diff --git a/newanalysis/functions/py_functions.c b/newanalysis/functions/py_functions.c index d3ef04d..43a577c 100644 --- a/newanalysis/functions/py_functions.c +++ b/newanalysis/functions/py_functions.c @@ -1,22 +1,51 @@ -/* Generated by Cython 0.29.34 */ +/* Generated by Cython 3.0.2 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "name": "newanalysis.functions", + "sources": [ + "newanalysis/functions/py_functions.py" + ] + }, + "module_name": "newanalysis.functions" +} +END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_34" -#define CYTHON_HEX_VERSION 0x001D22F0 -#define CYTHON_FUTURE_DIVISION 0 +#if CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" +#else +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_2" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030002F0 +#define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -35,9 +64,7 @@ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -45,13 +72,19 @@ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -76,10 +109,19 @@ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS @@ -89,44 +131,121 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK @@ -136,8 +255,9 @@ #endif #elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 @@ -181,16 +301,17 @@ #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -199,11 +320,8 @@ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5) + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 @@ -226,29 +344,47 @@ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) + #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) #endif - #if PY_VERSION_HEX >= 0x030B00A4 + #if PY_VERSION_HEX < 0x030700A3 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 @@ -257,6 +393,10 @@ #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -285,6 +425,17 @@ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -298,13 +449,16 @@ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -312,28 +466,59 @@ # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -343,13 +528,26 @@ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef CYTHON_INLINE #if defined(__clang__) @@ -365,85 +563,143 @@ #endif #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + PyObject *version_info; // borrowed + PyObject *py_minor_version = NULL; + long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; + #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 + minor_version = 11; // we don't yet need to distinguish between versions > 11 + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); } - end: - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(call_result); - Py_XDECREF(empty); + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + Py_XDECREF(py_minor_version); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here + if (!empty_bytes) return NULL; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -457,6 +713,12 @@ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -471,30 +733,53 @@ #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -503,6 +788,22 @@ #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -533,6 +834,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -545,12 +868,69 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) +#else + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) @@ -561,10 +941,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else @@ -582,11 +962,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -597,14 +977,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -633,8 +1019,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -644,15 +1036,33 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif #if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -664,6 +1074,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -681,11 +1094,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -730,7 +1138,16 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -809,9 +1226,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -819,11 +1236,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -849,7 +1277,52 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -871,7 +1344,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -936,24 +1409,26 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { - "src/functions/py_functions.py", + "newanalysis/functions/py_functions.py", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -962,11 +1437,11 @@ static const char *__pyx_f[] = { #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -976,28 +1451,40 @@ static const char *__pyx_f[] = { #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1008,6 +1495,10 @@ static const char *__pyx_f[] = { #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1019,26 +1510,140 @@ static const char *__pyx_f[] = { #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#else + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) +#endif +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) + #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) +#else + #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op + #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs + #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS + #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) + #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, + const char* function_name); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* DictGetItem.proto */ @@ -1053,21 +1658,10 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #endif /* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) @@ -1079,14 +1673,6 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) @@ -1193,49 +1779,39 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); -/* ObjectGetItem.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); -#else -#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif -#if CYTHON_FAST_PYCALL - static size_t __pyx_pyframe_localsplus_offset = 0; +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL +#endif +#endif #endif /* PyObjectCallMethO.proto */ @@ -1243,9 +1819,20 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); + /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); @@ -1269,41 +1856,102 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - /* PyDictContains.proto */ static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { int result = PyDict_Contains(dict, item); return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); #endif +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + /* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + typesModule = PyImport_ImportModule("types"); + if (!typesModule) return NULL; + methodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + if (!methodType) return NULL; + result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); + Py_DECREF(methodType); + return result; +} +#elif PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif /* CythonFunctionShared.proto */ -#define __Pyx_CyFunction_USED 1 +#define __Pyx_CyFunction_USED #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 PyCFunctionObject func; -#if PY_VERSION_HEX < 0x030500A0 +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_weakreflist; #endif PyObject *func_dict; @@ -1313,7 +1961,9 @@ typedef struct { PyObject *func_globals; PyObject *func_code; PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_classobj; +#endif void *defaults; int defaults_pyobjects; size_t defaults_size; // used by FusedFunction for copying defaults @@ -1322,14 +1972,17 @@ typedef struct { PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; + PyObject *func_is_coroutine; } __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *self, + PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, size_t size, int pyobjects); @@ -1339,7 +1992,18 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); -static int __pyx_CyFunction_init(void); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif /* CythonFunction.proto */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, @@ -1348,31 +2012,6 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, PyObject *module, PyObject *globals, PyObject* code); -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1381,6 +2020,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -1394,28 +2034,32 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif -/* Print.proto */ -static int __Pyx_Print(PyObject*, PyObject *, int); -#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 -static PyObject* __pyx_print = 0; -static PyObject* __pyx_print_kwargs = 0; -#endif - /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); -/* PrintOne.proto */ -static int __Pyx_PrintOne(PyObject* stream, PyObject *o); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); @@ -1426,14 +2070,18 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) /* CheckBinaryVersion.proto */ @@ -1442,23 +2090,31 @@ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ -/* Module declarations from 'newanalysis.functions' */ +/* Module declarations from "newanalysis.functions" */ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "newanalysis.functions" extern int __pyx_module_is_main_newanalysis__functions; int __pyx_module_is_main_newanalysis__functions = 0; -/* Implementation of 'newanalysis.functions' */ +/* Implementation of "newanalysis.functions" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_KeyError; static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_print; +/* #### Code section: string_decls ### */ static const char __pyx_k_[] = ""; static const char __pyx_k_a[] = "a"; static const char __pyx_k_i[] = "i"; static const char __pyx_k_j[] = "j"; +static const char __pyx_k__2[] = "."; +static const char __pyx_k__6[] = "*"; +static const char __pyx_k__27[] = "?"; static const char __pyx_k_apr[] = "apr"; static const char __pyx_k_com[] = "com"; static const char __pyx_k_ctr[] = "ctr"; -static const char __pyx_k_end[] = "end"; static const char __pyx_k_f2c[] = "f2c"; static const char __pyx_k_idx[] = "idx"; static const char __pyx_k_rfa[] = "rfa"; @@ -1469,9 +2125,9 @@ static const char __pyx_k_vel[] = "vel"; static const char __pyx_k_AKMA[] = "AKMA"; static const char __pyx_k_axis[] = "axis"; static const char __pyx_k_coor[] = "coor"; -static const char __pyx_k_file[] = "file"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_name[] = "__name__"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_vels[] = "vels"; static const char __pyx_k_array[] = "array"; @@ -1522,6 +2178,9 @@ static const char __pyx_k_fine2coarse[] = "fine2coarse"; static const char __pyx_k_comByResidue[] = "comByResidue"; static const char __pyx_k_dipByResidue[] = "dipByResidue"; static const char __pyx_k_dipoleMoment[] = "dipoleMoment"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; +static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_center_of_mass[] = "center_of_mass"; static const char __pyx_k_get_velocities[] = "get_velocities"; static const char __pyx_k_atomsPerResidue[] = "atomsPerResidue"; @@ -1533,104 +2192,16 @@ static const char __pyx_k_calcTessellation[] = "calcTessellation"; static const char __pyx_k_newanalysis_voro[] = "newanalysis.voro"; static const char __pyx_k_residueFirstAtom[] = "residueFirstAtom"; static const char __pyx_k_ascontiguousarray[] = "ascontiguousarray"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_newanalysis_helpers[] = "newanalysis.helpers"; static const char __pyx_k_centerOfMassByResidue[] = "centerOfMassByResidue"; static const char __pyx_k_dipoleMomentByResidue[] = "dipoleMomentByResidue"; static const char __pyx_k_newanalysis_functions[] = "newanalysis.functions"; -static const char __pyx_k_src_functions_py_functions_py[] = "src/functions/py_functions.py"; static const char __pyx_k_Warning_apr_is_now_calculated_ea[] = "Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code"; static const char __pyx_k_Warning_rfa_is_now_calculated_ea[] = "Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code"; -static PyObject *__pyx_kp_s_; -static PyObject *__pyx_n_s_AKMA; -static PyObject *__pyx_n_s_KeyError; -static PyObject *__pyx_n_s_MDAnalysis_units; -static PyObject *__pyx_kp_s_Warning_apr_is_now_calculated_ea; -static PyObject *__pyx_kp_s_Warning_rfa_is_now_calculated_ea; -static PyObject *__pyx_n_s_a; -static PyObject *__pyx_n_s_apr; -static PyObject *__pyx_n_s_array; -static PyObject *__pyx_n_s_ascontiguousarray; -static PyObject *__pyx_n_s_astype; -static PyObject *__pyx_n_s_atoms; -static PyObject *__pyx_n_s_atomsPerResidue; -static PyObject *__pyx_n_s_axis; -static PyObject *__pyx_n_s_box_f2c; -static PyObject *__pyx_n_s_cache; -static PyObject *__pyx_n_s_calcTessellation; -static PyObject *__pyx_n_s_centerOfMassByResidue; -static PyObject *__pyx_n_s_center_of_mass; -static PyObject *__pyx_n_s_charges; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_com; -static PyObject *__pyx_n_s_comByResidue; -static PyObject *__pyx_n_s_coor; -static PyObject *__pyx_n_s_coord; -static PyObject *__pyx_n_s_core_sel; -static PyObject *__pyx_n_s_corelist; -static PyObject *__pyx_n_s_corelist_unique; -static PyObject *__pyx_n_s_ctr; -static PyObject *__pyx_n_s_curname; -static PyObject *__pyx_n_s_curnum; -static PyObject *__pyx_n_s_dimensions; -static PyObject *__pyx_n_s_dipByResidue; -static PyObject *__pyx_n_s_dipoleMoment; -static PyObject *__pyx_n_s_dipoleMomentByResidue; -static PyObject *__pyx_n_s_double; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_empty; -static PyObject *__pyx_n_s_end; -static PyObject *__pyx_n_s_f2c; -static PyObject *__pyx_n_s_face_areas; -static PyObject *__pyx_n_s_file; -static PyObject *__pyx_n_s_fine2coarse; -static PyObject *__pyx_n_s_float64; -static PyObject *__pyx_n_s_get_velocities; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_idx; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_indices; -static PyObject *__pyx_n_s_int32; -static PyObject *__pyx_n_s_j; -static PyObject *__pyx_n_s_kwargs; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_masses; -static PyObject *__pyx_n_s_maxshell; -static PyObject *__pyx_n_s_n_atoms; -static PyObject *__pyx_n_s_n_residues; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_newanalysis_functions; -static PyObject *__pyx_n_s_newanalysis_helpers; -static PyObject *__pyx_n_s_newanalysis_voro; -static PyObject *__pyx_n_s_newaxis; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_n_s_numres; -static PyObject *__pyx_n_s_positions; -static PyObject *__pyx_n_s_presname; -static PyObject *__pyx_n_s_presnum; -static PyObject *__pyx_n_s_print; -static PyObject *__pyx_n_s_prvname; -static PyObject *__pyx_n_s_prvnum; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_resid; -static PyObject *__pyx_n_s_residueFirstAtom; -static PyObject *__pyx_n_s_resname; -static PyObject *__pyx_n_s_resnum; -static PyObject *__pyx_n_s_rfa; -static PyObject *__pyx_n_s_running; -static PyObject *__pyx_n_s_sel; -static PyObject *__pyx_n_s_sel_f2c; -static PyObject *__pyx_kp_s_src_functions_py_functions_py; -static PyObject *__pyx_n_s_sum; -static PyObject *__pyx_n_s_sys; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_timeUnit_factor; -static PyObject *__pyx_n_s_universe; -static PyObject *__pyx_n_s_vel; -static PyObject *__pyx_n_s_velcomByResidue; -static PyObject *__pyx_n_s_vels; -static PyObject *__pyx_n_s_volumes; -static PyObject *__pyx_n_s_zeros; +static const char __pyx_k_newanalysis_functions_py_functio[] = "newanalysis/functions/py_functions.py"; +/* #### Code section: decls ### */ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sel, PyObject *__pyx_v_i); /* proto */ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sel, PyObject *__pyx_v_maxshell, PyObject *__pyx_v_core_sel, PyObject *__pyx_v_volumes, PyObject *__pyx_v_face_areas); /* proto */ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sel); /* proto */ @@ -1640,33 +2211,618 @@ static PyObject *__pyx_pf_11newanalysis_9functions_10dipoleMoment(CYTHON_UNUSED static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sel, PyObject *__pyx_v_kwargs); /* proto */ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sel, PyObject *__pyx_v_kwargs); /* proto */ static PyObject *__pyx_pf_11newanalysis_9functions_16get_velocities(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sel); /* proto */ -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_3; -static PyObject *__pyx_slice__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_codeobj__4; -static PyObject *__pyx_codeobj__7; -static PyObject *__pyx_codeobj__10; -static PyObject *__pyx_codeobj__12; -static PyObject *__pyx_codeobj__14; -static PyObject *__pyx_codeobj__16; -static PyObject *__pyx_codeobj__18; -static PyObject *__pyx_codeobj__20; -static PyObject *__pyx_codeobj__22; -/* Late includes */ - -/* "src/functions/py_functions.py":4 +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyObject *__pyx_kp_s_; + PyObject *__pyx_n_s_AKMA; + PyObject *__pyx_n_s_KeyError; + PyObject *__pyx_n_s_MDAnalysis_units; + PyObject *__pyx_kp_s_Warning_apr_is_now_calculated_ea; + PyObject *__pyx_kp_s_Warning_rfa_is_now_calculated_ea; + PyObject *__pyx_kp_u__2; + PyObject *__pyx_n_s__27; + PyObject *__pyx_n_s__6; + PyObject *__pyx_n_s_a; + PyObject *__pyx_n_s_apr; + PyObject *__pyx_n_s_array; + PyObject *__pyx_n_s_ascontiguousarray; + PyObject *__pyx_n_s_astype; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_atoms; + PyObject *__pyx_n_s_atomsPerResidue; + PyObject *__pyx_n_s_axis; + PyObject *__pyx_n_s_box_f2c; + PyObject *__pyx_n_s_cache; + PyObject *__pyx_n_s_calcTessellation; + PyObject *__pyx_n_s_centerOfMassByResidue; + PyObject *__pyx_n_s_center_of_mass; + PyObject *__pyx_n_s_charges; + PyObject *__pyx_n_s_class_getitem; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_com; + PyObject *__pyx_n_s_comByResidue; + PyObject *__pyx_n_s_coor; + PyObject *__pyx_n_s_coord; + PyObject *__pyx_n_s_core_sel; + PyObject *__pyx_n_s_corelist; + PyObject *__pyx_n_s_corelist_unique; + PyObject *__pyx_n_s_ctr; + PyObject *__pyx_n_s_curname; + PyObject *__pyx_n_s_curnum; + PyObject *__pyx_n_s_dimensions; + PyObject *__pyx_n_s_dipByResidue; + PyObject *__pyx_n_s_dipoleMoment; + PyObject *__pyx_n_s_dipoleMomentByResidue; + PyObject *__pyx_n_s_double; + PyObject *__pyx_n_s_dtype; + PyObject *__pyx_n_s_empty; + PyObject *__pyx_n_s_f2c; + PyObject *__pyx_n_s_face_areas; + PyObject *__pyx_n_s_fine2coarse; + PyObject *__pyx_n_s_float64; + PyObject *__pyx_n_s_get_velocities; + PyObject *__pyx_n_s_i; + PyObject *__pyx_n_s_idx; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_indices; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_int32; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_n_s_j; + PyObject *__pyx_n_s_kwargs; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_masses; + PyObject *__pyx_n_s_maxshell; + PyObject *__pyx_n_s_n_atoms; + PyObject *__pyx_n_s_n_residues; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_newanalysis_functions; + PyObject *__pyx_kp_s_newanalysis_functions_py_functio; + PyObject *__pyx_n_s_newanalysis_helpers; + PyObject *__pyx_n_s_newanalysis_voro; + PyObject *__pyx_n_s_newaxis; + PyObject *__pyx_n_s_numpy; + PyObject *__pyx_n_s_numres; + PyObject *__pyx_n_s_positions; + PyObject *__pyx_n_s_presname; + PyObject *__pyx_n_s_presnum; + PyObject *__pyx_n_s_print; + PyObject *__pyx_n_s_prvname; + PyObject *__pyx_n_s_prvnum; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_resid; + PyObject *__pyx_n_s_residueFirstAtom; + PyObject *__pyx_n_s_resname; + PyObject *__pyx_n_s_resnum; + PyObject *__pyx_n_s_rfa; + PyObject *__pyx_n_s_running; + PyObject *__pyx_n_s_sel; + PyObject *__pyx_n_s_sel_f2c; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_sum; + PyObject *__pyx_n_s_sys; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_timeUnit_factor; + PyObject *__pyx_n_s_universe; + PyObject *__pyx_n_s_vel; + PyObject *__pyx_n_s_velcomByResidue; + PyObject *__pyx_n_s_vels; + PyObject *__pyx_n_s_volumes; + PyObject *__pyx_n_s_zeros; + PyObject *__pyx_int_0; + PyObject *__pyx_int_1; + PyObject *__pyx_int_3; + PyObject *__pyx_slice__5; + PyObject *__pyx_tuple__3; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__7; + PyObject *__pyx_tuple__9; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__12; + PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__15; + PyObject *__pyx_tuple__17; + PyObject *__pyx_tuple__19; + PyObject *__pyx_tuple__21; + PyObject *__pyx_tuple__23; + PyObject *__pyx_tuple__25; + PyObject *__pyx_codeobj__8; + PyObject *__pyx_codeobj__11; + PyObject *__pyx_codeobj__14; + PyObject *__pyx_codeobj__16; + PyObject *__pyx_codeobj__18; + PyObject *__pyx_codeobj__20; + PyObject *__pyx_codeobj__22; + PyObject *__pyx_codeobj__24; + PyObject *__pyx_codeobj__26; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) + +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_kp_s_); + Py_CLEAR(clear_module_state->__pyx_n_s_AKMA); + Py_CLEAR(clear_module_state->__pyx_n_s_KeyError); + Py_CLEAR(clear_module_state->__pyx_n_s_MDAnalysis_units); + Py_CLEAR(clear_module_state->__pyx_kp_s_Warning_apr_is_now_calculated_ea); + Py_CLEAR(clear_module_state->__pyx_kp_s_Warning_rfa_is_now_calculated_ea); + Py_CLEAR(clear_module_state->__pyx_kp_u__2); + Py_CLEAR(clear_module_state->__pyx_n_s__27); + Py_CLEAR(clear_module_state->__pyx_n_s__6); + Py_CLEAR(clear_module_state->__pyx_n_s_a); + Py_CLEAR(clear_module_state->__pyx_n_s_apr); + Py_CLEAR(clear_module_state->__pyx_n_s_array); + Py_CLEAR(clear_module_state->__pyx_n_s_ascontiguousarray); + Py_CLEAR(clear_module_state->__pyx_n_s_astype); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_atoms); + Py_CLEAR(clear_module_state->__pyx_n_s_atomsPerResidue); + Py_CLEAR(clear_module_state->__pyx_n_s_axis); + Py_CLEAR(clear_module_state->__pyx_n_s_box_f2c); + Py_CLEAR(clear_module_state->__pyx_n_s_cache); + Py_CLEAR(clear_module_state->__pyx_n_s_calcTessellation); + Py_CLEAR(clear_module_state->__pyx_n_s_centerOfMassByResidue); + Py_CLEAR(clear_module_state->__pyx_n_s_center_of_mass); + Py_CLEAR(clear_module_state->__pyx_n_s_charges); + Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_com); + Py_CLEAR(clear_module_state->__pyx_n_s_comByResidue); + Py_CLEAR(clear_module_state->__pyx_n_s_coor); + Py_CLEAR(clear_module_state->__pyx_n_s_coord); + Py_CLEAR(clear_module_state->__pyx_n_s_core_sel); + Py_CLEAR(clear_module_state->__pyx_n_s_corelist); + Py_CLEAR(clear_module_state->__pyx_n_s_corelist_unique); + Py_CLEAR(clear_module_state->__pyx_n_s_ctr); + Py_CLEAR(clear_module_state->__pyx_n_s_curname); + Py_CLEAR(clear_module_state->__pyx_n_s_curnum); + Py_CLEAR(clear_module_state->__pyx_n_s_dimensions); + Py_CLEAR(clear_module_state->__pyx_n_s_dipByResidue); + Py_CLEAR(clear_module_state->__pyx_n_s_dipoleMoment); + Py_CLEAR(clear_module_state->__pyx_n_s_dipoleMomentByResidue); + Py_CLEAR(clear_module_state->__pyx_n_s_double); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_empty); + Py_CLEAR(clear_module_state->__pyx_n_s_f2c); + Py_CLEAR(clear_module_state->__pyx_n_s_face_areas); + Py_CLEAR(clear_module_state->__pyx_n_s_fine2coarse); + Py_CLEAR(clear_module_state->__pyx_n_s_float64); + Py_CLEAR(clear_module_state->__pyx_n_s_get_velocities); + Py_CLEAR(clear_module_state->__pyx_n_s_i); + Py_CLEAR(clear_module_state->__pyx_n_s_idx); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_indices); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_int32); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_n_s_j); + Py_CLEAR(clear_module_state->__pyx_n_s_kwargs); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_masses); + Py_CLEAR(clear_module_state->__pyx_n_s_maxshell); + Py_CLEAR(clear_module_state->__pyx_n_s_n_atoms); + Py_CLEAR(clear_module_state->__pyx_n_s_n_residues); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_newanalysis_functions); + Py_CLEAR(clear_module_state->__pyx_kp_s_newanalysis_functions_py_functio); + Py_CLEAR(clear_module_state->__pyx_n_s_newanalysis_helpers); + Py_CLEAR(clear_module_state->__pyx_n_s_newanalysis_voro); + Py_CLEAR(clear_module_state->__pyx_n_s_newaxis); + Py_CLEAR(clear_module_state->__pyx_n_s_numpy); + Py_CLEAR(clear_module_state->__pyx_n_s_numres); + Py_CLEAR(clear_module_state->__pyx_n_s_positions); + Py_CLEAR(clear_module_state->__pyx_n_s_presname); + Py_CLEAR(clear_module_state->__pyx_n_s_presnum); + Py_CLEAR(clear_module_state->__pyx_n_s_print); + Py_CLEAR(clear_module_state->__pyx_n_s_prvname); + Py_CLEAR(clear_module_state->__pyx_n_s_prvnum); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_resid); + Py_CLEAR(clear_module_state->__pyx_n_s_residueFirstAtom); + Py_CLEAR(clear_module_state->__pyx_n_s_resname); + Py_CLEAR(clear_module_state->__pyx_n_s_resnum); + Py_CLEAR(clear_module_state->__pyx_n_s_rfa); + Py_CLEAR(clear_module_state->__pyx_n_s_running); + Py_CLEAR(clear_module_state->__pyx_n_s_sel); + Py_CLEAR(clear_module_state->__pyx_n_s_sel_f2c); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_sum); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_timeUnit_factor); + Py_CLEAR(clear_module_state->__pyx_n_s_universe); + Py_CLEAR(clear_module_state->__pyx_n_s_vel); + Py_CLEAR(clear_module_state->__pyx_n_s_velcomByResidue); + Py_CLEAR(clear_module_state->__pyx_n_s_vels); + Py_CLEAR(clear_module_state->__pyx_n_s_volumes); + Py_CLEAR(clear_module_state->__pyx_n_s_zeros); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_3); + Py_CLEAR(clear_module_state->__pyx_slice__5); + Py_CLEAR(clear_module_state->__pyx_tuple__3); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__7); + Py_CLEAR(clear_module_state->__pyx_tuple__9); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__17); + Py_CLEAR(clear_module_state->__pyx_tuple__19); + Py_CLEAR(clear_module_state->__pyx_tuple__21); + Py_CLEAR(clear_module_state->__pyx_tuple__23); + Py_CLEAR(clear_module_state->__pyx_tuple__25); + Py_CLEAR(clear_module_state->__pyx_codeobj__8); + Py_CLEAR(clear_module_state->__pyx_codeobj__11); + Py_CLEAR(clear_module_state->__pyx_codeobj__14); + Py_CLEAR(clear_module_state->__pyx_codeobj__16); + Py_CLEAR(clear_module_state->__pyx_codeobj__18); + Py_CLEAR(clear_module_state->__pyx_codeobj__20); + Py_CLEAR(clear_module_state->__pyx_codeobj__22); + Py_CLEAR(clear_module_state->__pyx_codeobj__24); + Py_CLEAR(clear_module_state->__pyx_codeobj__26); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_kp_s_); + Py_VISIT(traverse_module_state->__pyx_n_s_AKMA); + Py_VISIT(traverse_module_state->__pyx_n_s_KeyError); + Py_VISIT(traverse_module_state->__pyx_n_s_MDAnalysis_units); + Py_VISIT(traverse_module_state->__pyx_kp_s_Warning_apr_is_now_calculated_ea); + Py_VISIT(traverse_module_state->__pyx_kp_s_Warning_rfa_is_now_calculated_ea); + Py_VISIT(traverse_module_state->__pyx_kp_u__2); + Py_VISIT(traverse_module_state->__pyx_n_s__27); + Py_VISIT(traverse_module_state->__pyx_n_s__6); + Py_VISIT(traverse_module_state->__pyx_n_s_a); + Py_VISIT(traverse_module_state->__pyx_n_s_apr); + Py_VISIT(traverse_module_state->__pyx_n_s_array); + Py_VISIT(traverse_module_state->__pyx_n_s_ascontiguousarray); + Py_VISIT(traverse_module_state->__pyx_n_s_astype); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_atoms); + Py_VISIT(traverse_module_state->__pyx_n_s_atomsPerResidue); + Py_VISIT(traverse_module_state->__pyx_n_s_axis); + Py_VISIT(traverse_module_state->__pyx_n_s_box_f2c); + Py_VISIT(traverse_module_state->__pyx_n_s_cache); + Py_VISIT(traverse_module_state->__pyx_n_s_calcTessellation); + Py_VISIT(traverse_module_state->__pyx_n_s_centerOfMassByResidue); + Py_VISIT(traverse_module_state->__pyx_n_s_center_of_mass); + Py_VISIT(traverse_module_state->__pyx_n_s_charges); + Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_com); + Py_VISIT(traverse_module_state->__pyx_n_s_comByResidue); + Py_VISIT(traverse_module_state->__pyx_n_s_coor); + Py_VISIT(traverse_module_state->__pyx_n_s_coord); + Py_VISIT(traverse_module_state->__pyx_n_s_core_sel); + Py_VISIT(traverse_module_state->__pyx_n_s_corelist); + Py_VISIT(traverse_module_state->__pyx_n_s_corelist_unique); + Py_VISIT(traverse_module_state->__pyx_n_s_ctr); + Py_VISIT(traverse_module_state->__pyx_n_s_curname); + Py_VISIT(traverse_module_state->__pyx_n_s_curnum); + Py_VISIT(traverse_module_state->__pyx_n_s_dimensions); + Py_VISIT(traverse_module_state->__pyx_n_s_dipByResidue); + Py_VISIT(traverse_module_state->__pyx_n_s_dipoleMoment); + Py_VISIT(traverse_module_state->__pyx_n_s_dipoleMomentByResidue); + Py_VISIT(traverse_module_state->__pyx_n_s_double); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_empty); + Py_VISIT(traverse_module_state->__pyx_n_s_f2c); + Py_VISIT(traverse_module_state->__pyx_n_s_face_areas); + Py_VISIT(traverse_module_state->__pyx_n_s_fine2coarse); + Py_VISIT(traverse_module_state->__pyx_n_s_float64); + Py_VISIT(traverse_module_state->__pyx_n_s_get_velocities); + Py_VISIT(traverse_module_state->__pyx_n_s_i); + Py_VISIT(traverse_module_state->__pyx_n_s_idx); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_indices); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_int32); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_n_s_j); + Py_VISIT(traverse_module_state->__pyx_n_s_kwargs); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_masses); + Py_VISIT(traverse_module_state->__pyx_n_s_maxshell); + Py_VISIT(traverse_module_state->__pyx_n_s_n_atoms); + Py_VISIT(traverse_module_state->__pyx_n_s_n_residues); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_newanalysis_functions); + Py_VISIT(traverse_module_state->__pyx_kp_s_newanalysis_functions_py_functio); + Py_VISIT(traverse_module_state->__pyx_n_s_newanalysis_helpers); + Py_VISIT(traverse_module_state->__pyx_n_s_newanalysis_voro); + Py_VISIT(traverse_module_state->__pyx_n_s_newaxis); + Py_VISIT(traverse_module_state->__pyx_n_s_numpy); + Py_VISIT(traverse_module_state->__pyx_n_s_numres); + Py_VISIT(traverse_module_state->__pyx_n_s_positions); + Py_VISIT(traverse_module_state->__pyx_n_s_presname); + Py_VISIT(traverse_module_state->__pyx_n_s_presnum); + Py_VISIT(traverse_module_state->__pyx_n_s_print); + Py_VISIT(traverse_module_state->__pyx_n_s_prvname); + Py_VISIT(traverse_module_state->__pyx_n_s_prvnum); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_resid); + Py_VISIT(traverse_module_state->__pyx_n_s_residueFirstAtom); + Py_VISIT(traverse_module_state->__pyx_n_s_resname); + Py_VISIT(traverse_module_state->__pyx_n_s_resnum); + Py_VISIT(traverse_module_state->__pyx_n_s_rfa); + Py_VISIT(traverse_module_state->__pyx_n_s_running); + Py_VISIT(traverse_module_state->__pyx_n_s_sel); + Py_VISIT(traverse_module_state->__pyx_n_s_sel_f2c); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_sum); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_timeUnit_factor); + Py_VISIT(traverse_module_state->__pyx_n_s_universe); + Py_VISIT(traverse_module_state->__pyx_n_s_vel); + Py_VISIT(traverse_module_state->__pyx_n_s_velcomByResidue); + Py_VISIT(traverse_module_state->__pyx_n_s_vels); + Py_VISIT(traverse_module_state->__pyx_n_s_volumes); + Py_VISIT(traverse_module_state->__pyx_n_s_zeros); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_3); + Py_VISIT(traverse_module_state->__pyx_slice__5); + Py_VISIT(traverse_module_state->__pyx_tuple__3); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__7); + Py_VISIT(traverse_module_state->__pyx_tuple__9); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__17); + Py_VISIT(traverse_module_state->__pyx_tuple__19); + Py_VISIT(traverse_module_state->__pyx_tuple__21); + Py_VISIT(traverse_module_state->__pyx_tuple__23); + Py_VISIT(traverse_module_state->__pyx_tuple__25); + Py_VISIT(traverse_module_state->__pyx_codeobj__8); + Py_VISIT(traverse_module_state->__pyx_codeobj__11); + Py_VISIT(traverse_module_state->__pyx_codeobj__14); + Py_VISIT(traverse_module_state->__pyx_codeobj__16); + Py_VISIT(traverse_module_state->__pyx_codeobj__18); + Py_VISIT(traverse_module_state->__pyx_codeobj__20); + Py_VISIT(traverse_module_state->__pyx_codeobj__22); + Py_VISIT(traverse_module_state->__pyx_codeobj__24); + Py_VISIT(traverse_module_state->__pyx_codeobj__26); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_kp_s_ __pyx_mstate_global->__pyx_kp_s_ +#define __pyx_n_s_AKMA __pyx_mstate_global->__pyx_n_s_AKMA +#define __pyx_n_s_KeyError __pyx_mstate_global->__pyx_n_s_KeyError +#define __pyx_n_s_MDAnalysis_units __pyx_mstate_global->__pyx_n_s_MDAnalysis_units +#define __pyx_kp_s_Warning_apr_is_now_calculated_ea __pyx_mstate_global->__pyx_kp_s_Warning_apr_is_now_calculated_ea +#define __pyx_kp_s_Warning_rfa_is_now_calculated_ea __pyx_mstate_global->__pyx_kp_s_Warning_rfa_is_now_calculated_ea +#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 +#define __pyx_n_s__27 __pyx_mstate_global->__pyx_n_s__27 +#define __pyx_n_s__6 __pyx_mstate_global->__pyx_n_s__6 +#define __pyx_n_s_a __pyx_mstate_global->__pyx_n_s_a +#define __pyx_n_s_apr __pyx_mstate_global->__pyx_n_s_apr +#define __pyx_n_s_array __pyx_mstate_global->__pyx_n_s_array +#define __pyx_n_s_ascontiguousarray __pyx_mstate_global->__pyx_n_s_ascontiguousarray +#define __pyx_n_s_astype __pyx_mstate_global->__pyx_n_s_astype +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_atoms __pyx_mstate_global->__pyx_n_s_atoms +#define __pyx_n_s_atomsPerResidue __pyx_mstate_global->__pyx_n_s_atomsPerResidue +#define __pyx_n_s_axis __pyx_mstate_global->__pyx_n_s_axis +#define __pyx_n_s_box_f2c __pyx_mstate_global->__pyx_n_s_box_f2c +#define __pyx_n_s_cache __pyx_mstate_global->__pyx_n_s_cache +#define __pyx_n_s_calcTessellation __pyx_mstate_global->__pyx_n_s_calcTessellation +#define __pyx_n_s_centerOfMassByResidue __pyx_mstate_global->__pyx_n_s_centerOfMassByResidue +#define __pyx_n_s_center_of_mass __pyx_mstate_global->__pyx_n_s_center_of_mass +#define __pyx_n_s_charges __pyx_mstate_global->__pyx_n_s_charges +#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_com __pyx_mstate_global->__pyx_n_s_com +#define __pyx_n_s_comByResidue __pyx_mstate_global->__pyx_n_s_comByResidue +#define __pyx_n_s_coor __pyx_mstate_global->__pyx_n_s_coor +#define __pyx_n_s_coord __pyx_mstate_global->__pyx_n_s_coord +#define __pyx_n_s_core_sel __pyx_mstate_global->__pyx_n_s_core_sel +#define __pyx_n_s_corelist __pyx_mstate_global->__pyx_n_s_corelist +#define __pyx_n_s_corelist_unique __pyx_mstate_global->__pyx_n_s_corelist_unique +#define __pyx_n_s_ctr __pyx_mstate_global->__pyx_n_s_ctr +#define __pyx_n_s_curname __pyx_mstate_global->__pyx_n_s_curname +#define __pyx_n_s_curnum __pyx_mstate_global->__pyx_n_s_curnum +#define __pyx_n_s_dimensions __pyx_mstate_global->__pyx_n_s_dimensions +#define __pyx_n_s_dipByResidue __pyx_mstate_global->__pyx_n_s_dipByResidue +#define __pyx_n_s_dipoleMoment __pyx_mstate_global->__pyx_n_s_dipoleMoment +#define __pyx_n_s_dipoleMomentByResidue __pyx_mstate_global->__pyx_n_s_dipoleMomentByResidue +#define __pyx_n_s_double __pyx_mstate_global->__pyx_n_s_double +#define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype +#define __pyx_n_s_empty __pyx_mstate_global->__pyx_n_s_empty +#define __pyx_n_s_f2c __pyx_mstate_global->__pyx_n_s_f2c +#define __pyx_n_s_face_areas __pyx_mstate_global->__pyx_n_s_face_areas +#define __pyx_n_s_fine2coarse __pyx_mstate_global->__pyx_n_s_fine2coarse +#define __pyx_n_s_float64 __pyx_mstate_global->__pyx_n_s_float64 +#define __pyx_n_s_get_velocities __pyx_mstate_global->__pyx_n_s_get_velocities +#define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i +#define __pyx_n_s_idx __pyx_mstate_global->__pyx_n_s_idx +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_indices __pyx_mstate_global->__pyx_n_s_indices +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_int32 __pyx_mstate_global->__pyx_n_s_int32 +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j +#define __pyx_n_s_kwargs __pyx_mstate_global->__pyx_n_s_kwargs +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_masses __pyx_mstate_global->__pyx_n_s_masses +#define __pyx_n_s_maxshell __pyx_mstate_global->__pyx_n_s_maxshell +#define __pyx_n_s_n_atoms __pyx_mstate_global->__pyx_n_s_n_atoms +#define __pyx_n_s_n_residues __pyx_mstate_global->__pyx_n_s_n_residues +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_newanalysis_functions __pyx_mstate_global->__pyx_n_s_newanalysis_functions +#define __pyx_kp_s_newanalysis_functions_py_functio __pyx_mstate_global->__pyx_kp_s_newanalysis_functions_py_functio +#define __pyx_n_s_newanalysis_helpers __pyx_mstate_global->__pyx_n_s_newanalysis_helpers +#define __pyx_n_s_newanalysis_voro __pyx_mstate_global->__pyx_n_s_newanalysis_voro +#define __pyx_n_s_newaxis __pyx_mstate_global->__pyx_n_s_newaxis +#define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy +#define __pyx_n_s_numres __pyx_mstate_global->__pyx_n_s_numres +#define __pyx_n_s_positions __pyx_mstate_global->__pyx_n_s_positions +#define __pyx_n_s_presname __pyx_mstate_global->__pyx_n_s_presname +#define __pyx_n_s_presnum __pyx_mstate_global->__pyx_n_s_presnum +#define __pyx_n_s_print __pyx_mstate_global->__pyx_n_s_print +#define __pyx_n_s_prvname __pyx_mstate_global->__pyx_n_s_prvname +#define __pyx_n_s_prvnum __pyx_mstate_global->__pyx_n_s_prvnum +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_resid __pyx_mstate_global->__pyx_n_s_resid +#define __pyx_n_s_residueFirstAtom __pyx_mstate_global->__pyx_n_s_residueFirstAtom +#define __pyx_n_s_resname __pyx_mstate_global->__pyx_n_s_resname +#define __pyx_n_s_resnum __pyx_mstate_global->__pyx_n_s_resnum +#define __pyx_n_s_rfa __pyx_mstate_global->__pyx_n_s_rfa +#define __pyx_n_s_running __pyx_mstate_global->__pyx_n_s_running +#define __pyx_n_s_sel __pyx_mstate_global->__pyx_n_s_sel +#define __pyx_n_s_sel_f2c __pyx_mstate_global->__pyx_n_s_sel_f2c +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_sum __pyx_mstate_global->__pyx_n_s_sum +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_timeUnit_factor __pyx_mstate_global->__pyx_n_s_timeUnit_factor +#define __pyx_n_s_universe __pyx_mstate_global->__pyx_n_s_universe +#define __pyx_n_s_vel __pyx_mstate_global->__pyx_n_s_vel +#define __pyx_n_s_velcomByResidue __pyx_mstate_global->__pyx_n_s_velcomByResidue +#define __pyx_n_s_vels __pyx_mstate_global->__pyx_n_s_vels +#define __pyx_n_s_volumes __pyx_mstate_global->__pyx_n_s_volumes +#define __pyx_n_s_zeros __pyx_mstate_global->__pyx_n_s_zeros +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3 +#define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5 +#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7 +#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 +#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 +#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 +#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23 +#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25 +#define __pyx_codeobj__8 __pyx_mstate_global->__pyx_codeobj__8 +#define __pyx_codeobj__11 __pyx_mstate_global->__pyx_codeobj__11 +#define __pyx_codeobj__14 __pyx_mstate_global->__pyx_codeobj__14 +#define __pyx_codeobj__16 __pyx_mstate_global->__pyx_codeobj__16 +#define __pyx_codeobj__18 __pyx_mstate_global->__pyx_codeobj__18 +#define __pyx_codeobj__20 __pyx_mstate_global->__pyx_codeobj__20 +#define __pyx_codeobj__22 __pyx_mstate_global->__pyx_codeobj__22 +#define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24 +#define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26 +/* #### Code section: module_code ### */ + +/* "newanalysis/functions/py_functions.py":4 * import sys * * def f2c(sel,i=None): # <<<<<<<<<<<<<< @@ -1675,52 +2831,82 @@ static PyObject *__pyx_codeobj__22; */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9functions_1f2c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_9functions_1f2c = {"f2c", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9functions_1f2c, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_9functions_1f2c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_11newanalysis_9functions_1f2c(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_9functions_1f2c = {"f2c", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9functions_1f2c, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_9functions_1f2c(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_sel = 0; PyObject *__pyx_v_i = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("f2c (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 4, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,&__pyx_n_s_i,0}; - PyObject* values[2] = {0,0}; - values[1] = ((PyObject *)((PyObject *)Py_None)); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,&__pyx_n_s_i,0}; + values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i); - if (value) { values[1] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_i); + if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "f2c") < 0)) __PYX_ERR(0, 4, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "f2c") < 0)) __PYX_ERR(0, 4, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -1730,8 +2916,15 @@ static PyObject *__pyx_pw_11newanalysis_9functions_1f2c(PyObject *__pyx_self, Py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("f2c", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 4, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("f2c", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 4, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_AddTraceback("newanalysis.functions.f2c", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -1739,6 +2932,12 @@ static PyObject *__pyx_pw_11newanalysis_9functions_1f2c(PyObject *__pyx_self, Py __pyx_r = __pyx_pf_11newanalysis_9functions_f2c(__pyx_self, __pyx_v_sel, __pyx_v_i); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -1772,13 +2971,12 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ Py_ssize_t __pyx_t_14; PyObject *(*__pyx_t_15)(PyObject *); int __pyx_t_16; - int __pyx_t_17; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("f2c", 0); - /* "src/functions/py_functions.py":5 + /* "newanalysis/functions/py_functions.py":5 * * def f2c(sel,i=None): * if i!=None: # <<<<<<<<<<<<<< @@ -1786,11 +2984,11 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ * box_f2c = sel.universe.atoms._cache['f2c'] */ __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 5, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "src/functions/py_functions.py":6 + /* "newanalysis/functions/py_functions.py":6 * def f2c(sel,i=None): * if i!=None: * try: # <<<<<<<<<<<<<< @@ -1806,7 +3004,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { - /* "src/functions/py_functions.py":7 + /* "newanalysis/functions/py_functions.py":7 * if i!=None: * try: * box_f2c = sel.universe.atoms._cache['f2c'] # <<<<<<<<<<<<<< @@ -1827,7 +3025,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_v_box_f2c = __pyx_t_6; __pyx_t_6 = 0; - /* "src/functions/py_functions.py":6 + /* "newanalysis/functions/py_functions.py":6 * def f2c(sel,i=None): * if i!=None: * try: # <<<<<<<<<<<<<< @@ -1843,7 +3041,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/functions/py_functions.py":8 + /* "newanalysis/functions/py_functions.py":8 * try: * box_f2c = sel.universe.atoms._cache['f2c'] * except KeyError: # <<<<<<<<<<<<<< @@ -1854,11 +3052,11 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ if (__pyx_t_7) { __Pyx_AddTraceback("newanalysis.functions.f2c", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_8) < 0) __PYX_ERR(0, 8, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_8); - /* "src/functions/py_functions.py":9 + /* "newanalysis/functions/py_functions.py":9 * box_f2c = sel.universe.atoms._cache['f2c'] * except KeyError: * fine2coarse=numpy.empty(sel.universe.atoms.n_atoms,dtype=numpy.int32) # <<<<<<<<<<<<<< @@ -1881,7 +3079,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 9, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9)) __PYX_ERR(0, 9, __pyx_L6_except_error); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 9, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_9); @@ -1900,7 +3098,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_v_fine2coarse = __pyx_t_13; __pyx_t_13 = 0; - /* "src/functions/py_functions.py":10 + /* "newanalysis/functions/py_functions.py":10 * except KeyError: * fine2coarse=numpy.empty(sel.universe.atoms.n_atoms,dtype=numpy.int32) * running=0 # <<<<<<<<<<<<<< @@ -1910,7 +3108,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(__pyx_int_0); __pyx_v_running = __pyx_int_0; - /* "src/functions/py_functions.py":11 + /* "newanalysis/functions/py_functions.py":11 * fine2coarse=numpy.empty(sel.universe.atoms.n_atoms,dtype=numpy.int32) * running=0 * presname="" # <<<<<<<<<<<<<< @@ -1920,7 +3118,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(__pyx_kp_s_); __pyx_v_presname = __pyx_kp_s_; - /* "src/functions/py_functions.py":12 + /* "newanalysis/functions/py_functions.py":12 * running=0 * presname="" * presnum=1 # <<<<<<<<<<<<<< @@ -1930,7 +3128,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(__pyx_int_1); __pyx_v_presnum = __pyx_int_1; - /* "src/functions/py_functions.py":13 + /* "newanalysis/functions/py_functions.py":13 * presname="" * presnum=1 * ctr=0 # <<<<<<<<<<<<<< @@ -1940,7 +3138,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(__pyx_int_0); __pyx_v_ctr = __pyx_int_0; - /* "src/functions/py_functions.py":14 + /* "newanalysis/functions/py_functions.py":14 * presnum=1 * ctr=0 * for a in sel.universe.atoms: # <<<<<<<<<<<<<< @@ -1958,7 +3156,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ } else { __pyx_t_14 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 14, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_13); - __pyx_t_15 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 14, __pyx_L6_except_error) + __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_13); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 14, __pyx_L6_except_error) } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; for (;;) { @@ -1966,7 +3164,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ if (likely(PyList_CheckExact(__pyx_t_13))) { if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_13)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_14); __Pyx_INCREF(__pyx_t_9); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 14, __pyx_L6_except_error) + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_14); __Pyx_INCREF(__pyx_t_9); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 14, __pyx_L6_except_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_13, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 14, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_9); @@ -1974,7 +3172,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ } else { if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_13)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_14); __Pyx_INCREF(__pyx_t_9); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 14, __pyx_L6_except_error) + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_14); __Pyx_INCREF(__pyx_t_9); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 14, __pyx_L6_except_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_13, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 14, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_9); @@ -1995,7 +3193,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_9); __pyx_t_9 = 0; - /* "src/functions/py_functions.py":15 + /* "newanalysis/functions/py_functions.py":15 * ctr=0 * for a in sel.universe.atoms: * if a.resname not in presname or presnum != a.resnum: # <<<<<<<<<<<<<< @@ -2004,25 +3202,24 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ */ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s_resname); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 15, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_t_9, __pyx_v_presname, Py_NE)); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 15, __pyx_L6_except_error) + __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_t_9, __pyx_v_presname, Py_NE)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 15, __pyx_L6_except_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_17 = (__pyx_t_16 != 0); - if (!__pyx_t_17) { + if (!__pyx_t_16) { } else { - __pyx_t_2 = __pyx_t_17; + __pyx_t_2 = __pyx_t_16; goto __pyx_L15_bool_binop_done; } __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s_resnum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 15, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_11 = PyObject_RichCompare(__pyx_v_presnum, __pyx_t_9, Py_NE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 15, __pyx_L6_except_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 15, __pyx_L6_except_error) + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 15, __pyx_L6_except_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_2 = __pyx_t_17; + __pyx_t_2 = __pyx_t_16; __pyx_L15_bool_binop_done:; if (__pyx_t_2) { - /* "src/functions/py_functions.py":16 + /* "newanalysis/functions/py_functions.py":16 * for a in sel.universe.atoms: * if a.resname not in presname or presnum != a.resnum: * running+=1 # <<<<<<<<<<<<<< @@ -2034,7 +3231,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_v_running, __pyx_t_11); __pyx_t_11 = 0; - /* "src/functions/py_functions.py":15 + /* "newanalysis/functions/py_functions.py":15 * ctr=0 * for a in sel.universe.atoms: * if a.resname not in presname or presnum != a.resnum: # <<<<<<<<<<<<<< @@ -2043,7 +3240,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ */ } - /* "src/functions/py_functions.py":17 + /* "newanalysis/functions/py_functions.py":17 * if a.resname not in presname or presnum != a.resnum: * running+=1 * fine2coarse[ctr]=running-1 # <<<<<<<<<<<<<< @@ -2052,10 +3249,10 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ */ __pyx_t_11 = __Pyx_PyInt_SubtractObjC(__pyx_v_running, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 17, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_11); - if (unlikely(PyObject_SetItem(__pyx_v_fine2coarse, __pyx_v_ctr, __pyx_t_11) < 0)) __PYX_ERR(0, 17, __pyx_L6_except_error) + if (unlikely((PyObject_SetItem(__pyx_v_fine2coarse, __pyx_v_ctr, __pyx_t_11) < 0))) __PYX_ERR(0, 17, __pyx_L6_except_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "src/functions/py_functions.py":18 + /* "newanalysis/functions/py_functions.py":18 * running+=1 * fine2coarse[ctr]=running-1 * presname=a.resname # <<<<<<<<<<<<<< @@ -2067,7 +3264,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_v_presname, __pyx_t_11); __pyx_t_11 = 0; - /* "src/functions/py_functions.py":19 + /* "newanalysis/functions/py_functions.py":19 * fine2coarse[ctr]=running-1 * presname=a.resname * presnum=a.resnum # <<<<<<<<<<<<<< @@ -2079,7 +3276,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_v_presnum, __pyx_t_11); __pyx_t_11 = 0; - /* "src/functions/py_functions.py":20 + /* "newanalysis/functions/py_functions.py":20 * presname=a.resname * presnum=a.resnum * ctr+=1 # <<<<<<<<<<<<<< @@ -2091,7 +3288,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_v_ctr, __pyx_t_11); __pyx_t_11 = 0; - /* "src/functions/py_functions.py":14 + /* "newanalysis/functions/py_functions.py":14 * presnum=1 * ctr=0 * for a in sel.universe.atoms: # <<<<<<<<<<<<<< @@ -2101,7 +3298,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ } __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "src/functions/py_functions.py":21 + /* "newanalysis/functions/py_functions.py":21 * presnum=a.resnum * ctr+=1 * sel.universe.atoms._cache['f2c']=fine2coarse # <<<<<<<<<<<<<< @@ -2116,10 +3313,10 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_cache); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 21, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_13, __pyx_n_s_f2c, __pyx_v_fine2coarse) < 0)) __PYX_ERR(0, 21, __pyx_L6_except_error) + if (unlikely((PyObject_SetItem(__pyx_t_13, __pyx_n_s_f2c, __pyx_v_fine2coarse) < 0))) __PYX_ERR(0, 21, __pyx_L6_except_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "src/functions/py_functions.py":22 + /* "newanalysis/functions/py_functions.py":22 * ctr+=1 * sel.universe.atoms._cache['f2c']=fine2coarse * box_f2c = sel.universe.atoms._cache['f2c'] # <<<<<<<<<<<<<< @@ -2145,15 +3342,15 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ goto __pyx_L5_exception_handled; } goto __pyx_L6_except_error; - __pyx_L6_except_error:; - /* "src/functions/py_functions.py":6 + /* "newanalysis/functions/py_functions.py":6 * def f2c(sel,i=None): * if i!=None: * try: # <<<<<<<<<<<<<< * box_f2c = sel.universe.atoms._cache['f2c'] * except KeyError: */ + __pyx_L6_except_error:; __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); @@ -2167,7 +3364,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_L9_try_end:; } - /* "src/functions/py_functions.py":23 + /* "newanalysis/functions/py_functions.py":23 * sel.universe.atoms._cache['f2c']=fine2coarse * box_f2c = sel.universe.atoms._cache['f2c'] * return box_f2c[i] # <<<<<<<<<<<<<< @@ -2181,7 +3378,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_t_8 = 0; goto __pyx_L0; - /* "src/functions/py_functions.py":5 + /* "newanalysis/functions/py_functions.py":5 * * def f2c(sel,i=None): * if i!=None: # <<<<<<<<<<<<<< @@ -2190,7 +3387,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ */ } - /* "src/functions/py_functions.py":25 + /* "newanalysis/functions/py_functions.py":25 * return box_f2c[i] * else: * fine2coarse=numpy.empty(sel.universe.atoms.n_atoms,dtype=numpy.int32) # <<<<<<<<<<<<<< @@ -2214,7 +3411,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8)) __PYX_ERR(0, 25, __pyx_L1_error); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); @@ -2233,7 +3430,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_v_fine2coarse = __pyx_t_13; __pyx_t_13 = 0; - /* "src/functions/py_functions.py":26 + /* "newanalysis/functions/py_functions.py":26 * else: * fine2coarse=numpy.empty(sel.universe.atoms.n_atoms,dtype=numpy.int32) * running=0 # <<<<<<<<<<<<<< @@ -2243,7 +3440,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(__pyx_int_0); __pyx_v_running = __pyx_int_0; - /* "src/functions/py_functions.py":27 + /* "newanalysis/functions/py_functions.py":27 * fine2coarse=numpy.empty(sel.universe.atoms.n_atoms,dtype=numpy.int32) * running=0 * presname="" # <<<<<<<<<<<<<< @@ -2253,7 +3450,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(__pyx_kp_s_); __pyx_v_presname = __pyx_kp_s_; - /* "src/functions/py_functions.py":28 + /* "newanalysis/functions/py_functions.py":28 * running=0 * presname="" * presnum=1 # <<<<<<<<<<<<<< @@ -2263,7 +3460,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(__pyx_int_1); __pyx_v_presnum = __pyx_int_1; - /* "src/functions/py_functions.py":29 + /* "newanalysis/functions/py_functions.py":29 * presname="" * presnum=1 * ctr=0 # <<<<<<<<<<<<<< @@ -2273,7 +3470,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(__pyx_int_0); __pyx_v_ctr = __pyx_int_0; - /* "src/functions/py_functions.py":30 + /* "newanalysis/functions/py_functions.py":30 * presnum=1 * ctr=0 * for a in sel.universe.atoms.atoms: # <<<<<<<<<<<<<< @@ -2294,7 +3491,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ } else { __pyx_t_14 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 30, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; for (;;) { @@ -2302,7 +3499,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_13); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_13 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_13); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 30, __pyx_L1_error) #else __pyx_t_13 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); @@ -2310,7 +3507,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ } else { if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_13); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_13); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 30, __pyx_L1_error) #else __pyx_t_13 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); @@ -2331,7 +3528,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_13); __pyx_t_13 = 0; - /* "src/functions/py_functions.py":31 + /* "newanalysis/functions/py_functions.py":31 * ctr=0 * for a in sel.universe.atoms.atoms: * if a.resname not in presname or presnum != a.resnum: # <<<<<<<<<<<<<< @@ -2340,25 +3537,24 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ */ __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s_resname); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); - __pyx_t_17 = (__Pyx_PySequence_ContainsTF(__pyx_t_13, __pyx_v_presname, Py_NE)); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_t_13, __pyx_v_presname, Py_NE)); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_16 = (__pyx_t_17 != 0); if (!__pyx_t_16) { } else { __pyx_t_2 = __pyx_t_16; - goto __pyx_L20_bool_binop_done; + goto __pyx_L21_bool_binop_done; } __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s_resnum); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_6 = PyObject_RichCompare(__pyx_v_presnum, __pyx_t_13, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = __pyx_t_16; - __pyx_L20_bool_binop_done:; + __pyx_L21_bool_binop_done:; if (__pyx_t_2) { - /* "src/functions/py_functions.py":32 + /* "newanalysis/functions/py_functions.py":32 * for a in sel.universe.atoms.atoms: * if a.resname not in presname or presnum != a.resnum: * running+=1 # <<<<<<<<<<<<<< @@ -2370,7 +3566,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_v_running, __pyx_t_6); __pyx_t_6 = 0; - /* "src/functions/py_functions.py":31 + /* "newanalysis/functions/py_functions.py":31 * ctr=0 * for a in sel.universe.atoms.atoms: * if a.resname not in presname or presnum != a.resnum: # <<<<<<<<<<<<<< @@ -2379,7 +3575,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ */ } - /* "src/functions/py_functions.py":33 + /* "newanalysis/functions/py_functions.py":33 * if a.resname not in presname or presnum != a.resnum: * running+=1 * fine2coarse[ctr]=running-1 # <<<<<<<<<<<<<< @@ -2388,10 +3584,10 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ */ __pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_v_running, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (unlikely(PyObject_SetItem(__pyx_v_fine2coarse, __pyx_v_ctr, __pyx_t_6) < 0)) __PYX_ERR(0, 33, __pyx_L1_error) + if (unlikely((PyObject_SetItem(__pyx_v_fine2coarse, __pyx_v_ctr, __pyx_t_6) < 0))) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/functions/py_functions.py":34 + /* "newanalysis/functions/py_functions.py":34 * running+=1 * fine2coarse[ctr]=running-1 * presname=a.resname # <<<<<<<<<<<<<< @@ -2403,7 +3599,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_v_presname, __pyx_t_6); __pyx_t_6 = 0; - /* "src/functions/py_functions.py":35 + /* "newanalysis/functions/py_functions.py":35 * fine2coarse[ctr]=running-1 * presname=a.resname * presnum=a.resnum # <<<<<<<<<<<<<< @@ -2415,7 +3611,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_v_presnum, __pyx_t_6); __pyx_t_6 = 0; - /* "src/functions/py_functions.py":36 + /* "newanalysis/functions/py_functions.py":36 * presname=a.resname * presnum=a.resnum * ctr+=1 # <<<<<<<<<<<<<< @@ -2427,7 +3623,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_DECREF_SET(__pyx_v_ctr, __pyx_t_6); __pyx_t_6 = 0; - /* "src/functions/py_functions.py":30 + /* "newanalysis/functions/py_functions.py":30 * presnum=1 * ctr=0 * for a in sel.universe.atoms.atoms: # <<<<<<<<<<<<<< @@ -2437,7 +3633,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/functions/py_functions.py":37 + /* "newanalysis/functions/py_functions.py":37 * presnum=a.resnum * ctr+=1 * box_f2c = fine2coarse # <<<<<<<<<<<<<< @@ -2447,7 +3643,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_INCREF(__pyx_v_fine2coarse); __pyx_v_box_f2c = __pyx_v_fine2coarse; - /* "src/functions/py_functions.py":38 + /* "newanalysis/functions/py_functions.py":38 * ctr+=1 * box_f2c = fine2coarse * sel_f2c = numpy.zeros(sel.n_atoms,dtype=numpy.int32) # <<<<<<<<<<<<<< @@ -2464,7 +3660,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_8)) __PYX_ERR(0, 38, __pyx_L1_error); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); @@ -2483,7 +3679,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_v_sel_f2c = __pyx_t_11; __pyx_t_11 = 0; - /* "src/functions/py_functions.py":39 + /* "newanalysis/functions/py_functions.py":39 * box_f2c = fine2coarse * sel_f2c = numpy.zeros(sel.n_atoms,dtype=numpy.int32) * indices = sel.indices # <<<<<<<<<<<<<< @@ -2495,7 +3691,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_v_indices = __pyx_t_11; __pyx_t_11 = 0; - /* "src/functions/py_functions.py":40 + /* "newanalysis/functions/py_functions.py":40 * sel_f2c = numpy.zeros(sel.n_atoms,dtype=numpy.int32) * indices = sel.indices * for j in range(sel.n_atoms): # <<<<<<<<<<<<<< @@ -2513,7 +3709,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ } else { __pyx_t_14 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_15 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 40, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; for (;;) { @@ -2521,7 +3717,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ if (likely(PyList_CheckExact(__pyx_t_11))) { if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_11)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_14); __Pyx_INCREF(__pyx_t_8); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_14); __Pyx_INCREF(__pyx_t_8); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 40, __pyx_L1_error) #else __pyx_t_8 = PySequence_ITEM(__pyx_t_11, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); @@ -2529,7 +3725,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ } else { if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_11)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_14); __Pyx_INCREF(__pyx_t_8); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_14); __Pyx_INCREF(__pyx_t_8); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 40, __pyx_L1_error) #else __pyx_t_8 = PySequence_ITEM(__pyx_t_11, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); @@ -2550,7 +3746,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_8); __pyx_t_8 = 0; - /* "src/functions/py_functions.py":41 + /* "newanalysis/functions/py_functions.py":41 * indices = sel.indices * for j in range(sel.n_atoms): * sel_f2c[i] = box_f2c[indices[i]] # <<<<<<<<<<<<<< @@ -2562,10 +3758,10 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_box_f2c, __pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_sel_f2c, __pyx_v_i, __pyx_t_13) < 0)) __PYX_ERR(0, 41, __pyx_L1_error) + if (unlikely((PyObject_SetItem(__pyx_v_sel_f2c, __pyx_v_i, __pyx_t_13) < 0))) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "src/functions/py_functions.py":40 + /* "newanalysis/functions/py_functions.py":40 * sel_f2c = numpy.zeros(sel.n_atoms,dtype=numpy.int32) * indices = sel.indices * for j in range(sel.n_atoms): # <<<<<<<<<<<<<< @@ -2575,7 +3771,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "src/functions/py_functions.py":42 + /* "newanalysis/functions/py_functions.py":42 * for j in range(sel.n_atoms): * sel_f2c[i] = box_f2c[indices[i]] * return sel_f2c # <<<<<<<<<<<<<< @@ -2588,7 +3784,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ goto __pyx_L0; } - /* "src/functions/py_functions.py":4 + /* "newanalysis/functions/py_functions.py":4 * import sys * * def f2c(sel,i=None): # <<<<<<<<<<<<<< @@ -2624,7 +3820,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "src/functions/py_functions.py":45 +/* "newanalysis/functions/py_functions.py":45 * * * def calcTessellation(sel,maxshell=3,core_sel=None,volumes=None,face_areas=None): # <<<<<<<<<<<<<< @@ -2633,89 +3829,122 @@ static PyObject *__pyx_pf_11newanalysis_9functions_f2c(CYTHON_UNUSED PyObject *_ */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9functions_3calcTessellation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9functions_2calcTessellation[] = "\n Calculates the Voronoi tessellation of the whole box with the current AtomGroup as the core selection and returns the Delaunay distance matrix.\n \n Arguments:\n \tmaxshell:\tMaximum shell to calculate (default is 3)\n \tcore_sel:\tAtomGroup object of core selection (default is self)\n \tvolumes:\t1-dim numpy.float64 array for cell volume calculation (only together with face_areas!)\n \tface_areas:\t2-dim numpy.float64 array for surface area calculation (only together with volumes!)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9functions_3calcTessellation = {"calcTessellation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9functions_3calcTessellation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9functions_2calcTessellation}; -static PyObject *__pyx_pw_11newanalysis_9functions_3calcTessellation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_11newanalysis_9functions_3calcTessellation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9functions_2calcTessellation, "\n Calculates the Voronoi tessellation of the whole box with the current AtomGroup as the core selection and returns the Delaunay distance matrix.\n \n Arguments:\n \tmaxshell:\tMaximum shell to calculate (default is 3)\n \tcore_sel:\tAtomGroup object of core selection (default is self)\n \tvolumes:\t1-dim numpy.float64 array for cell volume calculation (only together with face_areas!)\n \tface_areas:\t2-dim numpy.float64 array for surface area calculation (only together with volumes!)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9functions_3calcTessellation = {"calcTessellation", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9functions_3calcTessellation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9functions_2calcTessellation}; +static PyObject *__pyx_pw_11newanalysis_9functions_3calcTessellation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_sel = 0; PyObject *__pyx_v_maxshell = 0; PyObject *__pyx_v_core_sel = 0; PyObject *__pyx_v_volumes = 0; PyObject *__pyx_v_face_areas = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calcTessellation (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 45, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,&__pyx_n_s_maxshell,&__pyx_n_s_core_sel,&__pyx_n_s_volumes,&__pyx_n_s_face_areas,0}; - PyObject* values[5] = {0,0,0,0,0}; - values[1] = ((PyObject *)((PyObject *)__pyx_int_3)); - values[2] = ((PyObject *)((PyObject *)Py_None)); - values[3] = ((PyObject *)((PyObject *)Py_None)); - values[4] = ((PyObject *)((PyObject *)Py_None)); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,&__pyx_n_s_maxshell,&__pyx_n_s_core_sel,&__pyx_n_s_volumes,&__pyx_n_s_face_areas,0}; + values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_3))); + values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell); - if (value) { values[1] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell); + if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_core_sel); - if (value) { values[2] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_core_sel); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_volumes); - if (value) { values[3] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_volumes); + if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_face_areas); - if (value) { values[4] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_face_areas); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcTessellation") < 0)) __PYX_ERR(0, 45, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcTessellation") < 0)) __PYX_ERR(0, 45, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -2728,8 +3957,15 @@ static PyObject *__pyx_pw_11newanalysis_9functions_3calcTessellation(PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 45, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 1, 5, __pyx_nargs); __PYX_ERR(0, 45, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_AddTraceback("newanalysis.functions.calcTessellation", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -2737,6 +3973,12 @@ static PyObject *__pyx_pw_11newanalysis_9functions_3calcTessellation(PyObject *_ __pyx_r = __pyx_pf_11newanalysis_9functions_2calcTessellation(__pyx_self, __pyx_v_sel, __pyx_v_maxshell, __pyx_v_core_sel, __pyx_v_volumes, __pyx_v_face_areas); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -2745,30 +3987,28 @@ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUS PyObject *__pyx_v_calcTessellation = NULL; PyObject *__pyx_v_corelist = NULL; PyObject *__pyx_v_corelist_unique = NULL; - PyObject *__pyx_v_i = NULL; + PyObject *__pyx_7genexpr__pyx_v_i = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("calcTessellation", 0); __Pyx_INCREF(__pyx_v_core_sel); - /* "src/functions/py_functions.py":55 + /* "newanalysis/functions/py_functions.py":55 * \tface_areas:\t2-dim numpy.float64 array for surface area calculation (only together with volumes!) * """ * from newanalysis.voro import calcTessellation # <<<<<<<<<<<<<< @@ -2779,8 +4019,8 @@ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUS __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_calcTessellation); __Pyx_GIVEREF(__pyx_n_s_calcTessellation); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_calcTessellation); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_newanalysis_voro, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_calcTessellation)) __PYX_ERR(0, 55, __pyx_L1_error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_newanalysis_voro, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_calcTessellation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) @@ -2790,7 +4030,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUS __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":56 + /* "newanalysis/functions/py_functions.py":56 * """ * from newanalysis.voro import calcTessellation * if core_sel is None: # <<<<<<<<<<<<<< @@ -2798,10 +4038,9 @@ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUS * */ __pyx_t_3 = (__pyx_v_core_sel == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + if (__pyx_t_3) { - /* "src/functions/py_functions.py":57 + /* "newanalysis/functions/py_functions.py":57 * from newanalysis.voro import calcTessellation * if core_sel is None: * core_sel = sel # <<<<<<<<<<<<<< @@ -2811,7 +4050,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUS __Pyx_INCREF(__pyx_v_sel); __Pyx_DECREF_SET(__pyx_v_core_sel, __pyx_v_sel); - /* "src/functions/py_functions.py":56 + /* "newanalysis/functions/py_functions.py":56 * """ * from newanalysis.voro import calcTessellation * if core_sel is None: # <<<<<<<<<<<<<< @@ -2820,121 +4059,105 @@ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUS */ } - /* "src/functions/py_functions.py":59 + /* "newanalysis/functions/py_functions.py":59 * core_sel = sel * * corelist=[f2c(sel.universe.atoms,i) for i in core_sel.indices] # <<<<<<<<<<<<<< * corelist_unique=numpy.array(list(set(corelist)),dtype=numpy.int32) * */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_core_sel, __pyx_n_s_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 59, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_core_sel, __pyx_n_s_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L6_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 59, __pyx_L6_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 59, __pyx_L6_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 59, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_1 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 59, __pyx_L6_error) + } + break; + } __Pyx_GOTREF(__pyx_t_1); - #endif } - } else { - __pyx_t_1 = __pyx_t_7(__pyx_t_5); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_i, __pyx_t_1); + __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_f2c); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_universe); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 59, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_atoms); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 59, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_10 = 1; } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_f2c); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_universe); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_atoms); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_11 = 1; } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_10, __pyx_v_i}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_10, __pyx_v_i}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL; + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_t_9, __pyx_7genexpr__pyx_v_i}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_10, 2+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_10); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_i); - __pyx_t_10 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 59, __pyx_L6_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0; + goto __pyx_L10_exit_scope; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0; + goto __pyx_L1_error; + __pyx_L10_exit_scope:; + } /* exit inner scope */ __pyx_v_corelist = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":60 + /* "newanalysis/functions/py_functions.py":60 * * corelist=[f2c(sel.universe.atoms,i) for i in core_sel.indices] * corelist_unique=numpy.array(list(set(corelist)),dtype=numpy.int32) # <<<<<<<<<<<<<< @@ -2943,8 +4166,8 @@ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUS */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PySet_New(__pyx_v_corelist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -2954,26 +4177,26 @@ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUS __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_int32); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_12) < 0) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_numpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int32); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_corelist_unique = __pyx_t_12; - __pyx_t_12 = 0; + __pyx_v_corelist_unique = __pyx_t_9; + __pyx_t_9 = 0; - /* "src/functions/py_functions.py":62 + /* "newanalysis/functions/py_functions.py":62 * corelist_unique=numpy.array(list(set(corelist)),dtype=numpy.int32) * * return calcTessellation(sel.universe.atoms.positions.astype('float64'),sel.universe.coord.dimensions[0],f2c(sel.universe.atoms),sel.universe.atoms.n_atoms,sel.universe.atoms.n_residues,maxshell,corelist_unique,volumes,face_areas) # <<<<<<<<<<<<<< @@ -2983,162 +4206,127 @@ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUS __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_universe); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_atoms); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_atoms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_positions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_positions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_10 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_n_s_float64) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_float64); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_universe); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_coord); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_n_s_float64}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_universe); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_coord); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dimensions); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dimensions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_f2c); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_f2c); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_universe); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_universe); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_atoms); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_atoms); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_10 = 1; } } - __pyx_t_5 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_universe); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 62, __pyx_L1_error) + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_11}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_universe); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_atoms); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_n_atoms); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_universe); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_atoms); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_atoms); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_n_residues); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_n_atoms); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_universe); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_atoms); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_n_residues); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_INCREF(__pyx_v_calcTessellation); - __pyx_t_10 = __pyx_v_calcTessellation; __pyx_t_13 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_13); + __pyx_t_8 = __pyx_v_calcTessellation; __pyx_t_12 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - __pyx_t_11 = 1; + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_10 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[10] = {__pyx_t_13, __pyx_t_1, __pyx_t_2, __pyx_t_5, __pyx_t_8, __pyx_t_9, __pyx_v_maxshell, __pyx_v_corelist_unique, __pyx_v_volumes, __pyx_v_face_areas}; - __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 9+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[10] = {__pyx_t_13, __pyx_t_1, __pyx_t_2, __pyx_t_5, __pyx_t_8, __pyx_t_9, __pyx_v_maxshell, __pyx_v_corelist_unique, __pyx_v_volumes, __pyx_v_face_areas}; - __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 9+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_12); + #endif + { + PyObject *__pyx_callargs[10] = {__pyx_t_12, __pyx_t_1, __pyx_t_2, __pyx_t_4, __pyx_t_7, __pyx_t_11, __pyx_v_maxshell, __pyx_v_corelist_unique, __pyx_v_volumes, __pyx_v_face_areas}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 9+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_14 = PyTuple_New(9+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_11, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_11, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_11, __pyx_t_9); - __Pyx_INCREF(__pyx_v_maxshell); - __Pyx_GIVEREF(__pyx_v_maxshell); - PyTuple_SET_ITEM(__pyx_t_14, 5+__pyx_t_11, __pyx_v_maxshell); - __Pyx_INCREF(__pyx_v_corelist_unique); - __Pyx_GIVEREF(__pyx_v_corelist_unique); - PyTuple_SET_ITEM(__pyx_t_14, 6+__pyx_t_11, __pyx_v_corelist_unique); - __Pyx_INCREF(__pyx_v_volumes); - __Pyx_GIVEREF(__pyx_v_volumes); - PyTuple_SET_ITEM(__pyx_t_14, 7+__pyx_t_11, __pyx_v_volumes); - __Pyx_INCREF(__pyx_v_face_areas); - __Pyx_GIVEREF(__pyx_v_face_areas); - PyTuple_SET_ITEM(__pyx_t_14, 8+__pyx_t_11, __pyx_v_face_areas); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_5 = 0; - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_r = __pyx_t_12; - __pyx_t_12 = 0; + __pyx_r = __pyx_t_9; + __pyx_t_9 = 0; goto __pyx_L0; - /* "src/functions/py_functions.py":45 + /* "newanalysis/functions/py_functions.py":45 * * * def calcTessellation(sel,maxshell=3,core_sel=None,volumes=None,face_areas=None): # <<<<<<<<<<<<<< @@ -3150,27 +4338,26 @@ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUS __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); __Pyx_AddTraceback("newanalysis.functions.calcTessellation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_calcTessellation); __Pyx_XDECREF(__pyx_v_corelist); __Pyx_XDECREF(__pyx_v_corelist_unique); - __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __Pyx_XDECREF(__pyx_v_core_sel); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/functions/py_functions.py":64 +/* "newanalysis/functions/py_functions.py":64 * return calcTessellation(sel.universe.atoms.positions.astype('float64'),sel.universe.coord.dimensions[0],f2c(sel.universe.atoms),sel.universe.atoms.n_atoms,sel.universe.atoms.n_residues,maxshell,corelist_unique,volumes,face_areas) * * def atomsPerResidue(sel): # <<<<<<<<<<<<<< @@ -3179,15 +4366,97 @@ static PyObject *__pyx_pf_11newanalysis_9functions_2calcTessellation(CYTHON_UNUS */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9functions_5atomsPerResidue(PyObject *__pyx_self, PyObject *__pyx_v_sel); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_9functions_5atomsPerResidue = {"atomsPerResidue", (PyCFunction)__pyx_pw_11newanalysis_9functions_5atomsPerResidue, METH_O, 0}; -static PyObject *__pyx_pw_11newanalysis_9functions_5atomsPerResidue(PyObject *__pyx_self, PyObject *__pyx_v_sel) { +static PyObject *__pyx_pw_11newanalysis_9functions_5atomsPerResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_9functions_5atomsPerResidue = {"atomsPerResidue", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9functions_5atomsPerResidue, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_9functions_5atomsPerResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_sel = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("atomsPerResidue (wrapper)", 0); - __pyx_r = __pyx_pf_11newanalysis_9functions_4atomsPerResidue(__pyx_self, ((PyObject *)__pyx_v_sel)); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 64, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "atomsPerResidue") < 0)) __PYX_ERR(0, 64, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_sel = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("atomsPerResidue", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 64, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.functions.atomsPerResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9functions_4atomsPerResidue(__pyx_self, __pyx_v_sel); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -3216,7 +4485,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE int __pyx_clineno = 0; __Pyx_RefNannySetupContext("atomsPerResidue", 0); - /* "src/functions/py_functions.py":65 + /* "newanalysis/functions/py_functions.py":65 * * def atomsPerResidue(sel): * apr=numpy.zeros(sel.n_residues,dtype=numpy.int32) # <<<<<<<<<<<<<< @@ -3233,7 +4502,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -3252,7 +4521,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __pyx_v_apr = __pyx_t_5; __pyx_t_5 = 0; - /* "src/functions/py_functions.py":66 + /* "newanalysis/functions/py_functions.py":66 * def atomsPerResidue(sel): * apr=numpy.zeros(sel.n_residues,dtype=numpy.int32) * curnum=sel.atoms[0].resid # <<<<<<<<<<<<<< @@ -3270,7 +4539,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __pyx_v_curnum = __pyx_t_5; __pyx_t_5 = 0; - /* "src/functions/py_functions.py":67 + /* "newanalysis/functions/py_functions.py":67 * apr=numpy.zeros(sel.n_residues,dtype=numpy.int32) * curnum=sel.atoms[0].resid * prvnum=curnum # <<<<<<<<<<<<<< @@ -3280,7 +4549,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __Pyx_INCREF(__pyx_v_curnum); __pyx_v_prvnum = __pyx_v_curnum; - /* "src/functions/py_functions.py":68 + /* "newanalysis/functions/py_functions.py":68 * curnum=sel.atoms[0].resid * prvnum=curnum * curname=sel.atoms[0].resname # <<<<<<<<<<<<<< @@ -3298,7 +4567,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __pyx_v_curname = __pyx_t_5; __pyx_t_5 = 0; - /* "src/functions/py_functions.py":69 + /* "newanalysis/functions/py_functions.py":69 * prvnum=curnum * curname=sel.atoms[0].resname * prvname=curname # <<<<<<<<<<<<<< @@ -3308,7 +4577,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __Pyx_INCREF(__pyx_v_curname); __pyx_v_prvname = __pyx_v_curname; - /* "src/functions/py_functions.py":70 + /* "newanalysis/functions/py_functions.py":70 * curname=sel.atoms[0].resname * prvname=curname * idx=0 # <<<<<<<<<<<<<< @@ -3318,7 +4587,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __Pyx_INCREF(__pyx_int_0); __pyx_v_idx = __pyx_int_0; - /* "src/functions/py_functions.py":71 + /* "newanalysis/functions/py_functions.py":71 * prvname=curname * idx=0 * for i in range(sel.n_atoms): # <<<<<<<<<<<<<< @@ -3336,7 +4605,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE } else { __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 71, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -3344,7 +4613,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE if (likely(PyList_CheckExact(__pyx_t_5))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 71, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -3352,7 +4621,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 71, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -3373,7 +4642,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); __pyx_t_1 = 0; - /* "src/functions/py_functions.py":72 + /* "newanalysis/functions/py_functions.py":72 * idx=0 * for i in range(sel.n_atoms): * prvnum=curnum # <<<<<<<<<<<<<< @@ -3383,7 +4652,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __Pyx_INCREF(__pyx_v_curnum); __Pyx_DECREF_SET(__pyx_v_prvnum, __pyx_v_curnum); - /* "src/functions/py_functions.py":73 + /* "newanalysis/functions/py_functions.py":73 * for i in range(sel.n_atoms): * prvnum=curnum * curnum=sel.atoms[i].resid # <<<<<<<<<<<<<< @@ -3401,7 +4670,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __Pyx_DECREF_SET(__pyx_v_curnum, __pyx_t_1); __pyx_t_1 = 0; - /* "src/functions/py_functions.py":74 + /* "newanalysis/functions/py_functions.py":74 * prvnum=curnum * curnum=sel.atoms[i].resid * prvname=curname # <<<<<<<<<<<<<< @@ -3411,7 +4680,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __Pyx_INCREF(__pyx_v_curname); __Pyx_DECREF_SET(__pyx_v_prvname, __pyx_v_curname); - /* "src/functions/py_functions.py":75 + /* "newanalysis/functions/py_functions.py":75 * curnum=sel.atoms[i].resid * prvname=curname * curname=sel.atoms[i].resname # <<<<<<<<<<<<<< @@ -3429,7 +4698,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __Pyx_DECREF_SET(__pyx_v_curname, __pyx_t_1); __pyx_t_1 = 0; - /* "src/functions/py_functions.py":76 + /* "newanalysis/functions/py_functions.py":76 * prvname=curname * curname=sel.atoms[i].resname * if prvnum != curnum or prvname != curname: # <<<<<<<<<<<<<< @@ -3437,7 +4706,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE * apr[idx]+=1 */ __pyx_t_1 = PyObject_RichCompare(__pyx_v_prvnum, __pyx_v_curnum, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 76, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_9) { } else { @@ -3445,13 +4714,13 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE goto __pyx_L6_bool_binop_done; } __pyx_t_1 = PyObject_RichCompare(__pyx_v_prvname, __pyx_v_curname, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 76, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = __pyx_t_9; __pyx_L6_bool_binop_done:; if (__pyx_t_8) { - /* "src/functions/py_functions.py":77 + /* "newanalysis/functions/py_functions.py":77 * curname=sel.atoms[i].resname * if prvnum != curnum or prvname != curname: * idx+=1 # <<<<<<<<<<<<<< @@ -3463,7 +4732,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __Pyx_DECREF_SET(__pyx_v_idx, __pyx_t_1); __pyx_t_1 = 0; - /* "src/functions/py_functions.py":76 + /* "newanalysis/functions/py_functions.py":76 * prvname=curname * curname=sel.atoms[i].resname * if prvnum != curnum or prvname != curname: # <<<<<<<<<<<<<< @@ -3472,7 +4741,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE */ } - /* "src/functions/py_functions.py":78 + /* "newanalysis/functions/py_functions.py":78 * if prvnum != curnum or prvname != curname: * idx+=1 * apr[idx]+=1 # <<<<<<<<<<<<<< @@ -3486,11 +4755,11 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_apr, __pyx_t_1, __pyx_t_2) < 0)) __PYX_ERR(0, 78, __pyx_L1_error) + if (unlikely((PyObject_SetItem(__pyx_v_apr, __pyx_t_1, __pyx_t_2) < 0))) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/functions/py_functions.py":71 + /* "newanalysis/functions/py_functions.py":71 * prvname=curname * idx=0 * for i in range(sel.n_atoms): # <<<<<<<<<<<<<< @@ -3500,7 +4769,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/functions/py_functions.py":79 + /* "newanalysis/functions/py_functions.py":79 * idx+=1 * apr[idx]+=1 * return apr # <<<<<<<<<<<<<< @@ -3512,7 +4781,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE __pyx_r = __pyx_v_apr; goto __pyx_L0; - /* "src/functions/py_functions.py":64 + /* "newanalysis/functions/py_functions.py":64 * return calcTessellation(sel.universe.atoms.positions.astype('float64'),sel.universe.coord.dimensions[0],f2c(sel.universe.atoms),sel.universe.atoms.n_atoms,sel.universe.atoms.n_residues,maxshell,corelist_unique,volumes,face_areas) * * def atomsPerResidue(sel): # <<<<<<<<<<<<<< @@ -3542,7 +4811,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE return __pyx_r; } -/* "src/functions/py_functions.py":82 +/* "newanalysis/functions/py_functions.py":82 * * * def residueFirstAtom(sel): # <<<<<<<<<<<<<< @@ -3551,15 +4820,97 @@ static PyObject *__pyx_pf_11newanalysis_9functions_4atomsPerResidue(CYTHON_UNUSE */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9functions_7residueFirstAtom(PyObject *__pyx_self, PyObject *__pyx_v_sel); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_9functions_7residueFirstAtom = {"residueFirstAtom", (PyCFunction)__pyx_pw_11newanalysis_9functions_7residueFirstAtom, METH_O, 0}; -static PyObject *__pyx_pw_11newanalysis_9functions_7residueFirstAtom(PyObject *__pyx_self, PyObject *__pyx_v_sel) { +static PyObject *__pyx_pw_11newanalysis_9functions_7residueFirstAtom(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_9functions_7residueFirstAtom = {"residueFirstAtom", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9functions_7residueFirstAtom, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_9functions_7residueFirstAtom(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_sel = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("residueFirstAtom (wrapper)", 0); - __pyx_r = __pyx_pf_11newanalysis_9functions_6residueFirstAtom(__pyx_self, ((PyObject *)__pyx_v_sel)); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 82, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "residueFirstAtom") < 0)) __PYX_ERR(0, 82, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_sel = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("residueFirstAtom", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 82, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.functions.residueFirstAtom", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9functions_6residueFirstAtom(__pyx_self, __pyx_v_sel); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -3576,14 +4927,15 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("residueFirstAtom", 0); - /* "src/functions/py_functions.py":83 + /* "newanalysis/functions/py_functions.py":83 * * def residueFirstAtom(sel): * rfa=numpy.zeros(sel.n_residues,dtype=numpy.int32) # <<<<<<<<<<<<<< @@ -3600,7 +4952,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -3619,7 +4971,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS __pyx_v_rfa = __pyx_t_5; __pyx_t_5 = 0; - /* "src/functions/py_functions.py":84 + /* "newanalysis/functions/py_functions.py":84 * def residueFirstAtom(sel): * rfa=numpy.zeros(sel.n_residues,dtype=numpy.int32) * apr=atomsPerResidue(sel) # <<<<<<<<<<<<<< @@ -3629,24 +4981,31 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_atomsPerResidue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; } } - __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_sel) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sel); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_sel}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } __pyx_v_apr = __pyx_t_5; __pyx_t_5 = 0; - /* "src/functions/py_functions.py":85 + /* "newanalysis/functions/py_functions.py":85 * rfa=numpy.zeros(sel.n_residues,dtype=numpy.int32) * apr=atomsPerResidue(sel) * ctr=0 # <<<<<<<<<<<<<< @@ -3656,7 +5015,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS __Pyx_INCREF(__pyx_int_0); __pyx_v_ctr = __pyx_int_0; - /* "src/functions/py_functions.py":86 + /* "newanalysis/functions/py_functions.py":86 * apr=atomsPerResidue(sel) * ctr=0 * for i in range(sel.n_residues): # <<<<<<<<<<<<<< @@ -3669,35 +5028,35 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; - __pyx_t_7 = NULL; + __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = 0; + __pyx_t_8 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_7)) { + if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 86, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 86, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_1 = __pyx_t_7(__pyx_t_5); + __pyx_t_1 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { @@ -3711,16 +5070,16 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); __pyx_t_1 = 0; - /* "src/functions/py_functions.py":87 + /* "newanalysis/functions/py_functions.py":87 * ctr=0 * for i in range(sel.n_residues): * rfa[i]=ctr # <<<<<<<<<<<<<< * ctr+=apr[i] * return rfa */ - if (unlikely(PyObject_SetItem(__pyx_v_rfa, __pyx_v_i, __pyx_v_ctr) < 0)) __PYX_ERR(0, 87, __pyx_L1_error) + if (unlikely((PyObject_SetItem(__pyx_v_rfa, __pyx_v_i, __pyx_v_ctr) < 0))) __PYX_ERR(0, 87, __pyx_L1_error) - /* "src/functions/py_functions.py":88 + /* "newanalysis/functions/py_functions.py":88 * for i in range(sel.n_residues): * rfa[i]=ctr * ctr+=apr[i] # <<<<<<<<<<<<<< @@ -3735,7 +5094,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS __Pyx_DECREF_SET(__pyx_v_ctr, __pyx_t_3); __pyx_t_3 = 0; - /* "src/functions/py_functions.py":86 + /* "newanalysis/functions/py_functions.py":86 * apr=atomsPerResidue(sel) * ctr=0 * for i in range(sel.n_residues): # <<<<<<<<<<<<<< @@ -3745,7 +5104,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/functions/py_functions.py":89 + /* "newanalysis/functions/py_functions.py":89 * rfa[i]=ctr * ctr+=apr[i] * return rfa # <<<<<<<<<<<<<< @@ -3757,7 +5116,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS __pyx_r = __pyx_v_rfa; goto __pyx_L0; - /* "src/functions/py_functions.py":82 + /* "newanalysis/functions/py_functions.py":82 * * * def residueFirstAtom(sel): # <<<<<<<<<<<<<< @@ -3784,7 +5143,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS return __pyx_r; } -/* "src/functions/py_functions.py":91 +/* "newanalysis/functions/py_functions.py":91 * return rfa * * def centerOfMassByResidue(sel,**kwargs): # <<<<<<<<<<<<<< @@ -3793,52 +5152,88 @@ static PyObject *__pyx_pf_11newanalysis_9functions_6residueFirstAtom(CYTHON_UNUS */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9functions_9centerOfMassByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9functions_8centerOfMassByResidue[] = "Returns an array of the centers of mass of all residues in the current AtomGroup"; -static PyMethodDef __pyx_mdef_11newanalysis_9functions_9centerOfMassByResidue = {"centerOfMassByResidue", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9functions_9centerOfMassByResidue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9functions_8centerOfMassByResidue}; -static PyObject *__pyx_pw_11newanalysis_9functions_9centerOfMassByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_11newanalysis_9functions_9centerOfMassByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9functions_8centerOfMassByResidue, "Returns an array of the centers of mass of all residues in the current AtomGroup"); +static PyMethodDef __pyx_mdef_11newanalysis_9functions_9centerOfMassByResidue = {"centerOfMassByResidue", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9functions_9centerOfMassByResidue, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9functions_8centerOfMassByResidue}; +static PyObject *__pyx_pw_11newanalysis_9functions_9centerOfMassByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_sel = 0; PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("centerOfMassByResidue (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 91, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "centerOfMassByResidue") < 0)) __PYX_ERR(0, 91, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "centerOfMassByResidue") < 0)) __PYX_ERR(0, 91, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_sel = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("centerOfMassByResidue", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("centerOfMassByResidue", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 91, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("newanalysis.functions.centerOfMassByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3847,7 +5242,13 @@ static PyObject *__pyx_pw_11newanalysis_9functions_9centerOfMassByResidue(PyObje __pyx_r = __pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(__pyx_self, __pyx_v_sel, __pyx_v_kwargs); /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_DECREF(__pyx_v_kwargs); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -3864,16 +5265,15 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("centerOfMassByResidue", 0); - /* "src/functions/py_functions.py":93 + /* "newanalysis/functions/py_functions.py":93 * def centerOfMassByResidue(sel,**kwargs): * """Returns an array of the centers of mass of all residues in the current AtomGroup""" * from newanalysis.helpers import comByResidue # <<<<<<<<<<<<<< @@ -3884,8 +5284,8 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_comByResidue); __Pyx_GIVEREF(__pyx_n_s_comByResidue); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_comByResidue); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_newanalysis_helpers, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_comByResidue)) __PYX_ERR(0, 93, __pyx_L1_error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_newanalysis_helpers, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_comByResidue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) @@ -3895,18 +5295,17 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":94 + /* "newanalysis/functions/py_functions.py":94 * """Returns an array of the centers of mass of all residues in the current AtomGroup""" * from newanalysis.helpers import comByResidue * if not "coor" in kwargs: # <<<<<<<<<<<<<< * coor=sel.positions.astype('float64') * else: */ - __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_coor, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 94, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_coor, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 94, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/functions/py_functions.py":95 + /* "newanalysis/functions/py_functions.py":95 * from newanalysis.helpers import comByResidue * if not "coor" in kwargs: * coor=sel.positions.astype('float64') # <<<<<<<<<<<<<< @@ -3915,28 +5314,35 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_positions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_5 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_n_s_float64) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_float64); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_n_s_float64}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __pyx_v_coor = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":94 + /* "newanalysis/functions/py_functions.py":94 * """Returns an array of the centers of mass of all residues in the current AtomGroup""" * from newanalysis.helpers import comByResidue * if not "coor" in kwargs: # <<<<<<<<<<<<<< @@ -3946,7 +5352,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON goto __pyx_L3; } - /* "src/functions/py_functions.py":97 + /* "newanalysis/functions/py_functions.py":97 * coor=sel.positions.astype('float64') * else: * coor=kwargs["coor"] # <<<<<<<<<<<<<< @@ -3961,51 +5367,57 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON } __pyx_L3:; - /* "src/functions/py_functions.py":98 + /* "newanalysis/functions/py_functions.py":98 * else: * coor=kwargs["coor"] * if not "masses" in kwargs: # <<<<<<<<<<<<<< * masses = numpy.ascontiguousarray(sel.masses) * else: */ - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_masses, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 98, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_4 != 0); + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_masses, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 98, __pyx_L1_error) if (__pyx_t_3) { - /* "src/functions/py_functions.py":99 + /* "newanalysis/functions/py_functions.py":99 * coor=kwargs["coor"] * if not "masses" in kwargs: * masses = numpy.ascontiguousarray(sel.masses) # <<<<<<<<<<<<<< * else: * masses = kwargs["masses"] */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_masses); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_masses); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_5 = 1; } } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } __pyx_v_masses = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":98 + /* "newanalysis/functions/py_functions.py":98 * else: * coor=kwargs["coor"] * if not "masses" in kwargs: # <<<<<<<<<<<<<< @@ -4015,7 +5427,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON goto __pyx_L4; } - /* "src/functions/py_functions.py":101 + /* "newanalysis/functions/py_functions.py":101 * masses = numpy.ascontiguousarray(sel.masses) * else: * masses = kwargs["masses"] # <<<<<<<<<<<<<< @@ -4030,27 +5442,28 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON } __pyx_L4:; - /* "src/functions/py_functions.py":102 + /* "newanalysis/functions/py_functions.py":102 * else: * masses = kwargs["masses"] * if not "apr" in kwargs: # <<<<<<<<<<<<<< * print("Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code") * apr=atomsPerResidue(sel) */ - __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_apr, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 102, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_apr, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 102, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/functions/py_functions.py":103 + /* "newanalysis/functions/py_functions.py":103 * masses = kwargs["masses"] * if not "apr" in kwargs: * print("Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code") # <<<<<<<<<<<<<< * apr=atomsPerResidue(sel) * else: */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Warning_apr_is_now_calculated_ea) < 0) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":104 + /* "newanalysis/functions/py_functions.py":104 * if not "apr" in kwargs: * print("Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code") * apr=atomsPerResidue(sel) # <<<<<<<<<<<<<< @@ -4059,25 +5472,32 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_atomsPerResidue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_5 = 1; } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_sel) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sel); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_sel}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } __pyx_v_apr = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":102 + /* "newanalysis/functions/py_functions.py":102 * else: * masses = kwargs["masses"] * if not "apr" in kwargs: # <<<<<<<<<<<<<< @@ -4087,7 +5507,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON goto __pyx_L5; } - /* "src/functions/py_functions.py":106 + /* "newanalysis/functions/py_functions.py":106 * apr=atomsPerResidue(sel) * else: * apr = kwargs["apr"] # <<<<<<<<<<<<<< @@ -4102,27 +5522,28 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON } __pyx_L5:; - /* "src/functions/py_functions.py":107 + /* "newanalysis/functions/py_functions.py":107 * else: * apr = kwargs["apr"] * if not "rfa" in kwargs: # <<<<<<<<<<<<<< * print("Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code") * rfa=residueFirstAtom(sel) */ - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_rfa, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 107, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_4 != 0); + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_rfa, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 107, __pyx_L1_error) if (__pyx_t_3) { - /* "src/functions/py_functions.py":108 + /* "newanalysis/functions/py_functions.py":108 * apr = kwargs["apr"] * if not "rfa" in kwargs: * print("Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code") # <<<<<<<<<<<<<< * rfa=residueFirstAtom(sel) * else: */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Warning_rfa_is_now_calculated_ea) < 0) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":109 + /* "newanalysis/functions/py_functions.py":109 * if not "rfa" in kwargs: * print("Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code") * rfa=residueFirstAtom(sel) # <<<<<<<<<<<<<< @@ -4131,25 +5552,32 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_residueFirstAtom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_5 = 1; } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_sel) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sel); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_sel}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } __pyx_v_rfa = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":107 + /* "newanalysis/functions/py_functions.py":107 * else: * apr = kwargs["apr"] * if not "rfa" in kwargs: # <<<<<<<<<<<<<< @@ -4159,7 +5587,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON goto __pyx_L6; } - /* "src/functions/py_functions.py":111 + /* "newanalysis/functions/py_functions.py":111 * rfa=residueFirstAtom(sel) * else: * rfa = kwargs["rfa"] # <<<<<<<<<<<<<< @@ -4174,7 +5602,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON } __pyx_L6:; - /* "src/functions/py_functions.py":112 + /* "newanalysis/functions/py_functions.py":112 * else: * rfa = kwargs["rfa"] * numres = sel.n_residues # <<<<<<<<<<<<<< @@ -4186,7 +5614,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON __pyx_v_numres = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":114 + /* "newanalysis/functions/py_functions.py":114 * numres = sel.n_residues * * return comByResidue(coor,masses,numres,apr,rfa) # <<<<<<<<<<<<<< @@ -4195,65 +5623,33 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_comByResidue); - __pyx_t_1 = __pyx_v_comByResidue; __pyx_t_5 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { + __pyx_t_1 = __pyx_v_comByResidue; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_7 = 1; + __pyx_t_5 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_coor, __pyx_v_masses, __pyx_v_numres, __pyx_v_apr, __pyx_v_rfa}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_coor, __pyx_v_masses, __pyx_v_numres, __pyx_v_apr, __pyx_v_rfa}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else #endif { - __pyx_t_6 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_v_coor); - __Pyx_GIVEREF(__pyx_v_coor); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_coor); - __Pyx_INCREF(__pyx_v_masses); - __Pyx_GIVEREF(__pyx_v_masses); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_masses); - __Pyx_INCREF(__pyx_v_numres); - __Pyx_GIVEREF(__pyx_v_numres); - PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_numres); - __Pyx_INCREF(__pyx_v_apr); - __Pyx_GIVEREF(__pyx_v_apr); - PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_apr); - __Pyx_INCREF(__pyx_v_rfa); - __Pyx_GIVEREF(__pyx_v_rfa); - PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_rfa); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) + PyObject *__pyx_callargs[6] = {__pyx_t_4, __pyx_v_coor, __pyx_v_masses, __pyx_v_numres, __pyx_v_apr, __pyx_v_rfa}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 5+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "src/functions/py_functions.py":91 + /* "newanalysis/functions/py_functions.py":91 * return rfa * * def centerOfMassByResidue(sel,**kwargs): # <<<<<<<<<<<<<< @@ -4265,7 +5661,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("newanalysis.functions.centerOfMassByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; @@ -4281,7 +5677,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON return __pyx_r; } -/* "src/functions/py_functions.py":116 +/* "newanalysis/functions/py_functions.py":116 * return comByResidue(coor,masses,numres,apr,rfa) * * def dipoleMoment(sel): # <<<<<<<<<<<<<< @@ -4290,16 +5686,98 @@ static PyObject *__pyx_pf_11newanalysis_9functions_8centerOfMassByResidue(CYTHON */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9functions_11dipoleMoment(PyObject *__pyx_self, PyObject *__pyx_v_sel); /*proto*/ -static char __pyx_doc_11newanalysis_9functions_10dipoleMoment[] = "Dipole moment of the selection."; -static PyMethodDef __pyx_mdef_11newanalysis_9functions_11dipoleMoment = {"dipoleMoment", (PyCFunction)__pyx_pw_11newanalysis_9functions_11dipoleMoment, METH_O, __pyx_doc_11newanalysis_9functions_10dipoleMoment}; -static PyObject *__pyx_pw_11newanalysis_9functions_11dipoleMoment(PyObject *__pyx_self, PyObject *__pyx_v_sel) { +static PyObject *__pyx_pw_11newanalysis_9functions_11dipoleMoment(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9functions_10dipoleMoment, "Dipole moment of the selection."); +static PyMethodDef __pyx_mdef_11newanalysis_9functions_11dipoleMoment = {"dipoleMoment", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9functions_11dipoleMoment, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9functions_10dipoleMoment}; +static PyObject *__pyx_pw_11newanalysis_9functions_11dipoleMoment(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_sel = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dipoleMoment (wrapper)", 0); - __pyx_r = __pyx_pf_11newanalysis_9functions_10dipoleMoment(__pyx_self, ((PyObject *)__pyx_v_sel)); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 116, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dipoleMoment") < 0)) __PYX_ERR(0, 116, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_sel = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dipoleMoment", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 116, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.functions.dipoleMoment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9functions_10dipoleMoment(__pyx_self, __pyx_v_sel); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -4311,13 +5789,14 @@ static PyObject *__pyx_pf_11newanalysis_9functions_10dipoleMoment(CYTHON_UNUSED PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dipoleMoment", 0); - /* "src/functions/py_functions.py":118 + /* "newanalysis/functions/py_functions.py":118 * def dipoleMoment(sel): * """Dipole moment of the selection.""" * return numpy.sum((sel.positions.astype('float64')-sel.center_of_mass())*sel.charges[:,numpy.newaxis],axis=0) # <<<<<<<<<<<<<< @@ -4336,37 +5815,51 @@ static PyObject *__pyx_pf_11newanalysis_9functions_10dipoleMoment(CYTHON_UNUSED __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_5 = 1; } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_n_s_float64) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_float64); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_n_s_float64}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_center_of_mass); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { + __pyx_t_6 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + #endif + { + PyObject *__pyx_callargs[1] = {__pyx_t_6, }; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4375,43 +5868,43 @@ static PyObject *__pyx_pf_11newanalysis_9functions_10dipoleMoment(CYTHON_UNUSED __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_newaxis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_newaxis); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_slice__2); - __Pyx_GIVEREF(__pyx_slice__2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_slice__2); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_slice__5)) __PYX_ERR(0, 118, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 118, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "src/functions/py_functions.py":116 + /* "newanalysis/functions/py_functions.py":116 * return comByResidue(coor,masses,numres,apr,rfa) * * def dipoleMoment(sel): # <<<<<<<<<<<<<< @@ -4425,7 +5918,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_10dipoleMoment(CYTHON_UNUSED __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("newanalysis.functions.dipoleMoment", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4434,7 +5927,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_10dipoleMoment(CYTHON_UNUSED return __pyx_r; } -/* "src/functions/py_functions.py":120 +/* "newanalysis/functions/py_functions.py":120 * return numpy.sum((sel.positions.astype('float64')-sel.center_of_mass())*sel.charges[:,numpy.newaxis],axis=0) * * def dipoleMomentByResidue(sel,**kwargs): # <<<<<<<<<<<<<< @@ -4443,52 +5936,88 @@ static PyObject *__pyx_pf_11newanalysis_9functions_10dipoleMoment(CYTHON_UNUSED */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9functions_13dipoleMomentByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9functions_12dipoleMomentByResidue[] = "Returns an array of the dipole moments of all residues in the current AtomGroup"; -static PyMethodDef __pyx_mdef_11newanalysis_9functions_13dipoleMomentByResidue = {"dipoleMomentByResidue", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9functions_13dipoleMomentByResidue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9functions_12dipoleMomentByResidue}; -static PyObject *__pyx_pw_11newanalysis_9functions_13dipoleMomentByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_11newanalysis_9functions_13dipoleMomentByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9functions_12dipoleMomentByResidue, "Returns an array of the dipole moments of all residues in the current AtomGroup"); +static PyMethodDef __pyx_mdef_11newanalysis_9functions_13dipoleMomentByResidue = {"dipoleMomentByResidue", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9functions_13dipoleMomentByResidue, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9functions_12dipoleMomentByResidue}; +static PyObject *__pyx_pw_11newanalysis_9functions_13dipoleMomentByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_sel = 0; PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dipoleMomentByResidue (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 120, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "dipoleMomentByResidue") < 0)) __PYX_ERR(0, 120, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "dipoleMomentByResidue") < 0)) __PYX_ERR(0, 120, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_sel = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dipoleMomentByResidue", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 120, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("dipoleMomentByResidue", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 120, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("newanalysis.functions.dipoleMomentByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4497,7 +6026,13 @@ static PyObject *__pyx_pw_11newanalysis_9functions_13dipoleMomentByResidue(PyObj __pyx_r = __pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(__pyx_self, __pyx_v_sel, __pyx_v_kwargs); /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_DECREF(__pyx_v_kwargs); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -4516,16 +6051,15 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - int __pyx_t_4; + PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dipoleMomentByResidue", 0); - /* "src/functions/py_functions.py":122 + /* "newanalysis/functions/py_functions.py":122 * def dipoleMomentByResidue(sel,**kwargs): * """Returns an array of the dipole moments of all residues in the current AtomGroup""" * from newanalysis.helpers import dipByResidue # <<<<<<<<<<<<<< @@ -4536,8 +6070,8 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_dipByResidue); __Pyx_GIVEREF(__pyx_n_s_dipByResidue); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_dipByResidue); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_newanalysis_helpers, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_dipByResidue)) __PYX_ERR(0, 122, __pyx_L1_error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_newanalysis_helpers, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_dipByResidue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) @@ -4547,18 +6081,17 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":123 + /* "newanalysis/functions/py_functions.py":123 * """Returns an array of the dipole moments of all residues in the current AtomGroup""" * from newanalysis.helpers import dipByResidue * if not "charges" in kwargs: # <<<<<<<<<<<<<< * charges=numpy.ascontiguousarray(sel.charges) * else: */ - __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_charges, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 123, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_charges, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 123, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/functions/py_functions.py":124 + /* "newanalysis/functions/py_functions.py":124 * from newanalysis.helpers import dipByResidue * if not "charges" in kwargs: * charges=numpy.ascontiguousarray(sel.charges) # <<<<<<<<<<<<<< @@ -4567,31 +6100,38 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_charges); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __pyx_v_charges = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":123 + /* "newanalysis/functions/py_functions.py":123 * """Returns an array of the dipole moments of all residues in the current AtomGroup""" * from newanalysis.helpers import dipByResidue * if not "charges" in kwargs: # <<<<<<<<<<<<<< @@ -4601,7 +6141,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO goto __pyx_L3; } - /* "src/functions/py_functions.py":126 + /* "newanalysis/functions/py_functions.py":126 * charges=numpy.ascontiguousarray(sel.charges) * else: * charges = kwargs["charges"] # <<<<<<<<<<<<<< @@ -4616,51 +6156,57 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO } __pyx_L3:; - /* "src/functions/py_functions.py":127 + /* "newanalysis/functions/py_functions.py":127 * else: * charges = kwargs["charges"] * if not "masses" in kwargs: # <<<<<<<<<<<<<< * masses=numpy.ascontiguousarray(sel.masses) * else: */ - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_masses, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 127, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_4 != 0); + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_masses, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 127, __pyx_L1_error) if (__pyx_t_3) { - /* "src/functions/py_functions.py":128 + /* "newanalysis/functions/py_functions.py":128 * charges = kwargs["charges"] * if not "masses" in kwargs: * masses=numpy.ascontiguousarray(sel.masses) # <<<<<<<<<<<<<< * else: * masses=kwargs["masses"] */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_masses); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_masses); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } __pyx_v_masses = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":127 + /* "newanalysis/functions/py_functions.py":127 * else: * charges = kwargs["charges"] * if not "masses" in kwargs: # <<<<<<<<<<<<<< @@ -4670,7 +6216,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO goto __pyx_L4; } - /* "src/functions/py_functions.py":130 + /* "newanalysis/functions/py_functions.py":130 * masses=numpy.ascontiguousarray(sel.masses) * else: * masses=kwargs["masses"] # <<<<<<<<<<<<<< @@ -4685,18 +6231,17 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO } __pyx_L4:; - /* "src/functions/py_functions.py":131 + /* "newanalysis/functions/py_functions.py":131 * else: * masses=kwargs["masses"] * if not "coor" in kwargs: # <<<<<<<<<<<<<< * coor=sel.positions.astype('float64') * else: */ - __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_coor, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 131, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_coor, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 131, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/functions/py_functions.py":132 + /* "newanalysis/functions/py_functions.py":132 * masses=kwargs["masses"] * if not "coor" in kwargs: * coor=sel.positions.astype('float64') # <<<<<<<<<<<<<< @@ -4705,28 +6250,35 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_positions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_n_s_float64) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_float64); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_n_s_float64}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __pyx_v_coor = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":131 + /* "newanalysis/functions/py_functions.py":131 * else: * masses=kwargs["masses"] * if not "coor" in kwargs: # <<<<<<<<<<<<<< @@ -4736,7 +6288,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO goto __pyx_L5; } - /* "src/functions/py_functions.py":134 + /* "newanalysis/functions/py_functions.py":134 * coor=sel.positions.astype('float64') * else: * coor=kwargs["coor"] # <<<<<<<<<<<<<< @@ -4751,18 +6303,17 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO } __pyx_L5:; - /* "src/functions/py_functions.py":135 + /* "newanalysis/functions/py_functions.py":135 * else: * coor=kwargs["coor"] * if not "com" in kwargs: # <<<<<<<<<<<<<< * com = centerOfMassByResidue(sel,masses=masses, coor=coor) * else: */ - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_com, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 135, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_4 != 0); + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_com, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 135, __pyx_L1_error) if (__pyx_t_3) { - /* "src/functions/py_functions.py":136 + /* "newanalysis/functions/py_functions.py":136 * coor=kwargs["coor"] * if not "com" in kwargs: * com = centerOfMassByResidue(sel,masses=masses, coor=coor) # <<<<<<<<<<<<<< @@ -4771,24 +6322,24 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_centerOfMassByResidue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_sel); __Pyx_GIVEREF(__pyx_v_sel); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_sel); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_sel)) __PYX_ERR(0, 136, __pyx_L1_error); __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_masses, __pyx_v_masses) < 0) __PYX_ERR(0, 136, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_coor, __pyx_v_coor) < 0) __PYX_ERR(0, 136, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_com = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_com = __pyx_t_5; + __pyx_t_5 = 0; - /* "src/functions/py_functions.py":135 + /* "newanalysis/functions/py_functions.py":135 * else: * coor=kwargs["coor"] * if not "com" in kwargs: # <<<<<<<<<<<<<< @@ -4798,7 +6349,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO goto __pyx_L6; } - /* "src/functions/py_functions.py":138 + /* "newanalysis/functions/py_functions.py":138 * com = centerOfMassByResidue(sel,masses=masses, coor=coor) * else: * com = kwargs["com"] # <<<<<<<<<<<<<< @@ -4806,34 +6357,35 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO * print("Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code") */ /*else*/ { - __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_n_s_com); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_com = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_n_s_com); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_com = __pyx_t_5; + __pyx_t_5 = 0; } __pyx_L6:; - /* "src/functions/py_functions.py":139 + /* "newanalysis/functions/py_functions.py":139 * else: * com = kwargs["com"] * if not "apr" in kwargs: # <<<<<<<<<<<<<< * print("Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code") * apr=atomsPerResidue(sel) */ - __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_apr, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 139, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_apr, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 139, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/functions/py_functions.py":140 + /* "newanalysis/functions/py_functions.py":140 * com = kwargs["com"] * if not "apr" in kwargs: * print("Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code") # <<<<<<<<<<<<<< * apr=atomsPerResidue(sel) * else: */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Warning_apr_is_now_calculated_ea) < 0) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/functions/py_functions.py":141 + /* "newanalysis/functions/py_functions.py":141 * if not "apr" in kwargs: * print("Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code") * apr=atomsPerResidue(sel) # <<<<<<<<<<<<<< @@ -4842,25 +6394,32 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_atomsPerResidue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; } } - __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_sel) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sel); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_apr = __pyx_t_6; - __pyx_t_6 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_sel}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_v_apr = __pyx_t_5; + __pyx_t_5 = 0; - /* "src/functions/py_functions.py":139 + /* "newanalysis/functions/py_functions.py":139 * else: * com = kwargs["com"] * if not "apr" in kwargs: # <<<<<<<<<<<<<< @@ -4870,7 +6429,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO goto __pyx_L7; } - /* "src/functions/py_functions.py":143 + /* "newanalysis/functions/py_functions.py":143 * apr=atomsPerResidue(sel) * else: * apr = kwargs["apr"] # <<<<<<<<<<<<<< @@ -4878,34 +6437,35 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO * print("Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code") */ /*else*/ { - __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_n_s_apr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_apr = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_n_s_apr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_apr = __pyx_t_5; + __pyx_t_5 = 0; } __pyx_L7:; - /* "src/functions/py_functions.py":144 + /* "newanalysis/functions/py_functions.py":144 * else: * apr = kwargs["apr"] * if not "rfa" in kwargs: # <<<<<<<<<<<<<< * print("Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code") * rfa=residueFirstAtom(sel) */ - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_rfa, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 144, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_4 != 0); + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_rfa, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 144, __pyx_L1_error) if (__pyx_t_3) { - /* "src/functions/py_functions.py":145 + /* "newanalysis/functions/py_functions.py":145 * apr = kwargs["apr"] * if not "rfa" in kwargs: * print("Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code") # <<<<<<<<<<<<<< * rfa=residueFirstAtom(sel) * else: */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Warning_rfa_is_now_calculated_ea) < 0) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/functions/py_functions.py":146 + /* "newanalysis/functions/py_functions.py":146 * if not "rfa" in kwargs: * print("Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code") * rfa=residueFirstAtom(sel) # <<<<<<<<<<<<<< @@ -4914,25 +6474,32 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_residueFirstAtom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; } } - __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_sel) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sel); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_rfa = __pyx_t_6; - __pyx_t_6 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_sel}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_v_rfa = __pyx_t_5; + __pyx_t_5 = 0; - /* "src/functions/py_functions.py":144 + /* "newanalysis/functions/py_functions.py":144 * else: * apr = kwargs["apr"] * if not "rfa" in kwargs: # <<<<<<<<<<<<<< @@ -4942,7 +6509,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO goto __pyx_L8; } - /* "src/functions/py_functions.py":148 + /* "newanalysis/functions/py_functions.py":148 * rfa=residueFirstAtom(sel) * else: * rfa = kwargs["rfa"] # <<<<<<<<<<<<<< @@ -4950,26 +6517,26 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO * */ /*else*/ { - __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_n_s_rfa); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_rfa = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_n_s_rfa); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_rfa = __pyx_t_5; + __pyx_t_5 = 0; } __pyx_L8:; - /* "src/functions/py_functions.py":149 + /* "newanalysis/functions/py_functions.py":149 * else: * rfa = kwargs["rfa"] * numres = sel.n_residues # <<<<<<<<<<<<<< * * return dipByResidue(coor,charges,masses,numres,apr,rfa,com) */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_n_residues); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_numres = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_n_residues); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_numres = __pyx_t_5; + __pyx_t_5 = 0; - /* "src/functions/py_functions.py":151 + /* "newanalysis/functions/py_functions.py":151 * numres = sel.n_residues * * return dipByResidue(coor,charges,masses,numres,apr,rfa,com) # <<<<<<<<<<<<<< @@ -4978,71 +6545,33 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_dipByResidue); - __pyx_t_1 = __pyx_v_dipByResidue; __pyx_t_5 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { + __pyx_t_1 = __pyx_v_dipByResidue; __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_7 = 1; + __pyx_t_6 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[8] = {__pyx_t_5, __pyx_v_coor, __pyx_v_charges, __pyx_v_masses, __pyx_v_numres, __pyx_v_apr, __pyx_v_rfa, __pyx_v_com}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 7+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[8] = {__pyx_t_5, __pyx_v_coor, __pyx_v_charges, __pyx_v_masses, __pyx_v_numres, __pyx_v_apr, __pyx_v_rfa, __pyx_v_com}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 7+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else #endif { - __pyx_t_2 = PyTuple_New(7+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_v_coor); - __Pyx_GIVEREF(__pyx_v_coor); - PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_v_coor); - __Pyx_INCREF(__pyx_v_charges); - __Pyx_GIVEREF(__pyx_v_charges); - PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_v_charges); - __Pyx_INCREF(__pyx_v_masses); - __Pyx_GIVEREF(__pyx_v_masses); - PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_7, __pyx_v_masses); - __Pyx_INCREF(__pyx_v_numres); - __Pyx_GIVEREF(__pyx_v_numres); - PyTuple_SET_ITEM(__pyx_t_2, 3+__pyx_t_7, __pyx_v_numres); - __Pyx_INCREF(__pyx_v_apr); - __Pyx_GIVEREF(__pyx_v_apr); - PyTuple_SET_ITEM(__pyx_t_2, 4+__pyx_t_7, __pyx_v_apr); - __Pyx_INCREF(__pyx_v_rfa); - __Pyx_GIVEREF(__pyx_v_rfa); - PyTuple_SET_ITEM(__pyx_t_2, 5+__pyx_t_7, __pyx_v_rfa); - __Pyx_INCREF(__pyx_v_com); - __Pyx_GIVEREF(__pyx_v_com); - PyTuple_SET_ITEM(__pyx_t_2, 6+__pyx_t_7, __pyx_v_com); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyObject *__pyx_callargs[8] = {__pyx_t_4, __pyx_v_coor, __pyx_v_charges, __pyx_v_masses, __pyx_v_numres, __pyx_v_apr, __pyx_v_rfa, __pyx_v_com}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 7+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; - /* "src/functions/py_functions.py":120 + /* "newanalysis/functions/py_functions.py":120 * return numpy.sum((sel.positions.astype('float64')-sel.center_of_mass())*sel.charges[:,numpy.newaxis],axis=0) * * def dipoleMomentByResidue(sel,**kwargs): # <<<<<<<<<<<<<< @@ -5054,8 +6583,8 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("newanalysis.functions.dipoleMomentByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -5072,7 +6601,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO return __pyx_r; } -/* "src/functions/py_functions.py":153 +/* "newanalysis/functions/py_functions.py":153 * return dipByResidue(coor,charges,masses,numres,apr,rfa,com) * * def velcomByResidue(sel,**kwargs): # <<<<<<<<<<<<<< @@ -5081,52 +6610,88 @@ static PyObject *__pyx_pf_11newanalysis_9functions_12dipoleMomentByResidue(CYTHO */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9functions_15velcomByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9functions_14velcomByResidue[] = "\n Gives array of center-of-mass velocites of all residues in the current AtomGroup.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9functions_15velcomByResidue = {"velcomByResidue", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9functions_15velcomByResidue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9functions_14velcomByResidue}; -static PyObject *__pyx_pw_11newanalysis_9functions_15velcomByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_11newanalysis_9functions_15velcomByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9functions_14velcomByResidue, "\n Gives array of center-of-mass velocites of all residues in the current AtomGroup.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9functions_15velcomByResidue = {"velcomByResidue", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9functions_15velcomByResidue, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9functions_14velcomByResidue}; +static PyObject *__pyx_pw_11newanalysis_9functions_15velcomByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_sel = 0; PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("velcomByResidue (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 153, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "velcomByResidue") < 0)) __PYX_ERR(0, 153, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "velcomByResidue") < 0)) __PYX_ERR(0, 153, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_sel = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 153, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 153, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("newanalysis.functions.velcomByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5135,7 +6700,13 @@ static PyObject *__pyx_pw_11newanalysis_9functions_15velcomByResidue(PyObject *_ __pyx_r = __pyx_pf_11newanalysis_9functions_14velcomByResidue(__pyx_self, __pyx_v_sel, __pyx_v_kwargs); /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_DECREF(__pyx_v_kwargs); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -5152,16 +6723,15 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("velcomByResidue", 0); - /* "src/functions/py_functions.py":157 + /* "newanalysis/functions/py_functions.py":157 * Gives array of center-of-mass velocites of all residues in the current AtomGroup. * """ * from newanalysis.helpers import velcomByResidue # <<<<<<<<<<<<<< @@ -5172,8 +6742,8 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_velcomByResidue); __Pyx_GIVEREF(__pyx_n_s_velcomByResidue); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_velcomByResidue); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_newanalysis_helpers, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_velcomByResidue)) __PYX_ERR(0, 157, __pyx_L1_error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_newanalysis_helpers, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_velcomByResidue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) @@ -5183,18 +6753,17 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":158 + /* "newanalysis/functions/py_functions.py":158 * """ * from newanalysis.helpers import velcomByResidue * if not "vels" in kwargs: # <<<<<<<<<<<<<< * vels = get_velocities(sel) * else: */ - __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_vels, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 158, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_vels, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 158, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/functions/py_functions.py":159 + /* "newanalysis/functions/py_functions.py":159 * from newanalysis.helpers import velcomByResidue * if not "vels" in kwargs: * vels = get_velocities(sel) # <<<<<<<<<<<<<< @@ -5203,25 +6772,32 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_get_velocities); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_5 = 1; } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_sel) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_sel); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_sel}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } __pyx_v_vels = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":158 + /* "newanalysis/functions/py_functions.py":158 * """ * from newanalysis.helpers import velcomByResidue * if not "vels" in kwargs: # <<<<<<<<<<<<<< @@ -5231,7 +6807,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS goto __pyx_L3; } - /* "src/functions/py_functions.py":161 + /* "newanalysis/functions/py_functions.py":161 * vels = get_velocities(sel) * else: * vels = kwargs["vels"] # <<<<<<<<<<<<<< @@ -5246,18 +6822,17 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS } __pyx_L3:; - /* "src/functions/py_functions.py":162 + /* "newanalysis/functions/py_functions.py":162 * else: * vels = kwargs["vels"] * if not "masses" in kwargs: # <<<<<<<<<<<<<< * masses=numpy.ascontiguousarray(sel.masses) * else: */ - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_masses, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 162, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_4 != 0); + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_masses, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 162, __pyx_L1_error) if (__pyx_t_3) { - /* "src/functions/py_functions.py":163 + /* "newanalysis/functions/py_functions.py":163 * vels = kwargs["vels"] * if not "masses" in kwargs: * masses=numpy.ascontiguousarray(sel.masses) # <<<<<<<<<<<<<< @@ -5266,31 +6841,38 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sel, __pyx_n_s_masses); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_5 = 1; } } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __pyx_v_masses = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":162 + /* "newanalysis/functions/py_functions.py":162 * else: * vels = kwargs["vels"] * if not "masses" in kwargs: # <<<<<<<<<<<<<< @@ -5300,7 +6882,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS goto __pyx_L4; } - /* "src/functions/py_functions.py":165 + /* "newanalysis/functions/py_functions.py":165 * masses=numpy.ascontiguousarray(sel.masses) * else: * masses=kwargs["masses"] # <<<<<<<<<<<<<< @@ -5315,54 +6897,62 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS } __pyx_L4:; - /* "src/functions/py_functions.py":166 + /* "newanalysis/functions/py_functions.py":166 * else: * masses=kwargs["masses"] * if not "apr" in kwargs: # <<<<<<<<<<<<<< * print("Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code") * apr=atomsPerResidue(sel) */ - __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_apr, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 166, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_apr, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 166, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/functions/py_functions.py":167 + /* "newanalysis/functions/py_functions.py":167 * masses=kwargs["masses"] * if not "apr" in kwargs: * print("Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code") # <<<<<<<<<<<<<< * apr=atomsPerResidue(sel) * else: */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Warning_apr_is_now_calculated_ea) < 0) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":168 + /* "newanalysis/functions/py_functions.py":168 * if not "apr" in kwargs: * print("Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code") * apr=atomsPerResidue(sel) # <<<<<<<<<<<<<< * else: * apr = kwargs["apr"] */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_atomsPerResidue); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_atomsPerResidue); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_5 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_sel) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_sel); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_sel}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __pyx_v_apr = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":166 + /* "newanalysis/functions/py_functions.py":166 * else: * masses=kwargs["masses"] * if not "apr" in kwargs: # <<<<<<<<<<<<<< @@ -5372,7 +6962,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS goto __pyx_L5; } - /* "src/functions/py_functions.py":170 + /* "newanalysis/functions/py_functions.py":170 * apr=atomsPerResidue(sel) * else: * apr = kwargs["apr"] # <<<<<<<<<<<<<< @@ -5387,54 +6977,62 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS } __pyx_L5:; - /* "src/functions/py_functions.py":171 + /* "newanalysis/functions/py_functions.py":171 * else: * apr = kwargs["apr"] * if not "rfa" in kwargs: # <<<<<<<<<<<<<< * print("Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code") * rfa=residueFirstAtom(sel) */ - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_rfa, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 171, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_4 != 0); + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_rfa, __pyx_v_kwargs, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 171, __pyx_L1_error) if (__pyx_t_3) { - /* "src/functions/py_functions.py":172 + /* "newanalysis/functions/py_functions.py":172 * apr = kwargs["apr"] * if not "rfa" in kwargs: * print("Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code") # <<<<<<<<<<<<<< * rfa=residueFirstAtom(sel) * else: */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Warning_rfa_is_now_calculated_ea) < 0) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":173 + /* "newanalysis/functions/py_functions.py":173 * if not "rfa" in kwargs: * print("Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code") * rfa=residueFirstAtom(sel) # <<<<<<<<<<<<<< * else: * rfa = kwargs["rfa"] */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_residueFirstAtom); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_residueFirstAtom); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_5 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_sel) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_sel); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_sel}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __pyx_v_rfa = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":171 + /* "newanalysis/functions/py_functions.py":171 * else: * apr = kwargs["apr"] * if not "rfa" in kwargs: # <<<<<<<<<<<<<< @@ -5444,7 +7042,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS goto __pyx_L6; } - /* "src/functions/py_functions.py":175 + /* "newanalysis/functions/py_functions.py":175 * rfa=residueFirstAtom(sel) * else: * rfa = kwargs["rfa"] # <<<<<<<<<<<<<< @@ -5459,7 +7057,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS } __pyx_L6:; - /* "src/functions/py_functions.py":176 + /* "newanalysis/functions/py_functions.py":176 * else: * rfa = kwargs["rfa"] * numres = sel.n_residues # <<<<<<<<<<<<<< @@ -5471,7 +7069,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS __pyx_v_numres = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":178 + /* "newanalysis/functions/py_functions.py":178 * numres = sel.n_residues * * return velcomByResidue(vels,masses,numres,apr,rfa) # <<<<<<<<<<<<<< @@ -5480,65 +7078,33 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_velcomByResidue); - __pyx_t_5 = __pyx_v_velcomByResidue; __pyx_t_1 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); + __pyx_t_4 = __pyx_v_velcomByResidue; __pyx_t_1 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_7 = 1; + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_5 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[6] = {__pyx_t_1, __pyx_v_vels, __pyx_v_masses, __pyx_v_numres, __pyx_v_apr, __pyx_v_rfa}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[6] = {__pyx_t_1, __pyx_v_vels, __pyx_v_masses, __pyx_v_numres, __pyx_v_apr, __pyx_v_rfa}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else #endif { - __pyx_t_6 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_1) { - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL; - } - __Pyx_INCREF(__pyx_v_vels); - __Pyx_GIVEREF(__pyx_v_vels); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_vels); - __Pyx_INCREF(__pyx_v_masses); - __Pyx_GIVEREF(__pyx_v_masses); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_masses); - __Pyx_INCREF(__pyx_v_numres); - __Pyx_GIVEREF(__pyx_v_numres); - PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_numres); - __Pyx_INCREF(__pyx_v_apr); - __Pyx_GIVEREF(__pyx_v_apr); - PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_apr); - __Pyx_INCREF(__pyx_v_rfa); - __Pyx_GIVEREF(__pyx_v_rfa); - PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_rfa); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) + PyObject *__pyx_callargs[6] = {__pyx_t_1, __pyx_v_vels, __pyx_v_masses, __pyx_v_numres, __pyx_v_apr, __pyx_v_rfa}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 5+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "src/functions/py_functions.py":153 + /* "newanalysis/functions/py_functions.py":153 * return dipByResidue(coor,charges,masses,numres,apr,rfa,com) * * def velcomByResidue(sel,**kwargs): # <<<<<<<<<<<<<< @@ -5550,7 +7116,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("newanalysis.functions.velcomByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; @@ -5566,7 +7132,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS return __pyx_r; } -/* "src/functions/py_functions.py":180 +/* "newanalysis/functions/py_functions.py":180 * return velcomByResidue(vels,masses,numres,apr,rfa) * * def get_velocities(sel): # <<<<<<<<<<<<<< @@ -5575,15 +7141,97 @@ static PyObject *__pyx_pf_11newanalysis_9functions_14velcomByResidue(CYTHON_UNUS */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9functions_17get_velocities(PyObject *__pyx_self, PyObject *__pyx_v_sel); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_9functions_17get_velocities = {"get_velocities", (PyCFunction)__pyx_pw_11newanalysis_9functions_17get_velocities, METH_O, 0}; -static PyObject *__pyx_pw_11newanalysis_9functions_17get_velocities(PyObject *__pyx_self, PyObject *__pyx_v_sel) { +static PyObject *__pyx_pw_11newanalysis_9functions_17get_velocities(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_9functions_17get_velocities = {"get_velocities", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9functions_17get_velocities, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_9functions_17get_velocities(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_sel = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_velocities (wrapper)", 0); - __pyx_r = __pyx_pf_11newanalysis_9functions_16get_velocities(__pyx_self, ((PyObject *)__pyx_v_sel)); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 180, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sel,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_velocities") < 0)) __PYX_ERR(0, 180, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_sel = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_velocities", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 180, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.functions.get_velocities", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9functions_16get_velocities(__pyx_self, __pyx_v_sel); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -5602,7 +7250,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_16get_velocities(CYTHON_UNUSE int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_velocities", 0); - /* "src/functions/py_functions.py":181 + /* "newanalysis/functions/py_functions.py":181 * * def get_velocities(sel): * from MDAnalysis.units import timeUnit_factor # <<<<<<<<<<<<<< @@ -5613,8 +7261,8 @@ static PyObject *__pyx_pf_11newanalysis_9functions_16get_velocities(CYTHON_UNUSE __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_timeUnit_factor); __Pyx_GIVEREF(__pyx_n_s_timeUnit_factor); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_timeUnit_factor); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_MDAnalysis_units, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_timeUnit_factor)) __PYX_ERR(0, 181, __pyx_L1_error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_MDAnalysis_units, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_timeUnit_factor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) @@ -5624,7 +7272,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_16get_velocities(CYTHON_UNUSE __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":182 + /* "newanalysis/functions/py_functions.py":182 * def get_velocities(sel): * from MDAnalysis.units import timeUnit_factor * vel=numpy.ascontiguousarray(sel.positions*timeUnit_factor['AKMA'],dtype='double') # <<<<<<<<<<<<<< @@ -5647,7 +7295,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_16get_velocities(CYTHON_UNUSE __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 182, __pyx_L1_error); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); @@ -5660,7 +7308,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_16get_velocities(CYTHON_UNUSE __pyx_v_vel = __pyx_t_2; __pyx_t_2 = 0; - /* "src/functions/py_functions.py":183 + /* "newanalysis/functions/py_functions.py":183 * from MDAnalysis.units import timeUnit_factor * vel=numpy.ascontiguousarray(sel.positions*timeUnit_factor['AKMA'],dtype='double') * return vel # <<<<<<<<<<<<<< @@ -5671,7 +7319,7 @@ static PyObject *__pyx_pf_11newanalysis_9functions_16get_velocities(CYTHON_UNUSE __pyx_r = __pyx_v_vel; goto __pyx_L0; - /* "src/functions/py_functions.py":180 + /* "newanalysis/functions/py_functions.py":180 * return velcomByResidue(vels,masses,numres,apr,rfa) * * def get_velocities(sel): # <<<<<<<<<<<<<< @@ -5698,38 +7346,6 @@ static PyObject *__pyx_pf_11newanalysis_9functions_16get_velocities(CYTHON_UNUSE static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_functions(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_functions}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "functions", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE @@ -5739,245 +7355,281 @@ static struct PyModuleDef __pyx_moduledef = { #define CYTHON_SMALL_CODE #endif #endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, - {&__pyx_n_s_AKMA, __pyx_k_AKMA, sizeof(__pyx_k_AKMA), 0, 0, 1, 1}, - {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, - {&__pyx_n_s_MDAnalysis_units, __pyx_k_MDAnalysis_units, sizeof(__pyx_k_MDAnalysis_units), 0, 0, 1, 1}, - {&__pyx_kp_s_Warning_apr_is_now_calculated_ea, __pyx_k_Warning_apr_is_now_calculated_ea, sizeof(__pyx_k_Warning_apr_is_now_calculated_ea), 0, 0, 1, 0}, - {&__pyx_kp_s_Warning_rfa_is_now_calculated_ea, __pyx_k_Warning_rfa_is_now_calculated_ea, sizeof(__pyx_k_Warning_rfa_is_now_calculated_ea), 0, 0, 1, 0}, - {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1}, - {&__pyx_n_s_apr, __pyx_k_apr, sizeof(__pyx_k_apr), 0, 0, 1, 1}, - {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1}, - {&__pyx_n_s_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 0, 0, 1, 1}, - {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, - {&__pyx_n_s_atoms, __pyx_k_atoms, sizeof(__pyx_k_atoms), 0, 0, 1, 1}, - {&__pyx_n_s_atomsPerResidue, __pyx_k_atomsPerResidue, sizeof(__pyx_k_atomsPerResidue), 0, 0, 1, 1}, - {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1}, - {&__pyx_n_s_box_f2c, __pyx_k_box_f2c, sizeof(__pyx_k_box_f2c), 0, 0, 1, 1}, - {&__pyx_n_s_cache, __pyx_k_cache, sizeof(__pyx_k_cache), 0, 0, 1, 1}, - {&__pyx_n_s_calcTessellation, __pyx_k_calcTessellation, sizeof(__pyx_k_calcTessellation), 0, 0, 1, 1}, - {&__pyx_n_s_centerOfMassByResidue, __pyx_k_centerOfMassByResidue, sizeof(__pyx_k_centerOfMassByResidue), 0, 0, 1, 1}, - {&__pyx_n_s_center_of_mass, __pyx_k_center_of_mass, sizeof(__pyx_k_center_of_mass), 0, 0, 1, 1}, - {&__pyx_n_s_charges, __pyx_k_charges, sizeof(__pyx_k_charges), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_com, __pyx_k_com, sizeof(__pyx_k_com), 0, 0, 1, 1}, - {&__pyx_n_s_comByResidue, __pyx_k_comByResidue, sizeof(__pyx_k_comByResidue), 0, 0, 1, 1}, - {&__pyx_n_s_coor, __pyx_k_coor, sizeof(__pyx_k_coor), 0, 0, 1, 1}, - {&__pyx_n_s_coord, __pyx_k_coord, sizeof(__pyx_k_coord), 0, 0, 1, 1}, - {&__pyx_n_s_core_sel, __pyx_k_core_sel, sizeof(__pyx_k_core_sel), 0, 0, 1, 1}, - {&__pyx_n_s_corelist, __pyx_k_corelist, sizeof(__pyx_k_corelist), 0, 0, 1, 1}, - {&__pyx_n_s_corelist_unique, __pyx_k_corelist_unique, sizeof(__pyx_k_corelist_unique), 0, 0, 1, 1}, - {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, - {&__pyx_n_s_curname, __pyx_k_curname, sizeof(__pyx_k_curname), 0, 0, 1, 1}, - {&__pyx_n_s_curnum, __pyx_k_curnum, sizeof(__pyx_k_curnum), 0, 0, 1, 1}, - {&__pyx_n_s_dimensions, __pyx_k_dimensions, sizeof(__pyx_k_dimensions), 0, 0, 1, 1}, - {&__pyx_n_s_dipByResidue, __pyx_k_dipByResidue, sizeof(__pyx_k_dipByResidue), 0, 0, 1, 1}, - {&__pyx_n_s_dipoleMoment, __pyx_k_dipoleMoment, sizeof(__pyx_k_dipoleMoment), 0, 0, 1, 1}, - {&__pyx_n_s_dipoleMomentByResidue, __pyx_k_dipoleMomentByResidue, sizeof(__pyx_k_dipoleMomentByResidue), 0, 0, 1, 1}, - {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, - {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, - {&__pyx_n_s_f2c, __pyx_k_f2c, sizeof(__pyx_k_f2c), 0, 0, 1, 1}, - {&__pyx_n_s_face_areas, __pyx_k_face_areas, sizeof(__pyx_k_face_areas), 0, 0, 1, 1}, - {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1}, - {&__pyx_n_s_fine2coarse, __pyx_k_fine2coarse, sizeof(__pyx_k_fine2coarse), 0, 0, 1, 1}, - {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, - {&__pyx_n_s_get_velocities, __pyx_k_get_velocities, sizeof(__pyx_k_get_velocities), 0, 0, 1, 1}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1}, - {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, - {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, - {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_masses, __pyx_k_masses, sizeof(__pyx_k_masses), 0, 0, 1, 1}, - {&__pyx_n_s_maxshell, __pyx_k_maxshell, sizeof(__pyx_k_maxshell), 0, 0, 1, 1}, - {&__pyx_n_s_n_atoms, __pyx_k_n_atoms, sizeof(__pyx_k_n_atoms), 0, 0, 1, 1}, - {&__pyx_n_s_n_residues, __pyx_k_n_residues, sizeof(__pyx_k_n_residues), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_newanalysis_functions, __pyx_k_newanalysis_functions, sizeof(__pyx_k_newanalysis_functions), 0, 0, 1, 1}, - {&__pyx_n_s_newanalysis_helpers, __pyx_k_newanalysis_helpers, sizeof(__pyx_k_newanalysis_helpers), 0, 0, 1, 1}, - {&__pyx_n_s_newanalysis_voro, __pyx_k_newanalysis_voro, sizeof(__pyx_k_newanalysis_voro), 0, 0, 1, 1}, - {&__pyx_n_s_newaxis, __pyx_k_newaxis, sizeof(__pyx_k_newaxis), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_n_s_numres, __pyx_k_numres, sizeof(__pyx_k_numres), 0, 0, 1, 1}, - {&__pyx_n_s_positions, __pyx_k_positions, sizeof(__pyx_k_positions), 0, 0, 1, 1}, - {&__pyx_n_s_presname, __pyx_k_presname, sizeof(__pyx_k_presname), 0, 0, 1, 1}, - {&__pyx_n_s_presnum, __pyx_k_presnum, sizeof(__pyx_k_presnum), 0, 0, 1, 1}, - {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, - {&__pyx_n_s_prvname, __pyx_k_prvname, sizeof(__pyx_k_prvname), 0, 0, 1, 1}, - {&__pyx_n_s_prvnum, __pyx_k_prvnum, sizeof(__pyx_k_prvnum), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_resid, __pyx_k_resid, sizeof(__pyx_k_resid), 0, 0, 1, 1}, - {&__pyx_n_s_residueFirstAtom, __pyx_k_residueFirstAtom, sizeof(__pyx_k_residueFirstAtom), 0, 0, 1, 1}, - {&__pyx_n_s_resname, __pyx_k_resname, sizeof(__pyx_k_resname), 0, 0, 1, 1}, - {&__pyx_n_s_resnum, __pyx_k_resnum, sizeof(__pyx_k_resnum), 0, 0, 1, 1}, - {&__pyx_n_s_rfa, __pyx_k_rfa, sizeof(__pyx_k_rfa), 0, 0, 1, 1}, - {&__pyx_n_s_running, __pyx_k_running, sizeof(__pyx_k_running), 0, 0, 1, 1}, - {&__pyx_n_s_sel, __pyx_k_sel, sizeof(__pyx_k_sel), 0, 0, 1, 1}, - {&__pyx_n_s_sel_f2c, __pyx_k_sel_f2c, sizeof(__pyx_k_sel_f2c), 0, 0, 1, 1}, - {&__pyx_kp_s_src_functions_py_functions_py, __pyx_k_src_functions_py_functions_py, sizeof(__pyx_k_src_functions_py_functions_py), 0, 0, 1, 0}, - {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1}, - {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_timeUnit_factor, __pyx_k_timeUnit_factor, sizeof(__pyx_k_timeUnit_factor), 0, 0, 1, 1}, - {&__pyx_n_s_universe, __pyx_k_universe, sizeof(__pyx_k_universe), 0, 0, 1, 1}, - {&__pyx_n_s_vel, __pyx_k_vel, sizeof(__pyx_k_vel), 0, 0, 1, 1}, - {&__pyx_n_s_velcomByResidue, __pyx_k_velcomByResidue, sizeof(__pyx_k_velcomByResidue), 0, 0, 1, 1}, - {&__pyx_n_s_vels, __pyx_k_vels, sizeof(__pyx_k_vels), 0, 0, 1, 1}, - {&__pyx_n_s_volumes, __pyx_k_volumes, sizeof(__pyx_k_volumes), 0, 0, 1, 1}, - {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, + {&__pyx_n_s_AKMA, __pyx_k_AKMA, sizeof(__pyx_k_AKMA), 0, 0, 1, 1}, + {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, + {&__pyx_n_s_MDAnalysis_units, __pyx_k_MDAnalysis_units, sizeof(__pyx_k_MDAnalysis_units), 0, 0, 1, 1}, + {&__pyx_kp_s_Warning_apr_is_now_calculated_ea, __pyx_k_Warning_apr_is_now_calculated_ea, sizeof(__pyx_k_Warning_apr_is_now_calculated_ea), 0, 0, 1, 0}, + {&__pyx_kp_s_Warning_rfa_is_now_calculated_ea, __pyx_k_Warning_rfa_is_now_calculated_ea, sizeof(__pyx_k_Warning_rfa_is_now_calculated_ea), 0, 0, 1, 0}, + {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, + {&__pyx_n_s__27, __pyx_k__27, sizeof(__pyx_k__27), 0, 0, 1, 1}, + {&__pyx_n_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 1}, + {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1}, + {&__pyx_n_s_apr, __pyx_k_apr, sizeof(__pyx_k_apr), 0, 0, 1, 1}, + {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1}, + {&__pyx_n_s_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 0, 0, 1, 1}, + {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_atoms, __pyx_k_atoms, sizeof(__pyx_k_atoms), 0, 0, 1, 1}, + {&__pyx_n_s_atomsPerResidue, __pyx_k_atomsPerResidue, sizeof(__pyx_k_atomsPerResidue), 0, 0, 1, 1}, + {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1}, + {&__pyx_n_s_box_f2c, __pyx_k_box_f2c, sizeof(__pyx_k_box_f2c), 0, 0, 1, 1}, + {&__pyx_n_s_cache, __pyx_k_cache, sizeof(__pyx_k_cache), 0, 0, 1, 1}, + {&__pyx_n_s_calcTessellation, __pyx_k_calcTessellation, sizeof(__pyx_k_calcTessellation), 0, 0, 1, 1}, + {&__pyx_n_s_centerOfMassByResidue, __pyx_k_centerOfMassByResidue, sizeof(__pyx_k_centerOfMassByResidue), 0, 0, 1, 1}, + {&__pyx_n_s_center_of_mass, __pyx_k_center_of_mass, sizeof(__pyx_k_center_of_mass), 0, 0, 1, 1}, + {&__pyx_n_s_charges, __pyx_k_charges, sizeof(__pyx_k_charges), 0, 0, 1, 1}, + {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_com, __pyx_k_com, sizeof(__pyx_k_com), 0, 0, 1, 1}, + {&__pyx_n_s_comByResidue, __pyx_k_comByResidue, sizeof(__pyx_k_comByResidue), 0, 0, 1, 1}, + {&__pyx_n_s_coor, __pyx_k_coor, sizeof(__pyx_k_coor), 0, 0, 1, 1}, + {&__pyx_n_s_coord, __pyx_k_coord, sizeof(__pyx_k_coord), 0, 0, 1, 1}, + {&__pyx_n_s_core_sel, __pyx_k_core_sel, sizeof(__pyx_k_core_sel), 0, 0, 1, 1}, + {&__pyx_n_s_corelist, __pyx_k_corelist, sizeof(__pyx_k_corelist), 0, 0, 1, 1}, + {&__pyx_n_s_corelist_unique, __pyx_k_corelist_unique, sizeof(__pyx_k_corelist_unique), 0, 0, 1, 1}, + {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, + {&__pyx_n_s_curname, __pyx_k_curname, sizeof(__pyx_k_curname), 0, 0, 1, 1}, + {&__pyx_n_s_curnum, __pyx_k_curnum, sizeof(__pyx_k_curnum), 0, 0, 1, 1}, + {&__pyx_n_s_dimensions, __pyx_k_dimensions, sizeof(__pyx_k_dimensions), 0, 0, 1, 1}, + {&__pyx_n_s_dipByResidue, __pyx_k_dipByResidue, sizeof(__pyx_k_dipByResidue), 0, 0, 1, 1}, + {&__pyx_n_s_dipoleMoment, __pyx_k_dipoleMoment, sizeof(__pyx_k_dipoleMoment), 0, 0, 1, 1}, + {&__pyx_n_s_dipoleMomentByResidue, __pyx_k_dipoleMomentByResidue, sizeof(__pyx_k_dipoleMomentByResidue), 0, 0, 1, 1}, + {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, + {&__pyx_n_s_f2c, __pyx_k_f2c, sizeof(__pyx_k_f2c), 0, 0, 1, 1}, + {&__pyx_n_s_face_areas, __pyx_k_face_areas, sizeof(__pyx_k_face_areas), 0, 0, 1, 1}, + {&__pyx_n_s_fine2coarse, __pyx_k_fine2coarse, sizeof(__pyx_k_fine2coarse), 0, 0, 1, 1}, + {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, + {&__pyx_n_s_get_velocities, __pyx_k_get_velocities, sizeof(__pyx_k_get_velocities), 0, 0, 1, 1}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, + {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_masses, __pyx_k_masses, sizeof(__pyx_k_masses), 0, 0, 1, 1}, + {&__pyx_n_s_maxshell, __pyx_k_maxshell, sizeof(__pyx_k_maxshell), 0, 0, 1, 1}, + {&__pyx_n_s_n_atoms, __pyx_k_n_atoms, sizeof(__pyx_k_n_atoms), 0, 0, 1, 1}, + {&__pyx_n_s_n_residues, __pyx_k_n_residues, sizeof(__pyx_k_n_residues), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_newanalysis_functions, __pyx_k_newanalysis_functions, sizeof(__pyx_k_newanalysis_functions), 0, 0, 1, 1}, + {&__pyx_kp_s_newanalysis_functions_py_functio, __pyx_k_newanalysis_functions_py_functio, sizeof(__pyx_k_newanalysis_functions_py_functio), 0, 0, 1, 0}, + {&__pyx_n_s_newanalysis_helpers, __pyx_k_newanalysis_helpers, sizeof(__pyx_k_newanalysis_helpers), 0, 0, 1, 1}, + {&__pyx_n_s_newanalysis_voro, __pyx_k_newanalysis_voro, sizeof(__pyx_k_newanalysis_voro), 0, 0, 1, 1}, + {&__pyx_n_s_newaxis, __pyx_k_newaxis, sizeof(__pyx_k_newaxis), 0, 0, 1, 1}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_n_s_numres, __pyx_k_numres, sizeof(__pyx_k_numres), 0, 0, 1, 1}, + {&__pyx_n_s_positions, __pyx_k_positions, sizeof(__pyx_k_positions), 0, 0, 1, 1}, + {&__pyx_n_s_presname, __pyx_k_presname, sizeof(__pyx_k_presname), 0, 0, 1, 1}, + {&__pyx_n_s_presnum, __pyx_k_presnum, sizeof(__pyx_k_presnum), 0, 0, 1, 1}, + {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, + {&__pyx_n_s_prvname, __pyx_k_prvname, sizeof(__pyx_k_prvname), 0, 0, 1, 1}, + {&__pyx_n_s_prvnum, __pyx_k_prvnum, sizeof(__pyx_k_prvnum), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_resid, __pyx_k_resid, sizeof(__pyx_k_resid), 0, 0, 1, 1}, + {&__pyx_n_s_residueFirstAtom, __pyx_k_residueFirstAtom, sizeof(__pyx_k_residueFirstAtom), 0, 0, 1, 1}, + {&__pyx_n_s_resname, __pyx_k_resname, sizeof(__pyx_k_resname), 0, 0, 1, 1}, + {&__pyx_n_s_resnum, __pyx_k_resnum, sizeof(__pyx_k_resnum), 0, 0, 1, 1}, + {&__pyx_n_s_rfa, __pyx_k_rfa, sizeof(__pyx_k_rfa), 0, 0, 1, 1}, + {&__pyx_n_s_running, __pyx_k_running, sizeof(__pyx_k_running), 0, 0, 1, 1}, + {&__pyx_n_s_sel, __pyx_k_sel, sizeof(__pyx_k_sel), 0, 0, 1, 1}, + {&__pyx_n_s_sel_f2c, __pyx_k_sel_f2c, sizeof(__pyx_k_sel_f2c), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_timeUnit_factor, __pyx_k_timeUnit_factor, sizeof(__pyx_k_timeUnit_factor), 0, 0, 1, 1}, + {&__pyx_n_s_universe, __pyx_k_universe, sizeof(__pyx_k_universe), 0, 0, 1, 1}, + {&__pyx_n_s_vel, __pyx_k_vel, sizeof(__pyx_k_vel), 0, 0, 1, 1}, + {&__pyx_n_s_velcomByResidue, __pyx_k_velcomByResidue, sizeof(__pyx_k_velcomByResidue), 0, 0, 1, 1}, + {&__pyx_n_s_vels, __pyx_k_vels, sizeof(__pyx_k_vels), 0, 0, 1, 1}, + {&__pyx_n_s_volumes, __pyx_k_volumes, sizeof(__pyx_k_volumes), 0, 0, 1, 1}, + {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 8, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 103, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } +/* #### Code section: cached_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "src/functions/py_functions.py":118 + /* "newanalysis/functions/py_functions.py":103 + * masses = kwargs["masses"] + * if not "apr" in kwargs: + * print("Warning: apr is now calculated each timestep (very slow)! Give apr as an argument to speed up code") # <<<<<<<<<<<<<< + * apr=atomsPerResidue(sel) + * else: + */ + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Warning_apr_is_now_calculated_ea); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); + + /* "newanalysis/functions/py_functions.py":108 + * apr = kwargs["apr"] + * if not "rfa" in kwargs: + * print("Warning: rfa is now calculated each timestep (very slow)! Give rfa as an argument to speed up code") # <<<<<<<<<<<<<< + * rfa=residueFirstAtom(sel) + * else: + */ + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Warning_rfa_is_now_calculated_ea); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); + + /* "newanalysis/functions/py_functions.py":118 * def dipoleMoment(sel): * """Dipole moment of the selection.""" * return numpy.sum((sel.positions.astype('float64')-sel.center_of_mass())*sel.charges[:,numpy.newaxis],axis=0) # <<<<<<<<<<<<<< * * def dipoleMomentByResidue(sel,**kwargs): */ - __pyx_slice__2 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__2); - __Pyx_GIVEREF(__pyx_slice__2); + __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); - /* "src/functions/py_functions.py":4 + /* "newanalysis/functions/py_functions.py":4 * import sys * * def f2c(sel,i=None): # <<<<<<<<<<<<<< * if i!=None: * try: */ - __pyx_tuple__3 = PyTuple_Pack(12, __pyx_n_s_sel, __pyx_n_s_i, __pyx_n_s_box_f2c, __pyx_n_s_fine2coarse, __pyx_n_s_running, __pyx_n_s_presname, __pyx_n_s_presnum, __pyx_n_s_ctr, __pyx_n_s_a, __pyx_n_s_sel_f2c, __pyx_n_s_indices, __pyx_n_s_j); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_functions_py_functions_py, __pyx_n_s_f2c, 4, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 4, __pyx_L1_error) - __pyx_tuple__5 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_tuple__7 = PyTuple_Pack(12, __pyx_n_s_sel, __pyx_n_s_i, __pyx_n_s_box_f2c, __pyx_n_s_fine2coarse, __pyx_n_s_running, __pyx_n_s_presname, __pyx_n_s_presnum, __pyx_n_s_ctr, __pyx_n_s_a, __pyx_n_s_sel_f2c, __pyx_n_s_indices, __pyx_n_s_j); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_functions_py_functio, __pyx_n_s_f2c, 4, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); - /* "src/functions/py_functions.py":45 + /* "newanalysis/functions/py_functions.py":45 * * * def calcTessellation(sel,maxshell=3,core_sel=None,volumes=None,face_areas=None): # <<<<<<<<<<<<<< * """ * Calculates the Voronoi tessellation of the whole box with the current AtomGroup as the core selection and returns the Delaunay distance matrix. */ - __pyx_tuple__6 = PyTuple_Pack(9, __pyx_n_s_sel, __pyx_n_s_maxshell, __pyx_n_s_core_sel, __pyx_n_s_volumes, __pyx_n_s_face_areas, __pyx_n_s_calcTessellation, __pyx_n_s_corelist, __pyx_n_s_corelist_unique, __pyx_n_s_i); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(5, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_functions_py_functions_py, __pyx_n_s_calcTessellation, 45, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 45, __pyx_L1_error) - __pyx_tuple__8 = PyTuple_Pack(4, ((PyObject *)__pyx_int_3), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__10 = PyTuple_Pack(9, __pyx_n_s_sel, __pyx_n_s_maxshell, __pyx_n_s_core_sel, __pyx_n_s_volumes, __pyx_n_s_face_areas, __pyx_n_s_calcTessellation, __pyx_n_s_corelist, __pyx_n_s_corelist_unique, __pyx_n_s_i); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_functions_py_functio, __pyx_n_s_calcTessellation, 45, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(4, ((PyObject *)__pyx_int_3), Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); - /* "src/functions/py_functions.py":64 + /* "newanalysis/functions/py_functions.py":64 * return calcTessellation(sel.universe.atoms.positions.astype('float64'),sel.universe.coord.dimensions[0],f2c(sel.universe.atoms),sel.universe.atoms.n_atoms,sel.universe.atoms.n_residues,maxshell,corelist_unique,volumes,face_areas) * * def atomsPerResidue(sel): # <<<<<<<<<<<<<< * apr=numpy.zeros(sel.n_residues,dtype=numpy.int32) * curnum=sel.atoms[0].resid */ - __pyx_tuple__9 = PyTuple_Pack(8, __pyx_n_s_sel, __pyx_n_s_apr, __pyx_n_s_curnum, __pyx_n_s_prvnum, __pyx_n_s_curname, __pyx_n_s_prvname, __pyx_n_s_idx, __pyx_n_s_i); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_functions_py_functions_py, __pyx_n_s_atomsPerResidue, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_tuple__13 = PyTuple_Pack(8, __pyx_n_s_sel, __pyx_n_s_apr, __pyx_n_s_curnum, __pyx_n_s_prvnum, __pyx_n_s_curname, __pyx_n_s_prvname, __pyx_n_s_idx, __pyx_n_s_i); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_functions_py_functio, __pyx_n_s_atomsPerResidue, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 64, __pyx_L1_error) - /* "src/functions/py_functions.py":82 + /* "newanalysis/functions/py_functions.py":82 * * * def residueFirstAtom(sel): # <<<<<<<<<<<<<< * rfa=numpy.zeros(sel.n_residues,dtype=numpy.int32) * apr=atomsPerResidue(sel) */ - __pyx_tuple__11 = PyTuple_Pack(5, __pyx_n_s_sel, __pyx_n_s_rfa, __pyx_n_s_apr, __pyx_n_s_ctr, __pyx_n_s_i); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_functions_py_functions_py, __pyx_n_s_residueFirstAtom, 82, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(5, __pyx_n_s_sel, __pyx_n_s_rfa, __pyx_n_s_apr, __pyx_n_s_ctr, __pyx_n_s_i); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_functions_py_functio, __pyx_n_s_residueFirstAtom, 82, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 82, __pyx_L1_error) - /* "src/functions/py_functions.py":91 + /* "newanalysis/functions/py_functions.py":91 * return rfa * * def centerOfMassByResidue(sel,**kwargs): # <<<<<<<<<<<<<< * """Returns an array of the centers of mass of all residues in the current AtomGroup""" * from newanalysis.helpers import comByResidue */ - __pyx_tuple__13 = PyTuple_Pack(8, __pyx_n_s_sel, __pyx_n_s_kwargs, __pyx_n_s_comByResidue, __pyx_n_s_coor, __pyx_n_s_masses, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_numres); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_functions_py_functions_py, __pyx_n_s_centerOfMassByResidue, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(8, __pyx_n_s_sel, __pyx_n_s_kwargs, __pyx_n_s_comByResidue, __pyx_n_s_coor, __pyx_n_s_masses, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_numres); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_functions_py_functio, __pyx_n_s_centerOfMassByResidue, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 91, __pyx_L1_error) - /* "src/functions/py_functions.py":116 + /* "newanalysis/functions/py_functions.py":116 * return comByResidue(coor,masses,numres,apr,rfa) * * def dipoleMoment(sel): # <<<<<<<<<<<<<< * """Dipole moment of the selection.""" * return numpy.sum((sel.positions.astype('float64')-sel.center_of_mass())*sel.charges[:,numpy.newaxis],axis=0) */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_sel); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_functions_py_functions_py, __pyx_n_s_dipoleMoment, 116, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_sel); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_functions_py_functio, __pyx_n_s_dipoleMoment, 116, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 116, __pyx_L1_error) - /* "src/functions/py_functions.py":120 + /* "newanalysis/functions/py_functions.py":120 * return numpy.sum((sel.positions.astype('float64')-sel.center_of_mass())*sel.charges[:,numpy.newaxis],axis=0) * * def dipoleMomentByResidue(sel,**kwargs): # <<<<<<<<<<<<<< * """Returns an array of the dipole moments of all residues in the current AtomGroup""" * from newanalysis.helpers import dipByResidue */ - __pyx_tuple__17 = PyTuple_Pack(10, __pyx_n_s_sel, __pyx_n_s_kwargs, __pyx_n_s_dipByResidue, __pyx_n_s_charges, __pyx_n_s_masses, __pyx_n_s_coor, __pyx_n_s_com, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_numres); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_functions_py_functions_py, __pyx_n_s_dipoleMomentByResidue, 120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(10, __pyx_n_s_sel, __pyx_n_s_kwargs, __pyx_n_s_dipByResidue, __pyx_n_s_charges, __pyx_n_s_masses, __pyx_n_s_coor, __pyx_n_s_com, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_numres); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_functions_py_functio, __pyx_n_s_dipoleMomentByResidue, 120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 120, __pyx_L1_error) - /* "src/functions/py_functions.py":153 + /* "newanalysis/functions/py_functions.py":153 * return dipByResidue(coor,charges,masses,numres,apr,rfa,com) * * def velcomByResidue(sel,**kwargs): # <<<<<<<<<<<<<< * """ * Gives array of center-of-mass velocites of all residues in the current AtomGroup. */ - __pyx_tuple__19 = PyTuple_Pack(8, __pyx_n_s_sel, __pyx_n_s_kwargs, __pyx_n_s_velcomByResidue, __pyx_n_s_vels, __pyx_n_s_masses, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_numres); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_functions_py_functions_py, __pyx_n_s_velcomByResidue, 153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(8, __pyx_n_s_sel, __pyx_n_s_kwargs, __pyx_n_s_velcomByResidue, __pyx_n_s_vels, __pyx_n_s_masses, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_numres); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_functions_py_functio, __pyx_n_s_velcomByResidue, 153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 153, __pyx_L1_error) - /* "src/functions/py_functions.py":180 + /* "newanalysis/functions/py_functions.py":180 * return velcomByResidue(vels,masses,numres,apr,rfa) * * def get_velocities(sel): # <<<<<<<<<<<<<< * from MDAnalysis.units import timeUnit_factor * vel=numpy.ascontiguousarray(sel.positions*timeUnit_factor['AKMA'],dtype='double') */ - __pyx_tuple__21 = PyTuple_Pack(3, __pyx_n_s_sel, __pyx_n_s_timeUnit_factor, __pyx_n_s_vel); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_functions_py_functions_py, __pyx_n_s_get_velocities, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(3, __pyx_n_s_sel, __pyx_n_s_timeUnit_factor, __pyx_n_s_vel); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_functions_py_functio, __pyx_n_s_get_velocities, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } +/* #### Code section: init_constants ### */ -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error) +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -5985,6 +7637,12 @@ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { __pyx_L1_error:; return -1; } +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + return 0; +} +/* #### Code section: init_module ### */ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ @@ -6051,6 +7709,55 @@ static int __Pyx_modinit_function_import_code(void) { } +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_functions(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_functions}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "functions", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #elif PY_MAJOR_VERSION < 3 @@ -6101,12 +7808,21 @@ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { } return 0; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else result = PyDict_SetItemString(moddict, to_name, value); +#endif } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -6116,8 +7832,9 @@ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject } return result; } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) @@ -6127,8 +7844,12 @@ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNU module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; +#endif if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; @@ -6144,7 +7865,12 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_functions(PyObject *__pyx_pyinit_m #endif #endif { + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6158,6 +7884,35 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_functions(PyObject *__pyx_pyinit_m #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("functions", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to functions pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { @@ -6176,48 +7931,31 @@ if (!__Pyx_RefNanny) { __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("functions", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -6229,7 +7967,7 @@ if (!__Pyx_RefNanny) { { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "newanalysis.functions")) { - if (unlikely(PyDict_SetItemString(modules, "newanalysis.functions", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((PyDict_SetItemString(modules, "newanalysis.functions", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif @@ -6250,157 +7988,167 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "src/functions/py_functions.py":1 + /* "newanalysis/functions/py_functions.py":1 * import numpy # <<<<<<<<<<<<<< * import sys * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":2 + /* "newanalysis/functions/py_functions.py":2 * import numpy * import sys # <<<<<<<<<<<<<< * * def f2c(sel,i=None): */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_sys, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":4 + /* "newanalysis/functions/py_functions.py":4 * import sys * * def f2c(sel,i=None): # <<<<<<<<<<<<<< * if i!=None: * try: */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_1f2c, 0, __pyx_n_s_f2c, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_f2c, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_1f2c, 0, __pyx_n_s_f2c, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_f2c, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":45 + /* "newanalysis/functions/py_functions.py":45 * * * def calcTessellation(sel,maxshell=3,core_sel=None,volumes=None,face_areas=None): # <<<<<<<<<<<<<< * """ * Calculates the Voronoi tessellation of the whole box with the current AtomGroup as the core selection and returns the Delaunay distance matrix. */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_3calcTessellation, 0, __pyx_n_s_calcTessellation, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__8); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcTessellation, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_3calcTessellation, 0, __pyx_n_s_calcTessellation, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__12); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcTessellation, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":64 + /* "newanalysis/functions/py_functions.py":64 * return calcTessellation(sel.universe.atoms.positions.astype('float64'),sel.universe.coord.dimensions[0],f2c(sel.universe.atoms),sel.universe.atoms.n_atoms,sel.universe.atoms.n_residues,maxshell,corelist_unique,volumes,face_areas) * * def atomsPerResidue(sel): # <<<<<<<<<<<<<< * apr=numpy.zeros(sel.n_residues,dtype=numpy.int32) * curnum=sel.atoms[0].resid */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_5atomsPerResidue, 0, __pyx_n_s_atomsPerResidue, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_atomsPerResidue, __pyx_t_1) < 0) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_5atomsPerResidue, 0, __pyx_n_s_atomsPerResidue, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_atomsPerResidue, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":82 + /* "newanalysis/functions/py_functions.py":82 * * * def residueFirstAtom(sel): # <<<<<<<<<<<<<< * rfa=numpy.zeros(sel.n_residues,dtype=numpy.int32) * apr=atomsPerResidue(sel) */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_7residueFirstAtom, 0, __pyx_n_s_residueFirstAtom, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_residueFirstAtom, __pyx_t_1) < 0) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_7residueFirstAtom, 0, __pyx_n_s_residueFirstAtom, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_residueFirstAtom, __pyx_t_2) < 0) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":91 + /* "newanalysis/functions/py_functions.py":91 * return rfa * * def centerOfMassByResidue(sel,**kwargs): # <<<<<<<<<<<<<< * """Returns an array of the centers of mass of all residues in the current AtomGroup""" * from newanalysis.helpers import comByResidue */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_9centerOfMassByResidue, 0, __pyx_n_s_centerOfMassByResidue, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_centerOfMassByResidue, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_9centerOfMassByResidue, 0, __pyx_n_s_centerOfMassByResidue, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_centerOfMassByResidue, __pyx_t_2) < 0) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":116 + /* "newanalysis/functions/py_functions.py":116 * return comByResidue(coor,masses,numres,apr,rfa) * * def dipoleMoment(sel): # <<<<<<<<<<<<<< * """Dipole moment of the selection.""" * return numpy.sum((sel.positions.astype('float64')-sel.center_of_mass())*sel.charges[:,numpy.newaxis],axis=0) */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_11dipoleMoment, 0, __pyx_n_s_dipoleMoment, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipoleMoment, __pyx_t_1) < 0) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_11dipoleMoment, 0, __pyx_n_s_dipoleMoment, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipoleMoment, __pyx_t_2) < 0) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":120 + /* "newanalysis/functions/py_functions.py":120 * return numpy.sum((sel.positions.astype('float64')-sel.center_of_mass())*sel.charges[:,numpy.newaxis],axis=0) * * def dipoleMomentByResidue(sel,**kwargs): # <<<<<<<<<<<<<< * """Returns an array of the dipole moments of all residues in the current AtomGroup""" * from newanalysis.helpers import dipByResidue */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_13dipoleMomentByResidue, 0, __pyx_n_s_dipoleMomentByResidue, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipoleMomentByResidue, __pyx_t_1) < 0) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_13dipoleMomentByResidue, 0, __pyx_n_s_dipoleMomentByResidue, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipoleMomentByResidue, __pyx_t_2) < 0) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":153 + /* "newanalysis/functions/py_functions.py":153 * return dipByResidue(coor,charges,masses,numres,apr,rfa,com) * * def velcomByResidue(sel,**kwargs): # <<<<<<<<<<<<<< * """ * Gives array of center-of-mass velocites of all residues in the current AtomGroup. */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_15velcomByResidue, 0, __pyx_n_s_velcomByResidue, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_velcomByResidue, __pyx_t_1) < 0) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_15velcomByResidue, 0, __pyx_n_s_velcomByResidue, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_velcomByResidue, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":180 + /* "newanalysis/functions/py_functions.py":180 * return velcomByResidue(vels,masses,numres,apr,rfa) * * def get_velocities(sel): # <<<<<<<<<<<<<< * from MDAnalysis.units import timeUnit_factor * vel=numpy.ascontiguousarray(sel.positions*timeUnit_factor['AKMA'],dtype='double') */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_17get_velocities, 0, __pyx_n_s_get_velocities, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_velocities, __pyx_t_1) < 0) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9functions_17get_velocities, 0, __pyx_n_s_get_velocities, NULL, __pyx_n_s_newanalysis_functions, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_velocities, __pyx_t_2) < 0) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/functions/py_functions.py":1 + /* "newanalysis/functions/py_functions.py":1 * import numpy # <<<<<<<<<<<<<< * import sys * */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { - if (__pyx_d) { + if (__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init newanalysis.functions", __pyx_clineno, __pyx_lineno, __pyx_filename); } + #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init newanalysis.functions"); } @@ -6414,6 +8162,22 @@ if (!__Pyx_RefNanny) { return; #endif } +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ @@ -6433,6 +8197,106 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + /* PyObjectGetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { @@ -6447,10 +8311,32 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject } #endif +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); @@ -6461,6 +8347,213 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) +} +#endif + /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, @@ -6478,6 +8571,7 @@ static void __Pyx_RaiseDoubleKeywordsError( /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, + PyObject *const *kwvalues, PyObject **argnames[], PyObject *kwds2, PyObject *values[], @@ -6488,13 +8582,54 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); // transfer ownership of value to values + Py_DECREF(key); +#endif + key = NULL; + value = NULL; continue; } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_Check(key))) { @@ -6502,6 +8637,9 @@ static int __Pyx_ParseOptionalKeywords( if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif break; } name++; @@ -6522,14 +8660,18 @@ static int __Pyx_ParseOptionalKeywords( #endif if (likely(PyUnicode_Check(key))) { while (*name) { - int cmp = (**name == key) ? 0 : + int cmp = ( #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif - PyUnicode_Compare(**name, key); + PyUnicode_Compare(**name, key) + ); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif break; } name++; @@ -6556,6 +8698,8 @@ static int __Pyx_ParseOptionalKeywords( goto invalid_keyword; } } + Py_XDECREF(key); + Py_XDECREF(value); return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); @@ -6565,15 +8709,18 @@ static int __Pyx_ParseOptionalKeywords( "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: - PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else + PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: + Py_XDECREF(key); + Py_XDECREF(value); return -1; } @@ -6628,12 +8775,12 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { #endif /* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; @@ -6645,21 +8792,46 @@ __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; - #else + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; - #endif Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); + #endif } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; @@ -6680,31 +8852,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); -} -#endif - -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; icurexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + #endif } #endif @@ -6715,20 +8863,32 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { - PyObject *local_type, *local_value, *local_tb; + PyObject *local_type = NULL, *local_value, *local_tb = NULL; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; + #endif #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) @@ -6750,12 +8910,21 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; + #endif } #else tmp_type = tstate->exc_type; @@ -6825,6 +8994,14 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) } else if (unlikely(PyErr_Occurred())) { return NULL; } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } #else result = PyDict_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) @@ -6865,15 +9042,17 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg /* PyIntBinop */ #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long x; long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); + + x = (long)((unsigned long)a + (unsigned long)b); if (likely((x^a) >= 0 || (x^b) >= 0)) return PyInt_FromLong(x); return PyLong_Type.tp_as_number->nb_add(op1, op2); @@ -6887,77 +9066,79 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED const PY_LONG_LONG llb = intval; PY_LONG_LONG lla, llx; #endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op2); + } + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); switch (size) { case -2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; default: return PyLong_Type.tp_as_number->nb_add(op1, op2); @@ -6976,8 +9157,13 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED #endif if (PyFloat_CheckExact(op1)) { const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else double a = PyFloat_AS_DOUBLE(op1); +#endif double result; + PyFPE_START_PROTECT("add", return NULL) result = ((double)a) + (double)b; PyFPE_END_PROTECT(result) @@ -6989,15 +9175,17 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED /* PyIntBinop */ #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; +static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long x; long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a - b); + + x = (long)((unsigned long)a - (unsigned long)b); if (likely((x^a) >= 0 || (x^~b) >= 0)) return PyInt_FromLong(x); return PyLong_Type.tp_as_number->nb_subtract(op1, op2); @@ -7011,77 +9199,79 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U const PY_LONG_LONG llb = intval; PY_LONG_LONG lla, llx; #endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return PyLong_FromLong(-intval); + } + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); switch (size) { case -2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); @@ -7100,8 +9290,13 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U #endif if (PyFloat_CheckExact(op1)) { const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else double a = PyFloat_AS_DOUBLE(op1); +#endif double result; + PyFPE_START_PROTECT("subtract", return NULL) result = ((double)a) - (double)b; PyFPE_END_PROTECT(result) @@ -7114,7 +9309,7 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; - if (!j) return NULL; + if (unlikely(!j)) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; @@ -7175,10 +9370,18 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return r; } } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); if (likely(l >= 0)) { i += l; } else { @@ -7187,7 +9390,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, PyErr_Clear(); } } - return m->sq_item(o, i); + return sm->sq_item(o, i); } } #else @@ -7198,60 +9401,8 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -/* ObjectGetItem */ -#if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr = NULL; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); - } - return __Pyx_PyObject_GetIndex(obj, key); -} -#endif - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); - } -} -#endif - /* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; @@ -7280,7 +9431,6 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args --tstate->recursion_depth; return result; } -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); @@ -7296,7 +9446,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { return NULL; } if ( @@ -7367,7 +9517,6 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, return result; } #endif -#endif /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON @@ -7389,81 +9538,170 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject } #endif -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); return result; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) +#else + if (PyCFunction_Check(func)) #endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + } + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } + } + } #endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); } } - return __Pyx__PyObject_CallOneArg(func, arg); + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + #if CYTHON_VECTORCALL + #if Py_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); + } + #endif + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); } -#else + +/* PyObjectCallOneArg */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (meth) { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); } #endif /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; PyObject *module = 0; - PyObject *global_dict = 0; PyObject *empty_dict = 0; - PyObject *list; + PyObject *empty_list = 0; #if PY_MAJOR_VERSION < 3 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) + if (unlikely(!py_import)) goto bad; - #endif - if (from_list) - list = from_list; - else { + if (!from_list) { empty_list = PyList_New(0); - if (!empty_list) + if (unlikely(!empty_list)) goto bad; - list = empty_list; + from_list = empty_list; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; + #endif empty_dict = PyDict_New(); - if (!empty_dict) + if (unlikely(!empty_dict)) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) goto bad; PyErr_Clear(); } @@ -7474,23 +9712,23 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { if (!module) { #if PY_MAJOR_VERSION < 3 PyObject *py_level = PyInt_FromLong(level); - if (!py_level) + if (unlikely(!py_level)) goto bad; module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); + name, __pyx_d, empty_dict, from_list, level); #endif } } bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); #if PY_MAJOR_VERSION < 3 Py_XDECREF(py_import); #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); return module; } @@ -7498,6 +9736,35 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 "cannot import name %.230s", PyString_AS_STRING(name)); @@ -7505,110 +9772,401 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { "cannot import name %S", name); #endif } - return value; + return value; +} + +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); + } + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); +#endif + return imported_module; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; + } + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; } - -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__6; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); + } + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); } -/* PyObjectCallNoArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } +/* FixUpExtensionType */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } #endif -#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) #else - if (likely(PyCFunction_Check(func))) + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } #endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); + } + memb++; } + if (changed) + PyType_Modified(type); } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +#endif + return 0; } #endif +/* FetchSharedCythonModule */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; +} + /* FetchCommonType */ +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +#if !CYTHON_USE_TYPE_SPECS static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { goto bad; } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { goto bad; } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; + goto done; } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; done: - Py_DECREF(fake_module); - return cached_type; + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } +#endif + +/* PyVectorcallFastCallDict */ +#if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif /* CythonFunctionShared */ -#include +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + CYTHON_UNUSED_VAR(closure); if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { #if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #endif if (unlikely(op->func_doc == NULL)) return NULL; @@ -7616,30 +10174,33 @@ __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure Py_INCREF(Py_None); return Py_None; } +#endif } Py_INCREF(op->func_doc); return op->func_doc; } static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp = op->func_doc; + CYTHON_UNUSED_VAR(context); if (value == NULL) { value = Py_None; } Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_doc, value); return 0; } static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#elif PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; @@ -7648,9 +10209,9 @@ __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_name; } static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -7661,22 +10222,21 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "__name__ must be set to a string object"); return -1; } - tmp = op->func_name; Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_name, value); return 0; } static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_qualname); return op->func_qualname; } static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -7687,25 +10247,14 @@ __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHO "__qualname__ must be set to a string object"); return -1; } - tmp = op->func_qualname; Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); return 0; } static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) @@ -7715,9 +10264,9 @@ __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_dict; } static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL)) { PyErr_SetString(PyExc_TypeError, "function's dictionary may not be deleted"); @@ -7728,28 +10277,30 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "setting function's dictionary to a non-dict"); return -1; } - tmp = op->func_dict; Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_dict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); Py_INCREF(Py_None); return Py_None; } static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) { PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); Py_INCREF(result); return result; } @@ -7765,10 +10316,10 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); Py_INCREF(op->defaults_kwdict); #else - op->defaults_tuple = PySequence_ITEM(res, 0); + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); if (unlikely(!op->defaults_tuple)) result = -1; else { - op->defaults_kwdict = PySequence_ITEM(res, 1); + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); if (unlikely(!op->defaults_kwdict)) result = -1; } #endif @@ -7776,27 +10327,28 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { return result; } static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); return 0; } static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_tuple; } else { result = Py_None; @@ -7806,27 +10358,28 @@ __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *co return result; } static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_kwdict; } else { result = Py_None; @@ -7836,24 +10389,23 @@ __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void * return result; } static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value || value == Py_None) { value = NULL; - } else if (!PyDict_Check(value)) { + } else if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); return 0; } static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; @@ -7862,13 +10414,62 @@ __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void Py_INCREF(result); return result; } +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); + } +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, @@ -7881,49 +10482,88 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif {0, 0, 0, 0, 0} }; static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) { + CYTHON_UNUSED_VAR(args); #if PY_MAJOR_VERSION >= 3 Py_INCREF(m->func_qualname); return m->func_qualname; #else - return PyString_FromString(m->func.m_ml->ml_name); + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); #endif } static PyMethodDef __pyx_CyFunction_methods[] = { {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, {0, 0, 0, 0} }; -#if PY_VERSION_HEX < 0x030500A0 +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif if (unlikely(op == NULL)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif Py_XINCREF(closure); op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API Py_XINCREF(module); - op->func.m_module = module; + cf->m_module = module; +#endif op->func_dict = NULL; op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); @@ -7935,23 +10575,62 @@ static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef * op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif Py_CLEAR(m->func_dict); Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -7967,7 +10646,7 @@ static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); + __Pyx_PyHeapTypeObject_GC_Del(m); } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { @@ -7977,16 +10656,23 @@ static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif Py_VISIT(m->func_dict); Py_VISIT(m->func_name); Py_VISIT(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -7995,24 +10681,6 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, } return 0; } -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ -#if PY_MAJOR_VERSION < 3 - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; -#endif - return __Pyx_PyMethod_New(func, obj, type); -} static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { @@ -8025,10 +10693,22 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) #endif } static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyObject *py_name = NULL; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) return (*meth)(self, arg); @@ -8037,24 +10717,43 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif if (likely(size == 0)) return (*meth)(self, NULL); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); +#endif return NULL; } break; case METH_O: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif if (likely(size == 1)) { PyObject *result, *arg0; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS arg0 = PyTuple_GET_ITEM(arg, 0); #else - arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; #endif result = (*meth)(self, arg0); #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) @@ -8062,33 +10761,72 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py #endif return result; } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else PyErr_Format(PyExc_TypeError, "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); +#endif return NULL; } break; default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); return NULL; } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", + py_name); + Py_DECREF(py_name); +#else PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", f->m_ml->ml_name); +#endif return NULL; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; } static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { Py_ssize_t argc; PyObject *new_args; PyObject *self; +#if CYTHON_ASSUME_SAFE_MACROS argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(!argc) < 0) return NULL; +#endif new_args = PyTuple_GetSlice(args, 1, argc); if (unlikely(!new_args)) return NULL; @@ -8112,13 +10850,175 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P } return result; } +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else static PyTypeObject __pyx_CyFunctionType_type = { PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif 0, 0, #if PY_MAJOR_VERSION < 3 @@ -8136,7 +11036,13 @@ static PyTypeObject __pyx_CyFunctionType_type = { 0, 0, 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, 0, (traverseproc) __Pyx_CyFunction_traverse, (inquiry) __Pyx_CyFunction_clear, @@ -8153,7 +11059,7 @@ static PyTypeObject __pyx_CyFunctionType_type = { __pyx_CyFunction_getsets, 0, 0, - __Pyx_CyFunction_descr_get, + __Pyx_PyMethod_New, 0, offsetof(__pyx_CyFunctionObject, func_dict), 0, @@ -8174,15 +11080,24 @@ static PyTypeObject __pyx_CyFunctionType_type = { #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, #endif -#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 0, #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, #endif }; -static int __pyx_CyFunction_init(void) { +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif if (unlikely(__pyx_CyFunctionType == NULL)) { return -1; } @@ -8227,38 +11142,15 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qual return op; } -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -8272,7 +11164,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -8294,6 +11186,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { @@ -8372,17 +11265,99 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + PyErr_Clear(); + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #endif +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + py_funcname = PyUnicode_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -8417,6 +11392,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -8479,111 +11455,6 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } - -/* Print */ -#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static PyObject *__Pyx_GetStdout(void) { - PyObject *f = PySys_GetObject((char *)"stdout"); - if (!f) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); - } - return f; -} -static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - int i; - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { - PyObject* v; - if (PyFile_SoftSpace(f, 1)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - v = PyTuple_GET_ITEM(arg_tuple, i); - if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - goto error; - if (PyString_Check(v)) { - char *s = PyString_AsString(v); - Py_ssize_t len = PyString_Size(v); - if (len > 0) { - switch (s[len-1]) { - case ' ': break; - case '\f': case '\r': case '\n': case '\t': case '\v': - PyFile_SoftSpace(f, 0); - break; - default: break; - } - } - } - } - if (newline) { - if (PyFile_WriteString("\n", f) < 0) - goto error; - PyFile_SoftSpace(f, 0); - } - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; -} -#else -static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { - PyObject* kwargs = 0; - PyObject* result = 0; - PyObject* end_string; - if (unlikely(!__pyx_print)) { - __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print); - if (!__pyx_print) - return -1; - } - if (stream) { - kwargs = PyDict_New(); - if (unlikely(!kwargs)) - return -1; - if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0)) - goto bad; - if (!newline) { - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - goto bad; - if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - goto bad; - } - Py_DECREF(end_string); - } - } else if (!newline) { - if (unlikely(!__pyx_print_kwargs)) { - __pyx_print_kwargs = PyDict_New(); - if (unlikely(!__pyx_print_kwargs)) - return -1; - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - return -1; - if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - return -1; - } - Py_DECREF(end_string); - } - kwargs = __pyx_print_kwargs; - } - result = PyObject_Call(__pyx_print, arg_tuple, kwargs); - if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) - Py_DECREF(kwargs); - if (!result) - return -1; - Py_DECREF(result); - return 0; -bad: - if (kwargs != __pyx_print_kwargs) - Py_XDECREF(kwargs); - return -1; -} #endif /* CIntToPy */ @@ -8619,45 +11490,48 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } -/* PrintOne */ -#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static int __Pyx_PrintOne(PyObject* f, PyObject *o) { - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - if (PyFile_SoftSpace(f, 0)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__27); } - if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) - goto error; - if (PyFile_WriteString("\n", f) < 0) - goto error; - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; - /* the line below is just to avoid C compiler - * warnings about unused functions */ - return __Pyx_Print(f, NULL, 0); -} -#else -static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { - int res; - PyObject* arg_tuple = PyTuple_Pack(1, o); - if (unlikely(!arg_tuple)) - return -1; - res = __Pyx_Print(stream, arg_tuple, 1); - Py_DECREF(arg_tuple); - return res; + return name; } #endif @@ -8696,7 +11570,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -8710,40 +11584,45 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -8756,109 +11635,181 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -8892,7 +11843,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -8906,40 +11857,45 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -8952,109 +11908,181 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -9079,7 +12107,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { - a = a->tp_base; + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } @@ -9100,6 +12128,22 @@ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { } return __Pyx_InBases(a, b); } +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} #if PY_MAJOR_VERSION == 2 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { PyObject *exception, *value, *tb; @@ -9124,11 +12168,11 @@ static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc } #else static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } - return res; } #endif static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { @@ -9205,7 +12249,7 @@ static int __Pyx_check_binary_version(void) { rtversion[i] = rt_from_call[i]; } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -9214,9 +12258,31 @@ static int __Pyx_check_binary_version(void) { } /* InitStrings */ +#if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -9224,23 +12290,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -9302,7 +12356,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -9331,22 +12385,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -9412,13 +12470,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -9486,4 +12542,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/newanalysis/gfunction/gfunction.cpp b/newanalysis/gfunction/gfunction.cpp index fdf22ab..03d29e9 100644 --- a/newanalysis/gfunction/gfunction.cpp +++ b/newanalysis/gfunction/gfunction.cpp @@ -1,22 +1,68 @@ -/* Generated by Cython 0.29.34 */ +/* Generated by Cython 3.0.2 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayscalars.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ufuncobject.h" + ], + "extra_compile_args": [ + "-fopenmp" + ], + "extra_link_args": [ + "-fopenmp" + ], + "include_dirs": [ + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include" + ], + "language": "c++", + "name": "newanalysis.gfunction", + "sources": [ + "newanalysis/gfunction/gfunction.pyx" + ] + }, + "module_name": "newanalysis.gfunction" +} +END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_34" -#define CYTHON_HEX_VERSION 0x001D22F0 -#define CYTHON_FUTURE_DIVISION 0 +#if CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" +#else +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_2" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030002F0 +#define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -35,9 +81,7 @@ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -45,13 +89,19 @@ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -76,10 +126,19 @@ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS @@ -89,44 +148,121 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK @@ -136,8 +272,9 @@ #endif #elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 @@ -181,16 +318,17 @@ #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -199,11 +337,8 @@ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5) + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 @@ -226,29 +361,47 @@ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) + #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 @@ -257,6 +410,10 @@ #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -285,6 +442,17 @@ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -298,13 +466,16 @@ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -312,28 +483,59 @@ # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; + #else + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -343,13 +545,26 @@ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." @@ -373,91 +588,151 @@ class __Pyx_FakeReference { T *operator->() { return ptr; } T *operator&() { return ptr; } operator T&() { return *ptr; } - template bool operator ==(U other) { return *ptr == other; } - template bool operator !=(U other) { return *ptr != other; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } private: T *ptr; }; -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + PyObject *version_info; // borrowed + PyObject *py_minor_version = NULL; + long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; - } - end: - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(call_result); - Py_XDECREF(empty); + #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 + minor_version = 11; // we don't yet need to distinguish between versions > 11 + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + Py_XDECREF(py_minor_version); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here + if (!empty_bytes) return NULL; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -471,6 +746,12 @@ class __Pyx_FakeReference { #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -485,30 +766,53 @@ class __Pyx_FakeReference { #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -517,6 +821,22 @@ class __Pyx_FakeReference { #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -547,6 +867,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -559,12 +901,69 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) +#else + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) @@ -575,10 +974,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else @@ -596,11 +995,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -611,14 +1010,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -647,8 +1052,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -658,15 +1069,33 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif #if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -678,6 +1107,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -695,11 +1127,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -744,12 +1171,17 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" #endif #define __PYX_HAVE__newanalysis__gfunction @@ -757,18 +1189,17 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + #include "numpy/arrayobject.h" #include "numpy/ndarrayobject.h" #include "numpy/ndarraytypes.h" #include "numpy/arrayscalars.h" #include "numpy/ufuncobject.h" - - /* NumPy API declarations from "numpy/__init__.pxd" */ - #include #include "pythread.h" #include -#include "pystate.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -837,9 +1268,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -847,11 +1278,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -877,7 +1319,52 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -899,7 +1386,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -964,23 +1451,19 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; /* Header.proto */ #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__)) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 @@ -998,15 +1481,28 @@ static const char *__pyx_filename; #define _Complex_I 1.0fj #endif +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { - "src/gfunction/gfunction.pyx", - "__init__.pxd", - "stringsource", + "newanalysis/gfunction/gfunction.pyx", + "", + "__init__.cython-30.pxd", "type.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + /* BufferFormatStructs.proto */ -#define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { @@ -1041,29 +1537,6 @@ typedef struct { char is_valid_array; } __Pyx_BufFmt_Context; -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif - -/* MemviewSliceStruct.proto */ -struct __pyx_memoryview_obj; -typedef struct { - struct __pyx_memoryview_obj *memview; - char *data; - Py_ssize_t shape[8]; - Py_ssize_t strides[8]; - Py_ssize_t suboffsets[8]; -} __Pyx_memviewslice; -#define __Pyx_MemoryView_Len(m) (m.shape[0]) - /* Atomics.proto */ #include #ifndef CYTHON_ATOMICS @@ -1071,7 +1544,44 @@ typedef struct { #endif #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS #define __pyx_atomic_int_type int -#if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_incr_aligned(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_incr_aligned(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1) @@ -1079,10 +1589,11 @@ typedef struct { #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif -#elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL +#elif CYTHON_ATOMICS && defined(_MSC_VER) #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type long + #define __pyx_nonatomic_int_type long #pragma intrinsic (_InterlockedExchangeAdd) #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1) @@ -1096,7 +1607,6 @@ typedef struct { #warning "Not using atomics" #endif #endif -typedef volatile __pyx_atomic_int_type __pyx_atomic_int; #if CYTHON_ATOMICS #define __pyx_add_acquisition_count(memview)\ __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview)) @@ -1109,8 +1619,20 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) #endif +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) + +/* #### Code section: numeric_typedefs ### */ -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":689 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":730 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -1119,7 +1641,7 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":690 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":731 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -1128,7 +1650,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":691 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":732 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -1137,7 +1659,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":692 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":733 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -1146,7 +1668,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":696 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":737 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -1155,7 +1677,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":697 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":738 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -1164,7 +1686,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":698 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":739 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -1173,7 +1695,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":699 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":740 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -1182,7 +1704,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":703 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":744 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -1191,7 +1713,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":704 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":745 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -1200,61 +1722,43 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":713 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":754 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t + * */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":714 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":755 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":715 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":717 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":757 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t + * */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":718 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":758 * * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t - * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":719 - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":721 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":760 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1263,7 +1767,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":722 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":761 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1272,7 +1776,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":724 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":763 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1281,7 +1785,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":725 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":764 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1290,7 +1794,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":726 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":765 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1298,8 +1802,9 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* #### Code section: complex_type_declarations ### */ /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else @@ -1311,7 +1816,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else @@ -1322,6 +1827,7 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_array_obj; @@ -1329,7 +1835,7 @@ struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":728 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":767 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1338,7 +1844,7 @@ struct __pyx_memoryviewslice_obj; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":729 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":768 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1347,7 +1853,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":730 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":769 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1356,7 +1862,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":732 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":771 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1365,8 +1871,8 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1390,7 +1896,7 @@ struct __pyx_array_obj { }; -/* "View.MemoryView":280 +/* "View.MemoryView":302 * * @cname('__pyx_MemviewEnum') * cdef class Enum(object): # <<<<<<<<<<<<<< @@ -1403,10 +1909,10 @@ struct __pyx_MemviewEnum_obj { }; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1417,8 +1923,7 @@ struct __pyx_memoryview_obj { PyObject *_size; PyObject *_array_interface; PyThread_type_lock lock; - __pyx_atomic_int acquisition_count[2]; - __pyx_atomic_int *acquisition_count_aligned_p; + __pyx_atomic_int_type acquisition_count; Py_buffer view; int flags; int dtype_is_object; @@ -1426,8 +1931,8 @@ struct __pyx_memoryview_obj { }; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1443,8 +1948,8 @@ struct __pyx_memoryviewslice_obj { -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1457,10 +1962,10 @@ struct __pyx_vtabstruct_array { static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1473,12 +1978,13 @@ struct __pyx_vtabstruct_memoryview { PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); }; static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1489,6 +1995,7 @@ struct __pyx_vtabstruct__memoryviewslice { struct __pyx_vtabstruct_memoryview __pyx_base; }; static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1497,11 +2004,11 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1511,28 +2018,40 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1543,6 +2062,10 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1554,6 +2077,57 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); @@ -1561,53 +2135,126 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); -/* PyObjectSetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) #else -#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) -#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) +#endif +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) + #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) +#else + #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op + #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs + #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS + #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) + #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) #endif -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, + const char* function_name); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif -#if CYTHON_FAST_PYCALL - static size_t __pyx_pyframe_localsplus_offset = 0; +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL +#endif +#endif #endif /* PyObjectCall.proto */ @@ -1622,152 +2269,110 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC #endif -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); +/* BuildPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char); -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); -#endif +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +/* JoinPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); + +/* StrEquals.proto */ +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals #else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals #endif -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +/* PyObjectFormatSimple.proto */ +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#elif PY_MAJOR_VERSION < 3 + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\ + PyObject_Format(s, f)) +#elif CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ + likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ + PyObject_Format(s, f)) #else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) #endif -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* IsLittleEndian.proto */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); -/* BufferFormatCheck.proto */ -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type); +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); -/* BufferGetAndValidate.proto */ -#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ - ((obj == Py_None || obj == NULL) ?\ - (__Pyx_ZeroBuffer(buf), 0) :\ - __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) -static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, - __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static void __Pyx_ZeroBuffer(Py_buffer* buf); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; -static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); #else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); -/* MemviewSliceInit.proto */ -#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d -#define __Pyx_MEMVIEW_DIRECT 1 -#define __Pyx_MEMVIEW_PTR 2 -#define __Pyx_MEMVIEW_FULL 4 -#define __Pyx_MEMVIEW_CONTIG 8 -#define __Pyx_MEMVIEW_STRIDED 16 -#define __Pyx_MEMVIEW_FOLLOW 32 -#define __Pyx_IS_C_CONTIG 1 -#define __Pyx_IS_F_CONTIG 2 -static int __Pyx_init_memviewslice( - struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference); -static CYTHON_INLINE int __pyx_add_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p) -#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview)) -#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) -#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__) -static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS @@ -1816,38 +2421,132 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif -/* IncludeStringH.proto */ -#include +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (1) +#elif CYTHON_COMPILING_IN_LIMITED_API || (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000) + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); #else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif -/* PyFloatBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyFloat_DivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check); +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else -#define __Pyx_PyFloat_DivideCObj(op1, op2, floatval, inplace, zerodivision_check)\ - ((inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2))) - #endif +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif -/* PyFloatBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check); +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else -#define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); #endif +/* Import.proto */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); + +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* ssize_strlen.proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); + +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) +#endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) + +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +/* ListCompAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); + /* SetItemInt.proto */ #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ @@ -1858,35 +2557,85 @@ static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, int wraparound, int boundscheck); +/* RaiseUnboundLocalError.proto */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long); + +/* PySequenceContains.proto */ +static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* HasAttr.proto */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); + +/* PyObjectSetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); +#else +#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +/* IsLittleEndian.proto */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); + +/* BufferFormatCheck.proto */ +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type); + +/* BufferGetAndValidate.proto */ +#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ + ((obj == Py_None || obj == NULL) ?\ + (__Pyx_ZeroBuffer(buf), 0) :\ + __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) +static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static void __Pyx_ZeroBuffer(Py_buffer* buf); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; +static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + /* PyFloatBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check); +static PyObject* __Pyx_PyFloat_TrueDivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check); #else -#define __Pyx_PyFloat_DivideObjC(op1, op2, floatval, inplace, zerodivision_check)\ - ((inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2))) - #endif +#define __Pyx_PyFloat_TrueDivideCObj(op1, op2, floatval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2)) +#endif -/* GetItemInt.proto */ -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ - __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); +/* PyFloatBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) +#endif + +/* PyFloatBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyFloat_TrueDivideObjC(op1, op2, floatval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2)) +#endif + +/* PyIntBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_MultiplyObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyInt_MultiplyObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceMultiply(op1, op2) : PyNumber_Multiply(op1, op2)) +#endif /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY @@ -1896,15 +2645,6 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) #endif -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - /* ListAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { @@ -1922,6 +2662,9 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif +/* PyObjectCall2Args.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + /* PyObjectGetMethod.proto */ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); @@ -1931,8 +2674,146 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name /* append.proto */ static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); +/* pybytes_as_double.proto */ +static double __Pyx_SlowPyString_AsDouble(PyObject *obj); +static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length); +static CYTHON_INLINE double __Pyx_PyBytes_AsDouble(PyObject *obj) { + return __Pyx__PyBytes_AsDouble(obj, PyBytes_AS_STRING(obj), PyBytes_GET_SIZE(obj)); +} +static CYTHON_INLINE double __Pyx_PyByteArray_AsDouble(PyObject *obj) { + return __Pyx__PyBytes_AsDouble(obj, PyByteArray_AS_STRING(obj), PyByteArray_GET_SIZE(obj)); +} + +/* pyunicode_as_double.proto */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static const char* __Pyx__PyUnicode_AsDouble_Copy(const void* data, const int kind, char* buffer, Py_ssize_t start, Py_ssize_t end) { + int last_was_punctuation; + Py_ssize_t i; + last_was_punctuation = 1; + for (i=start; i <= end; i++) { + Py_UCS4 chr = PyUnicode_READ(kind, data, i); + int is_punctuation = (chr == '_') | (chr == '.'); + *buffer = (char)chr; + buffer += (chr != '_'); + if (unlikely(chr > 127)) goto parse_failure; + if (unlikely(last_was_punctuation & is_punctuation)) goto parse_failure; + last_was_punctuation = is_punctuation; + } + if (unlikely(last_was_punctuation)) goto parse_failure; + *buffer = '\0'; + return buffer; +parse_failure: + return NULL; +} +static double __Pyx__PyUnicode_AsDouble_inf_nan(const void* data, int kind, Py_ssize_t start, Py_ssize_t length) { + int matches = 1; + Py_UCS4 chr; + Py_UCS4 sign = PyUnicode_READ(kind, data, start); + int is_signed = (sign == '-') | (sign == '+'); + start += is_signed; + length -= is_signed; + switch (PyUnicode_READ(kind, data, start)) { + #ifdef Py_NAN + case 'n': + case 'N': + if (unlikely(length != 3)) goto parse_failure; + chr = PyUnicode_READ(kind, data, start+1); + matches &= (chr == 'a') | (chr == 'A'); + chr = PyUnicode_READ(kind, data, start+2); + matches &= (chr == 'n') | (chr == 'N'); + if (unlikely(!matches)) goto parse_failure; + return (sign == '-') ? -Py_NAN : Py_NAN; + #endif + case 'i': + case 'I': + if (unlikely(length < 3)) goto parse_failure; + chr = PyUnicode_READ(kind, data, start+1); + matches &= (chr == 'n') | (chr == 'N'); + chr = PyUnicode_READ(kind, data, start+2); + matches &= (chr == 'f') | (chr == 'F'); + if (likely(length == 3 && matches)) + return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL; + if (unlikely(length != 8)) goto parse_failure; + chr = PyUnicode_READ(kind, data, start+3); + matches &= (chr == 'i') | (chr == 'I'); + chr = PyUnicode_READ(kind, data, start+4); + matches &= (chr == 'n') | (chr == 'N'); + chr = PyUnicode_READ(kind, data, start+5); + matches &= (chr == 'i') | (chr == 'I'); + chr = PyUnicode_READ(kind, data, start+6); + matches &= (chr == 't') | (chr == 'T'); + chr = PyUnicode_READ(kind, data, start+7); + matches &= (chr == 'y') | (chr == 'Y'); + if (unlikely(!matches)) goto parse_failure; + return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL; + case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + break; + default: + goto parse_failure; + } + return 0.0; +parse_failure: + return -1.0; +} +static double __Pyx_PyUnicode_AsDouble_WithSpaces(PyObject *obj) { + double value; + const char *last; + char *end; + Py_ssize_t start, length = PyUnicode_GET_LENGTH(obj); + const int kind = PyUnicode_KIND(obj); + const void* data = PyUnicode_DATA(obj); + start = 0; + while (Py_UNICODE_ISSPACE(PyUnicode_READ(kind, data, start))) + start++; + while (start < length - 1 && Py_UNICODE_ISSPACE(PyUnicode_READ(kind, data, length - 1))) + length--; + length -= start; + if (unlikely(length <= 0)) goto fallback; + value = __Pyx__PyUnicode_AsDouble_inf_nan(data, kind, start, length); + if (unlikely(value == -1.0)) goto fallback; + if (value != 0.0) return value; + if (length < 40) { + char number[40]; + last = __Pyx__PyUnicode_AsDouble_Copy(data, kind, number, start, start + length); + if (unlikely(!last)) goto fallback; + value = PyOS_string_to_double(number, &end, NULL); + } else { + char *number = (char*) PyMem_Malloc((length + 1) * sizeof(char)); + if (unlikely(!number)) goto fallback; + last = __Pyx__PyUnicode_AsDouble_Copy(data, kind, number, start, start + length); + if (unlikely(!last)) { + PyMem_Free(number); + goto fallback; + } + value = PyOS_string_to_double(number, &end, NULL); + PyMem_Free(number); + } + if (likely(end == last) || (value == (double)-1 && PyErr_Occurred())) { + return value; + } +fallback: + return __Pyx_SlowPyString_AsDouble(obj); +} +#endif +static CYTHON_INLINE double __Pyx_PyUnicode_AsDouble(PyObject *obj) { +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY + if (unlikely(__Pyx_PyUnicode_READY(obj) == -1)) + return (double)-1; + if (likely(PyUnicode_IS_ASCII(obj))) { + const char *s; + Py_ssize_t length; + s = PyUnicode_AsUTF8AndSize(obj, &length); + return __Pyx__PyBytes_AsDouble(obj, s, length); + } + return __Pyx_PyUnicode_AsDouble_WithSpaces(obj); +#else + return __Pyx_SlowPyString_AsDouble(obj); +#endif +} + +/* pynumber_float.proto */ +static CYTHON_INLINE PyObject* __Pyx__PyNumber_Float(PyObject* obj); +#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : __Pyx__PyNumber_Float(x)) /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY @@ -1942,13 +2823,6 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long int (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) #endif -/* ObjectGetItem.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); -#else -#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) -#endif - /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); @@ -1957,6 +2831,14 @@ static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, long intval, (inplace ? PyNumber_InPlaceAnd(op1, op2) : PyNumber_And(op1, op2)) #endif +/* PyIntBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyInt_MultiplyCObj(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceMultiply(op1, op2) : PyNumber_Multiply(op1, op2)) +#endif + /* SliceObject.proto */ #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\ __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) @@ -1968,121 +2850,9 @@ static CYTHON_INLINE int __Pyx_PyObject_SetSlice( /* DivInt[int].proto */ static CYTHON_INLINE int __Pyx_div_int(int, int); -/* UnaryNegOverflows.proto */ -#define UNARY_NEG_WOULD_OVERFLOW(x)\ - (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) - -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* DivInt[Py_ssize_t].proto */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); - -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ -/* GetAttr.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); - -/* decode_c_string_utf16.proto */ -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 0; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = -1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} - -/* decode_c_string.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); - -/* GetAttr3.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -/* SwapException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* FastTypeChecks.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); -#else -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) -#endif -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) - -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -/* ListCompAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len)) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) -#endif - -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} - -/* DivInt[long].proto */ -static CYTHON_INLINE long __Pyx_div_long(long, long); - -/* PySequenceContains.proto */ -static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { - int result = PySequence_Contains(seq, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* HasAttr.proto */ -static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +/* PyObject_Str.proto */ +#define __Pyx_PyObject_Str(obj)\ + (likely(PyString_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 @@ -2098,56 +2868,145 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr #endif +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + /* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type); +#endif /* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce(PyObject* type_obj); +#endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -#if __STDC_VERSION__ >= 201112L +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_2 +#define __PYX_HAVE_RT_ImportType_proto_3_0_2 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif -#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT(s) alignof(s) +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +enum __Pyx_ImportType_CheckSize_3_0_2 { + __Pyx_ImportType_CheckSize_Error_3_0_2 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_2 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_2 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size); #endif +/* Py3UpdateBases.proto */ +static PyObject* __Pyx_PEP560_update_bases(PyObject *bases); + /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + /* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + typesModule = PyImport_ImportModule("types"); + if (!typesModule) return NULL; + methodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + if (!methodType) return NULL; + result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); + Py_DECREF(methodType); + return result; +} +#elif PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif /* CythonFunctionShared.proto */ -#define __Pyx_CyFunction_USED 1 +#define __Pyx_CyFunction_USED #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 PyCFunctionObject func; -#if PY_VERSION_HEX < 0x030500A0 +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_weakreflist; #endif PyObject *func_dict; @@ -2157,7 +3016,9 @@ typedef struct { PyObject *func_globals; PyObject *func_code; PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_classobj; +#endif void *defaults; int defaults_pyobjects; size_t defaults_size; // used by FusedFunction for copying defaults @@ -2166,14 +3027,17 @@ typedef struct { PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; + PyObject *func_is_coroutine; } __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *self, + PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, size_t size, int pyobjects); @@ -2183,7 +3047,18 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); -static int __pyx_CyFunction_init(void); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif /* CythonFunction.proto */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, @@ -2203,6 +3078,16 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) #endif +/* PyObjectLookupSpecial.proto */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0) +#define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1) +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error); +#else +#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n) +#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) +#endif + /* Py3ClassCreate.proto */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc); @@ -2217,6 +3102,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -2230,6 +3116,7 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -2266,9 +3153,6 @@ static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, __Pyx_memviewslice *slice2, int ndim, size_t itemsize); -/* Capsule.proto */ -static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); - /* TypeInfoCompare.proto */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b); @@ -2289,24 +3173,12 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_d /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(PyObject *, int writable_flag); -/* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(PyObject *, int writable_flag); /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(PyObject *, int writable_flag); -/* Print.proto */ -static int __Pyx_Print(PyObject*, PyObject *, int); -#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 -static PyObject* __pyx_print = 0; -static PyObject* __pyx_print_kwargs = 0; -#endif - /* RealImag.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -2330,7 +3202,7 @@ static PyObject* __pyx_print_kwargs = 0; #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_float(a, b) ((a)==(b)) #define __Pyx_c_sum_float(a, b) ((a)+(b)) #define __Pyx_c_diff_float(a, b) ((a)-(b)) @@ -2368,7 +3240,7 @@ static PyObject* __pyx_print_kwargs = 0; #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_double(a, b) ((a)==(b)) #define __Pyx_c_sum_double(a, b) ((a)+(b)) #define __Pyx_c_diff_double(a, b) ((a)-(b)) @@ -2412,6 +3284,31 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, size_t sizeof_dtype, int contig_flag, int dtype_is_object); +/* MemviewSliceInit.proto */ +#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); @@ -2424,18 +3321,32 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); -/* PrintOne.proto */ -static int __Pyx_PrintOne(PyObject* stream, PyObject *o); +/* None.proto */ +#include /* CIntFromPy.proto */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ @@ -2444,58 +3355,46 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ -/* Module declarations from 'cpython.buffer' */ +/* Module declarations from "libc.string" */ -/* Module declarations from 'libc.string' */ +/* Module declarations from "libc.stdio" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.type" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "cpython" */ -/* Module declarations from 'cpython' */ +/* Module declarations from "cpython.object" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.ref" */ -/* Module declarations from 'cpython.ref' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'cpython.mem' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'numpy' */ +/* Module declarations from "cython.view" */ -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_generic = 0; -static PyTypeObject *__pyx_ptype_5numpy_number = 0; -static PyTypeObject *__pyx_ptype_5numpy_integer = 0; -static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_inexact = 0; -static PyTypeObject *__pyx_ptype_5numpy_floating = 0; -static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0; -static PyTypeObject *__pyx_ptype_5numpy_flexible = 0; -static PyTypeObject *__pyx_ptype_5numpy_character = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +/* Module declarations from "cython.dataclasses" */ -/* Module declarations from 'cython.view' */ +/* Module declarations from "cython" */ -/* Module declarations from 'cython' */ +/* Module declarations from "libc.math" */ -/* Module declarations from 'libc.math' */ - -/* Module declarations from 'newanalysis.gfunction' */ -static PyTypeObject *__pyx_array_type = 0; -static PyTypeObject *__pyx_MemviewEnum_type = 0; -static PyTypeObject *__pyx_memoryview_type = 0; -static PyTypeObject *__pyx_memoryviewslice_type = 0; +/* Module declarations from "newanalysis.gfunction" */ +static PyObject *__pyx_collections_abc_Sequence = 0; static PyObject *generic = 0; static PyObject *strided = 0; static PyObject *indirect = 0; @@ -2506,12 +3405,12 @@ static PyThread_type_lock __pyx_memoryview_thread_locks[8]; static void __pyx_f_11newanalysis_9gfunction_calcHisto(double *, double *, double *, double *, PyArrayObject *, PyArrayObject *, int, int, float, float, int, double, int); /*proto*/ static void __pyx_f_11newanalysis_9gfunction_calcHistoVoronoi(double *, double *, double *, double *, PyArrayObject *, PyArrayObject *, int, int, float, float, int, double, int, int, int, int, int *); /*proto*/ static void __pyx_f_11newanalysis_9gfunction_calcHistoVoronoiNonSelf(double *, double *, double *, double *, PyArrayObject *, PyArrayObject *, int, int, float, float, int, double, int, int, int, int, int *); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ -static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ static PyObject *_unellipsify(PyObject *, int); /*proto*/ -static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ @@ -2529,8 +3428,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /* static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ -static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/ -static int __pyx_memoryview_err(PyObject *, char *); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ @@ -2539,27 +3439,34 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_char = { "char", NULL, sizeof(char), { 0 }, 0, 'H', IS_UNSIGNED(char), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_char = { "char", NULL, sizeof(char), { 0 }, 0, 'H', __PYX_IS_UNSIGNED(char), 0 }; +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "newanalysis.gfunction" extern int __pyx_module_is_main_newanalysis__gfunction; int __pyx_module_is_main_newanalysis__gfunction = 0; -/* Implementation of 'newanalysis.gfunction' */ +/* Implementation of "newanalysis.gfunction" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_object; static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_open; -static PyObject *__pyx_builtin_ImportError; +static PyObject *__pyx_builtin___import__; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_AssertionError; static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_IndexError; -static const char __pyx_k_[] = "*"; +static PyObject *__pyx_builtin_ImportError; +/* #### Code section: string_decls ### */ +static const char __pyx_k_[] = ": "; static const char __pyx_k_O[] = "O"; static const char __pyx_k_c[] = "c"; static const char __pyx_k_i[] = "i"; @@ -2570,11 +3477,16 @@ static const char __pyx_k_t[] = "t"; static const char __pyx_k_v[] = "v"; static const char __pyx_k_w[] = "w"; static const char __pyx_k_PI[] = "PI"; +static const char __pyx_k__2[] = "."; +static const char __pyx_k__3[] = "*"; +static const char __pyx_k__6[] = "'"; +static const char __pyx_k__7[] = ")"; static const char __pyx_k_cu[] = "cu"; static const char __pyx_k_ds[] = "ds"; static const char __pyx_k_dx[] = "dx"; static const char __pyx_k_dy[] = "dy"; static const char __pyx_k_dz[] = "dz"; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_ix[] = "ix"; static const char __pyx_k_n1[] = "n1"; @@ -2588,18 +3500,22 @@ static const char __pyx_k_110[] = "110"; static const char __pyx_k_202[] = "202"; static const char __pyx_k_220[] = "220"; static const char __pyx_k_RDF[] = "RDF"; +static const char __pyx_k__79[] = "?"; +static const char __pyx_k_abc[] = "abc"; static const char __pyx_k_all[] = "all"; +static const char __pyx_k_and[] = " and "; static const char __pyx_k_ctr[] = "ctr"; static const char __pyx_k_dev[] = "dev"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_drv[] = "drv"; -static const char __pyx_k_end[] = "end"; +static const char __pyx_k_got[] = " (got "; static const char __pyx_k_ix2[] = "ix2"; static const char __pyx_k_new[] = "__new__"; static const char __pyx_k_obj[] = "obj"; static const char __pyx_k_pos[] = "pos"; static const char __pyx_k_rdf[] = "rdf"; static const char __pyx_k_rho[] = "rho"; +static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_CUDA[] = "CUDA"; static const char __pyx_k_base[] = "base"; static const char __pyx_k_boxl[] = "boxl"; @@ -2613,7 +3529,6 @@ static const char __pyx_k_f101[] = "f101"; static const char __pyx_k_f110[] = "f110"; static const char __pyx_k_f202[] = "f202"; static const char __pyx_k_f220[] = "f220"; -static const char __pyx_k_file[] = "file"; static const char __pyx_k_grid[] = "grid"; static const char __pyx_k_init[] = "__init__"; static const char __pyx_k_main[] = "__main__"; @@ -2625,6 +3540,7 @@ static const char __pyx_k_open[] = "open"; static const char __pyx_k_pack[] = "pack"; static const char __pyx_k_self[] = "self"; static const char __pyx_k_size[] = "size"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_step[] = "step"; static const char __pyx_k_stop[] = "stop"; static const char __pyx_k_test[] = "__test__"; @@ -2636,10 +3552,12 @@ static const char __pyx_k_box_y[] = "box_y"; static const char __pyx_k_box_z[] = "box_z"; static const char __pyx_k_boxl2[] = "boxl2"; static const char __pyx_k_class[] = "__class__"; +static const char __pyx_k_count[] = "count"; static const char __pyx_k_dtype[] = "dtype"; static const char __pyx_k_error[] = "error"; static const char __pyx_k_flags[] = "flags"; static const char __pyx_k_histo[] = "histo"; +static const char __pyx_k_index[] = "index"; static const char __pyx_k_int32[] = "int32"; static const char __pyx_k_invdx[] = "invdx"; static const char __pyx_k_modes[] = "modes"; @@ -2656,12 +3574,15 @@ static const char __pyx_k_scale[] = "scale"; static const char __pyx_k_shape[] = "shape"; static const char __pyx_k_shell[] = "_shell"; static const char __pyx_k_start[] = "start"; +static const char __pyx_k_super[] = "super"; static const char __pyx_k_value[] = "value"; static const char __pyx_k_write[] = "write"; static const char __pyx_k_zeros[] = "zeros"; static const char __pyx_k_append[] = "append"; static const char __pyx_k_astype[] = "astype"; static const char __pyx_k_device[] = "device"; +static const char __pyx_k_driver[] = "driver"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_grid_x[] = "grid_x"; @@ -2686,6 +3607,7 @@ static const char __pyx_k_block_x[] = "block_x"; static const char __pyx_k_block_y[] = "block_y"; static const char __pyx_k_block_z[] = "block_z"; static const char __pyx_k_box_dim[] = "box_dim"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_float32[] = "float32"; static const char __pyx_k_float64[] = "float64"; static const char __pyx_k_fortran[] = "fortran"; @@ -2695,6 +3617,7 @@ static const char __pyx_k_nshells[] = "nshells"; static const char __pyx_k_prepare[] = "__prepare__"; static const char __pyx_k_shell_2[] = "shell"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; +static const char __pyx_k_Sequence[] = "Sequence"; static const char __pyx_k_addHisto[] = "_addHisto"; static const char __pyx_k_arr_sel1[] = "arr_sel1"; static const char __pyx_k_arr_sel2[] = "arr_sel2"; @@ -2718,6 +3641,8 @@ static const char __pyx_k_mode_sel[] = "mode_sel"; static const char __pyx_k_oneistwo[] = "oneistwo"; static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_qualname[] = "__qualname__"; +static const char __pyx_k_register[] = "register"; +static const char __pyx_k_set_name[] = "__set_name__"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_surr_xyz[] = "surr_xyz"; static const char __pyx_k_use_cuda[] = "use_cuda"; @@ -2734,6 +3659,7 @@ static const char __pyx_k_histo_max[] = "histo_max"; static const char __pyx_k_histo_min[] = "histo_min"; static const char __pyx_k_histo_out[] = "histo_out"; static const char __pyx_k_histogram[] = "histogram"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_mem_alloc[] = "mem_alloc"; static const char __pyx_k_metaclass[] = "__metaclass__"; static const char __pyx_k_normHisto[] = "_normHisto"; @@ -2757,8 +3683,10 @@ static const char __pyx_k_PickleError[] = "PickleError"; static const char __pyx_k_RDF_voronoi[] = "RDF_voronoi"; static const char __pyx_k_box_dim_gpu[] = "box_dim_gpu"; static const char __pyx_k_calcHistoTS[] = "calcHistoTS"; +static const char __pyx_k_collections[] = "collections"; static const char __pyx_k_memcpy_dtoh[] = "memcpy_dtoh"; static const char __pyx_k_memcpy_htod[] = "memcpy_htod"; +static const char __pyx_k_mro_entries[] = "__mro_entries__"; static const char __pyx_k_norm_volume[] = "norm_volume"; static const char __pyx_k_resetArrays[] = "resetArrays"; static const char __pyx_k_volume_list[] = "volume_list"; @@ -2768,18 +3696,23 @@ static const char __pyx_k_dip_sel1_gpu[] = "dip_sel1_gpu"; static const char __pyx_k_dip_sel2_gpu[] = "dip_sel2_gpu"; static const char __pyx_k_get_function[] = "get_function"; static const char __pyx_k_histo_inv_dr[] = "histo_inv_dr"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; -static const char __pyx_k_stringsource[] = "stringsource"; +static const char __pyx_k_stringsource[] = ""; +static const char __pyx_k_version_info[] = "version_info"; static const char __pyx_k_RDF__addHisto[] = "RDF._addHisto"; static const char __pyx_k_RDF_calcFrame[] = "RDF.calcFrame"; static const char __pyx_k_RDF_printInfo[] = "RDF.printInfo"; +static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_coor_sel1_gpu[] = "coor_sel1_gpu"; static const char __pyx_k_coor_sel2_gpu[] = "coor_sel2_gpu"; static const char __pyx_k_get_attribute[] = "get_attribute"; static const char __pyx_k_histogram_out[] = "histogram_out"; +static const char __pyx_k_init_subclass[] = "__init_subclass__"; static const char __pyx_k_pycuda_driver[] = "pycuda.driver"; -static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; +static const char __pyx_k_AssertionError[] = "AssertionError"; static const char __pyx_k_RDF__normHisto[] = "RDF._normHisto"; static const char __pyx_k_RDF_update_box[] = "RDF.update_box"; static const char __pyx_k_calcHistoGPU_2[] = "_calcHistoGPU"; @@ -2787,6 +3720,7 @@ static const char __pyx_k_RDF_resetArrays[] = "RDF.resetArrays"; static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; static const char __pyx_k_calcHistoTSVoro[] = "calcHistoTSVoro"; +static const char __pyx_k_collections_abc[] = "collections.abc"; static const char __pyx_k_delaunay_matrix[] = "delaunay_matrix"; static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; static const char __pyx_k_pycuda_autoinit[] = "pycuda.autoinit"; @@ -2804,361 +3738,56 @@ static const char __pyx_k_pre_coor_sel1_gpu[] = "pre_coor_sel1_gpu"; static const char __pyx_k_pre_coor_sel2_gpu[] = "pre_coor_sel2_gpu"; static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; static const char __pyx_k_RDF_voronoi___init[] = "RDF_voronoi.__init__"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_compute_capability[] = "compute_capability"; static const char __pyx_k_strided_and_direct[] = ""; static const char __pyx_k_MULTIPROCESSOR_COUNT[] = "MULTIPROCESSOR_COUNT"; static const char __pyx_k_strided_and_indirect[] = ""; +static const char __pyx_k_Invalid_shape_in_axis[] = "Invalid shape in axis "; static const char __pyx_k_RDF_voronoi__addHisto[] = "RDF_voronoi._addHisto"; static const char __pyx_k_RDF_voronoi_calcFrame[] = "RDF_voronoi.calcFrame"; static const char __pyx_k_RDF_voronoi_printInfo[] = "RDF_voronoi.printInfo"; static const char __pyx_k_contiguous_and_direct[] = ""; static const char __pyx_k_newanalysis_gfunction[] = "newanalysis.gfunction"; +static const char __pyx_k_Cannot_index_with_type[] = "Cannot index with type '"; static const char __pyx_k_MemoryView_of_r_object[] = ""; static const char __pyx_k_RDF_voronoi__normHisto[] = "RDF_voronoi._normHisto"; static const char __pyx_k_RDF_voronoi_update_box[] = "RDF_voronoi.update_box"; static const char __pyx_k_MemoryView_of_r_at_0x_x[] = ""; static const char __pyx_k_RDF_voronoi_resetArrays[] = "RDF_voronoi.resetArrays"; static const char __pyx_k_contiguous_and_indirect[] = ""; -static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; -static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; +static const char __pyx_k_Dimension_d_is_not_direct[] = "Dimension %d is not direct"; +static const char __pyx_k_Index_out_of_bounds_axis_d[] = "Index out of bounds (axis %d)"; +static const char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero (axis %d)"; static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; -static const char __pyx_k_src_gfunction_gfunction_pyx[] = "src/gfunction/gfunction.pyx"; static const char __pyx_k_device___double_atomicAdd_dou[] = "\n/* __device__ double atomicAdd(double* address, double val)\n {\n unsigned long long int* address_as_ull = (unsigned long long int*)address;\n unsigned long long int old = *address_as_ull, assumed;\n \n do {\n assumed = old;\n old = atomicCAS(address_as_ull, assumed,\n __double_as_longlong(val +\n __longlong_as_double(assumed)));\n // Note: uses integer comparison to avoid hang in case of NaN (since NaN != NaN)\n } while (assumed != old);\n\n return __longlong_as_double(old);\n }\n*/\n __global__ void calcHistoGPU(float *core_xyz, float *surr_xyz, float *core_dip, float *surr_dip, float *dest, float* box_dim, int ncore, int nsurround, float histo_min, float histo_max, int histo_n, float invdx, int mode_sel) {\n \n const int i = threadIdx.x + blockIdx.x * blockDim.x;\n const int j = threadIdx.y + blockIdx.y * blockDim.y;\n float off_diag = 1.0;\n if (i >= ncore || j >= nsurround || (j i && ncore == nsurround) off_diag = 2.0;\n const int ix = i*3, ix3 = i*histo_n, ix4=ncore*histo_n;\n float c_dx=core_xyz[ix], c_dy=core_xyz[ix+1], c_dz=core_xyz[ix+2], dx, dy, dz;\n float s_len, incr, dist;\n float c_px, c_py, c_pz, s_px, s_py, s_pz;\n int pos;\n float c_len;\n const int ix2 = j*3;\n\n if (mode_sel & 2 || mode_sel & 4 || mode_sel & 16 || mode_sel & 32) {\n c_px = core_dip[ix];\n c_py = core_dip[ix+1];\n c_pz = core_dip[ix+2];\n c_len = sqrt(c_px*c_px+c_py*c_py+c_pz*c_pz);\n }\n if (mode_sel & 2 || mode_sel & 8 || mode_sel & 16 || mode_sel & 64) {\n s_px = surr_dip[ix2];\n s_py = surr_dip[ix2+1];""\n s_pz = surr_dip[ix2+2];\n s_len = sqrt(s_px*s_px+s_py*s_py+s_pz*s_pz);\n }\n\n dx = surr_xyz[ix2] - c_dx; dy=surr_xyz[ix2+1] - c_dy; dz=surr_xyz[ix2+2] - c_dz;\n if (fabs(dx) > box_dim[3]) dx-=((0.0 < dx) - (dx < 0.0))*box_dim[0];\n if (fabs(dy) > box_dim[4]) dy-=((0.0 < dy) - (dy < 0.0))*box_dim[1];\n if (fabs(dz) > box_dim[5]) dz-=((0.0 < dz) - (dz < 0.0))*box_dim[2];\n dist = float(sqrt(dx*dx+dy*dy+dz*dz));\n \n if (disthisto_max || floor(dist*invdx)==0) return;\n \n pos = (int) floor((dist-histo_min)*invdx);\n \n if (mode_sel & 1) atomicAdd(&(dest[ix3+pos]),1.0*off_diag);\n \n if (mode_sel & 2 || mode_sel & 16) {\n incr = (c_px*s_px+c_py*s_py+c_pz*s_pz)/(c_len*s_len);\n if (mode_sel & 2) atomicAdd(&(dest[ix4+ix3+pos]),incr*off_diag);\n if (mode_sel & 16) atomicAdd(&(dest[4*ix4+ix3+pos]),(1.5*incr*incr-0.5)*off_diag); \n }\n if (mode_sel & 4 || mode_sel & 32) { \n incr = (c_px*dx+c_py*dy+c_pz*dz)/(c_len*dist);\n if (mode_sel & 4) atomicAdd(&(dest[2*ix4+ix3+pos]),incr*off_diag);\n if (mode_sel & 32) atomicAdd(&(dest[5*ix4+ix3+pos]),(1.5*incr*incr-0.5)*off_diag);\n }\n if (mode_sel & 8 || mode_sel & 64) {\n incr = (s_px*dx+s_py*dy+s_pz*dz)/(s_len*dist);\n if (mode_sel & 8) atomicAdd(&(dest[3*ix4+ix3+pos]),incr*off_diag);\n if (mode_sel & 64) atomicAdd(&(dest[6*ix4+ix3+pos]),(1.5*incr*incr-0.5)*off_diag);\n } \n } \n "; static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; static const char __pyx_k_strided_and_direct_or_indirect[] = ""; static const char __pyx_k_class_RDF_A_container_object_fo[] = "\n class RDF\n\n A container object for calculating radial distribution functions.\n "; +static const char __pyx_k_newanalysis_gfunction_gfunction[] = "newanalysis/gfunction/gfunction.pyx"; static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; +static const char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced"; static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview"; static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview"; +static const char __pyx_k_Cannot_transpose_memoryview_with[] = "Cannot transpose memoryview with indirect dimensions"; static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; -static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))"; +static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))"; static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; -static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; +static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got "; static const char __pyx_k_No_dipole_moment_array_for_the_f[] = "No dipole moment array for the fist selection was passed, although the requested gfunctions need it!"; static const char __pyx_k_No_dipole_moment_array_for_the_s[] = "No dipole moment array for the second selection was passed, although the requested gfunctions need it!"; static const char __pyx_k_No_suitable_CUDA_device_was_foun[] = "No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead."; -static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)"; +static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis "; static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; -static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)"; +static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension "; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; static const char __pyx_k_No_dipole_moment_array_for_the_f_2[] = "No dipole moment array for the first selection was passed, although the requested gfunctions need it!"; -static PyObject *__pyx_n_s_; -static PyObject *__pyx_kp_s_000; -static PyObject *__pyx_kp_s_011; -static PyObject *__pyx_kp_s_022; -static PyObject *__pyx_kp_s_101; -static PyObject *__pyx_kp_s_110; -static PyObject *__pyx_kp_s_202; -static PyObject *__pyx_kp_s_220; -static PyObject *__pyx_kp_s_5_5f_5_5f; -static PyObject *__pyx_n_s_ASCII; -static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; -static PyObject *__pyx_n_s_CUDA; -static PyObject *__pyx_n_s_CUDA___init; -static PyObject *__pyx_n_s_CUDA_calcHistoGPU; -static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; -static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; -static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; -static PyObject *__pyx_kp_s_Cannot_index_with_type_s; -static PyObject *__pyx_n_s_Ellipsis; -static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; -static PyObject *__pyx_kp_s_Frames_read; -static PyObject *__pyx_n_s_ImportError; -static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; -static PyObject *__pyx_n_s_IndexError; -static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; -static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; -static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d; -static PyObject *__pyx_n_s_MULTIPROCESSOR_COUNT; -static PyObject *__pyx_n_s_MemoryError; -static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; -static PyObject *__pyx_kp_s_MemoryView_of_r_object; -static PyObject *__pyx_kp_s_Modes; -static PyObject *__pyx_kp_s_No_dipole_moment_array_for_the_f; -static PyObject *__pyx_kp_s_No_dipole_moment_array_for_the_f_2; -static PyObject *__pyx_kp_s_No_dipole_moment_array_for_the_s; -static PyObject *__pyx_kp_s_No_suitable_CUDA_device_was_foun; -static PyObject *__pyx_n_b_O; -static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a; -static PyObject *__pyx_n_s_PI; -static PyObject *__pyx_n_s_PickleError; -static PyObject *__pyx_n_s_RDF; -static PyObject *__pyx_n_s_RDF___init; -static PyObject *__pyx_n_s_RDF__addHisto; -static PyObject *__pyx_n_s_RDF__normHisto; -static PyObject *__pyx_n_s_RDF_calcFrame; -static PyObject *__pyx_n_s_RDF_printInfo; -static PyObject *__pyx_n_s_RDF_resetArrays; -static PyObject *__pyx_n_s_RDF_scale; -static PyObject *__pyx_n_s_RDF_update_box; -static PyObject *__pyx_n_s_RDF_voronoi; -static PyObject *__pyx_n_s_RDF_voronoi___init; -static PyObject *__pyx_n_s_RDF_voronoi__addHisto; -static PyObject *__pyx_n_s_RDF_voronoi__normHisto; -static PyObject *__pyx_n_s_RDF_voronoi_calcFrame; -static PyObject *__pyx_n_s_RDF_voronoi_printInfo; -static PyObject *__pyx_n_s_RDF_voronoi_resetArrays; -static PyObject *__pyx_n_s_RDF_voronoi_scale; -static PyObject *__pyx_n_s_RDF_voronoi_update_box; -static PyObject *__pyx_n_s_RDF_voronoi_write; -static PyObject *__pyx_n_s_RDF_write; -static PyObject *__pyx_n_s_SourceModule; -static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s_View_MemoryView; -static PyObject *__pyx_n_s_addHisto; -static PyObject *__pyx_n_s_all; -static PyObject *__pyx_n_s_allocate_buffer; -static PyObject *__pyx_n_s_append; -static PyObject *__pyx_n_s_arr_sel1; -static PyObject *__pyx_n_s_arr_sel2; -static PyObject *__pyx_n_s_astype; -static PyObject *__pyx_n_s_autoinit; -static PyObject *__pyx_n_s_base; -static PyObject *__pyx_n_s_block; -static PyObject *__pyx_n_s_block_x; -static PyObject *__pyx_n_s_block_y; -static PyObject *__pyx_n_s_block_z; -static PyObject *__pyx_n_s_box_dim; -static PyObject *__pyx_n_s_box_dim_gpu; -static PyObject *__pyx_n_s_box_x; -static PyObject *__pyx_n_s_box_y; -static PyObject *__pyx_n_s_box_z; -static PyObject *__pyx_n_s_boxl; -static PyObject *__pyx_n_s_boxl2; -static PyObject *__pyx_n_s_c; -static PyObject *__pyx_n_u_c; -static PyObject *__pyx_n_s_calcFrame; -static PyObject *__pyx_n_s_calcHistoGPU; -static PyObject *__pyx_n_s_calcHistoGPU_2; -static PyObject *__pyx_n_s_calcHistoTS; -static PyObject *__pyx_n_s_calcHistoTSVoro; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_kp_s_class_RDF_A_container_object_fo; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_compute_capability; -static PyObject *__pyx_kp_s_contiguous_and_direct; -static PyObject *__pyx_kp_s_contiguous_and_indirect; -static PyObject *__pyx_n_s_coor_sel1; -static PyObject *__pyx_n_s_coor_sel1_gpu; -static PyObject *__pyx_n_s_coor_sel2; -static PyObject *__pyx_n_s_coor_sel2_gpu; -static PyObject *__pyx_n_s_core_xyz; -static PyObject *__pyx_n_s_ctr; -static PyObject *__pyx_n_s_cu; -static PyObject *__pyx_n_s_cuda; -static PyObject *__pyx_n_s_delaunay_matrix; -static PyObject *__pyx_n_s_dev; -static PyObject *__pyx_n_s_device; -static PyObject *__pyx_kp_s_device___double_atomicAdd_dou; -static PyObject *__pyx_n_s_device_attribute; -static PyObject *__pyx_n_s_dict; -static PyObject *__pyx_n_s_dip_sel1; -static PyObject *__pyx_n_s_dip_sel1_gpu; -static PyObject *__pyx_n_s_dip_sel2; -static PyObject *__pyx_n_s_dip_sel2_gpu; -static PyObject *__pyx_n_s_dist; -static PyObject *__pyx_n_s_doc; -static PyObject *__pyx_n_s_drv; -static PyObject *__pyx_n_s_ds; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_dtype_is_object; -static PyObject *__pyx_n_s_dx; -static PyObject *__pyx_n_s_dy; -static PyObject *__pyx_n_s_dz; -static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_end; -static PyObject *__pyx_n_s_enumerate; -static PyObject *__pyx_n_s_error; -static PyObject *__pyx_n_s_exclude_self_mol; -static PyObject *__pyx_n_s_f000; -static PyObject *__pyx_n_s_f011; -static PyObject *__pyx_n_s_f022; -static PyObject *__pyx_n_s_f101; -static PyObject *__pyx_n_s_f110; -static PyObject *__pyx_n_s_f202; -static PyObject *__pyx_n_s_f220; -static PyObject *__pyx_n_s_file; -static PyObject *__pyx_n_s_filename; -static PyObject *__pyx_n_s_flags; -static PyObject *__pyx_n_s_float32; -static PyObject *__pyx_n_s_float64; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_fortran; -static PyObject *__pyx_n_u_fortran; -static PyObject *__pyx_kp_s_g000_dat; -static PyObject *__pyx_kp_s_g011_dat; -static PyObject *__pyx_kp_s_g022_dat; -static PyObject *__pyx_kp_s_g101_dat; -static PyObject *__pyx_kp_s_g110_dat; -static PyObject *__pyx_kp_s_g202_dat; -static PyObject *__pyx_kp_s_g220_dat; -static PyObject *__pyx_n_s_get_attribute; -static PyObject *__pyx_n_s_get_function; -static PyObject *__pyx_n_s_getstate; -static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi; -static PyObject *__pyx_n_s_grid; -static PyObject *__pyx_n_s_grid_x; -static PyObject *__pyx_n_s_grid_y; -static PyObject *__pyx_n_s_histo; -static PyObject *__pyx_n_s_histo_dr; -static PyObject *__pyx_n_s_histo_gpu; -static PyObject *__pyx_n_s_histo_inv_dr; -static PyObject *__pyx_n_s_histo_max; -static PyObject *__pyx_n_s_histo_min; -static PyObject *__pyx_n_s_histo_n; -static PyObject *__pyx_n_s_histo_out; -static PyObject *__pyx_n_s_histogram; -static PyObject *__pyx_n_s_histogram_out; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_s_int32; -static PyObject *__pyx_n_s_invdx; -static PyObject *__pyx_n_s_itemsize; -static PyObject *__pyx_kp_s_itemsize_0_for_cython_array; -static PyObject *__pyx_n_s_ix; -static PyObject *__pyx_n_s_ix2; -static PyObject *__pyx_n_s_j; -static PyObject *__pyx_n_s_k; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_maxshell; -static PyObject *__pyx_n_s_mem_alloc; -static PyObject *__pyx_n_s_memcpy_dtoh; -static PyObject *__pyx_n_s_memcpy_htod; -static PyObject *__pyx_n_s_memview; -static PyObject *__pyx_n_s_metaclass; -static PyObject *__pyx_n_s_mode; -static PyObject *__pyx_n_s_mode_sel; -static PyObject *__pyx_n_s_modes; -static PyObject *__pyx_n_s_module; -static PyObject *__pyx_n_s_n1; -static PyObject *__pyx_n_s_n2; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_name_2; -static PyObject *__pyx_n_s_nbytes; -static PyObject *__pyx_n_s_ncore; -static PyObject *__pyx_n_s_ndim; -static PyObject *__pyx_n_s_new; -static PyObject *__pyx_n_s_newanalysis_gfunction; -static PyObject *__pyx_n_s_nmol1; -static PyObject *__pyx_n_s_nmol2; -static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; -static PyObject *__pyx_n_s_norm; -static PyObject *__pyx_n_s_normHisto; -static PyObject *__pyx_n_s_norm_volume; -static PyObject *__pyx_n_s_np; -static PyObject *__pyx_n_s_nshells; -static PyObject *__pyx_n_s_nsurr; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; -static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; -static PyObject *__pyx_n_s_obj; -static PyObject *__pyx_n_s_object; -static PyObject *__pyx_n_s_oneistwo; -static PyObject *__pyx_n_s_open; -static PyObject *__pyx_n_s_pack; -static PyObject *__pyx_n_s_pickle; -static PyObject *__pyx_n_s_pos; -static PyObject *__pyx_n_s_pre_coor_sel1_gpu; -static PyObject *__pyx_n_s_pre_coor_sel2_gpu; -static PyObject *__pyx_n_s_pre_dip_sel1_gpu; -static PyObject *__pyx_n_s_pre_dip_sel2_gpu; -static PyObject *__pyx_n_s_prepare; -static PyObject *__pyx_n_s_print; -static PyObject *__pyx_n_s_printInfo; -static PyObject *__pyx_n_s_pycuda; -static PyObject *__pyx_n_s_pycuda_autoinit; -static PyObject *__pyx_n_s_pycuda_compiler; -static PyObject *__pyx_n_s_pycuda_driver; -static PyObject *__pyx_n_s_pyx_PickleError; -static PyObject *__pyx_n_s_pyx_checksum; -static PyObject *__pyx_n_s_pyx_getbuffer; -static PyObject *__pyx_n_s_pyx_result; -static PyObject *__pyx_n_s_pyx_state; -static PyObject *__pyx_n_s_pyx_type; -static PyObject *__pyx_n_s_pyx_unpickle_Enum; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_qualname; -static PyObject *__pyx_n_s_r; -static PyObject *__pyx_n_s_r_out; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_rdf; -static PyObject *__pyx_n_s_reduce; -static PyObject *__pyx_n_s_reduce_cython; -static PyObject *__pyx_n_s_reduce_ex; -static PyObject *__pyx_n_s_resetArrays; -static PyObject *__pyx_n_s_result; -static PyObject *__pyx_n_s_rho; -static PyObject *__pyx_n_s_round; -static PyObject *__pyx_n_s_scale; -static PyObject *__pyx_n_s_sel1_n; -static PyObject *__pyx_n_s_sel1_nmol; -static PyObject *__pyx_n_s_sel2_n; -static PyObject *__pyx_n_s_sel2_nmol; -static PyObject *__pyx_n_s_self; -static PyObject *__pyx_n_s_setstate; -static PyObject *__pyx_n_s_setstate_cython; -static PyObject *__pyx_n_s_shape; -static PyObject *__pyx_n_s_shell; -static PyObject *__pyx_n_s_shell_2; -static PyObject *__pyx_n_s_size; -static PyObject *__pyx_n_s_slice_vol; -static PyObject *__pyx_n_s_source; -static PyObject *__pyx_kp_s_src_gfunction_gfunction_pyx; -static PyObject *__pyx_n_s_start; -static PyObject *__pyx_n_s_step; -static PyObject *__pyx_n_s_stop; -static PyObject *__pyx_kp_s_strided_and_direct; -static PyObject *__pyx_kp_s_strided_and_direct_or_indirect; -static PyObject *__pyx_kp_s_strided_and_indirect; -static PyObject *__pyx_kp_s_stringsource; -static PyObject *__pyx_n_s_struct; -static PyObject *__pyx_n_s_surr_xyz; -static PyObject *__pyx_n_s_t; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_kp_s_unable_to_allocate_array_data; -static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; -static PyObject *__pyx_n_s_unpack; -static PyObject *__pyx_n_s_update; -static PyObject *__pyx_n_s_update_box; -static PyObject *__pyx_n_s_use_cuda; -static PyObject *__pyx_n_s_v; -static PyObject *__pyx_n_s_value; -static PyObject *__pyx_n_s_volume; -static PyObject *__pyx_n_s_volume_list; -static PyObject *__pyx_n_s_w; -static PyObject *__pyx_n_s_write; -static PyObject *__pyx_n_s_zeros; -static PyObject *__pyx_pf_11newanalysis_9gfunction_4CUDA___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_4CUDA_2calcHistoGPU(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_coor_sel1_gpu, PyObject *__pyx_v_coor_sel2_gpu, PyObject *__pyx_v_dip_sel1_gpu, PyObject *__pyx_v_dip_sel2_gpu, PyObject *__pyx_v_histo_gpu, PyObject *__pyx_v_box_dim_gpu, PyObject *__pyx_v_n1, PyObject *__pyx_v_n2, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_n, PyObject *__pyx_v_histo_inv_dr, PyObject *__pyx_v_mode_sel, PyObject *__pyx_v_block, PyObject *__pyx_v_grid); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_calcHistoTS(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_core_xyz, __Pyx_memviewslice __pyx_v_surr_xyz, __Pyx_memviewslice __pyx_v_result, double __pyx_v_boxl, int __pyx_v_t, float __pyx_v_histo_min, float __pyx_v_histo_max, double __pyx_v_invdx); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_2calcHistoTSVoro(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_core_xyz, __Pyx_memviewslice __pyx_v_surr_xyz, __Pyx_memviewslice __pyx_v_result, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, double __pyx_v_boxl, int __pyx_v_t, float __pyx_v_histo_min, float __pyx_v_histo_max, double __pyx_v_invdx); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_modes, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_dr, PyObject *__pyx_v_sel1_n, PyObject *__pyx_v_sel2_n, PyObject *__pyx_v_sel1_nmol, PyObject *__pyx_v_sel2_nmol, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z, PyObject *__pyx_v_use_cuda, PyObject *__pyx_v_norm_volume); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_2update_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_4calcFrame(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_coor_sel1, PyArrayObject *__pyx_v_coor_sel2, PyArrayObject *__pyx_v_dip_sel1, PyArrayObject *__pyx_v_dip_sel2, PyObject *__pyx_v_pre_coor_sel1_gpu, PyObject *__pyx_v_pre_coor_sel2_gpu, PyObject *__pyx_v_pre_dip_sel1_gpu, PyObject *__pyx_v_pre_dip_sel2_gpu); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_6_addHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_histo_out, PyArrayObject *__pyx_v_histo); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_8_normHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_10scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_12write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_14resetArrays(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_16printInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_modes, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_dr, PyObject *__pyx_v_sel1_n, PyObject *__pyx_v_sel2_n, PyObject *__pyx_v_sel1_nmol, PyObject *__pyx_v_sel2_nmol, PyObject *__pyx_v_box_x, PyObject *__pyx_v_nshells, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z, CYTHON_UNUSED PyObject *__pyx_v_use_cuda, PyObject *__pyx_v_norm_volume, PyObject *__pyx_v_exclude_self_mol); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_2update_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_4calcFrame(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_coor_sel1, PyArrayObject *__pyx_v_coor_sel2, PyArrayObject *__pyx_v_delaunay_matrix, PyArrayObject *__pyx_v_dip_sel1, PyArrayObject *__pyx_v_dip_sel2, CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel1_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel2_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel1_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel2_gpu); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_6_addHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_histo_out, PyArrayObject *__pyx_v_histo); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_8_normHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_10scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_12write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_14resetArrays(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_16printInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +/* #### Code section: decls ### */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ @@ -3197,7437 +3826,7004 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_4CUDA___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_4CUDA_2calcHistoGPU(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_coor_sel1_gpu, PyObject *__pyx_v_coor_sel2_gpu, PyObject *__pyx_v_dip_sel1_gpu, PyObject *__pyx_v_dip_sel2_gpu, PyObject *__pyx_v_histo_gpu, PyObject *__pyx_v_box_dim_gpu, PyObject *__pyx_v_n1, PyObject *__pyx_v_n2, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_n, PyObject *__pyx_v_histo_inv_dr, PyObject *__pyx_v_mode_sel, PyObject *__pyx_v_block, PyObject *__pyx_v_grid); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_calcHistoTS(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_core_xyz, __Pyx_memviewslice __pyx_v_surr_xyz, __Pyx_memviewslice __pyx_v_result, double __pyx_v_boxl, int __pyx_v_t, float __pyx_v_histo_min, float __pyx_v_histo_max, double __pyx_v_invdx); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_2calcHistoTSVoro(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_core_xyz, __Pyx_memviewslice __pyx_v_surr_xyz, __Pyx_memviewslice __pyx_v_result, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, double __pyx_v_boxl, int __pyx_v_t, float __pyx_v_histo_min, float __pyx_v_histo_max, double __pyx_v_invdx); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_modes, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_dr, PyObject *__pyx_v_sel1_n, PyObject *__pyx_v_sel2_n, PyObject *__pyx_v_sel1_nmol, PyObject *__pyx_v_sel2_nmol, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z, PyObject *__pyx_v_use_cuda, PyObject *__pyx_v_norm_volume); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_2update_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_4calcFrame(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_coor_sel1, PyArrayObject *__pyx_v_coor_sel2, PyArrayObject *__pyx_v_dip_sel1, PyArrayObject *__pyx_v_dip_sel2, PyObject *__pyx_v_pre_coor_sel1_gpu, PyObject *__pyx_v_pre_coor_sel2_gpu, PyObject *__pyx_v_pre_dip_sel1_gpu, PyObject *__pyx_v_pre_dip_sel2_gpu); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_6_addHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_histo_out, PyArrayObject *__pyx_v_histo); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_8_normHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_10scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_12write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_14resetArrays(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_16printInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_modes, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_dr, PyObject *__pyx_v_sel1_n, PyObject *__pyx_v_sel2_n, PyObject *__pyx_v_sel1_nmol, PyObject *__pyx_v_sel2_nmol, PyObject *__pyx_v_box_x, PyObject *__pyx_v_nshells, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z, CYTHON_UNUSED PyObject *__pyx_v_use_cuda, PyObject *__pyx_v_norm_volume, PyObject *__pyx_v_exclude_self_mol); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_2update_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_4calcFrame(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_coor_sel1, PyArrayObject *__pyx_v_coor_sel2, PyArrayObject *__pyx_v_delaunay_matrix, PyArrayObject *__pyx_v_dip_sel1, PyArrayObject *__pyx_v_dip_sel2, CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel1_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel2_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel1_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel2_gpu); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_6_addHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_histo_out, PyArrayObject *__pyx_v_histo); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_8_normHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_10scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_12write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_14resetArrays(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_16printInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_float_0_0; -static PyObject *__pyx_float_0_5; -static PyObject *__pyx_float_1_0; -static PyObject *__pyx_float_2_0; -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_2; -static PyObject *__pyx_int_3; -static PyObject *__pyx_int_4; -static PyObject *__pyx_int_5; -static PyObject *__pyx_int_6; -static PyObject *__pyx_int_7; -static PyObject *__pyx_int_8; -static PyObject *__pyx_int_16; -static PyObject *__pyx_int_32; -static PyObject *__pyx_int_64; -static PyObject *__pyx_int_112105877; -static PyObject *__pyx_int_136983863; -static PyObject *__pyx_int_184977713; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_slice__6; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__24; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_tuple__28; -static PyObject *__pyx_tuple__29; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__33; -static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__37; -static PyObject *__pyx_tuple__38; -static PyObject *__pyx_tuple__40; -static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__46; -static PyObject *__pyx_tuple__48; -static PyObject *__pyx_tuple__50; -static PyObject *__pyx_tuple__52; -static PyObject *__pyx_tuple__54; -static PyObject *__pyx_tuple__55; -static PyObject *__pyx_tuple__57; -static PyObject *__pyx_tuple__59; -static PyObject *__pyx_tuple__60; -static PyObject *__pyx_tuple__62; -static PyObject *__pyx_tuple__63; -static PyObject *__pyx_tuple__65; -static PyObject *__pyx_tuple__67; -static PyObject *__pyx_tuple__68; -static PyObject *__pyx_tuple__70; -static PyObject *__pyx_tuple__72; -static PyObject *__pyx_tuple__74; -static PyObject *__pyx_tuple__76; -static PyObject *__pyx_tuple__77; -static PyObject *__pyx_tuple__79; -static PyObject *__pyx_tuple__81; -static PyObject *__pyx_tuple__82; -static PyObject *__pyx_tuple__83; -static PyObject *__pyx_tuple__84; -static PyObject *__pyx_tuple__85; -static PyObject *__pyx_tuple__86; -static PyObject *__pyx_codeobj__30; -static PyObject *__pyx_codeobj__32; -static PyObject *__pyx_codeobj__34; -static PyObject *__pyx_codeobj__36; -static PyObject *__pyx_codeobj__39; -static PyObject *__pyx_codeobj__42; -static PyObject *__pyx_codeobj__44; -static PyObject *__pyx_codeobj__47; -static PyObject *__pyx_codeobj__49; -static PyObject *__pyx_codeobj__51; -static PyObject *__pyx_codeobj__53; -static PyObject *__pyx_codeobj__56; -static PyObject *__pyx_codeobj__58; -static PyObject *__pyx_codeobj__61; -static PyObject *__pyx_codeobj__64; -static PyObject *__pyx_codeobj__66; -static PyObject *__pyx_codeobj__69; -static PyObject *__pyx_codeobj__71; -static PyObject *__pyx_codeobj__73; -static PyObject *__pyx_codeobj__75; -static PyObject *__pyx_codeobj__78; -static PyObject *__pyx_codeobj__80; -static PyObject *__pyx_codeobj__87; -/* Late includes */ - -/* "src/gfunction/gfunction.pyx":14 - * # CUDA handler interface - * class CUDA(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self.cuda = True - * try: +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4type_type; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + #endif + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + PyObject *__pyx_kp_u_; + PyObject *__pyx_kp_s_000; + PyObject *__pyx_kp_s_011; + PyObject *__pyx_kp_s_022; + PyObject *__pyx_kp_s_101; + PyObject *__pyx_kp_s_110; + PyObject *__pyx_kp_s_202; + PyObject *__pyx_kp_s_220; + PyObject *__pyx_kp_s_5_5f_5_5f; + PyObject *__pyx_n_s_ASCII; + PyObject *__pyx_kp_s_All_dimensions_preceding_dimensi; + PyObject *__pyx_n_s_AssertionError; + PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; + PyObject *__pyx_n_s_CUDA; + PyObject *__pyx_n_s_CUDA___init; + PyObject *__pyx_n_s_CUDA_calcHistoGPU; + PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; + PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; + PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; + PyObject *__pyx_kp_u_Cannot_index_with_type; + PyObject *__pyx_kp_s_Cannot_transpose_memoryview_with; + PyObject *__pyx_kp_s_Dimension_d_is_not_direct; + PyObject *__pyx_n_s_Ellipsis; + PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; + PyObject *__pyx_kp_s_Frames_read; + PyObject *__pyx_n_s_ImportError; + PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; + PyObject *__pyx_n_s_IndexError; + PyObject *__pyx_kp_s_Index_out_of_bounds_axis_d; + PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; + PyObject *__pyx_kp_u_Invalid_mode_expected_c_or_fortr; + PyObject *__pyx_kp_u_Invalid_shape_in_axis; + PyObject *__pyx_n_s_MULTIPROCESSOR_COUNT; + PyObject *__pyx_n_s_MemoryError; + PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; + PyObject *__pyx_kp_s_MemoryView_of_r_object; + PyObject *__pyx_kp_s_Modes; + PyObject *__pyx_kp_s_No_dipole_moment_array_for_the_f; + PyObject *__pyx_kp_s_No_dipole_moment_array_for_the_f_2; + PyObject *__pyx_kp_s_No_dipole_moment_array_for_the_s; + PyObject *__pyx_kp_s_No_suitable_CUDA_device_was_foun; + PyObject *__pyx_n_b_O; + PyObject *__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + PyObject *__pyx_n_s_PI; + PyObject *__pyx_n_s_PickleError; + PyObject *__pyx_n_s_RDF; + PyObject *__pyx_n_s_RDF___init; + PyObject *__pyx_n_s_RDF__addHisto; + PyObject *__pyx_n_s_RDF__normHisto; + PyObject *__pyx_n_s_RDF_calcFrame; + PyObject *__pyx_n_s_RDF_printInfo; + PyObject *__pyx_n_s_RDF_resetArrays; + PyObject *__pyx_n_s_RDF_scale; + PyObject *__pyx_n_s_RDF_update_box; + PyObject *__pyx_n_s_RDF_voronoi; + PyObject *__pyx_n_s_RDF_voronoi___init; + PyObject *__pyx_n_s_RDF_voronoi__addHisto; + PyObject *__pyx_n_s_RDF_voronoi__normHisto; + PyObject *__pyx_n_s_RDF_voronoi_calcFrame; + PyObject *__pyx_n_s_RDF_voronoi_printInfo; + PyObject *__pyx_n_s_RDF_voronoi_resetArrays; + PyObject *__pyx_n_s_RDF_voronoi_scale; + PyObject *__pyx_n_s_RDF_voronoi_update_box; + PyObject *__pyx_n_s_RDF_voronoi_write; + PyObject *__pyx_n_s_RDF_write; + PyObject *__pyx_n_s_Sequence; + PyObject *__pyx_n_s_SourceModule; + PyObject *__pyx_kp_s_Step_may_not_be_zero_axis_d; + PyObject *__pyx_n_s_TypeError; + PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; + PyObject *__pyx_n_s_ValueError; + PyObject *__pyx_n_s_View_MemoryView; + PyObject *__pyx_kp_u__2; + PyObject *__pyx_n_s__3; + PyObject *__pyx_kp_u__6; + PyObject *__pyx_kp_u__7; + PyObject *__pyx_n_s__79; + PyObject *__pyx_n_s_abc; + PyObject *__pyx_n_s_addHisto; + PyObject *__pyx_n_s_all; + PyObject *__pyx_n_s_allocate_buffer; + PyObject *__pyx_kp_u_and; + PyObject *__pyx_n_s_append; + PyObject *__pyx_n_s_arr_sel1; + PyObject *__pyx_n_s_arr_sel2; + PyObject *__pyx_n_s_astype; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_autoinit; + PyObject *__pyx_n_s_base; + PyObject *__pyx_n_s_block; + PyObject *__pyx_n_s_block_x; + PyObject *__pyx_n_s_block_y; + PyObject *__pyx_n_s_block_z; + PyObject *__pyx_n_s_box_dim; + PyObject *__pyx_n_s_box_dim_gpu; + PyObject *__pyx_n_s_box_x; + PyObject *__pyx_n_s_box_y; + PyObject *__pyx_n_s_box_z; + PyObject *__pyx_n_s_boxl; + PyObject *__pyx_n_s_boxl2; + PyObject *__pyx_n_s_c; + PyObject *__pyx_n_u_c; + PyObject *__pyx_n_s_calcFrame; + PyObject *__pyx_n_s_calcHistoGPU; + PyObject *__pyx_n_s_calcHistoGPU_2; + PyObject *__pyx_n_s_calcHistoTS; + PyObject *__pyx_n_s_calcHistoTSVoro; + PyObject *__pyx_n_s_class; + PyObject *__pyx_kp_s_class_RDF_A_container_object_fo; + PyObject *__pyx_n_s_class_getitem; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_collections; + PyObject *__pyx_kp_s_collections_abc; + PyObject *__pyx_n_s_compute_capability; + PyObject *__pyx_kp_s_contiguous_and_direct; + PyObject *__pyx_kp_s_contiguous_and_indirect; + PyObject *__pyx_n_s_coor_sel1; + PyObject *__pyx_n_s_coor_sel1_gpu; + PyObject *__pyx_n_s_coor_sel2; + PyObject *__pyx_n_s_coor_sel2_gpu; + PyObject *__pyx_n_s_core_xyz; + PyObject *__pyx_n_s_count; + PyObject *__pyx_n_s_ctr; + PyObject *__pyx_n_s_cu; + PyObject *__pyx_n_s_cuda; + PyObject *__pyx_n_s_delaunay_matrix; + PyObject *__pyx_n_s_dev; + PyObject *__pyx_n_s_device; + PyObject *__pyx_kp_s_device___double_atomicAdd_dou; + PyObject *__pyx_n_s_device_attribute; + PyObject *__pyx_n_s_dict; + PyObject *__pyx_n_s_dip_sel1; + PyObject *__pyx_n_s_dip_sel1_gpu; + PyObject *__pyx_n_s_dip_sel2; + PyObject *__pyx_n_s_dip_sel2_gpu; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_n_s_dist; + PyObject *__pyx_n_s_doc; + PyObject *__pyx_n_s_driver; + PyObject *__pyx_n_s_drv; + PyObject *__pyx_n_s_ds; + PyObject *__pyx_n_s_dtype; + PyObject *__pyx_n_s_dtype_is_object; + PyObject *__pyx_n_s_dx; + PyObject *__pyx_n_s_dy; + PyObject *__pyx_n_s_dz; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_encode; + PyObject *__pyx_n_s_enumerate; + PyObject *__pyx_n_s_error; + PyObject *__pyx_n_s_exclude_self_mol; + PyObject *__pyx_n_s_f000; + PyObject *__pyx_n_s_f011; + PyObject *__pyx_n_s_f022; + PyObject *__pyx_n_s_f101; + PyObject *__pyx_n_s_f110; + PyObject *__pyx_n_s_f202; + PyObject *__pyx_n_s_f220; + PyObject *__pyx_n_s_filename; + PyObject *__pyx_n_s_flags; + PyObject *__pyx_n_s_float32; + PyObject *__pyx_n_s_float64; + PyObject *__pyx_n_s_format; + PyObject *__pyx_n_s_fortran; + PyObject *__pyx_n_u_fortran; + PyObject *__pyx_kp_s_g000_dat; + PyObject *__pyx_kp_s_g011_dat; + PyObject *__pyx_kp_s_g022_dat; + PyObject *__pyx_kp_s_g101_dat; + PyObject *__pyx_kp_s_g110_dat; + PyObject *__pyx_kp_s_g202_dat; + PyObject *__pyx_kp_s_g220_dat; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_get_attribute; + PyObject *__pyx_n_s_get_function; + PyObject *__pyx_n_s_getstate; + PyObject *__pyx_kp_u_got; + PyObject *__pyx_kp_u_got_differing_extents_in_dimensi; + PyObject *__pyx_n_s_grid; + PyObject *__pyx_n_s_grid_x; + PyObject *__pyx_n_s_grid_y; + PyObject *__pyx_n_s_histo; + PyObject *__pyx_n_s_histo_dr; + PyObject *__pyx_n_s_histo_gpu; + PyObject *__pyx_n_s_histo_inv_dr; + PyObject *__pyx_n_s_histo_max; + PyObject *__pyx_n_s_histo_min; + PyObject *__pyx_n_s_histo_n; + PyObject *__pyx_n_s_histo_out; + PyObject *__pyx_n_s_histogram; + PyObject *__pyx_n_s_histogram_out; + PyObject *__pyx_n_s_i; + PyObject *__pyx_n_s_id; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_index; + PyObject *__pyx_n_s_init; + PyObject *__pyx_n_s_init_subclass; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_int32; + PyObject *__pyx_n_s_invdx; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_itemsize; + PyObject *__pyx_kp_s_itemsize_0_for_cython_array; + PyObject *__pyx_n_s_ix; + PyObject *__pyx_n_s_ix2; + PyObject *__pyx_n_s_j; + PyObject *__pyx_n_s_k; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_maxshell; + PyObject *__pyx_n_s_mem_alloc; + PyObject *__pyx_n_s_memcpy_dtoh; + PyObject *__pyx_n_s_memcpy_htod; + PyObject *__pyx_n_s_memview; + PyObject *__pyx_n_s_metaclass; + PyObject *__pyx_n_s_mode; + PyObject *__pyx_n_s_mode_sel; + PyObject *__pyx_n_s_modes; + PyObject *__pyx_n_s_module; + PyObject *__pyx_n_s_mro_entries; + PyObject *__pyx_n_s_n1; + PyObject *__pyx_n_s_n2; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_name_2; + PyObject *__pyx_n_s_nbytes; + PyObject *__pyx_n_s_ncore; + PyObject *__pyx_n_s_ndim; + PyObject *__pyx_n_s_new; + PyObject *__pyx_n_s_newanalysis_gfunction; + PyObject *__pyx_kp_s_newanalysis_gfunction_gfunction; + PyObject *__pyx_n_s_nmol1; + PyObject *__pyx_n_s_nmol2; + PyObject *__pyx_kp_s_no_default___reduce___due_to_non; + PyObject *__pyx_n_s_norm; + PyObject *__pyx_n_s_normHisto; + PyObject *__pyx_n_s_norm_volume; + PyObject *__pyx_n_s_np; + PyObject *__pyx_n_s_nshells; + PyObject *__pyx_n_s_nsurr; + PyObject *__pyx_n_s_numpy; + PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; + PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; + PyObject *__pyx_n_s_obj; + PyObject *__pyx_n_s_object; + PyObject *__pyx_n_s_oneistwo; + PyObject *__pyx_n_s_open; + PyObject *__pyx_n_s_pack; + PyObject *__pyx_n_s_pickle; + PyObject *__pyx_n_s_pos; + PyObject *__pyx_n_s_pre_coor_sel1_gpu; + PyObject *__pyx_n_s_pre_coor_sel2_gpu; + PyObject *__pyx_n_s_pre_dip_sel1_gpu; + PyObject *__pyx_n_s_pre_dip_sel2_gpu; + PyObject *__pyx_n_s_prepare; + PyObject *__pyx_n_s_print; + PyObject *__pyx_n_s_printInfo; + PyObject *__pyx_n_s_pycuda; + PyObject *__pyx_n_s_pycuda_autoinit; + PyObject *__pyx_n_s_pycuda_compiler; + PyObject *__pyx_n_s_pycuda_driver; + PyObject *__pyx_n_s_pyx_PickleError; + PyObject *__pyx_n_s_pyx_checksum; + PyObject *__pyx_n_s_pyx_result; + PyObject *__pyx_n_s_pyx_state; + PyObject *__pyx_n_s_pyx_type; + PyObject *__pyx_n_s_pyx_unpickle_Enum; + PyObject *__pyx_n_s_pyx_vtable; + PyObject *__pyx_n_s_qualname; + PyObject *__pyx_n_s_r; + PyObject *__pyx_n_s_r_out; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_rdf; + PyObject *__pyx_n_s_reduce; + PyObject *__pyx_n_s_reduce_cython; + PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_register; + PyObject *__pyx_n_s_resetArrays; + PyObject *__pyx_n_s_result; + PyObject *__pyx_n_s_rho; + PyObject *__pyx_n_s_round; + PyObject *__pyx_n_s_scale; + PyObject *__pyx_n_s_sel1_n; + PyObject *__pyx_n_s_sel1_nmol; + PyObject *__pyx_n_s_sel2_n; + PyObject *__pyx_n_s_sel2_nmol; + PyObject *__pyx_n_s_self; + PyObject *__pyx_n_s_set_name; + PyObject *__pyx_n_s_setstate; + PyObject *__pyx_n_s_setstate_cython; + PyObject *__pyx_n_s_shape; + PyObject *__pyx_n_s_shell; + PyObject *__pyx_n_s_shell_2; + PyObject *__pyx_n_s_size; + PyObject *__pyx_n_s_slice_vol; + PyObject *__pyx_n_s_source; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_start; + PyObject *__pyx_n_s_step; + PyObject *__pyx_n_s_stop; + PyObject *__pyx_kp_s_strided_and_direct; + PyObject *__pyx_kp_s_strided_and_direct_or_indirect; + PyObject *__pyx_kp_s_strided_and_indirect; + PyObject *__pyx_kp_s_stringsource; + PyObject *__pyx_n_s_struct; + PyObject *__pyx_n_s_super; + PyObject *__pyx_n_s_surr_xyz; + PyObject *__pyx_n_s_sys; + PyObject *__pyx_n_s_t; + PyObject *__pyx_n_s_test; + PyObject *__pyx_kp_s_unable_to_allocate_array_data; + PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; + PyObject *__pyx_n_s_unpack; + PyObject *__pyx_n_s_update; + PyObject *__pyx_n_s_update_box; + PyObject *__pyx_n_s_use_cuda; + PyObject *__pyx_n_s_v; + PyObject *__pyx_n_s_value; + PyObject *__pyx_n_s_version_info; + PyObject *__pyx_n_s_volume; + PyObject *__pyx_n_s_volume_list; + PyObject *__pyx_n_s_w; + PyObject *__pyx_n_s_write; + PyObject *__pyx_n_s_zeros; + PyObject *__pyx_float_0_0; + PyObject *__pyx_float_0_5; + PyObject *__pyx_float_1_0; + PyObject *__pyx_float_2_0; + PyObject *__pyx_int_0; + PyObject *__pyx_int_1; + PyObject *__pyx_int_2; + PyObject *__pyx_int_3; + PyObject *__pyx_int_4; + PyObject *__pyx_int_5; + PyObject *__pyx_int_6; + PyObject *__pyx_int_7; + PyObject *__pyx_int_8; + PyObject *__pyx_int_16; + PyObject *__pyx_int_32; + PyObject *__pyx_int_64; + PyObject *__pyx_int_112105877; + PyObject *__pyx_int_136983863; + PyObject *__pyx_int_184977713; + PyObject *__pyx_int_neg_1; + PyObject *__pyx_slice__5; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__8; + PyObject *__pyx_tuple__9; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__11; + PyObject *__pyx_tuple__12; + PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__14; + PyObject *__pyx_tuple__15; + PyObject *__pyx_tuple__16; + PyObject *__pyx_tuple__17; + PyObject *__pyx_tuple__18; + PyObject *__pyx_tuple__19; + PyObject *__pyx_tuple__20; + PyObject *__pyx_tuple__21; + PyObject *__pyx_tuple__22; + PyObject *__pyx_tuple__23; + PyObject *__pyx_tuple__24; + PyObject *__pyx_tuple__25; + PyObject *__pyx_tuple__26; + PyObject *__pyx_tuple__27; + PyObject *__pyx_tuple__28; + PyObject *__pyx_tuple__30; + PyObject *__pyx_tuple__31; + PyObject *__pyx_tuple__32; + PyObject *__pyx_tuple__34; + PyObject *__pyx_tuple__36; + PyObject *__pyx_tuple__38; + PyObject *__pyx_tuple__40; + PyObject *__pyx_tuple__41; + PyObject *__pyx_tuple__42; + PyObject *__pyx_tuple__44; + PyObject *__pyx_tuple__45; + PyObject *__pyx_tuple__47; + PyObject *__pyx_tuple__49; + PyObject *__pyx_tuple__50; + PyObject *__pyx_tuple__52; + PyObject *__pyx_tuple__54; + PyObject *__pyx_tuple__56; + PyObject *__pyx_tuple__58; + PyObject *__pyx_tuple__59; + PyObject *__pyx_tuple__62; + PyObject *__pyx_tuple__63; + PyObject *__pyx_tuple__64; + PyObject *__pyx_tuple__66; + PyObject *__pyx_tuple__68; + PyObject *__pyx_tuple__70; + PyObject *__pyx_tuple__72; + PyObject *__pyx_tuple__75; + PyObject *__pyx_codeobj__29; + PyObject *__pyx_codeobj__33; + PyObject *__pyx_codeobj__35; + PyObject *__pyx_codeobj__37; + PyObject *__pyx_codeobj__39; + PyObject *__pyx_codeobj__43; + PyObject *__pyx_codeobj__46; + PyObject *__pyx_codeobj__48; + PyObject *__pyx_codeobj__51; + PyObject *__pyx_codeobj__53; + PyObject *__pyx_codeobj__55; + PyObject *__pyx_codeobj__57; + PyObject *__pyx_codeobj__60; + PyObject *__pyx_codeobj__61; + PyObject *__pyx_codeobj__65; + PyObject *__pyx_codeobj__67; + PyObject *__pyx_codeobj__69; + PyObject *__pyx_codeobj__71; + PyObject *__pyx_codeobj__73; + PyObject *__pyx_codeobj__74; + PyObject *__pyx_codeobj__76; + PyObject *__pyx_codeobj__77; + PyObject *__pyx_codeobj__78; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) + +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_kp_s_000); + Py_CLEAR(clear_module_state->__pyx_kp_s_011); + Py_CLEAR(clear_module_state->__pyx_kp_s_022); + Py_CLEAR(clear_module_state->__pyx_kp_s_101); + Py_CLEAR(clear_module_state->__pyx_kp_s_110); + Py_CLEAR(clear_module_state->__pyx_kp_s_202); + Py_CLEAR(clear_module_state->__pyx_kp_s_220); + Py_CLEAR(clear_module_state->__pyx_kp_s_5_5f_5_5f); + Py_CLEAR(clear_module_state->__pyx_n_s_ASCII); + Py_CLEAR(clear_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_CLEAR(clear_module_state->__pyx_n_s_CUDA); + Py_CLEAR(clear_module_state->__pyx_n_s_CUDA___init); + Py_CLEAR(clear_module_state->__pyx_n_s_CUDA_calcHistoGPU); + Py_CLEAR(clear_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_CLEAR(clear_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_CLEAR(clear_module_state->__pyx_n_s_Ellipsis); + Py_CLEAR(clear_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_CLEAR(clear_module_state->__pyx_kp_s_Frames_read); + Py_CLEAR(clear_module_state->__pyx_n_s_ImportError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_CLEAR(clear_module_state->__pyx_n_s_IndexError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_CLEAR(clear_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_CLEAR(clear_module_state->__pyx_n_s_MULTIPROCESSOR_COUNT); + Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_CLEAR(clear_module_state->__pyx_kp_s_Modes); + Py_CLEAR(clear_module_state->__pyx_kp_s_No_dipole_moment_array_for_the_f); + Py_CLEAR(clear_module_state->__pyx_kp_s_No_dipole_moment_array_for_the_f_2); + Py_CLEAR(clear_module_state->__pyx_kp_s_No_dipole_moment_array_for_the_s); + Py_CLEAR(clear_module_state->__pyx_kp_s_No_suitable_CUDA_device_was_foun); + Py_CLEAR(clear_module_state->__pyx_n_b_O); + Py_CLEAR(clear_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_CLEAR(clear_module_state->__pyx_n_s_PI); + Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF___init); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF__addHisto); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF__normHisto); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_calcFrame); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_printInfo); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_resetArrays); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_scale); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_update_box); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_voronoi); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_voronoi___init); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_voronoi__addHisto); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_voronoi__normHisto); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_voronoi_calcFrame); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_voronoi_printInfo); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_voronoi_resetArrays); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_voronoi_scale); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_voronoi_update_box); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_voronoi_write); + Py_CLEAR(clear_module_state->__pyx_n_s_RDF_write); + Py_CLEAR(clear_module_state->__pyx_n_s_Sequence); + Py_CLEAR(clear_module_state->__pyx_n_s_SourceModule); + Py_CLEAR(clear_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); + Py_CLEAR(clear_module_state->__pyx_n_s_View_MemoryView); + Py_CLEAR(clear_module_state->__pyx_kp_u__2); + Py_CLEAR(clear_module_state->__pyx_n_s__3); + Py_CLEAR(clear_module_state->__pyx_kp_u__6); + Py_CLEAR(clear_module_state->__pyx_kp_u__7); + Py_CLEAR(clear_module_state->__pyx_n_s__79); + Py_CLEAR(clear_module_state->__pyx_n_s_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_addHisto); + Py_CLEAR(clear_module_state->__pyx_n_s_all); + Py_CLEAR(clear_module_state->__pyx_n_s_allocate_buffer); + Py_CLEAR(clear_module_state->__pyx_kp_u_and); + Py_CLEAR(clear_module_state->__pyx_n_s_append); + Py_CLEAR(clear_module_state->__pyx_n_s_arr_sel1); + Py_CLEAR(clear_module_state->__pyx_n_s_arr_sel2); + Py_CLEAR(clear_module_state->__pyx_n_s_astype); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_autoinit); + Py_CLEAR(clear_module_state->__pyx_n_s_base); + Py_CLEAR(clear_module_state->__pyx_n_s_block); + Py_CLEAR(clear_module_state->__pyx_n_s_block_x); + Py_CLEAR(clear_module_state->__pyx_n_s_block_y); + Py_CLEAR(clear_module_state->__pyx_n_s_block_z); + Py_CLEAR(clear_module_state->__pyx_n_s_box_dim); + Py_CLEAR(clear_module_state->__pyx_n_s_box_dim_gpu); + Py_CLEAR(clear_module_state->__pyx_n_s_box_x); + Py_CLEAR(clear_module_state->__pyx_n_s_box_y); + Py_CLEAR(clear_module_state->__pyx_n_s_box_z); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl2); + Py_CLEAR(clear_module_state->__pyx_n_s_c); + Py_CLEAR(clear_module_state->__pyx_n_u_c); + Py_CLEAR(clear_module_state->__pyx_n_s_calcFrame); + Py_CLEAR(clear_module_state->__pyx_n_s_calcHistoGPU); + Py_CLEAR(clear_module_state->__pyx_n_s_calcHistoGPU_2); + Py_CLEAR(clear_module_state->__pyx_n_s_calcHistoTS); + Py_CLEAR(clear_module_state->__pyx_n_s_calcHistoTSVoro); + Py_CLEAR(clear_module_state->__pyx_n_s_class); + Py_CLEAR(clear_module_state->__pyx_kp_s_class_RDF_A_container_object_fo); + Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_collections); + Py_CLEAR(clear_module_state->__pyx_kp_s_collections_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_compute_capability); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_sel1); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_sel1_gpu); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_sel2); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_sel2_gpu); + Py_CLEAR(clear_module_state->__pyx_n_s_core_xyz); + Py_CLEAR(clear_module_state->__pyx_n_s_count); + Py_CLEAR(clear_module_state->__pyx_n_s_ctr); + Py_CLEAR(clear_module_state->__pyx_n_s_cu); + Py_CLEAR(clear_module_state->__pyx_n_s_cuda); + Py_CLEAR(clear_module_state->__pyx_n_s_delaunay_matrix); + Py_CLEAR(clear_module_state->__pyx_n_s_dev); + Py_CLEAR(clear_module_state->__pyx_n_s_device); + Py_CLEAR(clear_module_state->__pyx_kp_s_device___double_atomicAdd_dou); + Py_CLEAR(clear_module_state->__pyx_n_s_device_attribute); + Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_n_s_dip_sel1); + Py_CLEAR(clear_module_state->__pyx_n_s_dip_sel1_gpu); + Py_CLEAR(clear_module_state->__pyx_n_s_dip_sel2); + Py_CLEAR(clear_module_state->__pyx_n_s_dip_sel2_gpu); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_dist); + Py_CLEAR(clear_module_state->__pyx_n_s_doc); + Py_CLEAR(clear_module_state->__pyx_n_s_driver); + Py_CLEAR(clear_module_state->__pyx_n_s_drv); + Py_CLEAR(clear_module_state->__pyx_n_s_ds); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype_is_object); + Py_CLEAR(clear_module_state->__pyx_n_s_dx); + Py_CLEAR(clear_module_state->__pyx_n_s_dy); + Py_CLEAR(clear_module_state->__pyx_n_s_dz); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); + Py_CLEAR(clear_module_state->__pyx_n_s_error); + Py_CLEAR(clear_module_state->__pyx_n_s_exclude_self_mol); + Py_CLEAR(clear_module_state->__pyx_n_s_f000); + Py_CLEAR(clear_module_state->__pyx_n_s_f011); + Py_CLEAR(clear_module_state->__pyx_n_s_f022); + Py_CLEAR(clear_module_state->__pyx_n_s_f101); + Py_CLEAR(clear_module_state->__pyx_n_s_f110); + Py_CLEAR(clear_module_state->__pyx_n_s_f202); + Py_CLEAR(clear_module_state->__pyx_n_s_f220); + Py_CLEAR(clear_module_state->__pyx_n_s_filename); + Py_CLEAR(clear_module_state->__pyx_n_s_flags); + Py_CLEAR(clear_module_state->__pyx_n_s_float32); + Py_CLEAR(clear_module_state->__pyx_n_s_float64); + Py_CLEAR(clear_module_state->__pyx_n_s_format); + Py_CLEAR(clear_module_state->__pyx_n_s_fortran); + Py_CLEAR(clear_module_state->__pyx_n_u_fortran); + Py_CLEAR(clear_module_state->__pyx_kp_s_g000_dat); + Py_CLEAR(clear_module_state->__pyx_kp_s_g011_dat); + Py_CLEAR(clear_module_state->__pyx_kp_s_g022_dat); + Py_CLEAR(clear_module_state->__pyx_kp_s_g101_dat); + Py_CLEAR(clear_module_state->__pyx_kp_s_g110_dat); + Py_CLEAR(clear_module_state->__pyx_kp_s_g202_dat); + Py_CLEAR(clear_module_state->__pyx_kp_s_g220_dat); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_get_attribute); + Py_CLEAR(clear_module_state->__pyx_n_s_get_function); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_kp_u_got); + Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_grid); + Py_CLEAR(clear_module_state->__pyx_n_s_grid_x); + Py_CLEAR(clear_module_state->__pyx_n_s_grid_y); + Py_CLEAR(clear_module_state->__pyx_n_s_histo); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_dr); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_gpu); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_inv_dr); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_max); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_min); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_n); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_out); + Py_CLEAR(clear_module_state->__pyx_n_s_histogram); + Py_CLEAR(clear_module_state->__pyx_n_s_histogram_out); + Py_CLEAR(clear_module_state->__pyx_n_s_i); + Py_CLEAR(clear_module_state->__pyx_n_s_id); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_index); + Py_CLEAR(clear_module_state->__pyx_n_s_init); + Py_CLEAR(clear_module_state->__pyx_n_s_init_subclass); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_int32); + Py_CLEAR(clear_module_state->__pyx_n_s_invdx); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_itemsize); + Py_CLEAR(clear_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_CLEAR(clear_module_state->__pyx_n_s_ix); + Py_CLEAR(clear_module_state->__pyx_n_s_ix2); + Py_CLEAR(clear_module_state->__pyx_n_s_j); + Py_CLEAR(clear_module_state->__pyx_n_s_k); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_maxshell); + Py_CLEAR(clear_module_state->__pyx_n_s_mem_alloc); + Py_CLEAR(clear_module_state->__pyx_n_s_memcpy_dtoh); + Py_CLEAR(clear_module_state->__pyx_n_s_memcpy_htod); + Py_CLEAR(clear_module_state->__pyx_n_s_memview); + Py_CLEAR(clear_module_state->__pyx_n_s_metaclass); + Py_CLEAR(clear_module_state->__pyx_n_s_mode); + Py_CLEAR(clear_module_state->__pyx_n_s_mode_sel); + Py_CLEAR(clear_module_state->__pyx_n_s_modes); + Py_CLEAR(clear_module_state->__pyx_n_s_module); + Py_CLEAR(clear_module_state->__pyx_n_s_mro_entries); + Py_CLEAR(clear_module_state->__pyx_n_s_n1); + Py_CLEAR(clear_module_state->__pyx_n_s_n2); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_name_2); + Py_CLEAR(clear_module_state->__pyx_n_s_nbytes); + Py_CLEAR(clear_module_state->__pyx_n_s_ncore); + Py_CLEAR(clear_module_state->__pyx_n_s_ndim); + Py_CLEAR(clear_module_state->__pyx_n_s_new); + Py_CLEAR(clear_module_state->__pyx_n_s_newanalysis_gfunction); + Py_CLEAR(clear_module_state->__pyx_kp_s_newanalysis_gfunction_gfunction); + Py_CLEAR(clear_module_state->__pyx_n_s_nmol1); + Py_CLEAR(clear_module_state->__pyx_n_s_nmol2); + Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_CLEAR(clear_module_state->__pyx_n_s_norm); + Py_CLEAR(clear_module_state->__pyx_n_s_normHisto); + Py_CLEAR(clear_module_state->__pyx_n_s_norm_volume); + Py_CLEAR(clear_module_state->__pyx_n_s_np); + Py_CLEAR(clear_module_state->__pyx_n_s_nshells); + Py_CLEAR(clear_module_state->__pyx_n_s_nsurr); + Py_CLEAR(clear_module_state->__pyx_n_s_numpy); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_CLEAR(clear_module_state->__pyx_n_s_obj); + Py_CLEAR(clear_module_state->__pyx_n_s_object); + Py_CLEAR(clear_module_state->__pyx_n_s_oneistwo); + Py_CLEAR(clear_module_state->__pyx_n_s_open); + Py_CLEAR(clear_module_state->__pyx_n_s_pack); + Py_CLEAR(clear_module_state->__pyx_n_s_pickle); + Py_CLEAR(clear_module_state->__pyx_n_s_pos); + Py_CLEAR(clear_module_state->__pyx_n_s_pre_coor_sel1_gpu); + Py_CLEAR(clear_module_state->__pyx_n_s_pre_coor_sel2_gpu); + Py_CLEAR(clear_module_state->__pyx_n_s_pre_dip_sel1_gpu); + Py_CLEAR(clear_module_state->__pyx_n_s_pre_dip_sel2_gpu); + Py_CLEAR(clear_module_state->__pyx_n_s_prepare); + Py_CLEAR(clear_module_state->__pyx_n_s_print); + Py_CLEAR(clear_module_state->__pyx_n_s_printInfo); + Py_CLEAR(clear_module_state->__pyx_n_s_pycuda); + Py_CLEAR(clear_module_state->__pyx_n_s_pycuda_autoinit); + Py_CLEAR(clear_module_state->__pyx_n_s_pycuda_compiler); + Py_CLEAR(clear_module_state->__pyx_n_s_pycuda_driver); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); + Py_CLEAR(clear_module_state->__pyx_n_s_qualname); + Py_CLEAR(clear_module_state->__pyx_n_s_r); + Py_CLEAR(clear_module_state->__pyx_n_s_r_out); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_rdf); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_register); + Py_CLEAR(clear_module_state->__pyx_n_s_resetArrays); + Py_CLEAR(clear_module_state->__pyx_n_s_result); + Py_CLEAR(clear_module_state->__pyx_n_s_rho); + Py_CLEAR(clear_module_state->__pyx_n_s_round); + Py_CLEAR(clear_module_state->__pyx_n_s_scale); + Py_CLEAR(clear_module_state->__pyx_n_s_sel1_n); + Py_CLEAR(clear_module_state->__pyx_n_s_sel1_nmol); + Py_CLEAR(clear_module_state->__pyx_n_s_sel2_n); + Py_CLEAR(clear_module_state->__pyx_n_s_sel2_nmol); + Py_CLEAR(clear_module_state->__pyx_n_s_self); + Py_CLEAR(clear_module_state->__pyx_n_s_set_name); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_shape); + Py_CLEAR(clear_module_state->__pyx_n_s_shell); + Py_CLEAR(clear_module_state->__pyx_n_s_shell_2); + Py_CLEAR(clear_module_state->__pyx_n_s_size); + Py_CLEAR(clear_module_state->__pyx_n_s_slice_vol); + Py_CLEAR(clear_module_state->__pyx_n_s_source); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_start); + Py_CLEAR(clear_module_state->__pyx_n_s_step); + Py_CLEAR(clear_module_state->__pyx_n_s_stop); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_struct); + Py_CLEAR(clear_module_state->__pyx_n_s_super); + Py_CLEAR(clear_module_state->__pyx_n_s_surr_xyz); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_t); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_CLEAR(clear_module_state->__pyx_n_s_unpack); + Py_CLEAR(clear_module_state->__pyx_n_s_update); + Py_CLEAR(clear_module_state->__pyx_n_s_update_box); + Py_CLEAR(clear_module_state->__pyx_n_s_use_cuda); + Py_CLEAR(clear_module_state->__pyx_n_s_v); + Py_CLEAR(clear_module_state->__pyx_n_s_value); + Py_CLEAR(clear_module_state->__pyx_n_s_version_info); + Py_CLEAR(clear_module_state->__pyx_n_s_volume); + Py_CLEAR(clear_module_state->__pyx_n_s_volume_list); + Py_CLEAR(clear_module_state->__pyx_n_s_w); + Py_CLEAR(clear_module_state->__pyx_n_s_write); + Py_CLEAR(clear_module_state->__pyx_n_s_zeros); + Py_CLEAR(clear_module_state->__pyx_float_0_0); + Py_CLEAR(clear_module_state->__pyx_float_0_5); + Py_CLEAR(clear_module_state->__pyx_float_1_0); + Py_CLEAR(clear_module_state->__pyx_float_2_0); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_2); + Py_CLEAR(clear_module_state->__pyx_int_3); + Py_CLEAR(clear_module_state->__pyx_int_4); + Py_CLEAR(clear_module_state->__pyx_int_5); + Py_CLEAR(clear_module_state->__pyx_int_6); + Py_CLEAR(clear_module_state->__pyx_int_7); + Py_CLEAR(clear_module_state->__pyx_int_8); + Py_CLEAR(clear_module_state->__pyx_int_16); + Py_CLEAR(clear_module_state->__pyx_int_32); + Py_CLEAR(clear_module_state->__pyx_int_64); + Py_CLEAR(clear_module_state->__pyx_int_112105877); + Py_CLEAR(clear_module_state->__pyx_int_136983863); + Py_CLEAR(clear_module_state->__pyx_int_184977713); + Py_CLEAR(clear_module_state->__pyx_int_neg_1); + Py_CLEAR(clear_module_state->__pyx_slice__5); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_tuple__9); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__14); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__16); + Py_CLEAR(clear_module_state->__pyx_tuple__17); + Py_CLEAR(clear_module_state->__pyx_tuple__18); + Py_CLEAR(clear_module_state->__pyx_tuple__19); + Py_CLEAR(clear_module_state->__pyx_tuple__20); + Py_CLEAR(clear_module_state->__pyx_tuple__21); + Py_CLEAR(clear_module_state->__pyx_tuple__22); + Py_CLEAR(clear_module_state->__pyx_tuple__23); + Py_CLEAR(clear_module_state->__pyx_tuple__24); + Py_CLEAR(clear_module_state->__pyx_tuple__25); + Py_CLEAR(clear_module_state->__pyx_tuple__26); + Py_CLEAR(clear_module_state->__pyx_tuple__27); + Py_CLEAR(clear_module_state->__pyx_tuple__28); + Py_CLEAR(clear_module_state->__pyx_tuple__30); + Py_CLEAR(clear_module_state->__pyx_tuple__31); + Py_CLEAR(clear_module_state->__pyx_tuple__32); + Py_CLEAR(clear_module_state->__pyx_tuple__34); + Py_CLEAR(clear_module_state->__pyx_tuple__36); + Py_CLEAR(clear_module_state->__pyx_tuple__38); + Py_CLEAR(clear_module_state->__pyx_tuple__40); + Py_CLEAR(clear_module_state->__pyx_tuple__41); + Py_CLEAR(clear_module_state->__pyx_tuple__42); + Py_CLEAR(clear_module_state->__pyx_tuple__44); + Py_CLEAR(clear_module_state->__pyx_tuple__45); + Py_CLEAR(clear_module_state->__pyx_tuple__47); + Py_CLEAR(clear_module_state->__pyx_tuple__49); + Py_CLEAR(clear_module_state->__pyx_tuple__50); + Py_CLEAR(clear_module_state->__pyx_tuple__52); + Py_CLEAR(clear_module_state->__pyx_tuple__54); + Py_CLEAR(clear_module_state->__pyx_tuple__56); + Py_CLEAR(clear_module_state->__pyx_tuple__58); + Py_CLEAR(clear_module_state->__pyx_tuple__59); + Py_CLEAR(clear_module_state->__pyx_tuple__62); + Py_CLEAR(clear_module_state->__pyx_tuple__63); + Py_CLEAR(clear_module_state->__pyx_tuple__64); + Py_CLEAR(clear_module_state->__pyx_tuple__66); + Py_CLEAR(clear_module_state->__pyx_tuple__68); + Py_CLEAR(clear_module_state->__pyx_tuple__70); + Py_CLEAR(clear_module_state->__pyx_tuple__72); + Py_CLEAR(clear_module_state->__pyx_tuple__75); + Py_CLEAR(clear_module_state->__pyx_codeobj__29); + Py_CLEAR(clear_module_state->__pyx_codeobj__33); + Py_CLEAR(clear_module_state->__pyx_codeobj__35); + Py_CLEAR(clear_module_state->__pyx_codeobj__37); + Py_CLEAR(clear_module_state->__pyx_codeobj__39); + Py_CLEAR(clear_module_state->__pyx_codeobj__43); + Py_CLEAR(clear_module_state->__pyx_codeobj__46); + Py_CLEAR(clear_module_state->__pyx_codeobj__48); + Py_CLEAR(clear_module_state->__pyx_codeobj__51); + Py_CLEAR(clear_module_state->__pyx_codeobj__53); + Py_CLEAR(clear_module_state->__pyx_codeobj__55); + Py_CLEAR(clear_module_state->__pyx_codeobj__57); + Py_CLEAR(clear_module_state->__pyx_codeobj__60); + Py_CLEAR(clear_module_state->__pyx_codeobj__61); + Py_CLEAR(clear_module_state->__pyx_codeobj__65); + Py_CLEAR(clear_module_state->__pyx_codeobj__67); + Py_CLEAR(clear_module_state->__pyx_codeobj__69); + Py_CLEAR(clear_module_state->__pyx_codeobj__71); + Py_CLEAR(clear_module_state->__pyx_codeobj__73); + Py_CLEAR(clear_module_state->__pyx_codeobj__74); + Py_CLEAR(clear_module_state->__pyx_codeobj__76); + Py_CLEAR(clear_module_state->__pyx_codeobj__77); + Py_CLEAR(clear_module_state->__pyx_codeobj__78); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_kp_s_000); + Py_VISIT(traverse_module_state->__pyx_kp_s_011); + Py_VISIT(traverse_module_state->__pyx_kp_s_022); + Py_VISIT(traverse_module_state->__pyx_kp_s_101); + Py_VISIT(traverse_module_state->__pyx_kp_s_110); + Py_VISIT(traverse_module_state->__pyx_kp_s_202); + Py_VISIT(traverse_module_state->__pyx_kp_s_220); + Py_VISIT(traverse_module_state->__pyx_kp_s_5_5f_5_5f); + Py_VISIT(traverse_module_state->__pyx_n_s_ASCII); + Py_VISIT(traverse_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_VISIT(traverse_module_state->__pyx_n_s_CUDA); + Py_VISIT(traverse_module_state->__pyx_n_s_CUDA___init); + Py_VISIT(traverse_module_state->__pyx_n_s_CUDA_calcHistoGPU); + Py_VISIT(traverse_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_VISIT(traverse_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_VISIT(traverse_module_state->__pyx_n_s_Ellipsis); + Py_VISIT(traverse_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_VISIT(traverse_module_state->__pyx_kp_s_Frames_read); + Py_VISIT(traverse_module_state->__pyx_n_s_ImportError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_VISIT(traverse_module_state->__pyx_n_s_IndexError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_VISIT(traverse_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_VISIT(traverse_module_state->__pyx_n_s_MULTIPROCESSOR_COUNT); + Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_VISIT(traverse_module_state->__pyx_kp_s_Modes); + Py_VISIT(traverse_module_state->__pyx_kp_s_No_dipole_moment_array_for_the_f); + Py_VISIT(traverse_module_state->__pyx_kp_s_No_dipole_moment_array_for_the_f_2); + Py_VISIT(traverse_module_state->__pyx_kp_s_No_dipole_moment_array_for_the_s); + Py_VISIT(traverse_module_state->__pyx_kp_s_No_suitable_CUDA_device_was_foun); + Py_VISIT(traverse_module_state->__pyx_n_b_O); + Py_VISIT(traverse_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_VISIT(traverse_module_state->__pyx_n_s_PI); + Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF___init); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF__addHisto); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF__normHisto); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_calcFrame); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_printInfo); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_resetArrays); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_scale); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_update_box); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_voronoi); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_voronoi___init); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_voronoi__addHisto); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_voronoi__normHisto); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_voronoi_calcFrame); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_voronoi_printInfo); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_voronoi_resetArrays); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_voronoi_scale); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_voronoi_update_box); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_voronoi_write); + Py_VISIT(traverse_module_state->__pyx_n_s_RDF_write); + Py_VISIT(traverse_module_state->__pyx_n_s_Sequence); + Py_VISIT(traverse_module_state->__pyx_n_s_SourceModule); + Py_VISIT(traverse_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); + Py_VISIT(traverse_module_state->__pyx_n_s_View_MemoryView); + Py_VISIT(traverse_module_state->__pyx_kp_u__2); + Py_VISIT(traverse_module_state->__pyx_n_s__3); + Py_VISIT(traverse_module_state->__pyx_kp_u__6); + Py_VISIT(traverse_module_state->__pyx_kp_u__7); + Py_VISIT(traverse_module_state->__pyx_n_s__79); + Py_VISIT(traverse_module_state->__pyx_n_s_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_addHisto); + Py_VISIT(traverse_module_state->__pyx_n_s_all); + Py_VISIT(traverse_module_state->__pyx_n_s_allocate_buffer); + Py_VISIT(traverse_module_state->__pyx_kp_u_and); + Py_VISIT(traverse_module_state->__pyx_n_s_append); + Py_VISIT(traverse_module_state->__pyx_n_s_arr_sel1); + Py_VISIT(traverse_module_state->__pyx_n_s_arr_sel2); + Py_VISIT(traverse_module_state->__pyx_n_s_astype); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_autoinit); + Py_VISIT(traverse_module_state->__pyx_n_s_base); + Py_VISIT(traverse_module_state->__pyx_n_s_block); + Py_VISIT(traverse_module_state->__pyx_n_s_block_x); + Py_VISIT(traverse_module_state->__pyx_n_s_block_y); + Py_VISIT(traverse_module_state->__pyx_n_s_block_z); + Py_VISIT(traverse_module_state->__pyx_n_s_box_dim); + Py_VISIT(traverse_module_state->__pyx_n_s_box_dim_gpu); + Py_VISIT(traverse_module_state->__pyx_n_s_box_x); + Py_VISIT(traverse_module_state->__pyx_n_s_box_y); + Py_VISIT(traverse_module_state->__pyx_n_s_box_z); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl2); + Py_VISIT(traverse_module_state->__pyx_n_s_c); + Py_VISIT(traverse_module_state->__pyx_n_u_c); + Py_VISIT(traverse_module_state->__pyx_n_s_calcFrame); + Py_VISIT(traverse_module_state->__pyx_n_s_calcHistoGPU); + Py_VISIT(traverse_module_state->__pyx_n_s_calcHistoGPU_2); + Py_VISIT(traverse_module_state->__pyx_n_s_calcHistoTS); + Py_VISIT(traverse_module_state->__pyx_n_s_calcHistoTSVoro); + Py_VISIT(traverse_module_state->__pyx_n_s_class); + Py_VISIT(traverse_module_state->__pyx_kp_s_class_RDF_A_container_object_fo); + Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_collections); + Py_VISIT(traverse_module_state->__pyx_kp_s_collections_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_compute_capability); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_sel1); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_sel1_gpu); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_sel2); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_sel2_gpu); + Py_VISIT(traverse_module_state->__pyx_n_s_core_xyz); + Py_VISIT(traverse_module_state->__pyx_n_s_count); + Py_VISIT(traverse_module_state->__pyx_n_s_ctr); + Py_VISIT(traverse_module_state->__pyx_n_s_cu); + Py_VISIT(traverse_module_state->__pyx_n_s_cuda); + Py_VISIT(traverse_module_state->__pyx_n_s_delaunay_matrix); + Py_VISIT(traverse_module_state->__pyx_n_s_dev); + Py_VISIT(traverse_module_state->__pyx_n_s_device); + Py_VISIT(traverse_module_state->__pyx_kp_s_device___double_atomicAdd_dou); + Py_VISIT(traverse_module_state->__pyx_n_s_device_attribute); + Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_n_s_dip_sel1); + Py_VISIT(traverse_module_state->__pyx_n_s_dip_sel1_gpu); + Py_VISIT(traverse_module_state->__pyx_n_s_dip_sel2); + Py_VISIT(traverse_module_state->__pyx_n_s_dip_sel2_gpu); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_dist); + Py_VISIT(traverse_module_state->__pyx_n_s_doc); + Py_VISIT(traverse_module_state->__pyx_n_s_driver); + Py_VISIT(traverse_module_state->__pyx_n_s_drv); + Py_VISIT(traverse_module_state->__pyx_n_s_ds); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype_is_object); + Py_VISIT(traverse_module_state->__pyx_n_s_dx); + Py_VISIT(traverse_module_state->__pyx_n_s_dy); + Py_VISIT(traverse_module_state->__pyx_n_s_dz); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); + Py_VISIT(traverse_module_state->__pyx_n_s_error); + Py_VISIT(traverse_module_state->__pyx_n_s_exclude_self_mol); + Py_VISIT(traverse_module_state->__pyx_n_s_f000); + Py_VISIT(traverse_module_state->__pyx_n_s_f011); + Py_VISIT(traverse_module_state->__pyx_n_s_f022); + Py_VISIT(traverse_module_state->__pyx_n_s_f101); + Py_VISIT(traverse_module_state->__pyx_n_s_f110); + Py_VISIT(traverse_module_state->__pyx_n_s_f202); + Py_VISIT(traverse_module_state->__pyx_n_s_f220); + Py_VISIT(traverse_module_state->__pyx_n_s_filename); + Py_VISIT(traverse_module_state->__pyx_n_s_flags); + Py_VISIT(traverse_module_state->__pyx_n_s_float32); + Py_VISIT(traverse_module_state->__pyx_n_s_float64); + Py_VISIT(traverse_module_state->__pyx_n_s_format); + Py_VISIT(traverse_module_state->__pyx_n_s_fortran); + Py_VISIT(traverse_module_state->__pyx_n_u_fortran); + Py_VISIT(traverse_module_state->__pyx_kp_s_g000_dat); + Py_VISIT(traverse_module_state->__pyx_kp_s_g011_dat); + Py_VISIT(traverse_module_state->__pyx_kp_s_g022_dat); + Py_VISIT(traverse_module_state->__pyx_kp_s_g101_dat); + Py_VISIT(traverse_module_state->__pyx_kp_s_g110_dat); + Py_VISIT(traverse_module_state->__pyx_kp_s_g202_dat); + Py_VISIT(traverse_module_state->__pyx_kp_s_g220_dat); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_get_attribute); + Py_VISIT(traverse_module_state->__pyx_n_s_get_function); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_kp_u_got); + Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_grid); + Py_VISIT(traverse_module_state->__pyx_n_s_grid_x); + Py_VISIT(traverse_module_state->__pyx_n_s_grid_y); + Py_VISIT(traverse_module_state->__pyx_n_s_histo); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_dr); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_gpu); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_inv_dr); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_max); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_min); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_n); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_out); + Py_VISIT(traverse_module_state->__pyx_n_s_histogram); + Py_VISIT(traverse_module_state->__pyx_n_s_histogram_out); + Py_VISIT(traverse_module_state->__pyx_n_s_i); + Py_VISIT(traverse_module_state->__pyx_n_s_id); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_index); + Py_VISIT(traverse_module_state->__pyx_n_s_init); + Py_VISIT(traverse_module_state->__pyx_n_s_init_subclass); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_int32); + Py_VISIT(traverse_module_state->__pyx_n_s_invdx); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_itemsize); + Py_VISIT(traverse_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_VISIT(traverse_module_state->__pyx_n_s_ix); + Py_VISIT(traverse_module_state->__pyx_n_s_ix2); + Py_VISIT(traverse_module_state->__pyx_n_s_j); + Py_VISIT(traverse_module_state->__pyx_n_s_k); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_maxshell); + Py_VISIT(traverse_module_state->__pyx_n_s_mem_alloc); + Py_VISIT(traverse_module_state->__pyx_n_s_memcpy_dtoh); + Py_VISIT(traverse_module_state->__pyx_n_s_memcpy_htod); + Py_VISIT(traverse_module_state->__pyx_n_s_memview); + Py_VISIT(traverse_module_state->__pyx_n_s_metaclass); + Py_VISIT(traverse_module_state->__pyx_n_s_mode); + Py_VISIT(traverse_module_state->__pyx_n_s_mode_sel); + Py_VISIT(traverse_module_state->__pyx_n_s_modes); + Py_VISIT(traverse_module_state->__pyx_n_s_module); + Py_VISIT(traverse_module_state->__pyx_n_s_mro_entries); + Py_VISIT(traverse_module_state->__pyx_n_s_n1); + Py_VISIT(traverse_module_state->__pyx_n_s_n2); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_name_2); + Py_VISIT(traverse_module_state->__pyx_n_s_nbytes); + Py_VISIT(traverse_module_state->__pyx_n_s_ncore); + Py_VISIT(traverse_module_state->__pyx_n_s_ndim); + Py_VISIT(traverse_module_state->__pyx_n_s_new); + Py_VISIT(traverse_module_state->__pyx_n_s_newanalysis_gfunction); + Py_VISIT(traverse_module_state->__pyx_kp_s_newanalysis_gfunction_gfunction); + Py_VISIT(traverse_module_state->__pyx_n_s_nmol1); + Py_VISIT(traverse_module_state->__pyx_n_s_nmol2); + Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_VISIT(traverse_module_state->__pyx_n_s_norm); + Py_VISIT(traverse_module_state->__pyx_n_s_normHisto); + Py_VISIT(traverse_module_state->__pyx_n_s_norm_volume); + Py_VISIT(traverse_module_state->__pyx_n_s_np); + Py_VISIT(traverse_module_state->__pyx_n_s_nshells); + Py_VISIT(traverse_module_state->__pyx_n_s_nsurr); + Py_VISIT(traverse_module_state->__pyx_n_s_numpy); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_VISIT(traverse_module_state->__pyx_n_s_obj); + Py_VISIT(traverse_module_state->__pyx_n_s_object); + Py_VISIT(traverse_module_state->__pyx_n_s_oneistwo); + Py_VISIT(traverse_module_state->__pyx_n_s_open); + Py_VISIT(traverse_module_state->__pyx_n_s_pack); + Py_VISIT(traverse_module_state->__pyx_n_s_pickle); + Py_VISIT(traverse_module_state->__pyx_n_s_pos); + Py_VISIT(traverse_module_state->__pyx_n_s_pre_coor_sel1_gpu); + Py_VISIT(traverse_module_state->__pyx_n_s_pre_coor_sel2_gpu); + Py_VISIT(traverse_module_state->__pyx_n_s_pre_dip_sel1_gpu); + Py_VISIT(traverse_module_state->__pyx_n_s_pre_dip_sel2_gpu); + Py_VISIT(traverse_module_state->__pyx_n_s_prepare); + Py_VISIT(traverse_module_state->__pyx_n_s_print); + Py_VISIT(traverse_module_state->__pyx_n_s_printInfo); + Py_VISIT(traverse_module_state->__pyx_n_s_pycuda); + Py_VISIT(traverse_module_state->__pyx_n_s_pycuda_autoinit); + Py_VISIT(traverse_module_state->__pyx_n_s_pycuda_compiler); + Py_VISIT(traverse_module_state->__pyx_n_s_pycuda_driver); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); + Py_VISIT(traverse_module_state->__pyx_n_s_qualname); + Py_VISIT(traverse_module_state->__pyx_n_s_r); + Py_VISIT(traverse_module_state->__pyx_n_s_r_out); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_rdf); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_register); + Py_VISIT(traverse_module_state->__pyx_n_s_resetArrays); + Py_VISIT(traverse_module_state->__pyx_n_s_result); + Py_VISIT(traverse_module_state->__pyx_n_s_rho); + Py_VISIT(traverse_module_state->__pyx_n_s_round); + Py_VISIT(traverse_module_state->__pyx_n_s_scale); + Py_VISIT(traverse_module_state->__pyx_n_s_sel1_n); + Py_VISIT(traverse_module_state->__pyx_n_s_sel1_nmol); + Py_VISIT(traverse_module_state->__pyx_n_s_sel2_n); + Py_VISIT(traverse_module_state->__pyx_n_s_sel2_nmol); + Py_VISIT(traverse_module_state->__pyx_n_s_self); + Py_VISIT(traverse_module_state->__pyx_n_s_set_name); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_shape); + Py_VISIT(traverse_module_state->__pyx_n_s_shell); + Py_VISIT(traverse_module_state->__pyx_n_s_shell_2); + Py_VISIT(traverse_module_state->__pyx_n_s_size); + Py_VISIT(traverse_module_state->__pyx_n_s_slice_vol); + Py_VISIT(traverse_module_state->__pyx_n_s_source); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_start); + Py_VISIT(traverse_module_state->__pyx_n_s_step); + Py_VISIT(traverse_module_state->__pyx_n_s_stop); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_struct); + Py_VISIT(traverse_module_state->__pyx_n_s_super); + Py_VISIT(traverse_module_state->__pyx_n_s_surr_xyz); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_t); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_VISIT(traverse_module_state->__pyx_n_s_unpack); + Py_VISIT(traverse_module_state->__pyx_n_s_update); + Py_VISIT(traverse_module_state->__pyx_n_s_update_box); + Py_VISIT(traverse_module_state->__pyx_n_s_use_cuda); + Py_VISIT(traverse_module_state->__pyx_n_s_v); + Py_VISIT(traverse_module_state->__pyx_n_s_value); + Py_VISIT(traverse_module_state->__pyx_n_s_version_info); + Py_VISIT(traverse_module_state->__pyx_n_s_volume); + Py_VISIT(traverse_module_state->__pyx_n_s_volume_list); + Py_VISIT(traverse_module_state->__pyx_n_s_w); + Py_VISIT(traverse_module_state->__pyx_n_s_write); + Py_VISIT(traverse_module_state->__pyx_n_s_zeros); + Py_VISIT(traverse_module_state->__pyx_float_0_0); + Py_VISIT(traverse_module_state->__pyx_float_0_5); + Py_VISIT(traverse_module_state->__pyx_float_1_0); + Py_VISIT(traverse_module_state->__pyx_float_2_0); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_2); + Py_VISIT(traverse_module_state->__pyx_int_3); + Py_VISIT(traverse_module_state->__pyx_int_4); + Py_VISIT(traverse_module_state->__pyx_int_5); + Py_VISIT(traverse_module_state->__pyx_int_6); + Py_VISIT(traverse_module_state->__pyx_int_7); + Py_VISIT(traverse_module_state->__pyx_int_8); + Py_VISIT(traverse_module_state->__pyx_int_16); + Py_VISIT(traverse_module_state->__pyx_int_32); + Py_VISIT(traverse_module_state->__pyx_int_64); + Py_VISIT(traverse_module_state->__pyx_int_112105877); + Py_VISIT(traverse_module_state->__pyx_int_136983863); + Py_VISIT(traverse_module_state->__pyx_int_184977713); + Py_VISIT(traverse_module_state->__pyx_int_neg_1); + Py_VISIT(traverse_module_state->__pyx_slice__5); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_tuple__9); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__14); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__16); + Py_VISIT(traverse_module_state->__pyx_tuple__17); + Py_VISIT(traverse_module_state->__pyx_tuple__18); + Py_VISIT(traverse_module_state->__pyx_tuple__19); + Py_VISIT(traverse_module_state->__pyx_tuple__20); + Py_VISIT(traverse_module_state->__pyx_tuple__21); + Py_VISIT(traverse_module_state->__pyx_tuple__22); + Py_VISIT(traverse_module_state->__pyx_tuple__23); + Py_VISIT(traverse_module_state->__pyx_tuple__24); + Py_VISIT(traverse_module_state->__pyx_tuple__25); + Py_VISIT(traverse_module_state->__pyx_tuple__26); + Py_VISIT(traverse_module_state->__pyx_tuple__27); + Py_VISIT(traverse_module_state->__pyx_tuple__28); + Py_VISIT(traverse_module_state->__pyx_tuple__30); + Py_VISIT(traverse_module_state->__pyx_tuple__31); + Py_VISIT(traverse_module_state->__pyx_tuple__32); + Py_VISIT(traverse_module_state->__pyx_tuple__34); + Py_VISIT(traverse_module_state->__pyx_tuple__36); + Py_VISIT(traverse_module_state->__pyx_tuple__38); + Py_VISIT(traverse_module_state->__pyx_tuple__40); + Py_VISIT(traverse_module_state->__pyx_tuple__41); + Py_VISIT(traverse_module_state->__pyx_tuple__42); + Py_VISIT(traverse_module_state->__pyx_tuple__44); + Py_VISIT(traverse_module_state->__pyx_tuple__45); + Py_VISIT(traverse_module_state->__pyx_tuple__47); + Py_VISIT(traverse_module_state->__pyx_tuple__49); + Py_VISIT(traverse_module_state->__pyx_tuple__50); + Py_VISIT(traverse_module_state->__pyx_tuple__52); + Py_VISIT(traverse_module_state->__pyx_tuple__54); + Py_VISIT(traverse_module_state->__pyx_tuple__56); + Py_VISIT(traverse_module_state->__pyx_tuple__58); + Py_VISIT(traverse_module_state->__pyx_tuple__59); + Py_VISIT(traverse_module_state->__pyx_tuple__62); + Py_VISIT(traverse_module_state->__pyx_tuple__63); + Py_VISIT(traverse_module_state->__pyx_tuple__64); + Py_VISIT(traverse_module_state->__pyx_tuple__66); + Py_VISIT(traverse_module_state->__pyx_tuple__68); + Py_VISIT(traverse_module_state->__pyx_tuple__70); + Py_VISIT(traverse_module_state->__pyx_tuple__72); + Py_VISIT(traverse_module_state->__pyx_tuple__75); + Py_VISIT(traverse_module_state->__pyx_codeobj__29); + Py_VISIT(traverse_module_state->__pyx_codeobj__33); + Py_VISIT(traverse_module_state->__pyx_codeobj__35); + Py_VISIT(traverse_module_state->__pyx_codeobj__37); + Py_VISIT(traverse_module_state->__pyx_codeobj__39); + Py_VISIT(traverse_module_state->__pyx_codeobj__43); + Py_VISIT(traverse_module_state->__pyx_codeobj__46); + Py_VISIT(traverse_module_state->__pyx_codeobj__48); + Py_VISIT(traverse_module_state->__pyx_codeobj__51); + Py_VISIT(traverse_module_state->__pyx_codeobj__53); + Py_VISIT(traverse_module_state->__pyx_codeobj__55); + Py_VISIT(traverse_module_state->__pyx_codeobj__57); + Py_VISIT(traverse_module_state->__pyx_codeobj__60); + Py_VISIT(traverse_module_state->__pyx_codeobj__61); + Py_VISIT(traverse_module_state->__pyx_codeobj__65); + Py_VISIT(traverse_module_state->__pyx_codeobj__67); + Py_VISIT(traverse_module_state->__pyx_codeobj__69); + Py_VISIT(traverse_module_state->__pyx_codeobj__71); + Py_VISIT(traverse_module_state->__pyx_codeobj__73); + Py_VISIT(traverse_module_state->__pyx_codeobj__74); + Py_VISIT(traverse_module_state->__pyx_codeobj__76); + Py_VISIT(traverse_module_state->__pyx_codeobj__77); + Py_VISIT(traverse_module_state->__pyx_codeobj__78); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_5numpy_dtype __pyx_mstate_global->__pyx_ptype_5numpy_dtype +#define __pyx_ptype_5numpy_flatiter __pyx_mstate_global->__pyx_ptype_5numpy_flatiter +#define __pyx_ptype_5numpy_broadcast __pyx_mstate_global->__pyx_ptype_5numpy_broadcast +#define __pyx_ptype_5numpy_ndarray __pyx_mstate_global->__pyx_ptype_5numpy_ndarray +#define __pyx_ptype_5numpy_generic __pyx_mstate_global->__pyx_ptype_5numpy_generic +#define __pyx_ptype_5numpy_number __pyx_mstate_global->__pyx_ptype_5numpy_number +#define __pyx_ptype_5numpy_integer __pyx_mstate_global->__pyx_ptype_5numpy_integer +#define __pyx_ptype_5numpy_signedinteger __pyx_mstate_global->__pyx_ptype_5numpy_signedinteger +#define __pyx_ptype_5numpy_unsignedinteger __pyx_mstate_global->__pyx_ptype_5numpy_unsignedinteger +#define __pyx_ptype_5numpy_inexact __pyx_mstate_global->__pyx_ptype_5numpy_inexact +#define __pyx_ptype_5numpy_floating __pyx_mstate_global->__pyx_ptype_5numpy_floating +#define __pyx_ptype_5numpy_complexfloating __pyx_mstate_global->__pyx_ptype_5numpy_complexfloating +#define __pyx_ptype_5numpy_flexible __pyx_mstate_global->__pyx_ptype_5numpy_flexible +#define __pyx_ptype_5numpy_character __pyx_mstate_global->__pyx_ptype_5numpy_character +#define __pyx_ptype_5numpy_ufunc __pyx_mstate_global->__pyx_ptype_5numpy_ufunc +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type___pyx_array __pyx_mstate_global->__pyx_type___pyx_array +#define __pyx_type___pyx_MemviewEnum __pyx_mstate_global->__pyx_type___pyx_MemviewEnum +#define __pyx_type___pyx_memoryview __pyx_mstate_global->__pyx_type___pyx_memoryview +#define __pyx_type___pyx_memoryviewslice __pyx_mstate_global->__pyx_type___pyx_memoryviewslice +#endif +#define __pyx_array_type __pyx_mstate_global->__pyx_array_type +#define __pyx_MemviewEnum_type __pyx_mstate_global->__pyx_MemviewEnum_type +#define __pyx_memoryview_type __pyx_mstate_global->__pyx_memoryview_type +#define __pyx_memoryviewslice_type __pyx_mstate_global->__pyx_memoryviewslice_type +#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_kp_s_000 __pyx_mstate_global->__pyx_kp_s_000 +#define __pyx_kp_s_011 __pyx_mstate_global->__pyx_kp_s_011 +#define __pyx_kp_s_022 __pyx_mstate_global->__pyx_kp_s_022 +#define __pyx_kp_s_101 __pyx_mstate_global->__pyx_kp_s_101 +#define __pyx_kp_s_110 __pyx_mstate_global->__pyx_kp_s_110 +#define __pyx_kp_s_202 __pyx_mstate_global->__pyx_kp_s_202 +#define __pyx_kp_s_220 __pyx_mstate_global->__pyx_kp_s_220 +#define __pyx_kp_s_5_5f_5_5f __pyx_mstate_global->__pyx_kp_s_5_5f_5_5f +#define __pyx_n_s_ASCII __pyx_mstate_global->__pyx_n_s_ASCII +#define __pyx_kp_s_All_dimensions_preceding_dimensi __pyx_mstate_global->__pyx_kp_s_All_dimensions_preceding_dimensi +#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError +#define __pyx_kp_s_Buffer_view_does_not_expose_stri __pyx_mstate_global->__pyx_kp_s_Buffer_view_does_not_expose_stri +#define __pyx_n_s_CUDA __pyx_mstate_global->__pyx_n_s_CUDA +#define __pyx_n_s_CUDA___init __pyx_mstate_global->__pyx_n_s_CUDA___init +#define __pyx_n_s_CUDA_calcHistoGPU __pyx_mstate_global->__pyx_n_s_CUDA_calcHistoGPU +#define __pyx_kp_s_Can_only_create_a_buffer_that_is __pyx_mstate_global->__pyx_kp_s_Can_only_create_a_buffer_that_is +#define __pyx_kp_s_Cannot_assign_to_read_only_memor __pyx_mstate_global->__pyx_kp_s_Cannot_assign_to_read_only_memor +#define __pyx_kp_s_Cannot_create_writable_memory_vi __pyx_mstate_global->__pyx_kp_s_Cannot_create_writable_memory_vi +#define __pyx_kp_u_Cannot_index_with_type __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type +#define __pyx_kp_s_Cannot_transpose_memoryview_with __pyx_mstate_global->__pyx_kp_s_Cannot_transpose_memoryview_with +#define __pyx_kp_s_Dimension_d_is_not_direct __pyx_mstate_global->__pyx_kp_s_Dimension_d_is_not_direct +#define __pyx_n_s_Ellipsis __pyx_mstate_global->__pyx_n_s_Ellipsis +#define __pyx_kp_s_Empty_shape_tuple_for_cython_arr __pyx_mstate_global->__pyx_kp_s_Empty_shape_tuple_for_cython_arr +#define __pyx_kp_s_Frames_read __pyx_mstate_global->__pyx_kp_s_Frames_read +#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError +#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 +#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError +#define __pyx_kp_s_Index_out_of_bounds_axis_d __pyx_mstate_global->__pyx_kp_s_Index_out_of_bounds_axis_d +#define __pyx_kp_s_Indirect_dimensions_not_supporte __pyx_mstate_global->__pyx_kp_s_Indirect_dimensions_not_supporte +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis +#define __pyx_n_s_MULTIPROCESSOR_COUNT __pyx_mstate_global->__pyx_n_s_MULTIPROCESSOR_COUNT +#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError +#define __pyx_kp_s_MemoryView_of_r_at_0x_x __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_at_0x_x +#define __pyx_kp_s_MemoryView_of_r_object __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_object +#define __pyx_kp_s_Modes __pyx_mstate_global->__pyx_kp_s_Modes +#define __pyx_kp_s_No_dipole_moment_array_for_the_f __pyx_mstate_global->__pyx_kp_s_No_dipole_moment_array_for_the_f +#define __pyx_kp_s_No_dipole_moment_array_for_the_f_2 __pyx_mstate_global->__pyx_kp_s_No_dipole_moment_array_for_the_f_2 +#define __pyx_kp_s_No_dipole_moment_array_for_the_s __pyx_mstate_global->__pyx_kp_s_No_dipole_moment_array_for_the_s +#define __pyx_kp_s_No_suitable_CUDA_device_was_foun __pyx_mstate_global->__pyx_kp_s_No_suitable_CUDA_device_was_foun +#define __pyx_n_b_O __pyx_mstate_global->__pyx_n_b_O +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a +#define __pyx_n_s_PI __pyx_mstate_global->__pyx_n_s_PI +#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError +#define __pyx_n_s_RDF __pyx_mstate_global->__pyx_n_s_RDF +#define __pyx_n_s_RDF___init __pyx_mstate_global->__pyx_n_s_RDF___init +#define __pyx_n_s_RDF__addHisto __pyx_mstate_global->__pyx_n_s_RDF__addHisto +#define __pyx_n_s_RDF__normHisto __pyx_mstate_global->__pyx_n_s_RDF__normHisto +#define __pyx_n_s_RDF_calcFrame __pyx_mstate_global->__pyx_n_s_RDF_calcFrame +#define __pyx_n_s_RDF_printInfo __pyx_mstate_global->__pyx_n_s_RDF_printInfo +#define __pyx_n_s_RDF_resetArrays __pyx_mstate_global->__pyx_n_s_RDF_resetArrays +#define __pyx_n_s_RDF_scale __pyx_mstate_global->__pyx_n_s_RDF_scale +#define __pyx_n_s_RDF_update_box __pyx_mstate_global->__pyx_n_s_RDF_update_box +#define __pyx_n_s_RDF_voronoi __pyx_mstate_global->__pyx_n_s_RDF_voronoi +#define __pyx_n_s_RDF_voronoi___init __pyx_mstate_global->__pyx_n_s_RDF_voronoi___init +#define __pyx_n_s_RDF_voronoi__addHisto __pyx_mstate_global->__pyx_n_s_RDF_voronoi__addHisto +#define __pyx_n_s_RDF_voronoi__normHisto __pyx_mstate_global->__pyx_n_s_RDF_voronoi__normHisto +#define __pyx_n_s_RDF_voronoi_calcFrame __pyx_mstate_global->__pyx_n_s_RDF_voronoi_calcFrame +#define __pyx_n_s_RDF_voronoi_printInfo __pyx_mstate_global->__pyx_n_s_RDF_voronoi_printInfo +#define __pyx_n_s_RDF_voronoi_resetArrays __pyx_mstate_global->__pyx_n_s_RDF_voronoi_resetArrays +#define __pyx_n_s_RDF_voronoi_scale __pyx_mstate_global->__pyx_n_s_RDF_voronoi_scale +#define __pyx_n_s_RDF_voronoi_update_box __pyx_mstate_global->__pyx_n_s_RDF_voronoi_update_box +#define __pyx_n_s_RDF_voronoi_write __pyx_mstate_global->__pyx_n_s_RDF_voronoi_write +#define __pyx_n_s_RDF_write __pyx_mstate_global->__pyx_n_s_RDF_write +#define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence +#define __pyx_n_s_SourceModule __pyx_mstate_global->__pyx_n_s_SourceModule +#define __pyx_kp_s_Step_may_not_be_zero_axis_d __pyx_mstate_global->__pyx_kp_s_Step_may_not_be_zero_axis_d +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_kp_s_Unable_to_convert_item_to_object __pyx_mstate_global->__pyx_kp_s_Unable_to_convert_item_to_object +#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError +#define __pyx_n_s_View_MemoryView __pyx_mstate_global->__pyx_n_s_View_MemoryView +#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 +#define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3 +#define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6 +#define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7 +#define __pyx_n_s__79 __pyx_mstate_global->__pyx_n_s__79 +#define __pyx_n_s_abc __pyx_mstate_global->__pyx_n_s_abc +#define __pyx_n_s_addHisto __pyx_mstate_global->__pyx_n_s_addHisto +#define __pyx_n_s_all __pyx_mstate_global->__pyx_n_s_all +#define __pyx_n_s_allocate_buffer __pyx_mstate_global->__pyx_n_s_allocate_buffer +#define __pyx_kp_u_and __pyx_mstate_global->__pyx_kp_u_and +#define __pyx_n_s_append __pyx_mstate_global->__pyx_n_s_append +#define __pyx_n_s_arr_sel1 __pyx_mstate_global->__pyx_n_s_arr_sel1 +#define __pyx_n_s_arr_sel2 __pyx_mstate_global->__pyx_n_s_arr_sel2 +#define __pyx_n_s_astype __pyx_mstate_global->__pyx_n_s_astype +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_autoinit __pyx_mstate_global->__pyx_n_s_autoinit +#define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base +#define __pyx_n_s_block __pyx_mstate_global->__pyx_n_s_block +#define __pyx_n_s_block_x __pyx_mstate_global->__pyx_n_s_block_x +#define __pyx_n_s_block_y __pyx_mstate_global->__pyx_n_s_block_y +#define __pyx_n_s_block_z __pyx_mstate_global->__pyx_n_s_block_z +#define __pyx_n_s_box_dim __pyx_mstate_global->__pyx_n_s_box_dim +#define __pyx_n_s_box_dim_gpu __pyx_mstate_global->__pyx_n_s_box_dim_gpu +#define __pyx_n_s_box_x __pyx_mstate_global->__pyx_n_s_box_x +#define __pyx_n_s_box_y __pyx_mstate_global->__pyx_n_s_box_y +#define __pyx_n_s_box_z __pyx_mstate_global->__pyx_n_s_box_z +#define __pyx_n_s_boxl __pyx_mstate_global->__pyx_n_s_boxl +#define __pyx_n_s_boxl2 __pyx_mstate_global->__pyx_n_s_boxl2 +#define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c +#define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c +#define __pyx_n_s_calcFrame __pyx_mstate_global->__pyx_n_s_calcFrame +#define __pyx_n_s_calcHistoGPU __pyx_mstate_global->__pyx_n_s_calcHistoGPU +#define __pyx_n_s_calcHistoGPU_2 __pyx_mstate_global->__pyx_n_s_calcHistoGPU_2 +#define __pyx_n_s_calcHistoTS __pyx_mstate_global->__pyx_n_s_calcHistoTS +#define __pyx_n_s_calcHistoTSVoro __pyx_mstate_global->__pyx_n_s_calcHistoTSVoro +#define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class +#define __pyx_kp_s_class_RDF_A_container_object_fo __pyx_mstate_global->__pyx_kp_s_class_RDF_A_container_object_fo +#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections +#define __pyx_kp_s_collections_abc __pyx_mstate_global->__pyx_kp_s_collections_abc +#define __pyx_n_s_compute_capability __pyx_mstate_global->__pyx_n_s_compute_capability +#define __pyx_kp_s_contiguous_and_direct __pyx_mstate_global->__pyx_kp_s_contiguous_and_direct +#define __pyx_kp_s_contiguous_and_indirect __pyx_mstate_global->__pyx_kp_s_contiguous_and_indirect +#define __pyx_n_s_coor_sel1 __pyx_mstate_global->__pyx_n_s_coor_sel1 +#define __pyx_n_s_coor_sel1_gpu __pyx_mstate_global->__pyx_n_s_coor_sel1_gpu +#define __pyx_n_s_coor_sel2 __pyx_mstate_global->__pyx_n_s_coor_sel2 +#define __pyx_n_s_coor_sel2_gpu __pyx_mstate_global->__pyx_n_s_coor_sel2_gpu +#define __pyx_n_s_core_xyz __pyx_mstate_global->__pyx_n_s_core_xyz +#define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count +#define __pyx_n_s_ctr __pyx_mstate_global->__pyx_n_s_ctr +#define __pyx_n_s_cu __pyx_mstate_global->__pyx_n_s_cu +#define __pyx_n_s_cuda __pyx_mstate_global->__pyx_n_s_cuda +#define __pyx_n_s_delaunay_matrix __pyx_mstate_global->__pyx_n_s_delaunay_matrix +#define __pyx_n_s_dev __pyx_mstate_global->__pyx_n_s_dev +#define __pyx_n_s_device __pyx_mstate_global->__pyx_n_s_device +#define __pyx_kp_s_device___double_atomicAdd_dou __pyx_mstate_global->__pyx_kp_s_device___double_atomicAdd_dou +#define __pyx_n_s_device_attribute __pyx_mstate_global->__pyx_n_s_device_attribute +#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_n_s_dip_sel1 __pyx_mstate_global->__pyx_n_s_dip_sel1 +#define __pyx_n_s_dip_sel1_gpu __pyx_mstate_global->__pyx_n_s_dip_sel1_gpu +#define __pyx_n_s_dip_sel2 __pyx_mstate_global->__pyx_n_s_dip_sel2 +#define __pyx_n_s_dip_sel2_gpu __pyx_mstate_global->__pyx_n_s_dip_sel2_gpu +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_dist __pyx_mstate_global->__pyx_n_s_dist +#define __pyx_n_s_doc __pyx_mstate_global->__pyx_n_s_doc +#define __pyx_n_s_driver __pyx_mstate_global->__pyx_n_s_driver +#define __pyx_n_s_drv __pyx_mstate_global->__pyx_n_s_drv +#define __pyx_n_s_ds __pyx_mstate_global->__pyx_n_s_ds +#define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype +#define __pyx_n_s_dtype_is_object __pyx_mstate_global->__pyx_n_s_dtype_is_object +#define __pyx_n_s_dx __pyx_mstate_global->__pyx_n_s_dx +#define __pyx_n_s_dy __pyx_mstate_global->__pyx_n_s_dy +#define __pyx_n_s_dz __pyx_mstate_global->__pyx_n_s_dz +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate +#define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error +#define __pyx_n_s_exclude_self_mol __pyx_mstate_global->__pyx_n_s_exclude_self_mol +#define __pyx_n_s_f000 __pyx_mstate_global->__pyx_n_s_f000 +#define __pyx_n_s_f011 __pyx_mstate_global->__pyx_n_s_f011 +#define __pyx_n_s_f022 __pyx_mstate_global->__pyx_n_s_f022 +#define __pyx_n_s_f101 __pyx_mstate_global->__pyx_n_s_f101 +#define __pyx_n_s_f110 __pyx_mstate_global->__pyx_n_s_f110 +#define __pyx_n_s_f202 __pyx_mstate_global->__pyx_n_s_f202 +#define __pyx_n_s_f220 __pyx_mstate_global->__pyx_n_s_f220 +#define __pyx_n_s_filename __pyx_mstate_global->__pyx_n_s_filename +#define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags +#define __pyx_n_s_float32 __pyx_mstate_global->__pyx_n_s_float32 +#define __pyx_n_s_float64 __pyx_mstate_global->__pyx_n_s_float64 +#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format +#define __pyx_n_s_fortran __pyx_mstate_global->__pyx_n_s_fortran +#define __pyx_n_u_fortran __pyx_mstate_global->__pyx_n_u_fortran +#define __pyx_kp_s_g000_dat __pyx_mstate_global->__pyx_kp_s_g000_dat +#define __pyx_kp_s_g011_dat __pyx_mstate_global->__pyx_kp_s_g011_dat +#define __pyx_kp_s_g022_dat __pyx_mstate_global->__pyx_kp_s_g022_dat +#define __pyx_kp_s_g101_dat __pyx_mstate_global->__pyx_kp_s_g101_dat +#define __pyx_kp_s_g110_dat __pyx_mstate_global->__pyx_kp_s_g110_dat +#define __pyx_kp_s_g202_dat __pyx_mstate_global->__pyx_kp_s_g202_dat +#define __pyx_kp_s_g220_dat __pyx_mstate_global->__pyx_kp_s_g220_dat +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_get_attribute __pyx_mstate_global->__pyx_n_s_get_attribute +#define __pyx_n_s_get_function __pyx_mstate_global->__pyx_n_s_get_function +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi +#define __pyx_n_s_grid __pyx_mstate_global->__pyx_n_s_grid +#define __pyx_n_s_grid_x __pyx_mstate_global->__pyx_n_s_grid_x +#define __pyx_n_s_grid_y __pyx_mstate_global->__pyx_n_s_grid_y +#define __pyx_n_s_histo __pyx_mstate_global->__pyx_n_s_histo +#define __pyx_n_s_histo_dr __pyx_mstate_global->__pyx_n_s_histo_dr +#define __pyx_n_s_histo_gpu __pyx_mstate_global->__pyx_n_s_histo_gpu +#define __pyx_n_s_histo_inv_dr __pyx_mstate_global->__pyx_n_s_histo_inv_dr +#define __pyx_n_s_histo_max __pyx_mstate_global->__pyx_n_s_histo_max +#define __pyx_n_s_histo_min __pyx_mstate_global->__pyx_n_s_histo_min +#define __pyx_n_s_histo_n __pyx_mstate_global->__pyx_n_s_histo_n +#define __pyx_n_s_histo_out __pyx_mstate_global->__pyx_n_s_histo_out +#define __pyx_n_s_histogram __pyx_mstate_global->__pyx_n_s_histogram +#define __pyx_n_s_histogram_out __pyx_mstate_global->__pyx_n_s_histogram_out +#define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i +#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index +#define __pyx_n_s_init __pyx_mstate_global->__pyx_n_s_init +#define __pyx_n_s_init_subclass __pyx_mstate_global->__pyx_n_s_init_subclass +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_int32 __pyx_mstate_global->__pyx_n_s_int32 +#define __pyx_n_s_invdx __pyx_mstate_global->__pyx_n_s_invdx +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_itemsize __pyx_mstate_global->__pyx_n_s_itemsize +#define __pyx_kp_s_itemsize_0_for_cython_array __pyx_mstate_global->__pyx_kp_s_itemsize_0_for_cython_array +#define __pyx_n_s_ix __pyx_mstate_global->__pyx_n_s_ix +#define __pyx_n_s_ix2 __pyx_mstate_global->__pyx_n_s_ix2 +#define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j +#define __pyx_n_s_k __pyx_mstate_global->__pyx_n_s_k +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_maxshell __pyx_mstate_global->__pyx_n_s_maxshell +#define __pyx_n_s_mem_alloc __pyx_mstate_global->__pyx_n_s_mem_alloc +#define __pyx_n_s_memcpy_dtoh __pyx_mstate_global->__pyx_n_s_memcpy_dtoh +#define __pyx_n_s_memcpy_htod __pyx_mstate_global->__pyx_n_s_memcpy_htod +#define __pyx_n_s_memview __pyx_mstate_global->__pyx_n_s_memview +#define __pyx_n_s_metaclass __pyx_mstate_global->__pyx_n_s_metaclass +#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode +#define __pyx_n_s_mode_sel __pyx_mstate_global->__pyx_n_s_mode_sel +#define __pyx_n_s_modes __pyx_mstate_global->__pyx_n_s_modes +#define __pyx_n_s_module __pyx_mstate_global->__pyx_n_s_module +#define __pyx_n_s_mro_entries __pyx_mstate_global->__pyx_n_s_mro_entries +#define __pyx_n_s_n1 __pyx_mstate_global->__pyx_n_s_n1 +#define __pyx_n_s_n2 __pyx_mstate_global->__pyx_n_s_n2 +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 +#define __pyx_n_s_nbytes __pyx_mstate_global->__pyx_n_s_nbytes +#define __pyx_n_s_ncore __pyx_mstate_global->__pyx_n_s_ncore +#define __pyx_n_s_ndim __pyx_mstate_global->__pyx_n_s_ndim +#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new +#define __pyx_n_s_newanalysis_gfunction __pyx_mstate_global->__pyx_n_s_newanalysis_gfunction +#define __pyx_kp_s_newanalysis_gfunction_gfunction __pyx_mstate_global->__pyx_kp_s_newanalysis_gfunction_gfunction +#define __pyx_n_s_nmol1 __pyx_mstate_global->__pyx_n_s_nmol1 +#define __pyx_n_s_nmol2 __pyx_mstate_global->__pyx_n_s_nmol2 +#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non +#define __pyx_n_s_norm __pyx_mstate_global->__pyx_n_s_norm +#define __pyx_n_s_normHisto __pyx_mstate_global->__pyx_n_s_normHisto +#define __pyx_n_s_norm_volume __pyx_mstate_global->__pyx_n_s_norm_volume +#define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np +#define __pyx_n_s_nshells __pyx_mstate_global->__pyx_n_s_nshells +#define __pyx_n_s_nsurr __pyx_mstate_global->__pyx_n_s_nsurr +#define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy +#define __pyx_kp_s_numpy_core_multiarray_failed_to __pyx_mstate_global->__pyx_kp_s_numpy_core_multiarray_failed_to +#define __pyx_kp_s_numpy_core_umath_failed_to_impor __pyx_mstate_global->__pyx_kp_s_numpy_core_umath_failed_to_impor +#define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj +#define __pyx_n_s_object __pyx_mstate_global->__pyx_n_s_object +#define __pyx_n_s_oneistwo __pyx_mstate_global->__pyx_n_s_oneistwo +#define __pyx_n_s_open __pyx_mstate_global->__pyx_n_s_open +#define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack +#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle +#define __pyx_n_s_pos __pyx_mstate_global->__pyx_n_s_pos +#define __pyx_n_s_pre_coor_sel1_gpu __pyx_mstate_global->__pyx_n_s_pre_coor_sel1_gpu +#define __pyx_n_s_pre_coor_sel2_gpu __pyx_mstate_global->__pyx_n_s_pre_coor_sel2_gpu +#define __pyx_n_s_pre_dip_sel1_gpu __pyx_mstate_global->__pyx_n_s_pre_dip_sel1_gpu +#define __pyx_n_s_pre_dip_sel2_gpu __pyx_mstate_global->__pyx_n_s_pre_dip_sel2_gpu +#define __pyx_n_s_prepare __pyx_mstate_global->__pyx_n_s_prepare +#define __pyx_n_s_print __pyx_mstate_global->__pyx_n_s_print +#define __pyx_n_s_printInfo __pyx_mstate_global->__pyx_n_s_printInfo +#define __pyx_n_s_pycuda __pyx_mstate_global->__pyx_n_s_pycuda +#define __pyx_n_s_pycuda_autoinit __pyx_mstate_global->__pyx_n_s_pycuda_autoinit +#define __pyx_n_s_pycuda_compiler __pyx_mstate_global->__pyx_n_s_pycuda_compiler +#define __pyx_n_s_pycuda_driver __pyx_mstate_global->__pyx_n_s_pycuda_driver +#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError +#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum +#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type +#define __pyx_n_s_pyx_unpickle_Enum __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Enum +#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable +#define __pyx_n_s_qualname __pyx_mstate_global->__pyx_n_s_qualname +#define __pyx_n_s_r __pyx_mstate_global->__pyx_n_s_r +#define __pyx_n_s_r_out __pyx_mstate_global->__pyx_n_s_r_out +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_rdf __pyx_mstate_global->__pyx_n_s_rdf +#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce +#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython +#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register +#define __pyx_n_s_resetArrays __pyx_mstate_global->__pyx_n_s_resetArrays +#define __pyx_n_s_result __pyx_mstate_global->__pyx_n_s_result +#define __pyx_n_s_rho __pyx_mstate_global->__pyx_n_s_rho +#define __pyx_n_s_round __pyx_mstate_global->__pyx_n_s_round +#define __pyx_n_s_scale __pyx_mstate_global->__pyx_n_s_scale +#define __pyx_n_s_sel1_n __pyx_mstate_global->__pyx_n_s_sel1_n +#define __pyx_n_s_sel1_nmol __pyx_mstate_global->__pyx_n_s_sel1_nmol +#define __pyx_n_s_sel2_n __pyx_mstate_global->__pyx_n_s_sel2_n +#define __pyx_n_s_sel2_nmol __pyx_mstate_global->__pyx_n_s_sel2_nmol +#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self +#define __pyx_n_s_set_name __pyx_mstate_global->__pyx_n_s_set_name +#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate +#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython +#define __pyx_n_s_shape __pyx_mstate_global->__pyx_n_s_shape +#define __pyx_n_s_shell __pyx_mstate_global->__pyx_n_s_shell +#define __pyx_n_s_shell_2 __pyx_mstate_global->__pyx_n_s_shell_2 +#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size +#define __pyx_n_s_slice_vol __pyx_mstate_global->__pyx_n_s_slice_vol +#define __pyx_n_s_source __pyx_mstate_global->__pyx_n_s_source +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start +#define __pyx_n_s_step __pyx_mstate_global->__pyx_n_s_step +#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop +#define __pyx_kp_s_strided_and_direct __pyx_mstate_global->__pyx_kp_s_strided_and_direct +#define __pyx_kp_s_strided_and_direct_or_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_direct_or_indirect +#define __pyx_kp_s_strided_and_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_indirect +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct +#define __pyx_n_s_super __pyx_mstate_global->__pyx_n_s_super +#define __pyx_n_s_surr_xyz __pyx_mstate_global->__pyx_n_s_surr_xyz +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_t __pyx_mstate_global->__pyx_n_s_t +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_kp_s_unable_to_allocate_array_data __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_array_data +#define __pyx_kp_s_unable_to_allocate_shape_and_str __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_shape_and_str +#define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack +#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update +#define __pyx_n_s_update_box __pyx_mstate_global->__pyx_n_s_update_box +#define __pyx_n_s_use_cuda __pyx_mstate_global->__pyx_n_s_use_cuda +#define __pyx_n_s_v __pyx_mstate_global->__pyx_n_s_v +#define __pyx_n_s_value __pyx_mstate_global->__pyx_n_s_value +#define __pyx_n_s_version_info __pyx_mstate_global->__pyx_n_s_version_info +#define __pyx_n_s_volume __pyx_mstate_global->__pyx_n_s_volume +#define __pyx_n_s_volume_list __pyx_mstate_global->__pyx_n_s_volume_list +#define __pyx_n_s_w __pyx_mstate_global->__pyx_n_s_w +#define __pyx_n_s_write __pyx_mstate_global->__pyx_n_s_write +#define __pyx_n_s_zeros __pyx_mstate_global->__pyx_n_s_zeros +#define __pyx_float_0_0 __pyx_mstate_global->__pyx_float_0_0 +#define __pyx_float_0_5 __pyx_mstate_global->__pyx_float_0_5 +#define __pyx_float_1_0 __pyx_mstate_global->__pyx_float_1_0 +#define __pyx_float_2_0 __pyx_mstate_global->__pyx_float_2_0 +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_2 __pyx_mstate_global->__pyx_int_2 +#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3 +#define __pyx_int_4 __pyx_mstate_global->__pyx_int_4 +#define __pyx_int_5 __pyx_mstate_global->__pyx_int_5 +#define __pyx_int_6 __pyx_mstate_global->__pyx_int_6 +#define __pyx_int_7 __pyx_mstate_global->__pyx_int_7 +#define __pyx_int_8 __pyx_mstate_global->__pyx_int_8 +#define __pyx_int_16 __pyx_mstate_global->__pyx_int_16 +#define __pyx_int_32 __pyx_mstate_global->__pyx_int_32 +#define __pyx_int_64 __pyx_mstate_global->__pyx_int_64 +#define __pyx_int_112105877 __pyx_mstate_global->__pyx_int_112105877 +#define __pyx_int_136983863 __pyx_mstate_global->__pyx_int_136983863 +#define __pyx_int_184977713 __pyx_mstate_global->__pyx_int_184977713 +#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 +#define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 +#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 +#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 +#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 +#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 +#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 +#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23 +#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24 +#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25 +#define __pyx_tuple__26 __pyx_mstate_global->__pyx_tuple__26 +#define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27 +#define __pyx_tuple__28 __pyx_mstate_global->__pyx_tuple__28 +#define __pyx_tuple__30 __pyx_mstate_global->__pyx_tuple__30 +#define __pyx_tuple__31 __pyx_mstate_global->__pyx_tuple__31 +#define __pyx_tuple__32 __pyx_mstate_global->__pyx_tuple__32 +#define __pyx_tuple__34 __pyx_mstate_global->__pyx_tuple__34 +#define __pyx_tuple__36 __pyx_mstate_global->__pyx_tuple__36 +#define __pyx_tuple__38 __pyx_mstate_global->__pyx_tuple__38 +#define __pyx_tuple__40 __pyx_mstate_global->__pyx_tuple__40 +#define __pyx_tuple__41 __pyx_mstate_global->__pyx_tuple__41 +#define __pyx_tuple__42 __pyx_mstate_global->__pyx_tuple__42 +#define __pyx_tuple__44 __pyx_mstate_global->__pyx_tuple__44 +#define __pyx_tuple__45 __pyx_mstate_global->__pyx_tuple__45 +#define __pyx_tuple__47 __pyx_mstate_global->__pyx_tuple__47 +#define __pyx_tuple__49 __pyx_mstate_global->__pyx_tuple__49 +#define __pyx_tuple__50 __pyx_mstate_global->__pyx_tuple__50 +#define __pyx_tuple__52 __pyx_mstate_global->__pyx_tuple__52 +#define __pyx_tuple__54 __pyx_mstate_global->__pyx_tuple__54 +#define __pyx_tuple__56 __pyx_mstate_global->__pyx_tuple__56 +#define __pyx_tuple__58 __pyx_mstate_global->__pyx_tuple__58 +#define __pyx_tuple__59 __pyx_mstate_global->__pyx_tuple__59 +#define __pyx_tuple__62 __pyx_mstate_global->__pyx_tuple__62 +#define __pyx_tuple__63 __pyx_mstate_global->__pyx_tuple__63 +#define __pyx_tuple__64 __pyx_mstate_global->__pyx_tuple__64 +#define __pyx_tuple__66 __pyx_mstate_global->__pyx_tuple__66 +#define __pyx_tuple__68 __pyx_mstate_global->__pyx_tuple__68 +#define __pyx_tuple__70 __pyx_mstate_global->__pyx_tuple__70 +#define __pyx_tuple__72 __pyx_mstate_global->__pyx_tuple__72 +#define __pyx_tuple__75 __pyx_mstate_global->__pyx_tuple__75 +#define __pyx_codeobj__29 __pyx_mstate_global->__pyx_codeobj__29 +#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33 +#define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35 +#define __pyx_codeobj__37 __pyx_mstate_global->__pyx_codeobj__37 +#define __pyx_codeobj__39 __pyx_mstate_global->__pyx_codeobj__39 +#define __pyx_codeobj__43 __pyx_mstate_global->__pyx_codeobj__43 +#define __pyx_codeobj__46 __pyx_mstate_global->__pyx_codeobj__46 +#define __pyx_codeobj__48 __pyx_mstate_global->__pyx_codeobj__48 +#define __pyx_codeobj__51 __pyx_mstate_global->__pyx_codeobj__51 +#define __pyx_codeobj__53 __pyx_mstate_global->__pyx_codeobj__53 +#define __pyx_codeobj__55 __pyx_mstate_global->__pyx_codeobj__55 +#define __pyx_codeobj__57 __pyx_mstate_global->__pyx_codeobj__57 +#define __pyx_codeobj__60 __pyx_mstate_global->__pyx_codeobj__60 +#define __pyx_codeobj__61 __pyx_mstate_global->__pyx_codeobj__61 +#define __pyx_codeobj__65 __pyx_mstate_global->__pyx_codeobj__65 +#define __pyx_codeobj__67 __pyx_mstate_global->__pyx_codeobj__67 +#define __pyx_codeobj__69 __pyx_mstate_global->__pyx_codeobj__69 +#define __pyx_codeobj__71 __pyx_mstate_global->__pyx_codeobj__71 +#define __pyx_codeobj__73 __pyx_mstate_global->__pyx_codeobj__73 +#define __pyx_codeobj__74 __pyx_mstate_global->__pyx_codeobj__74 +#define __pyx_codeobj__76 __pyx_mstate_global->__pyx_codeobj__76 +#define __pyx_codeobj__77 __pyx_mstate_global->__pyx_codeobj__77 +#define __pyx_codeobj__78 __pyx_mstate_global->__pyx_codeobj__78 +/* #### Code section: module_code ### */ + +/* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_4CUDA_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_4CUDA_1__init__ = {"__init__", (PyCFunction)__pyx_pw_11newanalysis_9gfunction_4CUDA_1__init__, METH_O, 0}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_4CUDA_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_r = __pyx_pf_11newanalysis_9gfunction_4CUDA___init__(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 131, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; + values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_n_s_c)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shape)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_itemsize)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 131, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_format)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 131, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode); + if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_allocate_buffer); + if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 131, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 132, __pyx_L3_error) + } else { + + /* "View.MemoryView":132 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx + */ + __pyx_v_allocate_buffer = ((int)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 131, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 131, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 131, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * + */ /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_4CUDA___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_v_pycuda = NULL; - PyObject *__pyx_v_drv = NULL; - PyObject *__pyx_v_SourceModule = NULL; - PyObject *__pyx_r = NULL; +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_t_7; + char *__pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_UCS4 __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "src/gfunction/gfunction.pyx":15 - * class CUDA(object): - * def __init__(self): - * self.cuda = True # <<<<<<<<<<<<<< - * try: - * import pycuda.autoinit - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_True) < 0) __PYX_ERR(0, 15, __pyx_L1_error) - - /* "src/gfunction/gfunction.pyx":16 - * def __init__(self): - * self.cuda = True - * try: # <<<<<<<<<<<<<< - * import pycuda.autoinit - * import pycuda.driver as drv - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "src/gfunction/gfunction.pyx":17 - * self.cuda = True - * try: - * import pycuda.autoinit # <<<<<<<<<<<<<< - * import pycuda.driver as drv - * from pycuda.compiler import SourceModule - */ - __pyx_t_4 = __Pyx_Import(__pyx_n_s_pycuda_autoinit, 0, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_pycuda = __pyx_t_4; - __pyx_t_4 = 0; - - /* "src/gfunction/gfunction.pyx":18 - * try: - * import pycuda.autoinit - * import pycuda.driver as drv # <<<<<<<<<<<<<< - * from pycuda.compiler import SourceModule - * if pycuda.autoinit.device.compute_capability() < (1, 3): - */ - __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_n_s_); - __Pyx_GIVEREF(__pyx_n_s_); - PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_); - __pyx_t_5 = __Pyx_Import(__pyx_n_s_pycuda_driver, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_drv = __pyx_t_5; - __pyx_t_5 = 0; - - /* "src/gfunction/gfunction.pyx":19 - * import pycuda.autoinit - * import pycuda.driver as drv - * from pycuda.compiler import SourceModule # <<<<<<<<<<<<<< - * if pycuda.autoinit.device.compute_capability() < (1, 3): - * self.cuda = False - */ - __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_n_s_SourceModule); - __Pyx_GIVEREF(__pyx_n_s_SourceModule); - PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_s_SourceModule); - __pyx_t_4 = __Pyx_Import(__pyx_n_s_pycuda_compiler, __pyx_t_5, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_SourceModule); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_5); - __pyx_v_SourceModule = __pyx_t_5; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "src/gfunction/gfunction.pyx":20 - * import pycuda.driver as drv - * from pycuda.compiler import SourceModule - * if pycuda.autoinit.device.compute_capability() < (1, 3): # <<<<<<<<<<<<<< - * self.cuda = False - * except: - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pycuda, __pyx_n_s_autoinit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_device); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_compute_capability); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_tuple__2, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 20, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { - - /* "src/gfunction/gfunction.pyx":21 - * from pycuda.compiler import SourceModule - * if pycuda.autoinit.device.compute_capability() < (1, 3): - * self.cuda = False # <<<<<<<<<<<<<< - * except: - * self.cuda = False - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_False) < 0) __PYX_ERR(0, 21, __pyx_L3_error) + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); - /* "src/gfunction/gfunction.pyx":20 - * import pycuda.driver as drv - * from pycuda.compiler import SourceModule - * if pycuda.autoinit.device.compute_capability() < (1, 3): # <<<<<<<<<<<<<< - * self.cuda = False - * except: + /* "View.MemoryView":137 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * */ - } + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 137, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 137, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); - /* "src/gfunction/gfunction.pyx":16 - * def __init__(self): - * self.cuda = True - * try: # <<<<<<<<<<<<<< - * import pycuda.autoinit - * import pycuda.driver as drv + /* "View.MemoryView":138 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_self->itemsize = __pyx_v_itemsize; - /* "src/gfunction/gfunction.pyx":22 - * if pycuda.autoinit.device.compute_capability() < (1, 3): - * self.cuda = False - * except: # <<<<<<<<<<<<<< - * self.cuda = False + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" * */ - /*except:*/ { - __Pyx_AddTraceback("newanalysis.gfunction.CUDA.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 22, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { - /* "src/gfunction/gfunction.pyx":23 - * self.cuda = False - * except: - * self.cuda = False # <<<<<<<<<<<<<< + /* "View.MemoryView":141 * - * if self.cuda: + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_False) < 0) __PYX_ERR(0, 23, __pyx_L5_except_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L4_exception_handled; - } - __pyx_L5_except_error:; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 141, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":16 - * def __init__(self): - * self.cuda = True - * try: # <<<<<<<<<<<<<< - * import pycuda.autoinit - * import pycuda.driver as drv + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L4_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - __pyx_L8_try_end:; } - /* "src/gfunction/gfunction.pyx":25 - * self.cuda = False + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" * - * if self.cuda: # <<<<<<<<<<<<<< - * self.drv = drv - * self.dev = pycuda.autoinit.device */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_7) { + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { - /* "src/gfunction/gfunction.pyx":26 + /* "View.MemoryView":144 * - * if self.cuda: - * self.drv = drv # <<<<<<<<<<<<<< - * self.dev = pycuda.autoinit.device - * self.source = SourceModule(""" + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): */ - if (unlikely(!__pyx_v_drv)) { __Pyx_RaiseUnboundLocalError("drv"); __PYX_ERR(0, 26, __pyx_L1_error) } - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_drv, __pyx_v_drv) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 144, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":27 - * if self.cuda: - * self.drv = drv - * self.dev = pycuda.autoinit.device # <<<<<<<<<<<<<< - * self.source = SourceModule(""" - * /[inserted by cython to avoid comment start]* __device__ double atomicAdd(double* address, double val) + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * */ - if (unlikely(!__pyx_v_pycuda)) { __Pyx_RaiseUnboundLocalError("pycuda"); __PYX_ERR(0, 27, __pyx_L1_error) } - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pycuda, __pyx_n_s_autoinit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_device); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dev, __pyx_t_4) < 0) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } - /* "src/gfunction/gfunction.pyx":28 - * self.drv = drv - * self.dev = pycuda.autoinit.device - * self.source = SourceModule(""" # <<<<<<<<<<<<<< - * /[inserted by cython to avoid comment start]* __device__ double atomicAdd(double* address, double val) - * { + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - if (unlikely(!__pyx_v_SourceModule)) { __Pyx_RaiseUnboundLocalError("SourceModule"); __PYX_ERR(0, 28, __pyx_L1_error) } - __Pyx_INCREF(__pyx_v_SourceModule); - __pyx_t_6 = __pyx_v_SourceModule; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_kp_s_device___double_atomicAdd_dou) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_device___double_atomicAdd_dou); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_source, __pyx_t_4) < 0) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { - /* "src/gfunction/gfunction.pyx":102 - * } - * """) - * self._calcHistoGPU = self.source.get_function("calcHistoGPU") # <<<<<<<<<<<<<< + /* "View.MemoryView":147 * - * def calcHistoGPU(self,coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel, block, grid): + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_source); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_get_function); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 102, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_calcHistoGPU) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_calcHistoGPU); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_calcHistoGPU_2, __pyx_t_4) < 0) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; - /* "src/gfunction/gfunction.pyx":25 - * self.cuda = False + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" * - * if self.cuda: # <<<<<<<<<<<<<< - * self.drv = drv - * self.dev = pycuda.autoinit.device + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ } - /* "src/gfunction/gfunction.pyx":14 - * # CUDA handler interface - * class CUDA(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self.cuda = True - * try: + /* "View.MemoryView":148 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * */ + if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_format))) __PYX_ERR(1, 148, __pyx_L1_error) + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("newanalysis.gfunction.CUDA.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_pycuda); - __Pyx_XDECREF(__pyx_v_drv); - __Pyx_XDECREF(__pyx_v_SourceModule); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/gfunction/gfunction.pyx":104 - * self._calcHistoGPU = self.source.get_function("calcHistoGPU") + /* "View.MemoryView":149 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< * - * def calcHistoGPU(self,coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel, block, grid): # <<<<<<<<<<<<<< - * self._calcHistoGPU(coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel,block=block,grid=grid) * */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_4CUDA_3calcHistoGPU(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_4CUDA_3calcHistoGPU = {"calcHistoGPU", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_4CUDA_3calcHistoGPU, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_4CUDA_3calcHistoGPU(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_coor_sel1_gpu = 0; - PyObject *__pyx_v_coor_sel2_gpu = 0; - PyObject *__pyx_v_dip_sel1_gpu = 0; - PyObject *__pyx_v_dip_sel2_gpu = 0; - PyObject *__pyx_v_histo_gpu = 0; - PyObject *__pyx_v_box_dim_gpu = 0; - PyObject *__pyx_v_n1 = 0; - PyObject *__pyx_v_n2 = 0; - PyObject *__pyx_v_histo_min = 0; - PyObject *__pyx_v_histo_max = 0; - PyObject *__pyx_v_histo_n = 0; - PyObject *__pyx_v_histo_inv_dr = 0; - PyObject *__pyx_v_mode_sel = 0; - PyObject *__pyx_v_block = 0; - PyObject *__pyx_v_grid = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcHistoGPU (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_coor_sel1_gpu,&__pyx_n_s_coor_sel2_gpu,&__pyx_n_s_dip_sel1_gpu,&__pyx_n_s_dip_sel2_gpu,&__pyx_n_s_histo_gpu,&__pyx_n_s_box_dim_gpu,&__pyx_n_s_n1,&__pyx_n_s_n2,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_histo_n,&__pyx_n_s_histo_inv_dr,&__pyx_n_s_mode_sel,&__pyx_n_s_block,&__pyx_n_s_grid,0}; - PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); - CYTHON_FALLTHROUGH; - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - CYTHON_FALLTHROUGH; - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_sel1_gpu)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 1); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_sel2_gpu)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 2); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_sel1_gpu)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 3); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_sel2_gpu)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 4); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_gpu)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 5); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_dim_gpu)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 6); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 7); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 8); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 9: - if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_min)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 9); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 10: - if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_max)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 10); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 11: - if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_n)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 11); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 12: - if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_inv_dr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 12); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 13: - if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode_sel)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 13); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 14: - if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 14); __PYX_ERR(0, 104, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 15: - if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grid)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 15); __PYX_ERR(0, 104, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcHistoGPU") < 0)) __PYX_ERR(0, 104, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 16) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - values[15] = PyTuple_GET_ITEM(__pyx_args, 15); - } - __pyx_v_self = values[0]; - __pyx_v_coor_sel1_gpu = values[1]; - __pyx_v_coor_sel2_gpu = values[2]; - __pyx_v_dip_sel1_gpu = values[3]; - __pyx_v_dip_sel2_gpu = values[4]; - __pyx_v_histo_gpu = values[5]; - __pyx_v_box_dim_gpu = values[6]; - __pyx_v_n1 = values[7]; - __pyx_v_n2 = values[8]; - __pyx_v_histo_min = values[9]; - __pyx_v_histo_max = values[10]; - __pyx_v_histo_n = values[11]; - __pyx_v_histo_inv_dr = values[12]; - __pyx_v_mode_sel = values[13]; - __pyx_v_block = values[14]; - __pyx_v_grid = values[15]; + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 149, __pyx_L1_error) } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 104, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.CUDA.calcHistoGPU", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9gfunction_4CUDA_2calcHistoGPU(__pyx_self, __pyx_v_self, __pyx_v_coor_sel1_gpu, __pyx_v_coor_sel2_gpu, __pyx_v_dip_sel1_gpu, __pyx_v_dip_sel2_gpu, __pyx_v_histo_gpu, __pyx_v_box_dim_gpu, __pyx_v_n1, __pyx_v_n2, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_n, __pyx_v_histo_inv_dr, __pyx_v_mode_sel, __pyx_v_block, __pyx_v_grid); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_9gfunction_4CUDA_2calcHistoGPU(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_coor_sel1_gpu, PyObject *__pyx_v_coor_sel2_gpu, PyObject *__pyx_v_dip_sel1_gpu, PyObject *__pyx_v_dip_sel2_gpu, PyObject *__pyx_v_histo_gpu, PyObject *__pyx_v_box_dim_gpu, PyObject *__pyx_v_n1, PyObject *__pyx_v_n2, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_n, PyObject *__pyx_v_histo_inv_dr, PyObject *__pyx_v_mode_sel, PyObject *__pyx_v_block, PyObject *__pyx_v_grid) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcHistoGPU", 0); + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 149, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_8; - /* "src/gfunction/gfunction.pyx":105 + /* "View.MemoryView":152 * - * def calcHistoGPU(self,coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel, block, grid): - * self._calcHistoGPU(coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel,block=block,grid=grid) # <<<<<<<<<<<<<< * - * cu=CUDA() + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_calcHistoGPU_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_coor_sel1_gpu); - __Pyx_GIVEREF(__pyx_v_coor_sel1_gpu); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_coor_sel1_gpu); - __Pyx_INCREF(__pyx_v_coor_sel2_gpu); - __Pyx_GIVEREF(__pyx_v_coor_sel2_gpu); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_coor_sel2_gpu); - __Pyx_INCREF(__pyx_v_dip_sel1_gpu); - __Pyx_GIVEREF(__pyx_v_dip_sel1_gpu); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_dip_sel1_gpu); - __Pyx_INCREF(__pyx_v_dip_sel2_gpu); - __Pyx_GIVEREF(__pyx_v_dip_sel2_gpu); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_dip_sel2_gpu); - __Pyx_INCREF(__pyx_v_histo_gpu); - __Pyx_GIVEREF(__pyx_v_histo_gpu); - PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_histo_gpu); - __Pyx_INCREF(__pyx_v_box_dim_gpu); - __Pyx_GIVEREF(__pyx_v_box_dim_gpu); - PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_v_box_dim_gpu); - __Pyx_INCREF(__pyx_v_n1); - __Pyx_GIVEREF(__pyx_v_n1); - PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_v_n1); - __Pyx_INCREF(__pyx_v_n2); - __Pyx_GIVEREF(__pyx_v_n2); - PyTuple_SET_ITEM(__pyx_t_2, 7, __pyx_v_n2); - __Pyx_INCREF(__pyx_v_histo_min); - __Pyx_GIVEREF(__pyx_v_histo_min); - PyTuple_SET_ITEM(__pyx_t_2, 8, __pyx_v_histo_min); - __Pyx_INCREF(__pyx_v_histo_max); - __Pyx_GIVEREF(__pyx_v_histo_max); - PyTuple_SET_ITEM(__pyx_t_2, 9, __pyx_v_histo_max); - __Pyx_INCREF(__pyx_v_histo_n); - __Pyx_GIVEREF(__pyx_v_histo_n); - PyTuple_SET_ITEM(__pyx_t_2, 10, __pyx_v_histo_n); - __Pyx_INCREF(__pyx_v_histo_inv_dr); - __Pyx_GIVEREF(__pyx_v_histo_inv_dr); - PyTuple_SET_ITEM(__pyx_t_2, 11, __pyx_v_histo_inv_dr); - __Pyx_INCREF(__pyx_v_mode_sel); - __Pyx_GIVEREF(__pyx_v_mode_sel); - PyTuple_SET_ITEM(__pyx_t_2, 12, __pyx_v_mode_sel); - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_block, __pyx_v_block) < 0) __PYX_ERR(0, 105, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_grid, __pyx_v_grid) < 0) __PYX_ERR(0, 105, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - /* "src/gfunction/gfunction.pyx":104 - * self._calcHistoGPU = self.source.get_function("calcHistoGPU") + /* "View.MemoryView":153 * - * def calcHistoGPU(self,coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel, block, grid): # <<<<<<<<<<<<<< - * self._calcHistoGPU(coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel,block=block,grid=grid) + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< * + * if not self._shape: */ + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("newanalysis.gfunction.CUDA.calcHistoGPU", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * + */ + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { -/* "src/gfunction/gfunction.pyx":110 + /* "View.MemoryView":156 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * * - * # CPU version - * cdef void calcHisto(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, - * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel): */ + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 156, __pyx_L1_error) -static void __pyx_f_11newanalysis_9gfunction_calcHisto(double *__pyx_v_core_xyz, double *__pyx_v_surr_xyz, double *__pyx_v_core_dip, double *__pyx_v_surr_dip, PyArrayObject *__pyx_v_np_dest, PyArrayObject *__pyx_v_np_box_dim, int __pyx_v_ncore, int __pyx_v_nsurround, float __pyx_v_histo_min, float __pyx_v_histo_max, int __pyx_v_histo_n, double __pyx_v_invdx, int __pyx_v_mode_sel) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_pos; - int __pyx_v_ix1; - int __pyx_v_ix2; - int __pyx_v_j_begin; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_dist; - double __pyx_v_cpx; - double __pyx_v_cpy; - double __pyx_v_cpz; - double __pyx_v_spx; - double __pyx_v_spy; - double __pyx_v_spz; - double __pyx_v_slen; - double __pyx_v_clen; - double __pyx_v_incr; - double __pyx_v_off_diag; - double *__pyx_v_dest; - double *__pyx_v_box_dim; - __Pyx_LocalBuf_ND __pyx_pybuffernd_np_box_dim; - __Pyx_Buffer __pyx_pybuffer_np_box_dim; - __Pyx_LocalBuf_ND __pyx_pybuffernd_np_dest; - __Pyx_Buffer __pyx_pybuffer_np_dest; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - double __pyx_t_10; - double __pyx_t_11; - long __pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcHisto", 0); - __pyx_pybuffer_np_dest.pybuffer.buf = NULL; - __pyx_pybuffer_np_dest.refcount = 0; - __pyx_pybuffernd_np_dest.data = NULL; - __pyx_pybuffernd_np_dest.rcbuffer = &__pyx_pybuffer_np_dest; - __pyx_pybuffer_np_box_dim.pybuffer.buf = NULL; - __pyx_pybuffer_np_box_dim.refcount = 0; - __pyx_pybuffernd_np_box_dim.data = NULL; - __pyx_pybuffernd_np_box_dim.rcbuffer = &__pyx_pybuffer_np_box_dim; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_dest, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 110, __pyx_L1_error) - } - __pyx_pybuffernd_np_dest.diminfo[0].strides = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_dest.diminfo[0].shape = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_box_dim, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 110, __pyx_L1_error) + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * + */ } - __pyx_pybuffernd_np_box_dim.diminfo[0].strides = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_box_dim.diminfo[0].shape = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.shape[0]; - /* "src/gfunction/gfunction.pyx":114 - * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel): + /* "View.MemoryView":159 * - * cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 - * cdef double *dest = np_dest.data + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." */ - __pyx_v_ix1 = (__pyx_v_ncore * __pyx_v_histo_n); - __pyx_v_j_begin = 0; + __pyx_t_7 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(1, 159, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_7; + __pyx_t_7 = (__pyx_t_7 + 1); - /* "src/gfunction/gfunction.pyx":115 + /* "View.MemoryView":160 * - * cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 # <<<<<<<<<<<<<< - * cdef double *dest = np_dest.data - * cdef double *box_dim = np_box_dim.data + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim */ - __pyx_v_off_diag = 1.0; + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { - /* "src/gfunction/gfunction.pyx":116 - * cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 - * cdef double *dest = np_dest.data # <<<<<<<<<<<<<< - * cdef double *box_dim = np_box_dim.data + /* "View.MemoryView":161 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim * */ - __pyx_v_dest = ((double *)__pyx_v_np_dest->data); + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = 0; + __pyx_t_10 = 127; + __Pyx_INCREF(__pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_9 += 22; + __Pyx_GIVEREF(__pyx_kp_u_Invalid_shape_in_axis); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u_); + __pyx_t_9 += 2; + __Pyx_GIVEREF(__pyx_kp_u_); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_); + __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u__2); + __pyx_t_9 += 1; + __Pyx_GIVEREF(__pyx_kp_u__2); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2); + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 161, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":117 - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 - * cdef double *dest = np_dest.data - * cdef double *box_dim = np_box_dim.data # <<<<<<<<<<<<<< + /* "View.MemoryView":160 * - * for i in prange(ncore, nogil=True): + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim */ - __pyx_v_box_dim = ((double *)__pyx_v_np_box_dim->data); + } - /* "src/gfunction/gfunction.pyx":119 - * cdef double *box_dim = np_box_dim.data + /* "View.MemoryView":162 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< * - * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< - * ix2=i*histo_n - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * cdef char order */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_ncore; - if ((1 == 0)) abort(); - { - double __pyx_parallel_temp0 = ((double)__PYX_NAN()); - double __pyx_parallel_temp1 = ((double)__PYX_NAN()); - double __pyx_parallel_temp2 = ((double)__PYX_NAN()); - double __pyx_parallel_temp3 = ((double)__PYX_NAN()); - double __pyx_parallel_temp4 = ((double)__PYX_NAN()); - double __pyx_parallel_temp5 = ((double)__PYX_NAN()); - double __pyx_parallel_temp6 = ((double)__PYX_NAN()); - double __pyx_parallel_temp7 = ((double)__PYX_NAN()); - int __pyx_parallel_temp8 = ((int)0xbad0bad0); - double __pyx_parallel_temp9 = ((double)__PYX_NAN()); - int __pyx_parallel_temp10 = ((int)0xbad0bad0); - int __pyx_parallel_temp11 = ((int)0xbad0bad0); - int __pyx_parallel_temp12 = ((int)0xbad0bad0); - double __pyx_parallel_temp13 = ((double)__PYX_NAN()); - int __pyx_parallel_temp14 = ((int)0xbad0bad0); - double __pyx_parallel_temp15 = ((double)__PYX_NAN()); - double __pyx_parallel_temp16 = ((double)__PYX_NAN()); - double __pyx_parallel_temp17 = ((double)__PYX_NAN()); - double __pyx_parallel_temp18 = ((double)__PYX_NAN()); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_clen) lastprivate(__pyx_v_cpx) lastprivate(__pyx_v_cpy) lastprivate(__pyx_v_cpz) lastprivate(__pyx_v_dist) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_incr) lastprivate(__pyx_v_ix2) lastprivate(__pyx_v_j) lastprivate(__pyx_v_j_begin) lastprivate(__pyx_v_off_diag) lastprivate(__pyx_v_pos) lastprivate(__pyx_v_slen) lastprivate(__pyx_v_spx) lastprivate(__pyx_v_spy) lastprivate(__pyx_v_spz) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - /* Initialize private variables to invalid values */ - __pyx_v_clen = ((double)__PYX_NAN()); - __pyx_v_cpx = ((double)__PYX_NAN()); - __pyx_v_cpy = ((double)__PYX_NAN()); - __pyx_v_cpz = ((double)__PYX_NAN()); - __pyx_v_dist = ((double)__PYX_NAN()); - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_incr = ((double)__PYX_NAN()); - __pyx_v_ix2 = ((int)0xbad0bad0); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_j_begin = ((int)0xbad0bad0); - __pyx_v_off_diag = ((double)__PYX_NAN()); - __pyx_v_pos = ((int)0xbad0bad0); - __pyx_v_slen = ((double)__PYX_NAN()); - __pyx_v_spx = ((double)__PYX_NAN()); - __pyx_v_spy = ((double)__PYX_NAN()); - __pyx_v_spz = ((double)__PYX_NAN()); + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - /* "src/gfunction/gfunction.pyx":120 + /* "View.MemoryView":159 * - * for i in prange(ncore, nogil=True): - * ix2=i*histo_n # <<<<<<<<<<<<<< - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - * cpx = core_dip[i*3] + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." */ - __pyx_v_ix2 = (__pyx_v_i * __pyx_v_histo_n); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/gfunction/gfunction.pyx":121 - * for i in prange(ncore, nogil=True): - * ix2=i*histo_n - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] + /* "View.MemoryView":165 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' */ - __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 4) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 32) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L11_bool_binop_done:; - if (__pyx_t_4) { + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 165, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/gfunction/gfunction.pyx":122 - * ix2=i*histo_n - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - * cpx = core_dip[i*3] # <<<<<<<<<<<<<< - * cpy = core_dip[i*3+1] - * cpz = core_dip[i*3+2] + /* "View.MemoryView":166 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': */ - __pyx_v_cpx = (__pyx_v_core_dip[(__pyx_v_i * 3)]); + __pyx_v_order = 'C'; - /* "src/gfunction/gfunction.pyx":123 - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] # <<<<<<<<<<<<<< - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + /* "View.MemoryView":167 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' */ - __pyx_v_cpy = (__pyx_v_core_dip[((__pyx_v_i * 3) + 1)]); + __Pyx_INCREF(__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_c; - /* "src/gfunction/gfunction.pyx":124 - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] - * cpz = core_dip[i*3+2] # <<<<<<<<<<<<<< - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: + /* "View.MemoryView":165 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' */ - __pyx_v_cpz = (__pyx_v_core_dip[((__pyx_v_i * 3) + 2)]); + goto __pyx_L11; + } - /* "src/gfunction/gfunction.pyx":125 - * cpy = core_dip[i*3+1] - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) # <<<<<<<<<<<<<< - * if ncore == nsurround: - * j_begin = i + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' */ - __pyx_v_clen = sqrt((((__pyx_v_cpx * __pyx_v_cpx) + (__pyx_v_cpy * __pyx_v_cpy)) + (__pyx_v_cpz * __pyx_v_cpz))); + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 168, __pyx_L1_error) + if (likely(__pyx_t_3)) { - /* "src/gfunction/gfunction.pyx":121 - * for i in prange(ncore, nogil=True): - * ix2=i*histo_n - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] + /* "View.MemoryView":169 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: */ - } + __pyx_v_order = 'F'; - /* "src/gfunction/gfunction.pyx":126 - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: # <<<<<<<<<<<<<< - * j_begin = i + /* "View.MemoryView":170 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" */ - __pyx_t_4 = ((__pyx_v_ncore == __pyx_v_nsurround) != 0); - if (__pyx_t_4) { + __Pyx_INCREF(__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_fortran; - /* "src/gfunction/gfunction.pyx":127 - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: - * j_begin = i # <<<<<<<<<<<<<< - * else: - * j_begin = 0 + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' */ - __pyx_v_j_begin = __pyx_v_i; + goto __pyx_L11; + } - /* "src/gfunction/gfunction.pyx":126 - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: # <<<<<<<<<<<<<< - * j_begin = i + /* "View.MemoryView":172 + * self.mode = u'fortran' * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) */ - goto __pyx_L15; - } + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 172, __pyx_L1_error) + } + __pyx_L11:; - /* "src/gfunction/gfunction.pyx":129 - * j_begin = i - * else: - * j_begin = 0 # <<<<<<<<<<<<<< - * for j in range(j_begin,nsurround): - * if ncore == nsurround and i != j: + /* "View.MemoryView":174 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer */ - /*else*/ { - __pyx_v_j_begin = 0; - } - __pyx_L15:; + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - /* "src/gfunction/gfunction.pyx":130 - * else: - * j_begin = 0 - * for j in range(j_begin,nsurround): # <<<<<<<<<<<<<< - * if ncore == nsurround and i != j: - * off_diag = 2.0 + /* "View.MemoryView":176 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * */ - __pyx_t_6 = __pyx_v_nsurround; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = __pyx_v_j_begin; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_j = __pyx_t_8; + __pyx_v_self->free_data = __pyx_v_allocate_buffer; - /* "src/gfunction/gfunction.pyx":131 - * j_begin = 0 - * for j in range(j_begin,nsurround): - * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< - * off_diag = 2.0 - * else: + /* "View.MemoryView":177 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: */ - __pyx_t_5 = ((__pyx_v_ncore == __pyx_v_nsurround) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L19_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_i != __pyx_v_j) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L19_bool_binop_done:; - if (__pyx_t_4) { + __pyx_t_6 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 177, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; - /* "src/gfunction/gfunction.pyx":132 - * for j in range(j_begin,nsurround): - * if ncore == nsurround and i != j: - * off_diag = 2.0 # <<<<<<<<<<<<<< - * else: - * off_diag = 1.0 + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * */ - __pyx_v_off_diag = 2.0; + if (__pyx_v_allocate_buffer) { - /* "src/gfunction/gfunction.pyx":131 - * j_begin = 0 - * for j in range(j_begin,nsurround): - * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< - * off_diag = 2.0 - * else: + /* "View.MemoryView":180 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') */ - goto __pyx_L18; - } + __pyx_t_7 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 180, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":134 - * off_diag = 2.0 - * else: - * off_diag = 1.0 # <<<<<<<<<<<<<< - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - * spx = surr_dip[j*3] + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * */ - /*else*/ { - __pyx_v_off_diag = 1.0; - } - __pyx_L18:; + } - /* "src/gfunction/gfunction.pyx":135 - * else: - * off_diag = 1.0 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * */ - __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L22_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 8) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L22_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L22_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 64) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L22_bool_binop_done:; - if (__pyx_t_4) { - /* "src/gfunction/gfunction.pyx":136 - * off_diag = 1.0 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - * spx = surr_dip[j*3] # <<<<<<<<<<<<<< - * spy = surr_dip[j*3+1] - * spz = surr_dip[j*3+2] + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":182 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ - __pyx_v_spx = (__pyx_v_surr_dip[(__pyx_v_j * 3)]); - /* "src/gfunction/gfunction.pyx":137 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] # <<<<<<<<<<<<<< - * spz = surr_dip[j*3+2] - * slen = sqrt(spx*spx+spy*spy+spz*spz) +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":184 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": */ - __pyx_v_spy = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 1)]); + __pyx_v_bufmode = -1; - /* "src/gfunction/gfunction.pyx":138 - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] - * spz = surr_dip[j*3+2] # <<<<<<<<<<<<<< - * slen = sqrt(spx*spx+spy*spy+spz*spz) - * + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __pyx_v_spz = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 2)]); + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":139 - * spy = surr_dip[j*3+1] - * spz = surr_dip[j*3+2] - * slen = sqrt(spx*spx+spy*spy+spz*spz) # <<<<<<<<<<<<<< - * - * dx = surr_xyz[j*3] - core_xyz[i*3] + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": */ - __pyx_v_slen = sqrt((((__pyx_v_spx * __pyx_v_spx) + (__pyx_v_spy * __pyx_v_spy)) + (__pyx_v_spz * __pyx_v_spz))); + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":135 - * else: - * off_diag = 1.0 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] + /* "View.MemoryView":187 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - } + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - /* "src/gfunction/gfunction.pyx":141 - * slen = sqrt(spx*spx+spy*spy+spz*spz) - * - * dx = surr_xyz[j*3] - core_xyz[i*3] # <<<<<<<<<<<<<< - * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": */ - __pyx_v_dx = ((__pyx_v_surr_xyz[(__pyx_v_j * 3)]) - (__pyx_v_core_xyz[(__pyx_v_i * 3)])); + goto __pyx_L4; + } - /* "src/gfunction/gfunction.pyx":142 - * - * dx = surr_xyz[j*3] - core_xyz[i*3] - * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] # <<<<<<<<<<<<<< - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] - * + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): */ - __pyx_v_dy = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 1)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 1)])); + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 188, __pyx_L1_error) + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":143 - * dx = surr_xyz[j*3] - core_xyz[i*3] - * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] # <<<<<<<<<<<<<< - * - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] + /* "View.MemoryView":189 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." */ - __pyx_v_dz = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 2)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 2)])); + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - /* "src/gfunction/gfunction.pyx":145 - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] - * - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] # <<<<<<<<<<<<<< - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): */ - __pyx_t_4 = ((fabs(__pyx_v_dx) > (__pyx_v_box_dim[3])) != 0); - if (__pyx_t_4) { - __pyx_v_dx = (__pyx_v_dx - (((0.0 < __pyx_v_dx) - (__pyx_v_dx < 0.0)) * (__pyx_v_box_dim[0]))); - } + } + __pyx_L4:; - /* "src/gfunction/gfunction.pyx":146 - * - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] # <<<<<<<<<<<<<< - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] - * dist = sqrt(dx*dx+dy*dy+dz*dz) + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data */ - __pyx_t_4 = ((fabs(__pyx_v_dy) > (__pyx_v_box_dim[4])) != 0); - if (__pyx_t_4) { - __pyx_v_dy = (__pyx_v_dy - (((0.0 < __pyx_v_dy) - (__pyx_v_dy < 0.0)) * (__pyx_v_box_dim[1]))); - } + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { - /* "src/gfunction/gfunction.pyx":147 - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] # <<<<<<<<<<<<<< - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue + /* "View.MemoryView":191 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len */ - __pyx_t_4 = ((fabs(__pyx_v_dz) > (__pyx_v_box_dim[5])) != 0); - if (__pyx_t_4) { - __pyx_v_dz = (__pyx_v_dz - (((0.0 < __pyx_v_dz) - (__pyx_v_dz < 0.0)) * (__pyx_v_box_dim[2]))); - } + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 191, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":148 - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] - * dist = sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< - * if disthisto_max or floor(dist*invdx)==0: continue - * pos = floor((dist-histo_min)*invdx) + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data */ - __pyx_v_dist = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + } - /* "src/gfunction/gfunction.pyx":149 - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue # <<<<<<<<<<<<<< - * pos = floor((dist-histo_min)*invdx) - * + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __pyx_t_5 = ((__pyx_v_dist < __pyx_v_histo_min) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L30_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_dist > __pyx_v_histo_max) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L30_bool_binop_done; - } - __pyx_t_5 = ((floor((__pyx_v_dist * __pyx_v_invdx)) == 0.0) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L30_bool_binop_done:; - if (__pyx_t_4) { - goto __pyx_L16_continue; - } + } - /* "src/gfunction/gfunction.pyx":150 - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue - * pos = floor((dist-histo_min)*invdx) # <<<<<<<<<<<<<< + /* "View.MemoryView":192 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len * - * if mode_sel & 1: dest[ix2+pos]+=1.0*off_diag */ - __pyx_v_pos = ((int)floor(((__pyx_v_dist - __pyx_v_histo_min) * __pyx_v_invdx))); + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; - /* "src/gfunction/gfunction.pyx":152 - * pos = floor((dist-histo_min)*invdx) - * - * if mode_sel & 1: dest[ix2+pos]+=1.0*off_diag # <<<<<<<<<<<<<< + /* "View.MemoryView":193 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< * - * if mode_sel & 2 or mode_sel & 16: + * if flags & PyBUF_STRIDES: */ - __pyx_t_4 = ((__pyx_v_mode_sel & 1) != 0); - if (__pyx_t_4) { - __pyx_t_9 = (__pyx_v_ix2 + __pyx_v_pos); - (__pyx_v_dest[__pyx_t_9]) = ((__pyx_v_dest[__pyx_t_9]) + (1.0 * __pyx_v_off_diag)); - } + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; - /* "src/gfunction/gfunction.pyx":154 - * if mode_sel & 1: dest[ix2+pos]+=1.0*off_diag + /* "View.MemoryView":195 + * info.len = self.len * - * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape */ - __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L35_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L35_bool_binop_done:; - if (__pyx_t_4) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":155 + /* "View.MemoryView":196 * - * if mode_sel & 2 or mode_sel & 16: - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) # <<<<<<<<<<<<<< - * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides */ - __pyx_t_10 = (((__pyx_v_cpx * __pyx_v_spx) + (__pyx_v_cpy * __pyx_v_spy)) + (__pyx_v_cpz * __pyx_v_spz)); - __pyx_t_11 = (__pyx_v_clen * __pyx_v_slen); - if (unlikely(__pyx_t_11 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 155, __pyx_L8_error) - } - __pyx_v_incr = (__pyx_t_10 / __pyx_t_11); + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; - /* "src/gfunction/gfunction.pyx":156 - * if mode_sel & 2 or mode_sel & 16: - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: + /* "View.MemoryView":197 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: */ - __pyx_t_4 = ((__pyx_v_mode_sel & 2) != 0); - if (__pyx_t_4) { - __pyx_t_9 = ((__pyx_v_ix1 + __pyx_v_ix2) + __pyx_v_pos); - (__pyx_v_dest[__pyx_t_9]) = ((__pyx_v_dest[__pyx_t_9]) + (__pyx_v_incr * __pyx_v_off_diag)); - } + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; - /* "src/gfunction/gfunction.pyx":157 - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 4 or mode_sel & 32: - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + /* "View.MemoryView":198 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 */ - __pyx_t_4 = ((__pyx_v_mode_sel & 16) != 0); - if (__pyx_t_4) { - __pyx_t_12 = (((4 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_pos); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); - } + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; - /* "src/gfunction/gfunction.pyx":154 - * if mode_sel & 1: dest[ix2+pos]+=1.0*off_diag + /* "View.MemoryView":195 + * info.len = self.len * - * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape */ - } + goto __pyx_L6; + } - /* "src/gfunction/gfunction.pyx":158 - * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag + /* "View.MemoryView":200 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL */ - __pyx_t_5 = ((__pyx_v_mode_sel & 4) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L40_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 32) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L40_bool_binop_done:; - if (__pyx_t_4) { + /*else*/ { + __pyx_v_info->ndim = 1; - /* "src/gfunction/gfunction.pyx":159 - * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) # <<<<<<<<<<<<<< - * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + /* "View.MemoryView":201 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL + * */ - __pyx_t_11 = (((__pyx_v_cpx * __pyx_v_dx) + (__pyx_v_cpy * __pyx_v_dy)) + (__pyx_v_cpz * __pyx_v_dz)); - __pyx_t_10 = (__pyx_v_clen * __pyx_v_dist); - if (unlikely(__pyx_t_10 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 159, __pyx_L8_error) - } - __pyx_v_incr = (__pyx_t_11 / __pyx_t_10); + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; - /* "src/gfunction/gfunction.pyx":160 - * if mode_sel & 4 or mode_sel & 32: - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: + /* "View.MemoryView":202 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL */ - __pyx_t_4 = ((__pyx_v_mode_sel & 4) != 0); - if (__pyx_t_4) { - __pyx_t_12 = (((2 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_pos); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + (__pyx_v_incr * __pyx_v_off_diag)); - } + __pyx_v_info->strides = NULL; + } + __pyx_L6:; - /* "src/gfunction/gfunction.pyx":161 - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 8 or mode_sel & 64: - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + /* "View.MemoryView":204 + * info.strides = NULL + * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 */ - __pyx_t_4 = ((__pyx_v_mode_sel & 32) != 0); - if (__pyx_t_4) { - __pyx_t_12 = (((5 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_pos); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); - } + __pyx_v_info->suboffsets = NULL; - /* "src/gfunction/gfunction.pyx":158 - * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag + /* "View.MemoryView":205 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL */ - } + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; - /* "src/gfunction/gfunction.pyx":162 - * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+pos]+=incr*off_diag + /* "View.MemoryView":206 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self */ - __pyx_t_5 = ((__pyx_v_mode_sel & 8) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L45_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 64) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L45_bool_binop_done:; - if (__pyx_t_4) { + __pyx_v_info->readonly = 0; - /* "src/gfunction/gfunction.pyx":163 - * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) # <<<<<<<<<<<<<< - * if mode_sel & 8: dest[3*ix1+ix2+pos]+=incr*off_diag - * if mode_sel & 64: dest[6*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + /* "View.MemoryView":207 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self + * */ - __pyx_t_10 = (((__pyx_v_spx * __pyx_v_dx) + (__pyx_v_spy * __pyx_v_dy)) + (__pyx_v_spz * __pyx_v_dz)); - __pyx_t_11 = (__pyx_v_slen * __pyx_v_dist); - if (unlikely(__pyx_t_11 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 163, __pyx_L8_error) - } - __pyx_v_incr = (__pyx_t_10 / __pyx_t_11); - - /* "src/gfunction/gfunction.pyx":164 - * if mode_sel & 8 or mode_sel & 64: - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+pos]+=incr*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 64: dest[6*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag - * - */ - __pyx_t_4 = ((__pyx_v_mode_sel & 8) != 0); - if (__pyx_t_4) { - __pyx_t_12 = (((3 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_pos); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + (__pyx_v_incr * __pyx_v_off_diag)); - } - - /* "src/gfunction/gfunction.pyx":165 - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+pos]+=incr*off_diag - * if mode_sel & 64: dest[6*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< - * - * # RDF time series - */ - __pyx_t_4 = ((__pyx_v_mode_sel & 64) != 0); - if (__pyx_t_4) { - __pyx_t_12 = (((6 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_pos); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); - } - - /* "src/gfunction/gfunction.pyx":162 - * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+pos]+=incr*off_diag - */ - } - __pyx_L16_continue:; - } - goto __pyx_L50; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L49; - __pyx_L49:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates8) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_clen; - __pyx_parallel_temp1 = __pyx_v_cpx; - __pyx_parallel_temp2 = __pyx_v_cpy; - __pyx_parallel_temp3 = __pyx_v_cpz; - __pyx_parallel_temp4 = __pyx_v_dist; - __pyx_parallel_temp5 = __pyx_v_dx; - __pyx_parallel_temp6 = __pyx_v_dy; - __pyx_parallel_temp7 = __pyx_v_dz; - __pyx_parallel_temp8 = __pyx_v_i; - __pyx_parallel_temp9 = __pyx_v_incr; - __pyx_parallel_temp10 = __pyx_v_ix2; - __pyx_parallel_temp11 = __pyx_v_j; - __pyx_parallel_temp12 = __pyx_v_j_begin; - __pyx_parallel_temp13 = __pyx_v_off_diag; - __pyx_parallel_temp14 = __pyx_v_pos; - __pyx_parallel_temp15 = __pyx_v_slen; - __pyx_parallel_temp16 = __pyx_v_spx; - __pyx_parallel_temp17 = __pyx_v_spy; - __pyx_parallel_temp18 = __pyx_v_spz; - } - __pyx_L50:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_clen = __pyx_parallel_temp0; - __pyx_v_cpx = __pyx_parallel_temp1; - __pyx_v_cpy = __pyx_parallel_temp2; - __pyx_v_cpz = __pyx_parallel_temp3; - __pyx_v_dist = __pyx_parallel_temp4; - __pyx_v_dx = __pyx_parallel_temp5; - __pyx_v_dy = __pyx_parallel_temp6; - __pyx_v_dz = __pyx_parallel_temp7; - __pyx_v_i = __pyx_parallel_temp8; - __pyx_v_incr = __pyx_parallel_temp9; - __pyx_v_ix2 = __pyx_parallel_temp10; - __pyx_v_j = __pyx_parallel_temp11; - __pyx_v_j_begin = __pyx_parallel_temp12; - __pyx_v_off_diag = __pyx_parallel_temp13; - __pyx_v_pos = __pyx_parallel_temp14; - __pyx_v_slen = __pyx_parallel_temp15; - __pyx_v_spx = __pyx_parallel_temp16; - __pyx_v_spy = __pyx_parallel_temp17; - __pyx_v_spz = __pyx_parallel_temp18; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; + } + __pyx_v_info->format = __pyx_t_2; - /* "src/gfunction/gfunction.pyx":119 - * cdef double *box_dim = np_box_dim.data + /* "View.MemoryView":208 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< * - * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< - * ix2=i*histo_n - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * def __dealloc__(array self): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } - } + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "src/gfunction/gfunction.pyx":110 + /* "View.MemoryView":182 + * _allocate_buffer(self) * - * # CPU version - * cdef void calcHisto(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, - * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel): + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ /* function exit code */ + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_WriteUnraisable("newanalysis.gfunction.calcHisto", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } __pyx_L2:; __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "src/gfunction/gfunction.pyx":169 - * # RDF time series - * @cython.boundscheck(False) - * def calcHistoTS(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:] result, # <<<<<<<<<<<<<< - * double boxl, int t, float histo_min, float histo_max, double invdx): +/* "View.MemoryView":210 + * info.obj = self * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_1calcHistoTS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_1calcHistoTS = {"calcHistoTS", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_1calcHistoTS, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_1calcHistoTS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_core_xyz = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_surr_xyz = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxl; - int __pyx_v_t; - float __pyx_v_histo_min; - float __pyx_v_histo_max; - double __pyx_v_invdx; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcHistoTS (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_core_xyz,&__pyx_n_s_surr_xyz,&__pyx_n_s_result,&__pyx_n_s_boxl,&__pyx_n_s_t,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_invdx,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_core_xyz)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surr_xyz)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 1); __PYX_ERR(0, 169, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 2); __PYX_ERR(0, 169, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 3); __PYX_ERR(0, 169, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 4); __PYX_ERR(0, 169, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_min)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 5); __PYX_ERR(0, 169, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_max)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 6); __PYX_ERR(0, 169, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_invdx)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 7); __PYX_ERR(0, 169, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcHistoTS") < 0)) __PYX_ERR(0, 169, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - } - __pyx_v_core_xyz = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_core_xyz.memview)) __PYX_ERR(0, 169, __pyx_L3_error) - __pyx_v_surr_xyz = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_surr_xyz.memview)) __PYX_ERR(0, 169, __pyx_L3_error) - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 169, __pyx_L3_error) - __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) - __pyx_v_t = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_t == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) - __pyx_v_histo_min = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_histo_min == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) - __pyx_v_histo_max = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_histo_max == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) - __pyx_v_invdx = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_invdx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 169, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.calcHistoTS", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9gfunction_calcHistoTS(__pyx_self, __pyx_v_core_xyz, __pyx_v_surr_xyz, __pyx_v_result, __pyx_v_boxl, __pyx_v_t, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_invdx); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_calcHistoTS(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_core_xyz, __Pyx_memviewslice __pyx_v_surr_xyz, __Pyx_memviewslice __pyx_v_result, double __pyx_v_boxl, int __pyx_v_t, float __pyx_v_histo_min, float __pyx_v_histo_max, double __pyx_v_invdx) { - CYTHON_UNUSED int __pyx_v_ncore; - int __pyx_v_nsurr; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_pos; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_dist; - double __pyx_v_boxl2; - PyObject *__pyx_r = NULL; +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - __Pyx_RefNannySetupContext("calcHistoTS", 0); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "src/gfunction/gfunction.pyx":172 - * double boxl, int t, float histo_min, float histo_max, double invdx): + /* "View.MemoryView":211 * - * cdef int ncore = core_xyz.shape[0] # <<<<<<<<<<<<<< - * cdef int nsurr = surr_xyz.shape[0] - * cdef int i, j, pos + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - __pyx_v_ncore = (__pyx_v_core_xyz.shape[0]); + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":173 - * - * cdef int ncore = core_xyz.shape[0] - * cdef int nsurr = surr_xyz.shape[0] # <<<<<<<<<<<<<< - * cdef int i, j, pos - * cdef double dx, dy, dz, dist + /* "View.MemoryView":212 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: */ - __pyx_v_nsurr = (__pyx_v_surr_xyz.shape[0]); + __pyx_v_self->callback_free_data(__pyx_v_self->data); - /* "src/gfunction/gfunction.pyx":176 - * cdef int i, j, pos - * cdef double dx, dy, dz, dist - * cdef double boxl2 = boxl / 2.0 # <<<<<<<<<<<<<< + /* "View.MemoryView":211 * - * for i in prange(ncore, nogil=True): + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - __pyx_v_boxl2 = (__pyx_v_boxl / 2.0); + goto __pyx_L3; + } - /* "src/gfunction/gfunction.pyx":178 - * cdef double boxl2 = boxl / 2.0 - * - * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< - * for j in range(nsurr): - * dx = surr_xyz[j,0] - core_xyz[i,0] + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_ncore; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dist) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_pos) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - /* Initialize private variables to invalid values */ - __pyx_v_dist = ((double)__PYX_NAN()); - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_pos = ((int)0xbad0bad0); + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":179 - * - * for i in prange(ncore, nogil=True): - * for j in range(nsurr): # <<<<<<<<<<<<<< - * dx = surr_xyz[j,0] - core_xyz[i,0] - * dy = surr_xyz[j,1] - core_xyz[i,1] + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) */ - __pyx_t_4 = __pyx_v_nsurr; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_j = __pyx_t_6; + if (__pyx_v_self->dtype_is_object) { - /* "src/gfunction/gfunction.pyx":180 - * for i in prange(ncore, nogil=True): - * for j in range(nsurr): - * dx = surr_xyz[j,0] - core_xyz[i,0] # <<<<<<<<<<<<<< - * dy = surr_xyz[j,1] - core_xyz[i,1] - * dz = surr_xyz[j,2] - core_xyz[i,2] + /* "View.MemoryView":215 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) */ - __pyx_t_7 = __pyx_v_j; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_surr_xyz.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_surr_xyz.shape[1]; - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = 0; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_core_xyz.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_core_xyz.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_7 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_8 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_9 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_10 * __pyx_v_core_xyz.strides[1]) )))); + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); - /* "src/gfunction/gfunction.pyx":181 - * for j in range(nsurr): - * dx = surr_xyz[j,0] - core_xyz[i,0] - * dy = surr_xyz[j,1] - core_xyz[i,1] # <<<<<<<<<<<<<< - * dz = surr_xyz[j,2] - core_xyz[i,2] - * + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) */ - __pyx_t_10 = __pyx_v_j; - __pyx_t_9 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_surr_xyz.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_surr_xyz.shape[1]; - __pyx_t_8 = __pyx_v_i; - __pyx_t_7 = 1; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_core_xyz.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_core_xyz.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_10 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_9 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_8 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_7 * __pyx_v_core_xyz.strides[1]) )))); + } - /* "src/gfunction/gfunction.pyx":182 - * dx = surr_xyz[j,0] - core_xyz[i,0] - * dy = surr_xyz[j,1] - core_xyz[i,1] - * dz = surr_xyz[j,2] - core_xyz[i,2] # <<<<<<<<<<<<<< + /* "View.MemoryView":216 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) * - * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl */ - __pyx_t_7 = __pyx_v_j; - __pyx_t_8 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_surr_xyz.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_surr_xyz.shape[1]; - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = 2; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_core_xyz.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_core_xyz.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_7 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_8 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_9 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_10 * __pyx_v_core_xyz.strides[1]) )))); + free(__pyx_v_self->data); - /* "src/gfunction/gfunction.pyx":184 - * dz = surr_xyz[j,2] - core_xyz[i,2] - * - * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl # <<<<<<<<<<<<<< - * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl - * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) */ - __pyx_t_11 = ((fabs(__pyx_v_dx) > __pyx_v_boxl2) != 0); - if (__pyx_t_11) { - __pyx_v_dx = (__pyx_v_dx - (((0.0 < __pyx_v_dx) - (__pyx_v_dx < 0.0)) * __pyx_v_boxl)); - } + } + __pyx_L3:; - /* "src/gfunction/gfunction.pyx":185 - * - * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl - * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl # <<<<<<<<<<<<<< - * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl + /* "View.MemoryView":217 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_11 = ((fabs(__pyx_v_dy) > __pyx_v_boxl2) != 0); - if (__pyx_t_11) { - __pyx_v_dy = (__pyx_v_dy - (((0.0 < __pyx_v_dy) - (__pyx_v_dy < 0.0)) * __pyx_v_boxl)); - } + PyObject_Free(__pyx_v_self->_shape); - /* "src/gfunction/gfunction.pyx":186 - * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl - * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl - * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl # <<<<<<<<<<<<<< + /* "View.MemoryView":210 + * info.obj = self * - * dist = sqrt(dx*dx+dy*dy+dz*dz) + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ - __pyx_t_11 = ((fabs(__pyx_v_dz) > __pyx_v_boxl2) != 0); - if (__pyx_t_11) { - __pyx_v_dz = (__pyx_v_dz - (((0.0 < __pyx_v_dz) - (__pyx_v_dz < 0.0)) * __pyx_v_boxl)); - } - /* "src/gfunction/gfunction.pyx":188 - * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "View.MemoryView":219 + * PyObject_Free(self._shape) * - * dist = sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< - * if disthisto_max or floor(dist*invdx)==0: continue - * pos = floor((dist-histo_min)*invdx) + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() */ - __pyx_v_dist = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* "src/gfunction/gfunction.pyx":189 - * - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue # <<<<<<<<<<<<<< - * pos = floor((dist-histo_min)*invdx) +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":221 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< * + * @cname('get_memview') */ - __pyx_t_12 = ((__pyx_v_dist < __pyx_v_histo_min) != 0); - if (!__pyx_t_12) { - } else { - __pyx_t_11 = __pyx_t_12; - goto __pyx_L16_bool_binop_done; - } - __pyx_t_12 = ((__pyx_v_dist > __pyx_v_histo_max) != 0); - if (!__pyx_t_12) { - } else { - __pyx_t_11 = __pyx_t_12; - goto __pyx_L16_bool_binop_done; - } - __pyx_t_12 = ((floor((__pyx_v_dist * __pyx_v_invdx)) == 0.0) != 0); - __pyx_t_11 = __pyx_t_12; - __pyx_L16_bool_binop_done:; - if (__pyx_t_11) { - goto __pyx_L10_continue; - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":190 - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue - * pos = floor((dist-histo_min)*invdx) # <<<<<<<<<<<<<< + /* "View.MemoryView":219 + * PyObject_Free(self._shape) * - * result[t,i,pos] += 1.0 + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() */ - __pyx_v_pos = ((int)floor(((__pyx_v_dist - __pyx_v_histo_min) * __pyx_v_invdx))); - /* "src/gfunction/gfunction.pyx":192 - * pos = floor((dist-histo_min)*invdx) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":224 * - * result[t,i,pos] += 1.0 # <<<<<<<<<<<<<< + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) + */ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":225 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) * - * # RDF time series with voronoi decomposition */ - __pyx_t_10 = __pyx_v_t; - __pyx_t_9 = __pyx_v_i; - __pyx_t_8 = __pyx_v_pos; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_result.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_result.shape[1]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_result.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_10 * __pyx_v_result.strides[0]) ) + __pyx_t_9 * __pyx_v_result.strides[1]) ) + __pyx_t_8 * __pyx_v_result.strides[2]) )) += 1.0; - __pyx_L10_continue:; - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); - /* "src/gfunction/gfunction.pyx":178 - * cdef double boxl2 = boxl / 2.0 + /* "View.MemoryView":226 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< * - * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< - * for j in range(nsurr): - * dx = surr_xyz[j,0] - core_xyz[i,0] + * def __len__(self): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":169 - * # RDF time series - * @cython.boundscheck(False) - * def calcHistoTS(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:] result, # <<<<<<<<<<<<<< - * double boxl, int t, float histo_min, float histo_max, double invdx): + /* "View.MemoryView":224 * + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_core_xyz, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_surr_xyz, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1); + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/gfunction/gfunction.pyx":196 - * # RDF time series with voronoi decomposition - * @cython.boundscheck(False) - * def calcHistoTSVoro(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:,:] result, char [:,:,:] ds, int maxshell, # <<<<<<<<<<<<<< - * double boxl, int t, float histo_min, float histo_max, double invdx): +/* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_3calcHistoTSVoro(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3calcHistoTSVoro = {"calcHistoTSVoro", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_3calcHistoTSVoro, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_3calcHistoTSVoro(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_core_xyz = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_surr_xyz = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell; - double __pyx_v_boxl; - int __pyx_v_t; - float __pyx_v_histo_min; - float __pyx_v_histo_max; - double __pyx_v_invdx; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcHistoTSVoro (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_core_xyz,&__pyx_n_s_surr_xyz,&__pyx_n_s_result,&__pyx_n_s_ds,&__pyx_n_s_maxshell,&__pyx_n_s_boxl,&__pyx_n_s_t,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_invdx,0}; - PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_core_xyz)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surr_xyz)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 1); __PYX_ERR(0, 196, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 2); __PYX_ERR(0, 196, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 3); __PYX_ERR(0, 196, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 4); __PYX_ERR(0, 196, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 5); __PYX_ERR(0, 196, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 6); __PYX_ERR(0, 196, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_min)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 7); __PYX_ERR(0, 196, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_max)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 8); __PYX_ERR(0, 196, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 9: - if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_invdx)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 9); __PYX_ERR(0, 196, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcHistoTSVoro") < 0)) __PYX_ERR(0, 196, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 10) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - } - __pyx_v_core_xyz = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_core_xyz.memview)) __PYX_ERR(0, 196, __pyx_L3_error) - __pyx_v_surr_xyz = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_surr_xyz.memview)) __PYX_ERR(0, 196, __pyx_L3_error) - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 196, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 196, __pyx_L3_error) - __pyx_v_maxshell = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L3_error) - __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) - __pyx_v_t = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_t == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) - __pyx_v_histo_min = __pyx_PyFloat_AsFloat(values[7]); if (unlikely((__pyx_v_histo_min == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) - __pyx_v_histo_max = __pyx_PyFloat_AsFloat(values[8]); if (unlikely((__pyx_v_histo_max == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) - __pyx_v_invdx = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_invdx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 196, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.calcHistoTSVoro", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9gfunction_2calcHistoTSVoro(__pyx_self, __pyx_v_core_xyz, __pyx_v_surr_xyz, __pyx_v_result, __pyx_v_ds, __pyx_v_maxshell, __pyx_v_boxl, __pyx_v_t, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_invdx); + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_2calcHistoTSVoro(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_core_xyz, __Pyx_memviewslice __pyx_v_surr_xyz, __Pyx_memviewslice __pyx_v_result, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, double __pyx_v_boxl, int __pyx_v_t, float __pyx_v_histo_min, float __pyx_v_histo_max, double __pyx_v_invdx) { - CYTHON_UNUSED int __pyx_v_ncore; - int __pyx_v_nsurr; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_pos; - char __pyx_v_shell; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_dist; - double __pyx_v_boxl2; - PyObject *__pyx_r = NULL; +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - __Pyx_RefNannySetupContext("calcHistoTSVoro", 0); + __Pyx_RefNannySetupContext("__len__", 0); - /* "src/gfunction/gfunction.pyx":199 - * double boxl, int t, float histo_min, float histo_max, double invdx): + /* "View.MemoryView":229 * - * cdef int ncore = core_xyz.shape[0] # <<<<<<<<<<<<<< - * cdef int nsurr = surr_xyz.shape[0] - * cdef int i, j, pos - */ - __pyx_v_ncore = (__pyx_v_core_xyz.shape[0]); - - /* "src/gfunction/gfunction.pyx":200 + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< * - * cdef int ncore = core_xyz.shape[0] - * cdef int nsurr = surr_xyz.shape[0] # <<<<<<<<<<<<<< - * cdef int i, j, pos - * cdef char shell + * def __getattr__(self, attr): */ - __pyx_v_nsurr = (__pyx_v_surr_xyz.shape[0]); + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":204 - * cdef char shell - * cdef double dx, dy, dz, dist - * cdef double boxl2 = boxl / 2.0 # <<<<<<<<<<<<<< + /* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) * - * for i in prange(ncore, nogil=True): - */ - __pyx_v_boxl2 = (__pyx_v_boxl / 2.0); - - /* "src/gfunction/gfunction.pyx":206 - * cdef double boxl2 = boxl / 2.0 + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * - * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< - * for j in range(nsurr): - * dx = surr_xyz[j,0] - core_xyz[i,0] */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_ncore; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dist) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_pos) lastprivate(__pyx_v_shell) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - /* Initialize private variables to invalid values */ - __pyx_v_dist = ((double)__PYX_NAN()); - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_pos = ((int)0xbad0bad0); - __pyx_v_shell = ((char)'?'); - /* "src/gfunction/gfunction.pyx":207 + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":231 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * - * for i in prange(ncore, nogil=True): - * for j in range(nsurr): # <<<<<<<<<<<<<< - * dx = surr_xyz[j,0] - core_xyz[i,0] - * dy = surr_xyz[j,1] - core_xyz[i,1] */ - __pyx_t_4 = __pyx_v_nsurr; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_j = __pyx_t_6; - /* "src/gfunction/gfunction.pyx":208 - * for i in prange(ncore, nogil=True): - * for j in range(nsurr): - * dx = surr_xyz[j,0] - core_xyz[i,0] # <<<<<<<<<<<<<< - * dy = surr_xyz[j,1] - core_xyz[i,1] - * dz = surr_xyz[j,2] - core_xyz[i,2] - */ - __pyx_t_7 = __pyx_v_j; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_surr_xyz.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_surr_xyz.shape[1]; - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = 0; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_core_xyz.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_core_xyz.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_7 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_8 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_9 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_10 * __pyx_v_core_xyz.strides[1]) )))); +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); - /* "src/gfunction/gfunction.pyx":209 - * for j in range(nsurr): - * dx = surr_xyz[j,0] - core_xyz[i,0] - * dy = surr_xyz[j,1] - core_xyz[i,1] # <<<<<<<<<<<<<< - * dz = surr_xyz[j,2] - core_xyz[i,2] - * - */ - __pyx_t_10 = __pyx_v_j; - __pyx_t_9 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_surr_xyz.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_surr_xyz.shape[1]; - __pyx_t_8 = __pyx_v_i; - __pyx_t_7 = 1; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_core_xyz.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_core_xyz.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_10 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_9 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_8 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_7 * __pyx_v_core_xyz.strides[1]) )))); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":210 - * dx = surr_xyz[j,0] - core_xyz[i,0] - * dy = surr_xyz[j,1] - core_xyz[i,1] - * dz = surr_xyz[j,2] - core_xyz[i,2] # <<<<<<<<<<<<<< - * - * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl - */ - __pyx_t_7 = __pyx_v_j; - __pyx_t_8 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_surr_xyz.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_surr_xyz.shape[1]; - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = 2; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_core_xyz.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_core_xyz.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_7 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_8 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_9 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_10 * __pyx_v_core_xyz.strides[1]) )))); +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); - /* "src/gfunction/gfunction.pyx":212 - * dz = surr_xyz[j,2] - core_xyz[i,2] + /* "View.MemoryView":232 * - * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl # <<<<<<<<<<<<<< - * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl - * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): */ - __pyx_t_11 = ((fabs(__pyx_v_dx) > __pyx_v_boxl2) != 0); - if (__pyx_t_11) { - __pyx_v_dx = (__pyx_v_dx - (((0.0 < __pyx_v_dx) - (__pyx_v_dx < 0.0)) * __pyx_v_boxl)); - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":213 + /* "View.MemoryView":231 + * return self._shape[0] * - * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl - * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl # <<<<<<<<<<<<<< - * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * */ - __pyx_t_11 = ((fabs(__pyx_v_dy) > __pyx_v_boxl2) != 0); - if (__pyx_t_11) { - __pyx_v_dy = (__pyx_v_dy - (((0.0 < __pyx_v_dy) - (__pyx_v_dy < 0.0)) * __pyx_v_boxl)); - } - /* "src/gfunction/gfunction.pyx":214 - * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl - * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl - * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl # <<<<<<<<<<<<<< - * - * dist = sqrt(dx*dx+dy*dy+dz*dz) - */ - __pyx_t_11 = ((fabs(__pyx_v_dz) > __pyx_v_boxl2) != 0); - if (__pyx_t_11) { - __pyx_v_dz = (__pyx_v_dz - (((0.0 < __pyx_v_dz) - (__pyx_v_dz < 0.0)) * __pyx_v_boxl)); - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":216 - * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl +/* "View.MemoryView":234 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] * - * dist = sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< - * if disthisto_max or floor(dist*invdx)==0: continue - * pos = floor((dist-histo_min)*invdx) */ - __pyx_v_dist = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* "src/gfunction/gfunction.pyx":217 +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":235 * - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue # <<<<<<<<<<<<<< - * pos = floor((dist-histo_min)*invdx) + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< * + * def __setitem__(self, item, value): */ - __pyx_t_12 = ((__pyx_v_dist < __pyx_v_histo_min) != 0); - if (!__pyx_t_12) { - } else { - __pyx_t_11 = __pyx_t_12; - goto __pyx_L16_bool_binop_done; - } - __pyx_t_12 = ((__pyx_v_dist > __pyx_v_histo_max) != 0); - if (!__pyx_t_12) { - } else { - __pyx_t_11 = __pyx_t_12; - goto __pyx_L16_bool_binop_done; - } - __pyx_t_12 = ((floor((__pyx_v_dist * __pyx_v_invdx)) == 0.0) != 0); - __pyx_t_11 = __pyx_t_12; - __pyx_L16_bool_binop_done:; - if (__pyx_t_11) { - goto __pyx_L10_continue; - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":218 - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue - * pos = floor((dist-histo_min)*invdx) # <<<<<<<<<<<<<< + /* "View.MemoryView":234 + * return getattr(self.memview, attr) * - * shell = ds[t,i,j] - */ - __pyx_v_pos = ((int)floor(((__pyx_v_dist - __pyx_v_histo_min) * __pyx_v_invdx))); - - /* "src/gfunction/gfunction.pyx":220 - * pos = floor((dist-histo_min)*invdx) + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] * - * shell = ds[t,i,j] # <<<<<<<<<<<<<< - * if shell > maxshell: - * shell = maxshell */ - __pyx_t_10 = __pyx_v_t; - __pyx_t_9 = __pyx_v_i; - __pyx_t_8 = __pyx_v_j; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_ds.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_ds.shape[1]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_ds.shape[2]; - __pyx_v_shell = (*((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_10 * __pyx_v_ds.strides[0]) ) + __pyx_t_9 * __pyx_v_ds.strides[1]) ) + __pyx_t_8 * __pyx_v_ds.strides[2]) ))); - /* "src/gfunction/gfunction.pyx":221 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":237 + * return self.memview[item] * - * shell = ds[t,i,j] - * if shell > maxshell: # <<<<<<<<<<<<<< - * shell = maxshell + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value * */ - __pyx_t_11 = ((__pyx_v_shell > __pyx_v_maxshell) != 0); - if (__pyx_t_11) { - /* "src/gfunction/gfunction.pyx":222 - * shell = ds[t,i,j] - * if shell > maxshell: - * shell = maxshell # <<<<<<<<<<<<<< - * - * result[t,i,shell-1,pos] += 1.0 - */ - __pyx_v_shell = __pyx_v_maxshell; +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); - /* "src/gfunction/gfunction.pyx":221 + /* "View.MemoryView":238 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< * - * shell = ds[t,i,j] - * if shell > maxshell: # <<<<<<<<<<<<<< - * shell = maxshell * */ - } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":224 - * shell = maxshell - * - * result[t,i,shell-1,pos] += 1.0 # <<<<<<<<<<<<<< + /* "View.MemoryView":237 + * return self.memview[item] * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value * */ - __pyx_t_8 = __pyx_v_t; - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = (__pyx_v_shell - 1); - __pyx_t_7 = __pyx_v_pos; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_result.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_result.shape[1]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_result.shape[2]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_result.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_8 * __pyx_v_result.strides[0]) ) + __pyx_t_9 * __pyx_v_result.strides[1]) ) + __pyx_t_10 * __pyx_v_result.strides[2]) ) + __pyx_t_7 * __pyx_v_result.strides[3]) )) += 1.0; - __pyx_L10_continue:; - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/gfunction/gfunction.pyx":206 - * cdef double boxl2 = boxl / 2.0 - * - * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< - * for j in range(nsurr): - * dx = surr_xyz[j,0] - core_xyz[i,0] + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - /* "src/gfunction/gfunction.pyx":196 - * # RDF time series with voronoi decomposition - * @cython.boundscheck(False) - * def calcHistoTSVoro(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:,:] result, char [:,:,:] ds, int maxshell, # <<<<<<<<<<<<<< - * double boxl, int t, float histo_min, float histo_max, double invdx): - * +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_core_xyz, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_surr_xyz, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/gfunction/gfunction.pyx":234 - * """ - * - * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False, norm_volume=None): # <<<<<<<<<<<<<< - * """ - * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_3RDF___init__[] = "\n RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False)\n\n Creates a new rdf container.\n\n modes .. a list of gfunctions to calculate\n e.g. [\"all\"] -> calculate all gfunctions\n [\"000\",\"110\",\"220\"] -> calculate only g000, g110 and g220\n histo_min .. lower bound of histogram\n histo_max .. upper bound of histogram\n histo_dr .. histogram bin width\n sel1_n .. number of particles in first selection\n sel2_n .. number of particles in second selection\n sel1_nmol .. number of molecules in first selection; needed for correct normalisation, if multiple atoms from the same molecule are selected\n sel2_nmol .. number of molecules in second selection\n box_x .. box length, x dim\n box_y .. box length, y dim (optional; if None, y=x)\n box_z .. box length, z dim (optional; if None, z=x)\n use_cuda .. whether to use cuda, if available (default=False)\n norm_volume .. volume to use for calculating the density during normalization (default = None)\n\n Usage example:\n my_rdf = RDF([\"all\"], 0.0, 50.0, 0.05, 200, 200, 200, 200, 25.0)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF___init__}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_modes = 0; - PyObject *__pyx_v_histo_min = 0; - PyObject *__pyx_v_histo_max = 0; - PyObject *__pyx_v_histo_dr = 0; - PyObject *__pyx_v_sel1_n = 0; - PyObject *__pyx_v_sel2_n = 0; - PyObject *__pyx_v_sel1_nmol = 0; - PyObject *__pyx_v_sel2_nmol = 0; - PyObject *__pyx_v_box_x = 0; - PyObject *__pyx_v_box_y = 0; - PyObject *__pyx_v_box_z = 0; - PyObject *__pyx_v_use_cuda = 0; - PyObject *__pyx_v_norm_volume = 0; +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_modes,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_histo_dr,&__pyx_n_s_sel1_n,&__pyx_n_s_sel2_n,&__pyx_n_s_sel1_nmol,&__pyx_n_s_sel2_nmol,&__pyx_n_s_box_x,&__pyx_n_s_box_y,&__pyx_n_s_box_z,&__pyx_n_s_use_cuda,&__pyx_n_s_norm_volume,0}; - PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - values[10] = ((PyObject *)((PyObject *)Py_None)); - values[11] = ((PyObject *)((PyObject *)Py_None)); - values[12] = ((PyObject *)((PyObject *)Py_False)); - values[13] = ((PyObject *)((PyObject *)Py_None)); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_modes)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 1); __PYX_ERR(0, 234, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_min)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 2); __PYX_ERR(0, 234, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_max)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 3); __PYX_ERR(0, 234, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_dr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 4); __PYX_ERR(0, 234, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel1_n)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 5); __PYX_ERR(0, 234, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel2_n)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 6); __PYX_ERR(0, 234, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel1_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 7); __PYX_ERR(0, 234, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel2_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 8); __PYX_ERR(0, 234, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 9: - if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_x)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 9); __PYX_ERR(0, 234, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 10: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_y); - if (value) { values[10] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 11: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_z); - if (value) { values[11] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 12: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_cuda); - if (value) { values[12] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 13: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_norm_volume); - if (value) { values[13] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 234, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_self = values[0]; - __pyx_v_modes = values[1]; - __pyx_v_histo_min = values[2]; - __pyx_v_histo_max = values[3]; - __pyx_v_histo_dr = values[4]; - __pyx_v_sel1_n = values[5]; - __pyx_v_sel2_n = values[6]; - __pyx_v_sel1_nmol = values[7]; - __pyx_v_sel2_nmol = values[8]; - __pyx_v_box_x = values[9]; - __pyx_v_box_y = values[10]; - __pyx_v_box_z = values[11]; - __pyx_v_use_cuda = values[12]; - __pyx_v_norm_volume = values[13]; + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 234, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF___init__(__pyx_self, __pyx_v_self, __pyx_v_modes, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_dr, __pyx_v_sel1_n, __pyx_v_sel2_n, __pyx_v_sel1_nmol, __pyx_v_sel2_nmol, __pyx_v_box_x, __pyx_v_box_y, __pyx_v_box_z, __pyx_v_use_cuda, __pyx_v_norm_volume); + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_modes, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_dr, PyObject *__pyx_v_sel1_n, PyObject *__pyx_v_sel2_n, PyObject *__pyx_v_sel1_nmol, PyObject *__pyx_v_sel2_nmol, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z, PyObject *__pyx_v_use_cuda, PyObject *__pyx_v_norm_volume) { - int __pyx_v_mode_sel; - PyObject *__pyx_v_mode = NULL; - PyObject *__pyx_v_arr_sel1 = NULL; - PyObject *__pyx_v_arr_sel2 = NULL; - PyObject *__pyx_v_block_x = NULL; - PyObject *__pyx_v_block_y = NULL; - long __pyx_v_block_z; - PyObject *__pyx_v_grid_x = NULL; - PyObject *__pyx_v_grid_y = NULL; +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/gfunction/gfunction.pyx":260 - * """ - * - * if use_cuda and cu.cuda: # <<<<<<<<<<<<<< - * self.cuda = True - * elif use_cuda and not cu.cuda: + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_use_cuda); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 260, __pyx_L1_error) - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_cu); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cuda); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":261 - * - * if use_cuda and cu.cuda: - * self.cuda = True # <<<<<<<<<<<<<< - * elif use_cuda and not cu.cuda: - * print "No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead." + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_True) < 0) __PYX_ERR(0, 261, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":260 - * """ + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * * - * if use_cuda and cu.cuda: # <<<<<<<<<<<<<< - * self.cuda = True - * elif use_cuda and not cu.cuda: */ - goto __pyx_L3; - } - /* "src/gfunction/gfunction.pyx":262 - * if use_cuda and cu.cuda: - * self.cuda = True - * elif use_cuda and not cu.cuda: # <<<<<<<<<<<<<< - * print "No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead." - * self.cuda = False +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_allocate_buffer", 0); + + /* "View.MemoryView":254 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_use_cuda); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 262, __pyx_L1_error) - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L6_bool_binop_done; - } - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_cu); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cuda); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = ((!__pyx_t_2) != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L6_bool_binop_done:; - if (__pyx_t_1) { + __pyx_v_self->free_data = 1; - /* "src/gfunction/gfunction.pyx":263 - * self.cuda = True - * elif use_cuda and not cu.cuda: - * print "No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead." # <<<<<<<<<<<<<< - * self.cuda = False - * else: + /* "View.MemoryView":255 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." */ - if (__Pyx_PrintOne(0, __pyx_kp_s_No_suitable_CUDA_device_was_foun) < 0) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); - /* "src/gfunction/gfunction.pyx":264 - * elif use_cuda and not cu.cuda: - * print "No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead." - * self.cuda = False # <<<<<<<<<<<<<< - * else: - * self.cuda = False + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_False) < 0) __PYX_ERR(0, 264, __pyx_L1_error) + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { - /* "src/gfunction/gfunction.pyx":262 - * if use_cuda and cu.cuda: - * self.cuda = True - * elif use_cuda and not cu.cuda: # <<<<<<<<<<<<<< - * print "No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead." - * self.cuda = False + /* "View.MemoryView":257 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: */ - goto __pyx_L3; - } + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 257, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":266 - * self.cuda = False - * else: - * self.cuda = False # <<<<<<<<<<<<<< + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." * - * if self.cuda: */ - /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_False) < 0) __PYX_ERR(0, 266, __pyx_L1_error) } - __pyx_L3:; - /* "src/gfunction/gfunction.pyx":268 - * self.cuda = False + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." * - * if self.cuda: # <<<<<<<<<<<<<< - * self.dtype = np.float32 - * else: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 268, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { + if (__pyx_v_self->dtype_is_object) { - /* "src/gfunction/gfunction.pyx":269 + /* "View.MemoryView":260 * - * if self.cuda: - * self.dtype = np.float32 # <<<<<<<<<<<<<< - * else: - * self.dtype = np.float64 + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 269, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_p = ((PyObject **)__pyx_v_self->data); - /* "src/gfunction/gfunction.pyx":268 - * self.cuda = False + /* "View.MemoryView":261 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) + */ + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":262 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 + */ + (__pyx_v_p[__pyx_v_i]) = Py_None; + + /* "View.MemoryView":263 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 * - * if self.cuda: # <<<<<<<<<<<<<< - * self.dtype = np.float32 - * else: */ - goto __pyx_L8; - } + Py_INCREF(Py_None); + } - /* "src/gfunction/gfunction.pyx":271 - * self.dtype = np.float32 - * else: - * self.dtype = np.float64 # <<<<<<<<<<<<<< + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." * - * # always initialize the histogram to 7 dimensions, but only fill the desired ones + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __pyx_L8:; - /* "src/gfunction/gfunction.pyx":274 + /* "View.MemoryView":264 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< * - * # always initialize the histogram to 7 dimensions, but only fill the desired ones - * cdef int mode_sel = 0 # <<<<<<<<<<<<<< * - * # select the gfunctions to calculate using bitwise operators */ - __pyx_v_mode_sel = 0; + __pyx_r = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":277 + /* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * * - * # select the gfunctions to calculate using bitwise operators - * for mode in modes: # <<<<<<<<<<<<<< - * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 - * if mode == "000": mode_sel = mode_sel | 1 */ - if (likely(PyList_CheckExact(__pyx_v_modes)) || PyTuple_CheckExact(__pyx_v_modes)) { - __pyx_t_3 = __pyx_v_modes; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_modes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 277, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 277, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 277, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_7(__pyx_t_3); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 277, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_mode, __pyx_t_4); - __pyx_t_4 = 0; - /* "src/gfunction/gfunction.pyx":278 - * # select the gfunctions to calculate using bitwise operators - * for mode in modes: - * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 # <<<<<<<<<<<<<< - * if mode == "000": mode_sel = mode_sel | 1 - * if mode == "110": mode_sel = mode_sel | 2 - */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_all, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 278, __pyx_L1_error) - if (__pyx_t_1) { - __pyx_v_mode_sel = (((((((__pyx_v_mode_sel | 1) | 2) | 4) | 8) | 16) | 32) | 64); - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":279 - * for mode in modes: - * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 - * if mode == "000": mode_sel = mode_sel | 1 # <<<<<<<<<<<<<< - * if mode == "110": mode_sel = mode_sel | 2 - * if mode == "101": mode_sel = mode_sel | 4 +/* "View.MemoryView":268 + * + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_000, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 279, __pyx_L1_error) - if (__pyx_t_1) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 1); - } - /* "src/gfunction/gfunction.pyx":280 - * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 - * if mode == "000": mode_sel = mode_sel | 1 - * if mode == "110": mode_sel = mode_sel | 2 # <<<<<<<<<<<<<< - * if mode == "101": mode_sel = mode_sel | 4 - * if mode == "011": mode_sel = mode_sel | 8 - */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_110, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 280, __pyx_L1_error) - if (__pyx_t_1) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 2); - } +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); - /* "src/gfunction/gfunction.pyx":281 - * if mode == "000": mode_sel = mode_sel | 1 - * if mode == "110": mode_sel = mode_sel | 2 - * if mode == "101": mode_sel = mode_sel | 4 # <<<<<<<<<<<<<< - * if mode == "011": mode_sel = mode_sel | 8 - * if mode == "220": mode_sel = mode_sel | 16 + /* "View.MemoryView":270 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_101, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 281, __pyx_L1_error) - if (__pyx_t_1) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 4); - } + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_n_s_fortran); + __pyx_t_1 = __pyx_n_s_fortran; + } else { + __Pyx_INCREF(__pyx_n_s_c); + __pyx_t_1 = __pyx_n_s_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":282 - * if mode == "110": mode_sel = mode_sel | 2 - * if mode == "101": mode_sel = mode_sel | 4 - * if mode == "011": mode_sel = mode_sel | 8 # <<<<<<<<<<<<<< - * if mode == "220": mode_sel = mode_sel | 16 - * if mode == "202": mode_sel = mode_sel | 32 + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_011, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 282, __pyx_L1_error) - if (__pyx_t_1) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 8); - } + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":283 - * if mode == "101": mode_sel = mode_sel | 4 - * if mode == "011": mode_sel = mode_sel | 8 - * if mode == "220": mode_sel = mode_sel | 16 # <<<<<<<<<<<<<< - * if mode == "202": mode_sel = mode_sel | 32 - * if mode == "022": mode_sel = mode_sel | 64 + /* "View.MemoryView":273 + * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_220, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 283, __pyx_L1_error) - if (__pyx_t_1) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 16); - } + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/gfunction/gfunction.pyx":284 - * if mode == "011": mode_sel = mode_sel | 8 - * if mode == "220": mode_sel = mode_sel | 16 - * if mode == "202": mode_sel = mode_sel | 32 # <<<<<<<<<<<<<< - * if mode == "022": mode_sel = mode_sel | 64 + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_202, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 284, __pyx_L1_error) - if (__pyx_t_1) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 32); - } + goto __pyx_L3; + } - /* "src/gfunction/gfunction.pyx":285 - * if mode == "220": mode_sel = mode_sel | 16 - * if mode == "202": mode_sel = mode_sel | 32 - * if mode == "022": mode_sel = mode_sel | 64 # <<<<<<<<<<<<<< + /* "View.MemoryView":275 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf * - * # remember the selection */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_022, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 285, __pyx_L1_error) - if (__pyx_t_1) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 64); - } + /*else*/ { + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode)) __PYX_ERR(1, 275, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 275, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/gfunction/gfunction.pyx":277 + /* "View.MemoryView":276 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< * - * # select the gfunctions to calculate using bitwise operators - * for mode in modes: # <<<<<<<<<<<<<< - * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 - * if mode == "000": mode_sel = mode_sel | 1 + * return result */ + __pyx_v_result->data = __pyx_v_buf; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_L3:; - /* "src/gfunction/gfunction.pyx":288 + /* "View.MemoryView":278 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< * - * # remember the selection - * self.mode_sel = np.int32(mode_sel) # <<<<<<<<<<<<<< * - * # set histogram parameters */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel, __pyx_t_3) < 0) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":291 + /* "View.MemoryView":268 * - * # set histogram parameters - * self.histo_min = np.float32(histo_min) # <<<<<<<<<<<<<< - * self.histo_max = np.float32(histo_max) - * self.histo_dr = np.round(self.dtype(histo_dr),5) + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_v_histo_min) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_histo_min); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_min, __pyx_t_3) < 0) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/gfunction/gfunction.pyx":292 - * # set histogram parameters - * self.histo_min = np.float32(histo_min) - * self.histo_max = np.float32(histo_max) # <<<<<<<<<<<<<< - * self.histo_dr = np.round(self.dtype(histo_dr),5) - * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_v_histo_max) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_histo_max); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_max, __pyx_t_3) < 0) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":293 - * self.histo_min = np.float32(histo_min) - * self.histo_max = np.float32(histo_max) - * self.histo_dr = np.round(self.dtype(histo_dr),5) # <<<<<<<<<<<<<< - * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) - * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) +/* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_round); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); + +/* Python wrapper */ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 304, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 304, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } + __pyx_v_name = values[0]; } - __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_v_histo_dr) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_histo_dr); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_11 = 1; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 304, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_int_5}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_int_5}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif + __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* function exit code */ { - __pyx_t_10 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_11, __pyx_t_8); - __Pyx_INCREF(__pyx_int_5); - __Pyx_GIVEREF(__pyx_int_5); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_11, __pyx_int_5); - __pyx_t_8 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr, __pyx_t_3) < 0) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":294 - * self.histo_max = np.float32(histo_max) - * self.histo_dr = np.round(self.dtype(histo_dr),5) - * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) # <<<<<<<<<<<<<< - * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) - * +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "View.MemoryView":305 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_0, __pyx_t_10, 1.0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr, __pyx_t_3) < 0) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; - /* "src/gfunction/gfunction.pyx":295 - * self.histo_dr = np.round(self.dtype(histo_dr),5) - * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) - * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) # <<<<<<<<<<<<<< - * - * self.box_dim = np.zeros(6,dtype=self.dtype) + /* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_v_histo_max, __pyx_v_histo_min); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_histo_dr); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyFloat_AddObjC(__pyx_t_10, __pyx_float_0_5, 0.5, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_n, __pyx_t_3) < 0) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/gfunction/gfunction.pyx":297 - * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name * - * self.box_dim = np.zeros(6,dtype=self.dtype) # <<<<<<<<<<<<<< - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 297, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__3, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_box_dim, __pyx_t_4) < 0) __PYX_ERR(0, 297, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/gfunction/gfunction.pyx":298 - * - * self.box_dim = np.zeros(6,dtype=self.dtype) - * self.box_dim[0] = box_x # <<<<<<<<<<<<<< - * self.box_dim[3] = box_x/2.0 - * if box_y: +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":307 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< + * + * cdef generic = Enum("") */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(__Pyx_SetItemInt(__pyx_t_4, 0, __pyx_v_box_x, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 298, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":299 - * self.box_dim = np.zeros(6,dtype=self.dtype) - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 # <<<<<<<<<<<<<< - * if box_y: - * self.box_dim[1] = box_y + /* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * */ - __pyx_t_4 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_x, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_SetItemInt(__pyx_t_3, 3, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/gfunction/gfunction.pyx":300 - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 - * if box_y: # <<<<<<<<<<<<<< - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_box_y); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 300, __pyx_L1_error) - if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":301 - * self.box_dim[3] = box_x/2.0 - * if box_y: - * self.box_dim[1] = box_y # <<<<<<<<<<<<<< - * self.box_dim[4] = box_y/2.0 - * else: +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(__Pyx_SetItemInt(__pyx_t_4, 1, __pyx_v_box_y, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":302 - * if box_y: - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 # <<<<<<<<<<<<<< - * else: - * self.box_dim[1] = self.box_dim[0] + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) */ - __pyx_t_4 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_y, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_SetItemInt(__pyx_t_3, 4, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":300 - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 - * if box_y: # <<<<<<<<<<<<<< - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - goto __pyx_L19; - } + __pyx_t_2 = (__pyx_v__dict != Py_None); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":304 - * self.box_dim[4] = box_y/2.0 - * else: - * self.box_dim[1] = self.box_dim[0] # <<<<<<<<<<<<<< - * self.box_dim[4] = self.box_dim[3] - * if box_z: + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(__Pyx_SetItemInt(__pyx_t_4, 1, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "src/gfunction/gfunction.pyx":305 - * else: - * self.box_dim[1] = self.box_dim[0] - * self.box_dim[4] = self.box_dim[3] # <<<<<<<<<<<<<< - * if box_z: - * self.box_dim[2] = box_z + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.name is not None */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_SetItemInt(__pyx_t_3, 4, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True + */ + goto __pyx_L3; } - __pyx_L19:; - /* "src/gfunction/gfunction.pyx":306 - * self.box_dim[1] = self.box_dim[0] - * self.box_dim[4] = self.box_dim[3] - * if box_z: # <<<<<<<<<<<<<< - * self.box_dim[2] = box_z - * self.box_dim[5] = box_z/2.0 + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = self.name is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_box_z); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 306, __pyx_L1_error) - if (__pyx_t_1) { + /*else*/ { + __pyx_t_2 = (__pyx_v_self->name != Py_None); + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; - /* "src/gfunction/gfunction.pyx":307 - * self.box_dim[4] = self.box_dim[3] - * if box_z: - * self.box_dim[2] = box_z # <<<<<<<<<<<<<< - * self.box_dim[5] = box_z/2.0 - * else: + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(__Pyx_SetItemInt(__pyx_t_4, 2, __pyx_v_box_z, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_v_use_setstate) { - /* "src/gfunction/gfunction.pyx":308 - * if box_z: - * self.box_dim[2] = box_z - * self.box_dim[5] = box_z/2.0 # <<<<<<<<<<<<<< - * else: - * self.box_dim[2] = self.box_dim[0] + /* "(tree fragment)":13 + * use_setstate = self.name is not None + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) */ - __pyx_t_4 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_z, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_SetItemInt(__pyx_t_3, 5, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":306 - * self.box_dim[1] = self.box_dim[0] - * self.box_dim[4] = self.box_dim[3] - * if box_z: # <<<<<<<<<<<<<< - * self.box_dim[2] = box_z - * self.box_dim[5] = box_z/2.0 + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: */ - goto __pyx_L20; } - /* "src/gfunction/gfunction.pyx":310 - * self.box_dim[5] = box_z/2.0 - * else: - * self.box_dim[2] = self.box_dim[0] # <<<<<<<<<<<<<< - * self.box_dim[5] = self.box_dim[3] - * + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(__Pyx_SetItemInt(__pyx_t_4, 2, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/gfunction/gfunction.pyx":311 - * else: - * self.box_dim[2] = self.box_dim[0] - * self.box_dim[5] = self.box_dim[3] # <<<<<<<<<<<<<< - * - * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_SetItemInt(__pyx_t_3, 5, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; } - __pyx_L20:; - /* "src/gfunction/gfunction.pyx":313 - * self.box_dim[5] = self.box_dim[3] - * - * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] # <<<<<<<<<<<<<< - * - * # remember volume for each frame for normalisation + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_8, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_volume, __pyx_t_8) < 0) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/gfunction/gfunction.pyx":316 - * - * # remember volume for each frame for normalisation - * self.volume_list = [] # <<<<<<<<<<<<<< - * - * self.norm_volume = norm_volume - */ - __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_volume_list, __pyx_t_8) < 0) __PYX_ERR(0, 316, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":318 - * self.volume_list = [] - * - * self.norm_volume = norm_volume # <<<<<<<<<<<<<< - * - * # set particle numbers +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume, __pyx_v_norm_volume) < 0) __PYX_ERR(0, 318, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":321 - * - * # set particle numbers - * self.n1 = np.int32(sel1_n) # <<<<<<<<<<<<<< - * self.n2 = np.int32(sel2_n) - * self.nmol1 = sel1_nmol - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 16, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } + __pyx_v___pyx_state = values[0]; } - __pyx_t_8 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_sel1_n) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_sel1_n); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n1, __pyx_t_8) < 0) __PYX_ERR(0, 321, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state); - /* "src/gfunction/gfunction.pyx":322 - * # set particle numbers - * self.n1 = np.int32(sel1_n) - * self.n2 = np.int32(sel2_n) # <<<<<<<<<<<<<< - * self.nmol1 = sel1_nmol - * self.nmol2 = sel2_nmol - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_sel2_n) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_sel2_n); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 322, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n2, __pyx_t_8) < 0) __PYX_ERR(0, 322, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":323 - * self.n1 = np.int32(sel1_n) - * self.n2 = np.int32(sel2_n) - * self.nmol1 = sel1_nmol # <<<<<<<<<<<<<< - * self.nmol2 = sel2_nmol - * - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nmol1, __pyx_v_sel1_nmol) < 0) __PYX_ERR(0, 323, __pyx_L1_error) +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/gfunction/gfunction.pyx":324 - * self.n2 = np.int32(sel2_n) - * self.nmol1 = sel1_nmol - * self.nmol2 = sel2_nmol # <<<<<<<<<<<<<< - * - * self.oneistwo = None + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nmol2, __pyx_v_sel2_nmol) < 0) __PYX_ERR(0, 324, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":326 - * self.nmol2 = sel2_nmol - * - * self.oneistwo = None # <<<<<<<<<<<<<< - * - * # set frame counter to 0 + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_None) < 0) __PYX_ERR(0, 326, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":329 - * - * # set frame counter to 0 - * self.ctr = 0 # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo * - * # initialize histogram array + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ctr, __pyx_int_0) < 0) __PYX_ERR(0, 329, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":332 - * - * # initialize histogram array - * self.histogram = np.zeros(self.n1*self.histo_n*7,dtype=self.dtype) # <<<<<<<<<<<<<< - * self.histogram_out = np.zeros(self.histo_n*7,dtype=np.float64) +/* Python wrapper */ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 349, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 349, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype_is_object); + if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 349, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 349, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "View.MemoryView":350 * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyNumber_Multiply(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Multiply(__pyx_t_10, __pyx_int_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histogram, __pyx_t_8) < 0) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; - /* "src/gfunction/gfunction.pyx":333 - * # initialize histogram array - * self.histogram = np.zeros(self.n1*self.histo_n*7,dtype=self.dtype) - * self.histogram_out = np.zeros(self.histo_n*7,dtype=np.float64) # <<<<<<<<<<<<<< - * - * # print, if CUDA device will be used and initialize arrays + /* "View.MemoryView":351 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = PyNumber_Multiply(__pyx_t_8, __pyx_int_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out, __pyx_t_9) < 0) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_self->flags = __pyx_v_flags; - /* "src/gfunction/gfunction.pyx":336 - * - * # print, if CUDA device will be used and initialize arrays - * if self.cuda and use_cuda: # <<<<<<<<<<<<<< - * # initialize gpu arrays - * + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 336, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 336, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_5) { + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); + if (!__pyx_t_2) { } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L22_bool_binop_done; + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; } - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_use_cuda); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 336, __pyx_L1_error) - __pyx_t_1 = __pyx_t_5; - __pyx_L22_bool_binop_done:; + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":339 - * # initialize gpu arrays + /* "View.MemoryView":353 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + */ + __pyx_t_3 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 353, __pyx_L1_error) + + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) + */ + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":355 + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) * - * self.histo_gpu=cu.drv.mem_alloc(self.histogram.nbytes) # <<<<<<<<<<<<<< - * cu.drv.memcpy_htod(self.histo_gpu, self.histogram) + */ + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + + /* "View.MemoryView":356 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + */ + Py_INCREF(Py_None); + + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_cu); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_drv); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } } - __pyx_t_9 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_gpu, __pyx_t_9) < 0) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":340 - * - * self.histo_gpu=cu.drv.mem_alloc(self.histogram.nbytes) - * cu.drv.memcpy_htod(self.histo_gpu, self.histogram) # <<<<<<<<<<<<<< + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + */ + } + + /* "View.MemoryView":358 + * Py_INCREF(Py_None) * - * self.box_dim_gpu=cu.drv.mem_alloc(self.box_dim.nbytes) + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + */ + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { + + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + */ + __pyx_t_1 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_1) { + + /* "View.MemoryView":361 + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + */ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":362 + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + */ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_cu); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_drv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_gpu); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_8}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_8}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_8); - __pyx_t_4 = 0; - __pyx_t_8 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":342 - * cu.drv.memcpy_htod(self.histo_gpu, self.histogram) - * - * self.box_dim_gpu=cu.drv.mem_alloc(self.box_dim.nbytes) # <<<<<<<<<<<<<< - * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + */ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":364 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError + */ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError * */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_cu); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_drv); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - __pyx_t_9 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_12, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_box_dim_gpu, __pyx_t_9) < 0) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { - /* "src/gfunction/gfunction.pyx":343 + /* "View.MemoryView":366 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< * - * self.box_dim_gpu=cu.drv.mem_alloc(self.box_dim.nbytes) - * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) # <<<<<<<<<<<<<< + * if flags & PyBUF_FORMAT: + */ + PyErr_NoMemory(); __PYX_ERR(1, 366, __pyx_L1_error) + + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError * - * arr_sel1 = np.zeros((self.n1,3),dtype=np.float32) */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_cu); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_drv); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim_gpu); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_4 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - __pyx_t_11 = 1; } + + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + */ } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_8, __pyx_t_12}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_8, __pyx_t_12}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - #endif - { - __pyx_t_3 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_t_12); - __pyx_t_8 = 0; - __pyx_t_12 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_3, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":345 - * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) + /* "View.MemoryView":358 + * Py_INCREF(Py_None) * - * arr_sel1 = np.zeros((self.n1,3),dtype=np.float32) # <<<<<<<<<<<<<< - * arr_sel2 = np.zeros((self.n2,3),dtype=np.float32) - * self.coor_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3); - __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_arr_sel1 = __pyx_t_8; - __pyx_t_8 = 0; + } - /* "src/gfunction/gfunction.pyx":346 + /* "View.MemoryView":368 + * raise MemoryError * - * arr_sel1 = np.zeros((self.n1,3),dtype=np.float32) - * arr_sel2 = np.zeros((self.n2,3),dtype=np.float32) # <<<<<<<<<<<<<< - * self.coor_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) - * self.coor_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_3); - __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float32); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_12) < 0) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_arr_sel2 = __pyx_t_12; - __pyx_t_12 = 0; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":347 - * arr_sel1 = np.zeros((self.n1,3),dtype=np.float32) - * arr_sel2 = np.zeros((self.n2,3),dtype=np.float32) - * self.coor_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) # <<<<<<<<<<<<<< - * self.coor_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) + /* "View.MemoryView":369 * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_cu); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_drv); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr_sel1, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L12_bool_binop_done; } - __pyx_t_12 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel1_gpu, __pyx_t_12) < 0) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L12_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":348 - * arr_sel2 = np.zeros((self.n2,3),dtype=np.float32) - * self.coor_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) - * self.coor_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) # <<<<<<<<<<<<<< - * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_cu); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 348, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_drv); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 348, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 348, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr_sel2, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 348, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_12 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 348, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel2_gpu, __pyx_t_12) < 0) __PYX_ERR(0, 348, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - - /* "src/gfunction/gfunction.pyx":350 - * self.coor_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) - * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< - * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - */ - __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L25_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 4) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L25_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L25_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 32) != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L25_bool_binop_done:; - if (__pyx_t_1) { - - /* "src/gfunction/gfunction.pyx":351 - * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) # <<<<<<<<<<<<<< - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - * self.dip_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) - */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_cu); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_drv); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr_sel1, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_12 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel1_gpu, __pyx_t_12) < 0) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - - /* "src/gfunction/gfunction.pyx":350 - * self.coor_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) - * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< - * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - */ - } - - /* "src/gfunction/gfunction.pyx":352 - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< - * self.dip_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) + /* "View.MemoryView":368 + * raise MemoryError * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: */ - __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L30_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 8) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L30_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_1 = __pyx_t_5; - goto __pyx_L30_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 64) != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L30_bool_binop_done:; - if (__pyx_t_1) { + goto __pyx_L11; + } - /* "src/gfunction/gfunction.pyx":353 - * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - * self.dip_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) # <<<<<<<<<<<<<< + /* "View.MemoryView":371 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< * - * # set gpu block and grid + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_cu); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_drv); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr_sel2, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_12 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel2_gpu, __pyx_t_12) < 0) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L11:; - /* "src/gfunction/gfunction.pyx":352 - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< - * self.dip_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) + /* "View.MemoryView":373 + * self.dtype_is_object = dtype_is_object * - */ - } - - /* "src/gfunction/gfunction.pyx":356 + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL * - * # set gpu block and grid - * block_x = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 # <<<<<<<<<<<<<< - * block_y = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 - * block_z = 1 - */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_cu); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_dev); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_get_attribute); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_cu); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_drv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_device_attribute); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_MULTIPROCESSOR_COUNT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_12 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Multiply(__pyx_t_12, __pyx_int_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_v_block_x = __pyx_t_9; - __pyx_t_9 = 0; - - /* "src/gfunction/gfunction.pyx":357 - * # set gpu block and grid - * block_x = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 - * block_y = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 # <<<<<<<<<<<<<< - * block_z = 1 - * grid_x = int(self.n1/block_x) - */ - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_cu); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_dev); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_attribute); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_cu); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_drv); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_device_attribute); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_MULTIPROCESSOR_COUNT); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - } - } - __pyx_t_9 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyNumber_Multiply(__pyx_t_9, __pyx_int_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_block_y = __pyx_t_12; - __pyx_t_12 = 0; - - /* "src/gfunction/gfunction.pyx":358 - * block_x = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 - * block_y = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 - * block_z = 1 # <<<<<<<<<<<<<< - * grid_x = int(self.n1/block_x) - * if self.n1%block_x: grid_x+=1 - */ - __pyx_v_block_z = 1; - - /* "src/gfunction/gfunction.pyx":359 - * block_y = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 - * block_z = 1 - * grid_x = int(self.n1/block_x) # <<<<<<<<<<<<<< - * if self.n1%block_x: grid_x+=1 - * grid_y = int(self.n2/block_y) - */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_12, __pyx_v_block_x); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_grid_x = __pyx_t_12; - __pyx_t_12 = 0; - - /* "src/gfunction/gfunction.pyx":360 - * block_z = 1 - * grid_x = int(self.n1/block_x) - * if self.n1%block_x: grid_x+=1 # <<<<<<<<<<<<<< - * grid_y = int(self.n2/block_y) - * if self.n2%block_y: grid_y+=1 */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 360, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_9 = PyNumber_Remainder(__pyx_t_12, __pyx_v_block_x); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 360, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 360, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_1) { - __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_v_grid_x, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 360, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF_SET(__pyx_v_grid_x, __pyx_t_9); - __pyx_t_9 = 0; + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 373, __pyx_L1_error) } - - /* "src/gfunction/gfunction.pyx":361 - * grid_x = int(self.n1/block_x) - * if self.n1%block_x: grid_x+=1 - * grid_y = int(self.n2/block_y) # <<<<<<<<<<<<<< - * if self.n2%block_y: grid_y+=1 - * self.block=(block_x,block_y,block_z) - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 361, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_12 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_v_block_y); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 361, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 361, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_v_grid_y = __pyx_t_9; - __pyx_t_9 = 0; - - /* "src/gfunction/gfunction.pyx":362 - * if self.n1%block_x: grid_x+=1 - * grid_y = int(self.n2/block_y) - * if self.n2%block_y: grid_y+=1 # <<<<<<<<<<<<<< - * self.block=(block_x,block_y,block_z) - * self.grid=(grid_x,grid_y) - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 362, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_12 = PyNumber_Remainder(__pyx_t_9, __pyx_v_block_y); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 362, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 362, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (__pyx_t_1) { - __pyx_t_12 = __Pyx_PyInt_AddObjC(__pyx_v_grid_y, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 362, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF_SET(__pyx_v_grid_y, __pyx_t_12); - __pyx_t_12 = 0; + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 373, __pyx_L1_error) } + } + #else + if ((1)); else __PYX_ERR(1, 373, __pyx_L1_error) + #endif - /* "src/gfunction/gfunction.pyx":363 - * grid_y = int(self.n2/block_y) - * if self.n2%block_y: grid_y+=1 - * self.block=(block_x,block_y,block_z) # <<<<<<<<<<<<<< - * self.grid=(grid_x,grid_y) - * - */ - __pyx_t_12 = __Pyx_PyInt_From_long(__pyx_v_block_z); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_block_x); - __Pyx_GIVEREF(__pyx_v_block_x); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_block_x); - __Pyx_INCREF(__pyx_v_block_y); - __Pyx_GIVEREF(__pyx_v_block_y); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_block_y); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_12); - __pyx_t_12 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_block, __pyx_t_9) < 0) __PYX_ERR(0, 363, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "src/gfunction/gfunction.pyx":364 - * if self.n2%block_y: grid_y+=1 - * self.block=(block_x,block_y,block_z) - * self.grid=(grid_x,grid_y) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_grid_x); - __Pyx_GIVEREF(__pyx_v_grid_x); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_grid_x); - __Pyx_INCREF(__pyx_v_grid_y); - __Pyx_GIVEREF(__pyx_v_grid_y); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_grid_y); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_grid, __pyx_t_9) < 0) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "src/gfunction/gfunction.pyx":336 + /* "View.MemoryView":374 * - * # print, if CUDA device will be used and initialize arrays - * if self.cuda and use_cuda: # <<<<<<<<<<<<<< - * # initialize gpu arrays + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< * + * def __dealloc__(memoryview self): */ - } + __pyx_v_self->typeinfo = NULL; - /* "src/gfunction/gfunction.pyx":234 - * """ + /* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo * - * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False, norm_volume=None): # <<<<<<<<<<<<<< - * """ - * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("newanalysis.gfunction.RDF.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_mode); - __Pyx_XDECREF(__pyx_v_arr_sel1); - __Pyx_XDECREF(__pyx_v_arr_sel2); - __Pyx_XDECREF(__pyx_v_block_x); - __Pyx_XDECREF(__pyx_v_block_y); - __Pyx_XDECREF(__pyx_v_grid_x); - __Pyx_XDECREF(__pyx_v_grid_y); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/gfunction/gfunction.pyx":367 - * +/* "View.MemoryView":376 + * self.typeinfo = NULL * - * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< - * """ - * update_box(box_x,box_y,box_z) + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_3update_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_3RDF_2update_box[] = "\n update_box(box_x,box_y,box_z)\n\n Update the box dimensions, when analysing NpT trajectories.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_3update_box = {"update_box", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_3update_box, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF_2update_box}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_3update_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_box_x = 0; - PyObject *__pyx_v_box_y = 0; - PyObject *__pyx_v_box_z = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("update_box (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_box_x,&__pyx_n_s_box_y,&__pyx_n_s_box_z,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_x)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 1); __PYX_ERR(0, 367, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_y)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 2); __PYX_ERR(0, 367, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_z)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 3); __PYX_ERR(0, 367, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_box") < 0)) __PYX_ERR(0, 367, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_self = values[0]; - __pyx_v_box_x = values[1]; - __pyx_v_box_y = values[2]; - __pyx_v_box_z = values[3]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 367, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF.update_box", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_2update_box(__pyx_self, __pyx_v_self, __pyx_v_box_x, __pyx_v_box_y, __pyx_v_box_z); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_2update_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z) { - PyObject *__pyx_r = NULL; +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("update_box", 0); - - /* "src/gfunction/gfunction.pyx":373 - * Update the box dimensions, when analysing NpT trajectories. - * """ - * self.box_dim[0] = box_x # <<<<<<<<<<<<<< - * self.box_dim[3] = box_x/2.0 - * self.box_dim[1] = box_y - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_t_1, 0, __pyx_v_box_x, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "src/gfunction/gfunction.pyx":374 - * """ - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 # <<<<<<<<<<<<<< - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 + /* "View.MemoryView":377 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - __pyx_t_1 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_x, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":375 - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 - * self.box_dim[1] = box_y # <<<<<<<<<<<<<< - * self.box_dim[4] = box_y/2.0 - * self.box_dim[2] = box_z + /* "View.MemoryView":378 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_t_1, 1, __pyx_v_box_y, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 375, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_ReleaseBuffer((&__pyx_v_self->view)); - /* "src/gfunction/gfunction.pyx":376 - * self.box_dim[3] = box_x/2.0 - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 # <<<<<<<<<<<<<< - * self.box_dim[2] = box_z - * self.box_dim[5] = box_z/2.0 + /* "View.MemoryView":377 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - __pyx_t_1 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_y, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 376, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } - /* "src/gfunction/gfunction.pyx":377 - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 - * self.box_dim[2] = box_z # <<<<<<<<<<<<<< - * self.box_dim[5] = box_z/2.0 + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * + * (<__pyx_buffer *> &self.view).obj = NULL */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_t_1, 2, __pyx_v_box_z, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 377, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":378 - * self.box_dim[4] = box_y/2.0 - * self.box_dim[2] = box_z - * self.box_dim[5] = box_z/2.0 # <<<<<<<<<<<<<< + /* "View.MemoryView":381 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) * - * if self.cuda: */ - __pyx_t_1 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_z, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 5, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; - /* "src/gfunction/gfunction.pyx":380 - * self.box_dim[5] = box_z/2.0 + /* "View.MemoryView":382 * - * if self.cuda: # <<<<<<<<<<<<<< - * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< * + * cdef int i */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { + Py_DECREF(Py_None); - /* "src/gfunction/gfunction.pyx":381 - * - * if self.cuda: - * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) # <<<<<<<<<<<<<< + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * - * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] + * (<__pyx_buffer *> &self.view).obj = NULL + */ + } + __pyx_L3:; + + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + */ + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":387 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + */ + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + */ + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { + + /* "View.MemoryView":389 + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + */ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + */ + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { + + /* "View.MemoryView":392 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: + */ + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + + /* "View.MemoryView":391 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break + */ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; + + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + */ + } + + /* "View.MemoryView":393 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) + */ + goto __pyx_L6_break; + + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cu); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_drv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim_gpu); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*else*/ { - /* "src/gfunction/gfunction.pyx":380 - * self.box_dim[5] = box_z/2.0 - * - * if self.cuda: # <<<<<<<<<<<<<< - * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) + /* "View.MemoryView":395 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: */ - } + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; - /* "src/gfunction/gfunction.pyx":383 - * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) - * - * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] # <<<<<<<<<<<<<< - * - * def calcFrame(self, + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_volume, __pyx_t_8) < 0) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } - /* "src/gfunction/gfunction.pyx":367 - * + /* "View.MemoryView":376 + * self.typeinfo = NULL * - * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< - * """ - * update_box(box_x,box_y,box_z) + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("newanalysis.gfunction.RDF.update_box", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "src/gfunction/gfunction.pyx":385 - * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] +/* "View.MemoryView":397 + * PyThread_free_lock(self.lock) * - * def calcFrame(self, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_5calcFrame(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_3RDF_4calcFrame[] = "\n calcFrame(coor_sel1, coor_sel2, dip_sel1=None, dip_sel2=None,\n pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, \n pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None)\n\n Args:\n coor_sel1 .. numpy-array (dtype=numpy.float64, ndim=2, mode=\"c\") containing the coordinates of the first selection\n coor_sel2 .. numpy-array containing the coordinates of the second selection\n dip_sel1 .. numpy-array containing the dipoles of the first selection (optional, only needed for 110, 101, 220 and 202)\n dip_sel2 .. numpy-array containing the dipoles of the second selection (optional, only needed for 110, 011, 220 and 022)\n\n pre-allocated arrays: PyCUDA GPU array objects obtained from drv.memalloc()\n\n Pass the data needed to calculate the RDF for the current frame and do the calculation.\n Optionally, pre-allocated arrays on the GPU can be used. This is useful, if they are reused for more than\n one rdf calculation.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_5calcFrame = {"calcFrame", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_5calcFrame, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF_4calcFrame}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_5calcFrame(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyArrayObject *__pyx_v_coor_sel1 = 0; - PyArrayObject *__pyx_v_coor_sel2 = 0; - PyArrayObject *__pyx_v_dip_sel1 = 0; - PyArrayObject *__pyx_v_dip_sel2 = 0; - PyObject *__pyx_v_pre_coor_sel1_gpu = 0; - PyObject *__pyx_v_pre_coor_sel2_gpu = 0; - PyObject *__pyx_v_pre_dip_sel1_gpu = 0; - PyObject *__pyx_v_pre_dip_sel2_gpu = 0; +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcFrame (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_coor_sel1,&__pyx_n_s_coor_sel2,&__pyx_n_s_dip_sel1,&__pyx_n_s_dip_sel2,&__pyx_n_s_pre_coor_sel1_gpu,&__pyx_n_s_pre_coor_sel2_gpu,&__pyx_n_s_pre_dip_sel1_gpu,&__pyx_n_s_pre_dip_sel2_gpu,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - - /* "src/gfunction/gfunction.pyx":388 - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, - * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, - */ - values[3] = (PyObject *)((PyArrayObject *)((PyObject *)Py_None)); - - /* "src/gfunction/gfunction.pyx":389 - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, # <<<<<<<<<<<<<< - * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, - * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): - */ - values[4] = (PyObject *)((PyArrayObject *)((PyObject *)Py_None)); + __Pyx_RefNannySetupContext("get_item_pointer", 0); - /* "src/gfunction/gfunction.pyx":390 - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, - * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, # <<<<<<<<<<<<<< - * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): - * """ + /* "View.MemoryView":399 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + * + * for dim, idx in enumerate(index): */ - values[5] = ((PyObject *)((PyObject *)Py_None)); - values[6] = ((PyObject *)((PyObject *)Py_None)); + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - /* "src/gfunction/gfunction.pyx":391 - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, - * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, - * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): # <<<<<<<<<<<<<< - * """ - * calcFrame(coor_sel1, coor_sel2, dip_sel1=None, dip_sel2=None, + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * */ - values[7] = ((PyObject *)((PyObject *)Py_None)); - values[8] = ((PyObject *)((PyObject *)Py_None)); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_sel1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 3, 9, 1); __PYX_ERR(0, 385, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_sel2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 3, 9, 2); __PYX_ERR(0, 385, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_sel1); - if (value) { values[3] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_sel2); - if (value) { values[4] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 5: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_coor_sel1_gpu); - if (value) { values[5] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 6: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_coor_sel2_gpu); - if (value) { values[6] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 7: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_dip_sel1_gpu); - if (value) { values[7] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 8: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_dip_sel2_gpu); - if (value) { values[8] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcFrame") < 0)) __PYX_ERR(0, 385, __pyx_L3_error) + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 401, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 401, __pyx_L1_error) + } break; - default: goto __pyx_L5_argtuple_error; } + __Pyx_GOTREF(__pyx_t_5); } - __pyx_v_self = values[0]; - __pyx_v_coor_sel1 = ((PyArrayObject *)values[1]); - __pyx_v_coor_sel2 = ((PyArrayObject *)values[2]); - __pyx_v_dip_sel1 = ((PyArrayObject *)values[3]); - __pyx_v_dip_sel2 = ((PyArrayObject *)values[4]); - __pyx_v_pre_coor_sel1_gpu = values[5]; - __pyx_v_pre_coor_sel2_gpu = values[6]; - __pyx_v_pre_dip_sel1_gpu = values[7]; - __pyx_v_pre_dip_sel2_gpu = values[8]; + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); + + /* "View.MemoryView":402 + * + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * + * return itemp + */ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; + + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + */ } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 385, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF.calcFrame", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_sel1), __pyx_ptype_5numpy_ndarray, 1, "coor_sel1", 0))) __PYX_ERR(0, 386, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_sel2), __pyx_ptype_5numpy_ndarray, 1, "coor_sel2", 0))) __PYX_ERR(0, 387, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dip_sel1), __pyx_ptype_5numpy_ndarray, 1, "dip_sel1", 0))) __PYX_ERR(0, 388, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dip_sel2), __pyx_ptype_5numpy_ndarray, 1, "dip_sel2", 0))) __PYX_ERR(0, 389, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_4calcFrame(__pyx_self, __pyx_v_self, __pyx_v_coor_sel1, __pyx_v_coor_sel2, __pyx_v_dip_sel1, __pyx_v_dip_sel2, __pyx_v_pre_coor_sel1_gpu, __pyx_v_pre_coor_sel2_gpu, __pyx_v_pre_dip_sel1_gpu, __pyx_v_pre_dip_sel2_gpu); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/gfunction/gfunction.pyx":385 - * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] + /* "View.MemoryView":404 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * - * def calcFrame(self, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, + * return itemp # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_itemp; + goto __pyx_L0; + + /* "View.MemoryView":397 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_idx); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_4calcFrame(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_coor_sel1, PyArrayObject *__pyx_v_coor_sel2, PyArrayObject *__pyx_v_dip_sel1, PyArrayObject *__pyx_v_dip_sel2, PyObject *__pyx_v_pre_coor_sel1_gpu, PyObject *__pyx_v_pre_coor_sel2_gpu, PyObject *__pyx_v_pre_dip_sel1_gpu, PyObject *__pyx_v_pre_dip_sel2_gpu) { - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_sel1; - __Pyx_Buffer __pyx_pybuffer_coor_sel1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_sel2; - __Pyx_Buffer __pyx_pybuffer_coor_sel2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_dip_sel1; - __Pyx_Buffer __pyx_pybuffer_dip_sel1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_dip_sel2; - __Pyx_Buffer __pyx_pybuffer_dip_sel2; +/* "View.MemoryView":407 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self + */ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - PyObject *__pyx_t_23 = NULL; - PyObject *__pyx_t_24 = NULL; - int __pyx_t_25; - float __pyx_t_26; - float __pyx_t_27; - int __pyx_t_28; - double __pyx_t_29; - int __pyx_t_30; + char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcFrame", 0); - __pyx_pybuffer_coor_sel1.pybuffer.buf = NULL; - __pyx_pybuffer_coor_sel1.refcount = 0; - __pyx_pybuffernd_coor_sel1.data = NULL; - __pyx_pybuffernd_coor_sel1.rcbuffer = &__pyx_pybuffer_coor_sel1; - __pyx_pybuffer_coor_sel2.pybuffer.buf = NULL; - __pyx_pybuffer_coor_sel2.refcount = 0; - __pyx_pybuffernd_coor_sel2.data = NULL; - __pyx_pybuffernd_coor_sel2.rcbuffer = &__pyx_pybuffer_coor_sel2; - __pyx_pybuffer_dip_sel1.pybuffer.buf = NULL; - __pyx_pybuffer_dip_sel1.refcount = 0; - __pyx_pybuffernd_dip_sel1.data = NULL; - __pyx_pybuffernd_dip_sel1.rcbuffer = &__pyx_pybuffer_dip_sel1; - __pyx_pybuffer_dip_sel2.pybuffer.buf = NULL; - __pyx_pybuffer_dip_sel2.refcount = 0; - __pyx_pybuffernd_dip_sel2.data = NULL; - __pyx_pybuffernd_dip_sel2.rcbuffer = &__pyx_pybuffer_dip_sel2; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_sel1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 385, __pyx_L1_error) - } - __pyx_pybuffernd_coor_sel1.diminfo[0].strides = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_sel1.diminfo[0].shape = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_sel1.diminfo[1].strides = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_sel1.diminfo[1].shape = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_sel2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 385, __pyx_L1_error) - } - __pyx_pybuffernd_coor_sel2.diminfo[0].strides = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_sel2.diminfo[0].shape = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_sel2.diminfo[1].strides = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_sel2.diminfo[1].shape = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer, (PyObject*)__pyx_v_dip_sel1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 385, __pyx_L1_error) - } - __pyx_pybuffernd_dip_sel1.diminfo[0].strides = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dip_sel1.diminfo[0].shape = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dip_sel1.diminfo[1].strides = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dip_sel1.diminfo[1].shape = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dip_sel2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 385, __pyx_L1_error) - } - __pyx_pybuffernd_dip_sel2.diminfo[0].strides = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dip_sel2.diminfo[0].shape = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dip_sel2.diminfo[1].strides = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dip_sel2.diminfo[1].shape = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.shape[1]; + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "src/gfunction/gfunction.pyx":411 + /* "View.MemoryView":408 * - * # Check if dipole moments are needed and, if yes, were passed - * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): # <<<<<<<<<<<<<< - * raise TypeError("No dipole moment array for the fist selection was passed, although the requested gfunctions need it!") + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self * */ - __pyx_t_2 = (((PyObject *)__pyx_v_dip_sel1) == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = ((((int)__pyx_t_5) & 2) != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = ((((int)__pyx_t_5) & 4) != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = ((((int)__pyx_t_5) & 16) != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = ((((int)__pyx_t_5) & 32) != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":412 - * # Check if dipole moments are needed and, if yes, were passed - * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): - * raise TypeError("No dipole moment array for the fist selection was passed, although the requested gfunctions need it!") # <<<<<<<<<<<<<< + /* "View.MemoryView":409 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< * - * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): + * have_slices, indices = _unellipsify(index, self.view.ndim) */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 412, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":411 + /* "View.MemoryView":408 * - * # Check if dipole moments are needed and, if yes, were passed - * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): # <<<<<<<<<<<<<< - * raise TypeError("No dipole moment array for the fist selection was passed, although the requested gfunctions need it!") + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self * */ } - /* "src/gfunction/gfunction.pyx":414 - * raise TypeError("No dipole moment array for the fist selection was passed, although the requested gfunctions need it!") + /* "View.MemoryView":411 + * return self * - * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): # <<<<<<<<<<<<<< - * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * + * cdef char *itemp */ - __pyx_t_3 = (((PyObject *)__pyx_v_dip_sel2) == Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = ((((int)__pyx_t_5) & 2) != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = ((((int)__pyx_t_5) & 8) != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = ((((int)__pyx_t_5) & 16) != 0); - if (!__pyx_t_2) { + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 411, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L10_bool_binop_done; + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 411, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = ((((int)__pyx_t_5) & 64) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L10_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; - /* "src/gfunction/gfunction.pyx":415 + /* "View.MemoryView":414 * - * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): - * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") # <<<<<<<<<<<<<< + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 414, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":415 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":414 * - * if self.oneistwo is None: + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 415, __pyx_L1_error) + } - /* "src/gfunction/gfunction.pyx":414 - * raise TypeError("No dipole moment array for the fist selection was passed, although the requested gfunctions need it!") + /* "View.MemoryView":417 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) * - * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): # <<<<<<<<<<<<<< - * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") + */ + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((char *)NULL))) __PYX_ERR(1, 417, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; + + /* "View.MemoryView":418 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< * + * def __setitem__(memoryview self, object index, object value): */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; } - /* "src/gfunction/gfunction.pyx":417 - * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") + /* "View.MemoryView":407 * - * if self.oneistwo is None: # <<<<<<<<<<<<<< - * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: - * self.oneistwo = True + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = (__pyx_t_4 == Py_None); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":418 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) * - * if self.oneistwo is None: - * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: # <<<<<<<<<<<<<< - * self.oneistwo = True - * else: + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ - __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coor_sel1), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coor_sel2), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_all); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L17_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_2 = __pyx_t_1; - __pyx_L17_bool_binop_done:; - if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":419 - * if self.oneistwo is None: - * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: - * self.oneistwo = True # <<<<<<<<<<<<<< - * else: - * self.oneistwo = False - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_True) < 0) __PYX_ERR(0, 419, __pyx_L1_error) +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); - /* "src/gfunction/gfunction.pyx":418 + /* "View.MemoryView":421 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * - * if self.oneistwo is None: - * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: # <<<<<<<<<<<<<< - * self.oneistwo = True - * else: */ - goto __pyx_L16; - } + if (unlikely(__pyx_v_self->view.readonly)) { - /* "src/gfunction/gfunction.pyx":421 - * self.oneistwo = True - * else: - * self.oneistwo = False # <<<<<<<<<<<<<< + /* "View.MemoryView":422 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< * - * # Increment frame counter + * have_slices, index = _unellipsify(index, self.view.ndim) */ - /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_False) < 0) __PYX_ERR(0, 421, __pyx_L1_error) - } - __pyx_L16:; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 422, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":417 - * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") + /* "View.MemoryView":421 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * - * if self.oneistwo is None: # <<<<<<<<<<<<<< - * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: - * self.oneistwo = True */ } - /* "src/gfunction/gfunction.pyx":424 + /* "View.MemoryView":424 + * raise TypeError, "Cannot assign to read-only memoryview" * - * # Increment frame counter - * self.ctr+=1 # <<<<<<<<<<<<<< + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * - * # add current volume to list + * if have_slices: */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_8, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ctr, __pyx_t_7) < 0) __PYX_ERR(0, 424, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 424, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 424, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; - /* "src/gfunction/gfunction.pyx":427 - * - * # add current volume to list - * self.volume_list.append(self.volume) # <<<<<<<<<<<<<< + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) * - * if self.cuda: + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 426, __pyx_L1_error) + if (__pyx_t_4) { - /* "src/gfunction/gfunction.pyx":429 - * self.volume_list.append(self.volume) + /* "View.MemoryView":427 * - * if self.cuda: # <<<<<<<<<<<<<< - * # allocate memory on cuda device and copy data to device - * if pre_coor_sel1_gpu: + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj: + * self.setitem_slice_assignment(self[index], obj) */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_2) { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":431 - * if self.cuda: - * # allocate memory on cuda device and copy data to device - * if pre_coor_sel1_gpu: # <<<<<<<<<<<<<< - * self.coor_sel1_gpu = pre_coor_sel1_gpu + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) * else: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pre_coor_sel1_gpu); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 431, __pyx_L1_error) - if (__pyx_t_2) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 428, __pyx_L1_error) + if (__pyx_t_4) { - /* "src/gfunction/gfunction.pyx":432 - * # allocate memory on cuda device and copy data to device - * if pre_coor_sel1_gpu: - * self.coor_sel1_gpu = pre_coor_sel1_gpu # <<<<<<<<<<<<<< + /* "View.MemoryView":429 + * obj = self.is_slice(value) + * if obj: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< * else: - * cu.drv.memcpy_htod(self.coor_sel1_gpu, coor_sel1.astype(np.float32)) + * self.setitem_slice_assign_scalar(self[index], value) */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel1_gpu, __pyx_v_pre_coor_sel1_gpu) < 0) __PYX_ERR(0, 432, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/gfunction/gfunction.pyx":431 - * if self.cuda: - * # allocate memory on cuda device and copy data to device - * if pre_coor_sel1_gpu: # <<<<<<<<<<<<<< - * self.coor_sel1_gpu = pre_coor_sel1_gpu + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) * else: */ - goto __pyx_L20; + goto __pyx_L5; } - /* "src/gfunction/gfunction.pyx":434 - * self.coor_sel1_gpu = pre_coor_sel1_gpu + /* "View.MemoryView":431 + * self.setitem_slice_assignment(self[index], obj) * else: - * cu.drv.memcpy_htod(self.coor_sel1_gpu, coor_sel1.astype(np.float32)) # <<<<<<<<<<<<<< - * if pre_coor_sel2_gpu: - * self.coor_sel2_gpu = pre_coor_sel2_gpu + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_cu); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_drv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel1_gpu); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_coor_sel1), __pyx_n_s_astype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float32); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - __pyx_t_6 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_12); - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_4, __pyx_t_6}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_4, __pyx_t_6}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_5, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_5, __pyx_t_6); - __pyx_t_4 = 0; - __pyx_t_6 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 431, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __pyx_L20:; + __pyx_L5:; - /* "src/gfunction/gfunction.pyx":435 - * else: - * cu.drv.memcpy_htod(self.coor_sel1_gpu, coor_sel1.astype(np.float32)) - * if pre_coor_sel2_gpu: # <<<<<<<<<<<<<< - * self.coor_sel2_gpu = pre_coor_sel2_gpu - * else: + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pre_coor_sel2_gpu); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 435, __pyx_L1_error) - if (__pyx_t_2) { + goto __pyx_L4; + } - /* "src/gfunction/gfunction.pyx":436 - * cu.drv.memcpy_htod(self.coor_sel1_gpu, coor_sel1.astype(np.float32)) - * if pre_coor_sel2_gpu: - * self.coor_sel2_gpu = pre_coor_sel2_gpu # <<<<<<<<<<<<<< - * else: - * cu.drv.memcpy_htod(self.coor_sel2_gpu, coor_sel2.astype(np.float32)) + /* "View.MemoryView":433 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + * + * cdef is_slice(self, obj): */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel2_gpu, __pyx_v_pre_coor_sel2_gpu) < 0) __PYX_ERR(0, 436, __pyx_L1_error) + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; - /* "src/gfunction/gfunction.pyx":435 - * else: - * cu.drv.memcpy_htod(self.coor_sel1_gpu, coor_sel1.astype(np.float32)) - * if pre_coor_sel2_gpu: # <<<<<<<<<<<<<< - * self.coor_sel2_gpu = pre_coor_sel2_gpu - * else: + /* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ - goto __pyx_L21; - } - /* "src/gfunction/gfunction.pyx":438 - * self.coor_sel2_gpu = pre_coor_sel2_gpu - * else: - * cu.drv.memcpy_htod(self.coor_sel2_gpu, coor_sel2.astype(np.float32)) # <<<<<<<<<<<<<< - * # if no dipole information was given, just point at the coordinates instead to keep the gpu function happy - * if dip_sel1 is not None: + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":435 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_cu); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_drv); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel2_gpu); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_coor_sel2), __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float32); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_6 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_11); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_12, __pyx_t_6}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_12, __pyx_t_6}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_5, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_5, __pyx_t_6); - __pyx_t_12 = 0; - __pyx_t_6 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __pyx_L21:; - - /* "src/gfunction/gfunction.pyx":440 - * cu.drv.memcpy_htod(self.coor_sel2_gpu, coor_sel2.astype(np.float32)) - * # if no dipole information was given, just point at the coordinates instead to keep the gpu function happy - * if dip_sel1 is not None: # <<<<<<<<<<<<<< - * if pre_dip_sel1_gpu: - * self.dip_sel1_gpu = pre_dip_sel1_gpu - */ - __pyx_t_2 = (((PyObject *)__pyx_v_dip_sel1) != Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":441 - * # if no dipole information was given, just point at the coordinates instead to keep the gpu function happy - * if dip_sel1 is not None: - * if pre_dip_sel1_gpu: # <<<<<<<<<<<<<< - * self.dip_sel1_gpu = pre_dip_sel1_gpu - * else: - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pre_dip_sel1_gpu); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 441, __pyx_L1_error) - if (__pyx_t_1) { +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); - /* "src/gfunction/gfunction.pyx":442 - * if dip_sel1 is not None: - * if pre_dip_sel1_gpu: - * self.dip_sel1_gpu = pre_dip_sel1_gpu # <<<<<<<<<<<<<< - * else: - * cu.drv.memcpy_htod(self.dip_sel1_gpu, dip_sel1.astype(np.float32)) + /* "View.MemoryView":436 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel1_gpu, __pyx_v_pre_dip_sel1_gpu) < 0) __PYX_ERR(0, 442, __pyx_L1_error) + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":441 - * # if no dipole information was given, just point at the coordinates instead to keep the gpu function happy - * if dip_sel1 is not None: - * if pre_dip_sel1_gpu: # <<<<<<<<<<<<<< - * self.dip_sel1_gpu = pre_dip_sel1_gpu - * else: + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ - goto __pyx_L23; - } + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { - /* "src/gfunction/gfunction.pyx":444 - * self.dip_sel1_gpu = pre_dip_sel1_gpu - * else: - * cu.drv.memcpy_htod(self.dip_sel1_gpu, dip_sel1.astype(np.float32)) # <<<<<<<<<<<<<< - * else: - * self.dip_sel1_gpu = self.coor_sel1_gpu + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_cu); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_drv); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel1_gpu); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dip_sel1), __pyx_n_s_astype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - } - } - __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_4, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_10); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 444, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_11, __pyx_t_6}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_11, __pyx_t_6}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12); __pyx_t_12 = NULL; - } - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_5, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_t_6); - __pyx_t_11 = 0; - __pyx_t_6 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __pyx_L23:; - - /* "src/gfunction/gfunction.pyx":440 - * cu.drv.memcpy_htod(self.coor_sel2_gpu, coor_sel2.astype(np.float32)) - * # if no dipole information was given, just point at the coordinates instead to keep the gpu function happy - * if dip_sel1 is not None: # <<<<<<<<<<<<<< - * if pre_dip_sel1_gpu: - * self.dip_sel1_gpu = pre_dip_sel1_gpu - */ - goto __pyx_L22; - } - /* "src/gfunction/gfunction.pyx":446 - * cu.drv.memcpy_htod(self.dip_sel1_gpu, dip_sel1.astype(np.float32)) - * else: - * self.dip_sel1_gpu = self.coor_sel1_gpu # <<<<<<<<<<<<<< - * if dip_sel2 is not None: - * if pre_dip_sel2_gpu: - */ - /*else*/ { - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel1_gpu); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel1_gpu, __pyx_t_8) < 0) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __pyx_L22:; - - /* "src/gfunction/gfunction.pyx":447 - * else: - * self.dip_sel1_gpu = self.coor_sel1_gpu - * if dip_sel2 is not None: # <<<<<<<<<<<<<< - * if pre_dip_sel2_gpu: - * self.dip_sel2_gpu = pre_dip_sel2_gpu + /* "View.MemoryView":439 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None */ - __pyx_t_1 = (((PyObject *)__pyx_v_dip_sel2) != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); - /* "src/gfunction/gfunction.pyx":448 - * self.dip_sel1_gpu = self.coor_sel1_gpu - * if dip_sel2 is not None: - * if pre_dip_sel2_gpu: # <<<<<<<<<<<<<< - * self.dip_sel2_gpu = pre_dip_sel2_gpu - * else: + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pre_dip_sel2_gpu); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 448, __pyx_L1_error) - if (__pyx_t_2) { + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); + __pyx_t_7 = 0; - /* "src/gfunction/gfunction.pyx":449 - * if dip_sel2 is not None: - * if pre_dip_sel2_gpu: - * self.dip_sel2_gpu = pre_dip_sel2_gpu # <<<<<<<<<<<<<< - * else: - * cu.drv.memcpy_htod(self.dip_sel2_gpu, dip_sel2.astype(np.float32)) + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel2_gpu, __pyx_v_pre_dip_sel2_gpu) < 0) __PYX_ERR(0, 449, __pyx_L1_error) + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/gfunction/gfunction.pyx":448 - * self.dip_sel1_gpu = self.coor_sel1_gpu - * if dip_sel2 is not None: - * if pre_dip_sel2_gpu: # <<<<<<<<<<<<<< - * self.dip_sel2_gpu = pre_dip_sel2_gpu - * else: + /* "View.MemoryView":440 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None + * */ - goto __pyx_L25; - } + __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); + if (__pyx_t_9) { + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 440, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); - /* "src/gfunction/gfunction.pyx":451 - * self.dip_sel2_gpu = pre_dip_sel2_gpu - * else: - * cu.drv.memcpy_htod(self.dip_sel2_gpu, dip_sel2.astype(np.float32)) # <<<<<<<<<<<<<< - * else: - * self.dip_sel2_gpu = self.coor_sel2_gpu + /* "View.MemoryView":441 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_cu); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_drv); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel2_gpu); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dip_sel2), __pyx_n_s_astype); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - } - } - __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_10, __pyx_t_6}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_10, __pyx_t_6}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_11); __pyx_t_11 = NULL; - } - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_6); - __pyx_t_10 = 0; - __pyx_t_6 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_except_return; } - __pyx_L25:; - - /* "src/gfunction/gfunction.pyx":447 - * else: - * self.dip_sel1_gpu = self.coor_sel1_gpu - * if dip_sel2 is not None: # <<<<<<<<<<<<<< - * if pre_dip_sel2_gpu: - * self.dip_sel2_gpu = pre_dip_sel2_gpu - */ - goto __pyx_L24; - } + goto __pyx_L6_except_error; - /* "src/gfunction/gfunction.pyx":453 - * cu.drv.memcpy_htod(self.dip_sel2_gpu, dip_sel2.astype(np.float32)) - * else: - * self.dip_sel2_gpu = self.coor_sel2_gpu # <<<<<<<<<<<<<< - * - * cu.calcHistoGPU(self.coor_sel1_gpu, self.coor_sel2_gpu, self.dip_sel1_gpu, self.dip_sel2_gpu, + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ - /*else*/ { - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel2_gpu); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel2_gpu, __pyx_t_8) < 0) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; } - __pyx_L24:; - /* "src/gfunction/gfunction.pyx":455 - * self.dip_sel2_gpu = self.coor_sel2_gpu + /* "View.MemoryView":436 * - * cu.calcHistoGPU(self.coor_sel1_gpu, self.coor_sel2_gpu, self.dip_sel1_gpu, self.dip_sel2_gpu, # <<<<<<<<<<<<<< - * self.histo_gpu, self.box_dim_gpu, self.n1, self.n2, self.histo_min, - * self.histo_max, self.histo_n, self.histo_inv_dr, self.mode_sel, self.block, self.grid) + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_cu); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_calcHistoGPU); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel1_gpu); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel2_gpu); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel1_gpu); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel2_gpu); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); + } - /* "src/gfunction/gfunction.pyx":456 + /* "View.MemoryView":443 + * return None * - * cu.calcHistoGPU(self.coor_sel1_gpu, self.coor_sel2_gpu, self.dip_sel1_gpu, self.dip_sel2_gpu, - * self.histo_gpu, self.box_dim_gpu, self.n1, self.n2, self.histo_min, # <<<<<<<<<<<<<< - * self.histo_max, self.histo_n, self.histo_inv_dr, self.mode_sel, self.block, self.grid) + * return obj # <<<<<<<<<<<<<< * + * cdef setitem_slice_assignment(self, dst, src): */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_gpu); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim_gpu); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":457 - * cu.calcHistoGPU(self.coor_sel1_gpu, self.coor_sel2_gpu, self.dip_sel1_gpu, self.dip_sel2_gpu, - * self.histo_gpu, self.box_dim_gpu, self.n1, self.n2, self.histo_min, - * self.histo_max, self.histo_n, self.histo_inv_dr, self.mode_sel, self.block, self.grid) # <<<<<<<<<<<<<< + /* "View.MemoryView":435 + * self.setitem_indexed(index, value) * - * else: + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ - __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_max); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_block); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_grid); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_22); - __pyx_t_23 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_23)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_23); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[16] = {__pyx_t_23, __pyx_t_7, __pyx_t_6, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 15+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[16] = {__pyx_t_23, __pyx_t_7, __pyx_t_6, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 15+__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - } else - #endif - { - __pyx_t_24 = PyTuple_New(15+__pyx_t_5); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - if (__pyx_t_23) { - __Pyx_GIVEREF(__pyx_t_23); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_23); __pyx_t_23 = NULL; - } - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_5, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_5, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_24, 2+__pyx_t_5, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_24, 3+__pyx_t_5, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_24, 4+__pyx_t_5, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_24, 5+__pyx_t_5, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_24, 6+__pyx_t_5, __pyx_t_14); - __Pyx_GIVEREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_24, 7+__pyx_t_5, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_24, 8+__pyx_t_5, __pyx_t_16); - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_24, 9+__pyx_t_5, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_24, 10+__pyx_t_5, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_19); - PyTuple_SET_ITEM(__pyx_t_24, 11+__pyx_t_5, __pyx_t_19); - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_24, 12+__pyx_t_5, __pyx_t_20); - __Pyx_GIVEREF(__pyx_t_21); - PyTuple_SET_ITEM(__pyx_t_24, 13+__pyx_t_5, __pyx_t_21); - __Pyx_GIVEREF(__pyx_t_22); - PyTuple_SET_ITEM(__pyx_t_24, 14+__pyx_t_5, __pyx_t_22); - __pyx_t_7 = 0; - __pyx_t_6 = 0; - __pyx_t_10 = 0; - __pyx_t_11 = 0; - __pyx_t_12 = 0; - __pyx_t_13 = 0; - __pyx_t_14 = 0; - __pyx_t_15 = 0; - __pyx_t_16 = 0; - __pyx_t_17 = 0; - __pyx_t_18 = 0; - __pyx_t_19 = 0; - __pyx_t_20 = 0; - __pyx_t_21 = 0; - __pyx_t_22 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_24, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/gfunction/gfunction.pyx":429 - * self.volume_list.append(self.volume) - * - * if self.cuda: # <<<<<<<<<<<<<< - * # allocate memory on cuda device and copy data to device - * if pre_coor_sel1_gpu: - */ - goto __pyx_L19; - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":460 +/* "View.MemoryView":445 + * return obj * - * else: - * calcHisto( coor_sel1.data, coor_sel2.data, # <<<<<<<<<<<<<< - * dip_sel1.data, dip_sel2.data, - * self.histogram, self.box_dim, + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ - /*else*/ { - /* "src/gfunction/gfunction.pyx":462 - * calcHisto( coor_sel1.data, coor_sel2.data, - * dip_sel1.data, dip_sel2.data, - * self.histogram, self.box_dim, # <<<<<<<<<<<<<< - * self.n1, self.n2, self.histo_min, self.histo_max, - * self.histo_n, self.histo_inv_dr, self.mode_sel) - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 462, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 462, __pyx_L1_error) +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - /* "src/gfunction/gfunction.pyx":463 - * dip_sel1.data, dip_sel2.data, - * self.histogram, self.box_dim, - * self.n1, self.n2, self.histo_min, self.histo_max, # <<<<<<<<<<<<<< - * self.histo_n, self.histo_inv_dr, self.mode_sel) + /* "View.MemoryView":448 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] * */ - __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 463, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_24); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 463, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_25 = __Pyx_PyInt_As_int(__pyx_t_24); if (unlikely((__pyx_t_25 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 463, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_26 = __pyx_PyFloat_AsFloat(__pyx_t_24); if (unlikely((__pyx_t_26 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_max); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 463, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_27 = __pyx_PyFloat_AsFloat(__pyx_t_24); if (unlikely((__pyx_t_27 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - - /* "src/gfunction/gfunction.pyx":464 - * self.histogram, self.box_dim, - * self.n1, self.n2, self.histo_min, self.histo_max, - * self.histo_n, self.histo_inv_dr, self.mode_sel) # <<<<<<<<<<<<<< + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); + + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< * - * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) */ - __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_28 = __Pyx_PyInt_As_int(__pyx_t_24); if (unlikely((__pyx_t_28 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_29 = __pyx_PyFloat_AsDouble(__pyx_t_24); if (unlikely((__pyx_t_29 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_30 = __Pyx_PyInt_As_int(__pyx_t_24); if (unlikely((__pyx_t_30 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - - /* "src/gfunction/gfunction.pyx":460 + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":451 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] * - * else: - * calcHisto( coor_sel1.data, coor_sel2.data, # <<<<<<<<<<<<<< - * dip_sel1.data, dip_sel2.data, - * self.histogram, self.box_dim, + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): */ - __pyx_f_11newanalysis_9gfunction_calcHisto(((double *)__pyx_v_coor_sel1->data), ((double *)__pyx_v_coor_sel2->data), ((double *)__pyx_v_dip_sel1->data), ((double *)__pyx_v_dip_sel2->data), ((PyArrayObject *)__pyx_t_8), ((PyArrayObject *)__pyx_t_4), __pyx_t_5, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __pyx_L19:; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 451, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":385 - * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] + /* "View.MemoryView":445 + * return obj * - * def calcFrame(self, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_19); - __Pyx_XDECREF(__pyx_t_20); - __Pyx_XDECREF(__pyx_t_21); - __Pyx_XDECREF(__pyx_t_22); - __Pyx_XDECREF(__pyx_t_23); - __Pyx_XDECREF(__pyx_t_24); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.gfunction.RDF.calcFrame", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer); - __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/gfunction/gfunction.pyx":466 - * self.histo_n, self.histo_inv_dr, self.mode_sel) +/* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) * - * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< - * """ - * Add the histograms of all core particles, after they were calculated in parallel. + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_7_addHisto(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_3RDF_6_addHisto[] = "\n Add the histograms of all core particles, after they were calculated in parallel.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_7_addHisto = {"_addHisto", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_7_addHisto, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF_6_addHisto}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_7_addHisto(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyArrayObject *__pyx_v_histo_out = 0; - PyArrayObject *__pyx_v_histo = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_addHisto (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_histo_out,&__pyx_n_s_histo,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_out)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, 1); __PYX_ERR(0, 466, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, 2); __PYX_ERR(0, 466, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_addHisto") < 0)) __PYX_ERR(0, 466, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_self = values[0]; - __pyx_v_histo_out = ((PyArrayObject *)values[1]); - __pyx_v_histo = ((PyArrayObject *)values[2]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 466, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF._addHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_histo_out), __pyx_ptype_5numpy_ndarray, 1, "histo_out", 0))) __PYX_ERR(0, 466, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_histo), __pyx_ptype_5numpy_ndarray, 1, "histo", 0))) __PYX_ERR(0, 466, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_6_addHisto(__pyx_self, __pyx_v_self, __pyx_v_histo_out, __pyx_v_histo); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_6_addHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_histo_out, PyArrayObject *__pyx_v_histo) { - int __pyx_v_histo_n; - int __pyx_v_n1; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_ix; - int __pyx_v_ix2; - double *__pyx_v_histogram_out; - double *__pyx_v_histogram; - __Pyx_LocalBuf_ND __pyx_pybuffernd_histo; - __Pyx_Buffer __pyx_pybuffer_histo; - __Pyx_LocalBuf_ND __pyx_pybuffernd_histo_out; - __Pyx_Buffer __pyx_pybuffer_histo_out; +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[0x80]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + __Pyx_memviewslice *__pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_4; int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_addHisto", 0); - __pyx_pybuffer_histo_out.pybuffer.buf = NULL; - __pyx_pybuffer_histo_out.refcount = 0; - __pyx_pybuffernd_histo_out.data = NULL; - __pyx_pybuffernd_histo_out.rcbuffer = &__pyx_pybuffer_histo_out; - __pyx_pybuffer_histo.pybuffer.buf = NULL; - __pyx_pybuffer_histo.refcount = 0; - __pyx_pybuffernd_histo.data = NULL; - __pyx_pybuffernd_histo.rcbuffer = &__pyx_pybuffer_histo; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_histo_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 466, __pyx_L1_error) - } - __pyx_pybuffernd_histo_out.diminfo[0].strides = __pyx_pybuffernd_histo_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_histo_out.diminfo[0].shape = __pyx_pybuffernd_histo_out.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_histo.rcbuffer->pybuffer, (PyObject*)__pyx_v_histo, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 466, __pyx_L1_error) - } - __pyx_pybuffernd_histo.diminfo[0].strides = __pyx_pybuffernd_histo.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_histo.diminfo[0].shape = __pyx_pybuffernd_histo.rcbuffer->pybuffer.shape[0]; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - /* "src/gfunction/gfunction.pyx":471 - * """ + /* "View.MemoryView":455 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item * - * cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n # <<<<<<<<<<<<<< - * cdef double* histogram_out = histo_out.data - * cdef double* histogram = histo.data */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_histo_n = __pyx_t_2; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_n1 = __pyx_t_2; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 471, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ix2 = __pyx_t_2; + __pyx_v_tmp = NULL; - /* "src/gfunction/gfunction.pyx":472 + /* "View.MemoryView":460 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< * - * cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n - * cdef double* histogram_out = histo_out.data # <<<<<<<<<<<<<< - * cdef double* histogram = histo.data + * if self.view.itemsize > sizeof(array): + */ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 460, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; + + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ - __pyx_v_histogram_out = ((double *)__pyx_v_histo_out->data); + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":473 - * cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n - * cdef double* histogram_out = histo_out.data - * cdef double* histogram = histo.data # <<<<<<<<<<<<<< + /* "View.MemoryView":463 * - * # add histograms + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError + */ + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp + */ + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":465 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: + */ + PyErr_NoMemory(); __PYX_ERR(1, 465, __pyx_L1_error) + + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp + */ + } + + /* "View.MemoryView":466 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array */ - __pyx_v_histogram = ((double *)__pyx_v_histo->data); + __pyx_v_item = __pyx_v_tmp; - /* "src/gfunction/gfunction.pyx":476 + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) * - * # add histograms - * for i in prange(histo_n, nogil=True): # <<<<<<<<<<<<<< - * for j in range(n1): - * ix = histo_n * j + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_2 = __pyx_v_histo_n; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_6 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_6 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_7, __pyx_t_8, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ix) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) - #endif /* _OPENMP */ - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_5); - /* Initialize private variables to invalid values */ - __pyx_v_ix = ((int)0xbad0bad0); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); + goto __pyx_L3; + } - /* "src/gfunction/gfunction.pyx":477 - * # add histograms - * for i in prange(histo_n, nogil=True): - * for j in range(n1): # <<<<<<<<<<<<<< - * ix = histo_n * j - * for k in range(7): + /* "View.MemoryView":468 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< + * + * try: */ - __pyx_t_7 = __pyx_v_n1; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_j = __pyx_t_9; + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; - /* "src/gfunction/gfunction.pyx":478 - * for i in prange(histo_n, nogil=True): - * for j in range(n1): - * ix = histo_n * j # <<<<<<<<<<<<<< - * for k in range(7): - * histogram_out[k*histo_n+i]+=histogram[k*ix2+ix+i] + /* "View.MemoryView":470 + * item = array + * + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value */ - __pyx_v_ix = (__pyx_v_histo_n * __pyx_v_j); + /*try:*/ { - /* "src/gfunction/gfunction.pyx":479 - * for j in range(n1): - * ix = histo_n * j - * for k in range(7): # <<<<<<<<<<<<<< - * histogram_out[k*histo_n+i]+=histogram[k*ix2+ix+i] + /* "View.MemoryView":471 * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - for (__pyx_t_10 = 0; __pyx_t_10 < 7; __pyx_t_10+=1) { - __pyx_v_k = __pyx_t_10; + if (__pyx_v_self->dtype_is_object) { - /* "src/gfunction/gfunction.pyx":480 - * ix = histo_n * j - * for k in range(7): - * histogram_out[k*histo_n+i]+=histogram[k*ix2+ix+i] # <<<<<<<<<<<<<< + /* "View.MemoryView":472 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) + */ + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + + /* "View.MemoryView":471 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: + */ + goto __pyx_L8; + } + + /* "View.MemoryView":474 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< * * */ - __pyx_t_11 = ((__pyx_v_k * __pyx_v_histo_n) + __pyx_v_i); - (__pyx_v_histogram_out[__pyx_t_11]) = ((__pyx_v_histogram_out[__pyx_t_11]) + (__pyx_v_histogram[(((__pyx_v_k * __pyx_v_ix2) + __pyx_v_ix) + __pyx_v_i)])); - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; - /* "src/gfunction/gfunction.pyx":476 + /* "View.MemoryView":478 * - * # add histograms - * for i in prange(histo_n, nogil=True): # <<<<<<<<<<<<<< - * for j in range(n1): - * ix = histo_n * j + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":479 + * + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) + */ + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 479, __pyx_L6_error) + + /* "View.MemoryView":478 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + */ + } + + /* "View.MemoryView":480 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: + */ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } + + /* "View.MemoryView":483 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< + * + * cdef setitem_indexed(self, index, value): + */ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); } + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; } - /* "src/gfunction/gfunction.pyx":466 - * self.histo_n, self.histo_inv_dr, self.mode_sel) + /* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) * - * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< - * """ - * Add the histograms of all core particles, after they were calculated in parallel. + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.gfunction.RDF._addHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer); - __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/gfunction/gfunction.pyx":483 - * +/* "View.MemoryView":485 + * PyMem_Free(tmp) * - * def _normHisto(self): # <<<<<<<<<<<<<< - * """ - * Normalize the histogram. + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_9_normHisto(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_3RDF_8_normHisto[] = "\n Normalize the histogram.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_9_normHisto = {"_normHisto", (PyCFunction)__pyx_pw_11newanalysis_9gfunction_3RDF_9_normHisto, METH_O, __pyx_doc_11newanalysis_9gfunction_3RDF_8_normHisto}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_9_normHisto(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_normHisto (wrapper)", 0); - __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_8_normHisto(__pyx_self, ((PyObject *)__pyx_v_self)); + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_indexed", 0); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":486 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 486, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_8_normHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_v_volume = NULL; - PyObject *__pyx_v_v = NULL; - int __pyx_v_i; - int __pyx_v_j; - CYTHON_UNUSED int __pyx_v_ix2; - double __pyx_v_PI; - PyObject *__pyx_v_rho = NULL; - PyObject *__pyx_v_r = NULL; - PyObject *__pyx_v_r_out = NULL; - PyObject *__pyx_v_slice_vol = NULL; - PyObject *__pyx_v_norm = NULL; + /* "View.MemoryView":487 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":485 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + */ + +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - long __pyx_t_8; - long __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_normHisto", 0); + __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "src/gfunction/gfunction.pyx":488 - * """ + /* "View.MemoryView":492 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem * - * if self.norm_volume: # <<<<<<<<<<<<<< - * volume = self.norm_volume - * else: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":489 + /* "View.MemoryView":495 + * cdef bytes bytesitem * - * if self.norm_volume: - * volume = self.norm_volume # <<<<<<<<<<<<<< - * else: - * volume = 0.0 + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_volume = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":488 - * """ + /* "View.MemoryView":496 * - * if self.norm_volume: # <<<<<<<<<<<<<< - * volume = self.norm_volume - * else: + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - goto __pyx_L3; - } + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { - /* "src/gfunction/gfunction.pyx":491 - * volume = self.norm_volume + /* "View.MemoryView":497 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":496 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + */ + } + + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" * else: - * volume = 0.0 # <<<<<<<<<<<<<< - * for v in self.volume_list: - * volume+=v + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result */ - /*else*/ { - __Pyx_INCREF(__pyx_float_0_0); - __pyx_v_volume = __pyx_float_0_0; + /*else:*/ { + __pyx_t_9 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 501, __pyx_L5_except_error) + __pyx_t_10 = (__pyx_t_9 == 1); + if (__pyx_t_10) { - /* "src/gfunction/gfunction.pyx":492 + /* "View.MemoryView":502 * else: - * volume = 0.0 - * for v in self.volume_list: # <<<<<<<<<<<<<< - * volume+=v - * volume/=len(self.volume_list) + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 492, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 492, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 492, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 492, __pyx_L1_error) - } - break; - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 502, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; + + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result + */ } - __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1); - __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":493 - * volume = 0.0 - * for v in self.volume_list: - * volume+=v # <<<<<<<<<<<<<< - * volume/=len(self.volume_list) + /* "View.MemoryView":503 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< * + * cdef assign_item_from_object(self, char *itemp, object value): */ - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_volume, __pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_volume, __pyx_t_1); - __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/gfunction/gfunction.pyx":492 + /* "View.MemoryView":498 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" * else: - * volume = 0.0 - * for v in self.volume_list: # <<<<<<<<<<<<<< - * volume+=v - * volume/=len(self.volume_list) */ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_6); + __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; + if (__pyx_t_8) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_1); + + /* "View.MemoryView":499 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 499, __pyx_L5_except_error) } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L5_except_error; - /* "src/gfunction/gfunction.pyx":494 - * for v in self.volume_list: - * volume+=v - * volume/=len(self.volume_list) # <<<<<<<<<<<<<< + /* "View.MemoryView":496 * - * cdef int i, j, ix, ix2 = self.n1 * self.histo_n + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 494, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_volume, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_volume, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; } - __pyx_L3:; - /* "src/gfunction/gfunction.pyx":496 - * volume/=len(self.volume_list) - * - * cdef int i, j, ix, ix2 = self.n1 * self.histo_n # <<<<<<<<<<<<<< - * PI = 3.14159265358979323846 + /* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 496, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_ix2 = __pyx_t_7; - /* "src/gfunction/gfunction.pyx":497 - * - * cdef int i, j, ix, ix2 = self.n1 * self.histo_n - * PI = 3.14159265358979323846 # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":505 + * return result * - * # norm histograms + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_v_PI = 3.14159265358979323846; - /* "src/gfunction/gfunction.pyx":500 +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + char *__pyx_t_10; + char *__pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":508 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue + */ + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":513 + * cdef Py_ssize_t i * - * # norm histograms - * if self.oneistwo: # <<<<<<<<<<<<<< - * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) * else: */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = PyTuple_Check(__pyx_v_value); if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":501 - * # norm histograms - * if self.oneistwo: - * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume # <<<<<<<<<<<<<< + /* "View.MemoryView":514 + * + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< * else: - * rho = float(self.nmol1 * self.nmol2) / volume + * bytesvalue = struct.pack(self.view.format, value) */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_volume); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_rho = __pyx_t_3; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 514, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "src/gfunction/gfunction.pyx":500 + /* "View.MemoryView":513 + * cdef Py_ssize_t i * - * # norm histograms - * if self.oneistwo: # <<<<<<<<<<<<<< - * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) * else: */ - goto __pyx_L6; + goto __pyx_L3; } - /* "src/gfunction/gfunction.pyx":503 - * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume + /* "View.MemoryView":516 + * bytesvalue = struct.pack(self.view.format, *value) * else: - * rho = float(self.nmol1 * self.nmol2) / volume # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< * - * for i in range(self.histo_n): + * for i, c in enumerate(bytesvalue): */ /*else*/ { - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_volume); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_rho = __pyx_t_6; + __pyx_t_4 = NULL; __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_value}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; } - __pyx_L6:; + __pyx_L3:; - /* "src/gfunction/gfunction.pyx":505 - * rho = float(self.nmol1 * self.nmol2) / volume + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c * - * for i in range(self.histo_n): # <<<<<<<<<<<<<< - * r = self.histo_min + float(i) * self.histo_dr - * r_out = r + self.histo_dr */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_9; __pyx_t_7+=1) { + __pyx_t_7 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 518, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_8 = __pyx_v_bytesvalue; + __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8); + __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8)); + for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) { + __pyx_t_9 = __pyx_t_12; + __pyx_v_c = (__pyx_t_9[0]); + + /* "View.MemoryView":519 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') + */ __pyx_v_i = __pyx_t_7; - /* "src/gfunction/gfunction.pyx":506 + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c * - * for i in range(self.histo_n): - * r = self.histo_min + float(i) * self.histo_dr # <<<<<<<<<<<<<< - * r_out = r + self.histo_dr - * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_7 = (__pyx_t_7 + 1); - /* "src/gfunction/gfunction.pyx":507 - * for i in range(self.histo_n): - * r = self.histo_min + float(i) * self.histo_dr - * r_out = r + self.histo_dr # <<<<<<<<<<<<<< - * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) - * norm = rho*slice_vol*float(self.ctr) + /* "View.MemoryView":519 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = PyNumber_Add(__pyx_v_r, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_r_out, __pyx_t_10); - __pyx_t_10 = 0; - - /* "src/gfunction/gfunction.pyx":508 - * r = self.histo_min + float(i) * self.histo_dr - * r_out = r + self.histo_dr - * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) # <<<<<<<<<<<<<< - * norm = rho*slice_vol*float(self.ctr) - * for j in range(7): - */ - __pyx_t_10 = PyFloat_FromDouble(((4.0 / 3.0) * __pyx_v_PI)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = PyNumber_Power(__pyx_v_r_out, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyNumber_Power(__pyx_v_r, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Multiply(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_slice_vol, __pyx_t_6); - __pyx_t_6 = 0; - - /* "src/gfunction/gfunction.pyx":509 - * r_out = r + self.histo_dr - * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) - * norm = rho*slice_vol*float(self.ctr) # <<<<<<<<<<<<<< - * for j in range(7): - * self.histogram_out[j*self.histo_n+i]/=norm - */ - __pyx_t_6 = PyNumber_Multiply(__pyx_v_rho, __pyx_v_slice_vol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 509, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyNumber_Float(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 509, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF_SET(__pyx_v_norm, __pyx_t_1); - __pyx_t_1 = 0; - - /* "src/gfunction/gfunction.pyx":510 - * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) - * norm = rho*slice_vol*float(self.ctr) - * for j in range(7): # <<<<<<<<<<<<<< - * self.histogram_out[j*self.histo_n+i]/=norm - * - */ - for (__pyx_t_11 = 0; __pyx_t_11 < 7; __pyx_t_11+=1) { - __pyx_v_j = __pyx_t_11; - - /* "src/gfunction/gfunction.pyx":511 - * norm = rho*slice_vol*float(self.ctr) - * for j in range(7): - * self.histogram_out[j*self.histo_n+i]/=norm # <<<<<<<<<<<<<< - * - * def scale(self, value): - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_10, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_6, __pyx_v_norm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_10, __pyx_t_3) < 0)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/gfunction/gfunction.pyx":483 - * + /* "View.MemoryView":505 + * return result * - * def _normHisto(self): # <<<<<<<<<<<<<< - * """ - * Normalize the histogram. + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ /* function exit code */ @@ -10636,1333 +10832,630 @@ static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_8_normHisto(CYTHON_UNUSE __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("newanalysis.gfunction.RDF._normHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_volume); - __Pyx_XDECREF(__pyx_v_v); - __Pyx_XDECREF(__pyx_v_rho); - __Pyx_XDECREF(__pyx_v_r); - __Pyx_XDECREF(__pyx_v_r_out); - __Pyx_XDECREF(__pyx_v_slice_vol); - __Pyx_XDECREF(__pyx_v_norm); + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/gfunction/gfunction.pyx":513 - * self.histogram_out[j*self.histo_n+i]/=norm +/* "View.MemoryView":521 + * itemp[i] = c * - * def scale(self, value): # <<<<<<<<<<<<<< - * self.histogram_out[:] *= value - * self.histogram[:] *= value + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_11scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_11scale = {"scale", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_11scale, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_11scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_value = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("scale (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); __PYX_ERR(0, 513, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) __PYX_ERR(0, 513, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_value = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 513, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_10scale(__pyx_self, __pyx_v_self, __pyx_v_value); + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_10scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("scale", 0); + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); - /* "src/gfunction/gfunction.pyx":514 + /* "View.MemoryView":523 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * - * def scale(self, value): - * self.histogram_out[:] *= value # <<<<<<<<<<<<<< - * self.histogram[:] *= value + */ + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":524 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< * + * if flags & PyBUF_ND: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_slice__6); - __pyx_t_2 = __pyx_slice__6; - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_InPlaceMultiply(__pyx_t_3, __pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_4) < 0)) __PYX_ERR(0, 514, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 524, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":515 - * def scale(self, value): - * self.histogram_out[:] *= value - * self.histogram[:] *= value # <<<<<<<<<<<<<< + /* "View.MemoryView":523 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * - * def write(self, filename="rdf"): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_slice__6); - __pyx_t_2 = __pyx_slice__6; - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_4, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } - /* "src/gfunction/gfunction.pyx":513 - * self.histogram_out[j*self.histo_n+i]/=norm + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * - * def scale(self, value): # <<<<<<<<<<<<<< - * self.histogram_out[:] *= value - * self.histogram[:] *= value + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("newanalysis.gfunction.RDF.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":527 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL + */ + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; -/* "src/gfunction/gfunction.pyx":517 - * self.histogram[:] *= value + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * - * def write(self, filename="rdf"): # <<<<<<<<<<<<<< - * """ - * RDF.write(filename="rdf") + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ + goto __pyx_L6; + } -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_13write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_3RDF_12write[] = "\n RDF.write(filename=\"rdf\")\n\n Args:\n filename .. name of the file to be written to. Each type of rdf will be written to a separate file\n with the ending specifying the type.\n \n Norm the calculated histograms and write them to the specified file.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_13write = {"write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_13write, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF_12write}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_13write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_filename = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filename,0}; - PyObject* values[2] = {0,0}; - values[1] = ((PyObject *)((PyObject*)__pyx_n_s_rdf)); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write") < 0)) __PYX_ERR(0, 517, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_self = values[0]; - __pyx_v_filename = values[1]; + /* "View.MemoryView":529 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: + */ + /*else*/ { + __pyx_v_info->shape = NULL; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 517, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF.write", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_12write(__pyx_self, __pyx_v_self, __pyx_v_filename); + __pyx_L6:; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":531 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_12write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename) { - PyObject *__pyx_v_f000 = NULL; - PyObject *__pyx_v_f110 = NULL; - PyObject *__pyx_v_f101 = NULL; - PyObject *__pyx_v_f011 = NULL; - PyObject *__pyx_v_f220 = NULL; - PyObject *__pyx_v_f202 = NULL; - PyObject *__pyx_v_f022 = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_r = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write", 0); + /* "View.MemoryView":532 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL + */ + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; - /* "src/gfunction/gfunction.pyx":528 - * """ + /* "View.MemoryView":531 + * info.shape = NULL * - * if self.cuda: # <<<<<<<<<<<<<< - * cu.drv.memcpy_dtoh(self.histogram, self.histo_gpu) + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: + */ + goto __pyx_L7; + } + + /* "View.MemoryView":534 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< * + * if flags & PyBUF_INDIRECT: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; - /* "src/gfunction/gfunction.pyx":529 + /* "View.MemoryView":536 + * info.strides = NULL * - * if self.cuda: - * cu.drv.memcpy_dtoh(self.histogram, self.histo_gpu) # <<<<<<<<<<<<<< + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":537 * - * self._addHisto(self.histogram_out, self.histogram.astype(np.float64)) + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_cu); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_drv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_memcpy_dtoh); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_gpu); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; - /* "src/gfunction/gfunction.pyx":528 - * """ + /* "View.MemoryView":536 + * info.strides = NULL * - * if self.cuda: # <<<<<<<<<<<<<< - * cu.drv.memcpy_dtoh(self.histogram, self.histo_gpu) + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: + */ + goto __pyx_L8; + } + + /* "View.MemoryView":539 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< * + * if flags & PyBUF_FORMAT: */ + /*else*/ { + __pyx_v_info->suboffsets = NULL; } + __pyx_L8:; - /* "src/gfunction/gfunction.pyx":531 - * cu.drv.memcpy_dtoh(self.histogram, self.histo_gpu) + /* "View.MemoryView":541 + * info.suboffsets = NULL * - * self._addHisto(self.histogram_out, self.histogram.astype(np.float64)) # <<<<<<<<<<<<<< - * self._normHisto() + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":542 * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_addHisto); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_astype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_8, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_8, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_7, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_7, __pyx_t_5); - __pyx_t_8 = 0; - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; - /* "src/gfunction/gfunction.pyx":532 - * - * self._addHisto(self.histogram_out, self.histogram.astype(np.float64)) - * self._normHisto() # <<<<<<<<<<<<<< + /* "View.MemoryView":541 + * info.suboffsets = NULL * - * if self.mode_sel & 1: f000 = open(filename+"_g000.dat",'w') + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normHisto); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } + goto __pyx_L9; } - __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":534 - * self._normHisto() + /* "View.MemoryView":544 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< * - * if self.mode_sel & 1: f000 = open(filename+"_g000.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 2: f110 = open(filename+"_g110.dat",'w') - * if self.mode_sel & 4: f101 = open(filename+"_g101.dat",'w') + * info.buf = self.view.buf */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_2) { - __pyx_t_3 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g000_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_w); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_f000 = __pyx_t_3; - __pyx_t_3 = 0; + /*else*/ { + __pyx_v_info->format = NULL; } + __pyx_L9:; - /* "src/gfunction/gfunction.pyx":535 + /* "View.MemoryView":546 + * info.format = NULL * - * if self.mode_sel & 1: f000 = open(filename+"_g000.dat",'w') - * if self.mode_sel & 2: f110 = open(filename+"_g110.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 4: f101 = open(filename+"_g101.dat",'w') - * if self.mode_sel & 8: f011 = open(filename+"_g011.dat",'w') + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 535, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - __pyx_t_1 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g110_dat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_w); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_f110 = __pyx_t_1; - __pyx_t_1 = 0; - } + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; - /* "src/gfunction/gfunction.pyx":536 - * if self.mode_sel & 1: f000 = open(filename+"_g000.dat",'w') - * if self.mode_sel & 2: f110 = open(filename+"_g110.dat",'w') - * if self.mode_sel & 4: f101 = open(filename+"_g101.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 8: f011 = open(filename+"_g011.dat",'w') - * if self.mode_sel & 16: f220 = open(filename+"_g220.dat",'w') + /* "View.MemoryView":547 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_2) { - __pyx_t_3 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g101_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_w); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_f101 = __pyx_t_3; - __pyx_t_3 = 0; - } + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; - /* "src/gfunction/gfunction.pyx":537 - * if self.mode_sel & 2: f110 = open(filename+"_g110.dat",'w') - * if self.mode_sel & 4: f101 = open(filename+"_g101.dat",'w') - * if self.mode_sel & 8: f011 = open(filename+"_g011.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 16: f220 = open(filename+"_g220.dat",'w') - * if self.mode_sel & 32: f202 = open(filename+"_g202.dat",'w') + /* "View.MemoryView":548 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - __pyx_t_1 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g011_dat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_w); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_f011 = __pyx_t_1; - __pyx_t_1 = 0; - } + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; - /* "src/gfunction/gfunction.pyx":538 - * if self.mode_sel & 4: f101 = open(filename+"_g101.dat",'w') - * if self.mode_sel & 8: f011 = open(filename+"_g011.dat",'w') - * if self.mode_sel & 16: f220 = open(filename+"_g220.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 32: f202 = open(filename+"_g202.dat",'w') - * if self.mode_sel & 64: f022 = open(filename+"_g022.dat",'w') + /* "View.MemoryView":549 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_2) { - __pyx_t_3 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g220_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_w); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_f220 = __pyx_t_3; - __pyx_t_3 = 0; - } + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; - /* "src/gfunction/gfunction.pyx":539 - * if self.mode_sel & 8: f011 = open(filename+"_g011.dat",'w') - * if self.mode_sel & 16: f220 = open(filename+"_g220.dat",'w') - * if self.mode_sel & 32: f202 = open(filename+"_g202.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 64: f022 = open(filename+"_g022.dat",'w') + /* "View.MemoryView":550 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_32, 32, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 539, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - __pyx_t_1 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g202_dat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_w); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_f202 = __pyx_t_1; - __pyx_t_1 = 0; - } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":540 - * if self.mode_sel & 16: f220 = open(filename+"_g220.dat",'w') - * if self.mode_sel & 32: f202 = open(filename+"_g202.dat",'w') - * if self.mode_sel & 64: f022 = open(filename+"_g022.dat",'w') # <<<<<<<<<<<<<< + /* "View.MemoryView":551 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * * - * for i in range(self.histo_n): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_64, 64, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_2) { - __pyx_t_3 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g022_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_w); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_f022 = __pyx_t_3; - __pyx_t_3 = 0; - } + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "src/gfunction/gfunction.pyx":542 - * if self.mode_sel & 64: f022 = open(filename+"_g022.dat",'w') + /* "View.MemoryView":521 + * itemp[i] = c * - * for i in range(self.histo_n): # <<<<<<<<<<<<<< - * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 542, __pyx_L1_error) + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 542, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 542, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_11(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 542, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_1 = 0; + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":543 +/* "View.MemoryView":554 * - * for i in range(self.histo_n): - * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 # <<<<<<<<<<<<<< - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) - * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[self.histo_n+i])) + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = PyNumber_Multiply(__pyx_v_i, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_float_0_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_5); - __pyx_t_5 = 0; - /* "src/gfunction/gfunction.pyx":544 - * for i in range(self.histo_n): - * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) # <<<<<<<<<<<<<< - * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[self.histo_n+i])) - * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n+i])) +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":556 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - if (unlikely(!__pyx_v_f000)) { __Pyx_RaiseUnboundLocalError("f000"); __PYX_ERR(0, 544, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f000, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 556, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":545 - * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) - * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[self.histo_n+i])) # <<<<<<<<<<<<<< - * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n+i])) - * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n+i])) + /* "View.MemoryView":557 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_2) { - if (unlikely(!__pyx_v_f110)) { __Pyx_RaiseUnboundLocalError("f110"); __PYX_ERR(0, 545, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f110, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = PyNumber_Add(__pyx_t_9, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 557, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":546 - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) - * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[self.histo_n+i])) - * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n+i])) # <<<<<<<<<<<<<< - * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n+i])) - * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n+i])) + /* "View.MemoryView":558 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_5, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - if (unlikely(!__pyx_v_f101)) { __Pyx_RaiseUnboundLocalError("f101"); __PYX_ERR(0, 546, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f101, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PyNumber_Multiply(__pyx_int_2, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":547 - * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[self.histo_n+i])) - * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n+i])) - * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n+i])) # <<<<<<<<<<<<<< - * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n+i])) - * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n+i])) + /* "View.MemoryView":554 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_2) { - if (unlikely(!__pyx_v_f011)) { __Pyx_RaiseUnboundLocalError("f011"); __PYX_ERR(0, 547, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f011, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyNumber_Multiply(__pyx_int_3, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_9, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - /* "src/gfunction/gfunction.pyx":548 - * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n+i])) - * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n+i])) - * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n+i])) # <<<<<<<<<<<<<< - * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n+i])) - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_5, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - if (unlikely(!__pyx_v_f220)) { __Pyx_RaiseUnboundLocalError("f220"); __PYX_ERR(0, 548, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f220, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PyNumber_Multiply(__pyx_int_4, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":549 - * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n+i])) - * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n+i])) - * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n+i])) # <<<<<<<<<<<<<< - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) +/* "View.MemoryView":560 + * return result * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_32, 32, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_2) { - if (unlikely(!__pyx_v_f202)) { __Pyx_RaiseUnboundLocalError("f202"); __PYX_ERR(0, 549, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f202, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyNumber_Multiply(__pyx_int_5, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_9, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - /* "src/gfunction/gfunction.pyx":550 - * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n+i])) - * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n+i])) - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) # <<<<<<<<<<<<<< - * - * def resetArrays(self): - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_5, __pyx_int_64, 64, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - if (unlikely(!__pyx_v_f022)) { __Pyx_RaiseUnboundLocalError("f022"); __PYX_ERR(0, 550, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f022, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PyNumber_Multiply(__pyx_int_6, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/gfunction/gfunction.pyx":542 - * if self.mode_sel & 64: f022 = open(filename+"_g022.dat",'w') + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":562 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< * - * for i in range(self.histo_n): # <<<<<<<<<<<<<< - * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) + * cdef _get_base(self): */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":517 - * self.histogram[:] *= value + /* "View.MemoryView":560 + * return result * - * def write(self, filename="rdf"): # <<<<<<<<<<<<<< - * """ - * RDF.write(filename="rdf") + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("newanalysis.gfunction.RDF.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_f000); - __Pyx_XDECREF(__pyx_v_f110); - __Pyx_XDECREF(__pyx_v_f101); - __Pyx_XDECREF(__pyx_v_f011); - __Pyx_XDECREF(__pyx_v_f220); - __Pyx_XDECREF(__pyx_v_f202); - __Pyx_XDECREF(__pyx_v_f022); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_r); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/gfunction/gfunction.pyx":552 - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) +/* "View.MemoryView":564 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * + */ + +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":565 + * + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; + + /* "View.MemoryView":564 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj * - * def resetArrays(self): # <<<<<<<<<<<<<< - * """ - * Reset histogram arrays to zero + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":567 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_15resetArrays(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_3RDF_14resetArrays[] = "\n Reset histogram arrays to zero\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_15resetArrays = {"resetArrays", (PyCFunction)__pyx_pw_11newanalysis_9gfunction_3RDF_15resetArrays, METH_O, __pyx_doc_11newanalysis_9gfunction_3RDF_14resetArrays}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_15resetArrays(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("resetArrays (wrapper)", 0); - __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_14resetArrays(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_14resetArrays(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("resetArrays", 0); - - /* "src/gfunction/gfunction.pyx":556 - * Reset histogram arrays to zero - * """ - * self.histogram_out[:] = 0.0 # <<<<<<<<<<<<<< - * self.histogram[:] = 0.0 - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetSlice(__pyx_t_1, __pyx_float_0_0, 0, 0, NULL, NULL, &__pyx_slice__6, 0, 0, 1) < 0) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/gfunction/gfunction.pyx":557 - * """ - * self.histogram_out[:] = 0.0 - * self.histogram[:] = 0.0 # <<<<<<<<<<<<<< - * + /* "View.MemoryView":569 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetSlice(__pyx_t_1, __pyx_float_0_0, 0, 0, NULL, NULL, &__pyx_slice__6, 0, 0, 1) < 0) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyInt_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":552 - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) + /* "View.MemoryView":567 + * return self.obj * - * def resetArrays(self): # <<<<<<<<<<<<<< - * """ - * Reset histogram arrays to zero + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("newanalysis.gfunction.RDF.resetArrays", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11970,94 +11463,114 @@ static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_14resetArrays(CYTHON_UNU return __pyx_r; } -/* "src/gfunction/gfunction.pyx":560 - * +/* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) * - * def printInfo(self): # <<<<<<<<<<<<<< - * """ - * Print some information about the RDF container. + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_17printInfo(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_3RDF_16printInfo[] = "\n Print some information about the RDF container.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_17printInfo = {"printInfo", (PyCFunction)__pyx_pw_11newanalysis_9gfunction_3RDF_17printInfo, METH_O, __pyx_doc_11newanalysis_9gfunction_3RDF_16printInfo}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_17printInfo(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("printInfo (wrapper)", 0); - __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_16printInfo(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_16printInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("printInfo", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/gfunction/gfunction.pyx":565 - * """ - * - * print("Modes: ", self.mode_sel) # <<<<<<<<<<<<<< - * print("Frames read: ", self.ctr) + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< * + * raise ValueError, "Buffer view does not expose strides" */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_kp_s_Modes); - __Pyx_GIVEREF(__pyx_kp_s_Modes); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_Modes); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __pyx_t_1 = 0; - if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { - /* "src/gfunction/gfunction.pyx":566 + /* "View.MemoryView":575 + * if self.view.strides == NULL: * - * print("Modes: ", self.mode_sel) - * print("Frames read: ", self.ctr) # <<<<<<<<<<<<<< + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< * - * ################################################################################################### + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_kp_s_Frames_read); - __Pyx_GIVEREF(__pyx_kp_s_Frames_read); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_s_Frames_read); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __pyx_t_2 = 0; - if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 566, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 575, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":560 + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< * + * raise ValueError, "Buffer view does not expose strides" + */ + } + + /* "View.MemoryView":577 + * raise ValueError, "Buffer view does not expose strides" * - * def printInfo(self): # <<<<<<<<<<<<<< - * """ - * Print some information about the RDF container. + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("newanalysis.gfunction.RDF.printInfo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -12065,7234 +11578,5070 @@ static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_16printInfo(CYTHON_UNUSE return __pyx_r; } -/* "src/gfunction/gfunction.pyx":570 - * ################################################################################################### +/* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) * - * cdef void calcHistoVoronoi(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, - * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel, int nm_core, int nm_surround, int nshells, int * delaunay_matrix): + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ -static void __pyx_f_11newanalysis_9gfunction_calcHistoVoronoi(double *__pyx_v_core_xyz, double *__pyx_v_surr_xyz, double *__pyx_v_core_dip, double *__pyx_v_surr_dip, PyArrayObject *__pyx_v_np_dest, PyArrayObject *__pyx_v_np_box_dim, int __pyx_v_ncore, int __pyx_v_nsurround, float __pyx_v_histo_min, float __pyx_v_histo_max, int __pyx_v_histo_n, double __pyx_v_invdx, int __pyx_v_mode_sel, int __pyx_v_nm_core, int __pyx_v_nm_surround, int __pyx_v_nshells, int *__pyx_v_delaunay_matrix) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_pos; - int __pyx_v_ix1; - int __pyx_v_ix2; - int __pyx_v_j_begin; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_dist; - double __pyx_v_cpx; - double __pyx_v_cpy; - double __pyx_v_cpz; - double __pyx_v_spx; - double __pyx_v_spy; - double __pyx_v_spz; - double __pyx_v_slen; - double __pyx_v_clen; - double __pyx_v_incr; - double __pyx_v_off_diag; - double *__pyx_v_dest; - double *__pyx_v_box_dim; - int __pyx_v_ds_pos1; - int __pyx_v_ds_pos2; - int __pyx_v_shell; - int __pyx_v_ix3; - int __pyx_v_ix4; - int __pyx_v_apr_core; - int __pyx_v_apr_surround; - __Pyx_LocalBuf_ND __pyx_pybuffernd_np_box_dim; - __Pyx_Buffer __pyx_pybuffer_np_box_dim; - __Pyx_LocalBuf_ND __pyx_pybuffernd_np_dest; - __Pyx_Buffer __pyx_pybuffer_np_dest; +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - double __pyx_t_10; - double __pyx_t_11; - long __pyx_t_12; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcHistoVoronoi", 0); - __pyx_pybuffer_np_dest.pybuffer.buf = NULL; - __pyx_pybuffer_np_dest.refcount = 0; - __pyx_pybuffernd_np_dest.data = NULL; - __pyx_pybuffernd_np_dest.rcbuffer = &__pyx_pybuffer_np_dest; - __pyx_pybuffer_np_box_dim.pybuffer.buf = NULL; - __pyx_pybuffer_np_box_dim.refcount = 0; - __pyx_pybuffernd_np_box_dim.data = NULL; - __pyx_pybuffernd_np_box_dim.rcbuffer = &__pyx_pybuffer_np_box_dim; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_dest, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 570, __pyx_L1_error) - } - __pyx_pybuffernd_np_dest.diminfo[0].strides = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_dest.diminfo[0].shape = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_box_dim, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 570, __pyx_L1_error) - } - __pyx_pybuffernd_np_box_dim.diminfo[0].strides = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_box_dim.diminfo[0].shape = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.shape[0]; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/gfunction/gfunction.pyx":575 + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim * - * #cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 # Change ix1, ix2 - * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 - * cdef double *dest = np_dest.data - */ - __pyx_v_ix1 = ((__pyx_v_nshells * __pyx_v_ncore) * __pyx_v_histo_n); - __pyx_v_j_begin = 0; - - /* "src/gfunction/gfunction.pyx":576 - * #cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 # Change ix1, ix2 - * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 # <<<<<<<<<<<<<< - * cdef double *dest = np_dest.data - * cdef double *box_dim = np_box_dim.data - */ - __pyx_v_off_diag = 1.0; - - /* "src/gfunction/gfunction.pyx":577 - * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 - * cdef double *dest = np_dest.data # <<<<<<<<<<<<<< - * cdef double *box_dim = np_box_dim.data - * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 - */ - __pyx_v_dest = ((double *)__pyx_v_np_dest->data); - - /* "src/gfunction/gfunction.pyx":578 - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 - * cdef double *dest = np_dest.data - * cdef double *box_dim = np_box_dim.data # <<<<<<<<<<<<<< - * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 - * cdef int apr_core = ncore / nm_core */ - __pyx_v_box_dim = ((double *)__pyx_v_np_box_dim->data); + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":580 - * cdef double *box_dim = np_box_dim.data - * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 - * cdef int apr_core = ncore / nm_core # <<<<<<<<<<<<<< - * cdef int apr_surround = nsurround / nm_surround + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - if (unlikely(__pyx_v_nm_core == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 580, __pyx_L1_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nm_core == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_ncore))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 580, __pyx_L1_error) - } - __pyx_v_apr_core = __Pyx_div_int(__pyx_v_ncore, __pyx_v_nm_core); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":581 - * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 - * cdef int apr_core = ncore / nm_core - * cdef int apr_surround = nsurround / nm_surround # <<<<<<<<<<<<<< - * + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim * */ - if (unlikely(__pyx_v_nm_surround == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 581, __pyx_L1_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nm_surround == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_nsurround))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 581, __pyx_L1_error) } - __pyx_v_apr_surround = __Pyx_div_int(__pyx_v_nsurround, __pyx_v_nm_surround); - /* "src/gfunction/gfunction.pyx":586 - * #TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells + /* "View.MemoryView":584 + * return (-1,) * self.view.ndim * - * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< - * #ix2=i*histo_n - * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_ncore; - if ((1 == 0)) abort(); - { - double __pyx_parallel_temp0 = ((double)__PYX_NAN()); - double __pyx_parallel_temp1 = ((double)__PYX_NAN()); - double __pyx_parallel_temp2 = ((double)__PYX_NAN()); - double __pyx_parallel_temp3 = ((double)__PYX_NAN()); - double __pyx_parallel_temp4 = ((double)__PYX_NAN()); - int __pyx_parallel_temp5 = ((int)0xbad0bad0); - int __pyx_parallel_temp6 = ((int)0xbad0bad0); - double __pyx_parallel_temp7 = ((double)__PYX_NAN()); - double __pyx_parallel_temp8 = ((double)__PYX_NAN()); - double __pyx_parallel_temp9 = ((double)__PYX_NAN()); - int __pyx_parallel_temp10 = ((int)0xbad0bad0); - double __pyx_parallel_temp11 = ((double)__PYX_NAN()); - int __pyx_parallel_temp12 = ((int)0xbad0bad0); - int __pyx_parallel_temp13 = ((int)0xbad0bad0); - int __pyx_parallel_temp14 = ((int)0xbad0bad0); - int __pyx_parallel_temp15 = ((int)0xbad0bad0); - int __pyx_parallel_temp16 = ((int)0xbad0bad0); - double __pyx_parallel_temp17 = ((double)__PYX_NAN()); - int __pyx_parallel_temp18 = ((int)0xbad0bad0); - int __pyx_parallel_temp19 = ((int)0xbad0bad0); - double __pyx_parallel_temp20 = ((double)__PYX_NAN()); - double __pyx_parallel_temp21 = ((double)__PYX_NAN()); - double __pyx_parallel_temp22 = ((double)__PYX_NAN()); - double __pyx_parallel_temp23 = ((double)__PYX_NAN()); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_clen) lastprivate(__pyx_v_cpx) lastprivate(__pyx_v_cpy) lastprivate(__pyx_v_cpz) lastprivate(__pyx_v_dist) lastprivate(__pyx_v_ds_pos1) lastprivate(__pyx_v_ds_pos2) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_incr) lastprivate(__pyx_v_ix2) lastprivate(__pyx_v_ix3) lastprivate(__pyx_v_ix4) lastprivate(__pyx_v_j) lastprivate(__pyx_v_j_begin) lastprivate(__pyx_v_off_diag) lastprivate(__pyx_v_pos) lastprivate(__pyx_v_shell) lastprivate(__pyx_v_slen) lastprivate(__pyx_v_spx) lastprivate(__pyx_v_spy) lastprivate(__pyx_v_spz) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - /* Initialize private variables to invalid values */ - __pyx_v_clen = ((double)__PYX_NAN()); - __pyx_v_cpx = ((double)__PYX_NAN()); - __pyx_v_cpy = ((double)__PYX_NAN()); - __pyx_v_cpz = ((double)__PYX_NAN()); - __pyx_v_dist = ((double)__PYX_NAN()); - __pyx_v_ds_pos1 = ((int)0xbad0bad0); - __pyx_v_ds_pos2 = ((int)0xbad0bad0); - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_incr = ((double)__PYX_NAN()); - __pyx_v_ix2 = ((int)0xbad0bad0); - __pyx_v_ix3 = ((int)0xbad0bad0); - __pyx_v_ix4 = ((int)0xbad0bad0); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_j_begin = ((int)0xbad0bad0); - __pyx_v_off_diag = ((double)__PYX_NAN()); - __pyx_v_pos = ((int)0xbad0bad0); - __pyx_v_shell = ((int)0xbad0bad0); - __pyx_v_slen = ((double)__PYX_NAN()); - __pyx_v_spx = ((double)__PYX_NAN()); - __pyx_v_spy = ((double)__PYX_NAN()); - __pyx_v_spz = ((double)__PYX_NAN()); - - /* "src/gfunction/gfunction.pyx":588 - * for i in prange(ncore, nogil=True): - * #ix2=i*histo_n - * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE # <<<<<<<<<<<<<< - * ds_pos1 = i/apr_core + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< * + * @property */ - __pyx_v_ix2 = ((__pyx_v_i * __pyx_v_nshells) * __pyx_v_histo_n); + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":589 - * #ix2=i*histo_n - * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE - * ds_pos1 = i/apr_core # <<<<<<<<<<<<<< + /* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ - if (unlikely(__pyx_v_apr_core == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 589, __pyx_L8_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_apr_core == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_i))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 589, __pyx_L8_error) - } - __pyx_v_ds_pos1 = __Pyx_div_int(__pyx_v_i, __pyx_v_apr_core); - /* "src/gfunction/gfunction.pyx":591 - * ds_pos1 = i/apr_core - * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] - */ - __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 4) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 32) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L11_bool_binop_done:; - if (__pyx_t_4) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":592 +/* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - * cpx = core_dip[i*3] # <<<<<<<<<<<<<< - * cpy = core_dip[i*3+1] - * cpz = core_dip[i*3+2] + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ - __pyx_v_cpx = (__pyx_v_core_dip[(__pyx_v_i * 3)]); - /* "src/gfunction/gfunction.pyx":593 - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] # <<<<<<<<<<<<<< - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - */ - __pyx_v_cpy = (__pyx_v_core_dip[((__pyx_v_i * 3) + 1)]); +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/gfunction/gfunction.pyx":594 - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] - * cpz = core_dip[i*3+2] # <<<<<<<<<<<<<< - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: - */ - __pyx_v_cpz = (__pyx_v_core_dip[((__pyx_v_i * 3) + 2)]); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":595 - * cpy = core_dip[i*3+1] - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) # <<<<<<<<<<<<<< - * if ncore == nsurround: - * j_begin = i - */ - __pyx_v_clen = sqrt((((__pyx_v_cpx * __pyx_v_cpx) + (__pyx_v_cpy * __pyx_v_cpy)) + (__pyx_v_cpz * __pyx_v_cpz))); +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/gfunction/gfunction.pyx":591 - * ds_pos1 = i/apr_core + /* "View.MemoryView":588 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] - */ - } - - /* "src/gfunction/gfunction.pyx":596 - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: # <<<<<<<<<<<<<< - * j_begin = i - * else: - */ - __pyx_t_4 = ((__pyx_v_ncore == __pyx_v_nsurround) != 0); - if (__pyx_t_4) { - - /* "src/gfunction/gfunction.pyx":597 - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: - * j_begin = i # <<<<<<<<<<<<<< - * else: - * j_begin = 0 + * @property */ - __pyx_v_j_begin = __pyx_v_i; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 588, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":596 - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: # <<<<<<<<<<<<<< - * j_begin = i - * else: + /* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ - goto __pyx_L15; - } - /* "src/gfunction/gfunction.pyx":599 - * j_begin = i - * else: - * j_begin = 0 # <<<<<<<<<<<<<< - * for j in range(j_begin,nsurround): - * ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 2 - */ - /*else*/ { - __pyx_v_j_begin = 0; - } - __pyx_L15:; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":600 - * else: - * j_begin = 0 - * for j in range(j_begin,nsurround): # <<<<<<<<<<<<<< - * ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 2 - * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? +/* "View.MemoryView":590 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ - __pyx_t_6 = __pyx_v_nsurround; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = __pyx_v_j_begin; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_j = __pyx_t_8; - /* "src/gfunction/gfunction.pyx":601 - * j_begin = 0 - * for j in range(j_begin,nsurround): - * ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 2 # <<<<<<<<<<<<<< - * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? - * shell = shell-1 - */ - if (unlikely(__pyx_v_apr_surround == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 601, __pyx_L8_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_apr_surround == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_j))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 601, __pyx_L8_error) - } - __pyx_v_ds_pos2 = __Pyx_div_int(__pyx_v_j, __pyx_v_apr_surround); +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/gfunction/gfunction.pyx":602 - * for j in range(j_begin,nsurround): - * ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 2 - * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? # <<<<<<<<<<<<<< - * shell = shell-1 - * if shell < 0: shell = nshells-1 - */ - __pyx_v_shell = (__pyx_v_delaunay_matrix[((__pyx_v_ds_pos1 * __pyx_v_nsurround) + __pyx_v_ds_pos2)]); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":603 - * ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 2 - * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? - * shell = shell-1 # <<<<<<<<<<<<<< - * if shell < 0: shell = nshells-1 - * if shell >= nshells: shell = nshells-1 - */ - __pyx_v_shell = (__pyx_v_shell - 1); +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/gfunction/gfunction.pyx":604 - * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? - * shell = shell-1 - * if shell < 0: shell = nshells-1 # <<<<<<<<<<<<<< - * if shell >= nshells: shell = nshells-1 + /* "View.MemoryView":592 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_4 = ((__pyx_v_shell < 0) != 0); - if (__pyx_t_4) { - __pyx_v_shell = (__pyx_v_nshells - 1); - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":605 - * shell = shell-1 - * if shell < 0: shell = nshells-1 - * if shell >= nshells: shell = nshells-1 # <<<<<<<<<<<<<< + /* "View.MemoryView":590 + * return self.view.ndim * - * if ncore == nsurround and i != j: + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ - __pyx_t_4 = ((__pyx_v_shell >= __pyx_v_nshells) != 0); - if (__pyx_t_4) { - __pyx_v_shell = (__pyx_v_nshells - 1); - } - /* "src/gfunction/gfunction.pyx":607 - * if shell >= nshells: shell = nshells-1 - * - * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< - * off_diag = 2.0 - * else: - */ - __pyx_t_5 = ((__pyx_v_ncore == __pyx_v_nsurround) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L21_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_i != __pyx_v_j) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L21_bool_binop_done:; - if (__pyx_t_4) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":608 +/* "View.MemoryView":594 + * return self.view.itemsize * - * if ncore == nsurround and i != j: - * off_diag = 2.0 # <<<<<<<<<<<<<< - * else: - * off_diag = 1.0 + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize */ - __pyx_v_off_diag = 2.0; - /* "src/gfunction/gfunction.pyx":607 - * if shell >= nshells: shell = nshells-1 - * - * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< - * off_diag = 2.0 - * else: - */ - goto __pyx_L20; - } +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/gfunction/gfunction.pyx":610 - * off_diag = 2.0 - * else: - * off_diag = 1.0 # <<<<<<<<<<<<<< - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - * spx = surr_dip[j*3] - */ - /*else*/ { - __pyx_v_off_diag = 1.0; - } - __pyx_L20:; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":611 - * else: - * off_diag = 1.0 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] - */ - __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L24_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 8) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L24_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L24_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 64) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L24_bool_binop_done:; - if (__pyx_t_4) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/gfunction/gfunction.pyx":612 - * off_diag = 1.0 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - * spx = surr_dip[j*3] # <<<<<<<<<<<<<< - * spy = surr_dip[j*3+1] - * spz = surr_dip[j*3+2] + /* "View.MemoryView":596 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property */ - __pyx_v_spx = (__pyx_v_surr_dip[(__pyx_v_j * 3)]); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":613 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] # <<<<<<<<<<<<<< - * spz = surr_dip[j*3+2] - * slen = sqrt(spx*spx+spy*spy+spz*spz) + /* "View.MemoryView":594 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize */ - __pyx_v_spy = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 1)]); - /* "src/gfunction/gfunction.pyx":614 - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] - * spz = surr_dip[j*3+2] # <<<<<<<<<<<<<< - * slen = sqrt(spx*spx+spy*spy+spz*spz) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":598 + * return self.size * self.view.itemsize * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ - __pyx_v_spz = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 2)]); - /* "src/gfunction/gfunction.pyx":615 - * spy = surr_dip[j*3+1] - * spz = surr_dip[j*3+2] - * slen = sqrt(spx*spx+spy*spy+spz*spz) # <<<<<<<<<<<<<< +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * dx = surr_xyz[j*3] - core_xyz[i*3] */ - __pyx_v_slen = sqrt((((__pyx_v_spx * __pyx_v_spx) + (__pyx_v_spy * __pyx_v_spy)) + (__pyx_v_spz * __pyx_v_spz))); + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":611 - * else: - * off_diag = 1.0 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] + /* "View.MemoryView":601 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< + * + * for length in self.view.shape[:self.view.ndim]: */ - } + __Pyx_INCREF(__pyx_int_1); + __pyx_v_result = __pyx_int_1; - /* "src/gfunction/gfunction.pyx":617 - * slen = sqrt(spx*spx+spy*spy+spz*spz) + /* "View.MemoryView":603 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length * - * dx = surr_xyz[j*3] - core_xyz[i*3] # <<<<<<<<<<<<<< - * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] */ - __pyx_v_dx = ((__pyx_v_surr_xyz[(__pyx_v_j * 3)]) - (__pyx_v_core_xyz[(__pyx_v_i * 3)])); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyInt_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; - /* "src/gfunction/gfunction.pyx":618 + /* "View.MemoryView":604 * - * dx = surr_xyz[j*3] - core_xyz[i*3] - * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] # <<<<<<<<<<<<<< - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< * + * self._size = result */ - __pyx_v_dy = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 1)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 1)])); + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; + } - /* "src/gfunction/gfunction.pyx":619 - * dx = surr_xyz[j*3] - core_xyz[i*3] - * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] # <<<<<<<<<<<<<< + /* "View.MemoryView":606 + * result *= length * - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size */ - __pyx_v_dz = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 2)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 2)])); + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; - /* "src/gfunction/gfunction.pyx":621 - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] # <<<<<<<<<<<<<< - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] */ - __pyx_t_4 = ((fabs(__pyx_v_dx) > (__pyx_v_box_dim[3])) != 0); - if (__pyx_t_4) { - __pyx_v_dx = (__pyx_v_dx - (((0.0 < __pyx_v_dx) - (__pyx_v_dx < 0.0)) * (__pyx_v_box_dim[0]))); - } + } - /* "src/gfunction/gfunction.pyx":622 + /* "View.MemoryView":608 + * self._size = result * - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] # <<<<<<<<<<<<<< - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] - * dist = sqrt(dx*dx+dy*dy+dz*dz) + * return self._size # <<<<<<<<<<<<<< + * + * def __len__(self): */ - __pyx_t_4 = ((fabs(__pyx_v_dy) > (__pyx_v_box_dim[4])) != 0); - if (__pyx_t_4) { - __pyx_v_dy = (__pyx_v_dy - (((0.0 < __pyx_v_dy) - (__pyx_v_dy < 0.0)) * (__pyx_v_box_dim[1]))); - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":623 - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] # <<<<<<<<<<<<<< - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue + /* "View.MemoryView":598 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ - __pyx_t_4 = ((fabs(__pyx_v_dz) > (__pyx_v_box_dim[5])) != 0); - if (__pyx_t_4) { - __pyx_v_dz = (__pyx_v_dz - (((0.0 < __pyx_v_dz) - (__pyx_v_dz < 0.0)) * (__pyx_v_box_dim[2]))); - } - /* "src/gfunction/gfunction.pyx":624 - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] - * dist = sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< - * if disthisto_max or floor(dist*invdx)==0: continue - * pos = floor((dist-histo_min)*invdx) - */ - __pyx_v_dist = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":625 - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue # <<<<<<<<<<<<<< - * pos = floor((dist-histo_min)*invdx) +/* "View.MemoryView":610 + * return self._size * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ - __pyx_t_5 = ((__pyx_v_dist < __pyx_v_histo_min) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L32_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_dist > __pyx_v_histo_max) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L32_bool_binop_done; - } - __pyx_t_5 = ((floor((__pyx_v_dist * __pyx_v_invdx)) == 0.0) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L32_bool_binop_done:; - if (__pyx_t_4) { - goto __pyx_L16_continue; - } - /* "src/gfunction/gfunction.pyx":626 - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue - * pos = floor((dist-histo_min)*invdx) # <<<<<<<<<<<<<< +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__len__", 0); + + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] * - * #pos -> idx3 */ - __pyx_v_pos = ((int)floor(((__pyx_v_dist - __pyx_v_histo_min) * __pyx_v_invdx))); + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":648 - * """ - * - * ix3 = pos*nshells # <<<<<<<<<<<<<< - * ix4 = shell + /* "View.MemoryView":612 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< * + * return 0 */ - __pyx_v_ix3 = (__pyx_v_pos * __pyx_v_nshells); + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":649 + /* "View.MemoryView":611 * - * ix3 = pos*nshells - * ix4 = shell # <<<<<<<<<<<<<< + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] * - * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag */ - __pyx_v_ix4 = __pyx_v_shell; + } - /* "src/gfunction/gfunction.pyx":651 - * ix4 = shell + /* "View.MemoryView":614 + * return self.view.shape[0] * - * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag # <<<<<<<<<<<<<< + * return 0 # <<<<<<<<<<<<<< * - * if mode_sel & 2 or mode_sel & 16: + * def __repr__(self): */ - __pyx_t_4 = ((__pyx_v_mode_sel & 1) != 0); - if (__pyx_t_4) { - __pyx_t_9 = ((__pyx_v_ix2 + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_9]) = ((__pyx_v_dest[__pyx_t_9]) + (1.0 * __pyx_v_off_diag)); - } + __pyx_r = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":653 - * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag + /* "View.MemoryView":610 + * return self._size * - * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ - __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L37_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L37_bool_binop_done:; - if (__pyx_t_4) { - /* "src/gfunction/gfunction.pyx":654 + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":616 + * return 0 * - * if mode_sel & 2 or mode_sel & 16: - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) # <<<<<<<<<<<<<< - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ - __pyx_t_10 = (((__pyx_v_cpx * __pyx_v_spx) + (__pyx_v_cpy * __pyx_v_spy)) + (__pyx_v_cpz * __pyx_v_spz)); - __pyx_t_11 = (__pyx_v_clen * __pyx_v_slen); - if (unlikely(__pyx_t_11 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 654, __pyx_L8_error) - } - __pyx_v_incr = (__pyx_t_10 / __pyx_t_11); - /* "src/gfunction/gfunction.pyx":655 - * if mode_sel & 2 or mode_sel & 16: - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: - */ - __pyx_t_4 = ((__pyx_v_mode_sel & 2) != 0); - if (__pyx_t_4) { - __pyx_t_9 = (((__pyx_v_ix1 + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_9]) = ((__pyx_v_dest[__pyx_t_9]) + (__pyx_v_incr * __pyx_v_off_diag)); - } +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/gfunction/gfunction.pyx":656 - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 4 or mode_sel & 32: - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - */ - __pyx_t_4 = ((__pyx_v_mode_sel & 16) != 0); - if (__pyx_t_4) { - __pyx_t_12 = ((((4 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":653 - * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag - * - * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag - */ - } +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/gfunction/gfunction.pyx":657 - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + /* "View.MemoryView":617 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * */ - __pyx_t_5 = ((__pyx_v_mode_sel & 4) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L42_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 32) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L42_bool_binop_done:; - if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/gfunction/gfunction.pyx":658 - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) # <<<<<<<<<<<<<< - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + /* "View.MemoryView":618 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): */ - __pyx_t_11 = (((__pyx_v_cpx * __pyx_v_dx) + (__pyx_v_cpy * __pyx_v_dy)) + (__pyx_v_cpz * __pyx_v_dz)); - __pyx_t_10 = (__pyx_v_clen * __pyx_v_dist); - if (unlikely(__pyx_t_10 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 658, __pyx_L8_error) - } - __pyx_v_incr = (__pyx_t_11 / __pyx_t_10); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "src/gfunction/gfunction.pyx":659 - * if mode_sel & 4 or mode_sel & 32: - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: + /* "View.MemoryView":617 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * */ - __pyx_t_4 = ((__pyx_v_mode_sel & 4) != 0); - if (__pyx_t_4) { - __pyx_t_12 = ((((2 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + (__pyx_v_incr * __pyx_v_off_diag)); - } + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":660 - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 8 or mode_sel & 64: - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + /* "View.MemoryView":616 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ - __pyx_t_4 = ((__pyx_v_mode_sel & 32) != 0); - if (__pyx_t_4) { - __pyx_t_12 = ((((5 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); - } - /* "src/gfunction/gfunction.pyx":657 - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag - */ - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":661 - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag +/* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * */ - __pyx_t_5 = ((__pyx_v_mode_sel & 8) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L47_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 64) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L47_bool_binop_done:; - if (__pyx_t_4) { - /* "src/gfunction/gfunction.pyx":662 - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) # <<<<<<<<<<<<<< - * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - */ - __pyx_t_10 = (((__pyx_v_spx * __pyx_v_dx) + (__pyx_v_spy * __pyx_v_dy)) + (__pyx_v_spz * __pyx_v_dz)); - __pyx_t_11 = (__pyx_v_slen * __pyx_v_dist); - if (unlikely(__pyx_t_11 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 662, __pyx_L8_error) - } - __pyx_v_incr = (__pyx_t_10 / __pyx_t_11); +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/gfunction/gfunction.pyx":663 - * if mode_sel & 8 or mode_sel & 64: - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * - */ - __pyx_t_4 = ((__pyx_v_mode_sel & 8) != 0); - if (__pyx_t_4) { - __pyx_t_12 = ((((3 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + (__pyx_v_incr * __pyx_v_off_diag)); - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":664 - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "View.MemoryView":621 * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< * - */ - __pyx_t_4 = ((__pyx_v_mode_sel & 64) != 0); - if (__pyx_t_4) { - __pyx_t_12 = ((((6 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); - } - - /* "src/gfunction/gfunction.pyx":661 - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag - */ - } - __pyx_L16_continue:; - } - goto __pyx_L52; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L51; - __pyx_L51:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates9) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_clen; - __pyx_parallel_temp1 = __pyx_v_cpx; - __pyx_parallel_temp2 = __pyx_v_cpy; - __pyx_parallel_temp3 = __pyx_v_cpz; - __pyx_parallel_temp4 = __pyx_v_dist; - __pyx_parallel_temp5 = __pyx_v_ds_pos1; - __pyx_parallel_temp6 = __pyx_v_ds_pos2; - __pyx_parallel_temp7 = __pyx_v_dx; - __pyx_parallel_temp8 = __pyx_v_dy; - __pyx_parallel_temp9 = __pyx_v_dz; - __pyx_parallel_temp10 = __pyx_v_i; - __pyx_parallel_temp11 = __pyx_v_incr; - __pyx_parallel_temp12 = __pyx_v_ix2; - __pyx_parallel_temp13 = __pyx_v_ix3; - __pyx_parallel_temp14 = __pyx_v_ix4; - __pyx_parallel_temp15 = __pyx_v_j; - __pyx_parallel_temp16 = __pyx_v_j_begin; - __pyx_parallel_temp17 = __pyx_v_off_diag; - __pyx_parallel_temp18 = __pyx_v_pos; - __pyx_parallel_temp19 = __pyx_v_shell; - __pyx_parallel_temp20 = __pyx_v_slen; - __pyx_parallel_temp21 = __pyx_v_spx; - __pyx_parallel_temp22 = __pyx_v_spy; - __pyx_parallel_temp23 = __pyx_v_spz; - } - __pyx_L52:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_clen = __pyx_parallel_temp0; - __pyx_v_cpx = __pyx_parallel_temp1; - __pyx_v_cpy = __pyx_parallel_temp2; - __pyx_v_cpz = __pyx_parallel_temp3; - __pyx_v_dist = __pyx_parallel_temp4; - __pyx_v_ds_pos1 = __pyx_parallel_temp5; - __pyx_v_ds_pos2 = __pyx_parallel_temp6; - __pyx_v_dx = __pyx_parallel_temp7; - __pyx_v_dy = __pyx_parallel_temp8; - __pyx_v_dz = __pyx_parallel_temp9; - __pyx_v_i = __pyx_parallel_temp10; - __pyx_v_incr = __pyx_parallel_temp11; - __pyx_v_ix2 = __pyx_parallel_temp12; - __pyx_v_ix3 = __pyx_parallel_temp13; - __pyx_v_ix4 = __pyx_parallel_temp14; - __pyx_v_j = __pyx_parallel_temp15; - __pyx_v_j_begin = __pyx_parallel_temp16; - __pyx_v_off_diag = __pyx_parallel_temp17; - __pyx_v_pos = __pyx_parallel_temp18; - __pyx_v_shell = __pyx_parallel_temp19; - __pyx_v_slen = __pyx_parallel_temp20; - __pyx_v_spx = __pyx_parallel_temp21; - __pyx_v_spy = __pyx_parallel_temp22; - __pyx_v_spz = __pyx_parallel_temp23; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - - /* "src/gfunction/gfunction.pyx":586 - * #TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells * - * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< - * #ix2=i*histo_n - * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":570 - * ################################################################################################### + /* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) * - * cdef void calcHistoVoronoi(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, - * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel, int nm_core, int nm_surround, int nshells, int * delaunay_matrix): */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_WriteUnraisable("newanalysis.gfunction.calcHistoVoronoi", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); - __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "src/gfunction/gfunction.pyx":667 +/* "View.MemoryView":624 * * - * cdef void calcHistoVoronoiNonSelf(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, - * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel, int nm_core, int nm_surround, int nshells, int * delaunay_matrix): + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ -static void __pyx_f_11newanalysis_9gfunction_calcHistoVoronoiNonSelf(double *__pyx_v_core_xyz, double *__pyx_v_surr_xyz, double *__pyx_v_core_dip, double *__pyx_v_surr_dip, PyArrayObject *__pyx_v_np_dest, PyArrayObject *__pyx_v_np_box_dim, int __pyx_v_ncore, int __pyx_v_nsurround, float __pyx_v_histo_min, float __pyx_v_histo_max, int __pyx_v_histo_n, double __pyx_v_invdx, int __pyx_v_mode_sel, int __pyx_v_nm_core, int __pyx_v_nm_surround, int __pyx_v_nshells, int *__pyx_v_delaunay_matrix) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_pos; - int __pyx_v_ix1; - int __pyx_v_ix2; - int __pyx_v_j_begin; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_dist; - double __pyx_v_cpx; - double __pyx_v_cpy; - double __pyx_v_cpz; - double __pyx_v_spx; - double __pyx_v_spy; - double __pyx_v_spz; - double __pyx_v_slen; - double __pyx_v_clen; - double __pyx_v_incr; - double __pyx_v_off_diag; - double *__pyx_v_dest; - double *__pyx_v_box_dim; - int __pyx_v_ds_pos1; - int __pyx_v_ds_pos2; - int __pyx_v_shell; - int __pyx_v_ix3; - int __pyx_v_ix4; - int __pyx_v_apr_core; - int __pyx_v_apr_surround; - __Pyx_LocalBuf_ND __pyx_pybuffernd_np_box_dim; - __Pyx_Buffer __pyx_pybuffer_np_box_dim; - __Pyx_LocalBuf_ND __pyx_pybuffernd_np_dest; - __Pyx_Buffer __pyx_pybuffer_np_dest; +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - double __pyx_t_10; - double __pyx_t_11; - long __pyx_t_12; + __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 624, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_c_contig", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcHistoVoronoiNonSelf", 0); - __pyx_pybuffer_np_dest.pybuffer.buf = NULL; - __pyx_pybuffer_np_dest.refcount = 0; - __pyx_pybuffernd_np_dest.data = NULL; - __pyx_pybuffernd_np_dest.rcbuffer = &__pyx_pybuffer_np_dest; - __pyx_pybuffer_np_box_dim.pybuffer.buf = NULL; - __pyx_pybuffer_np_box_dim.refcount = 0; - __pyx_pybuffernd_np_box_dim.data = NULL; - __pyx_pybuffernd_np_box_dim.rcbuffer = &__pyx_pybuffer_np_box_dim; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_dest, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 667, __pyx_L1_error) - } - __pyx_pybuffernd_np_dest.diminfo[0].strides = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_dest.diminfo[0].shape = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_box_dim, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 667, __pyx_L1_error) - } - __pyx_pybuffernd_np_box_dim.diminfo[0].strides = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_box_dim.diminfo[0].shape = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.shape[0]; + __Pyx_RefNannySetupContext("is_c_contig", 0); - /* "src/gfunction/gfunction.pyx":672 + /* "View.MemoryView":627 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * - * #cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 # Change ix1, ix2 - * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 - * cdef double *dest = np_dest.data */ - __pyx_v_ix1 = ((__pyx_v_nshells * __pyx_v_ncore) * __pyx_v_histo_n); - __pyx_v_j_begin = 0; + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 627, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":673 - * #cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 # Change ix1, ix2 - * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 # <<<<<<<<<<<<<< - * cdef double *dest = np_dest.data - * cdef double *box_dim = np_box_dim.data + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * + * def is_f_contig(self): */ - __pyx_v_off_diag = 1.0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":674 - * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 - * cdef double *dest = np_dest.data # <<<<<<<<<<<<<< - * cdef double *box_dim = np_box_dim.data - * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 + /* "View.MemoryView":624 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - __pyx_v_dest = ((double *)__pyx_v_np_dest->data); - /* "src/gfunction/gfunction.pyx":675 - * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 - * cdef double *dest = np_dest.data - * cdef double *box_dim = np_box_dim.data # <<<<<<<<<<<<<< - * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 - * cdef int apr_core = ncore / nm_core + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - __pyx_v_box_dim = ((double *)__pyx_v_np_box_dim->data); - /* "src/gfunction/gfunction.pyx":677 - * cdef double *box_dim = np_box_dim.data - * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 - * cdef int apr_core = ncore / nm_core # <<<<<<<<<<<<<< - * cdef int apr_surround = nsurround / nm_surround +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 630, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_f_contig", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_f_contig", 0); + + /* "View.MemoryView":633 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * */ - if (unlikely(__pyx_v_nm_core == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 677, __pyx_L1_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nm_core == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_ncore))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 677, __pyx_L1_error) - } - __pyx_v_apr_core = __Pyx_div_int(__pyx_v_ncore, __pyx_v_nm_core); + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 633, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":678 - * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 - * cdef int apr_core = ncore / nm_core - * cdef int apr_surround = nsurround / nm_surround # <<<<<<<<<<<<<< + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< * + * def copy(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - if (unlikely(__pyx_v_nm_surround == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 678, __pyx_L1_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nm_surround == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_nsurround))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 678, __pyx_L1_error) - } - __pyx_v_apr_surround = __Pyx_div_int(__pyx_v_nsurround, __pyx_v_nm_surround); - /* "src/gfunction/gfunction.pyx":683 - * #TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * - * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< - * #ix2=i*histo_n - * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_ncore; - if ((1 == 0)) abort(); - { - double __pyx_parallel_temp0 = ((double)__PYX_NAN()); - double __pyx_parallel_temp1 = ((double)__PYX_NAN()); - double __pyx_parallel_temp2 = ((double)__PYX_NAN()); - double __pyx_parallel_temp3 = ((double)__PYX_NAN()); - double __pyx_parallel_temp4 = ((double)__PYX_NAN()); - int __pyx_parallel_temp5 = ((int)0xbad0bad0); - int __pyx_parallel_temp6 = ((int)0xbad0bad0); - double __pyx_parallel_temp7 = ((double)__PYX_NAN()); - double __pyx_parallel_temp8 = ((double)__PYX_NAN()); - double __pyx_parallel_temp9 = ((double)__PYX_NAN()); - int __pyx_parallel_temp10 = ((int)0xbad0bad0); - double __pyx_parallel_temp11 = ((double)__PYX_NAN()); - int __pyx_parallel_temp12 = ((int)0xbad0bad0); - int __pyx_parallel_temp13 = ((int)0xbad0bad0); - int __pyx_parallel_temp14 = ((int)0xbad0bad0); - int __pyx_parallel_temp15 = ((int)0xbad0bad0); - int __pyx_parallel_temp16 = ((int)0xbad0bad0); - double __pyx_parallel_temp17 = ((double)__PYX_NAN()); - int __pyx_parallel_temp18 = ((int)0xbad0bad0); - int __pyx_parallel_temp19 = ((int)0xbad0bad0); - double __pyx_parallel_temp20 = ((double)__PYX_NAN()); - double __pyx_parallel_temp21 = ((double)__PYX_NAN()); - double __pyx_parallel_temp22 = ((double)__PYX_NAN()); - double __pyx_parallel_temp23 = ((double)__PYX_NAN()); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_clen) lastprivate(__pyx_v_cpx) lastprivate(__pyx_v_cpy) lastprivate(__pyx_v_cpz) lastprivate(__pyx_v_dist) lastprivate(__pyx_v_ds_pos1) lastprivate(__pyx_v_ds_pos2) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_incr) lastprivate(__pyx_v_ix2) lastprivate(__pyx_v_ix3) lastprivate(__pyx_v_ix4) lastprivate(__pyx_v_j) lastprivate(__pyx_v_j_begin) lastprivate(__pyx_v_off_diag) lastprivate(__pyx_v_pos) lastprivate(__pyx_v_shell) lastprivate(__pyx_v_slen) lastprivate(__pyx_v_spx) lastprivate(__pyx_v_spy) lastprivate(__pyx_v_spz) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - /* Initialize private variables to invalid values */ - __pyx_v_clen = ((double)__PYX_NAN()); - __pyx_v_cpx = ((double)__PYX_NAN()); - __pyx_v_cpy = ((double)__PYX_NAN()); - __pyx_v_cpz = ((double)__PYX_NAN()); - __pyx_v_dist = ((double)__PYX_NAN()); - __pyx_v_ds_pos1 = ((int)0xbad0bad0); - __pyx_v_ds_pos2 = ((int)0xbad0bad0); - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_incr = ((double)__PYX_NAN()); - __pyx_v_ix2 = ((int)0xbad0bad0); - __pyx_v_ix3 = ((int)0xbad0bad0); - __pyx_v_ix4 = ((int)0xbad0bad0); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_j_begin = ((int)0xbad0bad0); - __pyx_v_off_diag = ((double)__PYX_NAN()); - __pyx_v_pos = ((int)0xbad0bad0); - __pyx_v_shell = ((int)0xbad0bad0); - __pyx_v_slen = ((double)__PYX_NAN()); - __pyx_v_spx = ((double)__PYX_NAN()); - __pyx_v_spy = ((double)__PYX_NAN()); - __pyx_v_spz = ((double)__PYX_NAN()); - /* "src/gfunction/gfunction.pyx":685 - * for i in prange(ncore, nogil=True): - * #ix2=i*histo_n - * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE # <<<<<<<<<<<<<< - * ds_pos1 = i/apr_core - * - */ - __pyx_v_ix2 = ((__pyx_v_i * __pyx_v_nshells) * __pyx_v_histo_n); +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 636, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/gfunction/gfunction.pyx":686 - * #ix2=i*histo_n - * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE - * ds_pos1 = i/apr_core # <<<<<<<<<<<<<< - * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - */ - if (unlikely(__pyx_v_apr_core == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 686, __pyx_L8_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_apr_core == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_i))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 686, __pyx_L8_error) - } - __pyx_v_ds_pos1 = __Pyx_div_int(__pyx_v_i, __pyx_v_apr_core); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":688 - * ds_pos1 = i/apr_core - * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] - */ - __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 4) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 32) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L11_bool_binop_done:; - if (__pyx_t_4) { +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); - /* "src/gfunction/gfunction.pyx":689 + /* "View.MemoryView":638 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - * cpx = core_dip[i*3] # <<<<<<<<<<<<<< - * cpy = core_dip[i*3+1] - * cpz = core_dip[i*3+2] - */ - __pyx_v_cpx = (__pyx_v_core_dip[(__pyx_v_i * 3)]); - - /* "src/gfunction/gfunction.pyx":690 - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] # <<<<<<<<<<<<<< - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - */ - __pyx_v_cpy = (__pyx_v_core_dip[((__pyx_v_i * 3) + 1)]); - - /* "src/gfunction/gfunction.pyx":691 - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] - * cpz = core_dip[i*3+2] # <<<<<<<<<<<<<< - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: - */ - __pyx_v_cpz = (__pyx_v_core_dip[((__pyx_v_i * 3) + 2)]); - - /* "src/gfunction/gfunction.pyx":692 - * cpy = core_dip[i*3+1] - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) # <<<<<<<<<<<<<< - * if ncore == nsurround: - * j_begin = i + * slice_copy(self, &mslice) */ - __pyx_v_clen = sqrt((((__pyx_v_cpx * __pyx_v_cpx) + (__pyx_v_cpy * __pyx_v_cpy)) + (__pyx_v_cpz * __pyx_v_cpz))); + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - /* "src/gfunction/gfunction.pyx":688 - * ds_pos1 = i/apr_core + /* "View.MemoryView":640 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS * - * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< - * cpx = core_dip[i*3] - * cpy = core_dip[i*3+1] - */ - } - - /* "src/gfunction/gfunction.pyx":693 - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: # <<<<<<<<<<<<<< - * j_begin = i - * else: - */ - __pyx_t_4 = ((__pyx_v_ncore == __pyx_v_nsurround) != 0); - if (__pyx_t_4) { - - /* "src/gfunction/gfunction.pyx":694 - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: - * j_begin = i # <<<<<<<<<<<<<< - * else: - * j_begin = 0 - */ - __pyx_v_j_begin = __pyx_v_i; - - /* "src/gfunction/gfunction.pyx":693 - * cpz = core_dip[i*3+2] - * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) - * if ncore == nsurround: # <<<<<<<<<<<<<< - * j_begin = i - * else: - */ - goto __pyx_L15; - } - - /* "src/gfunction/gfunction.pyx":696 - * j_begin = i - * else: - * j_begin = 0 # <<<<<<<<<<<<<< - * for j in range(j_begin,nsurround): - * ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 3 - */ - /*else*/ { - __pyx_v_j_begin = 0; - } - __pyx_L15:; - - /* "src/gfunction/gfunction.pyx":697 - * else: - * j_begin = 0 - * for j in range(j_begin,nsurround): # <<<<<<<<<<<<<< - * ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 3 - * if(ds_pos1 == ds_pos2): continue - */ - __pyx_t_6 = __pyx_v_nsurround; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = __pyx_v_j_begin; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_j = __pyx_t_8; - - /* "src/gfunction/gfunction.pyx":698 - * j_begin = 0 - * for j in range(j_begin,nsurround): - * ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 3 # <<<<<<<<<<<<<< - * if(ds_pos1 == ds_pos2): continue - * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? - */ - if (unlikely(__pyx_v_apr_surround == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 698, __pyx_L8_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_apr_surround == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_j))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 698, __pyx_L8_error) - } - __pyx_v_ds_pos2 = __Pyx_div_int(__pyx_v_j, __pyx_v_apr_surround); - - /* "src/gfunction/gfunction.pyx":699 - * for j in range(j_begin,nsurround): - * ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 3 - * if(ds_pos1 == ds_pos2): continue # <<<<<<<<<<<<<< - * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? - * shell = shell-1 - */ - __pyx_t_4 = ((__pyx_v_ds_pos1 == __pyx_v_ds_pos2) != 0); - if (__pyx_t_4) { - goto __pyx_L16_continue; - } - - /* "src/gfunction/gfunction.pyx":700 - * ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 3 - * if(ds_pos1 == ds_pos2): continue - * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? # <<<<<<<<<<<<<< - * shell = shell-1 - * if shell < 0: shell = nshells-1 - */ - __pyx_v_shell = (__pyx_v_delaunay_matrix[((__pyx_v_ds_pos1 * __pyx_v_nsurround) + __pyx_v_ds_pos2)]); - - /* "src/gfunction/gfunction.pyx":701 - * if(ds_pos1 == ds_pos2): continue - * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? - * shell = shell-1 # <<<<<<<<<<<<<< - * if shell < 0: shell = nshells-1 - * if shell >= nshells: shell = nshells-1 + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, */ - __pyx_v_shell = (__pyx_v_shell - 1); + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - /* "src/gfunction/gfunction.pyx":702 - * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? - * shell = shell-1 - * if shell < 0: shell = nshells-1 # <<<<<<<<<<<<<< - * if shell >= nshells: shell = nshells-1 + /* "View.MemoryView":641 * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, */ - __pyx_t_4 = ((__pyx_v_shell < 0) != 0); - if (__pyx_t_4) { - __pyx_v_shell = (__pyx_v_nshells - 1); - } + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 641, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":703 - * shell = shell-1 - * if shell < 0: shell = nshells-1 - * if shell >= nshells: shell = nshells-1 # <<<<<<<<<<<<<< + /* "View.MemoryView":646 + * self.dtype_is_object) * - * if ncore == nsurround and i != j: - */ - __pyx_t_4 = ((__pyx_v_shell >= __pyx_v_nshells) != 0); - if (__pyx_t_4) { - __pyx_v_shell = (__pyx_v_nshells - 1); - } - - /* "src/gfunction/gfunction.pyx":705 - * if shell >= nshells: shell = nshells-1 + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< * - * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< - * off_diag = 2.0 - * else: + * def copy_fortran(self): */ - __pyx_t_5 = ((__pyx_v_ncore == __pyx_v_nsurround) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L22_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_i != __pyx_v_j) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L22_bool_binop_done:; - if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":706 + /* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * - * if ncore == nsurround and i != j: - * off_diag = 2.0 # <<<<<<<<<<<<<< - * else: - * off_diag = 1.0 + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ - __pyx_v_off_diag = 2.0; - /* "src/gfunction/gfunction.pyx":705 - * if shell >= nshells: shell = nshells-1 - * - * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< - * off_diag = 2.0 - * else: - */ - goto __pyx_L21; - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":708 - * off_diag = 2.0 - * else: - * off_diag = 1.0 # <<<<<<<<<<<<<< - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - * spx = surr_dip[j*3] +/* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ - /*else*/ { - __pyx_v_off_diag = 1.0; - } - __pyx_L21:; - /* "src/gfunction/gfunction.pyx":709 - * else: - * off_diag = 1.0 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] - */ - __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L25_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 8) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L25_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L25_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 64) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L25_bool_binop_done:; - if (__pyx_t_4) { +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 648, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy_fortran", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/gfunction/gfunction.pyx":710 - * off_diag = 1.0 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - * spx = surr_dip[j*3] # <<<<<<<<<<<<<< - * spy = surr_dip[j*3+1] - * spz = surr_dip[j*3+2] - */ - __pyx_v_spx = (__pyx_v_surr_dip[(__pyx_v_j * 3)]); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":711 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] # <<<<<<<<<<<<<< - * spz = surr_dip[j*3+2] - * slen = sqrt(spx*spx+spy*spy+spz*spz) - */ - __pyx_v_spy = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 1)]); +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); - /* "src/gfunction/gfunction.pyx":712 - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] - * spz = surr_dip[j*3+2] # <<<<<<<<<<<<<< - * slen = sqrt(spx*spx+spy*spy+spz*spz) + /* "View.MemoryView":650 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< * + * slice_copy(self, &src) */ - __pyx_v_spz = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 2)]); + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - /* "src/gfunction/gfunction.pyx":713 - * spy = surr_dip[j*3+1] - * spz = surr_dip[j*3+2] - * slen = sqrt(spx*spx+spy*spy+spz*spz) # <<<<<<<<<<<<<< + /* "View.MemoryView":652 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS * - * dx = surr_xyz[j*3] - core_xyz[i*3] - */ - __pyx_v_slen = sqrt((((__pyx_v_spx * __pyx_v_spx) + (__pyx_v_spy * __pyx_v_spy)) + (__pyx_v_spz * __pyx_v_spz))); - - /* "src/gfunction/gfunction.pyx":709 - * else: - * off_diag = 1.0 - * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< - * spx = surr_dip[j*3] - * spy = surr_dip[j*3+1] + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, */ - } + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); - /* "src/gfunction/gfunction.pyx":715 - * slen = sqrt(spx*spx+spy*spy+spz*spz) + /* "View.MemoryView":653 * - * dx = surr_xyz[j*3] - core_xyz[i*3] # <<<<<<<<<<<<<< - * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, */ - __pyx_v_dx = ((__pyx_v_surr_xyz[(__pyx_v_j * 3)]) - (__pyx_v_core_xyz[(__pyx_v_i * 3)])); + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 653, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":716 + /* "View.MemoryView":658 + * self.dtype_is_object) * - * dx = surr_xyz[j*3] - core_xyz[i*3] - * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] # <<<<<<<<<<<<<< - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< * - */ - __pyx_v_dy = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 1)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 1)])); - - /* "src/gfunction/gfunction.pyx":717 - * dx = surr_xyz[j*3] - core_xyz[i*3] - * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] # <<<<<<<<<<<<<< * - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] */ - __pyx_v_dz = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 2)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 2)])); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":719 - * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] + /* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) * - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] # <<<<<<<<<<<<<< - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ - __pyx_t_4 = ((fabs(__pyx_v_dx) > (__pyx_v_box_dim[3])) != 0); - if (__pyx_t_4) { - __pyx_v_dx = (__pyx_v_dx - (((0.0 < __pyx_v_dx) - (__pyx_v_dx < 0.0)) * (__pyx_v_box_dim[0]))); - } - /* "src/gfunction/gfunction.pyx":720 - * - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] # <<<<<<<<<<<<<< - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] - * dist = sqrt(dx*dx+dy*dy+dz*dz) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_4 = ((fabs(__pyx_v_dy) > (__pyx_v_box_dim[4])) != 0); - if (__pyx_t_4) { - __pyx_v_dy = (__pyx_v_dy - (((0.0 < __pyx_v_dy) - (__pyx_v_dy < 0.0)) * (__pyx_v_box_dim[1]))); - } - /* "src/gfunction/gfunction.pyx":721 - * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] # <<<<<<<<<<<<<< - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_4 = ((fabs(__pyx_v_dz) > (__pyx_v_box_dim[5])) != 0); - if (__pyx_t_4) { - __pyx_v_dz = (__pyx_v_dz - (((0.0 < __pyx_v_dz) - (__pyx_v_dz < 0.0)) * (__pyx_v_box_dim[2]))); - } + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":722 - * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] - * dist = sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< - * if disthisto_max or floor(dist*invdx)==0: continue - * pos = floor((dist-histo_min)*invdx) + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - __pyx_v_dist = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* "src/gfunction/gfunction.pyx":723 - * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue # <<<<<<<<<<<<<< - * pos = floor((dist-histo_min)*invdx) + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":662 * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ - __pyx_t_5 = ((__pyx_v_dist < __pyx_v_histo_min) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L33_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_dist > __pyx_v_histo_max) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L33_bool_binop_done; - } - __pyx_t_5 = ((floor((__pyx_v_dist * __pyx_v_invdx)) == 0.0) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L33_bool_binop_done:; - if (__pyx_t_4) { - goto __pyx_L16_continue; - } - /* "src/gfunction/gfunction.pyx":724 - * dist = sqrt(dx*dx+dy*dy+dz*dz) - * if disthisto_max or floor(dist*invdx)==0: continue - * pos = floor((dist-histo_min)*invdx) # <<<<<<<<<<<<<< +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":663 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result + */ + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":664 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result * - * #pos -> idx3 */ - __pyx_v_pos = ((int)floor(((__pyx_v_dist - __pyx_v_histo_min) * __pyx_v_invdx))); + __pyx_v_result->typeinfo = __pyx_v_typeinfo; - /* "src/gfunction/gfunction.pyx":746 - * """ + /* "View.MemoryView":665 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< * - * ix3 = pos*nshells # <<<<<<<<<<<<<< - * ix4 = shell + * @cname('__pyx_memoryview_check') + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":662 * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ - __pyx_v_ix3 = (__pyx_v_pos * __pyx_v_nshells); - /* "src/gfunction/gfunction.pyx":747 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":668 * - * ix3 = pos*nshells - * ix4 = shell # <<<<<<<<<<<<<< + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) * - * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag */ - __pyx_v_ix4 = __pyx_v_shell; - /* "src/gfunction/gfunction.pyx":749 - * ix4 = shell - * - * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag # <<<<<<<<<<<<<< +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("memoryview_check", 0); + + /* "View.MemoryView":669 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< * - * if mode_sel & 2 or mode_sel & 16: + * cdef tuple _unellipsify(object index, int ndim): */ - __pyx_t_4 = ((__pyx_v_mode_sel & 1) != 0); - if (__pyx_t_4) { - __pyx_t_9 = ((__pyx_v_ix2 + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_9]) = ((__pyx_v_dest[__pyx_t_9]) + (1.0 * __pyx_v_off_diag)); - } + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":751 - * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag + /* "View.MemoryView":668 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) * - * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag */ - __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L38_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L38_bool_binop_done:; - if (__pyx_t_4) { - /* "src/gfunction/gfunction.pyx":752 + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":671 + * return isinstance(o, memoryview) * - * if mode_sel & 2 or mode_sel & 16: - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) # <<<<<<<<<<<<<< - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with */ - __pyx_t_10 = (((__pyx_v_cpx * __pyx_v_spx) + (__pyx_v_cpy * __pyx_v_spy)) + (__pyx_v_cpz * __pyx_v_spz)); - __pyx_t_11 = (__pyx_v_clen * __pyx_v_slen); - if (unlikely(__pyx_t_11 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 752, __pyx_L8_error) - } - __pyx_v_incr = (__pyx_t_10 / __pyx_t_11); - /* "src/gfunction/gfunction.pyx":753 - * if mode_sel & 2 or mode_sel & 16: - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_UCS4 __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":677 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< + * + * result = [slice(None)] * ndim */ - __pyx_t_4 = ((__pyx_v_mode_sel & 2) != 0); - if (__pyx_t_4) { - __pyx_t_9 = (((__pyx_v_ix1 + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_9]) = ((__pyx_v_dest[__pyx_t_9]) + (__pyx_v_incr * __pyx_v_off_diag)); - } + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index)) __PYX_ERR(1, 677, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":754 - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 4 or mode_sel & 32: - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False */ - __pyx_t_4 = ((__pyx_v_mode_sel & 16) != 0); - if (__pyx_t_4) { - __pyx_t_12 = ((((4 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); - } + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":751 - * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag + /* "View.MemoryView":680 * - * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< - * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 */ - } + __pyx_v_have_slices = 0; - /* "src/gfunction/gfunction.pyx":755 - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + /* "View.MemoryView":681 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: */ - __pyx_t_5 = ((__pyx_v_mode_sel & 4) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L43_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 32) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L43_bool_binop_done:; - if (__pyx_t_4) { + __pyx_v_seen_ellipsis = 0; - /* "src/gfunction/gfunction.pyx":756 - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) # <<<<<<<<<<<<<< - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + /* "View.MemoryView":682 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: */ - __pyx_t_11 = (((__pyx_v_cpx * __pyx_v_dx) + (__pyx_v_cpy * __pyx_v_dy)) + (__pyx_v_cpz * __pyx_v_dz)); - __pyx_t_10 = (__pyx_v_clen * __pyx_v_dist); - if (unlikely(__pyx_t_10 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 756, __pyx_L8_error) - } - __pyx_v_incr = (__pyx_t_11 / __pyx_t_10); + __pyx_v_idx = 0; - /* "src/gfunction/gfunction.pyx":757 - * if mode_sel & 4 or mode_sel & 32: - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: */ - __pyx_t_4 = ((__pyx_v_mode_sel & 4) != 0); - if (__pyx_t_4) { - __pyx_t_12 = ((((2 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + (__pyx_v_incr * __pyx_v_off_diag)); - } + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 683, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; + for (;;) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 683, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; - /* "src/gfunction/gfunction.pyx":758 - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 8 or mode_sel & 64: - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) */ - __pyx_t_4 = ((__pyx_v_mode_sel & 32) != 0); - if (__pyx_t_4) { - __pyx_t_12 = ((((5 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); - } + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":755 - * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< - * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True */ - } + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":759 - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag + /* "View.MemoryView":686 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True */ - __pyx_t_5 = ((__pyx_v_mode_sel & 8) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L48_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_mode_sel & 64) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L48_bool_binop_done:; - if (__pyx_t_4) { + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 686, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 686, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); - /* "src/gfunction/gfunction.pyx":760 - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) # <<<<<<<<<<<<<< - * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + /* "View.MemoryView":687 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: */ - __pyx_t_10 = (((__pyx_v_spx * __pyx_v_dx) + (__pyx_v_spy * __pyx_v_dy)) + (__pyx_v_spz * __pyx_v_dz)); - __pyx_t_11 = (__pyx_v_slen * __pyx_v_dist); - if (unlikely(__pyx_t_11 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 760, __pyx_L8_error) - } - __pyx_v_incr = (__pyx_t_10 / __pyx_t_11); + __pyx_v_seen_ellipsis = 1; - /* "src/gfunction/gfunction.pyx":761 - * if mode_sel & 8 or mode_sel & 64: - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< - * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True */ - __pyx_t_4 = ((__pyx_v_mode_sel & 8) != 0); - if (__pyx_t_4) { - __pyx_t_12 = ((((3 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + (__pyx_v_incr * __pyx_v_off_diag)); - } + } - /* "src/gfunction/gfunction.pyx":762 - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< - * - * + /* "View.MemoryView":688 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): */ - __pyx_t_4 = ((__pyx_v_mode_sel & 64) != 0); - if (__pyx_t_4) { - __pyx_t_12 = ((((6 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); - (__pyx_v_dest[__pyx_t_12]) = ((__pyx_v_dest[__pyx_t_12]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); - } + __pyx_v_have_slices = 1; - /* "src/gfunction/gfunction.pyx":759 - * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag - * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag - * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< - * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) - * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) */ - } - __pyx_L16_continue:; - } - goto __pyx_L53; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L52; - __pyx_L52:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates10) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_clen; - __pyx_parallel_temp1 = __pyx_v_cpx; - __pyx_parallel_temp2 = __pyx_v_cpy; - __pyx_parallel_temp3 = __pyx_v_cpz; - __pyx_parallel_temp4 = __pyx_v_dist; - __pyx_parallel_temp5 = __pyx_v_ds_pos1; - __pyx_parallel_temp6 = __pyx_v_ds_pos2; - __pyx_parallel_temp7 = __pyx_v_dx; - __pyx_parallel_temp8 = __pyx_v_dy; - __pyx_parallel_temp9 = __pyx_v_dz; - __pyx_parallel_temp10 = __pyx_v_i; - __pyx_parallel_temp11 = __pyx_v_incr; - __pyx_parallel_temp12 = __pyx_v_ix2; - __pyx_parallel_temp13 = __pyx_v_ix3; - __pyx_parallel_temp14 = __pyx_v_ix4; - __pyx_parallel_temp15 = __pyx_v_j; - __pyx_parallel_temp16 = __pyx_v_j_begin; - __pyx_parallel_temp17 = __pyx_v_off_diag; - __pyx_parallel_temp18 = __pyx_v_pos; - __pyx_parallel_temp19 = __pyx_v_shell; - __pyx_parallel_temp20 = __pyx_v_slen; - __pyx_parallel_temp21 = __pyx_v_spx; - __pyx_parallel_temp22 = __pyx_v_spy; - __pyx_parallel_temp23 = __pyx_v_spz; - } - __pyx_L53:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_clen = __pyx_parallel_temp0; - __pyx_v_cpx = __pyx_parallel_temp1; - __pyx_v_cpy = __pyx_parallel_temp2; - __pyx_v_cpz = __pyx_parallel_temp3; - __pyx_v_dist = __pyx_parallel_temp4; - __pyx_v_ds_pos1 = __pyx_parallel_temp5; - __pyx_v_ds_pos2 = __pyx_parallel_temp6; - __pyx_v_dx = __pyx_parallel_temp7; - __pyx_v_dy = __pyx_parallel_temp8; - __pyx_v_dz = __pyx_parallel_temp9; - __pyx_v_i = __pyx_parallel_temp10; - __pyx_v_incr = __pyx_parallel_temp11; - __pyx_v_ix2 = __pyx_parallel_temp12; - __pyx_v_ix3 = __pyx_parallel_temp13; - __pyx_v_ix4 = __pyx_parallel_temp14; - __pyx_v_j = __pyx_parallel_temp15; - __pyx_v_j_begin = __pyx_parallel_temp16; - __pyx_v_off_diag = __pyx_parallel_temp17; - __pyx_v_pos = __pyx_parallel_temp18; - __pyx_v_shell = __pyx_parallel_temp19; - __pyx_v_slen = __pyx_parallel_temp20; - __pyx_v_spx = __pyx_parallel_temp21; - __pyx_v_spy = __pyx_parallel_temp22; - __pyx_v_spz = __pyx_parallel_temp23; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif + goto __pyx_L5; + } + + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): + */ + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { + + /* "View.MemoryView":691 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + */ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): + */ + goto __pyx_L7; } - /* "src/gfunction/gfunction.pyx":683 - * #TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells - * - * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< - * #ix2=i*histo_n - * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + */ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":693 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = 127; + __Pyx_INCREF(__pyx_kp_u_Cannot_index_with_type); + __pyx_t_5 += 24; + __Pyx_GIVEREF(__pyx_kp_u_Cannot_index_with_type); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Cannot_index_with_type); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_5 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__6); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 693, __pyx_L1_error) + + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; } + __pyx_L7:; + + /* "View.MemoryView":694 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 + * + */ + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0))) __PYX_ERR(1, 694, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":695 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx + */ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: + */ } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":667 + /* "View.MemoryView":697 + * idx += 1 * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) * - * cdef void calcHistoVoronoiNonSelf(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, - * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel, int nm_core, int nm_surround, int nshells, int * delaunay_matrix): */ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); - /* function exit code */ + /* "View.MemoryView":698 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + */ + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 698, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; + + /* "View.MemoryView":671 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with + */ + + /* function exit code */ __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_WriteUnraisable("newanalysis.gfunction.calcHistoVoronoiNonSelf", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); - __pyx_L2:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "src/gfunction/gfunction.pyx":772 - * """ +/* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) * - * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, nshells, box_y=None, box_z=None, use_cuda=False, norm_volume=None, exclude_self_mol=False): # <<<<<<<<<<<<<< - * """ - * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi___init__[] = "\n RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False)\n\n Creates a new rdf container.\n\n modes .. a list of gfunctions to calculate\n e.g. [\"all\"] -> calculate all gfunctions\n [\"000\",\"110\",\"220\"] -> calculate only g000, g110 and g220\n histo_min .. lower bound of histogram\n histo_max .. upper bound of histogram\n histo_dr .. histogram bin width\n sel1_n .. number of particles in first selection\n sel2_n .. number of particles in second selection\n sel1_nmol .. number of molecules in first selection; needed for correct normalisation, if multiple atoms from the same molecule are selected\n sel2_nmol .. number of molecules in second selection\n box_x .. box length, x dim\n box_y .. box length, y dim (optional; if None, y=x)\n box_z .. box length, z dim (optional; if None, z=x)\n use_cuda .. whether to use cuda, if available (default=False)\n norm_volume .. volume to use for calculating the density during normalization (default = None)\n\n Usage example:\n my_rdf = RDF([\"all\"], 0.0, 50.0, 0.05, 200, 200, 200, 200, 25.0)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi___init__}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_modes = 0; - PyObject *__pyx_v_histo_min = 0; - PyObject *__pyx_v_histo_max = 0; - PyObject *__pyx_v_histo_dr = 0; - PyObject *__pyx_v_sel1_n = 0; - PyObject *__pyx_v_sel2_n = 0; - PyObject *__pyx_v_sel1_nmol = 0; - PyObject *__pyx_v_sel2_nmol = 0; - PyObject *__pyx_v_box_x = 0; - PyObject *__pyx_v_nshells = 0; - PyObject *__pyx_v_box_y = 0; - PyObject *__pyx_v_box_z = 0; - CYTHON_UNUSED PyObject *__pyx_v_use_cuda = 0; - PyObject *__pyx_v_norm_volume = 0; - PyObject *__pyx_v_exclude_self_mol = 0; +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_modes,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_histo_dr,&__pyx_n_s_sel1_n,&__pyx_n_s_sel2_n,&__pyx_n_s_sel1_nmol,&__pyx_n_s_sel2_nmol,&__pyx_n_s_box_x,&__pyx_n_s_nshells,&__pyx_n_s_box_y,&__pyx_n_s_box_z,&__pyx_n_s_use_cuda,&__pyx_n_s_norm_volume,&__pyx_n_s_exclude_self_mol,0}; - PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - values[11] = ((PyObject *)((PyObject *)Py_None)); - values[12] = ((PyObject *)((PyObject *)Py_None)); - values[13] = ((PyObject *)((PyObject *)Py_False)); - values[14] = ((PyObject *)((PyObject *)Py_None)); - values[15] = ((PyObject *)((PyObject *)Py_False)); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); - CYTHON_FALLTHROUGH; - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - CYTHON_FALLTHROUGH; - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_modes)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 1); __PYX_ERR(0, 772, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_min)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 2); __PYX_ERR(0, 772, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_max)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 3); __PYX_ERR(0, 772, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_dr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 4); __PYX_ERR(0, 772, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel1_n)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 5); __PYX_ERR(0, 772, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel2_n)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 6); __PYX_ERR(0, 772, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel1_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 7); __PYX_ERR(0, 772, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sel2_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 8); __PYX_ERR(0, 772, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 9: - if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_x)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 9); __PYX_ERR(0, 772, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 10: - if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 10); __PYX_ERR(0, 772, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 11: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_y); - if (value) { values[11] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 12: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_z); - if (value) { values[12] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 13: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_cuda); - if (value) { values[13] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 14: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_norm_volume); - if (value) { values[14] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 15: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exclude_self_mol); - if (value) { values[15] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 772, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); - CYTHON_FALLTHROUGH; - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - CYTHON_FALLTHROUGH; - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); + + /* "View.MemoryView":701 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + */ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag + */ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":703 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 703, __pyx_L1_error) + + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag + */ } - __pyx_v_self = values[0]; - __pyx_v_modes = values[1]; - __pyx_v_histo_min = values[2]; - __pyx_v_histo_max = values[3]; - __pyx_v_histo_dr = values[4]; - __pyx_v_sel1_n = values[5]; - __pyx_v_sel2_n = values[6]; - __pyx_v_sel1_nmol = values[7]; - __pyx_v_sel2_nmol = values[8]; - __pyx_v_box_x = values[9]; - __pyx_v_nshells = values[10]; - __pyx_v_box_y = values[11]; - __pyx_v_box_z = values[12]; - __pyx_v_use_cuda = values[13]; - __pyx_v_norm_volume = values[14]; - __pyx_v_exclude_self_mol = values[15]; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 772, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi___init__(__pyx_self, __pyx_v_self, __pyx_v_modes, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_dr, __pyx_v_sel1_n, __pyx_v_sel2_n, __pyx_v_sel1_nmol, __pyx_v_sel2_nmol, __pyx_v_box_x, __pyx_v_nshells, __pyx_v_box_y, __pyx_v_box_z, __pyx_v_use_cuda, __pyx_v_norm_volume, __pyx_v_exclude_self_mol); + + /* "View.MemoryView":704 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + */ /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_modes, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_dr, PyObject *__pyx_v_sel1_n, PyObject *__pyx_v_sel2_n, PyObject *__pyx_v_sel1_nmol, PyObject *__pyx_v_sel2_nmol, PyObject *__pyx_v_box_x, PyObject *__pyx_v_nshells, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z, CYTHON_UNUSED PyObject *__pyx_v_use_cuda, PyObject *__pyx_v_norm_volume, PyObject *__pyx_v_exclude_self_mol) { - int __pyx_v_mode_sel; - PyObject *__pyx_v_mode = NULL; - PyObject *__pyx_r = NULL; +/* "View.MemoryView":711 + * + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step + */ + +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("memview_slice", 0); - /* "src/gfunction/gfunction.pyx":812 - * self.dtype = np.float64 - * """ - * self.dtype = np.float64 # <<<<<<<<<<<<<< - * - * # always initialize the histogram to 7 dimensions, but only fill the desired ones + /* "View.MemoryView":712 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 812, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 812, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; - /* "src/gfunction/gfunction.pyx":815 + /* "View.MemoryView":719 * - * # always initialize the histogram to 7 dimensions, but only fill the desired ones - * cdef int mode_sel = 0 # <<<<<<<<<<<<<< * - * # select the gfunctions to calculate using bitwise operators + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj */ - __pyx_v_mode_sel = 0; + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - /* "src/gfunction/gfunction.pyx":818 + /* "View.MemoryView":723 + * cdef _memoryviewslice memviewsliceobj * - * # select the gfunctions to calculate using bitwise operators - * for mode in modes: # <<<<<<<<<<<<<< - * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 - * if mode == "000": mode_sel = mode_sel | 1 + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): */ - if (likely(PyList_CheckExact(__pyx_v_modes)) || PyTuple_CheckExact(__pyx_v_modes)) { - __pyx_t_2 = __pyx_v_modes; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 723, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 723, __pyx_L1_error) + #endif + + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice + */ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":726 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: + */ + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 726, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":727 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) + */ + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice + */ + goto __pyx_L3; + } + + /* "View.MemoryView":729 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src + * + */ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + + /* "View.MemoryView":730 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; + + /* "View.MemoryView":736 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data + * + */ + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; + + /* "View.MemoryView":737 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; + + /* "View.MemoryView":742 + * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex + */ + __pyx_v_p_dst = (&__pyx_v_dst); + + /* "View.MemoryView":743 + * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step + */ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index + */ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; + __pyx_t_7 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_modes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error) + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 747, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 818, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 747, __pyx_L1_error) } for (;;) { - if (likely(!__pyx_t_4)) { + if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 818, __pyx_L1_error) + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); #endif } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 818, __pyx_L1_error) + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); #endif } } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 818, __pyx_L1_error) + else __PYX_ERR(1, 747, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_8); } - __Pyx_XDECREF_SET(__pyx_v_mode, __pyx_t_1); - __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); - /* "src/gfunction/gfunction.pyx":819 - * # select the gfunctions to calculate using bitwise operators - * for mode in modes: - * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 # <<<<<<<<<<<<<< - * if mode == "000": mode_sel = mode_sel | 1 - * if mode == "110": mode_sel = mode_sel | 2 + /* "View.MemoryView":748 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_all, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 819, __pyx_L1_error) - if (__pyx_t_5) { - __pyx_v_mode_sel = (((((((__pyx_v_mode_sel | 1) | 2) | 4) | 8) | 16) | 32) | 64); - } + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":820 - * for mode in modes: - * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 - * if mode == "000": mode_sel = mode_sel | 1 # <<<<<<<<<<<<<< - * if mode == "110": mode_sel = mode_sel | 2 - * if mode == "101": mode_sel = mode_sel | 4 + /* "View.MemoryView":749 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_000, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 820, __pyx_L1_error) - if (__pyx_t_5) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 1); - } + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 749, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; - /* "src/gfunction/gfunction.pyx":821 - * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 - * if mode == "000": mode_sel = mode_sel | 1 - * if mode == "110": mode_sel = mode_sel | 2 # <<<<<<<<<<<<<< - * if mode == "101": mode_sel = mode_sel | 4 - * if mode == "011": mode_sel = mode_sel | 8 + /* "View.MemoryView":750 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_110, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 821, __pyx_L1_error) - if (__pyx_t_5) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 2); - } + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 750, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":822 - * if mode == "000": mode_sel = mode_sel | 1 - * if mode == "110": mode_sel = mode_sel | 2 - * if mode == "101": mode_sel = mode_sel | 4 # <<<<<<<<<<<<<< - * if mode == "011": mode_sel = mode_sel | 8 - * if mode == "220": mode_sel = mode_sel | 16 + /* "View.MemoryView":748 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_101, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 822, __pyx_L1_error) - if (__pyx_t_5) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 4); + goto __pyx_L6; } - /* "src/gfunction/gfunction.pyx":823 - * if mode == "110": mode_sel = mode_sel | 2 - * if mode == "101": mode_sel = mode_sel | 4 - * if mode == "011": mode_sel = mode_sel | 8 # <<<<<<<<<<<<<< - * if mode == "220": mode_sel = mode_sel | 16 - * if mode == "202": mode_sel = mode_sel | 32 + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_011, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 823, __pyx_L1_error) - if (__pyx_t_5) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 8); - } + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":824 - * if mode == "101": mode_sel = mode_sel | 4 - * if mode == "011": mode_sel = mode_sel | 8 - * if mode == "220": mode_sel = mode_sel | 16 # <<<<<<<<<<<<<< - * if mode == "202": mode_sel = mode_sel | 32 - * if mode == "022": mode_sel = mode_sel | 64 + /* "View.MemoryView":757 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_220, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 824, __pyx_L1_error) - if (__pyx_t_5) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 16); + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + + /* "View.MemoryView":758 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 + */ + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + + /* "View.MemoryView":759 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: + */ + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + + /* "View.MemoryView":760 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 + */ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + */ + goto __pyx_L6; } - /* "src/gfunction/gfunction.pyx":825 - * if mode == "011": mode_sel = mode_sel | 8 - * if mode == "220": mode_sel = mode_sel | 16 - * if mode == "202": mode_sel = mode_sel | 32 # <<<<<<<<<<<<<< - * if mode == "022": mode_sel = mode_sel | 64 + /* "View.MemoryView":762 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 + */ + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 762, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 762, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; + + /* "View.MemoryView":763 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 * */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_202, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 825, __pyx_L1_error) - if (__pyx_t_5) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 32); - } + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; - /* "src/gfunction/gfunction.pyx":826 - * if mode == "220": mode_sel = mode_sel | 16 - * if mode == "202": mode_sel = mode_sel | 32 - * if mode == "022": mode_sel = mode_sel | 64 # <<<<<<<<<<<<<< + /* "View.MemoryView":764 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< * - * # remember the selection + * have_start = index.start is not None */ - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_022, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 826, __pyx_L1_error) - if (__pyx_t_5) { - __pyx_v_mode_sel = (__pyx_v_mode_sel | 64); - } + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; - /* "src/gfunction/gfunction.pyx":818 + /* "View.MemoryView":766 + * step = index.step or 0 * - * # select the gfunctions to calculate using bitwise operators - * for mode in modes: # <<<<<<<<<<<<<< - * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 - * if mode == "000": mode_sel = mode_sel | 1 + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":829 + /* "View.MemoryView":767 * - * # remember the selection - * self.mode_sel = np.int32(mode_sel) # <<<<<<<<<<<<<< + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None * - * # set histogram parameters */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel, __pyx_t_2) < 0) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":832 + /* "View.MemoryView":768 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< * - * # set histogram parameters - * self.histo_min = np.float32(histo_min) # <<<<<<<<<<<<<< - * self.histo_max = np.float32(histo_max) - * self.histo_dr = np.round(self.dtype(histo_dr),5) + * slice_memviewslice( */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 832, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_histo_min) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_histo_min); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 832, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_min, __pyx_t_2) < 0) __PYX_ERR(0, 832, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":833 - * # set histogram parameters - * self.histo_min = np.float32(histo_min) - * self.histo_max = np.float32(histo_max) # <<<<<<<<<<<<<< - * self.histo_dr = np.round(self.dtype(histo_dr),5) - * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) + /* "View.MemoryView":770 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 833, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 833, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_v_histo_max) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_histo_max); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 833, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_max, __pyx_t_2) < 0) __PYX_ERR(0, 833, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 770, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":834 - * self.histo_min = np.float32(histo_min) - * self.histo_max = np.float32(histo_max) - * self.histo_dr = np.round(self.dtype(histo_dr),5) # <<<<<<<<<<<<<< - * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) - * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) + /* "View.MemoryView":776 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_round); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_histo_dr) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_histo_dr); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - __pyx_t_9 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_9 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_int_5}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_int_5}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_t_6); - __Pyx_INCREF(__pyx_int_5); - __Pyx_GIVEREF(__pyx_int_5); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_int_5); - __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr, __pyx_t_2) < 0) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_L6:; - /* "src/gfunction/gfunction.pyx":835 - * self.histo_max = np.float32(histo_max) - * self.histo_dr = np.round(self.dtype(histo_dr),5) - * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) # <<<<<<<<<<<<<< - * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) - * self.nshells = np.int32(nshells) + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_0, __pyx_t_8, 1.0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } } - __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr, __pyx_t_2) < 0) __PYX_ERR(0, 835, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/gfunction/gfunction.pyx":836 - * self.histo_dr = np.round(self.dtype(histo_dr),5) - * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) - * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) # <<<<<<<<<<<<<< - * self.nshells = np.int32(nshells) - * self.exclude_self_mol = exclude_self_mol - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_v_histo_max, __pyx_v_histo_min); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_histo_dr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyFloat_AddObjC(__pyx_t_8, __pyx_float_0_5, 0.5, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_n, __pyx_t_2) < 0) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/gfunction/gfunction.pyx":837 - * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) - * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) - * self.nshells = np.int32(nshells) # <<<<<<<<<<<<<< - * self.exclude_self_mol = exclude_self_mol + /* "View.MemoryView":778 + * new_ndim += 1 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_nshells) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_nshells); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nshells, __pyx_t_2) < 0) __PYX_ERR(0, 837, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":838 - * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) - * self.nshells = np.int32(nshells) - * self.exclude_self_mol = exclude_self_mol # <<<<<<<<<<<<<< + /* "View.MemoryView":779 * - * self.box_dim = np.zeros(6,dtype=self.dtype) + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_exclude_self_mol, __pyx_v_exclude_self_mol) < 0) __PYX_ERR(0, 838, __pyx_L1_error) + __Pyx_XDECREF((PyObject *)__pyx_r); - /* "src/gfunction/gfunction.pyx":840 - * self.exclude_self_mol = exclude_self_mol - * - * self.box_dim = np.zeros(6,dtype=self.dtype) # <<<<<<<<<<<<<< - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 + /* "View.MemoryView":780 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_box_dim, __pyx_t_6) < 0) __PYX_ERR(0, 840, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 780, __pyx_L1_error) } - /* "src/gfunction/gfunction.pyx":841 - * - * self.box_dim = np.zeros(6,dtype=self.dtype) - * self.box_dim[0] = box_x # <<<<<<<<<<<<<< - * self.box_dim[3] = box_x/2.0 - * if box_y: + /* "View.MemoryView":781 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 0, __pyx_v_box_x, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } - /* "src/gfunction/gfunction.pyx":842 - * self.box_dim = np.zeros(6,dtype=self.dtype) - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 # <<<<<<<<<<<<<< - * if box_y: - * self.box_dim[1] = box_y + /* "View.MemoryView":779 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, */ - __pyx_t_6 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_x, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 842, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 842, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_t_6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 842, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 779, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":843 - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 - * if box_y: # <<<<<<<<<<<<<< - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 + /* "View.MemoryView":778 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_box_y); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 843, __pyx_L1_error) - if (__pyx_t_5) { + } - /* "src/gfunction/gfunction.pyx":844 - * self.box_dim[3] = box_x/2.0 - * if box_y: - * self.box_dim[1] = box_y # <<<<<<<<<<<<<< - * self.box_dim[4] = box_y/2.0 - * else: + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 844, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 1, __pyx_v_box_y, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 844, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); - /* "src/gfunction/gfunction.pyx":845 - * if box_y: - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 # <<<<<<<<<<<<<< - * else: - * self.box_dim[1] = self.box_dim[0] + /* "View.MemoryView":785 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * */ - __pyx_t_6 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_y, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 845, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 845, __pyx_L1_error) + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 784, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_t_6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 845, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/gfunction/gfunction.pyx":843 - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 - * if box_y: # <<<<<<<<<<<<<< - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * */ - goto __pyx_L13; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 784, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; } - /* "src/gfunction/gfunction.pyx":847 - * self.box_dim[4] = box_y/2.0 - * else: - * self.box_dim[1] = self.box_dim[0] # <<<<<<<<<<<<<< - * self.box_dim[4] = self.box_dim[3] - * if box_z: + /* "View.MemoryView":711 + * + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 847, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 847, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 847, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 1, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 847, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/gfunction/gfunction.pyx":848 - * else: - * self.box_dim[1] = self.box_dim[0] - * self.box_dim[4] = self.box_dim[3] # <<<<<<<<<<<<<< - * if box_z: - * self.box_dim[2] = box_z - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_t_6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 848, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __pyx_L13:; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/gfunction/gfunction.pyx":849 - * self.box_dim[1] = self.box_dim[0] - * self.box_dim[4] = self.box_dim[3] - * if box_z: # <<<<<<<<<<<<<< - * self.box_dim[2] = box_z - * self.box_dim[5] = box_z/2.0 +/* "View.MemoryView":793 + * + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_box_z); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 849, __pyx_L1_error) - if (__pyx_t_5) { - /* "src/gfunction/gfunction.pyx":850 - * self.box_dim[4] = self.box_dim[3] - * if box_z: - * self.box_dim[2] = box_z # <<<<<<<<<<<<<< - * self.box_dim[5] = box_z/2.0 - * else: - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 850, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 2, __pyx_v_box_z, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 850, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("slice_memviewslice", 1); - /* "src/gfunction/gfunction.pyx":851 - * if box_z: - * self.box_dim[2] = box_z - * self.box_dim[5] = box_z/2.0 # <<<<<<<<<<<<<< - * else: - * self.box_dim[2] = self.box_dim[0] + /* "View.MemoryView":813 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: */ - __pyx_t_6 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_z, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 5, __pyx_t_6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 851, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":849 - * self.box_dim[1] = self.box_dim[0] - * self.box_dim[4] = self.box_dim[3] - * if box_z: # <<<<<<<<<<<<<< - * self.box_dim[2] = box_z - * self.box_dim[5] = box_z/2.0 + /* "View.MemoryView":815 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: */ - goto __pyx_L14; - } + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":853 - * self.box_dim[5] = box_z/2.0 - * else: - * self.box_dim[2] = self.box_dim[0] # <<<<<<<<<<<<<< - * self.box_dim[5] = self.box_dim[3] + /* "View.MemoryView":816 * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 2, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "src/gfunction/gfunction.pyx":854 - * else: - * self.box_dim[2] = self.box_dim[0] - * self.box_dim[5] = self.box_dim[3] # <<<<<<<<<<<<<< + /* "View.MemoryView":815 + * if not is_slice: * - * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 5, __pyx_t_6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 854, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __pyx_L14:; + } - /* "src/gfunction/gfunction.pyx":856 - * self.box_dim[5] = self.box_dim[3] - * - * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] # <<<<<<<<<<<<<< + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: + */ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":818 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: * - * # remember volume for each frame for normalisation */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_6, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_volume, __pyx_t_1) < 0) __PYX_ERR(0, 856, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 818, __pyx_L1_error) + + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: + */ + } - /* "src/gfunction/gfunction.pyx":859 + /* "View.MemoryView":813 + * cdef bint negative_step * - * # remember volume for each frame for normalisation - * self.volume_list = [] # <<<<<<<<<<<<<< + * if not is_slice: # <<<<<<<<<<<<<< * - * self.norm_volume = norm_volume + * if start < 0: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_volume_list, __pyx_t_1) < 0) __PYX_ERR(0, 859, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } - /* "src/gfunction/gfunction.pyx":861 - * self.volume_list = [] - * - * self.norm_volume = norm_volume # <<<<<<<<<<<<<< + /* "View.MemoryView":821 + * else: * - * # set particle numbers + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume, __pyx_v_norm_volume) < 0) __PYX_ERR(0, 861, __pyx_L1_error) + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":864 + /* "View.MemoryView":822 * - * # set particle numbers - * self.n1 = np.int32(sel1_n) # <<<<<<<<<<<<<< - * self.n2 = np.int32(sel2_n) - * self.nmol1 = sel1_nmol + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 864, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_2, __pyx_v_sel1_n) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_sel1_n); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 864, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n1, __pyx_t_1) < 0) __PYX_ERR(0, 864, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_negative_step = (__pyx_v_step < 0); - /* "src/gfunction/gfunction.pyx":865 - * # set particle numbers - * self.n1 = np.int32(sel1_n) - * self.n2 = np.int32(sel2_n) # <<<<<<<<<<<<<< - * self.nmol1 = sel1_nmol - * self.nmol2 = sel2_nmol + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 865, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 865, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_v_sel2_n) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_sel2_n); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n2, __pyx_t_1) < 0) __PYX_ERR(0, 865, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":866 - * self.n1 = np.int32(sel1_n) - * self.n2 = np.int32(sel2_n) - * self.nmol1 = sel1_nmol # <<<<<<<<<<<<<< - * self.nmol2 = sel2_nmol - * + /* "View.MemoryView":824 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nmol1, __pyx_v_sel1_nmol) < 0) __PYX_ERR(0, 866, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 824, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":867 - * self.n2 = np.int32(sel2_n) - * self.nmol1 = sel1_nmol - * self.nmol2 = sel2_nmol # <<<<<<<<<<<<<< - * - * self.oneistwo = None + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nmol2, __pyx_v_sel2_nmol) < 0) __PYX_ERR(0, 867, __pyx_L1_error) + } - /* "src/gfunction/gfunction.pyx":869 - * self.nmol2 = sel2_nmol + /* "View.MemoryView":821 + * else: * - * self.oneistwo = None # <<<<<<<<<<<<<< + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: + */ + goto __pyx_L6; + } + + /* "View.MemoryView":826 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 * - * # set frame counter to 0 */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_None) < 0) __PYX_ERR(0, 869, __pyx_L1_error) + /*else*/ { + __pyx_v_negative_step = 0; - /* "src/gfunction/gfunction.pyx":872 + /* "View.MemoryView":827 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< * - * # set frame counter to 0 - * self.ctr = 0 # <<<<<<<<<<<<<< * - * # initialize histogram array */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ctr, __pyx_int_0) < 0) __PYX_ERR(0, 872, __pyx_L1_error) + __pyx_v_step = 1; + } + __pyx_L6:; - /* "src/gfunction/gfunction.pyx":875 + /* "View.MemoryView":830 * - * # initialize histogram array - * self.histogram = np.zeros(self.nshells*self.n1*self.histo_n*7,dtype=self.dtype) # <<<<<<<<<<<<<< - * self.histogram_out = np.zeros(self.nshells*self.histo_n*7,dtype=np.float64) * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PyNumber_Multiply(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_int_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histogram, __pyx_t_8) < 0) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":876 - * # initialize histogram array - * self.histogram = np.zeros(self.nshells*self.n1*self.histo_n*7,dtype=self.dtype) - * self.histogram_out = np.zeros(self.nshells*self.histo_n*7,dtype=np.float64) # <<<<<<<<<<<<<< + /* "View.MemoryView":831 * - * # print, if CUDA device will be used and initialize arrays + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Multiply(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_int_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out, __pyx_t_7) < 0) __PYX_ERR(0, 876, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":772 - * """ - * - * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, nshells, box_y=None, box_z=None, use_cuda=False, norm_volume=None, exclude_self_mol=False): # <<<<<<<<<<<<<< - * """ - * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) + /* "View.MemoryView":832 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 */ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_mode); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: + */ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { -/* "src/gfunction/gfunction.pyx":912 - * - * - * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< - * """ - * update_box(box_x,box_y,box_z) + /* "View.MemoryView":834 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: */ + __pyx_v_start = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_3update_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_2update_box[] = "\n update_box(box_x,box_y,box_z)\n\n Update the box dimensions, when analysing NpT trajectories.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_3update_box = {"update_box", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_3update_box, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_2update_box}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_3update_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_box_x = 0; - PyObject *__pyx_v_box_y = 0; - PyObject *__pyx_v_box_z = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("update_box (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_box_x,&__pyx_n_s_box_y,&__pyx_n_s_box_z,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_x)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 1); __PYX_ERR(0, 912, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_y)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 2); __PYX_ERR(0, 912, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_z)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 3); __PYX_ERR(0, 912, __pyx_L3_error) + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: + */ } + + /* "View.MemoryView":831 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: + */ + goto __pyx_L9; } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_box") < 0)) __PYX_ERR(0, 912, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_self = values[0]; - __pyx_v_box_x = values[1]; - __pyx_v_box_y = values[2]; - __pyx_v_box_z = values[3]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 912, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.update_box", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_2update_box(__pyx_self, __pyx_v_self, __pyx_v_box_x, __pyx_v_box_y, __pyx_v_box_z); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 + */ + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_2update_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("update_box", 0); + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: + */ + if (__pyx_v_negative_step) { - /* "src/gfunction/gfunction.pyx":918 - * Update the box dimensions, when analysing NpT trajectories. - * """ - * self.box_dim[0] = box_x # <<<<<<<<<<<<<< - * self.box_dim[3] = box_x/2.0 - * self.box_dim[1] = box_y + /* "View.MemoryView":837 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_t_1, 0, __pyx_v_box_x, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 918, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_start = (__pyx_v_shape - 1); - /* "src/gfunction/gfunction.pyx":919 - * """ - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 # <<<<<<<<<<<<<< - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - __pyx_t_1 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_x, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 919, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 919, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L11; + } - /* "src/gfunction/gfunction.pyx":920 - * self.box_dim[0] = box_x - * self.box_dim[3] = box_x/2.0 - * self.box_dim[1] = box_y # <<<<<<<<<<<<<< - * self.box_dim[4] = box_y/2.0 - * self.box_dim[2] = box_z + /* "View.MemoryView":839 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_t_1, 1, __pyx_v_box_y, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 920, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; - /* "src/gfunction/gfunction.pyx":921 - * self.box_dim[3] = box_x/2.0 - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 # <<<<<<<<<<<<<< - * self.box_dim[2] = box_z - * self.box_dim[5] = box_z/2.0 + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 */ - __pyx_t_1 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_y, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 921, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 921, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L9:; - /* "src/gfunction/gfunction.pyx":922 - * self.box_dim[1] = box_y - * self.box_dim[4] = box_y/2.0 - * self.box_dim[2] = box_z # <<<<<<<<<<<<<< - * self.box_dim[5] = box_z/2.0 + /* "View.MemoryView":830 * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 922, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_t_1, 2, __pyx_v_box_z, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 922, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8; + } - /* "src/gfunction/gfunction.pyx":923 - * self.box_dim[4] = box_y/2.0 - * self.box_dim[2] = box_z - * self.box_dim[5] = box_z/2.0 # <<<<<<<<<<<<<< - * - * """ + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - __pyx_t_1 = __Pyx_PyFloat_DivideObjC(__pyx_v_box_z, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 923, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 923, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 5, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 923, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*else*/ { + if (__pyx_v_negative_step) { - /* "src/gfunction/gfunction.pyx":912 - * - * - * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< - * """ - * update_box(box_x,box_y,box_z) + /* "View.MemoryView":842 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 */ + __pyx_v_start = (__pyx_v_shape - 1); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.update_box", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: + */ + goto __pyx_L12; + } -/* "src/gfunction/gfunction.pyx":932 - * """ + /* "View.MemoryView":844 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< * - * def calcFrame(self, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, + * if have_stop: */ + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_5calcFrame(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_4calcFrame[] = "\n calcFrame(coor_sel1, coor_sel2, dip_sel1=None, dip_sel2=None,\n pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, \n pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None)\n\n Args:\n coor_sel1 .. numpy-array (dtype=numpy.float64, ndim=2, mode=\"c\") containing the coordinates of the first selection\n coor_sel2 .. numpy-array containing the coordinates of the second selection\n dip_sel1 .. numpy-array containing the dipoles of the first selection (optional, only needed for 110, 101, 220 and 202)\n dip_sel2 .. numpy-array containing the dipoles of the second selection (optional, only needed for 110, 011, 220 and 022)\n\n pre-allocated arrays: PyCUDA GPU array objects obtained from drv.memalloc()\n\n Pass the data needed to calculate the RDF for the current frame and do the calculation.\n Optionally, pre-allocated arrays on the GPU can be used. This is useful, if they are reused for more than\n one rdf calculation.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_5calcFrame = {"calcFrame", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_5calcFrame, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_4calcFrame}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_5calcFrame(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyArrayObject *__pyx_v_coor_sel1 = 0; - PyArrayObject *__pyx_v_coor_sel2 = 0; - PyArrayObject *__pyx_v_delaunay_matrix = 0; - PyArrayObject *__pyx_v_dip_sel1 = 0; - PyArrayObject *__pyx_v_dip_sel2 = 0; - CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel1_gpu = 0; - CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel2_gpu = 0; - CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel1_gpu = 0; - CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel2_gpu = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcFrame (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_coor_sel1,&__pyx_n_s_coor_sel2,&__pyx_n_s_delaunay_matrix,&__pyx_n_s_dip_sel1,&__pyx_n_s_dip_sel2,&__pyx_n_s_pre_coor_sel1_gpu,&__pyx_n_s_pre_coor_sel2_gpu,&__pyx_n_s_pre_dip_sel1_gpu,&__pyx_n_s_pre_dip_sel2_gpu,0}; - PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; + /* "View.MemoryView":846 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape + */ + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":936 - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, - * np.ndarray[np.int32_t, ndim=2,mode="c"] delaunay_matrix, - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, - * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, + /* "View.MemoryView":847 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: */ - values[4] = (PyObject *)((PyArrayObject *)((PyObject *)Py_None)); + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":937 - * np.ndarray[np.int32_t, ndim=2,mode="c"] delaunay_matrix, - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, # <<<<<<<<<<<<<< - * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, - * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): + /* "View.MemoryView":848 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 */ - values[5] = (PyObject *)((PyArrayObject *)((PyObject *)Py_None)); + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - /* "src/gfunction/gfunction.pyx":938 - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, - * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, # <<<<<<<<<<<<<< - * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): - * """ + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ - values[6] = ((PyObject *)((PyObject *)Py_None)); - values[7] = ((PyObject *)((PyObject *)Py_None)); + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":939 - * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, - * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, - * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): # <<<<<<<<<<<<<< - * """ - * calcFrame(coor_sel1, coor_sel2, dip_sel1=None, dip_sel2=None, + /* "View.MemoryView":850 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape + */ + __pyx_v_stop = 0; + + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ - values[8] = ((PyObject *)((PyObject *)Py_None)); - values[9] = ((PyObject *)((PyObject *)Py_None)); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_sel1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 4, 10, 1); __PYX_ERR(0, 932, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_sel2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 4, 10, 2); __PYX_ERR(0, 932, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delaunay_matrix)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 4, 10, 3); __PYX_ERR(0, 932, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_sel1); - if (value) { values[4] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 5: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_sel2); - if (value) { values[5] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 6: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_coor_sel1_gpu); - if (value) { values[6] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 7: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_coor_sel2_gpu); - if (value) { values[7] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 8: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_dip_sel1_gpu); - if (value) { values[8] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 9: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pre_dip_sel2_gpu); - if (value) { values[9] = value; kw_args--; } } + + /* "View.MemoryView":847 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: + */ + goto __pyx_L14; } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcFrame") < 0)) __PYX_ERR(0, 932, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; + + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: + */ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":852 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: + */ + __pyx_v_stop = __pyx_v_shape; + + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: + */ } - } - __pyx_v_self = values[0]; - __pyx_v_coor_sel1 = ((PyArrayObject *)values[1]); - __pyx_v_coor_sel2 = ((PyArrayObject *)values[2]); - __pyx_v_delaunay_matrix = ((PyArrayObject *)values[3]); - __pyx_v_dip_sel1 = ((PyArrayObject *)values[4]); - __pyx_v_dip_sel2 = ((PyArrayObject *)values[5]); - __pyx_v_pre_coor_sel1_gpu = values[6]; - __pyx_v_pre_coor_sel2_gpu = values[7]; - __pyx_v_pre_dip_sel1_gpu = values[8]; - __pyx_v_pre_dip_sel2_gpu = values[9]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 4, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 932, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.calcFrame", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_sel1), __pyx_ptype_5numpy_ndarray, 1, "coor_sel1", 0))) __PYX_ERR(0, 933, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_sel2), __pyx_ptype_5numpy_ndarray, 1, "coor_sel2", 0))) __PYX_ERR(0, 934, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delaunay_matrix), __pyx_ptype_5numpy_ndarray, 1, "delaunay_matrix", 0))) __PYX_ERR(0, 935, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dip_sel1), __pyx_ptype_5numpy_ndarray, 1, "dip_sel1", 0))) __PYX_ERR(0, 936, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dip_sel2), __pyx_ptype_5numpy_ndarray, 1, "dip_sel2", 0))) __PYX_ERR(0, 937, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_4calcFrame(__pyx_self, __pyx_v_self, __pyx_v_coor_sel1, __pyx_v_coor_sel2, __pyx_v_delaunay_matrix, __pyx_v_dip_sel1, __pyx_v_dip_sel2, __pyx_v_pre_coor_sel1_gpu, __pyx_v_pre_coor_sel2_gpu, __pyx_v_pre_dip_sel1_gpu, __pyx_v_pre_dip_sel2_gpu); + __pyx_L14:; - /* "src/gfunction/gfunction.pyx":932 - * """ + /* "View.MemoryView":846 + * start = 0 * - * def calcFrame(self, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ + goto __pyx_L13; + } - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_4calcFrame(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_coor_sel1, PyArrayObject *__pyx_v_coor_sel2, PyArrayObject *__pyx_v_delaunay_matrix, PyArrayObject *__pyx_v_dip_sel1, PyArrayObject *__pyx_v_dip_sel2, CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel1_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel2_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel1_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel2_gpu) { - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_sel1; - __Pyx_Buffer __pyx_pybuffer_coor_sel1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_sel2; - __Pyx_Buffer __pyx_pybuffer_coor_sel2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_delaunay_matrix; - __Pyx_Buffer __pyx_pybuffer_delaunay_matrix; - __Pyx_LocalBuf_ND __pyx_pybuffernd_dip_sel1; - __Pyx_Buffer __pyx_pybuffer_dip_sel1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_dip_sel2; - __Pyx_Buffer __pyx_pybuffer_dip_sel2; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_t_10; - float __pyx_t_11; - float __pyx_t_12; - int __pyx_t_13; - double __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcFrame", 0); - __pyx_pybuffer_coor_sel1.pybuffer.buf = NULL; - __pyx_pybuffer_coor_sel1.refcount = 0; - __pyx_pybuffernd_coor_sel1.data = NULL; - __pyx_pybuffernd_coor_sel1.rcbuffer = &__pyx_pybuffer_coor_sel1; - __pyx_pybuffer_coor_sel2.pybuffer.buf = NULL; - __pyx_pybuffer_coor_sel2.refcount = 0; - __pyx_pybuffernd_coor_sel2.data = NULL; - __pyx_pybuffernd_coor_sel2.rcbuffer = &__pyx_pybuffer_coor_sel2; - __pyx_pybuffer_delaunay_matrix.pybuffer.buf = NULL; - __pyx_pybuffer_delaunay_matrix.refcount = 0; - __pyx_pybuffernd_delaunay_matrix.data = NULL; - __pyx_pybuffernd_delaunay_matrix.rcbuffer = &__pyx_pybuffer_delaunay_matrix; - __pyx_pybuffer_dip_sel1.pybuffer.buf = NULL; - __pyx_pybuffer_dip_sel1.refcount = 0; - __pyx_pybuffernd_dip_sel1.data = NULL; - __pyx_pybuffernd_dip_sel1.rcbuffer = &__pyx_pybuffer_dip_sel1; - __pyx_pybuffer_dip_sel2.pybuffer.buf = NULL; - __pyx_pybuffer_dip_sel2.refcount = 0; - __pyx_pybuffernd_dip_sel2.data = NULL; - __pyx_pybuffernd_dip_sel2.rcbuffer = &__pyx_pybuffer_dip_sel2; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_sel1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 932, __pyx_L1_error) - } - __pyx_pybuffernd_coor_sel1.diminfo[0].strides = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_sel1.diminfo[0].shape = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_sel1.diminfo[1].strides = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_sel1.diminfo[1].shape = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_sel2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 932, __pyx_L1_error) - } - __pyx_pybuffernd_coor_sel2.diminfo[0].strides = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_sel2.diminfo[0].shape = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_sel2.diminfo[1].strides = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_sel2.diminfo[1].shape = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer, (PyObject*)__pyx_v_delaunay_matrix, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 932, __pyx_L1_error) - } - __pyx_pybuffernd_delaunay_matrix.diminfo[0].strides = __pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_delaunay_matrix.diminfo[0].shape = __pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_delaunay_matrix.diminfo[1].strides = __pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_delaunay_matrix.diminfo[1].shape = __pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer, (PyObject*)__pyx_v_dip_sel1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 932, __pyx_L1_error) - } - __pyx_pybuffernd_dip_sel1.diminfo[0].strides = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dip_sel1.diminfo[0].shape = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dip_sel1.diminfo[1].strides = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dip_sel1.diminfo[1].shape = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dip_sel2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 932, __pyx_L1_error) - } - __pyx_pybuffernd_dip_sel2.diminfo[0].strides = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dip_sel2.diminfo[0].shape = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dip_sel2.diminfo[1].strides = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dip_sel2.diminfo[1].shape = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.shape[1]; + /* "View.MemoryView":854 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: + */ + /*else*/ { + if (__pyx_v_negative_step) { - /* "src/gfunction/gfunction.pyx":959 - * - * # Check if dipole moments are needed and, if yes, were passed - * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): # <<<<<<<<<<<<<< - * raise TypeError("No dipole moment array for the first selection was passed, although the requested gfunctions need it!") - * + /* "View.MemoryView":855 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape */ - __pyx_t_2 = (((PyObject *)__pyx_v_dip_sel1) == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 959, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = ((((int)__pyx_t_5) & 2) != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 959, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = ((((int)__pyx_t_5) & 4) != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 959, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = ((((int)__pyx_t_5) & 16) != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 959, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = ((((int)__pyx_t_5) & 32) != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_v_stop = -1L; - /* "src/gfunction/gfunction.pyx":960 - * # Check if dipole moments are needed and, if yes, were passed - * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): - * raise TypeError("No dipole moment array for the first selection was passed, although the requested gfunctions need it!") # <<<<<<<<<<<<<< - * - * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): + /* "View.MemoryView":854 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 960, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 960, __pyx_L1_error) + goto __pyx_L16; + } - /* "src/gfunction/gfunction.pyx":959 + /* "View.MemoryView":857 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< * - * # Check if dipole moments are needed and, if yes, were passed - * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): # <<<<<<<<<<<<<< - * raise TypeError("No dipole moment array for the first selection was passed, although the requested gfunctions need it!") * */ - } + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; - /* "src/gfunction/gfunction.pyx":962 - * raise TypeError("No dipole moment array for the first selection was passed, although the requested gfunctions need it!") + /* "View.MemoryView":861 * - * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): # <<<<<<<<<<<<<< - * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< * + * if (stop - start) - step * new_shape: */ - __pyx_t_3 = (((PyObject *)__pyx_v_dip_sel2) == Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 962, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 962, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = ((((int)__pyx_t_5) & 2) != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 962, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 962, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = ((((int)__pyx_t_5) & 8) != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 962, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 962, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = ((((int)__pyx_t_5) & 16) != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 962, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 962, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = ((((int)__pyx_t_5) & 64) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L10_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - /* "src/gfunction/gfunction.pyx":963 + /* "View.MemoryView":863 + * new_shape = (stop - start) // step * - * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): - * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") # <<<<<<<<<<<<<< + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 * - * if self.oneistwo is None: */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 963, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 963, __pyx_L1_error) + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":962 - * raise TypeError("No dipole moment array for the first selection was passed, although the requested gfunctions need it!") + /* "View.MemoryView":864 * - * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): # <<<<<<<<<<<<<< - * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< * + * if new_shape < 0: */ - } + __pyx_v_new_shape = (__pyx_v_new_shape + 1); - /* "src/gfunction/gfunction.pyx":965 - * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") + /* "View.MemoryView":863 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 * - * if self.oneistwo is None: # <<<<<<<<<<<<<< - * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: - * self.oneistwo = True */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = (__pyx_t_4 == Py_None); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + } - /* "src/gfunction/gfunction.pyx":966 + /* "View.MemoryView":866 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 * - * if self.oneistwo is None: - * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: # <<<<<<<<<<<<<< - * self.oneistwo = True - * else: */ - __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coor_sel1), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coor_sel2), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_all); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L17_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 966, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_2 = __pyx_t_1; - __pyx_L17_bool_binop_done:; + __pyx_t_2 = (__pyx_v_new_shape < 0); if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":967 - * if self.oneistwo is None: - * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: - * self.oneistwo = True # <<<<<<<<<<<<<< - * else: - * self.oneistwo = False + /* "View.MemoryView":867 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * + * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_True) < 0) __PYX_ERR(0, 967, __pyx_L1_error) + __pyx_v_new_shape = 0; - /* "src/gfunction/gfunction.pyx":966 + /* "View.MemoryView":866 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 * - * if self.oneistwo is None: - * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: # <<<<<<<<<<<<<< - * self.oneistwo = True - * else: */ - goto __pyx_L16; } - /* "src/gfunction/gfunction.pyx":969 - * self.oneistwo = True - * else: - * self.oneistwo = False # <<<<<<<<<<<<<< + /* "View.MemoryView":870 * - * # Increment frame counter + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset */ - /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_False) < 0) __PYX_ERR(0, 969, __pyx_L1_error) - } - __pyx_L16:; + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - /* "src/gfunction/gfunction.pyx":965 - * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") + /* "View.MemoryView":871 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset + * + */ + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + + /* "View.MemoryView":872 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * * - * if self.oneistwo is None: # <<<<<<<<<<<<<< - * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: - * self.oneistwo = True */ + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; } + __pyx_L3:; - /* "src/gfunction/gfunction.pyx":972 + /* "View.MemoryView":875 * - * # Increment frame counter - * self.ctr+=1 # <<<<<<<<<<<<<< * - * # add current volume to list + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 972, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_8, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 972, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ctr, __pyx_t_7) < 0) __PYX_ERR(0, 972, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":975 + /* "View.MemoryView":876 * - * # add current volume to list - * self.volume_list.append(self.volume) # <<<<<<<<<<<<<< + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride + */ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + + /* "View.MemoryView":875 * - * """ + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 975, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 975, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 975, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L19; + } - /* "src/gfunction/gfunction.pyx":1010 - * else: - * """ - * if(self.exclude_self_mol): # <<<<<<<<<<<<<< - * calcHistoVoronoiNonSelf( coor_sel1.data, coor_sel2.data, - * dip_sel1.data, dip_sel2.data, + /* "View.MemoryView":878 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_exclude_self_mol); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1010, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1010, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_2) { + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; - /* "src/gfunction/gfunction.pyx":1013 - * calcHistoVoronoiNonSelf( coor_sel1.data, coor_sel2.data, - * dip_sel1.data, dip_sel2.data, - * self.histogram, self.box_dim, # <<<<<<<<<<<<<< - * self.n1, self.n2, self.histo_min, self.histo_max, - * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1013, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1013, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1013, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1013, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":1014 - * dip_sel1.data, dip_sel2.data, - * self.histogram, self.box_dim, - * self.n1, self.n2, self.histo_min, self.histo_max, # <<<<<<<<<<<<<< - * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) - * else: + /* "View.MemoryView":881 + * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1014, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1014, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1014, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_max); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1014, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":1015 - * self.histogram, self.box_dim, - * self.n1, self.n2, self.histo_min, self.histo_max, - * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) # <<<<<<<<<<<<<< - * else: - * calcHistoVoronoi( coor_sel1.data, coor_sel2.data, + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":1011 - * """ - * if(self.exclude_self_mol): - * calcHistoVoronoiNonSelf( coor_sel1.data, coor_sel2.data, # <<<<<<<<<<<<<< - * dip_sel1.data, dip_sel2.data, - * self.histogram, self.box_dim, + /* "View.MemoryView":883 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " */ - __pyx_f_11newanalysis_9gfunction_calcHistoVoronoiNonSelf(((double *)__pyx_v_coor_sel1->data), ((double *)__pyx_v_coor_sel2->data), ((double *)__pyx_v_dip_sel1->data), ((double *)__pyx_v_dip_sel2->data), ((PyArrayObject *)__pyx_t_8), ((PyArrayObject *)__pyx_t_7), __pyx_t_5, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, ((int *)__pyx_v_delaunay_matrix->data)); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); - /* "src/gfunction/gfunction.pyx":1010 - * else: - * """ - * if(self.exclude_self_mol): # <<<<<<<<<<<<<< - * calcHistoVoronoiNonSelf( coor_sel1.data, coor_sel2.data, - * dip_sel1.data, dip_sel2.data, + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: */ - goto __pyx_L19; - } + goto __pyx_L22; + } - /* "src/gfunction/gfunction.pyx":1017 - * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) + /* "View.MemoryView":885 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) * else: - * calcHistoVoronoi( coor_sel1.data, coor_sel2.data, # <<<<<<<<<<<<<< - * dip_sel1.data, dip_sel2.data, - * self.histogram, self.box_dim, */ - /*else*/ { + /*else*/ { - /* "src/gfunction/gfunction.pyx":1019 - * calcHistoVoronoi( coor_sel1.data, coor_sel2.data, - * dip_sel1.data, dip_sel2.data, - * self.histogram, self.box_dim, # <<<<<<<<<<<<<< - * self.n1, self.n2, self.histo_min, self.histo_max, - * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) + /* "View.MemoryView":886 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1019, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1019, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1019, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1019, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 885, __pyx_L1_error) + } + __pyx_L22:; - /* "src/gfunction/gfunction.pyx":1020 - * dip_sel1.data, dip_sel2.data, - * self.histogram, self.box_dim, - * self.n1, self.n2, self.histo_min, self.histo_max, # <<<<<<<<<<<<<< - * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) + /* "View.MemoryView":881 * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_max); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L21; + } - /* "src/gfunction/gfunction.pyx":1021 - * self.histogram, self.box_dim, - * self.n1, self.n2, self.histo_min, self.histo_max, - * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) # <<<<<<<<<<<<<< + /* "View.MemoryView":888 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< * - * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): + * return 0 */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; - /* "src/gfunction/gfunction.pyx":1017 - * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) - * else: - * calcHistoVoronoi( coor_sel1.data, coor_sel2.data, # <<<<<<<<<<<<<< - * dip_sel1.data, dip_sel2.data, - * self.histogram, self.box_dim, + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: */ - __pyx_f_11newanalysis_9gfunction_calcHistoVoronoi(((double *)__pyx_v_coor_sel1->data), ((double *)__pyx_v_coor_sel2->data), ((double *)__pyx_v_dip_sel1->data), ((double *)__pyx_v_dip_sel2->data), ((PyArrayObject *)__pyx_t_7), ((PyArrayObject *)__pyx_t_8), __pyx_t_18, __pyx_t_17, __pyx_t_12, __pyx_t_11, __pyx_t_16, __pyx_t_14, __pyx_t_15, __pyx_t_13, __pyx_t_10, __pyx_t_5, ((int *)__pyx_v_delaunay_matrix->data)); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } - __pyx_L19:; - /* "src/gfunction/gfunction.pyx":932 - * """ + /* "View.MemoryView":890 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * * - * def calcFrame(self, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.calcFrame", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -/* "src/gfunction/gfunction.pyx":1023 - * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) + /* "View.MemoryView":793 * - * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< - * """ - * Add the histograms of all core particles, after they were calculated in parallel. + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_7_addHisto(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_6_addHisto[] = "\n Add the histograms of all core particles, after they were calculated in parallel.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_7_addHisto = {"_addHisto", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_7_addHisto, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_6_addHisto}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_7_addHisto(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyArrayObject *__pyx_v_histo_out = 0; - PyArrayObject *__pyx_v_histo = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_addHisto (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_histo_out,&__pyx_n_s_histo,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_out)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, 1); __PYX_ERR(0, 1023, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, 2); __PYX_ERR(0, 1023, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_addHisto") < 0)) __PYX_ERR(0, 1023, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_self = values[0]; - __pyx_v_histo_out = ((PyArrayObject *)values[1]); - __pyx_v_histo = ((PyArrayObject *)values[2]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1023, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi._addHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_histo_out), __pyx_ptype_5numpy_ndarray, 1, "histo_out", 0))) __PYX_ERR(0, 1023, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_histo), __pyx_ptype_5numpy_ndarray, 1, "histo", 0))) __PYX_ERR(0, 1023, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_6_addHisto(__pyx_self, __pyx_v_self, __pyx_v_histo_out, __pyx_v_histo); - /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; - __pyx_r = NULL; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_6_addHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_histo_out, PyArrayObject *__pyx_v_histo) { - int __pyx_v_histo_n; - int __pyx_v_n1; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_ix; - int __pyx_v_ix2; - double *__pyx_v_histogram_out; - double *__pyx_v_histogram; - int __pyx_v_shell; - int __pyx_v_nshells; - __Pyx_LocalBuf_ND __pyx_pybuffernd_histo; - __Pyx_Buffer __pyx_pybuffer_histo; - __Pyx_LocalBuf_ND __pyx_pybuffernd_histo_out; - __Pyx_Buffer __pyx_pybuffer_histo_out; - PyObject *__pyx_r = NULL; +/* "View.MemoryView":896 + * + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + */ + +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; + Py_UCS4 __pyx_t_4; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_addHisto", 0); - __pyx_pybuffer_histo_out.pybuffer.buf = NULL; - __pyx_pybuffer_histo_out.refcount = 0; - __pyx_pybuffernd_histo_out.data = NULL; - __pyx_pybuffernd_histo_out.rcbuffer = &__pyx_pybuffer_histo_out; - __pyx_pybuffer_histo.pybuffer.buf = NULL; - __pyx_pybuffer_histo.refcount = 0; - __pyx_pybuffernd_histo.data = NULL; - __pyx_pybuffernd_histo.rcbuffer = &__pyx_pybuffer_histo; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_histo_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1023, __pyx_L1_error) - } - __pyx_pybuffernd_histo_out.diminfo[0].strides = __pyx_pybuffernd_histo_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_histo_out.diminfo[0].shape = __pyx_pybuffernd_histo_out.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_histo.rcbuffer->pybuffer, (PyObject*)__pyx_v_histo, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1023, __pyx_L1_error) - } - __pyx_pybuffernd_histo.diminfo[0].strides = __pyx_pybuffernd_histo.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_histo.diminfo[0].shape = __pyx_pybuffernd_histo.rcbuffer->pybuffer.shape[0]; + __Pyx_RefNannySetupContext("pybuffer_index", 0); - /* "src/gfunction/gfunction.pyx":1029 - * - * #cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n - * cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n*self.nshells # <<<<<<<<<<<<<< - * - * cdef double* histogram_out = histo_out.data + /* "View.MemoryView":898 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1029, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_histo_n = __pyx_t_2; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1029, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_n1 = __pyx_t_2; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1029, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1029, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1029, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1029, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_ix2 = __pyx_t_2; + __pyx_v_suboffset = -1L; - /* "src/gfunction/gfunction.pyx":1031 - * cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n*self.nshells + /* "View.MemoryView":899 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp * - * cdef double* histogram_out = histo_out.data # <<<<<<<<<<<<<< - * cdef double* histogram = histo.data - * cdef int shell */ - __pyx_v_histogram_out = ((double *)__pyx_v_histo_out->data); + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":1032 + /* "View.MemoryView":902 + * cdef char *resultp * - * cdef double* histogram_out = histo_out.data - * cdef double* histogram = histo.data # <<<<<<<<<<<<<< - * cdef int shell - * cdef int nshells = self.nshells + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize */ - __pyx_v_histogram = ((double *)__pyx_v_histo->data); + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":1034 - * cdef double* histogram = histo.data - * cdef int shell - * cdef int nshells = self.nshells # <<<<<<<<<<<<<< + /* "View.MemoryView":903 * - * # add histograms + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1034, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1034, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_nshells = __pyx_t_2; + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 903, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 903, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); - /* "src/gfunction/gfunction.pyx":1044 - * histogram_out[k*histo_n+i]+=histogram[k*ix2+ix+i] - * """ - * for shell in range(nshells): # <<<<<<<<<<<<<< - * for i in prange(histo_n, nogil=True): - * for j in range(n1): #n_aufpunkte + /* "View.MemoryView":904 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] */ - __pyx_t_2 = __pyx_v_nshells; - __pyx_t_5 = __pyx_t_2; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_shell = __pyx_t_6; + __pyx_v_stride = __pyx_v_itemsize; - /* "src/gfunction/gfunction.pyx":1045 - * """ - * for shell in range(nshells): - * for i in prange(histo_n, nogil=True): # <<<<<<<<<<<<<< - * for j in range(n1): #n_aufpunkte - * ix = nshells * histo_n * j + /* "View.MemoryView":902 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_7 = __pyx_v_histo_n; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_9 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_9 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ix) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) - #endif /* _OPENMP */ - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_8); - /* Initialize private variables to invalid values */ - __pyx_v_ix = ((int)0xbad0bad0); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); + goto __pyx_L3; + } - /* "src/gfunction/gfunction.pyx":1046 - * for shell in range(nshells): - * for i in prange(histo_n, nogil=True): - * for j in range(n1): #n_aufpunkte # <<<<<<<<<<<<<< - * ix = nshells * histo_n * j - * for k in range(7): + /* "View.MemoryView":906 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: */ - __pyx_t_10 = __pyx_v_n1; - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - /* "src/gfunction/gfunction.pyx":1047 - * for i in prange(histo_n, nogil=True): - * for j in range(n1): #n_aufpunkte - * ix = nshells * histo_n * j # <<<<<<<<<<<<<< - * for k in range(7): - * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] + /* "View.MemoryView":907 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] */ - __pyx_v_ix = ((__pyx_v_nshells * __pyx_v_histo_n) * __pyx_v_j); + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - /* "src/gfunction/gfunction.pyx":1048 - * for j in range(n1): #n_aufpunkte - * ix = nshells * histo_n * j - * for k in range(7): # <<<<<<<<<<<<<< - * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] * */ - for (__pyx_t_13 = 0; __pyx_t_13 < 7; __pyx_t_13+=1) { - __pyx_v_k = __pyx_t_13; + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":1049 - * ix = nshells * histo_n * j - * for k in range(7): - * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] # <<<<<<<<<<<<<< + /* "View.MemoryView":909 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< * - * def _normHisto(self): + * if index < 0: */ - __pyx_t_14 = ((((__pyx_v_k * __pyx_v_histo_n) * __pyx_v_nshells) + (__pyx_v_i * __pyx_v_nshells)) + __pyx_v_shell); - (__pyx_v_histogram_out[__pyx_t_14]) = ((__pyx_v_histogram_out[__pyx_t_14]) + (__pyx_v_histogram[((((__pyx_v_k * __pyx_v_ix2) + __pyx_v_ix) + (__pyx_v_i * __pyx_v_nshells)) + __pyx_v_shell)])); - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); - /* "src/gfunction/gfunction.pyx":1045 - * """ - * for shell in range(nshells): - * for i in prange(histo_n, nogil=True): # <<<<<<<<<<<<<< - * for j in range(n1): #n_aufpunkte - * ix = nshells * histo_n * j + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L9; - } - __pyx_L9:; - } } } + __pyx_L3:; - /* "src/gfunction/gfunction.pyx":1023 - * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] * - * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< - * """ - * Add the histograms of all core particles, after they were calculated in parallel. + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi._addHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/gfunction/gfunction.pyx":1051 - * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] + /* "View.MemoryView":912 * - * def _normHisto(self): # <<<<<<<<<<<<<< - * """ - * Normalize the histogram. + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" */ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_9_normHisto(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_8_normHisto[] = "\n Normalize the histogram.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_9_normHisto = {"_normHisto", (PyCFunction)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_9_normHisto, METH_O, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_8_normHisto}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_9_normHisto(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_normHisto (wrapper)", 0); - __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_8_normHisto(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_8_normHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_v_volume = NULL; - PyObject *__pyx_v_v = NULL; - int __pyx_v_i; - int __pyx_v_j; - CYTHON_UNUSED int __pyx_v_ix2; - int __pyx_v_shell; - double __pyx_v_PI; - PyObject *__pyx_v_rho = NULL; - PyObject *__pyx_v_r = NULL; - PyObject *__pyx_v_r_out = NULL; - PyObject *__pyx_v_slice_vol = NULL; - PyObject *__pyx_v_norm = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - long __pyx_t_8; - long __pyx_t_9; - long __pyx_t_10; - long __pyx_t_11; - int __pyx_t_12; - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; - PyObject *__pyx_t_15 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_normHisto", 0); + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + */ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { - /* "src/gfunction/gfunction.pyx":1056 - * """ + /* "View.MemoryView":914 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< * - * if self.norm_volume: # <<<<<<<<<<<<<< - * volume = self.norm_volume - * else: + * if index >= shape: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1056, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1056, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__7); + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 914, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":1057 + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * if self.norm_volume: - * volume = self.norm_volume # <<<<<<<<<<<<<< - * else: - * volume = 0.0 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1057, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_volume = __pyx_t_1; - __pyx_t_1 = 0; + } - /* "src/gfunction/gfunction.pyx":1056 - * """ + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] * - * if self.norm_volume: # <<<<<<<<<<<<<< - * volume = self.norm_volume - * else: + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ - goto __pyx_L3; } - /* "src/gfunction/gfunction.pyx":1059 - * volume = self.norm_volume - * else: - * volume = 0.0 # <<<<<<<<<<<<<< - * for v in self.volume_list: - * volume+=v + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * */ - /*else*/ { - __Pyx_INCREF(__pyx_float_0_0); - __pyx_v_volume = __pyx_float_0_0; + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { - /* "src/gfunction/gfunction.pyx":1060 - * else: - * volume = 0.0 - * for v in self.volume_list: # <<<<<<<<<<<<<< - * volume+=v - * volume/=len(self.volume_list) + /* "View.MemoryView":917 + * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1060, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1060, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1060, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1060, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1060, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__7); + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 917, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":1061 - * volume = 0.0 - * for v in self.volume_list: - * volume+=v # <<<<<<<<<<<<<< - * volume/=len(self.volume_list) + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * */ - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_volume, __pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1061, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_volume, __pyx_t_1); - __pyx_t_1 = 0; + } - /* "src/gfunction/gfunction.pyx":1060 - * else: - * volume = 0.0 - * for v in self.volume_list: # <<<<<<<<<<<<<< - * volume+=v - * volume/=len(self.volume_list) + /* "View.MemoryView":919 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - /* "src/gfunction/gfunction.pyx":1062 - * for v in self.volume_list: - * volume+=v - * volume/=len(self.volume_list) # <<<<<<<<<<<<<< + /* "View.MemoryView":920 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset * - * cdef int i, j, ix, ix2 = self.n1 * self.histo_n, shell */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_volume, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_volume, __pyx_t_1); - __pyx_t_1 = 0; - } - __pyx_L3:; + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":1064 - * volume/=len(self.volume_list) + /* "View.MemoryView":921 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< * - * cdef int i, j, ix, ix2 = self.n1 * self.histo_n, shell # <<<<<<<<<<<<<< - * PI = 3.14159265358979323846 + * return resultp + */ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":920 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_ix2 = __pyx_t_7; + } - /* "src/gfunction/gfunction.pyx":1065 + /* "View.MemoryView":923 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< * - * cdef int i, j, ix, ix2 = self.n1 * self.histo_n, shell - * PI = 3.14159265358979323846 # <<<<<<<<<<<<<< * - * # norm histograms */ - __pyx_v_PI = 3.14159265358979323846; + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":1068 + /* "View.MemoryView":896 * - * # norm histograms - * if self.oneistwo: # <<<<<<<<<<<<<< - * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume - * else: + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1068, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1068, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_2) { - /* "src/gfunction/gfunction.pyx":1069 - * # norm histograms - * if self.oneistwo: - * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume # <<<<<<<<<<<<<< - * else: - * rho = float(self.nmol1 * self.nmol2) / volume + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim + * */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1069, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1069, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1069, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_volume); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1069, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_rho = __pyx_t_3; - __pyx_t_3 = 0; - /* "src/gfunction/gfunction.pyx":1068 +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("transpose_memslice", 1); + + /* "View.MemoryView":930 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< * - * # norm histograms - * if self.oneistwo: # <<<<<<<<<<<<<< - * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume - * else: + * cdef Py_ssize_t *shape = memslice.shape */ - goto __pyx_L6; - } + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":1071 - * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume - * else: - * rho = float(self.nmol1 * self.nmol2) / volume # <<<<<<<<<<<<<< + /* "View.MemoryView":932 + * cdef int ndim = memslice.memview.view.ndim * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides * */ - /*else*/ { - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1071, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1071, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1071, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1071, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_volume); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1071, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_rho = __pyx_t_6; - __pyx_t_6 = 0; - } - __pyx_L6:; + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; - /* "src/gfunction/gfunction.pyx":1083 - * self.histogram_out[j*self.histo_n+i]/=norm - * """ - * for shell in range(self.nshells): # <<<<<<<<<<<<<< - * for i in range(self.histo_n): - * r = self.histo_min + float(i) * self.histo_dr + /* "View.MemoryView":933 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1083, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1083, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_9; __pyx_t_7+=1) { - __pyx_v_shell = __pyx_t_7; + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; - /* "src/gfunction/gfunction.pyx":1084 - * """ - * for shell in range(self.nshells): - * for i in range(self.histo_n): # <<<<<<<<<<<<<< - * r = self.histo_min + float(i) * self.histo_dr - * r_out = r + self.histo_dr + /* "View.MemoryView":937 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1084, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1084, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_i = __pyx_t_12; + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; - /* "src/gfunction/gfunction.pyx":1085 - * for shell in range(self.nshells): - * for i in range(self.histo_n): - * r = self.histo_min + float(i) * self.histo_dr # <<<<<<<<<<<<<< - * r_out = r + self.histo_dr - * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) + /* "View.MemoryView":938 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1085, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1085, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); - /* "src/gfunction/gfunction.pyx":1086 - * for i in range(self.histo_n): - * r = self.histo_min + float(i) * self.histo_dr - * r_out = r + self.histo_dr # <<<<<<<<<<<<<< - * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) - * norm = rho*slice_vol*float(self.ctr) + /* "View.MemoryView":939 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1086, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = PyNumber_Add(__pyx_v_r, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1086, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_r_out, __pyx_t_13); - __pyx_t_13 = 0; + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; - /* "src/gfunction/gfunction.pyx":1087 - * r = self.histo_min + float(i) * self.histo_dr - * r_out = r + self.histo_dr - * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) # <<<<<<<<<<<<<< - * norm = rho*slice_vol*float(self.ctr) - * for j in range(7): + /* "View.MemoryView":940 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: */ - __pyx_t_13 = PyFloat_FromDouble(((4.0 / 3.0) * __pyx_v_PI)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1087, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_3 = PyNumber_Power(__pyx_v_r_out, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1087, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyNumber_Power(__pyx_v_r, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1087, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Multiply(__pyx_t_13, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_slice_vol, __pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; - /* "src/gfunction/gfunction.pyx":1088 - * r_out = r + self.histo_dr - * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) - * norm = rho*slice_vol*float(self.ctr) # <<<<<<<<<<<<<< - * for j in range(7): - * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * */ - __pyx_t_6 = PyNumber_Multiply(__pyx_v_rho, __pyx_v_slice_vol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1088, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = __Pyx_PyNumber_Float(__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1088, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF_SET(__pyx_v_norm, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { - /* "src/gfunction/gfunction.pyx":1089 - * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) - * norm = rho*slice_vol*float(self.ctr) - * for j in range(7): # <<<<<<<<<<<<<< - * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm + /* "View.MemoryView":943 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< * + * return 0 */ - for (__pyx_t_14 = 0; __pyx_t_14 < 7; __pyx_t_14+=1) { - __pyx_v_j = __pyx_t_14; + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_kp_s_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L1_error) - /* "src/gfunction/gfunction.pyx":1090 - * norm = rho*slice_vol*float(self.ctr) - * for j in range(7): - * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm # <<<<<<<<<<<<<< + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") * - * def scale(self, value): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_13, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_13 = PyNumber_Multiply(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = PyNumber_Multiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_13, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_shell); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_13 = PyNumber_Add(__pyx_t_3, __pyx_t_15); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_15, __pyx_v_norm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_13, __pyx_t_3) < 0)) __PYX_ERR(0, 1090, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } } } - /* "src/gfunction/gfunction.pyx":1051 - * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] + /* "View.MemoryView":945 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim * - * def _normHisto(self): # <<<<<<<<<<<<<< - * """ - * Normalize the histogram. */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi._normHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_XDECREF(__pyx_v_volume); - __Pyx_XDECREF(__pyx_v_v); - __Pyx_XDECREF(__pyx_v_rho); - __Pyx_XDECREF(__pyx_v_r); - __Pyx_XDECREF(__pyx_v_r_out); - __Pyx_XDECREF(__pyx_v_slice_vol); - __Pyx_XDECREF(__pyx_v_norm); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "src/gfunction/gfunction.pyx":1092 - * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm +/* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * def scale(self, value): # <<<<<<<<<<<<<< - * self.histogram_out[:] *= value - * self.histogram[:] *= value - */ + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_11scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_11scale = {"scale", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_11scale, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_11scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_value = 0; +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "View.MemoryView":964 + * + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): + */ + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); + + /* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) + */ + +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("scale (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); __PYX_ERR(0, 1092, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) __PYX_ERR(0, 1092, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_value = values[1]; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":967 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: + */ + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":968 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 968, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":967 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: + */ } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1092, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_10scale(__pyx_self, __pyx_v_self, __pyx_v_value); + + /* "View.MemoryView":970 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 970, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) + */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_10scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +/* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) + */ + +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("scale", 0); + __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "src/gfunction/gfunction.pyx":1093 + /* "View.MemoryView":973 * - * def scale(self, value): - * self.histogram_out[:] *= value # <<<<<<<<<<<<<< - * self.histogram[:] *= value + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: + */ + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":974 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) + */ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 974, __pyx_L1_error) + + /* "View.MemoryView":973 * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1093, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_slice__6); - __pyx_t_2 = __pyx_slice__6; - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1093, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_InPlaceMultiply(__pyx_t_3, __pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1093, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_4) < 0)) __PYX_ERR(0, 1093, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } - /* "src/gfunction/gfunction.pyx":1094 - * def scale(self, value): - * self.histogram_out[:] *= value - * self.histogram[:] *= value # <<<<<<<<<<<<<< + /* "View.MemoryView":976 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< * - * def write(self, filename="rdf"): + * cdef _get_base(self): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1094, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_slice__6); - __pyx_t_2 = __pyx_slice__6; - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1094, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_4, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1094, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0)) __PYX_ERR(0, 1094, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; - /* "src/gfunction/gfunction.pyx":1092 - * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm + /* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) * - * def scale(self, value): # <<<<<<<<<<<<<< - * self.histogram_out[:] *= value - * self.histogram[:] *= value + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/gfunction/gfunction.pyx":1096 - * self.histogram[:] *= value +/* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) * - * def write(self, filename="rdf"): # <<<<<<<<<<<<<< - * """ - * RDF.write(filename="rdf") + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * + */ + +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":979 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; + + /* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_13write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_12write[] = "\n RDF.write(filename=\"rdf\")\n\n Args:\n filename .. name of the file to be written to. Each type of rdf will be written to a separate file\n with the ending specifying the type.\n \n Norm the calculated histograms and write them to the specified file.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_13write = {"write", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_13write, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_12write}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_13write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_filename = 0; +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write (wrapper)", 0); + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filename,0}; - PyObject* values[2] = {0,0}; - values[1] = ((PyObject *)((PyObject*)__pyx_n_s_rdf)); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename); - if (value) { values[1] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write") < 0)) __PYX_ERR(0, 1096, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_self = values[0]; - __pyx_v_filename = values[1]; + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1096, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_12write(__pyx_self, __pyx_v_self, __pyx_v_filename); + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_12write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename) { - PyObject *__pyx_v_shell = NULL; - PyObject *__pyx_v_f000 = NULL; - PyObject *__pyx_v_f110 = NULL; - PyObject *__pyx_v_f101 = NULL; - PyObject *__pyx_v_f011 = NULL; - PyObject *__pyx_v_f220 = NULL; - PyObject *__pyx_v_f202 = NULL; - PyObject *__pyx_v_f022 = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_r = NULL; +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":999 + * + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), + */ + +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; + __Pyx_TypeInfo *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - PyObject *(*__pyx_t_13)(PyObject *); - PyObject *__pyx_t_14 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write", 0); + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - /* "src/gfunction/gfunction.pyx":1112 - * """ + /* "View.MemoryView":1007 + * cdef _memoryviewslice result * - * self._addHisto(self.histogram_out, self.histogram.astype(np.float64)) # <<<<<<<<<<<<<< - * self._normHisto() + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * + */ + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":1008 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "View.MemoryView":1007 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_addHisto); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_astype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/gfunction/gfunction.pyx":1113 + /* "View.MemoryView":1013 * - * self._addHisto(self.histogram_out, self.histogram.astype(np.float64)) - * self._normHisto() # <<<<<<<<<<<<<< * - * for shell in range(self.nshells): + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normHisto); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1113, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1113, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/gfunction/gfunction.pyx":1115 - * self._normHisto() + /* "View.MemoryView":1015 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) * - * for shell in range(self.nshells): # <<<<<<<<<<<<<< - * if self.mode_sel & 1: f000 = open(filename+"_shell"+str(shell+1)+"_g000.dat",'w') - * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1115, __pyx_L1_error) + __pyx_v_result->from_slice = __pyx_v_memviewslice; + + /* "View.MemoryView":1016 + * + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() + */ + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + + /* "View.MemoryView":1018 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo + * + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1115, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; + + /* "View.MemoryView":1019 + * + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * + * result.view = memviewslice.memview.view + */ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + + /* "View.MemoryView":1021 + * result.typeinfo = memviewslice.memview.typeinfo + * + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + */ + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; + + /* "View.MemoryView":1022 + * + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + */ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); + + /* "View.MemoryView":1023 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) + */ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + + /* "View.MemoryView":1024 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * + */ + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + + /* "View.MemoryView":1025 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + */ + Py_INCREF(Py_None); + + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: + */ + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1028 + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO + */ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: + */ + goto __pyx_L4; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1115, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1115, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_10(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1115, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_shell, __pyx_t_2); - __pyx_t_2 = 0; - /* "src/gfunction/gfunction.pyx":1116 + /* "View.MemoryView":1030 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< * - * for shell in range(self.nshells): - * if self.mode_sel & 1: f000 = open(filename+"_shell"+str(shell+1)+"_g000.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') - * if self.mode_sel & 4: f101 = open(filename+"_shell"+str(shell+1)+"_g101.dat",'w') + * result.view.shape = result.from_slice.shape */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_11) { - __pyx_t_7 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_g000_dat); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_w); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_f000, __pyx_t_4); - __pyx_t_4 = 0; - } + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; - /* "src/gfunction/gfunction.pyx":1117 - * for shell in range(self.nshells): - * if self.mode_sel & 1: f000 = open(filename+"_shell"+str(shell+1)+"_g000.dat",'w') - * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 4: f101 = open(filename+"_shell"+str(shell+1)+"_g101.dat",'w') - * if self.mode_sel & 8: f011 = open(filename+"_shell"+str(shell+1)+"_g011.dat",'w') + /* "View.MemoryView":1032 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides + * */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_11) { - __pyx_t_2 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_kp_s_g110_dat); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_w); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_f110, __pyx_t_7); - __pyx_t_7 = 0; - } + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); - /* "src/gfunction/gfunction.pyx":1118 - * if self.mode_sel & 1: f000 = open(filename+"_shell"+str(shell+1)+"_g000.dat",'w') - * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') - * if self.mode_sel & 4: f101 = open(filename+"_shell"+str(shell+1)+"_g101.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 8: f011 = open(filename+"_shell"+str(shell+1)+"_g011.dat",'w') - * if self.mode_sel & 16: f220 = open(filename+"_shell"+str(shell+1)+"_g220.dat",'w') + /* "View.MemoryView":1033 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * + * */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyInt_AndObjC(__pyx_t_7, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_11) { - __pyx_t_4 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_kp_s_g101_dat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_w); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF_SET(__pyx_v_f101, __pyx_t_2); - __pyx_t_2 = 0; - } + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - /* "src/gfunction/gfunction.pyx":1119 - * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') - * if self.mode_sel & 4: f101 = open(filename+"_shell"+str(shell+1)+"_g101.dat",'w') - * if self.mode_sel & 8: f011 = open(filename+"_shell"+str(shell+1)+"_g011.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 16: f220 = open(filename+"_shell"+str(shell+1)+"_g220.dat",'w') - * if self.mode_sel & 32: f202 = open(filename+"_shell"+str(shell+1)+"_g202.dat",'w') + /* "View.MemoryView":1036 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_11) { - __pyx_t_7 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_g011_dat); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_w); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_f011, __pyx_t_4); - __pyx_t_4 = 0; - } + __pyx_v_result->__pyx_base.view.suboffsets = NULL; - /* "src/gfunction/gfunction.pyx":1120 - * if self.mode_sel & 4: f101 = open(filename+"_shell"+str(shell+1)+"_g101.dat",'w') - * if self.mode_sel & 8: f011 = open(filename+"_shell"+str(shell+1)+"_g011.dat",'w') - * if self.mode_sel & 16: f220 = open(filename+"_shell"+str(shell+1)+"_g220.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 32: f202 = open(filename+"_shell"+str(shell+1)+"_g202.dat",'w') - * if self.mode_sel & 64: f022 = open(filename+"_shell"+str(shell+1)+"_g022.dat",'w') + /* "View.MemoryView":1037 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_11) { - __pyx_t_2 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_kp_s_g220_dat); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_w); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_f220, __pyx_t_7); - __pyx_t_7 = 0; - } + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); - /* "src/gfunction/gfunction.pyx":1121 - * if self.mode_sel & 8: f011 = open(filename+"_shell"+str(shell+1)+"_g011.dat",'w') - * if self.mode_sel & 16: f220 = open(filename+"_shell"+str(shell+1)+"_g220.dat",'w') - * if self.mode_sel & 32: f202 = open(filename+"_shell"+str(shell+1)+"_g202.dat",'w') # <<<<<<<<<<<<<< - * if self.mode_sel & 64: f022 = open(filename+"_shell"+str(shell+1)+"_g022.dat",'w') + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break + */ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1039 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break * */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyInt_AndObjC(__pyx_t_7, __pyx_int_32, 32, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_11) { - __pyx_t_4 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_kp_s_g202_dat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_w); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF_SET(__pyx_v_f202, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + + /* "View.MemoryView":1040 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize + */ + goto __pyx_L6_break; + + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break + */ } + } + __pyx_L6_break:; - /* "src/gfunction/gfunction.pyx":1122 - * if self.mode_sel & 16: f220 = open(filename+"_shell"+str(shell+1)+"_g220.dat",'w') - * if self.mode_sel & 32: f202 = open(filename+"_shell"+str(shell+1)+"_g202.dat",'w') - * if self.mode_sel & 64: f022 = open(filename+"_shell"+str(shell+1)+"_g022.dat",'w') # <<<<<<<<<<<<<< + /* "View.MemoryView":1042 + * break * - * for i in range(self.histo_n): + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1122, __pyx_L1_error) + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + + /* "View.MemoryView":1043 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * + */ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_64, 64, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_11) { - __pyx_t_7 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_g022_dat); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __Pyx_INCREF(__pyx_n_s_w); - __Pyx_GIVEREF(__pyx_n_s_w); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_w); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_f022, __pyx_t_4); - __pyx_t_4 = 0; - } + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; - /* "src/gfunction/gfunction.pyx":1124 - * if self.mode_sel & 64: f022 = open(filename+"_shell"+str(shell+1)+"_g022.dat",'w') + /* "View.MemoryView":1044 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< * - * for i in range(self.histo_n): # <<<<<<<<<<<<<< - * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) + * result.to_object_func = to_object_func */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1124, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_12 = 0; - __pyx_t_13 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_13 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1124, __pyx_L1_error) - } + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_13)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1124, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1124, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_13(__pyx_t_4); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1124, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } - /* "src/gfunction/gfunction.pyx":1125 + /* "View.MemoryView":1046 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func * - * for i in range(self.histo_n): - * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 # <<<<<<<<<<<<<< - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[1*self.histo_n*self.nshells+i*self.nshells+shell])) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyNumber_Multiply(__pyx_v_i, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_float_0_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_3); - __pyx_t_3 = 0; - - /* "src/gfunction/gfunction.pyx":1126 - * for i in range(self.histo_n): - * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< - * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[1*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n*self.nshells+i*self.nshells+shell])) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_11) { - if (unlikely(!__pyx_v_f000)) { __Pyx_RaiseUnboundLocalError("f000"); __PYX_ERR(0, 1126, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f000, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyNumber_Multiply(__pyx_int_0, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_14 = PyNumber_Multiply(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyNumber_Multiply(__pyx_v_i, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_14, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_v_shell); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "src/gfunction/gfunction.pyx":1127 - * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[1*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< - * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n*self.nshells+i*self.nshells+shell])) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_11) { - if (unlikely(!__pyx_v_f110)) { __Pyx_RaiseUnboundLocalError("f110"); __PYX_ERR(0, 1127, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f110, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyNumber_Multiply(__pyx_int_1, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = PyNumber_Multiply(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyNumber_Multiply(__pyx_v_i, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_14, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_v_shell); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - - /* "src/gfunction/gfunction.pyx":1128 - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[1*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< - * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n*self.nshells+i*self.nshells+shell])) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_11) { - if (unlikely(!__pyx_v_f101)) { __Pyx_RaiseUnboundLocalError("f101"); __PYX_ERR(0, 1128, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f101, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyNumber_Multiply(__pyx_int_2, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_14 = PyNumber_Multiply(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyNumber_Multiply(__pyx_v_i, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_14, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_7, __pyx_v_shell); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "src/gfunction/gfunction.pyx":1129 - * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[1*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< - * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n*self.nshells+i*self.nshells+shell])) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_11) { - if (unlikely(!__pyx_v_f011)) { __Pyx_RaiseUnboundLocalError("f011"); __PYX_ERR(0, 1129, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f011, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyNumber_Multiply(__pyx_int_3, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_14 = PyNumber_Multiply(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyNumber_Multiply(__pyx_v_i, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_14, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_v_shell); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - - /* "src/gfunction/gfunction.pyx":1130 - * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< - * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_11) { - if (unlikely(!__pyx_v_f220)) { __Pyx_RaiseUnboundLocalError("f220"); __PYX_ERR(0, 1130, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f220, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyNumber_Multiply(__pyx_int_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = PyNumber_Multiply(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyNumber_Multiply(__pyx_v_i, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_14, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_v_shell); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } + __pyx_v_result->to_object_func = __pyx_v_to_object_func; - /* "src/gfunction/gfunction.pyx":1131 - * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) + /* "View.MemoryView":1047 * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_32, 32, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_11) { - if (unlikely(!__pyx_v_f202)) { __Pyx_RaiseUnboundLocalError("f202"); __PYX_ERR(0, 1131, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f202, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyNumber_Multiply(__pyx_int_5, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_14 = PyNumber_Multiply(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyNumber_Multiply(__pyx_v_i, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_14, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_7, __pyx_v_shell); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - - /* "src/gfunction/gfunction.pyx":1132 - * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n*self.nshells+i*self.nshells+shell])) - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< * - * def resetArrays(self): + * return result */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_64, 64, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_11) { - if (unlikely(!__pyx_v_f022)) { __Pyx_RaiseUnboundLocalError("f022"); __PYX_ERR(0, 1132, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f022, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyNumber_Multiply(__pyx_int_6, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_14 = PyNumber_Multiply(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyNumber_Multiply(__pyx_v_i, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_14, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_v_shell); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_r); - __Pyx_GIVEREF(__pyx_v_r); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_r); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; - /* "src/gfunction/gfunction.pyx":1124 - * if self.mode_sel & 64: f022 = open(filename+"_shell"+str(shell+1)+"_g022.dat",'w') + /* "View.MemoryView":1049 + * result.to_dtype_func = to_dtype_func * - * for i in range(self.histo_n): # <<<<<<<<<<<<<< - * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 - * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) - */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "src/gfunction/gfunction.pyx":1115 - * self._normHisto() + * return result # <<<<<<<<<<<<<< * - * for shell in range(self.nshells): # <<<<<<<<<<<<<< - * if self.mode_sel & 1: f000 = open(filename+"_shell"+str(shell+1)+"_g000.dat",'w') - * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') + * @cname('__pyx_memoryview_get_slice_from_memoryview') */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "src/gfunction/gfunction.pyx":1096 - * self.histogram[:] *= value + /* "View.MemoryView":999 * - * def write(self, filename="rdf"): # <<<<<<<<<<<<<< - * """ - * RDF.write(filename="rdf") + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.write", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_shell); - __Pyx_XDECREF(__pyx_v_f000); - __Pyx_XDECREF(__pyx_v_f110); - __Pyx_XDECREF(__pyx_v_f101); - __Pyx_XDECREF(__pyx_v_f011); - __Pyx_XDECREF(__pyx_v_f220); - __Pyx_XDECREF(__pyx_v_f202); - __Pyx_XDECREF(__pyx_v_f022); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_r); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/gfunction/gfunction.pyx":1134 - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) +/* "View.MemoryView":1052 * - * def resetArrays(self): # <<<<<<<<<<<<<< - * """ - * Reset histogram arrays to zero + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_15resetArrays(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_14resetArrays[] = "\n Reset histogram arrays to zero\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_15resetArrays = {"resetArrays", (PyCFunction)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_15resetArrays, METH_O, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_14resetArrays}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_15resetArrays(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("resetArrays (wrapper)", 0); - __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_14resetArrays(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_14resetArrays(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("resetArrays", 0); - - /* "src/gfunction/gfunction.pyx":1138 - * Reset histogram arrays to zero - * """ - * self.histogram_out[:] = 0.0 # <<<<<<<<<<<<<< - * self.histogram[:] = 0.0 - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetSlice(__pyx_t_1, __pyx_float_0_0, 0, 0, NULL, NULL, &__pyx_slice__6, 0, 0, 1) < 0) __PYX_ERR(0, 1138, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - /* "src/gfunction/gfunction.pyx":1139 - * """ - * self.histogram_out[:] = 0.0 - * self.histogram[:] = 0.0 # <<<<<<<<<<<<<< - * - * + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetSlice(__pyx_t_1, __pyx_float_0_0, 0, 0, NULL, NULL, &__pyx_slice__6, 0, 0, 1) < 0) __PYX_ERR(0, 1139, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "src/gfunction/gfunction.pyx":1134 - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) - * - * def resetArrays(self): # <<<<<<<<<<<<<< - * """ - * Reset histogram arrays to zero + /* "View.MemoryView":1056 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: */ + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.resetArrays", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/gfunction/gfunction.pyx":1142 - * - * - * def printInfo(self): # <<<<<<<<<<<<<< - * """ - * Print some information about the RDF container. + /* "View.MemoryView":1057 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) */ + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_17printInfo(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_16printInfo[] = "\n Print some information about the RDF container.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_17printInfo = {"printInfo", (PyCFunction)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_17printInfo, METH_O, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_16printInfo}; -static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_17printInfo(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("printInfo (wrapper)", 0); - __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_16printInfo(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_16printInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("printInfo", 0); + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice + */ + } - /* "src/gfunction/gfunction.pyx":1147 - * """ + /* "View.MemoryView":1059 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice * - * print("Modes: ", self.mode_sel) # <<<<<<<<<<<<<< - * print("Frames read: ", self.ctr) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_kp_s_Modes); - __Pyx_GIVEREF(__pyx_kp_s_Modes); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_Modes); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __pyx_t_1 = 0; - if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 1147, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - /* "src/gfunction/gfunction.pyx":1148 + /* "View.MemoryView":1060 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< * - * print("Modes: ", self.mode_sel) - * print("Frames read: ", self.ctr) # <<<<<<<<<<<<<< + * @cname('__pyx_memoryview_slice_copy') */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_kp_s_Frames_read); - __Pyx_GIVEREF(__pyx_kp_s_Frames_read); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_s_Frames_read); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __pyx_t_2 = 0; - if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 1148, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } - /* "src/gfunction/gfunction.pyx":1142 + /* "View.MemoryView":1052 * - * - * def printInfo(self): # <<<<<<<<<<<<<< - * """ - * Print some information about the RDF container. + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.printInfo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_obj); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) +/* "View.MemoryView":1063 * + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("slice_copy", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":735 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + /* "View.MemoryView":1067 + * cdef (Py_ssize_t*) shape, strides, suboffsets * - * cdef inline object PyArray_MultiIterNew2(a, b): + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t + /* "View.MemoryView":1068 * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets * */ + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) + /* "View.MemoryView":1069 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< * + * dst.memview = <__pyx_memoryview *> memview */ + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":738 + /* "View.MemoryView":1071 + * suboffsets = memview.view.suboffsets * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf * - * cdef inline object PyArray_MultiIterNew3(a, b, c): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) + /* "View.MemoryView":1072 * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< * + * for dim in range(memview.view.ndim): */ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) + /* "View.MemoryView":1074 + * dst.data = memview.view.buf * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] */ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":741 + /* "View.MemoryView":1075 * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + */ + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + + /* "View.MemoryView":1076 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 741, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) + /* "View.MemoryView":1077 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) + * @cname('__pyx_memoryview_copy_object') + */ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } + + /* "View.MemoryView":1063 * + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) +/* "View.MemoryView":1080 * + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice */ -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) { +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + __Pyx_RefNannySetupContext("memoryview_copy", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":744 + /* "View.MemoryView":1083 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + */ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1084 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * @cname('__pyx_memoryview_copy_object_from_slice') */ __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 744, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) + /* "View.MemoryView":1080 * + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19300,784 +16649,692 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) +/* "View.MemoryView":1087 * + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ -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) { +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":747 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * cdef inline tuple PyDataType_SHAPE(dtype d): + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) + /* "View.MemoryView":1095 * + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: */ + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1096 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL + */ + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ + goto __pyx_L3; + } -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 - * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape + /* "View.MemoryView":1098 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL + * */ - __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); - if (__pyx_t_1) { + /*else*/ { + __pyx_v_to_object_func = NULL; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":751 - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape # <<<<<<<<<<<<<< + /* "View.MemoryView":1099 * else: - * return () + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); - __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); - goto __pyx_L0; + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 + /* "View.MemoryView":1101 + * to_dtype_func = NULL * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) */ - } + __Pyx_XDECREF(__pyx_r); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":753 - * return d.subarray.shape - * else: - * return () # <<<<<<<<<<<<<< + /* "View.MemoryView":1103 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< * * */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_empty_tuple); - __pyx_r = __pyx_empty_tuple; - goto __pyx_L0; - } + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) + /* "View.MemoryView":1087 * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 +/* "View.MemoryView":1109 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) */ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_array_base", 0); +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":929 + /* "View.MemoryView":1110 * - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< - * PyArray_SetBaseObject(arr, base) + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< * + * @cname('__pyx_get_best_slice_order') */ - Py_INCREF(__pyx_v_base); + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":930 - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + /* "View.MemoryView":1109 * - * cdef inline object get_array_base(ndarray arr): - */ - (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; + return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) +/* "View.MemoryView":1113 * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_v_base; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":933 - * - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< - * if base is NULL: - * return None + /* "View.MemoryView":1118 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 + * */ - __pyx_v_base = PyArray_BASE(__pyx_v_arr); + __pyx_v_c_stride = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base + /* "View.MemoryView":1119 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): */ - __pyx_t_1 = ((__pyx_v_base == NULL) != 0); - if (__pyx_t_1) { + __pyx_v_f_stride = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":935 - * base = PyArray_BASE(arr) - * if base is NULL: - * return None # <<<<<<<<<<<<<< - * return base + /* "View.MemoryView":1121 + * cdef Py_ssize_t f_stride = 0 * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base + /* "View.MemoryView":1122 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break */ - } + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":936 - * if base is NULL: - * return None - * return base # <<<<<<<<<<<<<< + /* "View.MemoryView":1123 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break * - * # Versions of the import_* functions which are more suitable for */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_base)); - __pyx_r = ((PyObject *)__pyx_v_base); - goto __pyx_L0; + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) + /* "View.MemoryView":1124 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: + * for i in range(ndim): */ + goto __pyx_L4_break; - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1122 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break + */ + } + } + __pyx_L4_break:; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() + /* "View.MemoryView":1126 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] */ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; -static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_array", 0); + /* "View.MemoryView":1127 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break + */ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":1128 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":942 - * cdef inline int import_array() except -1: - * try: - * __pyx_import_array() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":1129 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 942, __pyx_L3_error) + goto __pyx_L7_break; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":1127 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break */ } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + } + __pyx_L7_break:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":943 - * try: - * __pyx_import_array() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":1131 + * break * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 943, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":1132 * - * cdef inline int import_umath() except -1: + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 944, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 944, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + __pyx_r = 'C'; + goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":1131 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() + /* "View.MemoryView":1134 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< + * + * @cython.cdivision(True) + */ + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } + + /* "View.MemoryView":1113 + * + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") +/* "View.MemoryView":1137 * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ -static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_umath", 0); +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "View.MemoryView":1144 * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + __pyx_v_src_extent = (__pyx_v_src_shape[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":948 - * cdef inline int import_umath() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":1145 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 948, __pyx_L3_error) + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "View.MemoryView":1146 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + __pyx_v_src_stride = (__pyx_v_src_strides[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":949 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":1147 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< * + * if ndim == 1: */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 949, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * cdef inline int import_ufunc() except -1: + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 950, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 950, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "View.MemoryView":1150 * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") - * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + /* "View.MemoryView":1151 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: */ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":1150 * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ + if (__pyx_t_1) { -static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_ufunc", 0); + /* "View.MemoryView":1152 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): + */ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + /* "View.MemoryView":1150 * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + goto __pyx_L4; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":954 - * cdef inline int import_ufunc() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":1154 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 954, __pyx_L3_error) + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + /* "View.MemoryView":1155 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":955 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") - * + /* "View.MemoryView":1156 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 955, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":956 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - * - * cdef extern from *: + /* "View.MemoryView":1157 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 956, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 956, __pyx_L5_except_error) + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + __pyx_L4:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + goto __pyx_L3; } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") - * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + /* "View.MemoryView":1159 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, */ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1160 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, + */ + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 - * + /* "View.MemoryView":1164 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` */ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); -static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_timedelta64_object", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":978 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1165 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); - goto __pyx_L0; + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 - * + /* "View.MemoryView":1137 * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * +/* "View.MemoryView":1167 + * dst_data += dst_stride * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ -static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_datetime64_object", 0); +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":993 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1170 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) * */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); - goto __pyx_L0; + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * + /* "View.MemoryView":1167 + * dst_data += dst_stride * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 +/* "View.MemoryView":1174 * - * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ -static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { - npy_datetime __pyx_r; +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1003 - * also needed. That can be found using `get_datetime64_unit`. - * """ - * return (obj).obval # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1176 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< * + * for shape in src.shape[:ndim]: */ - __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 + /* "View.MemoryView":1178 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object */ + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 + /* "View.MemoryView":1179 * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object + * return size */ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } -static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { - npy_timedelta __pyx_r; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1010 - * returns the int64 value underlying scalar numpy timedelta64 object - * """ - * return (obj).obval # <<<<<<<<<<<<<< + /* "View.MemoryView":1181 + * size *= shape * + * return size # <<<<<<<<<<<<<< * + * @cname('__pyx_fill_contig_strides_array') */ - __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + __pyx_r = __pyx_v_size; goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 - * + /* "View.MemoryView":1174 * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ /* function exit code */ @@ -20085,2330 +17342,2158 @@ static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 +/* "View.MemoryView":1184 * - * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ -static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { - NPY_DATETIMEUNIT __pyx_r; +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1017 - * returns the unit part of the dtype for a numpy datetime64 object. - * """ - * return (obj).obmeta.base # <<<<<<<<<<<<<< + /* "View.MemoryView":1193 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ - __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); - goto __pyx_L0; + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 - * + /* "View.MemoryView":1194 * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] */ + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} + /* "View.MemoryView":1195 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: + */ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; -/* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): + /* "View.MemoryView":1196 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): + */ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + + /* "View.MemoryView":1193 + * cdef int idx * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ + goto __pyx_L3; + } -/* Python wrapper */ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_shape = 0; - Py_ssize_t __pyx_v_itemsize; - PyObject *__pyx_v_format = 0; - PyObject *__pyx_v_mode = 0; - int __pyx_v_allocate_buffer; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; - PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_n_s_c); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 123, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 123, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode); - if (value) { values[3] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 123, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_shape = ((PyObject*)values[0]); - __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_v_format = values[2]; - __pyx_v_mode = values[3]; - if (values[4]) { - __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 124, __pyx_L3_error) - } else { + /* "View.MemoryView":1198 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] + */ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; - /* "View.MemoryView":124 + /* "View.MemoryView":1199 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, - * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + */ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1200 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< * - * cdef int idx + * return stride */ - __pyx_v_allocate_buffer = ((int)1); + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 123, __pyx_L1_error) - if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 123, __pyx_L1_error) - } - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + __pyx_L3:; - /* "View.MemoryView":123 - * cdef bint dtype_is_object + /* "View.MemoryView":1202 + * stride *= shape[idx] * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') + */ + __pyx_r = __pyx_v_stride; + goto __pyx_L0; + + /* "View.MemoryView":1184 * + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { - int __pyx_v_idx; - Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_dim; - PyObject **__pyx_v_p; - char __pyx_v_order; - int __pyx_r; +/* "View.MemoryView":1205 + * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, + */ + +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - Py_ssize_t __pyx_t_11; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_format); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("copy_data_to_temp", 1); - /* "View.MemoryView":130 - * cdef PyObject **p + /* "View.MemoryView":1216 + * cdef void *result * - * self.ndim = len(shape) # <<<<<<<<<<<<<< - * self.itemsize = itemsize + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) * */ - if (unlikely(__pyx_v_shape == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 130, __pyx_L1_error) - } - __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 130, __pyx_L1_error) - __pyx_v_self->ndim = ((int)__pyx_t_1); + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":131 + /* "View.MemoryView":1217 * - * self.ndim = len(shape) - * self.itemsize = itemsize # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< * - * if not self.ndim: + * result = malloc(size) */ - __pyx_v_self->itemsize = __pyx_v_itemsize; + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - /* "View.MemoryView":133 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") + /* "View.MemoryView":1219 + * cdef size_t size = slice_get_size(src, ndim) * + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() */ - __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_v_result = malloc(__pyx_v_size); - /* "View.MemoryView":134 + /* "View.MemoryView":1220 * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() * - * if itemsize <= 0: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 134, __pyx_L1_error) + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { - /* "View.MemoryView":133 - * self.itemsize = itemsize + /* "View.MemoryView":1221 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") * */ - } + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error) - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") + /* "View.MemoryView":1220 * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() * */ - __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0); - if (unlikely(__pyx_t_2)) { + } - /* "View.MemoryView":137 + /* "View.MemoryView":1224 * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< * - * if not isinstance(format, bytes): + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 137, __pyx_L1_error) + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") + /* "View.MemoryView":1225 * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] */ - } + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") - * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string + /* "View.MemoryView":1226 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 */ - __pyx_t_2 = PyBytes_Check(__pyx_v_format); - __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_4) { + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":140 + /* "View.MemoryView":1227 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 * - * if not isinstance(format, bytes): - * format = format.encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format # keep a reference to the byte string - * self.format = self._format */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); - __pyx_t_3 = 0; + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") + /* "View.MemoryView":1228 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) */ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; } - /* "View.MemoryView":141 - * if not isinstance(format, bytes): - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< - * self.format = self._format + /* "View.MemoryView":1230 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * * */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 141, __pyx_L1_error) - __pyx_t_3 = __pyx_v_format; - __Pyx_INCREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->_format); - __Pyx_DECREF(__pyx_v_self->_format); - __pyx_v_self->_format = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":142 - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - * self.format = self._format # <<<<<<<<<<<<<< - * - * - */ - if (unlikely(__pyx_v_self->_format == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(2, 142, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 142, __pyx_L1_error) - __pyx_v_self->format = __pyx_t_7; - - /* "View.MemoryView":145 - * - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< - * self._strides = self._shape + self.ndim - * - */ - __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - /* "View.MemoryView":146 + /* "View.MemoryView":1233 * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) - * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< * - * if not self._shape: + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 */ - __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim + /* "View.MemoryView":1234 * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 * */ - __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1235 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< * + * if slice_is_contig(src[0], order, ndim): */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 149, __pyx_L1_error) + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim + /* "View.MemoryView":1234 * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 * */ + } } - /* "View.MemoryView":152 - * + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - __pyx_t_8 = 0; - __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; - for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 152, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_9; - __pyx_v_idx = __pyx_t_8; - __pyx_t_8 = (__pyx_t_8 + 1); + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":153 + /* "View.MemoryView":1238 * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) */ - __pyx_t_4 = ((__pyx_v_dim <= 0) != 0); - if (unlikely(__pyx_t_4)) { + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - /* "View.MemoryView":154 - * for idx, dim in enumerate(shape): - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<< - * self._shape[idx] = dim + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 154, __pyx_L1_error) + goto __pyx_L9; + } - /* "View.MemoryView":153 + /* "View.MemoryView":1240 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim + * return result */ - } + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; - /* "View.MemoryView":155 - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim # <<<<<<<<<<<<<< + /* "View.MemoryView":1242 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) * - * cdef char order - */ - (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - - /* "View.MemoryView":152 + * return result # <<<<<<<<<<<<<< * * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "View.MemoryView":158 + /* "View.MemoryView":1205 * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 158, __pyx_L1_error) - if (__pyx_t_4) { - - /* "View.MemoryView":159 - * cdef char order - * if mode == 'fortran': - * order = b'F' # <<<<<<<<<<<<<< - * self.mode = u'fortran' - * elif mode == 'c': + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ - __pyx_v_order = 'F'; - /* "View.MemoryView":160 - * if mode == 'fortran': - * order = b'F' - * self.mode = u'fortran' # <<<<<<<<<<<<<< - * elif mode == 'c': - * order = b'C' - */ - __Pyx_INCREF(__pyx_n_u_fortran); - __Pyx_GIVEREF(__pyx_n_u_fortran); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_fortran; + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} - /* "View.MemoryView":158 +/* "View.MemoryView":1247 * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - goto __pyx_L10; - } - - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 161, __pyx_L1_error) - if (likely(__pyx_t_4)) { - - /* "View.MemoryView":162 - * self.mode = u'fortran' - * elif mode == 'c': - * order = b'C' # <<<<<<<<<<<<<< - * self.mode = u'c' - * else: - */ - __pyx_v_order = 'C'; - - /* "View.MemoryView":163 - * elif mode == 'c': - * order = b'C' - * self.mode = u'c' # <<<<<<<<<<<<<< - * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ - __Pyx_INCREF(__pyx_n_u_c); - __Pyx_GIVEREF(__pyx_n_u_c); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_c; - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - goto __pyx_L10; - } +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_UCS4 __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_extents", 0); - /* "View.MemoryView":165 - * self.mode = u'c' - * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< + /* "View.MemoryView":1249 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< * - * self.len = fill_contig_strides_array(self._shape, self._strides, + * @cname('__pyx_memoryview_err_dim') */ - /*else*/ { - __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 165, __pyx_L1_error) - } - __pyx_L10:; + __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 127; + __Pyx_INCREF(__pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_2 += 35; + __Pyx_GIVEREF(__pyx_kp_u_got_differing_extents_in_dimensi); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_got); + __pyx_t_2 += 6; + __Pyx_GIVEREF(__pyx_kp_u_got); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_got); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_and); + __pyx_t_2 += 5; + __Pyx_GIVEREF(__pyx_kp_u_and); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_and); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_2 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__7); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 1249, __pyx_L1_error) - /* "View.MemoryView":167 - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) - * - * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<< - * itemsize, self.ndim, order) + /* "View.MemoryView":1247 * + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ - __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - /* "View.MemoryView":170 - * itemsize, self.ndim, order) - * - * self.free_data = allocate_buffer # <<<<<<<<<<<<<< - * self.dtype_is_object = format == b'O' - * if allocate_buffer: - */ - __pyx_v_self->free_data = __pyx_v_allocate_buffer; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} - /* "View.MemoryView":171 +/* "View.MemoryView":1252 * - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< - * if allocate_buffer: + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 171, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 171, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_self->dtype_is_object = __pyx_t_4; - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = (__pyx_v_allocate_buffer != 0); - if (__pyx_t_4) { +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); - /* "View.MemoryView":175 - * + /* "View.MemoryView":1253 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< * - * self.data = malloc(self.len) # <<<<<<<<<<<<<< - * if not self.data: - * raise MemoryError("unable to allocate array data.") + * @cname('__pyx_memoryview_err') */ - __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1253, __pyx_L1_error) - /* "View.MemoryView":176 + /* "View.MemoryView":1252 * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * */ - __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0); - if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< - * - * if self.dtype_is_object: - */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 177, __pyx_L1_error) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} - /* "View.MemoryView":176 +/* "View.MemoryView":1256 * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg * */ - } - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1257 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): + * @cname('__pyx_memoryview_err_no_memory') */ - __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_4) { + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1257, __pyx_L1_error) - /* "View.MemoryView":180 + /* "View.MemoryView":1256 + * + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg * - * if self.dtype_is_object: - * p = self.data # <<<<<<<<<<<<<< - * for i in range(self.len / itemsize): - * p[i] = Py_None */ - __pyx_v_p = ((PyObject **)__pyx_v_self->data); - /* "View.MemoryView":181 - * if self.dtype_is_object: - * p = self.data - * for i in range(self.len / itemsize): # <<<<<<<<<<<<<< - * p[i] = Py_None - * Py_INCREF(Py_None) - */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize); - __pyx_t_9 = __pyx_t_1; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} - /* "View.MemoryView":182 - * p = self.data - * for i in range(self.len / itemsize): - * p[i] = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) +/* "View.MemoryView":1260 * - */ - (__pyx_v_p[__pyx_v_i]) = Py_None; - - /* "View.MemoryView":183 - * for i in range(self.len / itemsize): - * p[i] = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * - * @cname('getbuffer') */ - Py_INCREF(Py_None); - } - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") - * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): - */ - } +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_no_memory", 0); - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< + /* "View.MemoryView":1261 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< * * */ - } + PyErr_NoMemory(); __PYX_ERR(1, 1261, __pyx_L1_error) - /* "View.MemoryView":123 - * cdef bint dtype_is_object + /* "View.MemoryView":1260 * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_format); __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "View.MemoryView":186 +/* "View.MemoryView":1265 * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_bufmode; +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + Py_ssize_t __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; - Py_ssize_t __pyx_t_5; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; int __pyx_t_6; - Py_ssize_t *__pyx_t_7; + void *__pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":187 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 # <<<<<<<<<<<<<< - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - __pyx_v_bufmode = -1; - - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 188, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("memoryview_copy_contents", 1); - /* "View.MemoryView":189 - * cdef int bufmode = -1 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + /* "View.MemoryView":1273 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i */ - __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + __pyx_v_tmpdata = NULL; - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": + /* "View.MemoryView":1274 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) */ - goto __pyx_L3; - } + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): + /* "View.MemoryView":1276 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 190, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); - /* "View.MemoryView":191 - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") + /* "View.MemoryView":1277 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp */ - __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + __pyx_v_broadcasting = 0; - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): + /* "View.MemoryView":1278 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp + * */ - } - __pyx_L3:; + __pyx_v_direct_copy = 0; - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ - __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len + /* "View.MemoryView":1282 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 193, __pyx_L1_error) + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ + goto __pyx_L3; } - /* "View.MemoryView":194 - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data # <<<<<<<<<<<<<< - * info.len = self.len - * info.ndim = self.ndim + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * */ - __pyx_t_4 = __pyx_v_self->data; - __pyx_v_info->buf = __pyx_t_4; + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":195 - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - * info.len = self.len # <<<<<<<<<<<<<< - * info.ndim = self.ndim - * info.shape = self._shape + /* "View.MemoryView":1284 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) */ - __pyx_t_5 = __pyx_v_self->len; - __pyx_v_info->len = __pyx_t_5; + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - /* "View.MemoryView":196 - * info.buf = self.data - * info.len = self.len - * info.ndim = self.ndim # <<<<<<<<<<<<<< - * info.shape = self._shape - * info.strides = self._strides + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * */ - __pyx_t_6 = __pyx_v_self->ndim; - __pyx_v_info->ndim = __pyx_t_6; + } + __pyx_L3:; - /* "View.MemoryView":197 - * info.len = self.len - * info.ndim = self.ndim - * info.shape = self._shape # <<<<<<<<<<<<<< - * info.strides = self._strides - * info.suboffsets = NULL + /* "View.MemoryView":1286 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): */ - __pyx_t_7 = __pyx_v_self->_shape; - __pyx_v_info->shape = __pyx_t_7; + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; - /* "View.MemoryView":198 - * info.ndim = self.ndim - * info.shape = self._shape - * info.strides = self._strides # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = self.itemsize + /* "View.MemoryView":1288 + * cdef int ndim = max(src_ndim, dst_ndim) + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: */ - __pyx_t_7 = __pyx_v_self->_strides; - __pyx_v_info->strides = __pyx_t_7; + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":199 - * info.shape = self._shape - * info.strides = self._strides - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = self.itemsize - * info.readonly = 0 + /* "View.MemoryView":1289 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ - __pyx_v_info->suboffsets = NULL; + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { - /* "View.MemoryView":200 - * info.strides = self._strides - * info.suboffsets = NULL - * info.itemsize = self.itemsize # <<<<<<<<<<<<<< - * info.readonly = 0 - * + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 */ - __pyx_t_5 = __pyx_v_self->itemsize; - __pyx_v_info->itemsize = __pyx_t_5; + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { - /* "View.MemoryView":201 - * info.suboffsets = NULL - * info.itemsize = self.itemsize - * info.readonly = 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":1291 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: + */ + __pyx_v_broadcasting = 1; + + /* "View.MemoryView":1292 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) + */ + (__pyx_v_src.strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 + */ + goto __pyx_L7; + } + + /* "View.MemoryView":1294 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< * - * if flags & PyBUF_FORMAT: + * if src.suboffsets[i] >= 0: */ - __pyx_v_info->readonly = 0; + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1294, __pyx_L1_error) + } + __pyx_L7:; - /* "View.MemoryView":203 - * info.readonly = 0 + /* "View.MemoryView":1289 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format - * else: + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + } - /* "View.MemoryView":204 + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * if flags & PyBUF_FORMAT: - * info.format = self.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL */ - __pyx_t_4 = __pyx_v_self->format; - __pyx_v_info->format = __pyx_t_4; + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { - /* "View.MemoryView":203 - * info.readonly = 0 + /* "View.MemoryView":1297 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format - * else: + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + * + * if slices_overlap(&src, &dst, ndim, itemsize): */ - goto __pyx_L5; - } + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error) - /* "View.MemoryView":206 - * info.format = self.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * info.obj = self */ - /*else*/ { - __pyx_v_info->format = NULL; + } } - __pyx_L5:; - /* "View.MemoryView":208 - * info.format = NULL + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * info.obj = self # <<<<<<<<<<<<<< + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + * if not slice_is_contig(src, order, ndim): */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { - /* "View.MemoryView":186 + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": */ + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1302 + * + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + */ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); -/* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) */ + } -/* Python wrapper */ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + /* "View.MemoryView":1304 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp + * + */ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1304, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} + /* "View.MemoryView":1305 + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: + */ + __pyx_v_src = __pyx_v_tmp; -static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__", 0); + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): + */ + } - /* "View.MemoryView":213 + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: */ - __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0); - if (__pyx_t_1) { + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { - /* "View.MemoryView":214 - * def __dealloc__(array self): - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) # <<<<<<<<<<<<<< - * elif self.free_data: - * if self.dtype_is_object: + /* "View.MemoryView":1310 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ - __pyx_v_self->callback_free_data(__pyx_v_self->data); + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":213 + /* "View.MemoryView":1311 * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) */ - goto __pyx_L3; - } + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, + /* "View.MemoryView":1310 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ - __pyx_t_1 = (__pyx_v_self->free_data != 0); - if (__pyx_t_1) { + goto __pyx_L12; + } - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * */ - __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_1) { + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":217 - * elif self.free_data: - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< - * self._strides, self.ndim, False) - * free(self.data) + /* "View.MemoryView":1313 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + * + * if direct_copy: */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * */ } + __pyx_L12:; - /* "View.MemoryView":219 - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) - * free(self.data) # <<<<<<<<<<<<<< - * PyObject_Free(self._shape) + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - free(__pyx_v_self->data); + if (__pyx_v_direct_copy) { - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, + /* "View.MemoryView":1317 + * if direct_copy: + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) */ - } - __pyx_L3:; + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":220 - * self._strides, self.ndim, False) - * free(self.data) - * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + /* "View.MemoryView":1318 * - * @property + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) */ - PyObject_Free(__pyx_v_self->_shape); + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + + /* "View.MemoryView":1319 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 + */ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + /* "View.MemoryView":1320 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) */ + free(__pyx_v_tmpdata); - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} + /* "View.MemoryView":1321 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): + */ + __pyx_r = 0; + goto __pyx_L0; -/* "View.MemoryView":223 + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() + * if direct_copy: # <<<<<<<<<<<<<< * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * + */ + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { -static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":1326 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) + * + */ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1326, __pyx_L1_error) - /* "View.MemoryView":224 - * @property - * def memview(self): - * return self.get_memview() # <<<<<<<<<<<<<< + /* "View.MemoryView":1327 * - * @cname('get_memview') + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) - /* "View.MemoryView":223 + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() * */ + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1329 + * transpose_memslice(&dst) + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + */ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); -/* "View.MemoryView":227 + /* "View.MemoryView":1330 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) */ + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_memview", 0); + /* "View.MemoryView":1331 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * free(tmpdata) + */ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":228 - * @cname('get_memview') - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< - * return memoryview(self, flags, self.dtype_is_object) + /* "View.MemoryView":1333 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 * */ - __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + free(__pyx_v_tmpdata); - /* "View.MemoryView":229 - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + /* "View.MemoryView":1334 * - * def __len__(self): + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_r = 0; goto __pyx_L0; - /* "View.MemoryView":227 + /* "View.MemoryView":1265 * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] +/* "View.MemoryView":1337 * + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ -/* Python wrapper */ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; - /* "View.MemoryView":232 - * - * def __len__(self): - * return self._shape[0] # <<<<<<<<<<<<<< + /* "View.MemoryView":1341 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< * - * def __getattr__(self, attr): + * for i in range(ndim - 1, -1, -1): */ - __pyx_r = (__pyx_v_self->_shape[0]); - goto __pyx_L0; + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - /* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] + /* "View.MemoryView":1343 + * cdef int offset = ndim_other - ndim * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] */ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1344 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + */ + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); -/* "View.MemoryView":234 - * return self._shape[0] + /* "View.MemoryView":1345 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) + */ + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1346 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< * + * for i in range(offset): */ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); + } -/* Python wrapper */ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + /* "View.MemoryView":1348 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + */ + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1349 + * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 + */ + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getattr__", 0); + /* "View.MemoryView":1350 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 + * + */ + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); - /* "View.MemoryView":235 + /* "View.MemoryView":1351 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< * - * def __getattr__(self, attr): - * return getattr(self.memview, attr) # <<<<<<<<<<<<<< * - * def __getitem__(self, item): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } - /* "View.MemoryView":234 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) + /* "View.MemoryView":1337 * + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":237 - * return getattr(self.memview, attr) +/* "View.MemoryView":1359 * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< * + * if dtype_is_object: */ -/* Python wrapper */ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + */ + if (__pyx_v_dtype_is_object) { -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); + /* "View.MemoryView":1362 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + */ + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); - /* "View.MemoryView":238 + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: * - * def __getitem__(self, item): - * return self.memview[item] # <<<<<<<<<<<<<< + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) * - * def __setitem__(self, item, value): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + } - /* "View.MemoryView":237 - * return getattr(self.memview, attr) + /* "View.MemoryView":1359 * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< * + * if dtype_is_object: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":240 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value +/* "View.MemoryView":1365 * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: */ -/* Python wrapper */ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); + + /* "View.MemoryView":1368 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + */ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1365 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + */ /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; +/* "View.MemoryView":1371 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + */ + +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - /* "View.MemoryView":241 - * - * def __setitem__(self, item, value): - * self.memview[item] = value # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1374 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< * + * for i in range(shape[0]): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 241, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":240 - * return self.memview[item] + /* "View.MemoryView":1376 + * cdef Py_ssize_t stride = strides[0] * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: + */ + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1377 * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) */ + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: + */ + if (__pyx_v_inc) { -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "View.MemoryView":1379 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) */ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: + */ + goto __pyx_L6; + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1381 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + */ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; -static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + /* "View.MemoryView":1377 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) + */ + goto __pyx_L5; + } - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":1383 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< + * + * data += stride */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "View.MemoryView":1385 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1371 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") +/* "View.MemoryView":1391 + * + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1394 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + */ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); -static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + /* "View.MemoryView":1395 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + * + */ + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "View.MemoryView":1396 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":1391 + * + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":245 +/* "View.MemoryView":1400 * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ -static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) { - struct __pyx_array_obj *__pyx_v_result = 0; - struct __pyx_array_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("array_cwrapper", 0); + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; - /* "View.MemoryView":249 - * cdef array result + /* "View.MemoryView":1404 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: */ - __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); - if (__pyx_t_1) { + __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":250 + /* "View.MemoryView":1405 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< * - * if buf == NULL: - * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<< - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), + * if ndim == 1: */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_extent = (__pyx_v_shape[0]); - /* "View.MemoryView":249 - * cdef array result + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) */ - goto __pyx_L3; - } + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf + /* "View.MemoryView":1408 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride */ - /*else*/ { - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_3 = 0; + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":253 + /* "View.MemoryView":1409 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) # <<<<<<<<<<<<<< - * result.data = buf - * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 253, __pyx_L1_error) + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) + /* "View.MemoryView":1410 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf + * for i in range(extent): */ - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } - /* "View.MemoryView":254 - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) - * result.data = buf # <<<<<<<<<<<<<< + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] * - * return result + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) */ - __pyx_v_result->data = __pyx_v_buf; + goto __pyx_L3; } - __pyx_L3:; - /* "View.MemoryView":256 - * result.data = buf + /* "View.MemoryView":1412 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride + */ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1413 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride * - * return result # <<<<<<<<<<<<<< + */ + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1414 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = __pyx_v_result; - goto __pyx_L0; + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; - /* "View.MemoryView":245 + /* "View.MemoryView":1400 * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): +/* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* Python wrapper */ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 282, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } - __pyx_v_name = values[0]; + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 282, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return -1; + return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); - - /* "View.MemoryView":283 - * cdef object name - * def __init__(self, name): - * self.name = name # <<<<<<<<<<<<<< - * def __repr__(self): - * return self.name - */ - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __Pyx_GOTREF(__pyx_v_self->name); - __Pyx_DECREF(__pyx_v_self->name); - __pyx_v_self->name = __pyx_v_name; - - /* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): - */ - - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * - */ - -/* Python wrapper */ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "View.MemoryView":285 - * self.name = name - * def __repr__(self): - * return self.name # <<<<<<<<<<<<<< - * - * cdef generic = Enum("") - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->name); - __pyx_r = __pyx_v_self->name; - goto __pyx_L0; - - /* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self.name,) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_self->name); - __Pyx_GIVEREF(__pyx_v_self->name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); - __pyx_v_state = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v__dict = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - __pyx_t_2 = (__pyx_v__dict != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); - __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self.name is not None + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: */ - __pyx_v_use_setstate = 1; + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - goto __pyx_L3; } - /* "(tree fragment)":11 - * use_setstate = True - * else: - * use_setstate = self.name is not None # <<<<<<<<<<<<<< - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) */ - /*else*/ { - __pyx_t_3 = (__pyx_v_self->name != Py_None); - __pyx_v_use_setstate = __pyx_t_3; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } } - __pyx_L3:; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result */ - __pyx_t_3 = (__pyx_v_use_setstate != 0); - if (__pyx_t_3) { + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { - /* "(tree fragment)":13 - * use_setstate = self.name is not None - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<< - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); - __pyx_t_4 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result */ } - /* "(tree fragment)":15 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - /* "(tree fragment)":17 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error) + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 > 1); + if (__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":14 + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) + */ + } + + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ /* function exit code */ @@ -22416,10730 +19501,18609 @@ static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_Me goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":299 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ -static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) { - Py_intptr_t __pyx_v_aligned_p; - size_t __pyx_v_offset; - void *__pyx_r; - int __pyx_t_1; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; - /* "View.MemoryView":301 - * cdef void *align_pointer(void *memory, size_t alignment) nogil: - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<< - * cdef size_t offset + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":248 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< * + * @property */ - __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory); + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; - /* "View.MemoryView":305 - * - * with cython.cdivision(True): - * offset = aligned_p % alignment # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * - * if offset > 0: + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ - __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment); - /* "View.MemoryView":307 - * offset = aligned_p % alignment - * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset - * - */ - __pyx_t_1 = ((__pyx_v_offset > 0) != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "View.MemoryView":308 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 * - * if offset > 0: - * aligned_p += alignment - offset # <<<<<<<<<<<<<< - * - * return aligned_p + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ */ - __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset)); - /* "View.MemoryView":307 - * offset = aligned_p % alignment - * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset - * - */ - } +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); - /* "View.MemoryView":310 - * aligned_p += alignment - offset - * - * return aligned_p # <<<<<<<<<<<<<< - * + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":254 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< * + * @property */ - __pyx_r = ((void *)__pyx_v_aligned_p); + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); goto __pyx_L0; - /* "View.MemoryView":299 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ */ /* function exit code */ __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ */ -/* Python wrapper */ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_obj = 0; - int __pyx_v_flags; - int __pyx_v_dtype_is_object; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 346, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 346, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) - if (values[2]) { - __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) - } else { - __pyx_v_dtype_is_object = ((int)0); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 346, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - /* "View.MemoryView":347 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":260 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj # <<<<<<<<<<<<<< - * self.flags = flags - * if type(self) is memoryview or obj is not None: + * @property */ - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - __Pyx_GOTREF(__pyx_v_self->obj); - __Pyx_DECREF(__pyx_v_self->obj); - __pyx_v_self->obj = __pyx_v_obj; + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; - /* "View.MemoryView":348 - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj - * self.flags = flags # <<<<<<<<<<<<<< - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 + * + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ */ - __pyx_v_self->flags = __pyx_v_flags; - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - */ - __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_3 = (__pyx_v_obj != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "View.MemoryView":350 - * self.flags = flags - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 + * + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 350, __pyx_L1_error) - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) - */ - __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); - if (__pyx_t_1) { +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; - /* "View.MemoryView":352 - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":268 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< * + * @property */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; - /* "View.MemoryView":353 - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - */ - Py_INCREF(Py_None); - - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - } - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - */ - } + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "View.MemoryView":355 - * Py_INCREF(Py_None) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0); - if (__pyx_t_1) { +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; - /* "View.MemoryView":358 - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":275 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; - /* "View.MemoryView":359 - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 + * + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - } + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 + * + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":361 - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< - * if self.lock is NULL: - * raise MemoryError - */ - __pyx_v_self->lock = PyThread_allocate_lock(); +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":281 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; - /* "View.MemoryView":363 - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - * raise MemoryError # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 * - * if flags & PyBUF_FORMAT: + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ */ - PyErr_NoMemory(); __PYX_ERR(2, 363, __pyx_L1_error) - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 * + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. */ - } - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - */ - } +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; - /* "View.MemoryView":355 - * Py_INCREF(Py_None) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":290 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: + * ctypedef unsigned char npy_bool */ - } + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; - /* "View.MemoryView":365 - * raise MemoryError + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":366 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) * - * if flags & PyBUF_FORMAT: - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< - * else: - * self.dtype_is_object = dtype_is_object */ - __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L12_bool_binop_done; - } - __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L12_bool_binop_done:; - __pyx_v_self->dtype_is_object = __pyx_t_1; - /* "View.MemoryView":365 - * raise MemoryError +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":774 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): */ - goto __pyx_L11; - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":368 - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( */ - /*else*/ { - __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; - } - __pyx_L11:; - /* "View.MemoryView":370 - * self.dtype_is_object = dtype_is_object + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<< - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL */ - __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int)))); - /* "View.MemoryView":372 - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL # <<<<<<<<<<<<<< +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":777 * - * def __dealloc__(memoryview self): + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): */ - __pyx_v_self->typeinfo = NULL; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":374 - * self.typeinfo = NULL +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) */ -/* Python wrapper */ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { - int __pyx_v_i; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyThread_type_lock __pyx_t_6; - PyThread_type_lock __pyx_t_7; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":375 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":780 * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - */ - __pyx_t_1 = (__pyx_v_self->obj != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":376 - * def __dealloc__(memoryview self): - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< - * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __Pyx_ReleaseBuffer((&__pyx_v_self->view)); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":375 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * - * (<__pyx_buffer *> &self.view).obj = NULL */ - __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":379 - * elif (<__pyx_buffer *> &self.view).obj == Py_None: + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) * - * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< - * Py_DECREF(Py_None) + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; - /* "View.MemoryView":380 +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":783 * - * (<__pyx_buffer *> &self.view).obj = NULL - * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * - * cdef int i + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - Py_DECREF(Py_None); + __Pyx_XDECREF(__pyx_r); + __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_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * - * (<__pyx_buffer *> &self.view).obj = NULL */ - } - __pyx_L3:; - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - */ - __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0); - if (__pyx_t_2) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":385 - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * */ - __pyx_t_3 = __pyx_memoryview_thread_locks_used; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - */ - __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0); - if (__pyx_t_2) { +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "View.MemoryView":387 - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + __Pyx_XDECREF(__pyx_r); + __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_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * */ - __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":390 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< - * break - * else: - */ - __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":389 - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape */ - (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6; - (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7; - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - */ - } +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - /* "View.MemoryView":391 - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break # <<<<<<<<<<<<<< - * else: - * PyThread_free_lock(self.lock) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: */ - goto __pyx_L6_break; + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":790 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () */ - } - } - /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); + __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); + goto __pyx_L0; - /* "View.MemoryView":393 - * break - * else: - * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: */ - PyThread_free_lock(__pyx_v_self->lock); - } - __pyx_L6_break:; + } - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":792 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_empty_tuple); + __pyx_r = __pyx_empty_tuple; + goto __pyx_L0; } - /* "View.MemoryView":374 - * self.typeinfo = NULL + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape */ /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":395 - * PyThread_free_lock(self.lock) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ -static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - Py_ssize_t __pyx_v_dim; - char *__pyx_v_itemp; - PyObject *__pyx_v_idx = NULL; - char *__pyx_r; +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - char *__pyx_t_7; + int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_item_pointer", 0); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "View.MemoryView":397 - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":968 + * + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) * - * for dim, idx in enumerate(index): */ - __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + Py_INCREF(__pyx_v_base); - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":969 + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< * + * cdef inline object get_array_base(ndarray arr): */ - __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { - __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 399, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 399, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_1; - __pyx_t_1 = (__pyx_t_1 + 1); + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 969, __pyx_L1_error) - /* "View.MemoryView":400 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 * - * for dim, idx in enumerate(index): - * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) * - * return itemp + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_7; - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":972 * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None + */ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base + */ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":974 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base */ } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":402 - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - * return itemp # <<<<<<<<<<<<<< - * + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":975 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< * + * # Versions of the import_* functions which are more suitable for */ - __pyx_r = __pyx_v_itemp; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); goto __pyx_L0; - /* "View.MemoryView":395 - * PyThread_free_lock(self.lock) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":405 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ -/* Python wrapper */ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_indices = NULL; - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_4; PyObject *__pyx_t_5 = NULL; - char *__pyx_t_6; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); + __Pyx_RefNannySetupContext("import_array", 0); - /* "View.MemoryView":406 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":407 - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: - * return self # <<<<<<<<<<<<<< - * - * have_slices, indices = _unellipsify(index, self.view.ndim) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "View.MemoryView":406 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":981 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") */ - } + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 981, __pyx_L3_error) - /* "View.MemoryView":409 - * return self - * - * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< - * - * cdef char *itemp + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(__pyx_t_3 != Py_None)) { - PyObject* sequence = __pyx_t_3; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 409, __pyx_L1_error) } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 409, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_v_indices = __pyx_t_5; - __pyx_t_5 = 0; - - /* "View.MemoryView":412 - * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: - */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 412, __pyx_L1_error) - if (__pyx_t_2) { - - /* "View.MemoryView":413 - * cdef char *itemp - * if have_slices: - * return memview_slice(self, indices) # <<<<<<<<<<<<<< - * else: - * itemp = self.get_item_pointer(indices) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":412 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":982 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.multiarray failed to import") * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: */ - } + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 982, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":415 - * return memview_slice(self, indices) - * else: - * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< - * return self.convert_item_to_object(itemp) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * + * cdef inline int import_umath() except -1: */ - /*else*/ { - __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 415, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_6; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 983, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 983, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "View.MemoryView":416 - * else: - * itemp = self.get_item_pointer(indices) - * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< - * - * def __setitem__(memoryview self, object index, object value): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; } - /* "View.MemoryView":405 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_indices); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ -/* Python wrapper */ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_obj = NULL; +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - __Pyx_INCREF(__pyx_v_index); - - /* "View.MemoryView":419 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") - * - */ - __pyx_t_1 = (__pyx_v_self->view.readonly != 0); - if (unlikely(__pyx_t_1)) { + __Pyx_RefNannySetupContext("import_umath", 0); - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * have_slices, index = _unellipsify(index, self.view.ndim) + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 420, __pyx_L1_error) + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":419 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") - * + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":987 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") */ - } + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 987, __pyx_L3_error) - /* "View.MemoryView":422 - * raise TypeError("Cannot assign to read-only memoryview") - * - * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * if have_slices: + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(__pyx_t_2 != Py_None)) { - PyObject* sequence = __pyx_t_2; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 422, __pyx_L1_error) } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 422, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); - __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":988 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 988, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":425 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * - * if have_slices: - * obj = self.is_slice(value) # <<<<<<<<<<<<<< - * if obj: - * self.setitem_slice_assignment(self[index], obj) - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_obj = __pyx_t_2; - __pyx_t_2 = 0; - - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 426, __pyx_L1_error) - if (__pyx_t_1) { - - /* "View.MemoryView":427 - * obj = self.is_slice(value) - * if obj: - * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< - * else: - * self.setitem_slice_assign_scalar(self[index], value) - */ - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: - */ - goto __pyx_L5; - } - - /* "View.MemoryView":429 - * self.setitem_slice_assignment(self[index], obj) - * else: - * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< - * else: - * self.setitem_indexed(index, value) + * cdef inline int import_ufunc() except -1: */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 429, __pyx_L1_error) - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 989, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 989, __pyx_L5_except_error) } - __pyx_L5:; - - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) - * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: - */ - goto __pyx_L4; - } + goto __pyx_L5_except_error; - /* "View.MemoryView":431 - * self.setitem_slice_assign_scalar(self[index], value) - * else: - * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * cdef is_slice(self, obj): + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - /*else*/ { - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; } - __pyx_L4:; - /* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XDECREF(__pyx_v_index); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":433 - * self.setitem_indexed(index, value) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ -static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { - PyObject *__pyx_r = NULL; +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_slice", 0); - __Pyx_INCREF(__pyx_v_obj); + __Pyx_RefNannySetupContext("import_ufunc", 0); - /* "View.MemoryView":434 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_5); - /*try:*/ { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":993 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 993, __pyx_L3_error) - /* "View.MemoryView":437 - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * except TypeError: - * return None + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 437, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":994 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") + * */ - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); - __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 994, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":995 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * + * */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 995, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 995, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "View.MemoryView":438 - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - * except TypeError: # <<<<<<<<<<<<<< - * return None + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); - if (__pyx_t_9) { - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 438, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_6); - - /* "View.MemoryView":439 - * self.dtype_is_object) - * except TypeError: - * return None # <<<<<<<<<<<<<< - * - * return obj - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_except_return; - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; - - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L1_error; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L0; - __pyx_L9_try_end:; - } - - /* "View.MemoryView":434 - * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; } - /* "View.MemoryView":441 - * return None - * - * return obj # <<<<<<<<<<<<<< - * - * cdef setitem_slice_assignment(self, dst, src): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_obj); - __pyx_r = __pyx_v_obj; - goto __pyx_L0; - - /* "View.MemoryView":433 - * self.setitem_indexed(index, value) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":443 - * return obj +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice + * + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ -static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { - __Pyx_memviewslice __pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_src_slice; - PyObject *__pyx_r = NULL; +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - __Pyx_memviewslice *__pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice - * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) - */ - if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 447, __pyx_L1_error) - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 447, __pyx_L1_error) + __Pyx_RefNannySetupContext("is_timedelta64_object", 0); - /* "View.MemoryView":448 - * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<< - * src.ndim, dst.ndim, self.dtype_is_object) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1010 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< * - */ - if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 448, __pyx_L1_error) - __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 448, __pyx_L1_error) - - /* "View.MemoryView":449 - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) - */ - __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 447, __pyx_L1_error) - - /* "View.MemoryView":443 - * return obj * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + * + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` */ -static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { - int __pyx_v_array[0x80]; - void *__pyx_v_tmp; - void *__pyx_v_item; - __Pyx_memviewslice *__pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_tmp_slice; - PyObject *__pyx_r = NULL; +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - char const *__pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + __Pyx_RefNannySetupContext("is_datetime64_object", 0); - /* "View.MemoryView":453 - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - * cdef int array[128] - * cdef void *tmp = NULL # <<<<<<<<<<<<<< - * cdef void *item + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1025 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< * - */ - __pyx_v_tmp = NULL; - - /* "View.MemoryView":458 - * cdef __Pyx_memviewslice *dst_slice - * cdef __Pyx_memviewslice tmp_slice - * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< * - * if self.view.itemsize > sizeof(array): */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 458, __pyx_L1_error) - __pyx_v_dst_slice = __pyx_t_1; + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - */ - __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":461 * - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< - * if tmp == NULL: - * raise MemoryError - */ - __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp - */ - __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":463 - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * item = tmp - * else: - */ - PyErr_NoMemory(); __PYX_ERR(2, 463, __pyx_L1_error) - - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` */ - } - /* "View.MemoryView":464 - * if tmp == NULL: - * raise MemoryError - * item = tmp # <<<<<<<<<<<<<< - * else: - * item = array - */ - __pyx_v_item = __pyx_v_tmp; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":466 - * item = tmp - * else: - * item = array # <<<<<<<<<<<<<< * - * try: + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object */ - /*else*/ { - __pyx_v_item = ((void *)__pyx_v_array); - } - __pyx_L3:; - /* "View.MemoryView":468 - * item = array - * - * try: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * ( item)[0] = value - */ - /*try:*/ { +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; - /* "View.MemoryView":469 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1035 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: - */ - __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":470 - * try: - * if self.dtype_is_object: - * ( item)[0] = value # <<<<<<<<<<<<<< - * else: - * self.assign_item_from_object( item, value) - */ - (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - - /* "View.MemoryView":469 * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: */ - goto __pyx_L8; - } + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; - /* "View.MemoryView":472 - * ( item)[0] = value - * else: - * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 * * + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object */ - /*else*/ { - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 472, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L8:; - /* "View.MemoryView":476 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 * * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object */ - __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":477 - * - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) - */ - __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 477, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; - /* "View.MemoryView":476 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1042 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< * * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - */ - } - - /* "View.MemoryView":478 - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< - * item, self.dtype_is_object) - * finally: */ - __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); - } + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; - /* "View.MemoryView":481 - * item, self.dtype_is_object) - * finally: - * PyMem_Free(tmp) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 * - * cdef setitem_indexed(self, index, value): - */ - /*finally:*/ { - /*normal exit:*/{ - PyMem_Free(__pyx_v_tmp); - goto __pyx_L7; - } - __pyx_L6_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; - { - PyMem_Free(__pyx_v_tmp); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; - goto __pyx_L1_error; - } - __pyx_L7:; - } - - /* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":483 - * PyMem_Free(tmp) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. */ -static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_indexed", 0); +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; - /* "View.MemoryView":484 - * - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< - * self.assign_item_from_object(itemp, value) - * + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1049 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 484, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_1; + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; - /* "View.MemoryView":485 - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 * - * cdef convert_item_to_object(self, char *itemp): - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 485, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":483 - * PyMem_Free(tmp) * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" +/* "newanalysis/gfunction/gfunction.pyx":14 + * # CUDA handler interface + * class CUDA(object): + * def __init__(self): # <<<<<<<<<<<<<< + * self.cuda = True + * try: */ -static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_v_struct = NULL; - PyObject *__pyx_v_bytesitem = 0; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - size_t __pyx_t_10; - int __pyx_t_11; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_4CUDA_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_4CUDA_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_4CUDA_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_4CUDA_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":490 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef bytes bytesitem - * - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 14, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 14, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 14, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_self = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 14, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.CUDA.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_4CUDA___init__(__pyx_self, __pyx_v_self); - /* "View.MemoryView":493 - * cdef bytes bytesitem - * - * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_9gfunction_4CUDA___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_v_pycuda = NULL; + PyObject *__pyx_v_drv = NULL; + PyObject *__pyx_v_SourceModule = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "newanalysis/gfunction/gfunction.pyx":15 + * class CUDA(object): + * def __init__(self): + * self.cuda = True # <<<<<<<<<<<<<< * try: - * result = struct.unpack(self.view.format, bytesitem) + * import pycuda.autoinit */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_True) < 0) __PYX_ERR(0, 15, __pyx_L1_error) - /* "View.MemoryView":494 - * - * bytesitem = itemp[:self.view.itemsize] + /* "newanalysis/gfunction/gfunction.pyx":16 + * def __init__(self): + * self.cuda = True * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + * import pycuda.autoinit + * import pycuda.driver as drv */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); /*try:*/ { - /* "View.MemoryView":495 - * bytesitem = itemp[:self.view.itemsize] + /* "newanalysis/gfunction/gfunction.pyx":17 + * self.cuda = True * try: - * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< - * except struct.error: - * raise ValueError("Unable to convert item to object") + * import pycuda.autoinit # <<<<<<<<<<<<<< + * import pycuda.driver as drv + * from pycuda.compiler import SourceModule + */ + __pyx_t_4 = __Pyx_Import(__pyx_n_s_pycuda_autoinit, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_pycuda = __pyx_t_4; + __pyx_t_4 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":18 + * try: + * import pycuda.autoinit + * import pycuda.driver as drv # <<<<<<<<<<<<<< + * from pycuda.compiler import SourceModule + * if pycuda.autoinit.device.compute_capability() < (1, 3): + */ + __pyx_t_4 = __Pyx_ImportDottedModule(__pyx_n_s_pycuda_driver, __pyx_tuple__12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_drv = __pyx_t_4; + __pyx_t_4 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":19 + * import pycuda.autoinit + * import pycuda.driver as drv + * from pycuda.compiler import SourceModule # <<<<<<<<<<<<<< + * if pycuda.autoinit.device.compute_capability() < (1, 3): + * self.cuda = False */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 495, __pyx_L3_error) + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_n_s_SourceModule); + __Pyx_GIVEREF(__pyx_n_s_SourceModule); + if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_SourceModule)) __PYX_ERR(0, 19, __pyx_L3_error); + __pyx_t_5 = __Pyx_Import(__pyx_n_s_pycuda_compiler, __pyx_t_4, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L3_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_SourceModule); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_SourceModule = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":20 + * import pycuda.driver as drv + * from pycuda.compiler import SourceModule + * if pycuda.autoinit.device.compute_capability() < (1, 3): # <<<<<<<<<<<<<< + * self.cuda = False + * except: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pycuda, __pyx_n_s_autoinit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_device); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_compute_capability); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else #endif { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); - __Pyx_INCREF(__pyx_v_bytesitem); - __Pyx_GIVEREF(__pyx_v_bytesitem); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + PyObject *__pyx_callargs[1] = {__pyx_t_6, }; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__13, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L3_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":494 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - */ - } - - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result - */ - /*else:*/ { - __pyx_t_10 = strlen(__pyx_v_self->view.format); - __pyx_t_11 = ((__pyx_t_10 == 1) != 0); - if (__pyx_t_11) { + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 20, __pyx_L3_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { - /* "View.MemoryView":500 - * else: - * if len(self.view.format) == 1: - * return result[0] # <<<<<<<<<<<<<< - * return result - * + /* "newanalysis/gfunction/gfunction.pyx":21 + * from pycuda.compiler import SourceModule + * if pycuda.autoinit.device.compute_capability() < (1, 3): + * self.cuda = False # <<<<<<<<<<<<<< + * except: + * self.cuda = False */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L6_except_return; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_False) < 0) __PYX_ERR(0, 21, __pyx_L3_error) - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result + /* "newanalysis/gfunction/gfunction.pyx":20 + * import pycuda.driver as drv + * from pycuda.compiler import SourceModule + * if pycuda.autoinit.device.compute_capability() < (1, 3): # <<<<<<<<<<<<<< + * self.cuda = False + * except: */ } - /* "View.MemoryView":501 - * if len(self.view.format) == 1: - * return result[0] - * return result # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): + /* "newanalysis/gfunction/gfunction.pyx":16 + * def __init__(self): + * self.cuda = True + * try: # <<<<<<<<<<<<<< + * import pycuda.autoinit + * import pycuda.driver as drv */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L6_except_return; } - __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "View.MemoryView":496 - * try: - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: # <<<<<<<<<<<<<< - * raise ValueError("Unable to convert item to object") - * else: + /* "newanalysis/gfunction/gfunction.pyx":22 + * if pycuda.autoinit.device.compute_capability() < (1, 3): + * self.cuda = False + * except: # <<<<<<<<<<<<<< + * self.cuda = False + * */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9); - __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0; - if (__pyx_t_8) { - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); + /*except:*/ { + __Pyx_AddTraceback("newanalysis.gfunction.CUDA.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 22, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: + /* "newanalysis/gfunction/gfunction.pyx":23 + * self.cuda = False + * except: + * self.cuda = False # <<<<<<<<<<<<<< + * + * if self.cuda: */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 497, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(2, 497, __pyx_L5_except_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_False) < 0) __PYX_ERR(0, 23, __pyx_L5_except_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L4_exception_handled; } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - /* "View.MemoryView":494 - * - * bytesitem = itemp[:self.view.itemsize] + /* "newanalysis/gfunction/gfunction.pyx":16 + * def __init__(self): + * self.cuda = True * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + * import pycuda.autoinit + * import pycuda.driver as drv */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; - __pyx_L6_except_return:; + __pyx_L4_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L0; + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L8_try_end:; } - /* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesitem); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":503 - * return result + /* "newanalysis/gfunction/gfunction.pyx":25 + * self.cuda = False * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - -static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_v_struct = NULL; - char __pyx_v_c; - PyObject *__pyx_v_bytesvalue = 0; - Py_ssize_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - char *__pyx_t_11; - char *__pyx_t_12; - char *__pyx_t_13; - char *__pyx_t_14; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); - - /* "View.MemoryView":506 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef char c - * cdef bytes bytesvalue + * if self.cuda: # <<<<<<<<<<<<<< + * self.drv = drv + * self.dev = pycuda.autoinit.device */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_8) { - /* "View.MemoryView":511 - * cdef Py_ssize_t i + /* "newanalysis/gfunction/gfunction.pyx":26 * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: + * if self.cuda: + * self.drv = drv # <<<<<<<<<<<<<< + * self.dev = pycuda.autoinit.device + * self.source = SourceModule(""" */ - __pyx_t_2 = PyTuple_Check(__pyx_v_value); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + if (unlikely(!__pyx_v_drv)) { __Pyx_RaiseUnboundLocalError("drv"); __PYX_ERR(0, 26, __pyx_L1_error) } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_drv, __pyx_v_drv) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - /* "View.MemoryView":512 - * - * if isinstance(value, tuple): - * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< - * else: - * bytesvalue = struct.pack(self.view.format, value) + /* "newanalysis/gfunction/gfunction.pyx":27 + * if self.cuda: + * self.drv = drv + * self.dev = pycuda.autoinit.device # <<<<<<<<<<<<<< + * self.source = SourceModule(""" + * /[inserted by cython to avoid comment start]* __device__ double atomicAdd(double* address, double val) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error) + if (unlikely(!__pyx_v_pycuda)) { __Pyx_RaiseUnboundLocalError("pycuda"); __PYX_ERR(0, 27, __pyx_L1_error) } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pycuda, __pyx_n_s_autoinit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_device); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - - /* "View.MemoryView":511 - * cdef Py_ssize_t i - * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: - */ - goto __pyx_L3; - } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dev, __pyx_t_5) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":514 - * bytesvalue = struct.pack(self.view.format, *value) - * else: - * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< - * - * for i, c in enumerate(bytesvalue): + /* "newanalysis/gfunction/gfunction.pyx":28 + * self.drv = drv + * self.dev = pycuda.autoinit.device + * self.source = SourceModule(""" # <<<<<<<<<<<<<< + * /[inserted by cython to avoid comment start]* __device__ double atomicAdd(double* address, double val) + * { */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; + if (unlikely(!__pyx_v_SourceModule)) { __Pyx_RaiseUnboundLocalError("SourceModule"); __PYX_ERR(0, 28, __pyx_L1_error) } + __Pyx_INCREF(__pyx_v_SourceModule); + __pyx_t_6 = __pyx_v_SourceModule; __pyx_t_4 = NULL; __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_7 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else #endif { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_s_device___double_atomicAdd_dou}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 514, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - } - __pyx_L3:; - - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c - * - */ - __pyx_t_9 = 0; - if (unlikely(__pyx_v_bytesvalue == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(2, 516, __pyx_L1_error) - } - __Pyx_INCREF(__pyx_v_bytesvalue); - __pyx_t_10 = __pyx_v_bytesvalue; - __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10); - __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10)); - for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { - __pyx_t_11 = __pyx_t_14; - __pyx_v_c = (__pyx_t_11[0]); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_source, __pyx_t_5) < 0) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":517 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":102 + * } + * """) + * self._calcHistoGPU = self.source.get_function("calcHistoGPU") # <<<<<<<<<<<<<< * - * @cname('getbuffer') + * def calcHistoGPU(self,coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel, block, grid): */ - __pyx_v_i = __pyx_t_9; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_source); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_get_function); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_calcHistoGPU}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_calcHistoGPU_2, __pyx_t_5) < 0) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c + /* "newanalysis/gfunction/gfunction.pyx":25 + * self.cuda = False * + * if self.cuda: # <<<<<<<<<<<<<< + * self.drv = drv + * self.dev = pycuda.autoinit.device */ - __pyx_t_9 = (__pyx_t_9 + 1); + } - /* "View.MemoryView":517 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< - * - * @cname('getbuffer') - */ - (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "View.MemoryView":503 - * return result - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + /* "newanalysis/gfunction/gfunction.pyx":14 + * # CUDA handler interface + * class CUDA(object): + * def __init__(self): # <<<<<<<<<<<<<< + * self.cuda = True + * try: */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("newanalysis.gfunction.CUDA.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XDECREF(__pyx_v_pycuda); + __Pyx_XDECREF(__pyx_v_drv); + __Pyx_XDECREF(__pyx_v_SourceModule); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":520 +/* "newanalysis/gfunction/gfunction.pyx":104 + * self._calcHistoGPU = self.source.get_function("calcHistoGPU") + * + * def calcHistoGPU(self,coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel, block, grid): # <<<<<<<<<<<<<< + * self._calcHistoGPU(coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel,block=block,grid=grid) * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") */ /* Python wrapper */ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; +static PyObject *__pyx_pw_11newanalysis_9gfunction_4CUDA_3calcHistoGPU(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_4CUDA_3calcHistoGPU = {"calcHistoGPU", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_4CUDA_3calcHistoGPU, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_4CUDA_3calcHistoGPU(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_coor_sel1_gpu = 0; + PyObject *__pyx_v_coor_sel2_gpu = 0; + PyObject *__pyx_v_dip_sel1_gpu = 0; + PyObject *__pyx_v_dip_sel2_gpu = 0; + PyObject *__pyx_v_histo_gpu = 0; + PyObject *__pyx_v_box_dim_gpu = 0; + PyObject *__pyx_v_n1 = 0; + PyObject *__pyx_v_n2 = 0; + PyObject *__pyx_v_histo_min = 0; + PyObject *__pyx_v_histo_max = 0; + PyObject *__pyx_v_histo_n = 0; + PyObject *__pyx_v_histo_inv_dr = 0; + PyObject *__pyx_v_mode_sel = 0; + PyObject *__pyx_v_block = 0; + PyObject *__pyx_v_grid = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannySetupContext("calcHistoGPU (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 104, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_coor_sel1_gpu,&__pyx_n_s_coor_sel2_gpu,&__pyx_n_s_dip_sel1_gpu,&__pyx_n_s_dip_sel2_gpu,&__pyx_n_s_histo_gpu,&__pyx_n_s_box_dim_gpu,&__pyx_n_s_n1,&__pyx_n_s_n2,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_histo_n,&__pyx_n_s_histo_inv_dr,&__pyx_n_s_mode_sel,&__pyx_n_s_block,&__pyx_n_s_grid,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 16: values[15] = __Pyx_Arg_FASTCALL(__pyx_args, 15); + CYTHON_FALLTHROUGH; + case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); + CYTHON_FALLTHROUGH; + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); + CYTHON_FALLTHROUGH; + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); + CYTHON_FALLTHROUGH; + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + CYTHON_FALLTHROUGH; + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_sel1_gpu)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 1); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_sel2_gpu)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 2); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_sel1_gpu)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 3); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_sel2_gpu)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 4); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_gpu)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 5); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_dim_gpu)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 6); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 7); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 8); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (likely((values[9] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_min)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[9]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 9); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 10: + if (likely((values[10] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_max)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[10]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 10); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 11: + if (likely((values[11] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_n)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[11]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 11); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 12: + if (likely((values[12] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_inv_dr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[12]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 12); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 13: + if (likely((values[13] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode_sel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[13]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 13); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 14: + if (likely((values[14] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_block)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[14]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 14); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 15: + if (likely((values[15] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_grid)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[15]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, 15); __PYX_ERR(0, 104, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcHistoGPU") < 0)) __PYX_ERR(0, 104, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 16)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); + values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); + values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); + values[15] = __Pyx_Arg_FASTCALL(__pyx_args, 15); + } + __pyx_v_self = values[0]; + __pyx_v_coor_sel1_gpu = values[1]; + __pyx_v_coor_sel2_gpu = values[2]; + __pyx_v_dip_sel1_gpu = values[3]; + __pyx_v_dip_sel2_gpu = values[4]; + __pyx_v_histo_gpu = values[5]; + __pyx_v_box_dim_gpu = values[6]; + __pyx_v_n1 = values[7]; + __pyx_v_n2 = values[8]; + __pyx_v_histo_min = values[9]; + __pyx_v_histo_max = values[10]; + __pyx_v_histo_n = values[11]; + __pyx_v_histo_inv_dr = values[12]; + __pyx_v_mode_sel = values[13]; + __pyx_v_block = values[14]; + __pyx_v_grid = values[15]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcHistoGPU", 1, 16, 16, __pyx_nargs); __PYX_ERR(0, 104, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.CUDA.calcHistoGPU", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_4CUDA_2calcHistoGPU(__pyx_self, __pyx_v_self, __pyx_v_coor_sel1_gpu, __pyx_v_coor_sel2_gpu, __pyx_v_dip_sel1_gpu, __pyx_v_dip_sel2_gpu, __pyx_v_histo_gpu, __pyx_v_box_dim_gpu, __pyx_v_n1, __pyx_v_n2, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_n, __pyx_v_histo_inv_dr, __pyx_v_mode_sel, __pyx_v_block, __pyx_v_grid); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; +static PyObject *__pyx_pf_11newanalysis_9gfunction_4CUDA_2calcHistoGPU(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_coor_sel1_gpu, PyObject *__pyx_v_coor_sel2_gpu, PyObject *__pyx_v_dip_sel1_gpu, PyObject *__pyx_v_dip_sel2_gpu, PyObject *__pyx_v_histo_gpu, PyObject *__pyx_v_box_dim_gpu, PyObject *__pyx_v_n1, PyObject *__pyx_v_n2, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_n, PyObject *__pyx_v_histo_inv_dr, PyObject *__pyx_v_mode_sel, PyObject *__pyx_v_block, PyObject *__pyx_v_grid) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - char *__pyx_t_5; - void *__pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * - */ - __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_self->view.readonly != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< - * - * if flags & PyBUF_ND: - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 522, __pyx_L1_error) - - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * - */ - } + __Pyx_RefNannySetupContext("calcHistoGPU", 0); - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "newanalysis/gfunction/gfunction.pyx":105 * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":525 + * def calcHistoGPU(self,coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel, block, grid): + * self._calcHistoGPU(coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel,block=block,grid=grid) # <<<<<<<<<<<<<< * - * if flags & PyBUF_ND: - * info.shape = self.view.shape # <<<<<<<<<<<<<< - * else: - * info.shape = NULL + * cu=CUDA() */ - __pyx_t_4 = __pyx_v_self->view.shape; - __pyx_v_info->shape = __pyx_t_4; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_calcHistoGPU_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_coor_sel1_gpu); + __Pyx_GIVEREF(__pyx_v_coor_sel1_gpu); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_coor_sel1_gpu)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_coor_sel2_gpu); + __Pyx_GIVEREF(__pyx_v_coor_sel2_gpu); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_coor_sel2_gpu)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_dip_sel1_gpu); + __Pyx_GIVEREF(__pyx_v_dip_sel1_gpu); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_dip_sel1_gpu)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_dip_sel2_gpu); + __Pyx_GIVEREF(__pyx_v_dip_sel2_gpu); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_dip_sel2_gpu)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_histo_gpu); + __Pyx_GIVEREF(__pyx_v_histo_gpu); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_histo_gpu)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_box_dim_gpu); + __Pyx_GIVEREF(__pyx_v_box_dim_gpu); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_v_box_dim_gpu)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_n1); + __Pyx_GIVEREF(__pyx_v_n1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_v_n1)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_n2); + __Pyx_GIVEREF(__pyx_v_n2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 7, __pyx_v_n2)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_histo_min); + __Pyx_GIVEREF(__pyx_v_histo_min); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 8, __pyx_v_histo_min)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_histo_max); + __Pyx_GIVEREF(__pyx_v_histo_max); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 9, __pyx_v_histo_max)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_histo_n); + __Pyx_GIVEREF(__pyx_v_histo_n); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 10, __pyx_v_histo_n)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_histo_inv_dr); + __Pyx_GIVEREF(__pyx_v_histo_inv_dr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 11, __pyx_v_histo_inv_dr)) __PYX_ERR(0, 105, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode_sel); + __Pyx_GIVEREF(__pyx_v_mode_sel); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 12, __pyx_v_mode_sel)) __PYX_ERR(0, 105, __pyx_L1_error); + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_block, __pyx_v_block) < 0) __PYX_ERR(0, 105, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_grid, __pyx_v_grid) < 0) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "newanalysis/gfunction/gfunction.pyx":104 + * self._calcHistoGPU = self.source.get_function("calcHistoGPU") * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: - */ - goto __pyx_L6; - } - - /* "View.MemoryView":527 - * info.shape = self.view.shape - * else: - * info.shape = NULL # <<<<<<<<<<<<<< + * def calcHistoGPU(self,coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel, block, grid): # <<<<<<<<<<<<<< + * self._calcHistoGPU(coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel,block=block,grid=grid) * - * if flags & PyBUF_STRIDES: */ - /*else*/ { - __pyx_v_info->shape = NULL; - } - __pyx_L6:; - /* "View.MemoryView":529 - * info.shape = NULL - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("newanalysis.gfunction.CUDA.calcHistoGPU", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":530 +/* "newanalysis/gfunction/gfunction.pyx":110 * - * if flags & PyBUF_STRIDES: - * info.strides = self.view.strides # <<<<<<<<<<<<<< - * else: - * info.strides = NULL + * # CPU version + * cdef void calcHisto(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, + * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel): */ - __pyx_t_4 = __pyx_v_self->view.strides; - __pyx_v_info->strides = __pyx_t_4; - /* "View.MemoryView":529 - * info.shape = NULL - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: - */ - goto __pyx_L7; +static void __pyx_f_11newanalysis_9gfunction_calcHisto(double *__pyx_v_core_xyz, double *__pyx_v_surr_xyz, double *__pyx_v_core_dip, double *__pyx_v_surr_dip, PyArrayObject *__pyx_v_np_dest, PyArrayObject *__pyx_v_np_box_dim, int __pyx_v_ncore, int __pyx_v_nsurround, float __pyx_v_histo_min, float __pyx_v_histo_max, int __pyx_v_histo_n, double __pyx_v_invdx, int __pyx_v_mode_sel) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_pos; + int __pyx_v_ix1; + int __pyx_v_ix2; + int __pyx_v_j_begin; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_dist; + double __pyx_v_cpx; + double __pyx_v_cpy; + double __pyx_v_cpz; + double __pyx_v_spx; + double __pyx_v_spy; + double __pyx_v_spz; + double __pyx_v_slen; + double __pyx_v_clen; + double __pyx_v_incr; + double __pyx_v_off_diag; + double *__pyx_v_dest; + double *__pyx_v_box_dim; + __Pyx_LocalBuf_ND __pyx_pybuffernd_np_box_dim; + __Pyx_Buffer __pyx_pybuffer_np_box_dim; + __Pyx_LocalBuf_ND __pyx_pybuffernd_np_dest; + __Pyx_Buffer __pyx_pybuffer_np_dest; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + double __pyx_t_11; + double __pyx_t_12; + long __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcHisto", 0); + __pyx_pybuffer_np_dest.pybuffer.buf = NULL; + __pyx_pybuffer_np_dest.refcount = 0; + __pyx_pybuffernd_np_dest.data = NULL; + __pyx_pybuffernd_np_dest.rcbuffer = &__pyx_pybuffer_np_dest; + __pyx_pybuffer_np_box_dim.pybuffer.buf = NULL; + __pyx_pybuffer_np_box_dim.refcount = 0; + __pyx_pybuffernd_np_box_dim.data = NULL; + __pyx_pybuffernd_np_box_dim.rcbuffer = &__pyx_pybuffer_np_box_dim; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_dest, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 110, __pyx_L1_error) } - - /* "View.MemoryView":532 - * info.strides = self.view.strides - * else: - * info.strides = NULL # <<<<<<<<<<<<<< - * - * if flags & PyBUF_INDIRECT: - */ - /*else*/ { - __pyx_v_info->strides = NULL; + __pyx_pybuffernd_np_dest.diminfo[0].strides = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_dest.diminfo[0].shape = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_box_dim, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 110, __pyx_L1_error) } - __pyx_L7:; - - /* "View.MemoryView":534 - * info.strides = NULL - * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":535 - * - * if flags & PyBUF_INDIRECT: - * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< - * else: - * info.suboffsets = NULL - */ - __pyx_t_4 = __pyx_v_self->view.suboffsets; - __pyx_v_info->suboffsets = __pyx_t_4; + __pyx_pybuffernd_np_box_dim.diminfo[0].strides = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_box_dim.diminfo[0].shape = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.shape[0]; - /* "View.MemoryView":534 - * info.strides = NULL + /* "newanalysis/gfunction/gfunction.pyx":114 + * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel): * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: + * cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 + * cdef double *dest = np_dest.data */ - goto __pyx_L8; - } + __pyx_v_ix1 = (__pyx_v_ncore * __pyx_v_histo_n); + __pyx_v_j_begin = 0; - /* "View.MemoryView":537 - * info.suboffsets = self.view.suboffsets - * else: - * info.suboffsets = NULL # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":115 * - * if flags & PyBUF_FORMAT: + * cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 # <<<<<<<<<<<<<< + * cdef double *dest = np_dest.data + * cdef double *box_dim = np_box_dim.data */ - /*else*/ { - __pyx_v_info->suboffsets = NULL; - } - __pyx_L8:; + __pyx_v_off_diag = 1.0; - /* "View.MemoryView":539 - * info.suboffsets = NULL + /* "newanalysis/gfunction/gfunction.pyx":116 + * cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 + * cdef double *dest = np_dest.data # <<<<<<<<<<<<<< + * cdef double *box_dim = np_box_dim.data * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_np_dest)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_v_dest = ((double *)__pyx_t_1); - /* "View.MemoryView":540 + /* "newanalysis/gfunction/gfunction.pyx":117 + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 + * cdef double *dest = np_dest.data + * cdef double *box_dim = np_box_dim.data # <<<<<<<<<<<<<< * - * if flags & PyBUF_FORMAT: - * info.format = self.view.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL + * for i in prange(ncore, nogil=True): */ - __pyx_t_5 = __pyx_v_self->view.format; - __pyx_v_info->format = __pyx_t_5; + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_np_box_dim)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_v_box_dim = ((double *)__pyx_t_1); - /* "View.MemoryView":539 - * info.suboffsets = NULL + /* "newanalysis/gfunction/gfunction.pyx":119 + * cdef double *box_dim = np_box_dim.data * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: + * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< + * ix2=i*histo_n + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: */ - goto __pyx_L9; - } - - /* "View.MemoryView":542 - * info.format = self.view.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< - * - * info.buf = self.view.buf - */ - /*else*/ { - __pyx_v_info->format = NULL; - } - __pyx_L9:; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_2 = __pyx_v_ncore; + { + double __pyx_parallel_temp0 = ((double)__PYX_NAN()); + double __pyx_parallel_temp1 = ((double)__PYX_NAN()); + double __pyx_parallel_temp2 = ((double)__PYX_NAN()); + double __pyx_parallel_temp3 = ((double)__PYX_NAN()); + double __pyx_parallel_temp4 = ((double)__PYX_NAN()); + double __pyx_parallel_temp5 = ((double)__PYX_NAN()); + double __pyx_parallel_temp6 = ((double)__PYX_NAN()); + double __pyx_parallel_temp7 = ((double)__PYX_NAN()); + int __pyx_parallel_temp8 = ((int)0xbad0bad0); + double __pyx_parallel_temp9 = ((double)__PYX_NAN()); + int __pyx_parallel_temp10 = ((int)0xbad0bad0); + int __pyx_parallel_temp11 = ((int)0xbad0bad0); + int __pyx_parallel_temp12 = ((int)0xbad0bad0); + double __pyx_parallel_temp13 = ((double)__PYX_NAN()); + int __pyx_parallel_temp14 = ((int)0xbad0bad0); + double __pyx_parallel_temp15 = ((double)__PYX_NAN()); + double __pyx_parallel_temp16 = ((double)__PYX_NAN()); + double __pyx_parallel_temp17 = ((double)__PYX_NAN()); + double __pyx_parallel_temp18 = ((double)__PYX_NAN()); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_4 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_4 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_clen) lastprivate(__pyx_v_cpx) lastprivate(__pyx_v_cpy) lastprivate(__pyx_v_cpz) lastprivate(__pyx_v_dist) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_incr) lastprivate(__pyx_v_ix2) lastprivate(__pyx_v_j) lastprivate(__pyx_v_j_begin) lastprivate(__pyx_v_off_diag) lastprivate(__pyx_v_pos) lastprivate(__pyx_v_slen) lastprivate(__pyx_v_spx) lastprivate(__pyx_v_spy) lastprivate(__pyx_v_spz) + #endif /* _OPENMP */ + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_3); + /* Initialize private variables to invalid values */ + __pyx_v_clen = ((double)__PYX_NAN()); + __pyx_v_cpx = ((double)__PYX_NAN()); + __pyx_v_cpy = ((double)__PYX_NAN()); + __pyx_v_cpz = ((double)__PYX_NAN()); + __pyx_v_dist = ((double)__PYX_NAN()); + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_incr = ((double)__PYX_NAN()); + __pyx_v_ix2 = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_j_begin = ((int)0xbad0bad0); + __pyx_v_off_diag = ((double)__PYX_NAN()); + __pyx_v_pos = ((int)0xbad0bad0); + __pyx_v_slen = ((double)__PYX_NAN()); + __pyx_v_spx = ((double)__PYX_NAN()); + __pyx_v_spy = ((double)__PYX_NAN()); + __pyx_v_spz = ((double)__PYX_NAN()); - /* "View.MemoryView":544 - * info.format = NULL + /* "newanalysis/gfunction/gfunction.pyx":120 * - * info.buf = self.view.buf # <<<<<<<<<<<<<< - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize + * for i in prange(ncore, nogil=True): + * ix2=i*histo_n # <<<<<<<<<<<<<< + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * cpx = core_dip[i*3] */ - __pyx_t_6 = __pyx_v_self->view.buf; - __pyx_v_info->buf = __pyx_t_6; + __pyx_v_ix2 = (__pyx_v_i * __pyx_v_histo_n); - /* "View.MemoryView":545 - * - * info.buf = self.view.buf - * info.ndim = self.view.ndim # <<<<<<<<<<<<<< - * info.itemsize = self.view.itemsize - * info.len = self.view.len + /* "newanalysis/gfunction/gfunction.pyx":121 + * for i in prange(ncore, nogil=True): + * ix2=i*histo_n + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] */ - __pyx_t_7 = __pyx_v_self->view.ndim; - __pyx_v_info->ndim = __pyx_t_7; + __pyx_t_6 = ((__pyx_v_mode_sel & 2) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 4) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 16) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 32) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L11_bool_binop_done:; + if (__pyx_t_5) { - /* "View.MemoryView":546 - * info.buf = self.view.buf - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< - * info.len = self.view.len - * info.readonly = self.view.readonly + /* "newanalysis/gfunction/gfunction.pyx":122 + * ix2=i*histo_n + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * cpx = core_dip[i*3] # <<<<<<<<<<<<<< + * cpy = core_dip[i*3+1] + * cpz = core_dip[i*3+2] */ - __pyx_t_8 = __pyx_v_self->view.itemsize; - __pyx_v_info->itemsize = __pyx_t_8; + __pyx_v_cpx = (__pyx_v_core_dip[(__pyx_v_i * 3)]); - /* "View.MemoryView":547 - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - * info.len = self.view.len # <<<<<<<<<<<<<< - * info.readonly = self.view.readonly - * info.obj = self + /* "newanalysis/gfunction/gfunction.pyx":123 + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] # <<<<<<<<<<<<<< + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) */ - __pyx_t_8 = __pyx_v_self->view.len; - __pyx_v_info->len = __pyx_t_8; + __pyx_v_cpy = (__pyx_v_core_dip[((__pyx_v_i * 3) + 1)]); - /* "View.MemoryView":548 - * info.itemsize = self.view.itemsize - * info.len = self.view.len - * info.readonly = self.view.readonly # <<<<<<<<<<<<<< - * info.obj = self - * + /* "newanalysis/gfunction/gfunction.pyx":124 + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] + * cpz = core_dip[i*3+2] # <<<<<<<<<<<<<< + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: */ - __pyx_t_1 = __pyx_v_self->view.readonly; - __pyx_v_info->readonly = __pyx_t_1; + __pyx_v_cpz = (__pyx_v_core_dip[((__pyx_v_i * 3) + 2)]); - /* "View.MemoryView":549 - * info.len = self.view.len - * info.readonly = self.view.readonly - * info.obj = self # <<<<<<<<<<<<<< - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") + /* "newanalysis/gfunction/gfunction.pyx":125 + * cpy = core_dip[i*3+1] + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) # <<<<<<<<<<<<<< + * if ncore == nsurround: + * j_begin = i */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + __pyx_v_clen = sqrt((((__pyx_v_cpx * __pyx_v_cpx) + (__pyx_v_cpy * __pyx_v_cpy)) + (__pyx_v_cpz * __pyx_v_cpz))); - /* "View.MemoryView":520 - * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "newanalysis/gfunction/gfunction.pyx":121 + * for i in prange(ncore, nogil=True): + * ix2=i*histo_n + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] */ + } - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":555 - * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) + /* "newanalysis/gfunction/gfunction.pyx":126 + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: # <<<<<<<<<<<<<< + * j_begin = i + * else: */ + __pyx_t_5 = (__pyx_v_ncore == __pyx_v_nsurround); + if (__pyx_t_5) { -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/gfunction/gfunction.pyx":127 + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: + * j_begin = i # <<<<<<<<<<<<<< + * else: + * j_begin = 0 + */ + __pyx_v_j_begin = __pyx_v_i; - /* "View.MemoryView":556 - * @property - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< - * transpose_memslice(&result.from_slice) - * return result + /* "newanalysis/gfunction/gfunction.pyx":126 + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: # <<<<<<<<<<<<<< + * j_begin = i + * else: */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 556, __pyx_L1_error) - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); - __pyx_t_1 = 0; + goto __pyx_L15; + } - /* "View.MemoryView":557 - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< - * return result - * + /* "newanalysis/gfunction/gfunction.pyx":129 + * j_begin = i + * else: + * j_begin = 0 # <<<<<<<<<<<<<< + * for j in range(j_begin,nsurround): + * if ncore == nsurround and i != j: */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 557, __pyx_L1_error) + /*else*/ { + __pyx_v_j_begin = 0; + } + __pyx_L15:; - /* "View.MemoryView":558 - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - * return result # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/gfunction/gfunction.pyx":130 + * else: + * j_begin = 0 + * for j in range(j_begin,nsurround): # <<<<<<<<<<<<<< + * if ncore == nsurround and i != j: + * off_diag = 2.0 */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + __pyx_t_7 = __pyx_v_nsurround; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = __pyx_v_j_begin; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_j = __pyx_t_9; - /* "View.MemoryView":555 - * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) + /* "newanalysis/gfunction/gfunction.pyx":131 + * j_begin = 0 + * for j in range(j_begin,nsurround): + * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< + * off_diag = 2.0 + * else: */ + __pyx_t_6 = (__pyx_v_ncore == __pyx_v_nsurround); + if (__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L19_bool_binop_done; + } + __pyx_t_6 = (__pyx_v_i != __pyx_v_j); + __pyx_t_5 = __pyx_t_6; + __pyx_L19_bool_binop_done:; + if (__pyx_t_5) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":132 + * for j in range(j_begin,nsurround): + * if ncore == nsurround and i != j: + * off_diag = 2.0 # <<<<<<<<<<<<<< + * else: + * off_diag = 1.0 + */ + __pyx_v_off_diag = 2.0; -/* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj - * + /* "newanalysis/gfunction/gfunction.pyx":131 + * j_begin = 0 + * for j in range(j_begin,nsurround): + * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< + * off_diag = 2.0 + * else: */ + goto __pyx_L18; + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "newanalysis/gfunction/gfunction.pyx":134 + * off_diag = 2.0 + * else: + * off_diag = 1.0 # <<<<<<<<<<<<<< + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: + * spx = surr_dip[j*3] + */ + /*else*/ { + __pyx_v_off_diag = 1.0; + } + __pyx_L18:; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":135 + * else: + * off_diag = 1.0 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] + */ + __pyx_t_6 = ((__pyx_v_mode_sel & 2) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L22_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 8) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L22_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 16) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L22_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 64) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L22_bool_binop_done:; + if (__pyx_t_5) { -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/gfunction/gfunction.pyx":136 + * off_diag = 1.0 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: + * spx = surr_dip[j*3] # <<<<<<<<<<<<<< + * spy = surr_dip[j*3+1] + * spz = surr_dip[j*3+2] + */ + __pyx_v_spx = (__pyx_v_surr_dip[(__pyx_v_j * 3)]); - /* "View.MemoryView":562 - * @property - * def base(self): - * return self.obj # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/gfunction/gfunction.pyx":137 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] # <<<<<<<<<<<<<< + * spz = surr_dip[j*3+2] + * slen = sqrt(spx*spx+spy*spy+spz*spz) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->obj); - __pyx_r = __pyx_v_self->obj; - goto __pyx_L0; + __pyx_v_spy = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 1)]); - /* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj + /* "newanalysis/gfunction/gfunction.pyx":138 + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] + * spz = surr_dip[j*3+2] # <<<<<<<<<<<<<< + * slen = sqrt(spx*spx+spy*spy+spz*spz) * */ + __pyx_v_spz = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 2)]); - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":565 - * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) + /* "newanalysis/gfunction/gfunction.pyx":139 + * spy = surr_dip[j*3+1] + * spz = surr_dip[j*3+2] + * slen = sqrt(spx*spx+spy*spy+spz*spz) # <<<<<<<<<<<<<< * + * dx = surr_xyz[j*3] - core_xyz[i*3] */ + __pyx_v_slen = sqrt((((__pyx_v_spx * __pyx_v_spx) + (__pyx_v_spy * __pyx_v_spy)) + (__pyx_v_spz * __pyx_v_spz))); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_length; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/gfunction/gfunction.pyx":135 + * else: + * off_diag = 1.0 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] + */ + } - /* "View.MemoryView":566 - * @property - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":141 + * slen = sqrt(spx*spx+spy*spy+spz*spz) * - * @property + * dx = surr_xyz[j*3] - core_xyz[i*3] # <<<<<<<<<<<<<< + * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_length = (__pyx_t_2[0]); - __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __pyx_v_dx = ((__pyx_v_surr_xyz[(__pyx_v_j * 3)]) - (__pyx_v_core_xyz[(__pyx_v_i * 3)])); - /* "View.MemoryView":565 + /* "newanalysis/gfunction/gfunction.pyx":142 * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * dx = surr_xyz[j*3] - core_xyz[i*3] + * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] # <<<<<<<<<<<<<< + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] * */ + __pyx_v_dy = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 1)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 1)])); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":143 + * dx = surr_xyz[j*3] - core_xyz[i*3] + * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] # <<<<<<<<<<<<<< + * + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] + */ + __pyx_v_dz = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 2)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 2)])); -/* "View.MemoryView":569 + /* "newanalysis/gfunction/gfunction.pyx":145 + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] # <<<<<<<<<<<<<< + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + */ + __pyx_t_5 = (fabs(__pyx_v_dx) > (__pyx_v_box_dim[3])); + if (__pyx_t_5) { + __pyx_v_dx = (__pyx_v_dx - (((0.0 < __pyx_v_dx) - (__pyx_v_dx < 0.0)) * (__pyx_v_box_dim[0]))); + } + + /* "newanalysis/gfunction/gfunction.pyx":146 * + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] # <<<<<<<<<<<<<< + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + * dist = sqrt(dx*dx+dy*dy+dz*dz) */ + __pyx_t_5 = (fabs(__pyx_v_dy) > (__pyx_v_box_dim[4])); + if (__pyx_t_5) { + __pyx_v_dy = (__pyx_v_dy - (((0.0 < __pyx_v_dy) - (__pyx_v_dy < 0.0)) * (__pyx_v_box_dim[1]))); + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "newanalysis/gfunction/gfunction.pyx":147 + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] # <<<<<<<<<<<<<< + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue + */ + __pyx_t_5 = (fabs(__pyx_v_dz) > (__pyx_v_box_dim[5])); + if (__pyx_t_5) { + __pyx_v_dz = (__pyx_v_dz - (((0.0 < __pyx_v_dz) - (__pyx_v_dz < 0.0)) * (__pyx_v_box_dim[2]))); + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":148 + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + * dist = sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< + * if disthisto_max or floor(dist*invdx)==0: continue + * pos = floor((dist-histo_min)*invdx) + */ + __pyx_v_dist = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_stride; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/gfunction/gfunction.pyx":149 + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue # <<<<<<<<<<<<<< + * pos = floor((dist-histo_min)*invdx) + * + */ + __pyx_t_6 = (__pyx_v_dist < __pyx_v_histo_min); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L30_bool_binop_done; + } + __pyx_t_6 = (__pyx_v_dist > __pyx_v_histo_max); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L30_bool_binop_done; + } + __pyx_t_6 = (floor((__pyx_v_dist * __pyx_v_invdx)) == 0.0); + __pyx_t_5 = __pyx_t_6; + __pyx_L30_bool_binop_done:; + if (__pyx_t_5) { + goto __pyx_L16_continue; + } - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":150 + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue + * pos = floor((dist-histo_min)*invdx) # <<<<<<<<<<<<<< * - * raise ValueError("Buffer view does not expose strides") + * if mode_sel & 1: dest[ix2+pos]+=1.0*off_diag */ - __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_v_pos = ((int)floor(((__pyx_v_dist - __pyx_v_histo_min) * __pyx_v_invdx))); - /* "View.MemoryView":572 - * if self.view.strides == NULL: + /* "newanalysis/gfunction/gfunction.pyx":152 + * pos = floor((dist-histo_min)*invdx) * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< + * if mode_sel & 1: dest[ix2+pos]+=1.0*off_diag # <<<<<<<<<<<<<< * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * if mode_sel & 2 or mode_sel & 16: */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_t_5 = ((__pyx_v_mode_sel & 1) != 0); + if (__pyx_t_5) { + __pyx_t_10 = (__pyx_v_ix2 + __pyx_v_pos); + (__pyx_v_dest[__pyx_t_10]) = ((__pyx_v_dest[__pyx_t_10]) + (1.0 * __pyx_v_off_diag)); + } - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":154 + * if mode_sel & 1: dest[ix2+pos]+=1.0*off_diag * - * raise ValueError("Buffer view does not expose strides") + * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag */ - } + __pyx_t_6 = ((__pyx_v_mode_sel & 2) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L35_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 16) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L35_bool_binop_done:; + if (__pyx_t_5) { - /* "View.MemoryView":574 - * raise ValueError("Buffer view does not expose strides") - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":155 * - * @property + * if mode_sel & 2 or mode_sel & 16: + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) # <<<<<<<<<<<<<< + * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_v_stride = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; + __pyx_t_11 = (((__pyx_v_cpx * __pyx_v_spx) + (__pyx_v_cpy * __pyx_v_spy)) + (__pyx_v_cpz * __pyx_v_spz)); + __pyx_t_12 = (__pyx_v_clen * __pyx_v_slen); + if (unlikely(__pyx_t_12 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 155, __pyx_L8_error) + } + __pyx_v_incr = (__pyx_t_11 / __pyx_t_12); - /* "View.MemoryView":569 - * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: - * + /* "newanalysis/gfunction/gfunction.pyx":156 + * if mode_sel & 2 or mode_sel & 16: + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: */ + __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); + if (__pyx_t_5) { + __pyx_t_10 = ((__pyx_v_ix1 + __pyx_v_ix2) + __pyx_v_pos); + (__pyx_v_dest[__pyx_t_10]) = ((__pyx_v_dest[__pyx_t_10]) + (__pyx_v_incr * __pyx_v_off_diag)); + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":157 + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 4 or mode_sel & 32: + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + */ + __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); + if (__pyx_t_5) { + __pyx_t_13 = (((4 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_pos); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); + } -/* "View.MemoryView":577 + /* "newanalysis/gfunction/gfunction.pyx":154 + * if mode_sel & 1: dest[ix2+pos]+=1.0*off_diag * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag */ + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "newanalysis/gfunction/gfunction.pyx":158 + * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag + */ + __pyx_t_6 = ((__pyx_v_mode_sel & 4) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L40_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 32) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L40_bool_binop_done:; + if (__pyx_t_5) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":159 + * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) # <<<<<<<<<<<<<< + * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + */ + __pyx_t_12 = (((__pyx_v_cpx * __pyx_v_dx) + (__pyx_v_cpy * __pyx_v_dy)) + (__pyx_v_cpz * __pyx_v_dz)); + __pyx_t_11 = (__pyx_v_clen * __pyx_v_dist); + if (unlikely(__pyx_t_11 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 159, __pyx_L8_error) + } + __pyx_v_incr = (__pyx_t_12 / __pyx_t_11); -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - Py_ssize_t *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/gfunction/gfunction.pyx":160 + * if mode_sel & 4 or mode_sel & 32: + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: + */ + __pyx_t_5 = ((__pyx_v_mode_sel & 4) != 0); + if (__pyx_t_5) { + __pyx_t_13 = (((2 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_pos); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + (__pyx_v_incr * __pyx_v_off_diag)); + } - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim - * + /* "newanalysis/gfunction/gfunction.pyx":161 + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 8 or mode_sel & 64: + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) */ - __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); - if (__pyx_t_1) { + __pyx_t_5 = ((__pyx_v_mode_sel & 32) != 0); + if (__pyx_t_5) { + __pyx_t_13 = (((5 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_pos); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); + } - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + /* "newanalysis/gfunction/gfunction.pyx":158 + * if mode_sel & 2: dest[ix1+ix2+pos]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__21, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + } - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim - * + /* "newanalysis/gfunction/gfunction.pyx":162 + * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+pos]+=incr*off_diag */ - } + __pyx_t_6 = ((__pyx_v_mode_sel & 8) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L45_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 64) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L45_bool_binop_done:; + if (__pyx_t_5) { - /* "View.MemoryView":581 - * return (-1,) * self.view.ndim - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/gfunction/gfunction.pyx":163 + * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) # <<<<<<<<<<<<<< + * if mode_sel & 8: dest[3*ix1+ix2+pos]+=incr*off_diag + * if mode_sel & 64: dest[6*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); - for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) { - __pyx_t_4 = __pyx_t_6; - __pyx_v_suboffset = (__pyx_t_4[0]); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_11 = (((__pyx_v_spx * __pyx_v_dx) + (__pyx_v_spy * __pyx_v_dy)) + (__pyx_v_spz * __pyx_v_dz)); + __pyx_t_12 = (__pyx_v_slen * __pyx_v_dist); + if (unlikely(__pyx_t_12 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 163, __pyx_L8_error) + } + __pyx_v_incr = (__pyx_t_11 / __pyx_t_12); - /* "View.MemoryView":577 + /* "newanalysis/gfunction/gfunction.pyx":164 + * if mode_sel & 8 or mode_sel & 64: + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+pos]+=incr*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 64: dest[6*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim */ + __pyx_t_5 = ((__pyx_v_mode_sel & 8) != 0); + if (__pyx_t_5) { + __pyx_t_13 = (((3 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_pos); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + (__pyx_v_incr * __pyx_v_off_diag)); + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":584 - * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim + /* "newanalysis/gfunction/gfunction.pyx":165 + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+pos]+=incr*off_diag + * if mode_sel & 64: dest[6*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< * + * # RDF time series */ + __pyx_t_5 = ((__pyx_v_mode_sel & 64) != 0); + if (__pyx_t_5) { + __pyx_t_13 = (((6 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_pos); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; + /* "newanalysis/gfunction/gfunction.pyx":162 + * if mode_sel & 4: dest[2*ix1+ix2+pos]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+pos]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+pos]+=incr*off_diag + */ + } + __pyx_L16_continue:; + } + goto __pyx_L50; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L49; + __pyx_L49:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates0) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_clen; + __pyx_parallel_temp1 = __pyx_v_cpx; + __pyx_parallel_temp2 = __pyx_v_cpy; + __pyx_parallel_temp3 = __pyx_v_cpz; + __pyx_parallel_temp4 = __pyx_v_dist; + __pyx_parallel_temp5 = __pyx_v_dx; + __pyx_parallel_temp6 = __pyx_v_dy; + __pyx_parallel_temp7 = __pyx_v_dz; + __pyx_parallel_temp8 = __pyx_v_i; + __pyx_parallel_temp9 = __pyx_v_incr; + __pyx_parallel_temp10 = __pyx_v_ix2; + __pyx_parallel_temp11 = __pyx_v_j; + __pyx_parallel_temp12 = __pyx_v_j_begin; + __pyx_parallel_temp13 = __pyx_v_off_diag; + __pyx_parallel_temp14 = __pyx_v_pos; + __pyx_parallel_temp15 = __pyx_v_slen; + __pyx_parallel_temp16 = __pyx_v_spx; + __pyx_parallel_temp17 = __pyx_v_spy; + __pyx_parallel_temp18 = __pyx_v_spz; + } + __pyx_L50:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP } +#endif /* _OPENMP */ + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_clen = __pyx_parallel_temp0; + __pyx_v_cpx = __pyx_parallel_temp1; + __pyx_v_cpy = __pyx_parallel_temp2; + __pyx_v_cpz = __pyx_parallel_temp3; + __pyx_v_dist = __pyx_parallel_temp4; + __pyx_v_dx = __pyx_parallel_temp5; + __pyx_v_dy = __pyx_parallel_temp6; + __pyx_v_dz = __pyx_parallel_temp7; + __pyx_v_i = __pyx_parallel_temp8; + __pyx_v_incr = __pyx_parallel_temp9; + __pyx_v_ix2 = __pyx_parallel_temp10; + __pyx_v_j = __pyx_parallel_temp11; + __pyx_v_j_begin = __pyx_parallel_temp12; + __pyx_v_off_diag = __pyx_parallel_temp13; + __pyx_v_pos = __pyx_parallel_temp14; + __pyx_v_slen = __pyx_parallel_temp15; + __pyx_v_spx = __pyx_parallel_temp16; + __pyx_v_spy = __pyx_parallel_temp17; + __pyx_v_spz = __pyx_parallel_temp18; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":585 - * @property - * def ndim(self): - * return self.view.ndim # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":119 + * cdef double *box_dim = np_box_dim.data * - * @property + * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< + * ix2=i*histo_n + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 585, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; + } + } - /* "View.MemoryView":584 - * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim + /* "newanalysis/gfunction/gfunction.pyx":110 * + * # CPU version + * cdef void calcHisto(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, + * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel): */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.gfunction.calcHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + goto __pyx_L2; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); + __pyx_L2:; __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":588 - * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize +/* "newanalysis/gfunction/gfunction.pyx":168 * + * # RDF time series + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcHistoTS(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:] result, + * double boxl, int t, float histo_min, float histo_max, double invdx): */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_11newanalysis_9gfunction_1calcHistoTS(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_1calcHistoTS = {"calcHistoTS", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_1calcHistoTS, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_1calcHistoTS(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_core_xyz = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_surr_xyz = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxl; + int __pyx_v_t; + float __pyx_v_histo_min; + float __pyx_v_histo_max; + double __pyx_v_invdx; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("calcHistoTS (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 168, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_core_xyz,&__pyx_n_s_surr_xyz,&__pyx_n_s_result,&__pyx_n_s_boxl,&__pyx_n_s_t,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_invdx,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_core_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_surr_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 1); __PYX_ERR(0, 168, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 2); __PYX_ERR(0, 168, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 3); __PYX_ERR(0, 168, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_t)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 4); __PYX_ERR(0, 168, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_min)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 5); __PYX_ERR(0, 168, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_max)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 6); __PYX_ERR(0, 168, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_invdx)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, 7); __PYX_ERR(0, 168, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcHistoTS") < 0)) __PYX_ERR(0, 168, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 8)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + } + __pyx_v_core_xyz = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_core_xyz.memview)) __PYX_ERR(0, 169, __pyx_L3_error) + __pyx_v_surr_xyz = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_surr_xyz.memview)) __PYX_ERR(0, 169, __pyx_L3_error) + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 169, __pyx_L3_error) + __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) + __pyx_v_t = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_t == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) + __pyx_v_histo_min = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_histo_min == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) + __pyx_v_histo_max = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_histo_max == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) + __pyx_v_invdx = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_invdx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcHistoTS", 1, 8, 8, __pyx_nargs); __PYX_ERR(0, 168, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_core_xyz, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_surr_xyz, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __Pyx_AddTraceback("newanalysis.gfunction.calcHistoTS", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_calcHistoTS(__pyx_self, __pyx_v_core_xyz, __pyx_v_surr_xyz, __pyx_v_result, __pyx_v_boxl, __pyx_v_t, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_invdx); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_core_xyz, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_surr_xyz, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { +static PyObject *__pyx_pf_11newanalysis_9gfunction_calcHistoTS(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_core_xyz, __Pyx_memviewslice __pyx_v_surr_xyz, __Pyx_memviewslice __pyx_v_result, double __pyx_v_boxl, int __pyx_v_t, float __pyx_v_histo_min, float __pyx_v_histo_max, double __pyx_v_invdx) { + CYTHON_UNUSED int __pyx_v_ncore; + int __pyx_v_nsurr; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_pos; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_dist; + double __pyx_v_boxl2; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + __Pyx_RefNannySetupContext("calcHistoTS", 0); - /* "View.MemoryView":589 - * @property - * def itemsize(self): - * return self.view.itemsize # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":172 + * double boxl, int t, float histo_min, float histo_max, double invdx): * - * @property + * cdef int ncore = core_xyz.shape[0] # <<<<<<<<<<<<<< + * cdef int nsurr = surr_xyz.shape[0] + * cdef int i, j, pos */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_ncore = (__pyx_v_core_xyz.shape[0]); - /* "View.MemoryView":588 - * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize + /* "newanalysis/gfunction/gfunction.pyx":173 * + * cdef int ncore = core_xyz.shape[0] + * cdef int nsurr = surr_xyz.shape[0] # <<<<<<<<<<<<<< + * cdef int i, j, pos + * cdef double dx, dy, dz, dist */ + __pyx_v_nsurr = (__pyx_v_surr_xyz.shape[0]); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":592 - * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize + /* "newanalysis/gfunction/gfunction.pyx":176 + * cdef int i, j, pos + * cdef double dx, dy, dz, dist + * cdef double boxl2 = boxl / 2.0 # <<<<<<<<<<<<<< * + * for i in prange(ncore, nogil=True): */ + __pyx_v_boxl2 = (__pyx_v_boxl / 2.0); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":593 - * @property - * def nbytes(self): - * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":178 + * cdef double boxl2 = boxl / 2.0 * - * @property + * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< + * for j in range(nsurr): + * dx = surr_xyz[j,0] - core_xyz[i,0] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_1 = __pyx_v_ncore; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_3 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dist) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_pos) + #endif /* _OPENMP */ + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_2); + /* Initialize private variables to invalid values */ + __pyx_v_dist = ((double)__PYX_NAN()); + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_pos = ((int)0xbad0bad0); - /* "View.MemoryView":592 - * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize + /* "newanalysis/gfunction/gfunction.pyx":179 * + * for i in prange(ncore, nogil=True): + * for j in range(nsurr): # <<<<<<<<<<<<<< + * dx = surr_xyz[j,0] - core_xyz[i,0] + * dy = surr_xyz[j,1] - core_xyz[i,1] */ + __pyx_t_4 = __pyx_v_nsurr; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_j = __pyx_t_6; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":180 + * for i in prange(ncore, nogil=True): + * for j in range(nsurr): + * dx = surr_xyz[j,0] - core_xyz[i,0] # <<<<<<<<<<<<<< + * dy = surr_xyz[j,1] - core_xyz[i,1] + * dz = surr_xyz[j,2] - core_xyz[i,2] + */ + __pyx_t_7 = __pyx_v_j; + __pyx_t_8 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_surr_xyz.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_surr_xyz.shape[1]; + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_core_xyz.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_core_xyz.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_7 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_8 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_9 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_10 * __pyx_v_core_xyz.strides[1]) )))); -/* "View.MemoryView":596 + /* "newanalysis/gfunction/gfunction.pyx":181 + * for j in range(nsurr): + * dx = surr_xyz[j,0] - core_xyz[i,0] + * dy = surr_xyz[j,1] - core_xyz[i,1] # <<<<<<<<<<<<<< + * dz = surr_xyz[j,2] - core_xyz[i,2] * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 */ + __pyx_t_10 = __pyx_v_j; + __pyx_t_9 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_surr_xyz.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_surr_xyz.shape[1]; + __pyx_t_8 = __pyx_v_i; + __pyx_t_7 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_core_xyz.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_core_xyz.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_10 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_9 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_8 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_7 * __pyx_v_core_xyz.strides[1]) )))); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 + /* "newanalysis/gfunction/gfunction.pyx":182 + * dx = surr_xyz[j,0] - core_xyz[i,0] + * dy = surr_xyz[j,1] - core_xyz[i,1] + * dz = surr_xyz[j,2] - core_xyz[i,2] # <<<<<<<<<<<<<< * + * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl */ - __pyx_t_1 = (__pyx_v_self->_size == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_7 = __pyx_v_j; + __pyx_t_8 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_surr_xyz.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_surr_xyz.shape[1]; + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = 2; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_core_xyz.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_core_xyz.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_7 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_8 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_9 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_10 * __pyx_v_core_xyz.strides[1]) )))); - /* "View.MemoryView":598 - * def size(self): - * if self._size is None: - * result = 1 # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":184 + * dz = surr_xyz[j,2] - core_xyz[i,2] * - * for length in self.view.shape[:self.view.ndim]: + * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl # <<<<<<<<<<<<<< + * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl + * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_result = __pyx_int_1; + __pyx_t_11 = (fabs(__pyx_v_dx) > __pyx_v_boxl2); + if (__pyx_t_11) { + __pyx_v_dx = (__pyx_v_dx - (((0.0 < __pyx_v_dx) - (__pyx_v_dx < 0.0)) * __pyx_v_boxl)); + } - /* "View.MemoryView":600 - * result = 1 + /* "newanalysis/gfunction/gfunction.pyx":185 * - * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< - * result *= length + * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl + * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl # <<<<<<<<<<<<<< + * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl * */ - __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_11 = (fabs(__pyx_v_dy) > __pyx_v_boxl2); + if (__pyx_t_11) { + __pyx_v_dy = (__pyx_v_dy - (((0.0 < __pyx_v_dy) - (__pyx_v_dy < 0.0)) * __pyx_v_boxl)); + } - /* "View.MemoryView":601 + /* "newanalysis/gfunction/gfunction.pyx":186 + * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl + * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl + * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl # <<<<<<<<<<<<<< * - * for length in self.view.shape[:self.view.ndim]: - * result *= length # <<<<<<<<<<<<<< + * dist = sqrt(dx*dx+dy*dy+dz*dz) + */ + __pyx_t_11 = (fabs(__pyx_v_dz) > __pyx_v_boxl2); + if (__pyx_t_11) { + __pyx_v_dz = (__pyx_v_dz - (((0.0 < __pyx_v_dz) - (__pyx_v_dz < 0.0)) * __pyx_v_boxl)); + } + + /* "newanalysis/gfunction/gfunction.pyx":188 + * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl * - * self._size = result + * dist = sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< + * if disthisto_max or floor(dist*invdx)==0: continue + * pos = floor((dist-histo_min)*invdx) */ - __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 601, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6); - __pyx_t_6 = 0; - } + __pyx_v_dist = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* "View.MemoryView":603 - * result *= length + /* "newanalysis/gfunction/gfunction.pyx":189 * - * self._size = result # <<<<<<<<<<<<<< + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue # <<<<<<<<<<<<<< + * pos = floor((dist-histo_min)*invdx) * - * return self._size */ - __Pyx_INCREF(__pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - __Pyx_GOTREF(__pyx_v_self->_size); - __Pyx_DECREF(__pyx_v_self->_size); - __pyx_v_self->_size = __pyx_v_result; + __pyx_t_12 = (__pyx_v_dist < __pyx_v_histo_min); + if (!__pyx_t_12) { + } else { + __pyx_t_11 = __pyx_t_12; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_12 = (__pyx_v_dist > __pyx_v_histo_max); + if (!__pyx_t_12) { + } else { + __pyx_t_11 = __pyx_t_12; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_12 = (floor((__pyx_v_dist * __pyx_v_invdx)) == 0.0); + __pyx_t_11 = __pyx_t_12; + __pyx_L16_bool_binop_done:; + if (__pyx_t_11) { + goto __pyx_L10_continue; + } - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 + /* "newanalysis/gfunction/gfunction.pyx":190 + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue + * pos = floor((dist-histo_min)*invdx) # <<<<<<<<<<<<<< * + * result[t,i,pos] += 1.0 */ - } + __pyx_v_pos = ((int)floor(((__pyx_v_dist - __pyx_v_histo_min) * __pyx_v_invdx))); - /* "View.MemoryView":605 - * self._size = result + /* "newanalysis/gfunction/gfunction.pyx":192 + * pos = floor((dist-histo_min)*invdx) * - * return self._size # <<<<<<<<<<<<<< + * result[t,i,pos] += 1.0 # <<<<<<<<<<<<<< * - * def __len__(self): + * # RDF time series with voronoi decomposition */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_size); - __pyx_r = __pyx_v_self->_size; - goto __pyx_L0; + __pyx_t_10 = __pyx_v_t; + __pyx_t_9 = __pyx_v_i; + __pyx_t_8 = __pyx_v_pos; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_result.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_result.shape[1]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_result.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_10 * __pyx_v_result.strides[0]) ) + __pyx_t_9 * __pyx_v_result.strides[1]) ) + __pyx_t_8 * __pyx_v_result.strides[2]) )) += 1.0; + __pyx_L10_continue:; + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":596 + /* "newanalysis/gfunction/gfunction.pyx":178 + * cdef double boxl2 = boxl / 2.0 * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 + * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< + * for j in range(nsurr): + * dx = surr_xyz[j,0] - core_xyz[i,0] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "newanalysis/gfunction/gfunction.pyx":168 + * + * # RDF time series + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcHistoTS(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:] result, + * double boxl, int t, float histo_min, float histo_max, double invdx): */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":607 - * return self._size +/* "newanalysis/gfunction/gfunction.pyx":195 * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + * # RDF time series with voronoi decomposition + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcHistoTSVoro(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:,:] result, char [:,:,:] ds, int maxshell, + * double boxl, int t, float histo_min, float histo_max, double invdx): */ /* Python wrapper */ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); +static PyObject *__pyx_pw_11newanalysis_9gfunction_3calcHistoTSVoro(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3calcHistoTSVoro = {"calcHistoTSVoro", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_3calcHistoTSVoro, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_3calcHistoTSVoro(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_core_xyz = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_surr_xyz = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell; + double __pyx_v_boxl; + int __pyx_v_t; + float __pyx_v_histo_min; + float __pyx_v_histo_max; + double __pyx_v_invdx; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcHistoTSVoro (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 195, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_core_xyz,&__pyx_n_s_surr_xyz,&__pyx_n_s_result,&__pyx_n_s_ds,&__pyx_n_s_maxshell,&__pyx_n_s_boxl,&__pyx_n_s_t,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_invdx,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_core_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_surr_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 1); __PYX_ERR(0, 195, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 2); __PYX_ERR(0, 195, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 3); __PYX_ERR(0, 195, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 4); __PYX_ERR(0, 195, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 5); __PYX_ERR(0, 195, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_t)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 6); __PYX_ERR(0, 195, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_min)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 7); __PYX_ERR(0, 195, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_max)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 8); __PYX_ERR(0, 195, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (likely((values[9] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_invdx)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[9]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, 9); __PYX_ERR(0, 195, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcHistoTSVoro") < 0)) __PYX_ERR(0, 195, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 10)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + } + __pyx_v_core_xyz = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_core_xyz.memview)) __PYX_ERR(0, 196, __pyx_L3_error) + __pyx_v_surr_xyz = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_surr_xyz.memview)) __PYX_ERR(0, 196, __pyx_L3_error) + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 196, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 196, __pyx_L3_error) + __pyx_v_maxshell = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L3_error) + __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) + __pyx_v_t = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_t == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) + __pyx_v_histo_min = __pyx_PyFloat_AsFloat(values[7]); if (unlikely((__pyx_v_histo_min == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) + __pyx_v_histo_max = __pyx_PyFloat_AsFloat(values[8]); if (unlikely((__pyx_v_histo_max == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) + __pyx_v_invdx = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_invdx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcHistoTSVoro", 1, 10, 10, __pyx_nargs); __PYX_ERR(0, 195, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_core_xyz, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_surr_xyz, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.gfunction.calcHistoTSVoro", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_2calcHistoTSVoro(__pyx_self, __pyx_v_core_xyz, __pyx_v_surr_xyz, __pyx_v_result, __pyx_v_ds, __pyx_v_maxshell, __pyx_v_boxl, __pyx_v_t, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_invdx); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_core_xyz, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_surr_xyz, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_pf_11newanalysis_9gfunction_2calcHistoTSVoro(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_core_xyz, __Pyx_memviewslice __pyx_v_surr_xyz, __Pyx_memviewslice __pyx_v_result, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, double __pyx_v_boxl, int __pyx_v_t, float __pyx_v_histo_min, float __pyx_v_histo_max, double __pyx_v_invdx) { + CYTHON_UNUSED int __pyx_v_ncore; + int __pyx_v_nsurr; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_pos; + char __pyx_v_shell; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_dist; + double __pyx_v_boxl2; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__len__", 0); + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + __Pyx_RefNannySetupContext("calcHistoTSVoro", 0); - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] + /* "newanalysis/gfunction/gfunction.pyx":199 + * double boxl, int t, float histo_min, float histo_max, double invdx): * + * cdef int ncore = core_xyz.shape[0] # <<<<<<<<<<<<<< + * cdef int nsurr = surr_xyz.shape[0] + * cdef int i, j, pos */ - __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); - if (__pyx_t_1) { + __pyx_v_ncore = (__pyx_v_core_xyz.shape[0]); - /* "View.MemoryView":609 - * def __len__(self): - * if self.view.ndim >= 1: - * return self.view.shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":200 * - * return 0 + * cdef int ncore = core_xyz.shape[0] + * cdef int nsurr = surr_xyz.shape[0] # <<<<<<<<<<<<<< + * cdef int i, j, pos + * cdef char shell */ - __pyx_r = (__pyx_v_self->view.shape[0]); - goto __pyx_L0; + __pyx_v_nsurr = (__pyx_v_surr_xyz.shape[0]); - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] + /* "newanalysis/gfunction/gfunction.pyx":204 + * cdef char shell + * cdef double dx, dy, dz, dist + * cdef double boxl2 = boxl / 2.0 # <<<<<<<<<<<<<< * + * for i in prange(ncore, nogil=True): */ - } + __pyx_v_boxl2 = (__pyx_v_boxl / 2.0); - /* "View.MemoryView":611 - * return self.view.shape[0] - * - * return 0 # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":206 + * cdef double boxl2 = boxl / 2.0 * - * def __repr__(self): + * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< + * for j in range(nsurr): + * dx = surr_xyz[j,0] - core_xyz[i,0] */ - __pyx_r = 0; - goto __pyx_L0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_1 = __pyx_v_ncore; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_3 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dist) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_pos) lastprivate(__pyx_v_shell) + #endif /* _OPENMP */ + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_2); + /* Initialize private variables to invalid values */ + __pyx_v_dist = ((double)__PYX_NAN()); + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_pos = ((int)0xbad0bad0); + __pyx_v_shell = ((char)'?'); - /* "View.MemoryView":607 - * return self._size + /* "newanalysis/gfunction/gfunction.pyx":207 * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + * for i in prange(ncore, nogil=True): + * for j in range(nsurr): # <<<<<<<<<<<<<< + * dx = surr_xyz[j,0] - core_xyz[i,0] + * dy = surr_xyz[j,1] - core_xyz[i,1] */ + __pyx_t_4 = __pyx_v_nsurr; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_j = __pyx_t_6; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":208 + * for i in prange(ncore, nogil=True): + * for j in range(nsurr): + * dx = surr_xyz[j,0] - core_xyz[i,0] # <<<<<<<<<<<<<< + * dy = surr_xyz[j,1] - core_xyz[i,1] + * dz = surr_xyz[j,2] - core_xyz[i,2] + */ + __pyx_t_7 = __pyx_v_j; + __pyx_t_8 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_surr_xyz.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_surr_xyz.shape[1]; + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_core_xyz.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_core_xyz.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_7 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_8 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_9 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_10 * __pyx_v_core_xyz.strides[1]) )))); -/* "View.MemoryView":613 - * return 0 + /* "newanalysis/gfunction/gfunction.pyx":209 + * for j in range(nsurr): + * dx = surr_xyz[j,0] - core_xyz[i,0] + * dy = surr_xyz[j,1] - core_xyz[i,1] # <<<<<<<<<<<<<< + * dz = surr_xyz[j,2] - core_xyz[i,2] * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) */ + __pyx_t_10 = __pyx_v_j; + __pyx_t_9 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_surr_xyz.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_surr_xyz.shape[1]; + __pyx_t_8 = __pyx_v_i; + __pyx_t_7 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_core_xyz.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_core_xyz.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_10 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_9 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_8 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_7 * __pyx_v_core_xyz.strides[1]) )))); -/* Python wrapper */ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "View.MemoryView":614 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) + /* "newanalysis/gfunction/gfunction.pyx":210 + * dx = surr_xyz[j,0] - core_xyz[i,0] + * dy = surr_xyz[j,1] - core_xyz[i,1] + * dz = surr_xyz[j,2] - core_xyz[i,2] # <<<<<<<<<<<<<< * + * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __pyx_v_j; + __pyx_t_8 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_surr_xyz.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_surr_xyz.shape[1]; + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = 2; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_core_xyz.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_core_xyz.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surr_xyz.data + __pyx_t_7 * __pyx_v_surr_xyz.strides[0]) ) + __pyx_t_8 * __pyx_v_surr_xyz.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_core_xyz.data + __pyx_t_9 * __pyx_v_core_xyz.strides[0]) ) + __pyx_t_10 * __pyx_v_core_xyz.strides[1]) )))); - /* "View.MemoryView":615 - * def __repr__(self): - * return "" % (self.base.__class__.__name__, - * id(self)) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":212 + * dz = surr_xyz[j,2] - core_xyz[i,2] * - * def __str__(self): + * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl # <<<<<<<<<<<<<< + * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl + * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = (fabs(__pyx_v_dx) > __pyx_v_boxl2); + if (__pyx_t_11) { + __pyx_v_dx = (__pyx_v_dx - (((0.0 < __pyx_v_dx) - (__pyx_v_dx < 0.0)) * __pyx_v_boxl)); + } - /* "View.MemoryView":614 + /* "newanalysis/gfunction/gfunction.pyx":213 * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) + * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl + * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl # <<<<<<<<<<<<<< + * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl * */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_11 = (fabs(__pyx_v_dy) > __pyx_v_boxl2); + if (__pyx_t_11) { + __pyx_v_dy = (__pyx_v_dy - (((0.0 < __pyx_v_dy) - (__pyx_v_dy < 0.0)) * __pyx_v_boxl)); + } - /* "View.MemoryView":613 - * return 0 + /* "newanalysis/gfunction/gfunction.pyx":214 + * if fabs(dx) > boxl2: dx = dx-((0.0 < dx) - (dx < 0.0))*boxl + * if fabs(dy) > boxl2: dy = dy-((0.0 < dy) - (dy < 0.0))*boxl + * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl # <<<<<<<<<<<<<< * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) + * dist = sqrt(dx*dx+dy*dy+dz*dz) */ + __pyx_t_11 = (fabs(__pyx_v_dz) > __pyx_v_boxl2); + if (__pyx_t_11) { + __pyx_v_dz = (__pyx_v_dz - (((0.0 < __pyx_v_dz) - (__pyx_v_dz < 0.0)) * __pyx_v_boxl)); + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":216 + * if fabs(dz) > boxl2: dz = dz-((0.0 < dz) - (dz < 0.0))*boxl + * + * dist = sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< + * if disthisto_max or floor(dist*invdx)==0: continue + * pos = floor((dist-histo_min)*invdx) + */ + __pyx_v_dist = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); -/* "View.MemoryView":617 - * id(self)) + /* "newanalysis/gfunction/gfunction.pyx":217 * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue # <<<<<<<<<<<<<< + * pos = floor((dist-histo_min)*invdx) * */ + __pyx_t_12 = (__pyx_v_dist < __pyx_v_histo_min); + if (!__pyx_t_12) { + } else { + __pyx_t_11 = __pyx_t_12; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_12 = (__pyx_v_dist > __pyx_v_histo_max); + if (!__pyx_t_12) { + } else { + __pyx_t_11 = __pyx_t_12; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_12 = (floor((__pyx_v_dist * __pyx_v_invdx)) == 0.0); + __pyx_t_11 = __pyx_t_12; + __pyx_L16_bool_binop_done:; + if (__pyx_t_11) { + goto __pyx_L10_continue; + } -/* Python wrapper */ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":218 + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue + * pos = floor((dist-histo_min)*invdx) # <<<<<<<<<<<<<< + * + * shell = ds[t,i,j] + */ + __pyx_v_pos = ((int)floor(((__pyx_v_dist - __pyx_v_histo_min) * __pyx_v_invdx))); -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); + /* "newanalysis/gfunction/gfunction.pyx":220 + * pos = floor((dist-histo_min)*invdx) + * + * shell = ds[t,i,j] # <<<<<<<<<<<<<< + * if shell > maxshell: + * shell = maxshell + */ + __pyx_t_10 = __pyx_v_t; + __pyx_t_9 = __pyx_v_i; + __pyx_t_8 = __pyx_v_j; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_ds.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_ds.shape[1]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_ds.shape[2]; + __pyx_v_shell = (*((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_10 * __pyx_v_ds.strides[0]) ) + __pyx_t_9 * __pyx_v_ds.strides[1]) ) + __pyx_t_8 * __pyx_v_ds.strides[2]) ))); - /* "View.MemoryView":618 + /* "newanalysis/gfunction/gfunction.pyx":221 * - * def __str__(self): - * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * shell = ds[t,i,j] + * if shell > maxshell: # <<<<<<<<<<<<<< + * shell = maxshell * + */ + __pyx_t_11 = (__pyx_v_shell > __pyx_v_maxshell); + if (__pyx_t_11) { + + /* "newanalysis/gfunction/gfunction.pyx":222 + * shell = ds[t,i,j] + * if shell > maxshell: + * shell = maxshell # <<<<<<<<<<<<<< * + * result[t,i,shell-1,pos] += 1.0 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_shell = __pyx_v_maxshell; - /* "View.MemoryView":617 - * id(self)) + /* "newanalysis/gfunction/gfunction.pyx":221 * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + * shell = ds[t,i,j] + * if shell > maxshell: # <<<<<<<<<<<<<< + * shell = maxshell * */ + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":621 + /* "newanalysis/gfunction/gfunction.pyx":224 + * shell = maxshell + * + * result[t,i,shell-1,pos] += 1.0 # <<<<<<<<<<<<<< * * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp */ + __pyx_t_8 = __pyx_v_t; + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = (__pyx_v_shell - 1); + __pyx_t_7 = __pyx_v_pos; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_result.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_result.shape[1]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_result.shape[2]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_result.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_8 * __pyx_v_result.strides[0]) ) + __pyx_t_9 * __pyx_v_result.strides[1]) ) + __pyx_t_10 * __pyx_v_result.strides[2]) ) + __pyx_t_7 * __pyx_v_result.strides[3]) )) += 1.0; + __pyx_L10_continue:; + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_c_contig", 0); - - /* "View.MemoryView":624 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'C', self.view.ndim) - * - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 624, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; - - /* "View.MemoryView":625 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":206 + * cdef double boxl2 = boxl / 2.0 * - * def is_f_contig(self): + * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< + * for j in range(nsurr): + * dx = surr_xyz[j,0] - core_xyz[i,0] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } - /* "View.MemoryView":621 - * + /* "newanalysis/gfunction/gfunction.pyx":195 * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + * # RDF time series with voronoi decomposition + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcHistoTSVoro(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:,:] result, char [:,:,:] ds, int maxshell, + * double boxl, int t, float histo_min, float histo_max, double invdx): */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) +/* "newanalysis/gfunction/gfunction.pyx":234 + * """ * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False, norm_volume=None): # <<<<<<<<<<<<<< + * """ + * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) */ /* Python wrapper */ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_3RDF___init__, "\n RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False)\n\n Creates a new rdf container.\n\n modes .. a list of gfunctions to calculate\n e.g. [\"all\"] -> calculate all gfunctions\n [\"000\",\"110\",\"220\"] -> calculate only g000, g110 and g220\n histo_min .. lower bound of histogram\n histo_max .. upper bound of histogram\n histo_dr .. histogram bin width\n sel1_n .. number of particles in first selection\n sel2_n .. number of particles in second selection\n sel1_nmol .. number of molecules in first selection; needed for correct normalisation, if multiple atoms from the same molecule are selected\n sel2_nmol .. number of molecules in second selection\n box_x .. box length, x dim\n box_y .. box length, y dim (optional; if None, y=x)\n box_z .. box length, z dim (optional; if None, z=x)\n use_cuda .. whether to use cuda, if available (default=False)\n norm_volume .. volume to use for calculating the density during normalization (default = None)\n\n Usage example:\n my_rdf = RDF([\"all\"], 0.0, 50.0, 0.05, 200, 200, 200, 200, 25.0)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF___init__}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_modes = 0; + PyObject *__pyx_v_histo_min = 0; + PyObject *__pyx_v_histo_max = 0; + PyObject *__pyx_v_histo_dr = 0; + PyObject *__pyx_v_sel1_n = 0; + PyObject *__pyx_v_sel2_n = 0; + PyObject *__pyx_v_sel1_nmol = 0; + PyObject *__pyx_v_sel2_nmol = 0; + PyObject *__pyx_v_box_x = 0; + PyObject *__pyx_v_box_y = 0; + PyObject *__pyx_v_box_z = 0; + PyObject *__pyx_v_use_cuda = 0; + PyObject *__pyx_v_norm_volume = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 234, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_modes,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_histo_dr,&__pyx_n_s_sel1_n,&__pyx_n_s_sel2_n,&__pyx_n_s_sel1_nmol,&__pyx_n_s_sel2_nmol,&__pyx_n_s_box_x,&__pyx_n_s_box_y,&__pyx_n_s_box_z,&__pyx_n_s_use_cuda,&__pyx_n_s_norm_volume,0}; + values[10] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[11] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[12] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False))); + values[13] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); + CYTHON_FALLTHROUGH; + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); + CYTHON_FALLTHROUGH; + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + CYTHON_FALLTHROUGH; + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_modes)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 1); __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_min)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 2); __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_max)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 3); __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_dr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 4); __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel1_n)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 5); __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel2_n)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 6); __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel1_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 7); __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel2_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 8); __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (likely((values[9] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_x)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[9]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, 9); __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 10: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_y); + if (value) { values[10] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 11: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_z); + if (value) { values[11] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 12: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_use_cuda); + if (value) { values[12] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 13: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_norm_volume); + if (value) { values[13] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 234, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); + CYTHON_FALLTHROUGH; + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); + CYTHON_FALLTHROUGH; + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + CYTHON_FALLTHROUGH; + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_self = values[0]; + __pyx_v_modes = values[1]; + __pyx_v_histo_min = values[2]; + __pyx_v_histo_max = values[3]; + __pyx_v_histo_dr = values[4]; + __pyx_v_sel1_n = values[5]; + __pyx_v_sel2_n = values[6]; + __pyx_v_sel1_nmol = values[7]; + __pyx_v_sel2_nmol = values[8]; + __pyx_v_box_x = values[9]; + __pyx_v_box_y = values[10]; + __pyx_v_box_z = values[11]; + __pyx_v_use_cuda = values[12]; + __pyx_v_norm_volume = values[13]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 10, 14, __pyx_nargs); __PYX_ERR(0, 234, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF___init__(__pyx_self, __pyx_v_self, __pyx_v_modes, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_dr, __pyx_v_sel1_n, __pyx_v_sel2_n, __pyx_v_sel1_nmol, __pyx_v_sel2_nmol, __pyx_v_box_x, __pyx_v_box_y, __pyx_v_box_z, __pyx_v_use_cuda, __pyx_v_norm_volume); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_modes, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_dr, PyObject *__pyx_v_sel1_n, PyObject *__pyx_v_sel2_n, PyObject *__pyx_v_sel1_nmol, PyObject *__pyx_v_sel2_nmol, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z, PyObject *__pyx_v_use_cuda, PyObject *__pyx_v_norm_volume) { + int __pyx_v_mode_sel; + PyObject *__pyx_v_mode = NULL; + PyObject *__pyx_v_arr_sel1 = NULL; + PyObject *__pyx_v_arr_sel2 = NULL; + PyObject *__pyx_v_block_x = NULL; + PyObject *__pyx_v_block_y = NULL; + long __pyx_v_block_z; + PyObject *__pyx_v_grid_x = NULL; + PyObject *__pyx_v_grid_y = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_f_contig", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "View.MemoryView":630 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "newanalysis/gfunction/gfunction.pyx":260 + * """ * + * if use_cuda and cu.cuda: # <<<<<<<<<<<<<< + * self.cuda = True + * elif use_cuda and not cu.cuda: */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 630, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_use_cuda); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 260, __pyx_L1_error) + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_cu); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cuda); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "View.MemoryView":631 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":261 * - * def copy(self): + * if use_cuda and cu.cuda: + * self.cuda = True # <<<<<<<<<<<<<< + * elif use_cuda and not cu.cuda: + * print("No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead.") */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_True) < 0) __PYX_ERR(0, 261, __pyx_L1_error) - /* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "newanalysis/gfunction/gfunction.pyx":260 + * """ * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + * if use_cuda and cu.cuda: # <<<<<<<<<<<<<< + * self.cuda = True + * elif use_cuda and not cu.cuda: */ + goto __pyx_L3; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) - * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + /* "newanalysis/gfunction/gfunction.pyx":262 + * if use_cuda and cu.cuda: + * self.cuda = True + * elif use_cuda and not cu.cuda: # <<<<<<<<<<<<<< + * print("No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead.") + * self.cuda = False */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_use_cuda); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 262, __pyx_L1_error) + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L6_bool_binop_done; + } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_cu); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cuda); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 262, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = (!__pyx_t_2); + __pyx_t_1 = __pyx_t_5; + __pyx_L6_bool_binop_done:; + if (__pyx_t_1) { -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "newanalysis/gfunction/gfunction.pyx":263 + * self.cuda = True + * elif use_cuda and not cu.cuda: + * print("No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead.") # <<<<<<<<<<<<<< + * self.cuda = False + * else: + */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":264 + * elif use_cuda and not cu.cuda: + * print("No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead.") + * self.cuda = False # <<<<<<<<<<<<<< + * else: + * self.cuda = False + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_False) < 0) __PYX_ERR(0, 264, __pyx_L1_error) -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_mslice; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy", 0); + /* "newanalysis/gfunction/gfunction.pyx":262 + * if use_cuda and cu.cuda: + * self.cuda = True + * elif use_cuda and not cu.cuda: # <<<<<<<<<<<<<< + * print("No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead.") + * self.cuda = False + */ + goto __pyx_L3; + } - /* "View.MemoryView":635 - * def copy(self): - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":266 + * self.cuda = False + * else: + * self.cuda = False # <<<<<<<<<<<<<< * - * slice_copy(self, &mslice) + * if self.cuda: */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + /*else*/ { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cuda, Py_False) < 0) __PYX_ERR(0, 266, __pyx_L1_error) + } + __pyx_L3:; - /* "View.MemoryView":637 - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + /* "newanalysis/gfunction/gfunction.pyx":268 + * self.cuda = False * - * slice_copy(self, &mslice) # <<<<<<<<<<<<<< - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, - * self.view.itemsize, + * if self.cuda: # <<<<<<<<<<<<<< + * self.dtype = np.float32 + * else: */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { - /* "View.MemoryView":638 + /* "newanalysis/gfunction/gfunction.pyx":269 * - * slice_copy(self, &mslice) - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_C_CONTIGUOUS, + * if self.cuda: + * self.dtype = np.float32 # <<<<<<<<<<<<<< + * else: + * self.dtype = np.float64 */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 638, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 269, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":643 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":268 + * self.cuda = False * - * def copy_fortran(self): + * if self.cuda: # <<<<<<<<<<<<<< + * self.dtype = np.float32 + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + goto __pyx_L8; + } - /* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "newanalysis/gfunction/gfunction.pyx":271 + * self.dtype = np.float32 + * else: + * self.dtype = np.float64 # <<<<<<<<<<<<<< * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * # always initialize the histogram to 7 dimensions, but only fill the desired ones */ + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 271, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) + /* "newanalysis/gfunction/gfunction.pyx":274 * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * # always initialize the histogram to 7 dimensions, but only fill the desired ones + * cdef int mode_sel = 0 # <<<<<<<<<<<<<< + * + * # select the gfunctions to calculate using bitwise operators */ + __pyx_v_mode_sel = 0; -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy_fortran", 0); - - /* "View.MemoryView":647 - * def copy_fortran(self): - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< - * - * slice_copy(self, &src) - */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - - /* "View.MemoryView":649 - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS - * - * slice_copy(self, &src) # <<<<<<<<<<<<<< - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, - * self.view.itemsize, - */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); - - /* "View.MemoryView":650 - * - * slice_copy(self, &src) - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_F_CONTIGUOUS, - */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 650, __pyx_L1_error) - __pyx_v_dst = __pyx_t_1; - - /* "View.MemoryView":655 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) - * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":659 - * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - */ - -static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { - struct __pyx_memoryview_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - - /* "View.MemoryView":660 - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< - * result.typeinfo = typeinfo - * return result - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_o); - __Pyx_GIVEREF(__pyx_v_o); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":661 - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_v_result->typeinfo = __pyx_v_typeinfo; - - /* "View.MemoryView":662 - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - * return result # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_check') - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - /* "View.MemoryView":659 - * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) - * - */ - -static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("memoryview_check", 0); - - /* "View.MemoryView":666 - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): - * return isinstance(o, memoryview) # <<<<<<<<<<<<<< - * - * cdef tuple _unellipsify(object index, int ndim): - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); - __pyx_r = __pyx_t_1; - goto __pyx_L0; - - /* "View.MemoryView":665 + /* "newanalysis/gfunction/gfunction.pyx":277 * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":668 - * return isinstance(o, memoryview) - * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with - */ - -static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { - PyObject *__pyx_v_tup = NULL; - PyObject *__pyx_v_result = NULL; - int __pyx_v_have_slices; - int __pyx_v_seen_ellipsis; - CYTHON_UNUSED PyObject *__pyx_v_idx = NULL; - PyObject *__pyx_v_item = NULL; - Py_ssize_t __pyx_v_nslices; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_unellipsify", 0); - - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: - */ - __pyx_t_1 = PyTuple_Check(__pyx_v_index); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":674 - * """ - * if not isinstance(index, tuple): - * tup = (index,) # <<<<<<<<<<<<<< - * else: - * tup = index - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 674, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); - __pyx_v_tup = __pyx_t_3; - __pyx_t_3 = 0; - - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":676 - * tup = (index,) - * else: - * tup = index # <<<<<<<<<<<<<< - * - * result = [] - */ - /*else*/ { - __Pyx_INCREF(__pyx_v_index); - __pyx_v_tup = __pyx_v_index; - } - __pyx_L3:; - - /* "View.MemoryView":678 - * tup = index - * - * result = [] # <<<<<<<<<<<<<< - * have_slices = False - * seen_ellipsis = False - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 678, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_result = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":679 - * - * result = [] - * have_slices = False # <<<<<<<<<<<<<< - * seen_ellipsis = False - * for idx, item in enumerate(tup): - */ - __pyx_v_have_slices = 0; - - /* "View.MemoryView":680 - * result = [] - * have_slices = False - * seen_ellipsis = False # <<<<<<<<<<<<<< - * for idx, item in enumerate(tup): - * if item is Ellipsis: - */ - __pyx_v_seen_ellipsis = 0; - - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: + * # select the gfunctions to calculate using bitwise operators + * for mode in modes: # <<<<<<<<<<<<<< + * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 + * if mode == "000": mode_sel = mode_sel | 1 */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_3 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) { - __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; + if (likely(PyList_CheckExact(__pyx_v_modes)) || PyTuple_CheckExact(__pyx_v_modes)) { + __pyx_t_3 = __pyx_v_modes; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; + __pyx_t_7 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 681, __pyx_L1_error) + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_modes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 277, __pyx_L1_error) } for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 277, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); #endif } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 277, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); #endif } } else { - __pyx_t_7 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_7)) { + __pyx_t_4 = __pyx_t_7(__pyx_t_3); + if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 681, __pyx_L1_error) + else __PYX_ERR(0, 277, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_4); } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_7; - __pyx_t_7 = 0; + __Pyx_XDECREF_SET(__pyx_v_mode, __pyx_t_4); + __pyx_t_4 = 0; - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) + /* "newanalysis/gfunction/gfunction.pyx":278 + * # select the gfunctions to calculate using bitwise operators + * for mode in modes: + * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 # <<<<<<<<<<<<<< + * if mode == "000": mode_sel = mode_sel | 1 + * if mode == "110": mode_sel = mode_sel | 2 */ - __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); - __pyx_t_1 = (__pyx_t_2 != 0); + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_all, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 278, __pyx_L1_error) if (__pyx_t_1) { + __pyx_v_mode_sel = (((((((__pyx_v_mode_sel | 1) | 2) | 4) | 8) | 16) | 32) | 64); + } - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True + /* "newanalysis/gfunction/gfunction.pyx":279 + * for mode in modes: + * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 + * if mode == "000": mode_sel = mode_sel | 1 # <<<<<<<<<<<<<< + * if mode == "110": mode_sel = mode_sel | 2 + * if mode == "101": mode_sel = mode_sel | 4 */ - __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0); - if (__pyx_t_1) { + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_000, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 279, __pyx_L1_error) + if (__pyx_t_1) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 1); + } - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: + /* "newanalysis/gfunction/gfunction.pyx":280 + * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 + * if mode == "000": mode_sel = mode_sel | 1 + * if mode == "110": mode_sel = mode_sel | 2 # <<<<<<<<<<<<<< + * if mode == "101": mode_sel = mode_sel | 4 + * if mode == "011": mode_sel = mode_sel | 8 */ - __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__6); - __Pyx_GIVEREF(__pyx_slice__6); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__6); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_110, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 280, __pyx_L1_error) + if (__pyx_t_1) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 2); + } - /* "View.MemoryView":685 - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True # <<<<<<<<<<<<<< - * else: - * result.append(slice(None)) + /* "newanalysis/gfunction/gfunction.pyx":281 + * if mode == "000": mode_sel = mode_sel | 1 + * if mode == "110": mode_sel = mode_sel | 2 + * if mode == "101": mode_sel = mode_sel | 4 # <<<<<<<<<<<<<< + * if mode == "011": mode_sel = mode_sel | 8 + * if mode == "220": mode_sel = mode_sel | 16 */ - __pyx_v_seen_ellipsis = 1; + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_101, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 281, __pyx_L1_error) + if (__pyx_t_1) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 4); + } - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True + /* "newanalysis/gfunction/gfunction.pyx":282 + * if mode == "110": mode_sel = mode_sel | 2 + * if mode == "101": mode_sel = mode_sel | 4 + * if mode == "011": mode_sel = mode_sel | 8 # <<<<<<<<<<<<<< + * if mode == "220": mode_sel = mode_sel | 16 + * if mode == "202": mode_sel = mode_sel | 32 */ - goto __pyx_L7; - } + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_011, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 282, __pyx_L1_error) + if (__pyx_t_1) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 8); + } - /* "View.MemoryView":687 - * seen_ellipsis = True - * else: - * result.append(slice(None)) # <<<<<<<<<<<<<< - * have_slices = True - * else: + /* "newanalysis/gfunction/gfunction.pyx":283 + * if mode == "101": mode_sel = mode_sel | 4 + * if mode == "011": mode_sel = mode_sel | 8 + * if mode == "220": mode_sel = mode_sel | 16 # <<<<<<<<<<<<<< + * if mode == "202": mode_sel = mode_sel | 32 + * if mode == "022": mode_sel = mode_sel | 64 */ - /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 687, __pyx_L1_error) - } - __pyx_L7:; + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_220, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 283, __pyx_L1_error) + if (__pyx_t_1) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 16); + } - /* "View.MemoryView":688 - * else: - * result.append(slice(None)) - * have_slices = True # <<<<<<<<<<<<<< - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): + /* "newanalysis/gfunction/gfunction.pyx":284 + * if mode == "011": mode_sel = mode_sel | 8 + * if mode == "220": mode_sel = mode_sel | 16 + * if mode == "202": mode_sel = mode_sel | 32 # <<<<<<<<<<<<<< + * if mode == "022": mode_sel = mode_sel | 64 + * */ - __pyx_v_have_slices = 1; + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_202, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 284, __pyx_L1_error) + if (__pyx_t_1) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 32); + } - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) + /* "newanalysis/gfunction/gfunction.pyx":285 + * if mode == "220": mode_sel = mode_sel | 16 + * if mode == "202": mode_sel = mode_sel | 32 + * if mode == "022": mode_sel = mode_sel | 64 # <<<<<<<<<<<<<< + * + * # remember the selection */ - goto __pyx_L6; + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_022, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 285, __pyx_L1_error) + if (__pyx_t_1) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 64); } - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) + /* "newanalysis/gfunction/gfunction.pyx":277 * + * # select the gfunctions to calculate using bitwise operators + * for mode in modes: # <<<<<<<<<<<<<< + * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 + * if mode == "000": mode_sel = mode_sel | 1 */ - /*else*/ { - __pyx_t_2 = PySlice_Check(__pyx_v_item); - __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0); - __pyx_t_1 = __pyx_t_10; - __pyx_L9_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":691 - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): - * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":288 * - * have_slices = have_slices or isinstance(item, slice) + * # remember the selection + * self.mode_sel = np.int32(mode_sel) # <<<<<<<<<<<<<< + * + * # set histogram parameters */ - __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(2, 691, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel, __pyx_t_3) < 0) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) + /* "newanalysis/gfunction/gfunction.pyx":291 * + * # set histogram parameters + * self.histo_min = np.float32(histo_min) # <<<<<<<<<<<<<< + * self.histo_max = np.float32(histo_max) + * self.histo_dr = np.round(self.dtype(histo_dr),5) */ - } + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_histo_min}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_min, __pyx_t_3) < 0) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":693 - * raise TypeError("Cannot index with type '%s'" % type(item)) - * - * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< - * result.append(item) - * + /* "newanalysis/gfunction/gfunction.pyx":292 + * # set histogram parameters + * self.histo_min = np.float32(histo_min) + * self.histo_max = np.float32(histo_max) # <<<<<<<<<<<<<< + * self.histo_dr = np.round(self.dtype(histo_dr),5) + * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) */ - __pyx_t_10 = (__pyx_v_have_slices != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = PySlice_Check(__pyx_v_item); - __pyx_t_2 = (__pyx_t_10 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L11_bool_binop_done:; - __pyx_v_have_slices = __pyx_t_1; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_histo_max}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_max, __pyx_t_3) < 0) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":694 - * - * have_slices = have_slices or isinstance(item, slice) - * result.append(item) # <<<<<<<<<<<<<< - * - * nslices = ndim - len(result) + /* "newanalysis/gfunction/gfunction.pyx":293 + * self.histo_min = np.float32(histo_min) + * self.histo_max = np.float32(histo_max) + * self.histo_dr = np.round(self.dtype(histo_dr),5) # <<<<<<<<<<<<<< + * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) + * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 694, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_round); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_10 = 1; } - __pyx_L6:; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_histo_dr}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_t_8, __pyx_int_5}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 2+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr, __pyx_t_3) < 0) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: + /* "newanalysis/gfunction/gfunction.pyx":294 + * self.histo_max = np.float32(histo_max) + * self.histo_dr = np.round(self.dtype(histo_dr),5) + * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) # <<<<<<<<<<<<<< + * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) + * */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 294, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 294, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyFloat_TrueDivideCObj(__pyx_float_1_0, __pyx_t_8, 1.0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 294, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_10 = 1; + } } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_9}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 294, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr, __pyx_t_3) < 0) __PYX_ERR(0, 294, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":696 - * result.append(item) + /* "newanalysis/gfunction/gfunction.pyx":295 + * self.histo_dr = np.round(self.dtype(histo_dr),5) + * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) + * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) # <<<<<<<<<<<<<< * - * nslices = ndim - len(result) # <<<<<<<<<<<<<< - * if nslices: - * result.extend([slice(None)] * nslices) + * self.box_dim = np.zeros(6,dtype=self.dtype) */ - __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 696, __pyx_L1_error) - __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Subtract(__pyx_v_histo_max, __pyx_v_histo_min); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_histo_dr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyFloat_AddObjC(__pyx_t_8, __pyx_float_0_5, 0.5, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_n, __pyx_t_3) < 0) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":697 + /* "newanalysis/gfunction/gfunction.pyx":297 + * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) + * self.box_dim = np.zeros(6,dtype=self.dtype) # <<<<<<<<<<<<<< + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 297, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__15, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_box_dim, __pyx_t_4) < 0) __PYX_ERR(0, 297, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":298 * + * self.box_dim = np.zeros(6,dtype=self.dtype) + * self.box_dim[0] = box_x # <<<<<<<<<<<<<< + * self.box_dim[3] = box_x/2.0 + * if box_y: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, 0, __pyx_v_box_x, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":299 + * self.box_dim = np.zeros(6,dtype=self.dtype) + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 # <<<<<<<<<<<<<< + * if box_y: + * self.box_dim[1] = box_y + */ + __pyx_t_4 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_x, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((__Pyx_SetItemInt(__pyx_t_3, 3, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":300 + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 + * if box_y: # <<<<<<<<<<<<<< + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 */ - __pyx_t_1 = (__pyx_v_nslices != 0); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_box_y); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 300, __pyx_L1_error) if (__pyx_t_1) { - /* "View.MemoryView":698 - * nslices = ndim - len(result) - * if nslices: - * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< - * - * return have_slices or nslices, tuple(result) + /* "newanalysis/gfunction/gfunction.pyx":301 + * self.box_dim[3] = box_x/2.0 + * if box_y: + * self.box_dim[1] = box_y # <<<<<<<<<<<<<< + * self.box_dim[4] = box_y/2.0 + * else: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, 1, __pyx_v_box_y, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 301, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":302 + * if box_y: + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 # <<<<<<<<<<<<<< + * else: + * self.box_dim[1] = self.box_dim[0] */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 698, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_y, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__6); - __Pyx_GIVEREF(__pyx_slice__6); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__6); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 698, __pyx_L1_error) + if (unlikely((__Pyx_SetItemInt(__pyx_t_3, 4, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":697 - * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) - * + /* "newanalysis/gfunction/gfunction.pyx":300 + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 + * if box_y: # <<<<<<<<<<<<<< + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 */ + goto __pyx_L20; } - /* "View.MemoryView":700 - * result.extend([slice(None)] * nslices) - * - * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< - * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): + /* "newanalysis/gfunction/gfunction.pyx":304 + * self.box_dim[4] = box_y/2.0 + * else: + * self.box_dim[1] = self.box_dim[0] # <<<<<<<<<<<<<< + * self.box_dim[4] = self.box_dim[3] + * if box_z: */ - __Pyx_XDECREF(__pyx_r); - if (!__pyx_v_have_slices) { - } else { - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L14_bool_binop_done; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, 1, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":305 + * else: + * self.box_dim[1] = self.box_dim[0] + * self.box_dim[4] = self.box_dim[3] # <<<<<<<<<<<<<< + * if box_z: + * self.box_dim[2] = box_z + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((__Pyx_SetItemInt(__pyx_t_3, 4, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_L14_bool_binop_done:; - __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject*)__pyx_t_11); - __pyx_t_11 = 0; - goto __pyx_L0; + __pyx_L20:; - /* "View.MemoryView":668 - * return isinstance(o, memoryview) - * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with + /* "newanalysis/gfunction/gfunction.pyx":306 + * self.box_dim[1] = self.box_dim[0] + * self.box_dim[4] = self.box_dim[3] + * if box_z: # <<<<<<<<<<<<<< + * self.box_dim[2] = box_z + * self.box_dim[5] = box_z/2.0 */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_box_z); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 306, __pyx_L1_error) + if (__pyx_t_1) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tup); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_XDECREF(__pyx_v_item); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":307 + * self.box_dim[4] = self.box_dim[3] + * if box_z: + * self.box_dim[2] = box_z # <<<<<<<<<<<<<< + * self.box_dim[5] = box_z/2.0 + * else: + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, 2, __pyx_v_box_z, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 307, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; -/* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) - * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: + /* "newanalysis/gfunction/gfunction.pyx":308 + * if box_z: + * self.box_dim[2] = box_z + * self.box_dim[5] = box_z/2.0 # <<<<<<<<<<<<<< + * else: + * self.box_dim[2] = self.box_dim[0] */ + __pyx_t_4 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_z, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((__Pyx_SetItemInt(__pyx_t_3, 5, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; -static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); + /* "newanalysis/gfunction/gfunction.pyx":306 + * self.box_dim[1] = self.box_dim[0] + * self.box_dim[4] = self.box_dim[3] + * if box_z: # <<<<<<<<<<<<<< + * self.box_dim[2] = box_z + * self.box_dim[5] = box_z/2.0 + */ + goto __pyx_L21; + } - /* "View.MemoryView":703 + /* "newanalysis/gfunction/gfunction.pyx":310 + * self.box_dim[5] = box_z/2.0 + * else: + * self.box_dim[2] = self.box_dim[0] # <<<<<<<<<<<<<< + * self.box_dim[5] = self.box_dim[3] * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") */ - __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); - for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { - __pyx_t_1 = __pyx_t_3; - __pyx_v_suboffset = (__pyx_t_1[0]); + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((__Pyx_SetItemInt(__pyx_t_4, 2, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 310, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") + /* "newanalysis/gfunction/gfunction.pyx":311 + * else: + * self.box_dim[2] = self.box_dim[0] + * self.box_dim[5] = self.box_dim[3] # <<<<<<<<<<<<<< * + * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] */ - __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely((__Pyx_SetItemInt(__pyx_t_3, 5, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L21:; - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":313 + * self.box_dim[5] = self.box_dim[3] * + * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] # <<<<<<<<<<<<<< * + * # remember volume for each frame for normalisation */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(2, 705, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_9, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_volume, __pyx_t_9) < 0) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") + /* "newanalysis/gfunction/gfunction.pyx":316 + * + * # remember volume for each frame for normalisation + * self.volume_list = [] # <<<<<<<<<<<<<< * + * self.norm_volume = norm_volume */ - } - } + __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_volume_list, __pyx_t_9) < 0) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) + /* "newanalysis/gfunction/gfunction.pyx":318 + * self.volume_list = [] * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: + * self.norm_volume = norm_volume # <<<<<<<<<<<<<< + * + * # set particle numbers */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume, __pyx_v_norm_volume) < 0) __PYX_ERR(0, 318, __pyx_L1_error) - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":712 + /* "newanalysis/gfunction/gfunction.pyx":321 * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step + * # set particle numbers + * self.n1 = np.int32(sel1_n) # <<<<<<<<<<<<<< + * self.n2 = np.int32(sel2_n) + * self.nmol1 = sel1_nmol */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_sel1_n}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n1, __pyx_t_9) < 0) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; -static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { - int __pyx_v_new_ndim; - int __pyx_v_suboffset_dim; - int __pyx_v_dim; - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - __Pyx_memviewslice *__pyx_v_p_src; - struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; - __Pyx_memviewslice *__pyx_v_p_dst; - int *__pyx_v_p_suboffset_dim; - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - int __pyx_v_have_start; - int __pyx_v_have_stop; - int __pyx_v_have_step; - PyObject *__pyx_v_index = NULL; - struct __pyx_memoryview_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - struct __pyx_memoryview_obj *__pyx_t_4; - char *__pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memview_slice", 0); - - /* "View.MemoryView":713 - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): - * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< - * cdef bint negative_step - * cdef __Pyx_memviewslice src, dst + /* "newanalysis/gfunction/gfunction.pyx":322 + * # set particle numbers + * self.n1 = np.int32(sel1_n) + * self.n2 = np.int32(sel2_n) # <<<<<<<<<<<<<< + * self.nmol1 = sel1_nmol + * self.nmol2 = sel2_nmol */ - __pyx_v_new_ndim = 0; - __pyx_v_suboffset_dim = -1; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_sel2_n}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 322, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n2, __pyx_t_9) < 0) __PYX_ERR(0, 322, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "View.MemoryView":720 - * + /* "newanalysis/gfunction/gfunction.pyx":323 + * self.n1 = np.int32(sel1_n) + * self.n2 = np.int32(sel2_n) + * self.nmol1 = sel1_nmol # <<<<<<<<<<<<<< + * self.nmol2 = sel2_nmol * - * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nmol1, __pyx_v_sel1_nmol) < 0) __PYX_ERR(0, 323, __pyx_L1_error) + + /* "newanalysis/gfunction/gfunction.pyx":324 + * self.n2 = np.int32(sel2_n) + * self.nmol1 = sel1_nmol + * self.nmol2 = sel2_nmol # <<<<<<<<<<<<<< * - * cdef _memoryviewslice memviewsliceobj + * self.oneistwo = None */ - (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nmol2, __pyx_v_sel2_nmol) < 0) __PYX_ERR(0, 324, __pyx_L1_error) - /* "View.MemoryView":724 - * cdef _memoryviewslice memviewsliceobj + /* "newanalysis/gfunction/gfunction.pyx":326 + * self.nmol2 = sel2_nmol * - * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * self.oneistwo = None # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): + * # set frame counter to 0 */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { - PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(2, 724, __pyx_L1_error) - } - } - #endif + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_None) < 0) __PYX_ERR(0, 326, __pyx_L1_error) - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 + /* "newanalysis/gfunction/gfunction.pyx":329 * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice + * # set frame counter to 0 + * self.ctr = 0 # <<<<<<<<<<<<<< + * + * # initialize histogram array */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ctr, __pyx_int_0) < 0) __PYX_ERR(0, 329, __pyx_L1_error) - /* "View.MemoryView":727 + /* "newanalysis/gfunction/gfunction.pyx":332 + * + * # initialize histogram array + * self.histogram = np.zeros(self.n1*self.histo_n*7,dtype=self.dtype) # <<<<<<<<<<<<<< + * self.histogram_out = np.zeros(self.histo_n*7,dtype=np.float64) * - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview # <<<<<<<<<<<<<< - * p_src = &memviewsliceobj.from_slice - * else: */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 727, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Multiply(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_MultiplyObjC(__pyx_t_8, __pyx_int_7, 7, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histogram, __pyx_t_9) < 0) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "View.MemoryView":728 - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, &src) + /* "newanalysis/gfunction/gfunction.pyx":333 + * # initialize histogram array + * self.histogram = np.zeros(self.n1*self.histo_n*7,dtype=self.dtype) + * self.histogram_out = np.zeros(self.histo_n*7,dtype=np.float64) # <<<<<<<<<<<<<< + * + * # print, if CUDA device will be used and initialize arrays */ - __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyInt_MultiplyObjC(__pyx_t_9, __pyx_int_7, 7, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8)) __PYX_ERR(0, 333, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out, __pyx_t_11) < 0) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 + /* "newanalysis/gfunction/gfunction.pyx":336 + * + * # print, if CUDA device will be used and initialize arrays + * if self.cuda and use_cuda: # <<<<<<<<<<<<<< + * # initialize gpu arrays * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice */ - goto __pyx_L3; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L23_bool_binop_done; } + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_use_cuda); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 336, __pyx_L1_error) + __pyx_t_1 = __pyx_t_5; + __pyx_L23_bool_binop_done:; + if (__pyx_t_1) { - /* "View.MemoryView":730 - * p_src = &memviewsliceobj.from_slice - * else: - * slice_copy(memview, &src) # <<<<<<<<<<<<<< - * p_src = &src + /* "newanalysis/gfunction/gfunction.pyx":339 + * # initialize gpu arrays + * + * self.histo_gpu=cu.drv.mem_alloc(self.histogram.nbytes) # <<<<<<<<<<<<<< + * cu.drv.memcpy_htod(self.histo_gpu, self.histogram) * */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_cu); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_drv); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_4}; + __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_gpu, __pyx_t_11) < 0) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "View.MemoryView":731 - * else: - * slice_copy(memview, &src) - * p_src = &src # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":340 * + * self.histo_gpu=cu.drv.mem_alloc(self.histogram.nbytes) + * cu.drv.memcpy_htod(self.histo_gpu, self.histogram) # <<<<<<<<<<<<<< * + * self.box_dim_gpu=cu.drv.mem_alloc(self.box_dim.nbytes) */ - __pyx_v_p_src = (&__pyx_v_src); - } - __pyx_L3:; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_cu); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_drv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_gpu); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_9}; + __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 2+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "View.MemoryView":737 - * + /* "newanalysis/gfunction/gfunction.pyx":342 + * cu.drv.memcpy_htod(self.histo_gpu, self.histogram) * - * dst.memview = p_src.memview # <<<<<<<<<<<<<< - * dst.data = p_src.data + * self.box_dim_gpu=cu.drv.mem_alloc(self.box_dim.nbytes) # <<<<<<<<<<<<<< + * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) * */ - __pyx_t_4 = __pyx_v_p_src->memview; - __pyx_v_dst.memview = __pyx_t_4; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_cu); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_drv); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_4}; + __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_box_dim_gpu, __pyx_t_11) < 0) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "View.MemoryView":738 - * - * dst.memview = p_src.memview - * dst.data = p_src.data # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":343 * + * self.box_dim_gpu=cu.drv.mem_alloc(self.box_dim.nbytes) + * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) # <<<<<<<<<<<<<< * + * arr_sel1 = np.zeros((self.n1,3),dtype=np.float32) */ - __pyx_t_5 = __pyx_v_p_src->data; - __pyx_v_dst.data = __pyx_t_5; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_cu); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_drv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim_gpu); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_9}; + __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 2+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "View.MemoryView":743 - * + /* "newanalysis/gfunction/gfunction.pyx":345 + * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) * - * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< - * cdef int *p_suboffset_dim = &suboffset_dim - * cdef Py_ssize_t start, stop, step + * arr_sel1 = np.zeros((self.n1,3),dtype=np.float32) # <<<<<<<<<<<<<< + * arr_sel2 = np.zeros((self.n2,3),dtype=np.float32) + * self.coor_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) */ - __pyx_v_p_dst = (&__pyx_v_dst); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11)) __PYX_ERR(0, 345, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_3)) __PYX_ERR(0, 345, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9)) __PYX_ERR(0, 345, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_arr_sel1 = __pyx_t_3; + __pyx_t_3 = 0; - /* "View.MemoryView":744 + /* "newanalysis/gfunction/gfunction.pyx":346 * - * cdef __Pyx_memviewslice *p_dst = &dst - * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< - * cdef Py_ssize_t start, stop, step - * cdef bint have_start, have_stop, have_step + * arr_sel1 = np.zeros((self.n1,3),dtype=np.float32) + * arr_sel2 = np.zeros((self.n2,3),dtype=np.float32) # <<<<<<<<<<<<<< + * self.coor_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) + * self.coor_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) */ - __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_int_3)) __PYX_ERR(0, 346, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11)) __PYX_ERR(0, 346, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_v_arr_sel2 = __pyx_t_4; + __pyx_t_4 = 0; - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step + /* "newanalysis/gfunction/gfunction.pyx":347 + * arr_sel1 = np.zeros((self.n1,3),dtype=np.float32) + * arr_sel2 = np.zeros((self.n2,3),dtype=np.float32) + * self.coor_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) # <<<<<<<<<<<<<< + * self.coor_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( */ - __pyx_t_6 = 0; - if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 748, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_cu); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_drv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 748, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } - } else { - __pyx_t_9 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_9)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 748, __pyx_L1_error) - } - break; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr_sel1, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + __pyx_t_10 = 1; } - __Pyx_GOTREF(__pyx_t_9); } - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_v_dim = __pyx_t_6; - __pyx_t_6 = (__pyx_t_6 + 1); + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_3}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel1_gpu, __pyx_t_4) < 0) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":749 + /* "newanalysis/gfunction/gfunction.pyx":348 + * arr_sel2 = np.zeros((self.n2,3),dtype=np.float32) + * self.coor_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) + * self.coor_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) # <<<<<<<<<<<<<< * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: */ - __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0); - if (__pyx_t_2) { + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_cu); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_drv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr_sel2, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_3}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel2_gpu, __pyx_t_4) < 0) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":753 - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<< - * 0, 0, 0, # have_{start,stop,step} - * False) + /* "newanalysis/gfunction/gfunction.pyx":350 + * self.coor_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) + * + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< + * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: */ - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 753, __pyx_L1_error) + __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); + if (!__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L26_bool_binop_done; + } + __pyx_t_5 = ((__pyx_v_mode_sel & 4) != 0); + if (!__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L26_bool_binop_done; + } + __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); + if (!__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L26_bool_binop_done; + } + __pyx_t_5 = ((__pyx_v_mode_sel & 32) != 0); + __pyx_t_1 = __pyx_t_5; + __pyx_L26_bool_binop_done:; + if (__pyx_t_1) { - /* "View.MemoryView":750 - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + /* "newanalysis/gfunction/gfunction.pyx":351 + * + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) # <<<<<<<<<<<<<< + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: + * self.dip_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 750, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_cu); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_drv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr_sel1, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_3}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel1_gpu, __pyx_t_4) < 0) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":749 + /* "newanalysis/gfunction/gfunction.pyx":350 + * self.coor_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< + * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: */ - goto __pyx_L6; } - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - */ - __pyx_t_2 = (__pyx_v_index == Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":757 - * False) - * elif index is None: - * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - */ - (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - - /* "View.MemoryView":758 - * elif index is None: - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 - */ - (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - - /* "View.MemoryView":759 - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< - * new_ndim += 1 - * else: - */ - (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; - - /* "View.MemoryView":760 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 # <<<<<<<<<<<<<< - * else: - * start = index.start or 0 - */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 + /* "newanalysis/gfunction/gfunction.pyx":352 + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< + * self.dip_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) + * */ - goto __pyx_L6; + __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); + if (!__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L31_bool_binop_done; } + __pyx_t_5 = ((__pyx_v_mode_sel & 8) != 0); + if (!__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L31_bool_binop_done; + } + __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); + if (!__pyx_t_5) { + } else { + __pyx_t_1 = __pyx_t_5; + goto __pyx_L31_bool_binop_done; + } + __pyx_t_5 = ((__pyx_v_mode_sel & 64) != 0); + __pyx_t_1 = __pyx_t_5; + __pyx_L31_bool_binop_done:; + if (__pyx_t_1) { - /* "View.MemoryView":762 - * new_ndim += 1 - * else: - * start = index.start or 0 # <<<<<<<<<<<<<< - * stop = index.stop or 0 - * step = index.step or 0 - */ - /*else*/ { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L7_bool_binop_done:; - __pyx_v_start = __pyx_t_10; - - /* "View.MemoryView":763 - * else: - * start = index.start or 0 - * stop = index.stop or 0 # <<<<<<<<<<<<<< - * step = index.step or 0 + /* "newanalysis/gfunction/gfunction.pyx":353 + * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: + * self.dip_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) # <<<<<<<<<<<<<< * + * # set gpu block and grid */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 763, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 763, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 763, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L9_bool_binop_done; - } + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_cu); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_drv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_mem_alloc); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr_sel2, __pyx_n_s_nbytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = NULL; __pyx_t_10 = 0; - __pyx_L9_bool_binop_done:; - __pyx_v_stop = __pyx_t_10; - - /* "View.MemoryView":764 - * start = index.start or 0 - * stop = index.stop or 0 - * step = index.step or 0 # <<<<<<<<<<<<<< - * - * have_start = index.start is not None - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 764, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 764, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L11_bool_binop_done; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + __pyx_t_10 = 1; + } } - __pyx_t_10 = 0; - __pyx_L11_bool_binop_done:; - __pyx_v_step = __pyx_t_10; - - /* "View.MemoryView":766 - * step = index.step or 0 - * - * have_start = index.start is not None # <<<<<<<<<<<<<< - * have_stop = index.stop is not None - * have_step = index.step is not None - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_start = __pyx_t_1; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_3}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel2_gpu, __pyx_t_4) < 0) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":767 - * - * have_start = index.start is not None - * have_stop = index.stop is not None # <<<<<<<<<<<<<< - * have_step = index.step is not None + /* "newanalysis/gfunction/gfunction.pyx":352 + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * self.dip_sel1_gpu = cu.drv.mem_alloc(arr_sel1.nbytes) + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< + * self.dip_sel2_gpu = cu.drv.mem_alloc(arr_sel2.nbytes) * */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 767, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_stop = __pyx_t_1; + } - /* "View.MemoryView":768 - * have_start = index.start is not None - * have_stop = index.stop is not None - * have_step = index.step is not None # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":356 * - * slice_memviewslice( + * # set gpu block and grid + * block_x = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 # <<<<<<<<<<<<<< + * block_y = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 + * block_z = 1 */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_cu); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_dev); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_attribute); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_cu); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_drv); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_device_attribute); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_MULTIPROCESSOR_COUNT); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_9}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_step = __pyx_t_1; - - /* "View.MemoryView":770 - * have_step = index.step is not None - * - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 770, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __pyx_t_11 = __Pyx_PyInt_MultiplyObjC(__pyx_t_4, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_block_x = __pyx_t_11; + __pyx_t_11 = 0; - /* "View.MemoryView":776 - * have_start, have_stop, have_step, - * True) - * new_ndim += 1 # <<<<<<<<<<<<<< - * - * if isinstance(memview, _memoryviewslice): + /* "newanalysis/gfunction/gfunction.pyx":357 + * # set gpu block and grid + * block_x = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 + * block_y = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 # <<<<<<<<<<<<<< + * block_z = 1 + * grid_x = int(self.n1/block_x) */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_cu); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dev); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_get_attribute); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_cu); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_drv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_device_attribute); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_MULTIPROCESSOR_COUNT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_10 = 1; + } } - __pyx_L6:; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_3}; + __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_4 = __Pyx_PyInt_MultiplyObjC(__pyx_t_11, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_v_block_y = __pyx_t_4; + __pyx_t_4 = 0; - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step - * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( + /* "newanalysis/gfunction/gfunction.pyx":358 + * block_x = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 + * block_y = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 + * block_z = 1 # <<<<<<<<<<<<<< + * grid_x = int(self.n1/block_x) + * if self.n1%block_x: grid_x+=1 */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_block_z = 1; - /* "View.MemoryView":778 - * new_ndim += 1 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, + /* "newanalysis/gfunction/gfunction.pyx":359 + * block_y = cu.dev.get_attribute(cu.drv.device_attribute.MULTIPROCESSOR_COUNT) * 2 + * block_z = 1 + * grid_x = int(self.n1/block_x) # <<<<<<<<<<<<<< + * if self.n1%block_x: grid_x+=1 + * grid_y = int(self.n2/block_y) */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_block_x); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_v_grid_x = __pyx_t_4; + __pyx_t_4 = 0; - /* "View.MemoryView":779 - * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, + /* "newanalysis/gfunction/gfunction.pyx":360 + * block_z = 1 + * grid_x = int(self.n1/block_x) + * if self.n1%block_x: grid_x+=1 # <<<<<<<<<<<<<< + * grid_y = int(self.n2/block_y) + * if self.n2%block_y: grid_y+=1 */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = PyNumber_Remainder(__pyx_t_4, __pyx_v_block_x); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 360, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_1) { + __pyx_t_11 = __Pyx_PyInt_AddObjC(__pyx_v_grid_x, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF_SET(__pyx_v_grid_x, __pyx_t_11); + __pyx_t_11 = 0; + } - /* "View.MemoryView":780 - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< - * memviewsliceobj.to_dtype_func, - * memview.dtype_is_object) + /* "newanalysis/gfunction/gfunction.pyx":361 + * grid_x = int(self.n1/block_x) + * if self.n1%block_x: grid_x+=1 + * grid_y = int(self.n2/block_y) # <<<<<<<<<<<<<< + * if self.n2%block_y: grid_y+=1 + * self.block=(block_x,block_y,block_z) */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 780, __pyx_L1_error) } + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_11, __pyx_v_block_y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_grid_y = __pyx_t_11; + __pyx_t_11 = 0; - /* "View.MemoryView":781 - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * else: + /* "newanalysis/gfunction/gfunction.pyx":362 + * if self.n1%block_x: grid_x+=1 + * grid_y = int(self.n2/block_y) + * if self.n2%block_y: grid_y+=1 # <<<<<<<<<<<<<< + * self.block=(block_x,block_y,block_z) + * self.grid=(grid_x,grid_y) */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 781, __pyx_L1_error) } + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = PyNumber_Remainder(__pyx_t_11, __pyx_v_block_y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_grid_y, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 362, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_grid_y, __pyx_t_4); + __pyx_t_4 = 0; + } - /* "View.MemoryView":779 + /* "newanalysis/gfunction/gfunction.pyx":363 + * grid_y = int(self.n2/block_y) + * if self.n2%block_y: grid_y+=1 + * self.block=(block_x,block_y,block_z) # <<<<<<<<<<<<<< + * self.grid=(grid_x,grid_y) * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 779, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 779, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_block_z); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_v_block_x); + __Pyx_GIVEREF(__pyx_v_block_x); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_block_x)) __PYX_ERR(0, 363, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_block_y); + __Pyx_GIVEREF(__pyx_v_block_y); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_block_y)) __PYX_ERR(0, 363, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_4)) __PYX_ERR(0, 363, __pyx_L1_error); + __pyx_t_4 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_block, __pyx_t_11) < 0) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "View.MemoryView":778 - * new_ndim += 1 + /* "newanalysis/gfunction/gfunction.pyx":364 + * if self.n2%block_y: grid_y+=1 + * self.block=(block_x,block_y,block_z) + * self.grid=(grid_x,grid_y) # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - */ - } - - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) * */ - /*else*/ { - __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_v_grid_x); + __Pyx_GIVEREF(__pyx_v_grid_x); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_grid_x)) __PYX_ERR(0, 364, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_grid_y); + __Pyx_GIVEREF(__pyx_v_grid_y); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_grid_y)) __PYX_ERR(0, 364, __pyx_L1_error); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_grid, __pyx_t_11) < 0) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "View.MemoryView":785 - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, - * memview.dtype_is_object) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":336 * + * # print, if CUDA device will be used and initialize arrays + * if self.cuda and use_cuda: # <<<<<<<<<<<<<< + * # initialize gpu arrays * */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * - */ - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 784, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; } - /* "View.MemoryView":712 + /* "newanalysis/gfunction/gfunction.pyx":234 + * """ * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step + * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False, norm_volume=None): # <<<<<<<<<<<<<< + * """ + * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("newanalysis.gfunction.RDF.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XDECREF(__pyx_v_arr_sel1); + __Pyx_XDECREF(__pyx_v_arr_sel2); + __Pyx_XDECREF(__pyx_v_block_x); + __Pyx_XDECREF(__pyx_v_block_y); + __Pyx_XDECREF(__pyx_v_grid_x); + __Pyx_XDECREF(__pyx_v_grid_y); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":809 +/* "newanalysis/gfunction/gfunction.pyx":367 * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + * + * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< + * """ + * update_box(box_x,box_y,box_z) */ -static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { - Py_ssize_t __pyx_v_new_shape; - int __pyx_v_negative_step; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_3update_box(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_3RDF_2update_box, "\n update_box(box_x,box_y,box_z)\n\n Update the box dimensions, when analysing NpT trajectories.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_3update_box = {"update_box", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_3update_box, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF_2update_box}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_3update_box(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_box_x = 0; + PyObject *__pyx_v_box_y = 0; + PyObject *__pyx_v_box_z = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("update_box (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 367, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_box_x,&__pyx_n_s_box_y,&__pyx_n_s_box_z,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_x)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 1); __PYX_ERR(0, 367, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_y)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 2); __PYX_ERR(0, 367, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_z)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 3); __PYX_ERR(0, 367, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "update_box") < 0)) __PYX_ERR(0, 367, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_self = values[0]; + __pyx_v_box_x = values[1]; + __pyx_v_box_y = values[2]; + __pyx_v_box_z = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 367, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF.update_box", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_2update_box(__pyx_self, __pyx_v_self, __pyx_v_box_x, __pyx_v_box_y, __pyx_v_box_z); - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< - * - * if start < 0: - */ - __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_1) { + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":831 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: - */ - __pyx_t_1 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_1) { +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_2update_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_box", 0); - /* "View.MemoryView":832 - * - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) + /* "newanalysis/gfunction/gfunction.pyx":373 + * Update the box dimensions, when analysing NpT trajectories. + * """ + * self.box_dim[0] = box_x # <<<<<<<<<<<<<< + * self.box_dim[3] = box_x/2.0 + * self.box_dim[1] = box_y */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, 0, __pyx_v_box_x, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":831 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: + /* "newanalysis/gfunction/gfunction.pyx":374 + * """ + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 # <<<<<<<<<<<<<< + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 */ - } + __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_x, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 374, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - * else: + /* "newanalysis/gfunction/gfunction.pyx":375 + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 + * self.box_dim[1] = box_y # <<<<<<<<<<<<<< + * self.box_dim[4] = box_y/2.0 + * self.box_dim[2] = box_z */ - __pyx_t_1 = (0 <= __pyx_v_start); - if (__pyx_t_1) { - __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); - } - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, 1, __pyx_v_box_y, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":834 - * start += shape - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< - * else: - * + /* "newanalysis/gfunction/gfunction.pyx":376 + * self.box_dim[3] = box_x/2.0 + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 # <<<<<<<<<<<<<< + * self.box_dim[2] = box_z + * self.box_dim[5] = box_z/2.0 */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 834, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_y, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - * else: + /* "newanalysis/gfunction/gfunction.pyx":377 + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 + * self.box_dim[2] = box_z # <<<<<<<<<<<<<< + * self.box_dim[5] = box_z/2.0 + * */ - } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, 2, __pyx_v_box_z, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":378 + * self.box_dim[4] = box_y/2.0 + * self.box_dim[2] = box_z + * self.box_dim[5] = box_z/2.0 # <<<<<<<<<<<<<< * - * if start < 0: + * if self.cuda: */ - goto __pyx_L3; - } + __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_z, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_t_2, 5, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":837 - * else: + /* "newanalysis/gfunction/gfunction.pyx":380 + * self.box_dim[5] = box_z/2.0 * - * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< + * if self.cuda: # <<<<<<<<<<<<<< + * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) * - * if have_step and step == 0: */ - /*else*/ { - __pyx_t_1 = ((__pyx_v_have_step != 0) != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_1 = ((__pyx_v_step < 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L6_bool_binop_done:; - __pyx_v_negative_step = __pyx_t_2; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 + /* "newanalysis/gfunction/gfunction.pyx":381 * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + * if self.cuda: + * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) # <<<<<<<<<<<<<< * + * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] */ - __pyx_t_1 = (__pyx_v_have_step != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L9_bool_binop_done; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cu); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_drv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim_gpu); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_7 = 1; + } } - __pyx_t_1 = ((__pyx_v_step == 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L9_bool_binop_done:; - if (__pyx_t_2) { + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":840 - * - * if have_step and step == 0: - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":380 + * self.box_dim[5] = box_z/2.0 * + * if self.cuda: # <<<<<<<<<<<<<< + * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) * */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 840, __pyx_L1_error) + } - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 + /* "newanalysis/gfunction/gfunction.pyx":383 + * cu.drv.memcpy_htod(self.box_dim_gpu, self.box_dim) * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] # <<<<<<<<<<<<<< * + * def calcFrame(self, */ - } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_volume, __pyx_t_5) < 0) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":843 + /* "newanalysis/gfunction/gfunction.pyx":367 * * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape + * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< + * """ + * update_box(box_x,box_y,box_z) */ - __pyx_t_2 = (__pyx_v_have_start != 0); - if (__pyx_t_2) { - /* "View.MemoryView":844 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("newanalysis.gfunction.RDF.update_box", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/gfunction/gfunction.pyx":385 + * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: + * def calcFrame(self, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":845 - * if have_start: - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if start < 0: - * start = 0 - */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_5calcFrame(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_3RDF_4calcFrame, "\n calcFrame(coor_sel1, coor_sel2, dip_sel1=None, dip_sel2=None,\n pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, \n pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None)\n\n Args:\n coor_sel1 .. numpy-array (dtype=numpy.float64, ndim=2, mode=\"c\") containing the coordinates of the first selection\n coor_sel2 .. numpy-array containing the coordinates of the second selection\n dip_sel1 .. numpy-array containing the dipoles of the first selection (optional, only needed for 110, 101, 220 and 202)\n dip_sel2 .. numpy-array containing the dipoles of the second selection (optional, only needed for 110, 011, 220 and 022)\n\n pre-allocated arrays: PyCUDA GPU array objects obtained from drv.memalloc()\n\n Pass the data needed to calculate the RDF for the current frame and do the calculation.\n Optionally, pre-allocated arrays on the GPU can be used. This is useful, if they are reused for more than\n one rdf calculation.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_5calcFrame = {"calcFrame", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_5calcFrame, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF_4calcFrame}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_5calcFrame(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyArrayObject *__pyx_v_coor_sel1 = 0; + PyArrayObject *__pyx_v_coor_sel2 = 0; + PyArrayObject *__pyx_v_dip_sel1 = 0; + PyArrayObject *__pyx_v_dip_sel2 = 0; + PyObject *__pyx_v_pre_coor_sel1_gpu = 0; + PyObject *__pyx_v_pre_coor_sel2_gpu = 0; + PyObject *__pyx_v_pre_dip_sel1_gpu = 0; + PyObject *__pyx_v_pre_dip_sel2_gpu = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcFrame (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 385, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_coor_sel1,&__pyx_n_s_coor_sel2,&__pyx_n_s_dip_sel1,&__pyx_n_s_dip_sel2,&__pyx_n_s_pre_coor_sel1_gpu,&__pyx_n_s_pre_coor_sel2_gpu,&__pyx_n_s_pre_dip_sel1_gpu,&__pyx_n_s_pre_dip_sel2_gpu,0}; - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "newanalysis/gfunction/gfunction.pyx":388 + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, + * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { + values[3] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((PyArrayObject *)Py_None)); - /* "View.MemoryView":847 - * start += shape - * if start < 0: - * start = 0 # <<<<<<<<<<<<<< - * elif start >= shape: - * if negative_step: + /* "newanalysis/gfunction/gfunction.pyx":389 + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, # <<<<<<<<<<<<<< + * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, + * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): */ - __pyx_v_start = 0; + values[4] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((PyArrayObject *)Py_None)); - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "newanalysis/gfunction/gfunction.pyx":390 + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, + * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, # <<<<<<<<<<<<<< + * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): + * """ */ - } + values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); - /* "View.MemoryView":844 - * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: + /* "newanalysis/gfunction/gfunction.pyx":391 + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, + * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, + * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): # <<<<<<<<<<<<<< + * """ + * calcFrame(coor_sel1, coor_sel2, dip_sel1=None, dip_sel2=None, */ - goto __pyx_L12; + values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[8] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 - */ - __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":850 - * elif start >= shape: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = shape - */ - __pyx_v_start = (__pyx_v_shape - 1); - - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - goto __pyx_L14; + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } - - /* "View.MemoryView":852 - * start = shape - 1 - * else: - * start = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: - */ - /*else*/ { - __pyx_v_start = __pyx_v_shape; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_sel1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 3, 9, 1); __PYX_ERR(0, 385, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_sel2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 3, 9, 2); __PYX_ERR(0, 385, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_sel1); + if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_sel2); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pre_coor_sel1_gpu); + if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pre_coor_sel2_gpu); + if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pre_dip_sel1_gpu); + if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pre_dip_sel2_gpu); + if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L3_error) } - __pyx_L14:; - - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 - */ } - __pyx_L12:; - - /* "View.MemoryView":843 - * - * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape - */ - goto __pyx_L11; - } - - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":855 - * else: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = 0 - */ - __pyx_v_start = (__pyx_v_shape - 1); - - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - goto __pyx_L15; + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcFrame") < 0)) __PYX_ERR(0, 385, __pyx_L3_error) } - - /* "View.MemoryView":857 - * start = shape - 1 - * else: - * start = 0 # <<<<<<<<<<<<<< - * - * if have_stop: - */ - /*else*/ { - __pyx_v_start = 0; + } else { + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } - __pyx_L15:; } - __pyx_L11:; - - /* "View.MemoryView":859 - * start = 0 - * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape - */ - __pyx_t_2 = (__pyx_v_have_stop != 0); - if (__pyx_t_2) { + __pyx_v_self = values[0]; + __pyx_v_coor_sel1 = ((PyArrayObject *)values[1]); + __pyx_v_coor_sel2 = ((PyArrayObject *)values[2]); + __pyx_v_dip_sel1 = ((PyArrayObject *)values[3]); + __pyx_v_dip_sel2 = ((PyArrayObject *)values[4]); + __pyx_v_pre_coor_sel1_gpu = values[5]; + __pyx_v_pre_coor_sel2_gpu = values[6]; + __pyx_v_pre_dip_sel1_gpu = values[7]; + __pyx_v_pre_dip_sel2_gpu = values[8]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 3, 9, __pyx_nargs); __PYX_ERR(0, 385, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF.calcFrame", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_sel1), __pyx_ptype_5numpy_ndarray, 1, "coor_sel1", 0))) __PYX_ERR(0, 386, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_sel2), __pyx_ptype_5numpy_ndarray, 1, "coor_sel2", 0))) __PYX_ERR(0, 387, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dip_sel1), __pyx_ptype_5numpy_ndarray, 1, "dip_sel1", 0))) __PYX_ERR(0, 388, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dip_sel2), __pyx_ptype_5numpy_ndarray, 1, "dip_sel2", 0))) __PYX_ERR(0, 389, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_4calcFrame(__pyx_self, __pyx_v_self, __pyx_v_coor_sel1, __pyx_v_coor_sel2, __pyx_v_dip_sel1, __pyx_v_dip_sel2, __pyx_v_pre_coor_sel1_gpu, __pyx_v_pre_coor_sel2_gpu, __pyx_v_pre_dip_sel1_gpu, __pyx_v_pre_dip_sel2_gpu); - /* "View.MemoryView":860 + /* "newanalysis/gfunction/gfunction.pyx":385 + * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: + * def calcFrame(self, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":861 - * if have_stop: - * if stop < 0: - * stop += shape # <<<<<<<<<<<<<< - * if stop < 0: - * stop = 0 - */ - __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: - */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":863 - * stop += shape - * if stop < 0: - * stop = 0 # <<<<<<<<<<<<<< - * elif stop > shape: - * stop = shape - */ - __pyx_v_stop = 0; - - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: - */ - } - - /* "View.MemoryView":860 - * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: - */ - goto __pyx_L17; - } - - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: - */ - __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":865 - * stop = 0 - * elif stop > shape: - * stop = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: - */ - __pyx_v_stop = __pyx_v_shape; - - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: - */ - } - __pyx_L17:; - - /* "View.MemoryView":859 - * start = 0 - * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape - */ - goto __pyx_L16; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":868 - * else: - * if negative_step: - * stop = -1 # <<<<<<<<<<<<<< - * else: - * stop = shape - */ - __pyx_v_stop = -1L; - - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - goto __pyx_L19; - } - - /* "View.MemoryView":870 - * stop = -1 - * else: - * stop = shape # <<<<<<<<<<<<<< - * - * if not have_step: - */ - /*else*/ { - __pyx_v_stop = __pyx_v_shape; - } - __pyx_L19:; - } - __pyx_L16:; +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_4calcFrame(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_coor_sel1, PyArrayObject *__pyx_v_coor_sel2, PyArrayObject *__pyx_v_dip_sel1, PyArrayObject *__pyx_v_dip_sel2, PyObject *__pyx_v_pre_coor_sel1_gpu, PyObject *__pyx_v_pre_coor_sel2_gpu, PyObject *__pyx_v_pre_dip_sel1_gpu, PyObject *__pyx_v_pre_dip_sel2_gpu) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_sel1; + __Pyx_Buffer __pyx_pybuffer_coor_sel1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_sel2; + __Pyx_Buffer __pyx_pybuffer_coor_sel2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_dip_sel1; + __Pyx_Buffer __pyx_pybuffer_dip_sel1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_dip_sel2; + __Pyx_Buffer __pyx_pybuffer_dip_sel2; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_22 = NULL; + char *__pyx_t_23; + char *__pyx_t_24; + char *__pyx_t_25; + char *__pyx_t_26; + int __pyx_t_27; + float __pyx_t_28; + float __pyx_t_29; + int __pyx_t_30; + double __pyx_t_31; + int __pyx_t_32; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcFrame", 0); + __pyx_pybuffer_coor_sel1.pybuffer.buf = NULL; + __pyx_pybuffer_coor_sel1.refcount = 0; + __pyx_pybuffernd_coor_sel1.data = NULL; + __pyx_pybuffernd_coor_sel1.rcbuffer = &__pyx_pybuffer_coor_sel1; + __pyx_pybuffer_coor_sel2.pybuffer.buf = NULL; + __pyx_pybuffer_coor_sel2.refcount = 0; + __pyx_pybuffernd_coor_sel2.data = NULL; + __pyx_pybuffernd_coor_sel2.rcbuffer = &__pyx_pybuffer_coor_sel2; + __pyx_pybuffer_dip_sel1.pybuffer.buf = NULL; + __pyx_pybuffer_dip_sel1.refcount = 0; + __pyx_pybuffernd_dip_sel1.data = NULL; + __pyx_pybuffernd_dip_sel1.rcbuffer = &__pyx_pybuffer_dip_sel1; + __pyx_pybuffer_dip_sel2.pybuffer.buf = NULL; + __pyx_pybuffer_dip_sel2.refcount = 0; + __pyx_pybuffernd_dip_sel2.data = NULL; + __pyx_pybuffernd_dip_sel2.rcbuffer = &__pyx_pybuffer_dip_sel2; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_sel1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 385, __pyx_L1_error) + } + __pyx_pybuffernd_coor_sel1.diminfo[0].strides = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_sel1.diminfo[0].shape = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_sel1.diminfo[1].strides = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_sel1.diminfo[1].shape = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_sel2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 385, __pyx_L1_error) + } + __pyx_pybuffernd_coor_sel2.diminfo[0].strides = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_sel2.diminfo[0].shape = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_sel2.diminfo[1].strides = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_sel2.diminfo[1].shape = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer, (PyObject*)__pyx_v_dip_sel1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 385, __pyx_L1_error) + } + __pyx_pybuffernd_dip_sel1.diminfo[0].strides = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dip_sel1.diminfo[0].shape = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dip_sel1.diminfo[1].strides = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dip_sel1.diminfo[1].shape = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dip_sel2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 385, __pyx_L1_error) + } + __pyx_pybuffernd_dip_sel2.diminfo[0].strides = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dip_sel2.diminfo[0].shape = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dip_sel2.diminfo[1].strides = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dip_sel2.diminfo[1].shape = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.shape[1]; - /* "View.MemoryView":872 - * stop = shape + /* "newanalysis/gfunction/gfunction.pyx":411 * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 + * # Check if dipole moments are needed and, if yes, were passed + * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): # <<<<<<<<<<<<<< + * raise TypeError("No dipole moment array for the fist selection was passed, although the requested gfunctions need it!") * */ - __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_2 = (((PyObject *)__pyx_v_dip_sel1) == Py_None); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 2) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 4) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 16) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 32) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":873 - * - * if not have_step: - * step = 1 # <<<<<<<<<<<<<< - * + /* "newanalysis/gfunction/gfunction.pyx":412 + * # Check if dipole moments are needed and, if yes, were passed + * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): + * raise TypeError("No dipole moment array for the fist selection was passed, although the requested gfunctions need it!") # <<<<<<<<<<<<<< * + * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): */ - __pyx_v_step = 1; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 412, __pyx_L1_error) - /* "View.MemoryView":872 - * stop = shape + /* "newanalysis/gfunction/gfunction.pyx":411 * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 + * # Check if dipole moments are needed and, if yes, were passed + * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): # <<<<<<<<<<<<<< + * raise TypeError("No dipole moment array for the fist selection was passed, although the requested gfunctions need it!") * */ - } + } - /* "View.MemoryView":877 + /* "newanalysis/gfunction/gfunction.pyx":414 + * raise TypeError("No dipole moment array for the fist selection was passed, although the requested gfunctions need it!") * - * with cython.cdivision(True): - * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): # <<<<<<<<<<<<<< + * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") * - * if (stop - start) - step * new_shape: */ - __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + __pyx_t_2 = (((PyObject *)__pyx_v_dip_sel2) == Py_None); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 2) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 8) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 16) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 64) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L10_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":879 - * new_shape = (stop - start) // step + /* "newanalysis/gfunction/gfunction.pyx":415 * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 + * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): + * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") # <<<<<<<<<<<<<< * + * if self.oneistwo is None: */ - __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); - if (__pyx_t_2) { + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 415, __pyx_L1_error) - /* "View.MemoryView":880 + /* "newanalysis/gfunction/gfunction.pyx":414 + * raise TypeError("No dipole moment array for the fist selection was passed, although the requested gfunctions need it!") * - * if (stop - start) - step * new_shape: - * new_shape += 1 # <<<<<<<<<<<<<< + * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): # <<<<<<<<<<<<<< + * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") * - * if new_shape < 0: */ - __pyx_v_new_shape = (__pyx_v_new_shape + 1); + } - /* "View.MemoryView":879 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 + /* "newanalysis/gfunction/gfunction.pyx":417 + * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") * + * if self.oneistwo is None: # <<<<<<<<<<<<<< + * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: + * self.oneistwo = True */ - } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = (__pyx_t_3 == Py_None); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { - /* "View.MemoryView":882 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 + /* "newanalysis/gfunction/gfunction.pyx":418 * + * if self.oneistwo is None: + * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: # <<<<<<<<<<<<<< + * self.oneistwo = True + * else: */ - __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0); + __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coor_sel1), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coor_sel2), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_all); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[1] = {__pyx_t_7, }; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L17_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_1 = __pyx_t_2; + __pyx_L17_bool_binop_done:; + if (__pyx_t_1) { - /* "View.MemoryView":883 - * - * if new_shape < 0: - * new_shape = 0 # <<<<<<<<<<<<<< - * - * + /* "newanalysis/gfunction/gfunction.pyx":419 + * if self.oneistwo is None: + * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: + * self.oneistwo = True # <<<<<<<<<<<<<< + * else: + * self.oneistwo = False */ - __pyx_v_new_shape = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_True) < 0) __PYX_ERR(0, 419, __pyx_L1_error) - /* "View.MemoryView":882 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 + /* "newanalysis/gfunction/gfunction.pyx":418 * + * if self.oneistwo is None: + * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: # <<<<<<<<<<<<<< + * self.oneistwo = True + * else: */ + goto __pyx_L16; } - /* "View.MemoryView":886 - * - * - * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset - */ - (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - - /* "View.MemoryView":887 - * - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< - * dst.suboffsets[new_ndim] = suboffset + /* "newanalysis/gfunction/gfunction.pyx":421 + * self.oneistwo = True + * else: + * self.oneistwo = False # <<<<<<<<<<<<<< * + * # Increment frame counter */ - (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + /*else*/ { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_False) < 0) __PYX_ERR(0, 421, __pyx_L1_error) + } + __pyx_L16:; - /* "View.MemoryView":888 - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< - * + /* "newanalysis/gfunction/gfunction.pyx":417 + * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") * + * if self.oneistwo is None: # <<<<<<<<<<<<<< + * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: + * self.oneistwo = True */ - (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; } - __pyx_L3:; - - /* "View.MemoryView":891 - * - * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: - */ - __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":892 - * - * if suboffset_dim[0] < 0: - * dst.data += start * stride # <<<<<<<<<<<<<< - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride - */ - __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); - /* "View.MemoryView":891 + /* "newanalysis/gfunction/gfunction.pyx":424 * + * # Increment frame counter + * self.ctr+=1 # <<<<<<<<<<<<<< * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: + * # add current volume to list */ - goto __pyx_L23; - } + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_7, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ctr, __pyx_t_6) < 0) __PYX_ERR(0, 424, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "View.MemoryView":894 - * dst.data += start * stride - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":427 * - * if suboffset >= 0: - */ - /*else*/ { - __pyx_t_3 = (__pyx_v_suboffset_dim[0]); - (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); - } - __pyx_L23:; - - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride + * # add current volume to list + * self.volume_list.append(self.volume) # <<<<<<<<<<<<<< * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: + * if self.cuda: */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_6, __pyx_t_7); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":897 + /* "newanalysis/gfunction/gfunction.pyx":429 + * self.volume_list.append(self.volume) * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset + * if self.cuda: # <<<<<<<<<<<<<< + * # allocate memory on cuda device and copy data to device + * if pre_coor_sel1_gpu: */ - __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 429, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_1) { - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset + /* "newanalysis/gfunction/gfunction.pyx":431 + * if self.cuda: + * # allocate memory on cuda device and copy data to device + * if pre_coor_sel1_gpu: # <<<<<<<<<<<<<< + * self.coor_sel1_gpu = pre_coor_sel1_gpu * else: */ - __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pre_coor_sel1_gpu); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 431, __pyx_L1_error) + if (__pyx_t_1) { - /* "View.MemoryView":899 - * if not is_slice: - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":432 + * # allocate memory on cuda device and copy data to device + * if pre_coor_sel1_gpu: + * self.coor_sel1_gpu = pre_coor_sel1_gpu # <<<<<<<<<<<<<< * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " + * cu.drv.memcpy_htod(self.coor_sel1_gpu, coor_sel1.astype(np.float32)) */ - __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel1_gpu, __pyx_v_pre_coor_sel1_gpu) < 0) __PYX_ERR(0, 432, __pyx_L1_error) - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset + /* "newanalysis/gfunction/gfunction.pyx":431 + * if self.cuda: + * # allocate memory on cuda device and copy data to device + * if pre_coor_sel1_gpu: # <<<<<<<<<<<<<< + * self.coor_sel1_gpu = pre_coor_sel1_gpu * else: */ - goto __pyx_L26; - } + goto __pyx_L20; + } - /* "View.MemoryView":901 - * dst.data = ( dst.data)[0] + suboffset + /* "newanalysis/gfunction/gfunction.pyx":434 + * self.coor_sel1_gpu = pre_coor_sel1_gpu * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< - * "must be indexed and not sliced", dim) - * else: + * cu.drv.memcpy_htod(self.coor_sel1_gpu, coor_sel1.astype(np.float32)) # <<<<<<<<<<<<<< + * if pre_coor_sel2_gpu: + * self.coor_sel2_gpu = pre_coor_sel2_gpu */ - /*else*/ { - - /* "View.MemoryView":902 - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< - * else: - * suboffset_dim[0] = new_ndim - */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 901, __pyx_L1_error) + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_cu); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_drv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel1_gpu); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_coor_sel1), __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float32); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; + } } - __pyx_L26:; - - /* "View.MemoryView":897 - * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset - */ - goto __pyx_L25; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_11}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_9 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_t_3, __pyx_t_5}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } + __pyx_L20:; - /* "View.MemoryView":904 - * "must be indexed and not sliced", dim) - * else: - * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< - * - * return 0 + /* "newanalysis/gfunction/gfunction.pyx":435 + * else: + * cu.drv.memcpy_htod(self.coor_sel1_gpu, coor_sel1.astype(np.float32)) + * if pre_coor_sel2_gpu: # <<<<<<<<<<<<<< + * self.coor_sel2_gpu = pre_coor_sel2_gpu + * else: */ - /*else*/ { - (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; - } - __pyx_L25:; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pre_coor_sel2_gpu); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 435, __pyx_L1_error) + if (__pyx_t_1) { - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride - * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: + /* "newanalysis/gfunction/gfunction.pyx":436 + * cu.drv.memcpy_htod(self.coor_sel1_gpu, coor_sel1.astype(np.float32)) + * if pre_coor_sel2_gpu: + * self.coor_sel2_gpu = pre_coor_sel2_gpu # <<<<<<<<<<<<<< + * else: + * cu.drv.memcpy_htod(self.coor_sel2_gpu, coor_sel2.astype(np.float32)) */ - } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel2_gpu, __pyx_v_pre_coor_sel2_gpu) < 0) __PYX_ERR(0, 436, __pyx_L1_error) - /* "View.MemoryView":906 - * suboffset_dim[0] = new_ndim - * - * return 0 # <<<<<<<<<<<<<< - * - * + /* "newanalysis/gfunction/gfunction.pyx":435 + * else: + * cu.drv.memcpy_htod(self.coor_sel1_gpu, coor_sel1.astype(np.float32)) + * if pre_coor_sel2_gpu: # <<<<<<<<<<<<<< + * self.coor_sel2_gpu = pre_coor_sel2_gpu + * else: */ - __pyx_r = 0; - goto __pyx_L0; + goto __pyx_L21; + } - /* "View.MemoryView":809 - * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + /* "newanalysis/gfunction/gfunction.pyx":438 + * self.coor_sel2_gpu = pre_coor_sel2_gpu + * else: + * cu.drv.memcpy_htod(self.coor_sel2_gpu, coor_sel2.astype(np.float32)) # <<<<<<<<<<<<<< + * # if no dipole information was given, just point at the coordinates instead to keep the gpu function happy + * if dip_sel1 is not None: */ + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_cu); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_drv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel2_gpu); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_coor_sel2), __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float32); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_10}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_9 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_t_5, __pyx_t_3}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 438, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_L21:; - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = -1; - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":912 - * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 + /* "newanalysis/gfunction/gfunction.pyx":440 + * cu.drv.memcpy_htod(self.coor_sel2_gpu, coor_sel2.astype(np.float32)) + * # if no dipole information was given, just point at the coordinates instead to keep the gpu function happy + * if dip_sel1 is not None: # <<<<<<<<<<<<<< + * if pre_dip_sel1_gpu: + * self.dip_sel1_gpu = pre_dip_sel1_gpu */ + __pyx_t_1 = (((PyObject *)__pyx_v_dip_sel1) != Py_None); + if (__pyx_t_1) { -static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_suboffset; - Py_ssize_t __pyx_v_itemsize; - char *__pyx_v_resultp; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pybuffer_index", 0); + /* "newanalysis/gfunction/gfunction.pyx":441 + * # if no dipole information was given, just point at the coordinates instead to keep the gpu function happy + * if dip_sel1 is not None: + * if pre_dip_sel1_gpu: # <<<<<<<<<<<<<< + * self.dip_sel1_gpu = pre_dip_sel1_gpu + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pre_dip_sel1_gpu); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 441, __pyx_L1_error) + if (__pyx_t_1) { - /* "View.MemoryView":914 - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< - * cdef Py_ssize_t itemsize = view.itemsize - * cdef char *resultp + /* "newanalysis/gfunction/gfunction.pyx":442 + * if dip_sel1 is not None: + * if pre_dip_sel1_gpu: + * self.dip_sel1_gpu = pre_dip_sel1_gpu # <<<<<<<<<<<<<< + * else: + * cu.drv.memcpy_htod(self.dip_sel1_gpu, dip_sel1.astype(np.float32)) */ - __pyx_v_suboffset = -1L; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel1_gpu, __pyx_v_pre_dip_sel1_gpu) < 0) __PYX_ERR(0, 442, __pyx_L1_error) - /* "View.MemoryView":915 - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< - * cdef char *resultp - * + /* "newanalysis/gfunction/gfunction.pyx":441 + * # if no dipole information was given, just point at the coordinates instead to keep the gpu function happy + * if dip_sel1 is not None: + * if pre_dip_sel1_gpu: # <<<<<<<<<<<<<< + * self.dip_sel1_gpu = pre_dip_sel1_gpu + * else: */ - __pyx_t_1 = __pyx_v_view->itemsize; - __pyx_v_itemsize = __pyx_t_1; + goto __pyx_L23; + } - /* "View.MemoryView":918 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + /* "newanalysis/gfunction/gfunction.pyx":444 + * self.dip_sel1_gpu = pre_dip_sel1_gpu + * else: + * cu.drv.memcpy_htod(self.dip_sel1_gpu, dip_sel1.astype(np.float32)) # <<<<<<<<<<<<<< + * else: + * self.dip_sel1_gpu = self.coor_sel1_gpu */ - __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0); - if (__pyx_t_2) { + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_cu); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_drv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel1_gpu); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dip_sel1), __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float32); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_11}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_9 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_t_3, __pyx_t_5}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_L23:; - /* "View.MemoryView":919 - * - * if view.ndim == 0: - * shape = view.len / itemsize # <<<<<<<<<<<<<< - * stride = itemsize - * else: + /* "newanalysis/gfunction/gfunction.pyx":440 + * cu.drv.memcpy_htod(self.coor_sel2_gpu, coor_sel2.astype(np.float32)) + * # if no dipole information was given, just point at the coordinates instead to keep the gpu function happy + * if dip_sel1 is not None: # <<<<<<<<<<<<<< + * if pre_dip_sel1_gpu: + * self.dip_sel1_gpu = pre_dip_sel1_gpu */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 919, __pyx_L1_error) + goto __pyx_L22; } - __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); - /* "View.MemoryView":920 - * if view.ndim == 0: - * shape = view.len / itemsize - * stride = itemsize # <<<<<<<<<<<<<< - * else: - * shape = view.shape[dim] + /* "newanalysis/gfunction/gfunction.pyx":446 + * cu.drv.memcpy_htod(self.dip_sel1_gpu, dip_sel1.astype(np.float32)) + * else: + * self.dip_sel1_gpu = self.coor_sel1_gpu # <<<<<<<<<<<<<< + * if dip_sel2 is not None: + * if pre_dip_sel2_gpu: */ - __pyx_v_stride = __pyx_v_itemsize; + /*else*/ { + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel1_gpu); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel1_gpu, __pyx_t_7) < 0) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_L22:; - /* "View.MemoryView":918 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + /* "newanalysis/gfunction/gfunction.pyx":447 + * else: + * self.dip_sel1_gpu = self.coor_sel1_gpu + * if dip_sel2 is not None: # <<<<<<<<<<<<<< + * if pre_dip_sel2_gpu: + * self.dip_sel2_gpu = pre_dip_sel2_gpu */ - goto __pyx_L3; - } + __pyx_t_1 = (((PyObject *)__pyx_v_dip_sel2) != Py_None); + if (__pyx_t_1) { - /* "View.MemoryView":922 - * stride = itemsize - * else: - * shape = view.shape[dim] # <<<<<<<<<<<<<< - * stride = view.strides[dim] - * if view.suboffsets != NULL: + /* "newanalysis/gfunction/gfunction.pyx":448 + * self.dip_sel1_gpu = self.coor_sel1_gpu + * if dip_sel2 is not None: + * if pre_dip_sel2_gpu: # <<<<<<<<<<<<<< + * self.dip_sel2_gpu = pre_dip_sel2_gpu + * else: */ - /*else*/ { - __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pre_dip_sel2_gpu); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 448, __pyx_L1_error) + if (__pyx_t_1) { - /* "View.MemoryView":923 - * else: - * shape = view.shape[dim] - * stride = view.strides[dim] # <<<<<<<<<<<<<< - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] + /* "newanalysis/gfunction/gfunction.pyx":449 + * if dip_sel2 is not None: + * if pre_dip_sel2_gpu: + * self.dip_sel2_gpu = pre_dip_sel2_gpu # <<<<<<<<<<<<<< + * else: + * cu.drv.memcpy_htod(self.dip_sel2_gpu, dip_sel2.astype(np.float32)) */ - __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel2_gpu, __pyx_v_pre_dip_sel2_gpu) < 0) __PYX_ERR(0, 449, __pyx_L1_error) - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * + /* "newanalysis/gfunction/gfunction.pyx":448 + * self.dip_sel1_gpu = self.coor_sel1_gpu + * if dip_sel2 is not None: + * if pre_dip_sel2_gpu: # <<<<<<<<<<<<<< + * self.dip_sel2_gpu = pre_dip_sel2_gpu + * else: */ - __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0); - if (__pyx_t_2) { + goto __pyx_L25; + } - /* "View.MemoryView":925 - * stride = view.strides[dim] - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< - * - * if index < 0: + /* "newanalysis/gfunction/gfunction.pyx":451 + * self.dip_sel2_gpu = pre_dip_sel2_gpu + * else: + * cu.drv.memcpy_htod(self.dip_sel2_gpu, dip_sel2.astype(np.float32)) # <<<<<<<<<<<<<< + * else: + * self.dip_sel2_gpu = self.coor_sel2_gpu */ - __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_cu); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_drv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_memcpy_htod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel2_gpu); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dip_sel2), __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float32); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_10}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_9 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_t_5, __pyx_t_3}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_L25:; - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * + /* "newanalysis/gfunction/gfunction.pyx":447 + * else: + * self.dip_sel1_gpu = self.coor_sel1_gpu + * if dip_sel2 is not None: # <<<<<<<<<<<<<< + * if pre_dip_sel2_gpu: + * self.dip_sel2_gpu = pre_dip_sel2_gpu */ + goto __pyx_L24; } - } - __pyx_L3:; - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] + /* "newanalysis/gfunction/gfunction.pyx":453 + * cu.drv.memcpy_htod(self.dip_sel2_gpu, dip_sel2.astype(np.float32)) + * else: + * self.dip_sel2_gpu = self.coor_sel2_gpu # <<<<<<<<<<<<<< * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: + * cu.calcHistoGPU(self.coor_sel1_gpu, self.coor_sel2_gpu, self.dip_sel1_gpu, self.dip_sel2_gpu, */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (__pyx_t_2) { + /*else*/ { + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel2_gpu); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel2_gpu, __pyx_t_7) < 0) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_L24:; - /* "View.MemoryView":928 + /* "newanalysis/gfunction/gfunction.pyx":455 + * self.dip_sel2_gpu = self.coor_sel2_gpu * - * if index < 0: - * index += view.shape[dim] # <<<<<<<<<<<<<< - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + * cu.calcHistoGPU(self.coor_sel1_gpu, self.coor_sel2_gpu, self.dip_sel1_gpu, self.dip_sel2_gpu, # <<<<<<<<<<<<<< + * self.histo_gpu, self.box_dim_gpu, self.n1, self.n2, self.histo_min, + * self.histo_max, self.histo_n, self.histo_inv_dr, self.mode_sel, self.block, self.grid) */ - __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_cu); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_calcHistoGPU); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel1_gpu); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_coor_sel2_gpu); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel1_gpu); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dip_sel2_gpu); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "newanalysis/gfunction/gfunction.pyx":456 * - */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":930 - * index += view.shape[dim] - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< + * cu.calcHistoGPU(self.coor_sel1_gpu, self.coor_sel2_gpu, self.dip_sel1_gpu, self.dip_sel2_gpu, + * self.histo_gpu, self.box_dim_gpu, self.n1, self.n2, self.histo_min, # <<<<<<<<<<<<<< + * self.histo_max, self.histo_n, self.histo_inv_dr, self.mode_sel, self.block, self.grid) * - * if index >= shape: */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 930, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_gpu); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim_gpu); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "newanalysis/gfunction/gfunction.pyx":457 + * cu.calcHistoGPU(self.coor_sel1_gpu, self.coor_sel2_gpu, self.dip_sel1_gpu, self.dip_sel2_gpu, + * self.histo_gpu, self.box_dim_gpu, self.n1, self.n2, self.histo_min, + * self.histo_max, self.histo_n, self.histo_inv_dr, self.mode_sel, self.block, self.grid) # <<<<<<<<<<<<<< * + * else: */ + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_max); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_block); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_grid); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_22 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_22)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_22); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[16] = {__pyx_t_22, __pyx_t_6, __pyx_t_5, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 15+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] + /* "newanalysis/gfunction/gfunction.pyx":429 + * self.volume_list.append(self.volume) * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: + * if self.cuda: # <<<<<<<<<<<<<< + * # allocate memory on cuda device and copy data to device + * if pre_coor_sel1_gpu: */ + goto __pyx_L19; } - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "newanalysis/gfunction/gfunction.pyx":460 * + * else: + * calcHisto( coor_sel1.data, coor_sel2.data, # <<<<<<<<<<<<<< + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, */ - __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0); - if (unlikely(__pyx_t_2)) { + /*else*/ { + __pyx_t_23 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coor_sel1)); if (unlikely(__pyx_t_23 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L1_error) + __pyx_t_24 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coor_sel2)); if (unlikely(__pyx_t_24 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L1_error) - /* "View.MemoryView":933 - * - * if index >= shape: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< - * - * resultp = bufp + index * stride - */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 933, __pyx_L1_error) - - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * + /* "newanalysis/gfunction/gfunction.pyx":461 + * else: + * calcHisto( coor_sel1.data, coor_sel2.data, + * dip_sel1.data, dip_sel2.data, # <<<<<<<<<<<<<< + * self.histogram, self.box_dim, + * self.n1, self.n2, self.histo_min, self.histo_max, */ - } + __pyx_t_25 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_dip_sel1)); if (unlikely(__pyx_t_25 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 461, __pyx_L1_error) + __pyx_t_26 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_dip_sel2)); if (unlikely(__pyx_t_26 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 461, __pyx_L1_error) - /* "View.MemoryView":935 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * resultp = bufp + index * stride # <<<<<<<<<<<<<< - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset + /* "newanalysis/gfunction/gfunction.pyx":462 + * calcHisto( coor_sel1.data, coor_sel2.data, + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, # <<<<<<<<<<<<<< + * self.n1, self.n2, self.histo_min, self.histo_max, + * self.histo_n, self.histo_inv_dr, self.mode_sel) */ - __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 462, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 462, __pyx_L1_error) - /* "View.MemoryView":936 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset + /* "newanalysis/gfunction/gfunction.pyx":463 + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, + * self.n1, self.n2, self.histo_min, self.histo_max, # <<<<<<<<<<<<<< + * self.histo_n, self.histo_inv_dr, self.mode_sel) * */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { + __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_21); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_27 = __Pyx_PyInt_As_int(__pyx_t_21); if (unlikely((__pyx_t_27 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_28 = __pyx_PyFloat_AsFloat(__pyx_t_21); if (unlikely((__pyx_t_28 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_max); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_29 = __pyx_PyFloat_AsFloat(__pyx_t_21); if (unlikely((__pyx_t_29 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - /* "View.MemoryView":937 - * resultp = bufp + index * stride - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":464 + * self.histogram, self.box_dim, + * self.n1, self.n2, self.histo_min, self.histo_max, + * self.histo_n, self.histo_inv_dr, self.mode_sel) # <<<<<<<<<<<<<< * - * return resultp + * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): */ - __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_30 = __Pyx_PyInt_As_int(__pyx_t_21); if (unlikely((__pyx_t_30 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_21); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_32 = __Pyx_PyInt_As_int(__pyx_t_21); if (unlikely((__pyx_t_32 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - /* "View.MemoryView":936 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset + /* "newanalysis/gfunction/gfunction.pyx":460 * + * else: + * calcHisto( coor_sel1.data, coor_sel2.data, # <<<<<<<<<<<<<< + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, */ + __pyx_f_11newanalysis_9gfunction_calcHisto(((double *)__pyx_t_23), ((double *)__pyx_t_24), ((double *)__pyx_t_25), ((double *)__pyx_t_26), ((PyArrayObject *)__pyx_t_7), ((PyArrayObject *)__pyx_t_3), __pyx_t_4, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } + __pyx_L19:; - /* "View.MemoryView":939 - * resultp = ( resultp)[0] + suboffset - * - * return resultp # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_resultp; - goto __pyx_L0; - - /* "View.MemoryView":912 + /* "newanalysis/gfunction/gfunction.pyx":385 + * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 + * def calcFrame(self, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.gfunction.RDF.calcFrame", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":945 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim +/* "newanalysis/gfunction/gfunction.pyx":466 + * self.histo_n, self.histo_inv_dr, self.mode_sel) * + * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< + * """ + * Add the histograms of all core particles, after they were calculated in parallel. */ -static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { - int __pyx_v_ndim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_7_addHisto(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_3RDF_6_addHisto, "\n Add the histograms of all core particles, after they were calculated in parallel.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_7_addHisto = {"_addHisto", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_7_addHisto, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF_6_addHisto}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_7_addHisto(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyArrayObject *__pyx_v_histo_out = 0; + PyArrayObject *__pyx_v_histo = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_addHisto (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 466, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_histo_out,&__pyx_n_s_histo,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_out)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, 1); __PYX_ERR(0, 466, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, 2); __PYX_ERR(0, 466, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_addHisto") < 0)) __PYX_ERR(0, 466, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_self = values[0]; + __pyx_v_histo_out = ((PyArrayObject *)values[1]); + __pyx_v_histo = ((PyArrayObject *)values[2]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 466, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF._addHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_histo_out), __pyx_ptype_5numpy_ndarray, 1, "histo_out", 0))) __PYX_ERR(0, 466, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_histo), __pyx_ptype_5numpy_ndarray, 1, "histo", 0))) __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_6_addHisto(__pyx_self, __pyx_v_self, __pyx_v_histo_out, __pyx_v_histo); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_6_addHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_histo_out, PyArrayObject *__pyx_v_histo) { + int __pyx_v_histo_n; + int __pyx_v_n1; int __pyx_v_i; int __pyx_v_j; - int __pyx_r; - int __pyx_t_1; - Py_ssize_t *__pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; + int __pyx_v_k; + int __pyx_v_ix; + int __pyx_v_ix2; + double *__pyx_v_histogram_out; + double *__pyx_v_histogram; + __Pyx_LocalBuf_ND __pyx_pybuffernd_histo; + __Pyx_Buffer __pyx_pybuffer_histo; + __Pyx_LocalBuf_ND __pyx_pybuffernd_histo_out; + __Pyx_Buffer __pyx_pybuffer_histo_out; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_addHisto", 0); + __pyx_pybuffer_histo_out.pybuffer.buf = NULL; + __pyx_pybuffer_histo_out.refcount = 0; + __pyx_pybuffernd_histo_out.data = NULL; + __pyx_pybuffernd_histo_out.rcbuffer = &__pyx_pybuffer_histo_out; + __pyx_pybuffer_histo.pybuffer.buf = NULL; + __pyx_pybuffer_histo.refcount = 0; + __pyx_pybuffernd_histo.data = NULL; + __pyx_pybuffernd_histo.rcbuffer = &__pyx_pybuffer_histo; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_histo_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 466, __pyx_L1_error) + } + __pyx_pybuffernd_histo_out.diminfo[0].strides = __pyx_pybuffernd_histo_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_histo_out.diminfo[0].shape = __pyx_pybuffernd_histo_out.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_histo.rcbuffer->pybuffer, (PyObject*)__pyx_v_histo, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 466, __pyx_L1_error) + } + __pyx_pybuffernd_histo.diminfo[0].strides = __pyx_pybuffernd_histo.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_histo.diminfo[0].shape = __pyx_pybuffernd_histo.rcbuffer->pybuffer.shape[0]; - /* "View.MemoryView":946 - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: - * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":471 + * """ * - * cdef Py_ssize_t *shape = memslice.shape + * cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n # <<<<<<<<<<<<<< + * cdef double* histogram_out = histo_out.data + * cdef double* histogram = histo.data */ - __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; - __pyx_v_ndim = __pyx_t_1; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_histo_n = __pyx_t_2; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_n1 = __pyx_t_2; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_ix2 = __pyx_t_2; - /* "View.MemoryView":948 - * cdef int ndim = memslice.memview.view.ndim + /* "newanalysis/gfunction/gfunction.pyx":472 * - * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< - * cdef Py_ssize_t *strides = memslice.strides + * cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n + * cdef double* histogram_out = histo_out.data # <<<<<<<<<<<<<< + * cdef double* histogram = histo.data * */ - __pyx_t_2 = __pyx_v_memslice->shape; - __pyx_v_shape = __pyx_t_2; + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_histo_out)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 472, __pyx_L1_error) + __pyx_v_histogram_out = ((double *)__pyx_t_5); - /* "View.MemoryView":949 - * - * cdef Py_ssize_t *shape = memslice.shape - * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< - * + /* "newanalysis/gfunction/gfunction.pyx":473 + * cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n + * cdef double* histogram_out = histo_out.data + * cdef double* histogram = histo.data # <<<<<<<<<<<<<< * + * # add histograms */ - __pyx_t_2 = __pyx_v_memslice->strides; - __pyx_v_strides = __pyx_t_2; + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_histo)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 473, __pyx_L1_error) + __pyx_v_histogram = ((double *)__pyx_t_5); - /* "View.MemoryView":953 + /* "newanalysis/gfunction/gfunction.pyx":476 * - * cdef int i, j - * for i in range(ndim / 2): # <<<<<<<<<<<<<< - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - */ - __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "View.MemoryView":954 - * cdef int i, j - * for i in range(ndim / 2): - * j = ndim - 1 - i # <<<<<<<<<<<<<< - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] + * # add histograms + * for i in prange(histo_n, nogil=True): # <<<<<<<<<<<<<< + * for j in range(n1): + * ix = histo_n * j */ - __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_2 = __pyx_v_histo_n; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_7 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_7 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_8, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ix) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) + #endif /* _OPENMP */ + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_6); + /* Initialize private variables to invalid values */ + __pyx_v_ix = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); - /* "View.MemoryView":955 - * for i in range(ndim / 2): - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< - * shape[i], shape[j] = shape[j], shape[i] - * + /* "newanalysis/gfunction/gfunction.pyx":477 + * # add histograms + * for i in prange(histo_n, nogil=True): + * for j in range(n1): # <<<<<<<<<<<<<< + * ix = histo_n * j + * for k in range(7): */ - __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); - __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); - (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; - (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + __pyx_t_8 = __pyx_v_n1; + __pyx_t_9 = __pyx_t_8; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_j = __pyx_t_10; - /* "View.MemoryView":956 - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + /* "newanalysis/gfunction/gfunction.pyx":478 + * for i in prange(histo_n, nogil=True): + * for j in range(n1): + * ix = histo_n * j # <<<<<<<<<<<<<< + * for k in range(7): + * histogram_out[k*histo_n+i]+=histogram[k*ix2+ix+i] */ - __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); - __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); - (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; - (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + __pyx_v_ix = (__pyx_v_histo_n * __pyx_v_j); - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") + /* "newanalysis/gfunction/gfunction.pyx":479 + * for j in range(n1): + * ix = histo_n * j + * for k in range(7): # <<<<<<<<<<<<<< + * histogram_out[k*histo_n+i]+=histogram[k*ix2+ix+i] * */ - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0); - __pyx_t_7 = __pyx_t_8; - __pyx_L6_bool_binop_done:; - if (__pyx_t_7) { + for (__pyx_t_11 = 0; __pyx_t_11 < 7; __pyx_t_11+=1) { + __pyx_v_k = __pyx_t_11; - /* "View.MemoryView":959 + /* "newanalysis/gfunction/gfunction.pyx":480 + * ix = histo_n * j + * for k in range(7): + * histogram_out[k*histo_n+i]+=histogram[k*ix2+ix+i] # <<<<<<<<<<<<<< * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< * - * return 1 */ - __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 959, __pyx_L1_error) + __pyx_t_12 = ((__pyx_v_k * __pyx_v_histo_n) + __pyx_v_i); + (__pyx_v_histogram_out[__pyx_t_12]) = ((__pyx_v_histogram_out[__pyx_t_12]) + (__pyx_v_histogram[(((__pyx_v_k * __pyx_v_ix2) + __pyx_v_ix) + __pyx_v_i)])); + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") + /* "newanalysis/gfunction/gfunction.pyx":476 * + * # add histograms + * for i in prange(histo_n, nogil=True): # <<<<<<<<<<<<<< + * for j in range(n1): + * ix = histo_n * j */ - } + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } } - /* "View.MemoryView":961 - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") - * - * return 1 # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 1; - goto __pyx_L0; - - /* "View.MemoryView":945 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim + /* "newanalysis/gfunction/gfunction.pyx":466 + * self.histo_n, self.histo_inv_dr, self.mode_sel) * + * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< + * """ + * Add the histograms of all core particles, after they were calculated in parallel. */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.gfunction.RDF._addHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 +/* "newanalysis/gfunction/gfunction.pyx":483 * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * + * def _normHisto(self): # <<<<<<<<<<<<<< + * """ + * Normalize the histogram. */ /* Python wrapper */ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_9_normHisto(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_3RDF_8_normHisto, "\n Normalize the histogram.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_9_normHisto = {"_normHisto", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_9_normHisto, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF_8_normHisto}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_9_normHisto(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":979 - * - * def __dealloc__(self): - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< - * - * cdef convert_item_to_object(self, char *itemp): - */ - __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); - - /* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) - */ + __Pyx_RefNannySetupContext("_normHisto (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 483, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_normHisto") < 0)) __PYX_ERR(0, 483, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_self = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_normHisto", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 483, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF._normHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_8_normHisto(__pyx_self, __pyx_v_self); -static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_8_normHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_v_volume = NULL; + PyObject *__pyx_v_v = NULL; + int __pyx_v_i; + int __pyx_v_j; + CYTHON_UNUSED int __pyx_v_ix2; + double __pyx_v_PI; + PyObject *__pyx_v_rho = NULL; + PyObject *__pyx_v_r = NULL; + PyObject *__pyx_v_r_out = NULL; + PyObject *__pyx_v_slice_vol = NULL; + PyObject *__pyx_v_norm = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + long __pyx_t_8; + long __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); + __Pyx_RefNannySetupContext("_normHisto", 0); - /* "View.MemoryView":982 + /* "newanalysis/gfunction/gfunction.pyx":488 + * """ * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) + * if self.norm_volume: # <<<<<<<<<<<<<< + * volume = self.norm_volume * else: */ - __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 488, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "View.MemoryView":983 - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":489 + * + * if self.norm_volume: + * volume = self.norm_volume # <<<<<<<<<<<<<< * else: - * return memoryview.convert_item_to_object(self, itemp) + * volume = 0.0 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_volume = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":982 + /* "newanalysis/gfunction/gfunction.pyx":488 + * """ * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) + * if self.norm_volume: # <<<<<<<<<<<<<< + * volume = self.norm_volume * else: */ + goto __pyx_L3; } - /* "View.MemoryView":985 - * return self.to_object_func(itemp) + /* "newanalysis/gfunction/gfunction.pyx":491 + * volume = self.norm_volume * else: - * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): + * volume = 0.0 # <<<<<<<<<<<<<< + * for v in self.volume_list: + * volume+=v */ /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 985, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } + __Pyx_INCREF(__pyx_float_0_0); + __pyx_v_volume = __pyx_float_0_0; + + /* "newanalysis/gfunction/gfunction.pyx":492 + * else: + * volume = 0.0 + * for v in self.volume_list: # <<<<<<<<<<<<<< + * volume+=v + * volume/=len(self.volume_list) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 492, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 492, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 492, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 492, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + /* "newanalysis/gfunction/gfunction.pyx":493 + * volume = 0.0 + * for v in self.volume_list: + * volume+=v # <<<<<<<<<<<<<< + * volume/=len(self.volume_list) * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) */ + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_volume, __pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_volume, __pyx_t_1); + __pyx_t_1 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":492 + * else: + * volume = 0.0 + * for v in self.volume_list: # <<<<<<<<<<<<<< + * volume+=v + * volume/=len(self.volume_list) + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; -/* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) + /* "newanalysis/gfunction/gfunction.pyx":494 + * for v in self.volume_list: + * volume+=v + * volume/=len(self.volume_list) # <<<<<<<<<<<<<< * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + * cdef int i, j, ix, ix2 = self.n1 * self.histo_n */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_volume, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_volume, __pyx_t_1); + __pyx_t_1 = 0; + } + __pyx_L3:; -static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); + /* "newanalysis/gfunction/gfunction.pyx":496 + * volume/=len(self.volume_list) + * + * cdef int i, j, ix, ix2 = self.n1 * self.histo_n # <<<<<<<<<<<<<< + * PI = 3.14159265358979323846 + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_ix2 = __pyx_t_7; - /* "View.MemoryView":988 + /* "newanalysis/gfunction/gfunction.pyx":497 * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) + * cdef int i, j, ix, ix2 = self.n1 * self.histo_n + * PI = 3.14159265358979323846 # <<<<<<<<<<<<<< + * + * # norm histograms + */ + __pyx_v_PI = 3.14159265358979323846; + + /* "newanalysis/gfunction/gfunction.pyx":500 + * + * # norm histograms + * if self.oneistwo: # <<<<<<<<<<<<<< + * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume * else: */ - __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0); - if (__pyx_t_1) { + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 500, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_2) { - /* "View.MemoryView":989 - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":501 + * # norm histograms + * if self.oneistwo: + * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume # <<<<<<<<<<<<<< * else: - * memoryview.assign_item_from_object(self, itemp, value) + * rho = float(self.nmol1 * self.nmol2) / volume */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 989, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_volume); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rho = __pyx_t_3; + __pyx_t_3 = 0; - /* "View.MemoryView":988 + /* "newanalysis/gfunction/gfunction.pyx":500 * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) + * # norm histograms + * if self.oneistwo: # <<<<<<<<<<<<<< + * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume * else: */ - goto __pyx_L3; + goto __pyx_L7; } - /* "View.MemoryView":991 - * self.to_dtype_func(itemp, value) + /* "newanalysis/gfunction/gfunction.pyx":503 + * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume * else: - * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + * rho = float(self.nmol1 * self.nmol2) / volume # <<<<<<<<<<<<<< * - * @property + * for i in range(self.histo_n): */ /*else*/ { - __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 991, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_volume); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rho = __pyx_t_6; + __pyx_t_6 = 0; } - __pyx_L3:; + __pyx_L7:; - /* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) + /* "newanalysis/gfunction/gfunction.pyx":505 + * rho = float(self.nmol1 * self.nmol2) / volume * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + * for i in range(self.histo_n): # <<<<<<<<<<<<<< + * r = self.histo_min + float(i) * self.histo_dr + * r_out = r + self.histo_dr */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 505, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_9 = __pyx_t_8; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_9; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":994 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object + /* "newanalysis/gfunction/gfunction.pyx":506 * + * for i in range(self.histo_n): + * r = self.histo_min + float(i) * self.histo_dr # <<<<<<<<<<<<<< + * r_out = r + self.histo_dr + * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_3); + __pyx_t_3 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + /* "newanalysis/gfunction/gfunction.pyx":507 + * for i in range(self.histo_n): + * r = self.histo_min + float(i) * self.histo_dr + * r_out = r + self.histo_dr # <<<<<<<<<<<<<< + * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) + * norm = rho*slice_vol*float(self.ctr) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = PyNumber_Add(__pyx_v_r, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_r_out, __pyx_t_10); + __pyx_t_10 = 0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":508 + * r = self.histo_min + float(i) * self.histo_dr + * r_out = r + self.histo_dr + * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) # <<<<<<<<<<<<<< + * norm = rho*slice_vol*float(self.ctr) + * for j in range(7): + */ + __pyx_t_10 = PyFloat_FromDouble(((4.0 / 3.0) * __pyx_v_PI)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_3 = PyNumber_Power(__pyx_v_r_out, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyNumber_Power(__pyx_v_r, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Multiply(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_slice_vol, __pyx_t_6); + __pyx_t_6 = 0; -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/gfunction/gfunction.pyx":509 + * r_out = r + self.histo_dr + * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) + * norm = rho*slice_vol*float(self.ctr) # <<<<<<<<<<<<<< + * for j in range(7): + * self.histogram_out[j*self.histo_n+i]/=norm + */ + __pyx_t_6 = PyNumber_Multiply(__pyx_v_rho, __pyx_v_slice_vol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyNumber_Float(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF_SET(__pyx_v_norm, __pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":995 - * @property - * def base(self): - * return self.from_object # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":510 + * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) + * norm = rho*slice_vol*float(self.ctr) + * for j in range(7): # <<<<<<<<<<<<<< + * self.histogram_out[j*self.histo_n+i]/=norm * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->from_object); - __pyx_r = __pyx_v_self->from_object; - goto __pyx_L0; + for (__pyx_t_11 = 0; __pyx_t_11 < 7; __pyx_t_11+=1) { + __pyx_v_j = __pyx_t_11; - /* "View.MemoryView":994 + /* "newanalysis/gfunction/gfunction.pyx":511 + * norm = rho*slice_vol*float(self.ctr) + * for j in range(7): + * self.histogram_out[j*self.histo_n+i]/=norm # <<<<<<<<<<<<<< + * + * def scale(self, value): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_10, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_6, __pyx_v_norm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_t_10, __pyx_t_3) < 0))) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + } + + /* "newanalysis/gfunction/gfunction.pyx":483 * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object * + * def _normHisto(self): # <<<<<<<<<<<<<< + * """ + * Normalize the histogram. */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("newanalysis.gfunction.RDF._normHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_volume); + __Pyx_XDECREF(__pyx_v_v); + __Pyx_XDECREF(__pyx_v_rho); + __Pyx_XDECREF(__pyx_v_r); + __Pyx_XDECREF(__pyx_v_r_out); + __Pyx_XDECREF(__pyx_v_slice_vol); + __Pyx_XDECREF(__pyx_v_norm); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - */ - +/* "newanalysis/gfunction/gfunction.pyx":513 + * self.histogram_out[j*self.histo_n+i]/=norm + * + * def scale(self, value): # <<<<<<<<<<<<<< + * self.histogram_out[:] *= value + * self.histogram[:] *= value + */ + /* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_11scale(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_11scale = {"scale", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_11scale, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_11scale(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_value = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("scale (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 513, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 513, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 513, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); __PYX_ERR(0, 513, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "scale") < 0)) __PYX_ERR(0, 513, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_self = values[0]; + __pyx_v_value = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 513, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_10scale(__pyx_self, __pyx_v_self, __pyx_v_value); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_10scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("scale", 0); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/gfunction/gfunction.pyx":514 + * + * def scale(self, value): + * self.histogram_out[:] *= value # <<<<<<<<<<<<<< + * self.histogram[:] *= value + * */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_INCREF(__pyx_slice__5); + __pyx_t_2 = __pyx_slice__5; + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_InPlaceMultiply(__pyx_t_3, __pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_4) < 0))) __PYX_ERR(0, 514, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/gfunction/gfunction.pyx":515 + * def scale(self, value): + * self.histogram_out[:] *= value + * self.histogram[:] *= value # <<<<<<<<<<<<<< + * + * def write(self, filename="rdf"): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_slice__5); + __pyx_t_2 = __pyx_slice__5; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_4, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0))) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":513 + * self.histogram_out[j*self.histo_n+i]/=norm + * + * def scale(self, value): # <<<<<<<<<<<<<< + * self.histogram_out[:] *= value + * self.histogram[:] *= value */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("newanalysis.gfunction.RDF.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") +/* "newanalysis/gfunction/gfunction.pyx":517 + * self.histogram[:] *= value + * + * def write(self, filename="rdf"): # <<<<<<<<<<<<<< + * """ + * RDF.write(filename="rdf") */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_13write(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_3RDF_12write, "\n RDF.write(filename=\"rdf\")\n\n Args:\n filename .. name of the file to be written to. Each type of rdf will be written to a separate file\n with the ending specifying the type.\n \n Norm the calculated histograms and write them to the specified file.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_13write = {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_13write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF_12write}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_13write(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_filename = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 517, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filename,0}; + values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_n_s_rdf))); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 517, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename); + if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 517, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write") < 0)) __PYX_ERR(0, 517, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_self = values[0]; + __pyx_v_filename = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 517, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_12write(__pyx_self, __pyx_v_self, __pyx_v_filename); /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1001 - * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), - */ - -static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_v_length = NULL; +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_12write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_v_f000 = NULL; + PyObject *__pyx_v_f110 = NULL; + PyObject *__pyx_v_f101 = NULL; + PyObject *__pyx_v_f011 = NULL; + PyObject *__pyx_v_f220 = NULL; + PyObject *__pyx_v_f202 = NULL; + PyObject *__pyx_v_f022 = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_r = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - __Pyx_TypeInfo *__pyx_t_4; - Py_buffer __pyx_t_5; - Py_ssize_t *__pyx_t_6; - Py_ssize_t *__pyx_t_7; - Py_ssize_t *__pyx_t_8; - Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + __Pyx_RefNannySetupContext("write", 0); - /* "View.MemoryView":1009 - * cdef _memoryviewslice result + /* "newanalysis/gfunction/gfunction.pyx":528 + * """ * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None + * if self.cuda: # <<<<<<<<<<<<<< + * cu.drv.memcpy_dtoh(self.histogram, self.histo_gpu) * */ - __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cuda); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "View.MemoryView":1010 - * - * if memviewslice.memview == Py_None: - * return None # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":529 * + * if self.cuda: + * cu.drv.memcpy_dtoh(self.histogram, self.histo_gpu) # <<<<<<<<<<<<<< * + * self._addHisto(self.histogram_out, self.histogram.astype(np.float64)) */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_cu); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_drv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_memcpy_dtoh); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_gpu); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1009 - * cdef _memoryviewslice result + /* "newanalysis/gfunction/gfunction.pyx":528 + * """ * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None + * if self.cuda: # <<<<<<<<<<<<<< + * cu.drv.memcpy_dtoh(self.histogram, self.histo_gpu) * */ } - /* "View.MemoryView":1015 - * + /* "newanalysis/gfunction/gfunction.pyx":531 + * cu.drv.memcpy_dtoh(self.histogram, self.histo_gpu) * - * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * self._addHisto(self.histogram_out, self.histogram.astype(np.float64)) # <<<<<<<<<<<<<< + * self._normHisto() * - * result.from_slice = memviewslice */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1015, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_addHisto); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":1017 - * result = _memoryviewslice(None, 0, dtype_is_object) - * - * result.from_slice = memviewslice # <<<<<<<<<<<<<< - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - */ - __pyx_v_result->from_slice = __pyx_v_memviewslice; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 531, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 531, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 531, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 531, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 531, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_9}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 531, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_8 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1018 + /* "newanalysis/gfunction/gfunction.pyx":532 * - * result.from_slice = memviewslice - * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * self._addHisto(self.histogram_out, self.histogram.astype(np.float64)) + * self._normHisto() # <<<<<<<<<<<<<< * - * result.from_object = ( memviewslice.memview).base + * if self.mode_sel & 1: f000 = open(filename+"_g000.dat",'w') */ - __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normHisto); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[1] = {__pyx_t_4, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1020 - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - * result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<< - * result.typeinfo = memviewslice.memview.typeinfo + /* "newanalysis/gfunction/gfunction.pyx":534 + * self._normHisto() * + * if self.mode_sel & 1: f000 = open(filename+"_g000.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 2: f110 = open(filename+"_g110.dat",'w') + * if self.mode_sel & 4: f101 = open(filename+"_g101.dat",'w') */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_result->from_object); - __Pyx_DECREF(__pyx_v_result->from_object); - __pyx_v_result->from_object = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + __pyx_t_3 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g000_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 534, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_w)) __PYX_ERR(0, 534, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_f000 = __pyx_t_3; + __pyx_t_3 = 0; + } - /* "View.MemoryView":1021 - * - * result.from_object = ( memviewslice.memview).base - * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":535 * - * result.view = memviewslice.memview.view + * if self.mode_sel & 1: f000 = open(filename+"_g000.dat",'w') + * if self.mode_sel & 2: f110 = open(filename+"_g110.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 4: f101 = open(filename+"_g101.dat",'w') + * if self.mode_sel & 8: f011 = open(filename+"_g011.dat",'w') */ - __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; - __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 535, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __pyx_t_1 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g110_dat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_w)) __PYX_ERR(0, 535, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_f110 = __pyx_t_1; + __pyx_t_1 = 0; + } - /* "View.MemoryView":1023 - * result.typeinfo = memviewslice.memview.typeinfo - * - * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< - * result.view.buf = memviewslice.data - * result.view.ndim = ndim + /* "newanalysis/gfunction/gfunction.pyx":536 + * if self.mode_sel & 1: f000 = open(filename+"_g000.dat",'w') + * if self.mode_sel & 2: f110 = open(filename+"_g110.dat",'w') + * if self.mode_sel & 4: f101 = open(filename+"_g101.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 8: f011 = open(filename+"_g011.dat",'w') + * if self.mode_sel & 16: f220 = open(filename+"_g220.dat",'w') */ - __pyx_t_5 = __pyx_v_memviewslice.memview->view; - __pyx_v_result->__pyx_base.view = __pyx_t_5; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + __pyx_t_3 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g101_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_w)) __PYX_ERR(0, 536, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_f101 = __pyx_t_3; + __pyx_t_3 = 0; + } - /* "View.MemoryView":1024 - * - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None + /* "newanalysis/gfunction/gfunction.pyx":537 + * if self.mode_sel & 2: f110 = open(filename+"_g110.dat",'w') + * if self.mode_sel & 4: f101 = open(filename+"_g101.dat",'w') + * if self.mode_sel & 8: f011 = open(filename+"_g011.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 16: f220 = open(filename+"_g220.dat",'w') + * if self.mode_sel & 32: f202 = open(filename+"_g202.dat",'w') */ - __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __pyx_t_1 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g011_dat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_w)) __PYX_ERR(0, 537, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_f011 = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "newanalysis/gfunction/gfunction.pyx":538 + * if self.mode_sel & 4: f101 = open(filename+"_g101.dat",'w') + * if self.mode_sel & 8: f011 = open(filename+"_g011.dat",'w') + * if self.mode_sel & 16: f220 = open(filename+"_g220.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 32: f202 = open(filename+"_g202.dat",'w') + * if self.mode_sel & 64: f022 = open(filename+"_g022.dat",'w') + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + __pyx_t_3 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g220_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_w)) __PYX_ERR(0, 538, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_f220 = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "newanalysis/gfunction/gfunction.pyx":539 + * if self.mode_sel & 8: f011 = open(filename+"_g011.dat",'w') + * if self.mode_sel & 16: f220 = open(filename+"_g220.dat",'w') + * if self.mode_sel & 32: f202 = open(filename+"_g202.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 64: f022 = open(filename+"_g022.dat",'w') + * + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_32, 32, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __pyx_t_1 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g202_dat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_w)) __PYX_ERR(0, 539, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_f202 = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "newanalysis/gfunction/gfunction.pyx":540 + * if self.mode_sel & 16: f220 = open(filename+"_g220.dat",'w') + * if self.mode_sel & 32: f202 = open(filename+"_g202.dat",'w') + * if self.mode_sel & 64: f022 = open(filename+"_g022.dat",'w') # <<<<<<<<<<<<<< + * + * for i in range(self.histo_n): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_64, 64, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + __pyx_t_3 = PyNumber_Add(__pyx_v_filename, __pyx_kp_s_g022_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_w)) __PYX_ERR(0, 540, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_f022 = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "newanalysis/gfunction/gfunction.pyx":542 + * if self.mode_sel & 64: f022 = open(filename+"_g022.dat",'w') + * + * for i in range(self.histo_n): # <<<<<<<<<<<<<< + * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 542, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 542, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 542, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_11(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 542, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); + __pyx_t_1 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":543 + * + * for i in range(self.histo_n): + * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 # <<<<<<<<<<<<<< + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) + * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[self.histo_n+i])) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyNumber_Multiply(__pyx_v_i, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_float_0_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_5); + __pyx_t_5 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":544 + * for i in range(self.histo_n): + * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) # <<<<<<<<<<<<<< + * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[self.histo_n+i])) + * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n+i])) + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + if (unlikely(!__pyx_v_f000)) { __Pyx_RaiseUnboundLocalError("f000"); __PYX_ERR(0, 544, __pyx_L1_error) } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f000, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_r)) __PYX_ERR(0, 544, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8)) __PYX_ERR(0, 544, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "newanalysis/gfunction/gfunction.pyx":545 + * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) + * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[self.histo_n+i])) # <<<<<<<<<<<<<< + * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n+i])) + * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n+i])) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_2) { + if (unlikely(!__pyx_v_f110)) { __Pyx_RaiseUnboundLocalError("f110"); __PYX_ERR(0, 545, __pyx_L1_error) } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f110, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = PyNumber_Add(__pyx_t_4, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_r)) __PYX_ERR(0, 545, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_4}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + + /* "newanalysis/gfunction/gfunction.pyx":546 + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) + * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[self.histo_n+i])) + * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n+i])) # <<<<<<<<<<<<<< + * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n+i])) + * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n+i])) + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_5, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + if (unlikely(!__pyx_v_f101)) { __Pyx_RaiseUnboundLocalError("f101"); __PYX_ERR(0, 546, __pyx_L1_error) } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f101, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyInt_MultiplyCObj(__pyx_int_2, __pyx_t_9, 2, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Add(__pyx_t_8, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_r)) __PYX_ERR(0, 546, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8)) __PYX_ERR(0, 546, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "newanalysis/gfunction/gfunction.pyx":547 + * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[self.histo_n+i])) + * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n+i])) + * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n+i])) # <<<<<<<<<<<<<< + * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n+i])) + * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n+i])) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_2) { + if (unlikely(!__pyx_v_f011)) { __Pyx_RaiseUnboundLocalError("f011"); __PYX_ERR(0, 547, __pyx_L1_error) } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f011, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = __Pyx_PyInt_MultiplyCObj(__pyx_int_3, __pyx_t_9, 3, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Add(__pyx_t_4, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_r)) __PYX_ERR(0, 547, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4)) __PYX_ERR(0, 547, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_4}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + + /* "newanalysis/gfunction/gfunction.pyx":548 + * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n+i])) + * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n+i])) + * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n+i])) # <<<<<<<<<<<<<< + * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n+i])) + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_5, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + if (unlikely(!__pyx_v_f220)) { __Pyx_RaiseUnboundLocalError("f220"); __PYX_ERR(0, 548, __pyx_L1_error) } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f220, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyInt_MultiplyCObj(__pyx_int_4, __pyx_t_9, 4, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Add(__pyx_t_8, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_r)) __PYX_ERR(0, 548, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8)) __PYX_ERR(0, 548, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "newanalysis/gfunction/gfunction.pyx":549 + * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n+i])) + * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n+i])) + * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n+i])) # <<<<<<<<<<<<<< + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_32, 32, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_2) { + if (unlikely(!__pyx_v_f202)) { __Pyx_RaiseUnboundLocalError("f202"); __PYX_ERR(0, 549, __pyx_L1_error) } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f202, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = __Pyx_PyInt_MultiplyCObj(__pyx_int_5, __pyx_t_9, 5, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Add(__pyx_t_4, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_r)) __PYX_ERR(0, 549, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_4}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 549, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + + /* "newanalysis/gfunction/gfunction.pyx":550 + * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n+i])) + * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n+i])) + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) # <<<<<<<<<<<<<< + * + * def resetArrays(self): + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyInt_AndObjC(__pyx_t_5, __pyx_int_64, 64, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + if (unlikely(!__pyx_v_f022)) { __Pyx_RaiseUnboundLocalError("f022"); __PYX_ERR(0, 550, __pyx_L1_error) } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f022, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyInt_MultiplyCObj(__pyx_int_6, __pyx_t_9, 6, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Add(__pyx_t_8, __pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_r)) __PYX_ERR(0, 550, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8)) __PYX_ERR(0, 550, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "newanalysis/gfunction/gfunction.pyx":542 + * if self.mode_sel & 64: f022 = open(filename+"_g022.dat",'w') + * + * for i in range(self.histo_n): # <<<<<<<<<<<<<< + * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[i])) + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":517 + * self.histogram[:] *= value + * + * def write(self, filename="rdf"): # <<<<<<<<<<<<<< + * """ + * RDF.write(filename="rdf") + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("newanalysis.gfunction.RDF.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_f000); + __Pyx_XDECREF(__pyx_v_f110); + __Pyx_XDECREF(__pyx_v_f101); + __Pyx_XDECREF(__pyx_v_f011); + __Pyx_XDECREF(__pyx_v_f220); + __Pyx_XDECREF(__pyx_v_f202); + __Pyx_XDECREF(__pyx_v_f022); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/gfunction/gfunction.pyx":552 + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) + * + * def resetArrays(self): # <<<<<<<<<<<<<< + * """ + * Reset histogram arrays to zero + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_15resetArrays(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_3RDF_14resetArrays, "\n Reset histogram arrays to zero\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_15resetArrays = {"resetArrays", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_15resetArrays, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF_14resetArrays}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_15resetArrays(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("resetArrays (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 552, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 552, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "resetArrays") < 0)) __PYX_ERR(0, 552, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_self = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("resetArrays", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 552, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF.resetArrays", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_14resetArrays(__pyx_self, __pyx_v_self); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_14resetArrays(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("resetArrays", 0); + + /* "newanalysis/gfunction/gfunction.pyx":556 + * Reset histogram arrays to zero + * """ + * self.histogram_out[:] = 0.0 # <<<<<<<<<<<<<< + * self.histogram[:] = 0.0 + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetSlice(__pyx_t_1, __pyx_float_0_0, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1) < 0) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":557 + * """ + * self.histogram_out[:] = 0.0 + * self.histogram[:] = 0.0 # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetSlice(__pyx_t_1, __pyx_float_0_0, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1) < 0) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":552 + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) + * + * def resetArrays(self): # <<<<<<<<<<<<<< + * """ + * Reset histogram arrays to zero + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("newanalysis.gfunction.RDF.resetArrays", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/gfunction/gfunction.pyx":560 + * + * + * def printInfo(self): # <<<<<<<<<<<<<< + * """ + * Print some information about the RDF container. + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_17printInfo(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_3RDF_16printInfo, "\n Print some information about the RDF container.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_3RDF_17printInfo = {"printInfo", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_3RDF_17printInfo, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_3RDF_16printInfo}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_3RDF_17printInfo(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("printInfo (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 560, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 560, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "printInfo") < 0)) __PYX_ERR(0, 560, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_self = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("printInfo", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 560, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF.printInfo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_3RDF_16printInfo(__pyx_self, __pyx_v_self); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_9gfunction_3RDF_16printInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("printInfo", 0); + + /* "newanalysis/gfunction/gfunction.pyx":565 + * """ + * + * print("Modes: ", self.mode_sel) # <<<<<<<<<<<<<< + * print("Frames read: ", self.ctr) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_kp_s_Modes); + __Pyx_GIVEREF(__pyx_kp_s_Modes); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_Modes)) __PYX_ERR(0, 565, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":566 + * + * print("Modes: ", self.mode_sel) + * print("Frames read: ", self.ctr) # <<<<<<<<<<<<<< + * + * ################################################################################################### + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_kp_s_Frames_read); + __Pyx_GIVEREF(__pyx_kp_s_Frames_read); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_Frames_read)) __PYX_ERR(0, 566, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":560 + * + * + * def printInfo(self): # <<<<<<<<<<<<<< + * """ + * Print some information about the RDF container. + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("newanalysis.gfunction.RDF.printInfo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/gfunction/gfunction.pyx":570 + * ################################################################################################### + * + * cdef void calcHistoVoronoi(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, + * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel, int nm_core, int nm_surround, int nshells, int * delaunay_matrix): + */ + +static void __pyx_f_11newanalysis_9gfunction_calcHistoVoronoi(double *__pyx_v_core_xyz, double *__pyx_v_surr_xyz, double *__pyx_v_core_dip, double *__pyx_v_surr_dip, PyArrayObject *__pyx_v_np_dest, PyArrayObject *__pyx_v_np_box_dim, int __pyx_v_ncore, int __pyx_v_nsurround, float __pyx_v_histo_min, float __pyx_v_histo_max, int __pyx_v_histo_n, double __pyx_v_invdx, int __pyx_v_mode_sel, int __pyx_v_nm_core, int __pyx_v_nm_surround, int __pyx_v_nshells, int *__pyx_v_delaunay_matrix) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_pos; + int __pyx_v_ix1; + int __pyx_v_ix2; + int __pyx_v_j_begin; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_dist; + double __pyx_v_cpx; + double __pyx_v_cpy; + double __pyx_v_cpz; + double __pyx_v_spx; + double __pyx_v_spy; + double __pyx_v_spz; + double __pyx_v_slen; + double __pyx_v_clen; + double __pyx_v_incr; + double __pyx_v_off_diag; + double *__pyx_v_dest; + double *__pyx_v_box_dim; + int __pyx_v_ds_pos1; + int __pyx_v_ds_pos2; + int __pyx_v_shell; + int __pyx_v_ix3; + int __pyx_v_ix4; + int __pyx_v_apr_core; + int __pyx_v_apr_surround; + __Pyx_LocalBuf_ND __pyx_pybuffernd_np_box_dim; + __Pyx_Buffer __pyx_pybuffer_np_box_dim; + __Pyx_LocalBuf_ND __pyx_pybuffernd_np_dest; + __Pyx_Buffer __pyx_pybuffer_np_dest; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + double __pyx_t_11; + double __pyx_t_12; + long __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcHistoVoronoi", 0); + __pyx_pybuffer_np_dest.pybuffer.buf = NULL; + __pyx_pybuffer_np_dest.refcount = 0; + __pyx_pybuffernd_np_dest.data = NULL; + __pyx_pybuffernd_np_dest.rcbuffer = &__pyx_pybuffer_np_dest; + __pyx_pybuffer_np_box_dim.pybuffer.buf = NULL; + __pyx_pybuffer_np_box_dim.refcount = 0; + __pyx_pybuffernd_np_box_dim.data = NULL; + __pyx_pybuffernd_np_box_dim.rcbuffer = &__pyx_pybuffer_np_box_dim; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_dest, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 570, __pyx_L1_error) + } + __pyx_pybuffernd_np_dest.diminfo[0].strides = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_dest.diminfo[0].shape = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_box_dim, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 570, __pyx_L1_error) + } + __pyx_pybuffernd_np_box_dim.diminfo[0].strides = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_box_dim.diminfo[0].shape = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.shape[0]; + + /* "newanalysis/gfunction/gfunction.pyx":575 + * + * #cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 # Change ix1, ix2 + * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 + * cdef double *dest = np_dest.data + */ + __pyx_v_ix1 = ((__pyx_v_nshells * __pyx_v_ncore) * __pyx_v_histo_n); + __pyx_v_j_begin = 0; + + /* "newanalysis/gfunction/gfunction.pyx":576 + * #cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 # Change ix1, ix2 + * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 # <<<<<<<<<<<<<< + * cdef double *dest = np_dest.data + * cdef double *box_dim = np_box_dim.data + */ + __pyx_v_off_diag = 1.0; + + /* "newanalysis/gfunction/gfunction.pyx":577 + * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 + * cdef double *dest = np_dest.data # <<<<<<<<<<<<<< + * cdef double *box_dim = np_box_dim.data + * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 + */ + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_np_dest)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 577, __pyx_L1_error) + __pyx_v_dest = ((double *)__pyx_t_1); + + /* "newanalysis/gfunction/gfunction.pyx":578 + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 + * cdef double *dest = np_dest.data + * cdef double *box_dim = np_box_dim.data # <<<<<<<<<<<<<< + * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 + * cdef int apr_core = ncore // nm_core + */ + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_np_box_dim)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L1_error) + __pyx_v_box_dim = ((double *)__pyx_t_1); + + /* "newanalysis/gfunction/gfunction.pyx":580 + * cdef double *box_dim = np_box_dim.data + * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 + * cdef int apr_core = ncore // nm_core # <<<<<<<<<<<<<< + * cdef int apr_surround = nsurround // nm_surround + * + */ + if (unlikely(__pyx_v_nm_core == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 580, __pyx_L1_error) + } + else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nm_core == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_ncore))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 580, __pyx_L1_error) + } + __pyx_v_apr_core = __Pyx_div_int(__pyx_v_ncore, __pyx_v_nm_core); + + /* "newanalysis/gfunction/gfunction.pyx":581 + * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 + * cdef int apr_core = ncore // nm_core + * cdef int apr_surround = nsurround // nm_surround # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(__pyx_v_nm_surround == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 581, __pyx_L1_error) + } + else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nm_surround == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_nsurround))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 581, __pyx_L1_error) + } + __pyx_v_apr_surround = __Pyx_div_int(__pyx_v_nsurround, __pyx_v_nm_surround); + + /* "newanalysis/gfunction/gfunction.pyx":586 + * #TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells + * + * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< + * #ix2=i*histo_n + * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_2 = __pyx_v_ncore; + { + double __pyx_parallel_temp0 = ((double)__PYX_NAN()); + double __pyx_parallel_temp1 = ((double)__PYX_NAN()); + double __pyx_parallel_temp2 = ((double)__PYX_NAN()); + double __pyx_parallel_temp3 = ((double)__PYX_NAN()); + double __pyx_parallel_temp4 = ((double)__PYX_NAN()); + int __pyx_parallel_temp5 = ((int)0xbad0bad0); + int __pyx_parallel_temp6 = ((int)0xbad0bad0); + double __pyx_parallel_temp7 = ((double)__PYX_NAN()); + double __pyx_parallel_temp8 = ((double)__PYX_NAN()); + double __pyx_parallel_temp9 = ((double)__PYX_NAN()); + int __pyx_parallel_temp10 = ((int)0xbad0bad0); + double __pyx_parallel_temp11 = ((double)__PYX_NAN()); + int __pyx_parallel_temp12 = ((int)0xbad0bad0); + int __pyx_parallel_temp13 = ((int)0xbad0bad0); + int __pyx_parallel_temp14 = ((int)0xbad0bad0); + int __pyx_parallel_temp15 = ((int)0xbad0bad0); + int __pyx_parallel_temp16 = ((int)0xbad0bad0); + double __pyx_parallel_temp17 = ((double)__PYX_NAN()); + int __pyx_parallel_temp18 = ((int)0xbad0bad0); + int __pyx_parallel_temp19 = ((int)0xbad0bad0); + double __pyx_parallel_temp20 = ((double)__PYX_NAN()); + double __pyx_parallel_temp21 = ((double)__PYX_NAN()); + double __pyx_parallel_temp22 = ((double)__PYX_NAN()); + double __pyx_parallel_temp23 = ((double)__PYX_NAN()); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_4 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_4 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_clen) lastprivate(__pyx_v_cpx) lastprivate(__pyx_v_cpy) lastprivate(__pyx_v_cpz) lastprivate(__pyx_v_dist) lastprivate(__pyx_v_ds_pos1) lastprivate(__pyx_v_ds_pos2) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_incr) lastprivate(__pyx_v_ix2) lastprivate(__pyx_v_ix3) lastprivate(__pyx_v_ix4) lastprivate(__pyx_v_j) lastprivate(__pyx_v_j_begin) lastprivate(__pyx_v_off_diag) lastprivate(__pyx_v_pos) lastprivate(__pyx_v_shell) lastprivate(__pyx_v_slen) lastprivate(__pyx_v_spx) lastprivate(__pyx_v_spy) lastprivate(__pyx_v_spz) + #endif /* _OPENMP */ + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_3); + /* Initialize private variables to invalid values */ + __pyx_v_clen = ((double)__PYX_NAN()); + __pyx_v_cpx = ((double)__PYX_NAN()); + __pyx_v_cpy = ((double)__PYX_NAN()); + __pyx_v_cpz = ((double)__PYX_NAN()); + __pyx_v_dist = ((double)__PYX_NAN()); + __pyx_v_ds_pos1 = ((int)0xbad0bad0); + __pyx_v_ds_pos2 = ((int)0xbad0bad0); + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_incr = ((double)__PYX_NAN()); + __pyx_v_ix2 = ((int)0xbad0bad0); + __pyx_v_ix3 = ((int)0xbad0bad0); + __pyx_v_ix4 = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_j_begin = ((int)0xbad0bad0); + __pyx_v_off_diag = ((double)__PYX_NAN()); + __pyx_v_pos = ((int)0xbad0bad0); + __pyx_v_shell = ((int)0xbad0bad0); + __pyx_v_slen = ((double)__PYX_NAN()); + __pyx_v_spx = ((double)__PYX_NAN()); + __pyx_v_spy = ((double)__PYX_NAN()); + __pyx_v_spz = ((double)__PYX_NAN()); + + /* "newanalysis/gfunction/gfunction.pyx":588 + * for i in prange(ncore, nogil=True): + * #ix2=i*histo_n + * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE # <<<<<<<<<<<<<< + * ds_pos1 = i//apr_core + * + */ + __pyx_v_ix2 = ((__pyx_v_i * __pyx_v_nshells) * __pyx_v_histo_n); + + /* "newanalysis/gfunction/gfunction.pyx":589 + * #ix2=i*histo_n + * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE + * ds_pos1 = i//apr_core # <<<<<<<<<<<<<< + * + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + */ + if (unlikely(__pyx_v_apr_core == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 589, __pyx_L8_error) + } + else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_apr_core == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_i))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 589, __pyx_L8_error) + } + __pyx_v_ds_pos1 = __Pyx_div_int(__pyx_v_i, __pyx_v_apr_core); + + /* "newanalysis/gfunction/gfunction.pyx":591 + * ds_pos1 = i//apr_core + * + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] + */ + __pyx_t_6 = ((__pyx_v_mode_sel & 2) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 4) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 16) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 32) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L11_bool_binop_done:; + if (__pyx_t_5) { + + /* "newanalysis/gfunction/gfunction.pyx":592 + * + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * cpx = core_dip[i*3] # <<<<<<<<<<<<<< + * cpy = core_dip[i*3+1] + * cpz = core_dip[i*3+2] + */ + __pyx_v_cpx = (__pyx_v_core_dip[(__pyx_v_i * 3)]); + + /* "newanalysis/gfunction/gfunction.pyx":593 + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] # <<<<<<<<<<<<<< + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + */ + __pyx_v_cpy = (__pyx_v_core_dip[((__pyx_v_i * 3) + 1)]); + + /* "newanalysis/gfunction/gfunction.pyx":594 + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] + * cpz = core_dip[i*3+2] # <<<<<<<<<<<<<< + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: + */ + __pyx_v_cpz = (__pyx_v_core_dip[((__pyx_v_i * 3) + 2)]); + + /* "newanalysis/gfunction/gfunction.pyx":595 + * cpy = core_dip[i*3+1] + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) # <<<<<<<<<<<<<< + * if ncore == nsurround: + * j_begin = i + */ + __pyx_v_clen = sqrt((((__pyx_v_cpx * __pyx_v_cpx) + (__pyx_v_cpy * __pyx_v_cpy)) + (__pyx_v_cpz * __pyx_v_cpz))); + + /* "newanalysis/gfunction/gfunction.pyx":591 + * ds_pos1 = i//apr_core + * + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] + */ + } + + /* "newanalysis/gfunction/gfunction.pyx":596 + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: # <<<<<<<<<<<<<< + * j_begin = i + * else: + */ + __pyx_t_5 = (__pyx_v_ncore == __pyx_v_nsurround); + if (__pyx_t_5) { + + /* "newanalysis/gfunction/gfunction.pyx":597 + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: + * j_begin = i # <<<<<<<<<<<<<< + * else: + * j_begin = 0 + */ + __pyx_v_j_begin = __pyx_v_i; + + /* "newanalysis/gfunction/gfunction.pyx":596 + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: # <<<<<<<<<<<<<< + * j_begin = i + * else: + */ + goto __pyx_L15; + } + + /* "newanalysis/gfunction/gfunction.pyx":599 + * j_begin = i + * else: + * j_begin = 0 # <<<<<<<<<<<<<< + * for j in range(j_begin,nsurround): + * ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 2 + */ + /*else*/ { + __pyx_v_j_begin = 0; + } + __pyx_L15:; + + /* "newanalysis/gfunction/gfunction.pyx":600 + * else: + * j_begin = 0 + * for j in range(j_begin,nsurround): # <<<<<<<<<<<<<< + * ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 2 + * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? + */ + __pyx_t_7 = __pyx_v_nsurround; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = __pyx_v_j_begin; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_j = __pyx_t_9; + + /* "newanalysis/gfunction/gfunction.pyx":601 + * j_begin = 0 + * for j in range(j_begin,nsurround): + * ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 2 # <<<<<<<<<<<<<< + * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? + * shell = shell-1 + */ + if (unlikely(__pyx_v_apr_surround == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 601, __pyx_L8_error) + } + else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_apr_surround == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_j))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 601, __pyx_L8_error) + } + __pyx_v_ds_pos2 = __Pyx_div_int(__pyx_v_j, __pyx_v_apr_surround); + + /* "newanalysis/gfunction/gfunction.pyx":602 + * for j in range(j_begin,nsurround): + * ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 2 + * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? # <<<<<<<<<<<<<< + * shell = shell-1 + * if shell < 0: shell = nshells-1 + */ + __pyx_v_shell = (__pyx_v_delaunay_matrix[((__pyx_v_ds_pos1 * __pyx_v_nsurround) + __pyx_v_ds_pos2)]); + + /* "newanalysis/gfunction/gfunction.pyx":603 + * ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 2 + * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? + * shell = shell-1 # <<<<<<<<<<<<<< + * if shell < 0: shell = nshells-1 + * if shell >= nshells: shell = nshells-1 + */ + __pyx_v_shell = (__pyx_v_shell - 1); + + /* "newanalysis/gfunction/gfunction.pyx":604 + * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? + * shell = shell-1 + * if shell < 0: shell = nshells-1 # <<<<<<<<<<<<<< + * if shell >= nshells: shell = nshells-1 + * + */ + __pyx_t_5 = (__pyx_v_shell < 0); + if (__pyx_t_5) { + __pyx_v_shell = (__pyx_v_nshells - 1); + } + + /* "newanalysis/gfunction/gfunction.pyx":605 + * shell = shell-1 + * if shell < 0: shell = nshells-1 + * if shell >= nshells: shell = nshells-1 # <<<<<<<<<<<<<< + * + * if ncore == nsurround and i != j: + */ + __pyx_t_5 = (__pyx_v_shell >= __pyx_v_nshells); + if (__pyx_t_5) { + __pyx_v_shell = (__pyx_v_nshells - 1); + } + + /* "newanalysis/gfunction/gfunction.pyx":607 + * if shell >= nshells: shell = nshells-1 + * + * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< + * off_diag = 2.0 + * else: + */ + __pyx_t_6 = (__pyx_v_ncore == __pyx_v_nsurround); + if (__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L21_bool_binop_done; + } + __pyx_t_6 = (__pyx_v_i != __pyx_v_j); + __pyx_t_5 = __pyx_t_6; + __pyx_L21_bool_binop_done:; + if (__pyx_t_5) { + + /* "newanalysis/gfunction/gfunction.pyx":608 + * + * if ncore == nsurround and i != j: + * off_diag = 2.0 # <<<<<<<<<<<<<< + * else: + * off_diag = 1.0 + */ + __pyx_v_off_diag = 2.0; + + /* "newanalysis/gfunction/gfunction.pyx":607 + * if shell >= nshells: shell = nshells-1 + * + * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< + * off_diag = 2.0 + * else: + */ + goto __pyx_L20; + } + + /* "newanalysis/gfunction/gfunction.pyx":610 + * off_diag = 2.0 + * else: + * off_diag = 1.0 # <<<<<<<<<<<<<< + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: + * spx = surr_dip[j*3] + */ + /*else*/ { + __pyx_v_off_diag = 1.0; + } + __pyx_L20:; + + /* "newanalysis/gfunction/gfunction.pyx":611 + * else: + * off_diag = 1.0 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] + */ + __pyx_t_6 = ((__pyx_v_mode_sel & 2) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L24_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 8) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L24_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 16) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L24_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 64) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L24_bool_binop_done:; + if (__pyx_t_5) { + + /* "newanalysis/gfunction/gfunction.pyx":612 + * off_diag = 1.0 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: + * spx = surr_dip[j*3] # <<<<<<<<<<<<<< + * spy = surr_dip[j*3+1] + * spz = surr_dip[j*3+2] + */ + __pyx_v_spx = (__pyx_v_surr_dip[(__pyx_v_j * 3)]); + + /* "newanalysis/gfunction/gfunction.pyx":613 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] # <<<<<<<<<<<<<< + * spz = surr_dip[j*3+2] + * slen = sqrt(spx*spx+spy*spy+spz*spz) + */ + __pyx_v_spy = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 1)]); + + /* "newanalysis/gfunction/gfunction.pyx":614 + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] + * spz = surr_dip[j*3+2] # <<<<<<<<<<<<<< + * slen = sqrt(spx*spx+spy*spy+spz*spz) + * + */ + __pyx_v_spz = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 2)]); + + /* "newanalysis/gfunction/gfunction.pyx":615 + * spy = surr_dip[j*3+1] + * spz = surr_dip[j*3+2] + * slen = sqrt(spx*spx+spy*spy+spz*spz) # <<<<<<<<<<<<<< + * + * dx = surr_xyz[j*3] - core_xyz[i*3] + */ + __pyx_v_slen = sqrt((((__pyx_v_spx * __pyx_v_spx) + (__pyx_v_spy * __pyx_v_spy)) + (__pyx_v_spz * __pyx_v_spz))); + + /* "newanalysis/gfunction/gfunction.pyx":611 + * else: + * off_diag = 1.0 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] + */ + } + + /* "newanalysis/gfunction/gfunction.pyx":617 + * slen = sqrt(spx*spx+spy*spy+spz*spz) + * + * dx = surr_xyz[j*3] - core_xyz[i*3] # <<<<<<<<<<<<<< + * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] + */ + __pyx_v_dx = ((__pyx_v_surr_xyz[(__pyx_v_j * 3)]) - (__pyx_v_core_xyz[(__pyx_v_i * 3)])); + + /* "newanalysis/gfunction/gfunction.pyx":618 + * + * dx = surr_xyz[j*3] - core_xyz[i*3] + * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] # <<<<<<<<<<<<<< + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] + * + */ + __pyx_v_dy = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 1)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 1)])); + + /* "newanalysis/gfunction/gfunction.pyx":619 + * dx = surr_xyz[j*3] - core_xyz[i*3] + * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] # <<<<<<<<<<<<<< + * + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] + */ + __pyx_v_dz = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 2)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 2)])); + + /* "newanalysis/gfunction/gfunction.pyx":621 + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] + * + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] # <<<<<<<<<<<<<< + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + */ + __pyx_t_5 = (fabs(__pyx_v_dx) > (__pyx_v_box_dim[3])); + if (__pyx_t_5) { + __pyx_v_dx = (__pyx_v_dx - (((0.0 < __pyx_v_dx) - (__pyx_v_dx < 0.0)) * (__pyx_v_box_dim[0]))); + } + + /* "newanalysis/gfunction/gfunction.pyx":622 + * + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] # <<<<<<<<<<<<<< + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + * dist = sqrt(dx*dx+dy*dy+dz*dz) + */ + __pyx_t_5 = (fabs(__pyx_v_dy) > (__pyx_v_box_dim[4])); + if (__pyx_t_5) { + __pyx_v_dy = (__pyx_v_dy - (((0.0 < __pyx_v_dy) - (__pyx_v_dy < 0.0)) * (__pyx_v_box_dim[1]))); + } + + /* "newanalysis/gfunction/gfunction.pyx":623 + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] # <<<<<<<<<<<<<< + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue + */ + __pyx_t_5 = (fabs(__pyx_v_dz) > (__pyx_v_box_dim[5])); + if (__pyx_t_5) { + __pyx_v_dz = (__pyx_v_dz - (((0.0 < __pyx_v_dz) - (__pyx_v_dz < 0.0)) * (__pyx_v_box_dim[2]))); + } - /* "View.MemoryView":1025 - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data - * result.view.ndim = ndim # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) + /* "newanalysis/gfunction/gfunction.pyx":624 + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + * dist = sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< + * if disthisto_max or floor(dist*invdx)==0: continue + * pos = floor((dist-histo_min)*invdx) */ - __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + __pyx_v_dist = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + + /* "newanalysis/gfunction/gfunction.pyx":625 + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue # <<<<<<<<<<<<<< + * pos = floor((dist-histo_min)*invdx) + * + */ + __pyx_t_6 = (__pyx_v_dist < __pyx_v_histo_min); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L32_bool_binop_done; + } + __pyx_t_6 = (__pyx_v_dist > __pyx_v_histo_max); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L32_bool_binop_done; + } + __pyx_t_6 = (floor((__pyx_v_dist * __pyx_v_invdx)) == 0.0); + __pyx_t_5 = __pyx_t_6; + __pyx_L32_bool_binop_done:; + if (__pyx_t_5) { + goto __pyx_L16_continue; + } + + /* "newanalysis/gfunction/gfunction.pyx":626 + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue + * pos = floor((dist-histo_min)*invdx) # <<<<<<<<<<<<<< + * + * #pos -> idx3 + */ + __pyx_v_pos = ((int)floor(((__pyx_v_dist - __pyx_v_histo_min) * __pyx_v_invdx))); + + /* "newanalysis/gfunction/gfunction.pyx":648 + * """ + * + * ix3 = pos*nshells # <<<<<<<<<<<<<< + * ix4 = shell + * + */ + __pyx_v_ix3 = (__pyx_v_pos * __pyx_v_nshells); + + /* "newanalysis/gfunction/gfunction.pyx":649 + * + * ix3 = pos*nshells + * ix4 = shell # <<<<<<<<<<<<<< + * + * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag + */ + __pyx_v_ix4 = __pyx_v_shell; + + /* "newanalysis/gfunction/gfunction.pyx":651 + * ix4 = shell + * + * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag # <<<<<<<<<<<<<< + * + * if mode_sel & 2 or mode_sel & 16: + */ + __pyx_t_5 = ((__pyx_v_mode_sel & 1) != 0); + if (__pyx_t_5) { + __pyx_t_10 = ((__pyx_v_ix2 + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_10]) = ((__pyx_v_dest[__pyx_t_10]) + (1.0 * __pyx_v_off_diag)); + } + + /* "newanalysis/gfunction/gfunction.pyx":653 + * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag + * + * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + */ + __pyx_t_6 = ((__pyx_v_mode_sel & 2) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L37_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 16) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L37_bool_binop_done:; + if (__pyx_t_5) { + + /* "newanalysis/gfunction/gfunction.pyx":654 + * + * if mode_sel & 2 or mode_sel & 16: + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) # <<<<<<<<<<<<<< + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + */ + __pyx_t_11 = (((__pyx_v_cpx * __pyx_v_spx) + (__pyx_v_cpy * __pyx_v_spy)) + (__pyx_v_cpz * __pyx_v_spz)); + __pyx_t_12 = (__pyx_v_clen * __pyx_v_slen); + if (unlikely(__pyx_t_12 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 654, __pyx_L8_error) + } + __pyx_v_incr = (__pyx_t_11 / __pyx_t_12); + + /* "newanalysis/gfunction/gfunction.pyx":655 + * if mode_sel & 2 or mode_sel & 16: + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: + */ + __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); + if (__pyx_t_5) { + __pyx_t_10 = (((__pyx_v_ix1 + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_10]) = ((__pyx_v_dest[__pyx_t_10]) + (__pyx_v_incr * __pyx_v_off_diag)); + } + + /* "newanalysis/gfunction/gfunction.pyx":656 + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 4 or mode_sel & 32: + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + */ + __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); + if (__pyx_t_5) { + __pyx_t_13 = ((((4 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); + } + + /* "newanalysis/gfunction/gfunction.pyx":653 + * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag + * + * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + */ + } + + /* "newanalysis/gfunction/gfunction.pyx":657 + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + */ + __pyx_t_6 = ((__pyx_v_mode_sel & 4) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L42_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 32) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L42_bool_binop_done:; + if (__pyx_t_5) { + + /* "newanalysis/gfunction/gfunction.pyx":658 + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) # <<<<<<<<<<<<<< + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + */ + __pyx_t_12 = (((__pyx_v_cpx * __pyx_v_dx) + (__pyx_v_cpy * __pyx_v_dy)) + (__pyx_v_cpz * __pyx_v_dz)); + __pyx_t_11 = (__pyx_v_clen * __pyx_v_dist); + if (unlikely(__pyx_t_11 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 658, __pyx_L8_error) + } + __pyx_v_incr = (__pyx_t_12 / __pyx_t_11); + + /* "newanalysis/gfunction/gfunction.pyx":659 + * if mode_sel & 4 or mode_sel & 32: + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: + */ + __pyx_t_5 = ((__pyx_v_mode_sel & 4) != 0); + if (__pyx_t_5) { + __pyx_t_13 = ((((2 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + (__pyx_v_incr * __pyx_v_off_diag)); + } + + /* "newanalysis/gfunction/gfunction.pyx":660 + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 8 or mode_sel & 64: + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + */ + __pyx_t_5 = ((__pyx_v_mode_sel & 32) != 0); + if (__pyx_t_5) { + __pyx_t_13 = ((((5 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); + } + + /* "newanalysis/gfunction/gfunction.pyx":657 + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + */ + } + + /* "newanalysis/gfunction/gfunction.pyx":661 + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag + */ + __pyx_t_6 = ((__pyx_v_mode_sel & 8) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L47_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 64) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L47_bool_binop_done:; + if (__pyx_t_5) { + + /* "newanalysis/gfunction/gfunction.pyx":662 + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) # <<<<<<<<<<<<<< + * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + */ + __pyx_t_11 = (((__pyx_v_spx * __pyx_v_dx) + (__pyx_v_spy * __pyx_v_dy)) + (__pyx_v_spz * __pyx_v_dz)); + __pyx_t_12 = (__pyx_v_slen * __pyx_v_dist); + if (unlikely(__pyx_t_12 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 662, __pyx_L8_error) + } + __pyx_v_incr = (__pyx_t_11 / __pyx_t_12); + + /* "newanalysis/gfunction/gfunction.pyx":663 + * if mode_sel & 8 or mode_sel & 64: + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * + */ + __pyx_t_5 = ((__pyx_v_mode_sel & 8) != 0); + if (__pyx_t_5) { + __pyx_t_13 = ((((3 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + (__pyx_v_incr * __pyx_v_off_diag)); + } + + /* "newanalysis/gfunction/gfunction.pyx":664 + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_5 = ((__pyx_v_mode_sel & 64) != 0); + if (__pyx_t_5) { + __pyx_t_13 = ((((6 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); + } + + /* "newanalysis/gfunction/gfunction.pyx":661 + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag + */ + } + __pyx_L16_continue:; + } + goto __pyx_L52; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L51; + __pyx_L51:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates1) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_clen; + __pyx_parallel_temp1 = __pyx_v_cpx; + __pyx_parallel_temp2 = __pyx_v_cpy; + __pyx_parallel_temp3 = __pyx_v_cpz; + __pyx_parallel_temp4 = __pyx_v_dist; + __pyx_parallel_temp5 = __pyx_v_ds_pos1; + __pyx_parallel_temp6 = __pyx_v_ds_pos2; + __pyx_parallel_temp7 = __pyx_v_dx; + __pyx_parallel_temp8 = __pyx_v_dy; + __pyx_parallel_temp9 = __pyx_v_dz; + __pyx_parallel_temp10 = __pyx_v_i; + __pyx_parallel_temp11 = __pyx_v_incr; + __pyx_parallel_temp12 = __pyx_v_ix2; + __pyx_parallel_temp13 = __pyx_v_ix3; + __pyx_parallel_temp14 = __pyx_v_ix4; + __pyx_parallel_temp15 = __pyx_v_j; + __pyx_parallel_temp16 = __pyx_v_j_begin; + __pyx_parallel_temp17 = __pyx_v_off_diag; + __pyx_parallel_temp18 = __pyx_v_pos; + __pyx_parallel_temp19 = __pyx_v_shell; + __pyx_parallel_temp20 = __pyx_v_slen; + __pyx_parallel_temp21 = __pyx_v_spx; + __pyx_parallel_temp22 = __pyx_v_spy; + __pyx_parallel_temp23 = __pyx_v_spz; + } + __pyx_L52:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP +} +#endif /* _OPENMP */ + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_clen = __pyx_parallel_temp0; + __pyx_v_cpx = __pyx_parallel_temp1; + __pyx_v_cpy = __pyx_parallel_temp2; + __pyx_v_cpz = __pyx_parallel_temp3; + __pyx_v_dist = __pyx_parallel_temp4; + __pyx_v_ds_pos1 = __pyx_parallel_temp5; + __pyx_v_ds_pos2 = __pyx_parallel_temp6; + __pyx_v_dx = __pyx_parallel_temp7; + __pyx_v_dy = __pyx_parallel_temp8; + __pyx_v_dz = __pyx_parallel_temp9; + __pyx_v_i = __pyx_parallel_temp10; + __pyx_v_incr = __pyx_parallel_temp11; + __pyx_v_ix2 = __pyx_parallel_temp12; + __pyx_v_ix3 = __pyx_parallel_temp13; + __pyx_v_ix4 = __pyx_parallel_temp14; + __pyx_v_j = __pyx_parallel_temp15; + __pyx_v_j_begin = __pyx_parallel_temp16; + __pyx_v_off_diag = __pyx_parallel_temp17; + __pyx_v_pos = __pyx_parallel_temp18; + __pyx_v_shell = __pyx_parallel_temp19; + __pyx_v_slen = __pyx_parallel_temp20; + __pyx_v_spx = __pyx_parallel_temp21; + __pyx_v_spy = __pyx_parallel_temp22; + __pyx_v_spz = __pyx_parallel_temp23; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/gfunction/gfunction.pyx":586 + * #TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells + * + * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< + * #ix2=i*histo_n + * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; + } + } + + /* "newanalysis/gfunction/gfunction.pyx":570 + * ################################################################################################### + * + * cdef void calcHistoVoronoi(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, + * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel, int nm_core, int nm_surround, int nshells, int * delaunay_matrix): + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.gfunction.calcHistoVoronoi", __pyx_clineno, __pyx_lineno, __pyx_filename); + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_RefNannyFinishContext(); +} + +/* "newanalysis/gfunction/gfunction.pyx":667 + * + * + * cdef void calcHistoVoronoiNonSelf(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, + * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel, int nm_core, int nm_surround, int nshells, int * delaunay_matrix): + */ + +static void __pyx_f_11newanalysis_9gfunction_calcHistoVoronoiNonSelf(double *__pyx_v_core_xyz, double *__pyx_v_surr_xyz, double *__pyx_v_core_dip, double *__pyx_v_surr_dip, PyArrayObject *__pyx_v_np_dest, PyArrayObject *__pyx_v_np_box_dim, int __pyx_v_ncore, int __pyx_v_nsurround, float __pyx_v_histo_min, float __pyx_v_histo_max, int __pyx_v_histo_n, double __pyx_v_invdx, int __pyx_v_mode_sel, int __pyx_v_nm_core, int __pyx_v_nm_surround, int __pyx_v_nshells, int *__pyx_v_delaunay_matrix) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_pos; + int __pyx_v_ix1; + int __pyx_v_ix2; + int __pyx_v_j_begin; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_dist; + double __pyx_v_cpx; + double __pyx_v_cpy; + double __pyx_v_cpz; + double __pyx_v_spx; + double __pyx_v_spy; + double __pyx_v_spz; + double __pyx_v_slen; + double __pyx_v_clen; + double __pyx_v_incr; + double __pyx_v_off_diag; + double *__pyx_v_dest; + double *__pyx_v_box_dim; + int __pyx_v_ds_pos1; + int __pyx_v_ds_pos2; + int __pyx_v_shell; + int __pyx_v_ix3; + int __pyx_v_ix4; + int __pyx_v_apr_core; + int __pyx_v_apr_surround; + __Pyx_LocalBuf_ND __pyx_pybuffernd_np_box_dim; + __Pyx_Buffer __pyx_pybuffer_np_box_dim; + __Pyx_LocalBuf_ND __pyx_pybuffernd_np_dest; + __Pyx_Buffer __pyx_pybuffer_np_dest; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + double __pyx_t_11; + double __pyx_t_12; + long __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcHistoVoronoiNonSelf", 0); + __pyx_pybuffer_np_dest.pybuffer.buf = NULL; + __pyx_pybuffer_np_dest.refcount = 0; + __pyx_pybuffernd_np_dest.data = NULL; + __pyx_pybuffernd_np_dest.rcbuffer = &__pyx_pybuffer_np_dest; + __pyx_pybuffer_np_box_dim.pybuffer.buf = NULL; + __pyx_pybuffer_np_box_dim.refcount = 0; + __pyx_pybuffernd_np_box_dim.data = NULL; + __pyx_pybuffernd_np_box_dim.rcbuffer = &__pyx_pybuffer_np_box_dim; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_dest, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 667, __pyx_L1_error) + } + __pyx_pybuffernd_np_dest.diminfo[0].strides = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_dest.diminfo[0].shape = __pyx_pybuffernd_np_dest.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_box_dim, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 667, __pyx_L1_error) + } + __pyx_pybuffernd_np_box_dim.diminfo[0].strides = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_box_dim.diminfo[0].shape = __pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer.shape[0]; + + /* "newanalysis/gfunction/gfunction.pyx":672 + * + * #cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 # Change ix1, ix2 + * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 + * cdef double *dest = np_dest.data + */ + __pyx_v_ix1 = ((__pyx_v_nshells * __pyx_v_ncore) * __pyx_v_histo_n); + __pyx_v_j_begin = 0; + + /* "newanalysis/gfunction/gfunction.pyx":673 + * #cdef int i, j, pos, ix1=ncore*histo_n, ix2, j_begin=0 # Change ix1, ix2 + * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 # <<<<<<<<<<<<<< + * cdef double *dest = np_dest.data + * cdef double *box_dim = np_box_dim.data + */ + __pyx_v_off_diag = 1.0; + + /* "newanalysis/gfunction/gfunction.pyx":674 + * cdef int i, j, pos, ix1=nshells*ncore*histo_n, ix2, j_begin=0 #ROLLBACK: ERASE THIS, UNCOMMENT ABOVE + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 + * cdef double *dest = np_dest.data # <<<<<<<<<<<<<< + * cdef double *box_dim = np_box_dim.data + * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 + */ + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_np_dest)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 674, __pyx_L1_error) + __pyx_v_dest = ((double *)__pyx_t_1); + + /* "newanalysis/gfunction/gfunction.pyx":675 + * cdef double dx, dy, dz, dist, cpx, cpy, cpz, spx, spy, spz, slen, clen, incr, off_diag=1.0 + * cdef double *dest = np_dest.data + * cdef double *box_dim = np_box_dim.data # <<<<<<<<<<<<<< + * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 + * cdef int apr_core = ncore // nm_core + */ + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_np_box_dim)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 675, __pyx_L1_error) + __pyx_v_box_dim = ((double *)__pyx_t_1); + + /* "newanalysis/gfunction/gfunction.pyx":677 + * cdef double *box_dim = np_box_dim.data + * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 + * cdef int apr_core = ncore // nm_core # <<<<<<<<<<<<<< + * cdef int apr_surround = nsurround // nm_surround + * + */ + if (unlikely(__pyx_v_nm_core == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 677, __pyx_L1_error) + } + else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nm_core == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_ncore))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 677, __pyx_L1_error) + } + __pyx_v_apr_core = __Pyx_div_int(__pyx_v_ncore, __pyx_v_nm_core); - /* "View.MemoryView":1026 - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "newanalysis/gfunction/gfunction.pyx":678 + * cdef int ds_pos1, ds_pos2, shell, ix3, ix4 + * cdef int apr_core = ncore // nm_core + * cdef int apr_surround = nsurround // nm_surround # <<<<<<<<<<<<<< + * * */ - ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + if (unlikely(__pyx_v_nm_surround == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 678, __pyx_L1_error) + } + else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nm_surround == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_nsurround))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 678, __pyx_L1_error) + } + __pyx_v_apr_surround = __Pyx_div_int(__pyx_v_nsurround, __pyx_v_nm_surround); - /* "View.MemoryView":1027 - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":683 + * #TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< + * #ix2=i*histo_n + * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE */ - Py_INCREF(Py_None); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_2 = __pyx_v_ncore; + { + double __pyx_parallel_temp0 = ((double)__PYX_NAN()); + double __pyx_parallel_temp1 = ((double)__PYX_NAN()); + double __pyx_parallel_temp2 = ((double)__PYX_NAN()); + double __pyx_parallel_temp3 = ((double)__PYX_NAN()); + double __pyx_parallel_temp4 = ((double)__PYX_NAN()); + int __pyx_parallel_temp5 = ((int)0xbad0bad0); + int __pyx_parallel_temp6 = ((int)0xbad0bad0); + double __pyx_parallel_temp7 = ((double)__PYX_NAN()); + double __pyx_parallel_temp8 = ((double)__PYX_NAN()); + double __pyx_parallel_temp9 = ((double)__PYX_NAN()); + int __pyx_parallel_temp10 = ((int)0xbad0bad0); + double __pyx_parallel_temp11 = ((double)__PYX_NAN()); + int __pyx_parallel_temp12 = ((int)0xbad0bad0); + int __pyx_parallel_temp13 = ((int)0xbad0bad0); + int __pyx_parallel_temp14 = ((int)0xbad0bad0); + int __pyx_parallel_temp15 = ((int)0xbad0bad0); + int __pyx_parallel_temp16 = ((int)0xbad0bad0); + double __pyx_parallel_temp17 = ((double)__PYX_NAN()); + int __pyx_parallel_temp18 = ((int)0xbad0bad0); + int __pyx_parallel_temp19 = ((int)0xbad0bad0); + double __pyx_parallel_temp20 = ((double)__PYX_NAN()); + double __pyx_parallel_temp21 = ((double)__PYX_NAN()); + double __pyx_parallel_temp22 = ((double)__PYX_NAN()); + double __pyx_parallel_temp23 = ((double)__PYX_NAN()); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_4 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_4 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_clen) lastprivate(__pyx_v_cpx) lastprivate(__pyx_v_cpy) lastprivate(__pyx_v_cpz) lastprivate(__pyx_v_dist) lastprivate(__pyx_v_ds_pos1) lastprivate(__pyx_v_ds_pos2) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_incr) lastprivate(__pyx_v_ix2) lastprivate(__pyx_v_ix3) lastprivate(__pyx_v_ix4) lastprivate(__pyx_v_j) lastprivate(__pyx_v_j_begin) lastprivate(__pyx_v_off_diag) lastprivate(__pyx_v_pos) lastprivate(__pyx_v_shell) lastprivate(__pyx_v_slen) lastprivate(__pyx_v_spx) lastprivate(__pyx_v_spy) lastprivate(__pyx_v_spz) + #endif /* _OPENMP */ + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_3); + /* Initialize private variables to invalid values */ + __pyx_v_clen = ((double)__PYX_NAN()); + __pyx_v_cpx = ((double)__PYX_NAN()); + __pyx_v_cpy = ((double)__PYX_NAN()); + __pyx_v_cpz = ((double)__PYX_NAN()); + __pyx_v_dist = ((double)__PYX_NAN()); + __pyx_v_ds_pos1 = ((int)0xbad0bad0); + __pyx_v_ds_pos2 = ((int)0xbad0bad0); + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_incr = ((double)__PYX_NAN()); + __pyx_v_ix2 = ((int)0xbad0bad0); + __pyx_v_ix3 = ((int)0xbad0bad0); + __pyx_v_ix4 = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_j_begin = ((int)0xbad0bad0); + __pyx_v_off_diag = ((double)__PYX_NAN()); + __pyx_v_pos = ((int)0xbad0bad0); + __pyx_v_shell = ((int)0xbad0bad0); + __pyx_v_slen = ((double)__PYX_NAN()); + __pyx_v_spx = ((double)__PYX_NAN()); + __pyx_v_spy = ((double)__PYX_NAN()); + __pyx_v_spz = ((double)__PYX_NAN()); - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) + /* "newanalysis/gfunction/gfunction.pyx":685 + * for i in prange(ncore, nogil=True): + * #ix2=i*histo_n + * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE # <<<<<<<<<<<<<< + * ds_pos1 = i//apr_core * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: */ - __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_1) { + __pyx_v_ix2 = ((__pyx_v_i * __pyx_v_nshells) * __pyx_v_histo_n); - /* "View.MemoryView":1030 + /* "newanalysis/gfunction/gfunction.pyx":686 + * #ix2=i*histo_n + * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE + * ds_pos1 = i//apr_core # <<<<<<<<<<<<<< * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: - * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< - * else: - * result.flags = PyBUF_RECORDS_RO + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: */ - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + if (unlikely(__pyx_v_apr_core == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 686, __pyx_L8_error) + } + else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_apr_core == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_i))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 686, __pyx_L8_error) + } + __pyx_v_ds_pos1 = __Pyx_div_int(__pyx_v_i, __pyx_v_apr_core); - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) + /* "newanalysis/gfunction/gfunction.pyx":688 + * ds_pos1 = i//apr_core * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] */ - goto __pyx_L4; - } + __pyx_t_6 = ((__pyx_v_mode_sel & 2) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 4) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 16) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 32) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L11_bool_binop_done:; + if (__pyx_t_5) { - /* "View.MemoryView":1032 - * result.flags = PyBUF_RECORDS - * else: - * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":689 * - * result.view.shape = result.from_slice.shape + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * cpx = core_dip[i*3] # <<<<<<<<<<<<<< + * cpy = core_dip[i*3+1] + * cpz = core_dip[i*3+2] */ - /*else*/ { - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; - } - __pyx_L4:; + __pyx_v_cpx = (__pyx_v_core_dip[(__pyx_v_i * 3)]); - /* "View.MemoryView":1034 - * result.flags = PyBUF_RECORDS_RO - * - * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< - * result.view.strides = result.from_slice.strides - * + /* "newanalysis/gfunction/gfunction.pyx":690 + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] # <<<<<<<<<<<<<< + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) */ - __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + __pyx_v_cpy = (__pyx_v_core_dip[((__pyx_v_i * 3) + 1)]); - /* "View.MemoryView":1035 - * - * result.view.shape = result.from_slice.shape - * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< - * - * + /* "newanalysis/gfunction/gfunction.pyx":691 + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] + * cpz = core_dip[i*3+2] # <<<<<<<<<<<<<< + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: */ - __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + __pyx_v_cpz = (__pyx_v_core_dip[((__pyx_v_i * 3) + 2)]); - /* "View.MemoryView":1038 - * - * - * result.view.suboffsets = NULL # <<<<<<<<<<<<<< - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: + /* "newanalysis/gfunction/gfunction.pyx":692 + * cpy = core_dip[i*3+1] + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) # <<<<<<<<<<<<<< + * if ncore == nsurround: + * j_begin = i */ - __pyx_v_result->__pyx_base.view.suboffsets = NULL; + __pyx_v_clen = sqrt((((__pyx_v_cpx * __pyx_v_cpx) + (__pyx_v_cpy * __pyx_v_cpy)) + (__pyx_v_cpz * __pyx_v_cpz))); - /* "View.MemoryView":1039 + /* "newanalysis/gfunction/gfunction.pyx":688 + * ds_pos1 = i//apr_core * - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets + * if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: # <<<<<<<<<<<<<< + * cpx = core_dip[i*3] + * cpy = core_dip[i*3+1] */ - __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_v_suboffset = (__pyx_t_6[0]); + } - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break + /* "newanalysis/gfunction/gfunction.pyx":693 + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: # <<<<<<<<<<<<<< + * j_begin = i + * else: */ - __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_1) { + __pyx_t_5 = (__pyx_v_ncore == __pyx_v_nsurround); + if (__pyx_t_5) { - /* "View.MemoryView":1041 - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< - * break - * + /* "newanalysis/gfunction/gfunction.pyx":694 + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: + * j_begin = i # <<<<<<<<<<<<<< + * else: + * j_begin = 0 */ - __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + __pyx_v_j_begin = __pyx_v_i; - /* "View.MemoryView":1042 - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - * break # <<<<<<<<<<<<<< - * - * result.view.len = result.view.itemsize + /* "newanalysis/gfunction/gfunction.pyx":693 + * cpz = core_dip[i*3+2] + * clen = sqrt(cpx*cpx+cpy*cpy+cpz*cpz) + * if ncore == nsurround: # <<<<<<<<<<<<<< + * j_begin = i + * else: */ - goto __pyx_L6_break; + goto __pyx_L15; + } - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break + /* "newanalysis/gfunction/gfunction.pyx":696 + * j_begin = i + * else: + * j_begin = 0 # <<<<<<<<<<<<<< + * for j in range(j_begin,nsurround): + * ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 3 */ - } - } - __pyx_L6_break:; + /*else*/ { + __pyx_v_j_begin = 0; + } + __pyx_L15:; - /* "View.MemoryView":1044 - * break - * - * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< - * for length in result.view.shape[:ndim]: - * result.view.len *= length + /* "newanalysis/gfunction/gfunction.pyx":697 + * else: + * j_begin = 0 + * for j in range(j_begin,nsurround): # <<<<<<<<<<<<<< + * ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 3 + * if(ds_pos1 == ds_pos2): continue */ - __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + __pyx_t_7 = __pyx_v_nsurround; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = __pyx_v_j_begin; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_j = __pyx_t_9; - /* "View.MemoryView":1045 - * - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< - * result.view.len *= length - * + /* "newanalysis/gfunction/gfunction.pyx":698 + * j_begin = 0 + * for j in range(j_begin,nsurround): + * ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 3 # <<<<<<<<<<<<<< + * if(ds_pos1 == ds_pos2): continue + * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? */ - __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1045, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); - __pyx_t_2 = 0; + if (unlikely(__pyx_v_apr_surround == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 698, __pyx_L8_error) + } + else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_apr_surround == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_j))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 698, __pyx_L8_error) + } + __pyx_v_ds_pos2 = __Pyx_div_int(__pyx_v_j, __pyx_v_apr_surround); - /* "View.MemoryView":1046 - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: - * result.view.len *= length # <<<<<<<<<<<<<< - * - * result.to_object_func = to_object_func + /* "newanalysis/gfunction/gfunction.pyx":699 + * for j in range(j_begin,nsurround): + * ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 3 + * if(ds_pos1 == ds_pos2): continue # <<<<<<<<<<<<<< + * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? + * shell = shell-1 */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - } + __pyx_t_5 = (__pyx_v_ds_pos1 == __pyx_v_ds_pos2); + if (__pyx_t_5) { + goto __pyx_L16_continue; + } - /* "View.MemoryView":1048 - * result.view.len *= length - * - * result.to_object_func = to_object_func # <<<<<<<<<<<<<< - * result.to_dtype_func = to_dtype_func - * + /* "newanalysis/gfunction/gfunction.pyx":700 + * ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 3 + * if(ds_pos1 == ds_pos2): continue + * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? # <<<<<<<<<<<<<< + * shell = shell-1 + * if shell < 0: shell = nshells-1 */ - __pyx_v_result->to_object_func = __pyx_v_to_object_func; + __pyx_v_shell = (__pyx_v_delaunay_matrix[((__pyx_v_ds_pos1 * __pyx_v_nsurround) + __pyx_v_ds_pos2)]); - /* "View.MemoryView":1049 - * - * result.to_object_func = to_object_func - * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< - * - * return result + /* "newanalysis/gfunction/gfunction.pyx":701 + * if(ds_pos1 == ds_pos2): continue + * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? + * shell = shell-1 # <<<<<<<<<<<<<< + * if shell < 0: shell = nshells-1 + * if shell >= nshells: shell = nshells-1 */ - __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + __pyx_v_shell = (__pyx_v_shell - 1); - /* "View.MemoryView":1051 - * result.to_dtype_func = to_dtype_func - * - * return result # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":702 + * shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? + * shell = shell-1 + * if shell < 0: shell = nshells-1 # <<<<<<<<<<<<<< + * if shell >= nshells: shell = nshells-1 * - * @cname('__pyx_memoryview_get_slice_from_memoryview') */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + __pyx_t_5 = (__pyx_v_shell < 0); + if (__pyx_t_5) { + __pyx_v_shell = (__pyx_v_nshells - 1); + } - /* "View.MemoryView":1001 + /* "newanalysis/gfunction/gfunction.pyx":703 + * shell = shell-1 + * if shell < 0: shell = nshells-1 + * if shell >= nshells: shell = nshells-1 # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), + * if ncore == nsurround and i != j: */ + __pyx_t_5 = (__pyx_v_shell >= __pyx_v_nshells); + if (__pyx_t_5) { + __pyx_v_shell = (__pyx_v_nshells - 1); + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1054 + /* "newanalysis/gfunction/gfunction.pyx":705 + * if shell >= nshells: shell = nshells-1 * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj + * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< + * off_diag = 2.0 + * else: */ + __pyx_t_6 = (__pyx_v_ncore == __pyx_v_nsurround); + if (__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L22_bool_binop_done; + } + __pyx_t_6 = (__pyx_v_i != __pyx_v_j); + __pyx_t_5 = __pyx_t_6; + __pyx_L22_bool_binop_done:; + if (__pyx_t_5) { -static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { - struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; - __Pyx_memviewslice *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "newanalysis/gfunction/gfunction.pyx":706 + * + * if ncore == nsurround and i != j: + * off_diag = 2.0 # <<<<<<<<<<<<<< + * else: + * off_diag = 1.0 */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_v_off_diag = 2.0; - /* "View.MemoryView":1058 - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): - * obj = memview # <<<<<<<<<<<<<< - * return &obj.from_slice - * else: + /* "newanalysis/gfunction/gfunction.pyx":705 + * if shell >= nshells: shell = nshells-1 + * + * if ncore == nsurround and i != j: # <<<<<<<<<<<<<< + * off_diag = 2.0 + * else: */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1058, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + goto __pyx_L21; + } - /* "View.MemoryView":1059 - * if isinstance(memview, _memoryviewslice): - * obj = memview - * return &obj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, mslice) + /* "newanalysis/gfunction/gfunction.pyx":708 + * off_diag = 2.0 + * else: + * off_diag = 1.0 # <<<<<<<<<<<<<< + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: + * spx = surr_dip[j*3] */ - __pyx_r = (&__pyx_v_obj->from_slice); - goto __pyx_L0; + /*else*/ { + __pyx_v_off_diag = 1.0; + } + __pyx_L21:; - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "newanalysis/gfunction/gfunction.pyx":709 + * else: + * off_diag = 1.0 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] */ - } + __pyx_t_6 = ((__pyx_v_mode_sel & 2) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L25_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 8) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L25_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 16) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L25_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 64) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L25_bool_binop_done:; + if (__pyx_t_5) { - /* "View.MemoryView":1061 - * return &obj.from_slice - * else: - * slice_copy(memview, mslice) # <<<<<<<<<<<<<< - * return mslice - * + /* "newanalysis/gfunction/gfunction.pyx":710 + * off_diag = 1.0 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: + * spx = surr_dip[j*3] # <<<<<<<<<<<<<< + * spy = surr_dip[j*3+1] + * spz = surr_dip[j*3+2] */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + __pyx_v_spx = (__pyx_v_surr_dip[(__pyx_v_j * 3)]); - /* "View.MemoryView":1062 - * else: - * slice_copy(memview, mslice) - * return mslice # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_slice_copy') + /* "newanalysis/gfunction/gfunction.pyx":711 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] # <<<<<<<<<<<<<< + * spz = surr_dip[j*3+2] + * slen = sqrt(spx*spx+spy*spy+spz*spz) */ - __pyx_r = __pyx_v_mslice; - goto __pyx_L0; - } + __pyx_v_spy = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 1)]); - /* "View.MemoryView":1054 + /* "newanalysis/gfunction/gfunction.pyx":712 + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] + * spz = surr_dip[j*3+2] # <<<<<<<<<<<<<< + * slen = sqrt(spx*spx+spy*spy+spz*spz) * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj */ + __pyx_v_spz = (__pyx_v_surr_dip[((__pyx_v_j * 3) + 2)]); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_obj); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1065 + /* "newanalysis/gfunction/gfunction.pyx":713 + * spy = surr_dip[j*3+1] + * spz = surr_dip[j*3+2] + * slen = sqrt(spx*spx+spy*spy+spz*spz) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets + * dx = surr_xyz[j*3] - core_xyz[i*3] */ + __pyx_v_slen = sqrt((((__pyx_v_spx * __pyx_v_spx) + (__pyx_v_spy * __pyx_v_spy)) + (__pyx_v_spz * __pyx_v_spz))); -static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { - int __pyx_v_dim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - Py_ssize_t *__pyx_v_suboffsets; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("slice_copy", 0); + /* "newanalysis/gfunction/gfunction.pyx":709 + * else: + * off_diag = 1.0 + * if mode_sel & 2 or mode_sel & 8 or mode_sel & 16 or mode_sel & 64: # <<<<<<<<<<<<<< + * spx = surr_dip[j*3] + * spy = surr_dip[j*3+1] + */ + } - /* "View.MemoryView":1069 - * cdef (Py_ssize_t*) shape, strides, suboffsets + /* "newanalysis/gfunction/gfunction.pyx":715 + * slen = sqrt(spx*spx+spy*spy+spz*spz) * - * shape = memview.view.shape # <<<<<<<<<<<<<< - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets + * dx = surr_xyz[j*3] - core_xyz[i*3] # <<<<<<<<<<<<<< + * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] */ - __pyx_t_1 = __pyx_v_memview->view.shape; - __pyx_v_shape = __pyx_t_1; + __pyx_v_dx = ((__pyx_v_surr_xyz[(__pyx_v_j * 3)]) - (__pyx_v_core_xyz[(__pyx_v_i * 3)])); - /* "View.MemoryView":1070 + /* "newanalysis/gfunction/gfunction.pyx":716 * - * shape = memview.view.shape - * strides = memview.view.strides # <<<<<<<<<<<<<< - * suboffsets = memview.view.suboffsets + * dx = surr_xyz[j*3] - core_xyz[i*3] + * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] # <<<<<<<<<<<<<< + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] * */ - __pyx_t_1 = __pyx_v_memview->view.strides; - __pyx_v_strides = __pyx_t_1; + __pyx_v_dy = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 1)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 1)])); - /* "View.MemoryView":1071 - * shape = memview.view.shape - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":717 + * dx = surr_xyz[j*3] - core_xyz[i*3] + * dy = surr_xyz[j*3+1] - core_xyz[i*3+1] + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] # <<<<<<<<<<<<<< * - * dst.memview = <__pyx_memoryview *> memview + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] */ - __pyx_t_1 = __pyx_v_memview->view.suboffsets; - __pyx_v_suboffsets = __pyx_t_1; + __pyx_v_dz = ((__pyx_v_surr_xyz[((__pyx_v_j * 3) + 2)]) - (__pyx_v_core_xyz[((__pyx_v_i * 3) + 2)])); - /* "View.MemoryView":1073 - * suboffsets = memview.view.suboffsets - * - * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< - * dst.data = memview.view.buf + /* "newanalysis/gfunction/gfunction.pyx":719 + * dz = surr_xyz[j*3+2] - core_xyz[i*3+2] * + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] # <<<<<<<<<<<<<< + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] */ - __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + __pyx_t_5 = (fabs(__pyx_v_dx) > (__pyx_v_box_dim[3])); + if (__pyx_t_5) { + __pyx_v_dx = (__pyx_v_dx - (((0.0 < __pyx_v_dx) - (__pyx_v_dx < 0.0)) * (__pyx_v_box_dim[0]))); + } - /* "View.MemoryView":1074 - * - * dst.memview = <__pyx_memoryview *> memview - * dst.data = memview.view.buf # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":720 * - * for dim in range(memview.view.ndim): + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] # <<<<<<<<<<<<<< + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + * dist = sqrt(dx*dx+dy*dy+dz*dz) */ - __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + __pyx_t_5 = (fabs(__pyx_v_dy) > (__pyx_v_box_dim[4])); + if (__pyx_t_5) { + __pyx_v_dy = (__pyx_v_dy - (((0.0 < __pyx_v_dy) - (__pyx_v_dy < 0.0)) * (__pyx_v_box_dim[1]))); + } - /* "View.MemoryView":1076 - * dst.data = memview.view.buf + /* "newanalysis/gfunction/gfunction.pyx":721 + * if fabs(dx) > box_dim[3]: dx = dx-((0.0 < dx) - (dx < 0.0))*box_dim[0] + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] # <<<<<<<<<<<<<< + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue + */ + __pyx_t_5 = (fabs(__pyx_v_dz) > (__pyx_v_box_dim[5])); + if (__pyx_t_5) { + __pyx_v_dz = (__pyx_v_dz - (((0.0 < __pyx_v_dz) - (__pyx_v_dz < 0.0)) * (__pyx_v_box_dim[2]))); + } + + /* "newanalysis/gfunction/gfunction.pyx":722 + * if fabs(dy) > box_dim[4]: dy = dy-((0.0 < dy) - (dy < 0.0))*box_dim[1] + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + * dist = sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< + * if disthisto_max or floor(dist*invdx)==0: continue + * pos = floor((dist-histo_min)*invdx) + */ + __pyx_v_dist = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + + /* "newanalysis/gfunction/gfunction.pyx":723 + * if fabs(dz) > box_dim[5]: dz = dz-((0.0 < dz) - (dz < 0.0))*box_dim[2] + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue # <<<<<<<<<<<<<< + * pos = floor((dist-histo_min)*invdx) * - * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] */ - __pyx_t_2 = __pyx_v_memview->view.ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_dim = __pyx_t_4; + __pyx_t_6 = (__pyx_v_dist < __pyx_v_histo_min); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L33_bool_binop_done; + } + __pyx_t_6 = (__pyx_v_dist > __pyx_v_histo_max); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L33_bool_binop_done; + } + __pyx_t_6 = (floor((__pyx_v_dist * __pyx_v_invdx)) == 0.0); + __pyx_t_5 = __pyx_t_6; + __pyx_L33_bool_binop_done:; + if (__pyx_t_5) { + goto __pyx_L16_continue; + } - /* "View.MemoryView":1077 + /* "newanalysis/gfunction/gfunction.pyx":724 + * dist = sqrt(dx*dx+dy*dy+dz*dz) + * if disthisto_max or floor(dist*invdx)==0: continue + * pos = floor((dist-histo_min)*invdx) # <<<<<<<<<<<<<< * - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * #pos -> idx3 */ - (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + __pyx_v_pos = ((int)floor(((__pyx_v_dist - __pyx_v_histo_min) * __pyx_v_invdx))); - /* "View.MemoryView":1078 - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + /* "newanalysis/gfunction/gfunction.pyx":746 + * """ + * + * ix3 = pos*nshells # <<<<<<<<<<<<<< + * ix4 = shell * */ - (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + __pyx_v_ix3 = (__pyx_v_pos * __pyx_v_nshells); - /* "View.MemoryView":1079 - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":747 * - * @cname('__pyx_memoryview_copy_object') + * ix3 = pos*nshells + * ix4 = shell # <<<<<<<<<<<<<< + * + * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag */ - if ((__pyx_v_suboffsets != 0)) { - __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); - } else { - __pyx_t_5 = -1L; - } - (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; - } + __pyx_v_ix4 = __pyx_v_shell; - /* "View.MemoryView":1065 + /* "newanalysis/gfunction/gfunction.pyx":749 + * ix4 = shell * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets + * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag # <<<<<<<<<<<<<< + * + * if mode_sel & 2 or mode_sel & 16: */ + __pyx_t_5 = ((__pyx_v_mode_sel & 1) != 0); + if (__pyx_t_5) { + __pyx_t_10 = ((__pyx_v_ix2 + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_10]) = ((__pyx_v_dest[__pyx_t_10]) + (1.0 * __pyx_v_off_diag)); + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} + /* "newanalysis/gfunction/gfunction.pyx":751 + * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag + * + * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + */ + __pyx_t_6 = ((__pyx_v_mode_sel & 2) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L38_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 16) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L38_bool_binop_done:; + if (__pyx_t_5) { -/* "View.MemoryView":1082 + /* "newanalysis/gfunction/gfunction.pyx":752 * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice + * if mode_sel & 2 or mode_sel & 16: + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) # <<<<<<<<<<<<<< + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag */ + __pyx_t_11 = (((__pyx_v_cpx * __pyx_v_spx) + (__pyx_v_cpy * __pyx_v_spy)) + (__pyx_v_cpz * __pyx_v_spz)); + __pyx_t_12 = (__pyx_v_clen * __pyx_v_slen); + if (unlikely(__pyx_t_12 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 752, __pyx_L8_error) + } + __pyx_v_incr = (__pyx_t_11 / __pyx_t_12); -static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { - __Pyx_memviewslice __pyx_v_memviewslice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy", 0); + /* "newanalysis/gfunction/gfunction.pyx":753 + * if mode_sel & 2 or mode_sel & 16: + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: + */ + __pyx_t_5 = ((__pyx_v_mode_sel & 2) != 0); + if (__pyx_t_5) { + __pyx_t_10 = (((__pyx_v_ix1 + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_10]) = ((__pyx_v_dest[__pyx_t_10]) + (__pyx_v_incr * __pyx_v_off_diag)); + } - /* "View.MemoryView":1085 - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< - * return memoryview_copy_from_slice(memview, &memviewslice) - * + /* "newanalysis/gfunction/gfunction.pyx":754 + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 4 or mode_sel & 32: + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) */ - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + __pyx_t_5 = ((__pyx_v_mode_sel & 16) != 0); + if (__pyx_t_5) { + __pyx_t_13 = ((((4 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); + } - /* "View.MemoryView":1086 - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) - * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":751 + * if mode_sel & 1: dest[ix2+ix3+ix4]+=1.0*off_diag * - * @cname('__pyx_memoryview_copy_object_from_slice') + * if mode_sel & 2 or mode_sel & 16: # <<<<<<<<<<<<<< + * incr = (cpx*spx+cpy*spy+cpz*spz)/(clen*slen) + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1086, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + } - /* "View.MemoryView":1082 - * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice + /* "newanalysis/gfunction/gfunction.pyx":755 + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag */ + __pyx_t_6 = ((__pyx_v_mode_sel & 4) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L43_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 32) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L43_bool_binop_done:; + if (__pyx_t_5) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/gfunction/gfunction.pyx":756 + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) # <<<<<<<<<<<<<< + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + */ + __pyx_t_12 = (((__pyx_v_cpx * __pyx_v_dx) + (__pyx_v_cpy * __pyx_v_dy)) + (__pyx_v_cpz * __pyx_v_dz)); + __pyx_t_11 = (__pyx_v_clen * __pyx_v_dist); + if (unlikely(__pyx_t_11 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 756, __pyx_L8_error) + } + __pyx_v_incr = (__pyx_t_12 / __pyx_t_11); -/* "View.MemoryView":1089 - * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. + /* "newanalysis/gfunction/gfunction.pyx":757 + * if mode_sel & 4 or mode_sel & 32: + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: */ + __pyx_t_5 = ((__pyx_v_mode_sel & 4) != 0); + if (__pyx_t_5) { + __pyx_t_13 = ((((2 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + (__pyx_v_incr * __pyx_v_off_diag)); + } -static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { - PyObject *(*__pyx_v_to_object_func)(char *); - int (*__pyx_v_to_dtype_func)(char *, PyObject *); - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *(*__pyx_t_3)(char *); - int (*__pyx_t_4)(char *, PyObject *); - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + /* "newanalysis/gfunction/gfunction.pyx":758 + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 8 or mode_sel & 64: + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + */ + __pyx_t_5 = ((__pyx_v_mode_sel & 32) != 0); + if (__pyx_t_5) { + __pyx_t_13 = ((((5 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); + } - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + /* "newanalysis/gfunction/gfunction.pyx":755 + * if mode_sel & 2: dest[ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 16: dest[4*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 4 or mode_sel & 32: # <<<<<<<<<<<<<< + * incr = (cpx*dx+cpy*dy+cpz*dz)/(clen*dist) + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + } - /* "View.MemoryView":1097 - * - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: + /* "newanalysis/gfunction/gfunction.pyx":759 + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag */ - __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; - __pyx_v_to_object_func = __pyx_t_3; + __pyx_t_6 = ((__pyx_v_mode_sel & 8) != 0); + if (!__pyx_t_6) { + } else { + __pyx_t_5 = __pyx_t_6; + goto __pyx_L48_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_mode_sel & 64) != 0); + __pyx_t_5 = __pyx_t_6; + __pyx_L48_bool_binop_done:; + if (__pyx_t_5) { - /* "View.MemoryView":1098 - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< - * else: - * to_object_func = NULL + /* "newanalysis/gfunction/gfunction.pyx":760 + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) # <<<<<<<<<<<<<< + * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag */ - __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; - __pyx_v_to_dtype_func = __pyx_t_4; + __pyx_t_11 = (((__pyx_v_spx * __pyx_v_dx) + (__pyx_v_spy * __pyx_v_dy)) + (__pyx_v_spz * __pyx_v_dz)); + __pyx_t_12 = (__pyx_v_slen * __pyx_v_dist); + if (unlikely(__pyx_t_12 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 760, __pyx_L8_error) + } + __pyx_v_incr = (__pyx_t_11 / __pyx_t_12); - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 + /* "newanalysis/gfunction/gfunction.pyx":761 + * if mode_sel & 8 or mode_sel & 64: + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag # <<<<<<<<<<<<<< + * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - goto __pyx_L3; - } + __pyx_t_5 = ((__pyx_v_mode_sel & 8) != 0); + if (__pyx_t_5) { + __pyx_t_13 = ((((3 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + (__pyx_v_incr * __pyx_v_off_diag)); + } - /* "View.MemoryView":1100 - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - * to_object_func = NULL # <<<<<<<<<<<<<< - * to_dtype_func = NULL + /* "newanalysis/gfunction/gfunction.pyx":762 + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 64: dest[6*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag # <<<<<<<<<<<<<< + * * */ - /*else*/ { - __pyx_v_to_object_func = NULL; + __pyx_t_5 = ((__pyx_v_mode_sel & 64) != 0); + if (__pyx_t_5) { + __pyx_t_13 = ((((6 * __pyx_v_ix1) + __pyx_v_ix2) + __pyx_v_ix3) + __pyx_v_ix4); + (__pyx_v_dest[__pyx_t_13]) = ((__pyx_v_dest[__pyx_t_13]) + ((((1.5 * __pyx_v_incr) * __pyx_v_incr) - 0.5) * __pyx_v_off_diag)); + } + + /* "newanalysis/gfunction/gfunction.pyx":759 + * if mode_sel & 4: dest[2*ix1+ix2+ix3+ix4]+=incr*off_diag + * if mode_sel & 32: dest[5*ix1+ix2+ix3+ix4]+=(1.5*incr*incr-0.5)*off_diag + * if mode_sel & 8 or mode_sel & 64: # <<<<<<<<<<<<<< + * incr = (spx*dx+spy*dy+spz*dz)/(slen*dist) + * if mode_sel & 8: dest[3*ix1+ix2+ix3+ix4]+=incr*off_diag + */ + } + __pyx_L16_continue:; + } + goto __pyx_L53; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L52; + __pyx_L52:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates2) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_clen; + __pyx_parallel_temp1 = __pyx_v_cpx; + __pyx_parallel_temp2 = __pyx_v_cpy; + __pyx_parallel_temp3 = __pyx_v_cpz; + __pyx_parallel_temp4 = __pyx_v_dist; + __pyx_parallel_temp5 = __pyx_v_ds_pos1; + __pyx_parallel_temp6 = __pyx_v_ds_pos2; + __pyx_parallel_temp7 = __pyx_v_dx; + __pyx_parallel_temp8 = __pyx_v_dy; + __pyx_parallel_temp9 = __pyx_v_dz; + __pyx_parallel_temp10 = __pyx_v_i; + __pyx_parallel_temp11 = __pyx_v_incr; + __pyx_parallel_temp12 = __pyx_v_ix2; + __pyx_parallel_temp13 = __pyx_v_ix3; + __pyx_parallel_temp14 = __pyx_v_ix4; + __pyx_parallel_temp15 = __pyx_v_j; + __pyx_parallel_temp16 = __pyx_v_j_begin; + __pyx_parallel_temp17 = __pyx_v_off_diag; + __pyx_parallel_temp18 = __pyx_v_pos; + __pyx_parallel_temp19 = __pyx_v_shell; + __pyx_parallel_temp20 = __pyx_v_slen; + __pyx_parallel_temp21 = __pyx_v_spx; + __pyx_parallel_temp22 = __pyx_v_spy; + __pyx_parallel_temp23 = __pyx_v_spz; + } + __pyx_L53:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP +} +#endif /* _OPENMP */ + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_clen = __pyx_parallel_temp0; + __pyx_v_cpx = __pyx_parallel_temp1; + __pyx_v_cpy = __pyx_parallel_temp2; + __pyx_v_cpz = __pyx_parallel_temp3; + __pyx_v_dist = __pyx_parallel_temp4; + __pyx_v_ds_pos1 = __pyx_parallel_temp5; + __pyx_v_ds_pos2 = __pyx_parallel_temp6; + __pyx_v_dx = __pyx_parallel_temp7; + __pyx_v_dy = __pyx_parallel_temp8; + __pyx_v_dz = __pyx_parallel_temp9; + __pyx_v_i = __pyx_parallel_temp10; + __pyx_v_incr = __pyx_parallel_temp11; + __pyx_v_ix2 = __pyx_parallel_temp12; + __pyx_v_ix3 = __pyx_parallel_temp13; + __pyx_v_ix4 = __pyx_parallel_temp14; + __pyx_v_j = __pyx_parallel_temp15; + __pyx_v_j_begin = __pyx_parallel_temp16; + __pyx_v_off_diag = __pyx_parallel_temp17; + __pyx_v_pos = __pyx_parallel_temp18; + __pyx_v_shell = __pyx_parallel_temp19; + __pyx_v_slen = __pyx_parallel_temp20; + __pyx_v_spx = __pyx_parallel_temp21; + __pyx_v_spy = __pyx_parallel_temp22; + __pyx_v_spz = __pyx_parallel_temp23; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1101 - * else: - * to_object_func = NULL - * to_dtype_func = NULL # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":683 + * #TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * for i in prange(ncore, nogil=True): # <<<<<<<<<<<<<< + * #ix2=i*histo_n + * ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE */ - __pyx_v_to_dtype_func = NULL; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; + } } - __pyx_L3:; - - /* "View.MemoryView":1103 - * to_dtype_func = NULL - * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< - * to_object_func, to_dtype_func, - * memview.dtype_is_object) - */ - __Pyx_XDECREF(__pyx_r); - /* "View.MemoryView":1105 - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - * to_object_func, to_dtype_func, - * memview.dtype_is_object) # <<<<<<<<<<<<<< - * + /* "newanalysis/gfunction/gfunction.pyx":667 * - */ - __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "View.MemoryView":1089 * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. + * cdef void calcHistoVoronoiNonSelf(double *core_xyz, double *surr_xyz, double *core_dip, double *surr_dip, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=1] np_dest, np.ndarray[np.float64_t,ndim=1] np_box_dim, + * int ncore, int nsurround, float histo_min, float histo_max, int histo_n, double invdx, int mode_sel, int nm_core, int nm_surround, int nshells, int * delaunay_matrix): */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.gfunction.calcHistoVoronoiNonSelf", __pyx_clineno, __pyx_lineno, __pyx_filename); + goto __pyx_L2; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_box_dim.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_dest.rcbuffer->pybuffer); + __pyx_L2:; __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":1111 - * - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg - */ - -static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { - Py_ssize_t __pyx_r; - int __pyx_t_1; - - /* "View.MemoryView":1112 +/* "newanalysis/gfunction/gfunction.pyx":772 + * """ * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: - */ - __pyx_t_1 = ((__pyx_v_arg < 0) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1113 - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: - * return -arg # <<<<<<<<<<<<<< - * else: - * return arg + * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, nshells, box_y=None, box_z=None, use_cuda=False, norm_volume=None, exclude_self_mol=False): # <<<<<<<<<<<<<< + * """ + * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) */ - __pyx_r = (-__pyx_v_arg); - goto __pyx_L0; - /* "View.MemoryView":1112 - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: - */ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_11RDF_voronoi___init__, "\n RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False)\n\n Creates a new rdf container.\n\n modes .. a list of gfunctions to calculate\n e.g. [\"all\"] -> calculate all gfunctions\n [\"000\",\"110\",\"220\"] -> calculate only g000, g110 and g220\n histo_min .. lower bound of histogram\n histo_max .. upper bound of histogram\n histo_dr .. histogram bin width\n sel1_n .. number of particles in first selection\n sel2_n .. number of particles in second selection\n sel1_nmol .. number of molecules in first selection; needed for correct normalisation, if multiple atoms from the same molecule are selected\n sel2_nmol .. number of molecules in second selection\n box_x .. box length, x dim\n box_y .. box length, y dim (optional; if None, y=x)\n box_z .. box length, z dim (optional; if None, z=x)\n use_cuda .. whether to use cuda, if available (default=False)\n norm_volume .. volume to use for calculating the density during normalization (default = None)\n\n Usage example:\n my_rdf = RDF([\"all\"], 0.0, 50.0, 0.05, 200, 200, 200, 200, 25.0)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi___init__}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_modes = 0; + PyObject *__pyx_v_histo_min = 0; + PyObject *__pyx_v_histo_max = 0; + PyObject *__pyx_v_histo_dr = 0; + PyObject *__pyx_v_sel1_n = 0; + PyObject *__pyx_v_sel2_n = 0; + PyObject *__pyx_v_sel1_nmol = 0; + PyObject *__pyx_v_sel2_nmol = 0; + PyObject *__pyx_v_box_x = 0; + PyObject *__pyx_v_nshells = 0; + PyObject *__pyx_v_box_y = 0; + PyObject *__pyx_v_box_z = 0; + CYTHON_UNUSED PyObject *__pyx_v_use_cuda = 0; + PyObject *__pyx_v_norm_volume = 0; + PyObject *__pyx_v_exclude_self_mol = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 772, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_modes,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_histo_dr,&__pyx_n_s_sel1_n,&__pyx_n_s_sel2_n,&__pyx_n_s_sel1_nmol,&__pyx_n_s_sel2_nmol,&__pyx_n_s_box_x,&__pyx_n_s_nshells,&__pyx_n_s_box_y,&__pyx_n_s_box_z,&__pyx_n_s_use_cuda,&__pyx_n_s_norm_volume,&__pyx_n_s_exclude_self_mol,0}; + values[11] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[12] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[13] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False))); + values[14] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[15] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False))); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 16: values[15] = __Pyx_Arg_FASTCALL(__pyx_args, 15); + CYTHON_FALLTHROUGH; + case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); + CYTHON_FALLTHROUGH; + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); + CYTHON_FALLTHROUGH; + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); + CYTHON_FALLTHROUGH; + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + CYTHON_FALLTHROUGH; + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_modes)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 1); __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_min)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 2); __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_max)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 3); __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_dr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 4); __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel1_n)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 5); __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel2_n)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 6); __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel1_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 7); __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sel2_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 8); __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (likely((values[9] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_x)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[9]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 9); __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 10: + if (likely((values[10] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[10]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, 10); __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 11: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_y); + if (value) { values[11] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 12: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_z); + if (value) { values[12] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 13: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_use_cuda); + if (value) { values[13] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 14: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_norm_volume); + if (value) { values[14] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 15: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exclude_self_mol); + if (value) { values[15] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 772, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 16: values[15] = __Pyx_Arg_FASTCALL(__pyx_args, 15); + CYTHON_FALLTHROUGH; + case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); + CYTHON_FALLTHROUGH; + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); + CYTHON_FALLTHROUGH; + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); + CYTHON_FALLTHROUGH; + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_self = values[0]; + __pyx_v_modes = values[1]; + __pyx_v_histo_min = values[2]; + __pyx_v_histo_max = values[3]; + __pyx_v_histo_dr = values[4]; + __pyx_v_sel1_n = values[5]; + __pyx_v_sel2_n = values[6]; + __pyx_v_sel1_nmol = values[7]; + __pyx_v_sel2_nmol = values[8]; + __pyx_v_box_x = values[9]; + __pyx_v_nshells = values[10]; + __pyx_v_box_y = values[11]; + __pyx_v_box_z = values[12]; + __pyx_v_use_cuda = values[13]; + __pyx_v_norm_volume = values[14]; + __pyx_v_exclude_self_mol = values[15]; } - - /* "View.MemoryView":1115 - * return -arg - * else: - * return arg # <<<<<<<<<<<<<< - * - * @cname('__pyx_get_best_slice_order') - */ - /*else*/ { - __pyx_r = __pyx_v_arg; - goto __pyx_L0; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 11, 16, __pyx_nargs); __PYX_ERR(0, 772, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - - /* "View.MemoryView":1111 - * - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg - */ + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi___init__(__pyx_self, __pyx_v_self, __pyx_v_modes, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_dr, __pyx_v_sel1_n, __pyx_v_sel2_n, __pyx_v_sel1_nmol, __pyx_v_sel2_nmol, __pyx_v_box_x, __pyx_v_nshells, __pyx_v_box_y, __pyx_v_box_z, __pyx_v_use_cuda, __pyx_v_norm_volume, __pyx_v_exclude_self_mol); /* function exit code */ - __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1118 - * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. - */ - -static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { - int __pyx_v_i; - Py_ssize_t __pyx_v_c_stride; - Py_ssize_t __pyx_v_f_stride; - char __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1123 - * """ - * cdef int i - * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< - * cdef Py_ssize_t f_stride = 0 - * - */ - __pyx_v_c_stride = 0; - - /* "View.MemoryView":1124 - * cdef int i - * cdef Py_ssize_t c_stride = 0 - * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): - */ - __pyx_v_f_stride = 0; - - /* "View.MemoryView":1126 - * cdef Py_ssize_t f_stride = 0 - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_modes, PyObject *__pyx_v_histo_min, PyObject *__pyx_v_histo_max, PyObject *__pyx_v_histo_dr, PyObject *__pyx_v_sel1_n, PyObject *__pyx_v_sel2_n, PyObject *__pyx_v_sel1_nmol, PyObject *__pyx_v_sel2_nmol, PyObject *__pyx_v_box_x, PyObject *__pyx_v_nshells, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z, CYTHON_UNUSED PyObject *__pyx_v_use_cuda, PyObject *__pyx_v_norm_volume, PyObject *__pyx_v_exclude_self_mol) { + int __pyx_v_mode_sel; + PyObject *__pyx_v_mode = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); - /* "View.MemoryView":1127 + /* "newanalysis/gfunction/gfunction.pyx":812 + * self.dtype = np.float64 + * """ + * self.dtype = np.float64 # <<<<<<<<<<<<<< * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break + * # always initialize the histogram to 7 dimensions, but only fill the desired ones */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 812, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 812, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1128 - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break + /* "newanalysis/gfunction/gfunction.pyx":815 * - */ - __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1129 - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< + * # always initialize the histogram to 7 dimensions, but only fill the desired ones + * cdef int mode_sel = 0 # <<<<<<<<<<<<<< * - * for i in range(ndim): + * # select the gfunctions to calculate using bitwise operators */ - goto __pyx_L4_break; + __pyx_v_mode_sel = 0; - /* "View.MemoryView":1127 + /* "newanalysis/gfunction/gfunction.pyx":818 * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break + * # select the gfunctions to calculate using bitwise operators + * for mode in modes: # <<<<<<<<<<<<<< + * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 + * if mode == "000": mode_sel = mode_sel | 1 */ - } + if (likely(PyList_CheckExact(__pyx_v_modes)) || PyTuple_CheckExact(__pyx_v_modes)) { + __pyx_t_2 = __pyx_v_modes; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_modes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 818, __pyx_L1_error) } - __pyx_L4_break:; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 818, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 818, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 818, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_mode, __pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":1131 - * break - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] + /* "newanalysis/gfunction/gfunction.pyx":819 + * # select the gfunctions to calculate using bitwise operators + * for mode in modes: + * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 # <<<<<<<<<<<<<< + * if mode == "000": mode_sel = mode_sel | 1 + * if mode == "110": mode_sel = mode_sel | 2 */ - __pyx_t_1 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_1; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_all, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 819, __pyx_L1_error) + if (__pyx_t_5) { + __pyx_v_mode_sel = (((((((__pyx_v_mode_sel | 1) | 2) | 4) | 8) | 16) | 32) | 64); + } - /* "View.MemoryView":1132 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break + /* "newanalysis/gfunction/gfunction.pyx":820 + * for mode in modes: + * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 + * if mode == "000": mode_sel = mode_sel | 1 # <<<<<<<<<<<<<< + * if mode == "110": mode_sel = mode_sel | 2 + * if mode == "101": mode_sel = mode_sel | 4 */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_000, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 820, __pyx_L1_error) + if (__pyx_t_5) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 1); + } - /* "View.MemoryView":1133 - * for i in range(ndim): - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * + /* "newanalysis/gfunction/gfunction.pyx":821 + * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 + * if mode == "000": mode_sel = mode_sel | 1 + * if mode == "110": mode_sel = mode_sel | 2 # <<<<<<<<<<<<<< + * if mode == "101": mode_sel = mode_sel | 4 + * if mode == "011": mode_sel = mode_sel | 8 */ - __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_110, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 821, __pyx_L1_error) + if (__pyx_t_5) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 2); + } - /* "View.MemoryView":1134 - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + /* "newanalysis/gfunction/gfunction.pyx":822 + * if mode == "000": mode_sel = mode_sel | 1 + * if mode == "110": mode_sel = mode_sel | 2 + * if mode == "101": mode_sel = mode_sel | 4 # <<<<<<<<<<<<<< + * if mode == "011": mode_sel = mode_sel | 8 + * if mode == "220": mode_sel = mode_sel | 16 */ - goto __pyx_L7_break; + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_101, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 822, __pyx_L1_error) + if (__pyx_t_5) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 4); + } - /* "View.MemoryView":1132 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break + /* "newanalysis/gfunction/gfunction.pyx":823 + * if mode == "110": mode_sel = mode_sel | 2 + * if mode == "101": mode_sel = mode_sel | 4 + * if mode == "011": mode_sel = mode_sel | 8 # <<<<<<<<<<<<<< + * if mode == "220": mode_sel = mode_sel | 16 + * if mode == "202": mode_sel = mode_sel | 32 */ + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_011, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 823, __pyx_L1_error) + if (__pyx_t_5) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 8); } - } - __pyx_L7_break:; - /* "View.MemoryView":1136 - * break - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: + /* "newanalysis/gfunction/gfunction.pyx":824 + * if mode == "101": mode_sel = mode_sel | 4 + * if mode == "011": mode_sel = mode_sel | 8 + * if mode == "220": mode_sel = mode_sel | 16 # <<<<<<<<<<<<<< + * if mode == "202": mode_sel = mode_sel | 32 + * if mode == "022": mode_sel = mode_sel | 64 */ - __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0); - if (__pyx_t_2) { + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_220, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 824, __pyx_L1_error) + if (__pyx_t_5) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 16); + } - /* "View.MemoryView":1137 + /* "newanalysis/gfunction/gfunction.pyx":825 + * if mode == "011": mode_sel = mode_sel | 8 + * if mode == "220": mode_sel = mode_sel | 16 + * if mode == "202": mode_sel = mode_sel | 32 # <<<<<<<<<<<<<< + * if mode == "022": mode_sel = mode_sel | 64 * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - * return 'C' # <<<<<<<<<<<<<< - * else: - * return 'F' */ - __pyx_r = 'C'; - goto __pyx_L0; + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_202, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 825, __pyx_L1_error) + if (__pyx_t_5) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 32); + } - /* "View.MemoryView":1136 - * break + /* "newanalysis/gfunction/gfunction.pyx":826 + * if mode == "220": mode_sel = mode_sel | 16 + * if mode == "202": mode_sel = mode_sel | 32 + * if mode == "022": mode_sel = mode_sel | 64 # <<<<<<<<<<<<<< * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: + * # remember the selection */ - } + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_kp_s_022, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 826, __pyx_L1_error) + if (__pyx_t_5) { + __pyx_v_mode_sel = (__pyx_v_mode_sel | 64); + } - /* "View.MemoryView":1139 - * return 'C' - * else: - * return 'F' # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":818 * - * @cython.cdivision(True) + * # select the gfunctions to calculate using bitwise operators + * for mode in modes: # <<<<<<<<<<<<<< + * if mode == "all": mode_sel = mode_sel | 1 | 2 | 4 | 8 | 16 | 32 | 64 + * if mode == "000": mode_sel = mode_sel | 1 */ - /*else*/ { - __pyx_r = 'F'; - goto __pyx_L0; } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1118 + /* "newanalysis/gfunction/gfunction.pyx":829 * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1142 + * # remember the selection + * self.mode_sel = np.int32(mode_sel) # <<<<<<<<<<<<<< * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + * # set histogram parameters */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel, __pyx_t_2) < 0) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; -static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; - Py_ssize_t __pyx_v_dst_extent; - Py_ssize_t __pyx_v_src_stride; - Py_ssize_t __pyx_v_dst_stride; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - - /* "View.MemoryView":1149 + /* "newanalysis/gfunction/gfunction.pyx":832 * - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - */ - __pyx_v_src_extent = (__pyx_v_src_shape[0]); - - /* "View.MemoryView":1150 - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] + * # set histogram parameters + * self.histo_min = np.float32(histo_min) # <<<<<<<<<<<<<< + * self.histo_max = np.float32(histo_max) + * self.histo_dr = np.round(self.dtype(histo_dr),5) */ - __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_histo_min}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_min, __pyx_t_2) < 0) __PYX_ERR(0, 832, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1151 - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_stride = dst_strides[0] - * + /* "newanalysis/gfunction/gfunction.pyx":833 + * # set histogram parameters + * self.histo_min = np.float32(histo_min) + * self.histo_max = np.float32(histo_max) # <<<<<<<<<<<<<< + * self.histo_dr = np.round(self.dtype(histo_dr),5) + * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) */ - __pyx_v_src_stride = (__pyx_v_src_strides[0]); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_histo_max}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_max, __pyx_t_2) < 0) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1152 - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: + /* "newanalysis/gfunction/gfunction.pyx":834 + * self.histo_min = np.float32(histo_min) + * self.histo_max = np.float32(histo_max) + * self.histo_dr = np.round(self.dtype(histo_dr),5) # <<<<<<<<<<<<<< + * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) + * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) */ - __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_round); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_histo_dr}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_int_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr, __pyx_t_2) < 0) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): + /* "newanalysis/gfunction/gfunction.pyx":835 + * self.histo_max = np.float32(histo_max) + * self.histo_dr = np.round(self.dtype(histo_dr),5) + * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) # <<<<<<<<<<<<<< + * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) + * self.nshells = np.int32(nshells) */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyFloat_TrueDivideCObj(__pyx_float_1_0, __pyx_t_6, 1.0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr, __pyx_t_2) < 0) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1155 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + /* "newanalysis/gfunction/gfunction.pyx":836 + * self.histo_dr = np.round(self.dtype(histo_dr),5) + * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) + * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) # <<<<<<<<<<<<<< + * self.nshells = np.int32(nshells) + * self.exclude_self_mol = exclude_self_mol */ - __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_v_histo_max, __pyx_v_histo_min); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_histo_dr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyFloat_AddObjC(__pyx_t_6, __pyx_float_0_5, 0.5, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_8 = 1; } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histo_n, __pyx_t_2) < 0) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1156 - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: + /* "newanalysis/gfunction/gfunction.pyx":837 + * self.histo_inv_dr = self.dtype(1.0 / self.histo_dr) + * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) + * self.nshells = np.int32(nshells) # <<<<<<<<<<<<<< + * self.exclude_self_mol = exclude_self_mol + * */ - __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); - if (__pyx_t_2) { - __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_8 = 1; } - __pyx_t_3 = (__pyx_t_2 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L5_bool_binop_done:; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_nshells}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nshells, __pyx_t_2) < 0) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1155 + /* "newanalysis/gfunction/gfunction.pyx":838 + * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) + * self.nshells = np.int32(nshells) + * self.exclude_self_mol = exclude_self_mol # <<<<<<<<<<<<<< * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + * self.box_dim = np.zeros(6,dtype=self.dtype) */ - if (__pyx_t_1) { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_exclude_self_mol, __pyx_v_exclude_self_mol) < 0) __PYX_ERR(0, 838, __pyx_L1_error) - /* "View.MemoryView":1157 - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): + /* "newanalysis/gfunction/gfunction.pyx":840 + * self.exclude_self_mol = exclude_self_mol + * + * self.box_dim = np.zeros(6,dtype=self.dtype) # <<<<<<<<<<<<<< + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__15, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_box_dim, __pyx_t_7) < 0) __PYX_ERR(0, 840, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":1155 + /* "newanalysis/gfunction/gfunction.pyx":841 * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + * self.box_dim = np.zeros(6,dtype=self.dtype) + * self.box_dim[0] = box_x # <<<<<<<<<<<<<< + * self.box_dim[3] = box_x/2.0 + * if box_y: */ - goto __pyx_L4; - } + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely((__Pyx_SetItemInt(__pyx_t_7, 0, __pyx_v_box_x, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":1159 - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride + /* "newanalysis/gfunction/gfunction.pyx":842 + * self.box_dim = np.zeros(6,dtype=self.dtype) + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 # <<<<<<<<<<<<<< + * if box_y: + * self.box_dim[1] = box_y */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1160 - * else: - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< - * src_data += src_stride - * dst_data += dst_stride + __pyx_t_7 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_x, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_t_7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":843 + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 + * if box_y: # <<<<<<<<<<<<<< + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_box_y); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 843, __pyx_L1_error) + if (__pyx_t_5) { - /* "View.MemoryView":1161 - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * else: + /* "newanalysis/gfunction/gfunction.pyx":844 + * self.box_dim[3] = box_x/2.0 + * if box_y: + * self.box_dim[1] = box_y # <<<<<<<<<<<<<< + * self.box_dim[4] = box_y/2.0 + * else: */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 844, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely((__Pyx_SetItemInt(__pyx_t_7, 1, __pyx_v_box_y, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 844, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":1162 - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): + /* "newanalysis/gfunction/gfunction.pyx":845 + * if box_y: + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 # <<<<<<<<<<<<<< + * else: + * self.box_dim[1] = self.box_dim[0] */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } - } - __pyx_L4:; + __pyx_t_7 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_y, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_t_7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 845, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): + /* "newanalysis/gfunction/gfunction.pyx":843 + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 + * if box_y: # <<<<<<<<<<<<<< + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 */ - goto __pyx_L3; + goto __pyx_L14; } - /* "View.MemoryView":1164 - * dst_data += dst_stride - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * _copy_strided_to_strided(src_data, src_strides + 1, - * dst_data, dst_strides + 1, + /* "newanalysis/gfunction/gfunction.pyx":847 + * self.box_dim[4] = box_y/2.0 + * else: + * self.box_dim[1] = self.box_dim[0] # <<<<<<<<<<<<<< + * self.box_dim[4] = self.box_dim[3] + * if box_z: */ /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1165 - * else: - * for i in range(dst_extent): - * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< - * dst_data, dst_strides + 1, - * src_shape + 1, dst_shape + 1, - */ - _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - - /* "View.MemoryView":1169 - * src_shape + 1, dst_shape + 1, - * ndim - 1, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * - */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely((__Pyx_SetItemInt(__pyx_t_7, 1, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 847, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1170 - * ndim - 1, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, + /* "newanalysis/gfunction/gfunction.pyx":848 + * else: + * self.box_dim[1] = self.box_dim[0] + * self.box_dim[4] = self.box_dim[3] # <<<<<<<<<<<<<< + * if box_z: + * self.box_dim[2] = box_z */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_t_7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 848, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } - __pyx_L3:; + __pyx_L14:; - /* "View.MemoryView":1142 - * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + /* "newanalysis/gfunction/gfunction.pyx":849 + * self.box_dim[1] = self.box_dim[0] + * self.box_dim[4] = self.box_dim[3] + * if box_z: # <<<<<<<<<<<<<< + * self.box_dim[2] = box_z + * self.box_dim[5] = box_z/2.0 */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_box_z); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 849, __pyx_L1_error) + if (__pyx_t_5) { - /* function exit code */ -} - -/* "View.MemoryView":1172 - * dst_data += dst_stride - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + /* "newanalysis/gfunction/gfunction.pyx":850 + * self.box_dim[4] = self.box_dim[3] + * if box_z: + * self.box_dim[2] = box_z # <<<<<<<<<<<<<< + * self.box_dim[5] = box_z/2.0 + * else: */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 850, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely((__Pyx_SetItemInt(__pyx_t_7, 2, __pyx_v_box_z, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 850, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; -static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - - /* "View.MemoryView":1175 - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: - * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< - * src.shape, dst.shape, ndim, itemsize) - * + /* "newanalysis/gfunction/gfunction.pyx":851 + * if box_z: + * self.box_dim[2] = box_z + * self.box_dim[5] = box_z/2.0 # <<<<<<<<<<<<<< + * else: + * self.box_dim[2] = self.box_dim[0] */ - _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + __pyx_t_7 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_z, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 851, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_t_2, 5, __pyx_t_7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 851, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":1172 - * dst_data += dst_stride - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + /* "newanalysis/gfunction/gfunction.pyx":849 + * self.box_dim[1] = self.box_dim[0] + * self.box_dim[4] = self.box_dim[3] + * if box_z: # <<<<<<<<<<<<<< + * self.box_dim[2] = box_z + * self.box_dim[5] = box_z/2.0 */ + goto __pyx_L15; + } - /* function exit code */ -} - -/* "View.MemoryView":1179 + /* "newanalysis/gfunction/gfunction.pyx":853 + * self.box_dim[5] = box_z/2.0 + * else: + * self.box_dim[2] = self.box_dim[0] # <<<<<<<<<<<<<< + * self.box_dim[5] = self.box_dim[3] * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ + /*else*/ { + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 853, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 853, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 853, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (unlikely((__Pyx_SetItemInt(__pyx_t_7, 2, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 853, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; -static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_size; - Py_ssize_t __pyx_r; - Py_ssize_t __pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - - /* "View.MemoryView":1181 - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":854 + * else: + * self.box_dim[2] = self.box_dim[0] + * self.box_dim[5] = self.box_dim[3] # <<<<<<<<<<<<<< * - * for shape in src.shape[:ndim]: + * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_size = __pyx_t_1; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 854, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 854, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 854, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_t_2, 5, __pyx_t_7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 854, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_L15:; - /* "View.MemoryView":1183 - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + /* "newanalysis/gfunction/gfunction.pyx":856 + * self.box_dim[5] = self.box_dim[3] * - * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< - * size *= shape + * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] # <<<<<<<<<<<<<< * + * # remember volume for each frame for normalisation */ - __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); - for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_shape = (__pyx_t_2[0]); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 856, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 856, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 856, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_7, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 856, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 856, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_volume, __pyx_t_1) < 0) __PYX_ERR(0, 856, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1184 + /* "newanalysis/gfunction/gfunction.pyx":859 * - * for shape in src.shape[:ndim]: - * size *= shape # <<<<<<<<<<<<<< + * # remember volume for each frame for normalisation + * self.volume_list = [] # <<<<<<<<<<<<<< * - * return size + * self.norm_volume = norm_volume */ - __pyx_v_size = (__pyx_v_size * __pyx_v_shape); - } + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_volume_list, __pyx_t_1) < 0) __PYX_ERR(0, 859, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1186 - * size *= shape + /* "newanalysis/gfunction/gfunction.pyx":861 + * self.volume_list = [] * - * return size # <<<<<<<<<<<<<< + * self.norm_volume = norm_volume # <<<<<<<<<<<<<< * - * @cname('__pyx_fill_contig_strides_array') + * # set particle numbers */ - __pyx_r = __pyx_v_size; - goto __pyx_L0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume, __pyx_v_norm_volume) < 0) __PYX_ERR(0, 861, __pyx_L1_error) - /* "View.MemoryView":1179 + /* "newanalysis/gfunction/gfunction.pyx":864 * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * # set particle numbers + * self.n1 = np.int32(sel1_n) # <<<<<<<<<<<<<< + * self.n2 = np.int32(sel2_n) + * self.nmol1 = sel1_nmol */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 864, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_sel1_n}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 864, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n1, __pyx_t_1) < 0) __PYX_ERR(0, 864, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1189 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + /* "newanalysis/gfunction/gfunction.pyx":865 + * # set particle numbers + * self.n1 = np.int32(sel1_n) + * self.n2 = np.int32(sel2_n) # <<<<<<<<<<<<<< + * self.nmol1 = sel1_nmol + * self.nmol2 = sel2_nmol */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 865, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 865, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_sel2_n}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n2, __pyx_t_1) < 0) __PYX_ERR(0, 865, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { - int __pyx_v_idx; - Py_ssize_t __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1198 - * cdef int idx + /* "newanalysis/gfunction/gfunction.pyx":866 + * self.n1 = np.int32(sel1_n) + * self.n2 = np.int32(sel2_n) + * self.nmol1 = sel1_nmol # <<<<<<<<<<<<<< + * self.nmol2 = sel2_nmol * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride */ - __pyx_t_1 = ((__pyx_v_order == 'F') != 0); - if (__pyx_t_1) { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nmol1, __pyx_v_sel1_nmol) < 0) __PYX_ERR(0, 866, __pyx_L1_error) - /* "View.MemoryView":1199 + /* "newanalysis/gfunction/gfunction.pyx":867 + * self.n2 = np.int32(sel2_n) + * self.nmol1 = sel1_nmol + * self.nmol2 = sel2_nmol # <<<<<<<<<<<<<< * - * if order == 'F': - * for idx in range(ndim): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] - */ - __pyx_t_2 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_idx = __pyx_t_4; - - /* "View.MemoryView":1200 - * if order == 'F': - * for idx in range(ndim): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * else: - */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - - /* "View.MemoryView":1201 - * for idx in range(ndim): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * else: - * for idx in range(ndim - 1, -1, -1): + * self.oneistwo = None */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nmol2, __pyx_v_sel2_nmol) < 0) __PYX_ERR(0, 867, __pyx_L1_error) - /* "View.MemoryView":1198 - * cdef int idx + /* "newanalysis/gfunction/gfunction.pyx":869 + * self.nmol2 = sel2_nmol * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1203 - * stride *= shape[idx] - * else: - * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] + * self.oneistwo = None # <<<<<<<<<<<<<< + * + * # set frame counter to 0 */ - /*else*/ { - for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { - __pyx_v_idx = __pyx_t_2; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_None) < 0) __PYX_ERR(0, 869, __pyx_L1_error) - /* "View.MemoryView":1204 - * else: - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] + /* "newanalysis/gfunction/gfunction.pyx":872 + * + * # set frame counter to 0 + * self.ctr = 0 # <<<<<<<<<<<<<< * + * # initialize histogram array */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ctr, __pyx_int_0) < 0) __PYX_ERR(0, 872, __pyx_L1_error) - /* "View.MemoryView":1205 - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":875 + * + * # initialize histogram array + * self.histogram = np.zeros(self.nshells*self.n1*self.histo_n*7,dtype=self.dtype) # <<<<<<<<<<<<<< + * self.histogram_out = np.zeros(self.nshells*self.histo_n*7,dtype=np.float64) * - * return stride */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } - } - __pyx_L3:; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyInt_MultiplyObjC(__pyx_t_1, __pyx_int_7, 7, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7)) __PYX_ERR(0, 875, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histogram, __pyx_t_6) < 0) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "View.MemoryView":1207 - * stride *= shape[idx] - * - * return stride # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":876 + * # initialize histogram array + * self.histogram = np.zeros(self.nshells*self.n1*self.histo_n*7,dtype=self.dtype) + * self.histogram_out = np.zeros(self.nshells*self.histo_n*7,dtype=np.float64) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_copy_data_to_temp') + * # print, if CUDA device will be used and initialize arrays */ - __pyx_r = __pyx_v_stride; - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Multiply(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_MultiplyObjC(__pyx_t_2, __pyx_int_7, 7, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out, __pyx_t_9) < 0) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "View.MemoryView":1189 + /* "newanalysis/gfunction/gfunction.pyx":772 + * """ * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, nshells, box_y=None, box_z=None, use_cuda=False, norm_volume=None, exclude_self_mol=False): # <<<<<<<<<<<<<< + * """ + * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1210 +/* "newanalysis/gfunction/gfunction.pyx":912 * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + * + * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< + * """ + * update_box(box_x,box_y,box_z) */ -static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { - int __pyx_v_i; - void *__pyx_v_result; - size_t __pyx_v_itemsize; - size_t __pyx_v_size; - void *__pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - struct __pyx_memoryview_obj *__pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_3update_box(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_2update_box, "\n update_box(box_x,box_y,box_z)\n\n Update the box dimensions, when analysing NpT trajectories.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_3update_box = {"update_box", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_3update_box, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_2update_box}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_3update_box(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_box_x = 0; + PyObject *__pyx_v_box_y = 0; + PyObject *__pyx_v_box_z = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("update_box (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 912, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_box_x,&__pyx_n_s_box_y,&__pyx_n_s_box_z,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_x)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 1); __PYX_ERR(0, 912, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_y)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 2); __PYX_ERR(0, 912, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_z)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, 3); __PYX_ERR(0, 912, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "update_box") < 0)) __PYX_ERR(0, 912, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_self = values[0]; + __pyx_v_box_x = values[1]; + __pyx_v_box_y = values[2]; + __pyx_v_box_z = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("update_box", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 912, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.update_box", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_2update_box(__pyx_self, __pyx_v_self, __pyx_v_box_x, __pyx_v_box_y, __pyx_v_box_z); - /* "View.MemoryView":1221 - * cdef void *result - * - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef size_t size = slice_get_size(src, ndim) - * - */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":1222 - * - * cdef size_t itemsize = src.memview.view.itemsize - * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< - * - * result = malloc(size) - */ - __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - - /* "View.MemoryView":1224 - * cdef size_t size = slice_get_size(src, ndim) - * - * result = malloc(size) # <<<<<<<<<<<<<< - * if not result: - * _err(MemoryError, NULL) - */ - __pyx_v_result = malloc(__pyx_v_size); - - /* "View.MemoryView":1225 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) - * - */ - __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0); - if (__pyx_t_2) { + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1226 - * result = malloc(size) - * if not result: - * _err(MemoryError, NULL) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1226, __pyx_L1_error) +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_2update_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("update_box", 0); - /* "View.MemoryView":1225 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) - * + /* "newanalysis/gfunction/gfunction.pyx":918 + * Update the box dimensions, when analysing NpT trajectories. + * """ + * self.box_dim[0] = box_x # <<<<<<<<<<<<<< + * self.box_dim[3] = box_x/2.0 + * self.box_dim[1] = box_y */ - } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, 0, __pyx_v_box_x, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 918, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1229 - * - * - * tmpslice.data = result # <<<<<<<<<<<<<< - * tmpslice.memview = src.memview - * for i in range(ndim): + /* "newanalysis/gfunction/gfunction.pyx":919 + * """ + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 # <<<<<<<<<<<<<< + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 */ - __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_x, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 919, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 919, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1230 - * - * tmpslice.data = result - * tmpslice.memview = src.memview # <<<<<<<<<<<<<< - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] + /* "newanalysis/gfunction/gfunction.pyx":920 + * self.box_dim[0] = box_x + * self.box_dim[3] = box_x/2.0 + * self.box_dim[1] = box_y # <<<<<<<<<<<<<< + * self.box_dim[4] = box_y/2.0 + * self.box_dim[2] = box_z */ - __pyx_t_4 = __pyx_v_src->memview; - __pyx_v_tmpslice->memview = __pyx_t_4; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, 1, __pyx_v_box_y, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 920, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1231 - * tmpslice.data = result - * tmpslice.memview = src.memview - * for i in range(ndim): # <<<<<<<<<<<<<< - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 + /* "newanalysis/gfunction/gfunction.pyx":921 + * self.box_dim[3] = box_x/2.0 + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 # <<<<<<<<<<<<<< + * self.box_dim[2] = box_z + * self.box_dim[5] = box_z/2.0 */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_y, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 921, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 921, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1232 - * tmpslice.memview = src.memview - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< - * tmpslice.suboffsets[i] = -1 + /* "newanalysis/gfunction/gfunction.pyx":922 + * self.box_dim[1] = box_y + * self.box_dim[4] = box_y/2.0 + * self.box_dim[2] = box_z # <<<<<<<<<<<<<< + * self.box_dim[5] = box_z/2.0 * */ - (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 922, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, 2, __pyx_v_box_z, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 922, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1233 - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":923 + * self.box_dim[4] = box_y/2.0 + * self.box_dim[2] = box_z + * self.box_dim[5] = box_z/2.0 # <<<<<<<<<<<<<< * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, + * """ */ - (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; - } + __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_box_z, __pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 923, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 923, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((__Pyx_SetItemInt(__pyx_t_2, 5, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 923, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1235 - * tmpslice.suboffsets[i] = -1 + /* "newanalysis/gfunction/gfunction.pyx":912 * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< - * ndim, order) * + * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< + * """ + * update_box(box_x,box_y,box_z) */ - (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - /* "View.MemoryView":1239 - * - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 - */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.update_box", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 +/* "newanalysis/gfunction/gfunction.pyx":932 + * """ * + * def calcFrame(self, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, */ - __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1241 - * for i in range(ndim): - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< - * - * if slice_is_contig(src[0], order, ndim): - */ - (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_5calcFrame(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_4calcFrame, "\n calcFrame(coor_sel1, coor_sel2, dip_sel1=None, dip_sel2=None,\n pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, \n pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None)\n\n Args:\n coor_sel1 .. numpy-array (dtype=numpy.float64, ndim=2, mode=\"c\") containing the coordinates of the first selection\n coor_sel2 .. numpy-array containing the coordinates of the second selection\n dip_sel1 .. numpy-array containing the dipoles of the first selection (optional, only needed for 110, 101, 220 and 202)\n dip_sel2 .. numpy-array containing the dipoles of the second selection (optional, only needed for 110, 011, 220 and 022)\n\n pre-allocated arrays: PyCUDA GPU array objects obtained from drv.memalloc()\n\n Pass the data needed to calculate the RDF for the current frame and do the calculation.\n Optionally, pre-allocated arrays on the GPU can be used. This is useful, if they are reused for more than\n one rdf calculation.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_5calcFrame = {"calcFrame", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_5calcFrame, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_4calcFrame}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_5calcFrame(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyArrayObject *__pyx_v_coor_sel1 = 0; + PyArrayObject *__pyx_v_coor_sel2 = 0; + PyArrayObject *__pyx_v_delaunay_matrix = 0; + PyArrayObject *__pyx_v_dip_sel1 = 0; + PyArrayObject *__pyx_v_dip_sel2 = 0; + CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel1_gpu = 0; + CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel2_gpu = 0; + CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel1_gpu = 0; + CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel2_gpu = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcFrame (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 932, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_coor_sel1,&__pyx_n_s_coor_sel2,&__pyx_n_s_delaunay_matrix,&__pyx_n_s_dip_sel1,&__pyx_n_s_dip_sel2,&__pyx_n_s_pre_coor_sel1_gpu,&__pyx_n_s_pre_coor_sel2_gpu,&__pyx_n_s_pre_dip_sel1_gpu,&__pyx_n_s_pre_dip_sel2_gpu,0}; - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * + /* "newanalysis/gfunction/gfunction.pyx":936 + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, + * np.ndarray[np.int32_t, ndim=2,mode="c"] delaunay_matrix, + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, + * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, */ - } - } + values[4] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((PyArrayObject *)Py_None)); - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: + /* "newanalysis/gfunction/gfunction.pyx":937 + * np.ndarray[np.int32_t, ndim=2,mode="c"] delaunay_matrix, + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, # <<<<<<<<<<<<<< + * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, + * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): */ - __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0); - if (__pyx_t_2) { + values[5] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((PyArrayObject *)Py_None)); - /* "View.MemoryView":1244 - * - * if slice_is_contig(src[0], order, ndim): - * memcpy(result, src.data, size) # <<<<<<<<<<<<<< - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + /* "newanalysis/gfunction/gfunction.pyx":938 + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel1 = None, + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, + * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, # <<<<<<<<<<<<<< + * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): + * """ */ - (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: + /* "newanalysis/gfunction/gfunction.pyx":939 + * np.ndarray[np.float64_t,ndim=2,mode="c"] dip_sel2 = None, + * pre_coor_sel1_gpu=None, pre_coor_sel2_gpu=None, + * pre_dip_sel1_gpu=None, pre_dip_sel2_gpu=None): # <<<<<<<<<<<<<< + * """ + * calcFrame(coor_sel1, coor_sel2, dip_sel1=None, dip_sel2=None, */ - goto __pyx_L9; + values[8] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[9] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_sel1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 4, 10, 1); __PYX_ERR(0, 932, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_sel2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 4, 10, 2); __PYX_ERR(0, 932, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_delaunay_matrix)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 4, 10, 3); __PYX_ERR(0, 932, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_sel1); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_sel2); + if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pre_coor_sel1_gpu); + if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pre_coor_sel2_gpu); + if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pre_dip_sel1_gpu); + if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pre_dip_sel2_gpu); + if (value) { values[9] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcFrame") < 0)) __PYX_ERR(0, 932, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_self = values[0]; + __pyx_v_coor_sel1 = ((PyArrayObject *)values[1]); + __pyx_v_coor_sel2 = ((PyArrayObject *)values[2]); + __pyx_v_delaunay_matrix = ((PyArrayObject *)values[3]); + __pyx_v_dip_sel1 = ((PyArrayObject *)values[4]); + __pyx_v_dip_sel2 = ((PyArrayObject *)values[5]); + __pyx_v_pre_coor_sel1_gpu = values[6]; + __pyx_v_pre_coor_sel2_gpu = values[7]; + __pyx_v_pre_dip_sel1_gpu = values[8]; + __pyx_v_pre_dip_sel2_gpu = values[9]; } - - /* "View.MemoryView":1246 - * memcpy(result, src.data, size) - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< - * - * return result - */ - /*else*/ { - copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcFrame", 0, 4, 10, __pyx_nargs); __PYX_ERR(0, 932, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_L9:; - - /* "View.MemoryView":1248 - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) - * - * return result # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.calcFrame", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_sel1), __pyx_ptype_5numpy_ndarray, 1, "coor_sel1", 0))) __PYX_ERR(0, 933, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_sel2), __pyx_ptype_5numpy_ndarray, 1, "coor_sel2", 0))) __PYX_ERR(0, 934, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_delaunay_matrix), __pyx_ptype_5numpy_ndarray, 1, "delaunay_matrix", 0))) __PYX_ERR(0, 935, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dip_sel1), __pyx_ptype_5numpy_ndarray, 1, "dip_sel1", 0))) __PYX_ERR(0, 936, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dip_sel2), __pyx_ptype_5numpy_ndarray, 1, "dip_sel2", 0))) __PYX_ERR(0, 937, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_4calcFrame(__pyx_self, __pyx_v_self, __pyx_v_coor_sel1, __pyx_v_coor_sel2, __pyx_v_delaunay_matrix, __pyx_v_dip_sel1, __pyx_v_dip_sel2, __pyx_v_pre_coor_sel1_gpu, __pyx_v_pre_coor_sel2_gpu, __pyx_v_pre_dip_sel1_gpu, __pyx_v_pre_dip_sel2_gpu); - /* "View.MemoryView":1210 + /* "newanalysis/gfunction/gfunction.pyx":932 + * """ * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + * def calcFrame(self, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } __pyx_r = NULL; __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1253 - * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % - */ - -static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { - int __pyx_r; +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_4calcFrame(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_coor_sel1, PyArrayObject *__pyx_v_coor_sel2, PyArrayObject *__pyx_v_delaunay_matrix, PyArrayObject *__pyx_v_dip_sel1, PyArrayObject *__pyx_v_dip_sel2, CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel1_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_coor_sel2_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel1_gpu, CYTHON_UNUSED PyObject *__pyx_v_pre_dip_sel2_gpu) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_sel1; + __Pyx_Buffer __pyx_pybuffer_coor_sel1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_sel2; + __Pyx_Buffer __pyx_pybuffer_coor_sel2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_delaunay_matrix; + __Pyx_Buffer __pyx_pybuffer_delaunay_matrix; + __Pyx_LocalBuf_ND __pyx_pybuffernd_dip_sel1; + __Pyx_Buffer __pyx_pybuffer_dip_sel1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_dip_sel2; + __Pyx_Buffer __pyx_pybuffer_dip_sel2; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + char *__pyx_t_9; + char *__pyx_t_10; + char *__pyx_t_11; + char *__pyx_t_12; + int __pyx_t_13; + float __pyx_t_14; + float __pyx_t_15; + int __pyx_t_16; + double __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + char *__pyx_t_22; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_extents", 0); + __Pyx_RefNannySetupContext("calcFrame", 0); + __pyx_pybuffer_coor_sel1.pybuffer.buf = NULL; + __pyx_pybuffer_coor_sel1.refcount = 0; + __pyx_pybuffernd_coor_sel1.data = NULL; + __pyx_pybuffernd_coor_sel1.rcbuffer = &__pyx_pybuffer_coor_sel1; + __pyx_pybuffer_coor_sel2.pybuffer.buf = NULL; + __pyx_pybuffer_coor_sel2.refcount = 0; + __pyx_pybuffernd_coor_sel2.data = NULL; + __pyx_pybuffernd_coor_sel2.rcbuffer = &__pyx_pybuffer_coor_sel2; + __pyx_pybuffer_delaunay_matrix.pybuffer.buf = NULL; + __pyx_pybuffer_delaunay_matrix.refcount = 0; + __pyx_pybuffernd_delaunay_matrix.data = NULL; + __pyx_pybuffernd_delaunay_matrix.rcbuffer = &__pyx_pybuffer_delaunay_matrix; + __pyx_pybuffer_dip_sel1.pybuffer.buf = NULL; + __pyx_pybuffer_dip_sel1.refcount = 0; + __pyx_pybuffernd_dip_sel1.data = NULL; + __pyx_pybuffernd_dip_sel1.rcbuffer = &__pyx_pybuffer_dip_sel1; + __pyx_pybuffer_dip_sel2.pybuffer.buf = NULL; + __pyx_pybuffer_dip_sel2.refcount = 0; + __pyx_pybuffernd_dip_sel2.data = NULL; + __pyx_pybuffernd_dip_sel2.rcbuffer = &__pyx_pybuffer_dip_sel2; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_sel1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 932, __pyx_L1_error) + } + __pyx_pybuffernd_coor_sel1.diminfo[0].strides = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_sel1.diminfo[0].shape = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_sel1.diminfo[1].strides = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_sel1.diminfo[1].shape = __pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_sel2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 932, __pyx_L1_error) + } + __pyx_pybuffernd_coor_sel2.diminfo[0].strides = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_sel2.diminfo[0].shape = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_sel2.diminfo[1].strides = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_sel2.diminfo[1].shape = __pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer, (PyObject*)__pyx_v_delaunay_matrix, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 932, __pyx_L1_error) + } + __pyx_pybuffernd_delaunay_matrix.diminfo[0].strides = __pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_delaunay_matrix.diminfo[0].shape = __pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_delaunay_matrix.diminfo[1].strides = __pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_delaunay_matrix.diminfo[1].shape = __pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer, (PyObject*)__pyx_v_dip_sel1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 932, __pyx_L1_error) + } + __pyx_pybuffernd_dip_sel1.diminfo[0].strides = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dip_sel1.diminfo[0].shape = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dip_sel1.diminfo[1].strides = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dip_sel1.diminfo[1].shape = __pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dip_sel2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 932, __pyx_L1_error) + } + __pyx_pybuffernd_dip_sel2.diminfo[0].strides = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dip_sel2.diminfo[0].shape = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dip_sel2.diminfo[1].strides = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dip_sel2.diminfo[1].shape = __pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer.shape[1]; - /* "View.MemoryView":1256 - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % - * (i, extent1, extent2)) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":959 * - * @cname('__pyx_memoryview_err_dim') - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - - /* "View.MemoryView":1255 - * cdef int _err_extents(int i, Py_ssize_t extent1, - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<< - * (i, extent1, extent2)) + * # Check if dipole moments are needed and, if yes, were passed + * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): # <<<<<<<<<<<<<< + * raise TypeError("No dipole moment array for the first selection was passed, although the requested gfunctions need it!") * */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error) + __pyx_t_2 = (((PyObject *)__pyx_v_dip_sel1) == Py_None); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 1255, __pyx_L1_error) + __pyx_t_2 = ((((int)__pyx_t_4) & 2) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 4) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 16) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 32) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":1253 + /* "newanalysis/gfunction/gfunction.pyx":960 + * # Check if dipole moments are needed and, if yes, were passed + * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): + * raise TypeError("No dipole moment array for the first selection was passed, although the requested gfunctions need it!") # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 960, __pyx_L1_error) - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1259 + /* "newanalysis/gfunction/gfunction.pyx":959 * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) + * # Check if dipole moments are needed and, if yes, were passed + * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): # <<<<<<<<<<<<<< + * raise TypeError("No dipole moment array for the first selection was passed, although the requested gfunctions need it!") * */ + } -static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_dim", 0); - __Pyx_INCREF(__pyx_v_error); - - /* "View.MemoryView":1260 - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: - * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":962 + * raise TypeError("No dipole moment array for the first selection was passed, although the requested gfunctions need it!") + * + * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): # <<<<<<<<<<<<<< + * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") * - * @cname('__pyx_memoryview_err') */ - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error) + __pyx_t_2 = (((PyObject *)__pyx_v_dip_sel2) == Py_None); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 962, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 962, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_v_error); - __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } + __pyx_t_2 = ((((int)__pyx_t_4) & 2) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L10_bool_binop_done; } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 962, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 962, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 1260, __pyx_L1_error) + __pyx_t_2 = ((((int)__pyx_t_4) & 8) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 962, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 962, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 16) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 962, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 962, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((((int)__pyx_t_4) & 64) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L10_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":1259 + /* "newanalysis/gfunction/gfunction.pyx":963 * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) + * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): + * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") # <<<<<<<<<<<<<< * + * if self.oneistwo is None: */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 963, __pyx_L1_error) - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1263 + /* "newanalysis/gfunction/gfunction.pyx":962 + * raise TypeError("No dipole moment array for the first selection was passed, although the requested gfunctions need it!") + * + * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): # <<<<<<<<<<<<<< + * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) */ + } -static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err", 0); - __Pyx_INCREF(__pyx_v_error); - - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: + /* "newanalysis/gfunction/gfunction.pyx":965 + * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") + * + * if self.oneistwo is None: # <<<<<<<<<<<<<< + * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: + * self.oneistwo = True */ - __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 965, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = (__pyx_t_3 == Py_None); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { - /* "View.MemoryView":1265 - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: - * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< - * else: - * raise error + /* "newanalysis/gfunction/gfunction.pyx":966 + * + * if self.oneistwo is None: + * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: # <<<<<<<<<<<<<< + * self.oneistwo = True + * else: */ - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_error); - __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); + __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coor_sel1), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coor_sel2), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_all); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + #endif + { + PyObject *__pyx_callargs[1] = {__pyx_t_7, }; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 966, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 1265, __pyx_L1_error) - - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: - */ - } + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L17_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_1 = __pyx_t_2; + __pyx_L17_bool_binop_done:; + if (__pyx_t_1) { - /* "View.MemoryView":1267 - * raise error(msg.decode('ascii')) - * else: - * raise error # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_contents') + /* "newanalysis/gfunction/gfunction.pyx":967 + * if self.oneistwo is None: + * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: + * self.oneistwo = True # <<<<<<<<<<<<<< + * else: + * self.oneistwo = False */ - /*else*/ { - __Pyx_Raise(__pyx_v_error, 0, 0, 0); - __PYX_ERR(2, 1267, __pyx_L1_error) - } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_True) < 0) __PYX_ERR(0, 967, __pyx_L1_error) - /* "View.MemoryView":1263 + /* "newanalysis/gfunction/gfunction.pyx":966 * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) + * if self.oneistwo is None: + * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: # <<<<<<<<<<<<<< + * self.oneistwo = True + * else: */ + goto __pyx_L16; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1270 + /* "newanalysis/gfunction/gfunction.pyx":969 + * self.oneistwo = True + * else: + * self.oneistwo = False # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ - -static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { - void *__pyx_v_tmpdata; - size_t __pyx_v_itemsize; - int __pyx_v_i; - char __pyx_v_order; - int __pyx_v_broadcasting; - int __pyx_v_direct_copy; - __Pyx_memviewslice __pyx_v_tmp; - int __pyx_v_ndim; - int __pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - void *__pyx_t_7; - int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - - /* "View.MemoryView":1278 - * Check for overlapping memory and verify the shapes. - * """ - * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - */ - __pyx_v_tmpdata = NULL; - - /* "View.MemoryView":1279 - * """ - * cdef void *tmpdata = NULL - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - */ - __pyx_t_1 = __pyx_v_src.memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":1281 - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< - * cdef bint broadcasting = False - * cdef bint direct_copy = False - */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); - - /* "View.MemoryView":1282 - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False # <<<<<<<<<<<<<< - * cdef bint direct_copy = False - * cdef __Pyx_memviewslice tmp + * # Increment frame counter */ - __pyx_v_broadcasting = 0; + /*else*/ { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo, Py_False) < 0) __PYX_ERR(0, 969, __pyx_L1_error) + } + __pyx_L16:; - /* "View.MemoryView":1283 - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False - * cdef bint direct_copy = False # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice tmp + /* "newanalysis/gfunction/gfunction.pyx":965 + * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") * + * if self.oneistwo is None: # <<<<<<<<<<<<<< + * if (coor_sel1[0] == coor_sel2[0]).all() and self.nmol1 == self.nmol2: + * self.oneistwo = True */ - __pyx_v_direct_copy = 0; + } - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp + /* "newanalysis/gfunction/gfunction.pyx":972 * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - */ - __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1287 + * # Increment frame counter + * self.ctr+=1 # <<<<<<<<<<<<<< * - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) + * # add current volume to list */ - __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_7, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ctr, __pyx_t_6) < 0) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp + /* "newanalysis/gfunction/gfunction.pyx":975 * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) + * # add current volume to list + * self.volume_list.append(self.volume) # <<<<<<<<<<<<<< * + * """ */ - __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 975, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 975, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_6, __pyx_t_7); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 975, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":1289 - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< - * - * cdef int ndim = max(src_ndim, dst_ndim) + /* "newanalysis/gfunction/gfunction.pyx":1010 + * else: + * """ + * if(self.exclude_self_mol): # <<<<<<<<<<<<<< + * calcHistoVoronoiNonSelf( coor_sel1.data, coor_sel2.data, + * dip_sel1.data, dip_sel2.data, */ - __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_exclude_self_mol); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1010, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1010, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_1) { - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * + /* "newanalysis/gfunction/gfunction.pyx":1011 + * """ + * if(self.exclude_self_mol): + * calcHistoVoronoiNonSelf( coor_sel1.data, coor_sel2.data, # <<<<<<<<<<<<<< + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, */ - } - __pyx_L3:; + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coor_sel1)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1011, __pyx_L1_error) + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coor_sel2)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1011, __pyx_L1_error) - /* "View.MemoryView":1291 - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * - * for i in range(ndim): + /* "newanalysis/gfunction/gfunction.pyx":1012 + * if(self.exclude_self_mol): + * calcHistoVoronoiNonSelf( coor_sel1.data, coor_sel2.data, + * dip_sel1.data, dip_sel2.data, # <<<<<<<<<<<<<< + * self.histogram, self.box_dim, + * self.n1, self.n2, self.histo_min, self.histo_max, */ - __pyx_t_3 = __pyx_v_dst_ndim; - __pyx_t_4 = __pyx_v_src_ndim; - if (((__pyx_t_3 > __pyx_t_4) != 0)) { - __pyx_t_5 = __pyx_t_3; - } else { - __pyx_t_5 = __pyx_t_4; - } - __pyx_v_ndim = __pyx_t_5; + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_dip_sel1)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1012, __pyx_L1_error) + __pyx_t_12 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_dip_sel2)); if (unlikely(__pyx_t_12 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1012, __pyx_L1_error) - /* "View.MemoryView":1293 - * cdef int ndim = max(src_ndim, dst_ndim) - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: + /* "newanalysis/gfunction/gfunction.pyx":1013 + * calcHistoVoronoiNonSelf( coor_sel1.data, coor_sel2.data, + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, # <<<<<<<<<<<<<< + * self.n1, self.n2, self.histo_min, self.histo_max, + * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) */ - __pyx_t_5 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_5; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1013, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1013, __pyx_L1_error) - /* "View.MemoryView":1294 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + /* "newanalysis/gfunction/gfunction.pyx":1014 + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, + * self.n1, self.n2, self.histo_min, self.histo_max, # <<<<<<<<<<<<<< + * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) + * else: */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0); - if (__pyx_t_2) { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_14 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1014, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_15 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/gfunction/gfunction.pyx":1015 + * self.histogram, self.box_dim, + * self.n1, self.n2, self.histo_min, self.histo_max, + * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) # <<<<<<<<<<<<<< + * else: + * calcHistoVoronoi( coor_sel1.data, coor_sel2.data, */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_22 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_delaunay_matrix)); if (unlikely(__pyx_t_22 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) - /* "View.MemoryView":1296 - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - * broadcasting = True # <<<<<<<<<<<<<< - * src.strides[i] = 0 - * else: + /* "newanalysis/gfunction/gfunction.pyx":1011 + * """ + * if(self.exclude_self_mol): + * calcHistoVoronoiNonSelf( coor_sel1.data, coor_sel2.data, # <<<<<<<<<<<<<< + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, */ - __pyx_v_broadcasting = 1; + __pyx_f_11newanalysis_9gfunction_calcHistoVoronoiNonSelf(((double *)__pyx_t_9), ((double *)__pyx_t_10), ((double *)__pyx_t_11), ((double *)__pyx_t_12), ((PyArrayObject *)__pyx_t_7), ((PyArrayObject *)__pyx_t_6), __pyx_t_4, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, ((int *)__pyx_t_22)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1011, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "View.MemoryView":1297 - * if src.shape[i] == 1: - * broadcasting = True - * src.strides[i] = 0 # <<<<<<<<<<<<<< - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) + /* "newanalysis/gfunction/gfunction.pyx":1010 + * else: + * """ + * if(self.exclude_self_mol): # <<<<<<<<<<<<<< + * calcHistoVoronoiNonSelf( coor_sel1.data, coor_sel2.data, + * dip_sel1.data, dip_sel2.data, */ - (__pyx_v_src.strides[__pyx_v_i]) = 0; + goto __pyx_L19; + } - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/gfunction/gfunction.pyx":1017 + * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) + * else: + * calcHistoVoronoi( coor_sel1.data, coor_sel2.data, # <<<<<<<<<<<<<< + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, */ - goto __pyx_L7; - } + /*else*/ { + __pyx_t_22 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coor_sel1)); if (unlikely(__pyx_t_22 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1017, __pyx_L1_error) + __pyx_t_12 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coor_sel2)); if (unlikely(__pyx_t_12 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1017, __pyx_L1_error) - /* "View.MemoryView":1299 - * src.strides[i] = 0 - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< - * - * if src.suboffsets[i] >= 0: + /* "newanalysis/gfunction/gfunction.pyx":1018 + * else: + * calcHistoVoronoi( coor_sel1.data, coor_sel2.data, + * dip_sel1.data, dip_sel2.data, # <<<<<<<<<<<<<< + * self.histogram, self.box_dim, + * self.n1, self.n2, self.histo_min, self.histo_max, */ - /*else*/ { - __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1299, __pyx_L1_error) - } - __pyx_L7:; + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_dip_sel1)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1018, __pyx_L1_error) + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_dip_sel2)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1018, __pyx_L1_error) - /* "View.MemoryView":1294 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + /* "newanalysis/gfunction/gfunction.pyx":1019 + * calcHistoVoronoi( coor_sel1.data, coor_sel2.data, + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, # <<<<<<<<<<<<<< + * self.n1, self.n2, self.histo_min, self.histo_max, + * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) */ - } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1019, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_box_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1019, __pyx_L1_error) - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) + /* "newanalysis/gfunction/gfunction.pyx":1020 + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, + * self.n1, self.n2, self.histo_min, self.histo_max, # <<<<<<<<<<<<<< + * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) * */ - __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0); - if (__pyx_t_2) { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1020, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1020, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1020, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_15 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1020, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_14 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1020, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":1302 - * - * if src.suboffsets[i] >= 0: - * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":1021 + * self.histogram, self.box_dim, + * self.n1, self.n2, self.histo_min, self.histo_max, + * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) # <<<<<<<<<<<<<< * - * if slices_overlap(&src, &dst, ndim, itemsize): + * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): */ - __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1302, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_inv_dr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_delaunay_matrix)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) - * + /* "newanalysis/gfunction/gfunction.pyx":1017 + * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) + * else: + * calcHistoVoronoi( coor_sel1.data, coor_sel2.data, # <<<<<<<<<<<<<< + * dip_sel1.data, dip_sel2.data, + * self.histogram, self.box_dim, */ - } + __pyx_f_11newanalysis_9gfunction_calcHistoVoronoi(((double *)__pyx_t_22), ((double *)__pyx_t_12), ((double *)__pyx_t_11), ((double *)__pyx_t_10), ((PyArrayObject *)__pyx_t_6), ((PyArrayObject *)__pyx_t_7), __pyx_t_21, __pyx_t_20, __pyx_t_15, __pyx_t_14, __pyx_t_19, __pyx_t_17, __pyx_t_18, __pyx_t_16, __pyx_t_13, __pyx_t_4, ((int *)__pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1017, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } + __pyx_L19:; - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":932 + * """ * - * if not slice_is_contig(src, order, ndim): + * def calcFrame(self, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, */ - __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * - */ - __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0); - if (__pyx_t_2) { + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.calcFrame", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_sel2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_delaunay_matrix.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dip_sel2.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1307 - * - * if not slice_is_contig(src, order, ndim): - * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< +/* "newanalysis/gfunction/gfunction.pyx":1023 + * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< + * """ + * Add the histograms of all core particles, after they were calculated in parallel. */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * - */ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_7_addHisto(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_6_addHisto, "\n Add the histograms of all core particles, after they were calculated in parallel.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_7_addHisto = {"_addHisto", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_7_addHisto, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_6_addHisto}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_7_addHisto(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyArrayObject *__pyx_v_histo_out = 0; + PyArrayObject *__pyx_v_histo = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_addHisto (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1023, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_histo_out,&__pyx_n_s_histo,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1023, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_out)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1023, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, 1); __PYX_ERR(0, 1023, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1023, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, 2); __PYX_ERR(0, 1023, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_addHisto") < 0)) __PYX_ERR(0, 1023, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_self = values[0]; + __pyx_v_histo_out = ((PyArrayObject *)values[1]); + __pyx_v_histo = ((PyArrayObject *)values[2]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_addHisto", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1023, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi._addHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_histo_out), __pyx_ptype_5numpy_ndarray, 1, "histo_out", 0))) __PYX_ERR(0, 1023, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_histo), __pyx_ptype_5numpy_ndarray, 1, "histo", 0))) __PYX_ERR(0, 1023, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_6_addHisto(__pyx_self, __pyx_v_self, __pyx_v_histo_out, __pyx_v_histo); - /* "View.MemoryView":1309 - * order = get_best_order(&dst, ndim) + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_6_addHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyArrayObject *__pyx_v_histo_out, PyArrayObject *__pyx_v_histo) { + int __pyx_v_histo_n; + int __pyx_v_n1; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_ix; + int __pyx_v_ix2; + double *__pyx_v_histogram_out; + double *__pyx_v_histogram; + int __pyx_v_shell; + int __pyx_v_nshells; + __Pyx_LocalBuf_ND __pyx_pybuffernd_histo; + __Pyx_Buffer __pyx_pybuffer_histo; + __Pyx_LocalBuf_ND __pyx_pybuffernd_histo_out; + __Pyx_Buffer __pyx_pybuffer_histo_out; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_addHisto", 0); + __pyx_pybuffer_histo_out.pybuffer.buf = NULL; + __pyx_pybuffer_histo_out.refcount = 0; + __pyx_pybuffernd_histo_out.data = NULL; + __pyx_pybuffernd_histo_out.rcbuffer = &__pyx_pybuffer_histo_out; + __pyx_pybuffer_histo.pybuffer.buf = NULL; + __pyx_pybuffer_histo.refcount = 0; + __pyx_pybuffernd_histo.data = NULL; + __pyx_pybuffernd_histo.rcbuffer = &__pyx_pybuffer_histo; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_histo_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1023, __pyx_L1_error) + } + __pyx_pybuffernd_histo_out.diminfo[0].strides = __pyx_pybuffernd_histo_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_histo_out.diminfo[0].shape = __pyx_pybuffernd_histo_out.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_histo.rcbuffer->pybuffer, (PyObject*)__pyx_v_histo, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1023, __pyx_L1_error) + } + __pyx_pybuffernd_histo.diminfo[0].strides = __pyx_pybuffernd_histo.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_histo.diminfo[0].shape = __pyx_pybuffernd_histo.rcbuffer->pybuffer.shape[0]; + + /* "newanalysis/gfunction/gfunction.pyx":1029 * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< - * src = tmp + * #cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n + * cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n*self.nshells # <<<<<<<<<<<<<< * + * cdef double* histogram_out = histo_out.data */ - __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1309, __pyx_L1_error) - __pyx_v_tmpdata = __pyx_t_7; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_histo_n = __pyx_t_2; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_n1 = __pyx_t_2; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1029, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_ix2 = __pyx_t_2; - /* "View.MemoryView":1310 - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) - * src = tmp # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":1031 + * cdef int histo_n = self.histo_n, n1=self.n1, i, j, k, ix, ix2 = self.n1*self.histo_n*self.nshells * - * if not broadcasting: + * cdef double* histogram_out = histo_out.data # <<<<<<<<<<<<<< + * cdef double* histogram = histo.data + * cdef int shell */ - __pyx_v_src = __pyx_v_tmp; + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_histo_out)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1031, __pyx_L1_error) + __pyx_v_histogram_out = ((double *)__pyx_t_5); - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) + /* "newanalysis/gfunction/gfunction.pyx":1032 * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): + * cdef double* histogram_out = histo_out.data + * cdef double* histogram = histo.data # <<<<<<<<<<<<<< + * cdef int shell + * cdef int nshells = self.nshells */ - } + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_histo)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1032, __pyx_L1_error) + __pyx_v_histogram = ((double *)__pyx_t_5); - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * + /* "newanalysis/gfunction/gfunction.pyx":1034 + * cdef double* histogram = histo.data + * cdef int shell + * cdef int nshells = self.nshells # <<<<<<<<<<<<<< * + * # add histograms */ - __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1034, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1034, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_nshells = __pyx_t_2; - /* "View.MemoryView":1315 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + /* "newanalysis/gfunction/gfunction.pyx":1044 + * histogram_out[k*histo_n+i]+=histogram[k*ix2+ix+i] + * """ + * for shell in range(nshells): # <<<<<<<<<<<<<< + * for i in prange(histo_n, nogil=True): + * for j in range(n1): #n_aufpunkte */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_2 = __pyx_v_nshells; + __pyx_t_6 = __pyx_t_2; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_shell = __pyx_t_7; - /* "View.MemoryView":1316 - * - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/gfunction/gfunction.pyx":1045 + * """ + * for shell in range(nshells): + * for i in prange(histo_n, nogil=True): # <<<<<<<<<<<<<< + * for j in range(n1): #n_aufpunkte + * ix = nshells * histo_n * j */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_8 = __pyx_v_histo_n; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_10 = (__pyx_t_8 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_10 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ix) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) + #endif /* _OPENMP */ + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_9); + /* Initialize private variables to invalid values */ + __pyx_v_ix = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); - /* "View.MemoryView":1315 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + /* "newanalysis/gfunction/gfunction.pyx":1046 + * for shell in range(nshells): + * for i in prange(histo_n, nogil=True): + * for j in range(n1): #n_aufpunkte # <<<<<<<<<<<<<< + * ix = nshells * histo_n * j + * for k in range(7): */ - goto __pyx_L12; - } + __pyx_t_11 = __pyx_v_n1; + __pyx_t_12 = __pyx_t_11; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_j = __pyx_t_13; - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) - * + /* "newanalysis/gfunction/gfunction.pyx":1047 + * for i in prange(histo_n, nogil=True): + * for j in range(n1): #n_aufpunkte + * ix = nshells * histo_n * j # <<<<<<<<<<<<<< + * for k in range(7): + * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_v_ix = ((__pyx_v_nshells * __pyx_v_histo_n) * __pyx_v_j); - /* "View.MemoryView":1318 - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":1048 + * for j in range(n1): #n_aufpunkte + * ix = nshells * histo_n * j + * for k in range(7): # <<<<<<<<<<<<<< + * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] * - * if direct_copy: */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + for (__pyx_t_14 = 0; __pyx_t_14 < 7; __pyx_t_14+=1) { + __pyx_v_k = __pyx_t_14; - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/gfunction/gfunction.pyx":1049 + * ix = nshells * histo_n * j + * for k in range(7): + * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] # <<<<<<<<<<<<<< * + * def _normHisto(self): */ - } - __pyx_L12:; + __pyx_t_15 = ((((__pyx_v_k * __pyx_v_histo_n) * __pyx_v_nshells) + (__pyx_v_i * __pyx_v_nshells)) + __pyx_v_shell); + (__pyx_v_histogram_out[__pyx_t_15]) = ((__pyx_v_histogram_out[__pyx_t_15]) + (__pyx_v_histogram[((((__pyx_v_k * __pyx_v_ix2) + __pyx_v_ix) + (__pyx_v_i * __pyx_v_nshells)) + __pyx_v_shell)])); + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) + /* "newanalysis/gfunction/gfunction.pyx":1045 + * """ + * for shell in range(nshells): + * for i in prange(histo_n, nogil=True): # <<<<<<<<<<<<<< + * for j in range(n1): #n_aufpunkte + * ix = nshells * histo_n * j */ - __pyx_t_2 = (__pyx_v_direct_copy != 0); - if (__pyx_t_2) { + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L9; + } + __pyx_L9:; + } + } + } - /* "View.MemoryView":1322 - * if direct_copy: + /* "newanalysis/gfunction/gfunction.pyx":1023 + * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) + * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< + * """ + * Add the histograms of all core particles, after they were calculated in parallel. */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":1323 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi._addHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_histo_out.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/gfunction/gfunction.pyx":1051 + * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) + * def _normHisto(self): # <<<<<<<<<<<<<< + * """ + * Normalize the histogram. */ - (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - /* "View.MemoryView":1324 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * free(tmpdata) - * return 0 - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_9_normHisto(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_8_normHisto, "\n Normalize the histogram.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_9_normHisto = {"_normHisto", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_9_normHisto, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_8_normHisto}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_9_normHisto(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_normHisto (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1051, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_normHisto") < 0)) __PYX_ERR(0, 1051, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_self = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_normHisto", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1051, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi._normHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_8_normHisto(__pyx_self, __pyx_v_self); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1325 - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 - * - */ - free(__pyx_v_tmpdata); +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_8_normHisto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_v_volume = NULL; + PyObject *__pyx_v_v = NULL; + int __pyx_v_i; + int __pyx_v_j; + CYTHON_UNUSED int __pyx_v_ix2; + int __pyx_v_shell; + double __pyx_v_PI; + PyObject *__pyx_v_rho = NULL; + PyObject *__pyx_v_r = NULL; + PyObject *__pyx_v_r_out = NULL; + PyObject *__pyx_v_slice_vol = NULL; + PyObject *__pyx_v_norm = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + long __pyx_t_8; + long __pyx_t_9; + long __pyx_t_10; + long __pyx_t_11; + int __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; + PyObject *__pyx_t_15 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_normHisto", 0); - /* "View.MemoryView":1326 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":1056 + * """ * - * if order == 'F' == get_best_order(&dst, ndim): + * if self.norm_volume: # <<<<<<<<<<<<<< + * volume = self.norm_volume + * else: */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1056, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1056, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":1057 * - * refcount_copying(&dst, dtype_is_object, ndim, False) + * if self.norm_volume: + * volume = self.norm_volume # <<<<<<<<<<<<<< + * else: + * volume = 0.0 */ - } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_norm_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1057, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_volume = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * + /* "newanalysis/gfunction/gfunction.pyx":1056 + * """ * + * if self.norm_volume: # <<<<<<<<<<<<<< + * volume = self.norm_volume + * else: */ + goto __pyx_L3; } - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * + /* "newanalysis/gfunction/gfunction.pyx":1059 + * volume = self.norm_volume + * else: + * volume = 0.0 # <<<<<<<<<<<<<< + * for v in self.volume_list: + * volume+=v */ - __pyx_t_2 = (__pyx_v_order == 'F'); - if (__pyx_t_2) { - __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); - } - __pyx_t_8 = (__pyx_t_2 != 0); - if (__pyx_t_8) { + /*else*/ { + __Pyx_INCREF(__pyx_float_0_0); + __pyx_v_volume = __pyx_float_0_0; - /* "View.MemoryView":1331 - * - * - * transpose_memslice(&src) # <<<<<<<<<<<<<< - * transpose_memslice(&dst) - * + /* "newanalysis/gfunction/gfunction.pyx":1060 + * else: + * volume = 0.0 + * for v in self.volume_list: # <<<<<<<<<<<<<< + * volume+=v + * volume/=len(self.volume_list) */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1331, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1060, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1060, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 1060, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 1060, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1060, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":1332 - * - * transpose_memslice(&src) - * transpose_memslice(&dst) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":1061 + * volume = 0.0 + * for v in self.volume_list: + * volume+=v # <<<<<<<<<<<<<< + * volume/=len(self.volume_list) * - * refcount_copying(&dst, dtype_is_object, ndim, False) */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1332, __pyx_L1_error) + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_volume, __pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1061, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_volume, __pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * + /* "newanalysis/gfunction/gfunction.pyx":1060 + * else: + * volume = 0.0 + * for v in self.volume_list: # <<<<<<<<<<<<<< + * volume+=v + * volume/=len(self.volume_list) */ - } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":1334 - * transpose_memslice(&dst) + /* "newanalysis/gfunction/gfunction.pyx":1062 + * for v in self.volume_list: + * volume+=v + * volume/=len(self.volume_list) # <<<<<<<<<<<<<< * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) + * cdef int i, j, ix, ix2 = self.n1 * self.histo_n, shell */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_volume_list); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_volume, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_volume, __pyx_t_1); + __pyx_t_1 = 0; + } + __pyx_L3:; - /* "View.MemoryView":1335 + /* "newanalysis/gfunction/gfunction.pyx":1064 + * volume/=len(self.volume_list) * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) + * cdef int i, j, ix, ix2 = self.n1 * self.histo_n, shell # <<<<<<<<<<<<<< + * PI = 3.14159265358979323846 * */ - copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_ix2 = __pyx_t_7; - /* "View.MemoryView":1336 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":1065 * - * free(tmpdata) + * cdef int i, j, ix, ix2 = self.n1 * self.histo_n, shell + * PI = 3.14159265358979323846 # <<<<<<<<<<<<<< + * + * # norm histograms */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + __pyx_v_PI = 3.14159265358979323846; - /* "View.MemoryView":1338 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 + /* "newanalysis/gfunction/gfunction.pyx":1068 * + * # norm histograms + * if self.oneistwo: # <<<<<<<<<<<<<< + * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume + * else: */ - free(__pyx_v_tmpdata); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_oneistwo); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1068, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1068, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_2) { - /* "View.MemoryView":1339 - * - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_broadcast_leading') + /* "newanalysis/gfunction/gfunction.pyx":1069 + * # norm histograms + * if self.oneistwo: + * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume # <<<<<<<<<<<<<< + * else: + * rho = float(self.nmol1 * self.nmol2) / volume */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_volume); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rho = __pyx_t_3; + __pyx_t_3 = 0; - /* "View.MemoryView":1270 + /* "newanalysis/gfunction/gfunction.pyx":1068 * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, + * # norm histograms + * if self.oneistwo: # <<<<<<<<<<<<<< + * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume + * else: */ - - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + goto __pyx_L7; } - __pyx_r = -1; - __pyx_L0:; - return __pyx_r; -} -/* "View.MemoryView":1342 + /* "newanalysis/gfunction/gfunction.pyx":1071 + * rho = float(self.nmol1 * (self.nmol1 - 1)) / volume + * else: + * rho = float(self.nmol1 * self.nmol2) / volume # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: - */ - -static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { - int __pyx_v_i; - int __pyx_v_offset; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - - /* "View.MemoryView":1346 - * int ndim_other) nogil: - * cdef int i - * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< * - * for i in range(ndim - 1, -1, -1): */ - __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1071, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nmol2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1071, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1071, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1071, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_volume); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1071, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rho = __pyx_t_6; + __pyx_t_6 = 0; + } + __pyx_L7:; - /* "View.MemoryView":1348 - * cdef int offset = ndim_other - ndim - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] + /* "newanalysis/gfunction/gfunction.pyx":1083 + * self.histogram_out[j*self.histo_n+i]/=norm + * """ + * for shell in range(self.nshells): # <<<<<<<<<<<<<< + * for i in range(self.histo_n): + * r = self.histo_min + float(i) * self.histo_dr */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1083, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1083, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_9 = __pyx_t_8; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_9; __pyx_t_7+=1) { + __pyx_v_shell = __pyx_t_7; - /* "View.MemoryView":1349 - * - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + /* "newanalysis/gfunction/gfunction.pyx":1084 + * """ + * for shell in range(self.nshells): + * for i in range(self.histo_n): # <<<<<<<<<<<<<< + * r = self.histo_min + float(i) * self.histo_dr + * r_out = r + self.histo_dr */ - (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1084, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1084, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_11 = __pyx_t_10; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_i = __pyx_t_12; - /* "View.MemoryView":1350 - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - * + /* "newanalysis/gfunction/gfunction.pyx":1085 + * for shell in range(self.nshells): + * for i in range(self.histo_n): + * r = self.histo_min + float(i) * self.histo_dr # <<<<<<<<<<<<<< + * r_out = r + self.histo_dr + * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) */ - (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyFloat_FromDouble(((double)__pyx_v_i)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":1351 - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< - * - * for i in range(offset): + /* "newanalysis/gfunction/gfunction.pyx":1086 + * for i in range(self.histo_n): + * r = self.histo_min + float(i) * self.histo_dr + * r_out = r + self.histo_dr # <<<<<<<<<<<<<< + * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) + * norm = rho*slice_vol*float(self.ctr) */ - (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); - } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1086, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = PyNumber_Add(__pyx_v_r, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1086, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_r_out, __pyx_t_13); + __pyx_t_13 = 0; - /* "View.MemoryView":1353 - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - * - * for i in range(offset): # <<<<<<<<<<<<<< - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] + /* "newanalysis/gfunction/gfunction.pyx":1087 + * r = self.histo_min + float(i) * self.histo_dr + * r_out = r + self.histo_dr + * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) # <<<<<<<<<<<<<< + * norm = rho*slice_vol*float(self.ctr) + * for j in range(7): */ - __pyx_t_1 = __pyx_v_offset; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_13 = PyFloat_FromDouble(((4.0 / 3.0) * __pyx_v_PI)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1087, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_3 = PyNumber_Power(__pyx_v_r_out, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1087, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyNumber_Power(__pyx_v_r, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1087, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Multiply(__pyx_t_13, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_slice_vol, __pyx_t_6); + __pyx_t_6 = 0; - /* "View.MemoryView":1354 - * - * for i in range(offset): - * mslice.shape[i] = 1 # <<<<<<<<<<<<<< - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 + /* "newanalysis/gfunction/gfunction.pyx":1088 + * r_out = r + self.histo_dr + * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) + * norm = rho*slice_vol*float(self.ctr) # <<<<<<<<<<<<<< + * for j in range(7): + * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm */ - (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + __pyx_t_6 = PyNumber_Multiply(__pyx_v_rho, __pyx_v_slice_vol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1088, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __Pyx_PyNumber_Float(__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1088, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF_SET(__pyx_v_norm, __pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":1355 - * for i in range(offset): - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< - * mslice.suboffsets[i] = -1 + /* "newanalysis/gfunction/gfunction.pyx":1089 + * slice_vol = 4.0/3.0 * PI * (r_out**3 - r**3) + * norm = rho*slice_vol*float(self.ctr) + * for j in range(7): # <<<<<<<<<<<<<< + * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm * */ - (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + for (__pyx_t_14 = 0; __pyx_t_14 < 7; __pyx_t_14+=1) { + __pyx_v_j = __pyx_t_14; - /* "View.MemoryView":1356 - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< - * + /* "newanalysis/gfunction/gfunction.pyx":1090 + * norm = rho*slice_vol*float(self.ctr) + * for j in range(7): + * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm # <<<<<<<<<<<<<< * + * def scale(self, value): */ - (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_13, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_13 = PyNumber_Multiply(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = PyNumber_Multiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_13, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_shell); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_13 = PyNumber_Add(__pyx_t_3, __pyx_t_15); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_15, __pyx_v_norm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_t_13, __pyx_t_3) < 0))) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + } } - /* "View.MemoryView":1342 + /* "newanalysis/gfunction/gfunction.pyx":1051 + * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: + * def _normHisto(self): # <<<<<<<<<<<<<< + * """ + * Normalize the histogram. */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi._normHisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_volume); + __Pyx_XDECREF(__pyx_v_v); + __Pyx_XDECREF(__pyx_v_rho); + __Pyx_XDECREF(__pyx_v_r); + __Pyx_XDECREF(__pyx_v_r_out); + __Pyx_XDECREF(__pyx_v_slice_vol); + __Pyx_XDECREF(__pyx_v_norm); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1364 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: +/* "newanalysis/gfunction/gfunction.pyx":1092 + * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm * + * def scale(self, value): # <<<<<<<<<<<<<< + * self.histogram_out[:] *= value + * self.histogram[:] *= value */ -static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - int __pyx_t_1; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_11scale(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_11scale = {"scale", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_11scale, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_11scale(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_value = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("scale (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1092, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1092, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1092, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); __PYX_ERR(0, 1092, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "scale") < 0)) __PYX_ERR(0, 1092, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_self = values[0]; + __pyx_v_value = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1092, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_10scale(__pyx_self, __pyx_v_self, __pyx_v_value); - /* "View.MemoryView":1368 - * - * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) - */ - __pyx_t_1 = (__pyx_v_dtype_is_object != 0); - if (__pyx_t_1) { + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_10scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("scale", 0); - /* "View.MemoryView":1369 + /* "newanalysis/gfunction/gfunction.pyx":1093 * - * if dtype_is_object: - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< - * dst.strides, ndim, inc) + * def scale(self, value): + * self.histogram_out[:] *= value # <<<<<<<<<<<<<< + * self.histogram[:] *= value * */ - __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1093, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_slice__5); + __pyx_t_2 = __pyx_slice__5; + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1093, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_InPlaceMultiply(__pyx_t_3, __pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1093, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_4) < 0))) __PYX_ERR(0, 1093, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1368 - * + /* "newanalysis/gfunction/gfunction.pyx":1094 + * def scale(self, value): + * self.histogram_out[:] *= value + * self.histogram[:] *= value # <<<<<<<<<<<<<< * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) + * def write(self, filename="rdf"): */ - } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1094, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_slice__5); + __pyx_t_2 = __pyx_slice__5; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1094, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_4, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1094, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0))) __PYX_ERR(0, 1094, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1364 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: + /* "newanalysis/gfunction/gfunction.pyx":1092 + * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm * + * def scale(self, value): # <<<<<<<<<<<<<< + * self.histogram_out[:] *= value + * self.histogram[:] *= value */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1373 +/* "newanalysis/gfunction/gfunction.pyx":1096 + * self.histogram[:] *= value * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: + * def write(self, filename="rdf"): # <<<<<<<<<<<<<< + * """ + * RDF.write(filename="rdf") */ -static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_13write(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_12write, "\n RDF.write(filename=\"rdf\")\n\n Args:\n filename .. name of the file to be written to. Each type of rdf will be written to a separate file\n with the ending specifying the type.\n \n Norm the calculated histograms and write them to the specified file.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_13write = {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_13write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_12write}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_13write(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_filename = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("write (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1096, __pyx_L3_error) #endif - __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - - /* "View.MemoryView":1376 - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - - /* "View.MemoryView":1373 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - */ + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filename,0}; + values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_n_s_rdf))); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1096, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename); + if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1096, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write") < 0)) __PYX_ERR(0, 1096, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_self = values[0]; + __pyx_v_filename = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1096, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_12write(__pyx_self, __pyx_v_self, __pyx_v_filename); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + return __pyx_r; } -/* "View.MemoryView":1379 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i - */ - -static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_12write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename) { + PyObject *__pyx_v_shell = NULL; + PyObject *__pyx_v_f000 = NULL; + PyObject *__pyx_v_f110 = NULL; + PyObject *__pyx_v_f101 = NULL; + PyObject *__pyx_v_f011 = NULL; + PyObject *__pyx_v_f220 = NULL; + PyObject *__pyx_v_f202 = NULL; + PyObject *__pyx_v_f022 = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_r = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + int __pyx_t_11; + Py_ssize_t __pyx_t_12; + PyObject *(*__pyx_t_13)(PyObject *); + PyObject *__pyx_t_14 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write", 0); - /* "View.MemoryView":1383 - * cdef Py_ssize_t i + /* "newanalysis/gfunction/gfunction.pyx":1112 + * """ + * + * self._addHisto(self.histogram_out, self.histogram.astype(np.float64)) # <<<<<<<<<<<<<< + * self._normHisto() * - * for i in range(shape[0]): # <<<<<<<<<<<<<< - * if ndim == 1: - * if inc: */ - __pyx_t_1 = (__pyx_v_shape[0]); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_addHisto); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_astype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_6 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1384 + /* "newanalysis/gfunction/gfunction.pyx":1113 * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) + * self._addHisto(self.histogram_out, self.histogram.astype(np.float64)) + * self._normHisto() # <<<<<<<<<<<<<< + * + * for shell in range(self.nshells): */ - __pyx_t_4 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normHisto); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[1] = {__pyx_t_4, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: + /* "newanalysis/gfunction/gfunction.pyx":1115 + * self._normHisto() + * + * for shell in range(self.nshells): # <<<<<<<<<<<<<< + * if self.mode_sel & 1: f000 = open(filename+"_shell"+str(shell+1)+"_g000.dat",'w') + * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') */ - __pyx_t_4 = (__pyx_v_inc != 0); - if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1115, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(0, 1115, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(0, 1115, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_10(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1115, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_shell, __pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":1386 - * if ndim == 1: - * if inc: - * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * Py_DECREF(( data)[0]) + /* "newanalysis/gfunction/gfunction.pyx":1116 + * + * for shell in range(self.nshells): + * if self.mode_sel & 1: f000 = open(filename+"_shell"+str(shell+1)+"_g000.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') + * if self.mode_sel & 4: f101 = open(filename+"_shell"+str(shell+1)+"_g101.dat",'w') */ - Py_INCREF((((PyObject **)__pyx_v_data)[0])); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1116, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_11) { + __pyx_t_4 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Str(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_g000_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(0, 1116, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_w)) __PYX_ERR(0, 1116, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_f000, __pyx_t_3); + __pyx_t_3 = 0; + } - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: + /* "newanalysis/gfunction/gfunction.pyx":1117 + * for shell in range(self.nshells): + * if self.mode_sel & 1: f000 = open(filename+"_shell"+str(shell+1)+"_g000.dat",'w') + * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 4: f101 = open(filename+"_shell"+str(shell+1)+"_g101.dat",'w') + * if self.mode_sel & 8: f011 = open(filename+"_shell"+str(shell+1)+"_g011.dat",'w') */ - goto __pyx_L6; - } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_11) { + __pyx_t_2 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Str(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_kp_s_g110_dat); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_w)) __PYX_ERR(0, 1117, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_f110, __pyx_t_4); + __pyx_t_4 = 0; + } - /* "View.MemoryView":1388 - * Py_INCREF(( data)[0]) - * else: - * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, + /* "newanalysis/gfunction/gfunction.pyx":1118 + * if self.mode_sel & 1: f000 = open(filename+"_shell"+str(shell+1)+"_g000.dat",'w') + * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') + * if self.mode_sel & 4: f101 = open(filename+"_shell"+str(shell+1)+"_g101.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 8: f011 = open(filename+"_shell"+str(shell+1)+"_g011.dat",'w') + * if self.mode_sel & 16: f220 = open(filename+"_shell"+str(shell+1)+"_g220.dat",'w') */ - /*else*/ { - Py_DECREF((((PyObject **)__pyx_v_data)[0])); - } - __pyx_L6:; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_11) { + __pyx_t_3 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_Str(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_kp_s_g101_dat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 1118, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_w)) __PYX_ERR(0, 1118, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_f101, __pyx_t_2); + __pyx_t_2 = 0; + } - /* "View.MemoryView":1384 - * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) + /* "newanalysis/gfunction/gfunction.pyx":1119 + * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') + * if self.mode_sel & 4: f101 = open(filename+"_shell"+str(shell+1)+"_g101.dat",'w') + * if self.mode_sel & 8: f011 = open(filename+"_shell"+str(shell+1)+"_g011.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 16: f220 = open(filename+"_shell"+str(shell+1)+"_g220.dat",'w') + * if self.mode_sel & 32: f202 = open(filename+"_shell"+str(shell+1)+"_g202.dat",'w') */ - goto __pyx_L5; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_11) { + __pyx_t_4 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Str(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_g011_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(0, 1119, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_w)) __PYX_ERR(0, 1119, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_f011, __pyx_t_3); + __pyx_t_3 = 0; } - /* "View.MemoryView":1390 - * Py_DECREF(( data)[0]) - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, inc) - * + /* "newanalysis/gfunction/gfunction.pyx":1120 + * if self.mode_sel & 4: f101 = open(filename+"_shell"+str(shell+1)+"_g101.dat",'w') + * if self.mode_sel & 8: f011 = open(filename+"_shell"+str(shell+1)+"_g011.dat",'w') + * if self.mode_sel & 16: f220 = open(filename+"_shell"+str(shell+1)+"_g220.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 32: f202 = open(filename+"_shell"+str(shell+1)+"_g202.dat",'w') + * if self.mode_sel & 64: f022 = open(filename+"_shell"+str(shell+1)+"_g022.dat",'w') */ - /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_3, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_11) { + __pyx_t_2 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Str(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_kp_s_g220_dat); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_w)) __PYX_ERR(0, 1120, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_f220, __pyx_t_4); + __pyx_t_4 = 0; + } - /* "View.MemoryView":1391 - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, - * ndim - 1, inc) # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":1121 + * if self.mode_sel & 8: f011 = open(filename+"_shell"+str(shell+1)+"_g011.dat",'w') + * if self.mode_sel & 16: f220 = open(filename+"_shell"+str(shell+1)+"_g220.dat",'w') + * if self.mode_sel & 32: f202 = open(filename+"_shell"+str(shell+1)+"_g202.dat",'w') # <<<<<<<<<<<<<< + * if self.mode_sel & 64: f022 = open(filename+"_shell"+str(shell+1)+"_g022.dat",'w') * - * data += strides[0] */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_4, __pyx_int_32, 32, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_11) { + __pyx_t_3 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_Str(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_kp_s_g202_dat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 1121, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_w)) __PYX_ERR(0, 1121, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_f202, __pyx_t_2); + __pyx_t_2 = 0; } - __pyx_L5:; - /* "View.MemoryView":1393 - * ndim - 1, inc) - * - * data += strides[0] # <<<<<<<<<<<<<< - * + /* "newanalysis/gfunction/gfunction.pyx":1122 + * if self.mode_sel & 16: f220 = open(filename+"_shell"+str(shell+1)+"_g220.dat",'w') + * if self.mode_sel & 32: f202 = open(filename+"_shell"+str(shell+1)+"_g202.dat",'w') + * if self.mode_sel & 64: f022 = open(filename+"_shell"+str(shell+1)+"_g022.dat",'w') # <<<<<<<<<<<<<< * + * for i in range(self.histo_n): */ - __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0])); - } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_64, 64, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_11) { + __pyx_t_4 = PyNumber_Add(__pyx_v_filename, __pyx_n_s_shell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_shell, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Str(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_kp_s_g022_dat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(0, 1122, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_w); + __Pyx_GIVEREF(__pyx_n_s_w); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_w)) __PYX_ERR(0, 1122, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_f022, __pyx_t_3); + __pyx_t_3 = 0; + } - /* "View.MemoryView":1379 + /* "newanalysis/gfunction/gfunction.pyx":1124 + * if self.mode_sel & 64: f022 = open(filename+"_shell"+str(shell+1)+"_g022.dat",'w') * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i + * for i in range(self.histo_n): # <<<<<<<<<<<<<< + * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = 0; + __pyx_t_13 = NULL; + } else { + __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1124, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_13)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 1124, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 1124, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_13(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1124, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); + __pyx_t_2 = 0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":1399 + /* "newanalysis/gfunction/gfunction.pyx":1125 * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - */ - -static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - - /* "View.MemoryView":1402 - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1403 - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) + * for i in range(self.histo_n): + * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 # <<<<<<<<<<<<<< + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[1*self.histo_n*self.nshells+i*self.nshells+shell])) */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_min); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Multiply(__pyx_v_i, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_dr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyNumber_Multiply(__pyx_t_6, __pyx_float_0_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_6); + __pyx_t_6 = 0; - /* "View.MemoryView":1405 - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * - * + /* "newanalysis/gfunction/gfunction.pyx":1126 + * for i in range(self.histo_n): + * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< + * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[1*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n*self.nshells+i*self.nshells+shell])) */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_11) { + if (unlikely(!__pyx_v_f000)) { __Pyx_RaiseUnboundLocalError("f000"); __PYX_ERR(0, 1126, __pyx_L1_error) } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_f000, __pyx_n_s_write); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyInt_MultiplyCObj(__pyx_int_0, __pyx_t_7, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = PyNumber_Multiply(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyNumber_Multiply(__pyx_v_i, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Add(__pyx_t_14, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_7, __pyx_v_shell); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_r)) __PYX_ERR(0, 1126, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 1126, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } - /* "View.MemoryView":1399 - * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: + /* "newanalysis/gfunction/gfunction.pyx":1127 + * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[1*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< + * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n*self.nshells+i*self.nshells+shell])) */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_11) { + if (unlikely(!__pyx_v_f110)) { __Pyx_RaiseUnboundLocalError("f110"); __PYX_ERR(0, 1127, __pyx_L1_error) } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f110, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyInt_MultiplyCObj(__pyx_int_1, __pyx_t_5, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_14 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Multiply(__pyx_v_i, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_14, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_v_shell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_r)) __PYX_ERR(0, 1127, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } - /* function exit code */ -} - -/* "View.MemoryView":1409 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: + /* "newanalysis/gfunction/gfunction.pyx":1128 + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[1*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< + * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n*self.nshells+i*self.nshells+shell])) */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_6, __pyx_int_4, 4, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_11) { + if (unlikely(!__pyx_v_f101)) { __Pyx_RaiseUnboundLocalError("f101"); __PYX_ERR(0, 1128, __pyx_L1_error) } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_f101, __pyx_n_s_write); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyInt_MultiplyCObj(__pyx_int_2, __pyx_t_4, 2, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_14 = PyNumber_Multiply(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyNumber_Multiply(__pyx_v_i, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_14, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_v_shell); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_r)) __PYX_ERR(0, 1128, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4)) __PYX_ERR(0, 1128, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } -static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_extent; - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - - /* "View.MemoryView":1413 - * size_t itemsize, void *item) nogil: - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t extent = shape[0] - * + /* "newanalysis/gfunction/gfunction.pyx":1129 + * if self.mode_sel & 2: f110.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[1*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< + * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n*self.nshells+i*self.nshells+shell])) */ - __pyx_v_stride = (__pyx_v_strides[0]); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_11) { + if (unlikely(!__pyx_v_f011)) { __Pyx_RaiseUnboundLocalError("f011"); __PYX_ERR(0, 1129, __pyx_L1_error) } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f011, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyInt_MultiplyCObj(__pyx_int_3, __pyx_t_7, 3, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = PyNumber_Multiply(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyNumber_Multiply(__pyx_v_i, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Add(__pyx_t_14, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_7, __pyx_v_shell); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_r)) __PYX_ERR(0, 1129, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 1129, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } - /* "View.MemoryView":1414 - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] - * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: + /* "newanalysis/gfunction/gfunction.pyx":1130 + * if self.mode_sel & 4: f101.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[2*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< + * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) */ - __pyx_v_extent = (__pyx_v_shape[0]); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_6, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_11) { + if (unlikely(!__pyx_v_f220)) { __Pyx_RaiseUnboundLocalError("f220"); __PYX_ERR(0, 1130, __pyx_L1_error) } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_f220, __pyx_n_s_write); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyInt_MultiplyCObj(__pyx_int_4, __pyx_t_5, 4, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_14 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Multiply(__pyx_v_i, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_14, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_v_shell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_r)) __PYX_ERR(0, 1130, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] + /* "newanalysis/gfunction/gfunction.pyx":1131 + * if self.mode_sel & 8: f011.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[3*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_32, 32, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_11) { + if (unlikely(!__pyx_v_f202)) { __Pyx_RaiseUnboundLocalError("f202"); __PYX_ERR(0, 1131, __pyx_L1_error) } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f202, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyInt_MultiplyCObj(__pyx_int_5, __pyx_t_4, 5, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_14 = PyNumber_Multiply(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyNumber_Multiply(__pyx_v_i, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_14, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_v_shell); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_r)) __PYX_ERR(0, 1131, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4)) __PYX_ERR(0, 1131, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_4}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } - /* "View.MemoryView":1417 + /* "newanalysis/gfunction/gfunction.pyx":1132 + * if self.mode_sel & 16: f220.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[4*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 32: f202.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[5*self.histo_n*self.nshells+i*self.nshells+shell])) + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) # <<<<<<<<<<<<<< * - * if ndim == 1: - * for i in range(extent): # <<<<<<<<<<<<<< - * memcpy(data, item, itemsize) - * data += stride - */ - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1418 - * if ndim == 1: - * for i in range(extent): - * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< - * data += stride - * else: - */ - (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - - /* "View.MemoryView":1419 - * for i in range(extent): - * memcpy(data, item, itemsize) - * data += stride # <<<<<<<<<<<<<< - * else: - * for i in range(extent): + * def resetArrays(self): */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_6, __pyx_int_64, 64, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_11) { + if (unlikely(!__pyx_v_f022)) { __Pyx_RaiseUnboundLocalError("f022"); __PYX_ERR(0, 1132, __pyx_L1_error) } + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_f022, __pyx_n_s_write); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histo_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyInt_MultiplyCObj(__pyx_int_6, __pyx_t_7, 6, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = PyNumber_Multiply(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nshells); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyNumber_Multiply(__pyx_v_i, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Add(__pyx_t_14, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_7, __pyx_v_shell); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_r)) __PYX_ERR(0, 1132, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 1132, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_5_5f_5_5f, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] + /* "newanalysis/gfunction/gfunction.pyx":1124 + * if self.mode_sel & 64: f022 = open(filename+"_shell"+str(shell+1)+"_g022.dat",'w') * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1421 - * data += stride - * else: - * for i in range(extent): # <<<<<<<<<<<<<< - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - */ - /*else*/ { - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1422 - * else: - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, itemsize, item) - * data += stride + * for i in range(self.histo_n): # <<<<<<<<<<<<<< + * r = self.histo_min+i*self.histo_dr+self.histo_dr*0.5 + * if self.mode_sel & 1: f000.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[0*self.histo_n*self.nshells+i*self.nshells+shell])) */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":1424 - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - * data += stride # <<<<<<<<<<<<<< - * + /* "newanalysis/gfunction/gfunction.pyx":1115 + * self._normHisto() * + * for shell in range(self.nshells): # <<<<<<<<<<<<<< + * if self.mode_sel & 1: f000 = open(filename+"_shell"+str(shell+1)+"_g000.dat",'w') + * if self.mode_sel & 2: f110 = open(filename+"_shell"+str(shell+1)+"_g110.dat",'w') */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } } - __pyx_L3:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1409 + /* "newanalysis/gfunction/gfunction.pyx":1096 + * self.histogram[:] *= value * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: + * def write(self, filename="rdf"): # <<<<<<<<<<<<<< + * """ + * RDF.write(filename="rdf") */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_shell); + __Pyx_XDECREF(__pyx_v_f000); + __Pyx_XDECREF(__pyx_v_f110); + __Pyx_XDECREF(__pyx_v_f101); + __Pyx_XDECREF(__pyx_v_f011); + __Pyx_XDECREF(__pyx_v_f220); + __Pyx_XDECREF(__pyx_v_f202); + __Pyx_XDECREF(__pyx_v_f022); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result +/* "newanalysis/gfunction/gfunction.pyx":1134 + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) + * + * def resetArrays(self): # <<<<<<<<<<<<<< + * """ + * Reset histogram arrays to zero */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_15resetArrays(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_14resetArrays, "\n Reset histogram arrays to zero\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_15resetArrays = {"resetArrays", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_15resetArrays, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_14resetArrays}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_15resetArrays(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + __Pyx_RefNannySetupContext("resetArrays (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1134, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error) + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1134, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "resetArrays") < 0)) __PYX_ERR(0, 1134, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error) - __pyx_v___pyx_state = values[2]; + __pyx_v_self = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("resetArrays", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1134, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.resetArrays", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_14resetArrays(__pyx_self, __pyx_v_self); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_14resetArrays(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + __Pyx_RefNannySetupContext("resetArrays", 0); - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) + /* "newanalysis/gfunction/gfunction.pyx":1138 + * Reset histogram arrays to zero + * """ + * self.histogram_out[:] = 0.0 # <<<<<<<<<<<<<< + * self.histogram[:] = 0.0 + * */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__27, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 4, __pyx_L1_error) + if (__Pyx_PyObject_SetSlice(__pyx_t_1, __pyx_float_0_0, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1) < 0) __PYX_ERR(0, 1138, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); - __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "(tree fragment)":6 - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_v___pyx_PickleError); - __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 6, __pyx_L1_error) - - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - */ - } - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + /* "newanalysis/gfunction/gfunction.pyx":1139 + * """ + * self.histogram_out[:] = 0.0 + * self.histogram[:] = 0.0 # <<<<<<<<<<<<<< + * + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 7, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_histogram); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_PyObject_SetSlice(__pyx_t_1, __pyx_float_0_0, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1) < 0) __PYX_ERR(0, 1139, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result = __pyx_t_4; - __pyx_t_4 = 0; - - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ - __pyx_t_3 = (__pyx_v___pyx_state != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "(tree fragment)":9 - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_t_4 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ - } - - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; - goto __pyx_L0; - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "newanalysis/gfunction/gfunction.pyx":1134 + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) + * + * def resetArrays(self): # <<<<<<<<<<<<<< + * """ + * Reset histogram arrays to zero */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.resetArrays", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - */ - -static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { +/* "newanalysis/gfunction/gfunction.pyx":1142 + * + * + * def printInfo(self): # <<<<<<<<<<<<<< + * """ + * Print some information about the RDF container. + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_17printInfo(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_16printInfo, "\n Print some information about the RDF container.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_17printInfo = {"printInfo", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_17printInfo, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9gfunction_11RDF_voronoi_16printInfo}; +static PyObject *__pyx_pw_11newanalysis_9gfunction_11RDF_voronoi_17printInfo(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("printInfo (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1142, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1142, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "printInfo") < 0)) __PYX_ERR(0, 1142, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_self = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("printInfo", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1142, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.printInfo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_16printInfo(__pyx_self, __pyx_v_self); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_9gfunction_11RDF_voronoi_16printInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + __Pyx_RefNannySetupContext("printInfo", 0); - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) + /* "newanalysis/gfunction/gfunction.pyx":1147 + * """ + * + * print("Modes: ", self.mode_sel) # <<<<<<<<<<<<<< + * print("Frames read: ", self.ctr) */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mode_sel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_kp_s_Modes); + __Pyx_GIVEREF(__pyx_kp_s_Modes); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_Modes)) __PYX_ERR(0, 1147, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->name); - __Pyx_DECREF(__pyx_v___pyx_result->name); - __pyx_v___pyx_result->name = __pyx_t_1; + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 13, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_4 = ((__pyx_t_3 > 1) != 0); - if (__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { - - /* "(tree fragment)":14 - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 14, __pyx_L1_error) - } - __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) + /* "newanalysis/gfunction/gfunction.pyx":1148 + * + * print("Modes: ", self.mode_sel) + * print("Frames read: ", self.ctr) # <<<<<<<<<<<<<< */ - } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ctr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_kp_s_Frames_read); + __Pyx_GIVEREF(__pyx_kp_s_Frames_read); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_Frames_read)) __PYX_ERR(0, 1148, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1)) __PYX_ERR(0, 1148, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + /* "newanalysis/gfunction/gfunction.pyx":1142 + * + * + * def printInfo(self): # <<<<<<<<<<<<<< + * """ + * Print some information about the RDF container. */ /* function exit code */ @@ -33147,11 +38111,9 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("newanalysis.gfunction.RDF_voronoi.printInfo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -33162,12 +38124,17 @@ static struct __pyx_vtabstruct_array __pyx_vtable_array; static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_array_obj *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_array_obj *)o); p->__pyx_vtab = __pyx_vtabptr_array; p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); @@ -33182,8 +38149,10 @@ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { static void __pyx_tp_dealloc_array(PyObject *o) { struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif { @@ -33196,7 +38165,14 @@ static void __pyx_tp_dealloc_array(PyObject *o) { } Py_CLEAR(p->mode); Py_CLEAR(p->_format); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { PyObject *r; @@ -33211,8 +38187,11 @@ static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { return __pyx_array___setitem__(o, i, v); } else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); return -1; } } @@ -33232,8 +38211,8 @@ static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED vo static PyMethodDef __pyx_methods_array[] = { {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -33241,6 +38220,50 @@ static struct PyGetSetDef __pyx_getsets_array[] = { {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "newanalysis.gfunction.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else static PySequenceMethods __pyx_tp_as_sequence_array = { __pyx_array___len__, /*sq_length*/ @@ -33280,7 +38303,7 @@ static PyBufferProcs __pyx_tp_as_buffer_array = { static PyTypeObject __pyx_type___pyx_array = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.gfunction.array", /*tp_name*/ + "newanalysis.gfunction.""array", /*tp_name*/ sizeof(struct __pyx_array_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_array, /*tp_dealloc*/ @@ -33308,7 +38331,7 @@ static PyTypeObject __pyx_type___pyx_array = { __pyx_tp_getattro_array, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ @@ -33323,7 +38346,9 @@ static PyTypeObject __pyx_type___pyx_array = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_array, /*tp_new*/ @@ -33337,28 +38362,41 @@ static PyTypeObject __pyx_type___pyx_array = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_MemviewEnum_obj *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_MemviewEnum_obj *)o); p->name = Py_None; Py_INCREF(Py_None); return o; @@ -33367,13 +38405,22 @@ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, C static void __pyx_tp_dealloc_Enum(PyObject *o) { struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); Py_CLEAR(p->name); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { @@ -33394,15 +38441,39 @@ static int __pyx_tp_clear_Enum(PyObject *o) { return 0; } +static PyObject *__pyx_specialmethod___pyx_MemviewEnum___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_MemviewEnum___repr__(self); +} + static PyMethodDef __pyx_methods_Enum[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0}, + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_MemviewEnum___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "newanalysis.gfunction.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_MemviewEnum_slots, +}; +#else static PyTypeObject __pyx_type___pyx_MemviewEnum = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.gfunction.Enum", /*tp_name*/ + "newanalysis.gfunction.""Enum", /*tp_name*/ sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_Enum, /*tp_dealloc*/ @@ -33445,7 +38516,9 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif __pyx_MemviewEnum___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_Enum, /*tp_new*/ @@ -33459,29 +38532,42 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_memoryview_obj *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_memoryview_obj *)o); p->__pyx_vtab = __pyx_vtabptr_memoryview; p->obj = Py_None; Py_INCREF(Py_None); @@ -33498,8 +38584,10 @@ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject static void __pyx_tp_dealloc_memoryview(PyObject *o) { struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -33514,7 +38602,14 @@ static void __pyx_tp_dealloc_memoryview(PyObject *o) { Py_CLEAR(p->obj); Py_CLEAR(p->_size); Py_CLEAR(p->_array_interface); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { @@ -33563,8 +38658,11 @@ static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject return __pyx_memoryview___setitem__(o, i, v); } else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); return -1; } } @@ -33605,13 +38703,18 @@ static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); } +static PyObject *__pyx_specialmethod___pyx_memoryview___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_memoryview___repr__(self); +} + static PyMethodDef __pyx_methods_memoryview[] = { - {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0}, - {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0}, - {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0}, - {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0}, + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_memoryview___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"is_c_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -33627,6 +38730,53 @@ static struct PyGetSetDef __pyx_getsets_memoryview[] = { {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "newanalysis.gfunction.memoryview", + sizeof(struct __pyx_memoryview_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_memoryview_slots, +}; +#else static PySequenceMethods __pyx_tp_as_sequence_memoryview = { __pyx_memoryview___len__, /*sq_length*/ @@ -33666,7 +38816,7 @@ static PyBufferProcs __pyx_tp_as_buffer_memoryview = { static PyTypeObject __pyx_type___pyx_memoryview = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.gfunction.memoryview", /*tp_name*/ + "newanalysis.gfunction.""memoryview", /*tp_name*/ sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ @@ -33709,7 +38859,9 @@ static PyTypeObject __pyx_type___pyx_memoryview = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_memoryview, /*tp_new*/ @@ -33723,18 +38875,26 @@ static PyTypeObject __pyx_type___pyx_memoryview = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { @@ -33743,6 +38903,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO if (unlikely(!o)) return 0; p = ((struct __pyx_memoryviewslice_obj *)o); p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + new((void*)&(p->from_slice)) __Pyx_memviewslice(); p->from_object = Py_None; Py_INCREF(Py_None); p->from_slice.memview = NULL; return o; @@ -33751,8 +38912,10 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -33764,6 +38927,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } + __Pyx_call_destructor(p->from_slice); Py_CLEAR(p->from_object); PyObject_GC_Track(o); __pyx_tp_dealloc_memoryview(o); @@ -33786,28 +38950,37 @@ static int __pyx_tp_clear__memoryviewslice(PyObject *o) { tmp = ((PyObject*)p->from_object); p->from_object = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - __PYX_XDEC_MEMVIEW(&p->from_slice, 1); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); return 0; } -static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o); -} - static PyMethodDef __pyx_methods__memoryviewslice[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; - -static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = { - {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, }; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "newanalysis.gfunction._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else static PyTypeObject __pyx_type___pyx_memoryviewslice = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.gfunction._memoryviewslice", /*tp_name*/ + "newanalysis.gfunction.""_memoryviewslice", /*tp_name*/ sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ @@ -33825,7 +38998,7 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif - #if CYTHON_COMPILING_IN_PYPY + #if CYTHON_COMPILING_IN_PYPY || 0 __pyx_memoryview___repr__, /*tp_repr*/ #else 0, /*tp_repr*/ @@ -33835,7 +39008,7 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY + #if CYTHON_COMPILING_IN_PYPY || 0 __pyx_memoryview___str__, /*tp_str*/ #else 0, /*tp_str*/ @@ -33843,8 +39016,8 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Internal class for passing memoryview slices to Python", /*tp_doc*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ __pyx_tp_clear__memoryviewslice, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -33853,12 +39026,14 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_iternext*/ __pyx_methods__memoryviewslice, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets__memoryviewslice, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new__memoryviewslice, /*tp_new*/ @@ -33872,54 +39047,30 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_gfunction(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_gfunction}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "gfunction", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE @@ -33929,1959 +39080,2461 @@ static struct PyModuleDef __pyx_moduledef = { #define CYTHON_SMALL_CODE #endif #endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 1}, - {&__pyx_kp_s_000, __pyx_k_000, sizeof(__pyx_k_000), 0, 0, 1, 0}, - {&__pyx_kp_s_011, __pyx_k_011, sizeof(__pyx_k_011), 0, 0, 1, 0}, - {&__pyx_kp_s_022, __pyx_k_022, sizeof(__pyx_k_022), 0, 0, 1, 0}, - {&__pyx_kp_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 0}, - {&__pyx_kp_s_110, __pyx_k_110, sizeof(__pyx_k_110), 0, 0, 1, 0}, - {&__pyx_kp_s_202, __pyx_k_202, sizeof(__pyx_k_202), 0, 0, 1, 0}, - {&__pyx_kp_s_220, __pyx_k_220, sizeof(__pyx_k_220), 0, 0, 1, 0}, - {&__pyx_kp_s_5_5f_5_5f, __pyx_k_5_5f_5_5f, sizeof(__pyx_k_5_5f_5_5f), 0, 0, 1, 0}, - {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, - {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, - {&__pyx_n_s_CUDA, __pyx_k_CUDA, sizeof(__pyx_k_CUDA), 0, 0, 1, 1}, - {&__pyx_n_s_CUDA___init, __pyx_k_CUDA___init, sizeof(__pyx_k_CUDA___init), 0, 0, 1, 1}, - {&__pyx_n_s_CUDA_calcHistoGPU, __pyx_k_CUDA_calcHistoGPU, sizeof(__pyx_k_CUDA_calcHistoGPU), 0, 0, 1, 1}, - {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0}, - {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, - {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, - {&__pyx_kp_s_Frames_read, __pyx_k_Frames_read, sizeof(__pyx_k_Frames_read), 0, 0, 1, 0}, - {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, - {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0}, - {&__pyx_n_s_MULTIPROCESSOR_COUNT, __pyx_k_MULTIPROCESSOR_COUNT, sizeof(__pyx_k_MULTIPROCESSOR_COUNT), 0, 0, 1, 1}, - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, - {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, - {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, - {&__pyx_kp_s_Modes, __pyx_k_Modes, sizeof(__pyx_k_Modes), 0, 0, 1, 0}, - {&__pyx_kp_s_No_dipole_moment_array_for_the_f, __pyx_k_No_dipole_moment_array_for_the_f, sizeof(__pyx_k_No_dipole_moment_array_for_the_f), 0, 0, 1, 0}, - {&__pyx_kp_s_No_dipole_moment_array_for_the_f_2, __pyx_k_No_dipole_moment_array_for_the_f_2, sizeof(__pyx_k_No_dipole_moment_array_for_the_f_2), 0, 0, 1, 0}, - {&__pyx_kp_s_No_dipole_moment_array_for_the_s, __pyx_k_No_dipole_moment_array_for_the_s, sizeof(__pyx_k_No_dipole_moment_array_for_the_s), 0, 0, 1, 0}, - {&__pyx_kp_s_No_suitable_CUDA_device_was_foun, __pyx_k_No_suitable_CUDA_device_was_foun, sizeof(__pyx_k_No_suitable_CUDA_device_was_foun), 0, 0, 1, 0}, - {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, - {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, - {&__pyx_n_s_PI, __pyx_k_PI, sizeof(__pyx_k_PI), 0, 0, 1, 1}, - {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_RDF, __pyx_k_RDF, sizeof(__pyx_k_RDF), 0, 0, 1, 1}, - {&__pyx_n_s_RDF___init, __pyx_k_RDF___init, sizeof(__pyx_k_RDF___init), 0, 0, 1, 1}, - {&__pyx_n_s_RDF__addHisto, __pyx_k_RDF__addHisto, sizeof(__pyx_k_RDF__addHisto), 0, 0, 1, 1}, - {&__pyx_n_s_RDF__normHisto, __pyx_k_RDF__normHisto, sizeof(__pyx_k_RDF__normHisto), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_calcFrame, __pyx_k_RDF_calcFrame, sizeof(__pyx_k_RDF_calcFrame), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_printInfo, __pyx_k_RDF_printInfo, sizeof(__pyx_k_RDF_printInfo), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_resetArrays, __pyx_k_RDF_resetArrays, sizeof(__pyx_k_RDF_resetArrays), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_scale, __pyx_k_RDF_scale, sizeof(__pyx_k_RDF_scale), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_update_box, __pyx_k_RDF_update_box, sizeof(__pyx_k_RDF_update_box), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_voronoi, __pyx_k_RDF_voronoi, sizeof(__pyx_k_RDF_voronoi), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_voronoi___init, __pyx_k_RDF_voronoi___init, sizeof(__pyx_k_RDF_voronoi___init), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_voronoi__addHisto, __pyx_k_RDF_voronoi__addHisto, sizeof(__pyx_k_RDF_voronoi__addHisto), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_voronoi__normHisto, __pyx_k_RDF_voronoi__normHisto, sizeof(__pyx_k_RDF_voronoi__normHisto), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_voronoi_calcFrame, __pyx_k_RDF_voronoi_calcFrame, sizeof(__pyx_k_RDF_voronoi_calcFrame), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_voronoi_printInfo, __pyx_k_RDF_voronoi_printInfo, sizeof(__pyx_k_RDF_voronoi_printInfo), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_voronoi_resetArrays, __pyx_k_RDF_voronoi_resetArrays, sizeof(__pyx_k_RDF_voronoi_resetArrays), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_voronoi_scale, __pyx_k_RDF_voronoi_scale, sizeof(__pyx_k_RDF_voronoi_scale), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_voronoi_update_box, __pyx_k_RDF_voronoi_update_box, sizeof(__pyx_k_RDF_voronoi_update_box), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_voronoi_write, __pyx_k_RDF_voronoi_write, sizeof(__pyx_k_RDF_voronoi_write), 0, 0, 1, 1}, - {&__pyx_n_s_RDF_write, __pyx_k_RDF_write, sizeof(__pyx_k_RDF_write), 0, 0, 1, 1}, - {&__pyx_n_s_SourceModule, __pyx_k_SourceModule, sizeof(__pyx_k_SourceModule), 0, 0, 1, 1}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, - {&__pyx_n_s_addHisto, __pyx_k_addHisto, sizeof(__pyx_k_addHisto), 0, 0, 1, 1}, - {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, - {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, - {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, - {&__pyx_n_s_arr_sel1, __pyx_k_arr_sel1, sizeof(__pyx_k_arr_sel1), 0, 0, 1, 1}, - {&__pyx_n_s_arr_sel2, __pyx_k_arr_sel2, sizeof(__pyx_k_arr_sel2), 0, 0, 1, 1}, - {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, - {&__pyx_n_s_autoinit, __pyx_k_autoinit, sizeof(__pyx_k_autoinit), 0, 0, 1, 1}, - {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, - {&__pyx_n_s_block, __pyx_k_block, sizeof(__pyx_k_block), 0, 0, 1, 1}, - {&__pyx_n_s_block_x, __pyx_k_block_x, sizeof(__pyx_k_block_x), 0, 0, 1, 1}, - {&__pyx_n_s_block_y, __pyx_k_block_y, sizeof(__pyx_k_block_y), 0, 0, 1, 1}, - {&__pyx_n_s_block_z, __pyx_k_block_z, sizeof(__pyx_k_block_z), 0, 0, 1, 1}, - {&__pyx_n_s_box_dim, __pyx_k_box_dim, sizeof(__pyx_k_box_dim), 0, 0, 1, 1}, - {&__pyx_n_s_box_dim_gpu, __pyx_k_box_dim_gpu, sizeof(__pyx_k_box_dim_gpu), 0, 0, 1, 1}, - {&__pyx_n_s_box_x, __pyx_k_box_x, sizeof(__pyx_k_box_x), 0, 0, 1, 1}, - {&__pyx_n_s_box_y, __pyx_k_box_y, sizeof(__pyx_k_box_y), 0, 0, 1, 1}, - {&__pyx_n_s_box_z, __pyx_k_box_z, sizeof(__pyx_k_box_z), 0, 0, 1, 1}, - {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, - {&__pyx_n_s_boxl2, __pyx_k_boxl2, sizeof(__pyx_k_boxl2), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, - {&__pyx_n_s_calcFrame, __pyx_k_calcFrame, sizeof(__pyx_k_calcFrame), 0, 0, 1, 1}, - {&__pyx_n_s_calcHistoGPU, __pyx_k_calcHistoGPU, sizeof(__pyx_k_calcHistoGPU), 0, 0, 1, 1}, - {&__pyx_n_s_calcHistoGPU_2, __pyx_k_calcHistoGPU_2, sizeof(__pyx_k_calcHistoGPU_2), 0, 0, 1, 1}, - {&__pyx_n_s_calcHistoTS, __pyx_k_calcHistoTS, sizeof(__pyx_k_calcHistoTS), 0, 0, 1, 1}, - {&__pyx_n_s_calcHistoTSVoro, __pyx_k_calcHistoTSVoro, sizeof(__pyx_k_calcHistoTSVoro), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_kp_s_class_RDF_A_container_object_fo, __pyx_k_class_RDF_A_container_object_fo, sizeof(__pyx_k_class_RDF_A_container_object_fo), 0, 0, 1, 0}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_compute_capability, __pyx_k_compute_capability, sizeof(__pyx_k_compute_capability), 0, 0, 1, 1}, - {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, - {&__pyx_n_s_coor_sel1, __pyx_k_coor_sel1, sizeof(__pyx_k_coor_sel1), 0, 0, 1, 1}, - {&__pyx_n_s_coor_sel1_gpu, __pyx_k_coor_sel1_gpu, sizeof(__pyx_k_coor_sel1_gpu), 0, 0, 1, 1}, - {&__pyx_n_s_coor_sel2, __pyx_k_coor_sel2, sizeof(__pyx_k_coor_sel2), 0, 0, 1, 1}, - {&__pyx_n_s_coor_sel2_gpu, __pyx_k_coor_sel2_gpu, sizeof(__pyx_k_coor_sel2_gpu), 0, 0, 1, 1}, - {&__pyx_n_s_core_xyz, __pyx_k_core_xyz, sizeof(__pyx_k_core_xyz), 0, 0, 1, 1}, - {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, - {&__pyx_n_s_cu, __pyx_k_cu, sizeof(__pyx_k_cu), 0, 0, 1, 1}, - {&__pyx_n_s_cuda, __pyx_k_cuda, sizeof(__pyx_k_cuda), 0, 0, 1, 1}, - {&__pyx_n_s_delaunay_matrix, __pyx_k_delaunay_matrix, sizeof(__pyx_k_delaunay_matrix), 0, 0, 1, 1}, - {&__pyx_n_s_dev, __pyx_k_dev, sizeof(__pyx_k_dev), 0, 0, 1, 1}, - {&__pyx_n_s_device, __pyx_k_device, sizeof(__pyx_k_device), 0, 0, 1, 1}, - {&__pyx_kp_s_device___double_atomicAdd_dou, __pyx_k_device___double_atomicAdd_dou, sizeof(__pyx_k_device___double_atomicAdd_dou), 0, 0, 1, 0}, - {&__pyx_n_s_device_attribute, __pyx_k_device_attribute, sizeof(__pyx_k_device_attribute), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_n_s_dip_sel1, __pyx_k_dip_sel1, sizeof(__pyx_k_dip_sel1), 0, 0, 1, 1}, - {&__pyx_n_s_dip_sel1_gpu, __pyx_k_dip_sel1_gpu, sizeof(__pyx_k_dip_sel1_gpu), 0, 0, 1, 1}, - {&__pyx_n_s_dip_sel2, __pyx_k_dip_sel2, sizeof(__pyx_k_dip_sel2), 0, 0, 1, 1}, - {&__pyx_n_s_dip_sel2_gpu, __pyx_k_dip_sel2_gpu, sizeof(__pyx_k_dip_sel2_gpu), 0, 0, 1, 1}, - {&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1}, - {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, - {&__pyx_n_s_drv, __pyx_k_drv, sizeof(__pyx_k_drv), 0, 0, 1, 1}, - {&__pyx_n_s_ds, __pyx_k_ds, sizeof(__pyx_k_ds), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, - {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1}, - {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1}, - {&__pyx_n_s_dz, __pyx_k_dz, sizeof(__pyx_k_dz), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, - {&__pyx_n_s_exclude_self_mol, __pyx_k_exclude_self_mol, sizeof(__pyx_k_exclude_self_mol), 0, 0, 1, 1}, - {&__pyx_n_s_f000, __pyx_k_f000, sizeof(__pyx_k_f000), 0, 0, 1, 1}, - {&__pyx_n_s_f011, __pyx_k_f011, sizeof(__pyx_k_f011), 0, 0, 1, 1}, - {&__pyx_n_s_f022, __pyx_k_f022, sizeof(__pyx_k_f022), 0, 0, 1, 1}, - {&__pyx_n_s_f101, __pyx_k_f101, sizeof(__pyx_k_f101), 0, 0, 1, 1}, - {&__pyx_n_s_f110, __pyx_k_f110, sizeof(__pyx_k_f110), 0, 0, 1, 1}, - {&__pyx_n_s_f202, __pyx_k_f202, sizeof(__pyx_k_f202), 0, 0, 1, 1}, - {&__pyx_n_s_f220, __pyx_k_f220, sizeof(__pyx_k_f220), 0, 0, 1, 1}, - {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1}, - {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1}, - {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, - {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1}, - {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, - {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, - {&__pyx_kp_s_g000_dat, __pyx_k_g000_dat, sizeof(__pyx_k_g000_dat), 0, 0, 1, 0}, - {&__pyx_kp_s_g011_dat, __pyx_k_g011_dat, sizeof(__pyx_k_g011_dat), 0, 0, 1, 0}, - {&__pyx_kp_s_g022_dat, __pyx_k_g022_dat, sizeof(__pyx_k_g022_dat), 0, 0, 1, 0}, - {&__pyx_kp_s_g101_dat, __pyx_k_g101_dat, sizeof(__pyx_k_g101_dat), 0, 0, 1, 0}, - {&__pyx_kp_s_g110_dat, __pyx_k_g110_dat, sizeof(__pyx_k_g110_dat), 0, 0, 1, 0}, - {&__pyx_kp_s_g202_dat, __pyx_k_g202_dat, sizeof(__pyx_k_g202_dat), 0, 0, 1, 0}, - {&__pyx_kp_s_g220_dat, __pyx_k_g220_dat, sizeof(__pyx_k_g220_dat), 0, 0, 1, 0}, - {&__pyx_n_s_get_attribute, __pyx_k_get_attribute, sizeof(__pyx_k_get_attribute), 0, 0, 1, 1}, - {&__pyx_n_s_get_function, __pyx_k_get_function, sizeof(__pyx_k_get_function), 0, 0, 1, 1}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0}, - {&__pyx_n_s_grid, __pyx_k_grid, sizeof(__pyx_k_grid), 0, 0, 1, 1}, - {&__pyx_n_s_grid_x, __pyx_k_grid_x, sizeof(__pyx_k_grid_x), 0, 0, 1, 1}, - {&__pyx_n_s_grid_y, __pyx_k_grid_y, sizeof(__pyx_k_grid_y), 0, 0, 1, 1}, - {&__pyx_n_s_histo, __pyx_k_histo, sizeof(__pyx_k_histo), 0, 0, 1, 1}, - {&__pyx_n_s_histo_dr, __pyx_k_histo_dr, sizeof(__pyx_k_histo_dr), 0, 0, 1, 1}, - {&__pyx_n_s_histo_gpu, __pyx_k_histo_gpu, sizeof(__pyx_k_histo_gpu), 0, 0, 1, 1}, - {&__pyx_n_s_histo_inv_dr, __pyx_k_histo_inv_dr, sizeof(__pyx_k_histo_inv_dr), 0, 0, 1, 1}, - {&__pyx_n_s_histo_max, __pyx_k_histo_max, sizeof(__pyx_k_histo_max), 0, 0, 1, 1}, - {&__pyx_n_s_histo_min, __pyx_k_histo_min, sizeof(__pyx_k_histo_min), 0, 0, 1, 1}, - {&__pyx_n_s_histo_n, __pyx_k_histo_n, sizeof(__pyx_k_histo_n), 0, 0, 1, 1}, - {&__pyx_n_s_histo_out, __pyx_k_histo_out, sizeof(__pyx_k_histo_out), 0, 0, 1, 1}, - {&__pyx_n_s_histogram, __pyx_k_histogram, sizeof(__pyx_k_histogram), 0, 0, 1, 1}, - {&__pyx_n_s_histogram_out, __pyx_k_histogram_out, sizeof(__pyx_k_histogram_out), 0, 0, 1, 1}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, - {&__pyx_n_s_invdx, __pyx_k_invdx, sizeof(__pyx_k_invdx), 0, 0, 1, 1}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, - {&__pyx_n_s_ix, __pyx_k_ix, sizeof(__pyx_k_ix), 0, 0, 1, 1}, - {&__pyx_n_s_ix2, __pyx_k_ix2, sizeof(__pyx_k_ix2), 0, 0, 1, 1}, - {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, - {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_maxshell, __pyx_k_maxshell, sizeof(__pyx_k_maxshell), 0, 0, 1, 1}, - {&__pyx_n_s_mem_alloc, __pyx_k_mem_alloc, sizeof(__pyx_k_mem_alloc), 0, 0, 1, 1}, - {&__pyx_n_s_memcpy_dtoh, __pyx_k_memcpy_dtoh, sizeof(__pyx_k_memcpy_dtoh), 0, 0, 1, 1}, - {&__pyx_n_s_memcpy_htod, __pyx_k_memcpy_htod, sizeof(__pyx_k_memcpy_htod), 0, 0, 1, 1}, - {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, - {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, - {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, - {&__pyx_n_s_mode_sel, __pyx_k_mode_sel, sizeof(__pyx_k_mode_sel), 0, 0, 1, 1}, - {&__pyx_n_s_modes, __pyx_k_modes, sizeof(__pyx_k_modes), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_n1, __pyx_k_n1, sizeof(__pyx_k_n1), 0, 0, 1, 1}, - {&__pyx_n_s_n2, __pyx_k_n2, sizeof(__pyx_k_n2), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_nbytes, __pyx_k_nbytes, sizeof(__pyx_k_nbytes), 0, 0, 1, 1}, - {&__pyx_n_s_ncore, __pyx_k_ncore, sizeof(__pyx_k_ncore), 0, 0, 1, 1}, - {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, - {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, - {&__pyx_n_s_newanalysis_gfunction, __pyx_k_newanalysis_gfunction, sizeof(__pyx_k_newanalysis_gfunction), 0, 0, 1, 1}, - {&__pyx_n_s_nmol1, __pyx_k_nmol1, sizeof(__pyx_k_nmol1), 0, 0, 1, 1}, - {&__pyx_n_s_nmol2, __pyx_k_nmol2, sizeof(__pyx_k_nmol2), 0, 0, 1, 1}, - {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, - {&__pyx_n_s_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 0, 0, 1, 1}, - {&__pyx_n_s_normHisto, __pyx_k_normHisto, sizeof(__pyx_k_normHisto), 0, 0, 1, 1}, - {&__pyx_n_s_norm_volume, __pyx_k_norm_volume, sizeof(__pyx_k_norm_volume), 0, 0, 1, 1}, - {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, - {&__pyx_n_s_nshells, __pyx_k_nshells, sizeof(__pyx_k_nshells), 0, 0, 1, 1}, - {&__pyx_n_s_nsurr, __pyx_k_nsurr, sizeof(__pyx_k_nsurr), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, - {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, - {&__pyx_n_s_oneistwo, __pyx_k_oneistwo, sizeof(__pyx_k_oneistwo), 0, 0, 1, 1}, - {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, - {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, - {&__pyx_n_s_pre_coor_sel1_gpu, __pyx_k_pre_coor_sel1_gpu, sizeof(__pyx_k_pre_coor_sel1_gpu), 0, 0, 1, 1}, - {&__pyx_n_s_pre_coor_sel2_gpu, __pyx_k_pre_coor_sel2_gpu, sizeof(__pyx_k_pre_coor_sel2_gpu), 0, 0, 1, 1}, - {&__pyx_n_s_pre_dip_sel1_gpu, __pyx_k_pre_dip_sel1_gpu, sizeof(__pyx_k_pre_dip_sel1_gpu), 0, 0, 1, 1}, - {&__pyx_n_s_pre_dip_sel2_gpu, __pyx_k_pre_dip_sel2_gpu, sizeof(__pyx_k_pre_dip_sel2_gpu), 0, 0, 1, 1}, - {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, - {&__pyx_n_s_printInfo, __pyx_k_printInfo, sizeof(__pyx_k_printInfo), 0, 0, 1, 1}, - {&__pyx_n_s_pycuda, __pyx_k_pycuda, sizeof(__pyx_k_pycuda), 0, 0, 1, 1}, - {&__pyx_n_s_pycuda_autoinit, __pyx_k_pycuda_autoinit, sizeof(__pyx_k_pycuda_autoinit), 0, 0, 1, 1}, - {&__pyx_n_s_pycuda_compiler, __pyx_k_pycuda_compiler, sizeof(__pyx_k_pycuda_compiler), 0, 0, 1, 1}, - {&__pyx_n_s_pycuda_driver, __pyx_k_pycuda_driver, sizeof(__pyx_k_pycuda_driver), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, - {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1}, - {&__pyx_n_s_r_out, __pyx_k_r_out, sizeof(__pyx_k_r_out), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_rdf, __pyx_k_rdf, sizeof(__pyx_k_rdf), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_resetArrays, __pyx_k_resetArrays, sizeof(__pyx_k_resetArrays), 0, 0, 1, 1}, - {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, - {&__pyx_n_s_rho, __pyx_k_rho, sizeof(__pyx_k_rho), 0, 0, 1, 1}, - {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1}, - {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1}, - {&__pyx_n_s_sel1_n, __pyx_k_sel1_n, sizeof(__pyx_k_sel1_n), 0, 0, 1, 1}, - {&__pyx_n_s_sel1_nmol, __pyx_k_sel1_nmol, sizeof(__pyx_k_sel1_nmol), 0, 0, 1, 1}, - {&__pyx_n_s_sel2_n, __pyx_k_sel2_n, sizeof(__pyx_k_sel2_n), 0, 0, 1, 1}, - {&__pyx_n_s_sel2_nmol, __pyx_k_sel2_nmol, sizeof(__pyx_k_sel2_nmol), 0, 0, 1, 1}, - {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, - {&__pyx_n_s_shell, __pyx_k_shell, sizeof(__pyx_k_shell), 0, 0, 1, 1}, - {&__pyx_n_s_shell_2, __pyx_k_shell_2, sizeof(__pyx_k_shell_2), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_slice_vol, __pyx_k_slice_vol, sizeof(__pyx_k_slice_vol), 0, 0, 1, 1}, - {&__pyx_n_s_source, __pyx_k_source, sizeof(__pyx_k_source), 0, 0, 1, 1}, - {&__pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_k_src_gfunction_gfunction_pyx, sizeof(__pyx_k_src_gfunction_gfunction_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_n_s_surr_xyz, __pyx_k_surr_xyz, sizeof(__pyx_k_surr_xyz), 0, 0, 1, 1}, - {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, - {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, - {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {&__pyx_n_s_update_box, __pyx_k_update_box, sizeof(__pyx_k_update_box), 0, 0, 1, 1}, - {&__pyx_n_s_use_cuda, __pyx_k_use_cuda, sizeof(__pyx_k_use_cuda), 0, 0, 1, 1}, - {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1}, - {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, - {&__pyx_n_s_volume, __pyx_k_volume, sizeof(__pyx_k_volume), 0, 0, 1, 1}, - {&__pyx_n_s_volume_list, __pyx_k_volume_list, sizeof(__pyx_k_volume_list), 0, 0, 1, 1}, - {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, - {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1}, - {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_kp_s_000, __pyx_k_000, sizeof(__pyx_k_000), 0, 0, 1, 0}, + {&__pyx_kp_s_011, __pyx_k_011, sizeof(__pyx_k_011), 0, 0, 1, 0}, + {&__pyx_kp_s_022, __pyx_k_022, sizeof(__pyx_k_022), 0, 0, 1, 0}, + {&__pyx_kp_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 0}, + {&__pyx_kp_s_110, __pyx_k_110, sizeof(__pyx_k_110), 0, 0, 1, 0}, + {&__pyx_kp_s_202, __pyx_k_202, sizeof(__pyx_k_202), 0, 0, 1, 0}, + {&__pyx_kp_s_220, __pyx_k_220, sizeof(__pyx_k_220), 0, 0, 1, 0}, + {&__pyx_kp_s_5_5f_5_5f, __pyx_k_5_5f_5_5f, sizeof(__pyx_k_5_5f_5_5f), 0, 0, 1, 0}, + {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, + {&__pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_k_All_dimensions_preceding_dimensi, sizeof(__pyx_k_All_dimensions_preceding_dimensi), 0, 0, 1, 0}, + {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, + {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, + {&__pyx_n_s_CUDA, __pyx_k_CUDA, sizeof(__pyx_k_CUDA), 0, 0, 1, 1}, + {&__pyx_n_s_CUDA___init, __pyx_k_CUDA___init, sizeof(__pyx_k_CUDA___init), 0, 0, 1, 1}, + {&__pyx_n_s_CUDA_calcHistoGPU, __pyx_k_CUDA_calcHistoGPU, sizeof(__pyx_k_CUDA_calcHistoGPU), 0, 0, 1, 1}, + {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, + {&__pyx_kp_u_Cannot_index_with_type, __pyx_k_Cannot_index_with_type, sizeof(__pyx_k_Cannot_index_with_type), 0, 1, 0, 0}, + {&__pyx_kp_s_Cannot_transpose_memoryview_with, __pyx_k_Cannot_transpose_memoryview_with, sizeof(__pyx_k_Cannot_transpose_memoryview_with), 0, 0, 1, 0}, + {&__pyx_kp_s_Dimension_d_is_not_direct, __pyx_k_Dimension_d_is_not_direct, sizeof(__pyx_k_Dimension_d_is_not_direct), 0, 0, 1, 0}, + {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, + {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, + {&__pyx_kp_s_Frames_read, __pyx_k_Frames_read, sizeof(__pyx_k_Frames_read), 0, 0, 1, 0}, + {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_k_Index_out_of_bounds_axis_d, sizeof(__pyx_k_Index_out_of_bounds_axis_d), 0, 0, 1, 0}, + {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, + {&__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 1, 0, 0}, + {&__pyx_kp_u_Invalid_shape_in_axis, __pyx_k_Invalid_shape_in_axis, sizeof(__pyx_k_Invalid_shape_in_axis), 0, 1, 0, 0}, + {&__pyx_n_s_MULTIPROCESSOR_COUNT, __pyx_k_MULTIPROCESSOR_COUNT, sizeof(__pyx_k_MULTIPROCESSOR_COUNT), 0, 0, 1, 1}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, + {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, + {&__pyx_kp_s_Modes, __pyx_k_Modes, sizeof(__pyx_k_Modes), 0, 0, 1, 0}, + {&__pyx_kp_s_No_dipole_moment_array_for_the_f, __pyx_k_No_dipole_moment_array_for_the_f, sizeof(__pyx_k_No_dipole_moment_array_for_the_f), 0, 0, 1, 0}, + {&__pyx_kp_s_No_dipole_moment_array_for_the_f_2, __pyx_k_No_dipole_moment_array_for_the_f_2, sizeof(__pyx_k_No_dipole_moment_array_for_the_f_2), 0, 0, 1, 0}, + {&__pyx_kp_s_No_dipole_moment_array_for_the_s, __pyx_k_No_dipole_moment_array_for_the_s, sizeof(__pyx_k_No_dipole_moment_array_for_the_s), 0, 0, 1, 0}, + {&__pyx_kp_s_No_suitable_CUDA_device_was_foun, __pyx_k_No_suitable_CUDA_device_was_foun, sizeof(__pyx_k_No_suitable_CUDA_device_was_foun), 0, 0, 1, 0}, + {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, + {&__pyx_kp_u_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 1, 0, 0}, + {&__pyx_n_s_PI, __pyx_k_PI, sizeof(__pyx_k_PI), 0, 0, 1, 1}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_RDF, __pyx_k_RDF, sizeof(__pyx_k_RDF), 0, 0, 1, 1}, + {&__pyx_n_s_RDF___init, __pyx_k_RDF___init, sizeof(__pyx_k_RDF___init), 0, 0, 1, 1}, + {&__pyx_n_s_RDF__addHisto, __pyx_k_RDF__addHisto, sizeof(__pyx_k_RDF__addHisto), 0, 0, 1, 1}, + {&__pyx_n_s_RDF__normHisto, __pyx_k_RDF__normHisto, sizeof(__pyx_k_RDF__normHisto), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_calcFrame, __pyx_k_RDF_calcFrame, sizeof(__pyx_k_RDF_calcFrame), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_printInfo, __pyx_k_RDF_printInfo, sizeof(__pyx_k_RDF_printInfo), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_resetArrays, __pyx_k_RDF_resetArrays, sizeof(__pyx_k_RDF_resetArrays), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_scale, __pyx_k_RDF_scale, sizeof(__pyx_k_RDF_scale), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_update_box, __pyx_k_RDF_update_box, sizeof(__pyx_k_RDF_update_box), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_voronoi, __pyx_k_RDF_voronoi, sizeof(__pyx_k_RDF_voronoi), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_voronoi___init, __pyx_k_RDF_voronoi___init, sizeof(__pyx_k_RDF_voronoi___init), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_voronoi__addHisto, __pyx_k_RDF_voronoi__addHisto, sizeof(__pyx_k_RDF_voronoi__addHisto), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_voronoi__normHisto, __pyx_k_RDF_voronoi__normHisto, sizeof(__pyx_k_RDF_voronoi__normHisto), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_voronoi_calcFrame, __pyx_k_RDF_voronoi_calcFrame, sizeof(__pyx_k_RDF_voronoi_calcFrame), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_voronoi_printInfo, __pyx_k_RDF_voronoi_printInfo, sizeof(__pyx_k_RDF_voronoi_printInfo), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_voronoi_resetArrays, __pyx_k_RDF_voronoi_resetArrays, sizeof(__pyx_k_RDF_voronoi_resetArrays), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_voronoi_scale, __pyx_k_RDF_voronoi_scale, sizeof(__pyx_k_RDF_voronoi_scale), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_voronoi_update_box, __pyx_k_RDF_voronoi_update_box, sizeof(__pyx_k_RDF_voronoi_update_box), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_voronoi_write, __pyx_k_RDF_voronoi_write, sizeof(__pyx_k_RDF_voronoi_write), 0, 0, 1, 1}, + {&__pyx_n_s_RDF_write, __pyx_k_RDF_write, sizeof(__pyx_k_RDF_write), 0, 0, 1, 1}, + {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1}, + {&__pyx_n_s_SourceModule, __pyx_k_SourceModule, sizeof(__pyx_k_SourceModule), 0, 0, 1, 1}, + {&__pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_k_Step_may_not_be_zero_axis_d, sizeof(__pyx_k_Step_may_not_be_zero_axis_d), 0, 0, 1, 0}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, + {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, + {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, + {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, + {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, + {&__pyx_n_s__79, __pyx_k__79, sizeof(__pyx_k__79), 0, 0, 1, 1}, + {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, + {&__pyx_n_s_addHisto, __pyx_k_addHisto, sizeof(__pyx_k_addHisto), 0, 0, 1, 1}, + {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, + {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, + {&__pyx_kp_u_and, __pyx_k_and, sizeof(__pyx_k_and), 0, 1, 0, 0}, + {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, + {&__pyx_n_s_arr_sel1, __pyx_k_arr_sel1, sizeof(__pyx_k_arr_sel1), 0, 0, 1, 1}, + {&__pyx_n_s_arr_sel2, __pyx_k_arr_sel2, sizeof(__pyx_k_arr_sel2), 0, 0, 1, 1}, + {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_autoinit, __pyx_k_autoinit, sizeof(__pyx_k_autoinit), 0, 0, 1, 1}, + {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, + {&__pyx_n_s_block, __pyx_k_block, sizeof(__pyx_k_block), 0, 0, 1, 1}, + {&__pyx_n_s_block_x, __pyx_k_block_x, sizeof(__pyx_k_block_x), 0, 0, 1, 1}, + {&__pyx_n_s_block_y, __pyx_k_block_y, sizeof(__pyx_k_block_y), 0, 0, 1, 1}, + {&__pyx_n_s_block_z, __pyx_k_block_z, sizeof(__pyx_k_block_z), 0, 0, 1, 1}, + {&__pyx_n_s_box_dim, __pyx_k_box_dim, sizeof(__pyx_k_box_dim), 0, 0, 1, 1}, + {&__pyx_n_s_box_dim_gpu, __pyx_k_box_dim_gpu, sizeof(__pyx_k_box_dim_gpu), 0, 0, 1, 1}, + {&__pyx_n_s_box_x, __pyx_k_box_x, sizeof(__pyx_k_box_x), 0, 0, 1, 1}, + {&__pyx_n_s_box_y, __pyx_k_box_y, sizeof(__pyx_k_box_y), 0, 0, 1, 1}, + {&__pyx_n_s_box_z, __pyx_k_box_z, sizeof(__pyx_k_box_z), 0, 0, 1, 1}, + {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, + {&__pyx_n_s_boxl2, __pyx_k_boxl2, sizeof(__pyx_k_boxl2), 0, 0, 1, 1}, + {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, + {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, + {&__pyx_n_s_calcFrame, __pyx_k_calcFrame, sizeof(__pyx_k_calcFrame), 0, 0, 1, 1}, + {&__pyx_n_s_calcHistoGPU, __pyx_k_calcHistoGPU, sizeof(__pyx_k_calcHistoGPU), 0, 0, 1, 1}, + {&__pyx_n_s_calcHistoGPU_2, __pyx_k_calcHistoGPU_2, sizeof(__pyx_k_calcHistoGPU_2), 0, 0, 1, 1}, + {&__pyx_n_s_calcHistoTS, __pyx_k_calcHistoTS, sizeof(__pyx_k_calcHistoTS), 0, 0, 1, 1}, + {&__pyx_n_s_calcHistoTSVoro, __pyx_k_calcHistoTSVoro, sizeof(__pyx_k_calcHistoTSVoro), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_kp_s_class_RDF_A_container_object_fo, __pyx_k_class_RDF_A_container_object_fo, sizeof(__pyx_k_class_RDF_A_container_object_fo), 0, 0, 1, 0}, + {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, + {&__pyx_kp_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 0}, + {&__pyx_n_s_compute_capability, __pyx_k_compute_capability, sizeof(__pyx_k_compute_capability), 0, 0, 1, 1}, + {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, + {&__pyx_n_s_coor_sel1, __pyx_k_coor_sel1, sizeof(__pyx_k_coor_sel1), 0, 0, 1, 1}, + {&__pyx_n_s_coor_sel1_gpu, __pyx_k_coor_sel1_gpu, sizeof(__pyx_k_coor_sel1_gpu), 0, 0, 1, 1}, + {&__pyx_n_s_coor_sel2, __pyx_k_coor_sel2, sizeof(__pyx_k_coor_sel2), 0, 0, 1, 1}, + {&__pyx_n_s_coor_sel2_gpu, __pyx_k_coor_sel2_gpu, sizeof(__pyx_k_coor_sel2_gpu), 0, 0, 1, 1}, + {&__pyx_n_s_core_xyz, __pyx_k_core_xyz, sizeof(__pyx_k_core_xyz), 0, 0, 1, 1}, + {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, + {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, + {&__pyx_n_s_cu, __pyx_k_cu, sizeof(__pyx_k_cu), 0, 0, 1, 1}, + {&__pyx_n_s_cuda, __pyx_k_cuda, sizeof(__pyx_k_cuda), 0, 0, 1, 1}, + {&__pyx_n_s_delaunay_matrix, __pyx_k_delaunay_matrix, sizeof(__pyx_k_delaunay_matrix), 0, 0, 1, 1}, + {&__pyx_n_s_dev, __pyx_k_dev, sizeof(__pyx_k_dev), 0, 0, 1, 1}, + {&__pyx_n_s_device, __pyx_k_device, sizeof(__pyx_k_device), 0, 0, 1, 1}, + {&__pyx_kp_s_device___double_atomicAdd_dou, __pyx_k_device___double_atomicAdd_dou, sizeof(__pyx_k_device___double_atomicAdd_dou), 0, 0, 1, 0}, + {&__pyx_n_s_device_attribute, __pyx_k_device_attribute, sizeof(__pyx_k_device_attribute), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_n_s_dip_sel1, __pyx_k_dip_sel1, sizeof(__pyx_k_dip_sel1), 0, 0, 1, 1}, + {&__pyx_n_s_dip_sel1_gpu, __pyx_k_dip_sel1_gpu, sizeof(__pyx_k_dip_sel1_gpu), 0, 0, 1, 1}, + {&__pyx_n_s_dip_sel2, __pyx_k_dip_sel2, sizeof(__pyx_k_dip_sel2), 0, 0, 1, 1}, + {&__pyx_n_s_dip_sel2_gpu, __pyx_k_dip_sel2_gpu, sizeof(__pyx_k_dip_sel2_gpu), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1}, + {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, + {&__pyx_n_s_driver, __pyx_k_driver, sizeof(__pyx_k_driver), 0, 0, 1, 1}, + {&__pyx_n_s_drv, __pyx_k_drv, sizeof(__pyx_k_drv), 0, 0, 1, 1}, + {&__pyx_n_s_ds, __pyx_k_ds, sizeof(__pyx_k_ds), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, + {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1}, + {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1}, + {&__pyx_n_s_dz, __pyx_k_dz, sizeof(__pyx_k_dz), 0, 0, 1, 1}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, + {&__pyx_n_s_exclude_self_mol, __pyx_k_exclude_self_mol, sizeof(__pyx_k_exclude_self_mol), 0, 0, 1, 1}, + {&__pyx_n_s_f000, __pyx_k_f000, sizeof(__pyx_k_f000), 0, 0, 1, 1}, + {&__pyx_n_s_f011, __pyx_k_f011, sizeof(__pyx_k_f011), 0, 0, 1, 1}, + {&__pyx_n_s_f022, __pyx_k_f022, sizeof(__pyx_k_f022), 0, 0, 1, 1}, + {&__pyx_n_s_f101, __pyx_k_f101, sizeof(__pyx_k_f101), 0, 0, 1, 1}, + {&__pyx_n_s_f110, __pyx_k_f110, sizeof(__pyx_k_f110), 0, 0, 1, 1}, + {&__pyx_n_s_f202, __pyx_k_f202, sizeof(__pyx_k_f202), 0, 0, 1, 1}, + {&__pyx_n_s_f220, __pyx_k_f220, sizeof(__pyx_k_f220), 0, 0, 1, 1}, + {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1}, + {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, + {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1}, + {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, + {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, + {&__pyx_kp_s_g000_dat, __pyx_k_g000_dat, sizeof(__pyx_k_g000_dat), 0, 0, 1, 0}, + {&__pyx_kp_s_g011_dat, __pyx_k_g011_dat, sizeof(__pyx_k_g011_dat), 0, 0, 1, 0}, + {&__pyx_kp_s_g022_dat, __pyx_k_g022_dat, sizeof(__pyx_k_g022_dat), 0, 0, 1, 0}, + {&__pyx_kp_s_g101_dat, __pyx_k_g101_dat, sizeof(__pyx_k_g101_dat), 0, 0, 1, 0}, + {&__pyx_kp_s_g110_dat, __pyx_k_g110_dat, sizeof(__pyx_k_g110_dat), 0, 0, 1, 0}, + {&__pyx_kp_s_g202_dat, __pyx_k_g202_dat, sizeof(__pyx_k_g202_dat), 0, 0, 1, 0}, + {&__pyx_kp_s_g220_dat, __pyx_k_g220_dat, sizeof(__pyx_k_g220_dat), 0, 0, 1, 0}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_get_attribute, __pyx_k_get_attribute, sizeof(__pyx_k_get_attribute), 0, 0, 1, 1}, + {&__pyx_n_s_get_function, __pyx_k_get_function, sizeof(__pyx_k_get_function), 0, 0, 1, 1}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0}, + {&__pyx_kp_u_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 1, 0, 0}, + {&__pyx_n_s_grid, __pyx_k_grid, sizeof(__pyx_k_grid), 0, 0, 1, 1}, + {&__pyx_n_s_grid_x, __pyx_k_grid_x, sizeof(__pyx_k_grid_x), 0, 0, 1, 1}, + {&__pyx_n_s_grid_y, __pyx_k_grid_y, sizeof(__pyx_k_grid_y), 0, 0, 1, 1}, + {&__pyx_n_s_histo, __pyx_k_histo, sizeof(__pyx_k_histo), 0, 0, 1, 1}, + {&__pyx_n_s_histo_dr, __pyx_k_histo_dr, sizeof(__pyx_k_histo_dr), 0, 0, 1, 1}, + {&__pyx_n_s_histo_gpu, __pyx_k_histo_gpu, sizeof(__pyx_k_histo_gpu), 0, 0, 1, 1}, + {&__pyx_n_s_histo_inv_dr, __pyx_k_histo_inv_dr, sizeof(__pyx_k_histo_inv_dr), 0, 0, 1, 1}, + {&__pyx_n_s_histo_max, __pyx_k_histo_max, sizeof(__pyx_k_histo_max), 0, 0, 1, 1}, + {&__pyx_n_s_histo_min, __pyx_k_histo_min, sizeof(__pyx_k_histo_min), 0, 0, 1, 1}, + {&__pyx_n_s_histo_n, __pyx_k_histo_n, sizeof(__pyx_k_histo_n), 0, 0, 1, 1}, + {&__pyx_n_s_histo_out, __pyx_k_histo_out, sizeof(__pyx_k_histo_out), 0, 0, 1, 1}, + {&__pyx_n_s_histogram, __pyx_k_histogram, sizeof(__pyx_k_histogram), 0, 0, 1, 1}, + {&__pyx_n_s_histogram_out, __pyx_k_histogram_out, sizeof(__pyx_k_histogram_out), 0, 0, 1, 1}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, + {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, + {&__pyx_n_s_init_subclass, __pyx_k_init_subclass, sizeof(__pyx_k_init_subclass), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, + {&__pyx_n_s_invdx, __pyx_k_invdx, sizeof(__pyx_k_invdx), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, + {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, + {&__pyx_n_s_ix, __pyx_k_ix, sizeof(__pyx_k_ix), 0, 0, 1, 1}, + {&__pyx_n_s_ix2, __pyx_k_ix2, sizeof(__pyx_k_ix2), 0, 0, 1, 1}, + {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, + {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_maxshell, __pyx_k_maxshell, sizeof(__pyx_k_maxshell), 0, 0, 1, 1}, + {&__pyx_n_s_mem_alloc, __pyx_k_mem_alloc, sizeof(__pyx_k_mem_alloc), 0, 0, 1, 1}, + {&__pyx_n_s_memcpy_dtoh, __pyx_k_memcpy_dtoh, sizeof(__pyx_k_memcpy_dtoh), 0, 0, 1, 1}, + {&__pyx_n_s_memcpy_htod, __pyx_k_memcpy_htod, sizeof(__pyx_k_memcpy_htod), 0, 0, 1, 1}, + {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, + {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, + {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_mode_sel, __pyx_k_mode_sel, sizeof(__pyx_k_mode_sel), 0, 0, 1, 1}, + {&__pyx_n_s_modes, __pyx_k_modes, sizeof(__pyx_k_modes), 0, 0, 1, 1}, + {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, + {&__pyx_n_s_mro_entries, __pyx_k_mro_entries, sizeof(__pyx_k_mro_entries), 0, 0, 1, 1}, + {&__pyx_n_s_n1, __pyx_k_n1, sizeof(__pyx_k_n1), 0, 0, 1, 1}, + {&__pyx_n_s_n2, __pyx_k_n2, sizeof(__pyx_k_n2), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_s_nbytes, __pyx_k_nbytes, sizeof(__pyx_k_nbytes), 0, 0, 1, 1}, + {&__pyx_n_s_ncore, __pyx_k_ncore, sizeof(__pyx_k_ncore), 0, 0, 1, 1}, + {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_n_s_newanalysis_gfunction, __pyx_k_newanalysis_gfunction, sizeof(__pyx_k_newanalysis_gfunction), 0, 0, 1, 1}, + {&__pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_k_newanalysis_gfunction_gfunction, sizeof(__pyx_k_newanalysis_gfunction_gfunction), 0, 0, 1, 0}, + {&__pyx_n_s_nmol1, __pyx_k_nmol1, sizeof(__pyx_k_nmol1), 0, 0, 1, 1}, + {&__pyx_n_s_nmol2, __pyx_k_nmol2, sizeof(__pyx_k_nmol2), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, + {&__pyx_n_s_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 0, 0, 1, 1}, + {&__pyx_n_s_normHisto, __pyx_k_normHisto, sizeof(__pyx_k_normHisto), 0, 0, 1, 1}, + {&__pyx_n_s_norm_volume, __pyx_k_norm_volume, sizeof(__pyx_k_norm_volume), 0, 0, 1, 1}, + {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_nshells, __pyx_k_nshells, sizeof(__pyx_k_nshells), 0, 0, 1, 1}, + {&__pyx_n_s_nsurr, __pyx_k_nsurr, sizeof(__pyx_k_nsurr), 0, 0, 1, 1}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, + {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, + {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, + {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, + {&__pyx_n_s_oneistwo, __pyx_k_oneistwo, sizeof(__pyx_k_oneistwo), 0, 0, 1, 1}, + {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, + {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, + {&__pyx_n_s_pre_coor_sel1_gpu, __pyx_k_pre_coor_sel1_gpu, sizeof(__pyx_k_pre_coor_sel1_gpu), 0, 0, 1, 1}, + {&__pyx_n_s_pre_coor_sel2_gpu, __pyx_k_pre_coor_sel2_gpu, sizeof(__pyx_k_pre_coor_sel2_gpu), 0, 0, 1, 1}, + {&__pyx_n_s_pre_dip_sel1_gpu, __pyx_k_pre_dip_sel1_gpu, sizeof(__pyx_k_pre_dip_sel1_gpu), 0, 0, 1, 1}, + {&__pyx_n_s_pre_dip_sel2_gpu, __pyx_k_pre_dip_sel2_gpu, sizeof(__pyx_k_pre_dip_sel2_gpu), 0, 0, 1, 1}, + {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, + {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, + {&__pyx_n_s_printInfo, __pyx_k_printInfo, sizeof(__pyx_k_printInfo), 0, 0, 1, 1}, + {&__pyx_n_s_pycuda, __pyx_k_pycuda, sizeof(__pyx_k_pycuda), 0, 0, 1, 1}, + {&__pyx_n_s_pycuda_autoinit, __pyx_k_pycuda_autoinit, sizeof(__pyx_k_pycuda_autoinit), 0, 0, 1, 1}, + {&__pyx_n_s_pycuda_compiler, __pyx_k_pycuda_compiler, sizeof(__pyx_k_pycuda_compiler), 0, 0, 1, 1}, + {&__pyx_n_s_pycuda_driver, __pyx_k_pycuda_driver, sizeof(__pyx_k_pycuda_driver), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, + {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1}, + {&__pyx_n_s_r_out, __pyx_k_r_out, sizeof(__pyx_k_r_out), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_rdf, __pyx_k_rdf, sizeof(__pyx_k_rdf), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1}, + {&__pyx_n_s_resetArrays, __pyx_k_resetArrays, sizeof(__pyx_k_resetArrays), 0, 0, 1, 1}, + {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, + {&__pyx_n_s_rho, __pyx_k_rho, sizeof(__pyx_k_rho), 0, 0, 1, 1}, + {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1}, + {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1}, + {&__pyx_n_s_sel1_n, __pyx_k_sel1_n, sizeof(__pyx_k_sel1_n), 0, 0, 1, 1}, + {&__pyx_n_s_sel1_nmol, __pyx_k_sel1_nmol, sizeof(__pyx_k_sel1_nmol), 0, 0, 1, 1}, + {&__pyx_n_s_sel2_n, __pyx_k_sel2_n, sizeof(__pyx_k_sel2_n), 0, 0, 1, 1}, + {&__pyx_n_s_sel2_nmol, __pyx_k_sel2_nmol, sizeof(__pyx_k_sel2_nmol), 0, 0, 1, 1}, + {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_n_s_set_name, __pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_shell, __pyx_k_shell, sizeof(__pyx_k_shell), 0, 0, 1, 1}, + {&__pyx_n_s_shell_2, __pyx_k_shell_2, sizeof(__pyx_k_shell_2), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_slice_vol, __pyx_k_slice_vol, sizeof(__pyx_k_slice_vol), 0, 0, 1, 1}, + {&__pyx_n_s_source, __pyx_k_source, sizeof(__pyx_k_source), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, + {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, + {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, + {&__pyx_n_s_surr_xyz, __pyx_k_surr_xyz, sizeof(__pyx_k_surr_xyz), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, + {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, + {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_update_box, __pyx_k_update_box, sizeof(__pyx_k_update_box), 0, 0, 1, 1}, + {&__pyx_n_s_use_cuda, __pyx_k_use_cuda, sizeof(__pyx_k_use_cuda), 0, 0, 1, 1}, + {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1}, + {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, + {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, + {&__pyx_n_s_volume, __pyx_k_volume, sizeof(__pyx_k_volume), 0, 0, 1, 1}, + {&__pyx_n_s_volume_list, __pyx_k_volume_list, sizeof(__pyx_k_volume_list), 0, 0, 1, 1}, + {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, + {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1}, + {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 13, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 263, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 412, __pyx_L1_error) __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 534, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 944, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 134, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 149, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 152, __pyx_L1_error) - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 406, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 615, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 834, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 100, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 141, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 156, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 159, __pyx_L1_error) + __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 373, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 408, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 618, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 914, __pyx_L1_error) + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 983, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } +/* #### Code section: cached_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "src/gfunction/gfunction.pyx":20 + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + */ + __pyx_tuple__4 = PyTuple_New(1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_tuple__4, 0, __pyx_int_neg_1)) __PYX_ERR(1, 582, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_tuple__4); + + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False + */ + __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + */ + __pyx_tuple__8 = PyTuple_Pack(3, __pyx_int_136983863, __pyx_int_112105877, __pyx_int_184977713); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: + */ + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: + */ + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 989, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + + /* "newanalysis/gfunction/gfunction.pyx":17 + * self.cuda = True + * try: + * import pycuda.autoinit # <<<<<<<<<<<<<< + * import pycuda.driver as drv + * from pycuda.compiler import SourceModule + */ + __pyx_tuple__11 = PyTuple_Pack(2, __pyx_n_s_pycuda, __pyx_n_s_autoinit); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + + /* "newanalysis/gfunction/gfunction.pyx":18 + * try: + * import pycuda.autoinit + * import pycuda.driver as drv # <<<<<<<<<<<<<< + * from pycuda.compiler import SourceModule + * if pycuda.autoinit.device.compute_capability() < (1, 3): + */ + __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_pycuda, __pyx_n_s_driver); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + + /* "newanalysis/gfunction/gfunction.pyx":20 * import pycuda.driver as drv * from pycuda.compiler import SourceModule * if pycuda.autoinit.device.compute_capability() < (1, 3): # <<<<<<<<<<<<<< * self.cuda = False * except: */ - __pyx_tuple__2 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_3); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); + __pyx_tuple__13 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_3); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + + /* "newanalysis/gfunction/gfunction.pyx":263 + * self.cuda = True + * elif use_cuda and not cu.cuda: + * print("No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead.") # <<<<<<<<<<<<<< + * self.cuda = False + * else: + */ + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_No_suitable_CUDA_device_was_foun); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 263, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); - /* "src/gfunction/gfunction.pyx":297 + /* "newanalysis/gfunction/gfunction.pyx":297 * self.histo_n = np.int32((histo_max-histo_min)/histo_dr+0.5) * * self.box_dim = np.zeros(6,dtype=self.dtype) # <<<<<<<<<<<<<< * self.box_dim[0] = box_x * self.box_dim[3] = box_x/2.0 */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_6); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_int_6); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); - /* "src/gfunction/gfunction.pyx":412 + /* "newanalysis/gfunction/gfunction.pyx":412 * # Check if dipole moments are needed and, if yes, were passed * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): * raise TypeError("No dipole moment array for the fist selection was passed, although the requested gfunctions need it!") # <<<<<<<<<<<<<< * * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_No_dipole_moment_array_for_the_f); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_No_dipole_moment_array_for_the_f); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); - /* "src/gfunction/gfunction.pyx":415 + /* "newanalysis/gfunction/gfunction.pyx":415 * * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): * raise TypeError("No dipole moment array for the second selection was passed, although the requested gfunctions need it!") # <<<<<<<<<<<<<< * * if self.oneistwo is None: */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_No_dipole_moment_array_for_the_s); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "src/gfunction/gfunction.pyx":514 - * - * def scale(self, value): - * self.histogram_out[:] *= value # <<<<<<<<<<<<<< - * self.histogram[:] *= value - * - */ - __pyx_slice__6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__6)) __PYX_ERR(0, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__6); - __Pyx_GIVEREF(__pyx_slice__6); + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_No_dipole_moment_array_for_the_s); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); - /* "src/gfunction/gfunction.pyx":960 + /* "newanalysis/gfunction/gfunction.pyx":960 * # Check if dipole moments are needed and, if yes, were passed * if dip_sel1 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 4 or ( self.mode_sel) & 16 or ( self.mode_sel) & 32): * raise TypeError("No dipole moment array for the first selection was passed, although the requested gfunctions need it!") # <<<<<<<<<<<<<< * * if dip_sel2 is None and (( self.mode_sel) & 2 or ( self.mode_sel) & 8 or ( self.mode_sel) & 16 or ( self.mode_sel) & 64): */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_No_dipole_moment_array_for_the_f_2); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 960, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_No_dipole_moment_array_for_the_f_2); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 960, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_sys); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_tuple__20 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + */ + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_collections_abc); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * + */ + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_collections); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + + /* "View.MemoryView":309 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") + */ + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * + */ + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); + + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * + */ + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_tuple__28 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "newanalysis/gfunction/gfunction.pyx":13 + * + * # CUDA handler interface + * class CUDA(object): # <<<<<<<<<<<<<< + * def __init__(self): + * self.cuda = True + */ + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); + + /* "newanalysis/gfunction/gfunction.pyx":14 + * # CUDA handler interface + * class CUDA(object): + * def __init__(self): # <<<<<<<<<<<<<< + * self.cuda = True + * try: + */ + __pyx_tuple__32 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_pycuda, __pyx_n_s_drv, __pyx_n_s_SourceModule); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_init, 14, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 14, __pyx_L1_error) + + /* "newanalysis/gfunction/gfunction.pyx":104 + * self._calcHistoGPU = self.source.get_function("calcHistoGPU") + * + * def calcHistoGPU(self,coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel, block, grid): # <<<<<<<<<<<<<< + * self._calcHistoGPU(coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel,block=block,grid=grid) + * + */ + __pyx_tuple__34 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_coor_sel1_gpu, __pyx_n_s_coor_sel2_gpu, __pyx_n_s_dip_sel1_gpu, __pyx_n_s_dip_sel2_gpu, __pyx_n_s_histo_gpu, __pyx_n_s_box_dim_gpu, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_n, __pyx_n_s_histo_inv_dr, __pyx_n_s_mode_sel, __pyx_n_s_block, __pyx_n_s_grid); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(16, 0, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_calcHistoGPU, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 104, __pyx_L1_error) + + /* "newanalysis/gfunction/gfunction.pyx":168 + * + * # RDF time series + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcHistoTS(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:] result, + * double boxl, int t, float histo_min, float histo_max, double invdx): + */ + __pyx_tuple__36 = PyTuple_Pack(18, __pyx_n_s_core_xyz, __pyx_n_s_surr_xyz, __pyx_n_s_result, __pyx_n_s_boxl, __pyx_n_s_t, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_invdx, __pyx_n_s_ncore, __pyx_n_s_nsurr, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_pos, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_dist, __pyx_n_s_boxl2); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_calcHistoTS, 168, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 168, __pyx_L1_error) + + /* "newanalysis/gfunction/gfunction.pyx":195 + * + * # RDF time series with voronoi decomposition + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcHistoTSVoro(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:,:] result, char [:,:,:] ds, int maxshell, + * double boxl, int t, float histo_min, float histo_max, double invdx): + */ + __pyx_tuple__38 = PyTuple_Pack(21, __pyx_n_s_core_xyz, __pyx_n_s_surr_xyz, __pyx_n_s_result, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_boxl, __pyx_n_s_t, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_invdx, __pyx_n_s_ncore, __pyx_n_s_nsurr, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_pos, __pyx_n_s_shell_2, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_dist, __pyx_n_s_boxl2); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(10, 0, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_calcHistoTSVoro, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 195, __pyx_L1_error) + + /* "newanalysis/gfunction/gfunction.pyx":227 + * + * + * class RDF(object): # <<<<<<<<<<<<<< + * """ + * class RDF + */ + __pyx_tuple__40 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_tuple__41 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + + /* "newanalysis/gfunction/gfunction.pyx":234 + * """ + * + * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False, norm_volume=None): # <<<<<<<<<<<<<< + * """ + * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) + */ + __pyx_tuple__42 = PyTuple_Pack(23, __pyx_n_s_self, __pyx_n_s_modes, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_dr, __pyx_n_s_sel1_n, __pyx_n_s_sel2_n, __pyx_n_s_sel1_nmol, __pyx_n_s_sel2_nmol, __pyx_n_s_box_x, __pyx_n_s_box_y, __pyx_n_s_box_z, __pyx_n_s_use_cuda, __pyx_n_s_norm_volume, __pyx_n_s_mode_sel, __pyx_n_s_mode, __pyx_n_s_arr_sel1, __pyx_n_s_arr_sel2, __pyx_n_s_block_x, __pyx_n_s_block_y, __pyx_n_s_block_z, __pyx_n_s_grid_x, __pyx_n_s_grid_y); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(14, 0, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_init, 234, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(4, Py_None, Py_None, ((PyObject *)Py_False), Py_None); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + + /* "newanalysis/gfunction/gfunction.pyx":367 + * + * + * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< + * """ + * update_box(box_x,box_y,box_z) + */ + __pyx_tuple__45 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_box_x, __pyx_n_s_box_y, __pyx_n_s_box_z); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_update_box, 367, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 367, __pyx_L1_error) + + /* "newanalysis/gfunction/gfunction.pyx":385 + * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] + * + * def calcFrame(self, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, + */ + __pyx_tuple__47 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_coor_sel1, __pyx_n_s_coor_sel2, __pyx_n_s_dip_sel1, __pyx_n_s_dip_sel2, __pyx_n_s_pre_coor_sel1_gpu, __pyx_n_s_pre_coor_sel2_gpu, __pyx_n_s_pre_dip_sel1_gpu, __pyx_n_s_pre_dip_sel2_gpu); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 385, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__47); + __Pyx_GIVEREF(__pyx_tuple__47); + __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_calcFrame, 385, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 385, __pyx_L1_error) + __pyx_tuple__49 = PyTuple_Pack(6, Py_None, Py_None, Py_None, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 385, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__49); + __Pyx_GIVEREF(__pyx_tuple__49); + + /* "newanalysis/gfunction/gfunction.pyx":466 + * self.histo_n, self.histo_inv_dr, self.mode_sel) + * + * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< + * """ + * Add the histograms of all core particles, after they were calculated in parallel. + */ + __pyx_tuple__50 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_histo_out, __pyx_n_s_histo, __pyx_n_s_histo_n, __pyx_n_s_n1, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_ix, __pyx_n_s_ix2, __pyx_n_s_histogram_out, __pyx_n_s_histogram); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_addHisto, 466, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 466, __pyx_L1_error) + + /* "newanalysis/gfunction/gfunction.pyx":483 + * + * + * def _normHisto(self): # <<<<<<<<<<<<<< + * """ + * Normalize the histogram. + */ + __pyx_tuple__52 = PyTuple_Pack(13, __pyx_n_s_self, __pyx_n_s_volume, __pyx_n_s_v, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_ix, __pyx_n_s_ix2, __pyx_n_s_PI, __pyx_n_s_rho, __pyx_n_s_r, __pyx_n_s_r_out, __pyx_n_s_slice_vol, __pyx_n_s_norm); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_normHisto, 483, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 483, __pyx_L1_error) + + /* "newanalysis/gfunction/gfunction.pyx":513 + * self.histogram_out[j*self.histo_n+i]/=norm + * + * def scale(self, value): # <<<<<<<<<<<<<< + * self.histogram_out[:] *= value + * self.histogram[:] *= value + */ + __pyx_tuple__54 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_scale, 513, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 513, __pyx_L1_error) + + /* "newanalysis/gfunction/gfunction.pyx":517 + * self.histogram[:] *= value * - * cdef inline int import_umath() except -1: + * def write(self, filename="rdf"): # <<<<<<<<<<<<<< + * """ + * RDF.write(filename="rdf") */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 944, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__56 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_filename, __pyx_n_s_f000, __pyx_n_s_f110, __pyx_n_s_f101, __pyx_n_s_f011, __pyx_n_s_f220, __pyx_n_s_f202, __pyx_n_s_f022, __pyx_n_s_i, __pyx_n_s_r); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); + __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_write, 517, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 517, __pyx_L1_error) + __pyx_tuple__58 = PyTuple_Pack(1, ((PyObject*)__pyx_n_s_rdf)); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__58); + __Pyx_GIVEREF(__pyx_tuple__58); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":552 + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) * - * cdef inline int import_ufunc() except -1: + * def resetArrays(self): # <<<<<<<<<<<<<< + * """ + * Reset histogram arrays to zero */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 950, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_tuple__59 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 552, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__59); + __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_resetArrays, 552, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 552, __pyx_L1_error) - /* "View.MemoryView":134 + /* "newanalysis/gfunction/gfunction.pyx":560 * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< * - * if itemsize <= 0: + * def printInfo(self): # <<<<<<<<<<<<<< + * """ + * Print some information about the RDF container. */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_printInfo, 560, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 560, __pyx_L1_error) - /* "View.MemoryView":137 + /* "newanalysis/gfunction/gfunction.pyx":765 * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< * - * if not isinstance(format, bytes): + * class RDF_voronoi(object): # <<<<<<<<<<<<<< + * """ + * class RDF */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_tuple__62 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__62); + __Pyx_GIVEREF(__pyx_tuple__62); + __pyx_tuple__63 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__63); + __Pyx_GIVEREF(__pyx_tuple__63); - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * + /* "newanalysis/gfunction/gfunction.pyx":772 + * """ * + * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, nshells, box_y=None, box_z=None, use_cuda=False, norm_volume=None, exclude_self_mol=False): # <<<<<<<<<<<<<< + * """ + * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_tuple__64 = PyTuple_Pack(18, __pyx_n_s_self, __pyx_n_s_modes, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_dr, __pyx_n_s_sel1_n, __pyx_n_s_sel2_n, __pyx_n_s_sel1_nmol, __pyx_n_s_sel2_nmol, __pyx_n_s_box_x, __pyx_n_s_nshells, __pyx_n_s_box_y, __pyx_n_s_box_z, __pyx_n_s_use_cuda, __pyx_n_s_norm_volume, __pyx_n_s_exclude_self_mol, __pyx_n_s_mode_sel, __pyx_n_s_mode); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__64); + __Pyx_GIVEREF(__pyx_tuple__64); + __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(16, 0, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_init, 772, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 772, __pyx_L1_error) + __pyx_tuple__66 = PyTuple_Pack(5, Py_None, Py_None, ((PyObject *)Py_False), Py_None, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__66); + __Pyx_GIVEREF(__pyx_tuple__66); - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":912 * - * if self.dtype_is_object: + * + * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< + * """ + * update_box(box_x,box_y,box_z) */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_update_box, 912, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 912, __pyx_L1_error) - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len + /* "newanalysis/gfunction/gfunction.pyx":932 + * """ + * + * def calcFrame(self, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, + * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_tuple__68 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_coor_sel1, __pyx_n_s_coor_sel2, __pyx_n_s_delaunay_matrix, __pyx_n_s_dip_sel1, __pyx_n_s_dip_sel2, __pyx_n_s_pre_coor_sel1_gpu, __pyx_n_s_pre_coor_sel2_gpu, __pyx_n_s_pre_dip_sel1_gpu, __pyx_n_s_pre_dip_sel2_gpu); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__68); + __Pyx_GIVEREF(__pyx_tuple__68); + __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(10, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_calcFrame, 932, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 932, __pyx_L1_error) - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/gfunction/gfunction.pyx":1023 + * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) + * + * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< + * """ + * Add the histograms of all core particles, after they were calculated in parallel. */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_tuple__70 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_histo_out, __pyx_n_s_histo, __pyx_n_s_histo_n, __pyx_n_s_n1, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_ix, __pyx_n_s_ix2, __pyx_n_s_histogram_out, __pyx_n_s_histogram, __pyx_n_s_shell_2, __pyx_n_s_nshells); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 1023, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__70); + __Pyx_GIVEREF(__pyx_tuple__70); + __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_addHisto, 1023, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 1023, __pyx_L1_error) - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":1051 + * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] + * + * def _normHisto(self): # <<<<<<<<<<<<<< + * """ + * Normalize the histogram. */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_tuple__72 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_volume, __pyx_n_s_v, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_ix, __pyx_n_s_ix2, __pyx_n_s_shell_2, __pyx_n_s_PI, __pyx_n_s_rho, __pyx_n_s_r, __pyx_n_s_r_out, __pyx_n_s_slice_vol, __pyx_n_s_norm); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__72); + __Pyx_GIVEREF(__pyx_tuple__72); + __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_normHisto, 1051, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 1051, __pyx_L1_error) - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":1092 + * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm * - * have_slices, index = _unellipsify(index, self.view.ndim) + * def scale(self, value): # <<<<<<<<<<<<<< + * self.histogram_out[:] *= value + * self.histogram[:] *= value */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_scale, 1092, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 1092, __pyx_L1_error) - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: + /* "newanalysis/gfunction/gfunction.pyx":1096 + * self.histogram[:] *= value + * + * def write(self, filename="rdf"): # <<<<<<<<<<<<<< + * """ + * RDF.write(filename="rdf") */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_tuple__75 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_filename, __pyx_n_s_shell_2, __pyx_n_s_f000, __pyx_n_s_f110, __pyx_n_s_f101, __pyx_n_s_f011, __pyx_n_s_f220, __pyx_n_s_f202, __pyx_n_s_f022, __pyx_n_s_i, __pyx_n_s_r); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 1096, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__75); + __Pyx_GIVEREF(__pyx_tuple__75); + __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_write, 1096, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 1096, __pyx_L1_error) - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< + /* "newanalysis/gfunction/gfunction.pyx":1134 + * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) * - * if flags & PyBUF_ND: + * def resetArrays(self): # <<<<<<<<<<<<<< + * """ + * Reset histogram arrays to zero */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_resetArrays, 1134, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 1134, __pyx_L1_error) - /* "View.MemoryView":572 - * if self.view.strides == NULL: + /* "newanalysis/gfunction/gfunction.pyx":1142 * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * def printInfo(self): # <<<<<<<<<<<<<< + * """ + * Print some information about the RDF container. */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_gfunction_gfunction, __pyx_n_s_printInfo, 1142, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 1142, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - */ - __pyx_tuple__21 = PyTuple_New(1); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_INCREF(__pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__21, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_tuple__21); +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_globals ### */ - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 0)); else - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< - * - * + /* NumpyImportArray.init */ + /* + * Cython has automatically inserted a call to _import_array since + * you didn't include one when you cimported numpy. To disable this + * add the line + * numpy._import_array */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); +#ifdef NPY_FEATURE_VERSION +#ifndef NO_IMPORT_ARRAY +if (unlikely(_import_array() == -1)) { + PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import " + "(auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; " + "use 'numpy._import_array' to disable if you are certain you don't need it)."); +} +#endif +#endif - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_tuple__27 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_module ### */ - /* "src/gfunction/gfunction.pyx":13 - * - * # CUDA handler interface - * class CUDA(object): # <<<<<<<<<<<<<< - * def __init__(self): - * self.cuda = True - */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ - /* "src/gfunction/gfunction.pyx":14 - * # CUDA handler interface - * class CUDA(object): - * def __init__(self): # <<<<<<<<<<<<<< - * self.cuda = True - * try: - */ - __pyx_tuple__29 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_pycuda, __pyx_n_s_drv, __pyx_n_s_SourceModule); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_init, 14, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 14, __pyx_L1_error) +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return 0; +} - /* "src/gfunction/gfunction.pyx":104 - * self._calcHistoGPU = self.source.get_function("calcHistoGPU") - * - * def calcHistoGPU(self,coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel, block, grid): # <<<<<<<<<<<<<< - * self._calcHistoGPU(coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel,block=block,grid=grid) - * - */ - __pyx_tuple__31 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_coor_sel1_gpu, __pyx_n_s_coor_sel2_gpu, __pyx_n_s_dip_sel1_gpu, __pyx_n_s_dip_sel2_gpu, __pyx_n_s_histo_gpu, __pyx_n_s_box_dim_gpu, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_n, __pyx_n_s_histo_inv_dr, __pyx_n_s_mode_sel, __pyx_n_s_block, __pyx_n_s_grid); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(16, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_calcHistoGPU, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 104, __pyx_L1_error) +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} - /* "src/gfunction/gfunction.pyx":169 - * # RDF time series - * @cython.boundscheck(False) - * def calcHistoTS(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:] result, # <<<<<<<<<<<<<< - * double boxl, int t, float histo_min, float histo_max, double invdx): - * - */ - __pyx_tuple__33 = PyTuple_Pack(18, __pyx_n_s_core_xyz, __pyx_n_s_surr_xyz, __pyx_n_s_result, __pyx_n_s_boxl, __pyx_n_s_t, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_invdx, __pyx_n_s_ncore, __pyx_n_s_nsurr, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_pos, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_dist, __pyx_n_s_boxl2); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(8, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_calcHistoTS, 169, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 169, __pyx_L1_error) +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} - /* "src/gfunction/gfunction.pyx":196 - * # RDF time series with voronoi decomposition - * @cython.boundscheck(False) - * def calcHistoTSVoro(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:,:] result, char [:,:,:] ds, int maxshell, # <<<<<<<<<<<<<< - * double boxl, int t, float histo_min, float histo_max, double invdx): - * - */ - __pyx_tuple__35 = PyTuple_Pack(21, __pyx_n_s_core_xyz, __pyx_n_s_surr_xyz, __pyx_n_s_result, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_boxl, __pyx_n_s_t, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_invdx, __pyx_n_s_ncore, __pyx_n_s_nsurr, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_pos, __pyx_n_s_shell_2, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_dist, __pyx_n_s_boxl2); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(10, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_calcHistoTSVoro, 196, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 196, __pyx_L1_error) +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_array_type)) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_array_type->tp_base->tp_as_buffer && __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #else + __pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_array_type->tp_print = 0; + #endif + if (__Pyx_SetVtable(__pyx_array_type, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_MemviewEnum_type)) __PYX_ERR(1, 302, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #else + __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_MemviewEnum_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_MemviewEnum_type->tp_dictoffset && __pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_MemviewEnum_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_memoryview_type)) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #else + __pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryview_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryview_type->tp_dictoffset && __pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryview_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_memoryview_type, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_memoryviewslice_type)) __PYX_ERR(1, 952, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #else + __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryviewslice_type->tp_base = __pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryviewslice_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryviewslice_type->tp_dictoffset && __pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryviewslice_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} - /* "src/gfunction/gfunction.pyx":227 - * - * - * class RDF(object): # <<<<<<<<<<<<<< - * """ - * class RDF - */ - __pyx_tuple__37 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_2(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArray_Descr),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 202, __pyx_L1_error) + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 225, __pyx_L1_error) + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayMultiIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 229, __pyx_L1_error) + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 238, __pyx_L1_error) + __pyx_ptype_5numpy_generic = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 809, __pyx_L1_error) + __pyx_ptype_5numpy_number = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 811, __pyx_L1_error) + __pyx_ptype_5numpy_integer = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 813, __pyx_L1_error) + __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 815, __pyx_L1_error) + __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 817, __pyx_L1_error) + __pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 819, __pyx_L1_error) + __pyx_ptype_5numpy_floating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 821, __pyx_L1_error) + __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 823, __pyx_L1_error) + __pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_ptype_5numpy_character = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyUFuncObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 865, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_gfunction(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_gfunction}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "gfunction", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void +#endif +#else +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initgfunction(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initgfunction(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_gfunction(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_gfunction(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else + result = PyDict_SetItemString(moddict, to_name, value); +#endif + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + if (__Pyx_check_single_interpreter()) + return NULL; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; +#endif + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} - /* "src/gfunction/gfunction.pyx":234 - * """ - * - * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False, norm_volume=None): # <<<<<<<<<<<<<< - * """ - * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) - */ - __pyx_tuple__38 = PyTuple_Pack(23, __pyx_n_s_self, __pyx_n_s_modes, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_dr, __pyx_n_s_sel1_n, __pyx_n_s_sel2_n, __pyx_n_s_sel1_nmol, __pyx_n_s_sel2_nmol, __pyx_n_s_box_x, __pyx_n_s_box_y, __pyx_n_s_box_z, __pyx_n_s_use_cuda, __pyx_n_s_norm_volume, __pyx_n_s_mode_sel, __pyx_n_s_mode, __pyx_n_s_arr_sel1, __pyx_n_s_arr_sel2, __pyx_n_s_block_x, __pyx_n_s_block_y, __pyx_n_s_block_z, __pyx_n_s_grid_x, __pyx_n_s_grid_y); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__38); - __Pyx_GIVEREF(__pyx_tuple__38); - __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(14, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_init, 234, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 234, __pyx_L1_error) - __pyx_tuple__40 = PyTuple_Pack(4, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_False), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__40); - __Pyx_GIVEREF(__pyx_tuple__40); - /* "src/gfunction/gfunction.pyx":367 - * - * - * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< - * """ - * update_box(box_x,box_y,box_z) - */ - __pyx_tuple__41 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_box_x, __pyx_n_s_box_y, __pyx_n_s_box_z); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_update_box, 367, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 367, __pyx_L1_error) +static CYTHON_SMALL_CODE int __pyx_pymod_exec_gfunction(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + static PyThread_type_lock __pyx_t_8[8]; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'gfunction' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("gfunction", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to gfunction pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_gfunction(void)", 0); + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + PyEval_InitThreads(); + #endif + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_newanalysis__gfunction) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "newanalysis.gfunction")) { + if (unlikely((PyDict_SetItemString(modules, "newanalysis.gfunction", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif - /* "src/gfunction/gfunction.pyx":385 - * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] + /* "View.MemoryView":99 * - * def calcFrame(self, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence */ - __pyx_tuple__43 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_coor_sel1, __pyx_n_s_coor_sel2, __pyx_n_s_dip_sel1, __pyx_n_s_dip_sel2, __pyx_n_s_pre_coor_sel1_gpu, __pyx_n_s_pre_coor_sel2_gpu, __pyx_n_s_pre_dip_sel1_gpu, __pyx_n_s_pre_dip_sel2_gpu); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 385, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(9, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_calcFrame, 385, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 385, __pyx_L1_error) - __pyx_tuple__45 = PyTuple_Pack(6, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 385, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "src/gfunction/gfunction.pyx":466 - * self.histo_n, self.histo_inv_dr, self.mode_sel) - * - * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< - * """ - * Add the histograms of all core particles, after they were calculated in parallel. + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: */ - __pyx_tuple__46 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_histo_out, __pyx_n_s_histo, __pyx_n_s_histo_n, __pyx_n_s_n1, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_ix, __pyx_n_s_ix2, __pyx_n_s_histogram_out, __pyx_n_s_histogram); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 466, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_addHisto, 466, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_version_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__20, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { - /* "src/gfunction/gfunction.pyx":483 - * - * - * def _normHisto(self): # <<<<<<<<<<<<<< - * """ - * Normalize the histogram. + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence */ - __pyx_tuple__48 = PyTuple_Pack(13, __pyx_n_s_self, __pyx_n_s_volume, __pyx_n_s_v, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_ix, __pyx_n_s_ix2, __pyx_n_s_PI, __pyx_n_s_rho, __pyx_n_s_r, __pyx_n_s_r_out, __pyx_n_s_slice_vol, __pyx_n_s_norm); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_normHisto, 483, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 483, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; - /* "src/gfunction/gfunction.pyx":513 - * self.histogram_out[j*self.histo_n+i]/=norm - * - * def scale(self, value): # <<<<<<<<<<<<<< - * self.histogram_out[:] *= value - * self.histogram[:] *= value + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: */ - __pyx_tuple__50 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 513, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_scale, 513, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 513, __pyx_L1_error) + goto __pyx_L8; + } - /* "src/gfunction/gfunction.pyx":517 - * self.histogram[:] *= value + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: * - * def write(self, filename="rdf"): # <<<<<<<<<<<<<< - * """ - * RDF.write(filename="rdf") */ - __pyx_tuple__52 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_filename, __pyx_n_s_f000, __pyx_n_s_f110, __pyx_n_s_f101, __pyx_n_s_f011, __pyx_n_s_f220, __pyx_n_s_f202, __pyx_n_s_f022, __pyx_n_s_i, __pyx_n_s_r); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__52); - __Pyx_GIVEREF(__pyx_tuple__52); - __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_write, 517, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 517, __pyx_L1_error) - __pyx_tuple__54 = PyTuple_Pack(1, ((PyObject*)__pyx_n_s_rdf)); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__54); - __Pyx_GIVEREF(__pyx_tuple__54); + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L8:; - /* "src/gfunction/gfunction.pyx":552 - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) + /* "View.MemoryView":99 * - * def resetArrays(self): # <<<<<<<<<<<<<< - * """ - * Reset histogram arrays to zero + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence */ - __pyx_tuple__55 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 552, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__55); - __Pyx_GIVEREF(__pyx_tuple__55); - __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_resetArrays, 552, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 552, __pyx_L1_error) + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/gfunction/gfunction.pyx":560 - * + /* "View.MemoryView":104 + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + * except: # <<<<<<<<<<<<<< * - * def printInfo(self): # <<<<<<<<<<<<<< - * """ - * Print some information about the RDF container. + * __pyx_collections_abc_Sequence = None */ - __pyx_tuple__57 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 560, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__57); - __Pyx_GIVEREF(__pyx_tuple__57); - __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_printInfo, 560, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 560, __pyx_L1_error) + /*except:*/ { + __Pyx_AddTraceback("View.MemoryView", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(1, 104, __pyx_L4_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_7); - /* "src/gfunction/gfunction.pyx":765 + /* "View.MemoryView":106 + * except: * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< * - * class RDF_voronoi(object): # <<<<<<<<<<<<<< - * """ - * class RDF - */ - __pyx_tuple__59 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 765, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__59); - __Pyx_GIVEREF(__pyx_tuple__59); - - /* "src/gfunction/gfunction.pyx":772 - * """ * - * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, nshells, box_y=None, box_z=None, use_cuda=False, norm_volume=None, exclude_self_mol=False): # <<<<<<<<<<<<<< - * """ - * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) */ - __pyx_tuple__60 = PyTuple_Pack(18, __pyx_n_s_self, __pyx_n_s_modes, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_dr, __pyx_n_s_sel1_n, __pyx_n_s_sel2_n, __pyx_n_s_sel1_nmol, __pyx_n_s_sel2_nmol, __pyx_n_s_box_x, __pyx_n_s_nshells, __pyx_n_s_box_y, __pyx_n_s_box_z, __pyx_n_s_use_cuda, __pyx_n_s_norm_volume, __pyx_n_s_exclude_self_mol, __pyx_n_s_mode_sel, __pyx_n_s_mode); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 772, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__60); - __Pyx_GIVEREF(__pyx_tuple__60); - __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(16, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_init, 772, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 772, __pyx_L1_error) - __pyx_tuple__62 = PyTuple_Pack(5, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_False), ((PyObject *)Py_None), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 772, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__62); - __Pyx_GIVEREF(__pyx_tuple__62); + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L3_exception_handled; + } - /* "src/gfunction/gfunction.pyx":912 - * + /* "View.MemoryView":99 * - * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< - * """ - * update_box(box_x,box_y,box_z) + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence */ - __pyx_tuple__63 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_box_x, __pyx_n_s_box_y, __pyx_n_s_box_z); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__63); - __Pyx_GIVEREF(__pyx_tuple__63); - __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_update_box, 912, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 912, __pyx_L1_error) + __pyx_L4_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } - /* "src/gfunction/gfunction.pyx":932 - * """ + /* "View.MemoryView":241 * - * def calcFrame(self, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, - * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, - */ - __pyx_tuple__65 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_coor_sel1, __pyx_n_s_coor_sel2, __pyx_n_s_delaunay_matrix, __pyx_n_s_dip_sel1, __pyx_n_s_dip_sel2, __pyx_n_s_pre_coor_sel1_gpu, __pyx_n_s_pre_coor_sel2_gpu, __pyx_n_s_pre_dip_sel1_gpu, __pyx_n_s_pre_dip_sel2_gpu); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__65); - __Pyx_GIVEREF(__pyx_tuple__65); - __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(10, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_calcFrame, 932, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 932, __pyx_L1_error) - __pyx_tuple__67 = PyTuple_Pack(6, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__67); - __Pyx_GIVEREF(__pyx_tuple__67); - - /* "src/gfunction/gfunction.pyx":1023 - * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) * - * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< - * """ - * Add the histograms of all core particles, after they were calculated in parallel. + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index */ - __pyx_tuple__68 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_histo_out, __pyx_n_s_histo, __pyx_n_s_histo_n, __pyx_n_s_n1, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_ix, __pyx_n_s_ix2, __pyx_n_s_histogram_out, __pyx_n_s_histogram, __pyx_n_s_shell_2, __pyx_n_s_nshells); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 1023, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__68); - __Pyx_GIVEREF(__pyx_tuple__68); - __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(3, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_addHisto, 1023, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 1023, __pyx_L1_error) + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { - /* "src/gfunction/gfunction.pyx":1051 - * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] + /* "View.MemoryView":242 * - * def _normHisto(self): # <<<<<<<<<<<<<< - * """ - * Normalize the histogram. + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: */ - __pyx_tuple__70 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_volume, __pyx_n_s_v, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_ix, __pyx_n_s_ix2, __pyx_n_s_shell_2, __pyx_n_s_PI, __pyx_n_s_rho, __pyx_n_s_r, __pyx_n_s_r_out, __pyx_n_s_slice_vol, __pyx_n_s_norm); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__70); - __Pyx_GIVEREF(__pyx_tuple__70); - __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(1, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_normHisto, 1051, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 1051, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); - /* "src/gfunction/gfunction.pyx":1092 - * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm - * - * def scale(self, value): # <<<<<<<<<<<<<< - * self.histogram_out[:] *= value - * self.histogram[:] *= value + /* "View.MemoryView":243 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass */ - __pyx_tuple__72 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 1092, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__72); - __Pyx_GIVEREF(__pyx_tuple__72); - __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_scale, 1092, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 1092, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); - /* "src/gfunction/gfunction.pyx":1096 - * self.histogram[:] *= value + /* "View.MemoryView":241 * - * def write(self, filename="rdf"): # <<<<<<<<<<<<<< - * """ - * RDF.write(filename="rdf") - */ - __pyx_tuple__74 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_filename, __pyx_n_s_shell_2, __pyx_n_s_f000, __pyx_n_s_f110, __pyx_n_s_f101, __pyx_n_s_f011, __pyx_n_s_f220, __pyx_n_s_f202, __pyx_n_s_f022, __pyx_n_s_i, __pyx_n_s_r); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 1096, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__74); - __Pyx_GIVEREF(__pyx_tuple__74); - __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_write, 1096, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 1096, __pyx_L1_error) - __pyx_tuple__76 = PyTuple_Pack(1, ((PyObject*)__pyx_n_s_rdf)); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 1096, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__76); - __Pyx_GIVEREF(__pyx_tuple__76); - - /* "src/gfunction/gfunction.pyx":1134 - * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) * - * def resetArrays(self): # <<<<<<<<<<<<<< - * """ - * Reset histogram arrays to zero + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index */ - __pyx_tuple__77 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 1134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__77); - __Pyx_GIVEREF(__pyx_tuple__77); - __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_resetArrays, 1134, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 1134, __pyx_L1_error) + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L16_try_end; + __pyx_L11_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/gfunction/gfunction.pyx":1142 - * + /* "View.MemoryView":244 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass * - * def printInfo(self): # <<<<<<<<<<<<<< - * """ - * Print some information about the RDF container. */ - __pyx_tuple__79 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 1142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__79); - __Pyx_GIVEREF(__pyx_tuple__79); - __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gfunction_gfunction_pyx, __pyx_n_s_printInfo, 1142, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 1142, __pyx_L1_error) + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L12_exception_handled; + } + __pyx_L12_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L16_try_end:; + } - /* "View.MemoryView":287 + /* "View.MemoryView":309 * return self.name * * cdef generic = Enum("") # <<<<<<<<<<<<<< * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_tuple__81 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__81); - __Pyx_GIVEREF(__pyx_tuple__81); + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":288 + /* "View.MemoryView":310 * * cdef generic = Enum("") * cdef strided = Enum("") # default # <<<<<<<<<<<<<< * cdef indirect = Enum("") * */ - __pyx_tuple__82 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__82); - __Pyx_GIVEREF(__pyx_tuple__82); + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":289 + /* "View.MemoryView":311 * cdef generic = Enum("") * cdef strided = Enum("") # default * cdef indirect = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_tuple__83 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__83); - __Pyx_GIVEREF(__pyx_tuple__83); + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":292 + /* "View.MemoryView":314 * * * cdef contiguous = Enum("") # <<<<<<<<<<<<<< * cdef indirect_contiguous = Enum("") * */ - __pyx_tuple__84 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__84); - __Pyx_GIVEREF(__pyx_tuple__84); + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":293 + /* "View.MemoryView":315 * * cdef contiguous = Enum("") * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_tuple__85 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__85); - __Pyx_GIVEREF(__pyx_tuple__85); + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "View.MemoryView":323 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), */ - __pyx_tuple__86 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__86); - __Pyx_GIVEREF(__pyx_tuple__86); - __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - /* InitThreads.init */ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 -PyEval_InitThreads(); -#endif - -if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} + __pyx_memoryview_thread_locks_used = 0; -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + /* "View.MemoryView":324 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), + */ + __pyx_t_8[0] = PyThread_allocate_lock(); + __pyx_t_8[1] = PyThread_allocate_lock(); + __pyx_t_8[2] = PyThread_allocate_lock(); + __pyx_t_8[3] = PyThread_allocate_lock(); + __pyx_t_8[4] = PyThread_allocate_lock(); + __pyx_t_8[5] = PyThread_allocate_lock(); + __pyx_t_8[6] = PyThread_allocate_lock(); + __pyx_t_8[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_8, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - generic = Py_None; Py_INCREF(Py_None); - strided = Py_None; Py_INCREF(Py_None); - indirect = Py_None; Py_INCREF(Py_None); - contiguous = Py_None; Py_INCREF(Py_None); - indirect_contiguous = Py_None; Py_INCREF(Py_None); - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "View.MemoryView":983 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "View.MemoryView":984 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __pyx_vtabptr_array = &__pyx_vtable_array; - __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; - if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_array.tp_print = 0; - #endif - if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - __pyx_array_type = &__pyx_type___pyx_array; - if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_MemviewEnum.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) - __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; - __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; - __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; - __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; - __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; - __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; - __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; - __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; - __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; - if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryview.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - __pyx_memoryview_type = &__pyx_type___pyx_memoryview; - __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; - __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; - __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; - __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; - __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; - if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryviewslice.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L22_try_end; + __pyx_L17_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", - #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyTypeObject), - #else - sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyHeapTypeObject), - #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT(PyArray_Descr), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 199, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 222, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayMultiIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 226, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error) - __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 770, __pyx_L1_error) - __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 772, __pyx_L1_error) - __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 774, __pyx_L1_error) - __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 776, __pyx_L1_error) - __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 778, __pyx_L1_error) - __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 780, __pyx_L1_error) - __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 782, __pyx_L1_error) - __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 784, __pyx_L1_error) - __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 786, __pyx_L1_error) - __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 788, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT(PyUFuncObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} + /* "View.MemoryView":985 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L18_exception_handled; + } + __pyx_L18_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L22_try_end:; + } -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 989, __pyx_L23_error) + if (__pyx_t_6) { + /* "View.MemoryView":993 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_memoryviewslice_type)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif -#else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif + /* "View.MemoryView":994 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_array_type)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + } -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initgfunction(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initgfunction(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_gfunction(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_gfunction(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { - result = PyDict_SetItemString(moddict, to_name, value); - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L28_try_end; + __pyx_L23_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; -static CYTHON_SMALL_CODE int __pyx_pymod_exec_gfunction(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - static PyThread_type_lock __pyx_t_4[8]; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'gfunction' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_gfunction(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - PyEval_InitThreads(); - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("gfunction", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_newanalysis__gfunction) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "newanalysis.gfunction")) { - if (unlikely(PyDict_SetItemString(modules, "newanalysis.gfunction", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + /* "View.MemoryView":995 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L24_exception_handled; } + __pyx_L24_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L28_try_end:; } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /* "src/gfunction/gfunction.pyx":4 + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/gfunction/gfunction.pyx":4 * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 * * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_7) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/gfunction/gfunction.pyx":13 + /* "newanalysis/gfunction/gfunction.pyx":13 * * # CUDA handler interface * class CUDA(object): # <<<<<<<<<<<<<< * def __init__(self): * self.cuda = True */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__28); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__28, __pyx_n_s_CUDA, __pyx_n_s_CUDA, (PyObject *) NULL, __pyx_n_s_newanalysis_gfunction, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PEP560_update_bases(__pyx_tuple__31); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_t_7, __pyx_n_s_CUDA, __pyx_n_s_CUDA, (PyObject *) NULL, __pyx_n_s_newanalysis_gfunction, (PyObject *) NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_7 != __pyx_tuple__31) { + if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_tuple__31) < 0))) __PYX_ERR(0, 13, __pyx_L1_error) + } - /* "src/gfunction/gfunction.pyx":14 + /* "newanalysis/gfunction/gfunction.pyx":14 * # CUDA handler interface * class CUDA(object): * def __init__(self): # <<<<<<<<<<<<<< * self.cuda = True * try: */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_4CUDA_1__init__, 0, __pyx_n_s_CUDA___init, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_4CUDA_1__init__, 0, __pyx_n_s_CUDA___init, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_init, __pyx_t_9) < 0) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":104 + /* "newanalysis/gfunction/gfunction.pyx":104 * self._calcHistoGPU = self.source.get_function("calcHistoGPU") * * def calcHistoGPU(self,coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel, block, grid): # <<<<<<<<<<<<<< * self._calcHistoGPU(coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel,block=block,grid=grid) * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_4CUDA_3calcHistoGPU, 0, __pyx_n_s_CUDA_calcHistoGPU, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_calcHistoGPU, __pyx_t_3) < 0) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_4CUDA_3calcHistoGPU, 0, __pyx_n_s_CUDA_calcHistoGPU, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_calcHistoGPU, __pyx_t_9) < 0) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":13 + /* "newanalysis/gfunction/gfunction.pyx":13 * * # CUDA handler interface * class CUDA(object): # <<<<<<<<<<<<<< * def __init__(self): * self.cuda = True */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_CUDA, __pyx_tuple__28, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_CUDA, __pyx_t_3) < 0) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_CUDA, __pyx_t_7, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_CUDA, __pyx_t_9) < 0) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/gfunction/gfunction.pyx":107 + /* "newanalysis/gfunction/gfunction.pyx":107 * self._calcHistoGPU(coor_sel1_gpu, coor_sel2_gpu, dip_sel1_gpu, dip_sel2_gpu, histo_gpu, box_dim_gpu, n1, n2, histo_min, histo_max, histo_n, histo_inv_dr, mode_sel,block=block,grid=grid) * * cu=CUDA() # <<<<<<<<<<<<<< * * # CPU version */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_CUDA); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cu, __pyx_t_2) < 0) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_CUDA); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cu, __pyx_t_4) < 0) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/gfunction/gfunction.pyx":169 + /* "newanalysis/gfunction/gfunction.pyx":168 + * * # RDF time series - * @cython.boundscheck(False) - * def calcHistoTS(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:] result, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcHistoTS(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:] result, * double boxl, int t, float histo_min, float histo_max, double invdx): - * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9gfunction_1calcHistoTS, NULL, __pyx_n_s_newanalysis_gfunction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcHistoTS, __pyx_t_2) < 0) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_1calcHistoTS, 0, __pyx_n_s_calcHistoTS, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcHistoTS, __pyx_t_4) < 0) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/gfunction/gfunction.pyx":196 + /* "newanalysis/gfunction/gfunction.pyx":195 + * * # RDF time series with voronoi decomposition - * @cython.boundscheck(False) - * def calcHistoTSVoro(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:,:] result, char [:,:,:] ds, int maxshell, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcHistoTSVoro(double [:,:] core_xyz, double [:,:] surr_xyz, double [:,:,:,:] result, char [:,:,:] ds, int maxshell, * double boxl, int t, float histo_min, float histo_max, double invdx): - * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9gfunction_3calcHistoTSVoro, NULL, __pyx_n_s_newanalysis_gfunction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcHistoTSVoro, __pyx_t_2) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3calcHistoTSVoro, 0, __pyx_n_s_calcHistoTSVoro, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcHistoTSVoro, __pyx_t_4) < 0) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/gfunction/gfunction.pyx":227 + /* "newanalysis/gfunction/gfunction.pyx":227 * * * class RDF(object): # <<<<<<<<<<<<<< * """ * class RDF */ - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__37); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__37, __pyx_n_s_RDF, __pyx_n_s_RDF, (PyObject *) NULL, __pyx_n_s_newanalysis_gfunction, __pyx_kp_s_class_RDF_A_container_object_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PEP560_update_bases(__pyx_tuple__41); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_4, __pyx_n_s_RDF, __pyx_n_s_RDF, (PyObject *) NULL, __pyx_n_s_newanalysis_gfunction, __pyx_kp_s_class_RDF_A_container_object_fo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_4 != __pyx_tuple__41) { + if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_tuple__41) < 0))) __PYX_ERR(0, 227, __pyx_L1_error) + } - /* "src/gfunction/gfunction.pyx":234 + /* "newanalysis/gfunction/gfunction.pyx":234 * """ * * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False, norm_volume=None): # <<<<<<<<<<<<<< * """ * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_1__init__, 0, __pyx_n_s_RDF___init, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__40); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_1__init__, 0, __pyx_n_s_RDF___init, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_tuple__44); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_init, __pyx_t_9) < 0) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":367 + /* "newanalysis/gfunction/gfunction.pyx":367 * * * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< * """ * update_box(box_x,box_y,box_z) */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_3update_box, 0, __pyx_n_s_RDF_update_box, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_update_box, __pyx_t_3) < 0) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_3update_box, 0, __pyx_n_s_RDF_update_box, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_update_box, __pyx_t_9) < 0) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":385 + /* "newanalysis/gfunction/gfunction.pyx":385 * self.volume = self.box_dim[0] * self.box_dim[1] * self.box_dim[2] * * def calcFrame(self, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_5calcFrame, 0, __pyx_n_s_RDF_calcFrame, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 385, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__45); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_calcFrame, __pyx_t_3) < 0) __PYX_ERR(0, 385, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_5calcFrame, 0, __pyx_n_s_RDF_calcFrame, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 385, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_tuple__49); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_calcFrame, __pyx_t_9) < 0) __PYX_ERR(0, 385, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":466 + /* "newanalysis/gfunction/gfunction.pyx":466 * self.histo_n, self.histo_inv_dr, self.mode_sel) * * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< * """ * Add the histograms of all core particles, after they were calculated in parallel. */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_7_addHisto, 0, __pyx_n_s_RDF__addHisto, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_addHisto, __pyx_t_3) < 0) __PYX_ERR(0, 466, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_7_addHisto, 0, __pyx_n_s_RDF__addHisto, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_addHisto, __pyx_t_9) < 0) __PYX_ERR(0, 466, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":483 + /* "newanalysis/gfunction/gfunction.pyx":483 * * * def _normHisto(self): # <<<<<<<<<<<<<< * """ * Normalize the histogram. */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_9_normHisto, 0, __pyx_n_s_RDF__normHisto, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_normHisto, __pyx_t_3) < 0) __PYX_ERR(0, 483, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_9_normHisto, 0, __pyx_n_s_RDF__normHisto, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_normHisto, __pyx_t_9) < 0) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":513 + /* "newanalysis/gfunction/gfunction.pyx":513 * self.histogram_out[j*self.histo_n+i]/=norm * * def scale(self, value): # <<<<<<<<<<<<<< * self.histogram_out[:] *= value * self.histogram[:] *= value */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_11scale, 0, __pyx_n_s_RDF_scale, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_scale, __pyx_t_3) < 0) __PYX_ERR(0, 513, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_11scale, 0, __pyx_n_s_RDF_scale, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_scale, __pyx_t_9) < 0) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":517 + /* "newanalysis/gfunction/gfunction.pyx":517 * self.histogram[:] *= value * * def write(self, filename="rdf"): # <<<<<<<<<<<<<< * """ * RDF.write(filename="rdf") */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_13write, 0, __pyx_n_s_RDF_write, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__54); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_write, __pyx_t_3) < 0) __PYX_ERR(0, 517, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_13write, 0, __pyx_n_s_RDF_write, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_tuple__58); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_write, __pyx_t_9) < 0) __PYX_ERR(0, 517, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":552 + /* "newanalysis/gfunction/gfunction.pyx":552 * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n+i])) * * def resetArrays(self): # <<<<<<<<<<<<<< * """ * Reset histogram arrays to zero */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_15resetArrays, 0, __pyx_n_s_RDF_resetArrays, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 552, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_resetArrays, __pyx_t_3) < 0) __PYX_ERR(0, 552, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_15resetArrays, 0, __pyx_n_s_RDF_resetArrays, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 552, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_resetArrays, __pyx_t_9) < 0) __PYX_ERR(0, 552, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":560 + /* "newanalysis/gfunction/gfunction.pyx":560 * * * def printInfo(self): # <<<<<<<<<<<<<< * """ * Print some information about the RDF container. */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_17printInfo, 0, __pyx_n_s_RDF_printInfo, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 560, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_printInfo, __pyx_t_3) < 0) __PYX_ERR(0, 560, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_3RDF_17printInfo, 0, __pyx_n_s_RDF_printInfo, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 560, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_printInfo, __pyx_t_9) < 0) __PYX_ERR(0, 560, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":227 + /* "newanalysis/gfunction/gfunction.pyx":227 * * * class RDF(object): # <<<<<<<<<<<<<< * """ * class RDF */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_RDF, __pyx_tuple__37, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_RDF, __pyx_t_3) < 0) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_RDF, __pyx_t_4, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_RDF, __pyx_t_9) < 0) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/gfunction/gfunction.pyx":765 + /* "newanalysis/gfunction/gfunction.pyx":765 * * * class RDF_voronoi(object): # <<<<<<<<<<<<<< * """ * class RDF */ - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__59); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 765, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__59, __pyx_n_s_RDF_voronoi, __pyx_n_s_RDF_voronoi, (PyObject *) NULL, __pyx_n_s_newanalysis_gfunction, __pyx_kp_s_class_RDF_A_container_object_fo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PEP560_update_bases(__pyx_tuple__63); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_4, __pyx_n_s_RDF_voronoi, __pyx_n_s_RDF_voronoi, (PyObject *) NULL, __pyx_n_s_newanalysis_gfunction, __pyx_kp_s_class_RDF_A_container_object_fo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_4 != __pyx_tuple__63) { + if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_tuple__63) < 0))) __PYX_ERR(0, 765, __pyx_L1_error) + } - /* "src/gfunction/gfunction.pyx":772 + /* "newanalysis/gfunction/gfunction.pyx":772 * """ * * def __init__(self, modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, nshells, box_y=None, box_z=None, use_cuda=False, norm_volume=None, exclude_self_mol=False): # <<<<<<<<<<<<<< * """ * RDF.__init__(modes, histo_min, histo_max, histo_dr, sel1_n, sel2_n, sel1_nmol, sel2_nmol, box_x, box_y=None, box_z=None, use_cuda=False) */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_1__init__, 0, __pyx_n_s_RDF_voronoi___init, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 772, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__62); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 772, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_1__init__, 0, __pyx_n_s_RDF_voronoi___init, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_tuple__66); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_init, __pyx_t_9) < 0) __PYX_ERR(0, 772, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":912 + /* "newanalysis/gfunction/gfunction.pyx":912 * * * def update_box(self,box_x,box_y,box_z): # <<<<<<<<<<<<<< * """ * update_box(box_x,box_y,box_z) */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_3update_box, 0, __pyx_n_s_RDF_voronoi_update_box, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_update_box, __pyx_t_3) < 0) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_3update_box, 0, __pyx_n_s_RDF_voronoi_update_box, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 912, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_update_box, __pyx_t_9) < 0) __PYX_ERR(0, 912, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":932 + /* "newanalysis/gfunction/gfunction.pyx":932 * """ * * def calcFrame(self, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel1, * np.ndarray[np.float64_t,ndim=2,mode="c"] coor_sel2, */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_5calcFrame, 0, __pyx_n_s_RDF_voronoi_calcFrame, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__67); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_calcFrame, __pyx_t_3) < 0) __PYX_ERR(0, 932, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_5calcFrame, 0, __pyx_n_s_RDF_voronoi_calcFrame, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_tuple__49); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_calcFrame, __pyx_t_9) < 0) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":1023 + /* "newanalysis/gfunction/gfunction.pyx":1023 * self.histo_n, self.histo_inv_dr, self.mode_sel, self.nmol1, self.nmol2, self.nshells, delaunay_matrix.data) * * def _addHisto(self,np.ndarray[np.float64_t,ndim=1] histo_out, np.ndarray[np.float64_t,ndim=1] histo): # <<<<<<<<<<<<<< * """ * Add the histograms of all core particles, after they were calculated in parallel. */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_7_addHisto, 0, __pyx_n_s_RDF_voronoi__addHisto, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1023, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_addHisto, __pyx_t_3) < 0) __PYX_ERR(0, 1023, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_7_addHisto, 0, __pyx_n_s_RDF_voronoi__addHisto, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1023, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_addHisto, __pyx_t_9) < 0) __PYX_ERR(0, 1023, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":1051 + /* "newanalysis/gfunction/gfunction.pyx":1051 * histogram_out[k*histo_n*nshells+i*nshells+shell]+=histogram[k*ix2+ix+i*nshells+shell] * * def _normHisto(self): # <<<<<<<<<<<<<< * """ * Normalize the histogram. */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_9_normHisto, 0, __pyx_n_s_RDF_voronoi__normHisto, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_normHisto, __pyx_t_3) < 0) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_9_normHisto, 0, __pyx_n_s_RDF_voronoi__normHisto, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_normHisto, __pyx_t_9) < 0) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":1092 + /* "newanalysis/gfunction/gfunction.pyx":1092 * self.histogram_out[j*self.histo_n*self.nshells+i*self.nshells+shell]/=norm * * def scale(self, value): # <<<<<<<<<<<<<< * self.histogram_out[:] *= value * self.histogram[:] *= value */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_11scale, 0, __pyx_n_s_RDF_voronoi_scale, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1092, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_scale, __pyx_t_3) < 0) __PYX_ERR(0, 1092, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_11scale, 0, __pyx_n_s_RDF_voronoi_scale, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1092, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_scale, __pyx_t_9) < 0) __PYX_ERR(0, 1092, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":1096 + /* "newanalysis/gfunction/gfunction.pyx":1096 * self.histogram[:] *= value * * def write(self, filename="rdf"): # <<<<<<<<<<<<<< * """ * RDF.write(filename="rdf") */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_13write, 0, __pyx_n_s_RDF_voronoi_write, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1096, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__76); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_write, __pyx_t_3) < 0) __PYX_ERR(0, 1096, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_13write, 0, __pyx_n_s_RDF_voronoi_write, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1096, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_tuple__58); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_write, __pyx_t_9) < 0) __PYX_ERR(0, 1096, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":1134 + /* "newanalysis/gfunction/gfunction.pyx":1134 * if self.mode_sel & 64: f022.write("%5.5f\t%5.5f\n" % (r,self.histogram_out[6*self.histo_n*self.nshells+i*self.nshells+shell])) * * def resetArrays(self): # <<<<<<<<<<<<<< * """ * Reset histogram arrays to zero */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_15resetArrays, 0, __pyx_n_s_RDF_voronoi_resetArrays, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_resetArrays, __pyx_t_3) < 0) __PYX_ERR(0, 1134, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_15resetArrays, 0, __pyx_n_s_RDF_voronoi_resetArrays, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__77)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_resetArrays, __pyx_t_9) < 0) __PYX_ERR(0, 1134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":1142 + /* "newanalysis/gfunction/gfunction.pyx":1142 * * * def printInfo(self): # <<<<<<<<<<<<<< * """ * Print some information about the RDF container. */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_17printInfo, 0, __pyx_n_s_RDF_voronoi_printInfo, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_printInfo, __pyx_t_3) < 0) __PYX_ERR(0, 1142, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9gfunction_11RDF_voronoi_17printInfo, 0, __pyx_n_s_RDF_voronoi_printInfo, NULL, __pyx_n_s_newanalysis_gfunction, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_printInfo, __pyx_t_9) < 0) __PYX_ERR(0, 1142, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/gfunction/gfunction.pyx":765 + /* "newanalysis/gfunction/gfunction.pyx":765 * * * class RDF_voronoi(object): # <<<<<<<<<<<<<< * """ * class RDF */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_RDF_voronoi, __pyx_tuple__59, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 765, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_RDF_voronoi, __pyx_t_3) < 0) __PYX_ERR(0, 765, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/gfunction/gfunction.pyx":1 - * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< - * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - * - */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":210 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * def __dealloc__(array self): - */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyType_Modified(__pyx_array_type); - - /* "View.MemoryView":287 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__81, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(generic); - __Pyx_DECREF_SET(generic, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":288 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__82, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(strided); - __Pyx_DECREF_SET(strided, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__83, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(indirect); - __Pyx_DECREF_SET(indirect, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":292 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__84, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(contiguous); - __Pyx_DECREF_SET(contiguous, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":293 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__85, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(indirect_contiguous); - __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":317 - * - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ - * PyThread_allocate_lock(), - */ - __pyx_memoryview_thread_locks_used = 0; - - /* "View.MemoryView":318 - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< - * PyThread_allocate_lock(), - * PyThread_allocate_lock(), - */ - __pyx_t_4[0] = PyThread_allocate_lock(); - __pyx_t_4[1] = PyThread_allocate_lock(); - __pyx_t_4[2] = PyThread_allocate_lock(); - __pyx_t_4[3] = PyThread_allocate_lock(); - __pyx_t_4[4] = PyThread_allocate_lock(); - __pyx_t_4[5] = PyThread_allocate_lock(); - __pyx_t_4[6] = PyThread_allocate_lock(); - __pyx_t_4[7] = PyThread_allocate_lock(); - memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_4, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); - - /* "View.MemoryView":551 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyType_Modified(__pyx_memoryview_type); - - /* "View.MemoryView":997 - * return self.from_object - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyType_Modified(__pyx_memoryviewslice_type); - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_RDF_voronoi, __pyx_t_4, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_RDF_voronoi, __pyx_t_9) < 0) __PYX_ERR(0, 765, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + /* "newanalysis/gfunction/gfunction.pyx":1 + * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< + * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + * */ + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); if (__pyx_m) { - if (__pyx_d) { + if (__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init newanalysis.gfunction", __pyx_clineno, __pyx_lineno, __pyx_filename); } + #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init newanalysis.gfunction"); } @@ -35895,6 +41548,22 @@ if (!__Pyx_RefNanny) { return; #endif } +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ @@ -35914,6 +41583,106 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + /* PyObjectGetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { @@ -35928,10 +41697,32 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject } #endif +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); @@ -35942,101 +41733,599 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } -/* PyObjectSetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else #if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); + PyObject* owned_ref = NULL; #endif - return PyObject_SetAttr(obj, attr_name, value); + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) +} +#endif + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); // transfer ownership of value to values + Py_DECREF(key); +#endif + key = NULL; + value = NULL; + continue; + } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = ( + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key) + ); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + Py_XDECREF(key); + Py_XDECREF(value); + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + Py_XDECREF(key); + Py_XDECREF(value); + return -1; +} + +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; } -#endif - -/* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; } } - level = 0; } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* ImportFrom */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); } - return value; + PyErr_SetObject(type, value); + if (tb) { + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; } +#endif /* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; @@ -36065,7 +42354,6 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args --tstate->recursion_depth; return result; } -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); @@ -36081,7 +42369,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { return NULL; } if ( @@ -36152,7 +42440,6 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, return result; } #endif -#endif /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON @@ -36194,98 +42481,799 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject } #endif -/* PyObjectCallNoArg */ +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) +#else + if (PyCFunction_Check(func)) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + } + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } + } } #endif -#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + #if CYTHON_VECTORCALL + #if Py_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); + } + #endif + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); +} + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* CIntToDigits */ +static const char DIGIT_PAIRS_10[2*10*10+1] = { + "00010203040506070809" + "10111213141516171819" + "20212223242526272829" + "30313233343536373839" + "40414243444546474849" + "50515253545556575859" + "60616263646566676869" + "70717273747576777879" + "80818283848586878889" + "90919293949596979899" +}; +static const char DIGIT_PAIRS_8[2*8*8+1] = { + "0001020304050607" + "1011121314151617" + "2021222324252627" + "3031323334353637" + "4041424344454647" + "5051525354555657" + "6061626364656667" + "7071727374757677" +}; +static const char DIGITS_HEX[2*16+1] = { + "0123456789abcdef" + "0123456789ABCDEF" +}; + +/* BuildPyUnicode */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char) { + PyObject *uval; + Py_ssize_t uoffset = ulength - clength; +#if CYTHON_USE_UNICODE_INTERNALS + Py_ssize_t i; +#if CYTHON_PEP393_ENABLED + void *udata; + uval = PyUnicode_New(ulength, 127); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_DATA(uval); #else - if (likely(PyCFunction_Check(func))) + Py_UNICODE *udata; + uval = PyUnicode_FromUnicode(NULL, ulength); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_AS_UNICODE(uval); #endif + if (uoffset > 0) { + i = 0; + if (prepend_sign) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); + i++; + } + for (; i < uoffset; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); + } + } + for (i=0; i < clength; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); + } +#else { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + PyObject *sign = NULL, *padding = NULL; + uval = NULL; + if (uoffset > 0) { + prepend_sign = !!prepend_sign; + if (uoffset > prepend_sign) { + padding = PyUnicode_FromOrdinal(padding_char); + if (likely(padding) && uoffset > prepend_sign + 1) { + PyObject *tmp; + PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign); + if (unlikely(!repeat)) goto done_or_error; + tmp = PyNumber_Multiply(padding, repeat); + Py_DECREF(repeat); + Py_DECREF(padding); + padding = tmp; + } + if (unlikely(!padding)) goto done_or_error; + } + if (prepend_sign) { + sign = PyUnicode_FromOrdinal('-'); + if (unlikely(!sign)) goto done_or_error; + } + } + uval = PyUnicode_DecodeASCII(chars, clength, NULL); + if (likely(uval) && padding) { + PyObject *tmp = PyNumber_Add(padding, uval); + Py_DECREF(uval); + uval = tmp; + } + if (likely(uval) && sign) { + PyObject *tmp = PyNumber_Add(sign, uval); + Py_DECREF(uval); + uval = tmp; + } +done_or_error: + Py_XDECREF(padding); + Py_XDECREF(sign); + } +#endif + return uval; +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(int)*3+2]; + char *dpos, *end = digits + sizeof(int)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + int remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (int) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (int) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (int) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (Py_ssize_t) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (Py_ssize_t) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (Py_ssize_t) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + CYTHON_MAYBE_UNUSED_VAR(max_char); +#if CYTHON_PEP393_ENABLED + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); +#else + result_uval = PyUnicode_FromUnicode(NULL, result_ulength); + if (unlikely(!result_uval)) return NULL; + result_ukind = sizeof(Py_UNICODE); + kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; + result_udata = PyUnicode_AS_UNICODE(result_uval); +#endif + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); + if (unlikely(__Pyx_PyUnicode_READY(uval))) + goto bad; + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030D0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif + } + char_pos += ulength; + } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; +#else + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + CYTHON_UNUSED_VAR(value_count); + return PyUnicode_Join(__pyx_empty_unicode, value_tuple); +#endif +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } #endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} /* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (meth) { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + Py_ssize_t kwsize; +#if CYTHON_ASSUME_SAFE_MACROS + kwsize = PyTuple_GET_SIZE(kw); +#else + kwsize = PyTuple_Size(kw); + if (kwsize < 0) return 0; +#endif + if (unlikely(kwsize == 0)) + return 1; + if (!kw_allowed) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, 0); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + goto invalid_keyword; + } +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < kwsize; pos++) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } +#endif + return 1; + } + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +/* GetAttr3 */ +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyString_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } +#endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +} + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); } #endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); } - return __Pyx__PyObject_CallOneArg(func, arg); + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); } -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; } -#endif /* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; @@ -36297,21 +43285,46 @@ __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; - #else + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; - #endif Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); + #endif } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; @@ -36332,6 +43345,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); + #endif } #endif @@ -36342,20 +43356,32 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { - PyObject *local_type, *local_value, *local_tb; + PyObject *local_type = NULL, *local_value, *local_tb = NULL; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; + #endif #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) @@ -36377,12 +43403,21 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; + #endif } #else tmp_type = tstate->exc_type; @@ -36409,181 +43444,538 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return -1; } -/* None */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; } +#endif -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) + goto bad; + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) + goto bad; + from_list = empty_list; } #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif + } } +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; + return module; } -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; } else { - num_expected = num_max; - more_or_less = "at most"; + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); } - if (exact) { - more_or_less = "exactly"; + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); +#endif + return imported_module; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; +} +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__3; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; + } + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); + } + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); + } +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); } -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif +/* ssize_strlen */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; } -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; } - name = first_kw_arg; + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + if (likely(PyExceptionClass_Check(t))) { + if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1; } else { - goto invalid_keyword; } } return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; } +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { + if (likely(err == exc_type)) return 1; + if (likely(PyExceptionClass_Check(err))) { + if (likely(PyExceptionClass_Check(exc_type))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); + } else if (likely(PyTuple_Check(exc_type))) { + return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); + } else { + } + } + return PyErr_GivenExceptionMatches(err, exc_type); +} +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { + assert(PyExceptionClass_Check(exc_type1)); + assert(PyExceptionClass_Check(exc_type2)); + if (likely(err == exc_type1 || err == exc_type2)) return 1; + if (likely(PyExceptionClass_Check(err))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); + } + return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); +} +#endif + +/* PySequenceMultiply */ +static PyObject* __Pyx_PySequence_Multiply_Generic(PyObject *seq, Py_ssize_t mul) { + PyObject *result, *pymul = PyInt_FromSsize_t(mul); + if (unlikely(!pymul)) + return NULL; + result = PyNumber_Multiply(seq, pymul); + Py_DECREF(pymul); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul) { +#if CYTHON_USE_TYPE_SLOTS + PyTypeObject *type = Py_TYPE(seq); + if (likely(type->tp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) +#else + if (is_list || PySequence_Check(o)) +#endif + { + return PySequence_SetItem(o, i, v); + } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +} + +/* RaiseUnboundLocalError */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +/* HasAttr */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_GetAttr(o, n); + if (!r) { + PyErr_Clear(); + return 0; + } else { + Py_DECREF(r); + return 1; + } +} + +/* PyObjectSetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#endif /* IsLittleEndian */ static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) @@ -36672,7 +44064,7 @@ static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { case 'P': return "a pointer"; case 's': case 'p': return "a string"; case 0: return "end"; - default: return "unparseable format string"; + default: return "unparsable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { @@ -36722,7 +44114,8 @@ typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); @@ -36754,7 +44147,8 @@ typedef struct { void *x; char c; } __Pyx_pad_void_p; #ifdef HAVE_LONG_LONG typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif -static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); @@ -36886,745 +44280,350 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { } ctx->fmt_offset += size; if (arraysize) - ctx->fmt_offset += (arraysize - 1) * size; - --ctx->enc_count; - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - break; - } - ctx->head->field = ++field; - if (field->type == NULL) { - --ctx->head; - field = ctx->head->field; - continue; - } else if (field->type->typegroup == 'S') { - size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; - field = field->type->fields; - ++ctx->head; - ctx->head->field = field; - ctx->head->parent_offset = parent_offset; - break; - } else { - break; - } - } - } while (ctx->enc_count); - ctx->enc_type = 0; - ctx->is_complex = 0; - return 0; -} -static PyObject * -__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) -{ - const char *ts = *tsp; - int i = 0, number, ndim; - ++ts; - if (ctx->new_count != 1) { - PyErr_SetString(PyExc_ValueError, - "Cannot handle repeated arrays in format string"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ndim = ctx->head->field->type->ndim; - while (*ts && *ts != ')') { - switch (*ts) { - case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; - default: break; - } - number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) - return PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %d", - ctx->head->field->type->arraysize[i], number); - if (*ts != ',' && *ts != ')') - return PyErr_Format(PyExc_ValueError, - "Expected a comma in format string, got '%c'", *ts); - if (*ts == ',') ts++; - i++; - } - if (i != ndim) - return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", - ctx->head->field->type->ndim, i); - if (!*ts) { - PyErr_SetString(PyExc_ValueError, - "Unexpected end of format string, expected ')'"); - return NULL; - } - ctx->is_valid_array = 1; - ctx->new_count = 1; - *tsp = ++ts; - return Py_None; -} -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { - int got_Z = 0; - while (1) { - switch(*ts) { - case 0: - if (ctx->enc_type != 0 && ctx->head == NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - if (ctx->head != NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - return ts; - case ' ': - case '\r': - case '\n': - ++ts; - break; - case '<': - if (!__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '=': - case '@': - case '^': - ctx->new_packmode = *ts++; - break; - case 'T': - { - const char* ts_after_sub; - size_t i, struct_count = ctx->new_count; - size_t struct_alignment = ctx->struct_alignment; - ctx->new_count = 1; - ++ts; - if (*ts != '{') { - PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - ctx->enc_count = 0; - ctx->struct_alignment = 0; - ++ts; - ts_after_sub = ts; - for (i = 0; i != struct_count; ++i) { - ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); - if (!ts_after_sub) return NULL; - } - ts = ts_after_sub; - if (struct_alignment) ctx->struct_alignment = struct_alignment; - } - break; - case '}': - { - size_t alignment = ctx->struct_alignment; - ++ts; - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - if (alignment && ctx->fmt_offset % alignment) { - ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); - } - } - return ts; - case 'x': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->fmt_offset += ctx->new_count; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->enc_packmode = ctx->new_packmode; - ++ts; - break; - case 'Z': - got_Z = 1; - ++ts; - if (*ts != 'f' && *ts != 'd' && *ts != 'g') { - __Pyx_BufFmt_RaiseUnexpectedChar('Z'); - return NULL; - } - CYTHON_FALLTHROUGH; - case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': - case 'l': case 'L': case 'q': case 'Q': - case 'f': case 'd': case 'g': - case 'O': case 'p': - if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && - (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { - ctx->enc_count += ctx->new_count; - ctx->new_count = 1; - got_Z = 0; - ++ts; - break; - } - CYTHON_FALLTHROUGH; - case 's': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_count = ctx->new_count; - ctx->enc_packmode = ctx->new_packmode; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; - ++ts; - ctx->new_count = 1; - got_Z = 0; - break; - case ':': - ++ts; - while(*ts != ':') ++ts; - ++ts; - break; - case '(': - if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; - break; - default: - { - int number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - ctx->new_count = (size_t)number; - } - } - } -} - -/* BufferGetAndValidate */ - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (unlikely(info->buf == NULL)) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); -} -static void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; -} -static int __Pyx__GetBufferAndValidate( - Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, - int nd, int cast, __Pyx_BufFmt_StackElem* stack) -{ - buf->buf = NULL; - if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { - __Pyx_ZeroBuffer(buf); - return -1; - } - if (unlikely(buf->ndim != nd)) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - nd, buf->ndim); - goto fail; - } - if (!cast) { - __Pyx_BufFmt_Context ctx; - __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; - } - if (unlikely((size_t)buf->itemsize != dtype->size)) { - PyErr_Format(PyExc_ValueError, - "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", - buf->itemsize, (buf->itemsize > 1) ? "s" : "", - dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); - goto fail; - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_SafeReleaseBuffer(buf); - return -1; -} - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* WriteUnraisableException */ - static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); - else state = (PyGILState_STATE)0; -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); - } - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); -#endif -} - -/* MemviewSliceInit */ - static int -__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference) -{ - __Pyx_RefNannyDeclarations - int i, retval=-1; - Py_buffer *buf = &memview->view; - __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (unlikely(memviewslice->memview || memviewslice->data)) { - PyErr_SetString(PyExc_ValueError, - "memviewslice is already initialized!"); - goto fail; - } - if (buf->strides) { - for (i = 0; i < ndim; i++) { - memviewslice->strides[i] = buf->strides[i]; - } - } else { - Py_ssize_t stride = buf->itemsize; - for (i = ndim - 1; i >= 0; i--) { - memviewslice->strides[i] = stride; - stride *= buf->shape[i]; - } - } - for (i = 0; i < ndim; i++) { - memviewslice->shape[i] = buf->shape[i]; - if (buf->suboffsets) { - memviewslice->suboffsets[i] = buf->suboffsets[i]; - } else { - memviewslice->suboffsets[i] = -1; - } - } - memviewslice->memview = memview; - memviewslice->data = (char *)buf->buf; - if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { - Py_INCREF(memview); - } - retval = 0; - goto no_fail; -fail: - memviewslice->memview = 0; - memviewslice->data = 0; - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; -} -#ifndef Py_NO_RETURN -#define Py_NO_RETURN -#endif -static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { - va_list vargs; - char msg[200]; -#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) - va_start(vargs, fmt); -#else - va_start(vargs); -#endif - vsnprintf(msg, 200, fmt, vargs); - va_end(vargs); - Py_FatalError(msg); -} -static CYTHON_INLINE int -__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)++; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE int -__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)--; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE void -__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) -{ - int first_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) - return; - if (unlikely(__pyx_get_slice_count(memview) < 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - first_time = __pyx_add_acquisition_count(memview) == 0; - if (unlikely(first_time)) { - if (have_gil) { - Py_INCREF((PyObject *) memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_INCREF((PyObject *) memview); - PyGILState_Release(_gilstate); - } - } -} -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, - int have_gil, int lineno) { - int last_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) { - memslice->memview = NULL; - return; - } - if (unlikely(__pyx_get_slice_count(memview) <= 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - last_time = __pyx_sub_acquisition_count(memview) == 1; - memslice->data = NULL; - if (unlikely(last_time)) { - if (have_gil) { - Py_CLEAR(memslice->memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_CLEAR(memslice->memview); - PyGILState_Release(_gilstate); - } - } else { - memslice->memview = NULL; - } -} - -/* PyDictVersioning */ - #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif - -/* GetModuleGlobalName */ - #if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} - -/* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } -#endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; + break; + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } } -#endif + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; } - -/* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; +static int +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number, ndim; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return -1; } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return -1; + ndim = ctx->head->field->type->ndim; + while (*ts && *ts != ')') { + switch (*ts) { + case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; + default: break; + } + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return -1; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) + } + if (*ts != ',' && *ts != ')') { + PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); + } + if (*ts == ',') ts++; + i++; } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; + if (i != ndim) { + PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + return -1; + } + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return -1; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return 0; +} +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; } -#if CYTHON_USE_UNICODE_INTERNALS + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case '\r': + case '\n': + ++ts; + break; + case '<': + if (!__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; - #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; } -#endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; + break; + case '}': + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } + CYTHON_FALLTHROUGH; + case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 'p': + if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && + (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { + ctx->enc_count += ctx->new_count; + ctx->new_count = 1; + got_Z = 0; + ++ts; + break; + } + CYTHON_FALLTHROUGH; + case 's': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (__pyx_buffmt_parse_array(ctx, &ts) < 0) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif + } +} + +/* BufferGetAndValidate */ + static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (unlikely(info->buf == NULL)) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} +static void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} +static int __Pyx__GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + buf->buf = NULL; + if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { + __Pyx_ZeroBuffer(buf); + return -1; + } + if (unlikely(buf->ndim != nd)) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if (unlikely((size_t)buf->itemsize != dtype->size)) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_SafeReleaseBuffer(buf); + return -1; } /* PyFloatBinop */ #if !CYTHON_COMPILING_IN_PYPY -#define __Pyx_PyFloat_DivideCObj_ZeroDivisionError(operand) if (unlikely(zerodivision_check && ((operand) == 0))) {\ - PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");\ - return NULL;\ -} -static PyObject* __Pyx_PyFloat_DivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) { +static PyObject* __Pyx_PyFloat_TrueDivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) { const double a = floatval; double b, result; - (void)inplace; - (void)zerodivision_check; + CYTHON_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); if (likely(PyFloat_CheckExact(op2))) { +#if CYTHON_COMPILING_IN_LIMITED_API + b = __pyx_PyFloat_AsDouble(op2); +#else b = PyFloat_AS_DOUBLE(op2); - __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b) +#endif + if (unlikely(zerodivision_check && ((b) == 0.0))) { PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero"); return NULL;} } else #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op2))) { b = (double) PyInt_AS_LONG(op2); - __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b) + if (unlikely(zerodivision_check && ((b) == 0.0))) { PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero"); return NULL;} } else #endif if (likely(PyLong_CheckExact(op2))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)op2)->ob_digit; - const Py_ssize_t size = Py_SIZE(op2); - switch (size) { - case 0: __Pyx_PyFloat_DivideCObj_ZeroDivisionError(0) break; - case -1: b = -(double) digits[0]; break; - case 1: b = (double) digits[0]; break; - case -2: - case 2: - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) { - b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -2) - b = -b; - break; + if (__Pyx_PyLong_IsZero(op2)) { + b = 0.0; + if (unlikely(zerodivision_check && ((b) == 0.0))) { PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero"); return NULL;} + } else if (__Pyx_PyLong_IsCompact(op2)) { + b = (double) __Pyx_PyLong_CompactValue(op2); + } else { + const digit* digits = __Pyx_PyLong_Digits(op2); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op2); + switch (size) { + case -2: + case 2: + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) { + b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -2) + b = -b; + break; + } } - } - CYTHON_FALLTHROUGH; - case -3: - case 3: - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) { - b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -3) - b = -b; - break; + CYTHON_FALLTHROUGH; + case -3: + case 3: + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) { + b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -3) + b = -b; + break; + } } - } - CYTHON_FALLTHROUGH; - case -4: - case 4: - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) { - b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -4) - b = -b; - break; + CYTHON_FALLTHROUGH; + case -4: + case 4: + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) { + b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -4) + b = -b; + break; + } } - } - CYTHON_FALLTHROUGH; - default: - #else - { + CYTHON_FALLTHROUGH; + default: #endif - b = PyLong_AsDouble(op2); - if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL; - __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b) + b = PyLong_AsDouble(op2); + if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL; + #if !CYTHON_USE_PYLONG_INTERNALS + if (unlikely(zerodivision_check && ((b) == 0.0))) { PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero"); return NULL;} + #endif + #if CYTHON_USE_PYLONG_INTERNALS + } } + #endif } else { - return (inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2)); + return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2); } - __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b) PyFPE_START_PROTECT("divide", return NULL) result = a / b; PyFPE_END_PROTECT(result) @@ -37633,14 +44632,18 @@ static PyObject* __Pyx_PyFloat_DivideCObj(PyObject *op1, PyObject *op2, double f #endif /* PyFloatBinop */ - #if !CYTHON_COMPILING_IN_PYPY + #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) { const double b = floatval; double a, result; - (void)inplace; - (void)zerodivision_check; + CYTHON_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); if (likely(PyFloat_CheckExact(op1))) { +#if CYTHON_COMPILING_IN_LIMITED_API + a = __pyx_PyFloat_AsDouble(op1); +#else a = PyFloat_AS_DOUBLE(op1); +#endif } else #if PY_MAJOR_VERSION < 3 @@ -37651,57 +44654,59 @@ static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floa #endif if (likely(PyLong_CheckExact(op1))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - switch (size) { - case 0: a = 0.0; break; - case -1: a = -(double) digits[0]; break; - case 1: a = (double) digits[0]; break; - case -2: - case 2: - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) { - a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -2) - a = -a; - break; + if (__Pyx_PyLong_IsZero(op1)) { + a = 0.0; + + } else if (__Pyx_PyLong_IsCompact(op1)) { + a = (double) __Pyx_PyLong_CompactValue(op1); + } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); + switch (size) { + case -2: + case 2: + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) { + a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -2) + a = -a; + break; + } } - } - CYTHON_FALLTHROUGH; - case -3: - case 3: - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) { - a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -3) - a = -a; - break; + CYTHON_FALLTHROUGH; + case -3: + case 3: + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) { + a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -3) + a = -a; + break; + } } - } - CYTHON_FALLTHROUGH; - case -4: - case 4: - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) { - a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -4) - a = -a; - break; + CYTHON_FALLTHROUGH; + case -4: + case 4: + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) { + a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -4) + a = -a; + break; + } } - } - CYTHON_FALLTHROUGH; - default: - #else - { + CYTHON_FALLTHROUGH; + default: #endif - a = PyLong_AsDouble(op1); - if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL; - + a = PyLong_AsDouble(op1); + if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL; + #if CYTHON_USE_PYLONG_INTERNALS + } } + #endif } else { return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); } - PyFPE_START_PROTECT("add", return NULL) result = a + b; PyFPE_END_PROTECT(result) @@ -37709,64 +44714,19 @@ static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floa } #endif -/* SetItemInt */ - static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, - CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { - PyObject* old = PyList_GET_ITEM(o, n); - Py_INCREF(v); - PyList_SET_ITEM(o, n, v); - Py_DECREF(old); - return 1; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_ass_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return -1; - PyErr_Clear(); - } - } - return m->sq_ass_item(o, i, v); - } - } -#else -#if CYTHON_COMPILING_IN_PYPY - if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) -#else - if (is_list || PySequence_Check(o)) -#endif - { - return PySequence_SetItem(o, i, v); - } -#endif - return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); -} - /* PyFloatBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) { + #if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) { const double b = floatval; double a, result; - (void)inplace; - (void)zerodivision_check; + CYTHON_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); if (likely(PyFloat_CheckExact(op1))) { +#if CYTHON_COMPILING_IN_LIMITED_API + a = __pyx_PyFloat_AsDouble(op1); +#else a = PyFloat_AS_DOUBLE(op1); +#endif } else #if PY_MAJOR_VERSION < 3 @@ -37777,162 +44737,226 @@ static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double f #endif if (likely(PyLong_CheckExact(op1))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - switch (size) { - case 0: a = 0.0; break; - case -1: a = -(double) digits[0]; break; - case 1: a = (double) digits[0]; break; - case -2: - case 2: - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) { - a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -2) - a = -a; + if (__Pyx_PyLong_IsZero(op1)) { + a = 0.0; + + } else if (__Pyx_PyLong_IsCompact(op1)) { + a = (double) __Pyx_PyLong_CompactValue(op1); + } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); + switch (size) { + case -2: + case 2: + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) { + a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -2) + a = -a; + break; + } + } + CYTHON_FALLTHROUGH; + case -3: + case 3: + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) { + a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -3) + a = -a; + break; + } + } + CYTHON_FALLTHROUGH; + case -4: + case 4: + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) { + a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -4) + a = -a; + break; + } + } + CYTHON_FALLTHROUGH; + default: + #endif + a = PyLong_AsDouble(op1); + if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL; + #if CYTHON_USE_PYLONG_INTERNALS + } + } + #endif + } else { + return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2); + } + PyFPE_START_PROTECT("divide", return NULL) + result = a / b; + PyFPE_END_PROTECT(result) + return PyFloat_FromDouble(result); +} +#endif + +/* PyIntBinop */ + #if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_MultiplyObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op1))) { + const long b = intval; + long a = PyInt_AS_LONG(op1); + +#ifdef HAVE_LONG_LONG + if (sizeof(PY_LONG_LONG) > sizeof(long)) { + PY_LONG_LONG result = (PY_LONG_LONG)a * (PY_LONG_LONG)b; + return (result >= LONG_MIN && result <= LONG_MAX) ? + PyInt_FromLong((long)result) : PyLong_FromLongLong(result); + } +#endif +#if CYTHON_USE_TYPE_SLOTS + return PyInt_Type.tp_as_number->nb_multiply(op1, op2); +#else + return PyNumber_Multiply(op1, op2); +#endif + } + #endif + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + const long b = intval; + long a, x; +#ifdef HAVE_LONG_LONG + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla, llx; +#endif + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op1); + } + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); + } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); + switch (size) { + case -2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) { + a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) { + lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) { + lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif } - } - CYTHON_FALLTHROUGH; - case -3: - case 3: - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) { - a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -3) - a = -a; + CYTHON_FALLTHROUGH; + case -3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) { + a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) { + lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif } - } - CYTHON_FALLTHROUGH; - case -4: - case 4: - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) { - a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -4) - a = -a; + CYTHON_FALLTHROUGH; + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) { + lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif } - } - CYTHON_FALLTHROUGH; - default: - #else - { - #endif - a = PyLong_AsDouble(op1); - if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL; - + CYTHON_FALLTHROUGH; + case -4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) { + a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) { + lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) { + lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + default: return PyLong_Type.tp_as_number->nb_multiply(op1, op2); + } } - } else { - return (inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2)); - } - - PyFPE_START_PROTECT("divide", return NULL) - result = a / b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); -} + CYTHON_UNUSED_VAR(a); + CYTHON_UNUSED_VAR(b); + #ifdef HAVE_LONG_LONG + lla = a; + goto long_long; + #else + return PyLong_Type.tp_as_number->nb_multiply(op1, op2); + #endif + return PyLong_FromLong(x); +#ifdef HAVE_LONG_LONG + long_long: + llx = lla * llb; + return PyLong_FromLongLong(llx); #endif - -/* GetItemInt */ - static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; + + } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); #else - return PySequence_GetItem(o, i); + double a = PyFloat_AS_DOUBLE(op1); #endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyTuple_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; + double result; + + PyFPE_START_PROTECT("multiply", return NULL) + result = ((double)a) * (double)b; + PyFPE_END_PROTECT(result) + return PyFloat_FromDouble(result); } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif + return (inplace ? PyNumber_InPlaceMultiply : PyNumber_Multiply)(op1, op2); } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } #endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} /* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; + #if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long x; long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); + + x = (long)((unsigned long)a + (unsigned long)b); if (likely((x^a) >= 0 || (x^b) >= 0)) return PyInt_FromLong(x); return PyLong_Type.tp_as_number->nb_add(op1, op2); @@ -37946,77 +44970,79 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED const PY_LONG_LONG llb = intval; PY_LONG_LONG lla, llx; #endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op2); + } + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); switch (size) { case -2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; default: return PyLong_Type.tp_as_number->nb_add(op1, op2); @@ -38035,8 +45061,13 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED #endif if (PyFloat_CheckExact(op1)) { const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else double a = PyFloat_AS_DOUBLE(op1); +#endif double result; + PyFPE_START_PROTECT("add", return NULL) result = ((double)a) + (double)b; PyFPE_END_PROTECT(result) @@ -38046,190 +45077,17 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED } #endif -/* ArgTypeTest */ - static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#endif - } -bad: - Py_XDECREF(owned_instance); - return; +/* PyObjectCall2Args */ + static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } -#endif /* PyObjectGetMethod */ - static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { PyObject *attr; #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; descrgetfunc f = NULL; @@ -38246,11 +45104,13 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject descr = _PyType_Lookup(tp, name); if (likely(descr != NULL)) { Py_INCREF(descr); -#if PY_MAJOR_VERSION >= 3 +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) #else - if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type))) + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) #endif #else #ifdef __Pyx_CyFunction_USED @@ -38291,18 +45151,20 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_DECREF(descr); goto try_unpack; } - if (descr != NULL) { + if (likely(descr != NULL)) { *method = descr; return 0; } + type_name = __Pyx_PyType_GetName(tp); PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, name); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(name)); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); #endif + __Pyx_DECREF_TypeName(type_name); return 0; #else attr = __Pyx_PyObject_GetAttrStr(obj, name); @@ -38323,7 +45185,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } /* PyObjectCallMethod1 */ - static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); Py_DECREF(method); return result; @@ -38341,7 +45203,7 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name } /* append */ - static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { if (likely(PyList_CheckExact(L))) { if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; } else { @@ -38353,30 +45215,164 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name return 0; } -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; +/* pybytes_as_double */ + static double __Pyx_SlowPyString_AsDouble(PyObject *obj) { + PyObject *float_value; +#if PY_MAJOR_VERSION >= 3 + float_value = PyFloat_FromString(obj); +#else + float_value = PyFloat_FromString(obj, 0); +#endif + if (likely(float_value)) { + double value = PyFloat_AS_DOUBLE(float_value); + Py_DECREF(float_value); + return value; } - if (likely(__Pyx_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; + return (double)-1; +} +static const char* __Pyx__PyBytes_AsDouble_Copy(const char* start, char* buffer, Py_ssize_t length) { + int last_was_punctuation = 1; + Py_ssize_t i; + for (i=0; i < length; i++) { + char chr = start[i]; + int is_punctuation = (chr == '_') | (chr == '.') | (chr == 'e') | (chr == 'E'); + *buffer = chr; + buffer += (chr != '_'); + if (unlikely(last_was_punctuation & is_punctuation)) goto parse_failure; + last_was_punctuation = is_punctuation; + } + if (unlikely(last_was_punctuation)) goto parse_failure; + *buffer = '\0'; + return buffer; +parse_failure: + return NULL; +} +static double __Pyx__PyBytes_AsDouble_inf_nan(const char* start, Py_ssize_t length) { + int matches = 1; + char sign = start[0]; + int is_signed = (sign == '+') | (sign == '-'); + start += is_signed; + length -= is_signed; + switch (start[0]) { + #ifdef Py_NAN + case 'n': + case 'N': + if (unlikely(length != 3)) goto parse_failure; + matches &= (start[1] == 'a' || start[1] == 'A'); + matches &= (start[2] == 'n' || start[2] == 'N'); + if (unlikely(!matches)) goto parse_failure; + return (sign == '-') ? -Py_NAN : Py_NAN; + #endif + case 'i': + case 'I': + if (unlikely(length < 3)) goto parse_failure; + matches &= (start[1] == 'n' || start[1] == 'N'); + matches &= (start[2] == 'f' || start[2] == 'F'); + if (likely(length == 3 && matches)) + return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL; + if (unlikely(length != 8)) goto parse_failure; + matches &= (start[3] == 'i' || start[3] == 'I'); + matches &= (start[4] == 'n' || start[4] == 'N'); + matches &= (start[5] == 'i' || start[5] == 'I'); + matches &= (start[6] == 't' || start[6] == 'T'); + matches &= (start[7] == 'y' || start[7] == 'Y'); + if (unlikely(!matches)) goto parse_failure; + return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL; + case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + break; + default: + goto parse_failure; + } + return 0.0; +parse_failure: + return -1.0; +} +static CYTHON_INLINE int __Pyx__PyBytes_AsDouble_IsSpace(char ch) { + return (ch == 0x20) | !((ch < 0x9) | (ch > 0xd)); +} +CYTHON_UNUSED static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length) { + double value; + Py_ssize_t i, digits; + const char *last = start + length; + char *end; + while (__Pyx__PyBytes_AsDouble_IsSpace(*start)) + start++; + while (start < last - 1 && __Pyx__PyBytes_AsDouble_IsSpace(last[-1])) + last--; + length = last - start; + if (unlikely(length <= 0)) goto fallback; + value = __Pyx__PyBytes_AsDouble_inf_nan(start, length); + if (unlikely(value == -1.0)) goto fallback; + if (value != 0.0) return value; + digits = 0; + for (i=0; i < length; digits += start[i++] != '_'); + if (likely(digits == length)) { + value = PyOS_string_to_double(start, &end, NULL); + } else if (digits < 40) { + char number[40]; + last = __Pyx__PyBytes_AsDouble_Copy(start, number, length); + if (unlikely(!last)) goto fallback; + value = PyOS_string_to_double(number, &end, NULL); + } else { + char *number = (char*) PyMem_Malloc((digits + 1) * sizeof(char)); + if (unlikely(!number)) goto fallback; + last = __Pyx__PyBytes_AsDouble_Copy(start, number, length); + if (unlikely(!last)) { + PyMem_Free(number); + goto fallback; + } + value = PyOS_string_to_double(number, &end, NULL); + PyMem_Free(number); + } + if (likely(end == last) || (value == (double)-1 && PyErr_Occurred())) { + return value; + } +fallback: + return __Pyx_SlowPyString_AsDouble(obj); +} + +/* pynumber_float */ + static CYTHON_INLINE PyObject* __Pyx__PyNumber_Float(PyObject* obj) { + double val; + if (PyLong_CheckExact(obj)) { +#if CYTHON_USE_PYLONG_INTERNALS + if (likely(__Pyx_PyLong_IsCompact(obj))) { + val = (double) __Pyx_PyLong_CompactValue(obj); + goto no_error; + } +#endif + val = PyLong_AsDouble(obj); + } else if (PyUnicode_CheckExact(obj)) { + val = __Pyx_PyUnicode_AsDouble(obj); + } else if (PyBytes_CheckExact(obj)) { + val = __Pyx_PyBytes_AsDouble(obj); + } else if (PyByteArray_CheckExact(obj)) { + val = __Pyx_PyByteArray_AsDouble(obj); + } else { + return PyNumber_Float(obj); + } + if (unlikely(val == -1 && PyErr_Occurred())) { + return NULL; + } +#if CYTHON_USE_PYLONG_INTERNALS +no_error: +#endif + return PyFloat_FromDouble(val); } /* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; + #if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long x; long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a - b); + + x = (long)((unsigned long)a - (unsigned long)b); if (likely((x^a) >= 0 || (x^~b) >= 0)) return PyInt_FromLong(x); return PyLong_Type.tp_as_number->nb_subtract(op1, op2); @@ -38390,77 +45386,79 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U const PY_LONG_LONG llb = intval; PY_LONG_LONG lla, llx; #endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return PyLong_FromLong(-intval); + } + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); switch (size) { case -2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); @@ -38479,8 +45477,13 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U #endif if (PyFloat_CheckExact(op1)) { const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else double a = PyFloat_AS_DOUBLE(op1); +#endif double result; + PyFPE_START_PROTECT("subtract", return NULL) result = ((double)a) - (double)b; PyFPE_END_PROTECT(result) @@ -38490,44 +45493,17 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U } #endif -/* ObjectGetItem */ - #if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr = NULL; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); - } - return __Pyx_PyObject_GetIndex(obj, key); -} -#endif - /* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; + #if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long a = PyInt_AS_LONG(op1); + return PyInt_FromLong(a & b); } #endif @@ -38539,102 +45515,257 @@ static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED const PY_LONG_LONG llb = intval; PY_LONG_LONG lla, llx; #endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; + if ((intval & PyLong_MASK) == intval) { + long last_digit = (long) __Pyx_PyLong_Digits(op1)[0]; + long result = intval & (likely(__Pyx_PyLong_IsPos(op1)) ? last_digit : (PyLong_MASK - last_digit + 1)); + return PyLong_FromLong(result); + } + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op1); + } + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); switch (size) { case -2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif + } + CYTHON_FALLTHROUGH; + case -3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case -4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + default: return PyLong_Type.tp_as_number->nb_and(op1, op2); + } + } + x = a & b; + return PyLong_FromLong(x); +#ifdef HAVE_LONG_LONG + long_long: + llx = lla & llb; + return PyLong_FromLongLong(llx); +#endif + + + } + #endif + return (inplace ? PyNumber_InPlaceAnd : PyNumber_And)(op1, op2); +} +#endif + +/* PyIntBinop */ + #if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op2))) { + const long a = intval; + long b = PyInt_AS_LONG(op2); + +#ifdef HAVE_LONG_LONG + if (sizeof(PY_LONG_LONG) > sizeof(long)) { + PY_LONG_LONG result = (PY_LONG_LONG)a * (PY_LONG_LONG)b; + return (result >= LONG_MIN && result <= LONG_MAX) ? + PyInt_FromLong((long)result) : PyLong_FromLongLong(result); + } +#endif +#if CYTHON_USE_TYPE_SLOTS + return PyInt_Type.tp_as_number->nb_multiply(op1, op2); +#else + return PyNumber_Multiply(op1, op2); +#endif + } + #endif + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op2))) { + const long a = intval; + long b, x; +#ifdef HAVE_LONG_LONG + const PY_LONG_LONG lla = intval; + PY_LONG_LONG llb, llx; +#endif + if (unlikely(__Pyx_PyLong_IsZero(op2))) { + return __Pyx_NewRef(op2); + } + if (likely(__Pyx_PyLong_IsCompact(op2))) { + b = __Pyx_PyLong_CompactValue(op2); + } else { + const digit* digits = __Pyx_PyLong_Digits(op2); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op2); + switch (size) { + case -2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) { + b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) { + llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) { + b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) { + llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif } CYTHON_FALLTHROUGH; case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) { + b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) { + llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) { + b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) { + llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) { + b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) { + llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) { + b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) { + llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_and(op1, op2); + default: return PyLong_Type.tp_as_number->nb_multiply(op1, op2); } } - x = a & b; + CYTHON_UNUSED_VAR(a); + CYTHON_UNUSED_VAR(b); + #ifdef HAVE_LONG_LONG + llb = b; + goto long_long; + #else + return PyLong_Type.tp_as_number->nb_multiply(op1, op2); + #endif return PyLong_FromLong(x); #ifdef HAVE_LONG_LONG long_long: - llx = lla & llb; + llx = lla * llb; return PyLong_FromLongLong(llx); #endif } #endif - return (inplace ? PyNumber_InPlaceAnd : PyNumber_And)(op1, op2); + if (PyFloat_CheckExact(op2)) { + const long a = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double b = __pyx_PyFloat_AsDouble(op2); +#else + double b = PyFloat_AS_DOUBLE(op2); +#endif + double result; + + PyFPE_START_PROTECT("multiply", return NULL) + result = ((double)a) * (double)b; + PyFPE_END_PROTECT(result) + return PyFloat_FromDouble(result); + } + return (inplace ? PyNumber_InPlaceMultiply : PyNumber_Multiply)(op1, op2); } #endif /* SliceObject */ - static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value, + static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop, PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { + int has_cstart, int has_cstop, int wraparound) { + __Pyx_TypeName obj_type_name; #if CYTHON_USE_TYPE_SLOTS PyMappingMethods* mp; #if PY_MAJOR_VERSION < 3 @@ -38673,9 +45804,13 @@ static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED } return ms->sq_ass_slice(obj, cstart, cstop, value); } +#else + CYTHON_UNUSED_VAR(wraparound); #endif mp = Py_TYPE(obj)->tp_as_mapping; if (likely(mp && mp->mp_ass_subscript)) +#else + CYTHON_UNUSED_VAR(wraparound); #endif { int result; @@ -38721,305 +45856,36 @@ static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED } return result; } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); PyErr_Format(PyExc_TypeError, - "'%.200s' object does not support slice %.10s", - Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion"); + "'" __Pyx_FMT_TYPENAME "' object does not support slice %.10s", + obj_type_name, value ? "assignment" : "deletion"); + __Pyx_DECREF_TypeName(obj_type_name); bad: return -1; } /* DivInt[int] */ - static CYTHON_INLINE int __Pyx_div_int(int a, int b) { + static CYTHON_INLINE int __Pyx_div_int(int a, int b) { int q = a / b; int r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } -/* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; icurexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); -} -#endif - -/* DivInt[Py_ssize_t] */ - static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { - Py_ssize_t q = a / b; - Py_ssize_t r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -/* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) -#else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); -#endif - return PyObject_GetAttr(o, n); -} - -/* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; - } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - } - if (unlikely(stop <= start)) - return __Pyx_NewRef(__pyx_empty_unicode); - length = stop - start; - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); - } -} - -/* GetAttr3 */ - static PyObject *__Pyx_GetAttr3Default(PyObject *d) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(d); - return d; -} -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r = __Pyx_GetAttr(o, n); - return (likely(r)) ? r : __Pyx_GetAttr3Default(d); -} - -/* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -/* SwapException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = *type; - exc_info->exc_value = *value; - exc_info->exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#endif - -/* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } - return res; -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif + __Pyx_DECREF_TypeName(type_name); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { @@ -39050,7 +45916,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj #endif /* PyObject_GenericGetAttr */ - #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { return PyObject_GenericGetAttr(obj, attr_name); @@ -39059,16 +45925,278 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam } #endif +/* FixUpExtensionType */ + #if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; + } + if (changed) + PyType_Modified(type); + } +#endif + return 0; +} +#endif + +/* PyObjectCallNoArg */ + static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectCallMethod0 */ + static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +} + +/* ValidateBasesTuple */ + #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_MACROS + n = PyTuple_GET_SIZE(bases); +#else + n = PyTuple_Size(bases); + if (n < 0) return -1; +#endif + for (i = 1; i < n; i++) + { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#if !CYTHON_USE_TYPE_SLOTS + if (dictoffset == 0) { + PyErr_Format(PyExc_TypeError, + "extension type '%s.200s': " + "unable to validate whether bases have a __dict__ " + "when CYTHON_USE_TYPE_SLOTS is off " + "(likely because you are building in the limited API). " + "Therefore, all extension types with multiple bases " + "must add 'cdef dict __dict__' in this compilation mode", + type_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#else + if (dictoffset == 0 && b->tp_dictoffset) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + } + return 0; +} +#endif + +/* PyType_Ready */ + static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + /* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 + static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) #else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) #endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) goto bad; Py_DECREF(ob); return 0; @@ -39077,33 +46205,85 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam return -1; } -/* PyObjectGetAttrStrNoError */ - static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } +/* GetVTable */ + static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); #endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i; + void** base_vtables; + __Pyx_TypeName tp_base_name; + __Pyx_TypeName base_name; + void* unknown = (void*)-1; + PyObject* bases = type->tp_bases; + int base_depth = 0; + { + PyTypeObject* base = type->tp_base; + while (base) { + base_depth += 1; + base = base->tp_base; + } + } + base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; + for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { + void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); + if (base_vtable != NULL) { + int j; + PyTypeObject* base = type->tp_base; + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = base->tp_base; + } + } } - return result; + PyErr_Clear(); + free(base_vtables); + return 0; +bad: + tp_base_name = __Pyx_PyType_GetName(type->tp_base); + base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); + free(base_vtables); + return -1; } +#endif /* SetupReduce */ - static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { @@ -39169,7 +46349,7 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } else if (reduce == object_reduce || PyErr_Occurred()) { goto __PYX_BAD; } - setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); @@ -39185,8 +46365,13 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } goto __PYX_GOOD; __PYX_BAD: - if (!PyErr_Occurred()) - PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } ret = -1; __PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP @@ -39202,18 +46387,19 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { Py_XDECREF(setstate_cython); return ret; } +#endif /* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size) + #ifndef __PYX_HAVE_RT_ImportType_3_0_2 +#define __PYX_HAVE_RT_ImportType_3_0_2 +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; Py_ssize_t itemsize; -#ifdef Py_LIMITED_API +#if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; PyObject *py_itemsize; #endif @@ -39226,7 +46412,7 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, module_name, class_name); goto bad; } -#ifndef Py_LIMITED_API +#if !CYTHON_COMPILING_IN_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; itemsize = ((PyTypeObject *)result)->tp_itemsize; #else @@ -39258,17 +46444,18 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_2 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_2 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -39282,12 +46469,91 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, } #endif +/* Py3UpdateBases */ + static PyObject* +__Pyx_PEP560_update_bases(PyObject *bases) +{ + Py_ssize_t i, j, size_bases; + PyObject *base, *meth, *new_base, *result, *new_bases = NULL; + size_bases = PyTuple_GET_SIZE(bases); + for (i = 0; i < size_bases; i++) { + base = PyTuple_GET_ITEM(bases, i); + if (PyType_Check(base)) { + if (new_bases) { + if (PyList_Append(new_bases, base) < 0) { + goto error; + } + } + continue; + } + meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_n_s_mro_entries); + if (!meth && PyErr_Occurred()) { + goto error; + } + if (!meth) { + if (new_bases) { + if (PyList_Append(new_bases, base) < 0) { + goto error; + } + } + continue; + } + new_base = __Pyx_PyObject_CallOneArg(meth, bases); + Py_DECREF(meth); + if (!new_base) { + goto error; + } + if (!PyTuple_Check(new_base)) { + PyErr_SetString(PyExc_TypeError, + "__mro_entries__ must return a tuple"); + Py_DECREF(new_base); + goto error; + } + if (!new_bases) { + if (!(new_bases = PyList_New(i))) { + goto error; + } + for (j = 0; j < i; j++) { + base = PyTuple_GET_ITEM(bases, j); + PyList_SET_ITEM(new_bases, j, base); + Py_INCREF(base); + } + } + j = PyList_GET_SIZE(new_bases); + if (PyList_SetSlice(new_bases, j, j, new_base) < 0) { + goto error; + } + Py_DECREF(new_base); + } + if (!new_bases) { + Py_INCREF(bases); + return bases; + } + result = PyList_AsTuple(new_bases); + Py_DECREF(new_bases); + return result; +error: + Py_XDECREF(new_bases); + return NULL; +} + /* CalculateMetaclass */ - static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { - Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); + static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + Py_ssize_t i, nbases; +#if CYTHON_ASSUME_SAFE_MACROS + nbases = PyTuple_GET_SIZE(bases); +#else + nbases = PyTuple_Size(bases); + if (nbases < 0) return NULL; +#endif for (i=0; i < nbases; i++) { PyTypeObject *tmptype; +#if CYTHON_ASSUME_SAFE_MACROS PyObject *tmp = PyTuple_GET_ITEM(bases, i); +#else + PyObject *tmp = PyTuple_GetItem(bases, i); + if (!tmp) return NULL; +#endif tmptype = Py_TYPE(tmp); #if PY_MAJOR_VERSION < 3 if (tmptype == &PyClass_Type) @@ -39321,56 +46587,197 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, return (PyObject*) metaclass; } +/* FetchSharedCythonModule */ + static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; +} + /* FetchCommonType */ - static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); + static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { goto bad; } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { goto bad; } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; + goto done; } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; done: - Py_DECREF(fake_module); - return cached_type; + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } +#endif + +/* PyVectorcallFastCallDict */ + #if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif /* CythonFunctionShared */ - #include + static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + CYTHON_UNUSED_VAR(closure); if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { #if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #endif if (unlikely(op->func_doc == NULL)) return NULL; @@ -39378,30 +46785,33 @@ __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure Py_INCREF(Py_None); return Py_None; } +#endif } Py_INCREF(op->func_doc); return op->func_doc; } static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp = op->func_doc; + CYTHON_UNUSED_VAR(context); if (value == NULL) { value = Py_None; } Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_doc, value); return 0; } static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#elif PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; @@ -39410,9 +46820,9 @@ __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_name; } static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -39423,22 +46833,21 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "__name__ must be set to a string object"); return -1; } - tmp = op->func_name; Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_name, value); return 0; } static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_qualname); return op->func_qualname; } static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -39449,25 +46858,14 @@ __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHO "__qualname__ must be set to a string object"); return -1; } - tmp = op->func_qualname; Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); return 0; } static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) @@ -39477,9 +46875,9 @@ __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_dict; } static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL)) { PyErr_SetString(PyExc_TypeError, "function's dictionary may not be deleted"); @@ -39490,28 +46888,30 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "setting function's dictionary to a non-dict"); return -1; } - tmp = op->func_dict; Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_dict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); Py_INCREF(Py_None); return Py_None; } static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) { PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); Py_INCREF(result); return result; } @@ -39527,10 +46927,10 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); Py_INCREF(op->defaults_kwdict); #else - op->defaults_tuple = PySequence_ITEM(res, 0); + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); if (unlikely(!op->defaults_tuple)) result = -1; else { - op->defaults_kwdict = PySequence_ITEM(res, 1); + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); if (unlikely(!op->defaults_kwdict)) result = -1; } #endif @@ -39538,27 +46938,28 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { return result; } static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); return 0; } static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_tuple; } else { result = Py_None; @@ -39568,27 +46969,28 @@ __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *co return result; } static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_kwdict; } else { result = Py_None; @@ -39598,24 +47000,23 @@ __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void * return result; } static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value || value == Py_None) { value = NULL; - } else if (!PyDict_Check(value)) { + } else if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); return 0; } static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; @@ -39624,13 +47025,62 @@ __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void Py_INCREF(result); return result; } +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); + } +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, @@ -39643,49 +47093,88 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif {0, 0, 0, 0, 0} }; static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) { + CYTHON_UNUSED_VAR(args); #if PY_MAJOR_VERSION >= 3 Py_INCREF(m->func_qualname); return m->func_qualname; #else - return PyString_FromString(m->func.m_ml->ml_name); + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); #endif } static PyMethodDef __pyx_CyFunction_methods[] = { {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, {0, 0, 0, 0} }; -#if PY_VERSION_HEX < 0x030500A0 +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif if (unlikely(op == NULL)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif Py_XINCREF(closure); op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API Py_XINCREF(module); - op->func.m_module = module; + cf->m_module = module; +#endif op->func_dict = NULL; op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); @@ -39697,23 +47186,62 @@ static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef * op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif Py_CLEAR(m->func_dict); Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -39729,7 +47257,7 @@ static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); + __Pyx_PyHeapTypeObject_GC_Del(m); } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { @@ -39739,16 +47267,23 @@ static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif Py_VISIT(m->func_dict); Py_VISIT(m->func_name); Py_VISIT(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -39757,24 +47292,6 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, } return 0; } -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ -#if PY_MAJOR_VERSION < 3 - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; -#endif - return __Pyx_PyMethod_New(func, obj, type); -} static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { @@ -39787,10 +47304,22 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) #endif } static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyObject *py_name = NULL; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) return (*meth)(self, arg); @@ -39799,24 +47328,43 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif if (likely(size == 0)) return (*meth)(self, NULL); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); +#endif return NULL; } break; case METH_O: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif if (likely(size == 1)) { PyObject *result, *arg0; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS arg0 = PyTuple_GET_ITEM(arg, 0); #else - arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; #endif result = (*meth)(self, arg0); #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) @@ -39824,33 +47372,72 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py #endif return result; } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else PyErr_Format(PyExc_TypeError, "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); +#endif return NULL; } break; default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); return NULL; } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", + py_name); + Py_DECREF(py_name); +#else PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", f->m_ml->ml_name); +#endif return NULL; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; } static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { Py_ssize_t argc; PyObject *new_args; PyObject *self; +#if CYTHON_ASSUME_SAFE_MACROS argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(!argc) < 0) return NULL; +#endif new_args = PyTuple_GetSlice(args, 1, argc); if (unlikely(!new_args)) return NULL; @@ -39874,13 +47461,175 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P } return result; } +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else static PyTypeObject __pyx_CyFunctionType_type = { PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif 0, 0, #if PY_MAJOR_VERSION < 3 @@ -39898,7 +47647,13 @@ static PyTypeObject __pyx_CyFunctionType_type = { 0, 0, 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, 0, (traverseproc) __Pyx_CyFunction_traverse, (inquiry) __Pyx_CyFunction_clear, @@ -39915,7 +47670,7 @@ static PyTypeObject __pyx_CyFunctionType_type = { __pyx_CyFunction_getsets, 0, 0, - __Pyx_CyFunction_descr_get, + __Pyx_PyMethod_New, 0, offsetof(__pyx_CyFunctionObject, func_dict), 0, @@ -39936,15 +47691,24 @@ static PyTypeObject __pyx_CyFunctionType_type = { #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, #endif -#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 +#if __PYX_NEED_TP_PRINT_SLOT 0, #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, #endif }; -static int __pyx_CyFunction_init(void) { +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif if (unlikely(__pyx_CyFunctionType == NULL)) { return -1; } @@ -39977,7 +47741,7 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py } /* CythonFunction */ - static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { PyObject *op = __Pyx_CyFunction_Init( PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), @@ -39989,25 +47753,43 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py return op; } +/* PyObjectLookupSpecial */ + #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) { + PyObject *res; + PyTypeObject *tp = Py_TYPE(obj); +#if PY_MAJOR_VERSION < 3 + if (unlikely(PyInstance_Check(obj))) + return with_error ? __Pyx_PyObject_GetAttrStr(obj, attr_name) : __Pyx_PyObject_GetAttrStrNoError(obj, attr_name); +#endif + res = _PyType_Lookup(tp, attr_name); + if (likely(res)) { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (!f) { + Py_INCREF(res); + } else { + res = f(res, obj, (PyObject *)tp); + } + } else if (with_error) { + PyErr_SetObject(PyExc_AttributeError, attr_name); + } + return res; +} +#endif + /* Py3ClassCreate */ - static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, + static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { PyObject *ns; if (metaclass) { - PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); + PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_n_s_prepare); if (prep) { - PyObject *pargs = PyTuple_Pack(2, name, bases); - if (unlikely(!pargs)) { - Py_DECREF(prep); - return NULL; - } - ns = PyObject_Call(prep, pargs, mkw); + PyObject *pargs[3] = {NULL, name, bases}; + ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw); Py_DECREF(prep); - Py_DECREF(pargs); } else { - if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) + if (unlikely(PyErr_Occurred())) return NULL; - PyErr_Clear(); ns = PyDict_New(); } } else { @@ -40016,18 +47798,153 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py if (unlikely(!ns)) return NULL; if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; +#if PY_VERSION_HEX >= 0x03030000 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; +#else + CYTHON_MAYBE_UNUSED_VAR(qualname); +#endif if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; return ns; bad: Py_DECREF(ns); return NULL; } +#if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS +static int __Pyx_SetNamesPEP487(PyObject *type_obj) { + PyTypeObject *type = (PyTypeObject*) type_obj; + PyObject *names_to_set, *key, *value, *set_name, *tmp; + Py_ssize_t i = 0; +#if CYTHON_USE_TYPE_SLOTS + names_to_set = PyDict_Copy(type->tp_dict); +#else + { + PyObject *d = PyObject_GetAttr(type_obj, __pyx_n_s_dict); + names_to_set = NULL; + if (likely(d)) { + PyObject *names_to_set = PyDict_New(); + int ret = likely(names_to_set) ? PyDict_Update(names_to_set, d) : -1; + Py_DECREF(d); + if (unlikely(ret < 0)) + Py_CLEAR(names_to_set); + } + } +#endif + if (unlikely(names_to_set == NULL)) + goto bad; + while (PyDict_Next(names_to_set, &i, &key, &value)) { + set_name = __Pyx_PyObject_LookupSpecialNoError(value, __pyx_n_s_set_name); + if (unlikely(set_name != NULL)) { + tmp = __Pyx_PyObject_Call2Args(set_name, type_obj, key); + Py_DECREF(set_name); + if (unlikely(tmp == NULL)) { + __Pyx_TypeName value_type_name = + __Pyx_PyType_GetName(Py_TYPE(value)); + __Pyx_TypeName type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_RuntimeError, +#if PY_MAJOR_VERSION >= 3 + "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %R " "in '" __Pyx_FMT_TYPENAME "'", + value_type_name, key, type_name); +#else + "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %.100s in '" __Pyx_FMT_TYPENAME "'", + value_type_name, + PyString_Check(key) ? PyString_AS_STRING(key) : "?", + type_name); +#endif + goto bad; + } else { + Py_DECREF(tmp); + } + } + else if (unlikely(PyErr_Occurred())) { + goto bad; + } + } + Py_DECREF(names_to_set); + return 0; +bad: + Py_XDECREF(names_to_set); + return -1; +} +static PyObject *__Pyx_InitSubclassPEP487(PyObject *type_obj, PyObject *mkw) { +#if CYTHON_USE_TYPE_SLOTS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyTypeObject *type = (PyTypeObject*) type_obj; + PyObject *mro = type->tp_mro; + Py_ssize_t i, nbases; + if (unlikely(!mro)) goto done; + (void) &__Pyx_GetBuiltinName; + Py_INCREF(mro); + nbases = PyTuple_GET_SIZE(mro); + assert(PyTuple_GET_ITEM(mro, 0) == type_obj); + for (i = 1; i < nbases-1; i++) { + PyObject *base, *dict, *meth; + base = PyTuple_GET_ITEM(mro, i); + dict = ((PyTypeObject *)base)->tp_dict; + meth = __Pyx_PyDict_GetItemStrWithError(dict, __pyx_n_s_init_subclass); + if (unlikely(meth)) { + descrgetfunc f = Py_TYPE(meth)->tp_descr_get; + PyObject *res; + Py_INCREF(meth); + if (likely(f)) { + res = f(meth, NULL, type_obj); + Py_DECREF(meth); + if (unlikely(!res)) goto bad; + meth = res; + } + res = __Pyx_PyObject_FastCallDict(meth, NULL, 0, mkw); + Py_DECREF(meth); + if (unlikely(!res)) goto bad; + Py_DECREF(res); + goto done; + } else if (unlikely(PyErr_Occurred())) { + goto bad; + } + } +done: + Py_XDECREF(mro); + return type_obj; +bad: + Py_XDECREF(mro); + Py_DECREF(type_obj); + return NULL; +#else + PyObject *super_type, *super, *func, *res; +#if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type) + super_type = __Pyx_GetBuiltinName(__pyx_n_s_super); +#else + super_type = (PyObject*) &PySuper_Type; + (void) &__Pyx_GetBuiltinName; +#endif + super = likely(super_type) ? __Pyx_PyObject_Call2Args(super_type, type_obj, type_obj) : NULL; +#if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type) + Py_XDECREF(super_type); +#endif + if (unlikely(!super)) { + Py_CLEAR(type_obj); + goto done; + } + func = __Pyx_PyObject_GetAttrStrNoError(super, __pyx_n_s_init_subclass); + Py_DECREF(super); + if (likely(!func)) { + if (unlikely(PyErr_Occurred())) + Py_CLEAR(type_obj); + goto done; + } + res = __Pyx_PyObject_FastCallDict(func, NULL, 0, mkw); + Py_DECREF(func); + if (unlikely(!res)) + Py_CLEAR(type_obj); + Py_XDECREF(res); +done: + return type_obj; +#endif +} +#endif static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass) { - PyObject *result, *margs; + PyObject *result; PyObject *owned_metaclass = NULL; + PyObject *margs[4] = {NULL, name, bases, dict}; if (allow_py2_metaclass) { owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); if (owned_metaclass) { @@ -40045,25 +47962,37 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj return NULL; owned_metaclass = metaclass; } - margs = PyTuple_Pack(3, name, bases, dict); - if (unlikely(!margs)) { - result = NULL; - } else { - result = PyObject_Call(metaclass, margs, mkw); - Py_DECREF(margs); - } + result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, +#if PY_VERSION_HEX < 0x030600A4 + (metaclass == (PyObject*)&PyType_Type) ? NULL : mkw +#else + mkw +#endif + ); Py_XDECREF(owned_metaclass); +#if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS + if (likely(result) && likely(PyType_Check(result))) { + if (unlikely(__Pyx_SetNamesPEP487(result) < 0)) { + Py_CLEAR(result); + } else { + result = __Pyx_InitSubclassPEP487(result, mkw); + } + } +#else + (void) &__Pyx_GetBuiltinName; +#endif return result; } /* CLineInTraceback */ - #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { + #ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -40077,7 +48006,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -40099,7 +48028,8 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -40177,17 +48107,99 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ - #include "compile.h" + #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + PyErr_Clear(); + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #endif +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + py_funcname = PyUnicode_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -40222,6 +48234,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -40284,13 +48297,19 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + __Pyx_TypeName obj_type_name; if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags); - PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' does not have the buffer interface", + obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { @@ -40307,8 +48326,8 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { #endif - /* MemviewSliceIsContig */ - static int + /* MemviewSliceIsContig */ + static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) { int i, index, step, start; @@ -40330,7 +48349,7 @@ __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) } /* OverlappingSlices */ - static void + static void __pyx_get_array_memory_extents(__Pyx_memviewslice *slice, void **out_start, void **out_end, int ndim, size_t itemsize) @@ -40365,21 +48384,8 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, return (start1 < end2) && (start2 < end1); } -/* Capsule */ - static CYTHON_INLINE PyObject * -__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) -{ - PyObject *cobj; -#if PY_VERSION_HEX >= 0x02070000 - cobj = PyCapsule_New(p, sig, NULL); -#else - cobj = PyCObject_FromVoidPtr(p, NULL); -#endif - return cobj; -} - /* TypeInfoCompare */ - static int + static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) { int i; @@ -40420,7 +48426,7 @@ __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) } /* MemviewSliceValidateAndInit */ - static int + static int __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) { if (buf->shape[dim] <= 1) @@ -40474,8 +48480,9 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) return 0; } static int -__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec) +__pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec) { + CYTHON_UNUSED_VAR(ndim); if (spec & __Pyx_MEMVIEW_DIRECT) { if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { PyErr_Format(PyExc_ValueError, @@ -40601,7 +48608,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *obj, int writable_flag) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *obj, int writable_flag) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) }; @@ -40624,7 +48631,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(PyObject *obj, int writable_flag) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(PyObject *obj, int writable_flag) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) }; @@ -40647,7 +48654,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -40669,7 +48676,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(PyObject *obj, int writable_flag) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(PyObject *obj, int writable_flag) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) }; @@ -40692,7 +48699,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(PyObject *obj, int writable_flag) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(PyObject *obj, int writable_flag) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) }; @@ -40714,114 +48721,8 @@ static int __Pyx_ValidateAndInit_memviewslice( return result; } -/* Print */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static PyObject *__Pyx_GetStdout(void) { - PyObject *f = PySys_GetObject((char *)"stdout"); - if (!f) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); - } - return f; -} -static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - int i; - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { - PyObject* v; - if (PyFile_SoftSpace(f, 1)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - v = PyTuple_GET_ITEM(arg_tuple, i); - if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - goto error; - if (PyString_Check(v)) { - char *s = PyString_AsString(v); - Py_ssize_t len = PyString_Size(v); - if (len > 0) { - switch (s[len-1]) { - case ' ': break; - case '\f': case '\r': case '\n': case '\t': case '\v': - PyFile_SoftSpace(f, 0); - break; - default: break; - } - } - } - } - if (newline) { - if (PyFile_WriteString("\n", f) < 0) - goto error; - PyFile_SoftSpace(f, 0); - } - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; -} -#else -static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { - PyObject* kwargs = 0; - PyObject* result = 0; - PyObject* end_string; - if (unlikely(!__pyx_print)) { - __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print); - if (!__pyx_print) - return -1; - } - if (stream) { - kwargs = PyDict_New(); - if (unlikely(!kwargs)) - return -1; - if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0)) - goto bad; - if (!newline) { - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - goto bad; - if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - goto bad; - } - Py_DECREF(end_string); - } - } else if (!newline) { - if (unlikely(!__pyx_print_kwargs)) { - __pyx_print_kwargs = PyDict_New(); - if (unlikely(!__pyx_print_kwargs)) - return -1; - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - return -1; - if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - return -1; - } - Py_DECREF(end_string); - } - kwargs = __pyx_print_kwargs; - } - result = PyObject_Call(__pyx_print, arg_tuple, kwargs); - if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) - Py_DECREF(kwargs); - if (!result) - return -1; - Py_DECREF(result); - return 0; -bad: - if (kwargs != __pyx_print_kwargs) - Py_XDECREF(kwargs); - return -1; -} -#endif - /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); @@ -40841,7 +48742,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -40975,7 +48876,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); @@ -40995,7 +48896,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -41129,7 +49030,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* MemviewSliceCopyTemplate */ - static __Pyx_memviewslice + static __Pyx_memviewslice __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const char *mode, int ndim, size_t sizeof_dtype, int contig_flag, @@ -41195,8 +49096,143 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return new_mvs; } +/* MemviewSliceInit */ + static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF(memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} +#ifndef Py_NO_RETURN +#define Py_NO_RETURN +#endif +static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + /* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -41208,7 +49244,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -41222,40 +49258,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -41268,109 +49309,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -41392,7 +49505,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -41424,13 +49537,37 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -41462,13 +49599,37 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } /* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -41480,7 +49641,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -41494,40 +49655,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -41540,109 +49706,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -41663,45 +49901,8 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (long) -1; } -/* PrintOne */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static int __Pyx_PrintOne(PyObject* f, PyObject *o) { - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - if (PyFile_SoftSpace(f, 0)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) - goto error; - if (PyFile_WriteString("\n", f) < 0) - goto error; - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; - /* the line below is just to avoid C compiler - * warnings about unused functions */ - return __Pyx_Print(f, NULL, 0); -} -#else -static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { - int res; - PyObject* arg_tuple = PyTuple_Pack(1, o); - if (unlikely(!arg_tuple)) - return -1; - res = __Pyx_Print(stream, arg_tuple, 1); - Py_DECREF(arg_tuple); - return res; -} -#endif - /* CIntFromPy */ - static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { + static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -41713,7 +49914,7 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(char) < sizeof(long)) { + if ((sizeof(char) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -41727,40 +49928,45 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { - return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { - return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { - return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -41773,109 +49979,181 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { goto raise_neg_overflow; } #endif - if (sizeof(char) <= sizeof(unsigned long)) { + if ((sizeof(char) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) - case -2: - if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(char) <= sizeof(long)) { + if ((sizeof(char) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (char) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (char) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (char) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (char) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (char) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (char) -1; } } else { @@ -41896,8 +50174,24 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { return (char) -1; } +/* FormatTypeName */ + #if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name_2); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__79); + } + return name; +} +#endif + /* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { + static int __Pyx_check_binary_version(void) { char ctversion[5]; int same=1, i, found_dot; const char* rt_from_call = Py_GetVersion(); @@ -41926,7 +50220,7 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { rtversion[i] = rt_from_call[i]; } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -41935,9 +50229,31 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { } /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + #if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -41945,23 +50261,11 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -42023,7 +50327,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -42052,22 +50356,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -42133,13 +50441,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -42207,4 +50513,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/newanalysis/gfunction/gfunction.pyx b/newanalysis/gfunction/gfunction.pyx index 4077b77..672ba10 100644 --- a/newanalysis/gfunction/gfunction.pyx +++ b/newanalysis/gfunction/gfunction.pyx @@ -260,7 +260,7 @@ class RDF(object): if use_cuda and cu.cuda: self.cuda = True elif use_cuda and not cu.cuda: - print "No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead." + print("No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead.") self.cuda = False else: self.cuda = False @@ -577,8 +577,8 @@ cdef void calcHistoVoronoi(double *core_xyz, double *surr_xyz, double *core_dip, cdef double *dest = np_dest.data cdef double *box_dim = np_box_dim.data cdef int ds_pos1, ds_pos2, shell, ix3, ix4 - cdef int apr_core = ncore / nm_core - cdef int apr_surround = nsurround / nm_surround + cdef int apr_core = ncore // nm_core + cdef int apr_surround = nsurround // nm_surround #TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells @@ -586,7 +586,7 @@ cdef void calcHistoVoronoi(double *core_xyz, double *surr_xyz, double *core_dip, for i in prange(ncore, nogil=True): #ix2=i*histo_n ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE - ds_pos1 = i/apr_core + ds_pos1 = i//apr_core if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: cpx = core_dip[i*3] @@ -598,7 +598,7 @@ cdef void calcHistoVoronoi(double *core_xyz, double *surr_xyz, double *core_dip, else: j_begin = 0 for j in range(j_begin,nsurround): - ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 2 + ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 2 shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? shell = shell-1 if shell < 0: shell = nshells-1 @@ -674,8 +674,8 @@ cdef void calcHistoVoronoiNonSelf(double *core_xyz, double *surr_xyz, double *co cdef double *dest = np_dest.data cdef double *box_dim = np_box_dim.data cdef int ds_pos1, ds_pos2, shell, ix3, ix4 - cdef int apr_core = ncore / nm_core - cdef int apr_surround = nsurround / nm_surround + cdef int apr_core = ncore // nm_core + cdef int apr_surround = nsurround // nm_surround #TODO: Change with nm_core, int nm_surround, int delaunay_matrix, nshells @@ -683,7 +683,7 @@ cdef void calcHistoVoronoiNonSelf(double *core_xyz, double *surr_xyz, double *co for i in prange(ncore, nogil=True): #ix2=i*histo_n ix2 = i*nshells*histo_n #ROLLBACK: ERASE THESE 2, UNCOMMENT ABOVE - ds_pos1 = i/apr_core + ds_pos1 = i//apr_core if mode_sel & 2 or mode_sel & 4 or mode_sel & 16 or mode_sel & 32: cpx = core_dip[i*3] @@ -695,7 +695,7 @@ cdef void calcHistoVoronoiNonSelf(double *core_xyz, double *surr_xyz, double *co else: j_begin = 0 for j in range(j_begin,nsurround): - ds_pos2 = j/apr_surround # ROLLBACK: ERASE THESE 3 + ds_pos2 = j//apr_surround # ROLLBACK: ERASE THESE 3 if(ds_pos1 == ds_pos2): continue shell = delaunay_matrix[ds_pos1*nsurround + ds_pos2] #Correctly shaped? shell = shell-1 @@ -799,7 +799,7 @@ class RDF_voronoi(object): if use_cuda and cu.cuda: self.cuda = True elif use_cuda and not cu.cuda: - print "No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead." + print("No suitable CUDA device was found to calculate radial distribution functions. Using CPU instead.") self.cuda = False else: self.cuda = False diff --git a/newanalysis/helpers/correl.cpp b/newanalysis/helpers/correl.cpp index 53d01e6..91bfb0f 100644 --- a/newanalysis/helpers/correl.cpp +++ b/newanalysis/helpers/correl.cpp @@ -1,22 +1,79 @@ -/* Generated by Cython 0.29.34 */ +/* Generated by Cython 3.0.2 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayscalars.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ufuncobject.h", + "newanalysis/helpers/mod_Correl.h" + ], + "extra_compile_args": [ + "-fopenmp" + ], + "extra_link_args": [ + "-fopenmp" + ], + "extra_objects": [ + "newanalysis/helpers/fftw-3.3.4/install/lib/libfftw3.a" + ], + "include_dirs": [ + "newanalysis/helpers", + "newanalysis/helpers/fftw-3.3.4/install/include", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include" + ], + "language": "c++", + "library_dirs": [ + "newanalysis/helpers/fftw-3.3.4/install/lib" + ], + "name": "newanalysis.correl", + "sources": [ + "newanalysis/helpers/correl.pyx", + "newanalysis/helpers/mod_Correl.cpp", + "newanalysis/helpers/BertholdHorn.cpp" + ] + }, + "module_name": "newanalysis.correl" +} +END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_34" -#define CYTHON_HEX_VERSION 0x001D22F0 -#define CYTHON_FUTURE_DIVISION 0 +#if CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" +#else +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_2" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030002F0 +#define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -35,9 +92,7 @@ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -45,13 +100,19 @@ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -76,10 +137,19 @@ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS @@ -89,44 +159,121 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK @@ -136,8 +283,9 @@ #endif #elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 @@ -181,16 +329,17 @@ #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -199,11 +348,8 @@ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5) + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 @@ -226,29 +372,47 @@ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) + #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #endif - #if PY_VERSION_HEX >= 0x030B00A4 + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 @@ -257,6 +421,10 @@ #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -285,6 +453,17 @@ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -298,13 +477,16 @@ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -312,28 +494,59 @@ # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -343,13 +556,26 @@ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." @@ -373,91 +599,151 @@ class __Pyx_FakeReference { T *operator->() { return ptr; } T *operator&() { return ptr; } operator T&() { return *ptr; } - template bool operator ==(U other) { return *ptr == other; } - template bool operator !=(U other) { return *ptr != other; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } private: T *ptr; }; -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + PyObject *version_info; // borrowed + PyObject *py_minor_version = NULL; + long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; - } - end: - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(call_result); - Py_XDECREF(empty); + #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 + minor_version = 11; // we don't yet need to distinguish between versions > 11 + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + Py_XDECREF(py_minor_version); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here + if (!empty_bytes) return NULL; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -471,6 +757,12 @@ class __Pyx_FakeReference { #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -485,30 +777,53 @@ class __Pyx_FakeReference { #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -517,6 +832,22 @@ class __Pyx_FakeReference { #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -547,6 +878,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -559,12 +912,69 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) +#else + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) @@ -575,10 +985,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else @@ -596,11 +1006,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -611,14 +1021,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -647,8 +1063,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -658,15 +1080,33 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif #if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -678,6 +1118,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -695,11 +1138,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -744,12 +1182,17 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" #endif #define __PYX_HAVE__newanalysis__correl @@ -757,14 +1200,14 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + #include "numpy/arrayobject.h" #include "numpy/ndarrayobject.h" #include "numpy/ndarraytypes.h" #include "numpy/arrayscalars.h" #include "numpy/ufuncobject.h" - - /* NumPy API declarations from "numpy/__init__.pxd" */ - #include #include "ios" #include "new" @@ -773,7 +1216,6 @@ static CYTHON_INLINE float __PYX_NAN() { #include "mod_Correl.h" #include "pythread.h" #include -#include "pystate.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -842,9 +1284,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -852,11 +1294,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -882,7 +1335,52 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -904,7 +1402,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -969,23 +1467,19 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; /* Header.proto */ #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__)) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 @@ -1003,15 +1497,28 @@ static const char *__pyx_filename; #define _Complex_I 1.0fj #endif +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { - "src/helpers/correl.pyx", - "__init__.pxd", - "stringsource", + "newanalysis/helpers/correl.pyx", + "", + "__init__.cython-30.pxd", "type.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + /* BufferFormatStructs.proto */ -#define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { @@ -1046,24 +1553,6 @@ typedef struct { char is_valid_array; } __Pyx_BufFmt_Context; -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - -/* MemviewSliceStruct.proto */ -struct __pyx_memoryview_obj; -typedef struct { - struct __pyx_memoryview_obj *memview; - char *data; - Py_ssize_t shape[8]; - Py_ssize_t strides[8]; - Py_ssize_t suboffsets[8]; -} __Pyx_memviewslice; -#define __Pyx_MemoryView_Len(m) (m.shape[0]) - /* Atomics.proto */ #include #ifndef CYTHON_ATOMICS @@ -1071,7 +1560,44 @@ typedef struct { #endif #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS #define __pyx_atomic_int_type int -#if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_incr_aligned(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_incr_aligned(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1) @@ -1079,10 +1605,11 @@ typedef struct { #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif -#elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL +#elif CYTHON_ATOMICS && defined(_MSC_VER) #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type long + #define __pyx_nonatomic_int_type long #pragma intrinsic (_InterlockedExchangeAdd) #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1) @@ -1096,7 +1623,6 @@ typedef struct { #warning "Not using atomics" #endif #endif -typedef volatile __pyx_atomic_int_type __pyx_atomic_int; #if CYTHON_ATOMICS #define __pyx_add_acquisition_count(memview)\ __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview)) @@ -1109,13 +1635,20 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) #endif -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +/* #### Code section: numeric_typedefs ### */ -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":689 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":730 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -1124,7 +1657,7 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":690 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":731 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -1133,7 +1666,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":691 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":732 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -1142,7 +1675,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":692 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":733 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -1151,7 +1684,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":696 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":737 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -1160,7 +1693,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":697 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":738 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -1169,7 +1702,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":698 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":739 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -1178,7 +1711,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":699 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":740 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -1187,7 +1720,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":703 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":744 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -1196,7 +1729,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":704 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":745 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -1205,61 +1738,43 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":713 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":754 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t + * */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":714 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":755 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":715 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":717 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":757 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t + * */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":718 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":758 * * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t - * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":719 - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":721 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":760 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1268,7 +1783,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":722 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":761 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1277,7 +1792,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":724 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":763 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1286,7 +1801,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":725 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":764 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1295,7 +1810,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":726 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":765 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1303,8 +1818,9 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* #### Code section: complex_type_declarations ### */ /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else @@ -1316,7 +1832,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else @@ -1327,6 +1843,7 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_array_obj; @@ -1334,7 +1851,7 @@ struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":728 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":767 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1343,7 +1860,7 @@ struct __pyx_memoryviewslice_obj; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":729 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":768 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1352,7 +1869,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":730 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":769 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1361,7 +1878,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":732 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":771 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1370,8 +1887,8 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1395,7 +1912,7 @@ struct __pyx_array_obj { }; -/* "View.MemoryView":280 +/* "View.MemoryView":302 * * @cname('__pyx_MemviewEnum') * cdef class Enum(object): # <<<<<<<<<<<<<< @@ -1408,10 +1925,10 @@ struct __pyx_MemviewEnum_obj { }; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1422,8 +1939,7 @@ struct __pyx_memoryview_obj { PyObject *_size; PyObject *_array_interface; PyThread_type_lock lock; - __pyx_atomic_int acquisition_count[2]; - __pyx_atomic_int *acquisition_count_aligned_p; + __pyx_atomic_int_type acquisition_count; Py_buffer view; int flags; int dtype_is_object; @@ -1431,8 +1947,8 @@ struct __pyx_memoryview_obj { }; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1448,8 +1964,8 @@ struct __pyx_memoryviewslice_obj { -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1462,10 +1978,10 @@ struct __pyx_vtabstruct_array { static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1478,12 +1994,13 @@ struct __pyx_vtabstruct_memoryview { PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); }; static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1494,6 +2011,7 @@ struct __pyx_vtabstruct__memoryviewslice { struct __pyx_vtabstruct_memoryview __pyx_base; }; static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1502,11 +2020,11 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1516,28 +2034,40 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1548,6 +2078,10 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1559,6 +2093,57 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); @@ -1566,9 +2151,71 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#else + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) +#endif +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) + #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) +#else + #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op + #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs + #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS + #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) + #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); @@ -1577,36 +2224,126 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); -/* IsLittleEndian.proto */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); -/* BufferFormatCheck.proto */ -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type); +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); +#endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 + #include "frameobject.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) + #define __Pyx_PyFrame_GetLocalsplus(frame)\ + (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif +#endif +#endif -/* BufferGetAndValidate.proto */ -#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ - ((obj == Py_None || obj == NULL) ?\ - (__Pyx_ZeroBuffer(buf), 0) :\ - __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) -static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, - __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static void __Pyx_ZeroBuffer(Py_buffer* buf); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; -static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* BuildPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char); + +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); + +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); + +/* JoinPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); + +/* StrEquals.proto */ +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + +/* PyObjectFormatSimple.proto */ +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#elif PY_MAJOR_VERSION < 3 + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\ + PyObject_Format(s, f)) +#elif CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ + likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ + PyObject_Format(s, f)) +#else + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#endif + +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ @@ -1630,6 +2367,29 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) @@ -1677,142 +2437,51 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#define __Pyx_BUILD_ASSERT_EXPR(cond)\ - (sizeof(char [1 - 2*!(cond)]) - 1) -#ifndef Py_MEMBER_SIZE -#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) -#endif -#if CYTHON_FAST_PYCALL - static size_t __pyx_pyframe_localsplus_offset = 0; - #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 - #ifndef Py_BUILD_CORE - #define Py_BUILD_CORE 1 - #endif - #include "internal/pycore_frame.h" -#endif - #define __Pxy_PyFrame_Initialize_Offsets()\ - ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ - (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) - #define __Pyx_PyFrame_GetLocalsplus(frame)\ - (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (1) +#elif CYTHON_COMPILING_IN_LIMITED_API || (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000) + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } #else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); /* ExtTypeTest.proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); -/* PyIntCompare.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* BufferIndexError.proto */ -static void __Pyx_RaiseBufferIndexError(int axis); - -/* MemviewSliceInit.proto */ -#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d -#define __Pyx_MEMVIEW_DIRECT 1 -#define __Pyx_MEMVIEW_PTR 2 -#define __Pyx_MEMVIEW_FULL 4 -#define __Pyx_MEMVIEW_CONTIG 8 -#define __Pyx_MEMVIEW_STRIDED 16 -#define __Pyx_MEMVIEW_FOLLOW 32 -#define __Pyx_IS_C_CONTIG 1 -#define __Pyx_IS_F_CONTIG 2 -static int __Pyx_init_memviewslice( - struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference); -static CYTHON_INLINE int __pyx_add_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p) -#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview)) -#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) -#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__) -static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); - -/* DivInt[long].proto */ -static CYTHON_INLINE long __Pyx_div_long(long, long); - -/* UnaryNegOverflows.proto */ -#define UNARY_NEG_WOULD_OVERFLOW(x)\ - (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) - /* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif @@ -1827,14 +2496,6 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) @@ -1843,72 +2504,6 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - -/* DivInt[Py_ssize_t].proto */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); - -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ -/* GetAttr.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); - -/* ObjectGetItem.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); -#else -#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) -#endif - -/* decode_c_string_utf16.proto */ -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 0; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = -1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} - -/* decode_c_string.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); - -/* GetAttr3.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) @@ -1920,20 +2515,33 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* ssize_strlen.proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); + /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { @@ -1951,47 +2559,26 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif - -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} - -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); -/* None.proto */ +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck); + +/* RaiseUnboundLocalError.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long); + /* PySequenceContains.proto */ static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { int result = PySequence_Contains(seq, item); @@ -2004,6 +2591,33 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* HasAttr.proto */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +/* IsLittleEndian.proto */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); + +/* BufferFormatCheck.proto */ +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type); + +/* BufferGetAndValidate.proto */ +#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ + ((obj == Py_None || obj == NULL) ?\ + (__Pyx_ZeroBuffer(buf), 0) :\ + __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) +static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static void __Pyx_ZeroBuffer(Py_buffer* buf); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; +static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +/* PyIntCompare.proto */ +static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* BufferIndexError.proto */ +static void __Pyx_RaiseBufferIndexError(int axis); + /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); @@ -2018,34 +2632,202 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr #endif +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + /* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type); +#endif /* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce(PyObject* type_obj); +#endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -#if __STDC_VERSION__ >= 201112L +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_2 +#define __PYX_HAVE_RT_ImportType_proto_3_0_2 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif -#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT(s) alignof(s) +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +enum __Pyx_ImportType_CheckSize_3_0_2 { + __Pyx_ImportType_CheckSize_Error_3_0_2 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_2 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_2 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size); +#endif + +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + typesModule = PyImport_ImportModule("types"); + if (!typesModule) return NULL; + methodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + if (!methodType) return NULL; + result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); + Py_DECREF(methodType); + return result; +} +#elif PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + void *defaults; + int defaults_pyobjects; + size_t defaults_size; // used by FusedFunction for copying defaults + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif #endif +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -2054,6 +2836,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -2067,6 +2850,7 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -2103,9 +2887,6 @@ static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, __Pyx_memviewslice *slice2, int ndim, size_t itemsize); -/* Capsule.proto */ -static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); - /* TypeInfoCompare.proto */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b); @@ -2123,11 +2904,6 @@ static int __Pyx_ValidateAndInit_memviewslice( /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *, int writable_flag); -/* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(PyObject *, int writable_flag); @@ -2186,13 +2962,6 @@ static void __Pyx_CppExn2PyErr() { static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp); static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj); -/* Print.proto */ -static int __Pyx_Print(PyObject*, PyObject *, int); -#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 -static PyObject* __pyx_print = 0; -static PyObject* __pyx_print_kwargs = 0; -#endif - /* RealImag.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -2216,7 +2985,7 @@ static PyObject* __pyx_print_kwargs = 0; #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_float(a, b) ((a)==(b)) #define __Pyx_c_sum_float(a, b) ((a)+(b)) #define __Pyx_c_diff_float(a, b) ((a)-(b)) @@ -2254,7 +3023,7 @@ static PyObject* __pyx_print_kwargs = 0; #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_double(a, b) ((a)==(b)) #define __Pyx_c_sum_double(a, b) ((a)+(b)) #define __Pyx_c_diff_double(a, b) ((a)-(b)) @@ -2298,6 +3067,31 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, size_t sizeof_dtype, int contig_flag, int dtype_is_object); +/* MemviewSliceInit.proto */ +#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); @@ -2310,18 +3104,32 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); -/* PrintOne.proto */ -static int __Pyx_PrintOne(PyObject* stream, PyObject *o); +/* None.proto */ +#include /* CIntFromPy.proto */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ @@ -2330,58 +3138,46 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ -/* Module declarations from 'cpython.buffer' */ - -/* Module declarations from 'libc.string' */ +/* Module declarations from "libc.string" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "libc.stdio" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "cpython.type" */ -/* Module declarations from 'cpython' */ +/* Module declarations from "cpython" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.object" */ -/* Module declarations from 'cpython.ref' */ +/* Module declarations from "cpython.ref" */ -/* Module declarations from 'cpython.mem' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'numpy' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_generic = 0; -static PyTypeObject *__pyx_ptype_5numpy_number = 0; -static PyTypeObject *__pyx_ptype_5numpy_integer = 0; -static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_inexact = 0; -static PyTypeObject *__pyx_ptype_5numpy_floating = 0; -static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0; -static PyTypeObject *__pyx_ptype_5numpy_flexible = 0; -static PyTypeObject *__pyx_ptype_5numpy_character = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +/* Module declarations from "cython.view" */ -/* Module declarations from 'cython.view' */ +/* Module declarations from "cython.dataclasses" */ -/* Module declarations from 'cython' */ +/* Module declarations from "cython" */ -/* Module declarations from 'libc.math' */ +/* Module declarations from "libc.math" */ -/* Module declarations from 'newanalysis.correl' */ -static PyTypeObject *__pyx_array_type = 0; -static PyTypeObject *__pyx_MemviewEnum_type = 0; -static PyTypeObject *__pyx_memoryview_type = 0; -static PyTypeObject *__pyx_memoryviewslice_type = 0; +/* Module declarations from "newanalysis.correl" */ +static PyObject *__pyx_collections_abc_Sequence = 0; static PyObject *generic = 0; static PyObject *strided = 0; static PyObject *indirect = 0; @@ -2389,12 +3185,12 @@ static PyObject *contiguous = 0; static PyObject *indirect_contiguous = 0; static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ -static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ static PyObject *_unellipsify(PyObject *, int); /*proto*/ -static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ @@ -2412,8 +3208,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /* static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ -static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/ -static int __pyx_memoryview_err(PyObject *, char *); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ @@ -2422,24 +3219,32 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, __PYX_IS_UNSIGNED(int) ? 'U' : 'I', __PYX_IS_UNSIGNED(int), 0 }; +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "newanalysis.correl" extern int __pyx_module_is_main_newanalysis__correl; int __pyx_module_is_main_newanalysis__correl = 0; -/* Implementation of 'newanalysis.correl' */ +/* Implementation of "newanalysis.correl" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_ImportError; +static PyObject *__pyx_builtin_print; +static PyObject *__pyx_builtin___import__; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_AssertionError; static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_ImportError; +/* #### Code section: string_decls ### */ +static const char __pyx_k_[] = ": "; static const char __pyx_k_O[] = "O"; static const char __pyx_k_c[] = "c"; static const char __pyx_k_i[] = "i"; @@ -2449,10 +3254,15 @@ static const char __pyx_k_l[] = "l"; static const char __pyx_k_m[] = "m"; static const char __pyx_k_n[] = "_n"; static const char __pyx_k_t[] = "t"; +static const char __pyx_k__2[] = "."; +static const char __pyx_k__3[] = "*"; +static const char __pyx_k__6[] = "'"; +static const char __pyx_k__7[] = ")"; static const char __pyx_k_d1[] = "d1"; static const char __pyx_k_d2[] = "d2"; static const char __pyx_k_ds[] = "ds"; static const char __pyx_k_dt[] = "dt"; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_nc[] = "nc"; static const char __pyx_k_np[] = "np"; @@ -2462,11 +3272,14 @@ static const char __pyx_k_t3[] = "t3"; static const char __pyx_k_t4[] = "t4"; static const char __pyx_k_t5[] = "t5"; static const char __pyx_k_t6[] = "t6"; +static const char __pyx_k__64[] = "?"; +static const char __pyx_k_abc[] = "abc"; +static const char __pyx_k_and[] = " and "; static const char __pyx_k_ans[] = "ans"; static const char __pyx_k_cds[] = "cds"; static const char __pyx_k_ctr[] = "ctr"; static const char __pyx_k_dim[] = "dim"; -static const char __pyx_k_end[] = "end"; +static const char __pyx_k_got[] = " (got "; static const char __pyx_k_idx[] = "idx"; static const char __pyx_k_ltc[] = "ltc"; static const char __pyx_k_mol[] = "mol"; @@ -2477,6 +3290,7 @@ static const char __pyx_k_new[] = "__new__"; static const char __pyx_k_obj[] = "obj"; static const char __pyx_k_out[] = "out"; static const char __pyx_k_pds[] = "pds"; +static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_tmp[] = "tmp"; static const char __pyx_k_xcf[] = "xcf"; static const char __pyx_k_base[] = "base"; @@ -2484,7 +3298,6 @@ static const char __pyx_k_cctr[] = "cctr"; static const char __pyx_k_corr[] = "corr"; static const char __pyx_k_data[] = "data"; static const char __pyx_k_dict[] = "__dict__"; -static const char __pyx_k_file[] = "file"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_mode[] = "mode"; static const char __pyx_k_name[] = "name"; @@ -2493,6 +3306,7 @@ static const char __pyx_k_ndim[] = "ndim"; static const char __pyx_k_nmol[] = "nmol"; static const char __pyx_k_pack[] = "pack"; static const char __pyx_k_size[] = "size"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_step[] = "step"; static const char __pyx_k_stop[] = "stop"; static const char __pyx_k_test[] = "__test__"; @@ -2500,6 +3314,7 @@ static const char __pyx_k_ASCII[] = "ASCII"; static const char __pyx_k_ccorr[] = "ccorr"; static const char __pyx_k_cdata[] = "cdata"; static const char __pyx_k_class[] = "__class__"; +static const char __pyx_k_count[] = "count"; static const char __pyx_k_data1[] = "data1"; static const char __pyx_k_data2[] = "data2"; static const char __pyx_k_delta[] = "delta"; @@ -2507,6 +3322,7 @@ static const char __pyx_k_dsidx[] = "dsidx"; static const char __pyx_k_dtype[] = "dtype"; static const char __pyx_k_error[] = "error"; static const char __pyx_k_flags[] = "flags"; +static const char __pyx_k_index[] = "index"; static const char __pyx_k_ltc_2[] = "_ltc"; static const char __pyx_k_maxdt[] = "maxdt"; static const char __pyx_k_numpy[] = "numpy"; @@ -2527,6 +3343,7 @@ static const char __pyx_k_zeros[] = "zeros"; static const char __pyx_k_cdata1[] = "cdata1"; static const char __pyx_k_cdata2[] = "cdata2"; static const char __pyx_k_contds[] = "contds"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_import[] = "__import__"; @@ -2552,6 +3369,7 @@ static const char __pyx_k_wxcorr[] = "wxcorr"; static const char __pyx_k_asarray[] = "asarray"; static const char __pyx_k_coor_ts[] = "coor_ts"; static const char __pyx_k_corrdim[] = "corrdim"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_float64[] = "float64"; static const char __pyx_k_fortran[] = "fortran"; static const char __pyx_k_lowhigh[] = "lowhigh"; @@ -2565,6 +3383,7 @@ static const char __pyx_k_p_data2[] = "p_data2"; static const char __pyx_k_selfctr[] = "selfctr"; static const char __pyx_k_shelldt[] = "shelldt"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; +static const char __pyx_k_Sequence[] = "Sequence"; static const char __pyx_k_contdata[] = "contdata"; static const char __pyx_k_coor1_ts[] = "coor1_ts"; static const char __pyx_k_coor2_ts[] = "coor2_ts"; @@ -2576,6 +3395,7 @@ static const char __pyx_k_myCorrel[] = "myCorrel"; static const char __pyx_k_pcorrdim[] = "pcorrdim"; static const char __pyx_k_pnshells[] = "pnshells"; static const char __pyx_k_pyx_type[] = "__pyx_type"; +static const char __pyx_k_register[] = "register"; static const char __pyx_k_selfcorr[] = "selfcorr"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_startmax[] = "startmax"; @@ -2587,6 +3407,7 @@ static const char __pyx_k_correlate[] = "correlate"; static const char __pyx_k_crosscorr[] = "crosscorr"; static const char __pyx_k_cselfcorr[] = "cselfcorr"; static const char __pyx_k_enumerate[] = "enumerate"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_pselfcorr[] = "pselfcorr"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; @@ -2605,15 +3426,21 @@ static const char __pyx_k_too_sparse[] = "too sparse"; static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_PickleError[] = "PickleError"; +static const char __pyx_k_collections[] = "collections"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; -static const char __pyx_k_stringsource[] = "stringsource"; -static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; +static const char __pyx_k_stringsource[] = ""; +static const char __pyx_k_version_info[] = "version_info"; +static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; +static const char __pyx_k_AssertionError[] = "AssertionError"; static const char __pyx_k_startingpoints[] = "startingpoints"; static const char __pyx_k_tot_too_sparse[] = "tot too sparse"; static const char __pyx_k_vectorRotation[] = "vectorRotation"; static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; +static const char __pyx_k_collections_abc[] = "collections.abc"; static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; static const char __pyx_k_self_too_sparse[] = "self too sparse"; @@ -2622,6 +3449,7 @@ static const char __pyx_k_sparsecorrelate[] = "sparsecorrelate"; static const char __pyx_k_ascontiguousarray[] = "ascontiguousarray"; static const char __pyx_k_correlateParallel[] = "correlateParallel"; static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_newanalysis_correl[] = "newanalysis.correl"; static const char __pyx_k_strided_and_direct[] = ""; @@ -2629,285 +3457,47 @@ static const char __pyx_k_calcRelativeAngDisp[] = "calcRelativeAngDisp"; static const char __pyx_k_sparsefullcorrelate[] = "sparsefullcorrelate"; static const char __pyx_k_sparsecrosscorrelate[] = "sparsecrosscorrelate"; static const char __pyx_k_strided_and_indirect[] = ""; +static const char __pyx_k_Invalid_shape_in_axis[] = "Invalid shape in axis "; static const char __pyx_k_contiguous_and_direct[] = ""; +static const char __pyx_k_Cannot_index_with_type[] = "Cannot index with type '"; static const char __pyx_k_MemoryView_of_r_object[] = ""; -static const char __pyx_k_src_helpers_correl_pyx[] = "src/helpers/correl.pyx"; static const char __pyx_k_MemoryView_of_r_at_0x_x[] = ""; static const char __pyx_k_calcAngularDisplacement[] = "calcAngularDisplacement"; static const char __pyx_k_contiguous_and_indirect[] = ""; -static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; static const char __pyx_k_sparsefullcrosscorrelate[] = "sparsefullcrosscorrelate"; -static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; +static const char __pyx_k_Dimension_d_is_not_direct[] = "Dimension %d is not direct"; static const char __pyx_k_sparsefullnobulkcorrelate[] = "sparsefullnobulkcorrelate"; +static const char __pyx_k_Index_out_of_bounds_axis_d[] = "Index out of bounds (axis %d)"; static const char __pyx_k_calcAngularVelocityXCorrel[] = "calcAngularVelocityXCorrel"; +static const char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero (axis %d)"; static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; static const char __pyx_k_rotationMatrixShellCorrelate[] = "rotationMatrixShellCorrelate"; static const char __pyx_k_sparsefullnobulkthincorrelate[] = "sparsefullnobulkthincorrelate"; static const char __pyx_k_sparsefullnobulkthingreenkubo[] = "sparsefullnobulkthingreenkubo"; static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; +static const char __pyx_k_newanalysis_helpers_correl_pyx[] = "newanalysis/helpers/correl.pyx"; static const char __pyx_k_strided_and_direct_or_indirect[] = ""; static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; static const char __pyx_k_rotationMatrixShellCorrelateTot[] = "rotationMatrixShellCorrelateTot"; +static const char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced"; static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview"; static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview"; +static const char __pyx_k_Cannot_transpose_memoryview_with[] = "Cannot transpose memoryview with indirect dimensions"; static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; -static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))"; +static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))"; static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; -static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; -static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)"; +static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got "; +static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis "; static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; -static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)"; +static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension "; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_rotationMatrixShellCorrelateDist[] = "rotationMatrixShellCorrelateDist"; static const char __pyx_k_rotationMatrixShellCorrelateTotP[] = "rotationMatrixShellCorrelateTotParts"; static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; -static PyObject *__pyx_n_s_ASCII; -static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; -static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; -static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; -static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; -static PyObject *__pyx_kp_s_Cannot_index_with_type_s; -static PyObject *__pyx_n_s_Ellipsis; -static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; -static PyObject *__pyx_n_s_ImportError; -static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; -static PyObject *__pyx_n_s_IndexError; -static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; -static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; -static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d; -static PyObject *__pyx_n_s_MemoryError; -static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; -static PyObject *__pyx_kp_s_MemoryView_of_r_object; -static PyObject *__pyx_n_b_O; -static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a; -static PyObject *__pyx_n_s_PickleError; -static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s_View_MemoryView; -static PyObject *__pyx_n_s_allocate_buffer; -static PyObject *__pyx_n_s_ans; -static PyObject *__pyx_n_s_asarray; -static PyObject *__pyx_n_s_ascontiguousarray; -static PyObject *__pyx_n_s_base; -static PyObject *__pyx_n_s_c; -static PyObject *__pyx_n_u_c; -static PyObject *__pyx_n_s_calcAngularDisplacement; -static PyObject *__pyx_n_s_calcAngularVelocityXCorrel; -static PyObject *__pyx_n_s_calcRelativeAngDisp; -static PyObject *__pyx_n_s_ccorr; -static PyObject *__pyx_n_s_ccrosscorr; -static PyObject *__pyx_n_s_ccrossctr; -static PyObject *__pyx_n_s_cctr; -static PyObject *__pyx_n_s_cdata; -static PyObject *__pyx_n_s_cdata1; -static PyObject *__pyx_n_s_cdata2; -static PyObject *__pyx_n_s_cds; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_contdata; -static PyObject *__pyx_n_s_contdata1; -static PyObject *__pyx_n_s_contdata2; -static PyObject *__pyx_n_s_contds; -static PyObject *__pyx_kp_s_contiguous_and_direct; -static PyObject *__pyx_kp_s_contiguous_and_indirect; -static PyObject *__pyx_n_s_coor1_ts; -static PyObject *__pyx_n_s_coor2_ts; -static PyObject *__pyx_n_s_coor_ts; -static PyObject *__pyx_n_s_corr; -static PyObject *__pyx_n_s_corrdim; -static PyObject *__pyx_n_s_correlate; -static PyObject *__pyx_n_s_correlateParallel; -static PyObject *__pyx_n_s_crosscorr; -static PyObject *__pyx_n_s_crossctr; -static PyObject *__pyx_n_s_cselfcorr; -static PyObject *__pyx_n_s_cselfctr; -static PyObject *__pyx_n_s_ctr; -static PyObject *__pyx_n_s_d1; -static PyObject *__pyx_n_s_d2; -static PyObject *__pyx_n_s_data; -static PyObject *__pyx_n_s_data1; -static PyObject *__pyx_n_s_data2; -static PyObject *__pyx_n_s_datapoints; -static PyObject *__pyx_n_s_delta; -static PyObject *__pyx_n_s_dict; -static PyObject *__pyx_n_s_dim; -static PyObject *__pyx_n_s_ds; -static PyObject *__pyx_n_s_dsidx; -static PyObject *__pyx_n_s_dt; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_dtype_is_object; -static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_end; -static PyObject *__pyx_n_s_enumerate; -static PyObject *__pyx_n_s_error; -static PyObject *__pyx_n_s_file; -static PyObject *__pyx_n_s_flags; -static PyObject *__pyx_n_s_float64; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_fortran; -static PyObject *__pyx_n_u_fortran; -static PyObject *__pyx_n_s_getstate; -static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_idx; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_istart; -static PyObject *__pyx_n_s_itemsize; -static PyObject *__pyx_kp_s_itemsize_0_for_cython_array; -static PyObject *__pyx_n_s_j; -static PyObject *__pyx_n_s_k; -static PyObject *__pyx_n_s_l; -static PyObject *__pyx_n_s_lowhigh; -static PyObject *__pyx_n_s_ltc; -static PyObject *__pyx_n_s_ltc_2; -static PyObject *__pyx_n_s_m; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_maxTime; -static PyObject *__pyx_n_s_maxdt; -static PyObject *__pyx_n_s_maxlen; -static PyObject *__pyx_n_s_memview; -static PyObject *__pyx_n_s_mode; -static PyObject *__pyx_n_s_mol; -static PyObject *__pyx_n_s_msd; -static PyObject *__pyx_n_s_myCorrel; -static PyObject *__pyx_n_s_myplan; -static PyObject *__pyx_n_s_n; -static PyObject *__pyx_n_s_n_2; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_name_2; -static PyObject *__pyx_n_s_natoms; -static PyObject *__pyx_n_s_natoms1; -static PyObject *__pyx_n_s_natoms2; -static PyObject *__pyx_n_s_nc; -static PyObject *__pyx_n_s_ncut; -static PyObject *__pyx_n_s_ndim; -static PyObject *__pyx_n_s_nds; -static PyObject *__pyx_n_s_new; -static PyObject *__pyx_n_s_newanalysis_correl; -static PyObject *__pyx_n_s_nmol; -static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; -static PyObject *__pyx_n_s_np; -static PyObject *__pyx_n_s_nshells; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; -static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; -static PyObject *__pyx_n_s_obj; -static PyObject *__pyx_n_s_out; -static PyObject *__pyx_n_s_p_ans; -static PyObject *__pyx_n_s_p_data1; -static PyObject *__pyx_n_s_p_data2; -static PyObject *__pyx_n_s_p_out; -static PyObject *__pyx_n_s_p_tmp; -static PyObject *__pyx_n_s_pack; -static PyObject *__pyx_n_s_pcorr; -static PyObject *__pyx_n_s_pcorrdim; -static PyObject *__pyx_n_s_pcrosscorr; -static PyObject *__pyx_n_s_pdata; -static PyObject *__pyx_n_s_pdata1; -static PyObject *__pyx_n_s_pdata2; -static PyObject *__pyx_n_s_pds; -static PyObject *__pyx_n_s_pickle; -static PyObject *__pyx_n_s_pnshells; -static PyObject *__pyx_n_s_point; -static PyObject *__pyx_n_s_print; -static PyObject *__pyx_n_s_pselfcorr; -static PyObject *__pyx_n_s_pyx_PickleError; -static PyObject *__pyx_n_s_pyx_checksum; -static PyObject *__pyx_n_s_pyx_getbuffer; -static PyObject *__pyx_n_s_pyx_result; -static PyObject *__pyx_n_s_pyx_state; -static PyObject *__pyx_n_s_pyx_type; -static PyObject *__pyx_n_s_pyx_unpickle_Enum; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_reduce; -static PyObject *__pyx_n_s_reduce_cython; -static PyObject *__pyx_n_s_reduce_ex; -static PyObject *__pyx_n_s_rotTs; -static PyObject *__pyx_n_s_rotTs1; -static PyObject *__pyx_n_s_rotTs2; -static PyObject *__pyx_n_s_rotTs3; -static PyObject *__pyx_n_s_rotationMatrixShellCorrelate; -static PyObject *__pyx_n_s_rotationMatrixShellCorrelateDist; -static PyObject *__pyx_n_s_rotationMatrixShellCorrelateTot; -static PyObject *__pyx_n_s_rotationMatrixShellCorrelateTotP; -static PyObject *__pyx_kp_s_self_too_sparse; -static PyObject *__pyx_n_s_selfcorr; -static PyObject *__pyx_n_s_selfctr; -static PyObject *__pyx_n_s_setstate; -static PyObject *__pyx_n_s_setstate_cython; -static PyObject *__pyx_n_s_shape; -static PyObject *__pyx_n_s_shell; -static PyObject *__pyx_n_s_shelldt; -static PyObject *__pyx_n_s_shellstart; -static PyObject *__pyx_n_s_size; -static PyObject *__pyx_n_s_sparsecorrelate; -static PyObject *__pyx_n_s_sparsecrosscorrelate; -static PyObject *__pyx_n_s_sparsefullcorrelate; -static PyObject *__pyx_n_s_sparsefullcrosscorrelate; -static PyObject *__pyx_n_s_sparsefullnobulkcorrelate; -static PyObject *__pyx_n_s_sparsefullnobulkthincorrelate; -static PyObject *__pyx_n_s_sparsefullnobulkthingreenkubo; -static PyObject *__pyx_kp_s_src_helpers_correl_pyx; -static PyObject *__pyx_n_s_start; -static PyObject *__pyx_n_s_startingpoints; -static PyObject *__pyx_n_s_startmax; -static PyObject *__pyx_n_s_startskip; -static PyObject *__pyx_n_s_step; -static PyObject *__pyx_n_s_stop; -static PyObject *__pyx_kp_s_strided_and_direct; -static PyObject *__pyx_kp_s_strided_and_direct_or_indirect; -static PyObject *__pyx_kp_s_strided_and_indirect; -static PyObject *__pyx_kp_s_stringsource; -static PyObject *__pyx_n_s_struct; -static PyObject *__pyx_n_s_t; -static PyObject *__pyx_n_s_t1; -static PyObject *__pyx_n_s_t2; -static PyObject *__pyx_n_s_t3; -static PyObject *__pyx_n_s_t4; -static PyObject *__pyx_n_s_t5; -static PyObject *__pyx_n_s_t6; -static PyObject *__pyx_n_s_tempvalue; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_tmp; -static PyObject *__pyx_kp_s_too_sparse; -static PyObject *__pyx_kp_s_tot_too_sparse; -static PyObject *__pyx_n_s_transform; -static PyObject *__pyx_kp_s_unable_to_allocate_array_data; -static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; -static PyObject *__pyx_n_s_unpack; -static PyObject *__pyx_n_s_update; -static PyObject *__pyx_n_s_validx; -static PyObject *__pyx_n_s_value; -static PyObject *__pyx_n_s_vectorRotation; -static PyObject *__pyx_n_s_wcorr1; -static PyObject *__pyx_n_s_wcorr2; -static PyObject *__pyx_n_s_wxcorr; -static PyObject *__pyx_n_s_xcf; -static PyObject *__pyx_n_s_zeros; -static PyObject *__pyx_pf_11newanalysis_6correl_correlateParallel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2, PyArrayObject *__pyx_v_out, PyObject *__pyx_v_ltc); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_2correlate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2, PyObject *__pyx_v_ltc); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_4transform(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_data, PyObject *__pyx_v_ltc); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_6sparsecrosscorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_8sparsefullcorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_10sparsefullnobulkcorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_12rotationMatrixShellCorrelateDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_14rotationMatrixShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_16rotationMatrixShellCorrelateTot(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_18rotationMatrixShellCorrelateTotParts(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs1, __Pyx_memviewslice __pyx_v_rotTs2, __Pyx_memviewslice __pyx_v_rotTs3, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_20vectorRotation(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, int __pyx_v_datapoints); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_22sparsefullnobulkthincorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_startingpoints); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_24sparsefullnobulkthingreenkubo(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_startingpoints); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_26sparsefullcrosscorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata1, PyArrayObject *__pyx_v_pdata2, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_28sparsecorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyObject *__pyx_v_maxlen); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_30calcAngularDisplacement(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor_ts, PyObject *__pyx_v_delta); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_32calcAngularVelocityXCorrel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor1_ts, PyArrayObject *__pyx_v_coor2_ts, PyObject *__pyx_v_delta); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6correl_34calcRelativeAngDisp(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor1_ts, PyArrayObject *__pyx_v_coor2_ts, PyObject *__pyx_v_delta, PyObject *__pyx_v_ncut); /* proto */ +/* #### Code section: decls ### */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ @@ -2946,30164 +3536,33940 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_correlateParallel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2, PyArrayObject *__pyx_v_out, PyObject *__pyx_v_ltc); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_2correlate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2, PyObject *__pyx_v_ltc); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_4transform(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_data, PyObject *__pyx_v_ltc); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_6sparsecrosscorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_8sparsefullcorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_10sparsefullnobulkcorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_12rotationMatrixShellCorrelateDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_14rotationMatrixShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_16rotationMatrixShellCorrelateTot(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_18rotationMatrixShellCorrelateTotParts(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs1, __Pyx_memviewslice __pyx_v_rotTs2, __Pyx_memviewslice __pyx_v_rotTs3, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_20vectorRotation(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, int __pyx_v_datapoints); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_22sparsefullnobulkthincorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_startingpoints); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_24sparsefullnobulkthingreenkubo(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_startingpoints); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_26sparsefullcrosscorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata1, PyArrayObject *__pyx_v_pdata2, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_28sparsecorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyObject *__pyx_v_maxlen); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_30calcAngularDisplacement(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor_ts, PyObject *__pyx_v_delta); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_32calcAngularVelocityXCorrel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor1_ts, PyArrayObject *__pyx_v_coor2_ts, PyObject *__pyx_v_delta); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6correl_34calcRelativeAngDisp(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor1_ts, PyArrayObject *__pyx_v_coor2_ts, PyObject *__pyx_v_delta, PyObject *__pyx_v_ncut); /* proto */ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_2; -static PyObject *__pyx_int_3; -static PyObject *__pyx_int_6; -static PyObject *__pyx_int_12; -static PyObject *__pyx_int_20; -static PyObject *__pyx_int_112105877; -static PyObject *__pyx_int_136983863; -static PyObject *__pyx_int_184977713; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__17; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__24; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__28; -static PyObject *__pyx_tuple__30; -static PyObject *__pyx_tuple__32; -static PyObject *__pyx_tuple__34; -static PyObject *__pyx_tuple__36; -static PyObject *__pyx_tuple__38; -static PyObject *__pyx_tuple__40; -static PyObject *__pyx_tuple__42; -static PyObject *__pyx_tuple__44; -static PyObject *__pyx_tuple__46; -static PyObject *__pyx_tuple__48; -static PyObject *__pyx_tuple__50; -static PyObject *__pyx_tuple__52; -static PyObject *__pyx_tuple__54; -static PyObject *__pyx_tuple__56; -static PyObject *__pyx_tuple__58; -static PyObject *__pyx_tuple__59; -static PyObject *__pyx_tuple__60; -static PyObject *__pyx_tuple__61; -static PyObject *__pyx_tuple__62; -static PyObject *__pyx_tuple__63; -static PyObject *__pyx_codeobj__23; -static PyObject *__pyx_codeobj__25; -static PyObject *__pyx_codeobj__27; -static PyObject *__pyx_codeobj__29; -static PyObject *__pyx_codeobj__31; -static PyObject *__pyx_codeobj__33; -static PyObject *__pyx_codeobj__35; -static PyObject *__pyx_codeobj__37; -static PyObject *__pyx_codeobj__39; -static PyObject *__pyx_codeobj__41; -static PyObject *__pyx_codeobj__43; -static PyObject *__pyx_codeobj__45; -static PyObject *__pyx_codeobj__47; -static PyObject *__pyx_codeobj__49; -static PyObject *__pyx_codeobj__51; -static PyObject *__pyx_codeobj__53; -static PyObject *__pyx_codeobj__55; -static PyObject *__pyx_codeobj__57; -static PyObject *__pyx_codeobj__64; -/* Late includes */ - -/* "src/helpers/correl.pyx":25 +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4type_type; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + #endif + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + PyObject *__pyx_kp_u_; + PyObject *__pyx_n_s_ASCII; + PyObject *__pyx_kp_s_All_dimensions_preceding_dimensi; + PyObject *__pyx_n_s_AssertionError; + PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; + PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; + PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; + PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; + PyObject *__pyx_kp_u_Cannot_index_with_type; + PyObject *__pyx_kp_s_Cannot_transpose_memoryview_with; + PyObject *__pyx_kp_s_Dimension_d_is_not_direct; + PyObject *__pyx_n_s_Ellipsis; + PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; + PyObject *__pyx_n_s_ImportError; + PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; + PyObject *__pyx_n_s_IndexError; + PyObject *__pyx_kp_s_Index_out_of_bounds_axis_d; + PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; + PyObject *__pyx_kp_u_Invalid_mode_expected_c_or_fortr; + PyObject *__pyx_kp_u_Invalid_shape_in_axis; + PyObject *__pyx_n_s_MemoryError; + PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; + PyObject *__pyx_kp_s_MemoryView_of_r_object; + PyObject *__pyx_n_b_O; + PyObject *__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + PyObject *__pyx_n_s_PickleError; + PyObject *__pyx_n_s_Sequence; + PyObject *__pyx_kp_s_Step_may_not_be_zero_axis_d; + PyObject *__pyx_n_s_TypeError; + PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; + PyObject *__pyx_n_s_ValueError; + PyObject *__pyx_n_s_View_MemoryView; + PyObject *__pyx_kp_u__2; + PyObject *__pyx_n_s__3; + PyObject *__pyx_kp_u__6; + PyObject *__pyx_n_s__64; + PyObject *__pyx_kp_u__7; + PyObject *__pyx_n_s_abc; + PyObject *__pyx_n_s_allocate_buffer; + PyObject *__pyx_kp_u_and; + PyObject *__pyx_n_s_ans; + PyObject *__pyx_n_s_asarray; + PyObject *__pyx_n_s_ascontiguousarray; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_base; + PyObject *__pyx_n_s_c; + PyObject *__pyx_n_u_c; + PyObject *__pyx_n_s_calcAngularDisplacement; + PyObject *__pyx_n_s_calcAngularVelocityXCorrel; + PyObject *__pyx_n_s_calcRelativeAngDisp; + PyObject *__pyx_n_s_ccorr; + PyObject *__pyx_n_s_ccrosscorr; + PyObject *__pyx_n_s_ccrossctr; + PyObject *__pyx_n_s_cctr; + PyObject *__pyx_n_s_cdata; + PyObject *__pyx_n_s_cdata1; + PyObject *__pyx_n_s_cdata2; + PyObject *__pyx_n_s_cds; + PyObject *__pyx_n_s_class; + PyObject *__pyx_n_s_class_getitem; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_collections; + PyObject *__pyx_kp_s_collections_abc; + PyObject *__pyx_n_s_contdata; + PyObject *__pyx_n_s_contdata1; + PyObject *__pyx_n_s_contdata2; + PyObject *__pyx_n_s_contds; + PyObject *__pyx_kp_s_contiguous_and_direct; + PyObject *__pyx_kp_s_contiguous_and_indirect; + PyObject *__pyx_n_s_coor1_ts; + PyObject *__pyx_n_s_coor2_ts; + PyObject *__pyx_n_s_coor_ts; + PyObject *__pyx_n_s_corr; + PyObject *__pyx_n_s_corrdim; + PyObject *__pyx_n_s_correlate; + PyObject *__pyx_n_s_correlateParallel; + PyObject *__pyx_n_s_count; + PyObject *__pyx_n_s_crosscorr; + PyObject *__pyx_n_s_crossctr; + PyObject *__pyx_n_s_cselfcorr; + PyObject *__pyx_n_s_cselfctr; + PyObject *__pyx_n_s_ctr; + PyObject *__pyx_n_s_d1; + PyObject *__pyx_n_s_d2; + PyObject *__pyx_n_s_data; + PyObject *__pyx_n_s_data1; + PyObject *__pyx_n_s_data2; + PyObject *__pyx_n_s_datapoints; + PyObject *__pyx_n_s_delta; + PyObject *__pyx_n_s_dict; + PyObject *__pyx_n_s_dim; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_n_s_ds; + PyObject *__pyx_n_s_dsidx; + PyObject *__pyx_n_s_dt; + PyObject *__pyx_n_s_dtype; + PyObject *__pyx_n_s_dtype_is_object; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_encode; + PyObject *__pyx_n_s_enumerate; + PyObject *__pyx_n_s_error; + PyObject *__pyx_n_s_flags; + PyObject *__pyx_n_s_float64; + PyObject *__pyx_n_s_format; + PyObject *__pyx_n_s_fortran; + PyObject *__pyx_n_u_fortran; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_getstate; + PyObject *__pyx_kp_u_got; + PyObject *__pyx_kp_u_got_differing_extents_in_dimensi; + PyObject *__pyx_n_s_i; + PyObject *__pyx_n_s_id; + PyObject *__pyx_n_s_idx; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_index; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_istart; + PyObject *__pyx_n_s_itemsize; + PyObject *__pyx_kp_s_itemsize_0_for_cython_array; + PyObject *__pyx_n_s_j; + PyObject *__pyx_n_s_k; + PyObject *__pyx_n_s_l; + PyObject *__pyx_n_s_lowhigh; + PyObject *__pyx_n_s_ltc; + PyObject *__pyx_n_s_ltc_2; + PyObject *__pyx_n_s_m; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_maxTime; + PyObject *__pyx_n_s_maxdt; + PyObject *__pyx_n_s_maxlen; + PyObject *__pyx_n_s_memview; + PyObject *__pyx_n_s_mode; + PyObject *__pyx_n_s_mol; + PyObject *__pyx_n_s_msd; + PyObject *__pyx_n_s_myCorrel; + PyObject *__pyx_n_s_myplan; + PyObject *__pyx_n_s_n; + PyObject *__pyx_n_s_n_2; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_name_2; + PyObject *__pyx_n_s_natoms; + PyObject *__pyx_n_s_natoms1; + PyObject *__pyx_n_s_natoms2; + PyObject *__pyx_n_s_nc; + PyObject *__pyx_n_s_ncut; + PyObject *__pyx_n_s_ndim; + PyObject *__pyx_n_s_nds; + PyObject *__pyx_n_s_new; + PyObject *__pyx_n_s_newanalysis_correl; + PyObject *__pyx_kp_s_newanalysis_helpers_correl_pyx; + PyObject *__pyx_n_s_nmol; + PyObject *__pyx_kp_s_no_default___reduce___due_to_non; + PyObject *__pyx_n_s_np; + PyObject *__pyx_n_s_nshells; + PyObject *__pyx_n_s_numpy; + PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; + PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; + PyObject *__pyx_n_s_obj; + PyObject *__pyx_n_s_out; + PyObject *__pyx_n_s_p_ans; + PyObject *__pyx_n_s_p_data1; + PyObject *__pyx_n_s_p_data2; + PyObject *__pyx_n_s_p_out; + PyObject *__pyx_n_s_p_tmp; + PyObject *__pyx_n_s_pack; + PyObject *__pyx_n_s_pcorr; + PyObject *__pyx_n_s_pcorrdim; + PyObject *__pyx_n_s_pcrosscorr; + PyObject *__pyx_n_s_pdata; + PyObject *__pyx_n_s_pdata1; + PyObject *__pyx_n_s_pdata2; + PyObject *__pyx_n_s_pds; + PyObject *__pyx_n_s_pickle; + PyObject *__pyx_n_s_pnshells; + PyObject *__pyx_n_s_point; + PyObject *__pyx_n_s_print; + PyObject *__pyx_n_s_pselfcorr; + PyObject *__pyx_n_s_pyx_PickleError; + PyObject *__pyx_n_s_pyx_checksum; + PyObject *__pyx_n_s_pyx_result; + PyObject *__pyx_n_s_pyx_state; + PyObject *__pyx_n_s_pyx_type; + PyObject *__pyx_n_s_pyx_unpickle_Enum; + PyObject *__pyx_n_s_pyx_vtable; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_reduce; + PyObject *__pyx_n_s_reduce_cython; + PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_register; + PyObject *__pyx_n_s_rotTs; + PyObject *__pyx_n_s_rotTs1; + PyObject *__pyx_n_s_rotTs2; + PyObject *__pyx_n_s_rotTs3; + PyObject *__pyx_n_s_rotationMatrixShellCorrelate; + PyObject *__pyx_n_s_rotationMatrixShellCorrelateDist; + PyObject *__pyx_n_s_rotationMatrixShellCorrelateTot; + PyObject *__pyx_n_s_rotationMatrixShellCorrelateTotP; + PyObject *__pyx_kp_s_self_too_sparse; + PyObject *__pyx_n_s_selfcorr; + PyObject *__pyx_n_s_selfctr; + PyObject *__pyx_n_s_setstate; + PyObject *__pyx_n_s_setstate_cython; + PyObject *__pyx_n_s_shape; + PyObject *__pyx_n_s_shell; + PyObject *__pyx_n_s_shelldt; + PyObject *__pyx_n_s_shellstart; + PyObject *__pyx_n_s_size; + PyObject *__pyx_n_s_sparsecorrelate; + PyObject *__pyx_n_s_sparsecrosscorrelate; + PyObject *__pyx_n_s_sparsefullcorrelate; + PyObject *__pyx_n_s_sparsefullcrosscorrelate; + PyObject *__pyx_n_s_sparsefullnobulkcorrelate; + PyObject *__pyx_n_s_sparsefullnobulkthincorrelate; + PyObject *__pyx_n_s_sparsefullnobulkthingreenkubo; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_start; + PyObject *__pyx_n_s_startingpoints; + PyObject *__pyx_n_s_startmax; + PyObject *__pyx_n_s_startskip; + PyObject *__pyx_n_s_step; + PyObject *__pyx_n_s_stop; + PyObject *__pyx_kp_s_strided_and_direct; + PyObject *__pyx_kp_s_strided_and_direct_or_indirect; + PyObject *__pyx_kp_s_strided_and_indirect; + PyObject *__pyx_kp_s_stringsource; + PyObject *__pyx_n_s_struct; + PyObject *__pyx_n_s_sys; + PyObject *__pyx_n_s_t; + PyObject *__pyx_n_s_t1; + PyObject *__pyx_n_s_t2; + PyObject *__pyx_n_s_t3; + PyObject *__pyx_n_s_t4; + PyObject *__pyx_n_s_t5; + PyObject *__pyx_n_s_t6; + PyObject *__pyx_n_s_tempvalue; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_tmp; + PyObject *__pyx_kp_s_too_sparse; + PyObject *__pyx_kp_s_tot_too_sparse; + PyObject *__pyx_n_s_transform; + PyObject *__pyx_kp_s_unable_to_allocate_array_data; + PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; + PyObject *__pyx_n_s_unpack; + PyObject *__pyx_n_s_update; + PyObject *__pyx_n_s_validx; + PyObject *__pyx_n_s_value; + PyObject *__pyx_n_s_vectorRotation; + PyObject *__pyx_n_s_version_info; + PyObject *__pyx_n_s_wcorr1; + PyObject *__pyx_n_s_wcorr2; + PyObject *__pyx_n_s_wxcorr; + PyObject *__pyx_n_s_xcf; + PyObject *__pyx_n_s_zeros; + PyObject *__pyx_int_0; + PyObject *__pyx_int_1; + PyObject *__pyx_int_2; + PyObject *__pyx_int_3; + PyObject *__pyx_int_6; + PyObject *__pyx_int_12; + PyObject *__pyx_int_20; + PyObject *__pyx_int_112105877; + PyObject *__pyx_int_136983863; + PyObject *__pyx_int_184977713; + PyObject *__pyx_int_neg_1; + PyObject *__pyx_slice__5; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__8; + PyObject *__pyx_tuple__9; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__11; + PyObject *__pyx_tuple__12; + PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__14; + PyObject *__pyx_tuple__15; + PyObject *__pyx_tuple__16; + PyObject *__pyx_tuple__17; + PyObject *__pyx_tuple__18; + PyObject *__pyx_tuple__19; + PyObject *__pyx_tuple__20; + PyObject *__pyx_tuple__21; + PyObject *__pyx_tuple__22; + PyObject *__pyx_tuple__23; + PyObject *__pyx_tuple__25; + PyObject *__pyx_tuple__27; + PyObject *__pyx_tuple__28; + PyObject *__pyx_tuple__30; + PyObject *__pyx_tuple__32; + PyObject *__pyx_tuple__34; + PyObject *__pyx_tuple__35; + PyObject *__pyx_tuple__37; + PyObject *__pyx_tuple__39; + PyObject *__pyx_tuple__41; + PyObject *__pyx_tuple__43; + PyObject *__pyx_tuple__45; + PyObject *__pyx_tuple__47; + PyObject *__pyx_tuple__49; + PyObject *__pyx_tuple__51; + PyObject *__pyx_tuple__52; + PyObject *__pyx_tuple__54; + PyObject *__pyx_tuple__56; + PyObject *__pyx_tuple__58; + PyObject *__pyx_tuple__60; + PyObject *__pyx_tuple__62; + PyObject *__pyx_codeobj__24; + PyObject *__pyx_codeobj__26; + PyObject *__pyx_codeobj__29; + PyObject *__pyx_codeobj__31; + PyObject *__pyx_codeobj__33; + PyObject *__pyx_codeobj__36; + PyObject *__pyx_codeobj__38; + PyObject *__pyx_codeobj__40; + PyObject *__pyx_codeobj__42; + PyObject *__pyx_codeobj__44; + PyObject *__pyx_codeobj__46; + PyObject *__pyx_codeobj__48; + PyObject *__pyx_codeobj__50; + PyObject *__pyx_codeobj__53; + PyObject *__pyx_codeobj__55; + PyObject *__pyx_codeobj__57; + PyObject *__pyx_codeobj__59; + PyObject *__pyx_codeobj__61; + PyObject *__pyx_codeobj__63; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) + +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_n_s_ASCII); + Py_CLEAR(clear_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_CLEAR(clear_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_CLEAR(clear_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_CLEAR(clear_module_state->__pyx_n_s_Ellipsis); + Py_CLEAR(clear_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_CLEAR(clear_module_state->__pyx_n_s_ImportError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_CLEAR(clear_module_state->__pyx_n_s_IndexError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_CLEAR(clear_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_CLEAR(clear_module_state->__pyx_n_b_O); + Py_CLEAR(clear_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_Sequence); + Py_CLEAR(clear_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); + Py_CLEAR(clear_module_state->__pyx_n_s_View_MemoryView); + Py_CLEAR(clear_module_state->__pyx_kp_u__2); + Py_CLEAR(clear_module_state->__pyx_n_s__3); + Py_CLEAR(clear_module_state->__pyx_kp_u__6); + Py_CLEAR(clear_module_state->__pyx_n_s__64); + Py_CLEAR(clear_module_state->__pyx_kp_u__7); + Py_CLEAR(clear_module_state->__pyx_n_s_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_allocate_buffer); + Py_CLEAR(clear_module_state->__pyx_kp_u_and); + Py_CLEAR(clear_module_state->__pyx_n_s_ans); + Py_CLEAR(clear_module_state->__pyx_n_s_asarray); + Py_CLEAR(clear_module_state->__pyx_n_s_ascontiguousarray); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_base); + Py_CLEAR(clear_module_state->__pyx_n_s_c); + Py_CLEAR(clear_module_state->__pyx_n_u_c); + Py_CLEAR(clear_module_state->__pyx_n_s_calcAngularDisplacement); + Py_CLEAR(clear_module_state->__pyx_n_s_calcAngularVelocityXCorrel); + Py_CLEAR(clear_module_state->__pyx_n_s_calcRelativeAngDisp); + Py_CLEAR(clear_module_state->__pyx_n_s_ccorr); + Py_CLEAR(clear_module_state->__pyx_n_s_ccrosscorr); + Py_CLEAR(clear_module_state->__pyx_n_s_ccrossctr); + Py_CLEAR(clear_module_state->__pyx_n_s_cctr); + Py_CLEAR(clear_module_state->__pyx_n_s_cdata); + Py_CLEAR(clear_module_state->__pyx_n_s_cdata1); + Py_CLEAR(clear_module_state->__pyx_n_s_cdata2); + Py_CLEAR(clear_module_state->__pyx_n_s_cds); + Py_CLEAR(clear_module_state->__pyx_n_s_class); + Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_collections); + Py_CLEAR(clear_module_state->__pyx_kp_s_collections_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_contdata); + Py_CLEAR(clear_module_state->__pyx_n_s_contdata1); + Py_CLEAR(clear_module_state->__pyx_n_s_contdata2); + Py_CLEAR(clear_module_state->__pyx_n_s_contds); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_CLEAR(clear_module_state->__pyx_n_s_coor1_ts); + Py_CLEAR(clear_module_state->__pyx_n_s_coor2_ts); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_ts); + Py_CLEAR(clear_module_state->__pyx_n_s_corr); + Py_CLEAR(clear_module_state->__pyx_n_s_corrdim); + Py_CLEAR(clear_module_state->__pyx_n_s_correlate); + Py_CLEAR(clear_module_state->__pyx_n_s_correlateParallel); + Py_CLEAR(clear_module_state->__pyx_n_s_count); + Py_CLEAR(clear_module_state->__pyx_n_s_crosscorr); + Py_CLEAR(clear_module_state->__pyx_n_s_crossctr); + Py_CLEAR(clear_module_state->__pyx_n_s_cselfcorr); + Py_CLEAR(clear_module_state->__pyx_n_s_cselfctr); + Py_CLEAR(clear_module_state->__pyx_n_s_ctr); + Py_CLEAR(clear_module_state->__pyx_n_s_d1); + Py_CLEAR(clear_module_state->__pyx_n_s_d2); + Py_CLEAR(clear_module_state->__pyx_n_s_data); + Py_CLEAR(clear_module_state->__pyx_n_s_data1); + Py_CLEAR(clear_module_state->__pyx_n_s_data2); + Py_CLEAR(clear_module_state->__pyx_n_s_datapoints); + Py_CLEAR(clear_module_state->__pyx_n_s_delta); + Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_n_s_dim); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_ds); + Py_CLEAR(clear_module_state->__pyx_n_s_dsidx); + Py_CLEAR(clear_module_state->__pyx_n_s_dt); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype_is_object); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); + Py_CLEAR(clear_module_state->__pyx_n_s_error); + Py_CLEAR(clear_module_state->__pyx_n_s_flags); + Py_CLEAR(clear_module_state->__pyx_n_s_float64); + Py_CLEAR(clear_module_state->__pyx_n_s_format); + Py_CLEAR(clear_module_state->__pyx_n_s_fortran); + Py_CLEAR(clear_module_state->__pyx_n_u_fortran); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_kp_u_got); + Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_i); + Py_CLEAR(clear_module_state->__pyx_n_s_id); + Py_CLEAR(clear_module_state->__pyx_n_s_idx); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_index); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_istart); + Py_CLEAR(clear_module_state->__pyx_n_s_itemsize); + Py_CLEAR(clear_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_CLEAR(clear_module_state->__pyx_n_s_j); + Py_CLEAR(clear_module_state->__pyx_n_s_k); + Py_CLEAR(clear_module_state->__pyx_n_s_l); + Py_CLEAR(clear_module_state->__pyx_n_s_lowhigh); + Py_CLEAR(clear_module_state->__pyx_n_s_ltc); + Py_CLEAR(clear_module_state->__pyx_n_s_ltc_2); + Py_CLEAR(clear_module_state->__pyx_n_s_m); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_maxTime); + Py_CLEAR(clear_module_state->__pyx_n_s_maxdt); + Py_CLEAR(clear_module_state->__pyx_n_s_maxlen); + Py_CLEAR(clear_module_state->__pyx_n_s_memview); + Py_CLEAR(clear_module_state->__pyx_n_s_mode); + Py_CLEAR(clear_module_state->__pyx_n_s_mol); + Py_CLEAR(clear_module_state->__pyx_n_s_msd); + Py_CLEAR(clear_module_state->__pyx_n_s_myCorrel); + Py_CLEAR(clear_module_state->__pyx_n_s_myplan); + Py_CLEAR(clear_module_state->__pyx_n_s_n); + Py_CLEAR(clear_module_state->__pyx_n_s_n_2); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_name_2); + Py_CLEAR(clear_module_state->__pyx_n_s_natoms); + Py_CLEAR(clear_module_state->__pyx_n_s_natoms1); + Py_CLEAR(clear_module_state->__pyx_n_s_natoms2); + Py_CLEAR(clear_module_state->__pyx_n_s_nc); + Py_CLEAR(clear_module_state->__pyx_n_s_ncut); + Py_CLEAR(clear_module_state->__pyx_n_s_ndim); + Py_CLEAR(clear_module_state->__pyx_n_s_nds); + Py_CLEAR(clear_module_state->__pyx_n_s_new); + Py_CLEAR(clear_module_state->__pyx_n_s_newanalysis_correl); + Py_CLEAR(clear_module_state->__pyx_kp_s_newanalysis_helpers_correl_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_nmol); + Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_CLEAR(clear_module_state->__pyx_n_s_np); + Py_CLEAR(clear_module_state->__pyx_n_s_nshells); + Py_CLEAR(clear_module_state->__pyx_n_s_numpy); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_CLEAR(clear_module_state->__pyx_n_s_obj); + Py_CLEAR(clear_module_state->__pyx_n_s_out); + Py_CLEAR(clear_module_state->__pyx_n_s_p_ans); + Py_CLEAR(clear_module_state->__pyx_n_s_p_data1); + Py_CLEAR(clear_module_state->__pyx_n_s_p_data2); + Py_CLEAR(clear_module_state->__pyx_n_s_p_out); + Py_CLEAR(clear_module_state->__pyx_n_s_p_tmp); + Py_CLEAR(clear_module_state->__pyx_n_s_pack); + Py_CLEAR(clear_module_state->__pyx_n_s_pcorr); + Py_CLEAR(clear_module_state->__pyx_n_s_pcorrdim); + Py_CLEAR(clear_module_state->__pyx_n_s_pcrosscorr); + Py_CLEAR(clear_module_state->__pyx_n_s_pdata); + Py_CLEAR(clear_module_state->__pyx_n_s_pdata1); + Py_CLEAR(clear_module_state->__pyx_n_s_pdata2); + Py_CLEAR(clear_module_state->__pyx_n_s_pds); + Py_CLEAR(clear_module_state->__pyx_n_s_pickle); + Py_CLEAR(clear_module_state->__pyx_n_s_pnshells); + Py_CLEAR(clear_module_state->__pyx_n_s_point); + Py_CLEAR(clear_module_state->__pyx_n_s_print); + Py_CLEAR(clear_module_state->__pyx_n_s_pselfcorr); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_register); + Py_CLEAR(clear_module_state->__pyx_n_s_rotTs); + Py_CLEAR(clear_module_state->__pyx_n_s_rotTs1); + Py_CLEAR(clear_module_state->__pyx_n_s_rotTs2); + Py_CLEAR(clear_module_state->__pyx_n_s_rotTs3); + Py_CLEAR(clear_module_state->__pyx_n_s_rotationMatrixShellCorrelate); + Py_CLEAR(clear_module_state->__pyx_n_s_rotationMatrixShellCorrelateDist); + Py_CLEAR(clear_module_state->__pyx_n_s_rotationMatrixShellCorrelateTot); + Py_CLEAR(clear_module_state->__pyx_n_s_rotationMatrixShellCorrelateTotP); + Py_CLEAR(clear_module_state->__pyx_kp_s_self_too_sparse); + Py_CLEAR(clear_module_state->__pyx_n_s_selfcorr); + Py_CLEAR(clear_module_state->__pyx_n_s_selfctr); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_shape); + Py_CLEAR(clear_module_state->__pyx_n_s_shell); + Py_CLEAR(clear_module_state->__pyx_n_s_shelldt); + Py_CLEAR(clear_module_state->__pyx_n_s_shellstart); + Py_CLEAR(clear_module_state->__pyx_n_s_size); + Py_CLEAR(clear_module_state->__pyx_n_s_sparsecorrelate); + Py_CLEAR(clear_module_state->__pyx_n_s_sparsecrosscorrelate); + Py_CLEAR(clear_module_state->__pyx_n_s_sparsefullcorrelate); + Py_CLEAR(clear_module_state->__pyx_n_s_sparsefullcrosscorrelate); + Py_CLEAR(clear_module_state->__pyx_n_s_sparsefullnobulkcorrelate); + Py_CLEAR(clear_module_state->__pyx_n_s_sparsefullnobulkthincorrelate); + Py_CLEAR(clear_module_state->__pyx_n_s_sparsefullnobulkthingreenkubo); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_start); + Py_CLEAR(clear_module_state->__pyx_n_s_startingpoints); + Py_CLEAR(clear_module_state->__pyx_n_s_startmax); + Py_CLEAR(clear_module_state->__pyx_n_s_startskip); + Py_CLEAR(clear_module_state->__pyx_n_s_step); + Py_CLEAR(clear_module_state->__pyx_n_s_stop); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_struct); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_t); + Py_CLEAR(clear_module_state->__pyx_n_s_t1); + Py_CLEAR(clear_module_state->__pyx_n_s_t2); + Py_CLEAR(clear_module_state->__pyx_n_s_t3); + Py_CLEAR(clear_module_state->__pyx_n_s_t4); + Py_CLEAR(clear_module_state->__pyx_n_s_t5); + Py_CLEAR(clear_module_state->__pyx_n_s_t6); + Py_CLEAR(clear_module_state->__pyx_n_s_tempvalue); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_tmp); + Py_CLEAR(clear_module_state->__pyx_kp_s_too_sparse); + Py_CLEAR(clear_module_state->__pyx_kp_s_tot_too_sparse); + Py_CLEAR(clear_module_state->__pyx_n_s_transform); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_CLEAR(clear_module_state->__pyx_n_s_unpack); + Py_CLEAR(clear_module_state->__pyx_n_s_update); + Py_CLEAR(clear_module_state->__pyx_n_s_validx); + Py_CLEAR(clear_module_state->__pyx_n_s_value); + Py_CLEAR(clear_module_state->__pyx_n_s_vectorRotation); + Py_CLEAR(clear_module_state->__pyx_n_s_version_info); + Py_CLEAR(clear_module_state->__pyx_n_s_wcorr1); + Py_CLEAR(clear_module_state->__pyx_n_s_wcorr2); + Py_CLEAR(clear_module_state->__pyx_n_s_wxcorr); + Py_CLEAR(clear_module_state->__pyx_n_s_xcf); + Py_CLEAR(clear_module_state->__pyx_n_s_zeros); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_2); + Py_CLEAR(clear_module_state->__pyx_int_3); + Py_CLEAR(clear_module_state->__pyx_int_6); + Py_CLEAR(clear_module_state->__pyx_int_12); + Py_CLEAR(clear_module_state->__pyx_int_20); + Py_CLEAR(clear_module_state->__pyx_int_112105877); + Py_CLEAR(clear_module_state->__pyx_int_136983863); + Py_CLEAR(clear_module_state->__pyx_int_184977713); + Py_CLEAR(clear_module_state->__pyx_int_neg_1); + Py_CLEAR(clear_module_state->__pyx_slice__5); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_tuple__9); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__14); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__16); + Py_CLEAR(clear_module_state->__pyx_tuple__17); + Py_CLEAR(clear_module_state->__pyx_tuple__18); + Py_CLEAR(clear_module_state->__pyx_tuple__19); + Py_CLEAR(clear_module_state->__pyx_tuple__20); + Py_CLEAR(clear_module_state->__pyx_tuple__21); + Py_CLEAR(clear_module_state->__pyx_tuple__22); + Py_CLEAR(clear_module_state->__pyx_tuple__23); + Py_CLEAR(clear_module_state->__pyx_tuple__25); + Py_CLEAR(clear_module_state->__pyx_tuple__27); + Py_CLEAR(clear_module_state->__pyx_tuple__28); + Py_CLEAR(clear_module_state->__pyx_tuple__30); + Py_CLEAR(clear_module_state->__pyx_tuple__32); + Py_CLEAR(clear_module_state->__pyx_tuple__34); + Py_CLEAR(clear_module_state->__pyx_tuple__35); + Py_CLEAR(clear_module_state->__pyx_tuple__37); + Py_CLEAR(clear_module_state->__pyx_tuple__39); + Py_CLEAR(clear_module_state->__pyx_tuple__41); + Py_CLEAR(clear_module_state->__pyx_tuple__43); + Py_CLEAR(clear_module_state->__pyx_tuple__45); + Py_CLEAR(clear_module_state->__pyx_tuple__47); + Py_CLEAR(clear_module_state->__pyx_tuple__49); + Py_CLEAR(clear_module_state->__pyx_tuple__51); + Py_CLEAR(clear_module_state->__pyx_tuple__52); + Py_CLEAR(clear_module_state->__pyx_tuple__54); + Py_CLEAR(clear_module_state->__pyx_tuple__56); + Py_CLEAR(clear_module_state->__pyx_tuple__58); + Py_CLEAR(clear_module_state->__pyx_tuple__60); + Py_CLEAR(clear_module_state->__pyx_tuple__62); + Py_CLEAR(clear_module_state->__pyx_codeobj__24); + Py_CLEAR(clear_module_state->__pyx_codeobj__26); + Py_CLEAR(clear_module_state->__pyx_codeobj__29); + Py_CLEAR(clear_module_state->__pyx_codeobj__31); + Py_CLEAR(clear_module_state->__pyx_codeobj__33); + Py_CLEAR(clear_module_state->__pyx_codeobj__36); + Py_CLEAR(clear_module_state->__pyx_codeobj__38); + Py_CLEAR(clear_module_state->__pyx_codeobj__40); + Py_CLEAR(clear_module_state->__pyx_codeobj__42); + Py_CLEAR(clear_module_state->__pyx_codeobj__44); + Py_CLEAR(clear_module_state->__pyx_codeobj__46); + Py_CLEAR(clear_module_state->__pyx_codeobj__48); + Py_CLEAR(clear_module_state->__pyx_codeobj__50); + Py_CLEAR(clear_module_state->__pyx_codeobj__53); + Py_CLEAR(clear_module_state->__pyx_codeobj__55); + Py_CLEAR(clear_module_state->__pyx_codeobj__57); + Py_CLEAR(clear_module_state->__pyx_codeobj__59); + Py_CLEAR(clear_module_state->__pyx_codeobj__61); + Py_CLEAR(clear_module_state->__pyx_codeobj__63); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_n_s_ASCII); + Py_VISIT(traverse_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_VISIT(traverse_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_VISIT(traverse_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_VISIT(traverse_module_state->__pyx_n_s_Ellipsis); + Py_VISIT(traverse_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_VISIT(traverse_module_state->__pyx_n_s_ImportError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_VISIT(traverse_module_state->__pyx_n_s_IndexError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_VISIT(traverse_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_VISIT(traverse_module_state->__pyx_n_b_O); + Py_VISIT(traverse_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_Sequence); + Py_VISIT(traverse_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); + Py_VISIT(traverse_module_state->__pyx_n_s_View_MemoryView); + Py_VISIT(traverse_module_state->__pyx_kp_u__2); + Py_VISIT(traverse_module_state->__pyx_n_s__3); + Py_VISIT(traverse_module_state->__pyx_kp_u__6); + Py_VISIT(traverse_module_state->__pyx_n_s__64); + Py_VISIT(traverse_module_state->__pyx_kp_u__7); + Py_VISIT(traverse_module_state->__pyx_n_s_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_allocate_buffer); + Py_VISIT(traverse_module_state->__pyx_kp_u_and); + Py_VISIT(traverse_module_state->__pyx_n_s_ans); + Py_VISIT(traverse_module_state->__pyx_n_s_asarray); + Py_VISIT(traverse_module_state->__pyx_n_s_ascontiguousarray); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_base); + Py_VISIT(traverse_module_state->__pyx_n_s_c); + Py_VISIT(traverse_module_state->__pyx_n_u_c); + Py_VISIT(traverse_module_state->__pyx_n_s_calcAngularDisplacement); + Py_VISIT(traverse_module_state->__pyx_n_s_calcAngularVelocityXCorrel); + Py_VISIT(traverse_module_state->__pyx_n_s_calcRelativeAngDisp); + Py_VISIT(traverse_module_state->__pyx_n_s_ccorr); + Py_VISIT(traverse_module_state->__pyx_n_s_ccrosscorr); + Py_VISIT(traverse_module_state->__pyx_n_s_ccrossctr); + Py_VISIT(traverse_module_state->__pyx_n_s_cctr); + Py_VISIT(traverse_module_state->__pyx_n_s_cdata); + Py_VISIT(traverse_module_state->__pyx_n_s_cdata1); + Py_VISIT(traverse_module_state->__pyx_n_s_cdata2); + Py_VISIT(traverse_module_state->__pyx_n_s_cds); + Py_VISIT(traverse_module_state->__pyx_n_s_class); + Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_collections); + Py_VISIT(traverse_module_state->__pyx_kp_s_collections_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_contdata); + Py_VISIT(traverse_module_state->__pyx_n_s_contdata1); + Py_VISIT(traverse_module_state->__pyx_n_s_contdata2); + Py_VISIT(traverse_module_state->__pyx_n_s_contds); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_VISIT(traverse_module_state->__pyx_n_s_coor1_ts); + Py_VISIT(traverse_module_state->__pyx_n_s_coor2_ts); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_ts); + Py_VISIT(traverse_module_state->__pyx_n_s_corr); + Py_VISIT(traverse_module_state->__pyx_n_s_corrdim); + Py_VISIT(traverse_module_state->__pyx_n_s_correlate); + Py_VISIT(traverse_module_state->__pyx_n_s_correlateParallel); + Py_VISIT(traverse_module_state->__pyx_n_s_count); + Py_VISIT(traverse_module_state->__pyx_n_s_crosscorr); + Py_VISIT(traverse_module_state->__pyx_n_s_crossctr); + Py_VISIT(traverse_module_state->__pyx_n_s_cselfcorr); + Py_VISIT(traverse_module_state->__pyx_n_s_cselfctr); + Py_VISIT(traverse_module_state->__pyx_n_s_ctr); + Py_VISIT(traverse_module_state->__pyx_n_s_d1); + Py_VISIT(traverse_module_state->__pyx_n_s_d2); + Py_VISIT(traverse_module_state->__pyx_n_s_data); + Py_VISIT(traverse_module_state->__pyx_n_s_data1); + Py_VISIT(traverse_module_state->__pyx_n_s_data2); + Py_VISIT(traverse_module_state->__pyx_n_s_datapoints); + Py_VISIT(traverse_module_state->__pyx_n_s_delta); + Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_n_s_dim); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_ds); + Py_VISIT(traverse_module_state->__pyx_n_s_dsidx); + Py_VISIT(traverse_module_state->__pyx_n_s_dt); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype_is_object); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); + Py_VISIT(traverse_module_state->__pyx_n_s_error); + Py_VISIT(traverse_module_state->__pyx_n_s_flags); + Py_VISIT(traverse_module_state->__pyx_n_s_float64); + Py_VISIT(traverse_module_state->__pyx_n_s_format); + Py_VISIT(traverse_module_state->__pyx_n_s_fortran); + Py_VISIT(traverse_module_state->__pyx_n_u_fortran); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_kp_u_got); + Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_i); + Py_VISIT(traverse_module_state->__pyx_n_s_id); + Py_VISIT(traverse_module_state->__pyx_n_s_idx); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_index); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_istart); + Py_VISIT(traverse_module_state->__pyx_n_s_itemsize); + Py_VISIT(traverse_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_VISIT(traverse_module_state->__pyx_n_s_j); + Py_VISIT(traverse_module_state->__pyx_n_s_k); + Py_VISIT(traverse_module_state->__pyx_n_s_l); + Py_VISIT(traverse_module_state->__pyx_n_s_lowhigh); + Py_VISIT(traverse_module_state->__pyx_n_s_ltc); + Py_VISIT(traverse_module_state->__pyx_n_s_ltc_2); + Py_VISIT(traverse_module_state->__pyx_n_s_m); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_maxTime); + Py_VISIT(traverse_module_state->__pyx_n_s_maxdt); + Py_VISIT(traverse_module_state->__pyx_n_s_maxlen); + Py_VISIT(traverse_module_state->__pyx_n_s_memview); + Py_VISIT(traverse_module_state->__pyx_n_s_mode); + Py_VISIT(traverse_module_state->__pyx_n_s_mol); + Py_VISIT(traverse_module_state->__pyx_n_s_msd); + Py_VISIT(traverse_module_state->__pyx_n_s_myCorrel); + Py_VISIT(traverse_module_state->__pyx_n_s_myplan); + Py_VISIT(traverse_module_state->__pyx_n_s_n); + Py_VISIT(traverse_module_state->__pyx_n_s_n_2); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_name_2); + Py_VISIT(traverse_module_state->__pyx_n_s_natoms); + Py_VISIT(traverse_module_state->__pyx_n_s_natoms1); + Py_VISIT(traverse_module_state->__pyx_n_s_natoms2); + Py_VISIT(traverse_module_state->__pyx_n_s_nc); + Py_VISIT(traverse_module_state->__pyx_n_s_ncut); + Py_VISIT(traverse_module_state->__pyx_n_s_ndim); + Py_VISIT(traverse_module_state->__pyx_n_s_nds); + Py_VISIT(traverse_module_state->__pyx_n_s_new); + Py_VISIT(traverse_module_state->__pyx_n_s_newanalysis_correl); + Py_VISIT(traverse_module_state->__pyx_kp_s_newanalysis_helpers_correl_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_nmol); + Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_VISIT(traverse_module_state->__pyx_n_s_np); + Py_VISIT(traverse_module_state->__pyx_n_s_nshells); + Py_VISIT(traverse_module_state->__pyx_n_s_numpy); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_VISIT(traverse_module_state->__pyx_n_s_obj); + Py_VISIT(traverse_module_state->__pyx_n_s_out); + Py_VISIT(traverse_module_state->__pyx_n_s_p_ans); + Py_VISIT(traverse_module_state->__pyx_n_s_p_data1); + Py_VISIT(traverse_module_state->__pyx_n_s_p_data2); + Py_VISIT(traverse_module_state->__pyx_n_s_p_out); + Py_VISIT(traverse_module_state->__pyx_n_s_p_tmp); + Py_VISIT(traverse_module_state->__pyx_n_s_pack); + Py_VISIT(traverse_module_state->__pyx_n_s_pcorr); + Py_VISIT(traverse_module_state->__pyx_n_s_pcorrdim); + Py_VISIT(traverse_module_state->__pyx_n_s_pcrosscorr); + Py_VISIT(traverse_module_state->__pyx_n_s_pdata); + Py_VISIT(traverse_module_state->__pyx_n_s_pdata1); + Py_VISIT(traverse_module_state->__pyx_n_s_pdata2); + Py_VISIT(traverse_module_state->__pyx_n_s_pds); + Py_VISIT(traverse_module_state->__pyx_n_s_pickle); + Py_VISIT(traverse_module_state->__pyx_n_s_pnshells); + Py_VISIT(traverse_module_state->__pyx_n_s_point); + Py_VISIT(traverse_module_state->__pyx_n_s_print); + Py_VISIT(traverse_module_state->__pyx_n_s_pselfcorr); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_register); + Py_VISIT(traverse_module_state->__pyx_n_s_rotTs); + Py_VISIT(traverse_module_state->__pyx_n_s_rotTs1); + Py_VISIT(traverse_module_state->__pyx_n_s_rotTs2); + Py_VISIT(traverse_module_state->__pyx_n_s_rotTs3); + Py_VISIT(traverse_module_state->__pyx_n_s_rotationMatrixShellCorrelate); + Py_VISIT(traverse_module_state->__pyx_n_s_rotationMatrixShellCorrelateDist); + Py_VISIT(traverse_module_state->__pyx_n_s_rotationMatrixShellCorrelateTot); + Py_VISIT(traverse_module_state->__pyx_n_s_rotationMatrixShellCorrelateTotP); + Py_VISIT(traverse_module_state->__pyx_kp_s_self_too_sparse); + Py_VISIT(traverse_module_state->__pyx_n_s_selfcorr); + Py_VISIT(traverse_module_state->__pyx_n_s_selfctr); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_shape); + Py_VISIT(traverse_module_state->__pyx_n_s_shell); + Py_VISIT(traverse_module_state->__pyx_n_s_shelldt); + Py_VISIT(traverse_module_state->__pyx_n_s_shellstart); + Py_VISIT(traverse_module_state->__pyx_n_s_size); + Py_VISIT(traverse_module_state->__pyx_n_s_sparsecorrelate); + Py_VISIT(traverse_module_state->__pyx_n_s_sparsecrosscorrelate); + Py_VISIT(traverse_module_state->__pyx_n_s_sparsefullcorrelate); + Py_VISIT(traverse_module_state->__pyx_n_s_sparsefullcrosscorrelate); + Py_VISIT(traverse_module_state->__pyx_n_s_sparsefullnobulkcorrelate); + Py_VISIT(traverse_module_state->__pyx_n_s_sparsefullnobulkthincorrelate); + Py_VISIT(traverse_module_state->__pyx_n_s_sparsefullnobulkthingreenkubo); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_start); + Py_VISIT(traverse_module_state->__pyx_n_s_startingpoints); + Py_VISIT(traverse_module_state->__pyx_n_s_startmax); + Py_VISIT(traverse_module_state->__pyx_n_s_startskip); + Py_VISIT(traverse_module_state->__pyx_n_s_step); + Py_VISIT(traverse_module_state->__pyx_n_s_stop); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_struct); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_t); + Py_VISIT(traverse_module_state->__pyx_n_s_t1); + Py_VISIT(traverse_module_state->__pyx_n_s_t2); + Py_VISIT(traverse_module_state->__pyx_n_s_t3); + Py_VISIT(traverse_module_state->__pyx_n_s_t4); + Py_VISIT(traverse_module_state->__pyx_n_s_t5); + Py_VISIT(traverse_module_state->__pyx_n_s_t6); + Py_VISIT(traverse_module_state->__pyx_n_s_tempvalue); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_tmp); + Py_VISIT(traverse_module_state->__pyx_kp_s_too_sparse); + Py_VISIT(traverse_module_state->__pyx_kp_s_tot_too_sparse); + Py_VISIT(traverse_module_state->__pyx_n_s_transform); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_VISIT(traverse_module_state->__pyx_n_s_unpack); + Py_VISIT(traverse_module_state->__pyx_n_s_update); + Py_VISIT(traverse_module_state->__pyx_n_s_validx); + Py_VISIT(traverse_module_state->__pyx_n_s_value); + Py_VISIT(traverse_module_state->__pyx_n_s_vectorRotation); + Py_VISIT(traverse_module_state->__pyx_n_s_version_info); + Py_VISIT(traverse_module_state->__pyx_n_s_wcorr1); + Py_VISIT(traverse_module_state->__pyx_n_s_wcorr2); + Py_VISIT(traverse_module_state->__pyx_n_s_wxcorr); + Py_VISIT(traverse_module_state->__pyx_n_s_xcf); + Py_VISIT(traverse_module_state->__pyx_n_s_zeros); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_2); + Py_VISIT(traverse_module_state->__pyx_int_3); + Py_VISIT(traverse_module_state->__pyx_int_6); + Py_VISIT(traverse_module_state->__pyx_int_12); + Py_VISIT(traverse_module_state->__pyx_int_20); + Py_VISIT(traverse_module_state->__pyx_int_112105877); + Py_VISIT(traverse_module_state->__pyx_int_136983863); + Py_VISIT(traverse_module_state->__pyx_int_184977713); + Py_VISIT(traverse_module_state->__pyx_int_neg_1); + Py_VISIT(traverse_module_state->__pyx_slice__5); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_tuple__9); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__14); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__16); + Py_VISIT(traverse_module_state->__pyx_tuple__17); + Py_VISIT(traverse_module_state->__pyx_tuple__18); + Py_VISIT(traverse_module_state->__pyx_tuple__19); + Py_VISIT(traverse_module_state->__pyx_tuple__20); + Py_VISIT(traverse_module_state->__pyx_tuple__21); + Py_VISIT(traverse_module_state->__pyx_tuple__22); + Py_VISIT(traverse_module_state->__pyx_tuple__23); + Py_VISIT(traverse_module_state->__pyx_tuple__25); + Py_VISIT(traverse_module_state->__pyx_tuple__27); + Py_VISIT(traverse_module_state->__pyx_tuple__28); + Py_VISIT(traverse_module_state->__pyx_tuple__30); + Py_VISIT(traverse_module_state->__pyx_tuple__32); + Py_VISIT(traverse_module_state->__pyx_tuple__34); + Py_VISIT(traverse_module_state->__pyx_tuple__35); + Py_VISIT(traverse_module_state->__pyx_tuple__37); + Py_VISIT(traverse_module_state->__pyx_tuple__39); + Py_VISIT(traverse_module_state->__pyx_tuple__41); + Py_VISIT(traverse_module_state->__pyx_tuple__43); + Py_VISIT(traverse_module_state->__pyx_tuple__45); + Py_VISIT(traverse_module_state->__pyx_tuple__47); + Py_VISIT(traverse_module_state->__pyx_tuple__49); + Py_VISIT(traverse_module_state->__pyx_tuple__51); + Py_VISIT(traverse_module_state->__pyx_tuple__52); + Py_VISIT(traverse_module_state->__pyx_tuple__54); + Py_VISIT(traverse_module_state->__pyx_tuple__56); + Py_VISIT(traverse_module_state->__pyx_tuple__58); + Py_VISIT(traverse_module_state->__pyx_tuple__60); + Py_VISIT(traverse_module_state->__pyx_tuple__62); + Py_VISIT(traverse_module_state->__pyx_codeobj__24); + Py_VISIT(traverse_module_state->__pyx_codeobj__26); + Py_VISIT(traverse_module_state->__pyx_codeobj__29); + Py_VISIT(traverse_module_state->__pyx_codeobj__31); + Py_VISIT(traverse_module_state->__pyx_codeobj__33); + Py_VISIT(traverse_module_state->__pyx_codeobj__36); + Py_VISIT(traverse_module_state->__pyx_codeobj__38); + Py_VISIT(traverse_module_state->__pyx_codeobj__40); + Py_VISIT(traverse_module_state->__pyx_codeobj__42); + Py_VISIT(traverse_module_state->__pyx_codeobj__44); + Py_VISIT(traverse_module_state->__pyx_codeobj__46); + Py_VISIT(traverse_module_state->__pyx_codeobj__48); + Py_VISIT(traverse_module_state->__pyx_codeobj__50); + Py_VISIT(traverse_module_state->__pyx_codeobj__53); + Py_VISIT(traverse_module_state->__pyx_codeobj__55); + Py_VISIT(traverse_module_state->__pyx_codeobj__57); + Py_VISIT(traverse_module_state->__pyx_codeobj__59); + Py_VISIT(traverse_module_state->__pyx_codeobj__61); + Py_VISIT(traverse_module_state->__pyx_codeobj__63); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_5numpy_dtype __pyx_mstate_global->__pyx_ptype_5numpy_dtype +#define __pyx_ptype_5numpy_flatiter __pyx_mstate_global->__pyx_ptype_5numpy_flatiter +#define __pyx_ptype_5numpy_broadcast __pyx_mstate_global->__pyx_ptype_5numpy_broadcast +#define __pyx_ptype_5numpy_ndarray __pyx_mstate_global->__pyx_ptype_5numpy_ndarray +#define __pyx_ptype_5numpy_generic __pyx_mstate_global->__pyx_ptype_5numpy_generic +#define __pyx_ptype_5numpy_number __pyx_mstate_global->__pyx_ptype_5numpy_number +#define __pyx_ptype_5numpy_integer __pyx_mstate_global->__pyx_ptype_5numpy_integer +#define __pyx_ptype_5numpy_signedinteger __pyx_mstate_global->__pyx_ptype_5numpy_signedinteger +#define __pyx_ptype_5numpy_unsignedinteger __pyx_mstate_global->__pyx_ptype_5numpy_unsignedinteger +#define __pyx_ptype_5numpy_inexact __pyx_mstate_global->__pyx_ptype_5numpy_inexact +#define __pyx_ptype_5numpy_floating __pyx_mstate_global->__pyx_ptype_5numpy_floating +#define __pyx_ptype_5numpy_complexfloating __pyx_mstate_global->__pyx_ptype_5numpy_complexfloating +#define __pyx_ptype_5numpy_flexible __pyx_mstate_global->__pyx_ptype_5numpy_flexible +#define __pyx_ptype_5numpy_character __pyx_mstate_global->__pyx_ptype_5numpy_character +#define __pyx_ptype_5numpy_ufunc __pyx_mstate_global->__pyx_ptype_5numpy_ufunc +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type___pyx_array __pyx_mstate_global->__pyx_type___pyx_array +#define __pyx_type___pyx_MemviewEnum __pyx_mstate_global->__pyx_type___pyx_MemviewEnum +#define __pyx_type___pyx_memoryview __pyx_mstate_global->__pyx_type___pyx_memoryview +#define __pyx_type___pyx_memoryviewslice __pyx_mstate_global->__pyx_type___pyx_memoryviewslice +#endif +#define __pyx_array_type __pyx_mstate_global->__pyx_array_type +#define __pyx_MemviewEnum_type __pyx_mstate_global->__pyx_MemviewEnum_type +#define __pyx_memoryview_type __pyx_mstate_global->__pyx_memoryview_type +#define __pyx_memoryviewslice_type __pyx_mstate_global->__pyx_memoryviewslice_type +#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_n_s_ASCII __pyx_mstate_global->__pyx_n_s_ASCII +#define __pyx_kp_s_All_dimensions_preceding_dimensi __pyx_mstate_global->__pyx_kp_s_All_dimensions_preceding_dimensi +#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError +#define __pyx_kp_s_Buffer_view_does_not_expose_stri __pyx_mstate_global->__pyx_kp_s_Buffer_view_does_not_expose_stri +#define __pyx_kp_s_Can_only_create_a_buffer_that_is __pyx_mstate_global->__pyx_kp_s_Can_only_create_a_buffer_that_is +#define __pyx_kp_s_Cannot_assign_to_read_only_memor __pyx_mstate_global->__pyx_kp_s_Cannot_assign_to_read_only_memor +#define __pyx_kp_s_Cannot_create_writable_memory_vi __pyx_mstate_global->__pyx_kp_s_Cannot_create_writable_memory_vi +#define __pyx_kp_u_Cannot_index_with_type __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type +#define __pyx_kp_s_Cannot_transpose_memoryview_with __pyx_mstate_global->__pyx_kp_s_Cannot_transpose_memoryview_with +#define __pyx_kp_s_Dimension_d_is_not_direct __pyx_mstate_global->__pyx_kp_s_Dimension_d_is_not_direct +#define __pyx_n_s_Ellipsis __pyx_mstate_global->__pyx_n_s_Ellipsis +#define __pyx_kp_s_Empty_shape_tuple_for_cython_arr __pyx_mstate_global->__pyx_kp_s_Empty_shape_tuple_for_cython_arr +#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError +#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 +#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError +#define __pyx_kp_s_Index_out_of_bounds_axis_d __pyx_mstate_global->__pyx_kp_s_Index_out_of_bounds_axis_d +#define __pyx_kp_s_Indirect_dimensions_not_supporte __pyx_mstate_global->__pyx_kp_s_Indirect_dimensions_not_supporte +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis +#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError +#define __pyx_kp_s_MemoryView_of_r_at_0x_x __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_at_0x_x +#define __pyx_kp_s_MemoryView_of_r_object __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_object +#define __pyx_n_b_O __pyx_mstate_global->__pyx_n_b_O +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a +#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError +#define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence +#define __pyx_kp_s_Step_may_not_be_zero_axis_d __pyx_mstate_global->__pyx_kp_s_Step_may_not_be_zero_axis_d +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_kp_s_Unable_to_convert_item_to_object __pyx_mstate_global->__pyx_kp_s_Unable_to_convert_item_to_object +#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError +#define __pyx_n_s_View_MemoryView __pyx_mstate_global->__pyx_n_s_View_MemoryView +#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 +#define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3 +#define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6 +#define __pyx_n_s__64 __pyx_mstate_global->__pyx_n_s__64 +#define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7 +#define __pyx_n_s_abc __pyx_mstate_global->__pyx_n_s_abc +#define __pyx_n_s_allocate_buffer __pyx_mstate_global->__pyx_n_s_allocate_buffer +#define __pyx_kp_u_and __pyx_mstate_global->__pyx_kp_u_and +#define __pyx_n_s_ans __pyx_mstate_global->__pyx_n_s_ans +#define __pyx_n_s_asarray __pyx_mstate_global->__pyx_n_s_asarray +#define __pyx_n_s_ascontiguousarray __pyx_mstate_global->__pyx_n_s_ascontiguousarray +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base +#define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c +#define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c +#define __pyx_n_s_calcAngularDisplacement __pyx_mstate_global->__pyx_n_s_calcAngularDisplacement +#define __pyx_n_s_calcAngularVelocityXCorrel __pyx_mstate_global->__pyx_n_s_calcAngularVelocityXCorrel +#define __pyx_n_s_calcRelativeAngDisp __pyx_mstate_global->__pyx_n_s_calcRelativeAngDisp +#define __pyx_n_s_ccorr __pyx_mstate_global->__pyx_n_s_ccorr +#define __pyx_n_s_ccrosscorr __pyx_mstate_global->__pyx_n_s_ccrosscorr +#define __pyx_n_s_ccrossctr __pyx_mstate_global->__pyx_n_s_ccrossctr +#define __pyx_n_s_cctr __pyx_mstate_global->__pyx_n_s_cctr +#define __pyx_n_s_cdata __pyx_mstate_global->__pyx_n_s_cdata +#define __pyx_n_s_cdata1 __pyx_mstate_global->__pyx_n_s_cdata1 +#define __pyx_n_s_cdata2 __pyx_mstate_global->__pyx_n_s_cdata2 +#define __pyx_n_s_cds __pyx_mstate_global->__pyx_n_s_cds +#define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class +#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections +#define __pyx_kp_s_collections_abc __pyx_mstate_global->__pyx_kp_s_collections_abc +#define __pyx_n_s_contdata __pyx_mstate_global->__pyx_n_s_contdata +#define __pyx_n_s_contdata1 __pyx_mstate_global->__pyx_n_s_contdata1 +#define __pyx_n_s_contdata2 __pyx_mstate_global->__pyx_n_s_contdata2 +#define __pyx_n_s_contds __pyx_mstate_global->__pyx_n_s_contds +#define __pyx_kp_s_contiguous_and_direct __pyx_mstate_global->__pyx_kp_s_contiguous_and_direct +#define __pyx_kp_s_contiguous_and_indirect __pyx_mstate_global->__pyx_kp_s_contiguous_and_indirect +#define __pyx_n_s_coor1_ts __pyx_mstate_global->__pyx_n_s_coor1_ts +#define __pyx_n_s_coor2_ts __pyx_mstate_global->__pyx_n_s_coor2_ts +#define __pyx_n_s_coor_ts __pyx_mstate_global->__pyx_n_s_coor_ts +#define __pyx_n_s_corr __pyx_mstate_global->__pyx_n_s_corr +#define __pyx_n_s_corrdim __pyx_mstate_global->__pyx_n_s_corrdim +#define __pyx_n_s_correlate __pyx_mstate_global->__pyx_n_s_correlate +#define __pyx_n_s_correlateParallel __pyx_mstate_global->__pyx_n_s_correlateParallel +#define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count +#define __pyx_n_s_crosscorr __pyx_mstate_global->__pyx_n_s_crosscorr +#define __pyx_n_s_crossctr __pyx_mstate_global->__pyx_n_s_crossctr +#define __pyx_n_s_cselfcorr __pyx_mstate_global->__pyx_n_s_cselfcorr +#define __pyx_n_s_cselfctr __pyx_mstate_global->__pyx_n_s_cselfctr +#define __pyx_n_s_ctr __pyx_mstate_global->__pyx_n_s_ctr +#define __pyx_n_s_d1 __pyx_mstate_global->__pyx_n_s_d1 +#define __pyx_n_s_d2 __pyx_mstate_global->__pyx_n_s_d2 +#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data +#define __pyx_n_s_data1 __pyx_mstate_global->__pyx_n_s_data1 +#define __pyx_n_s_data2 __pyx_mstate_global->__pyx_n_s_data2 +#define __pyx_n_s_datapoints __pyx_mstate_global->__pyx_n_s_datapoints +#define __pyx_n_s_delta __pyx_mstate_global->__pyx_n_s_delta +#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_n_s_dim __pyx_mstate_global->__pyx_n_s_dim +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_ds __pyx_mstate_global->__pyx_n_s_ds +#define __pyx_n_s_dsidx __pyx_mstate_global->__pyx_n_s_dsidx +#define __pyx_n_s_dt __pyx_mstate_global->__pyx_n_s_dt +#define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype +#define __pyx_n_s_dtype_is_object __pyx_mstate_global->__pyx_n_s_dtype_is_object +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate +#define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error +#define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags +#define __pyx_n_s_float64 __pyx_mstate_global->__pyx_n_s_float64 +#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format +#define __pyx_n_s_fortran __pyx_mstate_global->__pyx_n_s_fortran +#define __pyx_n_u_fortran __pyx_mstate_global->__pyx_n_u_fortran +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi +#define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i +#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id +#define __pyx_n_s_idx __pyx_mstate_global->__pyx_n_s_idx +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_istart __pyx_mstate_global->__pyx_n_s_istart +#define __pyx_n_s_itemsize __pyx_mstate_global->__pyx_n_s_itemsize +#define __pyx_kp_s_itemsize_0_for_cython_array __pyx_mstate_global->__pyx_kp_s_itemsize_0_for_cython_array +#define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j +#define __pyx_n_s_k __pyx_mstate_global->__pyx_n_s_k +#define __pyx_n_s_l __pyx_mstate_global->__pyx_n_s_l +#define __pyx_n_s_lowhigh __pyx_mstate_global->__pyx_n_s_lowhigh +#define __pyx_n_s_ltc __pyx_mstate_global->__pyx_n_s_ltc +#define __pyx_n_s_ltc_2 __pyx_mstate_global->__pyx_n_s_ltc_2 +#define __pyx_n_s_m __pyx_mstate_global->__pyx_n_s_m +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_maxTime __pyx_mstate_global->__pyx_n_s_maxTime +#define __pyx_n_s_maxdt __pyx_mstate_global->__pyx_n_s_maxdt +#define __pyx_n_s_maxlen __pyx_mstate_global->__pyx_n_s_maxlen +#define __pyx_n_s_memview __pyx_mstate_global->__pyx_n_s_memview +#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode +#define __pyx_n_s_mol __pyx_mstate_global->__pyx_n_s_mol +#define __pyx_n_s_msd __pyx_mstate_global->__pyx_n_s_msd +#define __pyx_n_s_myCorrel __pyx_mstate_global->__pyx_n_s_myCorrel +#define __pyx_n_s_myplan __pyx_mstate_global->__pyx_n_s_myplan +#define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n +#define __pyx_n_s_n_2 __pyx_mstate_global->__pyx_n_s_n_2 +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 +#define __pyx_n_s_natoms __pyx_mstate_global->__pyx_n_s_natoms +#define __pyx_n_s_natoms1 __pyx_mstate_global->__pyx_n_s_natoms1 +#define __pyx_n_s_natoms2 __pyx_mstate_global->__pyx_n_s_natoms2 +#define __pyx_n_s_nc __pyx_mstate_global->__pyx_n_s_nc +#define __pyx_n_s_ncut __pyx_mstate_global->__pyx_n_s_ncut +#define __pyx_n_s_ndim __pyx_mstate_global->__pyx_n_s_ndim +#define __pyx_n_s_nds __pyx_mstate_global->__pyx_n_s_nds +#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new +#define __pyx_n_s_newanalysis_correl __pyx_mstate_global->__pyx_n_s_newanalysis_correl +#define __pyx_kp_s_newanalysis_helpers_correl_pyx __pyx_mstate_global->__pyx_kp_s_newanalysis_helpers_correl_pyx +#define __pyx_n_s_nmol __pyx_mstate_global->__pyx_n_s_nmol +#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non +#define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np +#define __pyx_n_s_nshells __pyx_mstate_global->__pyx_n_s_nshells +#define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy +#define __pyx_kp_s_numpy_core_multiarray_failed_to __pyx_mstate_global->__pyx_kp_s_numpy_core_multiarray_failed_to +#define __pyx_kp_s_numpy_core_umath_failed_to_impor __pyx_mstate_global->__pyx_kp_s_numpy_core_umath_failed_to_impor +#define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj +#define __pyx_n_s_out __pyx_mstate_global->__pyx_n_s_out +#define __pyx_n_s_p_ans __pyx_mstate_global->__pyx_n_s_p_ans +#define __pyx_n_s_p_data1 __pyx_mstate_global->__pyx_n_s_p_data1 +#define __pyx_n_s_p_data2 __pyx_mstate_global->__pyx_n_s_p_data2 +#define __pyx_n_s_p_out __pyx_mstate_global->__pyx_n_s_p_out +#define __pyx_n_s_p_tmp __pyx_mstate_global->__pyx_n_s_p_tmp +#define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack +#define __pyx_n_s_pcorr __pyx_mstate_global->__pyx_n_s_pcorr +#define __pyx_n_s_pcorrdim __pyx_mstate_global->__pyx_n_s_pcorrdim +#define __pyx_n_s_pcrosscorr __pyx_mstate_global->__pyx_n_s_pcrosscorr +#define __pyx_n_s_pdata __pyx_mstate_global->__pyx_n_s_pdata +#define __pyx_n_s_pdata1 __pyx_mstate_global->__pyx_n_s_pdata1 +#define __pyx_n_s_pdata2 __pyx_mstate_global->__pyx_n_s_pdata2 +#define __pyx_n_s_pds __pyx_mstate_global->__pyx_n_s_pds +#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle +#define __pyx_n_s_pnshells __pyx_mstate_global->__pyx_n_s_pnshells +#define __pyx_n_s_point __pyx_mstate_global->__pyx_n_s_point +#define __pyx_n_s_print __pyx_mstate_global->__pyx_n_s_print +#define __pyx_n_s_pselfcorr __pyx_mstate_global->__pyx_n_s_pselfcorr +#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError +#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum +#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type +#define __pyx_n_s_pyx_unpickle_Enum __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Enum +#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce +#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython +#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register +#define __pyx_n_s_rotTs __pyx_mstate_global->__pyx_n_s_rotTs +#define __pyx_n_s_rotTs1 __pyx_mstate_global->__pyx_n_s_rotTs1 +#define __pyx_n_s_rotTs2 __pyx_mstate_global->__pyx_n_s_rotTs2 +#define __pyx_n_s_rotTs3 __pyx_mstate_global->__pyx_n_s_rotTs3 +#define __pyx_n_s_rotationMatrixShellCorrelate __pyx_mstate_global->__pyx_n_s_rotationMatrixShellCorrelate +#define __pyx_n_s_rotationMatrixShellCorrelateDist __pyx_mstate_global->__pyx_n_s_rotationMatrixShellCorrelateDist +#define __pyx_n_s_rotationMatrixShellCorrelateTot __pyx_mstate_global->__pyx_n_s_rotationMatrixShellCorrelateTot +#define __pyx_n_s_rotationMatrixShellCorrelateTotP __pyx_mstate_global->__pyx_n_s_rotationMatrixShellCorrelateTotP +#define __pyx_kp_s_self_too_sparse __pyx_mstate_global->__pyx_kp_s_self_too_sparse +#define __pyx_n_s_selfcorr __pyx_mstate_global->__pyx_n_s_selfcorr +#define __pyx_n_s_selfctr __pyx_mstate_global->__pyx_n_s_selfctr +#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate +#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython +#define __pyx_n_s_shape __pyx_mstate_global->__pyx_n_s_shape +#define __pyx_n_s_shell __pyx_mstate_global->__pyx_n_s_shell +#define __pyx_n_s_shelldt __pyx_mstate_global->__pyx_n_s_shelldt +#define __pyx_n_s_shellstart __pyx_mstate_global->__pyx_n_s_shellstart +#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size +#define __pyx_n_s_sparsecorrelate __pyx_mstate_global->__pyx_n_s_sparsecorrelate +#define __pyx_n_s_sparsecrosscorrelate __pyx_mstate_global->__pyx_n_s_sparsecrosscorrelate +#define __pyx_n_s_sparsefullcorrelate __pyx_mstate_global->__pyx_n_s_sparsefullcorrelate +#define __pyx_n_s_sparsefullcrosscorrelate __pyx_mstate_global->__pyx_n_s_sparsefullcrosscorrelate +#define __pyx_n_s_sparsefullnobulkcorrelate __pyx_mstate_global->__pyx_n_s_sparsefullnobulkcorrelate +#define __pyx_n_s_sparsefullnobulkthincorrelate __pyx_mstate_global->__pyx_n_s_sparsefullnobulkthincorrelate +#define __pyx_n_s_sparsefullnobulkthingreenkubo __pyx_mstate_global->__pyx_n_s_sparsefullnobulkthingreenkubo +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start +#define __pyx_n_s_startingpoints __pyx_mstate_global->__pyx_n_s_startingpoints +#define __pyx_n_s_startmax __pyx_mstate_global->__pyx_n_s_startmax +#define __pyx_n_s_startskip __pyx_mstate_global->__pyx_n_s_startskip +#define __pyx_n_s_step __pyx_mstate_global->__pyx_n_s_step +#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop +#define __pyx_kp_s_strided_and_direct __pyx_mstate_global->__pyx_kp_s_strided_and_direct +#define __pyx_kp_s_strided_and_direct_or_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_direct_or_indirect +#define __pyx_kp_s_strided_and_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_indirect +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_t __pyx_mstate_global->__pyx_n_s_t +#define __pyx_n_s_t1 __pyx_mstate_global->__pyx_n_s_t1 +#define __pyx_n_s_t2 __pyx_mstate_global->__pyx_n_s_t2 +#define __pyx_n_s_t3 __pyx_mstate_global->__pyx_n_s_t3 +#define __pyx_n_s_t4 __pyx_mstate_global->__pyx_n_s_t4 +#define __pyx_n_s_t5 __pyx_mstate_global->__pyx_n_s_t5 +#define __pyx_n_s_t6 __pyx_mstate_global->__pyx_n_s_t6 +#define __pyx_n_s_tempvalue __pyx_mstate_global->__pyx_n_s_tempvalue +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_tmp __pyx_mstate_global->__pyx_n_s_tmp +#define __pyx_kp_s_too_sparse __pyx_mstate_global->__pyx_kp_s_too_sparse +#define __pyx_kp_s_tot_too_sparse __pyx_mstate_global->__pyx_kp_s_tot_too_sparse +#define __pyx_n_s_transform __pyx_mstate_global->__pyx_n_s_transform +#define __pyx_kp_s_unable_to_allocate_array_data __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_array_data +#define __pyx_kp_s_unable_to_allocate_shape_and_str __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_shape_and_str +#define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack +#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update +#define __pyx_n_s_validx __pyx_mstate_global->__pyx_n_s_validx +#define __pyx_n_s_value __pyx_mstate_global->__pyx_n_s_value +#define __pyx_n_s_vectorRotation __pyx_mstate_global->__pyx_n_s_vectorRotation +#define __pyx_n_s_version_info __pyx_mstate_global->__pyx_n_s_version_info +#define __pyx_n_s_wcorr1 __pyx_mstate_global->__pyx_n_s_wcorr1 +#define __pyx_n_s_wcorr2 __pyx_mstate_global->__pyx_n_s_wcorr2 +#define __pyx_n_s_wxcorr __pyx_mstate_global->__pyx_n_s_wxcorr +#define __pyx_n_s_xcf __pyx_mstate_global->__pyx_n_s_xcf +#define __pyx_n_s_zeros __pyx_mstate_global->__pyx_n_s_zeros +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_2 __pyx_mstate_global->__pyx_int_2 +#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3 +#define __pyx_int_6 __pyx_mstate_global->__pyx_int_6 +#define __pyx_int_12 __pyx_mstate_global->__pyx_int_12 +#define __pyx_int_20 __pyx_mstate_global->__pyx_int_20 +#define __pyx_int_112105877 __pyx_mstate_global->__pyx_int_112105877 +#define __pyx_int_136983863 __pyx_mstate_global->__pyx_int_136983863 +#define __pyx_int_184977713 __pyx_mstate_global->__pyx_int_184977713 +#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 +#define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 +#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 +#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 +#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 +#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 +#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 +#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23 +#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25 +#define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27 +#define __pyx_tuple__28 __pyx_mstate_global->__pyx_tuple__28 +#define __pyx_tuple__30 __pyx_mstate_global->__pyx_tuple__30 +#define __pyx_tuple__32 __pyx_mstate_global->__pyx_tuple__32 +#define __pyx_tuple__34 __pyx_mstate_global->__pyx_tuple__34 +#define __pyx_tuple__35 __pyx_mstate_global->__pyx_tuple__35 +#define __pyx_tuple__37 __pyx_mstate_global->__pyx_tuple__37 +#define __pyx_tuple__39 __pyx_mstate_global->__pyx_tuple__39 +#define __pyx_tuple__41 __pyx_mstate_global->__pyx_tuple__41 +#define __pyx_tuple__43 __pyx_mstate_global->__pyx_tuple__43 +#define __pyx_tuple__45 __pyx_mstate_global->__pyx_tuple__45 +#define __pyx_tuple__47 __pyx_mstate_global->__pyx_tuple__47 +#define __pyx_tuple__49 __pyx_mstate_global->__pyx_tuple__49 +#define __pyx_tuple__51 __pyx_mstate_global->__pyx_tuple__51 +#define __pyx_tuple__52 __pyx_mstate_global->__pyx_tuple__52 +#define __pyx_tuple__54 __pyx_mstate_global->__pyx_tuple__54 +#define __pyx_tuple__56 __pyx_mstate_global->__pyx_tuple__56 +#define __pyx_tuple__58 __pyx_mstate_global->__pyx_tuple__58 +#define __pyx_tuple__60 __pyx_mstate_global->__pyx_tuple__60 +#define __pyx_tuple__62 __pyx_mstate_global->__pyx_tuple__62 +#define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24 +#define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26 +#define __pyx_codeobj__29 __pyx_mstate_global->__pyx_codeobj__29 +#define __pyx_codeobj__31 __pyx_mstate_global->__pyx_codeobj__31 +#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33 +#define __pyx_codeobj__36 __pyx_mstate_global->__pyx_codeobj__36 +#define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38 +#define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40 +#define __pyx_codeobj__42 __pyx_mstate_global->__pyx_codeobj__42 +#define __pyx_codeobj__44 __pyx_mstate_global->__pyx_codeobj__44 +#define __pyx_codeobj__46 __pyx_mstate_global->__pyx_codeobj__46 +#define __pyx_codeobj__48 __pyx_mstate_global->__pyx_codeobj__48 +#define __pyx_codeobj__50 __pyx_mstate_global->__pyx_codeobj__50 +#define __pyx_codeobj__53 __pyx_mstate_global->__pyx_codeobj__53 +#define __pyx_codeobj__55 __pyx_mstate_global->__pyx_codeobj__55 +#define __pyx_codeobj__57 __pyx_mstate_global->__pyx_codeobj__57 +#define __pyx_codeobj__59 __pyx_mstate_global->__pyx_codeobj__59 +#define __pyx_codeobj__61 __pyx_mstate_global->__pyx_codeobj__61 +#define __pyx_codeobj__63 __pyx_mstate_global->__pyx_codeobj__63 +/* #### Code section: module_code ### */ + +/* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): * - * @cython.boundscheck(False) - * def correlateParallel(np.ndarray[np.float64_t,ndim=2] data1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] data2, - * np.ndarray[np.float64_t,ndim=1] out, */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_1correlateParallel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_6correl_correlateParallel[] = "\n correlateParallel(data1, data2, out, ltc=0)\n\n Takes two data sets and calculates column-wise correlation functions in parallel and sums them up afterwards. The result is written into the out array.\n\n Args:\n data1: numpy array, float64, ndim=2\n data2: numpy array, float64, ndim=2\n out: numpy array, float64, ndim=1\n ltc: type of long tail correction used\n 0 = none (default)\n 1 = the average of the time series is subtracted from it before the correlation\n 2 = the result is modified\n\n :Example: dipole autocorrelation function\n correlateParallel(dipoles, dipoles, mu0mut)\n\n NOTE: \n for this to work, the data arrays have to be organised as follows:\n \n +--+--+--+--+--+--+--+---+--+--+--+\n | |x1|y1|z1|x2|y2|z2|...|xn|yn|zn|\n +==+==+==+==+==+==+==+===+==+==+==+\n |t1| | | | | | | | | | |\n +--+--+--+--+--+--+--+---+--+--+--+\n |t2| | | | | | | | | | |\n +--+--+--+--+--+--+--+---+--+--+--+\n |. | | | | | | | | | | | \n +--+--+--+--+--+--+--+---+--+--+--+\n |. | | | | | | | | | | |\n +--+--+--+--+--+--+--+---+--+--+--+\n |. | | | | | | | | | | |\n +--+--+--+--+--+--+--+---+--+--+--+\n |tm| | | | | | | | | | |\n +--+--+--+--+--+--+--+---+--+--+--+\n\n Each column is the x/y/z component of each particle, each row is a time step.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_6correl_1correlateParallel = {"correlateParallel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_1correlateParallel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_6correl_correlateParallel}; -static PyObject *__pyx_pw_11newanalysis_6correl_1correlateParallel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_data1 = 0; - PyArrayObject *__pyx_v_data2 = 0; - PyArrayObject *__pyx_v_out = 0; - PyObject *__pyx_v_ltc = 0; +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("correlateParallel (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 131, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data1,&__pyx_n_s_data2,&__pyx_n_s_out,&__pyx_n_s_ltc,0}; - PyObject* values[4] = {0,0,0,0}; - values[3] = ((PyObject *)__pyx_int_0); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; + values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_n_s_c)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data1)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shape)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data2)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_itemsize)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("correlateParallel", 0, 3, 4, 1); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_format)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("correlateParallel", 0, 3, 4, 2); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ltc); - if (value) { values[3] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode); + if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_allocate_buffer); + if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "correlateParallel") < 0)) __PYX_ERR(0, 25, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 131, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } - __pyx_v_data1 = ((PyArrayObject *)values[0]); - __pyx_v_data2 = ((PyArrayObject *)values[1]); - __pyx_v_out = ((PyArrayObject *)values[2]); - __pyx_v_ltc = values[3]; + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 132, __pyx_L3_error) + } else { + + /* "View.MemoryView":132 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx + */ + __pyx_v_allocate_buffer = ((int)1); + } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("correlateParallel", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 131, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.correlateParallel", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data1), __pyx_ptype_5numpy_ndarray, 1, "data1", 0))) __PYX_ERR(0, 25, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data2), __pyx_ptype_5numpy_ndarray, 1, "data2", 0))) __PYX_ERR(0, 26, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) __PYX_ERR(0, 27, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_correlateParallel(__pyx_self, __pyx_v_data1, __pyx_v_data2, __pyx_v_out, __pyx_v_ltc); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 131, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 131, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * + */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __pyx_r = NULL; + __pyx_r = -1; __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_correlateParallel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2, PyArrayObject *__pyx_v_out, PyObject *__pyx_v_ltc) { - long __pyx_v__n; - long __pyx_v_ncut; - int __pyx_v_m; - int __pyx_v__ltc; - int __pyx_v_lowhigh; - long __pyx_v_i; - long __pyx_v_j; - PyArrayObject *__pyx_v_d1 = 0; - PyArrayObject *__pyx_v_d2 = 0; - double *__pyx_v_p_data1; - double *__pyx_v_p_data2; - double *__pyx_v_p_out; - Correl *__pyx_v_myCorrel; - plan *__pyx_v_myplan; - PyArrayObject *__pyx_v_tmp = 0; - double *__pyx_v_p_tmp; - __Pyx_LocalBuf_ND __pyx_pybuffernd_d1; - __Pyx_Buffer __pyx_pybuffer_d1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_d2; - __Pyx_Buffer __pyx_pybuffer_d2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_data1; - __Pyx_Buffer __pyx_pybuffer_data1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_data2; - __Pyx_Buffer __pyx_pybuffer_data2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_out; - __Pyx_Buffer __pyx_pybuffer_out; - __Pyx_LocalBuf_ND __pyx_pybuffernd_tmp; - __Pyx_Buffer __pyx_pybuffer_tmp; - PyObject *__pyx_r = NULL; +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_2; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - Correl *__pyx_t_7; - plan *__pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - long __pyx_t_18; - long __pyx_t_19; - long __pyx_t_20; - long __pyx_t_21; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + char *__pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_UCS4 __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("correlateParallel", 0); - __pyx_pybuffer_d1.pybuffer.buf = NULL; - __pyx_pybuffer_d1.refcount = 0; - __pyx_pybuffernd_d1.data = NULL; - __pyx_pybuffernd_d1.rcbuffer = &__pyx_pybuffer_d1; - __pyx_pybuffer_d2.pybuffer.buf = NULL; - __pyx_pybuffer_d2.refcount = 0; - __pyx_pybuffernd_d2.data = NULL; - __pyx_pybuffernd_d2.rcbuffer = &__pyx_pybuffer_d2; - __pyx_pybuffer_tmp.pybuffer.buf = NULL; - __pyx_pybuffer_tmp.refcount = 0; - __pyx_pybuffernd_tmp.data = NULL; - __pyx_pybuffernd_tmp.rcbuffer = &__pyx_pybuffer_tmp; - __pyx_pybuffer_data1.pybuffer.buf = NULL; - __pyx_pybuffer_data1.refcount = 0; - __pyx_pybuffernd_data1.data = NULL; - __pyx_pybuffernd_data1.rcbuffer = &__pyx_pybuffer_data1; - __pyx_pybuffer_data2.pybuffer.buf = NULL; - __pyx_pybuffer_data2.refcount = 0; - __pyx_pybuffernd_data2.data = NULL; - __pyx_pybuffernd_data2.rcbuffer = &__pyx_pybuffer_data2; - __pyx_pybuffer_out.pybuffer.buf = NULL; - __pyx_pybuffer_out.refcount = 0; - __pyx_pybuffernd_out.data = NULL; - __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data1.rcbuffer->pybuffer, (PyObject*)__pyx_v_data1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 25, __pyx_L1_error) - } - __pyx_pybuffernd_data1.diminfo[0].strides = __pyx_pybuffernd_data1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data1.diminfo[0].shape = __pyx_pybuffernd_data1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_data1.diminfo[1].strides = __pyx_pybuffernd_data1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_data1.diminfo[1].shape = __pyx_pybuffernd_data1.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data2.rcbuffer->pybuffer, (PyObject*)__pyx_v_data2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 25, __pyx_L1_error) - } - __pyx_pybuffernd_data2.diminfo[0].strides = __pyx_pybuffernd_data2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data2.diminfo[0].shape = __pyx_pybuffernd_data2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_data2.diminfo[1].strides = __pyx_pybuffernd_data2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_data2.diminfo[1].shape = __pyx_pybuffernd_data2.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); + + /* "View.MemoryView":137 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * + */ + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 137, __pyx_L1_error) } - __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 137, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); - /* "src/helpers/correl.pyx":67 - * Each column is the x/y/z component of each particle, each row is a time step. - * """ - * cdef long _n = len(data1) # <<<<<<<<<<<<<< - * cdef long ncut = len(data1[0]) - * cdef int m=-1, _ltc=0, lowhigh=0 + /* "View.MemoryView":138 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_data1)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 67, __pyx_L1_error) - __pyx_v__n = ((long)__pyx_t_1); + __pyx_v_self->itemsize = __pyx_v_itemsize; - /* "src/helpers/correl.pyx":68 - * """ - * cdef long _n = len(data1) - * cdef long ncut = len(data1[0]) # <<<<<<<<<<<<<< - * cdef int m=-1, _ltc=0, lowhigh=0 - * cdef long i, j + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_data1), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_ncut = ((long)__pyx_t_1); + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/correl.pyx":69 - * cdef long _n = len(data1) - * cdef long ncut = len(data1[0]) - * cdef int m=-1, _ltc=0, lowhigh=0 # <<<<<<<<<<<<<< - * cdef long i, j + /* "View.MemoryView":141 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< * + * if itemsize <= 0: */ - __pyx_v_m = -1; - __pyx_v__ltc = 0; - __pyx_v_lowhigh = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 141, __pyx_L1_error) - /* "src/helpers/correl.pyx":72 - * cdef long i, j + /* "View.MemoryView":140 + * self.itemsize = itemsize * - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] d1=np.ascontiguousarray(data1) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] d2=np.ascontiguousarray(data2) + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, ((PyObject *)__pyx_v_data1)) : __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_data1)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 72, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d1.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_d1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_d1.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 72, __pyx_L1_error) - } else {__pyx_pybuffernd_d1.diminfo[0].strides = __pyx_pybuffernd_d1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d1.diminfo[0].shape = __pyx_pybuffernd_d1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d1.diminfo[1].strides = __pyx_pybuffernd_d1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d1.diminfo[1].shape = __pyx_pybuffernd_d1.rcbuffer->pybuffer.shape[1]; - } } - __pyx_t_5 = 0; - __pyx_v_d1 = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":73 + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" * - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] d1=np.ascontiguousarray(data1) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] d2=np.ascontiguousarray(data2) # <<<<<<<<<<<<<< + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" * - * cdef double *p_data1 = d1.data */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_data2)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_data2)); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 73, __pyx_L1_error) - __pyx_t_6 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_d2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 73, __pyx_L1_error) - } else {__pyx_pybuffernd_d2.diminfo[0].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d2.diminfo[0].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d2.diminfo[1].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d2.diminfo[1].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_6 = 0; - __pyx_v_d2 = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/correl.pyx":75 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] d2=np.ascontiguousarray(data2) + /* "View.MemoryView":144 * - * cdef double *p_data1 = d1.data # <<<<<<<<<<<<<< - * cdef double *p_data2 = d2.data - * cdef double *p_out = out.data + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): */ - __pyx_v_p_data1 = ((double *)__pyx_v_d1->data); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 144, __pyx_L1_error) - /* "src/helpers/correl.pyx":76 + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" * - * cdef double *p_data1 = d1.data - * cdef double *p_data2 = d2.data # <<<<<<<<<<<<<< - * cdef double *p_out = out.data + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" * */ - __pyx_v_p_data2 = ((double *)__pyx_v_d2->data); + } - /* "src/helpers/correl.pyx":77 - * cdef double *p_data1 = d1.data - * cdef double *p_data2 = d2.data - * cdef double *p_out = out.data # <<<<<<<<<<<<<< + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" * - * cdef Correl *myCorrel = new Correl() + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - __pyx_v_p_out = ((double *)__pyx_v_out->data); + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { - /* "src/helpers/correl.pyx":79 - * cdef double *p_out = out.data + /* "View.MemoryView":147 * - * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< - * cdef plan *myplan = new plan(p_data1,p_data2,ncut) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] tmp = np.zeros((_n,ncut),dtype=np.float64) + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format */ - try { - __pyx_t_7 = new Correl(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 79, __pyx_L1_error) - } - __pyx_v_myCorrel = __pyx_t_7; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; - /* "src/helpers/correl.pyx":80 + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" * - * cdef Correl *myCorrel = new Correl() - * cdef plan *myplan = new plan(p_data1,p_data2,ncut) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] tmp = np.zeros((_n,ncut),dtype=np.float64) - * cdef double *p_tmp = tmp.data + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - try { - __pyx_t_8 = new plan(__pyx_v_p_data1, __pyx_v_p_data2, __pyx_v_ncut); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 80, __pyx_L1_error) } - __pyx_v_myplan = __pyx_t_8; - /* "src/helpers/correl.pyx":81 - * cdef Correl *myCorrel = new Correl() - * cdef plan *myplan = new plan(p_data1,p_data2,ncut) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] tmp = np.zeros((_n,ncut),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *p_tmp = tmp.data + /* "View.MemoryView":148 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_ncut); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); + if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_format))) __PYX_ERR(1, 148, __pyx_L1_error) + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4); - __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 81, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tmp.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_tmp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_tmp.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 81, __pyx_L1_error) - } else {__pyx_pybuffernd_tmp.diminfo[0].strides = __pyx_pybuffernd_tmp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tmp.diminfo[0].shape = __pyx_pybuffernd_tmp.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_tmp.diminfo[1].strides = __pyx_pybuffernd_tmp.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_tmp.diminfo[1].shape = __pyx_pybuffernd_tmp.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_11 = 0; - __pyx_v_tmp = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; - /* "src/helpers/correl.pyx":82 - * cdef plan *myplan = new plan(p_data1,p_data2,ncut) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] tmp = np.zeros((_n,ncut),dtype=np.float64) - * cdef double *p_tmp = tmp.data # <<<<<<<<<<<<<< + /* "View.MemoryView":149 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * * - * if ltc==1 or ltc==2: */ - __pyx_v_p_tmp = ((double *)__pyx_v_tmp->data); + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 149, __pyx_L1_error) + } + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 149, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_8; - /* "src/helpers/correl.pyx":84 - * cdef double *p_tmp = tmp.data + /* "View.MemoryView":152 * - * if ltc==1 or ltc==2: # <<<<<<<<<<<<<< - * _ltc = ltc + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim * */ - __pyx_t_10 = __Pyx_PyInt_EqObjC(__pyx_v_ltc, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (!__pyx_t_13) { - } else { - __pyx_t_12 = __pyx_t_13; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_10 = __Pyx_PyInt_EqObjC(__pyx_v_ltc, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_12 = __pyx_t_13; - __pyx_L4_bool_binop_done:; - if (__pyx_t_12) { + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - /* "src/helpers/correl.pyx":85 + /* "View.MemoryView":153 * - * if ltc==1 or ltc==2: - * _ltc = ltc # <<<<<<<<<<<<<< + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< * - * for i in prange(_n,nogil=True): + * if not self._shape: */ - __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_v_ltc); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error) - __pyx_v__ltc = __pyx_t_14; + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - /* "src/helpers/correl.pyx":84 - * cdef double *p_tmp = tmp.data + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim * - * if ltc==1 or ltc==2: # <<<<<<<<<<<<<< - * _ltc = ltc + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * + */ + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":156 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * + */ + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 156, __pyx_L1_error) + + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." * */ } - /* "src/helpers/correl.pyx":87 - * _ltc = ltc + /* "View.MemoryView":159 * - * for i in prange(_n,nogil=True): # <<<<<<<<<<<<<< - * myCorrel.correl(&(p_data1[i*ncut]),&(p_data2[i*ncut]), ncut,&(p_tmp[i*ncut]),m,_ltc,lowhigh,myplan) * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_15 = __pyx_v__n; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_17 = (__pyx_t_15 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_17 > 0) - { - #ifdef _OPENMP - #pragma omp parallel - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) - #endif /* _OPENMP */ - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_17; __pyx_t_16++){ - { - __pyx_v_i = (long)(0 + 1 * __pyx_t_16); + __pyx_t_7 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(1, 159, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_7; + __pyx_t_7 = (__pyx_t_7 + 1); - /* "src/helpers/correl.pyx":88 + /* "View.MemoryView":160 * - * for i in prange(_n,nogil=True): - * myCorrel.correl(&(p_data1[i*ncut]),&(p_data2[i*ncut]), ncut,&(p_tmp[i*ncut]),m,_ltc,lowhigh,myplan) # <<<<<<<<<<<<<< + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim + */ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":161 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim * - * for i in range(ncut): */ - __pyx_v_myCorrel->correl((&(__pyx_v_p_data1[(__pyx_v_i * __pyx_v_ncut)])), (&(__pyx_v_p_data2[(__pyx_v_i * __pyx_v_ncut)])), ((int)__pyx_v_ncut), (&(__pyx_v_p_tmp[(__pyx_v_i * __pyx_v_ncut)])), __pyx_v_m, __pyx_v__ltc, __pyx_v_lowhigh, __pyx_v_myplan); - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = 0; + __pyx_t_10 = 127; + __Pyx_INCREF(__pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_9 += 22; + __Pyx_GIVEREF(__pyx_kp_u_Invalid_shape_in_axis); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u_); + __pyx_t_9 += 2; + __Pyx_GIVEREF(__pyx_kp_u_); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_); + __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u__2); + __pyx_t_9 += 1; + __Pyx_GIVEREF(__pyx_kp_u__2); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2); + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 161, __pyx_L1_error) - /* "src/helpers/correl.pyx":87 - * _ltc = ltc + /* "View.MemoryView":160 * - * for i in prange(_n,nogil=True): # <<<<<<<<<<<<<< - * myCorrel.correl(&(p_data1[i*ncut]),&(p_data2[i*ncut]), ncut,&(p_tmp[i*ncut]),m,_ltc,lowhigh,myplan) + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim + */ + } + + /* "View.MemoryView":162 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< * + * cdef char order */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L8; - } - __pyx_L8:; - } - } + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - /* "src/helpers/correl.pyx":90 - * myCorrel.correl(&(p_data1[i*ncut]),&(p_data2[i*ncut]), ncut,&(p_tmp[i*ncut]),m,_ltc,lowhigh,myplan) + /* "View.MemoryView":159 * - * for i in range(ncut): # <<<<<<<<<<<<<< - * for j in range(_n): - * p_out[i]+=p_tmp[j*ncut+i] + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." */ - __pyx_t_17 = __pyx_v_ncut; - __pyx_t_16 = __pyx_t_17; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15+=1) { - __pyx_v_i = __pyx_t_15; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/correl.pyx":91 + /* "View.MemoryView":165 * - * for i in range(ncut): - * for j in range(_n): # <<<<<<<<<<<<<< - * p_out[i]+=p_tmp[j*ncut+i] + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' + */ + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 165, __pyx_L1_error) + if (__pyx_t_3) { + + /* "View.MemoryView":166 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': + */ + __pyx_v_order = 'C'; + + /* "View.MemoryView":167 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' + */ + __Pyx_INCREF(__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_c; + + /* "View.MemoryView":165 * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' + */ + goto __pyx_L11; + } + + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' */ - __pyx_t_18 = __pyx_v__n; - __pyx_t_19 = __pyx_t_18; - for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { - __pyx_v_j = __pyx_t_20; + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 168, __pyx_L1_error) + if (likely(__pyx_t_3)) { - /* "src/helpers/correl.pyx":92 - * for i in range(ncut): - * for j in range(_n): - * p_out[i]+=p_tmp[j*ncut+i] # <<<<<<<<<<<<<< + /* "View.MemoryView":169 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: + */ + __pyx_v_order = 'F'; + + /* "View.MemoryView":170 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + */ + __Pyx_INCREF(__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_fortran; + + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' + */ + goto __pyx_L11; + } + + /* "View.MemoryView":172 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< * - * del myCorrel + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) */ - __pyx_t_21 = __pyx_v_i; - (__pyx_v_p_out[__pyx_t_21]) = ((__pyx_v_p_out[__pyx_t_21]) + (__pyx_v_p_tmp[((__pyx_v_j * __pyx_v_ncut) + __pyx_v_i)])); - } + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 172, __pyx_L1_error) } + __pyx_L11:; - /* "src/helpers/correl.pyx":94 - * p_out[i]+=p_tmp[j*ncut+i] + /* "View.MemoryView":174 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" * - * del myCorrel # <<<<<<<<<<<<<< - * del tmp - * del myplan + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer */ - delete __pyx_v_myCorrel; + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - /* "src/helpers/correl.pyx":95 + /* "View.MemoryView":176 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) * - * del myCorrel - * del tmp # <<<<<<<<<<<<<< - * del myplan + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' * */ - __Pyx_DECREF(((PyObject *)__pyx_v_tmp)); - __pyx_v_tmp = NULL; + __pyx_v_self->free_data = __pyx_v_allocate_buffer; - /* "src/helpers/correl.pyx":96 - * del myCorrel - * del tmp - * del myplan # <<<<<<<<<<<<<< + /* "View.MemoryView":177 * - * def correlate(np.ndarray[np.float64_t,ndim=1] data1, + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: */ - delete __pyx_v_myplan; + __pyx_t_6 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 177, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; - /* "src/helpers/correl.pyx":25 + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * + */ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":180 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') + */ + __pyx_t_7 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 180, __pyx_L1_error) + + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * + */ + } + + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): * - * @cython.boundscheck(False) - * def correlateParallel(np.ndarray[np.float64_t,ndim=2] data1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] data2, - * np.ndarray[np.float64_t,ndim=1] out, */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tmp.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.correlateParallel", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tmp.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_d1); - __Pyx_XDECREF((PyObject *)__pyx_v_d2); - __Pyx_XDECREF((PyObject *)__pyx_v_tmp); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_format); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":98 - * del myplan +/* "View.MemoryView":182 + * _allocate_buffer(self) * - * def correlate(np.ndarray[np.float64_t,ndim=1] data1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] data2, - * ltc=0): + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_3correlate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_6correl_2correlate[] = "\n correlate(data1, data2, ltc=0)\n\n Takes two data sets and calculates their correlation function.\n\n Args:\n data1 .. numpy array, float64, ndim=1\n data2 .. numpy array, float64, ndim=1\n ltc .. type of long tail correction used\n 0 = none (default)\n 1 = the average of the time series is subtracted from it before the correlation\n 2 = the result is modified\n\n Usage example:\n result = correlate(data1, data2)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_6correl_3correlate = {"correlate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_3correlate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_6correl_2correlate}; -static PyObject *__pyx_pw_11newanalysis_6correl_3correlate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_data1 = 0; - PyArrayObject *__pyx_v_data2 = 0; - PyObject *__pyx_v_ltc = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("correlate (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data1,&__pyx_n_s_data2,&__pyx_n_s_ltc,0}; - PyObject* values[3] = {0,0,0}; - values[2] = ((PyObject *)__pyx_int_0); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data1)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("correlate", 0, 2, 3, 1); __PYX_ERR(0, 98, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ltc); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "correlate") < 0)) __PYX_ERR(0, 98, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_data1 = ((PyArrayObject *)values[0]); - __pyx_v_data2 = ((PyArrayObject *)values[1]); - __pyx_v_ltc = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("correlate", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 98, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.correlate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data1), __pyx_ptype_5numpy_ndarray, 1, "data1", 0))) __PYX_ERR(0, 98, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data2), __pyx_ptype_5numpy_ndarray, 1, "data2", 0))) __PYX_ERR(0, 99, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_2correlate(__pyx_self, __pyx_v_data1, __pyx_v_data2, __pyx_v_ltc); + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_2correlate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2, PyObject *__pyx_v_ltc) { - int __pyx_v_ncut; - PyArrayObject *__pyx_v_ans = 0; - int __pyx_v_m; - int __pyx_v__ltc; - int __pyx_v_lowhigh; - PyArrayObject *__pyx_v_d1 = 0; - PyArrayObject *__pyx_v_d2 = 0; - double *__pyx_v_p_data1; - double *__pyx_v_p_data2; - double *__pyx_v_p_ans; - Correl *__pyx_v_myCorrel; - plan *__pyx_v_myplan; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ans; - __Pyx_Buffer __pyx_pybuffer_ans; - __Pyx_LocalBuf_ND __pyx_pybuffernd_d1; - __Pyx_Buffer __pyx_pybuffer_d1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_d2; - __Pyx_Buffer __pyx_pybuffer_d2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_data1; - __Pyx_Buffer __pyx_pybuffer_data1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_data2; - __Pyx_Buffer __pyx_pybuffer_data2; - PyObject *__pyx_r = NULL; +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyArrayObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - Correl *__pyx_t_10; - plan *__pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("correlate", 0); - __pyx_pybuffer_ans.pybuffer.buf = NULL; - __pyx_pybuffer_ans.refcount = 0; - __pyx_pybuffernd_ans.data = NULL; - __pyx_pybuffernd_ans.rcbuffer = &__pyx_pybuffer_ans; - __pyx_pybuffer_d1.pybuffer.buf = NULL; - __pyx_pybuffer_d1.refcount = 0; - __pyx_pybuffernd_d1.data = NULL; - __pyx_pybuffernd_d1.rcbuffer = &__pyx_pybuffer_d1; - __pyx_pybuffer_d2.pybuffer.buf = NULL; - __pyx_pybuffer_d2.refcount = 0; - __pyx_pybuffernd_d2.data = NULL; - __pyx_pybuffernd_d2.rcbuffer = &__pyx_pybuffer_d2; - __pyx_pybuffer_data1.pybuffer.buf = NULL; - __pyx_pybuffer_data1.refcount = 0; - __pyx_pybuffernd_data1.data = NULL; - __pyx_pybuffernd_data1.rcbuffer = &__pyx_pybuffer_data1; - __pyx_pybuffer_data2.pybuffer.buf = NULL; - __pyx_pybuffer_data2.refcount = 0; - __pyx_pybuffernd_data2.data = NULL; - __pyx_pybuffernd_data2.rcbuffer = &__pyx_pybuffer_data2; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data1.rcbuffer->pybuffer, (PyObject*)__pyx_v_data1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 98, __pyx_L1_error) - } - __pyx_pybuffernd_data1.diminfo[0].strides = __pyx_pybuffernd_data1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data1.diminfo[0].shape = __pyx_pybuffernd_data1.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data2.rcbuffer->pybuffer, (PyObject*)__pyx_v_data2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 98, __pyx_L1_error) + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; } - __pyx_pybuffernd_data2.diminfo[0].strides = __pyx_pybuffernd_data2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data2.diminfo[0].shape = __pyx_pybuffernd_data2.rcbuffer->pybuffer.shape[0]; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); - /* "src/helpers/correl.pyx":117 - * result = correlate(data1, data2) - * """ - * cdef int ncut = len(data1) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ans = np.zeros(ncut,dtype=np.float64) - * cdef int m=-1, _ltc=0, lowhigh=0 + /* "View.MemoryView":184 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_data1)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 117, __pyx_L1_error) - __pyx_v_ncut = __pyx_t_1; + __pyx_v_bufmode = -1; - /* "src/helpers/correl.pyx":118 - * """ - * cdef int ncut = len(data1) - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ans = np.zeros(ncut,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef int m=-1, _ltc=0, lowhigh=0 - * + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ncut); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 118, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ans.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { - __pyx_v_ans = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ans.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 118, __pyx_L1_error) - } else {__pyx_pybuffernd_ans.diminfo[0].strides = __pyx_pybuffernd_ans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ans.diminfo[0].shape = __pyx_pybuffernd_ans.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_7 = 0; - __pyx_v_ans = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":119 - * cdef int ncut = len(data1) - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ans = np.zeros(ncut,dtype=np.float64) - * cdef int m=-1, _ltc=0, lowhigh=0 # <<<<<<<<<<<<<< - * - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d1=np.ascontiguousarray(data1) + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": */ - __pyx_v_m = -1; - __pyx_v__ltc = 0; - __pyx_v_lowhigh = 0; + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":121 - * cdef int m=-1, _ltc=0, lowhigh=0 - * - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d1=np.ascontiguousarray(data1) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d2=np.ascontiguousarray(data2) - * + /* "View.MemoryView":187 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_6 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, ((PyObject *)__pyx_v_data1)) : __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_data1)); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 121, __pyx_L1_error) - __pyx_t_8 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d1.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { - __pyx_v_d1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_d1.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 121, __pyx_L1_error) - } else {__pyx_pybuffernd_d1.diminfo[0].strides = __pyx_pybuffernd_d1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d1.diminfo[0].shape = __pyx_pybuffernd_d1.rcbuffer->pybuffer.shape[0]; + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + */ + goto __pyx_L4; } - } - __pyx_t_8 = 0; - __pyx_v_d1 = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - /* "src/helpers/correl.pyx":122 - * - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d1=np.ascontiguousarray(data1) - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d2=np.ascontiguousarray(data2) # <<<<<<<<<<<<<< - * - * cdef double *p_data1 = d1.data + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + */ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 188, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":189 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + */ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); } - } - __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, ((PyObject *)__pyx_v_data2)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_data2)); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 122, __pyx_L1_error) - __pyx_t_9 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { - __pyx_v_d2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 122, __pyx_L1_error) - } else {__pyx_pybuffernd_d2.diminfo[0].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d2.diminfo[0].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[0]; + __pyx_L4:; + + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + */ + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":191 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 191, __pyx_L1_error) + + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + */ } + + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + */ } - __pyx_t_9 = 0; - __pyx_v_d2 = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - /* "src/helpers/correl.pyx":124 - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d2=np.ascontiguousarray(data2) + /* "View.MemoryView":192 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len * - * cdef double *p_data1 = d1.data # <<<<<<<<<<<<<< - * cdef double *p_data2 = d2.data - * cdef double *p_ans = ans.data */ - __pyx_v_p_data1 = ((double *)__pyx_v_d1->data); + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; - /* "src/helpers/correl.pyx":125 - * - * cdef double *p_data1 = d1.data - * cdef double *p_data2 = d2.data # <<<<<<<<<<<<<< - * cdef double *p_ans = ans.data + /* "View.MemoryView":193 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< * + * if flags & PyBUF_STRIDES: */ - __pyx_v_p_data2 = ((double *)__pyx_v_d2->data); + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; - /* "src/helpers/correl.pyx":126 - * cdef double *p_data1 = d1.data - * cdef double *p_data2 = d2.data - * cdef double *p_ans = ans.data # <<<<<<<<<<<<<< + /* "View.MemoryView":195 + * info.len = self.len * - * cdef Correl *myCorrel = new Correl() + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape */ - __pyx_v_p_ans = ((double *)__pyx_v_ans->data); + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":128 - * cdef double *p_ans = ans.data + /* "View.MemoryView":196 * - * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< - * cdef plan *myplan = new plan(p_data1,p_data2,ncut) + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides + */ + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; + + /* "View.MemoryView":197 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: + */ + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":198 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 + */ + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; + + /* "View.MemoryView":195 + * info.len = self.len * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape */ - try { - __pyx_t_10 = new Correl(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 128, __pyx_L1_error) + goto __pyx_L6; } - __pyx_v_myCorrel = __pyx_t_10; - /* "src/helpers/correl.pyx":129 + /* "View.MemoryView":200 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL + */ + /*else*/ { + __pyx_v_info->ndim = 1; + + /* "View.MemoryView":201 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL * - * cdef Correl *myCorrel = new Correl() - * cdef plan *myplan = new plan(p_data1,p_data2,ncut) # <<<<<<<<<<<<<< + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":202 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< * - * if ltc==1 or ltc==2: + * info.suboffsets = NULL */ - try { - __pyx_t_11 = new plan(__pyx_v_p_data1, __pyx_v_p_data2, __pyx_v_ncut); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_v_info->strides = NULL; } - __pyx_v_myplan = __pyx_t_11; + __pyx_L6:; - /* "src/helpers/correl.pyx":131 - * cdef plan *myplan = new plan(p_data1,p_data2,ncut) + /* "View.MemoryView":204 + * info.strides = NULL * - * if ltc==1 or ltc==2: # <<<<<<<<<<<<<< - * _ltc = ltc + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 + */ + __pyx_v_info->suboffsets = NULL; + + /* "View.MemoryView":205 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + */ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":206 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self + */ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":207 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self * */ - __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_v_ltc, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!__pyx_t_13) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; } else { - __pyx_t_12 = __pyx_t_13; - goto __pyx_L4_bool_binop_done; + __pyx_t_2 = NULL; } - __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_v_ltc, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_12 = __pyx_t_13; - __pyx_L4_bool_binop_done:; - if (__pyx_t_12) { + __pyx_v_info->format = __pyx_t_2; - /* "src/helpers/correl.pyx":132 - * - * if ltc==1 or ltc==2: - * _ltc = ltc # <<<<<<<<<<<<<< + /* "View.MemoryView":208 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< * - * myCorrel.correl(p_data1,p_data2,ncut,p_ans,m,_ltc,lowhigh,myplan) + * def __dealloc__(array self): */ - __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_v_ltc); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error) - __pyx_v__ltc = __pyx_t_14; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "src/helpers/correl.pyx":131 - * cdef plan *myplan = new plan(p_data1,p_data2,ncut) - * - * if ltc==1 or ltc==2: # <<<<<<<<<<<<<< - * _ltc = ltc + /* "View.MemoryView":182 + * _allocate_buffer(self) * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":134 - * _ltc = ltc - * - * myCorrel.correl(p_data1,p_data2,ncut,p_ans,m,_ltc,lowhigh,myplan) # <<<<<<<<<<<<<< +/* "View.MemoryView":210 + * info.obj = self * - * del myCorrel + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ - __pyx_v_myCorrel->correl(__pyx_v_p_data1, __pyx_v_p_data2, __pyx_v_ncut, __pyx_v_p_ans, __pyx_v_m, __pyx_v__ltc, __pyx_v_lowhigh, __pyx_v_myplan); - /* "src/helpers/correl.pyx":136 - * myCorrel.correl(p_data1,p_data2,ncut,p_ans,m,_ltc,lowhigh,myplan) - * - * del myCorrel # <<<<<<<<<<<<<< - * del myplan +/* Python wrapper */ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "View.MemoryView":211 * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - delete __pyx_v_myCorrel; + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":137 - * - * del myCorrel - * del myplan # <<<<<<<<<<<<<< + /* "View.MemoryView":212 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + */ + __pyx_v_self->callback_free_data(__pyx_v_self->data); + + /* "View.MemoryView":211 * - * return ans + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - delete __pyx_v_myplan; + goto __pyx_L3; + } - /* "src/helpers/correl.pyx":139 - * del myplan + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + */ + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + */ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":215 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) + */ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + */ + } + + /* "View.MemoryView":216 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) * - * return ans # <<<<<<<<<<<<<< + */ + free(__pyx_v_self->data); + + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + */ + } + __pyx_L3:; + + /* "View.MemoryView":217 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< * - * def transform(double [:] data, ltc = 0): + * @property */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_ans)); - __pyx_r = ((PyObject *)__pyx_v_ans); - goto __pyx_L0; + PyObject_Free(__pyx_v_self->_shape); - /* "src/helpers/correl.pyx":98 - * del myplan + /* "View.MemoryView":210 + * info.obj = self * - * def correlate(np.ndarray[np.float64_t,ndim=1] data1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] data2, - * ltc=0): + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ans.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.correlate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ans.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_ans); - __Pyx_XDECREF((PyObject *)__pyx_v_d1); - __Pyx_XDECREF((PyObject *)__pyx_v_d2); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "src/helpers/correl.pyx":141 - * return ans +/* "View.MemoryView":219 + * PyObject_Free(self._shape) * - * def transform(double [:] data, ltc = 0): # <<<<<<<<<<<<<< - * """ - * transform(data, ltc=0) + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_5transform(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_6correl_4transform[] = "\n transform(data, ltc=0)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_6correl_5transform = {"transform", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_5transform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_6correl_4transform}; -static PyObject *__pyx_pw_11newanalysis_6correl_5transform(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_v_ltc = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("transform (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_ltc,0}; - PyObject* values[2] = {0,0}; - values[1] = ((PyObject *)__pyx_int_0); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ltc); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transform") < 0)) __PYX_ERR(0, 141, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 141, __pyx_L3_error) - __pyx_v_ltc = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("transform", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 141, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_6correl_4transform(__pyx_self, __pyx_v_data, __pyx_v_ltc); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_4transform(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_data, PyObject *__pyx_v_ltc) { - int __pyx_v_ncut; - int __pyx_v_nc; - __Pyx_memviewslice __pyx_v_ans = { 0, 0, { 0 }, { 0 }, { 0 } }; - Correl *__pyx_v_myCorrel; +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Correl *__pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("transform", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/correl.pyx":145 - * transform(data, ltc=0) - * """ - * cdef int ncut = len(data) # <<<<<<<<<<<<<< - * cdef int nc = ncut + 1 + /* "View.MemoryView":221 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< * + * @cname('get_memview') */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_data); - __pyx_v_ncut = __pyx_t_1; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":146 - * """ - * cdef int ncut = len(data) - * cdef int nc = ncut + 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":219 + * PyObject_Free(self._shape) * - * cdef double [:,:] ans = np.zeros((2,nc), dtype=np.float64) + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() */ - __pyx_v_nc = (__pyx_v_ncut + 1); - /* "src/helpers/correl.pyx":148 - * cdef int nc = ncut + 1 - * - * cdef double [:,:] ans = np.zeros((2,nc), dtype=np.float64) # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":224 * - * cdef Correl *myCorrel = new Correl() - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) + */ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":225 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) + * + */ + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + + /* "View.MemoryView":226 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_2); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error); + __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_ans = __pyx_t_7; - __pyx_t_7.memview = NULL; - __pyx_t_7.data = NULL; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":150 - * cdef double [:,:] ans = np.zeros((2,nc), dtype=np.float64) + /* "View.MemoryView":224 * - * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * - * myCorrel.transform(&data[0], ncut, &ans[0,0], &ans[1,0], ltc) */ - try { - __pyx_t_8 = new Correl(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 150, __pyx_L1_error) - } - __pyx_v_myCorrel = __pyx_t_8; - /* "src/helpers/correl.pyx":152 - * cdef Correl *myCorrel = new Correl() +/* Python wrapper */ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__", 0); + + /* "View.MemoryView":229 * - * myCorrel.transform(&data[0], ncut, &ans[0,0], &ans[1,0], ltc) # <<<<<<<<<<<<<< + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< * - * return np.asarray(ans) + * def __getattr__(self, attr): */ - __pyx_t_9 = 0; - __pyx_t_10 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_v_data.shape[0]; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_v_data.shape[0])) __pyx_t_10 = 0; - if (unlikely(__pyx_t_10 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_10); - __PYX_ERR(0, 152, __pyx_L1_error) - } - __pyx_t_11 = 0; - __pyx_t_12 = 0; - __pyx_t_10 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_v_ans.shape[0]; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_v_ans.shape[0])) __pyx_t_10 = 0; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_v_ans.shape[1]; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1; - } else if (unlikely(__pyx_t_12 >= __pyx_v_ans.shape[1])) __pyx_t_10 = 1; - if (unlikely(__pyx_t_10 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_10); - __PYX_ERR(0, 152, __pyx_L1_error) - } - __pyx_t_13 = 1; - __pyx_t_14 = 0; - __pyx_t_10 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_v_ans.shape[0]; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_v_ans.shape[0])) __pyx_t_10 = 0; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_v_ans.shape[1]; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 1; - } else if (unlikely(__pyx_t_14 >= __pyx_v_ans.shape[1])) __pyx_t_10 = 1; - if (unlikely(__pyx_t_10 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_10); - __PYX_ERR(0, 152, __pyx_L1_error) - } - __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_ltc); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L1_error) - __pyx_v_myCorrel->transform((&(*((double *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_9 * __pyx_v_data.strides[0]) )))), __pyx_v_ncut, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ans.data + __pyx_t_11 * __pyx_v_ans.strides[0]) ) + __pyx_t_12 * __pyx_v_ans.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ans.data + __pyx_t_13 * __pyx_v_ans.strides[0]) ) + __pyx_t_14 * __pyx_v_ans.strides[1]) )))), ((int)__pyx_t_10)); + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; - /* "src/helpers/correl.pyx":154 - * myCorrel.transform(&data[0], ncut, &ans[0,0], &ans[1,0], ltc) + /* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) * - * return np.asarray(ans) # <<<<<<<<<<<<<< + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":231 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * - * @cython.boundscheck(False) + */ + +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "View.MemoryView":232 + * + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_ans, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_6 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "src/helpers/correl.pyx":141 - * return ans + /* "View.MemoryView":231 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * - * def transform(double [:] data, ltc = 0): # <<<<<<<<<<<<<< - * """ - * transform(data, ltc=0) */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); - __Pyx_AddTraceback("newanalysis.correl.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_ans, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_data, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":157 +/* "View.MemoryView":234 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] * - * @cython.boundscheck(False) - * def sparsecrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_7sparsecrosscorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_7sparsecrosscorrelate = {"sparsecrosscorrelate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_7sparsecrosscorrelate, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_7sparsecrosscorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_pdata = 0; - PyArrayObject *__pyx_v_pds = 0; - int __pyx_v_pnshells; - PyObject *__pyx_v_maxlen = 0; +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":235 + * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< + * + * def __setitem__(self, item, value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":234 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":237 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * + */ + +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "View.MemoryView":238 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":237 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sparsecrosscorrelate (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,0}; - PyObject* values[4] = {0,0,0,0}; + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":160 - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, - * maxlen=None,): # <<<<<<<<<<<<<< - * cdef int nmol = len(pdata) # number of molecules - * cdef int n = len(pdata[0]) # number of time steps + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - values[3] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pdata)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsecrosscorrelate", 0, 3, 4, 1); __PYX_ERR(0, 157, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pnshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsecrosscorrelate", 0, 3, 4, 2); __PYX_ERR(0, 157, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[3] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sparsecrosscorrelate") < 0)) __PYX_ERR(0, 157, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_pdata = ((PyArrayObject *)values[0]); - __pyx_v_pds = ((PyArrayObject *)values[1]); - __pyx_v_pnshells = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L3_error) - __pyx_v_maxlen = values[3]; + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparsecrosscorrelate", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 157, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.sparsecrosscorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 157, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 158, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_6sparsecrosscorrelate(__pyx_self, __pyx_v_pdata, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen); - - /* "src/helpers/correl.pyx":157 - * - * @cython.boundscheck(False) - * def sparsecrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, - */ + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_6sparsecrosscorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen) { - int __pyx_v_nmol; - int __pyx_v_n; - int __pyx_v_nds; - int __pyx_v_maxdt; - int __pyx_v_nshells; - PyArrayObject *__pyx_v_contdata = 0; - PyArrayObject *__pyx_v_contds = 0; - double *__pyx_v_cdata; - int *__pyx_v_cds; - PyArrayObject *__pyx_v_corr = 0; - PyArrayObject *__pyx_v_ctr = 0; - double *__pyx_v_ccorr; - double *__pyx_v_cctr; - double __pyx_v_value; - int __pyx_v_start; - int __pyx_v_dt; - int __pyx_v_mol; - int __pyx_v_shell; - int __pyx_v_i; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; - __Pyx_Buffer __pyx_pybuffer_contdata; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; - __Pyx_Buffer __pyx_pybuffer_contds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; - __Pyx_Buffer __pyx_pybuffer_corr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; - __Pyx_Buffer __pyx_pybuffer_pdata; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; - __Pyx_Buffer __pyx_pybuffer_pds; +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyArrayObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sparsecrosscorrelate", 0); - __pyx_pybuffer_contdata.pybuffer.buf = NULL; - __pyx_pybuffer_contdata.refcount = 0; - __pyx_pybuffernd_contdata.data = NULL; - __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; - __pyx_pybuffer_contds.pybuffer.buf = NULL; - __pyx_pybuffer_contds.refcount = 0; - __pyx_pybuffernd_contds.data = NULL; - __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; - __pyx_pybuffer_corr.pybuffer.buf = NULL; - __pyx_pybuffer_corr.refcount = 0; - __pyx_pybuffernd_corr.data = NULL; - __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_pdata.pybuffer.buf = NULL; - __pyx_pybuffer_pdata.refcount = 0; - __pyx_pybuffernd_pdata.data = NULL; - __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; - __pyx_pybuffer_pds.pybuffer.buf = NULL; - __pyx_pybuffer_pds.refcount = 0; - __pyx_pybuffernd_pds.data = NULL; - __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 157, __pyx_L1_error) - } - __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 157, __pyx_L1_error) - } - __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/helpers/correl.pyx":161 - * int pnshells, - * maxlen=None,): - * cdef int nmol = len(pdata) # number of molecules # <<<<<<<<<<<<<< - * cdef int n = len(pdata[0]) # number of time steps - * cdef int nds = len(pds[0]) # number of steps in delaunay array + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 161, __pyx_L1_error) - __pyx_v_nmol = __pyx_t_1; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/helpers/correl.pyx":162 - * maxlen=None,): - * cdef int nmol = len(pdata) # number of molecules - * cdef int n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< - * cdef int nds = len(pds[0]) # number of steps in delaunay array - * cdef int maxdt = n + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n = __pyx_t_1; - /* "src/helpers/correl.pyx":163 - * cdef int nmol = len(pdata) # number of molecules - * cdef int n = len(pdata[0]) # number of time steps - * cdef int nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< - * cdef int maxdt = n - * cdef int nshells = pnshells - */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_nds = __pyx_t_1; + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":164 - * cdef int n = len(pdata[0]) # number of time steps - * cdef int nds = len(pds[0]) # number of steps in delaunay array - * cdef int maxdt = n # <<<<<<<<<<<<<< - * cdef int nshells = pnshells - * if maxlen != None: +/* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * + * */ - __pyx_v_maxdt = __pyx_v_n; - /* "src/helpers/correl.pyx":165 - * cdef int nds = len(pds[0]) # number of steps in delaunay array - * cdef int maxdt = n - * cdef int nshells = pnshells # <<<<<<<<<<<<<< - * if maxlen != None: - * maxdt = maxlen - */ - __pyx_v_nshells = __pyx_v_pnshells; +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_allocate_buffer", 0); - /* "src/helpers/correl.pyx":166 - * cdef int maxdt = n - * cdef int nshells = pnshells - * if maxlen != None: # <<<<<<<<<<<<<< - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + /* "View.MemoryView":254 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 166, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { + __pyx_v_self->free_data = 1; - /* "src/helpers/correl.pyx":167 - * cdef int nshells = pnshells - * if maxlen != None: - * maxdt = maxlen # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + /* "View.MemoryView":255 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." */ - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L1_error) - __pyx_v_maxdt = __pyx_t_4; + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); - /* "src/helpers/correl.pyx":166 - * cdef int maxdt = n - * cdef int nshells = pnshells - * if maxlen != None: # <<<<<<<<<<<<<< - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * */ - } + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/correl.pyx":168 - * if maxlen != None: - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data + /* "View.MemoryView":257 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, ((PyObject *)__pyx_v_pdata)) : __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_pdata)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 168, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 168, __pyx_L1_error) - } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_7 = 0; - __pyx_v_contdata = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 257, __pyx_L1_error) - /* "src/helpers/correl.pyx":169 - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, ((PyObject *)__pyx_v_pds)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_pds)); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 169, __pyx_L1_error) - __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 169, __pyx_L1_error) - } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; - } } - __pyx_t_8 = 0; - __pyx_v_contds = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":170 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< - * cdef int *cds = contds.data - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - __pyx_v_cdata = ((double *)__pyx_v_contdata->data); + if (__pyx_v_self->dtype_is_object) { - /* "src/helpers/correl.pyx":171 - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":260 + * + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None */ - __pyx_v_cds = ((int *)__pyx_v_contds->data); + __pyx_v_p = ((PyObject **)__pyx_v_self->data); - /* "src/helpers/correl.pyx":172 - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data + /* "View.MemoryView":261 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6); - __pyx_t_2 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 172, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 172, __pyx_L1_error) - } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 261, __pyx_L1_error) } - } - __pyx_t_11 = 0; - __pyx_v_corr = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; - - /* "src/helpers/correl.pyx":173 - * cdef int *cds = contds.data - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *ccorr = corr.data - * cdef double *cctr = ctr.data - */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_10 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 173, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 173, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 261, __pyx_L1_error) } - } - __pyx_t_12 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/correl.pyx":174 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< - * cdef double *cctr = ctr.data - * cdef double value + /* "View.MemoryView":262 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 */ - __pyx_v_ccorr = ((double *)__pyx_v_corr->data); + (__pyx_v_p[__pyx_v_i]) = Py_None; - /* "src/helpers/correl.pyx":175 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data - * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< - * cdef double value - * cdef int start,dt,mol,shell + /* "View.MemoryView":263 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 + * */ - __pyx_v_cctr = ((double *)__pyx_v_ctr->data); + Py_INCREF(Py_None); + } - /* "src/helpers/correl.pyx":179 - * cdef int start,dt,mol,shell + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." * - * for dt in prange(maxdt,nogil=True): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_14 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_14 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_3) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shell) lastprivate(__pyx_v_start) lastprivate(__pyx_v_value) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ - { - __pyx_v_dt = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_mol = ((int)0xbad0bad0); - __pyx_v_shell = ((int)0xbad0bad0); - __pyx_v_start = ((int)0xbad0bad0); - __pyx_v_value = ((double)__PYX_NAN()); + } - /* "src/helpers/correl.pyx":180 + /* "View.MemoryView":264 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * * - * for dt in prange(maxdt,nogil=True): # loop over all delta t - * for start in range(n-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * shell = cds[mol*nds+start]-1 */ - __pyx_t_15 = (__pyx_v_n - __pyx_v_dt); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_start = __pyx_t_17; + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":181 - * for dt in prange(maxdt,nogil=True): # loop over all delta t - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * shell = cds[mol*nds+start]-1 - * if shell < nshells: + /* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * + * */ - __pyx_t_18 = __pyx_v_nmol; - __pyx_t_19 = __pyx_t_18; - for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { - __pyx_v_mol = __pyx_t_20; - /* "src/helpers/correl.pyx":182 - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * shell = cds[mol*nds+start]-1 # <<<<<<<<<<<<<< - * if shell < nshells: - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - */ - __pyx_v_shell = ((__pyx_v_cds[((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start)]) - 1); + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":183 - * for mol in range(nmol): # loop over molecules/entries - * shell = cds[mol*nds+start]-1 - * if shell < nshells: # <<<<<<<<<<<<<< - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - * ccorr[maxdt*shell+dt] += value +/* "View.MemoryView":268 + * + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ - __pyx_t_3 = ((__pyx_v_shell < __pyx_v_nshells) != 0); - if (__pyx_t_3) { - /* "src/helpers/correl.pyx":184 - * shell = cds[mol*nds+start]-1 - * if shell < nshells: - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] # <<<<<<<<<<<<<< - * ccorr[maxdt*shell+dt] += value - * cctr[maxdt*shell+dt] += 1 - */ - __pyx_v_value = ((__pyx_v_cdata[((__pyx_v_mol * __pyx_v_n) + __pyx_v_start)]) * (__pyx_v_cdata[(((__pyx_v_mol * __pyx_v_n) + __pyx_v_start) + __pyx_v_dt)])); +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); - /* "src/helpers/correl.pyx":185 - * if shell < nshells: - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - * ccorr[maxdt*shell+dt] += value # <<<<<<<<<<<<<< - * cctr[maxdt*shell+dt] += 1 + /* "View.MemoryView":270 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< * + * if buf is NULL: */ - __pyx_t_21 = ((__pyx_v_maxdt * __pyx_v_shell) + __pyx_v_dt); - (__pyx_v_ccorr[__pyx_t_21]) = ((__pyx_v_ccorr[__pyx_t_21]) + __pyx_v_value); + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_n_s_fortran); + __pyx_t_1 = __pyx_n_s_fortran; + } else { + __Pyx_INCREF(__pyx_n_s_c); + __pyx_t_1 = __pyx_n_s_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":186 - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - * ccorr[maxdt*shell+dt] += value - * cctr[maxdt*shell+dt] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. * - * for i in range(maxdt*nshells): + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - __pyx_t_21 = ((__pyx_v_maxdt * __pyx_v_shell) + __pyx_v_dt); - (__pyx_v_cctr[__pyx_t_21]) = ((__pyx_v_cctr[__pyx_t_21]) + 1.0); + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":183 - * for mol in range(nmol): # loop over molecules/entries - * shell = cds[mol*nds+start]-1 - * if shell < nshells: # <<<<<<<<<<<<<< - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - * ccorr[maxdt*shell+dt] += value + /* "View.MemoryView":273 + * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/correl.pyx":179 - * cdef int start,dt,mol,shell + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. * - * for dt in prange(maxdt,nogil=True): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } + goto __pyx_L3; } - /* "src/helpers/correl.pyx":188 - * cctr[maxdt*shell+dt] += 1 - * - * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] - */ - __pyx_t_14 = (__pyx_v_maxdt * __pyx_v_nshells); - __pyx_t_13 = __pyx_t_14; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_13; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "src/helpers/correl.pyx":189 - * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: - */ - __pyx_t_3 = (((__pyx_v_cctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_3) { - - /* "src/helpers/correl.pyx":190 - * for i in range(maxdt*nshells): - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< - * else: - * print 'too sparse' - */ - __pyx_t_15 = __pyx_v_i; - if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 190, __pyx_L1_error) - } - (__pyx_v_ccorr[__pyx_t_15]) = ((__pyx_v_ccorr[__pyx_t_15]) / (__pyx_v_cctr[__pyx_v_i])); - - /* "src/helpers/correl.pyx":189 + /* "View.MemoryView":275 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: */ - goto __pyx_L20; - } + /*else*/ { + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode)) __PYX_ERR(1, 275, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 275, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/correl.pyx":192 - * ccorr[i] /= cctr[i] - * else: - * print 'too sparse' # <<<<<<<<<<<<<< + /* "View.MemoryView":276 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< * - * return corr + * return result */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_too_sparse) < 0) __PYX_ERR(0, 192, __pyx_L1_error) - } - __pyx_L20:; + __pyx_v_result->data = __pyx_v_buf; } + __pyx_L3:; - /* "src/helpers/correl.pyx":194 - * print 'too sparse' + /* "View.MemoryView":278 + * result.data = buf * - * return corr # <<<<<<<<<<<<<< + * return result # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_corr)); - __pyx_r = ((PyObject *)__pyx_v_corr); + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "src/helpers/correl.pyx":157 + /* "View.MemoryView":268 * - * @cython.boundscheck(False) - * def sparsecrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.sparsecrosscorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_contdata); - __Pyx_XDECREF((PyObject *)__pyx_v_contds); - __Pyx_XDECREF((PyObject *)__pyx_v_corr); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":198 - * - * @cython.boundscheck(False) - * def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, +/* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_9sparsefullcorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_9sparsefullcorrelate = {"sparsefullcorrelate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_9sparsefullcorrelate, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_9sparsefullcorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_pdata = 0; - PyArrayObject *__pyx_v_pds = 0; - int __pyx_v_pnshells; - PyObject *__pyx_v_maxlen = 0; +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sparsefullcorrelate (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 304, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,0}; - PyObject* values[4] = {0,0,0,0}; - - /* "src/helpers/correl.pyx":201 - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, - * maxlen=None,): # <<<<<<<<<<<<<< - * cdef int nmol = len(pdata) # number of molecules - * cdef int n = len(pdata[0]) # number of time steps - */ - values[3] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pdata)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullcorrelate", 0, 3, 4, 1); __PYX_ERR(0, 198, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pnshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullcorrelate", 0, 3, 4, 2); __PYX_ERR(0, 198, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[3] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sparsefullcorrelate") < 0)) __PYX_ERR(0, 198, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 304, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } - __pyx_v_pdata = ((PyArrayObject *)values[0]); - __pyx_v_pds = ((PyArrayObject *)values[1]); - __pyx_v_pnshells = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L3_error) - __pyx_v_maxlen = values[3]; + __pyx_v_name = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparsefullcorrelate", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 198, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 304, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.sparsefullcorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 198, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 199, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_8sparsefullcorrelate(__pyx_self, __pyx_v_pdata, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen); - - /* "src/helpers/correl.pyx":198 - * - * @cython.boundscheck(False) - * def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, - */ + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_8sparsefullcorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen) { - int __pyx_v_nmol; - int __pyx_v_n; - int __pyx_v_nds; - int __pyx_v_maxdt; - int __pyx_v_nshells; - PyArrayObject *__pyx_v_contdata = 0; - PyArrayObject *__pyx_v_contds = 0; - double *__pyx_v_cdata; - int *__pyx_v_cds; - PyObject *__pyx_v_pcorr = NULL; - PyObject *__pyx_v_pselfcorr = NULL; - PyObject *__pyx_v_pcrosscorr = NULL; - PyArrayObject *__pyx_v_corr = 0; - PyArrayObject *__pyx_v_selfcorr = 0; - PyArrayObject *__pyx_v_crosscorr = 0; - PyArrayObject *__pyx_v_ctr = 0; - PyArrayObject *__pyx_v_selfctr = 0; - PyArrayObject *__pyx_v_crossctr = 0; - double *__pyx_v_ccorr; - double *__pyx_v_cselfcorr; - double *__pyx_v_ccrosscorr; - double *__pyx_v_cctr; - double *__pyx_v_cselfctr; - double *__pyx_v_ccrossctr; - double __pyx_v_value; - int __pyx_v_i; - int __pyx_v_start; - int __pyx_v_dt; - int __pyx_v_mol; - int __pyx_v_shellstart; - int __pyx_v_shelldt; - int __pyx_v_idx; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; - __Pyx_Buffer __pyx_pybuffer_contdata; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; - __Pyx_Buffer __pyx_pybuffer_contds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; - __Pyx_Buffer __pyx_pybuffer_corr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_crosscorr; - __Pyx_Buffer __pyx_pybuffer_crosscorr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_crossctr; - __Pyx_Buffer __pyx_pybuffer_crossctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; - __Pyx_Buffer __pyx_pybuffer_pdata; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; - __Pyx_Buffer __pyx_pybuffer_pds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_selfcorr; - __Pyx_Buffer __pyx_pybuffer_selfcorr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_selfctr; - __Pyx_Buffer __pyx_pybuffer_selfctr; - PyObject *__pyx_r = NULL; +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyArrayObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - PyArrayObject *__pyx_t_13 = NULL; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sparsefullcorrelate", 0); - __pyx_pybuffer_contdata.pybuffer.buf = NULL; - __pyx_pybuffer_contdata.refcount = 0; - __pyx_pybuffernd_contdata.data = NULL; - __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; - __pyx_pybuffer_contds.pybuffer.buf = NULL; - __pyx_pybuffer_contds.refcount = 0; - __pyx_pybuffernd_contds.data = NULL; - __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; - __pyx_pybuffer_corr.pybuffer.buf = NULL; - __pyx_pybuffer_corr.refcount = 0; - __pyx_pybuffernd_corr.data = NULL; - __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; - __pyx_pybuffer_selfcorr.pybuffer.buf = NULL; - __pyx_pybuffer_selfcorr.refcount = 0; - __pyx_pybuffernd_selfcorr.data = NULL; - __pyx_pybuffernd_selfcorr.rcbuffer = &__pyx_pybuffer_selfcorr; - __pyx_pybuffer_crosscorr.pybuffer.buf = NULL; - __pyx_pybuffer_crosscorr.refcount = 0; - __pyx_pybuffernd_crosscorr.data = NULL; - __pyx_pybuffernd_crosscorr.rcbuffer = &__pyx_pybuffer_crosscorr; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_selfctr.pybuffer.buf = NULL; - __pyx_pybuffer_selfctr.refcount = 0; - __pyx_pybuffernd_selfctr.data = NULL; - __pyx_pybuffernd_selfctr.rcbuffer = &__pyx_pybuffer_selfctr; - __pyx_pybuffer_crossctr.pybuffer.buf = NULL; - __pyx_pybuffer_crossctr.refcount = 0; - __pyx_pybuffernd_crossctr.data = NULL; - __pyx_pybuffernd_crossctr.rcbuffer = &__pyx_pybuffer_crossctr; - __pyx_pybuffer_pdata.pybuffer.buf = NULL; - __pyx_pybuffer_pdata.refcount = 0; - __pyx_pybuffernd_pdata.data = NULL; - __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; - __pyx_pybuffer_pds.pybuffer.buf = NULL; - __pyx_pybuffer_pds.refcount = 0; - __pyx_pybuffernd_pds.data = NULL; - __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 198, __pyx_L1_error) - } - __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 198, __pyx_L1_error) - } - __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; + __Pyx_RefNannySetupContext("__init__", 0); - /* "src/helpers/correl.pyx":202 - * int pnshells, - * maxlen=None,): - * cdef int nmol = len(pdata) # number of molecules # <<<<<<<<<<<<<< - * cdef int n = len(pdata[0]) # number of time steps - * cdef int nds = len(pds[0]) # number of steps in delaunay array + /* "View.MemoryView":305 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 202, __pyx_L1_error) - __pyx_v_nmol = __pyx_t_1; + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; - /* "src/helpers/correl.pyx":203 - * maxlen=None,): - * cdef int nmol = len(pdata) # number of molecules - * cdef int n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< - * cdef int nds = len(pds[0]) # number of steps in delaunay array - * cdef int maxdt = n + /* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n = __pyx_t_1; - /* "src/helpers/correl.pyx":204 - * cdef int nmol = len(pdata) # number of molecules - * cdef int n = len(pdata[0]) # number of time steps - * cdef int nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< - * cdef int maxdt = n - * cdef int nshells = pnshells+1 - */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_nds = __pyx_t_1; + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":205 - * cdef int n = len(pdata[0]) # number of time steps - * cdef int nds = len(pds[0]) # number of steps in delaunay array - * cdef int maxdt = n # <<<<<<<<<<<<<< - * cdef int nshells = pnshells+1 - * if maxlen != None: +/* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * */ - __pyx_v_maxdt = __pyx_v_n; - /* "src/helpers/correl.pyx":206 - * cdef int nds = len(pds[0]) # number of steps in delaunay array - * cdef int maxdt = n - * cdef int nshells = pnshells+1 # <<<<<<<<<<<<<< - * if maxlen != None: - * maxdt = maxlen - */ - __pyx_v_nshells = (__pyx_v_pnshells + 1); +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":207 - * cdef int maxdt = n - * cdef int nshells = pnshells+1 - * if maxlen != None: # <<<<<<<<<<<<<< - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":208 - * cdef int nshells = pnshells+1 - * if maxlen != None: - * maxdt = maxlen # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - */ - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error) - __pyx_v_maxdt = __pyx_t_4; +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/helpers/correl.pyx":207 - * cdef int maxdt = n - * cdef int nshells = pnshells+1 - * if maxlen != None: # <<<<<<<<<<<<<< - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + /* "View.MemoryView":307 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< + * + * cdef generic = Enum("") */ - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; - /* "src/helpers/correl.pyx":209 - * if maxlen != None: - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data + /* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, ((PyObject *)__pyx_v_pdata)) : __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_pdata)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 209, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 209, __pyx_L1_error) - } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_7 = 0; - __pyx_v_contdata = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":210 - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, ((PyObject *)__pyx_v_pds)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_pds)); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 210, __pyx_L1_error) - __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 210, __pyx_L1_error) - } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_8 = 0; - __pyx_v_contds = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":211 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - __pyx_v_cdata = ((double *)__pyx_v_contdata->data); - /* "src/helpers/correl.pyx":212 - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data # <<<<<<<<<<<<<< - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - */ - __pyx_v_cds = ((int *)__pyx_v_contds->data); +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":213 - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6); - __pyx_t_2 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_pcorr = __pyx_t_10; - __pyx_t_10 = 0; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":214 - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_10 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_pselfcorr = __pyx_t_2; - __pyx_t_2 = 0; +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "src/helpers/correl.pyx":215 - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6); - __pyx_t_2 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_pcrosscorr = __pyx_t_10; - __pyx_t_10 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":216 - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) */ - if (!(likely(((__pyx_v_pcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 216, __pyx_L1_error) - __pyx_t_10 = __pyx_v_pcorr; - __Pyx_INCREF(__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_10), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 216, __pyx_L1_error) - } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_v_corr = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":217 - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - if (!(likely(((__pyx_v_pselfcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pselfcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 217, __pyx_L1_error) - __pyx_t_10 = __pyx_v_pselfcorr; - __Pyx_INCREF(__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_10), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_selfcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 217, __pyx_L1_error) - } else {__pyx_pybuffernd_selfcorr.diminfo[0].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfcorr.diminfo[0].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfcorr.diminfo[1].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfcorr.diminfo[1].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_v_selfcorr = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; + __pyx_t_2 = (__pyx_v__dict != Py_None); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":218 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: */ - if (!(likely(((__pyx_v_pcrosscorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcrosscorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 218, __pyx_L1_error) - __pyx_t_10 = __pyx_v_pcrosscorr; - __Pyx_INCREF(__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_10), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_crosscorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 218, __pyx_L1_error) - } else {__pyx_pybuffernd_crosscorr.diminfo[0].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crosscorr.diminfo[0].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crosscorr.diminfo[1].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crosscorr.diminfo[1].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_v_crosscorr = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "src/helpers/correl.pyx":219 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.name is not None */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_10 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 219, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 219, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_11 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_use_setstate = 1; - /* "src/helpers/correl.pyx":220 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6); - __pyx_t_2 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 220, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_selfctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 220, __pyx_L1_error) - } else {__pyx_pybuffernd_selfctr.diminfo[0].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfctr.diminfo[0].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfctr.diminfo[1].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfctr.diminfo[1].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[1]; - } + goto __pyx_L3; } - __pyx_t_12 = 0; - __pyx_v_selfctr = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; - /* "src/helpers/correl.pyx":221 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = self.name is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_10 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 221, __pyx_L1_error) - __pyx_t_13 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_crossctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 221, __pyx_L1_error) - } else {__pyx_pybuffernd_crossctr.diminfo[0].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crossctr.diminfo[0].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crossctr.diminfo[1].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crossctr.diminfo[1].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[1]; - } + /*else*/ { + __pyx_t_2 = (__pyx_v_self->name != Py_None); + __pyx_v_use_setstate = __pyx_t_2; } - __pyx_t_13 = 0; - __pyx_v_crossctr = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_L3:; - /* "src/helpers/correl.pyx":222 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: */ - __pyx_v_ccorr = ((double *)__pyx_v_corr->data); + if (__pyx_v_use_setstate) { - /* "src/helpers/correl.pyx":223 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data # <<<<<<<<<<<<<< - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data + /* "(tree fragment)":13 + * use_setstate = self.name is not None + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) */ - __pyx_v_cselfcorr = ((double *)__pyx_v_selfcorr->data); + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":224 - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data # <<<<<<<<<<<<<< - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: */ - __pyx_v_ccrosscorr = ((double *)__pyx_v_crosscorr->data); + } - /* "src/helpers/correl.pyx":225 - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< - * cdef double *cselfctr = selfctr.data - * cdef double *ccrossctr = crossctr.data + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ - __pyx_v_cctr = ((double *)__pyx_v_ctr->data); + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } - /* "src/helpers/correl.pyx":226 - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data # <<<<<<<<<<<<<< - * cdef double *ccrossctr = crossctr.data - * cdef double value + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - __pyx_v_cselfctr = ((double *)__pyx_v_selfctr->data); - /* "src/helpers/correl.pyx":227 - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data - * cdef double *ccrossctr = crossctr.data # <<<<<<<<<<<<<< - * cdef double value - * cdef int i,start,dt,mol,shellstart,shelldt,idx - */ - __pyx_v_ccrossctr = ((double *)__pyx_v_crossctr->data); - - /* "src/helpers/correl.pyx":231 - * cdef int i,start,dt,mol,shellstart,shelldt,idx - * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_15 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_15 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_3) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_value) - #endif /* _OPENMP */ - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){ - { - __pyx_v_dt = (int)(0 + 1 * __pyx_t_14); - /* Initialize private variables to invalid values */ - __pyx_v_idx = ((int)0xbad0bad0); - __pyx_v_mol = ((int)0xbad0bad0); - __pyx_v_shelldt = ((int)0xbad0bad0); - __pyx_v_shellstart = ((int)0xbad0bad0); - __pyx_v_start = ((int)0xbad0bad0); - __pyx_v_value = ((double)__PYX_NAN()); - - /* "src/helpers/correl.pyx":232 - * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for start in range(n-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * shellstart = cds[mol*nds+start]-1 - */ - __pyx_t_16 = (__pyx_v_n - __pyx_v_dt); - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_start = __pyx_t_18; - - /* "src/helpers/correl.pyx":233 - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * shellstart = cds[mol*nds+start]-1 - * shelldt = cds[mol*nds+start+dt]-1 - */ - __pyx_t_19 = __pyx_v_nmol; - __pyx_t_20 = __pyx_t_19; - for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { - __pyx_v_mol = __pyx_t_21; - - /* "src/helpers/correl.pyx":234 - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * shellstart = cds[mol*nds+start]-1 # <<<<<<<<<<<<<< - * shelldt = cds[mol*nds+start+dt]-1 - * # if shellstart < nshells: - */ - __pyx_v_shellstart = ((__pyx_v_cds[((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start)]) - 1); - - /* "src/helpers/correl.pyx":235 - * for mol in range(nmol): # loop over molecules/entries - * shellstart = cds[mol*nds+start]-1 - * shelldt = cds[mol*nds+start+dt]-1 # <<<<<<<<<<<<<< - * # if shellstart < nshells: - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - */ - __pyx_v_shelldt = ((__pyx_v_cds[(((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start) + __pyx_v_dt)]) - 1); - - /* "src/helpers/correl.pyx":237 - * shelldt = cds[mol*nds+start+dt]-1 - * # if shellstart < nshells: - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] # <<<<<<<<<<<<<< - * idx = maxdt*shellstart+dt - * ccorr[idx] += value - */ - __pyx_v_value = ((__pyx_v_cdata[((__pyx_v_mol * __pyx_v_n) + __pyx_v_start)]) * (__pyx_v_cdata[(((__pyx_v_mol * __pyx_v_n) + __pyx_v_start) + __pyx_v_dt)])); - - /* "src/helpers/correl.pyx":238 - * # if shellstart < nshells: - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - * idx = maxdt*shellstart+dt # <<<<<<<<<<<<<< - * ccorr[idx] += value - * cctr[idx] += 1 - */ - __pyx_v_idx = ((__pyx_v_maxdt * __pyx_v_shellstart) + __pyx_v_dt); - - /* "src/helpers/correl.pyx":239 - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - * idx = maxdt*shellstart+dt - * ccorr[idx] += value # <<<<<<<<<<<<<< - * cctr[idx] += 1 - * if shellstart == shelldt: - */ - __pyx_t_22 = __pyx_v_idx; - (__pyx_v_ccorr[__pyx_t_22]) = ((__pyx_v_ccorr[__pyx_t_22]) + __pyx_v_value); - - /* "src/helpers/correl.pyx":240 - * idx = maxdt*shellstart+dt - * ccorr[idx] += value - * cctr[idx] += 1 # <<<<<<<<<<<<<< - * if shellstart == shelldt: - * cselfcorr[idx] += value - */ - __pyx_t_22 = __pyx_v_idx; - (__pyx_v_cctr[__pyx_t_22]) = ((__pyx_v_cctr[__pyx_t_22]) + 1.0); - - /* "src/helpers/correl.pyx":241 - * ccorr[idx] += value - * cctr[idx] += 1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * cselfcorr[idx] += value - * cselfctr[idx] += 1 - */ - __pyx_t_3 = ((__pyx_v_shellstart == __pyx_v_shelldt) != 0); - if (__pyx_t_3) { - - /* "src/helpers/correl.pyx":242 - * cctr[idx] += 1 - * if shellstart == shelldt: - * cselfcorr[idx] += value # <<<<<<<<<<<<<< - * cselfctr[idx] += 1 - * - */ - __pyx_t_22 = __pyx_v_idx; - (__pyx_v_cselfcorr[__pyx_t_22]) = ((__pyx_v_cselfcorr[__pyx_t_22]) + __pyx_v_value); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":243 - * if shellstart == shelldt: - * cselfcorr[idx] += value - * cselfctr[idx] += 1 # <<<<<<<<<<<<<< - * - * for i in range(maxdt*nshells): +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ - __pyx_t_22 = __pyx_v_idx; - (__pyx_v_cselfctr[__pyx_t_22]) = ((__pyx_v_cselfctr[__pyx_t_22]) + 1.0); - /* "src/helpers/correl.pyx":241 - * ccorr[idx] += value - * cctr[idx] += 1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * cselfcorr[idx] += value - * cselfctr[idx] += 1 - */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 16, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - - /* "src/helpers/correl.pyx":231 - * cdef int i,start,dt,mol,shellstart,shelldt,idx - * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } - __pyx_L6:; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } - } - - /* "src/helpers/correl.pyx":245 - * cselfctr[idx] += 1 - * - * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] - */ - __pyx_t_15 = (__pyx_v_maxdt * __pyx_v_nshells); - __pyx_t_14 = __pyx_t_15; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_14; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "src/helpers/correl.pyx":246 - * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: - */ - __pyx_t_3 = (((__pyx_v_cctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_3) { - - /* "src/helpers/correl.pyx":247 - * for i in range(maxdt*nshells): - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< - * else: - * print 'tot too sparse' - */ - __pyx_t_16 = __pyx_v_i; - if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 247, __pyx_L1_error) + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) } - (__pyx_v_ccorr[__pyx_t_16]) = ((__pyx_v_ccorr[__pyx_t_16]) / (__pyx_v_cctr[__pyx_v_i])); - - /* "src/helpers/correl.pyx":246 - * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: - */ - goto __pyx_L20; - } - - /* "src/helpers/correl.pyx":249 - * ccorr[i] /= cctr[i] - * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< - * if cctr[i] != 0: - * cselfcorr[i] /= cselfctr[i] - */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 249, __pyx_L1_error) + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_L20:; - - /* "src/helpers/correl.pyx":250 - * else: - * print 'tot too sparse' - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * cselfcorr[i] /= cselfctr[i] - * else: - */ - __pyx_t_3 = (((__pyx_v_cctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_3) { - - /* "src/helpers/correl.pyx":251 - * print 'tot too sparse' - * if cctr[i] != 0: - * cselfcorr[i] /= cselfctr[i] # <<<<<<<<<<<<<< - * else: - * print 'self too sparse' - */ - __pyx_t_16 = __pyx_v_i; - if (unlikely((__pyx_v_cselfctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 251, __pyx_L1_error) - } - (__pyx_v_cselfcorr[__pyx_t_16]) = ((__pyx_v_cselfcorr[__pyx_t_16]) / (__pyx_v_cselfctr[__pyx_v_i])); - - /* "src/helpers/correl.pyx":250 - * else: - * print 'tot too sparse' - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * cselfcorr[i] /= cselfctr[i] - * else: - */ - goto __pyx_L21; + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state); - /* "src/helpers/correl.pyx":253 - * cselfcorr[i] /= cselfctr[i] - * else: - * print 'self too sparse' # <<<<<<<<<<<<<< - * - * for i in range(maxdt*nshells): - */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_self_too_sparse) < 0) __PYX_ERR(0, 253, __pyx_L1_error) + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } - __pyx_L21:; } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":255 - * print 'self too sparse' - * - * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] - * ccrossctr[i] = cctr[i] - cselfctr[i] - */ - __pyx_t_15 = (__pyx_v_maxdt * __pyx_v_nshells); - __pyx_t_14 = __pyx_t_15; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_14; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "src/helpers/correl.pyx":256 - * - * for i in range(maxdt*nshells): - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] # <<<<<<<<<<<<<< - * ccrossctr[i] = cctr[i] - cselfctr[i] - * - */ - (__pyx_v_ccrosscorr[__pyx_v_i]) = ((__pyx_v_ccorr[__pyx_v_i]) - (__pyx_v_cselfcorr[__pyx_v_i])); - - /* "src/helpers/correl.pyx":257 - * for i in range(maxdt*nshells): - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] - * ccrossctr[i] = cctr[i] - cselfctr[i] # <<<<<<<<<<<<<< - * - * return corr,selfcorr,crosscorr - */ - (__pyx_v_ccrossctr[__pyx_v_i]) = ((__pyx_v_cctr[__pyx_v_i]) - (__pyx_v_cselfctr[__pyx_v_i])); - } +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/helpers/correl.pyx":259 - * ccrossctr[i] = cctr[i] - cselfctr[i] - * - * return corr,selfcorr,crosscorr # <<<<<<<<<<<<<< - * - * # @cython.boundscheck(False) + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_corr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_corr)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_corr)); - __Pyx_INCREF(((PyObject *)__pyx_v_selfcorr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_selfcorr)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_selfcorr)); - __Pyx_INCREF(((PyObject *)__pyx_v_crosscorr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_crosscorr)); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_crosscorr)); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":198 - * - * @cython.boundscheck(False) - * def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.sparsefullcorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_contdata); - __Pyx_XDECREF((PyObject *)__pyx_v_contds); - __Pyx_XDECREF(__pyx_v_pcorr); - __Pyx_XDECREF(__pyx_v_pselfcorr); - __Pyx_XDECREF(__pyx_v_pcrosscorr); - __Pyx_XDECREF((PyObject *)__pyx_v_corr); - __Pyx_XDECREF((PyObject *)__pyx_v_selfcorr); - __Pyx_XDECREF((PyObject *)__pyx_v_crosscorr); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); - __Pyx_XDECREF((PyObject *)__pyx_v_selfctr); - __Pyx_XDECREF((PyObject *)__pyx_v_crossctr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":327 +/* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo * - * @cython.boundscheck(False) - * def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_11sparsefullnobulkcorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_11sparsefullnobulkcorrelate = {"sparsefullnobulkcorrelate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_11sparsefullnobulkcorrelate, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_11sparsefullnobulkcorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_pdata = 0; - int __pyx_v_pcorrdim; - PyArrayObject *__pyx_v_pds = 0; - int __pyx_v_pnshells; - PyObject *__pyx_v_maxlen = 0; +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sparsefullnobulkcorrelate (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 349, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_pcorrdim,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,0}; - PyObject* values[5] = {0,0,0,0,0}; - - /* "src/helpers/correl.pyx":331 - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, - * maxlen=None,): # <<<<<<<<<<<<<< - * - * cdef long corrdim = pcorrdim - */ - values[4] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pdata)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pcorrdim)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkcorrelate", 0, 4, 5, 1); __PYX_ERR(0, 327, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkcorrelate", 0, 4, 5, 2); __PYX_ERR(0, 327, __pyx_L3_error) + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pnshells)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkcorrelate", 0, 4, 5, 3); __PYX_ERR(0, 327, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 349, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 4: + case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[4] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype_is_object); + if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sparsefullnobulkcorrelate") < 0)) __PYX_ERR(0, 327, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 349, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } - __pyx_v_pdata = ((PyArrayObject *)values[0]); - __pyx_v_pcorrdim = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_pcorrdim == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 328, __pyx_L3_error) - __pyx_v_pds = ((PyArrayObject *)values[2]); - __pyx_v_pnshells = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 330, __pyx_L3_error) - __pyx_v_maxlen = values[4]; + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); + } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkcorrelate", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 327, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 349, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkcorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 327, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 329, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_10sparsefullnobulkcorrelate(__pyx_self, __pyx_v_pdata, __pyx_v_pcorrdim, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen); - - /* "src/helpers/correl.pyx":327 - * - * @cython.boundscheck(False) - * def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, - */ + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_10sparsefullnobulkcorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen) { - long __pyx_v_corrdim; - long __pyx_v_nmol; - long __pyx_v_n; - long __pyx_v_nds; - long __pyx_v_maxdt; - long __pyx_v_nshells; - PyArrayObject *__pyx_v_contdata = 0; - PyArrayObject *__pyx_v_contds = 0; - double *__pyx_v_cdata; - int *__pyx_v_cds; - PyObject *__pyx_v_pcorr = NULL; - PyObject *__pyx_v_pselfcorr = NULL; - PyObject *__pyx_v_pcrosscorr = NULL; - PyArrayObject *__pyx_v_corr = 0; - PyArrayObject *__pyx_v_selfcorr = 0; - PyArrayObject *__pyx_v_crosscorr = 0; - PyArrayObject *__pyx_v_ctr = 0; - PyArrayObject *__pyx_v_selfctr = 0; - PyArrayObject *__pyx_v_crossctr = 0; - double *__pyx_v_ccorr; - double *__pyx_v_cselfcorr; - double *__pyx_v_ccrosscorr; - double *__pyx_v_cctr; - double *__pyx_v_cselfctr; - double *__pyx_v_ccrossctr; - double __pyx_v_value; - long __pyx_v_i; - long __pyx_v_start; - long __pyx_v_dt; - long __pyx_v_mol; - long __pyx_v_shellstart; - long __pyx_v_shelldt; - long __pyx_v_idx; - long __pyx_v_dim; - long __pyx_v_validx; - long __pyx_v_dsidx; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; - __Pyx_Buffer __pyx_pybuffer_contdata; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; - __Pyx_Buffer __pyx_pybuffer_contds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; - __Pyx_Buffer __pyx_pybuffer_corr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_crosscorr; - __Pyx_Buffer __pyx_pybuffer_crosscorr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_crossctr; - __Pyx_Buffer __pyx_pybuffer_crossctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; - __Pyx_Buffer __pyx_pybuffer_pdata; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; - __Pyx_Buffer __pyx_pybuffer_pds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_selfcorr; - __Pyx_Buffer __pyx_pybuffer_selfcorr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_selfctr; - __Pyx_Buffer __pyx_pybuffer_selfctr; - PyObject *__pyx_r = NULL; +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - long __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyArrayObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - PyArrayObject *__pyx_t_13 = NULL; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - long __pyx_t_18; - long __pyx_t_19; - long __pyx_t_20; - long __pyx_t_21; - long __pyx_t_22; - long __pyx_t_23; - long __pyx_t_24; - long __pyx_t_25; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sparsefullnobulkcorrelate", 0); - __pyx_pybuffer_contdata.pybuffer.buf = NULL; - __pyx_pybuffer_contdata.refcount = 0; - __pyx_pybuffernd_contdata.data = NULL; - __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; - __pyx_pybuffer_contds.pybuffer.buf = NULL; - __pyx_pybuffer_contds.refcount = 0; - __pyx_pybuffernd_contds.data = NULL; - __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; - __pyx_pybuffer_corr.pybuffer.buf = NULL; - __pyx_pybuffer_corr.refcount = 0; - __pyx_pybuffernd_corr.data = NULL; - __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; - __pyx_pybuffer_selfcorr.pybuffer.buf = NULL; - __pyx_pybuffer_selfcorr.refcount = 0; - __pyx_pybuffernd_selfcorr.data = NULL; - __pyx_pybuffernd_selfcorr.rcbuffer = &__pyx_pybuffer_selfcorr; - __pyx_pybuffer_crosscorr.pybuffer.buf = NULL; - __pyx_pybuffer_crosscorr.refcount = 0; - __pyx_pybuffernd_crosscorr.data = NULL; - __pyx_pybuffernd_crosscorr.rcbuffer = &__pyx_pybuffer_crosscorr; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_selfctr.pybuffer.buf = NULL; - __pyx_pybuffer_selfctr.refcount = 0; - __pyx_pybuffernd_selfctr.data = NULL; - __pyx_pybuffernd_selfctr.rcbuffer = &__pyx_pybuffer_selfctr; - __pyx_pybuffer_crossctr.pybuffer.buf = NULL; - __pyx_pybuffer_crossctr.refcount = 0; - __pyx_pybuffernd_crossctr.data = NULL; - __pyx_pybuffernd_crossctr.rcbuffer = &__pyx_pybuffer_crossctr; - __pyx_pybuffer_pdata.pybuffer.buf = NULL; - __pyx_pybuffer_pdata.refcount = 0; - __pyx_pybuffernd_pdata.data = NULL; - __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; - __pyx_pybuffer_pds.pybuffer.buf = NULL; - __pyx_pybuffer_pds.refcount = 0; - __pyx_pybuffernd_pds.data = NULL; - __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 327, __pyx_L1_error) - } - __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 327, __pyx_L1_error) - } - __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "src/helpers/correl.pyx":333 - * maxlen=None,): + /* "View.MemoryView":350 * - * cdef long corrdim = pcorrdim # <<<<<<<<<<<<<< - * cdef long nmol = len(pdata)/pcorrdim # number of molecules - * cdef long n = len(pdata[0]) # number of time steps + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: */ - __pyx_v_corrdim = ((long)__pyx_v_pcorrdim); + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; - /* "src/helpers/correl.pyx":334 - * - * cdef long corrdim = pcorrdim - * cdef long nmol = len(pdata)/pcorrdim # number of molecules # <<<<<<<<<<<<<< - * cdef long n = len(pdata[0]) # number of time steps - * cdef long nds = len(pds[0]) # number of steps in delaunay array + /* "View.MemoryView":351 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 334, __pyx_L1_error) - __pyx_t_2 = ((long)__pyx_t_1); - if (unlikely(__pyx_v_pcorrdim == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 334, __pyx_L1_error) - } - else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_pcorrdim == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 334, __pyx_L1_error) - } - __pyx_v_nmol = __Pyx_div_long(__pyx_t_2, __pyx_v_pcorrdim); + __pyx_v_self->flags = __pyx_v_flags; - /* "src/helpers/correl.pyx":335 - * cdef long corrdim = pcorrdim - * cdef long nmol = len(pdata)/pcorrdim # number of molecules - * cdef long n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< - * cdef long nds = len(pds[0]) # number of steps in delaunay array - * cdef long maxdt = n + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_n = ((long)__pyx_t_1); + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":336 - * cdef long nmol = len(pdata)/pcorrdim # number of molecules - * cdef long n = len(pdata[0]) # number of time steps - * cdef long nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< - * cdef long maxdt = n - * cdef long nshells = pnshells + /* "View.MemoryView":353 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None */ - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 336, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_nds = ((long)__pyx_t_1); + __pyx_t_3 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 353, __pyx_L1_error) - /* "src/helpers/correl.pyx":337 - * cdef long n = len(pdata[0]) # number of time steps - * cdef long nds = len(pds[0]) # number of steps in delaunay array - * cdef long maxdt = n # <<<<<<<<<<<<<< - * cdef long nshells = pnshells - * if maxlen != None: + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) */ - __pyx_v_maxdt = ((long)__pyx_v_n); + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":338 - * cdef long nds = len(pds[0]) # number of steps in delaunay array - * cdef long maxdt = n - * cdef long nshells = pnshells # <<<<<<<<<<<<<< - * if maxlen != None: - * maxdt = maxlen + /* "View.MemoryView":355 + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * */ - __pyx_v_nshells = ((long)__pyx_v_pnshells); + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - /* "src/helpers/correl.pyx":339 - * cdef long maxdt = n - * cdef long nshells = pnshells - * if maxlen != None: # <<<<<<<<<<<<<< - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + /* "View.MemoryView":356 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { + Py_INCREF(Py_None); - /* "src/helpers/correl.pyx":340 - * cdef long nshells = pnshells - * if maxlen != None: - * maxdt = maxlen # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) */ - __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_v_maxlen); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 340, __pyx_L1_error) - __pyx_v_maxdt = __pyx_t_2; + } - /* "src/helpers/correl.pyx":339 - * cdef long maxdt = n - * cdef long nshells = pnshells - * if maxlen != None: # <<<<<<<<<<<<<< - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ } - /* "src/helpers/correl.pyx":341 - * if maxlen != None: - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data + /* "View.MemoryView":358 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, ((PyObject *)__pyx_v_pdata)) : __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_pdata)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 341, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_3); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 341, __pyx_L1_error) - } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_7 = 0; - __pyx_v_contdata = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":342 - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + */ + __pyx_t_1 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_1) { + + /* "View.MemoryView":361 + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + */ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":362 + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + */ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, ((PyObject *)__pyx_v_pds)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_pds)); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 342, __pyx_L1_error) - __pyx_t_8 = ((PyArrayObject *)__pyx_t_3); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 342, __pyx_L1_error) - } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; } - } - __pyx_t_8 = 0; - __pyx_v_contds = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; - /* "src/helpers/correl.pyx":343 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: */ - __pyx_v_cdata = ((double *)__pyx_v_contdata->data); + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":344 - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data # <<<<<<<<<<<<<< - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":364 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError */ - __pyx_v_cds = ((int *)__pyx_v_contds->data); + __pyx_v_self->lock = PyThread_allocate_lock(); - /* "src/helpers/correl.pyx":345 - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6); - __pyx_t_3 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_pcorr = __pyx_t_10; - __pyx_t_10 = 0; + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/correl.pyx":346 - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + /* "View.MemoryView":366 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_10 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_pselfcorr = __pyx_t_3; - __pyx_t_3 = 0; + PyErr_NoMemory(); __PYX_ERR(1, 366, __pyx_L1_error) - /* "src/helpers/correl.pyx":347 - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6); - __pyx_t_3 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 347, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_pcrosscorr = __pyx_t_10; - __pyx_t_10 = 0; + } - /* "src/helpers/correl.pyx":348 - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: */ - if (!(likely(((__pyx_v_pcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 348, __pyx_L1_error) - __pyx_t_10 = __pyx_v_pcorr; - __Pyx_INCREF(__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_10), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 348, __pyx_L1_error) - } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; } + + /* "View.MemoryView":358 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + */ } - __pyx_v_corr = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; - /* "src/helpers/correl.pyx":349 - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":368 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: */ - if (!(likely(((__pyx_v_pselfcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pselfcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 349, __pyx_L1_error) - __pyx_t_10 = __pyx_v_pselfcorr; - __Pyx_INCREF(__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_10), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_selfcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 349, __pyx_L1_error) - } else {__pyx_pybuffernd_selfcorr.diminfo[0].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfcorr.diminfo[0].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfcorr.diminfo[1].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfcorr.diminfo[1].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_v_selfcorr = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":350 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":369 + * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object */ - if (!(likely(((__pyx_v_pcrosscorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcrosscorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 350, __pyx_L1_error) - __pyx_t_10 = __pyx_v_pcrosscorr; - __Pyx_INCREF(__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_10), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_crosscorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 350, __pyx_L1_error) - } else {__pyx_pybuffernd_crosscorr.diminfo[0].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crosscorr.diminfo[0].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crosscorr.diminfo[1].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crosscorr.diminfo[1].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[1]; + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L12_bool_binop_done; } - } - __pyx_v_crosscorr = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L12_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; - /* "src/helpers/correl.pyx":351 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":368 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_10 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 351, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_3); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 351, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; - } + goto __pyx_L11; } - __pyx_t_11 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; - /* "src/helpers/correl.pyx":352 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data + /* "View.MemoryView":371 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6); - __pyx_t_3 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 352, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_10); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_selfctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 352, __pyx_L1_error) - } else {__pyx_pybuffernd_selfctr.diminfo[0].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfctr.diminfo[0].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfctr.diminfo[1].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfctr.diminfo[1].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[1]; - } + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; } - __pyx_t_12 = 0; - __pyx_v_selfctr = ((PyArrayObject *)__pyx_t_10); - __pyx_t_10 = 0; + __pyx_L11:; - /* "src/helpers/correl.pyx":353 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data + /* "View.MemoryView":373 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL + * */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_10 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 353, __pyx_L1_error) - __pyx_t_13 = ((PyArrayObject *)__pyx_t_3); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_crossctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 353, __pyx_L1_error) - } else {__pyx_pybuffernd_crossctr.diminfo[0].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crossctr.diminfo[0].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crossctr.diminfo[1].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crossctr.diminfo[1].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[1]; + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 373, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 373, __pyx_L1_error) } } - __pyx_t_13 = 0; - __pyx_v_crossctr = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; + #else + if ((1)); else __PYX_ERR(1, 373, __pyx_L1_error) + #endif - /* "src/helpers/correl.pyx":354 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data + /* "View.MemoryView":374 + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(memoryview self): */ - __pyx_v_ccorr = ((double *)__pyx_v_corr->data); + __pyx_v_self->typeinfo = NULL; - /* "src/helpers/correl.pyx":355 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data # <<<<<<<<<<<<<< - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data + /* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ - __pyx_v_cselfcorr = ((double *)__pyx_v_selfcorr->data); - /* "src/helpers/correl.pyx":356 - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data # <<<<<<<<<<<<<< - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data - */ - __pyx_v_ccrosscorr = ((double *)__pyx_v_crosscorr->data); + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":357 - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< - * cdef double *cselfctr = selfctr.data - * cdef double *ccrossctr = crossctr.data +/* "View.MemoryView":376 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ - __pyx_v_cctr = ((double *)__pyx_v_ctr->data); - /* "src/helpers/correl.pyx":358 - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data # <<<<<<<<<<<<<< - * cdef double *ccrossctr = crossctr.data - * cdef double value +/* Python wrapper */ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "View.MemoryView":377 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - __pyx_v_cselfctr = ((double *)__pyx_v_selfctr->data); + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":359 - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data - * cdef double *ccrossctr = crossctr.data # <<<<<<<<<<<<<< - * cdef double value - * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx + /* "View.MemoryView":378 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * */ - __pyx_v_ccrossctr = ((double *)__pyx_v_crossctr->data); + __Pyx_ReleaseBuffer((&__pyx_v_self->view)); - /* "src/helpers/correl.pyx":363 - * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx + /* "View.MemoryView":377 * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_2 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_15 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_15 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_4) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dim) lastprivate(__pyx_v_dsidx) firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_validx) lastprivate(__pyx_v_value) - #endif /* _OPENMP */ - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){ - { - __pyx_v_dt = (long)(0 + 1 * __pyx_t_14); - /* Initialize private variables to invalid values */ - __pyx_v_dim = ((long)0xbad0bad0); - __pyx_v_dsidx = ((long)0xbad0bad0); - __pyx_v_idx = ((long)0xbad0bad0); - __pyx_v_mol = ((long)0xbad0bad0); - __pyx_v_shelldt = ((long)0xbad0bad0); - __pyx_v_shellstart = ((long)0xbad0bad0); - __pyx_v_start = ((long)0xbad0bad0); - __pyx_v_validx = ((long)0xbad0bad0); - __pyx_v_value = ((double)__PYX_NAN()); + goto __pyx_L3; + } - /* "src/helpers/correl.pyx":364 + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for start in range(n-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * dsidx = mol*nds+start + * (<__pyx_buffer *> &self.view).obj = NULL */ - __pyx_t_16 = (__pyx_v_n - __pyx_v_dt); - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_start = __pyx_t_18; + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":365 - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 + /* "View.MemoryView":381 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * */ - __pyx_t_19 = __pyx_v_nmol; - __pyx_t_20 = __pyx_t_19; - for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { - __pyx_v_mol = __pyx_t_21; + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; - /* "src/helpers/correl.pyx":366 - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * dsidx = mol*nds+start # <<<<<<<<<<<<<< - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: + /* "View.MemoryView":382 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i */ - __pyx_v_dsidx = ((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start); + Py_DECREF(Py_None); - /* "src/helpers/correl.pyx":367 - * for mol in range(nmol): # loop over molecules/entries - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 # <<<<<<<<<<<<<< - * if shellstart < nshells: - * shelldt = cds[dsidx+dt]-1 + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL */ - __pyx_v_shellstart = (((long)(__pyx_v_cds[__pyx_v_dsidx])) - 1); + } + __pyx_L3:; - /* "src/helpers/correl.pyx":368 - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: */ - __pyx_t_4 = ((__pyx_v_shellstart < __pyx_v_nshells) != 0); - if (__pyx_t_4) { + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":369 - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: - * shelldt = cds[dsidx+dt]-1 # <<<<<<<<<<<<<< - * for dim in range(corrdim): - * validx = mol*corrdim*n+dim*n+start + /* "View.MemoryView":387 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 */ - __pyx_v_shelldt = (((long)(__pyx_v_cds[(__pyx_v_dsidx + __pyx_v_dt)])) - 1); + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/correl.pyx":370 - * if shellstart < nshells: - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): # <<<<<<<<<<<<<< - * validx = mol*corrdim*n+dim*n+start - * value = cdata[validx]*cdata[validx+dt] + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: */ - __pyx_t_22 = __pyx_v_corrdim; - __pyx_t_23 = __pyx_t_22; - for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { - __pyx_v_dim = __pyx_t_24; + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":371 - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): - * validx = mol*corrdim*n+dim*n+start # <<<<<<<<<<<<<< - * value = cdata[validx]*cdata[validx+dt] - * idx = maxdt*shellstart+dt + /* "View.MemoryView":389 + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( */ - __pyx_v_validx = ((((__pyx_v_mol * __pyx_v_corrdim) * __pyx_v_n) + (__pyx_v_dim * __pyx_v_n)) + __pyx_v_start); + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); - /* "src/helpers/correl.pyx":372 - * for dim in range(corrdim): - * validx = mol*corrdim*n+dim*n+start - * value = cdata[validx]*cdata[validx+dt] # <<<<<<<<<<<<<< - * idx = maxdt*shellstart+dt - * ccorr[idx] += value + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) */ - __pyx_v_value = ((__pyx_v_cdata[__pyx_v_validx]) * (__pyx_v_cdata[(__pyx_v_validx + __pyx_v_dt)])); + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":373 - * validx = mol*corrdim*n+dim*n+start - * value = cdata[validx]*cdata[validx+dt] - * idx = maxdt*shellstart+dt # <<<<<<<<<<<<<< - * ccorr[idx] += value - * cctr[idx] += 1 + /* "View.MemoryView":392 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: */ - __pyx_v_idx = ((__pyx_v_maxdt * __pyx_v_shellstart) + __pyx_v_dt); + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); - /* "src/helpers/correl.pyx":374 - * value = cdata[validx]*cdata[validx+dt] - * idx = maxdt*shellstart+dt - * ccorr[idx] += value # <<<<<<<<<<<<<< - * cctr[idx] += 1 - * if shellstart == shelldt: + /* "View.MemoryView":391 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_ccorr[__pyx_t_25]) = ((__pyx_v_ccorr[__pyx_t_25]) + __pyx_v_value); + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; - /* "src/helpers/correl.pyx":375 - * idx = maxdt*shellstart+dt - * ccorr[idx] += value - * cctr[idx] += 1 # <<<<<<<<<<<<<< - * if shellstart == shelldt: - * cselfcorr[idx] += value + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_cctr[__pyx_t_25]) = ((__pyx_v_cctr[__pyx_t_25]) + 1.0); + } - /* "src/helpers/correl.pyx":376 - * ccorr[idx] += value - * cctr[idx] += 1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * cselfcorr[idx] += value - * cselfctr[idx] += 1 + /* "View.MemoryView":393 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) */ - __pyx_t_4 = ((__pyx_v_shellstart == __pyx_v_shelldt) != 0); - if (__pyx_t_4) { + goto __pyx_L6_break; - /* "src/helpers/correl.pyx":377 - * cctr[idx] += 1 - * if shellstart == shelldt: - * cselfcorr[idx] += value # <<<<<<<<<<<<<< - * cselfctr[idx] += 1 - * + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_cselfcorr[__pyx_t_25]) = ((__pyx_v_cselfcorr[__pyx_t_25]) + __pyx_v_value); + } + } + /*else*/ { - /* "src/helpers/correl.pyx":378 - * if shellstart == shelldt: - * cselfcorr[idx] += value - * cselfctr[idx] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":395 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< * - * for i in range(maxdt*nshells): + * cdef char *get_item_pointer(memoryview self, object index) except NULL: */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_cselfctr[__pyx_t_25]) = ((__pyx_v_cselfctr[__pyx_t_25]) + 1.0); - - /* "src/helpers/correl.pyx":376 - * ccorr[idx] += value - * cctr[idx] += 1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * cselfcorr[idx] += value - * cselfctr[idx] += 1 - */ - } - } - - /* "src/helpers/correl.pyx":368 - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): - */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; - /* "src/helpers/correl.pyx":363 - * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx - * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } } - /* "src/helpers/correl.pyx":380 - * cselfctr[idx] += 1 - * - * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] - */ - __pyx_t_15 = (__pyx_v_maxdt * __pyx_v_nshells); - __pyx_t_14 = __pyx_t_15; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_14; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "src/helpers/correl.pyx":381 + /* "View.MemoryView":376 + * self.typeinfo = NULL * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ - __pyx_t_4 = (((__pyx_v_cctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_4) { - /* "src/helpers/correl.pyx":382 - * for i in range(maxdt*nshells): - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< - * else: - * print 'tot too sparse' - */ - __pyx_t_16 = __pyx_v_i; - if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 382, __pyx_L1_error) - } - (__pyx_v_ccorr[__pyx_t_16]) = ((__pyx_v_ccorr[__pyx_t_16]) / (__pyx_v_cctr[__pyx_v_i])); + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} - /* "src/helpers/correl.pyx":381 +/* "View.MemoryView":397 + * PyThread_free_lock(self.lock) * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf */ - goto __pyx_L23; - } - /* "src/helpers/correl.pyx":384 - * ccorr[i] /= cctr[i] - * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< - * if cctr[i] != 0: - * cselfcorr[i] /= cselfctr[i] - */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 384, __pyx_L1_error) - } - __pyx_L23:; +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); - /* "src/helpers/correl.pyx":385 - * else: - * print 'tot too sparse' - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * cselfcorr[i] /= cselfctr[i] - * else: + /* "View.MemoryView":399 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + * + * for dim, idx in enumerate(index): */ - __pyx_t_4 = (((__pyx_v_cctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_4) { + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - /* "src/helpers/correl.pyx":386 - * print 'tot too sparse' - * if cctr[i] != 0: - * cselfcorr[i] /= cselfctr[i] # <<<<<<<<<<<<<< - * else: - * print 'self too sparse' + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * */ - __pyx_t_16 = __pyx_v_i; - if (unlikely((__pyx_v_cselfctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 386, __pyx_L1_error) + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 401, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif } - (__pyx_v_cselfcorr[__pyx_t_16]) = ((__pyx_v_cselfcorr[__pyx_t_16]) / (__pyx_v_cselfctr[__pyx_v_i])); - - /* "src/helpers/correl.pyx":385 - * else: - * print 'tot too sparse' - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * cselfcorr[i] /= cselfctr[i] - * else: - */ - goto __pyx_L24; + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 401, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_5); } + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); - /* "src/helpers/correl.pyx":388 - * cselfcorr[i] /= cselfctr[i] - * else: - * print 'self too sparse' # <<<<<<<<<<<<<< + /* "View.MemoryView":402 * - * for i in range(maxdt*nshells): - */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_self_too_sparse) < 0) __PYX_ERR(0, 388, __pyx_L1_error) - } - __pyx_L24:; - } - - /* "src/helpers/correl.pyx":390 - * print 'self too sparse' + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< * - * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] - * ccrossctr[i] = cctr[i] - cselfctr[i] + * return itemp */ - __pyx_t_15 = (__pyx_v_maxdt * __pyx_v_nshells); - __pyx_t_14 = __pyx_t_15; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_14; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; - /* "src/helpers/correl.pyx":391 - * - * for i in range(maxdt*nshells): - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] # <<<<<<<<<<<<<< - * ccrossctr[i] = cctr[i] - cselfctr[i] + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf * - */ - (__pyx_v_ccrosscorr[__pyx_v_i]) = ((__pyx_v_ccorr[__pyx_v_i]) - (__pyx_v_cselfcorr[__pyx_v_i])); - - /* "src/helpers/correl.pyx":392 - * for i in range(maxdt*nshells): - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] - * ccrossctr[i] = cctr[i] - cselfctr[i] # <<<<<<<<<<<<<< + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * - * return corr,selfcorr,crosscorr */ - (__pyx_v_ccrossctr[__pyx_v_i]) = ((__pyx_v_cctr[__pyx_v_i]) - (__pyx_v_cselfctr[__pyx_v_i])); } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":394 - * ccrossctr[i] = cctr[i] - cselfctr[i] + /* "View.MemoryView":404 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< * - * return corr,selfcorr,crosscorr # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_corr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_corr)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_corr)); - __Pyx_INCREF(((PyObject *)__pyx_v_selfcorr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_selfcorr)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_selfcorr)); - __Pyx_INCREF(((PyObject *)__pyx_v_crosscorr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_crosscorr)); - PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_crosscorr)); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_r = __pyx_v_itemp; goto __pyx_L0; - /* "src/helpers/correl.pyx":327 + /* "View.MemoryView":397 + * PyThread_free_lock(self.lock) * - * @cython.boundscheck(False) - * def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkcorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_contdata); - __Pyx_XDECREF((PyObject *)__pyx_v_contds); - __Pyx_XDECREF(__pyx_v_pcorr); - __Pyx_XDECREF(__pyx_v_pselfcorr); - __Pyx_XDECREF(__pyx_v_pcrosscorr); - __Pyx_XDECREF((PyObject *)__pyx_v_corr); - __Pyx_XDECREF((PyObject *)__pyx_v_selfcorr); - __Pyx_XDECREF((PyObject *)__pyx_v_crosscorr); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); - __Pyx_XDECREF((PyObject *)__pyx_v_selfctr); - __Pyx_XDECREF((PyObject *)__pyx_v_crossctr); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_idx); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":397 +/* "View.MemoryView":407 * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_13rotationMatrixShellCorrelateDist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_13rotationMatrixShellCorrelateDist = {"rotationMatrixShellCorrelateDist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_13rotationMatrixShellCorrelateDist, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_13rotationMatrixShellCorrelateDist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_v_nshells; - long __pyx_v_maxdt; - long __pyx_v_startingpoints; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateDist (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds,&__pyx_n_s_nshells,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rotTs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateDist", 1, 5, 5, 1); __PYX_ERR(0, 397, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateDist", 1, 5, 5, 2); __PYX_ERR(0, 397, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxdt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateDist", 1, 5, 5, 3); __PYX_ERR(0, 397, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startingpoints)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateDist", 1, 5, 5, 4); __PYX_ERR(0, 397, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotationMatrixShellCorrelateDist") < 0)) __PYX_ERR(0, 397, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - } - __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 397, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 397, __pyx_L3_error) - __pyx_v_nshells = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_nshells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 397, __pyx_L3_error) - __pyx_v_maxdt = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 397, __pyx_L3_error) - __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 397, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateDist", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 397, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateDist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_6correl_12rotationMatrixShellCorrelateDist(__pyx_self, __pyx_v_rotTs, __pyx_v_ds, __pyx_v_nshells, __pyx_v_maxdt, __pyx_v_startingpoints); + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_12rotationMatrixShellCorrelateDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints) { - long __pyx_v_nmol; - long __pyx_v_n; - long __pyx_v_startskip; - __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_t1; - double __pyx_v_t2; - double __pyx_v_t3; - double __pyx_v_t4; - double __pyx_v_t5; - double __pyx_v_t6; - long __pyx_v_i; - long __pyx_v_j; - long __pyx_v_k; - long __pyx_v_start; - long __pyx_v_point; - long __pyx_v_dt; - long __pyx_v_mol; - long __pyx_v_shellstart; - long __pyx_v_l; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_3; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_11; - long __pyx_t_12; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - long __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - int __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - Py_ssize_t __pyx_t_31; - Py_ssize_t __pyx_t_32; - Py_ssize_t __pyx_t_33; - Py_ssize_t __pyx_t_34; - Py_ssize_t __pyx_t_35; - Py_ssize_t __pyx_t_36; - Py_ssize_t __pyx_t_37; - Py_ssize_t __pyx_t_38; - Py_ssize_t __pyx_t_39; - Py_ssize_t __pyx_t_40; - Py_ssize_t __pyx_t_41; - Py_ssize_t __pyx_t_42; - Py_ssize_t __pyx_t_43; + char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateDist", 0); + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "src/helpers/correl.pyx":398 - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< - * cdef long n = len(rotTs[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array + /* "View.MemoryView":408 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); - __pyx_v_nmol = ((long)__pyx_t_1); + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":399 - * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints + /* "View.MemoryView":409 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) */ - __pyx_t_2.data = __pyx_v_rotTs.data; - __pyx_t_2.memview = __pyx_v_rotTs.memview; - __PYX_INC_MEMVIEW(&__pyx_t_2, 0); - { - Py_ssize_t __pyx_tmp_idx = 0; - Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; -__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; - __pyx_t_2.suboffsets[0] = -1; - -__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; -__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; - __pyx_t_2.suboffsets[1] = -1; - -__pyx_t_2.shape[2] = __pyx_v_rotTs.shape[3]; -__pyx_t_2.strides[2] = __pyx_v_rotTs.strides[3]; - __pyx_t_2.suboffsets[2] = -1; - -__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - __pyx_v_n = ((long)__pyx_t_1); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; - /* "src/helpers/correl.pyx":401 - * cdef long n = len(rotTs[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints # <<<<<<<<<<<<<< - * cdef double [:,:,:,:] corr = np.zeros((6,nshells,maxdt,20)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) + /* "View.MemoryView":408 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * */ - __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); - if (unlikely(__pyx_v_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 401, __pyx_L1_error) } - else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 401, __pyx_L1_error) - } - __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - /* "src/helpers/correl.pyx":402 - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:,:] corr = np.zeros((6,nshells,maxdt,20)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) - * cdef double t1,t2,t3,t4,t5,t6 + /* "View.MemoryView":411 + * return self + * + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 402, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 402, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 402, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 402, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 402, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_int_6); - __Pyx_GIVEREF(__pyx_int_6); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __Pyx_INCREF(__pyx_int_20); - __Pyx_GIVEREF(__pyx_int_20); - PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_int_20); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 411, __pyx_L1_error) } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 411, __pyx_L1_error) } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 402, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 402, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_corr = __pyx_t_9; - __pyx_t_9.memview = NULL; - __pyx_t_9.data = NULL; + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; - /* "src/helpers/correl.pyx":403 - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:,:] corr = np.zeros((6,nshells,maxdt,20)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # <<<<<<<<<<<<<< - * cdef double t1,t2,t3,t4,t5,t6 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* "View.MemoryView":414 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 403, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 403, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 403, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 403, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 403, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 403, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 403, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ctr = __pyx_t_10; - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 414, __pyx_L1_error) + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":407 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt - * - * for dt in prange(maxdt,nogil=True, schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + /* "View.MemoryView":415 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_3 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_12 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33, __pyx_t_34, __pyx_t_35, __pyx_t_36, __pyx_t_37, __pyx_t_38, __pyx_t_39, __pyx_t_40, __pyx_t_41, __pyx_t_42, __pyx_t_43) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_t1) lastprivate(__pyx_v_t2) lastprivate(__pyx_v_t3) lastprivate(__pyx_v_t4) lastprivate(__pyx_v_t5) lastprivate(__pyx_v_t6) - #endif /* _OPENMP */ - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){ - { - __pyx_v_dt = (long)(0 + 1 * __pyx_t_11); - /* Initialize private variables to invalid values */ - __pyx_v_mol = ((long)0xbad0bad0); - __pyx_v_point = ((long)0xbad0bad0); - __pyx_v_shellstart = ((long)0xbad0bad0); - __pyx_v_start = ((long)0xbad0bad0); - __pyx_v_t1 = ((double)__PYX_NAN()); - __pyx_v_t2 = ((double)__PYX_NAN()); - __pyx_v_t3 = ((double)__PYX_NAN()); - __pyx_v_t4 = ((double)__PYX_NAN()); - __pyx_v_t5 = ((double)__PYX_NAN()); - __pyx_v_t6 = ((double)__PYX_NAN()); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":408 + /* "View.MemoryView":414 * - * for dt in prange(maxdt,nogil=True, schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: */ - __pyx_t_13 = __pyx_v_startingpoints; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_point = __pyx_t_15; + } - /* "src/helpers/correl.pyx":409 - * for dt in prange(maxdt,nogil=True, schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * start = point*startskip - * shellstart = ds[mol,start]-1 + /* "View.MemoryView":417 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) + * */ - __pyx_t_16 = __pyx_v_nmol; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_mol = __pyx_t_18; + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((char *)NULL))) __PYX_ERR(1, 417, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; - /* "src/helpers/correl.pyx":410 - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip # <<<<<<<<<<<<<< - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: + /* "View.MemoryView":418 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * + * def __setitem__(memoryview self, object index, object value): */ - __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } - /* "src/helpers/correl.pyx":411 - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip - * shellstart = ds[mol,start]-1 # <<<<<<<<<<<<<< - * if shellstart < nshells: + /* "View.MemoryView":407 + * * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ - __pyx_t_19 = __pyx_v_mol; - __pyx_t_20 = __pyx_v_start; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds.shape[1]; - __pyx_v_shellstart = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_19 * __pyx_v_ds.strides[0]) ) + __pyx_t_20 * __pyx_v_ds.strides[1]) ))) - 1); - /* "src/helpers/correl.pyx":412 - * start = point*startskip - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) * - * ctr[shellstart,dt] += 1 + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ - __pyx_t_21 = ((__pyx_v_shellstart < __pyx_v_nshells) != 0); - if (__pyx_t_21) { - /* "src/helpers/correl.pyx":414 - * if shellstart < nshells: +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); + + /* "View.MemoryView":421 * - * ctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * - * t1 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,0,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,0,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,0,2])+1.0)*9.99999999999 */ - __pyx_t_20 = __pyx_v_shellstart; - __pyx_t_19 = __pyx_v_dt; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) )) += 1.0; + if (unlikely(__pyx_v_self->view.readonly)) { - /* "src/helpers/correl.pyx":416 - * ctr[shellstart,dt] += 1 + /* "View.MemoryView":422 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< * - * t1 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,0,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,0,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,0,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< - * t2 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 - * t3 = ((rotTs[mol,start,2,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,2,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,2,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_t_19 = __pyx_v_mol; - __pyx_t_20 = __pyx_v_start; - __pyx_t_22 = 0; - __pyx_t_23 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[3]; - __pyx_t_24 = __pyx_v_mol; - __pyx_t_25 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_26 = 0; - __pyx_t_27 = 0; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[3]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_30 = 0; - __pyx_t_31 = 1; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; - __pyx_t_32 = __pyx_v_mol; - __pyx_t_33 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_34 = 0; - __pyx_t_35 = 1; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; - __pyx_t_36 = __pyx_v_mol; - __pyx_t_37 = __pyx_v_start; - __pyx_t_38 = 0; - __pyx_t_39 = 2; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[3]; - __pyx_t_40 = __pyx_v_mol; - __pyx_t_41 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_42 = 0; - __pyx_t_43 = 2; - if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[3]; - __pyx_v_t1 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_22 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_24 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_25 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_27 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_28 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_40 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_41 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_43 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 422, __pyx_L1_error) - /* "src/helpers/correl.pyx":417 + /* "View.MemoryView":421 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * - * t1 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,0,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,0,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,0,2])+1.0)*9.99999999999 - * t2 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< - * t3 = ((rotTs[mol,start,2,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,2,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,2,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 - * t4 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 */ - __pyx_t_43 = __pyx_v_mol; - __pyx_t_42 = __pyx_v_start; - __pyx_t_41 = 1; - __pyx_t_40 = 0; - if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[3]; - __pyx_t_39 = __pyx_v_mol; - __pyx_t_38 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_37 = 1; - __pyx_t_36 = 0; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; - __pyx_t_35 = __pyx_v_mol; - __pyx_t_34 = __pyx_v_start; - __pyx_t_33 = 1; - __pyx_t_32 = 1; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; - __pyx_t_31 = __pyx_v_mol; - __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_29 = 1; - __pyx_t_28 = 1; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[3]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_26 = __pyx_v_start; - __pyx_t_25 = 1; - __pyx_t_24 = 2; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[3]; - __pyx_t_23 = __pyx_v_mol; - __pyx_t_22 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_20 = 1; - __pyx_t_19 = 2; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; - __pyx_v_t2 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_43 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_41 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_40 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_39 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_27 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_25 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_24 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_23 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_22 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); + } - /* "src/helpers/correl.pyx":418 - * t1 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,0,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,0,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,0,2])+1.0)*9.99999999999 - * t2 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 - * t3 = ((rotTs[mol,start,2,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,2,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,2,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< - * t4 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 - * t5 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + /* "View.MemoryView":424 + * raise TypeError, "Cannot assign to read-only memoryview" + * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: */ - __pyx_t_19 = __pyx_v_mol; - __pyx_t_20 = __pyx_v_start; - __pyx_t_22 = 2; - __pyx_t_23 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[3]; - __pyx_t_24 = __pyx_v_mol; - __pyx_t_25 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_26 = 2; - __pyx_t_27 = 0; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[3]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_30 = 2; - __pyx_t_31 = 1; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; - __pyx_t_32 = __pyx_v_mol; - __pyx_t_33 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_34 = 2; - __pyx_t_35 = 1; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; - __pyx_t_36 = __pyx_v_mol; - __pyx_t_37 = __pyx_v_start; - __pyx_t_38 = 2; - __pyx_t_39 = 2; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[3]; - __pyx_t_40 = __pyx_v_mol; - __pyx_t_41 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_42 = 2; - __pyx_t_43 = 2; - if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[3]; - __pyx_v_t3 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_22 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_24 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_25 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_27 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_28 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_40 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_41 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_43 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 424, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 424, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/correl.pyx":419 - * t2 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 - * t3 = ((rotTs[mol,start,2,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,2,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,2,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 - * t4 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< - * t5 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 - * t6 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ - __pyx_t_43 = __pyx_v_mol; - __pyx_t_42 = __pyx_v_start; - __pyx_t_41 = 0; - __pyx_t_40 = 0; - if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[3]; - __pyx_t_39 = __pyx_v_mol; - __pyx_t_38 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_37 = 1; - __pyx_t_36 = 0; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; - __pyx_t_35 = __pyx_v_mol; - __pyx_t_34 = __pyx_v_start; - __pyx_t_33 = 0; - __pyx_t_32 = 1; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; - __pyx_t_31 = __pyx_v_mol; - __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_29 = 1; - __pyx_t_28 = 1; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[3]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_26 = __pyx_v_start; - __pyx_t_25 = 0; - __pyx_t_24 = 2; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[3]; - __pyx_t_23 = __pyx_v_mol; - __pyx_t_22 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_20 = 1; - __pyx_t_19 = 2; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; - __pyx_v_t4 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_43 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_41 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_40 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_39 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_27 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_25 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_24 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_23 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_22 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 426, __pyx_L1_error) + if (__pyx_t_4) { - /* "src/helpers/correl.pyx":420 - * t3 = ((rotTs[mol,start,2,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,2,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,2,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 - * t4 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 - * t5 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< - * t6 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 - * corr[0,shellstart,dt, t1] += 1.0 # l=1 + /* "View.MemoryView":427 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj: + * self.setitem_slice_assignment(self[index], obj) */ - __pyx_t_19 = __pyx_v_mol; - __pyx_t_20 = __pyx_v_start; - __pyx_t_22 = 0; - __pyx_t_23 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[3]; - __pyx_t_24 = __pyx_v_mol; - __pyx_t_25 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_26 = 2; - __pyx_t_27 = 0; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[3]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_30 = 0; - __pyx_t_31 = 1; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; - __pyx_t_32 = __pyx_v_mol; - __pyx_t_33 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_34 = 2; - __pyx_t_35 = 1; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; - __pyx_t_36 = __pyx_v_mol; - __pyx_t_37 = __pyx_v_start; - __pyx_t_38 = 0; - __pyx_t_39 = 2; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[3]; - __pyx_t_40 = __pyx_v_mol; - __pyx_t_41 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_42 = 2; - __pyx_t_43 = 2; - if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[3]; - __pyx_v_t5 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_22 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_24 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_25 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_27 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_28 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_40 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_41 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_43 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":421 - * t4 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 - * t5 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 - * t6 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< - * corr[0,shellstart,dt, t1] += 1.0 # l=1 - * corr[1,shellstart,dt, t2] += 1.0 + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: */ - __pyx_t_43 = __pyx_v_mol; - __pyx_t_42 = __pyx_v_start; - __pyx_t_41 = 1; - __pyx_t_40 = 0; - if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[3]; - __pyx_t_39 = __pyx_v_mol; - __pyx_t_38 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_37 = 2; - __pyx_t_36 = 0; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; - __pyx_t_35 = __pyx_v_mol; - __pyx_t_34 = __pyx_v_start; - __pyx_t_33 = 1; - __pyx_t_32 = 1; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; - __pyx_t_31 = __pyx_v_mol; - __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_29 = 2; - __pyx_t_28 = 1; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[3]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_26 = __pyx_v_start; - __pyx_t_25 = 1; - __pyx_t_24 = 2; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[3]; - __pyx_t_23 = __pyx_v_mol; - __pyx_t_22 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_20 = 2; - __pyx_t_19 = 2; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; - __pyx_v_t6 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_43 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_41 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_40 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_39 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_27 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_25 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_24 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_23 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_22 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 428, __pyx_L1_error) + if (__pyx_t_4) { - /* "src/helpers/correl.pyx":422 - * t5 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 - * t6 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 - * corr[0,shellstart,dt, t1] += 1.0 # l=1 # <<<<<<<<<<<<<< - * corr[1,shellstart,dt, t2] += 1.0 - * corr[2,shellstart,dt, t3] += 1.0 + /* "View.MemoryView":429 + * obj = self.is_slice(value) + * if obj: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) */ - __pyx_t_19 = 0; - __pyx_t_20 = __pyx_v_shellstart; - __pyx_t_22 = __pyx_v_dt; - __pyx_t_23 = ((int)__pyx_v_t1); - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_corr.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_22 * __pyx_v_corr.strides[2]) ) + __pyx_t_23 * __pyx_v_corr.strides[3]) )) += 1.0; + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/helpers/correl.pyx":423 - * t6 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 - * corr[0,shellstart,dt, t1] += 1.0 # l=1 - * corr[1,shellstart,dt, t2] += 1.0 # <<<<<<<<<<<<<< - * corr[2,shellstart,dt, t3] += 1.0 - * corr[3,shellstart,dt, t4] += 1.0 - */ - __pyx_t_23 = 1; - __pyx_t_22 = __pyx_v_shellstart; - __pyx_t_20 = __pyx_v_dt; - __pyx_t_19 = ((int)__pyx_v_t2); - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_corr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_22 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_19 * __pyx_v_corr.strides[3]) )) += 1.0; - - /* "src/helpers/correl.pyx":424 - * corr[0,shellstart,dt, t1] += 1.0 # l=1 - * corr[1,shellstart,dt, t2] += 1.0 - * corr[2,shellstart,dt, t3] += 1.0 # <<<<<<<<<<<<<< - * corr[3,shellstart,dt, t4] += 1.0 - * corr[4,shellstart,dt, t5] += 1.0 + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: */ - __pyx_t_19 = 2; - __pyx_t_20 = __pyx_v_shellstart; - __pyx_t_22 = __pyx_v_dt; - __pyx_t_23 = ((int)__pyx_v_t3); - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_corr.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_22 * __pyx_v_corr.strides[2]) ) + __pyx_t_23 * __pyx_v_corr.strides[3]) )) += 1.0; + goto __pyx_L5; + } - /* "src/helpers/correl.pyx":425 - * corr[1,shellstart,dt, t2] += 1.0 - * corr[2,shellstart,dt, t3] += 1.0 - * corr[3,shellstart,dt, t4] += 1.0 # <<<<<<<<<<<<<< - * corr[4,shellstart,dt, t5] += 1.0 - * corr[5,shellstart,dt, t6] += 1.0 - */ - __pyx_t_23 = 3; - __pyx_t_22 = __pyx_v_shellstart; - __pyx_t_20 = __pyx_v_dt; - __pyx_t_19 = ((int)__pyx_v_t4); - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_corr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_22 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_19 * __pyx_v_corr.strides[3]) )) += 1.0; - - /* "src/helpers/correl.pyx":426 - * corr[2,shellstart,dt, t3] += 1.0 - * corr[3,shellstart,dt, t4] += 1.0 - * corr[4,shellstart,dt, t5] += 1.0 # <<<<<<<<<<<<<< - * corr[5,shellstart,dt, t6] += 1.0 - * + /* "View.MemoryView":431 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) */ - __pyx_t_19 = 4; - __pyx_t_20 = __pyx_v_shellstart; - __pyx_t_22 = __pyx_v_dt; - __pyx_t_23 = ((int)__pyx_v_t5); - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_corr.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_22 * __pyx_v_corr.strides[2]) ) + __pyx_t_23 * __pyx_v_corr.strides[3]) )) += 1.0; + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 431, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; - /* "src/helpers/correl.pyx":427 - * corr[3,shellstart,dt, t4] += 1.0 - * corr[4,shellstart,dt, t5] += 1.0 - * corr[5,shellstart,dt, t6] += 1.0 # <<<<<<<<<<<<<< + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) * - * for i in range(nshells): + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ - __pyx_t_23 = 5; - __pyx_t_22 = __pyx_v_shellstart; - __pyx_t_20 = __pyx_v_dt; - __pyx_t_19 = ((int)__pyx_v_t6); - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_corr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_22 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_19 * __pyx_v_corr.strides[3]) )) += 1.0; - - /* "src/helpers/correl.pyx":412 - * start = point*startskip - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< + goto __pyx_L4; + } + + /* "View.MemoryView":433 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< * - * ctr[shellstart,dt] += 1 + * cdef is_slice(self, obj): */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; - /* "src/helpers/correl.pyx":407 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) * - * for dt in prange(maxdt,nogil=True, schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - /* "src/helpers/correl.pyx":429 - * corr[5,shellstart,dt, t6] += 1.0 + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":435 + * self.setitem_indexed(index, value) * - * for i in range(nshells): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * if ctr[i,j] != 0: + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ - __pyx_t_12 = __pyx_v_nshells; - __pyx_t_11 = __pyx_t_12; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - /* "src/helpers/correl.pyx":430 +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); + + /* "View.MemoryView":436 * - * for i in range(nshells): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * if ctr[i,j] != 0: - * for k in range(6): + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - __pyx_t_13 = __pyx_v_maxdt; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_j = __pyx_t_15; + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":431 - * for i in range(nshells): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(6): - * for l in range(20): + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_20 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; - __pyx_t_21 = (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ))) != 0.0) != 0); - if (__pyx_t_21) { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { - /* "src/helpers/correl.pyx":432 - * for j in range(maxdt): - * if ctr[i,j] != 0: - * for k in range(6): # <<<<<<<<<<<<<< - * for l in range(20): - * corr[k,i,j,l] /= ctr[i,j] + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: */ - for (__pyx_t_16 = 0; __pyx_t_16 < 6; __pyx_t_16+=1) { - __pyx_v_k = __pyx_t_16; + __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); - /* "src/helpers/correl.pyx":433 - * if ctr[i,j] != 0: - * for k in range(6): - * for l in range(20): # <<<<<<<<<<<<<< - * corr[k,i,j,l] /= ctr[i,j] - * + /* "View.MemoryView":439 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None */ - for (__pyx_t_17 = 0; __pyx_t_17 < 20; __pyx_t_17+=1) { - __pyx_v_l = __pyx_t_17; + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); - /* "src/helpers/correl.pyx":434 - * for k in range(6): - * for l in range(20): - * corr[k,i,j,l] /= ctr[i,j] # <<<<<<<<<<<<<< - * + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: + */ + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "View.MemoryView":440 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None * */ - __pyx_t_20 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; - __pyx_t_22 = __pyx_v_k; - __pyx_t_23 = __pyx_v_i; - __pyx_t_24 = __pyx_v_j; - __pyx_t_25 = __pyx_v_l; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_corr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[1]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[2]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_22 * __pyx_v_corr.strides[0]) ) + __pyx_t_23 * __pyx_v_corr.strides[1]) ) + __pyx_t_24 * __pyx_v_corr.strides[2]) ) + __pyx_t_25 * __pyx_v_corr.strides[3]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) ))); - } - } + __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); + if (__pyx_t_9) { + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 440, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); - /* "src/helpers/correl.pyx":431 - * for i in range(nshells): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(6): - * for l in range(20): + /* "View.MemoryView":441 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_except_return; } + goto __pyx_L6_except_error; + + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + */ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; } - } - /* "src/helpers/correl.pyx":437 + /* "View.MemoryView":436 * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + */ + } + + /* "View.MemoryView":443 + * return None * - * return corr # <<<<<<<<<<<<<< - * + * return obj # <<<<<<<<<<<<<< * + * cdef setitem_slice_assignment(self, dst, src): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 4, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; goto __pyx_L0; - /* "src/helpers/correl.pyx":397 + /* "View.MemoryView":435 + * self.setitem_indexed(index, value) * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ /* function exit code */ __pyx_L1_error:; - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1); - __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); - __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateDist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_corr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rotTs, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_XDECREF(__pyx_v_obj); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":442 +/* "View.MemoryView":445 + * return obj * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_15rotationMatrixShellCorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_15rotationMatrixShellCorrelate = {"rotationMatrixShellCorrelate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_15rotationMatrixShellCorrelate, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_15rotationMatrixShellCorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_v_nshells; - long __pyx_v_maxdt; - long __pyx_v_startingpoints; +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("rotationMatrixShellCorrelate (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds,&__pyx_n_s_nshells,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rotTs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelate", 1, 5, 5, 1); __PYX_ERR(0, 442, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelate", 1, 5, 5, 2); __PYX_ERR(0, 442, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxdt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelate", 1, 5, 5, 3); __PYX_ERR(0, 442, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startingpoints)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelate", 1, 5, 5, 4); __PYX_ERR(0, 442, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotationMatrixShellCorrelate") < 0)) __PYX_ERR(0, 442, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - } - __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 442, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 442, __pyx_L3_error) - __pyx_v_nshells = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_nshells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L3_error) - __pyx_v_maxdt = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L3_error) - __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelate", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 442, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_6correl_14rotationMatrixShellCorrelate(__pyx_self, __pyx_v_rotTs, __pyx_v_ds, __pyx_v_nshells, __pyx_v_maxdt, __pyx_v_startingpoints); + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":448 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + */ + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); + + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + */ + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":451 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 451, __pyx_L1_error) + + /* "View.MemoryView":445 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_14rotationMatrixShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints) { - long __pyx_v_nmol; - long __pyx_v_n; - long __pyx_v_startskip; - __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_selfcorr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_crosscorr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_selfctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_crossctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_t1; - double __pyx_v_t2; - double __pyx_v_t3; - double __pyx_v_t4; - double __pyx_v_t5; - double __pyx_v_t6; - long __pyx_v_i; - long __pyx_v_j; - long __pyx_v_k; - long __pyx_v_start; - long __pyx_v_point; - long __pyx_v_dt; - long __pyx_v_mol; - long __pyx_v_shellstart; - long __pyx_v_shelldt; +/* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL + */ + +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[0x80]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_10; - long __pyx_t_11; - long __pyx_t_12; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - int __pyx_t_20; - double __pyx_t_21; - double __pyx_t_22; - double __pyx_t_23; - double __pyx_t_24; - double __pyx_t_25; - double __pyx_t_26; - long __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - Py_ssize_t __pyx_t_31; - Py_ssize_t __pyx_t_32; - Py_ssize_t __pyx_t_33; - Py_ssize_t __pyx_t_34; - PyObject *__pyx_t_35 = NULL; - PyObject *__pyx_t_36 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("rotationMatrixShellCorrelate", 0); + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - /* "src/helpers/correl.pyx":443 - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< - * cdef long n = len(rotTs[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array + /* "View.MemoryView":455 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item + * */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); - __pyx_v_nmol = ((long)__pyx_t_1); + __pyx_v_tmp = NULL; - /* "src/helpers/correl.pyx":444 - * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints + /* "View.MemoryView":460 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + * + * if self.view.itemsize > sizeof(array): */ - __pyx_t_2.data = __pyx_v_rotTs.data; - __pyx_t_2.memview = __pyx_v_rotTs.memview; - __PYX_INC_MEMVIEW(&__pyx_t_2, 0); - { - Py_ssize_t __pyx_tmp_idx = 0; - Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; -__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; - __pyx_t_2.suboffsets[0] = -1; - -__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; -__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; - __pyx_t_2.suboffsets[1] = -1; - -__pyx_t_2.shape[2] = __pyx_v_rotTs.shape[3]; -__pyx_t_2.strides[2] = __pyx_v_rotTs.strides[3]; - __pyx_t_2.suboffsets[2] = -1; - -__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - __pyx_v_n = ((long)__pyx_t_1); + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 460, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; - /* "src/helpers/correl.pyx":446 - * cdef long n = len(rotTs[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints # <<<<<<<<<<<<<< - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ - __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); - if (unlikely(__pyx_v_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 446, __pyx_L1_error) - } - else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 446, __pyx_L1_error) - } - __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":447 - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< - * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) + /* "View.MemoryView":463 + * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_int_12); - __Pyx_GIVEREF(__pyx_int_12); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_12); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_corr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - /* "src/helpers/correl.pyx":448 - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_int_12); - __Pyx_GIVEREF(__pyx_int_12); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_12); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_selfcorr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/correl.pyx":449 - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries - * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) + /* "View.MemoryView":465 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_int_12); - __Pyx_GIVEREF(__pyx_int_12); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_12); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7); - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_crosscorr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; + PyErr_NoMemory(); __PYX_ERR(1, 465, __pyx_L1_error) - /* "src/helpers/correl.pyx":450 - * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< - * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) - * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 450, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 450, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 450, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 450, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 450, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 450, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 450, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ctr = __pyx_t_9; - __pyx_t_9.memview = NULL; - __pyx_t_9.data = NULL; - /* "src/helpers/correl.pyx":451 - * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries - * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) - * cdef double t1,t2,t3,t4,t5,t6 + /* "View.MemoryView":466 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 451, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_selfctr = __pyx_t_9; - __pyx_t_9.memview = NULL; - __pyx_t_9.data = NULL; + __pyx_v_item = __pyx_v_tmp; - /* "src/helpers/correl.pyx":452 - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries - * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) - * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) # <<<<<<<<<<<<<< - * cdef double t1,t2,t3,t4,t5,t6 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } + goto __pyx_L3; } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_crossctr = __pyx_t_9; - __pyx_t_9.memview = NULL; - __pyx_t_9.data = NULL; - /* "src/helpers/correl.pyx":456 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* "View.MemoryView":468 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * try: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_3 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_11 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_11 > 0) - { - #ifdef _OPENMP - #pragma omp parallel reduction(+:__pyx_v_t1) reduction(+:__pyx_v_t2) reduction(+:__pyx_v_t3) reduction(+:__pyx_v_t4) reduction(+:__pyx_v_t5) reduction(+:__pyx_v_t6) private(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) - #endif /* _OPENMP */ - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ - { - __pyx_v_dt = (long)(0 + 1 * __pyx_t_10); - /* Initialize private variables to invalid values */ - __pyx_v_k = ((long)0xbad0bad0); - __pyx_v_mol = ((long)0xbad0bad0); - __pyx_v_point = ((long)0xbad0bad0); - __pyx_v_shelldt = ((long)0xbad0bad0); - __pyx_v_shellstart = ((long)0xbad0bad0); - __pyx_v_start = ((long)0xbad0bad0); + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; - /* "src/helpers/correl.pyx":457 + /* "View.MemoryView":470 + * item = array * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value */ - __pyx_t_12 = __pyx_v_startingpoints; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_point = __pyx_t_14; + /*try:*/ { - /* "src/helpers/correl.pyx":458 - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * start = point*startskip - * shellstart = ds[mol,start]-1 + /* "View.MemoryView":471 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - __pyx_t_15 = __pyx_v_nmol; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_mol = __pyx_t_17; + if (__pyx_v_self->dtype_is_object) { - /* "src/helpers/correl.pyx":459 - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip # <<<<<<<<<<<<<< - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: + /* "View.MemoryView":472 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) */ - __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - /* "src/helpers/correl.pyx":460 - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip - * shellstart = ds[mol,start]-1 # <<<<<<<<<<<<<< - * if shellstart < nshells: - * ctr[shellstart,dt] += 1 + /* "View.MemoryView":471 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds.shape[1]; - __pyx_v_shellstart = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_18 * __pyx_v_ds.strides[0]) ) + __pyx_t_19 * __pyx_v_ds.strides[1]) ))) - 1); + goto __pyx_L8; + } - /* "src/helpers/correl.pyx":461 - * start = point*startskip - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * ctr[shellstart,dt] += 1 + /* "View.MemoryView":474 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + * * */ - __pyx_t_20 = ((__pyx_v_shellstart < __pyx_v_nshells) != 0); - if (__pyx_t_20) { + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; - /* "src/helpers/correl.pyx":462 - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: - * ctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":478 * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_18 * __pyx_v_ctr.strides[1]) )) += 1.0; + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":464 - * ctr[shellstart,dt] += 1 + /* "View.MemoryView":479 * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 # <<<<<<<<<<<<<< - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) */ - __pyx_t_21 = 0.0; - __pyx_t_22 = 0.0; - __pyx_t_23 = 0.0; - __pyx_t_24 = 0.0; - __pyx_t_25 = 0.0; - __pyx_t_26 = 0.0; - __pyx_v_t1 = __pyx_t_21; - __pyx_v_t2 = __pyx_t_22; - __pyx_v_t3 = __pyx_t_23; - __pyx_v_t4 = __pyx_t_24; - __pyx_v_t5 = __pyx_t_25; - __pyx_v_t6 = __pyx_t_26; + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 479, __pyx_L6_error) - /* "src/helpers/correl.pyx":465 + /* "View.MemoryView":478 * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 - * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - for (__pyx_t_27 = 0; __pyx_t_27 < 3; __pyx_t_27+=1) { - __pyx_v_k = __pyx_t_27; + } - /* "src/helpers/correl.pyx":466 - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] # <<<<<<<<<<<<<< - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + /* "View.MemoryView":480 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_28 = 0; - __pyx_t_29 = __pyx_v_k; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[3]; - __pyx_t_30 = __pyx_v_mol; - __pyx_t_31 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_32 = 0; - __pyx_t_33 = __pyx_v_k; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; - __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_18 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))))); + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } - /* "src/helpers/correl.pyx":467 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - */ - __pyx_t_33 = __pyx_v_mol; - __pyx_t_32 = __pyx_v_start; - __pyx_t_31 = 1; - __pyx_t_30 = __pyx_v_k; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; - __pyx_t_29 = __pyx_v_mol; - __pyx_t_28 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_19 = 1; - __pyx_t_18 = __pyx_v_k; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[3]; - __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_29 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_18 * __pyx_v_rotTs.strides[3]) ))))); - - /* "src/helpers/correl.pyx":468 - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + /* "View.MemoryView":483 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< + * + * cdef setitem_indexed(self, index, value): */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_28 = 2; - __pyx_t_29 = __pyx_v_k; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[3]; - __pyx_t_30 = __pyx_v_mol; - __pyx_t_31 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_32 = 2; - __pyx_t_33 = __pyx_v_k; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; - __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_18 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))))); + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + } + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } - /* "src/helpers/correl.pyx":469 - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + /* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL */ - __pyx_t_33 = __pyx_v_mol; - __pyx_t_32 = __pyx_v_start; - __pyx_t_31 = 0; - __pyx_t_30 = __pyx_v_k; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; - __pyx_t_29 = __pyx_v_mol; - __pyx_t_28 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_19 = 1; - __pyx_t_18 = __pyx_v_k; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[3]; - __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_29 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_18 * __pyx_v_rotTs.strides[3]) ))))); - - /* "src/helpers/correl.pyx":470 - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart,dt] += t1 # l=1 - */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_28 = 0; - __pyx_t_29 = __pyx_v_k; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[3]; - __pyx_t_30 = __pyx_v_mol; - __pyx_t_31 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_32 = 2; - __pyx_t_33 = __pyx_v_k; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; - __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_18 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))))); - /* "src/helpers/correl.pyx":471 - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * corr[0,shellstart,dt] += t1 # l=1 - * corr[1,shellstart,dt] += t2 - */ - __pyx_t_33 = __pyx_v_mol; - __pyx_t_32 = __pyx_v_start; - __pyx_t_31 = 1; - __pyx_t_30 = __pyx_v_k; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; - __pyx_t_29 = __pyx_v_mol; - __pyx_t_28 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_19 = 2; - __pyx_t_18 = __pyx_v_k; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[3]; - __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_29 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_18 * __pyx_v_rotTs.strides[3]) ))))); - } + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":472 - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart,dt] += t1 # l=1 # <<<<<<<<<<<<<< - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 +/* "View.MemoryView":485 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) */ - __pyx_t_18 = 0; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += __pyx_v_t1; - /* "src/helpers/correl.pyx":473 - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart,dt] += t1 # l=1 - * corr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 - */ - __pyx_t_28 = 1; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t2; +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_indexed", 0); - /* "src/helpers/correl.pyx":474 - * corr[0,shellstart,dt] += t1 # l=1 - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 + /* "View.MemoryView":486 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * */ - __pyx_t_18 = 2; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += __pyx_v_t3; + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 486, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; - /* "src/helpers/correl.pyx":475 - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 + /* "View.MemoryView":487 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): */ - __pyx_t_28 = 3; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t4; + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":476 - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + /* "View.MemoryView":485 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) */ - __pyx_t_18 = 4; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += __pyx_v_t5; - /* "src/helpers/correl.pyx":477 - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - */ - __pyx_t_28 = 5; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t6; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":478 - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 # <<<<<<<<<<<<<< - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 +/* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_t_18 = 6; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - /* "src/helpers/correl.pyx":479 - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - */ - __pyx_t_28 = 7; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "src/helpers/correl.pyx":480 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 + /* "View.MemoryView":492 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem + * */ - __pyx_t_18 = 8; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":481 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":495 + * cdef bytes bytesitem + * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) */ - __pyx_t_28 = 9; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":482 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":496 * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - __pyx_t_18 = 10; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { - /* "src/helpers/correl.pyx":483 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< - * - * shelldt = ds[mol,start+dt]-1 + /* "View.MemoryView":497 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" */ - __pyx_t_28 = 11; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":485 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":496 * - * shelldt = ds[mol,start+dt]-1 # <<<<<<<<<<<<<< - * if shellstart == shelldt: - * selfctr[shellstart,dt] += 1 + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds.shape[1]; - __pyx_v_shelldt = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_18 * __pyx_v_ds.strides[0]) ) + __pyx_t_19 * __pyx_v_ds.strides[1]) ))) - 1); + } - /* "src/helpers/correl.pyx":486 - * - * shelldt = ds[mol,start+dt]-1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * selfctr[shellstart,dt] += 1 - * + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result */ - __pyx_t_20 = ((__pyx_v_shellstart == __pyx_v_shelldt) != 0); - if (__pyx_t_20) { + /*else:*/ { + __pyx_t_9 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 501, __pyx_L5_except_error) + __pyx_t_10 = (__pyx_t_9 == 1); + if (__pyx_t_10) { - /* "src/helpers/correl.pyx":487 - * shelldt = ds[mol,start+dt]-1 - * if shellstart == shelldt: - * selfctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":502 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result * - * selfcorr[0,shellstart,dt] += t1 */ - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_19 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_18 * __pyx_v_selfctr.strides[1]) )) += 1.0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 502, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; - /* "src/helpers/correl.pyx":489 - * selfctr[shellstart,dt] += 1 - * - * selfcorr[0,shellstart,dt] += t1 # <<<<<<<<<<<<<< - * selfcorr[1,shellstart,dt] += t2 - * selfcorr[2,shellstart,dt] += t3 + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result */ - __pyx_t_18 = 0; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_28 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t1; + } - /* "src/helpers/correl.pyx":490 + /* "View.MemoryView":503 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< * - * selfcorr[0,shellstart,dt] += t1 - * selfcorr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< - * selfcorr[2,shellstart,dt] += t3 - * selfcorr[3,shellstart,dt] += t4 + * cdef assign_item_from_object(self, char *itemp, object value): */ - __pyx_t_28 = 1; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_28 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t2; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/correl.pyx":491 - * selfcorr[0,shellstart,dt] += t1 - * selfcorr[1,shellstart,dt] += t2 - * selfcorr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< - * selfcorr[3,shellstart,dt] += t4 - * selfcorr[4,shellstart,dt] += t5 + /* "View.MemoryView":498 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: */ - __pyx_t_18 = 2; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_28 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t3; + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_6); + __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; + if (__pyx_t_8) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_1); - /* "src/helpers/correl.pyx":492 - * selfcorr[1,shellstart,dt] += t2 - * selfcorr[2,shellstart,dt] += t3 - * selfcorr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< - * selfcorr[4,shellstart,dt] += t5 - * selfcorr[5,shellstart,dt] += t6 + /* "View.MemoryView":499 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: */ - __pyx_t_28 = 3; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_28 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t4; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 499, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "src/helpers/correl.pyx":493 - * selfcorr[2,shellstart,dt] += t3 - * selfcorr[3,shellstart,dt] += t4 - * selfcorr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< - * selfcorr[5,shellstart,dt] += t6 - * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 + /* "View.MemoryView":496 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - __pyx_t_18 = 4; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_28 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t5; + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; + } - /* "src/helpers/correl.pyx":494 - * selfcorr[3,shellstart,dt] += t4 - * selfcorr[4,shellstart,dt] += t5 - * selfcorr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< - * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 - * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 + /* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_t_28 = 5; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_28 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t6; - /* "src/helpers/correl.pyx":495 - * selfcorr[4,shellstart,dt] += t5 - * selfcorr[5,shellstart,dt] += t6 - * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 # <<<<<<<<<<<<<< - * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 - */ - __pyx_t_18 = 6; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_28 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":496 - * selfcorr[5,shellstart,dt] += t6 - * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 - * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< - * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 +/* "View.MemoryView":505 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_t_28 = 7; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_28 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); - /* "src/helpers/correl.pyx":497 - * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 - * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< - * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 - */ - __pyx_t_18 = 8; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_28 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + char *__pyx_t_10; + char *__pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "src/helpers/correl.pyx":498 - * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< - * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":508 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue */ - __pyx_t_28 = 9; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_28 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":499 - * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< - * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":513 + * cdef Py_ssize_t i * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: */ - __pyx_t_18 = 10; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_28 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); + __pyx_t_2 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":500 - * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< + /* "View.MemoryView":514 * - * for i in range(nshells): + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) */ - __pyx_t_28 = 11; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_28 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 514, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/correl.pyx":486 - * - * shelldt = ds[mol,start+dt]-1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * selfctr[shellstart,dt] += 1 + /* "View.MemoryView":513 + * cdef Py_ssize_t i * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: */ - } + goto __pyx_L3; + } - /* "src/helpers/correl.pyx":461 - * start = point*startskip - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * ctr[shellstart,dt] += 1 + /* "View.MemoryView":516 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< * + * for i, c in enumerate(bytesvalue): */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif + /*else*/ { + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } - - /* "src/helpers/correl.pyx":456 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_value}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } + __pyx_t_7 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 518, __pyx_L1_error) } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_8 = __pyx_v_bytesvalue; + __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8); + __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8)); + for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) { + __pyx_t_9 = __pyx_t_12; + __pyx_v_c = (__pyx_t_9[0]); - /* "src/helpers/correl.pyx":502 - * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":519 * - * for i in range(nshells): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * if ctr[i,j] != 0: + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') */ - __pyx_t_11 = __pyx_v_nshells; - __pyx_t_10 = __pyx_t_11; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_10; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_v_i = __pyx_t_7; - /* "src/helpers/correl.pyx":503 + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c * - * for i in range(nshells): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * if ctr[i,j] != 0: - * for k in range(12): */ - __pyx_t_12 = __pyx_v_maxdt; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_j = __pyx_t_14; + __pyx_t_7 = (__pyx_t_7 + 1); - /* "src/helpers/correl.pyx":504 - * for i in range(nshells): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] + /* "View.MemoryView":519 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; - __pyx_t_20 = (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_18 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) ))) != 0.0) != 0); - if (__pyx_t_20) { + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/helpers/correl.pyx":505 - * for j in range(maxdt): - * if ctr[i,j] != 0: - * for k in range(12): # <<<<<<<<<<<<<< - * corr[k,i,j] /= ctr[i,j] - * else: + /* "View.MemoryView":505 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - for (__pyx_t_15 = 0; __pyx_t_15 < 12; __pyx_t_15+=1) { - __pyx_v_k = __pyx_t_15; - /* "src/helpers/correl.pyx":506 - * if ctr[i,j] != 0: - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] # <<<<<<<<<<<<<< - * else: - * print 'tot too sparse' + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":521 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_18 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[1]; - __pyx_t_28 = __pyx_v_k; - __pyx_t_29 = __pyx_v_i; - __pyx_t_30 = __pyx_v_j; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_29 * __pyx_v_corr.strides[1]) ) + __pyx_t_30 * __pyx_v_corr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_18 * __pyx_v_ctr.strides[1]) ))); - } - /* "src/helpers/correl.pyx":504 - * for i in range(nshells): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":523 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * */ - goto __pyx_L24; - } + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "src/helpers/correl.pyx":508 - * corr[k,i,j] /= ctr[i,j] - * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< - * if selfctr[i,j] != 0: - * for k in range(12): + /* "View.MemoryView":524 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 508, __pyx_L1_error) - } - __pyx_L24:; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 524, __pyx_L1_error) - /* "src/helpers/correl.pyx":509 - * else: - * print 'tot too sparse' - * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * selfcorr[k,i,j] /= selfctr[i,j] + /* "View.MemoryView":523 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[1]; - __pyx_t_20 = (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_18 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfctr.strides[1]) ))) != 0.0) != 0); - if (__pyx_t_20) { - - /* "src/helpers/correl.pyx":510 - * print 'tot too sparse' - * if selfctr[i,j] != 0: - * for k in range(12): # <<<<<<<<<<<<<< - * selfcorr[k,i,j] /= selfctr[i,j] - * else: + } + + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ - for (__pyx_t_15 = 0; __pyx_t_15 < 12; __pyx_t_15+=1) { - __pyx_v_k = __pyx_t_15; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":511 - * if selfctr[i,j] != 0: - * for k in range(12): - * selfcorr[k,i,j] /= selfctr[i,j] # <<<<<<<<<<<<<< - * else: - * print 'self too sparse' + /* "View.MemoryView":527 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_18 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfctr.shape[1]; - __pyx_t_30 = __pyx_v_k; - __pyx_t_29 = __pyx_v_i; - __pyx_t_28 = __pyx_v_j; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_30 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_29 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_28 * __pyx_v_selfcorr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_19 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_18 * __pyx_v_selfctr.strides[1]) ))); - } + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; - /* "src/helpers/correl.pyx":509 - * else: - * print 'tot too sparse' - * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * selfcorr[k,i,j] /= selfctr[i,j] + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ - goto __pyx_L27; - } + goto __pyx_L6; + } - /* "src/helpers/correl.pyx":513 - * selfcorr[k,i,j] /= selfctr[i,j] - * else: - * print 'self too sparse' # <<<<<<<<<<<<<< - * for i in range(nshells): - * for j in range(maxdt): + /* "View.MemoryView":529 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_self_too_sparse) < 0) __PYX_ERR(0, 513, __pyx_L1_error) - } - __pyx_L27:; - } + /*else*/ { + __pyx_v_info->shape = NULL; } + __pyx_L6:; - /* "src/helpers/correl.pyx":514 - * else: - * print 'self too sparse' - * for i in range(nshells): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] + /* "View.MemoryView":531 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - __pyx_t_11 = __pyx_v_nshells; - __pyx_t_10 = __pyx_t_11; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_10; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":515 - * print 'self too sparse' - * for i in range(nshells): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] - * for k in range(12): + /* "View.MemoryView":532 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL */ - __pyx_t_12 = __pyx_v_maxdt; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_j = __pyx_t_14; + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; - /* "src/helpers/correl.pyx":516 - * for i in range(nshells): - * for j in range(maxdt): - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] # <<<<<<<<<<<<<< - * for k in range(12): - * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] + /* "View.MemoryView":531 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; - __pyx_t_28 = __pyx_v_i; - __pyx_t_29 = __pyx_v_j; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfctr.shape[1]; - __pyx_t_30 = __pyx_v_i; - __pyx_t_31 = __pyx_v_j; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_crossctr.shape[0]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_crossctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crossctr.data + __pyx_t_30 * __pyx_v_crossctr.strides[0]) ) + __pyx_t_31 * __pyx_v_crossctr.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_18 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_28 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_29 * __pyx_v_selfctr.strides[1]) )))); - - /* "src/helpers/correl.pyx":517 - * for j in range(maxdt): - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] - * for k in range(12): # <<<<<<<<<<<<<< - * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] + goto __pyx_L7; + } + + /* "View.MemoryView":534 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< * + * if flags & PyBUF_INDIRECT: */ - for (__pyx_t_15 = 0; __pyx_t_15 < 12; __pyx_t_15+=1) { - __pyx_v_k = __pyx_t_15; + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; - /* "src/helpers/correl.pyx":518 - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] - * for k in range(12): - * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] # <<<<<<<<<<<<<< + /* "View.MemoryView":536 + * info.strides = NULL * - * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: */ - __pyx_t_29 = __pyx_v_k; - __pyx_t_28 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; - __pyx_t_18 = __pyx_v_k; - __pyx_t_31 = __pyx_v_i; - __pyx_t_30 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_selfcorr.shape[2]; - __pyx_t_32 = __pyx_v_k; - __pyx_t_33 = __pyx_v_i; - __pyx_t_34 = __pyx_v_j; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_crosscorr.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_crosscorr.shape[1]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_crosscorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crosscorr.data + __pyx_t_32 * __pyx_v_crosscorr.strides[0]) ) + __pyx_t_33 * __pyx_v_crosscorr.strides[1]) ) + __pyx_t_34 * __pyx_v_crosscorr.strides[2]) )) = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_28 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) ))) - (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_31 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_30 * __pyx_v_selfcorr.strides[2]) )))); - } - } + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":537 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL + */ + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; + + /* "View.MemoryView":536 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: + */ + goto __pyx_L8; } - /* "src/helpers/correl.pyx":520 - * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] + /* "View.MemoryView":539 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< * - * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr # <<<<<<<<<<<<<< + * if flags & PyBUF_FORMAT: + */ + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; + + /* "View.MemoryView":541 + * info.suboffsets = NULL * - * @cython.boundscheck(False) + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_selfcorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_crosscorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_selfctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_35 = __pyx_memoryview_fromslice(__pyx_v_crossctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_35); - __pyx_t_36 = PyTuple_New(6); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_36); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_36, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_36, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_36, 2, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_36, 3, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_36, 4, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_35); - PyTuple_SET_ITEM(__pyx_t_36, 5, __pyx_t_35); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_35 = 0; - __pyx_r = __pyx_t_36; - __pyx_t_36 = 0; - goto __pyx_L0; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":442 + /* "View.MemoryView":542 * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL + */ + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; + + /* "View.MemoryView":541 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: + */ + goto __pyx_L9; + } + + /* "View.MemoryView":544 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< + * + * info.buf = self.view.buf + */ + /*else*/ { + __pyx_v_info->format = NULL; + } + __pyx_L9:; + + /* "View.MemoryView":546 + * info.format = NULL + * + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + */ + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; + + /* "View.MemoryView":547 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len + */ + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":548 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly + */ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":549 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self + */ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; + + /* "View.MemoryView":550 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * + */ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":551 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * + * + */ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":521 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1); - __Pyx_XDECREF(__pyx_t_35); - __Pyx_XDECREF(__pyx_t_36); - __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_corr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_selfcorr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_crosscorr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_selfctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_crossctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rotTs, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __Pyx_XGIVEREF(__pyx_r); + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":523 +/* "View.MemoryView":554 * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_17rotationMatrixShellCorrelateTot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_17rotationMatrixShellCorrelateTot = {"rotationMatrixShellCorrelateTot", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_17rotationMatrixShellCorrelateTot, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_17rotationMatrixShellCorrelateTot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_v_nshells; - long __pyx_v_maxdt; - long __pyx_v_startingpoints; +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateTot (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds,&__pyx_n_s_nshells,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rotTs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTot", 1, 5, 5, 1); __PYX_ERR(0, 523, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTot", 1, 5, 5, 2); __PYX_ERR(0, 523, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxdt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTot", 1, 5, 5, 3); __PYX_ERR(0, 523, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startingpoints)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTot", 1, 5, 5, 4); __PYX_ERR(0, 523, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotationMatrixShellCorrelateTot") < 0)) __PYX_ERR(0, 523, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - } - __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 523, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 523, __pyx_L3_error) - __pyx_v_nshells = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_nshells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L3_error) - __pyx_v_maxdt = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L3_error) - __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTot", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 523, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateTot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":556 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result + */ + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 556, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":557 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 557, __pyx_L1_error) + + /* "View.MemoryView":558 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":554 + * + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_6correl_16rotationMatrixShellCorrelateTot(__pyx_self, __pyx_v_rotTs, __pyx_v_ds, __pyx_v_nshells, __pyx_v_maxdt, __pyx_v_startingpoints); + return __pyx_r; +} + +/* "View.MemoryView":560 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_16rotationMatrixShellCorrelateTot(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints) { - long __pyx_v_nmol; - long __pyx_v_n; - long __pyx_v_startskip; - __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_t1; - double __pyx_v_t2; - double __pyx_v_t3; - double __pyx_v_t4; - double __pyx_v_t5; - double __pyx_v_t6; - long __pyx_v_i; - long __pyx_v_j; - long __pyx_v_k; - long __pyx_v_start; - long __pyx_v_point; - long __pyx_v_dt; - long __pyx_v_mol; - long __pyx_v_shellstart; +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_10; - long __pyx_t_11; - long __pyx_t_12; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - int __pyx_t_20; - double __pyx_t_21; - double __pyx_t_22; - double __pyx_t_23; - double __pyx_t_24; - double __pyx_t_25; - double __pyx_t_26; - long __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - Py_ssize_t __pyx_t_31; - Py_ssize_t __pyx_t_32; - Py_ssize_t __pyx_t_33; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateTot", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/correl.pyx":524 - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< - * cdef long n = len(rotTs[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array + /* "View.MemoryView":562 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< + * + * cdef _get_base(self): */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); - __pyx_v_nmol = ((long)__pyx_t_1); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":525 - * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints + /* "View.MemoryView":560 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ - __pyx_t_2.data = __pyx_v_rotTs.data; - __pyx_t_2.memview = __pyx_v_rotTs.memview; - __PYX_INC_MEMVIEW(&__pyx_t_2, 0); - { - Py_ssize_t __pyx_tmp_idx = 0; - Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; -} -__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; -__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; - __pyx_t_2.suboffsets[0] = -1; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; -__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; - __pyx_t_2.suboffsets[1] = -1; +/* "View.MemoryView":564 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * + */ -__pyx_t_2.shape[2] = __pyx_v_rotTs.shape[3]; -__pyx_t_2.strides[2] = __pyx_v_rotTs.strides[3]; - __pyx_t_2.suboffsets[2] = -1; +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); -__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - __pyx_v_n = ((long)__pyx_t_1); + /* "View.MemoryView":565 + * + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; - /* "src/helpers/correl.pyx":527 - * cdef long n = len(rotTs[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints # <<<<<<<<<<<<<< - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + /* "View.MemoryView":564 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * */ - __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); - if (unlikely(__pyx_v_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 527, __pyx_L1_error) - } - else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 527, __pyx_L1_error) - } - __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - /* "src/helpers/correl.pyx":528 - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries - * cdef double t1,t2,t3,t4,t5,t6 + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":567 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_int_12); - __Pyx_GIVEREF(__pyx_int_12); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_12); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_corr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - /* "src/helpers/correl.pyx":529 - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< - * cdef double t1,t2,t3,t4,t5,t6 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":569 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyInt_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ctr = __pyx_t_9; - __pyx_t_9.memview = NULL; - __pyx_t_9.data = NULL; + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":533 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* "View.MemoryView":567 + * return self.obj * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_3 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_11 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_11 > 0) - { - #ifdef _OPENMP - #pragma omp parallel reduction(+:__pyx_v_t1) reduction(+:__pyx_v_t2) reduction(+:__pyx_v_t3) reduction(+:__pyx_v_t4) reduction(+:__pyx_v_t5) reduction(+:__pyx_v_t6) private(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) - #endif /* _OPENMP */ - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ - { - __pyx_v_dt = (long)(0 + 1 * __pyx_t_10); - /* Initialize private variables to invalid values */ - __pyx_v_k = ((long)0xbad0bad0); - __pyx_v_mol = ((long)0xbad0bad0); - __pyx_v_point = ((long)0xbad0bad0); - __pyx_v_shellstart = ((long)0xbad0bad0); - __pyx_v_start = ((long)0xbad0bad0); - /* "src/helpers/correl.pyx":534 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ - __pyx_t_12 = __pyx_v_startingpoints; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_point = __pyx_t_14; - /* "src/helpers/correl.pyx":535 - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * start = point*startskip - * shellstart = ds[mol,start]-1 - */ - __pyx_t_15 = __pyx_v_nmol; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_mol = __pyx_t_17; +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":536 - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip # <<<<<<<<<<<<<< - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: - */ - __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":537 - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip - * shellstart = ds[mol,start]-1 # <<<<<<<<<<<<<< - * if shellstart < nshells: - * ctr[shellstart,dt] += 1 - */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds.shape[1]; - __pyx_v_shellstart = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_18 * __pyx_v_ds.strides[0]) ) + __pyx_t_19 * __pyx_v_ds.strides[1]) ))) - 1); +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/correl.pyx":538 - * start = point*startskip - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * ctr[shellstart,dt] += 1 + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< * + * raise ValueError, "Buffer view does not expose strides" */ - __pyx_t_20 = ((__pyx_v_shellstart < __pyx_v_nshells) != 0); - if (__pyx_t_20) { + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/correl.pyx":539 - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: - * ctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":575 + * if self.view.strides == NULL: * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_18 * __pyx_v_ctr.strides[1]) )) += 1.0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 575, __pyx_L1_error) - /* "src/helpers/correl.pyx":541 - * ctr[shellstart,dt] += 1 + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 # <<<<<<<<<<<<<< - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * raise ValueError, "Buffer view does not expose strides" */ - __pyx_t_21 = 0.0; - __pyx_t_22 = 0.0; - __pyx_t_23 = 0.0; - __pyx_t_24 = 0.0; - __pyx_t_25 = 0.0; - __pyx_t_26 = 0.0; - __pyx_v_t1 = __pyx_t_21; - __pyx_v_t2 = __pyx_t_22; - __pyx_v_t3 = __pyx_t_23; - __pyx_v_t4 = __pyx_t_24; - __pyx_v_t5 = __pyx_t_25; - __pyx_v_t6 = __pyx_t_26; + } - /* "src/helpers/correl.pyx":542 + /* "View.MemoryView":577 + * raise ValueError, "Buffer view does not expose strides" * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 - * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property */ - for (__pyx_t_27 = 0; __pyx_t_27 < 3; __pyx_t_27+=1) { - __pyx_v_k = __pyx_t_27; + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":543 - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] # <<<<<<<<<<<<<< - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + /* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_28 = 0; - __pyx_t_29 = __pyx_v_k; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[3]; - __pyx_t_30 = __pyx_v_mol; - __pyx_t_31 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_32 = 0; - __pyx_t_33 = __pyx_v_k; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; - __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_18 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))))); - /* "src/helpers/correl.pyx":544 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - */ - __pyx_t_33 = __pyx_v_mol; - __pyx_t_32 = __pyx_v_start; - __pyx_t_31 = 1; - __pyx_t_30 = __pyx_v_k; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; - __pyx_t_29 = __pyx_v_mol; - __pyx_t_28 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_19 = 1; - __pyx_t_18 = __pyx_v_k; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[3]; - __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_29 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_18 * __pyx_v_rotTs.strides[3]) ))))); - - /* "src/helpers/correl.pyx":545 - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_28 = 2; - __pyx_t_29 = __pyx_v_k; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[3]; - __pyx_t_30 = __pyx_v_mol; - __pyx_t_31 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_32 = 2; - __pyx_t_33 = __pyx_v_k; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; - __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_18 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))))); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":546 - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - */ - __pyx_t_33 = __pyx_v_mol; - __pyx_t_32 = __pyx_v_start; - __pyx_t_31 = 0; - __pyx_t_30 = __pyx_v_k; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; - __pyx_t_29 = __pyx_v_mol; - __pyx_t_28 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_19 = 1; - __pyx_t_18 = __pyx_v_k; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[3]; - __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_29 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_18 * __pyx_v_rotTs.strides[3]) ))))); - - /* "src/helpers/correl.pyx":547 - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart,dt] += t1 # l=1 +/* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_28 = 0; - __pyx_t_29 = __pyx_v_k; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[3]; - __pyx_t_30 = __pyx_v_mol; - __pyx_t_31 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_32 = 2; - __pyx_t_33 = __pyx_v_k; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; - __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_18 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))))); - /* "src/helpers/correl.pyx":548 - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * corr[0,shellstart,dt] += t1 # l=1 - * corr[1,shellstart,dt] += t2 - */ - __pyx_t_33 = __pyx_v_mol; - __pyx_t_32 = __pyx_v_start; - __pyx_t_31 = 1; - __pyx_t_30 = __pyx_v_k; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; - __pyx_t_29 = __pyx_v_mol; - __pyx_t_28 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_19 = 2; - __pyx_t_18 = __pyx_v_k; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[3]; - __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_29 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_18 * __pyx_v_rotTs.strides[3]) ))))); - } +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":549 - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart,dt] += t1 # l=1 # <<<<<<<<<<<<<< - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 - */ - __pyx_t_18 = 0; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += __pyx_v_t1; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":550 - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart,dt] += t1 # l=1 - * corr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 - */ - __pyx_t_28 = 1; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t2; +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/correl.pyx":551 - * corr[0,shellstart,dt] += t1 # l=1 - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * */ - __pyx_t_18 = 2; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += __pyx_v_t3; + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":552 - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_t_28 = 3; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t4; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":553 - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * */ - __pyx_t_18 = 4; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += __pyx_v_t5; + } - /* "src/helpers/correl.pyx":554 - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + /* "View.MemoryView":584 + * return (-1,) * self.view.ndim + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_28 = 5; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t6; + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":555 - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 # <<<<<<<<<<<<<< - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + /* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ - __pyx_t_18 = 6; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - /* "src/helpers/correl.pyx":556 - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - */ - __pyx_t_28 = 7; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":557 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 +/* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ - __pyx_t_18 = 8; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); - /* "src/helpers/correl.pyx":558 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 - */ - __pyx_t_28 = 9; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":559 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 - * - */ - __pyx_t_18 = 10; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_28 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":560 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":588 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< * - * for i in range(nshells): + * @property */ - __pyx_t_28 = 11; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 588, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":538 - * start = point*startskip - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * ctr[shellstart,dt] += 1 + /* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/helpers/correl.pyx":533 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":590 + * return self.view.ndim * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - /* "src/helpers/correl.pyx":562 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":592 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< * - * for i in range(nshells): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * if ctr[i,j] != 0: + * @property */ - __pyx_t_11 = __pyx_v_nshells; - __pyx_t_10 = __pyx_t_11; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_10; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":563 + /* "View.MemoryView":590 + * return self.view.ndim * - * for i in range(nshells): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * if ctr[i,j] != 0: - * for k in range(12): + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ - __pyx_t_12 = __pyx_v_maxdt; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_j = __pyx_t_14; - /* "src/helpers/correl.pyx":564 - * for i in range(nshells): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] - */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; - __pyx_t_20 = (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_18 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) ))) != 0.0) != 0); - if (__pyx_t_20) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":565 - * for j in range(maxdt): - * if ctr[i,j] != 0: - * for k in range(12): # <<<<<<<<<<<<<< - * corr[k,i,j] /= ctr[i,j] - * else: +/* "View.MemoryView":594 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize */ - for (__pyx_t_15 = 0; __pyx_t_15 < 12; __pyx_t_15+=1) { - __pyx_v_k = __pyx_t_15; - /* "src/helpers/correl.pyx":566 - * if ctr[i,j] != 0: - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] # <<<<<<<<<<<<<< - * else: - * print 'tot too sparse' - */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_18 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[1]; - __pyx_t_28 = __pyx_v_k; - __pyx_t_29 = __pyx_v_i; - __pyx_t_30 = __pyx_v_j; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_29 * __pyx_v_corr.strides[1]) ) + __pyx_t_30 * __pyx_v_corr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_18 * __pyx_v_ctr.strides[1]) ))); - } +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":564 - * for i in range(nshells): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] - */ - goto __pyx_L23; - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":568 - * corr[k,i,j] /= ctr[i,j] - * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< - * - * return corr - */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 568, __pyx_L1_error) - } - __pyx_L23:; - } - } +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/correl.pyx":570 - * print 'tot too sparse' - * - * return corr # <<<<<<<<<<<<<< + /* "View.MemoryView":596 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 570, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "src/helpers/correl.pyx":523 + /* "View.MemoryView":594 + * return self.view.itemsize * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize */ /* function exit code */ __pyx_L1_error:; - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1); - __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateTot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_corr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rotTs, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":573 +/* "View.MemoryView":598 + * return self.size * self.view.itemsize * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs1) # number of molecules - * cdef long n = len(rotTs1[0]) # number of time steps + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_19rotationMatrixShellCorrelateTotParts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_19rotationMatrixShellCorrelateTotParts = {"rotationMatrixShellCorrelateTotParts", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_19rotationMatrixShellCorrelateTotParts, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_19rotationMatrixShellCorrelateTotParts(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_rotTs1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rotTs2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rotTs3 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_v_nshells; - long __pyx_v_maxdt; - long __pyx_v_startingpoints; +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateTotParts (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs1,&__pyx_n_s_rotTs2,&__pyx_n_s_rotTs3,&__pyx_n_s_ds,&__pyx_n_s_nshells,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rotTs1)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rotTs2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 1); __PYX_ERR(0, 573, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rotTs3)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 2); __PYX_ERR(0, 573, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 3); __PYX_ERR(0, 573, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 4); __PYX_ERR(0, 573, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxdt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 5); __PYX_ERR(0, 573, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startingpoints)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 6); __PYX_ERR(0, 573, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotationMatrixShellCorrelateTotParts") < 0)) __PYX_ERR(0, 573, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - } - __pyx_v_rotTs1 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs1.memview)) __PYX_ERR(0, 573, __pyx_L3_error) - __pyx_v_rotTs2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs2.memview)) __PYX_ERR(0, 573, __pyx_L3_error) - __pyx_v_rotTs3 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs3.memview)) __PYX_ERR(0, 573, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 573, __pyx_L3_error) - __pyx_v_nshells = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_nshells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 573, __pyx_L3_error) - __pyx_v_maxdt = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 573, __pyx_L3_error) - __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 573, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 573, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateTotParts", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_6correl_18rotationMatrixShellCorrelateTotParts(__pyx_self, __pyx_v_rotTs1, __pyx_v_rotTs2, __pyx_v_rotTs3, __pyx_v_ds, __pyx_v_nshells, __pyx_v_maxdt, __pyx_v_startingpoints); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_6correl_18rotationMatrixShellCorrelateTotParts(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs1, __Pyx_memviewslice __pyx_v_rotTs2, __Pyx_memviewslice __pyx_v_rotTs3, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints) { - long __pyx_v_nmol; - long __pyx_v_n; - long __pyx_v_startskip; - __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_t1; - double __pyx_v_t2; - double __pyx_v_t3; - double __pyx_v_t4; - double __pyx_v_t5; - double __pyx_v_t6; - long __pyx_v_i; - long __pyx_v_j; - long __pyx_v_k; - long __pyx_v_start; - long __pyx_v_point; - long __pyx_v_dt; - long __pyx_v_mol; - long __pyx_v_shellstart; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_10; - long __pyx_t_11; - long __pyx_t_12; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - int __pyx_t_20; - double __pyx_t_21; - double __pyx_t_22; - double __pyx_t_23; - double __pyx_t_24; - double __pyx_t_25; - double __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateTotParts", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/correl.pyx":574 - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs1) # number of molecules # <<<<<<<<<<<<<< - * cdef long n = len(rotTs1[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 + * */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs1); - __pyx_v_nmol = ((long)__pyx_t_1); + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":575 - * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs1) # number of molecules - * cdef long n = len(rotTs1[0]) # number of time steps # <<<<<<<<<<<<<< - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints + /* "View.MemoryView":601 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< + * + * for length in self.view.shape[:self.view.ndim]: */ - __pyx_t_2.data = __pyx_v_rotTs1.data; - __pyx_t_2.memview = __pyx_v_rotTs1.memview; - __PYX_INC_MEMVIEW(&__pyx_t_2, 0); - { - Py_ssize_t __pyx_tmp_idx = 0; - Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs1.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs1.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_2.shape[0] = __pyx_v_rotTs1.shape[1]; -__pyx_t_2.strides[0] = __pyx_v_rotTs1.strides[1]; - __pyx_t_2.suboffsets[0] = -1; - -__pyx_t_2.shape[1] = __pyx_v_rotTs1.shape[2]; -__pyx_t_2.strides[1] = __pyx_v_rotTs1.strides[2]; - __pyx_t_2.suboffsets[1] = -1; - -__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - __pyx_v_n = ((long)__pyx_t_1); + __Pyx_INCREF(__pyx_int_1); + __pyx_v_result = __pyx_int_1; - /* "src/helpers/correl.pyx":577 - * cdef long n = len(rotTs1[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints # <<<<<<<<<<<<<< - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + /* "View.MemoryView":603 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length + * */ - __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); - if (unlikely(__pyx_v_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 577, __pyx_L1_error) - } - else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 577, __pyx_L1_error) - } - __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyInt_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; - /* "src/helpers/correl.pyx":578 - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries - * cdef double t1,t2,t3,t4,t5,t6 + /* "View.MemoryView":604 + * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_int_12); - __Pyx_GIVEREF(__pyx_int_12); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_12); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_corr = __pyx_t_9; - __pyx_t_9.memview = NULL; - __pyx_t_9.data = NULL; - /* "src/helpers/correl.pyx":579 - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< - * cdef double t1,t2,t3,t4,t5,t6 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* "View.MemoryView":606 + * result *= length + * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ctr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; - /* "src/helpers/correl.pyx":583 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_3 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_11 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_11 > 0) - { - #ifdef _OPENMP - #pragma omp parallel reduction(+:__pyx_v_t1) reduction(+:__pyx_v_t2) reduction(+:__pyx_v_t3) reduction(+:__pyx_v_t4) reduction(+:__pyx_v_t5) reduction(+:__pyx_v_t6) private(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) - #endif /* _OPENMP */ - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ - { - __pyx_v_dt = (long)(0 + 1 * __pyx_t_10); - /* Initialize private variables to invalid values */ - __pyx_v_mol = ((long)0xbad0bad0); - __pyx_v_point = ((long)0xbad0bad0); - __pyx_v_shellstart = ((long)0xbad0bad0); - __pyx_v_start = ((long)0xbad0bad0); + } - /* "src/helpers/correl.pyx":584 + /* "View.MemoryView":608 + * self._size = result * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip + * return self._size # <<<<<<<<<<<<<< + * + * def __len__(self): */ - __pyx_t_12 = __pyx_v_startingpoints; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_point = __pyx_t_14; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; - /* "src/helpers/correl.pyx":585 - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * start = point*startskip - * shellstart = ds[mol,start]-1 + /* "View.MemoryView":598 + * return self.size * self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ - __pyx_t_15 = __pyx_v_nmol; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_mol = __pyx_t_17; - /* "src/helpers/correl.pyx":586 - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip # <<<<<<<<<<<<<< - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: - */ - __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":587 - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip - * shellstart = ds[mol,start]-1 # <<<<<<<<<<<<<< - * if shellstart < nshells: - * ctr[shellstart,dt] += 1 +/* "View.MemoryView":610 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds.shape[1]; - __pyx_v_shellstart = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_18 * __pyx_v_ds.strides[0]) ) + __pyx_t_19 * __pyx_v_ds.strides[1]) ))) - 1); - /* "src/helpers/correl.pyx":588 - * start = point*startskip - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * ctr[shellstart,dt] += 1 +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__len__", 0); + + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] * */ - __pyx_t_20 = ((__pyx_v_shellstart < __pyx_v_nshells) != 0); - if (__pyx_t_20) { + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":589 - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: - * ctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":612 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * return 0 */ - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_18 * __pyx_v_ctr.strides[1]) )) += 1.0; + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; - /* "src/helpers/correl.pyx":591 - * ctr[shellstart,dt] += 1 + /* "View.MemoryView":611 * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 # <<<<<<<<<<<<<< + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] * - * t1 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,0] */ - __pyx_t_21 = 0.0; - __pyx_t_22 = 0.0; - __pyx_t_23 = 0.0; - __pyx_t_24 = 0.0; - __pyx_t_25 = 0.0; - __pyx_t_26 = 0.0; - __pyx_v_t1 = __pyx_t_21; - __pyx_v_t2 = __pyx_t_22; - __pyx_v_t3 = __pyx_t_23; - __pyx_v_t4 = __pyx_t_24; - __pyx_v_t5 = __pyx_t_25; - __pyx_v_t6 = __pyx_t_26; - - /* "src/helpers/correl.pyx":593 - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + } + + /* "View.MemoryView":614 + * return self.view.shape[0] * - * t1 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,0] # <<<<<<<<<<<<<< - * t2 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,1] - * t3 += rotTs1[mol,start,2]*rotTs1[mol,start+dt,2] + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_27 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs1.shape[2]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_30 = 0; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[2]; - __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_18 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_28 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs1.strides[2]) ))))); + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":594 + /* "View.MemoryView":610 + * return self._size * - * t1 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,0] - * t2 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,1] # <<<<<<<<<<<<<< - * t3 += rotTs1[mol,start,2]*rotTs1[mol,start+dt,2] - * t4 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,1] - */ - __pyx_t_30 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_28 = 1; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[2]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_18 = 1; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs1.shape[2]; - __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_30 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_27 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_18 * __pyx_v_rotTs1.strides[2]) ))))); - - /* "src/helpers/correl.pyx":595 - * t1 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,0] - * t2 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,1] - * t3 += rotTs1[mol,start,2]*rotTs1[mol,start+dt,2] # <<<<<<<<<<<<<< - * t4 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,1] - * t5 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,2] + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_27 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs1.shape[2]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_30 = 2; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[2]; - __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_18 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_28 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs1.strides[2]) ))))); - /* "src/helpers/correl.pyx":596 - * t2 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,1] - * t3 += rotTs1[mol,start,2]*rotTs1[mol,start+dt,2] - * t4 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,1] # <<<<<<<<<<<<<< - * t5 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,2] - * t6 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,2] - */ - __pyx_t_30 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_28 = 0; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[2]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_18 = 1; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs1.shape[2]; - __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_30 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_27 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_18 * __pyx_v_rotTs1.strides[2]) ))))); - - /* "src/helpers/correl.pyx":597 - * t3 += rotTs1[mol,start,2]*rotTs1[mol,start+dt,2] - * t4 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,1] - * t5 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,2] # <<<<<<<<<<<<<< - * t6 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,2] - * t1 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,0] - */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_27 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs1.shape[2]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_30 = 2; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[2]; - __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_18 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_28 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs1.strides[2]) ))))); + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":598 - * t4 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,1] - * t5 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,2] - * t6 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,2] # <<<<<<<<<<<<<< - * t1 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,0] - * t2 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,1] - */ - __pyx_t_30 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_28 = 1; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[2]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_18 = 2; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs1.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs1.shape[2]; - __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_30 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_27 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_18 * __pyx_v_rotTs1.strides[2]) ))))); - - /* "src/helpers/correl.pyx":599 - * t5 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,2] - * t6 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,2] - * t1 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,0] # <<<<<<<<<<<<<< - * t2 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,1] - * t3 += rotTs2[mol,start,2]*rotTs2[mol,start+dt,2] +/* "View.MemoryView":616 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_27 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs2.shape[2]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_30 = 0; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[2]; - __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_18 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_28 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs2.strides[2]) ))))); - /* "src/helpers/correl.pyx":600 - * t6 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,2] - * t1 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,0] - * t2 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,1] # <<<<<<<<<<<<<< - * t3 += rotTs2[mol,start,2]*rotTs2[mol,start+dt,2] - * t4 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,1] - */ - __pyx_t_30 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_28 = 1; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[2]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_18 = 1; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs2.shape[2]; - __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_30 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_27 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_18 * __pyx_v_rotTs2.strides[2]) ))))); - - /* "src/helpers/correl.pyx":601 - * t1 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,0] - * t2 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,1] - * t3 += rotTs2[mol,start,2]*rotTs2[mol,start+dt,2] # <<<<<<<<<<<<<< - * t4 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,1] - * t5 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,2] - */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_27 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs2.shape[2]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_30 = 2; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[2]; - __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_18 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_28 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs2.strides[2]) ))))); +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":602 - * t2 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,1] - * t3 += rotTs2[mol,start,2]*rotTs2[mol,start+dt,2] - * t4 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,1] # <<<<<<<<<<<<<< - * t5 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,2] - * t6 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,2] - */ - __pyx_t_30 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_28 = 0; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[2]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_18 = 1; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs2.shape[2]; - __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_30 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_27 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_18 * __pyx_v_rotTs2.strides[2]) ))))); - - /* "src/helpers/correl.pyx":603 - * t3 += rotTs2[mol,start,2]*rotTs2[mol,start+dt,2] - * t4 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,1] - * t5 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,2] # <<<<<<<<<<<<<< - * t6 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,2] - * t1 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,0] - */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_27 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs2.shape[2]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_30 = 2; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[2]; - __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_18 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_28 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs2.strides[2]) ))))); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":604 - * t4 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,1] - * t5 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,2] - * t6 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,2] # <<<<<<<<<<<<<< - * t1 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,0] - * t2 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,1] - */ - __pyx_t_30 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_28 = 1; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[2]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_18 = 2; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs2.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs2.shape[2]; - __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_30 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_27 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_18 * __pyx_v_rotTs2.strides[2]) ))))); - - /* "src/helpers/correl.pyx":605 - * t5 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,2] - * t6 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,2] - * t1 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,0] # <<<<<<<<<<<<<< - * t2 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,1] - * t3 += rotTs3[mol,start,2]*rotTs3[mol,start+dt,2] - */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_27 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs3.shape[2]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_30 = 0; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[2]; - __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_18 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_28 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs3.strides[2]) ))))); +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/helpers/correl.pyx":606 - * t6 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,2] - * t1 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,0] - * t2 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,1] # <<<<<<<<<<<<<< - * t3 += rotTs3[mol,start,2]*rotTs3[mol,start+dt,2] - * t4 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,1] - */ - __pyx_t_30 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_28 = 1; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[2]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_18 = 1; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs3.shape[2]; - __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_30 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_27 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_18 * __pyx_v_rotTs3.strides[2]) ))))); - - /* "src/helpers/correl.pyx":607 - * t1 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,0] - * t2 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,1] - * t3 += rotTs3[mol,start,2]*rotTs3[mol,start+dt,2] # <<<<<<<<<<<<<< - * t4 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,1] - * t5 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,2] + /* "View.MemoryView":617 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_27 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs3.shape[2]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_30 = 2; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[2]; - __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_18 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_28 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs3.strides[2]) ))))); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":608 - * t2 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,1] - * t3 += rotTs3[mol,start,2]*rotTs3[mol,start+dt,2] - * t4 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,1] # <<<<<<<<<<<<<< - * t5 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,2] - * t6 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,2] - */ - __pyx_t_30 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_28 = 0; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[2]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_18 = 1; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs3.shape[2]; - __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_30 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_27 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_18 * __pyx_v_rotTs3.strides[2]) ))))); - - /* "src/helpers/correl.pyx":609 - * t3 += rotTs3[mol,start,2]*rotTs3[mol,start+dt,2] - * t4 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,1] - * t5 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,2] # <<<<<<<<<<<<<< - * t6 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,2] + /* "View.MemoryView":618 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< * + * def __str__(self): */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_27 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs3.shape[2]; - __pyx_t_28 = __pyx_v_mol; - __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_30 = 2; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[2]; - __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_18 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_28 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs3.strides[2]) ))))); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "src/helpers/correl.pyx":610 - * t4 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,1] - * t5 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,2] - * t6 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,2] # <<<<<<<<<<<<<< + /* "View.MemoryView":617 * - * corr[0,shellstart,dt] += t1 # l=1 - */ - __pyx_t_30 = __pyx_v_mol; - __pyx_t_29 = __pyx_v_start; - __pyx_t_28 = 1; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[2]; - __pyx_t_27 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_18 = 2; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs3.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs3.shape[2]; - __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_30 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_27 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_18 * __pyx_v_rotTs3.strides[2]) ))))); - - /* "src/helpers/correl.pyx":612 - * t6 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,2] + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) * - * corr[0,shellstart,dt] += t1 # l=1 # <<<<<<<<<<<<<< - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 */ - __pyx_t_18 = 0; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_27 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_27 * __pyx_v_corr.strides[2]) )) += __pyx_v_t1; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":613 + /* "View.MemoryView":616 + * return 0 * - * corr[0,shellstart,dt] += t1 # l=1 - * corr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 - */ - __pyx_t_27 = 1; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_27 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t2; - - /* "src/helpers/correl.pyx":614 - * corr[0,shellstart,dt] += t1 # l=1 - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 - */ - __pyx_t_18 = 2; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_27 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_27 * __pyx_v_corr.strides[2]) )) += __pyx_v_t3; - - /* "src/helpers/correl.pyx":615 - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 - */ - __pyx_t_27 = 3; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_27 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t4; - - /* "src/helpers/correl.pyx":616 - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ - __pyx_t_18 = 4; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_27 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_27 * __pyx_v_corr.strides[2]) )) += __pyx_v_t5; - /* "src/helpers/correl.pyx":617 - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - */ - __pyx_t_27 = 5; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_27 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t6; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":618 - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 # <<<<<<<<<<<<<< - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 +/* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * */ - __pyx_t_18 = 6; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_27 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_27 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - /* "src/helpers/correl.pyx":619 - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - */ - __pyx_t_27 = 7; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_27 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":620 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 - */ - __pyx_t_18 = 8; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_27 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_27 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":621 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 - */ - __pyx_t_27 = 9; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_27 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); - /* "src/helpers/correl.pyx":622 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":621 * - */ - __pyx_t_18 = 10; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_27 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_27 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); - - /* "src/helpers/correl.pyx":623 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< * - * for i in range(nshells): - */ - __pyx_t_27 = 11; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_27 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); - - /* "src/helpers/correl.pyx":588 - * start = point*startskip - * shellstart = ds[mol,start]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * ctr[shellstart,dt] += 1 * */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":583 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* "View.MemoryView":620 + * id(self)) * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "src/helpers/correl.pyx":625 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) * - * for i in range(nshells): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * if ctr[i,j] != 0: */ - __pyx_t_11 = __pyx_v_nshells; - __pyx_t_10 = __pyx_t_11; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_10; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - /* "src/helpers/correl.pyx":626 - * - * for i in range(nshells): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * if ctr[i,j] != 0: - * for k in range(12): - */ - __pyx_t_12 = __pyx_v_maxdt; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_j = __pyx_t_14; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":627 - * for i in range(nshells): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] +/* "View.MemoryView":624 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; - __pyx_t_20 = (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_18 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) ))) != 0.0) != 0); - if (__pyx_t_20) { - /* "src/helpers/correl.pyx":628 - * for j in range(maxdt): - * if ctr[i,j] != 0: - * for k in range(12): # <<<<<<<<<<<<<< - * corr[k,i,j] /= ctr[i,j] - * else: - */ - for (__pyx_t_15 = 0; __pyx_t_15 < 12; __pyx_t_15+=1) { - __pyx_v_k = __pyx_t_15; +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 624, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_c_contig", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":629 - * if ctr[i,j] != 0: - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] # <<<<<<<<<<<<<< - * else: - * print 'tot too sparse' - */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_18 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[1]; - __pyx_t_27 = __pyx_v_k; - __pyx_t_28 = __pyx_v_i; - __pyx_t_29 = __pyx_v_j; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[0]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[1]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_27 * __pyx_v_corr.strides[0]) ) + __pyx_t_28 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_18 * __pyx_v_ctr.strides[1]) ))); - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":627 - * for i in range(nshells): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] - */ - goto __pyx_L21; - } +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); - /* "src/helpers/correl.pyx":631 - * corr[k,i,j] /= ctr[i,j] - * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< + /* "View.MemoryView":627 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * - * return corr */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 631, __pyx_L1_error) - } - __pyx_L21:; - } - } + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 627, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/helpers/correl.pyx":633 - * print 'tot too sparse' - * - * return corr # <<<<<<<<<<<<<< - * + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< * + * def is_f_contig(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "src/helpers/correl.pyx":573 + /* "View.MemoryView":624 * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs1) # number of molecules - * cdef long n = len(rotTs1[0]) # number of time steps + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* function exit code */ __pyx_L1_error:; - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1); - __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateTotParts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_corr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rotTs1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rotTs2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rotTs3, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":637 +/* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * - * @cython.boundscheck(False) - * def vectorRotation(double [:,:] rotTs, int datapoints): # <<<<<<<<<<<<<< - * # cdef long datapoints = len(rotTs) - * cdef double [:,:] corr = np.zeros((2,datapoints)) + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_21vectorRotation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_21vectorRotation = {"vectorRotation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_21vectorRotation, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_21vectorRotation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_datapoints; +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("vectorRotation (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_datapoints,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rotTs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_datapoints)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vectorRotation", 1, 2, 2, 1); __PYX_ERR(0, 637, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vectorRotation") < 0)) __PYX_ERR(0, 637, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 637, __pyx_L3_error) - __pyx_v_datapoints = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_datapoints == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 637, __pyx_L3_error) - } + __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 630, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_f_contig", 0))) return NULL; goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("vectorRotation", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 637, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.vectorRotation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_6correl_20vectorRotation(__pyx_self, __pyx_v_rotTs, __pyx_v_datapoints); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_20vectorRotation(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, int __pyx_v_datapoints) { - __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_t; - long __pyx_v_i; - long __pyx_v_k; - long __pyx_v_start; - long __pyx_v_dt; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + __Pyx_memviewslice *__pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_6; - long __pyx_t_7; - long __pyx_t_8; - long __pyx_t_9; - long __pyx_t_10; - long __pyx_t_11; - long __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - int __pyx_t_17; - double __pyx_t_18; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("vectorRotation", 0); + __Pyx_RefNannySetupContext("is_f_contig", 0); - /* "src/helpers/correl.pyx":639 - * def vectorRotation(double [:,:] rotTs, int datapoints): - * # cdef long datapoints = len(rotTs) - * cdef double [:,:] corr = np.zeros((2,datapoints)) # <<<<<<<<<<<<<< - * cdef double t - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* "View.MemoryView":633 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_datapoints); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 633, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; + + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * + * def copy(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __pyx_r = __pyx_t_2; __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_corr = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + goto __pyx_L0; - /* "src/helpers/correl.pyx":643 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * - * for dt in prange(datapoints,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(datapoints-dt): # loop over all possible interval start points - * t = 0 + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_6 = __pyx_v_datapoints; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_8 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_8 > 0) - { - #ifdef _OPENMP - #pragma omp parallel reduction(+:__pyx_v_t) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_start) - #endif /* _OPENMP */ - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ - { - __pyx_v_dt = (long)(0 + 1 * __pyx_t_7); - /* Initialize private variables to invalid values */ - __pyx_v_k = ((long)0xbad0bad0); - __pyx_v_start = ((long)0xbad0bad0); - /* "src/helpers/correl.pyx":644 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * - * for dt in prange(datapoints,nogil=True,schedule=dynamic): # loop over all delta t - * for start in range(datapoints-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< - * t = 0 - * for k in range(3): # skalar produkt + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ - __pyx_t_9 = (__pyx_v_datapoints - __pyx_v_dt); - __pyx_t_10 = __pyx_t_9; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_start = __pyx_t_11; - /* "src/helpers/correl.pyx":645 - * for dt in prange(datapoints,nogil=True,schedule=dynamic): # loop over all delta t - * for start in range(datapoints-dt): # loop over all possible interval start points - * t = 0 # <<<<<<<<<<<<<< - * for k in range(3): # skalar produkt - * t += rotTs[start,k]*rotTs[start+dt,k] +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 636, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":638 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &mslice) */ - __pyx_v_t = 0.0; + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - /* "src/helpers/correl.pyx":646 - * for start in range(datapoints-dt): # loop over all possible interval start points - * t = 0 - * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< - * t += rotTs[start,k]*rotTs[start+dt,k] - * corr[0,dt] += t # l=1 + /* "View.MemoryView":640 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, */ - for (__pyx_t_12 = 0; __pyx_t_12 < 3; __pyx_t_12+=1) { - __pyx_v_k = __pyx_t_12; + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - /* "src/helpers/correl.pyx":647 - * t = 0 - * for k in range(3): # skalar produkt - * t += rotTs[start,k]*rotTs[start+dt,k] # <<<<<<<<<<<<<< - * corr[0,dt] += t # l=1 - * corr[1,dt] += 1.5*t*t-0.5 # l=2 + /* "View.MemoryView":641 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, */ - __pyx_t_13 = __pyx_v_start; - __pyx_t_14 = __pyx_v_k; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_rotTs.shape[1]; - __pyx_t_15 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_16 = __pyx_v_k; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_rotTs.shape[1]; - __pyx_v_t = (__pyx_v_t + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_13 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_14 * __pyx_v_rotTs.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_15 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_16 * __pyx_v_rotTs.strides[1]) ))))); - } + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 641, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/helpers/correl.pyx":648 - * for k in range(3): # skalar produkt - * t += rotTs[start,k]*rotTs[start+dt,k] - * corr[0,dt] += t # l=1 # <<<<<<<<<<<<<< - * corr[1,dt] += 1.5*t*t-0.5 # l=2 - * for i in range(datapoints): + /* "View.MemoryView":646 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * + * def copy_fortran(self): */ - __pyx_t_16 = 0; - __pyx_t_15 = __pyx_v_dt; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_16 * __pyx_v_corr.strides[0]) ) + __pyx_t_15 * __pyx_v_corr.strides[1]) )) += __pyx_v_t; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":649 - * t += rotTs[start,k]*rotTs[start+dt,k] - * corr[0,dt] += t # l=1 - * corr[1,dt] += 1.5*t*t-0.5 # l=2 # <<<<<<<<<<<<<< - * for i in range(datapoints): - * corr[0,i] = corr[0,i] / (datapoints-i) + /* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ - __pyx_t_15 = 1; - __pyx_t_16 = __pyx_v_dt; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_15 * __pyx_v_corr.strides[0]) ) + __pyx_t_16 * __pyx_v_corr.strides[1]) )) += (((1.5 * __pyx_v_t) * __pyx_v_t) - 0.5); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/helpers/correl.pyx":643 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) * - * for dt in prange(datapoints,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(datapoints-dt): # loop over all possible interval start points - * t = 0 + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - /* "src/helpers/correl.pyx":650 - * corr[0,dt] += t # l=1 - * corr[1,dt] += 1.5*t*t-0.5 # l=2 - * for i in range(datapoints): # <<<<<<<<<<<<<< - * corr[0,i] = corr[0,i] / (datapoints-i) - * corr[1,i] = corr[1,i] / (datapoints-i) +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 648, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy_fortran", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":650 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) */ - __pyx_t_6 = __pyx_v_datapoints; - __pyx_t_17 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_17; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - /* "src/helpers/correl.pyx":651 - * corr[1,dt] += 1.5*t*t-0.5 # l=2 - * for i in range(datapoints): - * corr[0,i] = corr[0,i] / (datapoints-i) # <<<<<<<<<<<<<< - * corr[1,i] = corr[1,i] / (datapoints-i) - * return corr + /* "View.MemoryView":652 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, */ - __pyx_t_16 = 0; - __pyx_t_15 = __pyx_v_i; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[1]; - __pyx_t_18 = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_16 * __pyx_v_corr.strides[0]) ) + __pyx_t_15 * __pyx_v_corr.strides[1]) ))); - __pyx_t_7 = (__pyx_v_datapoints - __pyx_v_i); - if (unlikely(__pyx_t_7 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 651, __pyx_L1_error) - } - __pyx_t_15 = 0; - __pyx_t_16 = __pyx_v_i; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_15 * __pyx_v_corr.strides[0]) ) + __pyx_t_16 * __pyx_v_corr.strides[1]) )) = (__pyx_t_18 / __pyx_t_7); + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); - /* "src/helpers/correl.pyx":652 - * for i in range(datapoints): - * corr[0,i] = corr[0,i] / (datapoints-i) - * corr[1,i] = corr[1,i] / (datapoints-i) # <<<<<<<<<<<<<< - * return corr + /* "View.MemoryView":653 * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, */ - __pyx_t_16 = 1; - __pyx_t_15 = __pyx_v_i; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[1]; - __pyx_t_18 = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_16 * __pyx_v_corr.strides[0]) ) + __pyx_t_15 * __pyx_v_corr.strides[1]) ))); - __pyx_t_7 = (__pyx_v_datapoints - __pyx_v_i); - if (unlikely(__pyx_t_7 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 652, __pyx_L1_error) - } - __pyx_t_15 = 1; - __pyx_t_16 = __pyx_v_i; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_15 * __pyx_v_corr.strides[0]) ) + __pyx_t_16 * __pyx_v_corr.strides[1]) )) = (__pyx_t_18 / __pyx_t_7); - } + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 653, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; - /* "src/helpers/correl.pyx":653 - * corr[0,i] = corr[0,i] / (datapoints-i) - * corr[1,i] = corr[1,i] / (datapoints-i) - * return corr # <<<<<<<<<<<<<< + /* "View.MemoryView":658 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_corr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "src/helpers/correl.pyx":637 + /* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) * - * @cython.boundscheck(False) - * def vectorRotation(double [:,:] rotTs, int datapoints): # <<<<<<<<<<<<<< - * # cdef long datapoints = len(rotTs) - * cdef double [:,:] corr = np.zeros((2,datapoints)) + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __Pyx_AddTraceback("newanalysis.correl.vectorRotation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_corr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rotTs, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":656 - * - * @cython.boundscheck(False) - * def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_23sparsefullnobulkthincorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_23sparsefullnobulkthincorrelate = {"sparsefullnobulkthincorrelate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_23sparsefullnobulkthincorrelate, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_23sparsefullnobulkthincorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_pdata = 0; - int __pyx_v_pcorrdim; - PyArrayObject *__pyx_v_pds = 0; - int __pyx_v_pnshells; - PyObject *__pyx_v_maxlen = 0; - PyObject *__pyx_v_startingpoints = 0; +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sparsefullnobulkthincorrelate (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_pcorrdim,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,&__pyx_n_s_startingpoints,0}; - PyObject* values[6] = {0,0,0,0,0,0}; + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":660 - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, - * maxlen=None, # <<<<<<<<<<<<<< - * startingpoints=None): - * + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - values[4] = ((PyObject *)Py_None); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "src/helpers/correl.pyx":661 - * int pnshells, - * maxlen=None, - * startingpoints=None): # <<<<<<<<<<<<<< - * - * cdef long corrdim = pcorrdim + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - values[5] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pdata)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pcorrdim)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthincorrelate", 0, 4, 6, 1); __PYX_ERR(0, 656, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthincorrelate", 0, 4, 6, 2); __PYX_ERR(0, 656, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pnshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthincorrelate", 0, 4, 6, 3); __PYX_ERR(0, 656, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[4] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 5: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startingpoints); - if (value) { values[5] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sparsefullnobulkthincorrelate") < 0)) __PYX_ERR(0, 656, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_pdata = ((PyArrayObject *)values[0]); - __pyx_v_pcorrdim = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_pcorrdim == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 657, __pyx_L3_error) - __pyx_v_pds = ((PyArrayObject *)values[2]); - __pyx_v_pnshells = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 659, __pyx_L3_error) - __pyx_v_maxlen = values[4]; - __pyx_v_startingpoints = values[5]; + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthincorrelate", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 656, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkthincorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 656, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 658, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_22sparsefullnobulkthincorrelate(__pyx_self, __pyx_v_pdata, __pyx_v_pcorrdim, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen, __pyx_v_startingpoints); + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state); - /* "src/helpers/correl.pyx":656 - * - * @cython.boundscheck(False) - * def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_22sparsefullnobulkthincorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_startingpoints) { - long __pyx_v_corrdim; - long __pyx_v_nmol; - long __pyx_v_n; - long __pyx_v_nds; - long __pyx_v_maxdt; - long __pyx_v_nshells; - long __pyx_v_startskip; - long __pyx_v_startmax; - PyArrayObject *__pyx_v_contdata = 0; - PyArrayObject *__pyx_v_contds = 0; - double *__pyx_v_cdata; - int *__pyx_v_cds; - PyObject *__pyx_v_pcorr = NULL; - PyObject *__pyx_v_pselfcorr = NULL; - PyObject *__pyx_v_pcrosscorr = NULL; - PyArrayObject *__pyx_v_corr = 0; - PyArrayObject *__pyx_v_selfcorr = 0; - PyArrayObject *__pyx_v_crosscorr = 0; - PyArrayObject *__pyx_v_ctr = 0; - PyArrayObject *__pyx_v_selfctr = 0; - PyArrayObject *__pyx_v_crossctr = 0; - double *__pyx_v_ccorr; - double *__pyx_v_cselfcorr; - double *__pyx_v_ccrosscorr; - double *__pyx_v_cctr; - double *__pyx_v_cselfctr; - double *__pyx_v_ccrossctr; - double __pyx_v_value; - long __pyx_v_i; - long __pyx_v_start; - long __pyx_v_dt; - long __pyx_v_mol; - long __pyx_v_shellstart; - long __pyx_v_shelldt; - long __pyx_v_idx; - long __pyx_v_dim; - long __pyx_v_validx; - long __pyx_v_dsidx; - long __pyx_v_istart; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; - __Pyx_Buffer __pyx_pybuffer_contdata; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; - __Pyx_Buffer __pyx_pybuffer_contds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; - __Pyx_Buffer __pyx_pybuffer_corr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_crosscorr; - __Pyx_Buffer __pyx_pybuffer_crosscorr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_crossctr; - __Pyx_Buffer __pyx_pybuffer_crossctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; - __Pyx_Buffer __pyx_pybuffer_pdata; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; - __Pyx_Buffer __pyx_pybuffer_pds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_selfcorr; - __Pyx_Buffer __pyx_pybuffer_selfcorr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_selfctr; - __Pyx_Buffer __pyx_pybuffer_selfctr; +/* "View.MemoryView":662 + * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + */ + +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - long __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - long __pyx_t_18; - long __pyx_t_19; - long __pyx_t_20; - int __pyx_t_21; - long __pyx_t_22; - long __pyx_t_23; - long __pyx_t_24; - long __pyx_t_25; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sparsefullnobulkthincorrelate", 0); - __pyx_pybuffer_contdata.pybuffer.buf = NULL; - __pyx_pybuffer_contdata.refcount = 0; - __pyx_pybuffernd_contdata.data = NULL; - __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; - __pyx_pybuffer_contds.pybuffer.buf = NULL; - __pyx_pybuffer_contds.refcount = 0; - __pyx_pybuffernd_contds.data = NULL; - __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; - __pyx_pybuffer_corr.pybuffer.buf = NULL; - __pyx_pybuffer_corr.refcount = 0; - __pyx_pybuffernd_corr.data = NULL; - __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; - __pyx_pybuffer_selfcorr.pybuffer.buf = NULL; - __pyx_pybuffer_selfcorr.refcount = 0; - __pyx_pybuffernd_selfcorr.data = NULL; - __pyx_pybuffernd_selfcorr.rcbuffer = &__pyx_pybuffer_selfcorr; - __pyx_pybuffer_crosscorr.pybuffer.buf = NULL; - __pyx_pybuffer_crosscorr.refcount = 0; - __pyx_pybuffernd_crosscorr.data = NULL; - __pyx_pybuffernd_crosscorr.rcbuffer = &__pyx_pybuffer_crosscorr; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_selfctr.pybuffer.buf = NULL; - __pyx_pybuffer_selfctr.refcount = 0; - __pyx_pybuffernd_selfctr.data = NULL; - __pyx_pybuffernd_selfctr.rcbuffer = &__pyx_pybuffer_selfctr; - __pyx_pybuffer_crossctr.pybuffer.buf = NULL; - __pyx_pybuffer_crossctr.refcount = 0; - __pyx_pybuffernd_crossctr.data = NULL; - __pyx_pybuffernd_crossctr.rcbuffer = &__pyx_pybuffer_crossctr; - __pyx_pybuffer_pdata.pybuffer.buf = NULL; - __pyx_pybuffer_pdata.refcount = 0; - __pyx_pybuffernd_pdata.data = NULL; - __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; - __pyx_pybuffer_pds.pybuffer.buf = NULL; - __pyx_pybuffer_pds.refcount = 0; - __pyx_pybuffernd_pds.data = NULL; - __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 656, __pyx_L1_error) - } - __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 656, __pyx_L1_error) - } - __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - /* "src/helpers/correl.pyx":663 - * startingpoints=None): + /* "View.MemoryView":663 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result + */ + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":664 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result * - * cdef long corrdim = pcorrdim # <<<<<<<<<<<<<< - * cdef long nmol = len(pdata)/pcorrdim # number of molecules - * cdef long n = len(pdata[0]) # number of time steps */ - __pyx_v_corrdim = ((long)__pyx_v_pcorrdim); + __pyx_v_result->typeinfo = __pyx_v_typeinfo; - /* "src/helpers/correl.pyx":664 + /* "View.MemoryView":665 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< * - * cdef long corrdim = pcorrdim - * cdef long nmol = len(pdata)/pcorrdim # number of molecules # <<<<<<<<<<<<<< - * cdef long n = len(pdata[0]) # number of time steps - * cdef long nds = len(pds[0]) # number of steps in delaunay array + * @cname('__pyx_memoryview_check') */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 664, __pyx_L1_error) - __pyx_t_2 = ((long)__pyx_t_1); - if (unlikely(__pyx_v_pcorrdim == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 664, __pyx_L1_error) - } - else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_pcorrdim == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 664, __pyx_L1_error) - } - __pyx_v_nmol = __Pyx_div_long(__pyx_t_2, __pyx_v_pcorrdim); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "src/helpers/correl.pyx":665 - * cdef long corrdim = pcorrdim - * cdef long nmol = len(pdata)/pcorrdim # number of molecules - * cdef long n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< - * cdef long nds = len(pds[0]) # number of steps in delaunay array - * cdef long maxdt = maxlen + /* "View.MemoryView":662 + * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 665, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 665, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_n = ((long)__pyx_t_1); - /* "src/helpers/correl.pyx":666 - * cdef long nmol = len(pdata)/pcorrdim # number of molecules - * cdef long n = len(pdata[0]) # number of time steps - * cdef long nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< - * cdef long maxdt = maxlen - * cdef long nshells = pnshells + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":668 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) + * */ - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 666, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 666, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_nds = ((long)__pyx_t_1); - /* "src/helpers/correl.pyx":667 - * cdef long n = len(pdata[0]) # number of time steps - * cdef long nds = len(pds[0]) # number of steps in delaunay array - * cdef long maxdt = maxlen # <<<<<<<<<<<<<< - * cdef long nshells = pnshells - * cdef long startskip = (n-maxdt)/startingpoints +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("memoryview_check", 0); + + /* "View.MemoryView":669 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): */ - __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_v_maxlen); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 667, __pyx_L1_error) - __pyx_v_maxdt = ((long)__pyx_t_2); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; - /* "src/helpers/correl.pyx":668 - * cdef long nds = len(pds[0]) # number of steps in delaunay array - * cdef long maxdt = maxlen - * cdef long nshells = pnshells # <<<<<<<<<<<<<< - * cdef long startskip = (n-maxdt)/startingpoints - * cdef long startmax = (n-maxdt)/startskip + /* "View.MemoryView":668 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) + * */ - __pyx_v_nshells = ((long)__pyx_v_pnshells); - /* "src/helpers/correl.pyx":669 - * cdef long maxdt = maxlen - * cdef long nshells = pnshells - * cdef long startskip = (n-maxdt)/startingpoints # <<<<<<<<<<<<<< - * cdef long startmax = (n-maxdt)/startskip - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":671 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with */ - __pyx_t_3 = __Pyx_PyInt_From_long(((long)(__pyx_v_n - __pyx_v_maxdt))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 669, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_startingpoints); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 669, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_startskip = __pyx_t_2; - /* "src/helpers/correl.pyx":670 - * cdef long nshells = pnshells - * cdef long startskip = (n-maxdt)/startingpoints - * cdef long startmax = (n-maxdt)/startskip # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_UCS4 __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":677 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< + * + * result = [slice(None)] * ndim */ - __pyx_t_2 = (__pyx_v_n - __pyx_v_maxdt); - if (unlikely(__pyx_v_startskip == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 670, __pyx_L1_error) - } - else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startskip == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 670, __pyx_L1_error) + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index)) __PYX_ERR(1, 677, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; } - __pyx_v_startmax = __Pyx_div_long(__pyx_t_2, __pyx_v_startskip); + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":671 - * cdef long startskip = (n-maxdt)/startingpoints - * cdef long startmax = (n-maxdt)/startskip - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_v_pdata)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_pdata)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 671, __pyx_L1_error) - __pyx_t_6 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 671, __pyx_L1_error) - } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error); } } - __pyx_t_6 = 0; - __pyx_v_contdata = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":672 - * cdef long startmax = (n-maxdt)/startskip - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data + /* "View.MemoryView":680 + * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, ((PyObject *)__pyx_v_pds)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pds)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 672, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 672, __pyx_L1_error) - } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_7 = 0; - __pyx_v_contds = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_have_slices = 0; - /* "src/helpers/correl.pyx":673 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":681 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: */ - __pyx_v_cdata = ((double *)__pyx_v_contdata->data); + __pyx_v_seen_ellipsis = 0; - /* "src/helpers/correl.pyx":674 - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data # <<<<<<<<<<<<<< - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":682 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: */ - __pyx_v_cds = ((int *)__pyx_v_contds->data); + __pyx_v_idx = 0; - /* "src/helpers/correl.pyx":675 - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_pcorr = __pyx_t_9; - __pyx_t_9 = 0; + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 683, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; + for (;;) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 683, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/correl.pyx":676 - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __pyx_t_9 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_pselfcorr = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":677 - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_pcrosscorr = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":678 - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + /* "View.MemoryView":686 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True */ - if (!(likely(((__pyx_v_pcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 678, __pyx_L1_error) - __pyx_t_9 = __pyx_v_pcorr; - __Pyx_INCREF(__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_9), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 678, __pyx_L1_error) - } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_v_corr = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 686, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 686, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); - /* "src/helpers/correl.pyx":679 - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":687 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: */ - if (!(likely(((__pyx_v_pselfcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pselfcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 679, __pyx_L1_error) - __pyx_t_9 = __pyx_v_pselfcorr; - __Pyx_INCREF(__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_9), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_selfcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 679, __pyx_L1_error) - } else {__pyx_pybuffernd_selfcorr.diminfo[0].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfcorr.diminfo[0].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfcorr.diminfo[1].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfcorr.diminfo[1].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_v_selfcorr = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + __pyx_v_seen_ellipsis = 1; - /* "src/helpers/correl.pyx":680 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True */ - if (!(likely(((__pyx_v_pcrosscorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcrosscorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 680, __pyx_L1_error) - __pyx_t_9 = __pyx_v_pcrosscorr; - __Pyx_INCREF(__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_9), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_crosscorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 680, __pyx_L1_error) - } else {__pyx_pybuffernd_crosscorr.diminfo[0].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crosscorr.diminfo[0].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crosscorr.diminfo[1].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crosscorr.diminfo[1].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_v_crosscorr = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + } - /* "src/helpers/correl.pyx":681 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":688 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __pyx_t_9 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 681, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 681, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 681, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_10 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_have_slices = 1; - /* "src/helpers/correl.pyx":682 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 682, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_selfctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 682, __pyx_L1_error) - } else {__pyx_pybuffernd_selfctr.diminfo[0].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfctr.diminfo[0].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfctr.diminfo[1].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfctr.diminfo[1].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[1]; + goto __pyx_L5; } - } - __pyx_t_11 = 0; - __pyx_v_selfctr = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; - /* "src/helpers/correl.pyx":683 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __pyx_t_9 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 683, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_crossctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 683, __pyx_L1_error) - } else {__pyx_pybuffernd_crossctr.diminfo[0].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crossctr.diminfo[0].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crossctr.diminfo[1].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crossctr.diminfo[1].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_12 = 0; - __pyx_v_crossctr = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":684 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data + /* "View.MemoryView":691 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" */ - __pyx_v_ccorr = ((double *)__pyx_v_corr->data); + __pyx_v_have_slices = 1; - /* "src/helpers/correl.pyx":685 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data # <<<<<<<<<<<<<< - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): */ - __pyx_v_cselfcorr = ((double *)__pyx_v_selfcorr->data); + goto __pyx_L7; + } - /* "src/helpers/correl.pyx":686 - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data # <<<<<<<<<<<<<< - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + */ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":693 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = 127; + __Pyx_INCREF(__pyx_kp_u_Cannot_index_with_type); + __pyx_t_5 += 24; + __Pyx_GIVEREF(__pyx_kp_u_Cannot_index_with_type); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Cannot_index_with_type); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_5 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__6); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 693, __pyx_L1_error) + + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item */ - __pyx_v_ccrosscorr = ((double *)__pyx_v_crosscorr->data); + } + __pyx_L7:; - /* "src/helpers/correl.pyx":687 - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< - * cdef double *cselfctr = selfctr.data - * cdef double *ccrossctr = crossctr.data + /* "View.MemoryView":694 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 + * */ - __pyx_v_cctr = ((double *)__pyx_v_ctr->data); + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0))) __PYX_ERR(1, 694, __pyx_L1_error) + } + __pyx_L5:; - /* "src/helpers/correl.pyx":688 - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data # <<<<<<<<<<<<<< - * cdef double *ccrossctr = crossctr.data - * cdef double value + /* "View.MemoryView":695 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx */ - __pyx_v_cselfctr = ((double *)__pyx_v_selfctr->data); + __pyx_v_idx = (__pyx_v_idx + 1); - /* "src/helpers/correl.pyx":689 - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data - * cdef double *ccrossctr = crossctr.data # <<<<<<<<<<<<<< - * cdef double value - * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: */ - __pyx_v_ccrossctr = ((double *)__pyx_v_crossctr->data); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/correl.pyx":693 - * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart + /* "View.MemoryView":697 + * idx += 1 + * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for istart in range(startmax): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_2 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_14 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_14 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dim) lastprivate(__pyx_v_dsidx) firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_istart) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_validx) lastprivate(__pyx_v_value) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ - { - __pyx_v_dt = (long)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_dim = ((long)0xbad0bad0); - __pyx_v_dsidx = ((long)0xbad0bad0); - __pyx_v_idx = ((long)0xbad0bad0); - __pyx_v_istart = ((long)0xbad0bad0); - __pyx_v_mol = ((long)0xbad0bad0); - __pyx_v_shelldt = ((long)0xbad0bad0); - __pyx_v_shellstart = ((long)0xbad0bad0); - __pyx_v_start = ((long)0xbad0bad0); - __pyx_v_validx = ((long)0xbad0bad0); - __pyx_v_value = ((double)__PYX_NAN()); + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); - /* "src/helpers/correl.pyx":694 + /* "View.MemoryView":698 * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for istart in range(startmax): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * start = istart*startskip + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: */ - __pyx_t_15 = __pyx_v_startmax; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_istart = __pyx_t_17; + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 698, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":695 - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for istart in range(startmax): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * start = istart*startskip - * dsidx = mol*nds+start + /* "View.MemoryView":671 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with */ - __pyx_t_18 = __pyx_v_nmol; - __pyx_t_19 = __pyx_t_18; - for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { - __pyx_v_mol = __pyx_t_20; - /* "src/helpers/correl.pyx":696 - * for istart in range(startmax): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * start = istart*startskip # <<<<<<<<<<<<<< - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 - */ - __pyx_v_start = (__pyx_v_istart * __pyx_v_startskip); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/correl.pyx":697 - * for mol in range(nmol): # loop over molecules/entries - * start = istart*startskip - * dsidx = mol*nds+start # <<<<<<<<<<<<<< - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: +/* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: */ - __pyx_v_dsidx = ((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start); - /* "src/helpers/correl.pyx":698 - * start = istart*startskip - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 # <<<<<<<<<<<<<< - * if shellstart < nshells: - * shelldt = cds[dsidx+dt]-1 - */ - __pyx_v_shellstart = (((long)(__pyx_v_cds[__pyx_v_dsidx])) - 1); +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - /* "src/helpers/correl.pyx":699 - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): + /* "View.MemoryView":701 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" */ - __pyx_t_21 = ((__pyx_v_shellstart < __pyx_v_nshells) != 0); - if (__pyx_t_21) { + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); - /* "src/helpers/correl.pyx":700 - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: - * shelldt = cds[dsidx+dt]-1 # <<<<<<<<<<<<<< - * for dim in range(corrdim): - * validx = mol*corrdim*n+dim*n+start + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag */ - __pyx_v_shelldt = (((long)(__pyx_v_cds[(__pyx_v_dsidx + __pyx_v_dt)])) - 1); + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { - /* "src/helpers/correl.pyx":701 - * if shellstart < nshells: - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): # <<<<<<<<<<<<<< - * validx = mol*corrdim*n+dim*n+start - * value = cdata[validx]*cdata[validx+dt] + /* "View.MemoryView":703 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * */ - __pyx_t_22 = __pyx_v_corrdim; - __pyx_t_23 = __pyx_t_22; - for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { - __pyx_v_dim = __pyx_t_24; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 703, __pyx_L1_error) - /* "src/helpers/correl.pyx":702 - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): - * validx = mol*corrdim*n+dim*n+start # <<<<<<<<<<<<<< - * value = cdata[validx]*cdata[validx+dt] - * idx = maxdt*shellstart+dt + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag */ - __pyx_v_validx = ((((__pyx_v_mol * __pyx_v_corrdim) * __pyx_v_n) + (__pyx_v_dim * __pyx_v_n)) + __pyx_v_start); + } + } - /* "src/helpers/correl.pyx":703 - * for dim in range(corrdim): - * validx = mol*corrdim*n+dim*n+start - * value = cdata[validx]*cdata[validx+dt] # <<<<<<<<<<<<<< - * idx = maxdt*shellstart+dt - * ccorr[idx] += value + /* "View.MemoryView":704 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * */ - __pyx_v_value = ((__pyx_v_cdata[__pyx_v_validx]) * (__pyx_v_cdata[(__pyx_v_validx + __pyx_v_dt)])); + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":704 - * validx = mol*corrdim*n+dim*n+start - * value = cdata[validx]*cdata[validx+dt] - * idx = maxdt*shellstart+dt # <<<<<<<<<<<<<< - * ccorr[idx] += value - * cctr[idx] += 1 + /* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: */ - __pyx_v_idx = ((__pyx_v_maxdt * __pyx_v_shellstart) + __pyx_v_dt); - /* "src/helpers/correl.pyx":705 - * value = cdata[validx]*cdata[validx+dt] - * idx = maxdt*shellstart+dt - * ccorr[idx] += value # <<<<<<<<<<<<<< - * cctr[idx] += 1 - * if shellstart == shelldt: + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":711 + * + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_ccorr[__pyx_t_25]) = ((__pyx_v_ccorr[__pyx_t_25]) + __pyx_v_value); - /* "src/helpers/correl.pyx":706 - * idx = maxdt*shellstart+dt - * ccorr[idx] += value - * cctr[idx] += 1 # <<<<<<<<<<<<<< - * if shellstart == shelldt: - * cselfcorr[idx] += value +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); + + /* "View.MemoryView":712 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_cctr[__pyx_t_25]) = ((__pyx_v_cctr[__pyx_t_25]) + 1.0); + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; - /* "src/helpers/correl.pyx":707 - * ccorr[idx] += value - * cctr[idx] += 1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * cselfcorr[idx] += value - * cselfctr[idx] += 1 + /* "View.MemoryView":719 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj */ - __pyx_t_21 = ((__pyx_v_shellstart == __pyx_v_shelldt) != 0); - if (__pyx_t_21) { + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - /* "src/helpers/correl.pyx":708 - * cctr[idx] += 1 - * if shellstart == shelldt: - * cselfcorr[idx] += value # <<<<<<<<<<<<<< - * cselfctr[idx] += 1 + /* "View.MemoryView":723 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< * + * if isinstance(memview, _memoryviewslice): */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_cselfcorr[__pyx_t_25]) = ((__pyx_v_cselfcorr[__pyx_t_25]) + __pyx_v_value); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 723, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 723, __pyx_L1_error) + #endif - /* "src/helpers/correl.pyx":709 - * if shellstart == shelldt: - * cselfcorr[idx] += value - * cselfctr[idx] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 * - * for i in range(maxdt*nshells): + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_cselfctr[__pyx_t_25]) = ((__pyx_v_cselfctr[__pyx_t_25]) + 1.0); + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":707 - * ccorr[idx] += value - * cctr[idx] += 1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * cselfcorr[idx] += value - * cselfctr[idx] += 1 + /* "View.MemoryView":726 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: */ - } - } + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 726, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":699 - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): + /* "View.MemoryView":727 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); - /* "src/helpers/correl.pyx":693 - * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for istart in range(startmax): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } + goto __pyx_L3; } - /* "src/helpers/correl.pyx":711 - * cselfctr[idx] += 1 + /* "View.MemoryView":729 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src * - * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] */ - __pyx_t_14 = (__pyx_v_maxdt * __pyx_v_nshells); - __pyx_t_13 = __pyx_t_14; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_13; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - /* "src/helpers/correl.pyx":712 + /* "View.MemoryView":730 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: */ - __pyx_t_21 = (((__pyx_v_cctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_21) { + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; - /* "src/helpers/correl.pyx":713 - * for i in range(maxdt*nshells): - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< - * else: - * print 'tot too sparse' + /* "View.MemoryView":736 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data + * */ - __pyx_t_15 = __pyx_v_i; - if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 713, __pyx_L1_error) - } - (__pyx_v_ccorr[__pyx_t_15]) = ((__pyx_v_ccorr[__pyx_t_15]) / (__pyx_v_cctr[__pyx_v_i])); + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; - /* "src/helpers/correl.pyx":712 + /* "View.MemoryView":737 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: */ - goto __pyx_L22; + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; + + /* "View.MemoryView":742 + * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex + */ + __pyx_v_p_dst = (&__pyx_v_dst); + + /* "View.MemoryView":743 + * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step + */ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index + */ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 747, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 747, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_8); } + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); - /* "src/helpers/correl.pyx":715 - * ccorr[i] /= cctr[i] - * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< - * if cselfctr[i] != 0: - * cselfcorr[i] /= cselfctr[i] + /* "View.MemoryView":748 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 715, __pyx_L1_error) + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":749 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + */ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 749, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; + + /* "View.MemoryView":750 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, + */ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 750, __pyx_L1_error) + + /* "View.MemoryView":748 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( + */ + goto __pyx_L6; } - __pyx_L22:; - /* "src/helpers/correl.pyx":716 - * else: - * print 'tot too sparse' - * if cselfctr[i] != 0: # <<<<<<<<<<<<<< - * cselfcorr[i] /= cselfctr[i] - * else: + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 */ - __pyx_t_21 = (((__pyx_v_cselfctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_21) { + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":717 - * print 'tot too sparse' - * if cselfctr[i] != 0: - * cselfcorr[i] /= cselfctr[i] # <<<<<<<<<<<<<< - * else: - * print 'self too sparse' + /* "View.MemoryView":757 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 */ - __pyx_t_15 = __pyx_v_i; - if (unlikely((__pyx_v_cselfctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 717, __pyx_L1_error) - } - (__pyx_v_cselfcorr[__pyx_t_15]) = ((__pyx_v_cselfcorr[__pyx_t_15]) / (__pyx_v_cselfctr[__pyx_v_i])); + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + + /* "View.MemoryView":758 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 + */ + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - /* "src/helpers/correl.pyx":716 + /* "View.MemoryView":759 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 * else: - * print 'tot too sparse' - * if cselfctr[i] != 0: # <<<<<<<<<<<<<< - * cselfcorr[i] /= cselfctr[i] + */ + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + + /* "View.MemoryView":760 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< * else: + * start = index.start or 0 */ - goto __pyx_L23; + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + */ + goto __pyx_L6; } - /* "src/helpers/correl.pyx":719 - * cselfcorr[i] /= cselfctr[i] + /* "View.MemoryView":762 + * new_ndim += 1 * else: - * print 'self too sparse' # <<<<<<<<<<<<<< - * - * for i in range(maxdt*nshells): + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 */ /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_self_too_sparse) < 0) __PYX_ERR(0, 719, __pyx_L1_error) - } - __pyx_L23:; - } + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 762, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 762, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; - /* "src/helpers/correl.pyx":721 - * print 'self too sparse' + /* "View.MemoryView":763 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 * - * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] - * ccrossctr[i] = cctr[i] - cselfctr[i] */ - __pyx_t_14 = (__pyx_v_maxdt * __pyx_v_nshells); - __pyx_t_13 = __pyx_t_14; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_13; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; - /* "src/helpers/correl.pyx":722 - * - * for i in range(maxdt*nshells): - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] # <<<<<<<<<<<<<< - * ccrossctr[i] = cctr[i] - cselfctr[i] + /* "View.MemoryView":764 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< * + * have_start = index.start is not None */ - (__pyx_v_ccrosscorr[__pyx_v_i]) = ((__pyx_v_ccorr[__pyx_v_i]) - (__pyx_v_cselfcorr[__pyx_v_i])); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; - /* "src/helpers/correl.pyx":723 - * for i in range(maxdt*nshells): - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] - * ccrossctr[i] = cctr[i] - cselfctr[i] # <<<<<<<<<<<<<< + /* "View.MemoryView":766 + * step = index.step or 0 * - * return corr,selfcorr,crosscorr + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None */ - (__pyx_v_ccrossctr[__pyx_v_i]) = ((__pyx_v_cctr[__pyx_v_i]) - (__pyx_v_cselfctr[__pyx_v_i])); - } + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; - /* "src/helpers/correl.pyx":725 - * ccrossctr[i] = cctr[i] - cselfctr[i] - * - * return corr,selfcorr,crosscorr # <<<<<<<<<<<<<< + /* "View.MemoryView":767 * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 725, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_v_corr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_corr)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_corr)); - __Pyx_INCREF(((PyObject *)__pyx_v_selfcorr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_selfcorr)); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_selfcorr)); - __Pyx_INCREF(((PyObject *)__pyx_v_crosscorr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_crosscorr)); - PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_crosscorr)); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; - /* "src/helpers/correl.pyx":656 + /* "View.MemoryView":768 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, + * slice_memviewslice( */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkthincorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_contdata); - __Pyx_XDECREF((PyObject *)__pyx_v_contds); - __Pyx_XDECREF(__pyx_v_pcorr); - __Pyx_XDECREF(__pyx_v_pselfcorr); - __Pyx_XDECREF(__pyx_v_pcrosscorr); - __Pyx_XDECREF((PyObject *)__pyx_v_corr); - __Pyx_XDECREF((PyObject *)__pyx_v_selfcorr); - __Pyx_XDECREF((PyObject *)__pyx_v_crosscorr); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); - __Pyx_XDECREF((PyObject *)__pyx_v_selfctr); - __Pyx_XDECREF((PyObject *)__pyx_v_crossctr); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":770 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, + */ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 770, __pyx_L1_error) -/* "src/helpers/correl.pyx":729 + /* "View.MemoryView":776 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, + * if isinstance(memview, _memoryviewslice): */ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_25sparsefullnobulkthingreenkubo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_25sparsefullnobulkthingreenkubo = {"sparsefullnobulkthingreenkubo", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_25sparsefullnobulkthingreenkubo, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_25sparsefullnobulkthingreenkubo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_pdata = 0; - int __pyx_v_pcorrdim; - PyArrayObject *__pyx_v_pds = 0; - int __pyx_v_pnshells; - PyObject *__pyx_v_maxlen = 0; - PyObject *__pyx_v_startingpoints = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sparsefullnobulkthingreenkubo (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_pcorrdim,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,&__pyx_n_s_startingpoints,0}; - PyObject* values[6] = {0,0,0,0,0,0}; + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":733 - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, - * maxlen=None, # <<<<<<<<<<<<<< - * startingpoints=None): + /* "View.MemoryView":778 + * new_ndim += 1 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, */ - values[4] = ((PyObject *)Py_None); + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":734 - * int pnshells, - * maxlen=None, - * startingpoints=None): # <<<<<<<<<<<<<< + /* "View.MemoryView":779 * - * cdef long corrdim = pcorrdim + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, + */ + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":780 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 780, __pyx_L1_error) } + + /* "View.MemoryView":781 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":779 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, + */ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 779, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":778 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, */ - values[5] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pdata)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pcorrdim)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthingreenkubo", 0, 4, 6, 1); __PYX_ERR(0, 729, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthingreenkubo", 0, 4, 6, 2); __PYX_ERR(0, 729, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pnshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthingreenkubo", 0, 4, 6, 3); __PYX_ERR(0, 729, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[4] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 5: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startingpoints); - if (value) { values[5] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sparsefullnobulkthingreenkubo") < 0)) __PYX_ERR(0, 729, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_pdata = ((PyArrayObject *)values[0]); - __pyx_v_pcorrdim = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_pcorrdim == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 730, __pyx_L3_error) - __pyx_v_pds = ((PyArrayObject *)values[2]); - __pyx_v_pnshells = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 732, __pyx_L3_error) - __pyx_v_maxlen = values[4]; - __pyx_v_startingpoints = values[5]; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthingreenkubo", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 729, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkthingreenkubo", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 729, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 731, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_24sparsefullnobulkthingreenkubo(__pyx_self, __pyx_v_pdata, __pyx_v_pcorrdim, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen, __pyx_v_startingpoints); - /* "src/helpers/correl.pyx":729 + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) * - * @cython.boundscheck(False) - * def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, + */ + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":785 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * + */ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 784, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":711 + * + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_24sparsefullnobulkthingreenkubo(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_startingpoints) { - long __pyx_v_corrdim; - long __pyx_v_nmol; - long __pyx_v_n; - long __pyx_v_nds; - long __pyx_v_maxdt; - long __pyx_v_nshells; - long __pyx_v_startskip; - long __pyx_v_startmax; - PyArrayObject *__pyx_v_contdata = 0; - PyArrayObject *__pyx_v_contds = 0; - double *__pyx_v_cdata; - int *__pyx_v_cds; - PyObject *__pyx_v_pcorr = NULL; - PyObject *__pyx_v_pselfcorr = NULL; - PyObject *__pyx_v_pcrosscorr = NULL; - PyArrayObject *__pyx_v_corr = 0; - PyArrayObject *__pyx_v_selfcorr = 0; - PyArrayObject *__pyx_v_crosscorr = 0; - PyArrayObject *__pyx_v_ctr = 0; - PyArrayObject *__pyx_v_selfctr = 0; - PyArrayObject *__pyx_v_crossctr = 0; - double *__pyx_v_ccorr; - double *__pyx_v_cselfcorr; - double *__pyx_v_ccrosscorr; - double *__pyx_v_cctr; - double *__pyx_v_cselfctr; - double *__pyx_v_ccrossctr; - double __pyx_v_value; - double __pyx_v_tempvalue; - long __pyx_v_i; - long __pyx_v_start; - long __pyx_v_dt; - long __pyx_v_mol; - long __pyx_v_shellstart; - long __pyx_v_shelldt; - long __pyx_v_idx; - long __pyx_v_dim; - long __pyx_v_validx; - long __pyx_v_dsidx; - long __pyx_v_istart; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; - __Pyx_Buffer __pyx_pybuffer_contdata; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; - __Pyx_Buffer __pyx_pybuffer_contds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; - __Pyx_Buffer __pyx_pybuffer_corr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_crosscorr; - __Pyx_Buffer __pyx_pybuffer_crosscorr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_crossctr; - __Pyx_Buffer __pyx_pybuffer_crossctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; - __Pyx_Buffer __pyx_pybuffer_pdata; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; - __Pyx_Buffer __pyx_pybuffer_pds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_selfcorr; - __Pyx_Buffer __pyx_pybuffer_selfcorr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_selfctr; - __Pyx_Buffer __pyx_pybuffer_selfctr; - PyObject *__pyx_r = NULL; +/* "View.MemoryView":793 + * + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + */ + +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - long __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - long __pyx_t_18; - long __pyx_t_19; - long __pyx_t_20; - int __pyx_t_21; - long __pyx_t_22; - long __pyx_t_23; - long __pyx_t_24; - long __pyx_t_25; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sparsefullnobulkthingreenkubo", 0); - __pyx_pybuffer_contdata.pybuffer.buf = NULL; - __pyx_pybuffer_contdata.refcount = 0; - __pyx_pybuffernd_contdata.data = NULL; - __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; - __pyx_pybuffer_contds.pybuffer.buf = NULL; - __pyx_pybuffer_contds.refcount = 0; - __pyx_pybuffernd_contds.data = NULL; - __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; - __pyx_pybuffer_corr.pybuffer.buf = NULL; - __pyx_pybuffer_corr.refcount = 0; - __pyx_pybuffernd_corr.data = NULL; - __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; - __pyx_pybuffer_selfcorr.pybuffer.buf = NULL; - __pyx_pybuffer_selfcorr.refcount = 0; - __pyx_pybuffernd_selfcorr.data = NULL; - __pyx_pybuffernd_selfcorr.rcbuffer = &__pyx_pybuffer_selfcorr; - __pyx_pybuffer_crosscorr.pybuffer.buf = NULL; - __pyx_pybuffer_crosscorr.refcount = 0; - __pyx_pybuffernd_crosscorr.data = NULL; - __pyx_pybuffernd_crosscorr.rcbuffer = &__pyx_pybuffer_crosscorr; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_selfctr.pybuffer.buf = NULL; - __pyx_pybuffer_selfctr.refcount = 0; - __pyx_pybuffernd_selfctr.data = NULL; - __pyx_pybuffernd_selfctr.rcbuffer = &__pyx_pybuffer_selfctr; - __pyx_pybuffer_crossctr.pybuffer.buf = NULL; - __pyx_pybuffer_crossctr.refcount = 0; - __pyx_pybuffernd_crossctr.data = NULL; - __pyx_pybuffernd_crossctr.rcbuffer = &__pyx_pybuffer_crossctr; - __pyx_pybuffer_pdata.pybuffer.buf = NULL; - __pyx_pybuffer_pdata.refcount = 0; - __pyx_pybuffernd_pdata.data = NULL; - __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; - __pyx_pybuffer_pds.pybuffer.buf = NULL; - __pyx_pybuffer_pds.refcount = 0; - __pyx_pybuffernd_pds.data = NULL; - __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 729, __pyx_L1_error) - } - __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 729, __pyx_L1_error) - } - __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("slice_memviewslice", 1); - /* "src/helpers/correl.pyx":736 - * startingpoints=None): + /* "View.MemoryView":813 + * cdef bint negative_step * - * cdef long corrdim = pcorrdim # <<<<<<<<<<<<<< - * cdef long nmol = len(pdata)/pcorrdim # number of molecules - * cdef long n = len(pdata[0]) # number of time steps + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: */ - __pyx_v_corrdim = ((long)__pyx_v_pcorrdim); + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":737 + /* "View.MemoryView":815 + * if not is_slice: * - * cdef long corrdim = pcorrdim - * cdef long nmol = len(pdata)/pcorrdim # number of molecules # <<<<<<<<<<<<<< - * cdef long n = len(pdata[0]) # number of time steps - * cdef long nds = len(pds[0]) # number of steps in delaunay array + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 737, __pyx_L1_error) - __pyx_t_2 = ((long)__pyx_t_1); - if (unlikely(__pyx_v_pcorrdim == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 737, __pyx_L1_error) - } - else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_pcorrdim == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 737, __pyx_L1_error) - } - __pyx_v_nmol = __Pyx_div_long(__pyx_t_2, __pyx_v_pcorrdim); + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":738 - * cdef long corrdim = pcorrdim - * cdef long nmol = len(pdata)/pcorrdim # number of molecules - * cdef long n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< - * cdef long nds = len(pds[0]) # number of steps in delaunay array - * cdef long maxdt = maxlen + /* "View.MemoryView":816 + * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) */ - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 738, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_n = ((long)__pyx_t_1); + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "src/helpers/correl.pyx":739 - * cdef long nmol = len(pdata)/pcorrdim # number of molecules - * cdef long n = len(pdata[0]) # number of time steps - * cdef long nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< - * cdef long maxdt = maxlen - * cdef long nshells = pnshells + /* "View.MemoryView":815 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: */ - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 739, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 739, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_nds = ((long)__pyx_t_1); + } - /* "src/helpers/correl.pyx":740 - * cdef long n = len(pdata[0]) # number of time steps - * cdef long nds = len(pds[0]) # number of steps in delaunay array - * cdef long maxdt = maxlen # <<<<<<<<<<<<<< - * cdef long nshells = pnshells - * cdef long startskip = (n-maxdt)/startingpoints + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: */ - __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_v_maxlen); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 740, __pyx_L1_error) - __pyx_v_maxdt = ((long)__pyx_t_2); + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":741 - * cdef long nds = len(pds[0]) # number of steps in delaunay array - * cdef long maxdt = maxlen - * cdef long nshells = pnshells # <<<<<<<<<<<<<< - * cdef long startskip = (n-maxdt)/startingpoints - * cdef long startmax = (n-maxdt)/startskip + /* "View.MemoryView":818 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * */ - __pyx_v_nshells = ((long)__pyx_v_pnshells); + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 818, __pyx_L1_error) - /* "src/helpers/correl.pyx":742 - * cdef long maxdt = maxlen - * cdef long nshells = pnshells - * cdef long startskip = (n-maxdt)/startingpoints # <<<<<<<<<<<<<< - * cdef long startmax = (n-maxdt)/startskip - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: */ - __pyx_t_3 = __Pyx_PyInt_From_long(((long)(__pyx_v_n - __pyx_v_maxdt))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_startingpoints); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 742, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 742, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_startskip = __pyx_t_2; + } - /* "src/helpers/correl.pyx":743 - * cdef long nshells = pnshells - * cdef long startskip = (n-maxdt)/startingpoints - * cdef long startmax = (n-maxdt)/startskip # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + /* "View.MemoryView":813 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: */ - __pyx_t_2 = (__pyx_v_n - __pyx_v_maxdt); - if (unlikely(__pyx_v_startskip == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 743, __pyx_L1_error) - } - else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startskip == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 743, __pyx_L1_error) + goto __pyx_L3; } - __pyx_v_startmax = __Pyx_div_long(__pyx_t_2, __pyx_v_startskip); - /* "src/helpers/correl.pyx":744 - * cdef long startskip = (n-maxdt)/startingpoints - * cdef long startmax = (n-maxdt)/startskip - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data + /* "View.MemoryView":821 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 744, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 744, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_v_pdata)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_pdata)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 744, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 744, __pyx_L1_error) - __pyx_t_6 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 744, __pyx_L1_error) - } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_6 = 0; - __pyx_v_contdata = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":745 - * cdef long startmax = (n-maxdt)/startskip - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data + /* "View.MemoryView":822 + * + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, ((PyObject *)__pyx_v_pds)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_pds)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 745, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 745, __pyx_L1_error) - } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_7 = 0; - __pyx_v_contds = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_negative_step = (__pyx_v_step < 0); - /* "src/helpers/correl.pyx":746 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: */ - __pyx_v_cdata = ((double *)__pyx_v_contdata->data); + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":747 - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data # <<<<<<<<<<<<<< - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":824 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False */ - __pyx_v_cds = ((int *)__pyx_v_contds->data); + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 824, __pyx_L1_error) - /* "src/helpers/correl.pyx":748 - * cdef double *cdata = contdata.data - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 748, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_pcorr = __pyx_t_9; - __pyx_t_9 = 0; + } - /* "src/helpers/correl.pyx":749 - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + /* "View.MemoryView":821 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __pyx_t_9 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_pselfcorr = __pyx_t_4; - __pyx_t_4 = 0; + goto __pyx_L6; + } - /* "src/helpers/correl.pyx":750 - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + /* "View.MemoryView":826 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 + * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_pcrosscorr = __pyx_t_9; - __pyx_t_9 = 0; + /*else*/ { + __pyx_v_negative_step = 0; - /* "src/helpers/correl.pyx":751 - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + /* "View.MemoryView":827 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * + * */ - if (!(likely(((__pyx_v_pcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 751, __pyx_L1_error) - __pyx_t_9 = __pyx_v_pcorr; - __Pyx_INCREF(__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_9), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 751, __pyx_L1_error) - } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; + __pyx_v_step = 1; } - } - __pyx_v_corr = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + __pyx_L6:; - /* "src/helpers/correl.pyx":752 - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":830 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ - if (!(likely(((__pyx_v_pselfcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pselfcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 752, __pyx_L1_error) - __pyx_t_9 = __pyx_v_pselfcorr; - __Pyx_INCREF(__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_9), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_selfcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 752, __pyx_L1_error) - } else {__pyx_pybuffernd_selfcorr.diminfo[0].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfcorr.diminfo[0].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfcorr.diminfo[1].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfcorr.diminfo[1].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_v_selfcorr = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":753 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":831 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ - if (!(likely(((__pyx_v_pcrosscorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcrosscorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 753, __pyx_L1_error) - __pyx_t_9 = __pyx_v_pcrosscorr; - __Pyx_INCREF(__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_9), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_crosscorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 753, __pyx_L1_error) - } else {__pyx_pybuffernd_crosscorr.diminfo[0].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crosscorr.diminfo[0].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crosscorr.diminfo[1].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crosscorr.diminfo[1].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_v_crosscorr = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":754 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":832 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __pyx_t_9 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 754, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 754, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_10 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "src/helpers/correl.pyx":755 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 755, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 755, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_selfctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 755, __pyx_L1_error) - } else {__pyx_pybuffernd_selfctr.diminfo[0].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfctr.diminfo[0].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfctr.diminfo[1].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfctr.diminfo[1].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_11 = 0; - __pyx_v_selfctr = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":756 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data + /* "View.MemoryView":834 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __pyx_t_9 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 756, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_crossctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 756, __pyx_L1_error) - } else {__pyx_pybuffernd_crossctr.diminfo[0].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crossctr.diminfo[0].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crossctr.diminfo[1].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crossctr.diminfo[1].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_12 = 0; - __pyx_v_crossctr = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_start = 0; - /* "src/helpers/correl.pyx":757 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: */ - __pyx_v_ccorr = ((double *)__pyx_v_corr->data); + } - /* "src/helpers/correl.pyx":758 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data # <<<<<<<<<<<<<< - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data + /* "View.MemoryView":831 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ - __pyx_v_cselfcorr = ((double *)__pyx_v_selfcorr->data); + goto __pyx_L9; + } - /* "src/helpers/correl.pyx":759 - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data # <<<<<<<<<<<<<< - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 */ - __pyx_v_ccrosscorr = ((double *)__pyx_v_crosscorr->data); + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":760 - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< - * cdef double *cselfctr = selfctr.data - * cdef double *ccrossctr = crossctr.data + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - __pyx_v_cctr = ((double *)__pyx_v_ctr->data); + if (__pyx_v_negative_step) { - /* "src/helpers/correl.pyx":761 - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data # <<<<<<<<<<<<<< - * cdef double *ccrossctr = crossctr.data - * cdef double value,tempvalue + /* "View.MemoryView":837 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape */ - __pyx_v_cselfctr = ((double *)__pyx_v_selfctr->data); + __pyx_v_start = (__pyx_v_shape - 1); - /* "src/helpers/correl.pyx":762 - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data - * cdef double *ccrossctr = crossctr.data # <<<<<<<<<<<<<< - * cdef double value,tempvalue - * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - __pyx_v_ccrossctr = ((double *)__pyx_v_crossctr->data); + goto __pyx_L11; + } - /* "src/helpers/correl.pyx":766 - * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart - * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for istart in range(startmax): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + /* "View.MemoryView":839 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_2 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_14 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_14 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dim) lastprivate(__pyx_v_dsidx) firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_istart) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_tempvalue) lastprivate(__pyx_v_validx) lastprivate(__pyx_v_value) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ - { - __pyx_v_dt = (long)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_dim = ((long)0xbad0bad0); - __pyx_v_dsidx = ((long)0xbad0bad0); - __pyx_v_idx = ((long)0xbad0bad0); - __pyx_v_istart = ((long)0xbad0bad0); - __pyx_v_mol = ((long)0xbad0bad0); - __pyx_v_shelldt = ((long)0xbad0bad0); - __pyx_v_shellstart = ((long)0xbad0bad0); - __pyx_v_start = ((long)0xbad0bad0); - __pyx_v_tempvalue = ((double)__PYX_NAN()); - __pyx_v_validx = ((long)0xbad0bad0); - __pyx_v_value = ((double)__PYX_NAN()); + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; - /* "src/helpers/correl.pyx":767 - * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for istart in range(startmax): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * start = istart*startskip + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 */ - __pyx_t_15 = __pyx_v_startmax; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_istart = __pyx_t_17; + } + __pyx_L9:; - /* "src/helpers/correl.pyx":768 - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for istart in range(startmax): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * start = istart*startskip - * dsidx = mol*nds+start + /* "View.MemoryView":830 + * + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ - __pyx_t_18 = __pyx_v_nmol; - __pyx_t_19 = __pyx_t_18; - for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { - __pyx_v_mol = __pyx_t_20; + goto __pyx_L8; + } - /* "src/helpers/correl.pyx":769 - * for istart in range(startmax): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * start = istart*startskip # <<<<<<<<<<<<<< - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - __pyx_v_start = (__pyx_v_istart * __pyx_v_startskip); + /*else*/ { + if (__pyx_v_negative_step) { - /* "src/helpers/correl.pyx":770 - * for mol in range(nmol): # loop over molecules/entries - * start = istart*startskip - * dsidx = mol*nds+start # <<<<<<<<<<<<<< - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: + /* "View.MemoryView":842 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 */ - __pyx_v_dsidx = ((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start); + __pyx_v_start = (__pyx_v_shape - 1); - /* "src/helpers/correl.pyx":771 - * start = istart*startskip - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 # <<<<<<<<<<<<<< - * if shellstart < nshells: - * shelldt = cds[dsidx+dt]-1 + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - __pyx_v_shellstart = (((long)(__pyx_v_cds[__pyx_v_dsidx])) - 1); + goto __pyx_L12; + } - /* "src/helpers/correl.pyx":772 - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): + /* "View.MemoryView":844 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< + * + * if have_stop: */ - __pyx_t_21 = ((__pyx_v_shellstart < __pyx_v_nshells) != 0); - if (__pyx_t_21) { + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; - /* "src/helpers/correl.pyx":773 - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: - * shelldt = cds[dsidx+dt]-1 # <<<<<<<<<<<<<< - * for dim in range(corrdim): - * validx = mol*corrdim*n+dim*n+start + /* "View.MemoryView":846 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ - __pyx_v_shelldt = (((long)(__pyx_v_cds[(__pyx_v_dsidx + __pyx_v_dt)])) - 1); + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":774 - * if shellstart < nshells: - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): # <<<<<<<<<<<<<< - * validx = mol*corrdim*n+dim*n+start - * tempvalue = cdata[validx+dt]-cdata[validx] + /* "View.MemoryView":847 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: */ - __pyx_t_22 = __pyx_v_corrdim; - __pyx_t_23 = __pyx_t_22; - for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { - __pyx_v_dim = __pyx_t_24; + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":775 - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): - * validx = mol*corrdim*n+dim*n+start # <<<<<<<<<<<<<< - * tempvalue = cdata[validx+dt]-cdata[validx] - * value = tempvalue*tempvalue + /* "View.MemoryView":848 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 */ - __pyx_v_validx = ((((__pyx_v_mol * __pyx_v_corrdim) * __pyx_v_n) + (__pyx_v_dim * __pyx_v_n)) + __pyx_v_start); + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - /* "src/helpers/correl.pyx":776 - * for dim in range(corrdim): - * validx = mol*corrdim*n+dim*n+start - * tempvalue = cdata[validx+dt]-cdata[validx] # <<<<<<<<<<<<<< - * value = tempvalue*tempvalue - * idx = maxdt*shellstart+dt + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ - __pyx_v_tempvalue = ((__pyx_v_cdata[(__pyx_v_validx + __pyx_v_dt)]) - (__pyx_v_cdata[__pyx_v_validx])); + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":777 - * validx = mol*corrdim*n+dim*n+start - * tempvalue = cdata[validx+dt]-cdata[validx] - * value = tempvalue*tempvalue # <<<<<<<<<<<<<< - * idx = maxdt*shellstart+dt - * ccorr[idx] += value + /* "View.MemoryView":850 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape */ - __pyx_v_value = (__pyx_v_tempvalue * __pyx_v_tempvalue); + __pyx_v_stop = 0; - /* "src/helpers/correl.pyx":778 - * tempvalue = cdata[validx+dt]-cdata[validx] - * value = tempvalue*tempvalue - * idx = maxdt*shellstart+dt # <<<<<<<<<<<<<< - * ccorr[idx] += value - * cctr[idx] += 1 + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ - __pyx_v_idx = ((__pyx_v_maxdt * __pyx_v_shellstart) + __pyx_v_dt); + } - /* "src/helpers/correl.pyx":779 - * value = tempvalue*tempvalue - * idx = maxdt*shellstart+dt - * ccorr[idx] += value # <<<<<<<<<<<<<< - * cctr[idx] += 1 - * if shellstart == shelldt: + /* "View.MemoryView":847 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_ccorr[__pyx_t_25]) = ((__pyx_v_ccorr[__pyx_t_25]) + __pyx_v_value); + goto __pyx_L14; + } - /* "src/helpers/correl.pyx":780 - * idx = maxdt*shellstart+dt - * ccorr[idx] += value - * cctr[idx] += 1 # <<<<<<<<<<<<<< - * if shellstart == shelldt: - * cselfcorr[idx] += value + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_cctr[__pyx_t_25]) = ((__pyx_v_cctr[__pyx_t_25]) + 1.0); + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":781 - * ccorr[idx] += value - * cctr[idx] += 1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * cselfcorr[idx] += value - * cselfctr[idx] += 1 + /* "View.MemoryView":852 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: */ - __pyx_t_21 = ((__pyx_v_shellstart == __pyx_v_shelldt) != 0); - if (__pyx_t_21) { + __pyx_v_stop = __pyx_v_shape; - /* "src/helpers/correl.pyx":782 - * cctr[idx] += 1 - * if shellstart == shelldt: - * cselfcorr[idx] += value # <<<<<<<<<<<<<< - * cselfctr[idx] += 1 - * + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_cselfcorr[__pyx_t_25]) = ((__pyx_v_cselfcorr[__pyx_t_25]) + __pyx_v_value); + } + __pyx_L14:; - /* "src/helpers/correl.pyx":783 - * if shellstart == shelldt: - * cselfcorr[idx] += value - * cselfctr[idx] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":846 + * start = 0 * - * for i in range(maxdt*nshells): + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ - __pyx_t_25 = __pyx_v_idx; - (__pyx_v_cselfctr[__pyx_t_25]) = ((__pyx_v_cselfctr[__pyx_t_25]) + 1.0); + goto __pyx_L13; + } - /* "src/helpers/correl.pyx":781 - * ccorr[idx] += value - * cctr[idx] += 1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * cselfcorr[idx] += value - * cselfctr[idx] += 1 + /* "View.MemoryView":854 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: */ - } - } + /*else*/ { + if (__pyx_v_negative_step) { - /* "src/helpers/correl.pyx":772 - * dsidx = mol*nds+start - * shellstart = cds[dsidx]-1 - * if shellstart < nshells: # <<<<<<<<<<<<<< - * shelldt = cds[dsidx+dt]-1 - * for dim in range(corrdim): + /* "View.MemoryView":855 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif + __pyx_v_stop = -1L; + + /* "View.MemoryView":854 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: + */ + goto __pyx_L16; } - /* "src/helpers/correl.pyx":766 - * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart + /* "View.MemoryView":857 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for istart in range(startmax): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; + /*else*/ { + __pyx_v_stop = __pyx_v_shape; } - } + __pyx_L16:; + } + __pyx_L13:; - /* "src/helpers/correl.pyx":785 - * cselfctr[idx] += 1 + /* "View.MemoryView":861 * - * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: */ - __pyx_t_14 = (__pyx_v_maxdt * __pyx_v_nshells); - __pyx_t_13 = __pyx_t_14; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_13; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - /* "src/helpers/correl.pyx":786 + /* "View.MemoryView":863 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: */ - __pyx_t_21 = (((__pyx_v_cctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_21) { + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":787 - * for i in range(maxdt*nshells): - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< - * else: - * print 'tot too sparse' + /* "View.MemoryView":864 + * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: */ - __pyx_t_15 = __pyx_v_i; - if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 787, __pyx_L1_error) - } - (__pyx_v_ccorr[__pyx_t_15]) = ((__pyx_v_ccorr[__pyx_t_15]) / (__pyx_v_cctr[__pyx_v_i])); + __pyx_v_new_shape = (__pyx_v_new_shape + 1); - /* "src/helpers/correl.pyx":786 + /* "View.MemoryView":863 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: */ - goto __pyx_L22; } - /* "src/helpers/correl.pyx":789 - * ccorr[i] /= cctr[i] - * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< - * if cctr[i] != 0: - * cselfcorr[i] /= cselfctr[i] + /* "View.MemoryView":866 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * + */ + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":867 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_new_shape = 0; + + /* "View.MemoryView":866 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 789, __pyx_L1_error) } - __pyx_L22:; - /* "src/helpers/correl.pyx":790 - * else: - * print 'tot too sparse' - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * cselfcorr[i] /= cselfctr[i] - * else: + /* "View.MemoryView":870 + * + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset */ - __pyx_t_21 = (((__pyx_v_cctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_21) { + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - /* "src/helpers/correl.pyx":791 - * print 'tot too sparse' - * if cctr[i] != 0: - * cselfcorr[i] /= cselfctr[i] # <<<<<<<<<<<<<< - * else: - * print 'self too sparse' + /* "View.MemoryView":871 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset + * */ - __pyx_t_15 = __pyx_v_i; - if (unlikely((__pyx_v_cselfctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 791, __pyx_L1_error) - } - (__pyx_v_cselfcorr[__pyx_t_15]) = ((__pyx_v_cselfcorr[__pyx_t_15]) / (__pyx_v_cselfctr[__pyx_v_i])); + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - /* "src/helpers/correl.pyx":790 - * else: - * print 'tot too sparse' - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * cselfcorr[i] /= cselfctr[i] - * else: + /* "View.MemoryView":872 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * + * */ - goto __pyx_L23; - } + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; - /* "src/helpers/correl.pyx":793 - * cselfcorr[i] /= cselfctr[i] - * else: - * print 'self too sparse' # <<<<<<<<<<<<<< + /* "View.MemoryView":875 * - * for i in range(maxdt*nshells): + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_self_too_sparse) < 0) __PYX_ERR(0, 793, __pyx_L1_error) - } - __pyx_L23:; + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { + + /* "View.MemoryView":876 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride + */ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + + /* "View.MemoryView":875 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: + */ + goto __pyx_L19; } - /* "src/helpers/correl.pyx":795 - * print 'self too sparse' + /* "View.MemoryView":878 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< * - * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] - * ccrossctr[i] = cctr[i] - cselfctr[i] + * if suboffset >= 0: */ - __pyx_t_14 = (__pyx_v_maxdt * __pyx_v_nshells); - __pyx_t_13 = __pyx_t_14; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_13; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; - /* "src/helpers/correl.pyx":796 + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride * - * for i in range(maxdt*nshells): - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] # <<<<<<<<<<<<<< - * ccrossctr[i] = cctr[i] - cselfctr[i] + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: + */ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":881 * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ - (__pyx_v_ccrosscorr[__pyx_v_i]) = ((__pyx_v_ccorr[__pyx_v_i]) - (__pyx_v_cselfcorr[__pyx_v_i])); + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":797 - * for i in range(maxdt*nshells): - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] - * ccrossctr[i] = cctr[i] - cselfctr[i] # <<<<<<<<<<<<<< + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: + */ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":883 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + */ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: + */ + goto __pyx_L22; + } + + /* "View.MemoryView":885 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: + */ + /*else*/ { + + /* "View.MemoryView":886 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim + */ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 885, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":881 * - * return corr,selfcorr,crosscorr + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset + */ + goto __pyx_L21; + } + + /* "View.MemoryView":888 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + * + * return 0 + */ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; + + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: */ - (__pyx_v_ccrossctr[__pyx_v_i]) = ((__pyx_v_cctr[__pyx_v_i]) - (__pyx_v_cselfctr[__pyx_v_i])); } - /* "src/helpers/correl.pyx":799 - * ccrossctr[i] = cctr[i] - cselfctr[i] + /* "View.MemoryView":890 + * suboffset_dim[0] = new_ndim * - * return corr,selfcorr,crosscorr # <<<<<<<<<<<<<< + * return 0 # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_v_corr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_corr)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_corr)); - __Pyx_INCREF(((PyObject *)__pyx_v_selfcorr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_selfcorr)); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_selfcorr)); - __Pyx_INCREF(((PyObject *)__pyx_v_crosscorr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_crosscorr)); - PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_crosscorr)); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_r = 0; goto __pyx_L0; - /* "src/helpers/correl.pyx":729 + /* "View.MemoryView":793 * - * @cython.boundscheck(False) - * def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkthingreenkubo", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_contdata); - __Pyx_XDECREF((PyObject *)__pyx_v_contds); - __Pyx_XDECREF(__pyx_v_pcorr); - __Pyx_XDECREF(__pyx_v_pselfcorr); - __Pyx_XDECREF(__pyx_v_pcrosscorr); - __Pyx_XDECREF((PyObject *)__pyx_v_corr); - __Pyx_XDECREF((PyObject *)__pyx_v_selfcorr); - __Pyx_XDECREF((PyObject *)__pyx_v_crosscorr); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); - __Pyx_XDECREF((PyObject *)__pyx_v_selfctr); - __Pyx_XDECREF((PyObject *)__pyx_v_crossctr); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "src/helpers/correl.pyx":804 - * - * @cython.boundscheck(False) - * def sparsefullcrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] pdata2, - * np.ndarray[np.int32_t,ndim=2] pds, - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_27sparsefullcrosscorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_27sparsefullcrosscorrelate = {"sparsefullcrosscorrelate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_27sparsefullcrosscorrelate, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_27sparsefullcrosscorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_pdata1 = 0; - PyArrayObject *__pyx_v_pdata2 = 0; - PyArrayObject *__pyx_v_pds = 0; - int __pyx_v_pnshells; - PyObject *__pyx_v_maxlen = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sparsefullcrosscorrelate (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata1,&__pyx_n_s_pdata2,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,0}; - PyObject* values[5] = {0,0,0,0,0}; - - /* "src/helpers/correl.pyx":808 - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, - * maxlen=None,): # <<<<<<<<<<<<<< - * cdef int nmol = len(pdata1) # number of molecules - * cdef int n = len(pdata1[0]) # number of time steps - */ - values[4] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pdata1)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pdata2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullcrosscorrelate", 0, 4, 5, 1); __PYX_ERR(0, 804, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullcrosscorrelate", 0, 4, 5, 2); __PYX_ERR(0, 804, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pnshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sparsefullcrosscorrelate", 0, 4, 5, 3); __PYX_ERR(0, 804, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sparsefullcrosscorrelate") < 0)) __PYX_ERR(0, 804, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_pdata1 = ((PyArrayObject *)values[0]); - __pyx_v_pdata2 = ((PyArrayObject *)values[1]); - __pyx_v_pds = ((PyArrayObject *)values[2]); - __pyx_v_pnshells = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 807, __pyx_L3_error) - __pyx_v_maxlen = values[4]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparsefullcrosscorrelate", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 804, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.sparsefullcrosscorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata1), __pyx_ptype_5numpy_ndarray, 1, "pdata1", 0))) __PYX_ERR(0, 804, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata2), __pyx_ptype_5numpy_ndarray, 1, "pdata2", 0))) __PYX_ERR(0, 805, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 806, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_26sparsefullcrosscorrelate(__pyx_self, __pyx_v_pdata1, __pyx_v_pdata2, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen); - - /* "src/helpers/correl.pyx":804 +/* "View.MemoryView":896 * - * @cython.boundscheck(False) - * def sparsefullcrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] pdata2, - * np.ndarray[np.int32_t,ndim=2] pds, + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_6correl_26sparsefullcrosscorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata1, PyArrayObject *__pyx_v_pdata2, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen) { - int __pyx_v_nmol; - int __pyx_v_n; - int __pyx_v_nds; - int __pyx_v_maxdt; - int __pyx_v_nshells; - PyArrayObject *__pyx_v_contdata1 = 0; - PyArrayObject *__pyx_v_contdata2 = 0; - PyArrayObject *__pyx_v_contds = 0; - double *__pyx_v_cdata1; - double *__pyx_v_cdata2; - int *__pyx_v_cds; - PyObject *__pyx_v_pcorr = NULL; - PyObject *__pyx_v_pselfcorr = NULL; - PyObject *__pyx_v_pcrosscorr = NULL; - PyArrayObject *__pyx_v_corr = 0; - PyArrayObject *__pyx_v_selfcorr = 0; - PyArrayObject *__pyx_v_crosscorr = 0; - PyArrayObject *__pyx_v_ctr = 0; - PyArrayObject *__pyx_v_selfctr = 0; - PyArrayObject *__pyx_v_crossctr = 0; - double *__pyx_v_ccorr; - double *__pyx_v_cselfcorr; - double *__pyx_v_ccrosscorr; - double *__pyx_v_cctr; - double *__pyx_v_cselfctr; - double *__pyx_v_ccrossctr; - double __pyx_v_value; - int __pyx_v_i; - int __pyx_v_start; - int __pyx_v_dt; - int __pyx_v_mol; - int __pyx_v_shellstart; - int __pyx_v_shelldt; - int __pyx_v_idx; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata1; - __Pyx_Buffer __pyx_pybuffer_contdata1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata2; - __Pyx_Buffer __pyx_pybuffer_contdata2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; - __Pyx_Buffer __pyx_pybuffer_contds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; - __Pyx_Buffer __pyx_pybuffer_corr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_crosscorr; - __Pyx_Buffer __pyx_pybuffer_crosscorr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_crossctr; - __Pyx_Buffer __pyx_pybuffer_crossctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata1; - __Pyx_Buffer __pyx_pybuffer_pdata1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata2; - __Pyx_Buffer __pyx_pybuffer_pdata2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; - __Pyx_Buffer __pyx_pybuffer_pds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_selfcorr; - __Pyx_Buffer __pyx_pybuffer_selfcorr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_selfctr; - __Pyx_Buffer __pyx_pybuffer_selfctr; - PyObject *__pyx_r = NULL; +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_UCS4 __pyx_t_4; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyArrayObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - PyArrayObject *__pyx_t_13 = NULL; - PyArrayObject *__pyx_t_14 = NULL; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - int __pyx_t_23; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sparsefullcrosscorrelate", 0); - __pyx_pybuffer_contdata1.pybuffer.buf = NULL; - __pyx_pybuffer_contdata1.refcount = 0; - __pyx_pybuffernd_contdata1.data = NULL; - __pyx_pybuffernd_contdata1.rcbuffer = &__pyx_pybuffer_contdata1; - __pyx_pybuffer_contdata2.pybuffer.buf = NULL; - __pyx_pybuffer_contdata2.refcount = 0; - __pyx_pybuffernd_contdata2.data = NULL; - __pyx_pybuffernd_contdata2.rcbuffer = &__pyx_pybuffer_contdata2; - __pyx_pybuffer_contds.pybuffer.buf = NULL; - __pyx_pybuffer_contds.refcount = 0; - __pyx_pybuffernd_contds.data = NULL; - __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; - __pyx_pybuffer_corr.pybuffer.buf = NULL; - __pyx_pybuffer_corr.refcount = 0; - __pyx_pybuffernd_corr.data = NULL; - __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; - __pyx_pybuffer_selfcorr.pybuffer.buf = NULL; - __pyx_pybuffer_selfcorr.refcount = 0; - __pyx_pybuffernd_selfcorr.data = NULL; - __pyx_pybuffernd_selfcorr.rcbuffer = &__pyx_pybuffer_selfcorr; - __pyx_pybuffer_crosscorr.pybuffer.buf = NULL; - __pyx_pybuffer_crosscorr.refcount = 0; - __pyx_pybuffernd_crosscorr.data = NULL; - __pyx_pybuffernd_crosscorr.rcbuffer = &__pyx_pybuffer_crosscorr; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_selfctr.pybuffer.buf = NULL; - __pyx_pybuffer_selfctr.refcount = 0; - __pyx_pybuffernd_selfctr.data = NULL; - __pyx_pybuffernd_selfctr.rcbuffer = &__pyx_pybuffer_selfctr; - __pyx_pybuffer_crossctr.pybuffer.buf = NULL; - __pyx_pybuffer_crossctr.refcount = 0; - __pyx_pybuffernd_crossctr.data = NULL; - __pyx_pybuffernd_crossctr.rcbuffer = &__pyx_pybuffer_crossctr; - __pyx_pybuffer_pdata1.pybuffer.buf = NULL; - __pyx_pybuffer_pdata1.refcount = 0; - __pyx_pybuffernd_pdata1.data = NULL; - __pyx_pybuffernd_pdata1.rcbuffer = &__pyx_pybuffer_pdata1; - __pyx_pybuffer_pdata2.pybuffer.buf = NULL; - __pyx_pybuffer_pdata2.refcount = 0; - __pyx_pybuffernd_pdata2.data = NULL; - __pyx_pybuffernd_pdata2.rcbuffer = &__pyx_pybuffer_pdata2; - __pyx_pybuffer_pds.pybuffer.buf = NULL; - __pyx_pybuffer_pds.refcount = 0; - __pyx_pybuffernd_pds.data = NULL; - __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata1.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 804, __pyx_L1_error) - } - __pyx_pybuffernd_pdata1.diminfo[0].strides = __pyx_pybuffernd_pdata1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata1.diminfo[0].shape = __pyx_pybuffernd_pdata1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata1.diminfo[1].strides = __pyx_pybuffernd_pdata1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata1.diminfo[1].shape = __pyx_pybuffernd_pdata1.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata2.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 804, __pyx_L1_error) - } - __pyx_pybuffernd_pdata2.diminfo[0].strides = __pyx_pybuffernd_pdata2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata2.diminfo[0].shape = __pyx_pybuffernd_pdata2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata2.diminfo[1].strides = __pyx_pybuffernd_pdata2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata2.diminfo[1].shape = __pyx_pybuffernd_pdata2.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 804, __pyx_L1_error) - } - __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; + __Pyx_RefNannySetupContext("pybuffer_index", 0); - /* "src/helpers/correl.pyx":809 - * int pnshells, - * maxlen=None,): - * cdef int nmol = len(pdata1) # number of molecules # <<<<<<<<<<<<<< - * cdef int n = len(pdata1[0]) # number of time steps - * cdef int nds = len(pds[0]) # number of steps in delaunay array + /* "View.MemoryView":898 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata1)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 809, __pyx_L1_error) - __pyx_v_nmol = __pyx_t_1; + __pyx_v_suboffset = -1L; - /* "src/helpers/correl.pyx":810 - * maxlen=None,): - * cdef int nmol = len(pdata1) # number of molecules - * cdef int n = len(pdata1[0]) # number of time steps # <<<<<<<<<<<<<< - * cdef int nds = len(pds[0]) # number of steps in delaunay array - * cdef int maxdt = n + /* "View.MemoryView":899 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp + * */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata1), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n = __pyx_t_1; + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "src/helpers/correl.pyx":811 - * cdef int nmol = len(pdata1) # number of molecules - * cdef int n = len(pdata1[0]) # number of time steps - * cdef int nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< - * cdef int maxdt = n - * cdef int nshells = pnshells+1 + /* "View.MemoryView":902 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 811, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_nds = __pyx_t_1; + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":812 - * cdef int n = len(pdata1[0]) # number of time steps - * cdef int nds = len(pds[0]) # number of steps in delaunay array - * cdef int maxdt = n # <<<<<<<<<<<<<< - * cdef int nshells = pnshells+1 - * if maxlen != None: + /* "View.MemoryView":903 + * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: */ - __pyx_v_maxdt = __pyx_v_n; + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 903, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 903, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); - /* "src/helpers/correl.pyx":813 - * cdef int nds = len(pds[0]) # number of steps in delaunay array - * cdef int maxdt = n - * cdef int nshells = pnshells+1 # <<<<<<<<<<<<<< - * if maxlen != None: - * maxdt = maxlen + /* "View.MemoryView":904 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] */ - __pyx_v_nshells = (__pyx_v_pnshells + 1); + __pyx_v_stride = __pyx_v_itemsize; - /* "src/helpers/correl.pyx":814 - * cdef int maxdt = n - * cdef int nshells = pnshells+1 - * if maxlen != None: # <<<<<<<<<<<<<< - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) + /* "View.MemoryView":902 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 814, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 814, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { + goto __pyx_L3; + } - /* "src/helpers/correl.pyx":815 - * cdef int nshells = pnshells+1 - * if maxlen != None: - * maxdt = maxlen # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata2 = np.ascontiguousarray(pdata2) + /* "View.MemoryView":906 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: */ - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L1_error) - __pyx_v_maxdt = __pyx_t_4; + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - /* "src/helpers/correl.pyx":814 - * cdef int maxdt = n - * cdef int nshells = pnshells+1 - * if maxlen != None: # <<<<<<<<<<<<<< - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) + /* "View.MemoryView":907 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] */ - } + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - /* "src/helpers/correl.pyx":816 - * if maxlen != None: - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata2 = np.ascontiguousarray(pdata2) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 816, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 816, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, ((PyObject *)__pyx_v_pdata1)) : __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_pdata1)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 816, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata1.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contdata1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata1.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 816, __pyx_L1_error) - } else {__pyx_pybuffernd_contdata1.diminfo[0].strides = __pyx_pybuffernd_contdata1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata1.diminfo[0].shape = __pyx_pybuffernd_contdata1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata1.diminfo[1].strides = __pyx_pybuffernd_contdata1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata1.diminfo[1].shape = __pyx_pybuffernd_contdata1.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_7 = 0; - __pyx_v_contdata1 = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":817 - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata2 = np.ascontiguousarray(pdata2) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata1 = contdata1.data + /* "View.MemoryView":909 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + * + * if index < 0: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 817, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 817, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, ((PyObject *)__pyx_v_pdata2)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_pdata2)); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 817, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 817, __pyx_L1_error) - __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata2.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contdata2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata2.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 817, __pyx_L1_error) - } else {__pyx_pybuffernd_contdata2.diminfo[0].strides = __pyx_pybuffernd_contdata2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata2.diminfo[0].shape = __pyx_pybuffernd_contdata2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata2.diminfo[1].strides = __pyx_pybuffernd_contdata2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata2.diminfo[1].shape = __pyx_pybuffernd_contdata2.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_8 = 0; - __pyx_v_contdata2 = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); - /* "src/helpers/correl.pyx":818 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata2 = np.ascontiguousarray(pdata2) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< - * cdef double *cdata1 = contdata1.data - * cdef double *cdata2 = contdata2.data + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, ((PyObject *)__pyx_v_pds)) : __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_pds)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 818, __pyx_L1_error) - __pyx_t_9 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 818, __pyx_L1_error) - } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; } } - __pyx_t_9 = 0; - __pyx_v_contds = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_L3:; - /* "src/helpers/correl.pyx":819 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata2 = np.ascontiguousarray(pdata2) - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata1 = contdata1.data # <<<<<<<<<<<<<< - * cdef double *cdata2 = contdata2.data - * cdef int *cds = contds.data + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ - __pyx_v_cdata1 = ((double *)__pyx_v_contdata1->data); + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":820 - * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) - * cdef double *cdata1 = contdata1.data - * cdef double *cdata2 = contdata2.data # <<<<<<<<<<<<<< - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":912 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" */ - __pyx_v_cdata2 = ((double *)__pyx_v_contdata2->data); + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); - /* "src/helpers/correl.pyx":821 - * cdef double *cdata1 = contdata1.data - * cdef double *cdata2 = contdata2.data - * cdef int *cds = contds.data # <<<<<<<<<<<<<< - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - */ - __pyx_v_cds = ((int *)__pyx_v_contds->data); - - /* "src/helpers/correl.pyx":822 - * cdef double *cdata2 = contdata2.data - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5); - __pyx_t_2 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 822, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_pcorr = __pyx_t_11; - __pyx_t_11 = 0; + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/correl.pyx":823 - * cdef int *cds = contds.data - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + /* "View.MemoryView":914 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * if index >= shape: */ - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __pyx_t_11 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_pselfcorr = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__7); + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 914, __pyx_L1_error) - /* "src/helpers/correl.pyx":824 - * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5); - __pyx_t_2 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_pcrosscorr = __pyx_t_11; - __pyx_t_11 = 0; + } - /* "src/helpers/correl.pyx":825 - * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ - if (!(likely(((__pyx_v_pcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 825, __pyx_L1_error) - __pyx_t_11 = __pyx_v_pcorr; - __Pyx_INCREF(__pyx_t_11); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 825, __pyx_L1_error) - } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; - } } - __pyx_v_corr = ((PyArrayObject *)__pyx_t_11); - __pyx_t_11 = 0; - /* "src/helpers/correl.pyx":826 - * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * */ - if (!(likely(((__pyx_v_pselfcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pselfcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 826, __pyx_L1_error) - __pyx_t_11 = __pyx_v_pselfcorr; - __Pyx_INCREF(__pyx_t_11); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_selfcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 826, __pyx_L1_error) - } else {__pyx_pybuffernd_selfcorr.diminfo[0].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfcorr.diminfo[0].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfcorr.diminfo[1].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfcorr.diminfo[1].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_v_selfcorr = ((PyArrayObject *)__pyx_t_11); - __pyx_t_11 = 0; + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/correl.pyx":827 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":917 + * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride */ - if (!(likely(((__pyx_v_pcrosscorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcrosscorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 827, __pyx_L1_error) - __pyx_t_11 = __pyx_v_pcrosscorr; - __Pyx_INCREF(__pyx_t_11); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_crosscorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 827, __pyx_L1_error) - } else {__pyx_pybuffernd_crosscorr.diminfo[0].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crosscorr.diminfo[0].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crosscorr.diminfo[1].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crosscorr.diminfo[1].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_v_crosscorr = ((PyArrayObject *)__pyx_t_11); - __pyx_t_11 = 0; + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__7); + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 917, __pyx_L1_error) - /* "src/helpers/correl.pyx":828 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * */ - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __pyx_t_11 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 828, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 828, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; - } } - __pyx_t_12 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":829 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data + /* "View.MemoryView":919 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5); - __pyx_t_2 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 829, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 829, __pyx_L1_error) - __pyx_t_13 = ((PyArrayObject *)__pyx_t_11); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_selfctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 829, __pyx_L1_error) - } else {__pyx_pybuffernd_selfctr.diminfo[0].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfctr.diminfo[0].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfctr.diminfo[1].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfctr.diminfo[1].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_13 = 0; - __pyx_v_selfctr = ((PyArrayObject *)__pyx_t_11); - __pyx_t_11 = 0; + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - /* "src/helpers/correl.pyx":830 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data + /* "View.MemoryView":920 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * */ - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __pyx_t_11 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 830, __pyx_L1_error) - __pyx_t_14 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_crossctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 830, __pyx_L1_error) - } else {__pyx_pybuffernd_crossctr.diminfo[0].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crossctr.diminfo[0].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crossctr.diminfo[1].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crossctr.diminfo[1].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_14 = 0; - __pyx_v_crossctr = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":831 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data + /* "View.MemoryView":921 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + * + * return resultp */ - __pyx_v_ccorr = ((double *)__pyx_v_corr->data); + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); - /* "src/helpers/correl.pyx":832 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data # <<<<<<<<<<<<<< - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data + /* "View.MemoryView":920 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * */ - __pyx_v_cselfcorr = ((double *)__pyx_v_selfcorr->data); + } - /* "src/helpers/correl.pyx":833 - * cdef double *ccorr = corr.data - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data # <<<<<<<<<<<<<< - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data + /* "View.MemoryView":923 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< + * + * */ - __pyx_v_ccrosscorr = ((double *)__pyx_v_crosscorr->data); + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; - /* "src/helpers/correl.pyx":834 - * cdef double *cselfcorr = selfcorr.data - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< - * cdef double *cselfctr = selfctr.data - * cdef double *ccrossctr = crossctr.data + /* "View.MemoryView":896 + * + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ - __pyx_v_cctr = ((double *)__pyx_v_ctr->data); - /* "src/helpers/correl.pyx":835 - * cdef double *ccrosscorr = crosscorr.data - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data # <<<<<<<<<<<<<< - * cdef double *ccrossctr = crossctr.data - * cdef double value + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim + * */ - __pyx_v_cselfctr = ((double *)__pyx_v_selfctr->data); - /* "src/helpers/correl.pyx":836 - * cdef double *cctr = ctr.data - * cdef double *cselfctr = selfctr.data - * cdef double *ccrossctr = crossctr.data # <<<<<<<<<<<<<< - * cdef double value - * cdef int i,start,dt,mol,shellstart,shelldt,idx +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("transpose_memslice", 1); + + /* "View.MemoryView":930 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t *shape = memslice.shape */ - __pyx_v_ccrossctr = ((double *)__pyx_v_crossctr->data); + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; - /* "src/helpers/correl.pyx":840 - * cdef int i,start,dt,mol,shellstart,shelldt,idx + /* "View.MemoryView":932 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_16 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_16 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_3) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_value) - #endif /* _OPENMP */ - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){ - { - __pyx_v_dt = (int)(0 + 1 * __pyx_t_15); - /* Initialize private variables to invalid values */ - __pyx_v_idx = ((int)0xbad0bad0); - __pyx_v_mol = ((int)0xbad0bad0); - __pyx_v_shelldt = ((int)0xbad0bad0); - __pyx_v_shellstart = ((int)0xbad0bad0); - __pyx_v_start = ((int)0xbad0bad0); - __pyx_v_value = ((double)__PYX_NAN()); + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; - /* "src/helpers/correl.pyx":841 + /* "View.MemoryView":933 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for start in range(n-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * shellstart = cds[mol*nds+start]-1 */ - __pyx_t_17 = (__pyx_v_n - __pyx_v_dt); - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_start = __pyx_t_19; + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; - /* "src/helpers/correl.pyx":842 - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * shellstart = cds[mol*nds+start]-1 - * shelldt = cds[mol*nds+start+dt]-1 + /* "View.MemoryView":937 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] */ - __pyx_t_20 = __pyx_v_nmol; - __pyx_t_21 = __pyx_t_20; - for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { - __pyx_v_mol = __pyx_t_22; + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; - /* "src/helpers/correl.pyx":843 - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * shellstart = cds[mol*nds+start]-1 # <<<<<<<<<<<<<< - * shelldt = cds[mol*nds+start+dt]-1 - * # if shellstart < nshells: + /* "View.MemoryView":938 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] */ - __pyx_v_shellstart = ((__pyx_v_cds[((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start)]) - 1); + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); - /* "src/helpers/correl.pyx":844 - * for mol in range(nmol): # loop over molecules/entries - * shellstart = cds[mol*nds+start]-1 - * shelldt = cds[mol*nds+start+dt]-1 # <<<<<<<<<<<<<< - * # if shellstart < nshells: - * value = cdata1[mol*n+start]*cdata2[mol*n+start+dt] + /* "View.MemoryView":939 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * */ - __pyx_v_shelldt = ((__pyx_v_cds[(((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start) + __pyx_v_dt)]) - 1); + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; - /* "src/helpers/correl.pyx":846 - * shelldt = cds[mol*nds+start+dt]-1 - * # if shellstart < nshells: - * value = cdata1[mol*n+start]*cdata2[mol*n+start+dt] # <<<<<<<<<<<<<< - * idx = maxdt*shellstart+dt - * ccorr[idx] += value + /* "View.MemoryView":940 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: */ - __pyx_v_value = ((__pyx_v_cdata1[((__pyx_v_mol * __pyx_v_n) + __pyx_v_start)]) * (__pyx_v_cdata2[(((__pyx_v_mol * __pyx_v_n) + __pyx_v_start) + __pyx_v_dt)])); + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; - /* "src/helpers/correl.pyx":847 - * # if shellstart < nshells: - * value = cdata1[mol*n+start]*cdata2[mol*n+start+dt] - * idx = maxdt*shellstart+dt # <<<<<<<<<<<<<< - * ccorr[idx] += value - * cctr[idx] += 1 + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * */ - __pyx_v_idx = ((__pyx_v_maxdt * __pyx_v_shellstart) + __pyx_v_dt); + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { - /* "src/helpers/correl.pyx":848 - * value = cdata1[mol*n+start]*cdata2[mol*n+start+dt] - * idx = maxdt*shellstart+dt - * ccorr[idx] += value # <<<<<<<<<<<<<< - * cctr[idx] += 1 - * if shellstart == shelldt: + /* "View.MemoryView":943 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 */ - __pyx_t_23 = __pyx_v_idx; - (__pyx_v_ccorr[__pyx_t_23]) = ((__pyx_v_ccorr[__pyx_t_23]) + __pyx_v_value); + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_kp_s_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L1_error) - /* "src/helpers/correl.pyx":849 - * idx = maxdt*shellstart+dt - * ccorr[idx] += value - * cctr[idx] += 1 # <<<<<<<<<<<<<< - * if shellstart == shelldt: - * cselfcorr[idx] += value + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * */ - __pyx_t_23 = __pyx_v_idx; - (__pyx_v_cctr[__pyx_t_23]) = ((__pyx_v_cctr[__pyx_t_23]) + 1.0); + } + } - /* "src/helpers/correl.pyx":850 - * ccorr[idx] += value - * cctr[idx] += 1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * cselfcorr[idx] += value - * cselfctr[idx] += 1 + /* "View.MemoryView":945 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * */ - __pyx_t_3 = ((__pyx_v_shellstart == __pyx_v_shelldt) != 0); - if (__pyx_t_3) { + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":851 - * cctr[idx] += 1 - * if shellstart == shelldt: - * cselfcorr[idx] += value # <<<<<<<<<<<<<< - * cselfctr[idx] += 1 + /* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim * */ - __pyx_t_23 = __pyx_v_idx; - (__pyx_v_cselfcorr[__pyx_t_23]) = ((__pyx_v_cselfcorr[__pyx_t_23]) + __pyx_v_value); - /* "src/helpers/correl.pyx":852 - * if shellstart == shelldt: - * cselfcorr[idx] += value - * cselfctr[idx] += 1 # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} + +/* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * for i in range(maxdt*nshells): */ - __pyx_t_23 = __pyx_v_idx; - (__pyx_v_cselfctr[__pyx_t_23]) = ((__pyx_v_cselfctr[__pyx_t_23]) + 1.0); - /* "src/helpers/correl.pyx":850 - * ccorr[idx] += value - * cctr[idx] += 1 - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * cselfcorr[idx] += value - * cselfctr[idx] += 1 +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "View.MemoryView":964 + * + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); - /* "src/helpers/correl.pyx":840 - * cdef int i,start,dt,mol,shellstart,shelldt,idx + /* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } - /* "src/helpers/correl.pyx":854 - * cselfctr[idx] += 1 + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) */ - __pyx_t_16 = (__pyx_v_maxdt * __pyx_v_nshells); - __pyx_t_15 = __pyx_t_16; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_15; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - /* "src/helpers/correl.pyx":855 +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":967 * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) * else: */ - __pyx_t_3 = (((__pyx_v_cctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_3) { + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":856 - * for i in range(maxdt*nshells): - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< + /* "View.MemoryView":968 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< * else: - * print 'tot too sparse' + * return memoryview.convert_item_to_object(self, itemp) */ - __pyx_t_17 = __pyx_v_i; - if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 856, __pyx_L1_error) - } - (__pyx_v_ccorr[__pyx_t_17]) = ((__pyx_v_ccorr[__pyx_t_17]) / (__pyx_v_cctr[__pyx_v_i])); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 968, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/correl.pyx":855 + /* "View.MemoryView":967 * - * for i in range(maxdt*nshells): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) * else: */ - goto __pyx_L20; - } + } - /* "src/helpers/correl.pyx":858 - * ccorr[i] /= cctr[i] + /* "View.MemoryView":970 + * return self.to_object_func(itemp) * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< - * if cctr[i] != 0: - * cselfcorr[i] /= cselfctr[i] + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 858, __pyx_L1_error) - } - __pyx_L20:; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 970, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } - /* "src/helpers/correl.pyx":859 - * else: - * print 'tot too sparse' - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * cselfcorr[i] /= cselfctr[i] - * else: + /* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) */ - __pyx_t_3 = (((__pyx_v_cctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_3) { - /* "src/helpers/correl.pyx":860 - * print 'tot too sparse' - * if cctr[i] != 0: - * cselfcorr[i] /= cselfctr[i] # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) + */ + +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":973 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) * else: - * print 'self too sparse' */ - __pyx_t_17 = __pyx_v_i; - if (unlikely((__pyx_v_cselfctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 860, __pyx_L1_error) - } - (__pyx_v_cselfcorr[__pyx_t_17]) = ((__pyx_v_cselfcorr[__pyx_t_17]) / (__pyx_v_cselfctr[__pyx_v_i])); + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":859 + /* "View.MemoryView":974 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< * else: - * print 'tot too sparse' - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * cselfcorr[i] /= cselfctr[i] + * memoryview.assign_item_from_object(self, itemp, value) + */ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 974, __pyx_L1_error) + + /* "View.MemoryView":973 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) * else: */ - goto __pyx_L21; - } + goto __pyx_L3; + } - /* "src/helpers/correl.pyx":862 - * cselfcorr[i] /= cselfctr[i] + /* "View.MemoryView":976 + * self.to_dtype_func(itemp, value) * else: - * print 'self too sparse' # <<<<<<<<<<<<<< + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< * - * for i in range(maxdt*nshells): + * cdef _get_base(self): */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_self_too_sparse) < 0) __PYX_ERR(0, 862, __pyx_L1_error) - } - __pyx_L21:; + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } + __pyx_L3:; - /* "src/helpers/correl.pyx":864 - * print 'self too sparse' + /* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) * - * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] - * ccrossctr[i] = cctr[i] - cselfctr[i] + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ - __pyx_t_16 = (__pyx_v_maxdt * __pyx_v_nshells); - __pyx_t_15 = __pyx_t_16; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_15; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - /* "src/helpers/correl.pyx":865 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) * - * for i in range(maxdt*nshells): - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] # <<<<<<<<<<<<<< - * ccrossctr[i] = cctr[i] - cselfctr[i] + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object * */ - (__pyx_v_ccrosscorr[__pyx_v_i]) = ((__pyx_v_ccorr[__pyx_v_i]) - (__pyx_v_cselfcorr[__pyx_v_i])); - /* "src/helpers/correl.pyx":866 - * for i in range(maxdt*nshells): - * ccrosscorr[i] = ccorr[i] - cselfcorr[i] - * ccrossctr[i] = cctr[i] - cselfctr[i] # <<<<<<<<<<<<<< - * - * return corr,selfcorr,crosscorr - */ - (__pyx_v_ccrossctr[__pyx_v_i]) = ((__pyx_v_cctr[__pyx_v_i]) - (__pyx_v_cselfctr[__pyx_v_i])); - } +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); - /* "src/helpers/correl.pyx":868 - * ccrossctr[i] = cctr[i] - cselfctr[i] + /* "View.MemoryView":979 * - * return corr,selfcorr,crosscorr # <<<<<<<<<<<<<< + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 868, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_corr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_corr)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_corr)); - __Pyx_INCREF(((PyObject *)__pyx_v_selfcorr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_selfcorr)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_selfcorr)); - __Pyx_INCREF(((PyObject *)__pyx_v_crosscorr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_crosscorr)); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_crosscorr)); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; goto __pyx_L0; - /* "src/helpers/correl.pyx":804 + /* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object * - * @cython.boundscheck(False) - * def sparsefullcrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] pdata2, - * np.ndarray[np.int32_t,ndim=2] pds, */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.sparsefullcrosscorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_contdata1); - __Pyx_XDECREF((PyObject *)__pyx_v_contdata2); - __Pyx_XDECREF((PyObject *)__pyx_v_contds); - __Pyx_XDECREF(__pyx_v_pcorr); - __Pyx_XDECREF(__pyx_v_pselfcorr); - __Pyx_XDECREF(__pyx_v_pcrosscorr); - __Pyx_XDECREF((PyObject *)__pyx_v_corr); - __Pyx_XDECREF((PyObject *)__pyx_v_selfcorr); - __Pyx_XDECREF((PyObject *)__pyx_v_crosscorr); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); - __Pyx_XDECREF((PyObject *)__pyx_v_selfctr); - __Pyx_XDECREF((PyObject *)__pyx_v_crossctr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":872 - * - * @cython.boundscheck(False) - * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * maxlen=None): - * cdef int nmol = len(pdata) # number of molecules +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_29sparsecorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_29sparsecorrelate = {"sparsecorrelate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_29sparsecorrelate, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_29sparsecorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_pdata = 0; - PyObject *__pyx_v_maxlen = 0; +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sparsecorrelate (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_maxlen,0}; - PyObject* values[2] = {0,0}; + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - /* "src/helpers/correl.pyx":873 - * @cython.boundscheck(False) - * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, - * maxlen=None): # <<<<<<<<<<<<<< - * cdef int nmol = len(pdata) # number of molecules - * cdef int n = len(pdata[0]) # number of time steps + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - values[1] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pdata)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[1] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sparsecorrelate") < 0)) __PYX_ERR(0, 872, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_pdata = ((PyArrayObject *)values[0]); - __pyx_v_maxlen = values[1]; + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparsecorrelate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 872, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.sparsecorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 872, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_28sparsecorrelate(__pyx_self, __pyx_v_pdata, __pyx_v_maxlen); - - /* "src/helpers/correl.pyx":872 - * - * @cython.boundscheck(False) - * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * maxlen=None): - * cdef int nmol = len(pdata) # number of molecules - */ + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_28sparsecorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyObject *__pyx_v_maxlen) { - int __pyx_v_nmol; - int __pyx_v_n; - int __pyx_v_maxdt; - PyArrayObject *__pyx_v_contdata = 0; - double *__pyx_v_cdata; - PyArrayObject *__pyx_v_corr = 0; - PyArrayObject *__pyx_v_ctr = 0; - double *__pyx_v_ccorr; - double *__pyx_v_cctr; - double __pyx_v_value; - int __pyx_v_start; - int __pyx_v_dt; - int __pyx_v_mol; - int __pyx_v_i; - __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; - __Pyx_Buffer __pyx_pybuffer_contdata; - __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; - __Pyx_Buffer __pyx_pybuffer_corr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; - __Pyx_Buffer __pyx_pybuffer_pdata; +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sparsecorrelate", 0); - __pyx_pybuffer_contdata.pybuffer.buf = NULL; - __pyx_pybuffer_contdata.refcount = 0; - __pyx_pybuffernd_contdata.data = NULL; - __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; - __pyx_pybuffer_corr.pybuffer.buf = NULL; - __pyx_pybuffer_corr.refcount = 0; - __pyx_pybuffernd_corr.data = NULL; - __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_pdata.pybuffer.buf = NULL; - __pyx_pybuffer_pdata.refcount = 0; - __pyx_pybuffernd_pdata.data = NULL; - __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 872, __pyx_L1_error) - } - __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/helpers/correl.pyx":874 - * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, - * maxlen=None): - * cdef int nmol = len(pdata) # number of molecules # <<<<<<<<<<<<<< - * cdef int n = len(pdata[0]) # number of time steps - * cdef int maxdt = n + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 874, __pyx_L1_error) - __pyx_v_nmol = __pyx_t_1; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/helpers/correl.pyx":875 - * maxlen=None): - * cdef int nmol = len(pdata) # number of molecules - * cdef int n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< - * cdef int maxdt = n - * if maxlen != None: + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 875, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n = __pyx_t_1; - /* "src/helpers/correl.pyx":876 - * cdef int nmol = len(pdata) # number of molecules - * cdef int n = len(pdata[0]) # number of time steps - * cdef int maxdt = n # <<<<<<<<<<<<<< - * if maxlen != None: - * maxdt = maxlen + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":999 + * + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ - __pyx_v_maxdt = __pyx_v_n; - /* "src/helpers/correl.pyx":877 - * cdef int n = len(pdata[0]) # number of time steps - * cdef int maxdt = n - * if maxlen != None: # <<<<<<<<<<<<<< - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + + /* "View.MemoryView":1007 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 877, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":878 - * cdef int maxdt = n - * if maxlen != None: - * maxdt = maxlen # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef double *cdata = contdata.data + /* "View.MemoryView":1008 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * + * */ - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 878, __pyx_L1_error) - __pyx_v_maxdt = __pyx_t_4; + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "src/helpers/correl.pyx":877 - * cdef int n = len(pdata[0]) # number of time steps - * cdef int maxdt = n - * if maxlen != None: # <<<<<<<<<<<<<< - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + /* "View.MemoryView":1007 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * */ } - /* "src/helpers/correl.pyx":879 - * if maxlen != None: - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< - * cdef double *cdata = contdata.data - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] corr = np.zeros(maxdt,dtype=np.float64) + /* "View.MemoryView":1013 + * + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 879, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 879, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, ((PyObject *)__pyx_v_pdata)) : __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_pdata)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 879, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 879, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 879, __pyx_L1_error) - } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_7 = 0; - __pyx_v_contdata = ((PyArrayObject *)__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":880 - * maxdt = maxlen - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] corr = np.zeros(maxdt,dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ctr = np.zeros(maxdt,dtype=np.float64) + /* "View.MemoryView":1015 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * */ - __pyx_v_cdata = ((double *)__pyx_v_contdata->data); + __pyx_v_result->from_slice = __pyx_v_memviewslice; - /* "src/helpers/correl.pyx":881 - * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) - * cdef double *cdata = contdata.data - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] corr = np.zeros(maxdt,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ctr = np.zeros(maxdt,dtype=np.float64) - * cdef double *ccorr = corr.data + /* "View.MemoryView":1016 + * + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 881, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 881, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 881, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 881, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 881, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 881, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 881, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { - __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 881, __pyx_L1_error) - } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_10 = 0; - __pyx_v_corr = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - /* "src/helpers/correl.pyx":882 - * cdef double *cdata = contdata.data - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] corr = np.zeros(maxdt,dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ctr = np.zeros(maxdt,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *ccorr = corr.data - * cdef double *cctr = ctr.data + /* "View.MemoryView":1018 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo + * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 882, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 882, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 882, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_11 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; - - /* "src/helpers/correl.pyx":883 - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] corr = np.zeros(maxdt,dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ctr = np.zeros(maxdt,dtype=np.float64) - * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< - * cdef double *cctr = ctr.data - * cdef double value - */ - __pyx_v_ccorr = ((double *)__pyx_v_corr->data); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":884 - * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ctr = np.zeros(maxdt,dtype=np.float64) - * cdef double *ccorr = corr.data - * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< - * cdef double value - * cdef int start,dt,mol + /* "View.MemoryView":1019 + * + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * + * result.view = memviewslice.memview.view */ - __pyx_v_cctr = ((double *)__pyx_v_ctr->data); + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - /* "src/helpers/correl.pyx":888 - * cdef int start,dt,mol + /* "View.MemoryView":1021 + * result.typeinfo = memviewslice.memview.typeinfo * - * for dt in prange(maxdt,nogil=True): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_13 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_13 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_3) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_start) lastprivate(__pyx_v_value) - #endif /* _OPENMP */ - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){ - { - __pyx_v_dt = (int)(0 + 1 * __pyx_t_12); - /* Initialize private variables to invalid values */ - __pyx_v_mol = ((int)0xbad0bad0); - __pyx_v_start = ((int)0xbad0bad0); - __pyx_v_value = ((double)__PYX_NAN()); + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; - /* "src/helpers/correl.pyx":889 + /* "View.MemoryView":1022 * - * for dt in prange(maxdt,nogil=True): # loop over all delta t - * for start in range(n-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None */ - __pyx_t_14 = (__pyx_v_n - __pyx_v_dt); - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { - __pyx_v_start = __pyx_t_16; + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - /* "src/helpers/correl.pyx":890 - * for dt in prange(maxdt,nogil=True): # loop over all delta t - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - * if value != 0: + /* "View.MemoryView":1023 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) */ - __pyx_t_17 = __pyx_v_nmol; - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_mol = __pyx_t_19; + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - /* "src/helpers/correl.pyx":891 - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] # <<<<<<<<<<<<<< - * if value != 0: - * ccorr[dt] += value + /* "View.MemoryView":1024 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * */ - __pyx_v_value = ((__pyx_v_cdata[((__pyx_v_mol * __pyx_v_n) + __pyx_v_start)]) * (__pyx_v_cdata[(((__pyx_v_mol * __pyx_v_n) + __pyx_v_start) + __pyx_v_dt)])); + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; - /* "src/helpers/correl.pyx":892 - * for mol in range(nmol): # loop over molecules/entries - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - * if value != 0: # <<<<<<<<<<<<<< - * ccorr[dt] += value - * cctr[dt] += 1 + /* "View.MemoryView":1025 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: */ - __pyx_t_3 = ((__pyx_v_value != 0.0) != 0); - if (__pyx_t_3) { + Py_INCREF(Py_None); - /* "src/helpers/correl.pyx":893 - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - * if value != 0: - * ccorr[dt] += value # <<<<<<<<<<<<<< - * cctr[dt] += 1 + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: */ - __pyx_t_20 = __pyx_v_dt; - (__pyx_v_ccorr[__pyx_t_20]) = ((__pyx_v_ccorr[__pyx_t_20]) + __pyx_v_value); + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":894 - * if value != 0: - * ccorr[dt] += value - * cctr[dt] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1028 * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO + */ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: */ - __pyx_t_20 = __pyx_v_dt; - (__pyx_v_cctr[__pyx_t_20]) = ((__pyx_v_cctr[__pyx_t_20]) + 1.0); + goto __pyx_L4; + } - /* "src/helpers/correl.pyx":892 - * for mol in range(nmol): # loop over molecules/entries - * value = cdata[mol*n+start]*cdata[mol*n+start+dt] - * if value != 0: # <<<<<<<<<<<<<< - * ccorr[dt] += value - * cctr[dt] += 1 + /* "View.MemoryView":1030 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; - /* "src/helpers/correl.pyx":888 - * cdef int start,dt,mol + /* "View.MemoryView":1032 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides * - * for dt in prange(maxdt,nogil=True): # loop over all delta t # <<<<<<<<<<<<<< - * for start in range(n-dt): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); - /* "src/helpers/correl.pyx":897 + /* "View.MemoryView":1033 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< * * - * for i in range(maxdt): # <<<<<<<<<<<<<< - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] */ - __pyx_t_13 = __pyx_v_maxdt; - __pyx_t_12 = __pyx_t_13; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_12; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - /* "src/helpers/correl.pyx":898 + /* "View.MemoryView":1036 * - * for i in range(maxdt): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: */ - __pyx_t_3 = (((__pyx_v_cctr[__pyx_v_i]) != 0.0) != 0); - if (__pyx_t_3) { + __pyx_v_result->__pyx_base.view.suboffsets = NULL; - /* "src/helpers/correl.pyx":899 - * for i in range(maxdt): - * if cctr[i] != 0: - * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< - * else: - * print 'too sparse' + /* "View.MemoryView":1037 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets */ - __pyx_t_14 = __pyx_v_i; - if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 899, __pyx_L1_error) - } - (__pyx_v_ccorr[__pyx_t_14]) = ((__pyx_v_ccorr[__pyx_t_14]) / (__pyx_v_cctr[__pyx_v_i])); + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); + + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break + */ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":898 + /* "View.MemoryView":1039 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break * - * for i in range(maxdt): - * if cctr[i] != 0: # <<<<<<<<<<<<<< - * ccorr[i] /= cctr[i] - * else: */ - goto __pyx_L20; - } + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - /* "src/helpers/correl.pyx":901 - * ccorr[i] /= cctr[i] - * else: - * print 'too sparse' # <<<<<<<<<<<<<< + /* "View.MemoryView":1040 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< * - * return corr + * result.view.len = result.view.itemsize + */ + goto __pyx_L6_break; + + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_too_sparse) < 0) __PYX_ERR(0, 901, __pyx_L1_error) } - __pyx_L20:; } + __pyx_L6_break:; - /* "src/helpers/correl.pyx":903 - * print 'too sparse' + /* "View.MemoryView":1042 + * break * - * return corr # <<<<<<<<<<<<<< + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length + */ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + + /* "View.MemoryView":1043 * - * @cython.boundscheck(False) + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * + */ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1044 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func + */ + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } + + /* "View.MemoryView":1046 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * + */ + __pyx_v_result->to_object_func = __pyx_v_to_object_func; + + /* "View.MemoryView":1047 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result + */ + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + + /* "View.MemoryView":1049 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_corr)); - __pyx_r = ((PyObject *)__pyx_v_corr); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "src/helpers/correl.pyx":872 + /* "View.MemoryView":999 * - * @cython.boundscheck(False) - * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * maxlen=None): - * cdef int nmol = len(pdata) # number of molecules + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.sparsecorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_contdata); - __Pyx_XDECREF((PyObject *)__pyx_v_corr); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":906 - * - * @cython.boundscheck(False) - * def calcAngularDisplacement(np.ndarray[np.float64_t,ndim=3] coor_ts, delta): # <<<<<<<<<<<<<< +/* "View.MemoryView":1052 * - * cdef int maxTime = coor_ts.shape[0] + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_31calcAngularDisplacement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_31calcAngularDisplacement = {"calcAngularDisplacement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_31calcAngularDisplacement, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_31calcAngularDisplacement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_coor_ts = 0; - PyObject *__pyx_v_delta = 0; +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcAngularDisplacement (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor_ts,&__pyx_n_s_delta,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_ts)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcAngularDisplacement", 1, 2, 2, 1); __PYX_ERR(0, 906, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcAngularDisplacement") < 0)) __PYX_ERR(0, 906, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_coor_ts = ((PyArrayObject *)values[0]); - __pyx_v_delta = values[1]; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice + */ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":1056 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: + */ + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1057 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) + */ + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; + + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice + */ } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcAngularDisplacement", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 906, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.calcAngularDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_ts), __pyx_ptype_5numpy_ndarray, 1, "coor_ts", 0))) __PYX_ERR(0, 906, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_30calcAngularDisplacement(__pyx_self, __pyx_v_coor_ts, __pyx_v_delta); + + /* "View.MemoryView":1059 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice + * + */ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + + /* "View.MemoryView":1060 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_slice_copy') + */ + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } + + /* "View.MemoryView":1052 + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_30calcAngularDisplacement(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor_ts, PyObject *__pyx_v_delta) { - int __pyx_v_maxTime; - int __pyx_v_natoms; - double __pyx_v_dt; - PyArrayObject *__pyx_v_msd = 0; - Correl *__pyx_v_myCorrel; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_ts; - __Pyx_Buffer __pyx_pybuffer_coor_ts; - __Pyx_LocalBuf_ND __pyx_pybuffernd_msd; - __Pyx_Buffer __pyx_pybuffer_msd; - PyObject *__pyx_r = NULL; +/* "View.MemoryView":1063 + * + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets + */ + +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; __Pyx_RefNannyDeclarations - double __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - Correl *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcAngularDisplacement", 0); - __pyx_pybuffer_msd.pybuffer.buf = NULL; - __pyx_pybuffer_msd.refcount = 0; - __pyx_pybuffernd_msd.data = NULL; - __pyx_pybuffernd_msd.rcbuffer = &__pyx_pybuffer_msd; - __pyx_pybuffer_coor_ts.pybuffer.buf = NULL; - __pyx_pybuffer_coor_ts.refcount = 0; - __pyx_pybuffernd_coor_ts.data = NULL; - __pyx_pybuffernd_coor_ts.rcbuffer = &__pyx_pybuffer_coor_ts; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 906, __pyx_L1_error) - } - __pyx_pybuffernd_coor_ts.diminfo[0].strides = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_ts.diminfo[0].shape = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_ts.diminfo[1].strides = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_ts.diminfo[1].shape = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coor_ts.diminfo[2].strides = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coor_ts.diminfo[2].shape = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.shape[2]; + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("slice_copy", 0); - /* "src/helpers/correl.pyx":908 - * def calcAngularDisplacement(np.ndarray[np.float64_t,ndim=3] coor_ts, delta): + /* "View.MemoryView":1067 + * cdef (Py_ssize_t*) shape, strides, suboffsets * - * cdef int maxTime = coor_ts.shape[0] # <<<<<<<<<<<<<< - * cdef int natoms = coor_ts.shape[1] - * cdef double dt = delta + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets */ - __pyx_v_maxTime = ((int)(__pyx_v_coor_ts->dimensions[0])); + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; - /* "src/helpers/correl.pyx":909 + /* "View.MemoryView":1068 * - * cdef int maxTime = coor_ts.shape[0] - * cdef int natoms = coor_ts.shape[1] # <<<<<<<<<<<<<< - * cdef double dt = delta + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets * */ - __pyx_v_natoms = ((int)(__pyx_v_coor_ts->dimensions[1])); + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; - /* "src/helpers/correl.pyx":910 - * cdef int maxTime = coor_ts.shape[0] - * cdef int natoms = coor_ts.shape[1] - * cdef double dt = delta # <<<<<<<<<<<<<< + /* "View.MemoryView":1069 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< * - * cdef np.ndarray[np.float64_t,ndim=2] msd = np.zeros((maxTime,3)) + * dst.memview = <__pyx_memoryview *> memview */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_delta); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 910, __pyx_L1_error) - __pyx_v_dt = ((double)__pyx_t_1); + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; - /* "src/helpers/correl.pyx":912 - * cdef double dt = delta + /* "View.MemoryView":1071 + * suboffsets = memview.view.suboffsets * - * cdef np.ndarray[np.float64_t,ndim=2] msd = np.zeros((maxTime,3)) # <<<<<<<<<<<<<< + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf * - * cdef Correl *myCorrel = new Correl() */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_maxTime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_3); - __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 912, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 912, __pyx_L1_error) - __pyx_t_6 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_msd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 912, __pyx_L1_error) - } else {__pyx_pybuffernd_msd.diminfo[0].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msd.diminfo[0].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_msd.diminfo[1].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_msd.diminfo[1].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_6 = 0; - __pyx_v_msd = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); - /* "src/helpers/correl.pyx":914 - * cdef np.ndarray[np.float64_t,ndim=2] msd = np.zeros((maxTime,3)) + /* "View.MemoryView":1072 * - * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< * - * myCorrel.msd_angvelmf( coor_ts.data, msd.data, natoms, maxTime, dt) + * for dim in range(memview.view.ndim): */ - try { - __pyx_t_7 = new Correl(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 914, __pyx_L1_error) - } - __pyx_v_myCorrel = __pyx_t_7; + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - /* "src/helpers/correl.pyx":916 - * cdef Correl *myCorrel = new Correl() - * - * myCorrel.msd_angvelmf( coor_ts.data, msd.data, natoms, maxTime, dt) # <<<<<<<<<<<<<< + /* "View.MemoryView":1074 + * dst.data = memview.view.buf * - * del myCorrel + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] */ - __pyx_v_myCorrel->msd_angvelmf(((double *)__pyx_v_coor_ts->data), ((double *)__pyx_v_msd->data), __pyx_v_natoms, __pyx_v_maxTime, __pyx_v_dt); + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; - /* "src/helpers/correl.pyx":918 - * myCorrel.msd_angvelmf( coor_ts.data, msd.data, natoms, maxTime, dt) + /* "View.MemoryView":1075 * - * del myCorrel # <<<<<<<<<<<<<< - * - * return msd + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 */ - delete __pyx_v_myCorrel; + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); - /* "src/helpers/correl.pyx":920 - * del myCorrel - * - * return msd # <<<<<<<<<<<<<< + /* "View.MemoryView":1076 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_msd)); - __pyx_r = ((PyObject *)__pyx_v_msd); - goto __pyx_L0; + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); - /* "src/helpers/correl.pyx":906 - * - * @cython.boundscheck(False) - * def calcAngularDisplacement(np.ndarray[np.float64_t,ndim=3] coor_ts, delta): # <<<<<<<<<<<<<< + /* "View.MemoryView":1077 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< * - * cdef int maxTime = coor_ts.shape[0] + * @cname('__pyx_memoryview_copy_object') */ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.calcAngularDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_msd); - __Pyx_XGIVEREF(__pyx_r); + /* "View.MemoryView":1063 + * + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "src/helpers/correl.pyx":923 +/* "View.MemoryView":1080 * - * @cython.boundscheck(False) - * def calcAngularVelocityXCorrel(np.ndarray[np.float64_t,ndim=3] coor1_ts, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coor2_ts, - * delta): + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_33calcAngularVelocityXCorrel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_33calcAngularVelocityXCorrel = {"calcAngularVelocityXCorrel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_33calcAngularVelocityXCorrel, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_33calcAngularVelocityXCorrel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_coor1_ts = 0; - PyArrayObject *__pyx_v_coor2_ts = 0; - PyObject *__pyx_v_delta = 0; +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcAngularVelocityXCorrel (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1_ts,&__pyx_n_s_coor2_ts,&__pyx_n_s_delta,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor1_ts)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor2_ts)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcAngularVelocityXCorrel", 1, 3, 3, 1); __PYX_ERR(0, 923, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcAngularVelocityXCorrel", 1, 3, 3, 2); __PYX_ERR(0, 923, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcAngularVelocityXCorrel") < 0)) __PYX_ERR(0, 923, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_coor1_ts = ((PyArrayObject *)values[0]); - __pyx_v_coor2_ts = ((PyArrayObject *)values[1]); - __pyx_v_delta = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcAngularVelocityXCorrel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 923, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.calcAngularVelocityXCorrel", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor1_ts), __pyx_ptype_5numpy_ndarray, 1, "coor1_ts", 0))) __PYX_ERR(0, 923, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor2_ts), __pyx_ptype_5numpy_ndarray, 1, "coor2_ts", 0))) __PYX_ERR(0, 924, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_32calcAngularVelocityXCorrel(__pyx_self, __pyx_v_coor1_ts, __pyx_v_coor2_ts, __pyx_v_delta); + __Pyx_RefNannySetupContext("memoryview_copy", 0); - /* function exit code */ + /* "View.MemoryView":1083 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * + */ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1084 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; + + /* "View.MemoryView":1080 + * + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + */ + + /* function exit code */ __pyx_L1_error:; - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_32calcAngularVelocityXCorrel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor1_ts, PyArrayObject *__pyx_v_coor2_ts, PyObject *__pyx_v_delta) { - int __pyx_v_maxTime; - int __pyx_v_natoms1; - int __pyx_v_natoms2; - double __pyx_v_dt; - PyArrayObject *__pyx_v_xcf = 0; - Correl *__pyx_v_myCorrel; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor1_ts; - __Pyx_Buffer __pyx_pybuffer_coor1_ts; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor2_ts; - __Pyx_Buffer __pyx_pybuffer_coor2_ts; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xcf; - __Pyx_Buffer __pyx_pybuffer_xcf; +/* "View.MemoryView":1087 + * + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. + */ + +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - double __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - Correl *__pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcAngularVelocityXCorrel", 0); - __pyx_pybuffer_xcf.pybuffer.buf = NULL; - __pyx_pybuffer_xcf.refcount = 0; - __pyx_pybuffernd_xcf.data = NULL; - __pyx_pybuffernd_xcf.rcbuffer = &__pyx_pybuffer_xcf; - __pyx_pybuffer_coor1_ts.pybuffer.buf = NULL; - __pyx_pybuffer_coor1_ts.refcount = 0; - __pyx_pybuffernd_coor1_ts.data = NULL; - __pyx_pybuffernd_coor1_ts.rcbuffer = &__pyx_pybuffer_coor1_ts; - __pyx_pybuffer_coor2_ts.pybuffer.buf = NULL; - __pyx_pybuffer_coor2_ts.refcount = 0; - __pyx_pybuffernd_coor2_ts.data = NULL; - __pyx_pybuffernd_coor2_ts.rcbuffer = &__pyx_pybuffer_coor2_ts; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor1_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 923, __pyx_L1_error) - } - __pyx_pybuffernd_coor1_ts.diminfo[0].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor1_ts.diminfo[0].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor1_ts.diminfo[1].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor1_ts.diminfo[1].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coor1_ts.diminfo[2].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coor1_ts.diminfo[2].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor2_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 923, __pyx_L1_error) - } - __pyx_pybuffernd_coor2_ts.diminfo[0].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor2_ts.diminfo[0].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor2_ts.diminfo[1].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor2_ts.diminfo[1].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coor2_ts.diminfo[2].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coor2_ts.diminfo[2].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[2]; - - /* "src/helpers/correl.pyx":927 - * delta): - * - * cdef int maxTime = coor1_ts.shape[0] # <<<<<<<<<<<<<< - * cdef int natoms1 = coor1_ts.shape[1] - * cdef int natoms2 = coor2_ts.shape[1] - */ - __pyx_v_maxTime = ((int)(__pyx_v_coor1_ts->dimensions[0])); + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - /* "src/helpers/correl.pyx":928 + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * cdef int maxTime = coor1_ts.shape[0] - * cdef int natoms1 = coor1_ts.shape[1] # <<<<<<<<<<<<<< - * cdef int natoms2 = coor2_ts.shape[1] - * cdef double dt = delta + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - __pyx_v_natoms1 = ((int)(__pyx_v_coor1_ts->dimensions[1])); + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "src/helpers/correl.pyx":929 - * cdef int maxTime = coor1_ts.shape[0] - * cdef int natoms1 = coor1_ts.shape[1] - * cdef int natoms2 = coor2_ts.shape[1] # <<<<<<<<<<<<<< - * cdef double dt = delta + /* "View.MemoryView":1095 * + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: */ - __pyx_v_natoms2 = ((int)(__pyx_v_coor2_ts->dimensions[1])); + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; - /* "src/helpers/correl.pyx":930 - * cdef int natoms1 = coor1_ts.shape[1] - * cdef int natoms2 = coor2_ts.shape[1] - * cdef double dt = delta # <<<<<<<<<<<<<< - * - * cdef np.ndarray[np.float64_t,ndim=2] xcf = np.zeros((maxTime,3)) + /* "View.MemoryView":1096 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_delta); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 930, __pyx_L1_error) - __pyx_v_dt = ((double)__pyx_t_1); + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; - /* "src/helpers/correl.pyx":932 - * cdef double dt = delta - * - * cdef np.ndarray[np.float64_t,ndim=2] xcf = np.zeros((maxTime,3)) # <<<<<<<<<<<<<< + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * cdef Correl *myCorrel = new Correl() + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_maxTime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_3); - __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 932, __pyx_L1_error) - __pyx_t_6 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xcf.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_xcf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_xcf.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 932, __pyx_L1_error) - } else {__pyx_pybuffernd_xcf.diminfo[0].strides = __pyx_pybuffernd_xcf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xcf.diminfo[0].shape = __pyx_pybuffernd_xcf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xcf.diminfo[1].strides = __pyx_pybuffernd_xcf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xcf.diminfo[1].shape = __pyx_pybuffernd_xcf.rcbuffer->pybuffer.shape[1]; - } + goto __pyx_L3; } - __pyx_t_6 = 0; - __pyx_v_xcf = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - /* "src/helpers/correl.pyx":934 - * cdef np.ndarray[np.float64_t,ndim=2] xcf = np.zeros((maxTime,3)) - * - * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< + /* "View.MemoryView":1098 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL * - * myCorrel.xcorrel_angvelmf( coor1_ts.data, coor2_ts.data, xcf.data, natoms1, natoms2, maxTime, dt) */ - try { - __pyx_t_7 = new Correl(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 934, __pyx_L1_error) - } - __pyx_v_myCorrel = __pyx_t_7; + /*else*/ { + __pyx_v_to_object_func = NULL; - /* "src/helpers/correl.pyx":936 - * cdef Correl *myCorrel = new Correl() - * - * myCorrel.xcorrel_angvelmf( coor1_ts.data, coor2_ts.data, xcf.data, natoms1, natoms2, maxTime, dt) # <<<<<<<<<<<<<< + /* "View.MemoryView":1099 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< * - * del myCorrel + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, */ - __pyx_v_myCorrel->xcorrel_angvelmf(((double *)__pyx_v_coor1_ts->data), ((double *)__pyx_v_coor2_ts->data), ((double *)__pyx_v_xcf->data), __pyx_v_natoms1, __pyx_v_natoms2, __pyx_v_maxTime, __pyx_v_dt); + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; - /* "src/helpers/correl.pyx":938 - * myCorrel.xcorrel_angvelmf( coor1_ts.data, coor2_ts.data, xcf.data, natoms1, natoms2, maxTime, dt) - * - * del myCorrel # <<<<<<<<<<<<<< + /* "View.MemoryView":1101 + * to_dtype_func = NULL * - * return xcf + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) */ - delete __pyx_v_myCorrel; + __Pyx_XDECREF(__pyx_r); - /* "src/helpers/correl.pyx":940 - * del myCorrel + /* "View.MemoryView":1103 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< * - * return xcf # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_xcf)); - __pyx_r = ((PyObject *)__pyx_v_xcf); + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "src/helpers/correl.pyx":923 + /* "View.MemoryView":1087 * - * @cython.boundscheck(False) - * def calcAngularVelocityXCorrel(np.ndarray[np.float64_t,ndim=3] coor1_ts, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coor2_ts, - * delta): + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xcf.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.calcAngularVelocityXCorrel", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xcf.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_xcf); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/correl.pyx":943 +/* "View.MemoryView":1109 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg * - * @cython.boundscheck(False) - * def calcRelativeAngDisp(np.ndarray[np.float64_t,ndim=3] coor1_ts, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coor2_ts, - * delta, ncut): */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6correl_35calcRelativeAngDisp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6correl_35calcRelativeAngDisp = {"calcRelativeAngDisp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6correl_35calcRelativeAngDisp, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6correl_35calcRelativeAngDisp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_coor1_ts = 0; - PyArrayObject *__pyx_v_coor2_ts = 0; - PyObject *__pyx_v_delta = 0; - PyObject *__pyx_v_ncut = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcRelativeAngDisp (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1_ts,&__pyx_n_s_coor2_ts,&__pyx_n_s_delta,&__pyx_n_s_ncut,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor1_ts)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor2_ts)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcRelativeAngDisp", 1, 4, 4, 1); __PYX_ERR(0, 943, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcRelativeAngDisp", 1, 4, 4, 2); __PYX_ERR(0, 943, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ncut)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcRelativeAngDisp", 1, 4, 4, 3); __PYX_ERR(0, 943, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcRelativeAngDisp") < 0)) __PYX_ERR(0, 943, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_coor1_ts = ((PyArrayObject *)values[0]); - __pyx_v_coor2_ts = ((PyArrayObject *)values[1]); - __pyx_v_delta = values[2]; - __pyx_v_ncut = values[3]; +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1110 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') + */ + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcRelativeAngDisp", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 943, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.correl.calcRelativeAngDisp", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor1_ts), __pyx_ptype_5numpy_ndarray, 1, "coor1_ts", 0))) __PYX_ERR(0, 943, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor2_ts), __pyx_ptype_5numpy_ndarray, 1, "coor2_ts", 0))) __PYX_ERR(0, 944, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6correl_34calcRelativeAngDisp(__pyx_self, __pyx_v_coor1_ts, __pyx_v_coor2_ts, __pyx_v_delta, __pyx_v_ncut); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":1109 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * + */ /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6correl_34calcRelativeAngDisp(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor1_ts, PyArrayObject *__pyx_v_coor2_ts, PyObject *__pyx_v_delta, PyObject *__pyx_v_ncut) { - int __pyx_v_maxTime; - int __pyx_v_natoms1; - int __pyx_v_natoms2; - double __pyx_v_dt; - PyArrayObject *__pyx_v_wcorr1 = 0; - PyArrayObject *__pyx_v_wcorr2 = 0; - PyArrayObject *__pyx_v_wxcorr = 0; - Correl *__pyx_v_myCorrel; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor1_ts; - __Pyx_Buffer __pyx_pybuffer_coor1_ts; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor2_ts; - __Pyx_Buffer __pyx_pybuffer_coor2_ts; - __Pyx_LocalBuf_ND __pyx_pybuffernd_wcorr1; - __Pyx_Buffer __pyx_pybuffer_wcorr1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_wcorr2; - __Pyx_Buffer __pyx_pybuffer_wcorr2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_wxcorr; - __Pyx_Buffer __pyx_pybuffer_wxcorr; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - double __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - Correl *__pyx_t_8; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcRelativeAngDisp", 0); - __pyx_pybuffer_wcorr1.pybuffer.buf = NULL; - __pyx_pybuffer_wcorr1.refcount = 0; - __pyx_pybuffernd_wcorr1.data = NULL; - __pyx_pybuffernd_wcorr1.rcbuffer = &__pyx_pybuffer_wcorr1; - __pyx_pybuffer_wcorr2.pybuffer.buf = NULL; - __pyx_pybuffer_wcorr2.refcount = 0; - __pyx_pybuffernd_wcorr2.data = NULL; - __pyx_pybuffernd_wcorr2.rcbuffer = &__pyx_pybuffer_wcorr2; - __pyx_pybuffer_wxcorr.pybuffer.buf = NULL; - __pyx_pybuffer_wxcorr.refcount = 0; - __pyx_pybuffernd_wxcorr.data = NULL; - __pyx_pybuffernd_wxcorr.rcbuffer = &__pyx_pybuffer_wxcorr; - __pyx_pybuffer_coor1_ts.pybuffer.buf = NULL; - __pyx_pybuffer_coor1_ts.refcount = 0; - __pyx_pybuffernd_coor1_ts.data = NULL; - __pyx_pybuffernd_coor1_ts.rcbuffer = &__pyx_pybuffer_coor1_ts; - __pyx_pybuffer_coor2_ts.pybuffer.buf = NULL; - __pyx_pybuffer_coor2_ts.refcount = 0; - __pyx_pybuffernd_coor2_ts.data = NULL; - __pyx_pybuffernd_coor2_ts.rcbuffer = &__pyx_pybuffer_coor2_ts; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor1_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 943, __pyx_L1_error) - } - __pyx_pybuffernd_coor1_ts.diminfo[0].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor1_ts.diminfo[0].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor1_ts.diminfo[1].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor1_ts.diminfo[1].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coor1_ts.diminfo[2].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coor1_ts.diminfo[2].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor2_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 943, __pyx_L1_error) - } - __pyx_pybuffernd_coor2_ts.diminfo[0].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor2_ts.diminfo[0].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor2_ts.diminfo[1].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor2_ts.diminfo[1].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coor2_ts.diminfo[2].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coor2_ts.diminfo[2].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[2]; - - /* "src/helpers/correl.pyx":947 - * delta, ncut): +/* "View.MemoryView":1113 * - * cdef int maxTime = coor1_ts.shape[0] # <<<<<<<<<<<<<< - * cdef int natoms1 = coor1_ts.shape[1] - * cdef int natoms2 = coor2_ts.shape[1] + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. */ - __pyx_v_maxTime = ((int)(__pyx_v_coor1_ts->dimensions[0])); - /* "src/helpers/correl.pyx":948 +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1118 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 * - * cdef int maxTime = coor1_ts.shape[0] - * cdef int natoms1 = coor1_ts.shape[1] # <<<<<<<<<<<<<< - * cdef int natoms2 = coor2_ts.shape[1] - * cdef double dt = delta */ - __pyx_v_natoms1 = ((int)(__pyx_v_coor1_ts->dimensions[1])); + __pyx_v_c_stride = 0; - /* "src/helpers/correl.pyx":949 - * cdef int maxTime = coor1_ts.shape[0] - * cdef int natoms1 = coor1_ts.shape[1] - * cdef int natoms2 = coor2_ts.shape[1] # <<<<<<<<<<<<<< - * cdef double dt = delta + /* "View.MemoryView":1119 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< * + * for i in range(ndim - 1, -1, -1): */ - __pyx_v_natoms2 = ((int)(__pyx_v_coor2_ts->dimensions[1])); + __pyx_v_f_stride = 0; - /* "src/helpers/correl.pyx":950 - * cdef int natoms1 = coor1_ts.shape[1] - * cdef int natoms2 = coor2_ts.shape[1] - * cdef double dt = delta # <<<<<<<<<<<<<< + /* "View.MemoryView":1121 + * cdef Py_ssize_t f_stride = 0 * - * cdef np.ndarray[np.float64_t,ndim=1] wcorr1 = np.zeros(ncut) + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_delta); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 950, __pyx_L1_error) - __pyx_v_dt = ((double)__pyx_t_1); + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* "src/helpers/correl.pyx":952 - * cdef double dt = delta + /* "View.MemoryView":1122 * - * cdef np.ndarray[np.float64_t,ndim=1] wcorr1 = np.zeros(ncut) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1] wcorr2 = np.zeros(ncut) - * cdef np.ndarray[np.float64_t,ndim=1] wxcorr = np.zeros(ncut) + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 952, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 952, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_ncut) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_ncut); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 952, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 952, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wcorr1.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_wcorr1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_wcorr1.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 952, __pyx_L1_error) - } else {__pyx_pybuffernd_wcorr1.diminfo[0].strides = __pyx_pybuffernd_wcorr1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wcorr1.diminfo[0].shape = __pyx_pybuffernd_wcorr1.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_5 = 0; - __pyx_v_wcorr1 = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":953 + /* "View.MemoryView":1123 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break * - * cdef np.ndarray[np.float64_t,ndim=1] wcorr1 = np.zeros(ncut) - * cdef np.ndarray[np.float64_t,ndim=1] wcorr2 = np.zeros(ncut) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1] wxcorr = np.zeros(ncut) + */ + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1124 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< * + * for i in range(ndim): */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 953, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 953, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_ncut) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_ncut); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 953, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 953, __pyx_L1_error) - __pyx_t_6 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wcorr2.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_wcorr2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_wcorr2.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 953, __pyx_L1_error) - } else {__pyx_pybuffernd_wcorr2.diminfo[0].strides = __pyx_pybuffernd_wcorr2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wcorr2.diminfo[0].shape = __pyx_pybuffernd_wcorr2.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_6 = 0; - __pyx_v_wcorr2 = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + goto __pyx_L4_break; - /* "src/helpers/correl.pyx":954 - * cdef np.ndarray[np.float64_t,ndim=1] wcorr1 = np.zeros(ncut) - * cdef np.ndarray[np.float64_t,ndim=1] wcorr2 = np.zeros(ncut) - * cdef np.ndarray[np.float64_t,ndim=1] wxcorr = np.zeros(ncut) # <<<<<<<<<<<<<< + /* "View.MemoryView":1122 * - * cdef Correl *myCorrel = new Correl() + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_ncut) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_ncut); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 954, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wxcorr.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_wxcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_wxcorr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 954, __pyx_L1_error) - } else {__pyx_pybuffernd_wxcorr.diminfo[0].strides = __pyx_pybuffernd_wxcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wxcorr.diminfo[0].shape = __pyx_pybuffernd_wxcorr.rcbuffer->pybuffer.shape[0]; } } - __pyx_t_7 = 0; - __pyx_v_wxcorr = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_L4_break:; - /* "src/helpers/correl.pyx":956 - * cdef np.ndarray[np.float64_t,ndim=1] wxcorr = np.zeros(ncut) + /* "View.MemoryView":1126 + * break * - * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + */ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1127 * - * myCorrel.rel_angvelmf( coor1_ts.data, coor2_ts.data, wcorr1.data, wcorr2.data, wxcorr.data, natoms1, natoms2, maxTime, ncut, dt) + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break */ - try { - __pyx_t_8 = new Correl(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 956, __pyx_L1_error) - } - __pyx_v_myCorrel = __pyx_t_8; + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":958 - * cdef Correl *myCorrel = new Correl() + /* "View.MemoryView":1128 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break * - * myCorrel.rel_angvelmf( coor1_ts.data, coor2_ts.data, wcorr1.data, wcorr2.data, wxcorr.data, natoms1, natoms2, maxTime, ncut, dt) # <<<<<<<<<<<<<< + */ + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1129 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< * - * del myCorrel + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): */ - __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_ncut); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L1_error) - __pyx_v_myCorrel->rel_angvelmf(((double *)__pyx_v_coor1_ts->data), ((double *)__pyx_v_coor2_ts->data), ((double *)__pyx_v_wcorr1->data), ((double *)__pyx_v_wcorr2->data), ((double *)__pyx_v_wxcorr->data), __pyx_v_natoms1, __pyx_v_natoms2, __pyx_v_maxTime, ((int)__pyx_t_9), __pyx_v_dt); + goto __pyx_L7_break; - /* "src/helpers/correl.pyx":960 - * myCorrel.rel_angvelmf( coor1_ts.data, coor2_ts.data, wcorr1.data, wcorr2.data, wxcorr.data, natoms1, natoms2, maxTime, ncut, dt) + /* "View.MemoryView":1127 * - * del myCorrel # <<<<<<<<<<<<<< + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break + */ + } + } + __pyx_L7_break:; + + /* "View.MemoryView":1131 + * break * - * return wcorr1, wcorr2, wxcorr + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: */ - delete __pyx_v_myCorrel; + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { - /* "src/helpers/correl.pyx":962 - * del myCorrel + /* "View.MemoryView":1132 * - * return wcorr1, wcorr2, wxcorr # <<<<<<<<<<<<<< + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' + */ + __pyx_r = 'C'; + goto __pyx_L0; + + /* "View.MemoryView":1131 + * break * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: + */ + } + + /* "View.MemoryView":1134 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< * + * @cython.cdivision(True) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 962, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_wcorr1)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_wcorr1)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_wcorr1)); - __Pyx_INCREF(((PyObject *)__pyx_v_wcorr2)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_wcorr2)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_wcorr2)); - __Pyx_INCREF(((PyObject *)__pyx_v_wxcorr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_wxcorr)); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_wxcorr)); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } - /* "src/helpers/correl.pyx":943 + /* "View.MemoryView":1113 * - * @cython.boundscheck(False) - * def calcRelativeAngDisp(np.ndarray[np.float64_t,ndim=3] coor1_ts, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coor2_ts, - * delta, ncut): + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wcorr1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wcorr2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wxcorr.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.correl.calcRelativeAngDisp", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wcorr1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wcorr2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wxcorr.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_wcorr1); - __Pyx_XDECREF((PyObject *)__pyx_v_wcorr2); - __Pyx_XDECREF((PyObject *)__pyx_v_wxcorr); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t +/* "View.MemoryView":1137 * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + */ + +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1144 * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] */ + __pyx_v_src_extent = (__pyx_v_src_shape[0]); -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + /* "View.MemoryView":1145 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] + */ + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":735 + /* "View.MemoryView":1146 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + */ + __pyx_v_src_stride = (__pyx_v_src_strides[0]); + + /* "View.MemoryView":1147 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew2(a, b): + * if ndim == 1: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + */ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1150 * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1151 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + */ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) + /* "View.MemoryView":1150 * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ + if (__pyx_t_1) { -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + /* "View.MemoryView":1152 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): + */ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":738 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + /* "View.MemoryView":1150 * - * cdef inline object PyArray_MultiIterNew3(a, b, c): + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + goto __pyx_L4; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * + /* "View.MemoryView":1154 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride */ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1155 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride + */ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * + /* "View.MemoryView":1156 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: */ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + /* "View.MemoryView":1157 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): + */ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":741 + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + */ + goto __pyx_L3; + } + + /* "View.MemoryView":1159 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, + */ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1160 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, + */ + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + + /* "View.MemoryView":1164 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 741, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) + /* "View.MemoryView":1165 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, + */ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1137 * + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) +/* "View.MemoryView":1167 + * dst_data += dst_stride * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ -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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":744 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + /* "View.MemoryView":1170 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 744, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) + /* "View.MemoryView":1167 + * dst_data += dst_stride * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) +/* "View.MemoryView":1174 * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + */ -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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":747 + /* "View.MemoryView":1176 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * for shape in src.shape[:ndim]: + */ + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; + + /* "View.MemoryView":1178 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape * - * cdef inline tuple PyDataType_SHAPE(dtype d): */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) + /* "View.MemoryView":1179 * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size + */ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } + + /* "View.MemoryView":1181 + * size *= shape + * + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') + */ + __pyx_r = __pyx_v_size; + goto __pyx_L0; + + /* "View.MemoryView":1174 * + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) +/* "View.MemoryView":1184 * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; int __pyx_t_1; - __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 + /* "View.MemoryView":1193 + * cdef int idx * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ - __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); + __pyx_t_1 = (__pyx_v_order == 'F'); if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":751 - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape # <<<<<<<<<<<<<< + /* "View.MemoryView":1194 + * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] + */ + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1195 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] * else: - * return () */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); - __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); - goto __pyx_L0; + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 - * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape + /* "View.MemoryView":1196 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< * else: + * for idx in range(ndim - 1, -1, -1): + */ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + + /* "View.MemoryView":1193 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ + goto __pyx_L3; } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":753 - * return d.subarray.shape + /* "View.MemoryView":1198 + * stride *= shape[idx] * else: - * return () # <<<<<<<<<<<<<< + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] + */ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; + + /* "View.MemoryView":1199 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] * + */ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1200 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< * + * return stride */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_empty_tuple); - __pyx_r = __pyx_empty_tuple; - goto __pyx_L0; + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } } + __pyx_L3:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) + /* "View.MemoryView":1202 + * stride *= shape[idx] * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') + */ + __pyx_r = __pyx_v_stride; + goto __pyx_L0; + + /* "View.MemoryView":1184 + * + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ /* function exit code */ __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 +/* "View.MemoryView":1205 * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_array_base", 0); + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("copy_data_to_temp", 1); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":929 + /* "View.MemoryView":1216 + * cdef void *result * - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< - * PyArray_SetBaseObject(arr, base) + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) * */ - Py_INCREF(__pyx_v_base); + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":930 - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + /* "View.MemoryView":1217 * - * cdef inline object get_array_base(ndarray arr): + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) */ - (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 + /* "View.MemoryView":1219 + * cdef size_t size = slice_get_size(src, ndim) * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() */ + __pyx_v_result = malloc(__pyx_v_size); - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) + /* "View.MemoryView":1220 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: */ + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_v_base; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); + /* "View.MemoryView":1221 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error) - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":933 + /* "View.MemoryView":1220 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() * - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< - * if base is NULL: - * return None */ - __pyx_v_base = PyArray_BASE(__pyx_v_arr); + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base + /* "View.MemoryView":1224 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): */ - __pyx_t_1 = ((__pyx_v_base == NULL) != 0); - if (__pyx_t_1) { + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":935 - * base = PyArray_BASE(arr) - * if base is NULL: - * return None # <<<<<<<<<<<<<< - * return base + /* "View.MemoryView":1225 * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base + /* "View.MemoryView":1226 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 */ - } + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":936 - * if base is NULL: - * return None - * return base # <<<<<<<<<<<<<< + /* "View.MemoryView":1227 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 * - * # Versions of the import_* functions which are more suitable for */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_base)); - __pyx_r = ((PyObject *)__pyx_v_base); - goto __pyx_L0; + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) + /* "View.MemoryView":1228 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) */ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() + /* "View.MemoryView":1230 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * */ + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); -static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_array", 0); + /* "View.MemoryView":1233 + * + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 + */ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":1234 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":942 - * cdef inline int import_array() except -1: - * try: - * __pyx_import_array() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":1235 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 942, __pyx_L3_error) + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":1234 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * */ } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":943 - * try: - * __pyx_import_array() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 943, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":1238 * - * cdef inline int import_umath() except -1: + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 944, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 944, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + goto __pyx_L9; } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() + /* "View.MemoryView":1240 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * + * return result */ + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; - /* function exit code */ - __pyx_r = 0; + /* "View.MemoryView":1242 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":1205 * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ -static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} + +/* "View.MemoryView":1247 + * + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + */ + +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_2; + Py_UCS4 __pyx_t_3; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_umath", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 - * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":948 - * cdef inline int import_umath() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") - */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 948, __pyx_L3_error) - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 - * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":949 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 949, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_ufunc() except -1: - */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 950, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 950, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_extents", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "View.MemoryView":1249 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * @cname('__pyx_memoryview_err_dim') */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } + __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 127; + __Pyx_INCREF(__pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_2 += 35; + __Pyx_GIVEREF(__pyx_kp_u_got_differing_extents_in_dimensi); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_got); + __pyx_t_2 += 6; + __Pyx_GIVEREF(__pyx_kp_u_got); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_got); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_and); + __pyx_t_2 += 5; + __Pyx_GIVEREF(__pyx_kp_u_and); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_and); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_2 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__7); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 1249, __pyx_L1_error) - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":1247 * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __pyx_L0:; __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") +/* "View.MemoryView":1252 + * + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() */ -static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_ufunc", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":954 - * cdef inline int import_ufunc() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") - */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 954, __pyx_L3_error) - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":955 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 955, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":956 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":1253 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< * - * cdef extern from *: + * @cname('__pyx_memoryview_err') */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 956, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 956, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1253, __pyx_L1_error) - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + /* "View.MemoryView":1252 * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __pyx_L0:; + __Pyx_XDECREF(__pyx_v_msg); __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 +/* "View.MemoryView":1256 * + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` */ -static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_timedelta64_object", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":978 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1257 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< * + * @cname('__pyx_memoryview_err_no_memory') */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); - goto __pyx_L0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1257, __pyx_L1_error) - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 + /* "View.MemoryView":1256 * + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` */ /* function exit code */ - __pyx_L0:; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 +/* "View.MemoryView":1260 * + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` */ -static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { +static int __pyx_memoryview_err_no_memory(void) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_datetime64_object", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_no_memory", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":993 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + /* "View.MemoryView":1261 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< * * */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); - goto __pyx_L0; + PyErr_NoMemory(); __PYX_ERR(1, 1261, __pyx_L1_error) - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 + /* "View.MemoryView":1260 * + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` */ /* function exit code */ - __pyx_L0:; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 - * +/* "View.MemoryView":1265 * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ -static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { - npy_datetime __pyx_r; +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("memoryview_copy_contents", 1); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1003 - * also needed. That can be found using `get_datetime64_unit`. + /* "View.MemoryView":1273 + * Check for overlapping memory and verify the shapes. * """ - * return (obj).obval # <<<<<<<<<<<<<< - * - * + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i */ - __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; + __pyx_v_tmpdata = NULL; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 - * - * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + /* "View.MemoryView":1274 * """ - * returns the int64 value underlying scalar numpy datetime64 object + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) */ + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 - * - * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object + /* "View.MemoryView":1276 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False */ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); -static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { - npy_timedelta __pyx_r; + /* "View.MemoryView":1277 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp + */ + __pyx_v_broadcasting = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1010 - * returns the int64 value underlying scalar numpy timedelta64 object - * """ - * return (obj).obval # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1278 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp * */ - __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; + __pyx_v_direct_copy = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 - * + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} + /* "View.MemoryView":1282 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) + */ + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + */ + goto __pyx_L3; + } + + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. */ + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { -static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { - NPY_DATETIMEUNIT __pyx_r; + /* "View.MemoryView":1284 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) + */ + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1017 - * returns the unit part of the dtype for a numpy datetime64 object. - * """ - * return (obj).obmeta.base # <<<<<<<<<<<<<< + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * */ - __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); - goto __pyx_L0; + } + __pyx_L3:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 + /* "View.MemoryView":1286 + * broadcast_leading(&dst, dst_ndim, src_ndim) * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. + * for i in range(ndim): */ + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":123 - * cdef bint dtype_is_object + /* "View.MemoryView":1288 + * cdef int ndim = max(src_ndim, dst_ndim) * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + */ + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1289 * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { -/* Python wrapper */ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_shape = 0; - Py_ssize_t __pyx_v_itemsize; - PyObject *__pyx_v_format = 0; - PyObject *__pyx_v_mode = 0; - int __pyx_v_allocate_buffer; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; - PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_n_s_c); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 123, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 123, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode); - if (value) { values[3] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 123, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_shape = ((PyObject*)values[0]); - __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_v_format = values[2]; - __pyx_v_mode = values[3]; - if (values[4]) { - __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 124, __pyx_L3_error) - } else { - - /* "View.MemoryView":124 - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, - * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< - * - * cdef int idx + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 */ - __pyx_v_allocate_buffer = ((int)1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 123, __pyx_L1_error) - if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 123, __pyx_L1_error) - } - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { - /* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * + /* "View.MemoryView":1291 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: */ + __pyx_v_broadcasting = 1; - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1292 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) + */ + (__pyx_v_src.strides[__pyx_v_i]) = 0; -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { - int __pyx_v_idx; - Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_dim; - PyObject **__pyx_v_p; - char __pyx_v_order; - int __pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - Py_ssize_t __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_format); + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 + */ + goto __pyx_L7; + } - /* "View.MemoryView":130 - * cdef PyObject **p - * - * self.ndim = len(shape) # <<<<<<<<<<<<<< - * self.itemsize = itemsize + /* "View.MemoryView":1294 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< * + * if src.suboffsets[i] >= 0: */ - if (unlikely(__pyx_v_shape == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 130, __pyx_L1_error) - } - __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 130, __pyx_L1_error) - __pyx_v_self->ndim = ((int)__pyx_t_1); + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1294, __pyx_L1_error) + } + __pyx_L7:; - /* "View.MemoryView":131 - * - * self.ndim = len(shape) - * self.itemsize = itemsize # <<<<<<<<<<<<<< + /* "View.MemoryView":1289 * - * if not self.ndim: + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ - __pyx_v_self->itemsize = __pyx_v_itemsize; + } - /* "View.MemoryView":133 - * self.itemsize = itemsize + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * */ - __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { - /* "View.MemoryView":134 + /* "View.MemoryView":1297 * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< * - * if itemsize <= 0: + * if slices_overlap(&src, &dst, ndim, itemsize): */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 134, __pyx_L1_error) + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error) - /* "View.MemoryView":133 - * self.itemsize = itemsize + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * */ + } } - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< * + * if not slice_is_contig(src, order, ndim): */ - __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { - /* "View.MemoryView":137 + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) * - * if not isinstance(format, bytes): */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 137, __pyx_L1_error) + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") + /* "View.MemoryView":1302 * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) */ - } + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - */ - __pyx_t_2 = PyBytes_Check(__pyx_v_format); - __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":140 + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) * - * if not isinstance(format, bytes): - * format = format.encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format # keep a reference to the byte string - * self.format = self._format */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); - __pyx_t_3 = 0; - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") + /* "View.MemoryView":1304 + * order = get_best_order(&dst, ndim) * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - */ - } - - /* "View.MemoryView":141 - * if not isinstance(format, bytes): - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< - * self.format = self._format + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp * */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 141, __pyx_L1_error) - __pyx_t_3 = __pyx_v_format; - __Pyx_INCREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->_format); - __Pyx_DECREF(__pyx_v_self->_format); - __pyx_v_self->_format = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1304, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; - /* "View.MemoryView":142 - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - * self.format = self._format # <<<<<<<<<<<<<< + /* "View.MemoryView":1305 * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< * + * if not broadcasting: */ - if (unlikely(__pyx_v_self->_format == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(2, 142, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 142, __pyx_L1_error) - __pyx_v_self->format = __pyx_t_7; + __pyx_v_src = __pyx_v_tmp; - /* "View.MemoryView":145 - * + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< - * self._strides = self._shape + self.ndim + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< * + * if not slice_is_contig(src, order, ndim): */ - __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + } - /* "View.MemoryView":146 - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) - * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + /* "View.MemoryView":1307 + * src = tmp * - * if not self._shape: - */ - __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim + * if not broadcasting: # <<<<<<<<<<<<<< * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") * */ - __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< + /* "View.MemoryView":1310 * * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 149, __pyx_L1_error) + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") + /* "View.MemoryView":1311 * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) */ - } + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); - /* "View.MemoryView":152 + /* "View.MemoryView":1310 * * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ - __pyx_t_8 = 0; - __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; - for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 152, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_9; - __pyx_v_idx = __pyx_t_8; - __pyx_t_8 = (__pyx_t_8 + 1); + goto __pyx_L12; + } - /* "View.MemoryView":153 + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim */ - __pyx_t_4 = ((__pyx_v_dim <= 0) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":154 - * for idx, dim in enumerate(shape): - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<< - * self._shape[idx] = dim + /* "View.MemoryView":1313 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< * + * if direct_copy: */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 154, __pyx_L1_error) + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - /* "View.MemoryView":153 + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim */ } + __pyx_L12:; - /* "View.MemoryView":155 - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim # <<<<<<<<<<<<<< - * - * cdef char order - */ - (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - - /* "View.MemoryView":152 + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) * + * if direct_copy: # <<<<<<<<<<<<<< * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_v_direct_copy) { - /* "View.MemoryView":158 + /* "View.MemoryView":1317 + * if direct_copy: * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 158, __pyx_L1_error) - if (__pyx_t_4) { + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":159 - * cdef char order - * if mode == 'fortran': - * order = b'F' # <<<<<<<<<<<<<< - * self.mode = u'fortran' - * elif mode == 'c': + /* "View.MemoryView":1318 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) */ - __pyx_v_order = 'F'; + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - /* "View.MemoryView":160 - * if mode == 'fortran': - * order = b'F' - * self.mode = u'fortran' # <<<<<<<<<<<<<< - * elif mode == 'c': - * order = b'C' + /* "View.MemoryView":1319 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 */ - __Pyx_INCREF(__pyx_n_u_fortran); - __Pyx_GIVEREF(__pyx_n_u_fortran); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_fortran; + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":158 + /* "View.MemoryView":1320 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - goto __pyx_L10; - } - - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 161, __pyx_L1_error) - if (likely(__pyx_t_4)) { + free(__pyx_v_tmpdata); - /* "View.MemoryView":162 - * self.mode = u'fortran' - * elif mode == 'c': - * order = b'C' # <<<<<<<<<<<<<< - * self.mode = u'c' - * else: + /* "View.MemoryView":1321 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): */ - __pyx_v_order = 'C'; + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":163 - * elif mode == 'c': - * order = b'C' - * self.mode = u'c' # <<<<<<<<<<<<<< - * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - __Pyx_INCREF(__pyx_n_u_c); - __Pyx_GIVEREF(__pyx_n_u_c); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_c; + } - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * */ - goto __pyx_L10; } - /* "View.MemoryView":165 - * self.mode = u'c' - * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * * - * self.len = fill_contig_strides_array(self._shape, self._strides, */ - /*else*/ { - __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 165, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); } - __pyx_L10:; + if (__pyx_t_2) { - /* "View.MemoryView":167 - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) + /* "View.MemoryView":1326 * - * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<< - * itemsize, self.ndim, order) * - */ - __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - - /* "View.MemoryView":170 - * itemsize, self.ndim, order) + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) * - * self.free_data = allocate_buffer # <<<<<<<<<<<<<< - * self.dtype_is_object = format == b'O' - * if allocate_buffer: */ - __pyx_v_self->free_data = __pyx_v_allocate_buffer; + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1326, __pyx_L1_error) - /* "View.MemoryView":171 + /* "View.MemoryView":1327 * - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< - * if allocate_buffer: + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 171, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 171, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_self->dtype_is_object = __pyx_t_4; + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< * * */ - __pyx_t_4 = (__pyx_v_allocate_buffer != 0); - if (__pyx_t_4) { + } - /* "View.MemoryView":175 - * + /* "View.MemoryView":1329 + * transpose_memslice(&dst) * - * self.data = malloc(self.len) # <<<<<<<<<<<<<< - * if not self.data: - * raise MemoryError("unable to allocate array data.") + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) */ - __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":176 + /* "View.MemoryView":1330 * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * */ - __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0); - if (unlikely(__pyx_t_4)) { + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< + /* "View.MemoryView":1331 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< * - * if self.dtype_is_object: + * free(tmpdata) */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 177, __pyx_L1_error) + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":176 + /* "View.MemoryView":1333 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 * */ - } + free(__pyx_v_tmpdata); - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") + /* "View.MemoryView":1334 * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): - */ - __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":180 + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< * - * if self.dtype_is_object: - * p = self.data # <<<<<<<<<<<<<< - * for i in range(self.len / itemsize): - * p[i] = Py_None + * @cname('__pyx_memoryview_broadcast_leading') */ - __pyx_v_p = ((PyObject **)__pyx_v_self->data); + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":181 - * if self.dtype_is_object: - * p = self.data - * for i in range(self.len / itemsize): # <<<<<<<<<<<<<< - * p[i] = Py_None - * Py_INCREF(Py_None) - */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize); - __pyx_t_9 = __pyx_t_1; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; - - /* "View.MemoryView":182 - * p = self.data - * for i in range(self.len / itemsize): - * p[i] = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) - * - */ - (__pyx_v_p[__pyx_v_i]) = Py_None; - - /* "View.MemoryView":183 - * for i in range(self.len / itemsize): - * p[i] = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< - * - * @cname('getbuffer') - */ - Py_INCREF(Py_None); - } - - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") - * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): - */ - } - - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< - * - * - */ - } - - /* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): + /* "View.MemoryView":1265 * + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_XDECREF(__pyx_v_format); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "View.MemoryView":186 +/* "View.MemoryView":1337 * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_bufmode; - int __pyx_r; - __Pyx_RefNannyDeclarations +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - Py_ssize_t *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":187 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 # <<<<<<<<<<<<<< - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - __pyx_v_bufmode = -1; - - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 188, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + int __pyx_t_3; - /* "View.MemoryView":189 - * cdef int bufmode = -1 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + /* "View.MemoryView":1341 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): */ - __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": + /* "View.MemoryView":1343 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] */ - goto __pyx_L3; - } + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): + /* "View.MemoryView":1344 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 190, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - /* "View.MemoryView":191 - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") + /* "View.MemoryView":1345 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * */ - __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): + /* "View.MemoryView":1346 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): */ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); } - __pyx_L3:; - - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - */ - __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0); - if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len + /* "View.MemoryView":1348 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 193, __pyx_L1_error) + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data + /* "View.MemoryView":1349 + * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 */ - } + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; - /* "View.MemoryView":194 - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data # <<<<<<<<<<<<<< - * info.len = self.len - * info.ndim = self.ndim + /* "View.MemoryView":1350 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 + * */ - __pyx_t_4 = __pyx_v_self->data; - __pyx_v_info->buf = __pyx_t_4; + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); - /* "View.MemoryView":195 - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - * info.len = self.len # <<<<<<<<<<<<<< - * info.ndim = self.ndim - * info.shape = self._shape + /* "View.MemoryView":1351 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * */ - __pyx_t_5 = __pyx_v_self->len; - __pyx_v_info->len = __pyx_t_5; + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } - /* "View.MemoryView":196 - * info.buf = self.data - * info.len = self.len - * info.ndim = self.ndim # <<<<<<<<<<<<<< - * info.shape = self._shape - * info.strides = self._strides + /* "View.MemoryView":1337 + * + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ - __pyx_t_6 = __pyx_v_self->ndim; - __pyx_v_info->ndim = __pyx_t_6; - /* "View.MemoryView":197 - * info.len = self.len - * info.ndim = self.ndim - * info.shape = self._shape # <<<<<<<<<<<<<< - * info.strides = self._strides - * info.suboffsets = NULL - */ - __pyx_t_7 = __pyx_v_self->_shape; - __pyx_v_info->shape = __pyx_t_7; + /* function exit code */ +} - /* "View.MemoryView":198 - * info.ndim = self.ndim - * info.shape = self._shape - * info.strides = self._strides # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = self.itemsize +/* "View.MemoryView":1359 + * + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< + * + * if dtype_is_object: */ - __pyx_t_7 = __pyx_v_self->_strides; - __pyx_v_info->strides = __pyx_t_7; - /* "View.MemoryView":199 - * info.shape = self._shape - * info.strides = self._strides - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = self.itemsize - * info.readonly = 0 - */ - __pyx_v_info->suboffsets = NULL; +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - /* "View.MemoryView":200 - * info.strides = self._strides - * info.suboffsets = NULL - * info.itemsize = self.itemsize # <<<<<<<<<<<<<< - * info.readonly = 0 + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: * - */ - __pyx_t_5 = __pyx_v_self->itemsize; - __pyx_v_info->itemsize = __pyx_t_5; - - /* "View.MemoryView":201 - * info.suboffsets = NULL - * info.itemsize = self.itemsize - * info.readonly = 0 # <<<<<<<<<<<<<< + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) * - * if flags & PyBUF_FORMAT: */ - __pyx_v_info->readonly = 0; + if (__pyx_v_dtype_is_object) { - /* "View.MemoryView":203 - * info.readonly = 0 + /* "View.MemoryView":1362 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":204 + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< * - * if flags & PyBUF_FORMAT: - * info.format = self.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') */ - __pyx_t_4 = __pyx_v_self->format; - __pyx_v_info->format = __pyx_t_4; + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); - /* "View.MemoryView":203 - * info.readonly = 0 + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format - * else: - */ - goto __pyx_L5; - } - - /* "View.MemoryView":206 - * info.format = self.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) * - * info.obj = self */ - /*else*/ { - __pyx_v_info->format = NULL; } - __pyx_L5:; - /* "View.MemoryView":208 - * info.format = NULL - * - * info.obj = self # <<<<<<<<<<<<<< + /* "View.MemoryView":1359 * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") - */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - - /* "View.MemoryView":186 + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * if dtype_is_object: */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") +/* "View.MemoryView":1365 * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: */ -/* Python wrapper */ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); + + /* "View.MemoryView":1368 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + */ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1365 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + */ /* function exit code */ __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif } -static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { +/* "View.MemoryView":1371 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + */ + +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__", 0); + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - /* "View.MemoryView":213 + /* "View.MemoryView":1374 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: + * for i in range(shape[0]): */ - __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0); - if (__pyx_t_1) { + __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":214 - * def __dealloc__(array self): - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) # <<<<<<<<<<<<<< - * elif self.free_data: - * if self.dtype_is_object: + /* "View.MemoryView":1376 + * cdef Py_ssize_t stride = strides[0] + * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: */ - __pyx_v_self->callback_free_data(__pyx_v_self->data); + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":213 + /* "View.MemoryView":1377 * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) */ - goto __pyx_L3; - } + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: */ - __pyx_t_1 = (__pyx_v_self->free_data != 0); - if (__pyx_t_1) { + if (__pyx_v_inc) { - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) + /* "View.MemoryView":1379 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) */ - __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_1) { + Py_INCREF((((PyObject **)__pyx_v_data)[0])); - /* "View.MemoryView":217 - * elif self.free_data: - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< - * self._strides, self.ndim, False) - * free(self.data) + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + goto __pyx_L6; + } - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) + /* "View.MemoryView":1381 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) */ - } + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; - /* "View.MemoryView":219 - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) - * free(self.data) # <<<<<<<<<<<<<< - * PyObject_Free(self._shape) + /* "View.MemoryView":1377 * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) */ - free(__pyx_v_self->data); + goto __pyx_L5; + } - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, + /* "View.MemoryView":1383 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< + * + * data += stride */ - } - __pyx_L3:; + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; - /* "View.MemoryView":220 - * self._strides, self.ndim, False) - * free(self.data) - * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + /* "View.MemoryView":1385 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * * - * @property */ - PyObject_Free(__pyx_v_self->_shape); + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } - /* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + /* "View.MemoryView":1371 * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":223 - * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() +/* "View.MemoryView":1391 * + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: */ -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { -static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":1394 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + */ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":224 - * @property - * def memview(self): - * return self.get_memview() # <<<<<<<<<<<<<< + /* "View.MemoryView":1395 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) * - * @cname('get_memview') */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":223 + /* "View.MemoryView":1396 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() * + */ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1391 + * + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":227 +/* "View.MemoryView":1400 * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_memview", 0); +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; - /* "View.MemoryView":228 - * @cname('get_memview') - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< - * return memoryview(self, flags, self.dtype_is_object) + /* "View.MemoryView":1404 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] * */ - __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":229 - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + /* "View.MemoryView":1405 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< * - * def __len__(self): + * if ndim == 1: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_v_extent = (__pyx_v_shape[0]); - /* "View.MemoryView":227 + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) */ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] + /* "View.MemoryView":1408 * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride */ + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; -/* Python wrapper */ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1409 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: + */ + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); -static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); + /* "View.MemoryView":1410 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): + */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } - /* "View.MemoryView":232 + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] * - * def __len__(self): - * return self._shape[0] # <<<<<<<<<<<<<< + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) + */ + goto __pyx_L3; + } + + /* "View.MemoryView":1412 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride + */ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1413 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride * - * def __getattr__(self, attr): */ - __pyx_r = (__pyx_v_self->_shape[0]); - goto __pyx_L0; + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) + /* "View.MemoryView":1414 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] * + */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1400 + * + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":234 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) - * +/* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* Python wrapper */ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getattr__", 0); + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); - /* "View.MemoryView":235 - * - * def __getattr__(self, attr): - * return getattr(self.memview, attr) # <<<<<<<<<<<<<< - * - * def __getitem__(self, item): + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 235, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + if (__pyx_t_2) { + + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + */ + } + + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { + + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; goto __pyx_L0; - /* "View.MemoryView":234 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) - * + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":237 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ -/* Python wrapper */ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - /* "View.MemoryView":238 - * - * def __getitem__(self, item): - * return self.memview[item] # <<<<<<<<<<<<<< - * - * def __setitem__(self, item, value): + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 238, __pyx_L1_error) + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":237 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 > 1); + if (__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":14 + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) + */ + } + + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":240 - * return self.memview[item] +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":248 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< * + * @property */ + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; -/* Python wrapper */ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 + * + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 + * + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ + */ + +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":254 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 + * + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ + */ /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 + * + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ + */ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - /* "View.MemoryView":241 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":260 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< * - * def __setitem__(self, item, value): - * self.memview[item] = value # <<<<<<<<<<<<<< + * @property + */ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 * + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 * + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 241, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":240 - * return self.memview[item] +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":268 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value + * @property + */ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 * + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 + * + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":275 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 + * + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 + * + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ + */ - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":281 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 + * + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 + * + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":290 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * ctypedef unsigned char npy_bool + */ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 + * + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":774 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":245 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result */ -static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) { - struct __pyx_array_obj *__pyx_v_result = 0; - struct __pyx_array_obj *__pyx_r = NULL; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("array_cwrapper", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "View.MemoryView":249 - * cdef array result + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":777 * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - */ - __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":250 + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * - * if buf == NULL: - * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<< - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), + * cdef inline object PyArray_MultiIterNew3(a, b, c): */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); - __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":249 - * cdef array result + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf - */ - /*else*/ { - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_3 = 0; - - /* "View.MemoryView":253 - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) # <<<<<<<<<<<<<< - * result.data = buf + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 253, __pyx_L1_error) - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf - */ - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5); - __pyx_t_5 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":254 - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) - * result.data = buf # <<<<<<<<<<<<<< +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * - * return result */ - __pyx_v_result->data = __pyx_v_buf; - } - __pyx_L3:; - /* "View.MemoryView":256 - * result.data = buf - * - * return result # <<<<<<<<<<<<<< +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":780 * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = __pyx_v_result; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":245 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * */ -/* Python wrapper */ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 282, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_name = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 282, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "View.MemoryView":283 - * cdef object name - * def __init__(self, name): - * self.name = name # <<<<<<<<<<<<<< - * def __repr__(self): - * return self.name + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __Pyx_GOTREF(__pyx_v_self->name); - __Pyx_DECREF(__pyx_v_self->name); - __pyx_v_self->name = __pyx_v_name; + __Pyx_XDECREF(__pyx_r); + __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_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ -/* Python wrapper */ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__", 0); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "View.MemoryView":285 - * self.name = name - * def __repr__(self): - * return self.name # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":786 * - * cdef generic = Enum("") + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->name); - __pyx_r = __pyx_v_self->name; + __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_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + int __pyx_t_1; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: + */ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":790 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); + __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: + */ + } + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":792 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * + * + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_empty_tuple); + __pyx_r = __pyx_empty_tuple; + goto __pyx_L0; + } + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape + */ /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; - PyObject *__pyx_r = NULL; +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self.name,) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":968 + * + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_self->name); - __Pyx_GIVEREF(__pyx_v_self->name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); - __pyx_v_state = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + Py_INCREF(__pyx_v_base); - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":969 + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v__dict = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 969, __pyx_L1_error) - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ - __pyx_t_2 = (__pyx_v__dict != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); - __pyx_t_4 = 0; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self.name is not None +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ - __pyx_v_use_setstate = 1; - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - goto __pyx_L3; - } +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "(tree fragment)":11 - * use_setstate = True - * else: - * use_setstate = self.name is not None # <<<<<<<<<<<<<< - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":972 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None */ - /*else*/ { - __pyx_t_3 = (__pyx_v_self->name != Py_None); - __pyx_v_use_setstate = __pyx_t_3; - } - __pyx_L3:; + __pyx_v_base = PyArray_BASE(__pyx_v_arr); - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base */ - __pyx_t_3 = (__pyx_v_use_setstate != 0); - if (__pyx_t_3) { + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { - /* "(tree fragment)":13 - * use_setstate = self.name is not None - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<< - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":974 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); - __pyx_t_4 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base */ } - /* "(tree fragment)":15 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":975 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v__dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("import_array", 0); - /* "(tree fragment)":17 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":981 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") + */ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 981, __pyx_L3_error) + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":982 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.multiarray failed to import") + * + */ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 982, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: + */ + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 983, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 983, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: + */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":299 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ -static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) { - Py_intptr_t __pyx_v_aligned_p; - size_t __pyx_v_offset; - void *__pyx_r; - int __pyx_t_1; +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); - /* "View.MemoryView":301 - * cdef void *align_pointer(void *memory, size_t alignment) nogil: - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<< - * cdef size_t offset + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":305 - * - * with cython.cdivision(True): - * offset = aligned_p % alignment # <<<<<<<<<<<<<< - * - * if offset > 0: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":987 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") */ - __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment); + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 987, __pyx_L3_error) - /* "View.MemoryView":307 - * offset = aligned_p % alignment - * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_1 = ((__pyx_v_offset > 0) != 0); - if (__pyx_t_1) { + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":308 - * - * if offset > 0: - * aligned_p += alignment - offset # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":988 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") * - * return aligned_p */ - __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset)); + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 988, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":307 - * offset = aligned_p % alignment - * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * + * cdef inline int import_ufunc() except -1: */ - } + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 989, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 989, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "View.MemoryView":310 - * aligned_p += alignment - offset - * - * return aligned_p # <<<<<<<<<<<<<< - * + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_r = ((void *)__pyx_v_aligned_p); - goto __pyx_L0; + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } - /* "View.MemoryView":299 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ -/* Python wrapper */ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_obj = 0; - int __pyx_v_flags; - int __pyx_v_dtype_is_object; +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: + */ { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 346, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 346, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) - if (values[2]) { - __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) - } else { - __pyx_v_dtype_is_object = ((int)0); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 346, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "View.MemoryView":347 - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj # <<<<<<<<<<<<<< - * self.flags = flags - * if type(self) is memoryview or obj is not None: - */ - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - __Pyx_GOTREF(__pyx_v_self->obj); - __Pyx_DECREF(__pyx_v_self->obj); - __pyx_v_self->obj = __pyx_v_obj; - - /* "View.MemoryView":348 - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj - * self.flags = flags # <<<<<<<<<<<<<< - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - */ - __pyx_v_self->flags = __pyx_v_flags; - - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - */ - __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_3 = (__pyx_v_obj != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { - - /* "View.MemoryView":350 - * self.flags = flags - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - */ - __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 350, __pyx_L1_error) + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":993 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); - if (__pyx_t_1) { + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 993, __pyx_L3_error) - /* "View.MemoryView":352 - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":353 - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":994 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): */ - Py_INCREF(Py_None); + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 994, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":995 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * + * */ + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 995, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 995, __pyx_L5_except_error) } + goto __pyx_L5_except_error; - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; } - /* "View.MemoryView":355 - * Py_INCREF(Py_None) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - */ - __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":358 - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - */ - __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - - /* "View.MemoryView":359 - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - } + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 + * + * + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":361 - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< - * if self.lock is NULL: - * raise MemoryError - */ - __pyx_v_self->lock = PyThread_allocate_lock(); +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_timedelta64_object", 0); - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1010 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< * - */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":363 - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - * raise MemoryError # <<<<<<<<<<<<<< * - * if flags & PyBUF_FORMAT: */ - PyErr_NoMemory(); __PYX_ERR(2, 363, __pyx_L1_error) + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - */ - } - - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - */ - } - - /* "View.MemoryView":355 - * Py_INCREF(Py_None) * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ - } - /* "View.MemoryView":365 - * raise MemoryError - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":366 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * if flags & PyBUF_FORMAT: - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< - * else: - * self.dtype_is_object = dtype_is_object - */ - __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L12_bool_binop_done; - } - __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L12_bool_binop_done:; - __pyx_v_self->dtype_is_object = __pyx_t_1; - - /* "View.MemoryView":365 - * raise MemoryError * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` */ - goto __pyx_L11; - } - /* "View.MemoryView":368 - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< - * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( - */ - /*else*/ { - __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; - } - __pyx_L11:; +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_datetime64_object", 0); - /* "View.MemoryView":370 - * self.dtype_is_object = dtype_is_object + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1025 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<< - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL - */ - __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int)))); - - /* "View.MemoryView":372 - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL # <<<<<<<<<<<<<< * - * def __dealloc__(memoryview self): */ - __pyx_v_self->typeinfo = NULL; + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; - /* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags + * + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":374 - * self.typeinfo = NULL +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) + * + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object */ -/* Python wrapper */ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { - int __pyx_v_i; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyThread_type_lock __pyx_t_6; - PyThread_type_lock __pyx_t_7; - __Pyx_RefNannySetupContext("__dealloc__", 0); +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; - /* "View.MemoryView":375 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1035 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - */ - __pyx_t_1 = (__pyx_v_self->obj != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":376 - * def __dealloc__(memoryview self): - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< - * elif (<__pyx_buffer *> &self.view).obj == Py_None: * */ - __Pyx_ReleaseBuffer((&__pyx_v_self->view)); + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; - /* "View.MemoryView":375 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object */ - goto __pyx_L3; - } - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 * - * (<__pyx_buffer *> &self.view).obj = NULL + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object */ - __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":379 - * elif (<__pyx_buffer *> &self.view).obj == Py_None: +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1042 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< * - * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< - * Py_DECREF(Py_None) * */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; - /* "View.MemoryView":380 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 * - * (<__pyx_buffer *> &self.view).obj = NULL - * Py_DECREF(Py_None) # <<<<<<<<<<<<<< * - * cdef int i + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object */ - Py_DECREF(Py_None); - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 * - * (<__pyx_buffer *> &self.view).obj = NULL + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. */ - } - __pyx_L3:; - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - */ - __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0); - if (__pyx_t_2) { +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; - /* "View.MemoryView":385 - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1049 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< */ - __pyx_t_3 = __pyx_memoryview_thread_locks_used; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. */ - __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":387 - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +/* "newanalysis/helpers/correl.pyx":24 + * void transform( double *data, int ncut, double *ans_re, double *ans_im, int ltc ) nogil + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateParallel(np.ndarray[np.float64_t,ndim=2] data1, + * np.ndarray[np.float64_t,ndim=2] data2, */ - __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":390 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< - * break - * else: - */ - __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]); - - /* "View.MemoryView":389 - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break - */ - (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6; - (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7; - - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - */ - } - - /* "View.MemoryView":391 - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break # <<<<<<<<<<<<<< - * else: - * PyThread_free_lock(self.lock) - */ - goto __pyx_L6_break; - - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - */ - } - } - /*else*/ { - - /* "View.MemoryView":393 - * break - * else: - * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - */ - PyThread_free_lock(__pyx_v_self->lock); - } - __pyx_L6_break:; - - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - */ - } - - /* "View.MemoryView":374 - * self.typeinfo = NULL - * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":395 - * PyThread_free_lock(self.lock) - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf - */ - -static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - Py_ssize_t __pyx_v_dim; - char *__pyx_v_itemp; - PyObject *__pyx_v_idx = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - char *__pyx_t_7; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_1correlateParallel(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_6correl_correlateParallel, "\n correlateParallel(data1, data2, out, ltc=0)\n\n Takes two data sets and calculates column-wise correlation functions in parallel and sums them up afterwards. The result is written into the out array.\n\n Args:\n data1: numpy array, float64, ndim=2\n data2: numpy array, float64, ndim=2\n out: numpy array, float64, ndim=1\n ltc: type of long tail correction used\n 0 = none (default)\n 1 = the average of the time series is subtracted from it before the correlation\n 2 = the result is modified\n\n :Example: dipole autocorrelation function\n correlateParallel(dipoles, dipoles, mu0mut)\n\n NOTE: \n for this to work, the data arrays have to be organised as follows:\n \n +--+--+--+--+--+--+--+---+--+--+--+\n | |x1|y1|z1|x2|y2|z2|...|xn|yn|zn|\n +==+==+==+==+==+==+==+===+==+==+==+\n |t1| | | | | | | | | | |\n +--+--+--+--+--+--+--+---+--+--+--+\n |t2| | | | | | | | | | |\n +--+--+--+--+--+--+--+---+--+--+--+\n |. | | | | | | | | | | | \n +--+--+--+--+--+--+--+---+--+--+--+\n |. | | | | | | | | | | |\n +--+--+--+--+--+--+--+---+--+--+--+\n |. | | | | | | | | | | |\n +--+--+--+--+--+--+--+---+--+--+--+\n |tm| | | | | | | | | | |\n +--+--+--+--+--+--+--+---+--+--+--+\n\n Each column is the x/y/z component of each particle, each row is a time step.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_6correl_1correlateParallel = {"correlateParallel", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_1correlateParallel, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_6correl_correlateParallel}; +static PyObject *__pyx_pw_11newanalysis_6correl_1correlateParallel(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_data1 = 0; + PyArrayObject *__pyx_v_data2 = 0; + PyArrayObject *__pyx_v_out = 0; + PyObject *__pyx_v_ltc = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_item_pointer", 0); - - /* "View.MemoryView":397 - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< - * - * for dim, idx in enumerate(index): - */ - __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - */ - __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { - __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 399, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("correlateParallel (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 24, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data1,&__pyx_n_s_data2,&__pyx_n_s_out,&__pyx_n_s_ltc,0}; + values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_0))); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 399, __pyx_L1_error) + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateParallel", 0, 3, 4, 1); __PYX_ERR(0, 24, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_out)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateParallel", 0, 3, 4, 2); __PYX_ERR(0, 24, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ltc); + if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "correlateParallel") < 0)) __PYX_ERR(0, 24, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; + default: goto __pyx_L5_argtuple_error; } - __Pyx_GOTREF(__pyx_t_5); } - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_1; - __pyx_t_1 = (__pyx_t_1 + 1); - - /* "View.MemoryView":400 - * - * for dim, idx in enumerate(index): - * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< - * - * return itemp - */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_7; - - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - */ + __pyx_v_data1 = ((PyArrayObject *)values[0]); + __pyx_v_data2 = ((PyArrayObject *)values[1]); + __pyx_v_out = ((PyArrayObject *)values[2]); + __pyx_v_ltc = values[3]; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":402 - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - * return itemp # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_itemp; - goto __pyx_L0; - - /* "View.MemoryView":395 - * PyThread_free_lock(self.lock) - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf - */ + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("correlateParallel", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 24, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.correl.correlateParallel", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data1), __pyx_ptype_5numpy_ndarray, 1, "data1", 0))) __PYX_ERR(0, 25, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data2), __pyx_ptype_5numpy_ndarray, 1, "data2", 0))) __PYX_ERR(0, 26, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) __PYX_ERR(0, 27, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_correlateParallel(__pyx_self, __pyx_v_data1, __pyx_v_data2, __pyx_v_out, __pyx_v_ltc); /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":405 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_indices = NULL; - char *__pyx_v_itemp; +static PyObject *__pyx_pf_11newanalysis_6correl_correlateParallel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2, PyArrayObject *__pyx_v_out, PyObject *__pyx_v_ltc) { + long __pyx_v__n; + long __pyx_v_ncut; + int __pyx_v_m; + int __pyx_v__ltc; + int __pyx_v_lowhigh; + long __pyx_v_i; + long __pyx_v_j; + PyArrayObject *__pyx_v_d1 = 0; + PyArrayObject *__pyx_v_d2 = 0; + double *__pyx_v_p_data1; + double *__pyx_v_p_data2; + double *__pyx_v_p_out; + Correl *__pyx_v_myCorrel; + plan *__pyx_v_myplan; + PyArrayObject *__pyx_v_tmp = 0; + double *__pyx_v_p_tmp; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d1; + __Pyx_Buffer __pyx_pybuffer_d1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d2; + __Pyx_Buffer __pyx_pybuffer_d2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_data1; + __Pyx_Buffer __pyx_pybuffer_data1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_data2; + __Pyx_Buffer __pyx_pybuffer_data2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_out; + __Pyx_Buffer __pyx_pybuffer_out; + __Pyx_LocalBuf_ND __pyx_pybuffernd_tmp; + __Pyx_Buffer __pyx_pybuffer_tmp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - char *__pyx_t_6; + int __pyx_t_5; + PyArrayObject *__pyx_t_6 = NULL; + PyArrayObject *__pyx_t_7 = NULL; + char *__pyx_t_8; + Correl *__pyx_t_9; + plan *__pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + long __pyx_t_20; + long __pyx_t_21; + long __pyx_t_22; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); + __Pyx_RefNannySetupContext("correlateParallel", 0); + __pyx_pybuffer_d1.pybuffer.buf = NULL; + __pyx_pybuffer_d1.refcount = 0; + __pyx_pybuffernd_d1.data = NULL; + __pyx_pybuffernd_d1.rcbuffer = &__pyx_pybuffer_d1; + __pyx_pybuffer_d2.pybuffer.buf = NULL; + __pyx_pybuffer_d2.refcount = 0; + __pyx_pybuffernd_d2.data = NULL; + __pyx_pybuffernd_d2.rcbuffer = &__pyx_pybuffer_d2; + __pyx_pybuffer_tmp.pybuffer.buf = NULL; + __pyx_pybuffer_tmp.refcount = 0; + __pyx_pybuffernd_tmp.data = NULL; + __pyx_pybuffernd_tmp.rcbuffer = &__pyx_pybuffer_tmp; + __pyx_pybuffer_data1.pybuffer.buf = NULL; + __pyx_pybuffer_data1.refcount = 0; + __pyx_pybuffernd_data1.data = NULL; + __pyx_pybuffernd_data1.rcbuffer = &__pyx_pybuffer_data1; + __pyx_pybuffer_data2.pybuffer.buf = NULL; + __pyx_pybuffer_data2.refcount = 0; + __pyx_pybuffernd_data2.data = NULL; + __pyx_pybuffernd_data2.rcbuffer = &__pyx_pybuffer_data2; + __pyx_pybuffer_out.pybuffer.buf = NULL; + __pyx_pybuffer_out.refcount = 0; + __pyx_pybuffernd_out.data = NULL; + __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data1.rcbuffer->pybuffer, (PyObject*)__pyx_v_data1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 24, __pyx_L1_error) + } + __pyx_pybuffernd_data1.diminfo[0].strides = __pyx_pybuffernd_data1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data1.diminfo[0].shape = __pyx_pybuffernd_data1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_data1.diminfo[1].strides = __pyx_pybuffernd_data1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_data1.diminfo[1].shape = __pyx_pybuffernd_data1.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data2.rcbuffer->pybuffer, (PyObject*)__pyx_v_data2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 24, __pyx_L1_error) + } + __pyx_pybuffernd_data2.diminfo[0].strides = __pyx_pybuffernd_data2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data2.diminfo[0].shape = __pyx_pybuffernd_data2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_data2.diminfo[1].strides = __pyx_pybuffernd_data2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_data2.diminfo[1].shape = __pyx_pybuffernd_data2.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 24, __pyx_L1_error) + } + __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; - /* "View.MemoryView":406 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * + /* "newanalysis/helpers/correl.pyx":67 + * Each column is the x/y/z component of each particle, each row is a time step. + * """ + * cdef long _n = len(data1) # <<<<<<<<<<<<<< + * cdef long ncut = len(data1[0]) + * cdef int m=-1, _ltc=0, lowhigh=0 */ - __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_data1)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_v__n = ((long)__pyx_t_1); - /* "View.MemoryView":407 - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: - * return self # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":68 + * """ + * cdef long _n = len(data1) + * cdef long ncut = len(data1[0]) # <<<<<<<<<<<<<< + * cdef int m=-1, _ltc=0, lowhigh=0 + * cdef long i, j + */ + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_data1), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_ncut = ((long)__pyx_t_1); + + /* "newanalysis/helpers/correl.pyx":69 + * cdef long _n = len(data1) + * cdef long ncut = len(data1[0]) + * cdef int m=-1, _ltc=0, lowhigh=0 # <<<<<<<<<<<<<< + * cdef long i, j * - * have_slices, indices = _unellipsify(index, self.view.ndim) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; + __pyx_v_m = -1; + __pyx_v__ltc = 0; + __pyx_v_lowhigh = 0; - /* "View.MemoryView":406 + /* "newanalysis/helpers/correl.pyx":72 + * cdef long i, j * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] d1=np.ascontiguousarray(data1) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] d2=np.ascontiguousarray(data2) * */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_data1)}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_6 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d1.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_d1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_d1.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 72, __pyx_L1_error) + } else {__pyx_pybuffernd_d1.diminfo[0].strides = __pyx_pybuffernd_d1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d1.diminfo[0].shape = __pyx_pybuffernd_d1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d1.diminfo[1].strides = __pyx_pybuffernd_d1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d1.diminfo[1].shape = __pyx_pybuffernd_d1.rcbuffer->pybuffer.shape[1]; + } } + __pyx_t_6 = 0; + __pyx_v_d1 = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":409 - * return self + /* "newanalysis/helpers/correl.pyx":73 * - * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] d1=np.ascontiguousarray(data1) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] d2=np.ascontiguousarray(data2) # <<<<<<<<<<<<<< * - * cdef char *itemp + * cdef double *p_data1 = d1.data */ - __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (likely(__pyx_t_3 != Py_None)) { - PyObject* sequence = __pyx_t_3; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 409, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_data2)}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 409, __pyx_L1_error) } - __pyx_v_have_slices = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_v_indices = __pyx_t_5; - __pyx_t_5 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_d2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 73, __pyx_L1_error) + } else {__pyx_pybuffernd_d2.diminfo[0].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d2.diminfo[0].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d2.diminfo[1].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d2.diminfo[1].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_7 = 0; + __pyx_v_d2 = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":412 + /* "newanalysis/helpers/correl.pyx":75 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] d2=np.ascontiguousarray(data2) * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: - */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 412, __pyx_L1_error) - if (__pyx_t_2) { - - /* "View.MemoryView":413 - * cdef char *itemp - * if have_slices: - * return memview_slice(self, indices) # <<<<<<<<<<<<<< - * else: - * itemp = self.get_item_pointer(indices) + * cdef double *p_data1 = d1.data # <<<<<<<<<<<<<< + * cdef double *p_data2 = d2.data + * cdef double *p_out = out.data */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_8 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_d1)); if (unlikely(__pyx_t_8 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_v_p_data1 = ((double *)__pyx_t_8); - /* "View.MemoryView":412 + /* "newanalysis/helpers/correl.pyx":76 + * + * cdef double *p_data1 = d1.data + * cdef double *p_data2 = d2.data # <<<<<<<<<<<<<< + * cdef double *p_out = out.data * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: */ - } + __pyx_t_8 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_d2)); if (unlikely(__pyx_t_8 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 76, __pyx_L1_error) + __pyx_v_p_data2 = ((double *)__pyx_t_8); - /* "View.MemoryView":415 - * return memview_slice(self, indices) - * else: - * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< - * return self.convert_item_to_object(itemp) + /* "newanalysis/helpers/correl.pyx":77 + * cdef double *p_data1 = d1.data + * cdef double *p_data2 = d2.data + * cdef double *p_out = out.data # <<<<<<<<<<<<<< * + * cdef Correl *myCorrel = new Correl() */ - /*else*/ { - __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 415, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_6; + __pyx_t_8 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_out)); if (unlikely(__pyx_t_8 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_v_p_out = ((double *)__pyx_t_8); - /* "View.MemoryView":416 - * else: - * itemp = self.get_item_pointer(indices) - * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":79 + * cdef double *p_out = out.data * - * def __setitem__(memoryview self, object index, object value): + * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< + * cdef plan *myplan = new plan(p_data1,p_data2,ncut) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] tmp = np.zeros((_n,ncut),dtype=np.float64) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + try { + __pyx_t_9 = new Correl(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 79, __pyx_L1_error) } + __pyx_v_myCorrel = __pyx_t_9; - /* "View.MemoryView":405 - * + /* "newanalysis/helpers/correl.pyx":80 * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self + * cdef Correl *myCorrel = new Correl() + * cdef plan *myplan = new plan(p_data1,p_data2,ncut) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] tmp = np.zeros((_n,ncut),dtype=np.float64) + * cdef double *p_tmp = tmp.data */ + try { + __pyx_t_10 = new plan(__pyx_v_p_data1, __pyx_v_p_data2, __pyx_v_ncut); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 80, __pyx_L1_error) + } + __pyx_v_myplan = __pyx_t_10; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_indices); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) + /* "newanalysis/helpers/correl.pyx":81 + * cdef Correl *myCorrel = new Correl() + * cdef plan *myplan = new plan(p_data1,p_data2,ncut) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] tmp = np.zeros((_n,ncut),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *p_tmp = tmp.data * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_ncut); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_11)) __PYX_ERR(0, 81, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, __pyx_t_12) < 0) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_12); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tmp.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_tmp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_tmp.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 81, __pyx_L1_error) + } else {__pyx_pybuffernd_tmp.diminfo[0].strides = __pyx_pybuffernd_tmp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tmp.diminfo[0].shape = __pyx_pybuffernd_tmp.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_tmp.diminfo[1].strides = __pyx_pybuffernd_tmp.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_tmp.diminfo[1].shape = __pyx_pybuffernd_tmp.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_13 = 0; + __pyx_v_tmp = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; -/* Python wrapper */ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_obj = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - __Pyx_INCREF(__pyx_v_index); + /* "newanalysis/helpers/correl.pyx":82 + * cdef plan *myplan = new plan(p_data1,p_data2,ncut) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] tmp = np.zeros((_n,ncut),dtype=np.float64) + * cdef double *p_tmp = tmp.data # <<<<<<<<<<<<<< + * + * if ltc==1 or ltc==2: + */ + __pyx_t_8 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_tmp)); if (unlikely(__pyx_t_8 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_v_p_tmp = ((double *)__pyx_t_8); - /* "View.MemoryView":419 + /* "newanalysis/helpers/correl.pyx":84 + * cdef double *p_tmp = tmp.data * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") + * if ltc==1 or ltc==2: # <<<<<<<<<<<<<< + * _ltc = ltc * */ - __pyx_t_1 = (__pyx_v_self->view.readonly != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_15 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_ltc, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 84, __pyx_L1_error) + if (!__pyx_t_15) { + } else { + __pyx_t_14 = __pyx_t_15; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_15 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_ltc, __pyx_int_2, 2, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_14 = __pyx_t_15; + __pyx_L4_bool_binop_done:; + if (__pyx_t_14) { - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":85 * - * have_slices, index = _unellipsify(index, self.view.ndim) + * if ltc==1 or ltc==2: + * _ltc = ltc # <<<<<<<<<<<<<< + * + * for i in prange(_n,nogil=True): */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 420, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_ltc); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_v__ltc = __pyx_t_5; - /* "View.MemoryView":419 + /* "newanalysis/helpers/correl.pyx":84 + * cdef double *p_tmp = tmp.data * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") + * if ltc==1 or ltc==2: # <<<<<<<<<<<<<< + * _ltc = ltc * */ } - /* "View.MemoryView":422 - * raise TypeError("Cannot assign to read-only memoryview") + /* "newanalysis/helpers/correl.pyx":87 + * _ltc = ltc * - * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * for i in prange(_n,nogil=True): # <<<<<<<<<<<<<< + * myCorrel.correl(&(p_data1[i*ncut]),&(p_data2[i*ncut]), ncut,&(p_tmp[i*ncut]),m,_ltc,lowhigh,myplan) * - * if have_slices: */ - __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(__pyx_t_2 != Py_None)) { - PyObject* sequence = __pyx_t_2; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 422, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 422, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); - __pyx_t_4 = 0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_16 = __pyx_v__n; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_18 = (__pyx_t_16 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_18 > 0) + { + #ifdef _OPENMP + #pragma omp parallel + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_18; __pyx_t_17++){ + { + __pyx_v_i = (long)(0 + 1 * __pyx_t_17); - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "newanalysis/helpers/correl.pyx":88 * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: + * for i in prange(_n,nogil=True): + * myCorrel.correl(&(p_data1[i*ncut]),&(p_data2[i*ncut]), ncut,&(p_tmp[i*ncut]),m,_ltc,lowhigh,myplan) # <<<<<<<<<<<<<< + * + * for i in range(ncut): */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_v_myCorrel->correl((&(__pyx_v_p_data1[(__pyx_v_i * __pyx_v_ncut)])), (&(__pyx_v_p_data2[(__pyx_v_i * __pyx_v_ncut)])), ((int)__pyx_v_ncut), (&(__pyx_v_p_tmp[(__pyx_v_i * __pyx_v_ncut)])), __pyx_v_m, __pyx_v__ltc, __pyx_v_lowhigh, __pyx_v_myplan); + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":425 + /* "newanalysis/helpers/correl.pyx":87 + * _ltc = ltc + * + * for i in prange(_n,nogil=True): # <<<<<<<<<<<<<< + * myCorrel.correl(&(p_data1[i*ncut]),&(p_data2[i*ncut]), ncut,&(p_tmp[i*ncut]),m,_ltc,lowhigh,myplan) * - * if have_slices: - * obj = self.is_slice(value) # <<<<<<<<<<<<<< - * if obj: - * self.setitem_slice_assignment(self[index], obj) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_obj = __pyx_t_2; - __pyx_t_2 = 0; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L8; + } + __pyx_L8:; + } + } - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: + /* "newanalysis/helpers/correl.pyx":90 + * myCorrel.correl(&(p_data1[i*ncut]),&(p_data2[i*ncut]), ncut,&(p_tmp[i*ncut]),m,_ltc,lowhigh,myplan) + * + * for i in range(ncut): # <<<<<<<<<<<<<< + * for j in range(_n): + * p_out[i]+=p_tmp[j*ncut+i] */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 426, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_t_18 = __pyx_v_ncut; + __pyx_t_17 = __pyx_t_18; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_17; __pyx_t_16+=1) { + __pyx_v_i = __pyx_t_16; - /* "View.MemoryView":427 - * obj = self.is_slice(value) - * if obj: - * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< - * else: - * self.setitem_slice_assign_scalar(self[index], value) + /* "newanalysis/helpers/correl.pyx":91 + * + * for i in range(ncut): + * for j in range(_n): # <<<<<<<<<<<<<< + * p_out[i]+=p_tmp[j*ncut+i] + * */ - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_19 = __pyx_v__n; + __pyx_t_20 = __pyx_t_19; + for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { + __pyx_v_j = __pyx_t_21; - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: + /* "newanalysis/helpers/correl.pyx":92 + * for i in range(ncut): + * for j in range(_n): + * p_out[i]+=p_tmp[j*ncut+i] # <<<<<<<<<<<<<< + * + * del myCorrel */ - goto __pyx_L5; + __pyx_t_22 = __pyx_v_i; + (__pyx_v_p_out[__pyx_t_22]) = ((__pyx_v_p_out[__pyx_t_22]) + (__pyx_v_p_tmp[((__pyx_v_j * __pyx_v_ncut) + __pyx_v_i)])); } + } - /* "View.MemoryView":429 - * self.setitem_slice_assignment(self[index], obj) - * else: - * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< - * else: - * self.setitem_indexed(index, value) + /* "newanalysis/helpers/correl.pyx":94 + * p_out[i]+=p_tmp[j*ncut+i] + * + * del myCorrel # <<<<<<<<<<<<<< + * del tmp + * del myplan */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 429, __pyx_L1_error) - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L5:; + delete __pyx_v_myCorrel; - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "newanalysis/helpers/correl.pyx":95 + * + * del myCorrel + * del tmp # <<<<<<<<<<<<<< + * del myplan * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: */ - goto __pyx_L4; - } + __Pyx_DECREF((PyObject *)__pyx_v_tmp); __pyx_v_tmp = 0; - /* "View.MemoryView":431 - * self.setitem_slice_assign_scalar(self[index], value) - * else: - * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":96 + * del myCorrel + * del tmp + * del myplan # <<<<<<<<<<<<<< * - * cdef is_slice(self, obj): + * def correlate(np.ndarray[np.float64_t,ndim=1] data1, */ - /*else*/ { - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L4:; + delete __pyx_v_myplan; - /* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) + /* "newanalysis/helpers/correl.pyx":24 + * void transform( double *data, int ncut, double *ans_re, double *ans_im, int ltc ) nogil * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateParallel(np.ndarray[np.float64_t,ndim=2] data1, + * np.ndarray[np.float64_t,ndim=2] data2, */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tmp.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.correlateParallel", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XDECREF(__pyx_v_index); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tmp.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_d1); + __Pyx_XDECREF((PyObject *)__pyx_v_d2); + __Pyx_XDECREF((PyObject *)__pyx_v_tmp); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":433 - * self.setitem_indexed(index, value) +/* "newanalysis/helpers/correl.pyx":98 + * del myplan * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + * def correlate(np.ndarray[np.float64_t,ndim=1] data1, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=1] data2, + * ltc=0): */ -static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_3correlate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_6correl_2correlate, "\n correlate(data1, data2, ltc=0)\n\n Takes two data sets and calculates their correlation function.\n\n Args:\n data1 .. numpy array, float64, ndim=1\n data2 .. numpy array, float64, ndim=1\n ltc .. type of long tail correction used\n 0 = none (default)\n 1 = the average of the time series is subtracted from it before the correlation\n 2 = the result is modified\n\n Usage example:\n result = correlate(data1, data2)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_6correl_3correlate = {"correlate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_3correlate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_6correl_2correlate}; +static PyObject *__pyx_pw_11newanalysis_6correl_3correlate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_data1 = 0; + PyArrayObject *__pyx_v_data2 = 0; + PyObject *__pyx_v_ltc = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("correlate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 98, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data1,&__pyx_n_s_data2,&__pyx_n_s_ltc,0}; + values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_0))); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlate", 0, 2, 3, 1); __PYX_ERR(0, 98, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ltc); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "correlate") < 0)) __PYX_ERR(0, 98, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_data1 = ((PyArrayObject *)values[0]); + __pyx_v_data2 = ((PyArrayObject *)values[1]); + __pyx_v_ltc = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("correlate", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 98, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.correl.correlate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data1), __pyx_ptype_5numpy_ndarray, 1, "data1", 0))) __PYX_ERR(0, 98, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data2), __pyx_ptype_5numpy_ndarray, 1, "data2", 0))) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_2correlate(__pyx_self, __pyx_v_data1, __pyx_v_data2, __pyx_v_ltc); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_6correl_2correlate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2, PyObject *__pyx_v_ltc) { + int __pyx_v_ncut; + PyArrayObject *__pyx_v_ans = 0; + int __pyx_v_m; + int __pyx_v__ltc; + int __pyx_v_lowhigh; + PyArrayObject *__pyx_v_d1 = 0; + PyArrayObject *__pyx_v_d2 = 0; + double *__pyx_v_p_data1; + double *__pyx_v_p_data2; + double *__pyx_v_p_ans; + Correl *__pyx_v_myCorrel; + plan *__pyx_v_myplan; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ans; + __Pyx_Buffer __pyx_pybuffer_ans; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d1; + __Pyx_Buffer __pyx_pybuffer_d1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d2; + __Pyx_Buffer __pyx_pybuffer_d2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_data1; + __Pyx_Buffer __pyx_pybuffer_data1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_data2; + __Pyx_Buffer __pyx_pybuffer_data2; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; + PyArrayObject *__pyx_t_7 = NULL; + int __pyx_t_8; + PyArrayObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + char *__pyx_t_11; + Correl *__pyx_t_12; + plan *__pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_slice", 0); - __Pyx_INCREF(__pyx_v_obj); + __Pyx_RefNannySetupContext("correlate", 0); + __pyx_pybuffer_ans.pybuffer.buf = NULL; + __pyx_pybuffer_ans.refcount = 0; + __pyx_pybuffernd_ans.data = NULL; + __pyx_pybuffernd_ans.rcbuffer = &__pyx_pybuffer_ans; + __pyx_pybuffer_d1.pybuffer.buf = NULL; + __pyx_pybuffer_d1.refcount = 0; + __pyx_pybuffernd_d1.data = NULL; + __pyx_pybuffernd_d1.rcbuffer = &__pyx_pybuffer_d1; + __pyx_pybuffer_d2.pybuffer.buf = NULL; + __pyx_pybuffer_d2.refcount = 0; + __pyx_pybuffernd_d2.data = NULL; + __pyx_pybuffernd_d2.rcbuffer = &__pyx_pybuffer_d2; + __pyx_pybuffer_data1.pybuffer.buf = NULL; + __pyx_pybuffer_data1.refcount = 0; + __pyx_pybuffernd_data1.data = NULL; + __pyx_pybuffernd_data1.rcbuffer = &__pyx_pybuffer_data1; + __pyx_pybuffer_data2.pybuffer.buf = NULL; + __pyx_pybuffer_data2.refcount = 0; + __pyx_pybuffernd_data2.data = NULL; + __pyx_pybuffernd_data2.rcbuffer = &__pyx_pybuffer_data2; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data1.rcbuffer->pybuffer, (PyObject*)__pyx_v_data1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 98, __pyx_L1_error) + } + __pyx_pybuffernd_data1.diminfo[0].strides = __pyx_pybuffernd_data1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data1.diminfo[0].shape = __pyx_pybuffernd_data1.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data2.rcbuffer->pybuffer, (PyObject*)__pyx_v_data2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 98, __pyx_L1_error) + } + __pyx_pybuffernd_data2.diminfo[0].strides = __pyx_pybuffernd_data2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data2.diminfo[0].shape = __pyx_pybuffernd_data2.rcbuffer->pybuffer.shape[0]; - /* "View.MemoryView":434 - * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + /* "newanalysis/helpers/correl.pyx":117 + * result = correlate(data1, data2) + * """ + * cdef int ncut = len(data1) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ans = np.zeros(ncut,dtype=np.float64) + * cdef int m=-1, _ltc=0, lowhigh=0 */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_data1)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_v_ncut = __pyx_t_1; - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) + /* "newanalysis/helpers/correl.pyx":118 + * """ + * cdef int ncut = len(data1) + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ans = np.zeros(ncut,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef int m=-1, _ltc=0, lowhigh=0 + * */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_5); - /*try:*/ { + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ncut); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ans.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { + __pyx_v_ans = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ans.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 118, __pyx_L1_error) + } else {__pyx_pybuffernd_ans.diminfo[0].strides = __pyx_pybuffernd_ans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ans.diminfo[0].shape = __pyx_pybuffernd_ans.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_7 = 0; + __pyx_v_ans = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: + /* "newanalysis/helpers/correl.pyx":119 + * cdef int ncut = len(data1) + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ans = np.zeros(ncut,dtype=np.float64) + * cdef int m=-1, _ltc=0, lowhigh=0 # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d1=np.ascontiguousarray(data1) */ - __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_v_m = -1; + __pyx_v__ltc = 0; + __pyx_v_lowhigh = 0; - /* "View.MemoryView":437 - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * except TypeError: - * return None + /* "newanalysis/helpers/correl.pyx":121 + * cdef int m=-1, _ltc=0, lowhigh=0 + * + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d1=np.ascontiguousarray(data1) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d2=np.ascontiguousarray(data2) + * */ - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 437, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_data1)}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_9 = ((PyArrayObject *)__pyx_t_6); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d1.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { + __pyx_v_d1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_d1.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 121, __pyx_L1_error) + } else {__pyx_pybuffernd_d1.diminfo[0].strides = __pyx_pybuffernd_d1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d1.diminfo[0].shape = __pyx_pybuffernd_d1.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_9 = 0; + __pyx_v_d1 = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: + /* "newanalysis/helpers/correl.pyx":122 + * + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d1=np.ascontiguousarray(data1) + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d2=np.ascontiguousarray(data2) # <<<<<<<<<<<<<< + * + * cdef double *p_data1 = d1.data */ - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); - __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_data2)}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_10 = ((PyArrayObject *)__pyx_t_6); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { + __pyx_v_d2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 122, __pyx_L1_error) + } else {__pyx_pybuffernd_d2.diminfo[0].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d2.diminfo[0].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_10 = 0; + __pyx_v_d2 = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) + /* "newanalysis/helpers/correl.pyx":124 + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] d2=np.ascontiguousarray(data2) + * + * cdef double *p_data1 = d1.data # <<<<<<<<<<<<<< + * cdef double *p_data2 = d2.data + * cdef double *p_ans = ans.data */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_d1)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_v_p_data1 = ((double *)__pyx_t_11); - /* "View.MemoryView":438 - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - * except TypeError: # <<<<<<<<<<<<<< - * return None + /* "newanalysis/helpers/correl.pyx":125 + * + * cdef double *p_data1 = d1.data + * cdef double *p_data2 = d2.data # <<<<<<<<<<<<<< + * cdef double *p_ans = ans.data * */ - __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); - if (__pyx_t_9) { - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 438, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_d2)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_v_p_data2 = ((double *)__pyx_t_11); - /* "View.MemoryView":439 - * self.dtype_is_object) - * except TypeError: - * return None # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":126 + * cdef double *p_data1 = d1.data + * cdef double *p_data2 = d2.data + * cdef double *p_ans = ans.data # <<<<<<<<<<<<<< * - * return obj + * cdef Correl *myCorrel = new Correl() */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_except_return; - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ans)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_v_p_ans = ((double *)__pyx_t_11); - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) + /* "newanalysis/helpers/correl.pyx":128 + * cdef double *p_ans = ans.data + * + * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< + * cdef plan *myplan = new plan(p_data1,p_data2,ncut) + * */ - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L1_error; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L0; - __pyx_L9_try_end:; - } + try { + __pyx_t_12 = new Correl(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 128, __pyx_L1_error) + } + __pyx_v_myCorrel = __pyx_t_12; - /* "View.MemoryView":434 + /* "newanalysis/helpers/correl.pyx":129 * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * cdef Correl *myCorrel = new Correl() + * cdef plan *myplan = new plan(p_data1,p_data2,ncut) # <<<<<<<<<<<<<< + * + * if ltc==1 or ltc==2: */ + try { + __pyx_t_13 = new plan(__pyx_v_p_data1, __pyx_v_p_data2, __pyx_v_ncut); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 129, __pyx_L1_error) } + __pyx_v_myplan = __pyx_t_13; - /* "View.MemoryView":441 - * return None + /* "newanalysis/helpers/correl.pyx":131 + * cdef plan *myplan = new plan(p_data1,p_data2,ncut) * - * return obj # <<<<<<<<<<<<<< + * if ltc==1 or ltc==2: # <<<<<<<<<<<<<< + * _ltc = ltc * - * cdef setitem_slice_assignment(self, dst, src): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_obj); - __pyx_r = __pyx_v_obj; - goto __pyx_L0; + __pyx_t_15 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_ltc, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 131, __pyx_L1_error) + if (!__pyx_t_15) { + } else { + __pyx_t_14 = __pyx_t_15; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_15 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_ltc, __pyx_int_2, 2, 0)); if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_14 = __pyx_t_15; + __pyx_L4_bool_binop_done:; + if (__pyx_t_14) { - /* "View.MemoryView":433 - * self.setitem_indexed(index, value) + /* "newanalysis/helpers/correl.pyx":132 * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + * if ltc==1 or ltc==2: + * _ltc = ltc # <<<<<<<<<<<<<< + * + * myCorrel.correl(p_data1,p_data2,ncut,p_ans,m,_ltc,lowhigh,myplan) */ + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_ltc); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_v__ltc = __pyx_t_8; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":443 - * return obj + /* "newanalysis/helpers/correl.pyx":131 + * cdef plan *myplan = new plan(p_data1,p_data2,ncut) + * + * if ltc==1 or ltc==2: # <<<<<<<<<<<<<< + * _ltc = ltc * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice */ + } -static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { - __Pyx_memviewslice __pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_src_slice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - __Pyx_memviewslice *__pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice + /* "newanalysis/helpers/correl.pyx":134 + * _ltc = ltc * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) + * myCorrel.correl(p_data1,p_data2,ncut,p_ans,m,_ltc,lowhigh,myplan) # <<<<<<<<<<<<<< + * + * del myCorrel */ - if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 447, __pyx_L1_error) - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 447, __pyx_L1_error) + __pyx_v_myCorrel->correl(__pyx_v_p_data1, __pyx_v_p_data2, __pyx_v_ncut, __pyx_v_p_ans, __pyx_v_m, __pyx_v__ltc, __pyx_v_lowhigh, __pyx_v_myplan); - /* "View.MemoryView":448 + /* "newanalysis/helpers/correl.pyx":136 + * myCorrel.correl(p_data1,p_data2,ncut,p_ans,m,_ltc,lowhigh,myplan) * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<< - * src.ndim, dst.ndim, self.dtype_is_object) + * del myCorrel # <<<<<<<<<<<<<< + * del myplan * */ - if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 448, __pyx_L1_error) - __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 448, __pyx_L1_error) + delete __pyx_v_myCorrel; - /* "View.MemoryView":449 - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":137 * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * del myCorrel + * del myplan # <<<<<<<<<<<<<< + * + * return ans */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + delete __pyx_v_myplan; - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice + /* "newanalysis/helpers/correl.pyx":139 + * del myplan + * + * return ans # <<<<<<<<<<<<<< * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) + * def transform(double [:] data, ltc = 0): */ - __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 447, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_ans); + __pyx_r = ((PyObject *)__pyx_v_ans); + goto __pyx_L0; - /* "View.MemoryView":443 - * return obj + /* "newanalysis/helpers/correl.pyx":98 + * del myplan * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice + * def correlate(np.ndarray[np.float64_t,ndim=1] data1, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=1] data2, + * ltc=0): */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ans.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.correlate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ans.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data2.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_ans); + __Pyx_XDECREF((PyObject *)__pyx_v_d1); + __Pyx_XDECREF((PyObject *)__pyx_v_d2); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) +/* "newanalysis/helpers/correl.pyx":141 + * return ans * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + * def transform(double [:] data, ltc = 0): # <<<<<<<<<<<<<< + * """ + * transform(data, ltc=0) */ -static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { - int __pyx_v_array[0x80]; - void *__pyx_v_tmp; - void *__pyx_v_item; - __Pyx_memviewslice *__pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_tmp_slice; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_5transform(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_6correl_4transform, "\n transform(data, ltc=0)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_6correl_5transform = {"transform", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_5transform, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_6correl_4transform}; +static PyObject *__pyx_pw_11newanalysis_6correl_5transform(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_ltc = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("transform (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 141, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_ltc,0}; + values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_0))); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ltc); + if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "transform") < 0)) __PYX_ERR(0, 141, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 141, __pyx_L3_error) + __pyx_v_ltc = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("transform", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 141, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1); + __Pyx_AddTraceback("newanalysis.correl.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_6correl_4transform(__pyx_self, __pyx_v_data, __pyx_v_ltc); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_6correl_4transform(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_data, PyObject *__pyx_v_ltc) { + int __pyx_v_ncut; + int __pyx_v_nc; + __Pyx_memviewslice __pyx_v_ans = { 0, 0, { 0 }, { 0 }, { 0 } }; + Correl *__pyx_v_myCorrel; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - int __pyx_t_2; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - char const *__pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Correl *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + __Pyx_RefNannySetupContext("transform", 0); - /* "View.MemoryView":453 - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - * cdef int array[128] - * cdef void *tmp = NULL # <<<<<<<<<<<<<< - * cdef void *item + /* "newanalysis/helpers/correl.pyx":145 + * transform(data, ltc=0) + * """ + * cdef int ncut = len(data) # <<<<<<<<<<<<<< + * cdef int nc = ncut + 1 * */ - __pyx_v_tmp = NULL; + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_data); + __pyx_v_ncut = __pyx_t_1; - /* "View.MemoryView":458 - * cdef __Pyx_memviewslice *dst_slice - * cdef __Pyx_memviewslice tmp_slice - * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":146 + * """ + * cdef int ncut = len(data) + * cdef int nc = ncut + 1 # <<<<<<<<<<<<<< * - * if self.view.itemsize > sizeof(array): + * cdef double [:,:] ans = np.zeros((2,nc), dtype=np.float64) */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 458, __pyx_L1_error) - __pyx_v_dst_slice = __pyx_t_1; + __pyx_v_nc = (__pyx_v_ncut + 1); - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) + /* "newanalysis/helpers/correl.pyx":148 + * cdef int nc = ncut + 1 * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - */ - __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":461 + * cdef double [:,:] ans = np.zeros((2,nc), dtype=np.float64) # <<<<<<<<<<<<<< * - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< - * if tmp == NULL: - * raise MemoryError - */ - __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp - */ - __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":463 - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * item = tmp - * else: - */ - PyErr_NoMemory(); __PYX_ERR(2, 463, __pyx_L1_error) - - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp - */ - } - - /* "View.MemoryView":464 - * if tmp == NULL: - * raise MemoryError - * item = tmp # <<<<<<<<<<<<<< - * else: - * item = array + * cdef Correl *myCorrel = new Correl() */ - __pyx_v_item = __pyx_v_tmp; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_2)) __PYX_ERR(0, 148, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_ans = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) + /* "newanalysis/helpers/correl.pyx":150 + * cdef double [:,:] ans = np.zeros((2,nc), dtype=np.float64) * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":466 - * item = tmp - * else: - * item = array # <<<<<<<<<<<<<< + * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< * - * try: + * myCorrel.transform(&data[0], ncut, &ans[0,0], &ans[1,0], ltc) */ - /*else*/ { - __pyx_v_item = ((void *)__pyx_v_array); + try { + __pyx_t_8 = new Correl(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 150, __pyx_L1_error) } - __pyx_L3:; - - /* "View.MemoryView":468 - * item = array - * - * try: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * ( item)[0] = value - */ - /*try:*/ { - - /* "View.MemoryView":469 - * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: - */ - __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":470 - * try: - * if self.dtype_is_object: - * ( item)[0] = value # <<<<<<<<<<<<<< - * else: - * self.assign_item_from_object( item, value) - */ - (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - - /* "View.MemoryView":469 - * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: - */ - goto __pyx_L8; - } - - /* "View.MemoryView":472 - * ( item)[0] = value - * else: - * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 472, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L8:; + __pyx_v_myCorrel = __pyx_t_8; - /* "View.MemoryView":476 - * + /* "newanalysis/helpers/correl.pyx":152 + * cdef Correl *myCorrel = new Correl() * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - */ - __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":477 + * myCorrel.transform(&data[0], ncut, &ans[0,0], &ans[1,0], ltc) # <<<<<<<<<<<<<< * - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) + * return np.asarray(ans) */ - __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 477, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = -1; + if (__pyx_t_9 < 0) { + __pyx_t_9 += __pyx_v_data.shape[0]; + if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0; + } else if (unlikely(__pyx_t_9 >= __pyx_v_data.shape[0])) __pyx_t_10 = 0; + if (unlikely(__pyx_t_10 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_10); + __PYX_ERR(0, 152, __pyx_L1_error) + } + __pyx_t_11 = 0; + __pyx_t_12 = 0; + __pyx_t_10 = -1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_v_ans.shape[0]; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0; + } else if (unlikely(__pyx_t_11 >= __pyx_v_ans.shape[0])) __pyx_t_10 = 0; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_v_ans.shape[1]; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1; + } else if (unlikely(__pyx_t_12 >= __pyx_v_ans.shape[1])) __pyx_t_10 = 1; + if (unlikely(__pyx_t_10 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_10); + __PYX_ERR(0, 152, __pyx_L1_error) + } + __pyx_t_13 = 1; + __pyx_t_14 = 0; + __pyx_t_10 = -1; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_v_ans.shape[0]; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 0; + } else if (unlikely(__pyx_t_13 >= __pyx_v_ans.shape[0])) __pyx_t_10 = 0; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_v_ans.shape[1]; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 1; + } else if (unlikely(__pyx_t_14 >= __pyx_v_ans.shape[1])) __pyx_t_10 = 1; + if (unlikely(__pyx_t_10 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_10); + __PYX_ERR(0, 152, __pyx_L1_error) + } + __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_ltc); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_v_myCorrel->transform((&(*((double *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_9 * __pyx_v_data.strides[0]) )))), __pyx_v_ncut, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ans.data + __pyx_t_11 * __pyx_v_ans.strides[0]) ) + __pyx_t_12 * __pyx_v_ans.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ans.data + __pyx_t_13 * __pyx_v_ans.strides[0]) ) + __pyx_t_14 * __pyx_v_ans.strides[1]) )))), ((int)__pyx_t_10)); - /* "View.MemoryView":476 + /* "newanalysis/helpers/correl.pyx":154 + * myCorrel.transform(&data[0], ncut, &ans[0,0], &ans[1,0], ltc) * + * return np.asarray(ans) # <<<<<<<<<<<<<< * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * @cython.boundscheck(False) */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_ans, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_10 = 1; } - - /* "View.MemoryView":478 - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< - * item, self.dtype_is_object) - * finally: - */ - __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); } - - /* "View.MemoryView":481 - * item, self.dtype_is_object) - * finally: - * PyMem_Free(tmp) # <<<<<<<<<<<<<< - * - * cdef setitem_indexed(self, index, value): - */ - /*finally:*/ { - /*normal exit:*/{ - PyMem_Free(__pyx_v_tmp); - goto __pyx_L7; - } - __pyx_L6_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; - { - PyMem_Free(__pyx_v_tmp); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; - goto __pyx_L1_error; - } - __pyx_L7:; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) + /* "newanalysis/helpers/correl.pyx":141 + * return ans * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + * def transform(double [:] data, ltc = 0): # <<<<<<<<<<<<<< + * """ + * transform(data, ltc=0) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_AddTraceback("newanalysis.correl.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ans, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":483 - * PyMem_Free(tmp) +/* "newanalysis/helpers/correl.pyx":156 + * return np.asarray(ans) * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsecrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * np.ndarray[np.int32_t,ndim=2] pds, */ -static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_7sparsecrosscorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_7sparsecrosscorrelate = {"sparsecrosscorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_7sparsecrosscorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_7sparsecrosscorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_pdata = 0; + PyArrayObject *__pyx_v_pds = 0; + int __pyx_v_pnshells; + PyObject *__pyx_v_maxlen = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_indexed", 0); - - /* "View.MemoryView":484 - * - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< - * self.assign_item_from_object(itemp, value) - * - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 484, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_1; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sparsecrosscorrelate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 156, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,0}; - /* "View.MemoryView":485 - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< - * - * cdef convert_item_to_object(self, char *itemp): + /* "newanalysis/helpers/correl.pyx":160 + * np.ndarray[np.int32_t,ndim=2] pds, + * int pnshells, + * maxlen=None,): # <<<<<<<<<<<<<< + * cdef int nmol = len(pdata) # number of molecules + * cdef int n = len(pdata[0]) # number of time steps */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 485, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pdata)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsecrosscorrelate", 0, 3, 4, 1); __PYX_ERR(0, 156, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pnshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsecrosscorrelate", 0, 3, 4, 2); __PYX_ERR(0, 156, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sparsecrosscorrelate") < 0)) __PYX_ERR(0, 156, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_pdata = ((PyArrayObject *)values[0]); + __pyx_v_pds = ((PyArrayObject *)values[1]); + __pyx_v_pnshells = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L3_error) + __pyx_v_maxlen = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sparsecrosscorrelate", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 156, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.correl.sparsecrosscorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 157, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_6sparsecrosscorrelate(__pyx_self, __pyx_v_pdata, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen); - /* "View.MemoryView":483 - * PyMem_Free(tmp) + /* "newanalysis/helpers/correl.pyx":156 + * return np.asarray(ans) * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsecrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * np.ndarray[np.int32_t,ndim=2] pds, */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - -static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_v_struct = NULL; - PyObject *__pyx_v_bytesitem = 0; - PyObject *__pyx_v_result = NULL; +static PyObject *__pyx_pf_11newanalysis_6correl_6sparsecrosscorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen) { + int __pyx_v_nmol; + int __pyx_v_n; + int __pyx_v_nds; + int __pyx_v_maxdt; + int __pyx_v_nshells; + PyArrayObject *__pyx_v_contdata = 0; + PyArrayObject *__pyx_v_contds = 0; + double *__pyx_v_cdata; + int *__pyx_v_cds; + PyArrayObject *__pyx_v_corr = 0; + PyArrayObject *__pyx_v_ctr = 0; + double *__pyx_v_ccorr; + double *__pyx_v_cctr; + double __pyx_v_value; + int __pyx_v_start; + int __pyx_v_dt; + int __pyx_v_mol; + int __pyx_v_shell; + int __pyx_v_i; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; + __Pyx_Buffer __pyx_pybuffer_contdata; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; + __Pyx_Buffer __pyx_pybuffer_contds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; + __Pyx_Buffer __pyx_pybuffer_corr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; + __Pyx_Buffer __pyx_pybuffer_pdata; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; + __Pyx_Buffer __pyx_pybuffer_pds; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_3; + int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - size_t __pyx_t_10; - int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":490 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef bytes bytesitem - * + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sparsecrosscorrelate", 0); + __pyx_pybuffer_contdata.pybuffer.buf = NULL; + __pyx_pybuffer_contdata.refcount = 0; + __pyx_pybuffernd_contdata.data = NULL; + __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; + __pyx_pybuffer_contds.pybuffer.buf = NULL; + __pyx_pybuffer_contds.refcount = 0; + __pyx_pybuffernd_contds.data = NULL; + __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; + __pyx_pybuffer_corr.pybuffer.buf = NULL; + __pyx_pybuffer_corr.refcount = 0; + __pyx_pybuffernd_corr.data = NULL; + __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_pdata.pybuffer.buf = NULL; + __pyx_pybuffer_pdata.refcount = 0; + __pyx_pybuffernd_pdata.data = NULL; + __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; + __pyx_pybuffer_pds.pybuffer.buf = NULL; + __pyx_pybuffer_pds.refcount = 0; + __pyx_pybuffernd_pds.data = NULL; + __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 156, __pyx_L1_error) + } + __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 156, __pyx_L1_error) + } + __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; + + /* "newanalysis/helpers/correl.pyx":161 + * int pnshells, + * maxlen=None,): + * cdef int nmol = len(pdata) # number of molecules # <<<<<<<<<<<<<< + * cdef int n = len(pdata[0]) # number of time steps + * cdef int nds = len(pds[0]) # number of steps in delaunay array */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_v_nmol = __pyx_t_1; - /* "View.MemoryView":493 - * cdef bytes bytesitem - * - * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< - * try: - * result = struct.unpack(self.view.format, bytesitem) + /* "newanalysis/helpers/correl.pyx":162 + * maxlen=None,): + * cdef int nmol = len(pdata) # number of molecules + * cdef int n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< + * cdef int nds = len(pds[0]) # number of steps in delaunay array + * cdef int maxdt = n */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n = __pyx_t_1; - /* "View.MemoryView":494 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + /* "newanalysis/helpers/correl.pyx":163 + * cdef int nmol = len(pdata) # number of molecules + * cdef int n = len(pdata[0]) # number of time steps + * cdef int nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< + * cdef int maxdt = n + * cdef int nshells = pnshells */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_nds = __pyx_t_1; - /* "View.MemoryView":495 - * bytesitem = itemp[:self.view.itemsize] - * try: - * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< - * except struct.error: - * raise ValueError("Unable to convert item to object") + /* "newanalysis/helpers/correl.pyx":164 + * cdef int n = len(pdata[0]) # number of time steps + * cdef int nds = len(pds[0]) # number of steps in delaunay array + * cdef int maxdt = n # <<<<<<<<<<<<<< + * cdef int nshells = pnshells + * if maxlen != None: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); - __Pyx_INCREF(__pyx_v_bytesitem); - __Pyx_GIVEREF(__pyx_v_bytesitem); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_maxdt = __pyx_v_n; - /* "View.MemoryView":494 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + /* "newanalysis/helpers/correl.pyx":165 + * cdef int nds = len(pds[0]) # number of steps in delaunay array + * cdef int maxdt = n + * cdef int nshells = pnshells # <<<<<<<<<<<<<< + * if maxlen != None: + * maxdt = maxlen */ - } + __pyx_v_nshells = __pyx_v_pnshells; - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result + /* "newanalysis/helpers/correl.pyx":166 + * cdef int maxdt = n + * cdef int nshells = pnshells + * if maxlen != None: # <<<<<<<<<<<<<< + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) */ - /*else:*/ { - __pyx_t_10 = strlen(__pyx_v_self->view.format); - __pyx_t_11 = ((__pyx_t_10 == 1) != 0); - if (__pyx_t_11) { + __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { - /* "View.MemoryView":500 - * else: - * if len(self.view.format) == 1: - * return result[0] # <<<<<<<<<<<<<< - * return result - * + /* "newanalysis/helpers/correl.pyx":167 + * cdef int nshells = pnshells + * if maxlen != None: + * maxdt = maxlen # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L6_except_return; + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_v_maxdt = __pyx_t_4; - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result + /* "newanalysis/helpers/correl.pyx":166 + * cdef int maxdt = n + * cdef int nshells = pnshells + * if maxlen != None: # <<<<<<<<<<<<<< + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) */ - } + } - /* "View.MemoryView":501 - * if len(self.view.format) == 1: - * return result[0] - * return result # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): + /* "newanalysis/helpers/correl.pyx":168 + * if maxlen != None: + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L6_except_return; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; } - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_pdata)}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "View.MemoryView":496 - * try: - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: # <<<<<<<<<<<<<< - * raise ValueError("Unable to convert item to object") - * else: - */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6); + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9); - __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0; - if (__pyx_t_8) { - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); - - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: - */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 497, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(2, 497, __pyx_L5_except_error) + } + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 168, __pyx_L1_error) + } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + } + __pyx_t_7 = 0; + __pyx_v_contdata = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":494 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + /* "newanalysis/helpers/correl.pyx":169 + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data */ - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L6_except_return:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, ((PyObject *)__pyx_v_pds)}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 169, __pyx_L1_error) + } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; + } } + __pyx_t_8 = 0; + __pyx_v_contds = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + /* "newanalysis/helpers/correl.pyx":170 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< + * cdef int *cds = contds.data + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = np.zeros((nshells,maxdt),dtype=np.float64) */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contdata)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_v_cdata = ((double *)__pyx_t_9); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesitem); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":171 + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contds)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_v_cds = ((int *)__pyx_t_9); -/* "View.MemoryView":503 - * return result - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + /* "newanalysis/helpers/correl.pyx":172 + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10)) __PYX_ERR(0, 172, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 172, __pyx_L1_error) + } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_12 = 0; + __pyx_v_corr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; -static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_v_struct = NULL; - char __pyx_v_c; - PyObject *__pyx_v_bytesvalue = 0; - Py_ssize_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - char *__pyx_t_11; - char *__pyx_t_12; - char *__pyx_t_13; - char *__pyx_t_14; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); + /* "newanalysis/helpers/correl.pyx":173 + * cdef int *cds = contds.data + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *ccorr = corr.data + * cdef double *cctr = ctr.data + */ + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11)) __PYX_ERR(0, 173, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 173, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_13 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":506 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef char c - * cdef bytes bytesvalue + /* "newanalysis/helpers/correl.pyx":174 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< + * cdef double *cctr = ctr.data + * cdef double value */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_corr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_v_ccorr = ((double *)__pyx_t_9); - /* "View.MemoryView":511 - * cdef Py_ssize_t i - * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: + /* "newanalysis/helpers/correl.pyx":175 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data + * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< + * cdef double value + * cdef int start,dt,mol,shell */ - __pyx_t_2 = PyTuple_Check(__pyx_v_value); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_v_cctr = ((double *)__pyx_t_9); - /* "View.MemoryView":512 + /* "newanalysis/helpers/correl.pyx":179 + * cdef int start,dt,mol,shell * - * if isinstance(value, tuple): - * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< - * else: - * bytesvalue = struct.pack(self.view.format, value) + * for dt in prange(maxdt,nogil=True): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_15 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_15 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_3) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shell) lastprivate(__pyx_v_start) lastprivate(__pyx_v_value) + #endif /* _OPENMP */ + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){ + { + __pyx_v_dt = (int)(0 + 1 * __pyx_t_14); + /* Initialize private variables to invalid values */ + __pyx_v_mol = ((int)0xbad0bad0); + __pyx_v_shell = ((int)0xbad0bad0); + __pyx_v_start = ((int)0xbad0bad0); + __pyx_v_value = ((double)__PYX_NAN()); - /* "View.MemoryView":511 - * cdef Py_ssize_t i + /* "newanalysis/helpers/correl.pyx":180 * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: + * for dt in prange(maxdt,nogil=True): # loop over all delta t + * for start in range(n-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * shell = cds[mol*nds+start]-1 */ - goto __pyx_L3; - } + __pyx_t_16 = (__pyx_v_n - __pyx_v_dt); + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_start = __pyx_t_18; - /* "View.MemoryView":514 - * bytesvalue = struct.pack(self.view.format, *value) - * else: - * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< - * - * for i, c in enumerate(bytesvalue): + /* "newanalysis/helpers/correl.pyx":181 + * for dt in prange(maxdt,nogil=True): # loop over all delta t + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * shell = cds[mol*nds+start]-1 + * if shell < nshells: */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 514, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - } - __pyx_L3:; + __pyx_t_19 = __pyx_v_nmol; + __pyx_t_20 = __pyx_t_19; + for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { + __pyx_v_mol = __pyx_t_21; - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c - * + /* "newanalysis/helpers/correl.pyx":182 + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * shell = cds[mol*nds+start]-1 # <<<<<<<<<<<<<< + * if shell < nshells: + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] */ - __pyx_t_9 = 0; - if (unlikely(__pyx_v_bytesvalue == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(2, 516, __pyx_L1_error) - } - __Pyx_INCREF(__pyx_v_bytesvalue); - __pyx_t_10 = __pyx_v_bytesvalue; - __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10); - __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10)); - for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { - __pyx_t_11 = __pyx_t_14; - __pyx_v_c = (__pyx_t_11[0]); + __pyx_v_shell = ((__pyx_v_cds[((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start)]) - 1); - /* "View.MemoryView":517 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< - * - * @cname('getbuffer') + /* "newanalysis/helpers/correl.pyx":183 + * for mol in range(nmol): # loop over molecules/entries + * shell = cds[mol*nds+start]-1 + * if shell < nshells: # <<<<<<<<<<<<<< + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + * ccorr[maxdt*shell+dt] += value */ - __pyx_v_i = __pyx_t_9; + __pyx_t_3 = (__pyx_v_shell < __pyx_v_nshells); + if (__pyx_t_3) { - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c - * + /* "newanalysis/helpers/correl.pyx":184 + * shell = cds[mol*nds+start]-1 + * if shell < nshells: + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] # <<<<<<<<<<<<<< + * ccorr[maxdt*shell+dt] += value + * cctr[maxdt*shell+dt] += 1 */ - __pyx_t_9 = (__pyx_t_9 + 1); + __pyx_v_value = ((__pyx_v_cdata[((__pyx_v_mol * __pyx_v_n) + __pyx_v_start)]) * (__pyx_v_cdata[(((__pyx_v_mol * __pyx_v_n) + __pyx_v_start) + __pyx_v_dt)])); - /* "View.MemoryView":517 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":185 + * if shell < nshells: + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + * ccorr[maxdt*shell+dt] += value # <<<<<<<<<<<<<< + * cctr[maxdt*shell+dt] += 1 * - * @cname('getbuffer') */ - (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_22 = ((__pyx_v_maxdt * __pyx_v_shell) + __pyx_v_dt); + (__pyx_v_ccorr[__pyx_t_22]) = ((__pyx_v_ccorr[__pyx_t_22]) + __pyx_v_value); - /* "View.MemoryView":503 - * return result + /* "newanalysis/helpers/correl.pyx":186 + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + * ccorr[maxdt*shell+dt] += value + * cctr[maxdt*shell+dt] += 1 # <<<<<<<<<<<<<< * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * for i in range(maxdt*nshells): */ + __pyx_t_22 = ((__pyx_v_maxdt * __pyx_v_shell) + __pyx_v_dt); + (__pyx_v_cctr[__pyx_t_22]) = ((__pyx_v_cctr[__pyx_t_22]) + 1.0); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesvalue); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":520 - * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "newanalysis/helpers/correl.pyx":183 + * for mol in range(nmol): # loop over molecules/entries + * shell = cds[mol*nds+start]-1 + * if shell < nshells: # <<<<<<<<<<<<<< + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + * ccorr[maxdt*shell+dt] += value */ + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - char *__pyx_t_5; - void *__pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "newanalysis/helpers/correl.pyx":179 + * cdef int start,dt,mol,shell * + * for dt in prange(maxdt,nogil=True): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } } - __pyx_t_2 = (__pyx_v_self->view.readonly != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< - * - * if flags & PyBUF_ND: - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 522, __pyx_L1_error) - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "newanalysis/helpers/correl.pyx":188 + * cctr[maxdt*shell+dt] += 1 * + * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] */ - } + __pyx_t_15 = (__pyx_v_maxdt * __pyx_v_nshells); + __pyx_t_14 = __pyx_t_15; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_14; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "newanalysis/helpers/correl.pyx":189 * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); - if (__pyx_t_1) { + __pyx_t_3 = ((__pyx_v_cctr[__pyx_v_i]) != 0.0); + if (__pyx_t_3) { - /* "View.MemoryView":525 - * - * if flags & PyBUF_ND: - * info.shape = self.view.shape # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":190 + * for i in range(maxdt*nshells): + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< * else: - * info.shape = NULL + * print('too sparse') */ - __pyx_t_4 = __pyx_v_self->view.shape; - __pyx_v_info->shape = __pyx_t_4; + __pyx_t_16 = __pyx_v_i; + if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 190, __pyx_L1_error) + } + (__pyx_v_ccorr[__pyx_t_16]) = ((__pyx_v_ccorr[__pyx_t_16]) / (__pyx_v_cctr[__pyx_v_i])); - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "newanalysis/helpers/correl.pyx":189 * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] * else: */ - goto __pyx_L6; - } + goto __pyx_L20; + } - /* "View.MemoryView":527 - * info.shape = self.view.shape + /* "newanalysis/helpers/correl.pyx":192 + * ccorr[i] /= cctr[i] * else: - * info.shape = NULL # <<<<<<<<<<<<<< + * print('too sparse') # <<<<<<<<<<<<<< * - * if flags & PyBUF_STRIDES: + * return corr */ - /*else*/ { - __pyx_v_info->shape = NULL; + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L20:; } - __pyx_L6:; - /* "View.MemoryView":529 - * info.shape = NULL + /* "newanalysis/helpers/correl.pyx":194 + * print('too sparse') * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":530 + * return corr # <<<<<<<<<<<<<< * - * if flags & PyBUF_STRIDES: - * info.strides = self.view.strides # <<<<<<<<<<<<<< - * else: - * info.strides = NULL - */ - __pyx_t_4 = __pyx_v_self->view.strides; - __pyx_v_info->strides = __pyx_t_4; - - /* "View.MemoryView":529 - * info.shape = NULL * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: */ - goto __pyx_L7; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_corr); + __pyx_r = ((PyObject *)__pyx_v_corr); + goto __pyx_L0; - /* "View.MemoryView":532 - * info.strides = self.view.strides - * else: - * info.strides = NULL # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":156 + * return np.asarray(ans) * - * if flags & PyBUF_INDIRECT: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsecrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * np.ndarray[np.int32_t,ndim=2] pds, */ - /*else*/ { - __pyx_v_info->strides = NULL; - } - __pyx_L7:; - /* "View.MemoryView":534 - * info.strides = NULL - * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.sparsecrosscorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_contdata); + __Pyx_XDECREF((PyObject *)__pyx_v_contds); + __Pyx_XDECREF((PyObject *)__pyx_v_corr); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":535 +/* "newanalysis/helpers/correl.pyx":197 * - * if flags & PyBUF_INDIRECT: - * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< - * else: - * info.suboffsets = NULL + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * np.ndarray[np.int32_t,ndim=2] pds, */ - __pyx_t_4 = __pyx_v_self->view.suboffsets; - __pyx_v_info->suboffsets = __pyx_t_4; - /* "View.MemoryView":534 - * info.strides = NULL - * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_9sparsefullcorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_9sparsefullcorrelate = {"sparsefullcorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_9sparsefullcorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_9sparsefullcorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_pdata = 0; + PyArrayObject *__pyx_v_pds = 0; + int __pyx_v_pnshells; + PyObject *__pyx_v_maxlen = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sparsefullcorrelate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 197, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,0}; + + /* "newanalysis/helpers/correl.pyx":201 + * np.ndarray[np.int32_t,ndim=2] pds, + * int pnshells, + * maxlen=None,): # <<<<<<<<<<<<<< + * cdef int nmol = len(pdata) # number of molecules + * cdef int n = len(pdata[0]) # number of time steps */ - goto __pyx_L8; + values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pdata)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullcorrelate", 0, 3, 4, 1); __PYX_ERR(0, 197, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pnshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullcorrelate", 0, 3, 4, 2); __PYX_ERR(0, 197, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sparsefullcorrelate") < 0)) __PYX_ERR(0, 197, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_pdata = ((PyArrayObject *)values[0]); + __pyx_v_pds = ((PyArrayObject *)values[1]); + __pyx_v_pnshells = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L3_error) + __pyx_v_maxlen = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sparsefullcorrelate", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 197, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_AddTraceback("newanalysis.correl.sparsefullcorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 198, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_8sparsefullcorrelate(__pyx_self, __pyx_v_pdata, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen); - /* "View.MemoryView":537 - * info.suboffsets = self.view.suboffsets - * else: - * info.suboffsets = NULL # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":197 * - * if flags & PyBUF_FORMAT: - */ - /*else*/ { - __pyx_v_info->suboffsets = NULL; - } - __pyx_L8:; - - /* "View.MemoryView":539 - * info.suboffsets = NULL - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":540 - * - * if flags & PyBUF_FORMAT: - * info.format = self.view.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL - */ - __pyx_t_5 = __pyx_v_self->view.format; - __pyx_v_info->format = __pyx_t_5; - - /* "View.MemoryView":539 - * info.suboffsets = NULL - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: - */ - goto __pyx_L9; - } - - /* "View.MemoryView":542 - * info.format = self.view.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< - * - * info.buf = self.view.buf - */ - /*else*/ { - __pyx_v_info->format = NULL; - } - __pyx_L9:; - - /* "View.MemoryView":544 - * info.format = NULL - * - * info.buf = self.view.buf # <<<<<<<<<<<<<< - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - */ - __pyx_t_6 = __pyx_v_self->view.buf; - __pyx_v_info->buf = __pyx_t_6; - - /* "View.MemoryView":545 - * - * info.buf = self.view.buf - * info.ndim = self.view.ndim # <<<<<<<<<<<<<< - * info.itemsize = self.view.itemsize - * info.len = self.view.len - */ - __pyx_t_7 = __pyx_v_self->view.ndim; - __pyx_v_info->ndim = __pyx_t_7; - - /* "View.MemoryView":546 - * info.buf = self.view.buf - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< - * info.len = self.view.len - * info.readonly = self.view.readonly - */ - __pyx_t_8 = __pyx_v_self->view.itemsize; - __pyx_v_info->itemsize = __pyx_t_8; - - /* "View.MemoryView":547 - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - * info.len = self.view.len # <<<<<<<<<<<<<< - * info.readonly = self.view.readonly - * info.obj = self - */ - __pyx_t_8 = __pyx_v_self->view.len; - __pyx_v_info->len = __pyx_t_8; - - /* "View.MemoryView":548 - * info.itemsize = self.view.itemsize - * info.len = self.view.len - * info.readonly = self.view.readonly # <<<<<<<<<<<<<< - * info.obj = self - * - */ - __pyx_t_1 = __pyx_v_self->view.readonly; - __pyx_v_info->readonly = __pyx_t_1; - - /* "View.MemoryView":549 - * info.len = self.view.len - * info.readonly = self.view.readonly - * info.obj = self # <<<<<<<<<<<<<< - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") - */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - - /* "View.MemoryView":520 - * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * np.ndarray[np.int32_t,ndim=2] pds, */ /* function exit code */ - __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; + __pyx_r = NULL; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":555 - * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; +static PyObject *__pyx_pf_11newanalysis_6correl_8sparsefullcorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen) { + int __pyx_v_nmol; + int __pyx_v_n; + int __pyx_v_nds; + int __pyx_v_maxdt; + int __pyx_v_nshells; + PyArrayObject *__pyx_v_contdata = 0; + PyArrayObject *__pyx_v_contds = 0; + double *__pyx_v_cdata; + int *__pyx_v_cds; + PyObject *__pyx_v_pcorr = NULL; + PyObject *__pyx_v_pselfcorr = NULL; + PyObject *__pyx_v_pcrosscorr = NULL; + PyArrayObject *__pyx_v_corr = 0; + PyArrayObject *__pyx_v_selfcorr = 0; + PyArrayObject *__pyx_v_crosscorr = 0; + PyArrayObject *__pyx_v_ctr = 0; + PyArrayObject *__pyx_v_selfctr = 0; + PyArrayObject *__pyx_v_crossctr = 0; + double *__pyx_v_ccorr; + double *__pyx_v_cselfcorr; + double *__pyx_v_ccrosscorr; + double *__pyx_v_cctr; + double *__pyx_v_cselfctr; + double *__pyx_v_ccrossctr; + double __pyx_v_value; + int __pyx_v_i; + int __pyx_v_start; + int __pyx_v_dt; + int __pyx_v_mol; + int __pyx_v_shellstart; + int __pyx_v_shelldt; + int __pyx_v_idx; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; + __Pyx_Buffer __pyx_pybuffer_contdata; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; + __Pyx_Buffer __pyx_pybuffer_contds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; + __Pyx_Buffer __pyx_pybuffer_corr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_crosscorr; + __Pyx_Buffer __pyx_pybuffer_crosscorr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_crossctr; + __Pyx_Buffer __pyx_pybuffer_crossctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; + __Pyx_Buffer __pyx_pybuffer_pdata; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; + __Pyx_Buffer __pyx_pybuffer_pds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_selfcorr; + __Pyx_Buffer __pyx_pybuffer_selfcorr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_selfctr; + __Pyx_Buffer __pyx_pybuffer_selfctr; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + PyArrayObject *__pyx_t_14 = NULL; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":556 - * @property - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< - * transpose_memslice(&result.from_slice) - * return result - */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 556, __pyx_L1_error) - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("sparsefullcorrelate", 0); + __pyx_pybuffer_contdata.pybuffer.buf = NULL; + __pyx_pybuffer_contdata.refcount = 0; + __pyx_pybuffernd_contdata.data = NULL; + __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; + __pyx_pybuffer_contds.pybuffer.buf = NULL; + __pyx_pybuffer_contds.refcount = 0; + __pyx_pybuffernd_contds.data = NULL; + __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; + __pyx_pybuffer_corr.pybuffer.buf = NULL; + __pyx_pybuffer_corr.refcount = 0; + __pyx_pybuffernd_corr.data = NULL; + __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; + __pyx_pybuffer_selfcorr.pybuffer.buf = NULL; + __pyx_pybuffer_selfcorr.refcount = 0; + __pyx_pybuffernd_selfcorr.data = NULL; + __pyx_pybuffernd_selfcorr.rcbuffer = &__pyx_pybuffer_selfcorr; + __pyx_pybuffer_crosscorr.pybuffer.buf = NULL; + __pyx_pybuffer_crosscorr.refcount = 0; + __pyx_pybuffernd_crosscorr.data = NULL; + __pyx_pybuffernd_crosscorr.rcbuffer = &__pyx_pybuffer_crosscorr; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_selfctr.pybuffer.buf = NULL; + __pyx_pybuffer_selfctr.refcount = 0; + __pyx_pybuffernd_selfctr.data = NULL; + __pyx_pybuffernd_selfctr.rcbuffer = &__pyx_pybuffer_selfctr; + __pyx_pybuffer_crossctr.pybuffer.buf = NULL; + __pyx_pybuffer_crossctr.refcount = 0; + __pyx_pybuffernd_crossctr.data = NULL; + __pyx_pybuffernd_crossctr.rcbuffer = &__pyx_pybuffer_crossctr; + __pyx_pybuffer_pdata.pybuffer.buf = NULL; + __pyx_pybuffer_pdata.refcount = 0; + __pyx_pybuffernd_pdata.data = NULL; + __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; + __pyx_pybuffer_pds.pybuffer.buf = NULL; + __pyx_pybuffer_pds.refcount = 0; + __pyx_pybuffernd_pds.data = NULL; + __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 197, __pyx_L1_error) + } + __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 197, __pyx_L1_error) + } + __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; - /* "View.MemoryView":557 - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< - * return result - * + /* "newanalysis/helpers/correl.pyx":202 + * int pnshells, + * maxlen=None,): + * cdef int nmol = len(pdata) # number of molecules # <<<<<<<<<<<<<< + * cdef int n = len(pdata[0]) # number of time steps + * cdef int nds = len(pds[0]) # number of steps in delaunay array */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 557, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_v_nmol = __pyx_t_1; - /* "View.MemoryView":558 - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - * return result # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/correl.pyx":203 + * maxlen=None,): + * cdef int nmol = len(pdata) # number of molecules + * cdef int n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< + * cdef int nds = len(pds[0]) # number of steps in delaunay array + * cdef int maxdt = n */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n = __pyx_t_1; - /* "View.MemoryView":555 - * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) + /* "newanalysis/helpers/correl.pyx":204 + * cdef int nmol = len(pdata) # number of molecules + * cdef int n = len(pdata[0]) # number of time steps + * cdef int nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< + * cdef int maxdt = n + * cdef int nshells = pnshells+1 */ + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_nds = __pyx_t_1; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj - * + /* "newanalysis/helpers/correl.pyx":205 + * cdef int n = len(pdata[0]) # number of time steps + * cdef int nds = len(pds[0]) # number of steps in delaunay array + * cdef int maxdt = n # <<<<<<<<<<<<<< + * cdef int nshells = pnshells+1 + * if maxlen != None: */ + __pyx_v_maxdt = __pyx_v_n; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":562 - * @property - * def base(self): - * return self.obj # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/correl.pyx":206 + * cdef int nds = len(pds[0]) # number of steps in delaunay array + * cdef int maxdt = n + * cdef int nshells = pnshells+1 # <<<<<<<<<<<<<< + * if maxlen != None: + * maxdt = maxlen */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->obj); - __pyx_r = __pyx_v_self->obj; - goto __pyx_L0; + __pyx_v_nshells = (__pyx_v_pnshells + 1); - /* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj - * + /* "newanalysis/helpers/correl.pyx":207 + * cdef int maxdt = n + * cdef int nshells = pnshells+1 + * if maxlen != None: # <<<<<<<<<<<<<< + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":565 - * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - * + /* "newanalysis/helpers/correl.pyx":208 + * cdef int nshells = pnshells+1 + * if maxlen != None: + * maxdt = maxlen # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) */ + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_v_maxdt = __pyx_t_4; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_length; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":566 - * @property - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/correl.pyx":207 + * cdef int maxdt = n + * cdef int nshells = pnshells+1 + * if maxlen != None: # <<<<<<<<<<<<<< + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_length = (__pyx_t_2[0]); - __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - /* "View.MemoryView":565 - * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - * + /* "newanalysis/helpers/correl.pyx":209 + * if maxlen != None: + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_pdata)}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 209, __pyx_L1_error) + } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_7 = 0; + __pyx_v_contdata = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":569 - * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: - * + /* "newanalysis/helpers/correl.pyx":210 + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, ((PyObject *)__pyx_v_pds)}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 210, __pyx_L1_error) + } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_8 = 0; + __pyx_v_contds = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "newanalysis/helpers/correl.pyx":211 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contdata)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_v_cdata = ((double *)__pyx_t_9); + + /* "newanalysis/helpers/correl.pyx":212 + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data # <<<<<<<<<<<<<< + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contds)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_v_cds = ((int *)__pyx_t_9); + + /* "newanalysis/helpers/correl.pyx":213 + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6)) __PYX_ERR(0, 213, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10)) __PYX_ERR(0, 213, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_pcorr = __pyx_t_11; + __pyx_t_11 = 0; + + /* "newanalysis/helpers/correl.pyx":214 + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + */ + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11)) __PYX_ERR(0, 214, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 214, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_pselfcorr = __pyx_t_2; + __pyx_t_2 = 0; + + /* "newanalysis/helpers/correl.pyx":215 + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10)) __PYX_ERR(0, 215, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_pcrosscorr = __pyx_t_11; + __pyx_t_11 = 0; + + /* "newanalysis/helpers/correl.pyx":216 + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + */ + if (!(likely(((__pyx_v_pcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_11 = __pyx_v_pcorr; + __Pyx_INCREF(__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 216, __pyx_L1_error) + } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_corr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; + + /* "newanalysis/helpers/correl.pyx":217 + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + if (!(likely(((__pyx_v_pselfcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pselfcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_11 = __pyx_v_pselfcorr; + __Pyx_INCREF(__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_selfcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 217, __pyx_L1_error) + } else {__pyx_pybuffernd_selfcorr.diminfo[0].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfcorr.diminfo[0].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfcorr.diminfo[1].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfcorr.diminfo[1].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_selfcorr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; + + /* "newanalysis/helpers/correl.pyx":218 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + if (!(likely(((__pyx_v_pcrosscorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcrosscorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_11 = __pyx_v_pcrosscorr; + __Pyx_INCREF(__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_crosscorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 218, __pyx_L1_error) + } else {__pyx_pybuffernd_crosscorr.diminfo[0].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crosscorr.diminfo[0].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crosscorr.diminfo[1].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crosscorr.diminfo[1].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_crosscorr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; + + /* "newanalysis/helpers/correl.pyx":219 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11)) __PYX_ERR(0, 219, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 219, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 219, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_12 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "newanalysis/helpers/correl.pyx":220 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10)) __PYX_ERR(0, 220, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_selfctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 220, __pyx_L1_error) + } else {__pyx_pybuffernd_selfctr.diminfo[0].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfctr.diminfo[0].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfctr.diminfo[1].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfctr.diminfo[1].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_13 = 0; + __pyx_v_selfctr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; + + /* "newanalysis/helpers/correl.pyx":221 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data + */ + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11)) __PYX_ERR(0, 221, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_14 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_crossctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 221, __pyx_L1_error) + } else {__pyx_pybuffernd_crossctr.diminfo[0].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crossctr.diminfo[0].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crossctr.diminfo[1].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crossctr.diminfo[1].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_14 = 0; + __pyx_v_crossctr = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "newanalysis/helpers/correl.pyx":222 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data + */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_corr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L1_error) + __pyx_v_ccorr = ((double *)__pyx_t_9); + + /* "newanalysis/helpers/correl.pyx":223 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data # <<<<<<<<<<<<<< + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data + */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_selfcorr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_v_cselfcorr = ((double *)__pyx_t_9); + + /* "newanalysis/helpers/correl.pyx":224 + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data # <<<<<<<<<<<<<< + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data + */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_crosscorr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_v_ccrosscorr = ((double *)__pyx_t_9); + + /* "newanalysis/helpers/correl.pyx":225 + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< + * cdef double *cselfctr = selfctr.data + * cdef double *ccrossctr = crossctr.data + */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_v_cctr = ((double *)__pyx_t_9); + + /* "newanalysis/helpers/correl.pyx":226 + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data # <<<<<<<<<<<<<< + * cdef double *ccrossctr = crossctr.data + * cdef double value + */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_selfctr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_v_cselfctr = ((double *)__pyx_t_9); + + /* "newanalysis/helpers/correl.pyx":227 + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data + * cdef double *ccrossctr = crossctr.data # <<<<<<<<<<<<<< + * cdef double value + * cdef int i,start,dt,mol,shellstart,shelldt,idx + */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_crossctr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_v_ccrossctr = ((double *)__pyx_t_9); + + /* "newanalysis/helpers/correl.pyx":231 + * cdef int i,start,dt,mol,shellstart,shelldt,idx + * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_16 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_16 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_3) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_value) + #endif /* _OPENMP */ + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){ + { + __pyx_v_dt = (int)(0 + 1 * __pyx_t_15); + /* Initialize private variables to invalid values */ + __pyx_v_idx = ((int)0xbad0bad0); + __pyx_v_mol = ((int)0xbad0bad0); + __pyx_v_shelldt = ((int)0xbad0bad0); + __pyx_v_shellstart = ((int)0xbad0bad0); + __pyx_v_start = ((int)0xbad0bad0); + __pyx_v_value = ((double)__PYX_NAN()); + + /* "newanalysis/helpers/correl.pyx":232 + * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for start in range(n-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * shellstart = cds[mol*nds+start]-1 + */ + __pyx_t_17 = (__pyx_v_n - __pyx_v_dt); + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_start = __pyx_t_19; + + /* "newanalysis/helpers/correl.pyx":233 + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * shellstart = cds[mol*nds+start]-1 + * shelldt = cds[mol*nds+start+dt]-1 + */ + __pyx_t_20 = __pyx_v_nmol; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_mol = __pyx_t_22; + + /* "newanalysis/helpers/correl.pyx":234 + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * shellstart = cds[mol*nds+start]-1 # <<<<<<<<<<<<<< + * shelldt = cds[mol*nds+start+dt]-1 + * # if shellstart < nshells: + */ + __pyx_v_shellstart = ((__pyx_v_cds[((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start)]) - 1); + + /* "newanalysis/helpers/correl.pyx":235 + * for mol in range(nmol): # loop over molecules/entries + * shellstart = cds[mol*nds+start]-1 + * shelldt = cds[mol*nds+start+dt]-1 # <<<<<<<<<<<<<< + * # if shellstart < nshells: + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + */ + __pyx_v_shelldt = ((__pyx_v_cds[(((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start) + __pyx_v_dt)]) - 1); + + /* "newanalysis/helpers/correl.pyx":237 + * shelldt = cds[mol*nds+start+dt]-1 + * # if shellstart < nshells: + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] # <<<<<<<<<<<<<< + * idx = maxdt*shellstart+dt + * ccorr[idx] += value + */ + __pyx_v_value = ((__pyx_v_cdata[((__pyx_v_mol * __pyx_v_n) + __pyx_v_start)]) * (__pyx_v_cdata[(((__pyx_v_mol * __pyx_v_n) + __pyx_v_start) + __pyx_v_dt)])); + + /* "newanalysis/helpers/correl.pyx":238 + * # if shellstart < nshells: + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + * idx = maxdt*shellstart+dt # <<<<<<<<<<<<<< + * ccorr[idx] += value + * cctr[idx] += 1 + */ + __pyx_v_idx = ((__pyx_v_maxdt * __pyx_v_shellstart) + __pyx_v_dt); + + /* "newanalysis/helpers/correl.pyx":239 + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + * idx = maxdt*shellstart+dt + * ccorr[idx] += value # <<<<<<<<<<<<<< + * cctr[idx] += 1 + * if shellstart == shelldt: + */ + __pyx_t_23 = __pyx_v_idx; + (__pyx_v_ccorr[__pyx_t_23]) = ((__pyx_v_ccorr[__pyx_t_23]) + __pyx_v_value); + + /* "newanalysis/helpers/correl.pyx":240 + * idx = maxdt*shellstart+dt + * ccorr[idx] += value + * cctr[idx] += 1 # <<<<<<<<<<<<<< + * if shellstart == shelldt: + * cselfcorr[idx] += value + */ + __pyx_t_23 = __pyx_v_idx; + (__pyx_v_cctr[__pyx_t_23]) = ((__pyx_v_cctr[__pyx_t_23]) + 1.0); + + /* "newanalysis/helpers/correl.pyx":241 + * ccorr[idx] += value + * cctr[idx] += 1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * cselfcorr[idx] += value + * cselfctr[idx] += 1 + */ + __pyx_t_3 = (__pyx_v_shellstart == __pyx_v_shelldt); + if (__pyx_t_3) { + + /* "newanalysis/helpers/correl.pyx":242 + * cctr[idx] += 1 + * if shellstart == shelldt: + * cselfcorr[idx] += value # <<<<<<<<<<<<<< + * cselfctr[idx] += 1 + * + */ + __pyx_t_23 = __pyx_v_idx; + (__pyx_v_cselfcorr[__pyx_t_23]) = ((__pyx_v_cselfcorr[__pyx_t_23]) + __pyx_v_value); + + /* "newanalysis/helpers/correl.pyx":243 + * if shellstart == shelldt: + * cselfcorr[idx] += value + * cselfctr[idx] += 1 # <<<<<<<<<<<<<< + * + * for i in range(maxdt*nshells): + */ + __pyx_t_23 = __pyx_v_idx; + (__pyx_v_cselfctr[__pyx_t_23]) = ((__pyx_v_cselfctr[__pyx_t_23]) + 1.0); + + /* "newanalysis/helpers/correl.pyx":241 + * ccorr[idx] += value + * cctr[idx] += 1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * cselfcorr[idx] += value + * cselfctr[idx] += 1 + */ + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/correl.pyx":231 + * cdef int i,start,dt,mol,shellstart,shelldt,idx + * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } + + /* "newanalysis/helpers/correl.pyx":245 + * cselfctr[idx] += 1 + * + * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] + */ + __pyx_t_16 = (__pyx_v_maxdt * __pyx_v_nshells); + __pyx_t_15 = __pyx_t_16; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_15; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "newanalysis/helpers/correl.pyx":246 + * + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: + */ + __pyx_t_3 = ((__pyx_v_cctr[__pyx_v_i]) != 0.0); + if (__pyx_t_3) { + + /* "newanalysis/helpers/correl.pyx":247 + * for i in range(maxdt*nshells): + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< + * else: + * print('tot too sparse') + */ + __pyx_t_17 = __pyx_v_i; + if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 247, __pyx_L1_error) + } + (__pyx_v_ccorr[__pyx_t_17]) = ((__pyx_v_ccorr[__pyx_t_17]) / (__pyx_v_cctr[__pyx_v_i])); + + /* "newanalysis/helpers/correl.pyx":246 + * + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: + */ + goto __pyx_L20; + } + + /* "newanalysis/helpers/correl.pyx":249 + * ccorr[i] /= cctr[i] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * cselfcorr[i] /= cselfctr[i] + */ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L20:; + + /* "newanalysis/helpers/correl.pyx":250 + * else: + * print('tot too sparse') + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * cselfcorr[i] /= cselfctr[i] + * else: + */ + __pyx_t_3 = ((__pyx_v_cctr[__pyx_v_i]) != 0.0); + if (__pyx_t_3) { + + /* "newanalysis/helpers/correl.pyx":251 + * print('tot too sparse') + * if cctr[i] != 0: + * cselfcorr[i] /= cselfctr[i] # <<<<<<<<<<<<<< + * else: + * print('self too sparse') + */ + __pyx_t_17 = __pyx_v_i; + if (unlikely((__pyx_v_cselfctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 251, __pyx_L1_error) + } + (__pyx_v_cselfcorr[__pyx_t_17]) = ((__pyx_v_cselfcorr[__pyx_t_17]) / (__pyx_v_cselfctr[__pyx_v_i])); + + /* "newanalysis/helpers/correl.pyx":250 + * else: + * print('tot too sparse') + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * cselfcorr[i] /= cselfctr[i] + * else: + */ + goto __pyx_L21; + } + + /* "newanalysis/helpers/correl.pyx":253 + * cselfcorr[i] /= cselfctr[i] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< + * + * for i in range(maxdt*nshells): + */ + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L21:; + } + + /* "newanalysis/helpers/correl.pyx":255 + * print('self too sparse') + * + * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] + * ccrossctr[i] = cctr[i] - cselfctr[i] + */ + __pyx_t_16 = (__pyx_v_maxdt * __pyx_v_nshells); + __pyx_t_15 = __pyx_t_16; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_15; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "newanalysis/helpers/correl.pyx":256 + * + * for i in range(maxdt*nshells): + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] # <<<<<<<<<<<<<< + * ccrossctr[i] = cctr[i] - cselfctr[i] + * + */ + (__pyx_v_ccrosscorr[__pyx_v_i]) = ((__pyx_v_ccorr[__pyx_v_i]) - (__pyx_v_cselfcorr[__pyx_v_i])); + + /* "newanalysis/helpers/correl.pyx":257 + * for i in range(maxdt*nshells): + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] + * ccrossctr[i] = cctr[i] - cselfctr[i] # <<<<<<<<<<<<<< + * + * return corr,selfcorr,crosscorr + */ + (__pyx_v_ccrossctr[__pyx_v_i]) = ((__pyx_v_cctr[__pyx_v_i]) - (__pyx_v_cselfctr[__pyx_v_i])); + } + + /* "newanalysis/helpers/correl.pyx":259 + * ccrossctr[i] = cctr[i] - cselfctr[i] + * + * return corr,selfcorr,crosscorr # <<<<<<<<<<<<<< + * + * # @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_corr); + __Pyx_GIVEREF((PyObject *)__pyx_v_corr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_corr))) __PYX_ERR(0, 259, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_selfcorr); + __Pyx_GIVEREF((PyObject *)__pyx_v_selfcorr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_selfcorr))) __PYX_ERR(0, 259, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_crosscorr); + __Pyx_GIVEREF((PyObject *)__pyx_v_crosscorr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_crosscorr))) __PYX_ERR(0, 259, __pyx_L1_error); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "newanalysis/helpers/correl.pyx":197 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * np.ndarray[np.int32_t,ndim=2] pds, */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.sparsefullcorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_contdata); + __Pyx_XDECREF((PyObject *)__pyx_v_contds); + __Pyx_XDECREF(__pyx_v_pcorr); + __Pyx_XDECREF(__pyx_v_pselfcorr); + __Pyx_XDECREF(__pyx_v_pcrosscorr); + __Pyx_XDECREF((PyObject *)__pyx_v_corr); + __Pyx_XDECREF((PyObject *)__pyx_v_selfcorr); + __Pyx_XDECREF((PyObject *)__pyx_v_crosscorr); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XDECREF((PyObject *)__pyx_v_selfctr); + __Pyx_XDECREF((PyObject *)__pyx_v_crossctr); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_stride; +/* "newanalysis/helpers/correl.pyx":326 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_11sparsefullnobulkcorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_11sparsefullnobulkcorrelate = {"sparsefullnobulkcorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_11sparsefullnobulkcorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_11sparsefullnobulkcorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_pdata = 0; + int __pyx_v_pcorrdim; + PyArrayObject *__pyx_v_pds = 0; + int __pyx_v_pnshells; + PyObject *__pyx_v_maxlen = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sparsefullnobulkcorrelate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 326, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_pcorrdim,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,0}; + + /* "newanalysis/helpers/correl.pyx":331 + * np.ndarray[np.int32_t,ndim=2] pds, + * int pnshells, + * maxlen=None,): # <<<<<<<<<<<<<< + * + * cdef long corrdim = pcorrdim + */ + values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pdata)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pcorrdim)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkcorrelate", 0, 4, 5, 1); __PYX_ERR(0, 326, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkcorrelate", 0, 4, 5, 2); __PYX_ERR(0, 326, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pnshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkcorrelate", 0, 4, 5, 3); __PYX_ERR(0, 326, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sparsefullnobulkcorrelate") < 0)) __PYX_ERR(0, 326, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_pdata = ((PyArrayObject *)values[0]); + __pyx_v_pcorrdim = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_pcorrdim == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 328, __pyx_L3_error) + __pyx_v_pds = ((PyArrayObject *)values[2]); + __pyx_v_pnshells = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 330, __pyx_L3_error) + __pyx_v_maxlen = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkcorrelate", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 326, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkcorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 327, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_10sparsefullnobulkcorrelate(__pyx_self, __pyx_v_pdata, __pyx_v_pcorrdim, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen); + + /* "newanalysis/helpers/correl.pyx":326 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_6correl_10sparsefullnobulkcorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen) { + long __pyx_v_corrdim; + long __pyx_v_nmol; + long __pyx_v_n; + long __pyx_v_nds; + long __pyx_v_maxdt; + long __pyx_v_nshells; + PyArrayObject *__pyx_v_contdata = 0; + PyArrayObject *__pyx_v_contds = 0; + double *__pyx_v_cdata; + int *__pyx_v_cds; + PyObject *__pyx_v_pcorr = NULL; + PyObject *__pyx_v_pselfcorr = NULL; + PyObject *__pyx_v_pcrosscorr = NULL; + PyArrayObject *__pyx_v_corr = 0; + PyArrayObject *__pyx_v_selfcorr = 0; + PyArrayObject *__pyx_v_crosscorr = 0; + PyArrayObject *__pyx_v_ctr = 0; + PyArrayObject *__pyx_v_selfctr = 0; + PyArrayObject *__pyx_v_crossctr = 0; + double *__pyx_v_ccorr; + double *__pyx_v_cselfcorr; + double *__pyx_v_ccrosscorr; + double *__pyx_v_cctr; + double *__pyx_v_cselfctr; + double *__pyx_v_ccrossctr; + double __pyx_v_value; + long __pyx_v_i; + long __pyx_v_start; + long __pyx_v_dt; + long __pyx_v_mol; + long __pyx_v_shellstart; + long __pyx_v_shelldt; + long __pyx_v_idx; + long __pyx_v_dim; + long __pyx_v_validx; + long __pyx_v_dsidx; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; + __Pyx_Buffer __pyx_pybuffer_contdata; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; + __Pyx_Buffer __pyx_pybuffer_contds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; + __Pyx_Buffer __pyx_pybuffer_corr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_crosscorr; + __Pyx_Buffer __pyx_pybuffer_crosscorr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_crossctr; + __Pyx_Buffer __pyx_pybuffer_crossctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; + __Pyx_Buffer __pyx_pybuffer_pdata; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; + __Pyx_Buffer __pyx_pybuffer_pds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_selfcorr; + __Pyx_Buffer __pyx_pybuffer_selfcorr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_selfctr; + __Pyx_Buffer __pyx_pybuffer_selfctr; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; + Py_ssize_t __pyx_t_1; + long __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyArrayObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + PyArrayObject *__pyx_t_14 = NULL; + PyArrayObject *__pyx_t_15 = NULL; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + long __pyx_t_20; + long __pyx_t_21; + long __pyx_t_22; + long __pyx_t_23; + long __pyx_t_24; + long __pyx_t_25; + long __pyx_t_26; + long __pyx_t_27; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("sparsefullnobulkcorrelate", 0); + __pyx_pybuffer_contdata.pybuffer.buf = NULL; + __pyx_pybuffer_contdata.refcount = 0; + __pyx_pybuffernd_contdata.data = NULL; + __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; + __pyx_pybuffer_contds.pybuffer.buf = NULL; + __pyx_pybuffer_contds.refcount = 0; + __pyx_pybuffernd_contds.data = NULL; + __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; + __pyx_pybuffer_corr.pybuffer.buf = NULL; + __pyx_pybuffer_corr.refcount = 0; + __pyx_pybuffernd_corr.data = NULL; + __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; + __pyx_pybuffer_selfcorr.pybuffer.buf = NULL; + __pyx_pybuffer_selfcorr.refcount = 0; + __pyx_pybuffernd_selfcorr.data = NULL; + __pyx_pybuffernd_selfcorr.rcbuffer = &__pyx_pybuffer_selfcorr; + __pyx_pybuffer_crosscorr.pybuffer.buf = NULL; + __pyx_pybuffer_crosscorr.refcount = 0; + __pyx_pybuffernd_crosscorr.data = NULL; + __pyx_pybuffernd_crosscorr.rcbuffer = &__pyx_pybuffer_crosscorr; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_selfctr.pybuffer.buf = NULL; + __pyx_pybuffer_selfctr.refcount = 0; + __pyx_pybuffernd_selfctr.data = NULL; + __pyx_pybuffernd_selfctr.rcbuffer = &__pyx_pybuffer_selfctr; + __pyx_pybuffer_crossctr.pybuffer.buf = NULL; + __pyx_pybuffer_crossctr.refcount = 0; + __pyx_pybuffernd_crossctr.data = NULL; + __pyx_pybuffernd_crossctr.rcbuffer = &__pyx_pybuffer_crossctr; + __pyx_pybuffer_pdata.pybuffer.buf = NULL; + __pyx_pybuffer_pdata.refcount = 0; + __pyx_pybuffernd_pdata.data = NULL; + __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; + __pyx_pybuffer_pds.pybuffer.buf = NULL; + __pyx_pybuffer_pds.refcount = 0; + __pyx_pybuffernd_pds.data = NULL; + __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 326, __pyx_L1_error) + } + __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 326, __pyx_L1_error) + } + __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":333 + * maxlen=None,): * - * raise ValueError("Buffer view does not expose strides") + * cdef long corrdim = pcorrdim # <<<<<<<<<<<<<< + * cdef long nmol = len(pdata)//pcorrdim # number of molecules + * cdef long n = len(pdata[0]) # number of time steps + */ + __pyx_v_corrdim = ((long)__pyx_v_pcorrdim); + + /* "newanalysis/helpers/correl.pyx":334 + * + * cdef long corrdim = pcorrdim + * cdef long nmol = len(pdata)//pcorrdim # number of molecules # <<<<<<<<<<<<<< + * cdef long n = len(pdata[0]) # number of time steps + * cdef long nds = len(pds[0]) # number of steps in delaunay array + */ + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_t_2 = ((long)__pyx_t_1); + if (unlikely(__pyx_v_pcorrdim == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 334, __pyx_L1_error) + } + else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_pcorrdim == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 334, __pyx_L1_error) + } + __pyx_v_nmol = __Pyx_div_long(__pyx_t_2, __pyx_v_pcorrdim); + + /* "newanalysis/helpers/correl.pyx":335 + * cdef long corrdim = pcorrdim + * cdef long nmol = len(pdata)//pcorrdim # number of molecules + * cdef long n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< + * cdef long nds = len(pds[0]) # number of steps in delaunay array + * cdef long maxdt = n + */ + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 335, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_n = ((long)__pyx_t_1); + + /* "newanalysis/helpers/correl.pyx":336 + * cdef long nmol = len(pdata)//pcorrdim # number of molecules + * cdef long n = len(pdata[0]) # number of time steps + * cdef long nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< + * cdef long maxdt = n + * cdef long nshells = pnshells + */ + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_nds = ((long)__pyx_t_1); + + /* "newanalysis/helpers/correl.pyx":337 + * cdef long n = len(pdata[0]) # number of time steps + * cdef long nds = len(pds[0]) # number of steps in delaunay array + * cdef long maxdt = n # <<<<<<<<<<<<<< + * cdef long nshells = pnshells + * if maxlen != None: + */ + __pyx_v_maxdt = ((long)__pyx_v_n); + + /* "newanalysis/helpers/correl.pyx":338 + * cdef long nds = len(pds[0]) # number of steps in delaunay array + * cdef long maxdt = n + * cdef long nshells = pnshells # <<<<<<<<<<<<<< + * if maxlen != None: + * maxdt = maxlen + */ + __pyx_v_nshells = ((long)__pyx_v_pnshells); + + /* "newanalysis/helpers/correl.pyx":339 + * cdef long maxdt = n + * cdef long nshells = pnshells + * if maxlen != None: # <<<<<<<<<<<<<< + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "newanalysis/helpers/correl.pyx":340 + * cdef long nshells = pnshells + * if maxlen != None: + * maxdt = maxlen # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + */ + __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_v_maxlen); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 340, __pyx_L1_error) + __pyx_v_maxdt = __pyx_t_2; + + /* "newanalysis/helpers/correl.pyx":339 + * cdef long maxdt = n + * cdef long nshells = pnshells + * if maxlen != None: # <<<<<<<<<<<<<< + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + */ + } + + /* "newanalysis/helpers/correl.pyx":341 + * if maxlen != None: + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_pdata)}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 341, __pyx_L1_error) + } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_8 = 0; + __pyx_v_contdata = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "newanalysis/helpers/correl.pyx":342 + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, ((PyObject *)__pyx_v_pds)}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 342, __pyx_L1_error) + __pyx_t_9 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 342, __pyx_L1_error) + } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_9 = 0; + __pyx_v_contds = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "newanalysis/helpers/correl.pyx":343 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contdata)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_v_cdata = ((double *)__pyx_t_10); + + /* "newanalysis/helpers/correl.pyx":344 + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data # <<<<<<<<<<<<<< + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contds)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 344, __pyx_L1_error) + __pyx_v_cds = ((int *)__pyx_t_10); + + /* "newanalysis/helpers/correl.pyx":345 + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_6)) __PYX_ERR(0, 345, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11)) __PYX_ERR(0, 345, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, __pyx_t_12) < 0) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_v_pcorr = __pyx_t_12; + __pyx_t_12 = 0; + + /* "newanalysis/helpers/correl.pyx":346 + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + */ + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_zeros); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12)) __PYX_ERR(0, 346, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error); + __pyx_t_12 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_pselfcorr = __pyx_t_3; + __pyx_t_3 = 0; + + /* "newanalysis/helpers/correl.pyx":347 + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_6)) __PYX_ERR(0, 347, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11)) __PYX_ERR(0, 347, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, __pyx_t_12) < 0) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 347, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_v_pcrosscorr = __pyx_t_12; + __pyx_t_12 = 0; + + /* "newanalysis/helpers/correl.pyx":348 + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + */ + if (!(likely(((__pyx_v_pcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 348, __pyx_L1_error) + __pyx_t_12 = __pyx_v_pcorr; + __Pyx_INCREF(__pyx_t_12); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_12), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 348, __pyx_L1_error) + } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_corr = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; + + /* "newanalysis/helpers/correl.pyx":349 + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + if (!(likely(((__pyx_v_pselfcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pselfcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 349, __pyx_L1_error) + __pyx_t_12 = __pyx_v_pselfcorr; + __Pyx_INCREF(__pyx_t_12); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_12), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_selfcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 349, __pyx_L1_error) + } else {__pyx_pybuffernd_selfcorr.diminfo[0].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfcorr.diminfo[0].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfcorr.diminfo[1].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfcorr.diminfo[1].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_selfcorr = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; + + /* "newanalysis/helpers/correl.pyx":350 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + if (!(likely(((__pyx_v_pcrosscorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcrosscorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 350, __pyx_L1_error) + __pyx_t_12 = __pyx_v_pcrosscorr; + __Pyx_INCREF(__pyx_t_12); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_12), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_crosscorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 350, __pyx_L1_error) + } else {__pyx_pybuffernd_crosscorr.diminfo[0].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crosscorr.diminfo[0].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crosscorr.diminfo[1].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crosscorr.diminfo[1].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_crosscorr = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; + + /* "newanalysis/helpers/correl.pyx":351 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + */ + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_zeros); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12)) __PYX_ERR(0, 351, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 351, __pyx_L1_error); + __pyx_t_12 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 351, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 351, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_13 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "newanalysis/helpers/correl.pyx":352 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_6)) __PYX_ERR(0, 352, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11)) __PYX_ERR(0, 352, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, __pyx_t_12) < 0) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 352, __pyx_L1_error) + __pyx_t_14 = ((PyArrayObject *)__pyx_t_12); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_selfctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 352, __pyx_L1_error) + } else {__pyx_pybuffernd_selfctr.diminfo[0].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfctr.diminfo[0].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfctr.diminfo[1].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfctr.diminfo[1].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_14 = 0; + __pyx_v_selfctr = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; + + /* "newanalysis/helpers/correl.pyx":353 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data + */ + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_zeros); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12)) __PYX_ERR(0, 353, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 353, __pyx_L1_error); + __pyx_t_12 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5)) __PYX_ERR(0, 353, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_15 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_crossctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 353, __pyx_L1_error) + } else {__pyx_pybuffernd_crossctr.diminfo[0].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crossctr.diminfo[0].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crossctr.diminfo[1].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crossctr.diminfo[1].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_15 = 0; + __pyx_v_crossctr = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "newanalysis/helpers/correl.pyx":354 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data */ - __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_corr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_v_ccorr = ((double *)__pyx_t_10); - /* "View.MemoryView":572 - * if self.view.strides == NULL: - * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + /* "newanalysis/helpers/correl.pyx":355 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data # <<<<<<<<<<<<<< + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_selfcorr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_v_cselfcorr = ((double *)__pyx_t_10); - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< - * - * raise ValueError("Buffer view does not expose strides") + /* "newanalysis/helpers/correl.pyx":356 + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data # <<<<<<<<<<<<<< + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data */ - } + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_crosscorr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_v_ccrosscorr = ((double *)__pyx_t_10); - /* "View.MemoryView":574 - * raise ValueError("Buffer view does not expose strides") - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/correl.pyx":357 + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< + * cdef double *cselfctr = selfctr.data + * cdef double *ccrossctr = crossctr.data */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_v_stride = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 357, __pyx_L1_error) + __pyx_v_cctr = ((double *)__pyx_t_10); - /* "View.MemoryView":569 - * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: - * + /* "newanalysis/helpers/correl.pyx":358 + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data # <<<<<<<<<<<<<< + * cdef double *ccrossctr = crossctr.data + * cdef double value */ + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_selfctr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 358, __pyx_L1_error) + __pyx_v_cselfctr = ((double *)__pyx_t_10); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":359 + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data + * cdef double *ccrossctr = crossctr.data # <<<<<<<<<<<<<< + * cdef double value + * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx + */ + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_crossctr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L1_error) + __pyx_v_ccrossctr = ((double *)__pyx_t_10); -/* "View.MemoryView":577 + /* "newanalysis/helpers/correl.pyx":363 + * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_2 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_17 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_17 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_4) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dim) lastprivate(__pyx_v_dsidx) firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_validx) lastprivate(__pyx_v_value) + #endif /* _OPENMP */ + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_17; __pyx_t_16++){ + { + __pyx_v_dt = (long)(0 + 1 * __pyx_t_16); + /* Initialize private variables to invalid values */ + __pyx_v_dim = ((long)0xbad0bad0); + __pyx_v_dsidx = ((long)0xbad0bad0); + __pyx_v_idx = ((long)0xbad0bad0); + __pyx_v_mol = ((long)0xbad0bad0); + __pyx_v_shelldt = ((long)0xbad0bad0); + __pyx_v_shellstart = ((long)0xbad0bad0); + __pyx_v_start = ((long)0xbad0bad0); + __pyx_v_validx = ((long)0xbad0bad0); + __pyx_v_value = ((double)__PYX_NAN()); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - Py_ssize_t *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim + /* "newanalysis/helpers/correl.pyx":364 * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for start in range(n-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * dsidx = mol*nds+start */ - __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); - if (__pyx_t_1) { + __pyx_t_18 = (__pyx_v_n - __pyx_v_dt); + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { + __pyx_v_start = __pyx_t_20; - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + /* "newanalysis/helpers/correl.pyx":365 + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__14, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_21 = __pyx_v_nmol; + __pyx_t_22 = __pyx_t_21; + for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) { + __pyx_v_mol = __pyx_t_23; - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim - * + /* "newanalysis/helpers/correl.pyx":366 + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * dsidx = mol*nds+start # <<<<<<<<<<<<<< + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: */ - } + __pyx_v_dsidx = ((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start); - /* "View.MemoryView":581 - * return (-1,) * self.view.ndim - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/correl.pyx":367 + * for mol in range(nmol): # loop over molecules/entries + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 # <<<<<<<<<<<<<< + * if shellstart < nshells: + * shelldt = cds[dsidx+dt]-1 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); - for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) { - __pyx_t_4 = __pyx_t_6; - __pyx_v_suboffset = (__pyx_t_4[0]); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_v_shellstart = (((long)(__pyx_v_cds[__pyx_v_dsidx])) - 1); - /* "View.MemoryView":577 - * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + /* "newanalysis/helpers/correl.pyx":368 + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): */ + __pyx_t_4 = (__pyx_v_shellstart < __pyx_v_nshells); + if (__pyx_t_4) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":369 + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: + * shelldt = cds[dsidx+dt]-1 # <<<<<<<<<<<<<< + * for dim in range(corrdim): + * validx = mol*corrdim*n+dim*n+start + */ + __pyx_v_shelldt = (((long)(__pyx_v_cds[(__pyx_v_dsidx + __pyx_v_dt)])) - 1); -/* "View.MemoryView":584 - * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim - * + /* "newanalysis/helpers/correl.pyx":370 + * if shellstart < nshells: + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): # <<<<<<<<<<<<<< + * validx = mol*corrdim*n+dim*n+start + * value = cdata[validx]*cdata[validx+dt] */ + __pyx_t_24 = __pyx_v_corrdim; + __pyx_t_25 = __pyx_t_24; + for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) { + __pyx_v_dim = __pyx_t_26; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "newanalysis/helpers/correl.pyx":371 + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): + * validx = mol*corrdim*n+dim*n+start # <<<<<<<<<<<<<< + * value = cdata[validx]*cdata[validx+dt] + * idx = maxdt*shellstart+dt + */ + __pyx_v_validx = ((((__pyx_v_mol * __pyx_v_corrdim) * __pyx_v_n) + (__pyx_v_dim * __pyx_v_n)) + __pyx_v_start); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":372 + * for dim in range(corrdim): + * validx = mol*corrdim*n+dim*n+start + * value = cdata[validx]*cdata[validx+dt] # <<<<<<<<<<<<<< + * idx = maxdt*shellstart+dt + * ccorr[idx] += value + */ + __pyx_v_value = ((__pyx_v_cdata[__pyx_v_validx]) * (__pyx_v_cdata[(__pyx_v_validx + __pyx_v_dt)])); -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/helpers/correl.pyx":373 + * validx = mol*corrdim*n+dim*n+start + * value = cdata[validx]*cdata[validx+dt] + * idx = maxdt*shellstart+dt # <<<<<<<<<<<<<< + * ccorr[idx] += value + * cctr[idx] += 1 + */ + __pyx_v_idx = ((__pyx_v_maxdt * __pyx_v_shellstart) + __pyx_v_dt); - /* "View.MemoryView":585 - * @property - * def ndim(self): - * return self.view.ndim # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/correl.pyx":374 + * value = cdata[validx]*cdata[validx+dt] + * idx = maxdt*shellstart+dt + * ccorr[idx] += value # <<<<<<<<<<<<<< + * cctr[idx] += 1 + * if shellstart == shelldt: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 585, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_ccorr[__pyx_t_27]) = ((__pyx_v_ccorr[__pyx_t_27]) + __pyx_v_value); - /* "View.MemoryView":584 - * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim - * + /* "newanalysis/helpers/correl.pyx":375 + * idx = maxdt*shellstart+dt + * ccorr[idx] += value + * cctr[idx] += 1 # <<<<<<<<<<<<<< + * if shellstart == shelldt: + * cselfcorr[idx] += value */ + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_cctr[__pyx_t_27]) = ((__pyx_v_cctr[__pyx_t_27]) + 1.0); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":376 + * ccorr[idx] += value + * cctr[idx] += 1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * cselfcorr[idx] += value + * cselfctr[idx] += 1 + */ + __pyx_t_4 = (__pyx_v_shellstart == __pyx_v_shelldt); + if (__pyx_t_4) { -/* "View.MemoryView":588 - * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize + /* "newanalysis/helpers/correl.pyx":377 + * cctr[idx] += 1 + * if shellstart == shelldt: + * cselfcorr[idx] += value # <<<<<<<<<<<<<< + * cselfctr[idx] += 1 * */ + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_cselfcorr[__pyx_t_27]) = ((__pyx_v_cselfcorr[__pyx_t_27]) + __pyx_v_value); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":589 - * @property - * def itemsize(self): - * return self.view.itemsize # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":378 + * if shellstart == shelldt: + * cselfcorr[idx] += value + * cselfctr[idx] += 1 # <<<<<<<<<<<<<< * - * @property + * for i in range(maxdt*nshells): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_cselfctr[__pyx_t_27]) = ((__pyx_v_cselfctr[__pyx_t_27]) + 1.0); - /* "View.MemoryView":588 - * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize - * + /* "newanalysis/helpers/correl.pyx":376 + * ccorr[idx] += value + * cctr[idx] += 1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * cselfcorr[idx] += value + * cselfctr[idx] += 1 */ + } + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":368 + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): + */ + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } -/* "View.MemoryView":592 - * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize + /* "newanalysis/helpers/correl.pyx":363 + * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":593 - * @property - * def nbytes(self): - * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":380 + * cselfctr[idx] += 1 * - * @property + * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_17 = (__pyx_v_maxdt * __pyx_v_nshells); + __pyx_t_16 = __pyx_t_17; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_16; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":592 - * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize + /* "newanalysis/helpers/correl.pyx":381 * + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: */ + __pyx_t_4 = ((__pyx_v_cctr[__pyx_v_i]) != 0.0); + if (__pyx_t_4) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":382 + * for i in range(maxdt*nshells): + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< + * else: + * print('tot too sparse') + */ + __pyx_t_18 = __pyx_v_i; + if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 382, __pyx_L1_error) + } + (__pyx_v_ccorr[__pyx_t_18]) = ((__pyx_v_ccorr[__pyx_t_18]) / (__pyx_v_cctr[__pyx_v_i])); -/* "View.MemoryView":596 + /* "newanalysis/helpers/correl.pyx":381 * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: */ + goto __pyx_L23; + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":384 + * ccorr[i] /= cctr[i] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * cselfcorr[i] /= cselfctr[i] + */ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L23:; -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/helpers/correl.pyx":385 + * else: + * print('tot too sparse') + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * cselfcorr[i] /= cselfctr[i] + * else: + */ + __pyx_t_4 = ((__pyx_v_cctr[__pyx_v_i]) != 0.0); + if (__pyx_t_4) { - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 - * + /* "newanalysis/helpers/correl.pyx":386 + * print('tot too sparse') + * if cctr[i] != 0: + * cselfcorr[i] /= cselfctr[i] # <<<<<<<<<<<<<< + * else: + * print('self too sparse') */ - __pyx_t_1 = (__pyx_v_self->_size == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_18 = __pyx_v_i; + if (unlikely((__pyx_v_cselfctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 386, __pyx_L1_error) + } + (__pyx_v_cselfcorr[__pyx_t_18]) = ((__pyx_v_cselfcorr[__pyx_t_18]) / (__pyx_v_cselfctr[__pyx_v_i])); - /* "View.MemoryView":598 - * def size(self): - * if self._size is None: - * result = 1 # <<<<<<<<<<<<<< - * - * for length in self.view.shape[:self.view.ndim]: + /* "newanalysis/helpers/correl.pyx":385 + * else: + * print('tot too sparse') + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * cselfcorr[i] /= cselfctr[i] + * else: */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_result = __pyx_int_1; + goto __pyx_L24; + } - /* "View.MemoryView":600 - * result = 1 - * - * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< - * result *= length + /* "newanalysis/helpers/correl.pyx":388 + * cselfcorr[i] /= cselfctr[i] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< * + * for i in range(maxdt*nshells): */ - __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6); - __pyx_t_6 = 0; + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L24:; + } - /* "View.MemoryView":601 + /* "newanalysis/helpers/correl.pyx":390 + * print('self too sparse') * - * for length in self.view.shape[:self.view.ndim]: - * result *= length # <<<<<<<<<<<<<< - * - * self._size = result + * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] + * ccrossctr[i] = cctr[i] - cselfctr[i] */ - __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 601, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6); - __pyx_t_6 = 0; - } + __pyx_t_17 = (__pyx_v_maxdt * __pyx_v_nshells); + __pyx_t_16 = __pyx_t_17; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_16; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":603 - * result *= length + /* "newanalysis/helpers/correl.pyx":391 * - * self._size = result # <<<<<<<<<<<<<< + * for i in range(maxdt*nshells): + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] # <<<<<<<<<<<<<< + * ccrossctr[i] = cctr[i] - cselfctr[i] * - * return self._size */ - __Pyx_INCREF(__pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - __Pyx_GOTREF(__pyx_v_self->_size); - __Pyx_DECREF(__pyx_v_self->_size); - __pyx_v_self->_size = __pyx_v_result; + (__pyx_v_ccrosscorr[__pyx_v_i]) = ((__pyx_v_ccorr[__pyx_v_i]) - (__pyx_v_cselfcorr[__pyx_v_i])); - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 + /* "newanalysis/helpers/correl.pyx":392 + * for i in range(maxdt*nshells): + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] + * ccrossctr[i] = cctr[i] - cselfctr[i] # <<<<<<<<<<<<<< * + * return corr,selfcorr,crosscorr */ + (__pyx_v_ccrossctr[__pyx_v_i]) = ((__pyx_v_cctr[__pyx_v_i]) - (__pyx_v_cselfctr[__pyx_v_i])); } - /* "View.MemoryView":605 - * self._size = result + /* "newanalysis/helpers/correl.pyx":394 + * ccrossctr[i] = cctr[i] - cselfctr[i] * - * return self._size # <<<<<<<<<<<<<< + * return corr,selfcorr,crosscorr # <<<<<<<<<<<<<< * - * def __len__(self): + * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_size); - __pyx_r = __pyx_v_self->_size; + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF((PyObject *)__pyx_v_corr); + __Pyx_GIVEREF((PyObject *)__pyx_v_corr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_corr))) __PYX_ERR(0, 394, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_selfcorr); + __Pyx_GIVEREF((PyObject *)__pyx_v_selfcorr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_selfcorr))) __PYX_ERR(0, 394, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_crosscorr); + __Pyx_GIVEREF((PyObject *)__pyx_v_crosscorr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_crosscorr))) __PYX_ERR(0, 394, __pyx_L1_error); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "View.MemoryView":596 + /* "newanalysis/helpers/correl.pyx":326 * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkcorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_contdata); + __Pyx_XDECREF((PyObject *)__pyx_v_contds); + __Pyx_XDECREF(__pyx_v_pcorr); + __Pyx_XDECREF(__pyx_v_pselfcorr); + __Pyx_XDECREF(__pyx_v_pcrosscorr); + __Pyx_XDECREF((PyObject *)__pyx_v_corr); + __Pyx_XDECREF((PyObject *)__pyx_v_selfcorr); + __Pyx_XDECREF((PyObject *)__pyx_v_crosscorr); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XDECREF((PyObject *)__pyx_v_selfctr); + __Pyx_XDECREF((PyObject *)__pyx_v_crossctr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":607 - * return self._size +/* "newanalysis/helpers/correl.pyx":396 + * return corr,selfcorr,crosscorr * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ /* Python wrapper */ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_pw_11newanalysis_6correl_13rotationMatrixShellCorrelateDist(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_13rotationMatrixShellCorrelateDist = {"rotationMatrixShellCorrelateDist", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_13rotationMatrixShellCorrelateDist, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_13rotationMatrixShellCorrelateDist(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_nshells; + long __pyx_v_maxdt; + long __pyx_v_startingpoints; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateDist (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 396, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds,&__pyx_n_s_nshells,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rotTs)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 396, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 396, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateDist", 1, 5, 5, 1); __PYX_ERR(0, 396, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 396, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateDist", 1, 5, 5, 2); __PYX_ERR(0, 396, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxdt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 396, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateDist", 1, 5, 5, 3); __PYX_ERR(0, 396, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_startingpoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 396, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateDist", 1, 5, 5, 4); __PYX_ERR(0, 396, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rotationMatrixShellCorrelateDist") < 0)) __PYX_ERR(0, 396, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 5)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + } + __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 397, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 397, __pyx_L3_error) + __pyx_v_nshells = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_nshells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 397, __pyx_L3_error) + __pyx_v_maxdt = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 397, __pyx_L3_error) + __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 397, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateDist", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 396, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateDist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_6correl_12rotationMatrixShellCorrelateDist(__pyx_self, __pyx_v_rotTs, __pyx_v_ds, __pyx_v_nshells, __pyx_v_maxdt, __pyx_v_startingpoints); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_pf_11newanalysis_6correl_12rotationMatrixShellCorrelateDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints) { + long __pyx_v_nmol; + long __pyx_v_n; + long __pyx_v_startskip; + __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_t1; + double __pyx_v_t2; + double __pyx_v_t3; + double __pyx_v_t4; + double __pyx_v_t5; + double __pyx_v_t6; + long __pyx_v_i; + long __pyx_v_j; + long __pyx_v_k; + long __pyx_v_start; + long __pyx_v_point; + long __pyx_v_dt; + long __pyx_v_mol; + long __pyx_v_shellstart; + long __pyx_v_l; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__len__", 0); + Py_ssize_t __pyx_t_1; + __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + int __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; + Py_ssize_t __pyx_t_35; + Py_ssize_t __pyx_t_36; + Py_ssize_t __pyx_t_37; + Py_ssize_t __pyx_t_38; + Py_ssize_t __pyx_t_39; + Py_ssize_t __pyx_t_40; + Py_ssize_t __pyx_t_41; + Py_ssize_t __pyx_t_42; + Py_ssize_t __pyx_t_43; + Py_ssize_t __pyx_t_44; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateDist", 0); - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] - * + /* "newanalysis/helpers/correl.pyx":398 + * @cython.boundscheck(False) + * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< + * cdef long n = len(rotTs[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array */ - __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); + __pyx_v_nmol = ((long)__pyx_t_1); - /* "View.MemoryView":609 - * def __len__(self): - * if self.view.ndim >= 1: - * return self.view.shape[0] # <<<<<<<<<<<<<< - * - * return 0 + /* "newanalysis/helpers/correl.pyx":399 + * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules + * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints */ - __pyx_r = (__pyx_v_self->view.shape[0]); - goto __pyx_L0; + __pyx_t_2.data = __pyx_v_rotTs.data; + __pyx_t_2.memview = __pyx_v_rotTs.memview; + __PYX_INC_MEMVIEW(&__pyx_t_2, 1); + { + Py_ssize_t __pyx_tmp_idx = 0; + Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] - * - */ - } +__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; +__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; + __pyx_t_2.suboffsets[0] = -1; - /* "View.MemoryView":611 - * return self.view.shape[0] - * - * return 0 # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __pyx_r = 0; - goto __pyx_L0; +__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; +__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; + __pyx_t_2.suboffsets[1] = -1; - /* "View.MemoryView":607 - * return self._size - * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] - */ +__pyx_t_2.shape[2] = __pyx_v_rotTs.shape[3]; +__pyx_t_2.strides[2] = __pyx_v_rotTs.strides[3]; + __pyx_t_2.suboffsets[2] = -1; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} +__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL; + __pyx_v_n = ((long)__pyx_t_1); -/* "View.MemoryView":613 - * return 0 - * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) + /* "newanalysis/helpers/correl.pyx":401 + * cdef long n = len(rotTs[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints # <<<<<<<<<<<<<< + * cdef double [:,:,:,:] corr = np.zeros((6,nshells,maxdt,20)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) */ + __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); + if (unlikely(__pyx_v_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 401, __pyx_L1_error) + } + else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 401, __pyx_L1_error) + } + __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); -/* Python wrapper */ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":402 + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:,:] corr = np.zeros((6,nshells,maxdt,20)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) + * cdef double t1,t2,t3,t4,t5,t6 + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_6); + __Pyx_GIVEREF(__pyx_int_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_6)) __PYX_ERR(0, 402, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5)) __PYX_ERR(0, 402, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(0, 402, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_20); + __Pyx_GIVEREF(__pyx_int_20); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_int_20)) __PYX_ERR(0, 402, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_corr = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__repr__", 0); + /* "newanalysis/helpers/correl.pyx":403 + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:,:] corr = np.zeros((6,nshells,maxdt,20)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # <<<<<<<<<<<<<< + * cdef double t1,t2,t3,t4,t5,t6 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 403, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 403, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 403, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 403, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 403, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 403, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 403, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 403, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 403, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_ctr = __pyx_t_11; + __pyx_t_11.memview = NULL; + __pyx_t_11.data = NULL; - /* "View.MemoryView":614 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) + /* "newanalysis/helpers/correl.pyx":407 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt * + * for dt in prange(maxdt,nogil=True, schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_3 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_13 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_13 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33, __pyx_t_34, __pyx_t_35, __pyx_t_36, __pyx_t_37, __pyx_t_38, __pyx_t_39, __pyx_t_40, __pyx_t_41, __pyx_t_42, __pyx_t_43, __pyx_t_44) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_t1) lastprivate(__pyx_v_t2) lastprivate(__pyx_v_t3) lastprivate(__pyx_v_t4) lastprivate(__pyx_v_t5) lastprivate(__pyx_v_t6) + #endif /* _OPENMP */ + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){ + { + __pyx_v_dt = (long)(0 + 1 * __pyx_t_12); + /* Initialize private variables to invalid values */ + __pyx_v_mol = ((long)0xbad0bad0); + __pyx_v_point = ((long)0xbad0bad0); + __pyx_v_shellstart = ((long)0xbad0bad0); + __pyx_v_start = ((long)0xbad0bad0); + __pyx_v_t1 = ((double)__PYX_NAN()); + __pyx_v_t2 = ((double)__PYX_NAN()); + __pyx_v_t3 = ((double)__PYX_NAN()); + __pyx_v_t4 = ((double)__PYX_NAN()); + __pyx_v_t5 = ((double)__PYX_NAN()); + __pyx_v_t6 = ((double)__PYX_NAN()); - /* "View.MemoryView":615 - * def __repr__(self): - * return "" % (self.base.__class__.__name__, - * id(self)) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":408 * - * def __str__(self): + * for dt in prange(maxdt,nogil=True, schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_14 = __pyx_v_startingpoints; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_point = __pyx_t_16; - /* "View.MemoryView":614 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) - * + /* "newanalysis/helpers/correl.pyx":409 + * for dt in prange(maxdt,nogil=True, schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * start = point*startskip + * shellstart = ds[mol,start]-1 */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_17 = __pyx_v_nmol; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_mol = __pyx_t_19; - /* "View.MemoryView":613 - * return 0 - * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) + /* "newanalysis/helpers/correl.pyx":410 + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip # <<<<<<<<<<<<<< + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: */ + __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":617 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + /* "newanalysis/helpers/correl.pyx":411 + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip + * shellstart = ds[mol,start]-1 # <<<<<<<<<<<<<< + * if shellstart < nshells: * */ + __pyx_t_20 = __pyx_v_mol; + __pyx_t_21 = __pyx_v_start; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ds.shape[1]; + __pyx_v_shellstart = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_20 * __pyx_v_ds.strides[0]) ) + __pyx_t_21 * __pyx_v_ds.strides[1]) ))) - 1); -/* Python wrapper */ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "View.MemoryView":618 - * - * def __str__(self): - * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":412 + * start = point*startskip + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< * + * ctr[shellstart,dt] += 1 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_22 = (__pyx_v_shellstart < __pyx_v_nshells); + if (__pyx_t_22) { - /* "View.MemoryView":617 - * id(self)) + /* "newanalysis/helpers/correl.pyx":414 + * if shellstart < nshells: * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + * ctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< * + * t1 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,0,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,0,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,0,2])+1.0)*9.99999999999 */ + __pyx_t_21 = __pyx_v_shellstart; + __pyx_t_20 = __pyx_v_dt; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ctr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_21 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) )) += 1.0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":621 - * + /* "newanalysis/helpers/correl.pyx":416 + * ctr[shellstart,dt] += 1 * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + * t1 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,0,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,0,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,0,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< + * t2 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 + * t3 = ((rotTs[mol,start,2,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,2,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,2,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 */ + __pyx_t_20 = __pyx_v_mol; + __pyx_t_21 = __pyx_v_start; + __pyx_t_23 = 0; + __pyx_t_24 = 0; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[3]; + __pyx_t_25 = __pyx_v_mol; + __pyx_t_26 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_27 = 0; + __pyx_t_28 = 0; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[3]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_31 = 0; + __pyx_t_32 = 1; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; + __pyx_t_33 = __pyx_v_mol; + __pyx_t_34 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_35 = 0; + __pyx_t_36 = 1; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; + __pyx_t_37 = __pyx_v_mol; + __pyx_t_38 = __pyx_v_start; + __pyx_t_39 = 0; + __pyx_t_40 = 2; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[3]; + __pyx_t_41 = __pyx_v_mol; + __pyx_t_42 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_43 = 0; + __pyx_t_44 = 2; + if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_rotTs.shape[3]; + __pyx_v_t1 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_20 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_24 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_25 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_29 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_37 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_40 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_41 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_43 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_44 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_c_contig", 0); - - /* "View.MemoryView":624 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "newanalysis/helpers/correl.pyx":417 * + * t1 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,0,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,0,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,0,2])+1.0)*9.99999999999 + * t2 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< + * t3 = ((rotTs[mol,start,2,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,2,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,2,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + * t4 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 624, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __pyx_t_44 = __pyx_v_mol; + __pyx_t_43 = __pyx_v_start; + __pyx_t_42 = 1; + __pyx_t_41 = 0; + if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[3]; + __pyx_t_40 = __pyx_v_mol; + __pyx_t_39 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_38 = 1; + __pyx_t_37 = 0; + if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[3]; + __pyx_t_36 = __pyx_v_mol; + __pyx_t_35 = __pyx_v_start; + __pyx_t_34 = 1; + __pyx_t_33 = 1; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; + __pyx_t_32 = __pyx_v_mol; + __pyx_t_31 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_30 = 1; + __pyx_t_29 = 1; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[3]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_27 = __pyx_v_start; + __pyx_t_26 = 1; + __pyx_t_25 = 2; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[3]; + __pyx_t_24 = __pyx_v_mol; + __pyx_t_23 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_21 = 1; + __pyx_t_20 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[3]; + __pyx_v_t2 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_44 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_43 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_41 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_40 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_28 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_27 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_25 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_24 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); - /* "View.MemoryView":625 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< - * - * def is_f_contig(self): + /* "newanalysis/helpers/correl.pyx":418 + * t1 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,0,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,0,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,0,2])+1.0)*9.99999999999 + * t2 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 + * t3 = ((rotTs[mol,start,2,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,2,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,2,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< + * t4 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 + * t5 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_20 = __pyx_v_mol; + __pyx_t_21 = __pyx_v_start; + __pyx_t_23 = 2; + __pyx_t_24 = 0; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[3]; + __pyx_t_25 = __pyx_v_mol; + __pyx_t_26 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_27 = 2; + __pyx_t_28 = 0; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[3]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_31 = 2; + __pyx_t_32 = 1; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; + __pyx_t_33 = __pyx_v_mol; + __pyx_t_34 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_35 = 2; + __pyx_t_36 = 1; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; + __pyx_t_37 = __pyx_v_mol; + __pyx_t_38 = __pyx_v_start; + __pyx_t_39 = 2; + __pyx_t_40 = 2; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[3]; + __pyx_t_41 = __pyx_v_mol; + __pyx_t_42 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_43 = 2; + __pyx_t_44 = 2; + if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_rotTs.shape[3]; + __pyx_v_t3 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_20 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_24 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_25 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_29 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_37 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_40 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_41 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_43 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_44 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); - /* "View.MemoryView":621 - * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/correl.pyx":419 + * t2 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 + * t3 = ((rotTs[mol,start,2,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,2,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,2,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + * t4 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< + * t5 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + * t6 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 */ + __pyx_t_44 = __pyx_v_mol; + __pyx_t_43 = __pyx_v_start; + __pyx_t_42 = 0; + __pyx_t_41 = 0; + if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[3]; + __pyx_t_40 = __pyx_v_mol; + __pyx_t_39 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_38 = 1; + __pyx_t_37 = 0; + if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[3]; + __pyx_t_36 = __pyx_v_mol; + __pyx_t_35 = __pyx_v_start; + __pyx_t_34 = 0; + __pyx_t_33 = 1; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; + __pyx_t_32 = __pyx_v_mol; + __pyx_t_31 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_30 = 1; + __pyx_t_29 = 1; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[3]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_27 = __pyx_v_start; + __pyx_t_26 = 0; + __pyx_t_25 = 2; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[3]; + __pyx_t_24 = __pyx_v_mol; + __pyx_t_23 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_21 = 1; + __pyx_t_20 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[3]; + __pyx_v_t4 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_44 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_43 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_41 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_40 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_28 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_27 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_25 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_24 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) - * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/correl.pyx":420 + * t3 = ((rotTs[mol,start,2,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,2,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,2,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + * t4 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 + * t5 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< + * t6 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + * corr[0,shellstart,dt, t1] += 1.0 # l=1 */ + __pyx_t_20 = __pyx_v_mol; + __pyx_t_21 = __pyx_v_start; + __pyx_t_23 = 0; + __pyx_t_24 = 0; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[3]; + __pyx_t_25 = __pyx_v_mol; + __pyx_t_26 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_27 = 2; + __pyx_t_28 = 0; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[3]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_31 = 0; + __pyx_t_32 = 1; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; + __pyx_t_33 = __pyx_v_mol; + __pyx_t_34 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_35 = 2; + __pyx_t_36 = 1; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; + __pyx_t_37 = __pyx_v_mol; + __pyx_t_38 = __pyx_v_start; + __pyx_t_39 = 0; + __pyx_t_40 = 2; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[3]; + __pyx_t_41 = __pyx_v_mol; + __pyx_t_42 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_43 = 2; + __pyx_t_44 = 2; + if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_rotTs.shape[3]; + __pyx_v_t5 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_20 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_24 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_25 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_29 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_37 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_40 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_41 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_43 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_44 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_f_contig", 0); - - /* "View.MemoryView":630 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'F', self.view.ndim) - * + /* "newanalysis/helpers/correl.pyx":421 + * t4 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,1,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,1,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,1,2])+1.0)*9.99999999999 + * t5 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + * t6 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 # <<<<<<<<<<<<<< + * corr[0,shellstart,dt, t1] += 1.0 # l=1 + * corr[1,shellstart,dt, t2] += 1.0 */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 630, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __pyx_t_44 = __pyx_v_mol; + __pyx_t_43 = __pyx_v_start; + __pyx_t_42 = 1; + __pyx_t_41 = 0; + if (__pyx_t_44 < 0) __pyx_t_44 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_43 < 0) __pyx_t_43 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_42 < 0) __pyx_t_42 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_41 < 0) __pyx_t_41 += __pyx_v_rotTs.shape[3]; + __pyx_t_40 = __pyx_v_mol; + __pyx_t_39 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_38 = 2; + __pyx_t_37 = 0; + if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[3]; + __pyx_t_36 = __pyx_v_mol; + __pyx_t_35 = __pyx_v_start; + __pyx_t_34 = 1; + __pyx_t_33 = 1; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; + __pyx_t_32 = __pyx_v_mol; + __pyx_t_31 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_30 = 2; + __pyx_t_29 = 1; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[3]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_27 = __pyx_v_start; + __pyx_t_26 = 1; + __pyx_t_25 = 2; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[3]; + __pyx_t_24 = __pyx_v_mol; + __pyx_t_23 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_21 = 2; + __pyx_t_20 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[3]; + __pyx_v_t6 = ((((((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_44 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_43 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_42 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_41 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_40 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[3]) )))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[3]) ))))) + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_28 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_27 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_25 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_24 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[3]) ))))) + 1.0) * 9.99999999999); - /* "View.MemoryView":631 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< - * - * def copy(self): + /* "newanalysis/helpers/correl.pyx":422 + * t5 = ((rotTs[mol,start,0,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,0,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,0,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + * t6 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + * corr[0,shellstart,dt, t1] += 1.0 # l=1 # <<<<<<<<<<<<<< + * corr[1,shellstart,dt, t2] += 1.0 + * corr[2,shellstart,dt, t3] += 1.0 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) - * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + __pyx_t_20 = 0; + __pyx_t_21 = __pyx_v_shellstart; + __pyx_t_23 = __pyx_v_dt; + __pyx_t_24 = ((int)__pyx_v_t1); + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_20 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) ) + __pyx_t_23 * __pyx_v_corr.strides[2]) ) + __pyx_t_24 * __pyx_v_corr.strides[3]) )) += 1.0; + + /* "newanalysis/helpers/correl.pyx":423 + * t6 = ((rotTs[mol,start,1,0]*rotTs[mol,start+dt,2,0]+rotTs[mol,start,1,1]*rotTs[mol,start+dt,2,1]+rotTs[mol,start,1,2]*rotTs[mol,start+dt,2,2])+1.0)*9.99999999999 + * corr[0,shellstart,dt, t1] += 1.0 # l=1 + * corr[1,shellstart,dt, t2] += 1.0 # <<<<<<<<<<<<<< + * corr[2,shellstart,dt, t3] += 1.0 + * corr[3,shellstart,dt, t4] += 1.0 */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) - * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + __pyx_t_24 = 1; + __pyx_t_23 = __pyx_v_shellstart; + __pyx_t_21 = __pyx_v_dt; + __pyx_t_20 = ((int)__pyx_v_t2); + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_24 * __pyx_v_corr.strides[0]) ) + __pyx_t_23 * __pyx_v_corr.strides[1]) ) + __pyx_t_21 * __pyx_v_corr.strides[2]) ) + __pyx_t_20 * __pyx_v_corr.strides[3]) )) += 1.0; + + /* "newanalysis/helpers/correl.pyx":424 + * corr[0,shellstart,dt, t1] += 1.0 # l=1 + * corr[1,shellstart,dt, t2] += 1.0 + * corr[2,shellstart,dt, t3] += 1.0 # <<<<<<<<<<<<<< + * corr[3,shellstart,dt, t4] += 1.0 + * corr[4,shellstart,dt, t5] += 1.0 */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_mslice; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy", 0); - - /* "View.MemoryView":635 - * def copy(self): - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + __pyx_t_20 = 2; + __pyx_t_21 = __pyx_v_shellstart; + __pyx_t_23 = __pyx_v_dt; + __pyx_t_24 = ((int)__pyx_v_t3); + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_20 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) ) + __pyx_t_23 * __pyx_v_corr.strides[2]) ) + __pyx_t_24 * __pyx_v_corr.strides[3]) )) += 1.0; + + /* "newanalysis/helpers/correl.pyx":425 + * corr[1,shellstart,dt, t2] += 1.0 + * corr[2,shellstart,dt, t3] += 1.0 + * corr[3,shellstart,dt, t4] += 1.0 # <<<<<<<<<<<<<< + * corr[4,shellstart,dt, t5] += 1.0 + * corr[5,shellstart,dt, t6] += 1.0 + */ + __pyx_t_24 = 3; + __pyx_t_23 = __pyx_v_shellstart; + __pyx_t_21 = __pyx_v_dt; + __pyx_t_20 = ((int)__pyx_v_t4); + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_24 * __pyx_v_corr.strides[0]) ) + __pyx_t_23 * __pyx_v_corr.strides[1]) ) + __pyx_t_21 * __pyx_v_corr.strides[2]) ) + __pyx_t_20 * __pyx_v_corr.strides[3]) )) += 1.0; + + /* "newanalysis/helpers/correl.pyx":426 + * corr[2,shellstart,dt, t3] += 1.0 + * corr[3,shellstart,dt, t4] += 1.0 + * corr[4,shellstart,dt, t5] += 1.0 # <<<<<<<<<<<<<< + * corr[5,shellstart,dt, t6] += 1.0 * - * slice_copy(self, &mslice) */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + __pyx_t_20 = 4; + __pyx_t_21 = __pyx_v_shellstart; + __pyx_t_23 = __pyx_v_dt; + __pyx_t_24 = ((int)__pyx_v_t5); + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_20 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) ) + __pyx_t_23 * __pyx_v_corr.strides[2]) ) + __pyx_t_24 * __pyx_v_corr.strides[3]) )) += 1.0; - /* "View.MemoryView":637 - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + /* "newanalysis/helpers/correl.pyx":427 + * corr[3,shellstart,dt, t4] += 1.0 + * corr[4,shellstart,dt, t5] += 1.0 + * corr[5,shellstart,dt, t6] += 1.0 # <<<<<<<<<<<<<< * - * slice_copy(self, &mslice) # <<<<<<<<<<<<<< - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, - * self.view.itemsize, + * for i in range(nshells): */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - - /* "View.MemoryView":638 + __pyx_t_24 = 5; + __pyx_t_23 = __pyx_v_shellstart; + __pyx_t_21 = __pyx_v_dt; + __pyx_t_20 = ((int)__pyx_v_t6); + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_24 * __pyx_v_corr.strides[0]) ) + __pyx_t_23 * __pyx_v_corr.strides[1]) ) + __pyx_t_21 * __pyx_v_corr.strides[2]) ) + __pyx_t_20 * __pyx_v_corr.strides[3]) )) += 1.0; + + /* "newanalysis/helpers/correl.pyx":412 + * start = point*startskip + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< * - * slice_copy(self, &mslice) - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_C_CONTIGUOUS, + * ctr[shellstart,dt] += 1 */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 638, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":643 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":407 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt * - * def copy_fortran(self): + * for dt in prange(maxdt,nogil=True, schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } - /* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "newanalysis/helpers/correl.pyx":429 + * corr[5,shellstart,dt, t6] += 1.0 * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * for i in range(nshells): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * if ctr[i,j] != 0: */ + __pyx_t_13 = __pyx_v_nshells; + __pyx_t_12 = __pyx_t_13; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_12; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) + /* "newanalysis/helpers/correl.pyx":430 * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * for i in range(nshells): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * if ctr[i,j] != 0: + * for k in range(6): */ + __pyx_t_14 = __pyx_v_maxdt; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_j = __pyx_t_16; -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":431 + * for i in range(nshells): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(6): + * for l in range(20): + */ + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ctr.shape[1]; + __pyx_t_22 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_21 * __pyx_v_ctr.strides[1]) ))) != 0.0); + if (__pyx_t_22) { -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy_fortran", 0); + /* "newanalysis/helpers/correl.pyx":432 + * for j in range(maxdt): + * if ctr[i,j] != 0: + * for k in range(6): # <<<<<<<<<<<<<< + * for l in range(20): + * corr[k,i,j,l] /= ctr[i,j] + */ + for (__pyx_t_17 = 0; __pyx_t_17 < 6; __pyx_t_17+=1) { + __pyx_v_k = __pyx_t_17; - /* "View.MemoryView":647 - * def copy_fortran(self): - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":433 + * if ctr[i,j] != 0: + * for k in range(6): + * for l in range(20): # <<<<<<<<<<<<<< + * corr[k,i,j,l] /= ctr[i,j] * - * slice_copy(self, &src) */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + for (__pyx_t_18 = 0; __pyx_t_18 < 20; __pyx_t_18+=1) { + __pyx_v_l = __pyx_t_18; - /* "View.MemoryView":649 - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + /* "newanalysis/helpers/correl.pyx":434 + * for k in range(6): + * for l in range(20): + * corr[k,i,j,l] /= ctr[i,j] # <<<<<<<<<<<<<< + * * - * slice_copy(self, &src) # <<<<<<<<<<<<<< - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, - * self.view.itemsize, */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + __pyx_t_21 = __pyx_v_i; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ctr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; + __pyx_t_23 = __pyx_v_k; + __pyx_t_24 = __pyx_v_i; + __pyx_t_25 = __pyx_v_j; + __pyx_t_26 = __pyx_v_l; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[1]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_corr.shape[2]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_24 * __pyx_v_corr.strides[1]) ) + __pyx_t_25 * __pyx_v_corr.strides[2]) ) + __pyx_t_26 * __pyx_v_corr.strides[3]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_21 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ))); + } + } - /* "View.MemoryView":650 - * - * slice_copy(self, &src) - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_F_CONTIGUOUS, + /* "newanalysis/helpers/correl.pyx":431 + * for i in range(nshells): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(6): + * for l in range(20): */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 650, __pyx_L1_error) - __pyx_v_dst = __pyx_t_1; + } + } + } - /* "View.MemoryView":655 - * self.dtype_is_object) + /* "newanalysis/helpers/correl.pyx":437 * - * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * + * return corr # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 4, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) + /* "newanalysis/helpers/correl.pyx":396 + * return corr,selfcorr,crosscorr * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_11, 1); + __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateDist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ctr, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): +/* "newanalysis/helpers/correl.pyx":441 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; +static PyObject *__pyx_pw_11newanalysis_6correl_15rotationMatrixShellCorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_15rotationMatrixShellCorrelate = {"rotationMatrixShellCorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_15rotationMatrixShellCorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_15rotationMatrixShellCorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_nshells; + long __pyx_v_maxdt; + long __pyx_v_startingpoints; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":659 - * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - */ - -static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { - struct __pyx_memoryview_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - - /* "View.MemoryView":660 - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< - * result.typeinfo = typeinfo - * return result - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_o); - __Pyx_GIVEREF(__pyx_v_o); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":661 - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_v_result->typeinfo = __pyx_v_typeinfo; - - /* "View.MemoryView":662 - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - * return result # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_check') - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - /* "View.MemoryView":659 - * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannySetupContext("rotationMatrixShellCorrelate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 441, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds,&__pyx_n_s_nshells,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rotTs)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelate", 1, 5, 5, 1); __PYX_ERR(0, 441, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelate", 1, 5, 5, 2); __PYX_ERR(0, 441, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxdt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelate", 1, 5, 5, 3); __PYX_ERR(0, 441, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_startingpoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelate", 1, 5, 5, 4); __PYX_ERR(0, 441, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rotationMatrixShellCorrelate") < 0)) __PYX_ERR(0, 441, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 5)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + } + __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 442, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 442, __pyx_L3_error) + __pyx_v_nshells = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_nshells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L3_error) + __pyx_v_maxdt = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L3_error) + __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelate", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 441, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) - * - */ - -static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("memoryview_check", 0); - - /* "View.MemoryView":666 - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): - * return isinstance(o, memoryview) # <<<<<<<<<<<<<< - * - * cdef tuple _unellipsify(object index, int ndim): - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); - __pyx_r = __pyx_t_1; - goto __pyx_L0; - - /* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) - * - */ + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_6correl_14rotationMatrixShellCorrelate(__pyx_self, __pyx_v_rotTs, __pyx_v_ds, __pyx_v_nshells, __pyx_v_maxdt, __pyx_v_startingpoints); /* function exit code */ - __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":668 - * return isinstance(o, memoryview) - * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with - */ - -static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { - PyObject *__pyx_v_tup = NULL; - PyObject *__pyx_v_result = NULL; - int __pyx_v_have_slices; - int __pyx_v_seen_ellipsis; - CYTHON_UNUSED PyObject *__pyx_v_idx = NULL; - PyObject *__pyx_v_item = NULL; - Py_ssize_t __pyx_v_nslices; +static PyObject *__pyx_pf_11newanalysis_6correl_14rotationMatrixShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints) { + long __pyx_v_nmol; + long __pyx_v_n; + long __pyx_v_startskip; + __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_selfcorr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_crosscorr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_selfctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_crossctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_t1; + double __pyx_v_t2; + double __pyx_v_t3; + double __pyx_v_t4; + double __pyx_v_t5; + double __pyx_v_t6; + long __pyx_v_i; + long __pyx_v_j; + long __pyx_v_k; + long __pyx_v_start; + long __pyx_v_point; + long __pyx_v_dt; + long __pyx_v_mol; + long __pyx_v_shellstart; + long __pyx_v_shelldt; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_1; + __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_3; PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_11; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + int __pyx_t_21; + double __pyx_t_22; + double __pyx_t_23; + double __pyx_t_24; + double __pyx_t_25; + double __pyx_t_26; + double __pyx_t_27; + long __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; + Py_ssize_t __pyx_t_35; + PyObject *__pyx_t_36 = NULL; + PyObject *__pyx_t_37 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_unellipsify", 0); + __Pyx_RefNannySetupContext("rotationMatrixShellCorrelate", 0); - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: + /* "newanalysis/helpers/correl.pyx":443 + * @cython.boundscheck(False) + * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< + * cdef long n = len(rotTs[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array */ - __pyx_t_1 = PyTuple_Check(__pyx_v_index); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); + __pyx_v_nmol = ((long)__pyx_t_1); - /* "View.MemoryView":674 - * """ - * if not isinstance(index, tuple): - * tup = (index,) # <<<<<<<<<<<<<< - * else: - * tup = index + /* "newanalysis/helpers/correl.pyx":444 + * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules + * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 674, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); - __pyx_v_tup = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2.data = __pyx_v_rotTs.data; + __pyx_t_2.memview = __pyx_v_rotTs.memview; + __PYX_INC_MEMVIEW(&__pyx_t_2, 1); + { + Py_ssize_t __pyx_tmp_idx = 0; + Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: - */ - goto __pyx_L3; - } +__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; +__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; + __pyx_t_2.suboffsets[0] = -1; - /* "View.MemoryView":676 - * tup = (index,) - * else: - * tup = index # <<<<<<<<<<<<<< - * - * result = [] - */ - /*else*/ { - __Pyx_INCREF(__pyx_v_index); - __pyx_v_tup = __pyx_v_index; - } - __pyx_L3:; +__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; +__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; + __pyx_t_2.suboffsets[1] = -1; - /* "View.MemoryView":678 - * tup = index - * - * result = [] # <<<<<<<<<<<<<< - * have_slices = False - * seen_ellipsis = False - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 678, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_result = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; +__pyx_t_2.shape[2] = __pyx_v_rotTs.shape[3]; +__pyx_t_2.strides[2] = __pyx_v_rotTs.strides[3]; + __pyx_t_2.suboffsets[2] = -1; - /* "View.MemoryView":679 - * - * result = [] - * have_slices = False # <<<<<<<<<<<<<< - * seen_ellipsis = False - * for idx, item in enumerate(tup): - */ - __pyx_v_have_slices = 0; +__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL; + __pyx_v_n = ((long)__pyx_t_1); - /* "View.MemoryView":680 - * result = [] - * have_slices = False - * seen_ellipsis = False # <<<<<<<<<<<<<< - * for idx, item in enumerate(tup): - * if item is Ellipsis: + /* "newanalysis/helpers/correl.pyx":446 + * cdef long n = len(rotTs[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints # <<<<<<<<<<<<<< + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) */ - __pyx_v_seen_ellipsis = 0; + __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); + if (unlikely(__pyx_v_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 446, __pyx_L1_error) + } + else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 446, __pyx_L1_error) + } + __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: + /* "newanalysis/helpers/correl.pyx":447 + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< + * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_3 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) { - __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 681, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_12)) __PYX_ERR(0, 447, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5)) __PYX_ERR(0, 447, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(0, 447, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 681, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } - } else { - __pyx_t_7 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_7)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 681, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_7; - __pyx_t_7 = 0; - - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - */ - __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True - */ - __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: - */ - __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__17); - __Pyx_GIVEREF(__pyx_slice__17); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__17); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "View.MemoryView":685 - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True # <<<<<<<<<<<<<< - * else: - * result.append(slice(None)) - */ - __pyx_v_seen_ellipsis = 1; - - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True - */ - goto __pyx_L7; - } - - /* "View.MemoryView":687 - * seen_ellipsis = True - * else: - * result.append(slice(None)) # <<<<<<<<<<<<<< - * have_slices = True - * else: - */ - /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__17); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 687, __pyx_L1_error) - } - __pyx_L7:; + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_corr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; - /* "View.MemoryView":688 - * else: - * result.append(slice(None)) - * have_slices = True # <<<<<<<<<<<<<< - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): + /* "newanalysis/helpers/correl.pyx":448 + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries */ - __pyx_v_have_slices = 1; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_12)) __PYX_ERR(0, 448, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 448, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7)) __PYX_ERR(0, 448, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 448, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_selfcorr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) + /* "newanalysis/helpers/correl.pyx":449 + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) */ - goto __pyx_L6; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_12)) __PYX_ERR(0, 449, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7)) __PYX_ERR(0, 449, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_9 = 1; } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_crosscorr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) - * + /* "newanalysis/helpers/correl.pyx":450 + * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< + * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) + * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) */ - /*else*/ { - __pyx_t_2 = PySlice_Check(__pyx_v_item); - __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0); - __pyx_t_1 = __pyx_t_10; - __pyx_L9_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 450, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 450, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 450, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 450, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 450, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5)) __PYX_ERR(0, 450, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7)) __PYX_ERR(0, 450, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 450, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 450, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_ctr = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; - /* "View.MemoryView":691 - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): - * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<< - * - * have_slices = have_slices or isinstance(item, slice) + /* "newanalysis/helpers/correl.pyx":451 + * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) + * cdef double t1,t2,t3,t4,t5,t6 */ - __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(2, 691, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 451, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 451, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_selfctr = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) - * + /* "newanalysis/helpers/correl.pyx":452 + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) + * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) # <<<<<<<<<<<<<< + * cdef double t1,t2,t3,t4,t5,t6 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt */ - } + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8)) __PYX_ERR(0, 452, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7)) __PYX_ERR(0, 452, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_crossctr = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; - /* "View.MemoryView":693 - * raise TypeError("Cannot index with type '%s'" % type(item)) - * - * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< - * result.append(item) + /* "newanalysis/helpers/correl.pyx":456 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_t_10 = (__pyx_v_have_slices != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = PySlice_Check(__pyx_v_item); - __pyx_t_2 = (__pyx_t_10 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L11_bool_binop_done:; - __pyx_v_have_slices = __pyx_t_1; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_3 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_12 > 0) + { + #ifdef _OPENMP + #pragma omp parallel reduction(+:__pyx_v_t1) reduction(+:__pyx_v_t2) reduction(+:__pyx_v_t3) reduction(+:__pyx_v_t4) reduction(+:__pyx_v_t5) reduction(+:__pyx_v_t6) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33, __pyx_t_34) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) + #endif /* _OPENMP */ + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){ + { + __pyx_v_dt = (long)(0 + 1 * __pyx_t_11); + /* Initialize private variables to invalid values */ + __pyx_v_k = ((long)0xbad0bad0); + __pyx_v_mol = ((long)0xbad0bad0); + __pyx_v_point = ((long)0xbad0bad0); + __pyx_v_shelldt = ((long)0xbad0bad0); + __pyx_v_shellstart = ((long)0xbad0bad0); + __pyx_v_start = ((long)0xbad0bad0); - /* "View.MemoryView":694 - * - * have_slices = have_slices or isinstance(item, slice) - * result.append(item) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":457 * - * nslices = ndim - len(result) + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 694, __pyx_L1_error) - } - __pyx_L6:; + __pyx_t_13 = __pyx_v_startingpoints; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_point = __pyx_t_15; - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: + /* "newanalysis/helpers/correl.pyx":458 + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * start = point*startskip + * shellstart = ds[mol,start]-1 */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_16 = __pyx_v_nmol; + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_mol = __pyx_t_18; - /* "View.MemoryView":696 - * result.append(item) - * - * nslices = ndim - len(result) # <<<<<<<<<<<<<< - * if nslices: - * result.extend([slice(None)] * nslices) + /* "newanalysis/helpers/correl.pyx":459 + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip # <<<<<<<<<<<<<< + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: */ - __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 696, __pyx_L1_error) - __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); + __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); - /* "View.MemoryView":697 - * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) - * + /* "newanalysis/helpers/correl.pyx":460 + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip + * shellstart = ds[mol,start]-1 # <<<<<<<<<<<<<< + * if shellstart < nshells: + * ctr[shellstart,dt] += 1 */ - __pyx_t_1 = (__pyx_v_nslices != 0); - if (__pyx_t_1) { + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds.shape[1]; + __pyx_v_shellstart = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_19 * __pyx_v_ds.strides[0]) ) + __pyx_t_20 * __pyx_v_ds.strides[1]) ))) - 1); - /* "View.MemoryView":698 - * nslices = ndim - len(result) - * if nslices: - * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":461 + * start = point*startskip + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * ctr[shellstart,dt] += 1 * - * return have_slices or nslices, tuple(result) */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__17); - __Pyx_GIVEREF(__pyx_slice__17); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__17); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_21 = (__pyx_v_shellstart < __pyx_v_nshells); + if (__pyx_t_21) { - /* "View.MemoryView":697 - * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) + /* "newanalysis/helpers/correl.pyx":462 + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: + * ctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< * + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 */ - } + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) )) += 1.0; - /* "View.MemoryView":700 - * result.extend([slice(None)] * nslices) - * - * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":464 + * ctr[shellstart,dt] += 1 * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 # <<<<<<<<<<<<<< + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] */ - __Pyx_XDECREF(__pyx_r); - if (!__pyx_v_have_slices) { - } else { - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L14_bool_binop_done; - } - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_L14_bool_binop_done:; - __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject*)__pyx_t_11); - __pyx_t_11 = 0; - goto __pyx_L0; + __pyx_t_22 = 0.0; + __pyx_t_23 = 0.0; + __pyx_t_24 = 0.0; + __pyx_t_25 = 0.0; + __pyx_t_26 = 0.0; + __pyx_t_27 = 0.0; + __pyx_v_t1 = __pyx_t_22; + __pyx_v_t2 = __pyx_t_23; + __pyx_v_t3 = __pyx_t_24; + __pyx_v_t4 = __pyx_t_25; + __pyx_v_t5 = __pyx_t_26; + __pyx_v_t6 = __pyx_t_27; - /* "View.MemoryView":668 - * return isinstance(o, memoryview) + /* "newanalysis/helpers/correl.pyx":465 * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] */ + for (__pyx_t_28 = 0; __pyx_t_28 < 3; __pyx_t_28+=1) { + __pyx_v_k = __pyx_t_28; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tup); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_XDECREF(__pyx_v_item); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) - * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: + /* "newanalysis/helpers/correl.pyx":466 + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] # <<<<<<<<<<<<<< + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] */ + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_29 = 0; + __pyx_t_30 = __pyx_v_k; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; + __pyx_t_31 = __pyx_v_mol; + __pyx_t_32 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_33 = 0; + __pyx_t_34 = __pyx_v_k; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[3]; + __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[3]) ))))); -static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - - /* "View.MemoryView":703 - * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") + /* "newanalysis/helpers/correl.pyx":467 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] */ - __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); - for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { - __pyx_t_1 = __pyx_t_3; - __pyx_v_suboffset = (__pyx_t_1[0]); + __pyx_t_34 = __pyx_v_mol; + __pyx_t_33 = __pyx_v_start; + __pyx_t_32 = 1; + __pyx_t_31 = __pyx_v_k; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; + __pyx_t_30 = __pyx_v_mol; + __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_20 = 1; + __pyx_t_19 = __pyx_v_k; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; + __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_34 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") - * + /* "newanalysis/helpers/correl.pyx":468 + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] */ - __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_29 = 2; + __pyx_t_30 = __pyx_v_k; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; + __pyx_t_31 = __pyx_v_mol; + __pyx_t_32 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_33 = 2; + __pyx_t_34 = __pyx_v_k; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[3]; + __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/correl.pyx":469 + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(2, 705, __pyx_L1_error) + __pyx_t_34 = __pyx_v_mol; + __pyx_t_33 = __pyx_v_start; + __pyx_t_32 = 0; + __pyx_t_31 = __pyx_v_k; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; + __pyx_t_30 = __pyx_v_mol; + __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_20 = 1; + __pyx_t_19 = __pyx_v_k; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; + __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_34 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") - * + /* "newanalysis/helpers/correl.pyx":470 + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart,dt] += t1 # l=1 */ - } - } + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_29 = 0; + __pyx_t_30 = __pyx_v_k; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; + __pyx_t_31 = __pyx_v_mol; + __pyx_t_32 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_33 = 2; + __pyx_t_34 = __pyx_v_k; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[3]; + __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) - * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: + /* "newanalysis/helpers/correl.pyx":471 + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * corr[0,shellstart,dt] += t1 # l=1 + * corr[1,shellstart,dt] += t2 */ + __pyx_t_34 = __pyx_v_mol; + __pyx_t_33 = __pyx_v_start; + __pyx_t_32 = 1; + __pyx_t_31 = __pyx_v_k; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; + __pyx_t_30 = __pyx_v_mol; + __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_20 = 2; + __pyx_t_19 = __pyx_v_k; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; + __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_34 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))); + } - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":712 - * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step + /* "newanalysis/helpers/correl.pyx":472 + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart,dt] += t1 # l=1 # <<<<<<<<<<<<<< + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 */ + __pyx_t_19 = 0; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += __pyx_v_t1; -static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { - int __pyx_v_new_ndim; - int __pyx_v_suboffset_dim; - int __pyx_v_dim; - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - __Pyx_memviewslice *__pyx_v_p_src; - struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; - __Pyx_memviewslice *__pyx_v_p_dst; - int *__pyx_v_p_suboffset_dim; - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - int __pyx_v_have_start; - int __pyx_v_have_stop; - int __pyx_v_have_step; - PyObject *__pyx_v_index = NULL; - struct __pyx_memoryview_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - struct __pyx_memoryview_obj *__pyx_t_4; - char *__pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memview_slice", 0); + /* "newanalysis/helpers/correl.pyx":473 + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart,dt] += t1 # l=1 + * corr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 + */ + __pyx_t_29 = 1; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t2; - /* "View.MemoryView":713 - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): - * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< - * cdef bint negative_step - * cdef __Pyx_memviewslice src, dst + /* "newanalysis/helpers/correl.pyx":474 + * corr[0,shellstart,dt] += t1 # l=1 + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 */ - __pyx_v_new_ndim = 0; - __pyx_v_suboffset_dim = -1; + __pyx_t_19 = 2; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += __pyx_v_t3; - /* "View.MemoryView":720 - * - * - * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< - * - * cdef _memoryviewslice memviewsliceobj + /* "newanalysis/helpers/correl.pyx":475 + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 */ - (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + __pyx_t_29 = 3; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t4; - /* "View.MemoryView":724 - * cdef _memoryviewslice memviewsliceobj - * - * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< - * - * if isinstance(memview, _memoryviewslice): + /* "newanalysis/helpers/correl.pyx":476 + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { - PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(2, 724, __pyx_L1_error) - } - } - #endif + __pyx_t_19 = 4; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += __pyx_v_t5; - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice + /* "newanalysis/helpers/correl.pyx":477 + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_29 = 5; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t6; - /* "View.MemoryView":727 - * - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview # <<<<<<<<<<<<<< - * p_src = &memviewsliceobj.from_slice - * else: + /* "newanalysis/helpers/correl.pyx":478 + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 # <<<<<<<<<<<<<< + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 727, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_19 = 6; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - /* "View.MemoryView":728 - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, &src) + /* "newanalysis/helpers/correl.pyx":479 + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 */ - __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + __pyx_t_29 = 7; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice + /* "newanalysis/helpers/correl.pyx":480 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 */ - goto __pyx_L3; - } + __pyx_t_19 = 8; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); - /* "View.MemoryView":730 - * p_src = &memviewsliceobj.from_slice - * else: - * slice_copy(memview, &src) # <<<<<<<<<<<<<< - * p_src = &src - * + /* "newanalysis/helpers/correl.pyx":481 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + __pyx_t_29 = 9; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); - /* "View.MemoryView":731 - * else: - * slice_copy(memview, &src) - * p_src = &src # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":482 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 * */ - __pyx_v_p_src = (&__pyx_v_src); - } - __pyx_L3:; + __pyx_t_19 = 10; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); - /* "View.MemoryView":737 - * - * - * dst.memview = p_src.memview # <<<<<<<<<<<<<< - * dst.data = p_src.data + /* "newanalysis/helpers/correl.pyx":483 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< * + * shelldt = ds[mol,start+dt]-1 */ - __pyx_t_4 = __pyx_v_p_src->memview; - __pyx_v_dst.memview = __pyx_t_4; + __pyx_t_29 = 11; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); - /* "View.MemoryView":738 - * - * dst.memview = p_src.memview - * dst.data = p_src.data # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":485 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 * + * shelldt = ds[mol,start+dt]-1 # <<<<<<<<<<<<<< + * if shellstart == shelldt: + * selfctr[shellstart,dt] += 1 */ - __pyx_t_5 = __pyx_v_p_src->data; - __pyx_v_dst.data = __pyx_t_5; + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds.shape[1]; + __pyx_v_shelldt = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_19 * __pyx_v_ds.strides[0]) ) + __pyx_t_20 * __pyx_v_ds.strides[1]) ))) - 1); - /* "View.MemoryView":743 + /* "newanalysis/helpers/correl.pyx":486 * + * shelldt = ds[mol,start+dt]-1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * selfctr[shellstart,dt] += 1 * - * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< - * cdef int *p_suboffset_dim = &suboffset_dim - * cdef Py_ssize_t start, stop, step */ - __pyx_v_p_dst = (&__pyx_v_dst); + __pyx_t_21 = (__pyx_v_shellstart == __pyx_v_shelldt); + if (__pyx_t_21) { - /* "View.MemoryView":744 + /* "newanalysis/helpers/correl.pyx":487 + * shelldt = ds[mol,start+dt]-1 + * if shellstart == shelldt: + * selfctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< * - * cdef __Pyx_memviewslice *p_dst = &dst - * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< - * cdef Py_ssize_t start, stop, step - * cdef bint have_start, have_stop, have_step + * selfcorr[0,shellstart,dt] += t1 */ - __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_20 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfctr.strides[1]) )) += 1.0; - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step + /* "newanalysis/helpers/correl.pyx":489 + * selfctr[shellstart,dt] += 1 * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( + * selfcorr[0,shellstart,dt] += t1 # <<<<<<<<<<<<<< + * selfcorr[1,shellstart,dt] += t2 + * selfcorr[2,shellstart,dt] += t3 */ - __pyx_t_6 = 0; - if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 748, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } - } else { - __pyx_t_9 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_9)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 748, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_9); - } - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_v_dim = __pyx_t_6; - __pyx_t_6 = (__pyx_t_6 + 1); + __pyx_t_19 = 0; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_29 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t1; - /* "View.MemoryView":749 + /* "newanalysis/helpers/correl.pyx":490 * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * selfcorr[0,shellstart,dt] += t1 + * selfcorr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< + * selfcorr[2,shellstart,dt] += t3 + * selfcorr[3,shellstart,dt] += t4 */ - __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0); - if (__pyx_t_2) { + __pyx_t_29 = 1; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_29 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t2; - /* "View.MemoryView":753 - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<< - * 0, 0, 0, # have_{start,stop,step} - * False) + /* "newanalysis/helpers/correl.pyx":491 + * selfcorr[0,shellstart,dt] += t1 + * selfcorr[1,shellstart,dt] += t2 + * selfcorr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< + * selfcorr[3,shellstart,dt] += t4 + * selfcorr[4,shellstart,dt] += t5 + */ + __pyx_t_19 = 2; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_29 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t3; + + /* "newanalysis/helpers/correl.pyx":492 + * selfcorr[1,shellstart,dt] += t2 + * selfcorr[2,shellstart,dt] += t3 + * selfcorr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< + * selfcorr[4,shellstart,dt] += t5 + * selfcorr[5,shellstart,dt] += t6 */ - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 753, __pyx_L1_error) + __pyx_t_29 = 3; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_29 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t4; - /* "View.MemoryView":750 - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + /* "newanalysis/helpers/correl.pyx":493 + * selfcorr[2,shellstart,dt] += t3 + * selfcorr[3,shellstart,dt] += t4 + * selfcorr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< + * selfcorr[5,shellstart,dt] += t6 + * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 750, __pyx_L1_error) + __pyx_t_19 = 4; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_29 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t5; - /* "View.MemoryView":749 - * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + /* "newanalysis/helpers/correl.pyx":494 + * selfcorr[3,shellstart,dt] += t4 + * selfcorr[4,shellstart,dt] += t5 + * selfcorr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< + * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 + * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 */ - goto __pyx_L6; - } + __pyx_t_29 = 5; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_29 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t6; - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 + /* "newanalysis/helpers/correl.pyx":495 + * selfcorr[4,shellstart,dt] += t5 + * selfcorr[5,shellstart,dt] += t6 + * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 # <<<<<<<<<<<<<< + * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 */ - __pyx_t_2 = (__pyx_v_index == Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_t_19 = 6; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_29 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - /* "View.MemoryView":757 - * False) - * elif index is None: - * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 + /* "newanalysis/helpers/correl.pyx":496 + * selfcorr[5,shellstart,dt] += t6 + * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 + * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< + * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 */ - (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + __pyx_t_29 = 7; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_29 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); - /* "View.MemoryView":758 - * elif index is None: - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 + /* "newanalysis/helpers/correl.pyx":497 + * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 + * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< + * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 */ - (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + __pyx_t_19 = 8; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_29 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); - /* "View.MemoryView":759 - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< - * new_ndim += 1 - * else: + /* "newanalysis/helpers/correl.pyx":498 + * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< + * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 */ - (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + __pyx_t_29 = 9; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_29 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); - /* "View.MemoryView":760 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 # <<<<<<<<<<<<<< - * else: - * start = index.start or 0 + /* "newanalysis/helpers/correl.pyx":499 + * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< + * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 + * */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + __pyx_t_19 = 10; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_29 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 + /* "newanalysis/helpers/correl.pyx":500 + * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< + * + * for i in range(nshells): */ - goto __pyx_L6; - } + __pyx_t_29 = 11; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_29 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); - /* "View.MemoryView":762 - * new_ndim += 1 - * else: - * start = index.start or 0 # <<<<<<<<<<<<<< - * stop = index.stop or 0 - * step = index.step or 0 + /* "newanalysis/helpers/correl.pyx":486 + * + * shelldt = ds[mol,start+dt]-1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * selfctr[shellstart,dt] += 1 + * */ - /*else*/ { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L7_bool_binop_done:; - __pyx_v_start = __pyx_t_10; + } - /* "View.MemoryView":763 - * else: - * start = index.start or 0 - * stop = index.stop or 0 # <<<<<<<<<<<<<< - * step = index.step or 0 + /* "newanalysis/helpers/correl.pyx":461 + * start = point*startskip + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * ctr[shellstart,dt] += 1 * */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 763, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 763, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 763, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L9_bool_binop_done; + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif } - __pyx_t_10 = 0; - __pyx_L9_bool_binop_done:; - __pyx_v_stop = __pyx_t_10; - /* "View.MemoryView":764 - * start = index.start or 0 - * stop = index.stop or 0 - * step = index.step or 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":456 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt * - * have_start = index.start is not None + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 764, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 764, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L11_bool_binop_done; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; } - __pyx_t_10 = 0; - __pyx_L11_bool_binop_done:; - __pyx_v_step = __pyx_t_10; + } - /* "View.MemoryView":766 - * step = index.step or 0 + /* "newanalysis/helpers/correl.pyx":502 + * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 * - * have_start = index.start is not None # <<<<<<<<<<<<<< - * have_stop = index.stop is not None - * have_step = index.step is not None + * for i in range(nshells): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * if ctr[i,j] != 0: */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_start = __pyx_t_1; + __pyx_t_12 = __pyx_v_nshells; + __pyx_t_11 = __pyx_t_12; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":767 - * - * have_start = index.start is not None - * have_stop = index.stop is not None # <<<<<<<<<<<<<< - * have_step = index.step is not None + /* "newanalysis/helpers/correl.pyx":503 * + * for i in range(nshells): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * if ctr[i,j] != 0: + * for k in range(12): */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 767, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_stop = __pyx_t_1; + __pyx_t_13 = __pyx_v_maxdt; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; - /* "View.MemoryView":768 - * have_start = index.start is not None - * have_stop = index.stop is not None - * have_step = index.step is not None # <<<<<<<<<<<<<< - * - * slice_memviewslice( + /* "newanalysis/helpers/correl.pyx":504 + * for i in range(nshells): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_step = __pyx_t_1; + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; + __pyx_t_21 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ))) != 0.0); + if (__pyx_t_21) { - /* "View.MemoryView":770 - * have_step = index.step is not None - * - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + /* "newanalysis/helpers/correl.pyx":505 + * for j in range(maxdt): + * if ctr[i,j] != 0: + * for k in range(12): # <<<<<<<<<<<<<< + * corr[k,i,j] /= ctr[i,j] + * else: */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 770, __pyx_L1_error) + for (__pyx_t_16 = 0; __pyx_t_16 < 12; __pyx_t_16+=1) { + __pyx_v_k = __pyx_t_16; - /* "View.MemoryView":776 - * have_start, have_stop, have_step, - * True) - * new_ndim += 1 # <<<<<<<<<<<<<< - * - * if isinstance(memview, _memoryviewslice): + /* "newanalysis/helpers/correl.pyx":506 + * if ctr[i,j] != 0: + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] # <<<<<<<<<<<<<< + * else: + * print('tot too sparse') + */ + __pyx_t_20 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; + __pyx_t_29 = __pyx_v_k; + __pyx_t_30 = __pyx_v_i; + __pyx_t_31 = __pyx_v_j; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_corr.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_30 * __pyx_v_corr.strides[1]) ) + __pyx_t_31 * __pyx_v_corr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) ))); + } + + /* "newanalysis/helpers/correl.pyx":504 + * for i in range(nshells): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - } - __pyx_L6:; + goto __pyx_L24; + } - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step - * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( + /* "newanalysis/helpers/correl.pyx":508 + * corr[k,i,j] /= ctr[i,j] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if selfctr[i,j] != 0: + * for k in range(12): */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L24:; - /* "View.MemoryView":778 - * new_ndim += 1 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, + /* "newanalysis/helpers/correl.pyx":509 + * else: + * print('tot too sparse') + * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * selfcorr[k,i,j] /= selfctr[i,j] */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[1]; + __pyx_t_21 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_19 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfctr.strides[1]) ))) != 0.0); + if (__pyx_t_21) { - /* "View.MemoryView":779 - * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, + /* "newanalysis/helpers/correl.pyx":510 + * print('tot too sparse') + * if selfctr[i,j] != 0: + * for k in range(12): # <<<<<<<<<<<<<< + * selfcorr[k,i,j] /= selfctr[i,j] + * else: */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); + for (__pyx_t_16 = 0; __pyx_t_16 < 12; __pyx_t_16+=1) { + __pyx_v_k = __pyx_t_16; - /* "View.MemoryView":780 - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< - * memviewsliceobj.to_dtype_func, - * memview.dtype_is_object) + /* "newanalysis/helpers/correl.pyx":511 + * if selfctr[i,j] != 0: + * for k in range(12): + * selfcorr[k,i,j] /= selfctr[i,j] # <<<<<<<<<<<<<< + * else: + * print('self too sparse') + */ + __pyx_t_20 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[1]; + __pyx_t_31 = __pyx_v_k; + __pyx_t_30 = __pyx_v_i; + __pyx_t_29 = __pyx_v_j; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_31 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_30 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_29 * __pyx_v_selfcorr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_20 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfctr.strides[1]) ))); + } + + /* "newanalysis/helpers/correl.pyx":509 + * else: + * print('tot too sparse') + * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * selfcorr[k,i,j] /= selfctr[i,j] */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 780, __pyx_L1_error) } + goto __pyx_L27; + } - /* "View.MemoryView":781 - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * else: + /* "newanalysis/helpers/correl.pyx":513 + * selfcorr[k,i,j] /= selfctr[i,j] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< + * for i in range(nshells): + * for j in range(maxdt): */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 781, __pyx_L1_error) } + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L27:; + } + } - /* "View.MemoryView":779 + /* "newanalysis/helpers/correl.pyx":514 + * else: + * print('self too sparse') + * for i in range(nshells): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] + */ + __pyx_t_12 = __pyx_v_nshells; + __pyx_t_11 = __pyx_t_12; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "newanalysis/helpers/correl.pyx":515 + * print('self too sparse') + * for i in range(nshells): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] + * for k in range(12): + */ + __pyx_t_13 = __pyx_v_maxdt; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; + + /* "newanalysis/helpers/correl.pyx":516 + * for i in range(nshells): + * for j in range(maxdt): + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] # <<<<<<<<<<<<<< + * for k in range(12): + * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] + */ + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; + __pyx_t_29 = __pyx_v_i; + __pyx_t_30 = __pyx_v_j; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_selfctr.shape[1]; + __pyx_t_31 = __pyx_v_i; + __pyx_t_32 = __pyx_v_j; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_crossctr.shape[0]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_crossctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crossctr.data + __pyx_t_31 * __pyx_v_crossctr.strides[0]) ) + __pyx_t_32 * __pyx_v_crossctr.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_29 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_30 * __pyx_v_selfctr.strides[1]) )))); + + /* "newanalysis/helpers/correl.pyx":517 + * for j in range(maxdt): + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] + * for k in range(12): # <<<<<<<<<<<<<< + * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 779, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 779, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; + for (__pyx_t_16 = 0; __pyx_t_16 < 12; __pyx_t_16+=1) { + __pyx_v_k = __pyx_t_16; - /* "View.MemoryView":778 - * new_ndim += 1 + /* "newanalysis/helpers/correl.pyx":518 + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] + * for k in range(12): + * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr */ + __pyx_t_30 = __pyx_v_k; + __pyx_t_29 = __pyx_v_i; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_corr.shape[0]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; + __pyx_t_19 = __pyx_v_k; + __pyx_t_32 = __pyx_v_i; + __pyx_t_31 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[2]; + __pyx_t_33 = __pyx_v_k; + __pyx_t_34 = __pyx_v_i; + __pyx_t_35 = __pyx_v_j; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_crosscorr.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_crosscorr.shape[1]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_crosscorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crosscorr.data + __pyx_t_33 * __pyx_v_crosscorr.strides[0]) ) + __pyx_t_34 * __pyx_v_crosscorr.strides[1]) ) + __pyx_t_35 * __pyx_v_crosscorr.strides[2]) )) = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_30 * __pyx_v_corr.strides[0]) ) + __pyx_t_29 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ))) - (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_32 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_31 * __pyx_v_selfcorr.strides[2]) )))); + } + } } - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) + /* "newanalysis/helpers/correl.pyx":520 + * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] * + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - /*else*/ { - __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_selfcorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_crosscorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_selfctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_36 = __pyx_memoryview_fromslice(__pyx_v_crossctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_36); + __pyx_t_37 = PyTuple_New(6); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_37); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_t_4)) __PYX_ERR(0, 520, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 1, __pyx_t_5)) __PYX_ERR(0, 520, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 2, __pyx_t_6)) __PYX_ERR(0, 520, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 3, __pyx_t_7)) __PYX_ERR(0, 520, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 4, __pyx_t_8)) __PYX_ERR(0, 520, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_36); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 5, __pyx_t_36)) __PYX_ERR(0, 520, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_36 = 0; + __pyx_r = __pyx_t_37; + __pyx_t_37 = 0; + goto __pyx_L0; - /* "View.MemoryView":785 - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, - * memview.dtype_is_object) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":441 * * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) + /* function exit code */ + __pyx_L1_error:; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1); + __Pyx_XDECREF(__pyx_t_36); + __Pyx_XDECREF(__pyx_t_37); + __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_selfcorr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_crosscorr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ctr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_selfctr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_crossctr, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/correl.pyx":522 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 784, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_17rotationMatrixShellCorrelateTot(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_17rotationMatrixShellCorrelateTot = {"rotationMatrixShellCorrelateTot", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_17rotationMatrixShellCorrelateTot, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_17rotationMatrixShellCorrelateTot(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_nshells; + long __pyx_v_maxdt; + long __pyx_v_startingpoints; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateTot (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 522, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds,&__pyx_n_s_nshells,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rotTs)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTot", 1, 5, 5, 1); __PYX_ERR(0, 522, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTot", 1, 5, 5, 2); __PYX_ERR(0, 522, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxdt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTot", 1, 5, 5, 3); __PYX_ERR(0, 522, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_startingpoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTot", 1, 5, 5, 4); __PYX_ERR(0, 522, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rotationMatrixShellCorrelateTot") < 0)) __PYX_ERR(0, 522, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 5)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + } + __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 523, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 523, __pyx_L3_error) + __pyx_v_nshells = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_nshells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L3_error) + __pyx_v_maxdt = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L3_error) + __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L3_error) } - - /* "View.MemoryView":712 - * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step - */ + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTot", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 522, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateTot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_6correl_16rotationMatrixShellCorrelateTot(__pyx_self, __pyx_v_rotTs, __pyx_v_ds, __pyx_v_nshells, __pyx_v_maxdt, __pyx_v_startingpoints); /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF((PyObject *)__pyx_r); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":809 - * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, - */ - -static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { - Py_ssize_t __pyx_v_new_shape; - int __pyx_v_negative_step; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; +static PyObject *__pyx_pf_11newanalysis_6correl_16rotationMatrixShellCorrelateTot(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints) { + long __pyx_v_nmol; + long __pyx_v_n; + long __pyx_v_startskip; + __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_t1; + double __pyx_v_t2; + double __pyx_v_t3; + double __pyx_v_t4; + double __pyx_v_t5; + double __pyx_v_t6; + long __pyx_v_i; + long __pyx_v_j; + long __pyx_v_k; + long __pyx_v_start; + long __pyx_v_point; + long __pyx_v_dt; + long __pyx_v_mol; + long __pyx_v_shellstart; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_11; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + int __pyx_t_21; + double __pyx_t_22; + double __pyx_t_23; + double __pyx_t_24; + double __pyx_t_25; + double __pyx_t_26; + double __pyx_t_27; + long __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateTot", 0); - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< - * - * if start < 0: + /* "newanalysis/helpers/correl.pyx":524 + * @cython.boundscheck(False) + * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< + * cdef long n = len(rotTs[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array */ - __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); + __pyx_v_nmol = ((long)__pyx_t_1); - /* "View.MemoryView":831 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: + /* "newanalysis/helpers/correl.pyx":525 + * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules + * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints */ - __pyx_t_1 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_1) { + __pyx_t_2.data = __pyx_v_rotTs.data; + __pyx_t_2.memview = __pyx_v_rotTs.memview; + __PYX_INC_MEMVIEW(&__pyx_t_2, 1); + { + Py_ssize_t __pyx_tmp_idx = 0; + Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":832 - * - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); +__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; +__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; + __pyx_t_2.suboffsets[0] = -1; - /* "View.MemoryView":831 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: - */ - } +__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; +__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; + __pyx_t_2.suboffsets[1] = -1; - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - * else: - */ - __pyx_t_1 = (0 <= __pyx_v_start); - if (__pyx_t_1) { - __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); - } - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { +__pyx_t_2.shape[2] = __pyx_v_rotTs.shape[3]; +__pyx_t_2.strides[2] = __pyx_v_rotTs.strides[3]; + __pyx_t_2.suboffsets[2] = -1; - /* "View.MemoryView":834 - * start += shape - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< - * else: - * +__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL; + __pyx_v_n = ((long)__pyx_t_1); + + /* "newanalysis/helpers/correl.pyx":527 + * cdef long n = len(rotTs[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints # <<<<<<<<<<<<<< + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 834, __pyx_L1_error) + __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); + if (unlikely(__pyx_v_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 527, __pyx_L1_error) + } + else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 527, __pyx_L1_error) + } + __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - * else: + /* "newanalysis/helpers/correl.pyx":528 + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + * cdef double t1,t2,t3,t4,t5,t6 */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_12)) __PYX_ERR(0, 528, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5)) __PYX_ERR(0, 528, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(0, 528, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_corr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< - * - * if start < 0: + /* "newanalysis/helpers/correl.pyx":529 + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< + * cdef double t1,t2,t3,t4,t5,t6 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt */ - goto __pyx_L3; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 529, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 529, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_ctr = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; - /* "View.MemoryView":837 - * else: - * - * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":533 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt * - * if have_step and step == 0: + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - /*else*/ { - __pyx_t_1 = ((__pyx_v_have_step != 0) != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_1 = ((__pyx_v_step < 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L6_bool_binop_done:; - __pyx_v_negative_step = __pyx_t_2; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_3 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_12 > 0) + { + #ifdef _OPENMP + #pragma omp parallel reduction(+:__pyx_v_t1) reduction(+:__pyx_v_t2) reduction(+:__pyx_v_t3) reduction(+:__pyx_v_t4) reduction(+:__pyx_v_t5) reduction(+:__pyx_v_t6) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33, __pyx_t_34) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) + #endif /* _OPENMP */ + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){ + { + __pyx_v_dt = (long)(0 + 1 * __pyx_t_11); + /* Initialize private variables to invalid values */ + __pyx_v_k = ((long)0xbad0bad0); + __pyx_v_mol = ((long)0xbad0bad0); + __pyx_v_point = ((long)0xbad0bad0); + __pyx_v_shellstart = ((long)0xbad0bad0); + __pyx_v_start = ((long)0xbad0bad0); - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 - * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + /* "newanalysis/helpers/correl.pyx":534 * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip */ - __pyx_t_1 = (__pyx_v_have_step != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_1 = ((__pyx_v_step == 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L9_bool_binop_done:; - if (__pyx_t_2) { + __pyx_t_13 = __pyx_v_startingpoints; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_point = __pyx_t_15; - /* "View.MemoryView":840 - * - * if have_step and step == 0: - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/correl.pyx":535 + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * start = point*startskip + * shellstart = ds[mol,start]-1 */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 840, __pyx_L1_error) + __pyx_t_16 = __pyx_v_nmol; + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_mol = __pyx_t_18; - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 - * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) - * + /* "newanalysis/helpers/correl.pyx":536 + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip # <<<<<<<<<<<<<< + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: */ - } + __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); - /* "View.MemoryView":843 - * - * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape + /* "newanalysis/helpers/correl.pyx":537 + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip + * shellstart = ds[mol,start]-1 # <<<<<<<<<<<<<< + * if shellstart < nshells: + * ctr[shellstart,dt] += 1 */ - __pyx_t_2 = (__pyx_v_have_start != 0); - if (__pyx_t_2) { + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds.shape[1]; + __pyx_v_shellstart = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_19 * __pyx_v_ds.strides[0]) ) + __pyx_t_20 * __pyx_v_ds.strides[1]) ))) - 1); - /* "View.MemoryView":844 + /* "newanalysis/helpers/correl.pyx":538 + * start = point*startskip + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * ctr[shellstart,dt] += 1 * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { + __pyx_t_21 = (__pyx_v_shellstart < __pyx_v_nshells); + if (__pyx_t_21) { - /* "View.MemoryView":845 - * if have_start: - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if start < 0: - * start = 0 + /* "newanalysis/helpers/correl.pyx":539 + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: + * ctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< + * + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) )) += 1.0; - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "newanalysis/helpers/correl.pyx":541 + * ctr[shellstart,dt] += 1 + * + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 # <<<<<<<<<<<<<< + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { + __pyx_t_22 = 0.0; + __pyx_t_23 = 0.0; + __pyx_t_24 = 0.0; + __pyx_t_25 = 0.0; + __pyx_t_26 = 0.0; + __pyx_t_27 = 0.0; + __pyx_v_t1 = __pyx_t_22; + __pyx_v_t2 = __pyx_t_23; + __pyx_v_t3 = __pyx_t_24; + __pyx_v_t4 = __pyx_t_25; + __pyx_v_t5 = __pyx_t_26; + __pyx_v_t6 = __pyx_t_27; - /* "View.MemoryView":847 - * start += shape - * if start < 0: - * start = 0 # <<<<<<<<<<<<<< - * elif start >= shape: - * if negative_step: + /* "newanalysis/helpers/correl.pyx":542 + * + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] */ - __pyx_v_start = 0; + for (__pyx_t_28 = 0; __pyx_t_28 < 3; __pyx_t_28+=1) { + __pyx_v_k = __pyx_t_28; - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "newanalysis/helpers/correl.pyx":543 + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] # <<<<<<<<<<<<<< + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] */ - } + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_29 = 0; + __pyx_t_30 = __pyx_v_k; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; + __pyx_t_31 = __pyx_v_mol; + __pyx_t_32 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_33 = 0; + __pyx_t_34 = __pyx_v_k; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[3]; + __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":844 - * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: + /* "newanalysis/helpers/correl.pyx":544 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] */ - goto __pyx_L12; - } + __pyx_t_34 = __pyx_v_mol; + __pyx_t_33 = __pyx_v_start; + __pyx_t_32 = 1; + __pyx_t_31 = __pyx_v_k; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; + __pyx_t_30 = __pyx_v_mol; + __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_20 = 1; + __pyx_t_19 = __pyx_v_k; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; + __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_34 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 + /* "newanalysis/helpers/correl.pyx":545 + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] */ - __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0); - if (__pyx_t_2) { + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_29 = 2; + __pyx_t_30 = __pyx_v_k; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; + __pyx_t_31 = __pyx_v_mol; + __pyx_t_32 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_33 = 2; + __pyx_t_34 = __pyx_v_k; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[3]; + __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/correl.pyx":546 + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] */ - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + __pyx_t_34 = __pyx_v_mol; + __pyx_t_33 = __pyx_v_start; + __pyx_t_32 = 0; + __pyx_t_31 = __pyx_v_k; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; + __pyx_t_30 = __pyx_v_mol; + __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_20 = 1; + __pyx_t_19 = __pyx_v_k; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; + __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_34 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":850 - * elif start >= shape: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = shape + /* "newanalysis/helpers/correl.pyx":547 + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart,dt] += t1 # l=1 */ - __pyx_v_start = (__pyx_v_shape - 1); + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_29 = 0; + __pyx_t_30 = __pyx_v_k; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[3]; + __pyx_t_31 = __pyx_v_mol; + __pyx_t_32 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_33 = 2; + __pyx_t_34 = __pyx_v_k; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[3]; + __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_30 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/correl.pyx":548 + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * corr[0,shellstart,dt] += t1 # l=1 + * corr[1,shellstart,dt] += t2 */ - goto __pyx_L14; - } + __pyx_t_34 = __pyx_v_mol; + __pyx_t_33 = __pyx_v_start; + __pyx_t_32 = 1; + __pyx_t_31 = __pyx_v_k; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; + __pyx_t_30 = __pyx_v_mol; + __pyx_t_29 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_20 = 2; + __pyx_t_19 = __pyx_v_k; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; + __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_34 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_30 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_29 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))); + } - /* "View.MemoryView":852 - * start = shape - 1 - * else: - * start = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: + /* "newanalysis/helpers/correl.pyx":549 + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart,dt] += t1 # l=1 # <<<<<<<<<<<<<< + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 */ - /*else*/ { - __pyx_v_start = __pyx_v_shape; - } - __pyx_L14:; + __pyx_t_19 = 0; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += __pyx_v_t1; - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 + /* "newanalysis/helpers/correl.pyx":550 + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart,dt] += t1 # l=1 + * corr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 */ - } - __pyx_L12:; + __pyx_t_29 = 1; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t2; - /* "View.MemoryView":843 - * - * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape + /* "newanalysis/helpers/correl.pyx":551 + * corr[0,shellstart,dt] += t1 # l=1 + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 */ - goto __pyx_L11; - } + __pyx_t_19 = 2; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += __pyx_v_t3; - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/correl.pyx":552 + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + __pyx_t_29 = 3; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t4; - /* "View.MemoryView":855 - * else: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = 0 + /* "newanalysis/helpers/correl.pyx":553 + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 */ - __pyx_v_start = (__pyx_v_shape - 1); + __pyx_t_19 = 4; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += __pyx_v_t5; - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/correl.pyx":554 + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 */ - goto __pyx_L15; - } + __pyx_t_29 = 5; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t6; - /* "View.MemoryView":857 - * start = shape - 1 - * else: - * start = 0 # <<<<<<<<<<<<<< - * - * if have_stop: + /* "newanalysis/helpers/correl.pyx":555 + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 # <<<<<<<<<<<<<< + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 */ - /*else*/ { - __pyx_v_start = 0; - } - __pyx_L15:; - } - __pyx_L11:; + __pyx_t_19 = 6; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - /* "View.MemoryView":859 - * start = 0 - * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape + /* "newanalysis/helpers/correl.pyx":556 + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 */ - __pyx_t_2 = (__pyx_v_have_stop != 0); - if (__pyx_t_2) { + __pyx_t_29 = 7; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); - /* "View.MemoryView":860 - * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: + /* "newanalysis/helpers/correl.pyx":557 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { + __pyx_t_19 = 8; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); - /* "View.MemoryView":861 - * if have_stop: - * if stop < 0: - * stop += shape # <<<<<<<<<<<<<< - * if stop < 0: - * stop = 0 + /* "newanalysis/helpers/correl.pyx":558 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 */ - __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); + __pyx_t_29 = 9; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: + /* "newanalysis/helpers/correl.pyx":559 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + * */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { + __pyx_t_19 = 10; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_29 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_29 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); - /* "View.MemoryView":863 - * stop += shape - * if stop < 0: - * stop = 0 # <<<<<<<<<<<<<< - * elif stop > shape: - * stop = shape + /* "newanalysis/helpers/correl.pyx":560 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< + * + * for i in range(nshells): */ - __pyx_v_stop = 0; + __pyx_t_29 = 11; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: + /* "newanalysis/helpers/correl.pyx":538 + * start = point*startskip + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * ctr[shellstart,dt] += 1 + * */ + } + } + } + } + } + } + } } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":860 + /* "newanalysis/helpers/correl.pyx":533 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - goto __pyx_L17; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; } + } - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: - */ - __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":865 - * stop = 0 - * elif stop > shape: - * stop = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: - */ - __pyx_v_stop = __pyx_v_shape; - - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: + /* "newanalysis/helpers/correl.pyx":562 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + * + * for i in range(nshells): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * if ctr[i,j] != 0: */ - } - __pyx_L17:; + __pyx_t_12 = __pyx_v_nshells; + __pyx_t_11 = __pyx_t_12; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":859 - * start = 0 + /* "newanalysis/helpers/correl.pyx":563 * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape + * for i in range(nshells): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * if ctr[i,j] != 0: + * for k in range(12): */ - goto __pyx_L16; - } + __pyx_t_13 = __pyx_v_maxdt; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: + /* "newanalysis/helpers/correl.pyx":564 + * for i in range(nshells): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; + __pyx_t_21 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ))) != 0.0); + if (__pyx_t_21) { - /* "View.MemoryView":868 - * else: - * if negative_step: - * stop = -1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":565 + * for j in range(maxdt): + * if ctr[i,j] != 0: + * for k in range(12): # <<<<<<<<<<<<<< + * corr[k,i,j] /= ctr[i,j] * else: - * stop = shape */ - __pyx_v_stop = -1L; + for (__pyx_t_16 = 0; __pyx_t_16 < 12; __pyx_t_16+=1) { + __pyx_v_k = __pyx_t_16; - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 + /* "newanalysis/helpers/correl.pyx":566 + * if ctr[i,j] != 0: + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] # <<<<<<<<<<<<<< * else: + * print('tot too sparse') + */ + __pyx_t_20 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; + __pyx_t_29 = __pyx_v_k; + __pyx_t_30 = __pyx_v_i; + __pyx_t_31 = __pyx_v_j; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_corr.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_29 * __pyx_v_corr.strides[0]) ) + __pyx_t_30 * __pyx_v_corr.strides[1]) ) + __pyx_t_31 * __pyx_v_corr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) ))); + } + + /* "newanalysis/helpers/correl.pyx":564 + * for i in range(nshells): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] */ - goto __pyx_L19; + goto __pyx_L23; } - /* "View.MemoryView":870 - * stop = -1 + /* "newanalysis/helpers/correl.pyx":568 + * corr[k,i,j] /= ctr[i,j] * else: - * stop = shape # <<<<<<<<<<<<<< + * print('tot too sparse') # <<<<<<<<<<<<<< * - * if not have_step: + * return corr */ /*else*/ { - __pyx_v_stop = __pyx_v_shape; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_L19:; + __pyx_L23:; } - __pyx_L16:; + } - /* "View.MemoryView":872 - * stop = shape + /* "newanalysis/helpers/correl.pyx":570 + * print('tot too sparse') * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 + * return corr # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0); - if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "View.MemoryView":873 - * - * if not have_step: - * step = 1 # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":522 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ - __pyx_v_step = 1; - /* "View.MemoryView":872 - * stop = shape - * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 + /* function exit code */ + __pyx_L1_error:; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1); + __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateTot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ctr, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/correl.pyx":572 + * return corr * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs1) # number of molecules */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_19rotationMatrixShellCorrelateTotParts(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_19rotationMatrixShellCorrelateTotParts = {"rotationMatrixShellCorrelateTotParts", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_19rotationMatrixShellCorrelateTotParts, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_19rotationMatrixShellCorrelateTotParts(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_rotTs1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rotTs2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rotTs3 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_nshells; + long __pyx_v_maxdt; + long __pyx_v_startingpoints; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateTotParts (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 572, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs1,&__pyx_n_s_rotTs2,&__pyx_n_s_rotTs3,&__pyx_n_s_ds,&__pyx_n_s_nshells,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rotTs1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rotTs2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 1); __PYX_ERR(0, 572, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rotTs3)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 2); __PYX_ERR(0, 572, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 3); __PYX_ERR(0, 572, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 4); __PYX_ERR(0, 572, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxdt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 5); __PYX_ERR(0, 572, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_startingpoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, 6); __PYX_ERR(0, 572, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rotationMatrixShellCorrelateTotParts") < 0)) __PYX_ERR(0, 572, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 7)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + } + __pyx_v_rotTs1 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs1.memview)) __PYX_ERR(0, 573, __pyx_L3_error) + __pyx_v_rotTs2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs2.memview)) __PYX_ERR(0, 573, __pyx_L3_error) + __pyx_v_rotTs3 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs3.memview)) __PYX_ERR(0, 573, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 573, __pyx_L3_error) + __pyx_v_nshells = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_nshells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 573, __pyx_L3_error) + __pyx_v_maxdt = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 573, __pyx_L3_error) + __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 573, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("rotationMatrixShellCorrelateTotParts", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 572, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs3, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateTotParts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_6correl_18rotationMatrixShellCorrelateTotParts(__pyx_self, __pyx_v_rotTs1, __pyx_v_rotTs2, __pyx_v_rotTs3, __pyx_v_ds, __pyx_v_nshells, __pyx_v_maxdt, __pyx_v_startingpoints); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs3, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_6correl_18rotationMatrixShellCorrelateTotParts(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs1, __Pyx_memviewslice __pyx_v_rotTs2, __Pyx_memviewslice __pyx_v_rotTs3, __Pyx_memviewslice __pyx_v_ds, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints) { + long __pyx_v_nmol; + long __pyx_v_n; + long __pyx_v_startskip; + __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_t1; + double __pyx_v_t2; + double __pyx_v_t3; + double __pyx_v_t4; + double __pyx_v_t5; + double __pyx_v_t6; + long __pyx_v_i; + long __pyx_v_j; + long __pyx_v_k; + long __pyx_v_start; + long __pyx_v_point; + long __pyx_v_dt; + long __pyx_v_mol; + long __pyx_v_shellstart; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_11; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + int __pyx_t_21; + double __pyx_t_22; + double __pyx_t_23; + double __pyx_t_24; + double __pyx_t_25; + double __pyx_t_26; + double __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("rotationMatrixShellCorrelateTotParts", 0); - /* "View.MemoryView":877 - * - * with cython.cdivision(True): - * new_shape = (stop - start) // step # <<<<<<<<<<<<<< - * - * if (stop - start) - step * new_shape: + /* "newanalysis/helpers/correl.pyx":574 + * @cython.boundscheck(False) + * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs1) # number of molecules # <<<<<<<<<<<<<< + * cdef long n = len(rotTs1[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array */ - __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs1); + __pyx_v_nmol = ((long)__pyx_t_1); - /* "View.MemoryView":879 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 - * + /* "newanalysis/helpers/correl.pyx":575 + * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs1) # number of molecules + * cdef long n = len(rotTs1[0]) # number of time steps # <<<<<<<<<<<<<< + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints */ - __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); - if (__pyx_t_2) { + __pyx_t_2.data = __pyx_v_rotTs1.data; + __pyx_t_2.memview = __pyx_v_rotTs1.memview; + __PYX_INC_MEMVIEW(&__pyx_t_2, 1); + { + Py_ssize_t __pyx_tmp_idx = 0; + Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs1.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs1.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":880 - * - * if (stop - start) - step * new_shape: - * new_shape += 1 # <<<<<<<<<<<<<< - * - * if new_shape < 0: - */ - __pyx_v_new_shape = (__pyx_v_new_shape + 1); +__pyx_t_2.shape[0] = __pyx_v_rotTs1.shape[1]; +__pyx_t_2.strides[0] = __pyx_v_rotTs1.strides[1]; + __pyx_t_2.suboffsets[0] = -1; - /* "View.MemoryView":879 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 - * - */ - } +__pyx_t_2.shape[1] = __pyx_v_rotTs1.shape[2]; +__pyx_t_2.strides[1] = __pyx_v_rotTs1.strides[2]; + __pyx_t_2.suboffsets[1] = -1; - /* "View.MemoryView":882 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 - * - */ - __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0); - if (__pyx_t_2) { +__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL; + __pyx_v_n = ((long)__pyx_t_1); - /* "View.MemoryView":883 - * - * if new_shape < 0: - * new_shape = 0 # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/correl.pyx":577 + * cdef long n = len(rotTs1[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints # <<<<<<<<<<<<<< + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries */ - __pyx_v_new_shape = 0; + __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); + if (unlikely(__pyx_v_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 577, __pyx_L1_error) + } + else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 577, __pyx_L1_error) + } + __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - /* "View.MemoryView":882 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 - * + /* "newanalysis/helpers/correl.pyx":578 + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + * cdef double t1,t2,t3,t4,t5,t6 */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_12)) __PYX_ERR(0, 578, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5)) __PYX_ERR(0, 578, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(0, 578, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; } - - /* "View.MemoryView":886 - * - * - * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset - */ - (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - - /* "View.MemoryView":887 - * - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< - * dst.suboffsets[new_ndim] = suboffset - * - */ - (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - - /* "View.MemoryView":888 - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< - * - * - */ - (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; } - __pyx_L3:; - - /* "View.MemoryView":891 - * - * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: - */ - __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":892 - * - * if suboffset_dim[0] < 0: - * dst.data += start * stride # <<<<<<<<<<<<<< - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride - */ - __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); - - /* "View.MemoryView":891 - * - * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: - */ - goto __pyx_L23; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_corr = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; - /* "View.MemoryView":894 - * dst.data += start * stride - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< - * - * if suboffset >= 0: + /* "newanalysis/helpers/correl.pyx":579 + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< + * cdef double t1,t2,t3,t4,t5,t6 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt */ - /*else*/ { - __pyx_t_3 = (__pyx_v_suboffset_dim[0]); - (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 579, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 579, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } - __pyx_L23:; + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_ctr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride + /* "newanalysis/helpers/correl.pyx":583 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_3 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_12 > 0) + { + #ifdef _OPENMP + #pragma omp parallel reduction(+:__pyx_v_t1) reduction(+:__pyx_v_t2) reduction(+:__pyx_v_t3) reduction(+:__pyx_v_t4) reduction(+:__pyx_v_t5) reduction(+:__pyx_v_t6) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) + #endif /* _OPENMP */ + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){ + { + __pyx_v_dt = (long)(0 + 1 * __pyx_t_11); + /* Initialize private variables to invalid values */ + __pyx_v_mol = ((long)0xbad0bad0); + __pyx_v_point = ((long)0xbad0bad0); + __pyx_v_shellstart = ((long)0xbad0bad0); + __pyx_v_start = ((long)0xbad0bad0); - /* "View.MemoryView":897 + /* "newanalysis/helpers/correl.pyx":584 * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset - */ - __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: - */ - __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":899 - * if not is_slice: - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - */ - __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); - - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: - */ - goto __pyx_L26; - } - - /* "View.MemoryView":901 - * dst.data = ( dst.data)[0] + suboffset - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< - * "must be indexed and not sliced", dim) - * else: + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip */ - /*else*/ { + __pyx_t_13 = __pyx_v_startingpoints; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_point = __pyx_t_15; - /* "View.MemoryView":902 - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< - * else: - * suboffset_dim[0] = new_ndim + /* "newanalysis/helpers/correl.pyx":585 + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * start = point*startskip + * shellstart = ds[mol,start]-1 */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 901, __pyx_L1_error) - } - __pyx_L26:; + __pyx_t_16 = __pyx_v_nmol; + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_mol = __pyx_t_18; - /* "View.MemoryView":897 - * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset + /* "newanalysis/helpers/correl.pyx":586 + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip # <<<<<<<<<<<<<< + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: */ - goto __pyx_L25; - } + __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); - /* "View.MemoryView":904 - * "must be indexed and not sliced", dim) - * else: - * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< - * - * return 0 + /* "newanalysis/helpers/correl.pyx":587 + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip + * shellstart = ds[mol,start]-1 # <<<<<<<<<<<<<< + * if shellstart < nshells: + * ctr[shellstart,dt] += 1 */ - /*else*/ { - (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; - } - __pyx_L25:; + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds.shape[1]; + __pyx_v_shellstart = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_19 * __pyx_v_ds.strides[0]) ) + __pyx_t_20 * __pyx_v_ds.strides[1]) ))) - 1); - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride + /* "newanalysis/helpers/correl.pyx":588 + * start = point*startskip + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * ctr[shellstart,dt] += 1 * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: */ - } + __pyx_t_21 = (__pyx_v_shellstart < __pyx_v_nshells); + if (__pyx_t_21) { - /* "View.MemoryView":906 - * suboffset_dim[0] = new_ndim - * - * return 0 # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":589 + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: + * ctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< * + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) )) += 1.0; - /* "View.MemoryView":809 + /* "newanalysis/helpers/correl.pyx":591 + * ctr[shellstart,dt] += 1 * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, - */ - - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = -1; - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":912 + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 # <<<<<<<<<<<<<< * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - */ - -static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_suboffset; - Py_ssize_t __pyx_v_itemsize; - char *__pyx_v_resultp; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pybuffer_index", 0); - - /* "View.MemoryView":914 - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< - * cdef Py_ssize_t itemsize = view.itemsize - * cdef char *resultp + * t1 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,0] */ - __pyx_v_suboffset = -1L; - - /* "View.MemoryView":915 - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< - * cdef char *resultp + __pyx_t_22 = 0.0; + __pyx_t_23 = 0.0; + __pyx_t_24 = 0.0; + __pyx_t_25 = 0.0; + __pyx_t_26 = 0.0; + __pyx_t_27 = 0.0; + __pyx_v_t1 = __pyx_t_22; + __pyx_v_t2 = __pyx_t_23; + __pyx_v_t3 = __pyx_t_24; + __pyx_v_t4 = __pyx_t_25; + __pyx_v_t5 = __pyx_t_26; + __pyx_v_t6 = __pyx_t_27; + + /* "newanalysis/helpers/correl.pyx":593 + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 * + * t1 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,0] # <<<<<<<<<<<<<< + * t2 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,1] + * t3 += rotTs1[mol,start,2]*rotTs1[mol,start+dt,2] */ - __pyx_t_1 = __pyx_v_view->itemsize; - __pyx_v_itemsize = __pyx_t_1; + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_28 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[2]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_31 = 0; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs1.shape[2]; + __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_19 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_29 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs1.strides[2]) ))))); - /* "View.MemoryView":918 - * cdef char *resultp + /* "newanalysis/helpers/correl.pyx":594 * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + * t1 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,0] + * t2 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,1] # <<<<<<<<<<<<<< + * t3 += rotTs1[mol,start,2]*rotTs1[mol,start+dt,2] + * t4 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,1] */ - __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0); - if (__pyx_t_2) { + __pyx_t_31 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_29 = 1; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[2]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_19 = 1; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[2]; + __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_31 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_28 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs1.strides[2]) ))))); - /* "View.MemoryView":919 - * - * if view.ndim == 0: - * shape = view.len / itemsize # <<<<<<<<<<<<<< - * stride = itemsize - * else: + /* "newanalysis/helpers/correl.pyx":595 + * t1 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,0] + * t2 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,1] + * t3 += rotTs1[mol,start,2]*rotTs1[mol,start+dt,2] # <<<<<<<<<<<<<< + * t4 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,1] + * t5 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,2] */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_28 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[2]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_31 = 2; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs1.shape[2]; + __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_19 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_29 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs1.strides[2]) ))))); - /* "View.MemoryView":920 - * if view.ndim == 0: - * shape = view.len / itemsize - * stride = itemsize # <<<<<<<<<<<<<< - * else: - * shape = view.shape[dim] + /* "newanalysis/helpers/correl.pyx":596 + * t2 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,1] + * t3 += rotTs1[mol,start,2]*rotTs1[mol,start+dt,2] + * t4 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,1] # <<<<<<<<<<<<<< + * t5 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,2] + * t6 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,2] */ - __pyx_v_stride = __pyx_v_itemsize; + __pyx_t_31 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_29 = 0; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[2]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_19 = 1; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[2]; + __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_31 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_28 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs1.strides[2]) ))))); - /* "View.MemoryView":918 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + /* "newanalysis/helpers/correl.pyx":597 + * t3 += rotTs1[mol,start,2]*rotTs1[mol,start+dt,2] + * t4 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,1] + * t5 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,2] # <<<<<<<<<<<<<< + * t6 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,2] + * t1 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,0] */ - goto __pyx_L3; - } + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_28 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[2]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_31 = 2; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs1.shape[2]; + __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_19 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_29 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs1.strides[2]) ))))); - /* "View.MemoryView":922 - * stride = itemsize - * else: - * shape = view.shape[dim] # <<<<<<<<<<<<<< - * stride = view.strides[dim] - * if view.suboffsets != NULL: + /* "newanalysis/helpers/correl.pyx":598 + * t4 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,1] + * t5 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,2] + * t6 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,2] # <<<<<<<<<<<<<< + * t1 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,0] + * t2 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,1] */ - /*else*/ { - __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + __pyx_t_31 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_29 = 1; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs1.shape[2]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_19 = 2; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs1.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs1.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs1.shape[2]; + __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_31 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs1.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs1.data + __pyx_t_28 * __pyx_v_rotTs1.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs1.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs1.strides[2]) ))))); - /* "View.MemoryView":923 - * else: - * shape = view.shape[dim] - * stride = view.strides[dim] # <<<<<<<<<<<<<< - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] + /* "newanalysis/helpers/correl.pyx":599 + * t5 += rotTs1[mol,start,0]*rotTs1[mol,start+dt,2] + * t6 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,2] + * t1 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,0] # <<<<<<<<<<<<<< + * t2 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,1] + * t3 += rotTs2[mol,start,2]*rotTs2[mol,start+dt,2] */ - __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_28 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[2]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_31 = 0; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs2.shape[2]; + __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_19 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_29 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs2.strides[2]) ))))); - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * + /* "newanalysis/helpers/correl.pyx":600 + * t6 += rotTs1[mol,start,1]*rotTs1[mol,start+dt,2] + * t1 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,0] + * t2 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,1] # <<<<<<<<<<<<<< + * t3 += rotTs2[mol,start,2]*rotTs2[mol,start+dt,2] + * t4 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,1] */ - __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0); - if (__pyx_t_2) { + __pyx_t_31 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_29 = 1; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[2]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_19 = 1; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[2]; + __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_31 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_28 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs2.strides[2]) ))))); - /* "View.MemoryView":925 - * stride = view.strides[dim] - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< - * - * if index < 0: + /* "newanalysis/helpers/correl.pyx":601 + * t1 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,0] + * t2 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,1] + * t3 += rotTs2[mol,start,2]*rotTs2[mol,start+dt,2] # <<<<<<<<<<<<<< + * t4 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,1] + * t5 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,2] */ - __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_28 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[2]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_31 = 2; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs2.shape[2]; + __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_19 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_29 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs2.strides[2]) ))))); - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * + /* "newanalysis/helpers/correl.pyx":602 + * t2 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,1] + * t3 += rotTs2[mol,start,2]*rotTs2[mol,start+dt,2] + * t4 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,1] # <<<<<<<<<<<<<< + * t5 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,2] + * t6 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,2] */ - } - } - __pyx_L3:; + __pyx_t_31 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_29 = 0; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[2]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_19 = 1; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[2]; + __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_31 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_28 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs2.strides[2]) ))))); - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] - * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: + /* "newanalysis/helpers/correl.pyx":603 + * t3 += rotTs2[mol,start,2]*rotTs2[mol,start+dt,2] + * t4 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,1] + * t5 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,2] # <<<<<<<<<<<<<< + * t6 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,2] + * t1 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,0] */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (__pyx_t_2) { + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_28 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[2]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_31 = 2; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs2.shape[2]; + __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_19 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_29 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs2.strides[2]) ))))); - /* "View.MemoryView":928 - * - * if index < 0: - * index += view.shape[dim] # <<<<<<<<<<<<<< - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "newanalysis/helpers/correl.pyx":604 + * t4 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,1] + * t5 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,2] + * t6 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,2] # <<<<<<<<<<<<<< + * t1 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,0] + * t2 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,1] */ - __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + __pyx_t_31 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_29 = 1; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs2.shape[2]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_19 = 2; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs2.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs2.shape[2]; + __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_31 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs2.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs2.data + __pyx_t_28 * __pyx_v_rotTs2.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs2.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs2.strides[2]) ))))); - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * + /* "newanalysis/helpers/correl.pyx":605 + * t5 += rotTs2[mol,start,0]*rotTs2[mol,start+dt,2] + * t6 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,2] + * t1 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,0] # <<<<<<<<<<<<<< + * t2 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,1] + * t3 += rotTs3[mol,start,2]*rotTs3[mol,start+dt,2] */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_28 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[2]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_31 = 0; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs3.shape[2]; + __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_19 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_29 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs3.strides[2]) ))))); - /* "View.MemoryView":930 - * index += view.shape[dim] - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< - * - * if index >= shape: + /* "newanalysis/helpers/correl.pyx":606 + * t6 += rotTs2[mol,start,1]*rotTs2[mol,start+dt,2] + * t1 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,0] + * t2 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,1] # <<<<<<<<<<<<<< + * t3 += rotTs3[mol,start,2]*rotTs3[mol,start+dt,2] + * t4 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,1] */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 930, __pyx_L1_error) + __pyx_t_31 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_29 = 1; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[2]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_19 = 1; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[2]; + __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_31 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_28 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs3.strides[2]) ))))); - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * + /* "newanalysis/helpers/correl.pyx":607 + * t1 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,0] + * t2 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,1] + * t3 += rotTs3[mol,start,2]*rotTs3[mol,start+dt,2] # <<<<<<<<<<<<<< + * t4 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,1] + * t5 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,2] */ - } + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_28 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[2]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_31 = 2; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs3.shape[2]; + __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_19 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_29 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs3.strides[2]) ))))); - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] - * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: + /* "newanalysis/helpers/correl.pyx":608 + * t2 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,1] + * t3 += rotTs3[mol,start,2]*rotTs3[mol,start+dt,2] + * t4 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,1] # <<<<<<<<<<<<<< + * t5 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,2] + * t6 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,2] */ - } + __pyx_t_31 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_29 = 0; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[2]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_19 = 1; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[2]; + __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_31 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_28 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs3.strides[2]) ))))); - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "newanalysis/helpers/correl.pyx":609 + * t3 += rotTs3[mol,start,2]*rotTs3[mol,start+dt,2] + * t4 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,1] + * t5 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,2] # <<<<<<<<<<<<<< + * t6 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,2] * */ - __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_28 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[2]; + __pyx_t_29 = __pyx_v_mol; + __pyx_t_30 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_31 = 2; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs3.shape[2]; + __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_19 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_29 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_31 * __pyx_v_rotTs3.strides[2]) ))))); - /* "View.MemoryView":933 - * - * if index >= shape: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":610 + * t4 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,1] + * t5 += rotTs3[mol,start,0]*rotTs3[mol,start+dt,2] + * t6 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,2] # <<<<<<<<<<<<<< * - * resultp = bufp + index * stride + * corr[0,shellstart,dt] += t1 # l=1 */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 933, __pyx_L1_error) + __pyx_t_31 = __pyx_v_mol; + __pyx_t_30 = __pyx_v_start; + __pyx_t_29 = 1; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_rotTs3.shape[2]; + __pyx_t_28 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_19 = 2; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs3.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs3.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs3.shape[2]; + __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_31 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_30 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_29 * __pyx_v_rotTs3.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs3.data + __pyx_t_28 * __pyx_v_rotTs3.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs3.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs3.strides[2]) ))))); - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "newanalysis/helpers/correl.pyx":612 + * t6 += rotTs3[mol,start,1]*rotTs3[mol,start+dt,2] * + * corr[0,shellstart,dt] += t1 # l=1 # <<<<<<<<<<<<<< + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 */ - } + __pyx_t_19 = 0; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_28 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += __pyx_v_t1; - /* "View.MemoryView":935 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "newanalysis/helpers/correl.pyx":613 * - * resultp = bufp + index * stride # <<<<<<<<<<<<<< - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset + * corr[0,shellstart,dt] += t1 # l=1 + * corr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 */ - __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + __pyx_t_28 = 1; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t2; - /* "View.MemoryView":936 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset - * + /* "newanalysis/helpers/correl.pyx":614 + * corr[0,shellstart,dt] += t1 # l=1 + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { + __pyx_t_19 = 2; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_28 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += __pyx_v_t3; - /* "View.MemoryView":937 - * resultp = bufp + index * stride - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< - * - * return resultp + /* "newanalysis/helpers/correl.pyx":615 + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 */ - __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + __pyx_t_28 = 3; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t4; - /* "View.MemoryView":936 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset - * + /* "newanalysis/helpers/correl.pyx":616 + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 */ - } + __pyx_t_19 = 4; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_28 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += __pyx_v_t5; - /* "View.MemoryView":939 - * resultp = ( resultp)[0] + suboffset - * - * return resultp # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/correl.pyx":617 + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 */ - __pyx_r = __pyx_v_resultp; - goto __pyx_L0; + __pyx_t_28 = 5; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t6; - /* "View.MemoryView":912 - * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 + /* "newanalysis/helpers/correl.pyx":618 + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 # <<<<<<<<<<<<<< + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 */ + __pyx_t_19 = 6; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_28 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":619 + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + */ + __pyx_t_28 = 7; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); -/* "View.MemoryView":945 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim - * + /* "newanalysis/helpers/correl.pyx":620 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 */ + __pyx_t_19 = 8; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_28 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); -static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { - int __pyx_v_ndim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_r; - int __pyx_t_1; - Py_ssize_t *__pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; + /* "newanalysis/helpers/correl.pyx":621 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + */ + __pyx_t_28 = 9; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); - /* "View.MemoryView":946 - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: - * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":622 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 * - * cdef Py_ssize_t *shape = memslice.shape */ - __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; - __pyx_v_ndim = __pyx_t_1; + __pyx_t_19 = 10; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_28 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_28 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); - /* "View.MemoryView":948 - * cdef int ndim = memslice.memview.view.ndim - * - * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< - * cdef Py_ssize_t *strides = memslice.strides + /* "newanalysis/helpers/correl.pyx":623 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< * + * for i in range(nshells): */ - __pyx_t_2 = __pyx_v_memslice->shape; - __pyx_v_shape = __pyx_t_2; + __pyx_t_28 = 11; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); - /* "View.MemoryView":949 - * - * cdef Py_ssize_t *shape = memslice.shape - * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":588 + * start = point*startskip + * shellstart = ds[mol,start]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * ctr[shellstart,dt] += 1 * */ - __pyx_t_2 = __pyx_v_memslice->strides; - __pyx_v_strides = __pyx_t_2; + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":953 + /* "newanalysis/helpers/correl.pyx":583 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt * - * cdef int i, j - * for i in range(ndim / 2): # <<<<<<<<<<<<<< - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } - /* "View.MemoryView":954 - * cdef int i, j - * for i in range(ndim / 2): - * j = ndim - 1 - i # <<<<<<<<<<<<<< - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] + /* "newanalysis/helpers/correl.pyx":625 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + * + * for i in range(nshells): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * if ctr[i,j] != 0: */ - __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + __pyx_t_12 = __pyx_v_nshells; + __pyx_t_11 = __pyx_t_12; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":955 - * for i in range(ndim / 2): - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< - * shape[i], shape[j] = shape[j], shape[i] + /* "newanalysis/helpers/correl.pyx":626 * + * for i in range(nshells): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * if ctr[i,j] != 0: + * for k in range(12): */ - __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); - __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); - (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; - (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + __pyx_t_13 = __pyx_v_maxdt; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; - /* "View.MemoryView":956 - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + /* "newanalysis/helpers/correl.pyx":627 + * for i in range(nshells): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] */ - __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); - __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); - (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; - (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; + __pyx_t_21 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ))) != 0.0); + if (__pyx_t_21) { + + /* "newanalysis/helpers/correl.pyx":628 + * for j in range(maxdt): + * if ctr[i,j] != 0: + * for k in range(12): # <<<<<<<<<<<<<< + * corr[k,i,j] /= ctr[i,j] + * else: + */ + for (__pyx_t_16 = 0; __pyx_t_16 < 12; __pyx_t_16+=1) { + __pyx_v_k = __pyx_t_16; - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") - * + /* "newanalysis/helpers/correl.pyx":629 + * if ctr[i,j] != 0: + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] # <<<<<<<<<<<<<< + * else: + * print('tot too sparse') */ - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0); - __pyx_t_7 = __pyx_t_8; - __pyx_L6_bool_binop_done:; - if (__pyx_t_7) { + __pyx_t_20 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; + __pyx_t_28 = __pyx_v_k; + __pyx_t_29 = __pyx_v_i; + __pyx_t_30 = __pyx_v_j; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_corr.shape[1]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_29 * __pyx_v_corr.strides[1]) ) + __pyx_t_30 * __pyx_v_corr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) ))); + } - /* "View.MemoryView":959 - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< - * - * return 1 + /* "newanalysis/helpers/correl.pyx":627 + * for i in range(nshells): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] */ - __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 959, __pyx_L1_error) + goto __pyx_L21; + } - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") + /* "newanalysis/helpers/correl.pyx":631 + * corr[k,i,j] /= ctr[i,j] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< * + * return corr */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L21:; } } - /* "View.MemoryView":961 - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") + /* "newanalysis/helpers/correl.pyx":633 + * print('tot too sparse') * - * return 1 # <<<<<<<<<<<<<< + * return corr # <<<<<<<<<<<<<< * * */ - __pyx_r = 1; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "View.MemoryView":945 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim + /* "newanalysis/helpers/correl.pyx":572 + * return corr * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs1) # number of molecules */ /* function exit code */ __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = 0; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1); + __Pyx_AddTraceback("newanalysis.correl.rotationMatrixShellCorrelateTotParts", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ctr, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 +/* "newanalysis/helpers/correl.pyx":636 * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vectorRotation(double [:,:] rotTs, int datapoints): + * # cdef long datapoints = len(rotTs) */ /* Python wrapper */ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_11newanalysis_6correl_21vectorRotation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_21vectorRotation = {"vectorRotation", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_21vectorRotation, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_21vectorRotation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_datapoints; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ + __Pyx_RefNannySetupContext("vectorRotation (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 636, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_datapoints,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rotTs)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 636, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_datapoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 636, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("vectorRotation", 1, 2, 2, 1); __PYX_ERR(0, 636, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "vectorRotation") < 0)) __PYX_ERR(0, 636, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 637, __pyx_L3_error) + __pyx_v_datapoints = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_datapoints == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 637, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("vectorRotation", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 636, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __Pyx_AddTraceback("newanalysis.correl.vectorRotation", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":979 - * - * def __dealloc__(self): - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< - * - * cdef convert_item_to_object(self, char *itemp): - */ - __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); - - /* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * - */ + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_6correl_20vectorRotation(__pyx_self, __pyx_v_rotTs, __pyx_v_datapoints); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) - */ - -static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { +static PyObject *__pyx_pf_11newanalysis_6correl_20vectorRotation(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, int __pyx_v_datapoints) { + __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_t; + long __pyx_v_i; + long __pyx_v_k; + long __pyx_v_start; + long __pyx_v_dt; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_7; + long __pyx_t_8; + long __pyx_t_9; + long __pyx_t_10; + long __pyx_t_11; + long __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + int __pyx_t_17; + double __pyx_t_18; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":982 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: - */ - __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":983 - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) # <<<<<<<<<<<<<< - * else: - * return memoryview.convert_item_to_object(self, itemp) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __Pyx_RefNannySetupContext("vectorRotation", 0); - /* "View.MemoryView":982 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: + /* "newanalysis/helpers/correl.pyx":639 + * def vectorRotation(double [:,:] rotTs, int datapoints): + * # cdef long datapoints = len(rotTs) + * cdef double [:,:] corr = np.zeros((2,datapoints)) # <<<<<<<<<<<<<< + * cdef double t + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_datapoints); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_2)) __PYX_ERR(0, 639, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_corr = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "View.MemoryView":985 - * return self.to_object_func(itemp) - * else: - * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":643 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt * - * cdef assign_item_from_object(self, char *itemp, object value): + * for dt in prange(datapoints,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(datapoints-dt): # loop over all possible interval start points + * t = 0 */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 985, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_5 = __pyx_v_datapoints; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_8 = (__pyx_t_5 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_8 > 0) + { + #ifdef _OPENMP + #pragma omp parallel reduction(+:__pyx_v_t) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_start) + #endif /* _OPENMP */ + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ + { + __pyx_v_dt = (long)(0 + 1 * __pyx_t_7); + /* Initialize private variables to invalid values */ + __pyx_v_k = ((long)0xbad0bad0); + __pyx_v_start = ((long)0xbad0bad0); - /* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + /* "newanalysis/helpers/correl.pyx":644 * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) + * for dt in prange(datapoints,nogil=True,schedule=dynamic): # loop over all delta t + * for start in range(datapoints-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< + * t = 0 + * for k in range(3): # skalar produkt */ + __pyx_t_9 = (__pyx_v_datapoints - __pyx_v_dt); + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_start = __pyx_t_11; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + /* "newanalysis/helpers/correl.pyx":645 + * for dt in prange(datapoints,nogil=True,schedule=dynamic): # loop over all delta t + * for start in range(datapoints-dt): # loop over all possible interval start points + * t = 0 # <<<<<<<<<<<<<< + * for k in range(3): # skalar produkt + * t += rotTs[start,k]*rotTs[start+dt,k] */ + __pyx_v_t = 0.0; -static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); + /* "newanalysis/helpers/correl.pyx":646 + * for start in range(datapoints-dt): # loop over all possible interval start points + * t = 0 + * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< + * t += rotTs[start,k]*rotTs[start+dt,k] + * corr[0,dt] += t # l=1 + */ + for (__pyx_t_12 = 0; __pyx_t_12 < 3; __pyx_t_12+=1) { + __pyx_v_k = __pyx_t_12; - /* "View.MemoryView":988 - * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: + /* "newanalysis/helpers/correl.pyx":647 + * t = 0 + * for k in range(3): # skalar produkt + * t += rotTs[start,k]*rotTs[start+dt,k] # <<<<<<<<<<<<<< + * corr[0,dt] += t # l=1 + * corr[1,dt] += 1.5*t*t-0.5 # l=2 */ - __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0); - if (__pyx_t_1) { + __pyx_t_13 = __pyx_v_start; + __pyx_t_14 = __pyx_v_k; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_rotTs.shape[1]; + __pyx_t_15 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_16 = __pyx_v_k; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_rotTs.shape[1]; + __pyx_v_t = (__pyx_v_t + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_13 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_14 * __pyx_v_rotTs.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_15 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_16 * __pyx_v_rotTs.strides[1]) ))))); + } - /* "View.MemoryView":989 - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< - * else: - * memoryview.assign_item_from_object(self, itemp, value) + /* "newanalysis/helpers/correl.pyx":648 + * for k in range(3): # skalar produkt + * t += rotTs[start,k]*rotTs[start+dt,k] + * corr[0,dt] += t # l=1 # <<<<<<<<<<<<<< + * corr[1,dt] += 1.5*t*t-0.5 # l=2 + * for i in range(datapoints): */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 989, __pyx_L1_error) + __pyx_t_16 = 0; + __pyx_t_15 = __pyx_v_dt; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_16 * __pyx_v_corr.strides[0]) ) + __pyx_t_15 * __pyx_v_corr.strides[1]) )) += __pyx_v_t; - /* "View.MemoryView":988 - * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: + /* "newanalysis/helpers/correl.pyx":649 + * t += rotTs[start,k]*rotTs[start+dt,k] + * corr[0,dt] += t # l=1 + * corr[1,dt] += 1.5*t*t-0.5 # l=2 # <<<<<<<<<<<<<< + * for i in range(datapoints): + * corr[0,i] = corr[0,i] / (datapoints-i) */ - goto __pyx_L3; - } + __pyx_t_15 = 1; + __pyx_t_16 = __pyx_v_dt; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_15 * __pyx_v_corr.strides[0]) ) + __pyx_t_16 * __pyx_v_corr.strides[1]) )) += (((1.5 * __pyx_v_t) * __pyx_v_t) - 0.5); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":991 - * self.to_dtype_func(itemp, value) - * else: - * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":643 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt * - * @property + * for dt in prange(datapoints,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(datapoints-dt): # loop over all possible interval start points + * t = 0 */ - /*else*/ { - __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 991, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } } - __pyx_L3:; - /* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + /* "newanalysis/helpers/correl.pyx":650 + * corr[0,dt] += t # l=1 + * corr[1,dt] += 1.5*t*t-0.5 # l=2 + * for i in range(datapoints): # <<<<<<<<<<<<<< + * corr[0,i] = corr[0,i] / (datapoints-i) + * corr[1,i] = corr[1,i] / (datapoints-i) */ + __pyx_t_5 = __pyx_v_datapoints; + __pyx_t_17 = __pyx_t_5; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_17; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":651 + * corr[1,dt] += 1.5*t*t-0.5 # l=2 + * for i in range(datapoints): + * corr[0,i] = corr[0,i] / (datapoints-i) # <<<<<<<<<<<<<< + * corr[1,i] = corr[1,i] / (datapoints-i) + * return corr + */ + __pyx_t_16 = 0; + __pyx_t_15 = __pyx_v_i; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[1]; + __pyx_t_18 = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_16 * __pyx_v_corr.strides[0]) ) + __pyx_t_15 * __pyx_v_corr.strides[1]) ))); + __pyx_t_7 = (__pyx_v_datapoints - __pyx_v_i); + if (unlikely(__pyx_t_7 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 651, __pyx_L1_error) + } + __pyx_t_15 = 0; + __pyx_t_16 = __pyx_v_i; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_15 * __pyx_v_corr.strides[0]) ) + __pyx_t_16 * __pyx_v_corr.strides[1]) )) = (__pyx_t_18 / ((double)__pyx_t_7)); -/* "View.MemoryView":994 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object + /* "newanalysis/helpers/correl.pyx":652 + * for i in range(datapoints): + * corr[0,i] = corr[0,i] / (datapoints-i) + * corr[1,i] = corr[1,i] / (datapoints-i) # <<<<<<<<<<<<<< + * return corr * */ + __pyx_t_16 = 1; + __pyx_t_15 = __pyx_v_i; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[1]; + __pyx_t_18 = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_16 * __pyx_v_corr.strides[0]) ) + __pyx_t_15 * __pyx_v_corr.strides[1]) ))); + __pyx_t_7 = (__pyx_v_datapoints - __pyx_v_i); + if (unlikely(__pyx_t_7 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 652, __pyx_L1_error) + } + __pyx_t_15 = 1; + __pyx_t_16 = __pyx_v_i; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_corr.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_corr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_15 * __pyx_v_corr.strides[0]) ) + __pyx_t_16 * __pyx_v_corr.strides[1]) )) = (__pyx_t_18 / ((double)__pyx_t_7)); + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":995 - * @property - * def base(self): - * return self.from_object # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":653 + * corr[0,i] = corr[0,i] / (datapoints-i) + * corr[1,i] = corr[1,i] / (datapoints-i) + * return corr # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") + * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->from_object); - __pyx_r = __pyx_v_self->from_object; + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_corr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":994 + /* "newanalysis/helpers/correl.pyx":636 * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vectorRotation(double [:,:] rotTs, int datapoints): + * # cdef long datapoints = len(rotTs) */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __Pyx_AddTraceback("newanalysis.correl.vectorRotation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corr, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): +/* "newanalysis/helpers/correl.pyx":655 + * return corr + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; +static PyObject *__pyx_pw_11newanalysis_6correl_23sparsefullnobulkthincorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_23sparsefullnobulkthincorrelate = {"sparsefullnobulkthincorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_23sparsefullnobulkthincorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_23sparsefullnobulkthincorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_pdata = 0; + int __pyx_v_pcorrdim; + PyArrayObject *__pyx_v_pds = 0; + int __pyx_v_pnshells; + PyObject *__pyx_v_maxlen = 0; + PyObject *__pyx_v_startingpoints = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + __Pyx_RefNannySetupContext("sparsefullnobulkthincorrelate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 655, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_pcorrdim,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,&__pyx_n_s_startingpoints,0}; -static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + /* "newanalysis/helpers/correl.pyx":660 + * np.ndarray[np.int32_t,ndim=2] pds, + * int pnshells, + * maxlen=None, # <<<<<<<<<<<<<< + * startingpoints=None): + * + */ + values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":661 + * int pnshells, + * maxlen=None, + * startingpoints=None): # <<<<<<<<<<<<<< + * + * cdef long corrdim = pcorrdim */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pdata)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pcorrdim)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthincorrelate", 0, 4, 6, 1); __PYX_ERR(0, 655, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthincorrelate", 0, 4, 6, 2); __PYX_ERR(0, 655, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pnshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthincorrelate", 0, 4, 6, 3); __PYX_ERR(0, 655, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_startingpoints); + if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sparsefullnobulkthincorrelate") < 0)) __PYX_ERR(0, 655, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_pdata = ((PyArrayObject *)values[0]); + __pyx_v_pcorrdim = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_pcorrdim == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 657, __pyx_L3_error) + __pyx_v_pds = ((PyArrayObject *)values[2]); + __pyx_v_pnshells = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 659, __pyx_L3_error) + __pyx_v_maxlen = values[4]; + __pyx_v_startingpoints = values[5]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthincorrelate", 0, 4, 6, __pyx_nargs); __PYX_ERR(0, 655, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkthincorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 656, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 658, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_22sparsefullnobulkthincorrelate(__pyx_self, __pyx_v_pdata, __pyx_v_pcorrdim, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen, __pyx_v_startingpoints); - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/correl.pyx":655 + * return corr + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1001 - * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), - */ - -static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_v_length = NULL; +static PyObject *__pyx_pf_11newanalysis_6correl_22sparsefullnobulkthincorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_startingpoints) { + long __pyx_v_corrdim; + long __pyx_v_nmol; + long __pyx_v_n; + long __pyx_v_nds; + long __pyx_v_maxdt; + long __pyx_v_nshells; + long __pyx_v_startskip; + long __pyx_v_startmax; + PyArrayObject *__pyx_v_contdata = 0; + PyArrayObject *__pyx_v_contds = 0; + double *__pyx_v_cdata; + int *__pyx_v_cds; + PyObject *__pyx_v_pcorr = NULL; + PyObject *__pyx_v_pselfcorr = NULL; + PyObject *__pyx_v_pcrosscorr = NULL; + PyArrayObject *__pyx_v_corr = 0; + PyArrayObject *__pyx_v_selfcorr = 0; + PyArrayObject *__pyx_v_crosscorr = 0; + PyArrayObject *__pyx_v_ctr = 0; + PyArrayObject *__pyx_v_selfctr = 0; + PyArrayObject *__pyx_v_crossctr = 0; + double *__pyx_v_ccorr; + double *__pyx_v_cselfcorr; + double *__pyx_v_ccrosscorr; + double *__pyx_v_cctr; + double *__pyx_v_cselfctr; + double *__pyx_v_ccrossctr; + double __pyx_v_value; + long __pyx_v_i; + long __pyx_v_start; + long __pyx_v_dt; + long __pyx_v_mol; + long __pyx_v_shellstart; + long __pyx_v_shelldt; + long __pyx_v_idx; + long __pyx_v_dim; + long __pyx_v_validx; + long __pyx_v_dsidx; + long __pyx_v_istart; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; + __Pyx_Buffer __pyx_pybuffer_contdata; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; + __Pyx_Buffer __pyx_pybuffer_contds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; + __Pyx_Buffer __pyx_pybuffer_corr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_crosscorr; + __Pyx_Buffer __pyx_pybuffer_crosscorr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_crossctr; + __Pyx_Buffer __pyx_pybuffer_crossctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; + __Pyx_Buffer __pyx_pybuffer_pdata; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; + __Pyx_Buffer __pyx_pybuffer_pds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_selfcorr; + __Pyx_Buffer __pyx_pybuffer_selfcorr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_selfctr; + __Pyx_Buffer __pyx_pybuffer_selfctr; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_1; + long __pyx_t_2; PyObject *__pyx_t_3 = NULL; - __Pyx_TypeInfo *__pyx_t_4; - Py_buffer __pyx_t_5; - Py_ssize_t *__pyx_t_6; - Py_ssize_t *__pyx_t_7; - Py_ssize_t *__pyx_t_8; - Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + PyArrayObject *__pyx_t_14 = NULL; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + long __pyx_t_20; + long __pyx_t_21; + long __pyx_t_22; + int __pyx_t_23; + long __pyx_t_24; + long __pyx_t_25; + long __pyx_t_26; + long __pyx_t_27; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - - /* "View.MemoryView":1009 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None - * - */ - __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0); - if (__pyx_t_1) { + __Pyx_RefNannySetupContext("sparsefullnobulkthincorrelate", 0); + __pyx_pybuffer_contdata.pybuffer.buf = NULL; + __pyx_pybuffer_contdata.refcount = 0; + __pyx_pybuffernd_contdata.data = NULL; + __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; + __pyx_pybuffer_contds.pybuffer.buf = NULL; + __pyx_pybuffer_contds.refcount = 0; + __pyx_pybuffernd_contds.data = NULL; + __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; + __pyx_pybuffer_corr.pybuffer.buf = NULL; + __pyx_pybuffer_corr.refcount = 0; + __pyx_pybuffernd_corr.data = NULL; + __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; + __pyx_pybuffer_selfcorr.pybuffer.buf = NULL; + __pyx_pybuffer_selfcorr.refcount = 0; + __pyx_pybuffernd_selfcorr.data = NULL; + __pyx_pybuffernd_selfcorr.rcbuffer = &__pyx_pybuffer_selfcorr; + __pyx_pybuffer_crosscorr.pybuffer.buf = NULL; + __pyx_pybuffer_crosscorr.refcount = 0; + __pyx_pybuffernd_crosscorr.data = NULL; + __pyx_pybuffernd_crosscorr.rcbuffer = &__pyx_pybuffer_crosscorr; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_selfctr.pybuffer.buf = NULL; + __pyx_pybuffer_selfctr.refcount = 0; + __pyx_pybuffernd_selfctr.data = NULL; + __pyx_pybuffernd_selfctr.rcbuffer = &__pyx_pybuffer_selfctr; + __pyx_pybuffer_crossctr.pybuffer.buf = NULL; + __pyx_pybuffer_crossctr.refcount = 0; + __pyx_pybuffernd_crossctr.data = NULL; + __pyx_pybuffernd_crossctr.rcbuffer = &__pyx_pybuffer_crossctr; + __pyx_pybuffer_pdata.pybuffer.buf = NULL; + __pyx_pybuffer_pdata.refcount = 0; + __pyx_pybuffernd_pdata.data = NULL; + __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; + __pyx_pybuffer_pds.pybuffer.buf = NULL; + __pyx_pybuffer_pds.refcount = 0; + __pyx_pybuffernd_pds.data = NULL; + __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 655, __pyx_L1_error) + } + __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 655, __pyx_L1_error) + } + __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; - /* "View.MemoryView":1010 - * - * if memviewslice.memview == Py_None: - * return None # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":663 + * startingpoints=None): * + * cdef long corrdim = pcorrdim # <<<<<<<<<<<<<< + * cdef long nmol = len(pdata)//pcorrdim # number of molecules + * cdef long n = len(pdata[0]) # number of time steps */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_v_corrdim = ((long)__pyx_v_pcorrdim); - /* "View.MemoryView":1009 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None + /* "newanalysis/helpers/correl.pyx":664 * + * cdef long corrdim = pcorrdim + * cdef long nmol = len(pdata)//pcorrdim # number of molecules # <<<<<<<<<<<<<< + * cdef long n = len(pdata[0]) # number of time steps + * cdef long nds = len(pds[0]) # number of steps in delaunay array */ + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 664, __pyx_L1_error) + __pyx_t_2 = ((long)__pyx_t_1); + if (unlikely(__pyx_v_pcorrdim == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 664, __pyx_L1_error) + } + else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_pcorrdim == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 664, __pyx_L1_error) } + __pyx_v_nmol = __Pyx_div_long(__pyx_t_2, __pyx_v_pcorrdim); - /* "View.MemoryView":1015 - * - * - * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<< - * - * result.from_slice = memviewslice + /* "newanalysis/helpers/correl.pyx":665 + * cdef long corrdim = pcorrdim + * cdef long nmol = len(pdata)//pcorrdim # number of molecules + * cdef long n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< + * cdef long nds = len(pds[0]) # number of steps in delaunay array + * cdef long maxdt = maxlen */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1015, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":1017 - * result = _memoryviewslice(None, 0, dtype_is_object) - * - * result.from_slice = memviewslice # <<<<<<<<<<<<<< - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - */ - __pyx_v_result->from_slice = __pyx_v_memviewslice; - - /* "View.MemoryView":1018 - * - * result.from_slice = memviewslice - * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< - * - * result.from_object = ( memviewslice.memview).base - */ - __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - - /* "View.MemoryView":1020 - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - * result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<< - * result.typeinfo = memviewslice.memview.typeinfo - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_result->from_object); - __Pyx_DECREF(__pyx_v_result->from_object); - __pyx_v_result->from_object = __pyx_t_2; - __pyx_t_2 = 0; - - /* "View.MemoryView":1021 - * - * result.from_object = ( memviewslice.memview).base - * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< - * - * result.view = memviewslice.memview.view - */ - __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; - __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - - /* "View.MemoryView":1023 - * result.typeinfo = memviewslice.memview.typeinfo - * - * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - */ - __pyx_t_5 = __pyx_v_memviewslice.memview->view; - __pyx_v_result->__pyx_base.view = __pyx_t_5; - - /* "View.MemoryView":1024 - * - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - */ - __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - - /* "View.MemoryView":1025 - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data - * result.view.ndim = ndim # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) - */ - __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - - /* "View.MemoryView":1026 - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) - * - */ - ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + __pyx_v_n = ((long)__pyx_t_1); - /* "View.MemoryView":1027 - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: + /* "newanalysis/helpers/correl.pyx":666 + * cdef long nmol = len(pdata)//pcorrdim # number of molecules + * cdef long n = len(pdata[0]) # number of time steps + * cdef long nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< + * cdef long maxdt = maxlen + * cdef long nshells = pnshells */ - Py_INCREF(Py_None); + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_nds = ((long)__pyx_t_1); - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: + /* "newanalysis/helpers/correl.pyx":667 + * cdef long n = len(pdata[0]) # number of time steps + * cdef long nds = len(pds[0]) # number of steps in delaunay array + * cdef long maxdt = maxlen # <<<<<<<<<<<<<< + * cdef long nshells = pnshells + * cdef long startskip = (n-maxdt)//startingpoints */ - __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_1) { + __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_v_maxlen); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 667, __pyx_L1_error) + __pyx_v_maxdt = ((long)__pyx_t_2); - /* "View.MemoryView":1030 - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: - * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< - * else: - * result.flags = PyBUF_RECORDS_RO + /* "newanalysis/helpers/correl.pyx":668 + * cdef long nds = len(pds[0]) # number of steps in delaunay array + * cdef long maxdt = maxlen + * cdef long nshells = pnshells # <<<<<<<<<<<<<< + * cdef long startskip = (n-maxdt)//startingpoints + * cdef long startmax = (n-maxdt)//startskip */ - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + __pyx_v_nshells = ((long)__pyx_v_pnshells); - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: + /* "newanalysis/helpers/correl.pyx":669 + * cdef long maxdt = maxlen + * cdef long nshells = pnshells + * cdef long startskip = (n-maxdt)//startingpoints # <<<<<<<<<<<<<< + * cdef long startmax = (n-maxdt)//startskip + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) */ - goto __pyx_L4; - } + __pyx_t_3 = __Pyx_PyInt_From_long(((long)(__pyx_v_n - __pyx_v_maxdt))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 669, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_FloorDivide(__pyx_t_3, __pyx_v_startingpoints); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 669, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_startskip = __pyx_t_2; - /* "View.MemoryView":1032 - * result.flags = PyBUF_RECORDS - * else: - * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< - * - * result.view.shape = result.from_slice.shape + /* "newanalysis/helpers/correl.pyx":670 + * cdef long nshells = pnshells + * cdef long startskip = (n-maxdt)//startingpoints + * cdef long startmax = (n-maxdt)//startskip # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) */ - /*else*/ { - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + __pyx_t_2 = (__pyx_v_n - __pyx_v_maxdt); + if (unlikely(__pyx_v_startskip == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 670, __pyx_L1_error) } - __pyx_L4:; + else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startskip == (long)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 670, __pyx_L1_error) + } + __pyx_v_startmax = __Pyx_div_long(__pyx_t_2, __pyx_v_startskip); - /* "View.MemoryView":1034 - * result.flags = PyBUF_RECORDS_RO - * - * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< - * result.view.strides = result.from_slice.strides - * + /* "newanalysis/helpers/correl.pyx":671 + * cdef long startskip = (n-maxdt)//startingpoints + * cdef long startmax = (n-maxdt)//startskip + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data */ - __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_pdata)}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 671, __pyx_L1_error) + __pyx_t_7 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 671, __pyx_L1_error) + } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_7 = 0; + __pyx_v_contdata = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "View.MemoryView":1035 - * - * result.view.shape = result.from_slice.shape - * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/correl.pyx":672 + * cdef long startmax = (n-maxdt)//startskip + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data */ - __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 672, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 672, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_pds)}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 672, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 672, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 672, __pyx_L1_error) + } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_8 = 0; + __pyx_v_contds = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "View.MemoryView":1038 - * - * - * result.view.suboffsets = NULL # <<<<<<<<<<<<<< - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: + /* "newanalysis/helpers/correl.pyx":673 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_v_result->__pyx_base.view.suboffsets = NULL; + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contdata)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L1_error) + __pyx_v_cdata = ((double *)__pyx_t_9); - /* "View.MemoryView":1039 - * - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets + /* "newanalysis/helpers/correl.pyx":674 + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data # <<<<<<<<<<<<<< + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_v_suboffset = (__pyx_t_6[0]); + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contds)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 674, __pyx_L1_error) + __pyx_v_cds = ((int *)__pyx_t_9); - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break + /* "newanalysis/helpers/correl.pyx":675 + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_1) { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4)) __PYX_ERR(0, 675, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5)) __PYX_ERR(0, 675, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10)) __PYX_ERR(0, 675, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_pcorr = __pyx_t_11; + __pyx_t_11 = 0; - /* "View.MemoryView":1041 - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< - * break - * + /* "newanalysis/helpers/correl.pyx":676 + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr */ - __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11)) __PYX_ERR(0, 676, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(0, 676, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_pselfcorr = __pyx_t_4; + __pyx_t_4 = 0; - /* "View.MemoryView":1042 - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - * break # <<<<<<<<<<<<<< - * - * result.view.len = result.view.itemsize + /* "newanalysis/helpers/correl.pyx":677 + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr */ - goto __pyx_L6_break; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4)) __PYX_ERR(0, 677, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5)) __PYX_ERR(0, 677, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10)) __PYX_ERR(0, 677, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_pcrosscorr = __pyx_t_11; + __pyx_t_11 = 0; - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break + /* "newanalysis/helpers/correl.pyx":678 + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr */ + if (!(likely(((__pyx_v_pcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 678, __pyx_L1_error) + __pyx_t_11 = __pyx_v_pcorr; + __Pyx_INCREF(__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 678, __pyx_L1_error) + } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; } } - __pyx_L6_break:; + __pyx_v_corr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; - /* "View.MemoryView":1044 - * break - * - * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< - * for length in result.view.shape[:ndim]: - * result.view.len *= length + /* "newanalysis/helpers/correl.pyx":679 + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + if (!(likely(((__pyx_v_pselfcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pselfcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 679, __pyx_L1_error) + __pyx_t_11 = __pyx_v_pselfcorr; + __Pyx_INCREF(__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_selfcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 679, __pyx_L1_error) + } else {__pyx_pybuffernd_selfcorr.diminfo[0].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfcorr.diminfo[0].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfcorr.diminfo[1].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfcorr.diminfo[1].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_selfcorr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; - /* "View.MemoryView":1045 - * - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< - * result.view.len *= length - * + /* "newanalysis/helpers/correl.pyx":680 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1045, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); - __pyx_t_2 = 0; + if (!(likely(((__pyx_v_pcrosscorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcrosscorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 680, __pyx_L1_error) + __pyx_t_11 = __pyx_v_pcrosscorr; + __Pyx_INCREF(__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_crosscorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 680, __pyx_L1_error) + } else {__pyx_pybuffernd_crosscorr.diminfo[0].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crosscorr.diminfo[0].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crosscorr.diminfo[1].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crosscorr.diminfo[1].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_crosscorr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; - /* "View.MemoryView":1046 - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: - * result.view.len *= length # <<<<<<<<<<<<<< - * - * result.to_object_func = to_object_func + /* "newanalysis/helpers/correl.pyx":681 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11)) __PYX_ERR(0, 681, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(0, 681, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 681, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 681, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 681, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 681, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; + } } + __pyx_t_12 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "View.MemoryView":1048 - * result.view.len *= length - * - * result.to_object_func = to_object_func # <<<<<<<<<<<<<< - * result.to_dtype_func = to_dtype_func - * + /* "newanalysis/helpers/correl.pyx":682 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data */ - __pyx_v_result->to_object_func = __pyx_v_to_object_func; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5)) __PYX_ERR(0, 682, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10)) __PYX_ERR(0, 682, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 682, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_selfctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 682, __pyx_L1_error) + } else {__pyx_pybuffernd_selfctr.diminfo[0].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfctr.diminfo[0].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfctr.diminfo[1].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfctr.diminfo[1].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_13 = 0; + __pyx_v_selfctr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; - /* "View.MemoryView":1049 - * - * result.to_object_func = to_object_func - * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< - * - * return result + /* "newanalysis/helpers/correl.pyx":683 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data */ - __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11)) __PYX_ERR(0, 683, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 683, __pyx_L1_error) + __pyx_t_14 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_crossctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 683, __pyx_L1_error) + } else {__pyx_pybuffernd_crossctr.diminfo[0].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crossctr.diminfo[0].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crossctr.diminfo[1].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crossctr.diminfo[1].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_14 = 0; + __pyx_v_crossctr = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "View.MemoryView":1051 - * result.to_dtype_func = to_dtype_func - * - * return result # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') + /* "newanalysis/helpers/correl.pyx":684 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_corr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 684, __pyx_L1_error) + __pyx_v_ccorr = ((double *)__pyx_t_9); - /* "View.MemoryView":1001 - * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), + /* "newanalysis/helpers/correl.pyx":685 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data # <<<<<<<<<<<<<< + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_selfcorr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 685, __pyx_L1_error) + __pyx_v_cselfcorr = ((double *)__pyx_t_9); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1054 - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj + /* "newanalysis/helpers/correl.pyx":686 + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data # <<<<<<<<<<<<<< + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_crosscorr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 686, __pyx_L1_error) + __pyx_v_ccrosscorr = ((double *)__pyx_t_9); -static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { - struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; - __Pyx_memviewslice *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "newanalysis/helpers/correl.pyx":687 + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< + * cdef double *cselfctr = selfctr.data + * cdef double *ccrossctr = crossctr.data */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L1_error) + __pyx_v_cctr = ((double *)__pyx_t_9); - /* "View.MemoryView":1058 - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): - * obj = memview # <<<<<<<<<<<<<< - * return &obj.from_slice - * else: + /* "newanalysis/helpers/correl.pyx":688 + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data # <<<<<<<<<<<<<< + * cdef double *ccrossctr = crossctr.data + * cdef double value */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1058, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_selfctr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 688, __pyx_L1_error) + __pyx_v_cselfctr = ((double *)__pyx_t_9); - /* "View.MemoryView":1059 - * if isinstance(memview, _memoryviewslice): - * obj = memview - * return &obj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, mslice) + /* "newanalysis/helpers/correl.pyx":689 + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data + * cdef double *ccrossctr = crossctr.data # <<<<<<<<<<<<<< + * cdef double value + * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart */ - __pyx_r = (&__pyx_v_obj->from_slice); - goto __pyx_L0; + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_crossctr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 689, __pyx_L1_error) + __pyx_v_ccrossctr = ((double *)__pyx_t_9); - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "newanalysis/helpers/correl.pyx":693 + * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart + * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for istart in range(startmax): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_2 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_16 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_16 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dim) lastprivate(__pyx_v_dsidx) firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_istart) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_validx) lastprivate(__pyx_v_value) + #endif /* _OPENMP */ + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){ + { + __pyx_v_dt = (long)(0 + 1 * __pyx_t_15); + /* Initialize private variables to invalid values */ + __pyx_v_dim = ((long)0xbad0bad0); + __pyx_v_dsidx = ((long)0xbad0bad0); + __pyx_v_idx = ((long)0xbad0bad0); + __pyx_v_istart = ((long)0xbad0bad0); + __pyx_v_mol = ((long)0xbad0bad0); + __pyx_v_shelldt = ((long)0xbad0bad0); + __pyx_v_shellstart = ((long)0xbad0bad0); + __pyx_v_start = ((long)0xbad0bad0); + __pyx_v_validx = ((long)0xbad0bad0); + __pyx_v_value = ((double)__PYX_NAN()); - /* "View.MemoryView":1061 - * return &obj.from_slice - * else: - * slice_copy(memview, mslice) # <<<<<<<<<<<<<< - * return mslice + /* "newanalysis/helpers/correl.pyx":694 * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for istart in range(startmax): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * start = istart*startskip */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + __pyx_t_17 = __pyx_v_startmax; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_istart = __pyx_t_19; - /* "View.MemoryView":1062 - * else: - * slice_copy(memview, mslice) - * return mslice # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_slice_copy') + /* "newanalysis/helpers/correl.pyx":695 + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for istart in range(startmax): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * start = istart*startskip + * dsidx = mol*nds+start */ - __pyx_r = __pyx_v_mslice; - goto __pyx_L0; - } + __pyx_t_20 = __pyx_v_nmol; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_mol = __pyx_t_22; - /* "View.MemoryView":1054 - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj + /* "newanalysis/helpers/correl.pyx":696 + * for istart in range(startmax): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * start = istart*startskip # <<<<<<<<<<<<<< + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 */ + __pyx_v_start = (__pyx_v_istart * __pyx_v_startskip); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_obj); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":697 + * for mol in range(nmol): # loop over molecules/entries + * start = istart*startskip + * dsidx = mol*nds+start # <<<<<<<<<<<<<< + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: + */ + __pyx_v_dsidx = ((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start); -/* "View.MemoryView":1065 - * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets + /* "newanalysis/helpers/correl.pyx":698 + * start = istart*startskip + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 # <<<<<<<<<<<<<< + * if shellstart < nshells: + * shelldt = cds[dsidx+dt]-1 */ + __pyx_v_shellstart = (((long)(__pyx_v_cds[__pyx_v_dsidx])) - 1); -static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { - int __pyx_v_dim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - Py_ssize_t *__pyx_v_suboffsets; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("slice_copy", 0); + /* "newanalysis/helpers/correl.pyx":699 + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): + */ + __pyx_t_23 = (__pyx_v_shellstart < __pyx_v_nshells); + if (__pyx_t_23) { - /* "View.MemoryView":1069 - * cdef (Py_ssize_t*) shape, strides, suboffsets - * - * shape = memview.view.shape # <<<<<<<<<<<<<< - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets + /* "newanalysis/helpers/correl.pyx":700 + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: + * shelldt = cds[dsidx+dt]-1 # <<<<<<<<<<<<<< + * for dim in range(corrdim): + * validx = mol*corrdim*n+dim*n+start */ - __pyx_t_1 = __pyx_v_memview->view.shape; - __pyx_v_shape = __pyx_t_1; + __pyx_v_shelldt = (((long)(__pyx_v_cds[(__pyx_v_dsidx + __pyx_v_dt)])) - 1); - /* "View.MemoryView":1070 - * - * shape = memview.view.shape - * strides = memview.view.strides # <<<<<<<<<<<<<< - * suboffsets = memview.view.suboffsets - * + /* "newanalysis/helpers/correl.pyx":701 + * if shellstart < nshells: + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): # <<<<<<<<<<<<<< + * validx = mol*corrdim*n+dim*n+start + * value = cdata[validx]*cdata[validx+dt] */ - __pyx_t_1 = __pyx_v_memview->view.strides; - __pyx_v_strides = __pyx_t_1; + __pyx_t_24 = __pyx_v_corrdim; + __pyx_t_25 = __pyx_t_24; + for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) { + __pyx_v_dim = __pyx_t_26; - /* "View.MemoryView":1071 - * shape = memview.view.shape - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< - * - * dst.memview = <__pyx_memoryview *> memview + /* "newanalysis/helpers/correl.pyx":702 + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): + * validx = mol*corrdim*n+dim*n+start # <<<<<<<<<<<<<< + * value = cdata[validx]*cdata[validx+dt] + * idx = maxdt*shellstart+dt */ - __pyx_t_1 = __pyx_v_memview->view.suboffsets; - __pyx_v_suboffsets = __pyx_t_1; + __pyx_v_validx = ((((__pyx_v_mol * __pyx_v_corrdim) * __pyx_v_n) + (__pyx_v_dim * __pyx_v_n)) + __pyx_v_start); - /* "View.MemoryView":1073 - * suboffsets = memview.view.suboffsets - * - * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< - * dst.data = memview.view.buf - * + /* "newanalysis/helpers/correl.pyx":703 + * for dim in range(corrdim): + * validx = mol*corrdim*n+dim*n+start + * value = cdata[validx]*cdata[validx+dt] # <<<<<<<<<<<<<< + * idx = maxdt*shellstart+dt + * ccorr[idx] += value */ - __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + __pyx_v_value = ((__pyx_v_cdata[__pyx_v_validx]) * (__pyx_v_cdata[(__pyx_v_validx + __pyx_v_dt)])); - /* "View.MemoryView":1074 - * - * dst.memview = <__pyx_memoryview *> memview - * dst.data = memview.view.buf # <<<<<<<<<<<<<< - * - * for dim in range(memview.view.ndim): + /* "newanalysis/helpers/correl.pyx":704 + * validx = mol*corrdim*n+dim*n+start + * value = cdata[validx]*cdata[validx+dt] + * idx = maxdt*shellstart+dt # <<<<<<<<<<<<<< + * ccorr[idx] += value + * cctr[idx] += 1 */ - __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + __pyx_v_idx = ((__pyx_v_maxdt * __pyx_v_shellstart) + __pyx_v_dt); - /* "View.MemoryView":1076 - * dst.data = memview.view.buf - * - * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] + /* "newanalysis/helpers/correl.pyx":705 + * value = cdata[validx]*cdata[validx+dt] + * idx = maxdt*shellstart+dt + * ccorr[idx] += value # <<<<<<<<<<<<<< + * cctr[idx] += 1 + * if shellstart == shelldt: */ - __pyx_t_2 = __pyx_v_memview->view.ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_dim = __pyx_t_4; + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_ccorr[__pyx_t_27]) = ((__pyx_v_ccorr[__pyx_t_27]) + __pyx_v_value); - /* "View.MemoryView":1077 - * - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + /* "newanalysis/helpers/correl.pyx":706 + * idx = maxdt*shellstart+dt + * ccorr[idx] += value + * cctr[idx] += 1 # <<<<<<<<<<<<<< + * if shellstart == shelldt: + * cselfcorr[idx] += value */ - (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_cctr[__pyx_t_27]) = ((__pyx_v_cctr[__pyx_t_27]) + 1.0); - /* "View.MemoryView":1078 - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 - * + /* "newanalysis/helpers/correl.pyx":707 + * ccorr[idx] += value + * cctr[idx] += 1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * cselfcorr[idx] += value + * cselfctr[idx] += 1 */ - (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + __pyx_t_23 = (__pyx_v_shellstart == __pyx_v_shelldt); + if (__pyx_t_23) { - /* "View.MemoryView":1079 - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":708 + * cctr[idx] += 1 + * if shellstart == shelldt: + * cselfcorr[idx] += value # <<<<<<<<<<<<<< + * cselfctr[idx] += 1 * - * @cname('__pyx_memoryview_copy_object') */ - if ((__pyx_v_suboffsets != 0)) { - __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); - } else { - __pyx_t_5 = -1L; - } - (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; - } + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_cselfcorr[__pyx_t_27]) = ((__pyx_v_cselfcorr[__pyx_t_27]) + __pyx_v_value); - /* "View.MemoryView":1065 + /* "newanalysis/helpers/correl.pyx":709 + * if shellstart == shelldt: + * cselfcorr[idx] += value + * cselfctr[idx] += 1 # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets + * for i in range(maxdt*nshells): */ + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_cselfctr[__pyx_t_27]) = ((__pyx_v_cselfctr[__pyx_t_27]) + 1.0); - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":1082 - * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice + /* "newanalysis/helpers/correl.pyx":707 + * ccorr[idx] += value + * cctr[idx] += 1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * cselfcorr[idx] += value + * cselfctr[idx] += 1 */ + } + } -static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { - __Pyx_memviewslice __pyx_v_memviewslice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy", 0); + /* "newanalysis/helpers/correl.pyx":699 + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): + */ + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1085 - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< - * return memoryview_copy_from_slice(memview, &memviewslice) + /* "newanalysis/helpers/correl.pyx":693 + * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for istart in range(startmax): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } - /* "View.MemoryView":1086 - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) - * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":711 + * cselfctr[idx] += 1 * - * @cname('__pyx_memoryview_copy_object_from_slice') + * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1086, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_16 = (__pyx_v_maxdt * __pyx_v_nshells); + __pyx_t_15 = __pyx_t_16; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_15; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":1082 + /* "newanalysis/helpers/correl.pyx":712 * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: */ + __pyx_t_23 = ((__pyx_v_cctr[__pyx_v_i]) != 0.0); + if (__pyx_t_23) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":713 + * for i in range(maxdt*nshells): + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< + * else: + * print('tot too sparse') + */ + __pyx_t_17 = __pyx_v_i; + if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 713, __pyx_L1_error) + } + (__pyx_v_ccorr[__pyx_t_17]) = ((__pyx_v_ccorr[__pyx_t_17]) / (__pyx_v_cctr[__pyx_v_i])); -/* "View.MemoryView":1089 + /* "newanalysis/helpers/correl.pyx":712 * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: */ + goto __pyx_L22; + } -static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { - PyObject *(*__pyx_v_to_object_func)(char *); - int (*__pyx_v_to_dtype_func)(char *, PyObject *); - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *(*__pyx_t_3)(char *); - int (*__pyx_t_4)(char *, PyObject *); - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + /* "newanalysis/helpers/correl.pyx":715 + * ccorr[i] /= cctr[i] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if cselfctr[i] != 0: + * cselfcorr[i] /= cselfctr[i] + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 715, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L22:; - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + /* "newanalysis/helpers/correl.pyx":716 + * else: + * print('tot too sparse') + * if cselfctr[i] != 0: # <<<<<<<<<<<<<< + * cselfcorr[i] /= cselfctr[i] + * else: */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_23 = ((__pyx_v_cselfctr[__pyx_v_i]) != 0.0); + if (__pyx_t_23) { - /* "View.MemoryView":1097 - * - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: + /* "newanalysis/helpers/correl.pyx":717 + * print('tot too sparse') + * if cselfctr[i] != 0: + * cselfcorr[i] /= cselfctr[i] # <<<<<<<<<<<<<< + * else: + * print('self too sparse') */ - __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; - __pyx_v_to_object_func = __pyx_t_3; + __pyx_t_17 = __pyx_v_i; + if (unlikely((__pyx_v_cselfctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 717, __pyx_L1_error) + } + (__pyx_v_cselfcorr[__pyx_t_17]) = ((__pyx_v_cselfcorr[__pyx_t_17]) / (__pyx_v_cselfctr[__pyx_v_i])); - /* "View.MemoryView":1098 - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< - * else: - * to_object_func = NULL + /* "newanalysis/helpers/correl.pyx":716 + * else: + * print('tot too sparse') + * if cselfctr[i] != 0: # <<<<<<<<<<<<<< + * cselfcorr[i] /= cselfctr[i] + * else: */ - __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; - __pyx_v_to_dtype_func = __pyx_t_4; + goto __pyx_L23; + } - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 + /* "newanalysis/helpers/correl.pyx":719 + * cselfcorr[i] /= cselfctr[i] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * for i in range(maxdt*nshells): */ - goto __pyx_L3; + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 719, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L23:; } - /* "View.MemoryView":1100 - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - * to_object_func = NULL # <<<<<<<<<<<<<< - * to_dtype_func = NULL + /* "newanalysis/helpers/correl.pyx":721 + * print('self too sparse') * + * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] + * ccrossctr[i] = cctr[i] - cselfctr[i] */ - /*else*/ { - __pyx_v_to_object_func = NULL; + __pyx_t_16 = (__pyx_v_maxdt * __pyx_v_nshells); + __pyx_t_15 = __pyx_t_16; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_15; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":1101 - * else: - * to_object_func = NULL - * to_dtype_func = NULL # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":722 + * + * for i in range(maxdt*nshells): + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] # <<<<<<<<<<<<<< + * ccrossctr[i] = cctr[i] - cselfctr[i] * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, */ - __pyx_v_to_dtype_func = NULL; - } - __pyx_L3:; + (__pyx_v_ccrosscorr[__pyx_v_i]) = ((__pyx_v_ccorr[__pyx_v_i]) - (__pyx_v_cselfcorr[__pyx_v_i])); - /* "View.MemoryView":1103 - * to_dtype_func = NULL + /* "newanalysis/helpers/correl.pyx":723 + * for i in range(maxdt*nshells): + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] + * ccrossctr[i] = cctr[i] - cselfctr[i] # <<<<<<<<<<<<<< * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< - * to_object_func, to_dtype_func, - * memview.dtype_is_object) + * return corr,selfcorr,crosscorr */ - __Pyx_XDECREF(__pyx_r); + (__pyx_v_ccrossctr[__pyx_v_i]) = ((__pyx_v_cctr[__pyx_v_i]) - (__pyx_v_cselfctr[__pyx_v_i])); + } - /* "View.MemoryView":1105 - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - * to_object_func, to_dtype_func, - * memview.dtype_is_object) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":725 + * ccrossctr[i] = cctr[i] - cselfctr[i] + * + * return corr,selfcorr,crosscorr # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF((PyObject *)__pyx_v_corr); + __Pyx_GIVEREF((PyObject *)__pyx_v_corr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_corr))) __PYX_ERR(0, 725, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_selfcorr); + __Pyx_GIVEREF((PyObject *)__pyx_v_selfcorr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_selfcorr))) __PYX_ERR(0, 725, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_crosscorr); + __Pyx_GIVEREF((PyObject *)__pyx_v_crosscorr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_crosscorr))) __PYX_ERR(0, 725, __pyx_L1_error); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "View.MemoryView":1089 + /* "newanalysis/helpers/correl.pyx":655 + * return corr * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkthincorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_contdata); + __Pyx_XDECREF((PyObject *)__pyx_v_contds); + __Pyx_XDECREF(__pyx_v_pcorr); + __Pyx_XDECREF(__pyx_v_pselfcorr); + __Pyx_XDECREF(__pyx_v_pcrosscorr); + __Pyx_XDECREF((PyObject *)__pyx_v_corr); + __Pyx_XDECREF((PyObject *)__pyx_v_selfcorr); + __Pyx_XDECREF((PyObject *)__pyx_v_crosscorr); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XDECREF((PyObject *)__pyx_v_selfctr); + __Pyx_XDECREF((PyObject *)__pyx_v_crossctr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1111 +/* "newanalysis/helpers/correl.pyx":728 * * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, */ -static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { - Py_ssize_t __pyx_r; - int __pyx_t_1; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_25sparsefullnobulkthingreenkubo(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_25sparsefullnobulkthingreenkubo = {"sparsefullnobulkthingreenkubo", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_25sparsefullnobulkthingreenkubo, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_25sparsefullnobulkthingreenkubo(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_pdata = 0; + int __pyx_v_pcorrdim; + PyArrayObject *__pyx_v_pds = 0; + int __pyx_v_pnshells; + PyObject *__pyx_v_maxlen = 0; + PyObject *__pyx_v_startingpoints = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sparsefullnobulkthingreenkubo (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 728, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_pcorrdim,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,&__pyx_n_s_startingpoints,0}; - /* "View.MemoryView":1112 + /* "newanalysis/helpers/correl.pyx":733 + * np.ndarray[np.int32_t,ndim=2] pds, + * int pnshells, + * maxlen=None, # <<<<<<<<<<<<<< + * startingpoints=None): * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: - */ - __pyx_t_1 = ((__pyx_v_arg < 0) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1113 - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: - * return -arg # <<<<<<<<<<<<<< - * else: - * return arg */ - __pyx_r = (-__pyx_v_arg); - goto __pyx_L0; + values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); - /* "View.MemoryView":1112 + /* "newanalysis/helpers/correl.pyx":734 + * int pnshells, + * maxlen=None, + * startingpoints=None): # <<<<<<<<<<<<<< * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: + * cdef long corrdim = pcorrdim */ + values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pdata)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 728, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pcorrdim)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 728, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthingreenkubo", 0, 4, 6, 1); __PYX_ERR(0, 728, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 728, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthingreenkubo", 0, 4, 6, 2); __PYX_ERR(0, 728, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pnshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 728, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthingreenkubo", 0, 4, 6, 3); __PYX_ERR(0, 728, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 728, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_startingpoints); + if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 728, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sparsefullnobulkthingreenkubo") < 0)) __PYX_ERR(0, 728, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_pdata = ((PyArrayObject *)values[0]); + __pyx_v_pcorrdim = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_pcorrdim == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 730, __pyx_L3_error) + __pyx_v_pds = ((PyArrayObject *)values[2]); + __pyx_v_pnshells = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 732, __pyx_L3_error) + __pyx_v_maxlen = values[4]; + __pyx_v_startingpoints = values[5]; } - - /* "View.MemoryView":1115 - * return -arg - * else: - * return arg # <<<<<<<<<<<<<< - * - * @cname('__pyx_get_best_slice_order') - */ - /*else*/ { - __pyx_r = __pyx_v_arg; - goto __pyx_L0; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sparsefullnobulkthingreenkubo", 0, 4, 6, __pyx_nargs); __PYX_ERR(0, 728, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkthingreenkubo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 729, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 731, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_24sparsefullnobulkthingreenkubo(__pyx_self, __pyx_v_pdata, __pyx_v_pcorrdim, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen, __pyx_v_startingpoints); - /* "View.MemoryView":1111 + /* "newanalysis/helpers/correl.pyx":728 * * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, */ /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1118 - * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. - */ - -static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { - int __pyx_v_i; - Py_ssize_t __pyx_v_c_stride; - Py_ssize_t __pyx_v_f_stride; - char __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1123 - * """ - * cdef int i - * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< - * cdef Py_ssize_t f_stride = 0 - * - */ - __pyx_v_c_stride = 0; - - /* "View.MemoryView":1124 - * cdef int i - * cdef Py_ssize_t c_stride = 0 - * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): - */ - __pyx_v_f_stride = 0; - - /* "View.MemoryView":1126 - * cdef Py_ssize_t f_stride = 0 - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; - - /* "View.MemoryView":1127 - * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break - */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1128 - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1129 - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< - * - * for i in range(ndim): - */ - goto __pyx_L4_break; - - /* "View.MemoryView":1127 - * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break - */ - } +static PyObject *__pyx_pf_11newanalysis_6correl_24sparsefullnobulkthingreenkubo(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, int __pyx_v_pcorrdim, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_startingpoints) { + long __pyx_v_corrdim; + long __pyx_v_nmol; + long __pyx_v_n; + long __pyx_v_nds; + long __pyx_v_maxdt; + long __pyx_v_nshells; + long __pyx_v_startskip; + long __pyx_v_startmax; + PyArrayObject *__pyx_v_contdata = 0; + PyArrayObject *__pyx_v_contds = 0; + double *__pyx_v_cdata; + int *__pyx_v_cds; + PyObject *__pyx_v_pcorr = NULL; + PyObject *__pyx_v_pselfcorr = NULL; + PyObject *__pyx_v_pcrosscorr = NULL; + PyArrayObject *__pyx_v_corr = 0; + PyArrayObject *__pyx_v_selfcorr = 0; + PyArrayObject *__pyx_v_crosscorr = 0; + PyArrayObject *__pyx_v_ctr = 0; + PyArrayObject *__pyx_v_selfctr = 0; + PyArrayObject *__pyx_v_crossctr = 0; + double *__pyx_v_ccorr; + double *__pyx_v_cselfcorr; + double *__pyx_v_ccrosscorr; + double *__pyx_v_cctr; + double *__pyx_v_cselfctr; + double *__pyx_v_ccrossctr; + double __pyx_v_value; + double __pyx_v_tempvalue; + long __pyx_v_i; + long __pyx_v_start; + long __pyx_v_dt; + long __pyx_v_mol; + long __pyx_v_shellstart; + long __pyx_v_shelldt; + long __pyx_v_idx; + long __pyx_v_dim; + long __pyx_v_validx; + long __pyx_v_dsidx; + long __pyx_v_istart; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; + __Pyx_Buffer __pyx_pybuffer_contdata; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; + __Pyx_Buffer __pyx_pybuffer_contds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; + __Pyx_Buffer __pyx_pybuffer_corr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_crosscorr; + __Pyx_Buffer __pyx_pybuffer_crosscorr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_crossctr; + __Pyx_Buffer __pyx_pybuffer_crossctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; + __Pyx_Buffer __pyx_pybuffer_pdata; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; + __Pyx_Buffer __pyx_pybuffer_pds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_selfcorr; + __Pyx_Buffer __pyx_pybuffer_selfcorr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_selfctr; + __Pyx_Buffer __pyx_pybuffer_selfctr; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + long __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + PyArrayObject *__pyx_t_14 = NULL; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + long __pyx_t_20; + long __pyx_t_21; + long __pyx_t_22; + int __pyx_t_23; + long __pyx_t_24; + long __pyx_t_25; + long __pyx_t_26; + long __pyx_t_27; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sparsefullnobulkthingreenkubo", 0); + __pyx_pybuffer_contdata.pybuffer.buf = NULL; + __pyx_pybuffer_contdata.refcount = 0; + __pyx_pybuffernd_contdata.data = NULL; + __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; + __pyx_pybuffer_contds.pybuffer.buf = NULL; + __pyx_pybuffer_contds.refcount = 0; + __pyx_pybuffernd_contds.data = NULL; + __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; + __pyx_pybuffer_corr.pybuffer.buf = NULL; + __pyx_pybuffer_corr.refcount = 0; + __pyx_pybuffernd_corr.data = NULL; + __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; + __pyx_pybuffer_selfcorr.pybuffer.buf = NULL; + __pyx_pybuffer_selfcorr.refcount = 0; + __pyx_pybuffernd_selfcorr.data = NULL; + __pyx_pybuffernd_selfcorr.rcbuffer = &__pyx_pybuffer_selfcorr; + __pyx_pybuffer_crosscorr.pybuffer.buf = NULL; + __pyx_pybuffer_crosscorr.refcount = 0; + __pyx_pybuffernd_crosscorr.data = NULL; + __pyx_pybuffernd_crosscorr.rcbuffer = &__pyx_pybuffer_crosscorr; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_selfctr.pybuffer.buf = NULL; + __pyx_pybuffer_selfctr.refcount = 0; + __pyx_pybuffernd_selfctr.data = NULL; + __pyx_pybuffernd_selfctr.rcbuffer = &__pyx_pybuffer_selfctr; + __pyx_pybuffer_crossctr.pybuffer.buf = NULL; + __pyx_pybuffer_crossctr.refcount = 0; + __pyx_pybuffernd_crossctr.data = NULL; + __pyx_pybuffernd_crossctr.rcbuffer = &__pyx_pybuffer_crossctr; + __pyx_pybuffer_pdata.pybuffer.buf = NULL; + __pyx_pybuffer_pdata.refcount = 0; + __pyx_pybuffernd_pdata.data = NULL; + __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; + __pyx_pybuffer_pds.pybuffer.buf = NULL; + __pyx_pybuffer_pds.refcount = 0; + __pyx_pybuffernd_pds.data = NULL; + __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 728, __pyx_L1_error) } - __pyx_L4_break:; - - /* "View.MemoryView":1131 - * break - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - */ - __pyx_t_1 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_1; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1132 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break - */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1133 - * for i in range(ndim): - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1134 - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - */ - goto __pyx_L7_break; - - /* "View.MemoryView":1132 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break - */ - } + __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 728, __pyx_L1_error) } - __pyx_L7_break:; - - /* "View.MemoryView":1136 - * break - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: - */ - __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0); - if (__pyx_t_2) { + __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; - /* "View.MemoryView":1137 + /* "newanalysis/helpers/correl.pyx":736 + * startingpoints=None): * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - * return 'C' # <<<<<<<<<<<<<< - * else: - * return 'F' + * cdef long corrdim = pcorrdim # <<<<<<<<<<<<<< + * cdef long nmol = len(pdata)//pcorrdim # number of molecules + * cdef long n = len(pdata[0]) # number of time steps */ - __pyx_r = 'C'; - goto __pyx_L0; + __pyx_v_corrdim = ((long)__pyx_v_pcorrdim); - /* "View.MemoryView":1136 - * break + /* "newanalysis/helpers/correl.pyx":737 * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: + * cdef long corrdim = pcorrdim + * cdef long nmol = len(pdata)//pcorrdim # number of molecules # <<<<<<<<<<<<<< + * cdef long n = len(pdata[0]) # number of time steps + * cdef long nds = len(pds[0]) # number of steps in delaunay array */ + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 737, __pyx_L1_error) + __pyx_t_2 = ((long)__pyx_t_1); + if (unlikely(__pyx_v_pcorrdim == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 737, __pyx_L1_error) } - - /* "View.MemoryView":1139 - * return 'C' - * else: - * return 'F' # <<<<<<<<<<<<<< - * - * @cython.cdivision(True) - */ - /*else*/ { - __pyx_r = 'F'; - goto __pyx_L0; + else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_pcorrdim == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 737, __pyx_L1_error) } + __pyx_v_nmol = __Pyx_div_long(__pyx_t_2, __pyx_v_pcorrdim); - /* "View.MemoryView":1118 - * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. + /* "newanalysis/helpers/correl.pyx":738 + * cdef long corrdim = pcorrdim + * cdef long nmol = len(pdata)//pcorrdim # number of molecules + * cdef long n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< + * cdef long nds = len(pds[0]) # number of steps in delaunay array + * cdef long maxdt = maxlen */ + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 738, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_n = ((long)__pyx_t_1); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1142 - * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + /* "newanalysis/helpers/correl.pyx":739 + * cdef long nmol = len(pdata)//pcorrdim # number of molecules + * cdef long n = len(pdata[0]) # number of time steps + * cdef long nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< + * cdef long maxdt = maxlen + * cdef long nshells = pnshells */ + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 739, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 739, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_nds = ((long)__pyx_t_1); -static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; - Py_ssize_t __pyx_v_dst_extent; - Py_ssize_t __pyx_v_src_stride; - Py_ssize_t __pyx_v_dst_stride; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - - /* "View.MemoryView":1149 - * - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] + /* "newanalysis/helpers/correl.pyx":740 + * cdef long n = len(pdata[0]) # number of time steps + * cdef long nds = len(pds[0]) # number of steps in delaunay array + * cdef long maxdt = maxlen # <<<<<<<<<<<<<< + * cdef long nshells = pnshells + * cdef long startskip = (n-maxdt)//startingpoints */ - __pyx_v_src_extent = (__pyx_v_src_shape[0]); + __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_v_maxlen); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 740, __pyx_L1_error) + __pyx_v_maxdt = ((long)__pyx_t_2); - /* "View.MemoryView":1150 - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] + /* "newanalysis/helpers/correl.pyx":741 + * cdef long nds = len(pds[0]) # number of steps in delaunay array + * cdef long maxdt = maxlen + * cdef long nshells = pnshells # <<<<<<<<<<<<<< + * cdef long startskip = (n-maxdt)//startingpoints + * cdef long startmax = (n-maxdt)//startskip */ - __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + __pyx_v_nshells = ((long)__pyx_v_pnshells); - /* "View.MemoryView":1151 - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_stride = dst_strides[0] - * + /* "newanalysis/helpers/correl.pyx":742 + * cdef long maxdt = maxlen + * cdef long nshells = pnshells + * cdef long startskip = (n-maxdt)//startingpoints # <<<<<<<<<<<<<< + * cdef long startmax = (n-maxdt)//startskip + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) */ - __pyx_v_src_stride = (__pyx_v_src_strides[0]); + __pyx_t_3 = __Pyx_PyInt_From_long(((long)(__pyx_v_n - __pyx_v_maxdt))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_FloorDivide(__pyx_t_3, __pyx_v_startingpoints); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 742, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 742, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_startskip = __pyx_t_2; - /* "View.MemoryView":1152 - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: + /* "newanalysis/helpers/correl.pyx":743 + * cdef long nshells = pnshells + * cdef long startskip = (n-maxdt)//startingpoints + * cdef long startmax = (n-maxdt)//startskip # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) */ - __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + __pyx_t_2 = (__pyx_v_n - __pyx_v_maxdt); + if (unlikely(__pyx_v_startskip == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 743, __pyx_L1_error) + } + else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startskip == (long)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_2))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 743, __pyx_L1_error) + } + __pyx_v_startmax = __Pyx_div_long(__pyx_t_2, __pyx_v_startskip); - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): + /* "newanalysis/helpers/correl.pyx":744 + * cdef long startskip = (n-maxdt)//startingpoints + * cdef long startmax = (n-maxdt)//startskip + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 744, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 744, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_pdata)}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 744, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 744, __pyx_L1_error) + __pyx_t_7 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 744, __pyx_L1_error) + } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_7 = 0; + __pyx_v_contdata = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "View.MemoryView":1155 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + /* "newanalysis/helpers/correl.pyx":745 + * cdef long startmax = (n-maxdt)//startskip + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data */ - __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; } - __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_pds)}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 745, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 745, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 745, __pyx_L1_error) + } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; } + } + __pyx_t_8 = 0; + __pyx_v_contds = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "View.MemoryView":1156 - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: + /* "newanalysis/helpers/correl.pyx":746 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); - if (__pyx_t_2) { - __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); - } - __pyx_t_3 = (__pyx_t_2 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L5_bool_binop_done:; + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contdata)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 746, __pyx_L1_error) + __pyx_v_cdata = ((double *)__pyx_t_9); - /* "View.MemoryView":1155 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + /* "newanalysis/helpers/correl.pyx":747 + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data # <<<<<<<<<<<<<< + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) */ - if (__pyx_t_1) { + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contds)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 747, __pyx_L1_error) + __pyx_v_cds = ((int *)__pyx_t_9); - /* "View.MemoryView":1157 - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): + /* "newanalysis/helpers/correl.pyx":748 + * cdef double *cdata = contdata.data + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4)) __PYX_ERR(0, 748, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5)) __PYX_ERR(0, 748, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10)) __PYX_ERR(0, 748, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_pcorr = __pyx_t_11; + __pyx_t_11 = 0; - /* "View.MemoryView":1155 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + /* "newanalysis/helpers/correl.pyx":749 + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr */ - goto __pyx_L4; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11)) __PYX_ERR(0, 749, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(0, 749, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 749, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 749, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_pselfcorr = __pyx_t_4; + __pyx_t_4 = 0; + + /* "newanalysis/helpers/correl.pyx":750 + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5)) __PYX_ERR(0, 750, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10)) __PYX_ERR(0, 750, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_pcrosscorr = __pyx_t_11; + __pyx_t_11 = 0; + + /* "newanalysis/helpers/correl.pyx":751 + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + */ + if (!(likely(((__pyx_v_pcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 751, __pyx_L1_error) + __pyx_t_11 = __pyx_v_pcorr; + __Pyx_INCREF(__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 751, __pyx_L1_error) + } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; } + } + __pyx_v_corr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; - /* "View.MemoryView":1159 - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride + /* "newanalysis/helpers/correl.pyx":752 + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1160 - * else: - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< - * src_data += src_stride - * dst_data += dst_stride + if (!(likely(((__pyx_v_pselfcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pselfcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 752, __pyx_L1_error) + __pyx_t_11 = __pyx_v_pselfcorr; + __Pyx_INCREF(__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_selfcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 752, __pyx_L1_error) + } else {__pyx_pybuffernd_selfcorr.diminfo[0].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfcorr.diminfo[0].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfcorr.diminfo[1].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfcorr.diminfo[1].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_selfcorr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; + + /* "newanalysis/helpers/correl.pyx":753 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + if (!(likely(((__pyx_v_pcrosscorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcrosscorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 753, __pyx_L1_error) + __pyx_t_11 = __pyx_v_pcrosscorr; + __Pyx_INCREF(__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_crosscorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 753, __pyx_L1_error) + } else {__pyx_pybuffernd_crosscorr.diminfo[0].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crosscorr.diminfo[0].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crosscorr.diminfo[1].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crosscorr.diminfo[1].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_crosscorr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; - /* "View.MemoryView":1161 - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * else: + /* "newanalysis/helpers/correl.pyx":754 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11)) __PYX_ERR(0, 754, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(0, 754, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 754, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 754, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_12 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "View.MemoryView":1162 - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): + /* "newanalysis/helpers/correl.pyx":755 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4)) __PYX_ERR(0, 755, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5)) __PYX_ERR(0, 755, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10)) __PYX_ERR(0, 755, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 755, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_11); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_selfctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 755, __pyx_L1_error) + } else {__pyx_pybuffernd_selfctr.diminfo[0].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfctr.diminfo[0].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfctr.diminfo[1].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfctr.diminfo[1].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[1]; } - __pyx_L4:; - - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - */ - goto __pyx_L3; } + __pyx_t_13 = 0; + __pyx_v_selfctr = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; - /* "View.MemoryView":1164 - * dst_data += dst_stride - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * _copy_strided_to_strided(src_data, src_strides + 1, - * dst_data, dst_strides + 1, - */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1165 - * else: - * for i in range(dst_extent): - * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< - * dst_data, dst_strides + 1, - * src_shape + 1, dst_shape + 1, - */ - _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - - /* "View.MemoryView":1169 - * src_shape + 1, dst_shape + 1, - * ndim - 1, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * - */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - - /* "View.MemoryView":1170 - * ndim - 1, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, + /* "newanalysis/helpers/correl.pyx":756 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11)) __PYX_ERR(0, 756, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(0, 756, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 756, __pyx_L1_error) + __pyx_t_14 = ((PyArrayObject *)__pyx_t_4); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_crossctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 756, __pyx_L1_error) + } else {__pyx_pybuffernd_crossctr.diminfo[0].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crossctr.diminfo[0].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crossctr.diminfo[1].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crossctr.diminfo[1].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[1]; } } - __pyx_L3:; - - /* "View.MemoryView":1142 - * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, - */ - - /* function exit code */ -} + __pyx_t_14 = 0; + __pyx_v_crossctr = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; -/* "View.MemoryView":1172 - * dst_data += dst_stride - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + /* "newanalysis/helpers/correl.pyx":757 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_corr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 757, __pyx_L1_error) + __pyx_v_ccorr = ((double *)__pyx_t_9); -static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - - /* "View.MemoryView":1175 - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: - * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< - * src.shape, dst.shape, ndim, itemsize) - * + /* "newanalysis/helpers/correl.pyx":758 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data # <<<<<<<<<<<<<< + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data */ - _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_selfcorr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 758, __pyx_L1_error) + __pyx_v_cselfcorr = ((double *)__pyx_t_9); - /* "View.MemoryView":1172 - * dst_data += dst_stride - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + /* "newanalysis/helpers/correl.pyx":759 + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data # <<<<<<<<<<<<<< + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_crosscorr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 759, __pyx_L1_error) + __pyx_v_ccrosscorr = ((double *)__pyx_t_9); - /* function exit code */ -} - -/* "View.MemoryView":1179 - * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + /* "newanalysis/helpers/correl.pyx":760 + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< + * cdef double *cselfctr = selfctr.data + * cdef double *ccrossctr = crossctr.data */ + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 760, __pyx_L1_error) + __pyx_v_cctr = ((double *)__pyx_t_9); -static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_size; - Py_ssize_t __pyx_r; - Py_ssize_t __pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - - /* "View.MemoryView":1181 - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< - * - * for shape in src.shape[:ndim]: + /* "newanalysis/helpers/correl.pyx":761 + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data # <<<<<<<<<<<<<< + * cdef double *ccrossctr = crossctr.data + * cdef double value,tempvalue */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_size = __pyx_t_1; + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_selfctr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 761, __pyx_L1_error) + __pyx_v_cselfctr = ((double *)__pyx_t_9); - /* "View.MemoryView":1183 - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - * - * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< - * size *= shape - * + /* "newanalysis/helpers/correl.pyx":762 + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data + * cdef double *ccrossctr = crossctr.data # <<<<<<<<<<<<<< + * cdef double value,tempvalue + * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart */ - __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); - for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_shape = (__pyx_t_2[0]); + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_crossctr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 762, __pyx_L1_error) + __pyx_v_ccrossctr = ((double *)__pyx_t_9); - /* "View.MemoryView":1184 - * - * for shape in src.shape[:ndim]: - * size *= shape # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":766 + * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart * - * return size + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for istart in range(startmax): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_v_size = (__pyx_v_size * __pyx_v_shape); - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_2 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_16 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_16 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dim) lastprivate(__pyx_v_dsidx) firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_istart) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_tempvalue) lastprivate(__pyx_v_validx) lastprivate(__pyx_v_value) + #endif /* _OPENMP */ + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){ + { + __pyx_v_dt = (long)(0 + 1 * __pyx_t_15); + /* Initialize private variables to invalid values */ + __pyx_v_dim = ((long)0xbad0bad0); + __pyx_v_dsidx = ((long)0xbad0bad0); + __pyx_v_idx = ((long)0xbad0bad0); + __pyx_v_istart = ((long)0xbad0bad0); + __pyx_v_mol = ((long)0xbad0bad0); + __pyx_v_shelldt = ((long)0xbad0bad0); + __pyx_v_shellstart = ((long)0xbad0bad0); + __pyx_v_start = ((long)0xbad0bad0); + __pyx_v_tempvalue = ((double)__PYX_NAN()); + __pyx_v_validx = ((long)0xbad0bad0); + __pyx_v_value = ((double)__PYX_NAN()); - /* "View.MemoryView":1186 - * size *= shape + /* "newanalysis/helpers/correl.pyx":767 * - * return size # <<<<<<<<<<<<<< - * - * @cname('__pyx_fill_contig_strides_array') + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for istart in range(startmax): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * start = istart*startskip */ - __pyx_r = __pyx_v_size; - goto __pyx_L0; + __pyx_t_17 = __pyx_v_startmax; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_istart = __pyx_t_19; - /* "View.MemoryView":1179 - * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + /* "newanalysis/helpers/correl.pyx":768 + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for istart in range(startmax): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * start = istart*startskip + * dsidx = mol*nds+start */ + __pyx_t_20 = __pyx_v_nmol; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_mol = __pyx_t_22; - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1189 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + /* "newanalysis/helpers/correl.pyx":769 + * for istart in range(startmax): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * start = istart*startskip # <<<<<<<<<<<<<< + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 */ + __pyx_v_start = (__pyx_v_istart * __pyx_v_startskip); -static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { - int __pyx_v_idx; - Py_ssize_t __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1198 - * cdef int idx - * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride + /* "newanalysis/helpers/correl.pyx":770 + * for mol in range(nmol): # loop over molecules/entries + * start = istart*startskip + * dsidx = mol*nds+start # <<<<<<<<<<<<<< + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: */ - __pyx_t_1 = ((__pyx_v_order == 'F') != 0); - if (__pyx_t_1) { + __pyx_v_dsidx = ((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start); - /* "View.MemoryView":1199 - * - * if order == 'F': - * for idx in range(ndim): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] + /* "newanalysis/helpers/correl.pyx":771 + * start = istart*startskip + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 # <<<<<<<<<<<<<< + * if shellstart < nshells: + * shelldt = cds[dsidx+dt]-1 */ - __pyx_t_2 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_idx = __pyx_t_4; + __pyx_v_shellstart = (((long)(__pyx_v_cds[__pyx_v_dsidx])) - 1); - /* "View.MemoryView":1200 - * if order == 'F': - * for idx in range(ndim): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * else: + /* "newanalysis/helpers/correl.pyx":772 + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + __pyx_t_23 = (__pyx_v_shellstart < __pyx_v_nshells); + if (__pyx_t_23) { - /* "View.MemoryView":1201 - * for idx in range(ndim): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * else: - * for idx in range(ndim - 1, -1, -1): + /* "newanalysis/helpers/correl.pyx":773 + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: + * shelldt = cds[dsidx+dt]-1 # <<<<<<<<<<<<<< + * for dim in range(corrdim): + * validx = mol*corrdim*n+dim*n+start */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } + __pyx_v_shelldt = (((long)(__pyx_v_cds[(__pyx_v_dsidx + __pyx_v_dt)])) - 1); - /* "View.MemoryView":1198 - * cdef int idx - * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride + /* "newanalysis/helpers/correl.pyx":774 + * if shellstart < nshells: + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): # <<<<<<<<<<<<<< + * validx = mol*corrdim*n+dim*n+start + * tempvalue = cdata[validx+dt]-cdata[validx] */ - goto __pyx_L3; - } + __pyx_t_24 = __pyx_v_corrdim; + __pyx_t_25 = __pyx_t_24; + for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) { + __pyx_v_dim = __pyx_t_26; - /* "View.MemoryView":1203 - * stride *= shape[idx] - * else: - * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] + /* "newanalysis/helpers/correl.pyx":775 + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): + * validx = mol*corrdim*n+dim*n+start # <<<<<<<<<<<<<< + * tempvalue = cdata[validx+dt]-cdata[validx] + * value = tempvalue*tempvalue */ - /*else*/ { - for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { - __pyx_v_idx = __pyx_t_2; + __pyx_v_validx = ((((__pyx_v_mol * __pyx_v_corrdim) * __pyx_v_n) + (__pyx_v_dim * __pyx_v_n)) + __pyx_v_start); - /* "View.MemoryView":1204 - * else: - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * + /* "newanalysis/helpers/correl.pyx":776 + * for dim in range(corrdim): + * validx = mol*corrdim*n+dim*n+start + * tempvalue = cdata[validx+dt]-cdata[validx] # <<<<<<<<<<<<<< + * value = tempvalue*tempvalue + * idx = maxdt*shellstart+dt */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + __pyx_v_tempvalue = ((__pyx_v_cdata[(__pyx_v_validx + __pyx_v_dt)]) - (__pyx_v_cdata[__pyx_v_validx])); - /* "View.MemoryView":1205 - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * - * return stride + /* "newanalysis/helpers/correl.pyx":777 + * validx = mol*corrdim*n+dim*n+start + * tempvalue = cdata[validx+dt]-cdata[validx] + * value = tempvalue*tempvalue # <<<<<<<<<<<<<< + * idx = maxdt*shellstart+dt + * ccorr[idx] += value */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } - } - __pyx_L3:; + __pyx_v_value = (__pyx_v_tempvalue * __pyx_v_tempvalue); - /* "View.MemoryView":1207 - * stride *= shape[idx] - * - * return stride # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_data_to_temp') + /* "newanalysis/helpers/correl.pyx":778 + * tempvalue = cdata[validx+dt]-cdata[validx] + * value = tempvalue*tempvalue + * idx = maxdt*shellstart+dt # <<<<<<<<<<<<<< + * ccorr[idx] += value + * cctr[idx] += 1 */ - __pyx_r = __pyx_v_stride; - goto __pyx_L0; + __pyx_v_idx = ((__pyx_v_maxdt * __pyx_v_shellstart) + __pyx_v_dt); - /* "View.MemoryView":1189 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + /* "newanalysis/helpers/correl.pyx":779 + * value = tempvalue*tempvalue + * idx = maxdt*shellstart+dt + * ccorr[idx] += value # <<<<<<<<<<<<<< + * cctr[idx] += 1 + * if shellstart == shelldt: */ + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_ccorr[__pyx_t_27]) = ((__pyx_v_ccorr[__pyx_t_27]) + __pyx_v_value); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1210 - * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + /* "newanalysis/helpers/correl.pyx":780 + * idx = maxdt*shellstart+dt + * ccorr[idx] += value + * cctr[idx] += 1 # <<<<<<<<<<<<<< + * if shellstart == shelldt: + * cselfcorr[idx] += value */ + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_cctr[__pyx_t_27]) = ((__pyx_v_cctr[__pyx_t_27]) + 1.0); -static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { - int __pyx_v_i; - void *__pyx_v_result; - size_t __pyx_v_itemsize; - size_t __pyx_v_size; - void *__pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - struct __pyx_memoryview_obj *__pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - - /* "View.MemoryView":1221 - * cdef void *result - * - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef size_t size = slice_get_size(src, ndim) - * + /* "newanalysis/helpers/correl.pyx":781 + * ccorr[idx] += value + * cctr[idx] += 1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * cselfcorr[idx] += value + * cselfctr[idx] += 1 */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; + __pyx_t_23 = (__pyx_v_shellstart == __pyx_v_shelldt); + if (__pyx_t_23) { - /* "View.MemoryView":1222 - * - * cdef size_t itemsize = src.memview.view.itemsize - * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":782 + * cctr[idx] += 1 + * if shellstart == shelldt: + * cselfcorr[idx] += value # <<<<<<<<<<<<<< + * cselfctr[idx] += 1 * - * result = malloc(size) */ - __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_cselfcorr[__pyx_t_27]) = ((__pyx_v_cselfcorr[__pyx_t_27]) + __pyx_v_value); - /* "View.MemoryView":1224 - * cdef size_t size = slice_get_size(src, ndim) + /* "newanalysis/helpers/correl.pyx":783 + * if shellstart == shelldt: + * cselfcorr[idx] += value + * cselfctr[idx] += 1 # <<<<<<<<<<<<<< * - * result = malloc(size) # <<<<<<<<<<<<<< - * if not result: - * _err(MemoryError, NULL) + * for i in range(maxdt*nshells): */ - __pyx_v_result = malloc(__pyx_v_size); + __pyx_t_27 = __pyx_v_idx; + (__pyx_v_cselfctr[__pyx_t_27]) = ((__pyx_v_cselfctr[__pyx_t_27]) + 1.0); - /* "View.MemoryView":1225 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) - * + /* "newanalysis/helpers/correl.pyx":781 + * ccorr[idx] += value + * cctr[idx] += 1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * cselfcorr[idx] += value + * cselfctr[idx] += 1 */ - __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0); - if (__pyx_t_2) { + } + } - /* "View.MemoryView":1226 - * result = malloc(size) - * if not result: - * _err(MemoryError, NULL) # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/correl.pyx":772 + * dsidx = mol*nds+start + * shellstart = cds[dsidx]-1 + * if shellstart < nshells: # <<<<<<<<<<<<<< + * shelldt = cds[dsidx+dt]-1 + * for dim in range(corrdim): */ - __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1226, __pyx_L1_error) + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1225 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) + /* "newanalysis/helpers/correl.pyx":766 + * cdef long i,start,dt,mol,shellstart,shelldt,idx,dim,validx,dsidx,istart * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for istart in range(startmax): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } } - /* "View.MemoryView":1229 - * + /* "newanalysis/helpers/correl.pyx":785 + * cselfctr[idx] += 1 * - * tmpslice.data = result # <<<<<<<<<<<<<< - * tmpslice.memview = src.memview - * for i in range(ndim): + * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] */ - __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + __pyx_t_16 = (__pyx_v_maxdt * __pyx_v_nshells); + __pyx_t_15 = __pyx_t_16; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_15; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":1230 + /* "newanalysis/helpers/correl.pyx":786 * - * tmpslice.data = result - * tmpslice.memview = src.memview # <<<<<<<<<<<<<< - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - */ - __pyx_t_4 = __pyx_v_src->memview; - __pyx_v_tmpslice->memview = __pyx_t_4; - - /* "View.MemoryView":1231 - * tmpslice.data = result - * tmpslice.memview = src.memview - * for i in range(ndim): # <<<<<<<<<<<<<< - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_23 = ((__pyx_v_cctr[__pyx_v_i]) != 0.0); + if (__pyx_t_23) { - /* "View.MemoryView":1232 - * tmpslice.memview = src.memview - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< - * tmpslice.suboffsets[i] = -1 - * + /* "newanalysis/helpers/correl.pyx":787 + * for i in range(maxdt*nshells): + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< + * else: + * print('tot too sparse') */ - (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + __pyx_t_17 = __pyx_v_i; + if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 787, __pyx_L1_error) + } + (__pyx_v_ccorr[__pyx_t_17]) = ((__pyx_v_ccorr[__pyx_t_17]) / (__pyx_v_cctr[__pyx_v_i])); - /* "View.MemoryView":1233 - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":786 * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: */ - (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; - } + goto __pyx_L22; + } - /* "View.MemoryView":1235 - * tmpslice.suboffsets[i] = -1 - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< - * ndim, order) - * + /* "newanalysis/helpers/correl.pyx":789 + * ccorr[i] /= cctr[i] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * cselfcorr[i] /= cselfctr[i] */ - (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L22:; - /* "View.MemoryView":1239 - * - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 + /* "newanalysis/helpers/correl.pyx":790 + * else: + * print('tot too sparse') + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * cselfcorr[i] /= cselfctr[i] + * else: */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_23 = ((__pyx_v_cctr[__pyx_v_i]) != 0.0); + if (__pyx_t_23) { - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * + /* "newanalysis/helpers/correl.pyx":791 + * print('tot too sparse') + * if cctr[i] != 0: + * cselfcorr[i] /= cselfctr[i] # <<<<<<<<<<<<<< + * else: + * print('self too sparse') */ - __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { + __pyx_t_17 = __pyx_v_i; + if (unlikely((__pyx_v_cselfctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 791, __pyx_L1_error) + } + (__pyx_v_cselfcorr[__pyx_t_17]) = ((__pyx_v_cselfcorr[__pyx_t_17]) / (__pyx_v_cselfctr[__pyx_v_i])); - /* "View.MemoryView":1241 - * for i in range(ndim): - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< - * - * if slice_is_contig(src[0], order, ndim): + /* "newanalysis/helpers/correl.pyx":790 + * else: + * print('tot too sparse') + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * cselfcorr[i] /= cselfctr[i] + * else: */ - (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + goto __pyx_L23; + } - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 + /* "newanalysis/helpers/correl.pyx":793 + * cselfcorr[i] /= cselfctr[i] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< * + * for i in range(maxdt*nshells): */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 793, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } + __pyx_L23:; } - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 + /* "newanalysis/helpers/correl.pyx":795 + * print('self too sparse') * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: + * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] + * ccrossctr[i] = cctr[i] - cselfctr[i] */ - __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_16 = (__pyx_v_maxdt * __pyx_v_nshells); + __pyx_t_15 = __pyx_t_16; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_15; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":1244 + /* "newanalysis/helpers/correl.pyx":796 * - * if slice_is_contig(src[0], order, ndim): - * memcpy(result, src.data, size) # <<<<<<<<<<<<<< - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) - */ - (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 + * for i in range(maxdt*nshells): + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] # <<<<<<<<<<<<<< + * ccrossctr[i] = cctr[i] - cselfctr[i] * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: */ - goto __pyx_L9; - } + (__pyx_v_ccrosscorr[__pyx_v_i]) = ((__pyx_v_ccorr[__pyx_v_i]) - (__pyx_v_cselfcorr[__pyx_v_i])); - /* "View.MemoryView":1246 - * memcpy(result, src.data, size) - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":797 + * for i in range(maxdt*nshells): + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] + * ccrossctr[i] = cctr[i] - cselfctr[i] # <<<<<<<<<<<<<< * - * return result + * return corr,selfcorr,crosscorr */ - /*else*/ { - copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + (__pyx_v_ccrossctr[__pyx_v_i]) = ((__pyx_v_cctr[__pyx_v_i]) - (__pyx_v_cselfctr[__pyx_v_i])); } - __pyx_L9:; - /* "View.MemoryView":1248 - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + /* "newanalysis/helpers/correl.pyx":799 + * ccrossctr[i] = cctr[i] - cselfctr[i] * - * return result # <<<<<<<<<<<<<< + * return corr,selfcorr,crosscorr # <<<<<<<<<<<<<< * * */ - __pyx_r = __pyx_v_result; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF((PyObject *)__pyx_v_corr); + __Pyx_GIVEREF((PyObject *)__pyx_v_corr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_corr))) __PYX_ERR(0, 799, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_selfcorr); + __Pyx_GIVEREF((PyObject *)__pyx_v_selfcorr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_selfcorr))) __PYX_ERR(0, 799, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_crosscorr); + __Pyx_GIVEREF((PyObject *)__pyx_v_crosscorr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_crosscorr))) __PYX_ERR(0, 799, __pyx_L1_error); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "View.MemoryView":1210 + /* "newanalysis/helpers/correl.pyx":728 * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, */ /* function exit code */ __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.sparsefullnobulkthingreenkubo", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_contdata); + __Pyx_XDECREF((PyObject *)__pyx_v_contds); + __Pyx_XDECREF(__pyx_v_pcorr); + __Pyx_XDECREF(__pyx_v_pselfcorr); + __Pyx_XDECREF(__pyx_v_pcrosscorr); + __Pyx_XDECREF((PyObject *)__pyx_v_corr); + __Pyx_XDECREF((PyObject *)__pyx_v_selfcorr); + __Pyx_XDECREF((PyObject *)__pyx_v_crosscorr); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XDECREF((PyObject *)__pyx_v_selfctr); + __Pyx_XDECREF((PyObject *)__pyx_v_crossctr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1253 +/* "newanalysis/helpers/correl.pyx":803 * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullcrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata1, + * np.ndarray[np.float64_t,ndim=2] pdata2, */ -static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_27sparsefullcrosscorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_27sparsefullcrosscorrelate = {"sparsefullcrosscorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_27sparsefullcrosscorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_27sparsefullcrosscorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_pdata1 = 0; + PyArrayObject *__pyx_v_pdata2 = 0; + PyArrayObject *__pyx_v_pds = 0; + int __pyx_v_pnshells; + PyObject *__pyx_v_maxlen = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sparsefullcrosscorrelate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 803, __pyx_L3_error) #endif - __Pyx_RefNannySetupContext("_err_extents", 0); + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata1,&__pyx_n_s_pdata2,&__pyx_n_s_pds,&__pyx_n_s_pnshells,&__pyx_n_s_maxlen,0}; - /* "View.MemoryView":1256 - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % - * (i, extent1, extent2)) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err_dim') + /* "newanalysis/helpers/correl.pyx":808 + * np.ndarray[np.int32_t,ndim=2] pds, + * int pnshells, + * maxlen=None,): # <<<<<<<<<<<<<< + * cdef int nmol = len(pdata1) # number of molecules + * cdef int n = len(pdata1[0]) # number of time steps */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; + values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pdata1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 803, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pdata2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 803, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullcrosscorrelate", 0, 4, 5, 1); __PYX_ERR(0, 803, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 803, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullcrosscorrelate", 0, 4, 5, 2); __PYX_ERR(0, 803, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pnshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 803, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sparsefullcrosscorrelate", 0, 4, 5, 3); __PYX_ERR(0, 803, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 803, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sparsefullcrosscorrelate") < 0)) __PYX_ERR(0, 803, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_pdata1 = ((PyArrayObject *)values[0]); + __pyx_v_pdata2 = ((PyArrayObject *)values[1]); + __pyx_v_pds = ((PyArrayObject *)values[2]); + __pyx_v_pnshells = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_pnshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 807, __pyx_L3_error) + __pyx_v_maxlen = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sparsefullcrosscorrelate", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 803, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.correl.sparsefullcrosscorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata1), __pyx_ptype_5numpy_ndarray, 1, "pdata1", 0))) __PYX_ERR(0, 804, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata2), __pyx_ptype_5numpy_ndarray, 1, "pdata2", 0))) __PYX_ERR(0, 805, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pds), __pyx_ptype_5numpy_ndarray, 1, "pds", 0))) __PYX_ERR(0, 806, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_26sparsefullcrosscorrelate(__pyx_self, __pyx_v_pdata1, __pyx_v_pdata2, __pyx_v_pds, __pyx_v_pnshells, __pyx_v_maxlen); - /* "View.MemoryView":1255 - * cdef int _err_extents(int i, Py_ssize_t extent1, - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<< - * (i, extent1, extent2)) + /* "newanalysis/helpers/correl.pyx":803 * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullcrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata1, + * np.ndarray[np.float64_t,ndim=2] pdata2, */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 1255, __pyx_L1_error) - /* "View.MemoryView":1253 - * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_6correl_26sparsefullcrosscorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata1, PyArrayObject *__pyx_v_pdata2, PyArrayObject *__pyx_v_pds, int __pyx_v_pnshells, PyObject *__pyx_v_maxlen) { + int __pyx_v_nmol; + int __pyx_v_n; + int __pyx_v_nds; + int __pyx_v_maxdt; + int __pyx_v_nshells; + PyArrayObject *__pyx_v_contdata1 = 0; + PyArrayObject *__pyx_v_contdata2 = 0; + PyArrayObject *__pyx_v_contds = 0; + double *__pyx_v_cdata1; + double *__pyx_v_cdata2; + int *__pyx_v_cds; + PyObject *__pyx_v_pcorr = NULL; + PyObject *__pyx_v_pselfcorr = NULL; + PyObject *__pyx_v_pcrosscorr = NULL; + PyArrayObject *__pyx_v_corr = 0; + PyArrayObject *__pyx_v_selfcorr = 0; + PyArrayObject *__pyx_v_crosscorr = 0; + PyArrayObject *__pyx_v_ctr = 0; + PyArrayObject *__pyx_v_selfctr = 0; + PyArrayObject *__pyx_v_crossctr = 0; + double *__pyx_v_ccorr; + double *__pyx_v_cselfcorr; + double *__pyx_v_ccrosscorr; + double *__pyx_v_cctr; + double *__pyx_v_cselfctr; + double *__pyx_v_ccrossctr; + double __pyx_v_value; + int __pyx_v_i; + int __pyx_v_start; + int __pyx_v_dt; + int __pyx_v_mol; + int __pyx_v_shellstart; + int __pyx_v_shelldt; + int __pyx_v_idx; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata1; + __Pyx_Buffer __pyx_pybuffer_contdata1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata2; + __Pyx_Buffer __pyx_pybuffer_contdata2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contds; + __Pyx_Buffer __pyx_pybuffer_contds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; + __Pyx_Buffer __pyx_pybuffer_corr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_crosscorr; + __Pyx_Buffer __pyx_pybuffer_crosscorr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_crossctr; + __Pyx_Buffer __pyx_pybuffer_crossctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata1; + __Pyx_Buffer __pyx_pybuffer_pdata1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata2; + __Pyx_Buffer __pyx_pybuffer_pdata2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pds; + __Pyx_Buffer __pyx_pybuffer_pds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_selfcorr; + __Pyx_Buffer __pyx_pybuffer_selfcorr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_selfctr; + __Pyx_Buffer __pyx_pybuffer_selfctr; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + PyArrayObject *__pyx_t_14 = NULL; + PyArrayObject *__pyx_t_15 = NULL; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sparsefullcrosscorrelate", 0); + __pyx_pybuffer_contdata1.pybuffer.buf = NULL; + __pyx_pybuffer_contdata1.refcount = 0; + __pyx_pybuffernd_contdata1.data = NULL; + __pyx_pybuffernd_contdata1.rcbuffer = &__pyx_pybuffer_contdata1; + __pyx_pybuffer_contdata2.pybuffer.buf = NULL; + __pyx_pybuffer_contdata2.refcount = 0; + __pyx_pybuffernd_contdata2.data = NULL; + __pyx_pybuffernd_contdata2.rcbuffer = &__pyx_pybuffer_contdata2; + __pyx_pybuffer_contds.pybuffer.buf = NULL; + __pyx_pybuffer_contds.refcount = 0; + __pyx_pybuffernd_contds.data = NULL; + __pyx_pybuffernd_contds.rcbuffer = &__pyx_pybuffer_contds; + __pyx_pybuffer_corr.pybuffer.buf = NULL; + __pyx_pybuffer_corr.refcount = 0; + __pyx_pybuffernd_corr.data = NULL; + __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; + __pyx_pybuffer_selfcorr.pybuffer.buf = NULL; + __pyx_pybuffer_selfcorr.refcount = 0; + __pyx_pybuffernd_selfcorr.data = NULL; + __pyx_pybuffernd_selfcorr.rcbuffer = &__pyx_pybuffer_selfcorr; + __pyx_pybuffer_crosscorr.pybuffer.buf = NULL; + __pyx_pybuffer_crosscorr.refcount = 0; + __pyx_pybuffernd_crosscorr.data = NULL; + __pyx_pybuffernd_crosscorr.rcbuffer = &__pyx_pybuffer_crosscorr; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_selfctr.pybuffer.buf = NULL; + __pyx_pybuffer_selfctr.refcount = 0; + __pyx_pybuffernd_selfctr.data = NULL; + __pyx_pybuffernd_selfctr.rcbuffer = &__pyx_pybuffer_selfctr; + __pyx_pybuffer_crossctr.pybuffer.buf = NULL; + __pyx_pybuffer_crossctr.refcount = 0; + __pyx_pybuffernd_crossctr.data = NULL; + __pyx_pybuffernd_crossctr.rcbuffer = &__pyx_pybuffer_crossctr; + __pyx_pybuffer_pdata1.pybuffer.buf = NULL; + __pyx_pybuffer_pdata1.refcount = 0; + __pyx_pybuffernd_pdata1.data = NULL; + __pyx_pybuffernd_pdata1.rcbuffer = &__pyx_pybuffer_pdata1; + __pyx_pybuffer_pdata2.pybuffer.buf = NULL; + __pyx_pybuffer_pdata2.refcount = 0; + __pyx_pybuffernd_pdata2.data = NULL; + __pyx_pybuffernd_pdata2.rcbuffer = &__pyx_pybuffer_pdata2; + __pyx_pybuffer_pds.pybuffer.buf = NULL; + __pyx_pybuffer_pds.refcount = 0; + __pyx_pybuffernd_pds.data = NULL; + __pyx_pybuffernd_pds.rcbuffer = &__pyx_pybuffer_pds; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata1.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 803, __pyx_L1_error) + } + __pyx_pybuffernd_pdata1.diminfo[0].strides = __pyx_pybuffernd_pdata1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata1.diminfo[0].shape = __pyx_pybuffernd_pdata1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata1.diminfo[1].strides = __pyx_pybuffernd_pdata1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata1.diminfo[1].shape = __pyx_pybuffernd_pdata1.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata2.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 803, __pyx_L1_error) + } + __pyx_pybuffernd_pdata2.diminfo[0].strides = __pyx_pybuffernd_pdata2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata2.diminfo[0].shape = __pyx_pybuffernd_pdata2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata2.diminfo[1].strides = __pyx_pybuffernd_pdata2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata2.diminfo[1].shape = __pyx_pybuffernd_pdata2.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pds.rcbuffer->pybuffer, (PyObject*)__pyx_v_pds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 803, __pyx_L1_error) + } + __pyx_pybuffernd_pds.diminfo[0].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pds.diminfo[0].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pds.diminfo[1].strides = __pyx_pybuffernd_pds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pds.diminfo[1].shape = __pyx_pybuffernd_pds.rcbuffer->pybuffer.shape[1]; + + /* "newanalysis/helpers/correl.pyx":809 + * int pnshells, + * maxlen=None,): + * cdef int nmol = len(pdata1) # number of molecules # <<<<<<<<<<<<<< + * cdef int n = len(pdata1[0]) # number of time steps + * cdef int nds = len(pds[0]) # number of steps in delaunay array */ + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata1)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 809, __pyx_L1_error) + __pyx_v_nmol = __pyx_t_1; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1259 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) - * + /* "newanalysis/helpers/correl.pyx":810 + * maxlen=None,): + * cdef int nmol = len(pdata1) # number of molecules + * cdef int n = len(pdata1[0]) # number of time steps # <<<<<<<<<<<<<< + * cdef int nds = len(pds[0]) # number of steps in delaunay array + * cdef int maxdt = n */ + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata1), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 810, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n = __pyx_t_1; -static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_dim", 0); - __Pyx_INCREF(__pyx_v_error); - - /* "View.MemoryView":1260 - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: - * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err') + /* "newanalysis/helpers/correl.pyx":811 + * cdef int nmol = len(pdata1) # number of molecules + * cdef int n = len(pdata1[0]) # number of time steps + * cdef int nds = len(pds[0]) # number of steps in delaunay array # <<<<<<<<<<<<<< + * cdef int maxdt = n + * cdef int nshells = pnshells+1 */ - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pds), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_v_error); - __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 1260, __pyx_L1_error) + __pyx_v_nds = __pyx_t_1; - /* "View.MemoryView":1259 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) - * + /* "newanalysis/helpers/correl.pyx":812 + * cdef int n = len(pdata1[0]) # number of time steps + * cdef int nds = len(pds[0]) # number of steps in delaunay array + * cdef int maxdt = n # <<<<<<<<<<<<<< + * cdef int nshells = pnshells+1 + * if maxlen != None: */ + __pyx_v_maxdt = __pyx_v_n; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} + /* "newanalysis/helpers/correl.pyx":813 + * cdef int nds = len(pds[0]) # number of steps in delaunay array + * cdef int maxdt = n + * cdef int nshells = pnshells+1 # <<<<<<<<<<<<<< + * if maxlen != None: + * maxdt = maxlen + */ + __pyx_v_nshells = (__pyx_v_pnshells + 1); -/* "View.MemoryView":1263 - * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) + /* "newanalysis/helpers/correl.pyx":814 + * cdef int maxdt = n + * cdef int nshells = pnshells+1 + * if maxlen != None: # <<<<<<<<<<<<<< + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 814, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 814, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { -static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err", 0); - __Pyx_INCREF(__pyx_v_error); + /* "newanalysis/helpers/correl.pyx":815 + * cdef int nshells = pnshells+1 + * if maxlen != None: + * maxdt = maxlen # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata2 = np.ascontiguousarray(pdata2) + */ + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L1_error) + __pyx_v_maxdt = __pyx_t_4; - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: + /* "newanalysis/helpers/correl.pyx":814 + * cdef int maxdt = n + * cdef int nshells = pnshells+1 + * if maxlen != None: # <<<<<<<<<<<<<< + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) */ - __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); - if (unlikely(__pyx_t_1)) { + } - /* "View.MemoryView":1265 - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: - * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< - * else: - * raise error + /* "newanalysis/helpers/correl.pyx":816 + * if maxlen != None: + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata2 = np.ascontiguousarray(pdata2) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) */ - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_error); - __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 816, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 816, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_pdata1)}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1265, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 1265, __pyx_L1_error) - - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: - */ + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - - /* "View.MemoryView":1267 - * raise error(msg.decode('ascii')) - * else: - * raise error # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_contents') - */ - /*else*/ { - __Pyx_Raise(__pyx_v_error, 0, 0, 0); - __PYX_ERR(2, 1267, __pyx_L1_error) + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 816, __pyx_L1_error) + __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata1.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contdata1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata1.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 816, __pyx_L1_error) + } else {__pyx_pybuffernd_contdata1.diminfo[0].strides = __pyx_pybuffernd_contdata1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata1.diminfo[0].shape = __pyx_pybuffernd_contdata1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata1.diminfo[1].strides = __pyx_pybuffernd_contdata1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata1.diminfo[1].shape = __pyx_pybuffernd_contdata1.rcbuffer->pybuffer.shape[1]; + } } + __pyx_t_7 = 0; + __pyx_v_contdata1 = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":1263 - * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) + /* "newanalysis/helpers/correl.pyx":817 + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata2 = np.ascontiguousarray(pdata2) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata1 = contdata1.data */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 817, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 817, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_4 = 1; + } + } #endif - return __pyx_r; -} - -/* "View.MemoryView":1270 - * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ - -static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { - void *__pyx_v_tmpdata; - size_t __pyx_v_itemsize; - int __pyx_v_i; - char __pyx_v_order; - int __pyx_v_broadcasting; - int __pyx_v_direct_copy; - __Pyx_memviewslice __pyx_v_tmp; - int __pyx_v_ndim; - int __pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - void *__pyx_t_7; - int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, ((PyObject *)__pyx_v_pdata2)}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 817, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 817, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata2.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contdata2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata2.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 817, __pyx_L1_error) + } else {__pyx_pybuffernd_contdata2.diminfo[0].strides = __pyx_pybuffernd_contdata2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata2.diminfo[0].shape = __pyx_pybuffernd_contdata2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata2.diminfo[1].strides = __pyx_pybuffernd_contdata2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata2.diminfo[1].shape = __pyx_pybuffernd_contdata2.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_8 = 0; + __pyx_v_contdata2 = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":1278 - * Check for overlapping memory and verify the shapes. - * """ - * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i + /* "newanalysis/helpers/correl.pyx":818 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata1 = np.ascontiguousarray(pdata1) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata2 = np.ascontiguousarray(pdata2) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) # <<<<<<<<<<<<<< + * cdef double *cdata1 = contdata1.data + * cdef double *cdata2 = contdata2.data */ - __pyx_v_tmpdata = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 818, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 818, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_pds)}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 818, __pyx_L1_error) + __pyx_t_9 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contds.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contds.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 818, __pyx_L1_error) + } else {__pyx_pybuffernd_contds.diminfo[0].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contds.diminfo[0].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contds.diminfo[1].strides = __pyx_pybuffernd_contds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contds.diminfo[1].shape = __pyx_pybuffernd_contds.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_9 = 0; + __pyx_v_contds = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":1279 - * """ - * cdef void *tmpdata = NULL - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) + /* "newanalysis/helpers/correl.pyx":819 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata2 = np.ascontiguousarray(pdata2) + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata1 = contdata1.data # <<<<<<<<<<<<<< + * cdef double *cdata2 = contdata2.data + * cdef int *cds = contds.data */ - __pyx_t_1 = __pyx_v_src.memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contdata1)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L1_error) + __pyx_v_cdata1 = ((double *)__pyx_t_10); - /* "View.MemoryView":1281 - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< - * cdef bint broadcasting = False - * cdef bint direct_copy = False + /* "newanalysis/helpers/correl.pyx":820 + * cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) + * cdef double *cdata1 = contdata1.data + * cdef double *cdata2 = contdata2.data # <<<<<<<<<<<<<< + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contdata2)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L1_error) + __pyx_v_cdata2 = ((double *)__pyx_t_10); - /* "View.MemoryView":1282 - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False # <<<<<<<<<<<<<< - * cdef bint direct_copy = False - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/correl.pyx":821 + * cdef double *cdata1 = contdata1.data + * cdef double *cdata2 = contdata2.data + * cdef int *cds = contds.data # <<<<<<<<<<<<<< + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_v_broadcasting = 0; + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contds)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 821, __pyx_L1_error) + __pyx_v_cds = ((int *)__pyx_t_10); - /* "View.MemoryView":1283 - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False - * cdef bint direct_copy = False # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice tmp - * + /* "newanalysis/helpers/correl.pyx":822 + * cdef double *cdata2 = contdata2.data + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_v_direct_copy = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_5)) __PYX_ERR(0, 822, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11)) __PYX_ERR(0, 822, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, __pyx_t_12) < 0) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_v_pcorr = __pyx_t_12; + __pyx_t_12 = 0; - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp - * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: + /* "newanalysis/helpers/correl.pyx":823 + * cdef int *cds = contds.data + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr */ - __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0); - if (__pyx_t_2) { + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_zeros); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_12)) __PYX_ERR(0, 823, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error); + __pyx_t_12 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 823, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_pselfcorr = __pyx_t_2; + __pyx_t_2 = 0; - /* "View.MemoryView":1287 - * - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) + /* "newanalysis/helpers/correl.pyx":824 + * pcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr */ - __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_5)) __PYX_ERR(0, 824, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11)) __PYX_ERR(0, 824, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, __pyx_t_12) < 0) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_v_pcrosscorr = __pyx_t_12; + __pyx_t_12 = 0; - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp - * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: + /* "newanalysis/helpers/correl.pyx":825 + * pselfcorr = np.zeros((nshells,maxdt),dtype=np.float64) + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr */ - goto __pyx_L3; + if (!(likely(((__pyx_v_pcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 825, __pyx_L1_error) + __pyx_t_12 = __pyx_v_pcorr; + __Pyx_INCREF(__pyx_t_12); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_12), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 825, __pyx_L1_error) + } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corr.diminfo[1].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corr.diminfo[1].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[1]; + } } + __pyx_v_corr = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * + /* "newanalysis/helpers/correl.pyx":826 + * pcrosscorr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0); - if (__pyx_t_2) { + if (!(likely(((__pyx_v_pselfcorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pselfcorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 826, __pyx_L1_error) + __pyx_t_12 = __pyx_v_pselfcorr; + __Pyx_INCREF(__pyx_t_12); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_12), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_selfcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 826, __pyx_L1_error) + } else {__pyx_pybuffernd_selfcorr.diminfo[0].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfcorr.diminfo[0].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfcorr.diminfo[1].strides = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfcorr.diminfo[1].shape = __pyx_pybuffernd_selfcorr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_selfcorr = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; - /* "View.MemoryView":1289 - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< - * - * cdef int ndim = max(src_ndim, dst_ndim) + /* "newanalysis/helpers/correl.pyx":827 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] corr = pcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) */ - __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); + if (!(likely(((__pyx_v_pcrosscorr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pcrosscorr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 827, __pyx_L1_error) + __pyx_t_12 = __pyx_v_pcrosscorr; + __Pyx_INCREF(__pyx_t_12); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_12), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_crosscorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 827, __pyx_L1_error) + } else {__pyx_pybuffernd_crosscorr.diminfo[0].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crosscorr.diminfo[0].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crosscorr.diminfo[1].strides = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crosscorr.diminfo[1].shape = __pyx_pybuffernd_crosscorr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_v_crosscorr = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * + /* "newanalysis/helpers/correl.pyx":828 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfcorr = pselfcorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) */ + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_zeros); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_12)) __PYX_ERR(0, 828, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5)) __PYX_ERR(0, 828, __pyx_L1_error); + __pyx_t_12 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 828, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 828, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 828, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ctr.diminfo[1].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ctr.diminfo[1].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[1]; + } } - __pyx_L3:; + __pyx_t_13 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":1291 - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * - * for i in range(ndim): + /* "newanalysis/helpers/correl.pyx":829 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crosscorr = pcrosscorr + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data */ - __pyx_t_3 = __pyx_v_dst_ndim; - __pyx_t_4 = __pyx_v_src_ndim; - if (((__pyx_t_3 > __pyx_t_4) != 0)) { - __pyx_t_5 = __pyx_t_3; - } else { - __pyx_t_5 = __pyx_t_4; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_11); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11)) __PYX_ERR(0, 829, __pyx_L1_error); + __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, __pyx_t_12) < 0) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 829, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 829, __pyx_L1_error) + __pyx_t_14 = ((PyArrayObject *)__pyx_t_12); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_selfctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 829, __pyx_L1_error) + } else {__pyx_pybuffernd_selfctr.diminfo[0].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selfctr.diminfo[0].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selfctr.diminfo[1].strides = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selfctr.diminfo[1].shape = __pyx_pybuffernd_selfctr.rcbuffer->pybuffer.shape[1]; + } } - __pyx_v_ndim = __pyx_t_5; + __pyx_t_14 = 0; + __pyx_v_selfctr = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; - /* "View.MemoryView":1293 - * cdef int ndim = max(src_ndim, dst_ndim) - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: + /* "newanalysis/helpers/correl.pyx":830 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] ctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data */ - __pyx_t_5 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_5; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_zeros); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_12)) __PYX_ERR(0, 830, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5)) __PYX_ERR(0, 830, __pyx_L1_error); + __pyx_t_12 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 830, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 830, __pyx_L1_error) + __pyx_t_15 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_crossctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 830, __pyx_L1_error) + } else {__pyx_pybuffernd_crossctr.diminfo[0].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_crossctr.diminfo[0].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_crossctr.diminfo[1].strides = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_crossctr.diminfo[1].shape = __pyx_pybuffernd_crossctr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_15 = 0; + __pyx_v_crossctr = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":1294 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + /* "newanalysis/helpers/correl.pyx":831 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] selfctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0); - if (__pyx_t_2) { + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_corr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 831, __pyx_L1_error) + __pyx_v_ccorr = ((double *)__pyx_t_10); - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/helpers/correl.pyx":832 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] crossctr = np.zeros((nshells,maxdt),dtype=np.float64) + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data # <<<<<<<<<<<<<< + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_selfcorr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 832, __pyx_L1_error) + __pyx_v_cselfcorr = ((double *)__pyx_t_10); - /* "View.MemoryView":1296 - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - * broadcasting = True # <<<<<<<<<<<<<< - * src.strides[i] = 0 - * else: + /* "newanalysis/helpers/correl.pyx":833 + * cdef double *ccorr = corr.data + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data # <<<<<<<<<<<<<< + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data */ - __pyx_v_broadcasting = 1; + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_crosscorr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 833, __pyx_L1_error) + __pyx_v_ccrosscorr = ((double *)__pyx_t_10); - /* "View.MemoryView":1297 - * if src.shape[i] == 1: - * broadcasting = True - * src.strides[i] = 0 # <<<<<<<<<<<<<< - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) + /* "newanalysis/helpers/correl.pyx":834 + * cdef double *cselfcorr = selfcorr.data + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< + * cdef double *cselfctr = selfctr.data + * cdef double *ccrossctr = crossctr.data */ - (__pyx_v_src.strides[__pyx_v_i]) = 0; + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 834, __pyx_L1_error) + __pyx_v_cctr = ((double *)__pyx_t_10); - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/helpers/correl.pyx":835 + * cdef double *ccrosscorr = crosscorr.data + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data # <<<<<<<<<<<<<< + * cdef double *ccrossctr = crossctr.data + * cdef double value */ - goto __pyx_L7; - } + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_selfctr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 835, __pyx_L1_error) + __pyx_v_cselfctr = ((double *)__pyx_t_10); - /* "View.MemoryView":1299 - * src.strides[i] = 0 - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< - * - * if src.suboffsets[i] >= 0: + /* "newanalysis/helpers/correl.pyx":836 + * cdef double *cctr = ctr.data + * cdef double *cselfctr = selfctr.data + * cdef double *ccrossctr = crossctr.data # <<<<<<<<<<<<<< + * cdef double value + * cdef int i,start,dt,mol,shellstart,shelldt,idx */ - /*else*/ { - __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1299, __pyx_L1_error) - } - __pyx_L7:; + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_crossctr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 836, __pyx_L1_error) + __pyx_v_ccrossctr = ((double *)__pyx_t_10); - /* "View.MemoryView":1294 + /* "newanalysis/helpers/correl.pyx":840 + * cdef int i,start,dt,mol,shellstart,shelldt,idx * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_17 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_17 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_3) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) lastprivate(__pyx_v_value) + #endif /* _OPENMP */ + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_17; __pyx_t_16++){ + { + __pyx_v_dt = (int)(0 + 1 * __pyx_t_16); + /* Initialize private variables to invalid values */ + __pyx_v_idx = ((int)0xbad0bad0); + __pyx_v_mol = ((int)0xbad0bad0); + __pyx_v_shelldt = ((int)0xbad0bad0); + __pyx_v_shellstart = ((int)0xbad0bad0); + __pyx_v_start = ((int)0xbad0bad0); + __pyx_v_value = ((double)__PYX_NAN()); - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) + /* "newanalysis/helpers/correl.pyx":841 * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for start in range(n-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * shellstart = cds[mol*nds+start]-1 */ - __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0); - if (__pyx_t_2) { + __pyx_t_18 = (__pyx_v_n - __pyx_v_dt); + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { + __pyx_v_start = __pyx_t_20; - /* "View.MemoryView":1302 - * - * if src.suboffsets[i] >= 0: - * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< - * - * if slices_overlap(&src, &dst, ndim, itemsize): + /* "newanalysis/helpers/correl.pyx":842 + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * shellstart = cds[mol*nds+start]-1 + * shelldt = cds[mol*nds+start+dt]-1 */ - __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1302, __pyx_L1_error) + __pyx_t_21 = __pyx_v_nmol; + __pyx_t_22 = __pyx_t_21; + for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) { + __pyx_v_mol = __pyx_t_23; - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) - * + /* "newanalysis/helpers/correl.pyx":843 + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * shellstart = cds[mol*nds+start]-1 # <<<<<<<<<<<<<< + * shelldt = cds[mol*nds+start+dt]-1 + * # if shellstart < nshells: */ - } - } + __pyx_v_shellstart = ((__pyx_v_cds[((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start)]) - 1); - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): + /* "newanalysis/helpers/correl.pyx":844 + * for mol in range(nmol): # loop over molecules/entries + * shellstart = cds[mol*nds+start]-1 + * shelldt = cds[mol*nds+start+dt]-1 # <<<<<<<<<<<<<< + * # if shellstart < nshells: + * value = cdata1[mol*n+start]*cdata2[mol*n+start+dt] */ - __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0); - if (__pyx_t_2) { + __pyx_v_shelldt = ((__pyx_v_cds[(((__pyx_v_mol * __pyx_v_nds) + __pyx_v_start) + __pyx_v_dt)]) - 1); - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * + /* "newanalysis/helpers/correl.pyx":846 + * shelldt = cds[mol*nds+start+dt]-1 + * # if shellstart < nshells: + * value = cdata1[mol*n+start]*cdata2[mol*n+start+dt] # <<<<<<<<<<<<<< + * idx = maxdt*shellstart+dt + * ccorr[idx] += value */ - __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0); - if (__pyx_t_2) { + __pyx_v_value = ((__pyx_v_cdata1[((__pyx_v_mol * __pyx_v_n) + __pyx_v_start)]) * (__pyx_v_cdata2[(((__pyx_v_mol * __pyx_v_n) + __pyx_v_start) + __pyx_v_dt)])); - /* "View.MemoryView":1307 - * - * if not slice_is_contig(src, order, ndim): - * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + /* "newanalysis/helpers/correl.pyx":847 + * # if shellstart < nshells: + * value = cdata1[mol*n+start]*cdata2[mol*n+start+dt] + * idx = maxdt*shellstart+dt # <<<<<<<<<<<<<< + * ccorr[idx] += value + * cctr[idx] += 1 */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + __pyx_v_idx = ((__pyx_v_maxdt * __pyx_v_shellstart) + __pyx_v_dt); - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * + /* "newanalysis/helpers/correl.pyx":848 + * value = cdata1[mol*n+start]*cdata2[mol*n+start+dt] + * idx = maxdt*shellstart+dt + * ccorr[idx] += value # <<<<<<<<<<<<<< + * cctr[idx] += 1 + * if shellstart == shelldt: */ - } + __pyx_t_24 = __pyx_v_idx; + (__pyx_v_ccorr[__pyx_t_24]) = ((__pyx_v_ccorr[__pyx_t_24]) + __pyx_v_value); - /* "View.MemoryView":1309 - * order = get_best_order(&dst, ndim) - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< - * src = tmp - * + /* "newanalysis/helpers/correl.pyx":849 + * idx = maxdt*shellstart+dt + * ccorr[idx] += value + * cctr[idx] += 1 # <<<<<<<<<<<<<< + * if shellstart == shelldt: + * cselfcorr[idx] += value */ - __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1309, __pyx_L1_error) - __pyx_v_tmpdata = __pyx_t_7; + __pyx_t_24 = __pyx_v_idx; + (__pyx_v_cctr[__pyx_t_24]) = ((__pyx_v_cctr[__pyx_t_24]) + 1.0); - /* "View.MemoryView":1310 - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) - * src = tmp # <<<<<<<<<<<<<< - * - * if not broadcasting: + /* "newanalysis/helpers/correl.pyx":850 + * ccorr[idx] += value + * cctr[idx] += 1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * cselfcorr[idx] += value + * cselfctr[idx] += 1 */ - __pyx_v_src = __pyx_v_tmp; + __pyx_t_3 = (__pyx_v_shellstart == __pyx_v_shelldt); + if (__pyx_t_3) { - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":851 + * cctr[idx] += 1 + * if shellstart == shelldt: + * cselfcorr[idx] += value # <<<<<<<<<<<<<< + * cselfctr[idx] += 1 * - * if not slice_is_contig(src, order, ndim): */ - } + __pyx_t_24 = __pyx_v_idx; + (__pyx_v_cselfcorr[__pyx_t_24]) = ((__pyx_v_cselfcorr[__pyx_t_24]) + __pyx_v_value); - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":852 + * if shellstart == shelldt: + * cselfcorr[idx] += value + * cselfctr[idx] += 1 # <<<<<<<<<<<<<< * + * for i in range(maxdt*nshells): */ - __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_24 = __pyx_v_idx; + (__pyx_v_cselfctr[__pyx_t_24]) = ((__pyx_v_cselfctr[__pyx_t_24]) + 1.0); - /* "View.MemoryView":1315 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + /* "newanalysis/helpers/correl.pyx":850 + * ccorr[idx] += value + * cctr[idx] += 1 + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * cselfcorr[idx] += value + * cselfctr[idx] += 1 */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1316 + /* "newanalysis/helpers/correl.pyx":840 + * cdef int i,start,dt,mol,shellstart,shelldt,idx * - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } - /* "View.MemoryView":1315 - * + /* "newanalysis/helpers/correl.pyx":854 + * cselfctr[idx] += 1 * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] */ - goto __pyx_L12; - } + __pyx_t_17 = (__pyx_v_maxdt * __pyx_v_nshells); + __pyx_t_16 = __pyx_t_17; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_16; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/helpers/correl.pyx":855 * + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_3 = ((__pyx_v_cctr[__pyx_v_i]) != 0.0); + if (__pyx_t_3) { - /* "View.MemoryView":1318 - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< - * - * if direct_copy: + /* "newanalysis/helpers/correl.pyx":856 + * for i in range(maxdt*nshells): + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< + * else: + * print('tot too sparse') */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + __pyx_t_18 = __pyx_v_i; + if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 856, __pyx_L1_error) + } + (__pyx_v_ccorr[__pyx_t_18]) = ((__pyx_v_ccorr[__pyx_t_18]) / (__pyx_v_cctr[__pyx_v_i])); - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/helpers/correl.pyx":855 * + * for i in range(maxdt*nshells): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: */ + goto __pyx_L20; } - __pyx_L12:; - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) + /* "newanalysis/helpers/correl.pyx":858 + * ccorr[i] /= cctr[i] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * cselfcorr[i] /= cselfctr[i] */ - __pyx_t_2 = (__pyx_v_direct_copy != 0); - if (__pyx_t_2) { + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 858, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L20:; - /* "View.MemoryView":1322 - * if direct_copy: - * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) + /* "newanalysis/helpers/correl.pyx":859 + * else: + * print('tot too sparse') + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * cselfcorr[i] /= cselfctr[i] + * else: */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + __pyx_t_3 = ((__pyx_v_cctr[__pyx_v_i]) != 0.0); + if (__pyx_t_3) { - /* "View.MemoryView":1323 - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) + /* "newanalysis/helpers/correl.pyx":860 + * print('tot too sparse') + * if cctr[i] != 0: + * cselfcorr[i] /= cselfctr[i] # <<<<<<<<<<<<<< + * else: + * print('self too sparse') */ - (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + __pyx_t_18 = __pyx_v_i; + if (unlikely((__pyx_v_cselfctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 860, __pyx_L1_error) + } + (__pyx_v_cselfcorr[__pyx_t_18]) = ((__pyx_v_cselfcorr[__pyx_t_18]) / (__pyx_v_cselfctr[__pyx_v_i])); - /* "View.MemoryView":1324 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * free(tmpdata) - * return 0 + /* "newanalysis/helpers/correl.pyx":859 + * else: + * print('tot too sparse') + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * cselfcorr[i] /= cselfctr[i] + * else: */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + goto __pyx_L21; + } - /* "View.MemoryView":1325 - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 + /* "newanalysis/helpers/correl.pyx":862 + * cselfcorr[i] /= cselfctr[i] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< * + * for i in range(maxdt*nshells): */ - free(__pyx_v_tmpdata); + /*else*/ { + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 862, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L21:; + } - /* "View.MemoryView":1326 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":864 + * print('self too sparse') * - * if order == 'F' == get_best_order(&dst, ndim): + * for i in range(maxdt*nshells): # <<<<<<<<<<<<<< + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] + * ccrossctr[i] = cctr[i] - cselfctr[i] */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_17 = (__pyx_v_maxdt * __pyx_v_nshells); + __pyx_t_16 = __pyx_t_17; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_16; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/helpers/correl.pyx":865 * - * if direct_copy: # <<<<<<<<<<<<<< + * for i in range(maxdt*nshells): + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] # <<<<<<<<<<<<<< + * ccrossctr[i] = cctr[i] - cselfctr[i] * - * refcount_copying(&dst, dtype_is_object, ndim, False) */ - } + (__pyx_v_ccrosscorr[__pyx_v_i]) = ((__pyx_v_ccorr[__pyx_v_i]) - (__pyx_v_cselfcorr[__pyx_v_i])); - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":866 + * for i in range(maxdt*nshells): + * ccrosscorr[i] = ccorr[i] - cselfcorr[i] + * ccrossctr[i] = cctr[i] - cselfctr[i] # <<<<<<<<<<<<<< * + * return corr,selfcorr,crosscorr */ + (__pyx_v_ccrossctr[__pyx_v_i]) = ((__pyx_v_cctr[__pyx_v_i]) - (__pyx_v_cselfctr[__pyx_v_i])); } - /* "View.MemoryView":1328 - * return 0 + /* "newanalysis/helpers/correl.pyx":868 + * ccrossctr[i] = cctr[i] - cselfctr[i] * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * return corr,selfcorr,crosscorr # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = (__pyx_v_order == 'F'); - if (__pyx_t_2) { - __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); - } - __pyx_t_8 = (__pyx_t_2 != 0); - if (__pyx_t_8) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF((PyObject *)__pyx_v_corr); + __Pyx_GIVEREF((PyObject *)__pyx_v_corr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_corr))) __PYX_ERR(0, 868, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_selfcorr); + __Pyx_GIVEREF((PyObject *)__pyx_v_selfcorr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_selfcorr))) __PYX_ERR(0, 868, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_crosscorr); + __Pyx_GIVEREF((PyObject *)__pyx_v_crosscorr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_crosscorr))) __PYX_ERR(0, 868, __pyx_L1_error); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "View.MemoryView":1331 - * + /* "newanalysis/helpers/correl.pyx":803 * - * transpose_memslice(&src) # <<<<<<<<<<<<<< - * transpose_memslice(&dst) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullcrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata1, + * np.ndarray[np.float64_t,ndim=2] pdata2, */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1331, __pyx_L1_error) - /* "View.MemoryView":1332 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.sparsefullcrosscorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crosscorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_crossctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfcorr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selfctr.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_contdata1); + __Pyx_XDECREF((PyObject *)__pyx_v_contdata2); + __Pyx_XDECREF((PyObject *)__pyx_v_contds); + __Pyx_XDECREF(__pyx_v_pcorr); + __Pyx_XDECREF(__pyx_v_pselfcorr); + __Pyx_XDECREF(__pyx_v_pcrosscorr); + __Pyx_XDECREF((PyObject *)__pyx_v_corr); + __Pyx_XDECREF((PyObject *)__pyx_v_selfcorr); + __Pyx_XDECREF((PyObject *)__pyx_v_crosscorr); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XDECREF((PyObject *)__pyx_v_selfctr); + __Pyx_XDECREF((PyObject *)__pyx_v_crossctr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/correl.pyx":871 * - * transpose_memslice(&src) - * transpose_memslice(&dst) # <<<<<<<<<<<<<< * - * refcount_copying(&dst, dtype_is_object, ndim, False) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * maxlen=None): */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1332, __pyx_L1_error) - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_29sparsecorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_29sparsecorrelate = {"sparsecorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_29sparsecorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_29sparsecorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_pdata = 0; + PyObject *__pyx_v_maxlen = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sparsecorrelate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 871, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pdata,&__pyx_n_s_maxlen,0}; + + /* "newanalysis/helpers/correl.pyx":873 + * @cython.boundscheck(False) + * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * maxlen=None): # <<<<<<<<<<<<<< + * cdef int nmol = len(pdata) # number of molecules + * cdef int n = len(pdata[0]) # number of time steps + */ + values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pdata)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 871, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 871, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sparsecorrelate") < 0)) __PYX_ERR(0, 871, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_pdata = ((PyArrayObject *)values[0]); + __pyx_v_maxlen = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sparsecorrelate", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 871, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.correl.sparsecorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pdata), __pyx_ptype_5numpy_ndarray, 1, "pdata", 0))) __PYX_ERR(0, 872, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_28sparsecorrelate(__pyx_self, __pyx_v_pdata, __pyx_v_maxlen); + + /* "newanalysis/helpers/correl.pyx":871 * * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * maxlen=None): */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1334 - * transpose_memslice(&dst) - * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) +static PyObject *__pyx_pf_11newanalysis_6correl_28sparsecorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pdata, PyObject *__pyx_v_maxlen) { + int __pyx_v_nmol; + int __pyx_v_n; + int __pyx_v_maxdt; + PyArrayObject *__pyx_v_contdata = 0; + double *__pyx_v_cdata; + PyArrayObject *__pyx_v_corr = 0; + PyArrayObject *__pyx_v_ctr = 0; + double *__pyx_v_ccorr; + double *__pyx_v_cctr; + double __pyx_v_value; + int __pyx_v_start; + int __pyx_v_dt; + int __pyx_v_mol; + int __pyx_v_i; + __Pyx_LocalBuf_ND __pyx_pybuffernd_contdata; + __Pyx_Buffer __pyx_pybuffer_contdata; + __Pyx_LocalBuf_ND __pyx_pybuffernd_corr; + __Pyx_Buffer __pyx_pybuffer_corr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pdata; + __Pyx_Buffer __pyx_pybuffer_pdata; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyArrayObject *__pyx_t_7 = NULL; + char *__pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sparsecorrelate", 0); + __pyx_pybuffer_contdata.pybuffer.buf = NULL; + __pyx_pybuffer_contdata.refcount = 0; + __pyx_pybuffernd_contdata.data = NULL; + __pyx_pybuffernd_contdata.rcbuffer = &__pyx_pybuffer_contdata; + __pyx_pybuffer_corr.pybuffer.buf = NULL; + __pyx_pybuffer_corr.refcount = 0; + __pyx_pybuffernd_corr.data = NULL; + __pyx_pybuffernd_corr.rcbuffer = &__pyx_pybuffer_corr; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_pdata.pybuffer.buf = NULL; + __pyx_pybuffer_pdata.refcount = 0; + __pyx_pybuffernd_pdata.data = NULL; + __pyx_pybuffernd_pdata.rcbuffer = &__pyx_pybuffer_pdata; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer, (PyObject*)__pyx_v_pdata, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 871, __pyx_L1_error) + } + __pyx_pybuffernd_pdata.diminfo[0].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pdata.diminfo[0].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pdata.diminfo[1].strides = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pdata.diminfo[1].shape = __pyx_pybuffernd_pdata.rcbuffer->pybuffer.shape[1]; + + /* "newanalysis/helpers/correl.pyx":874 + * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * maxlen=None): + * cdef int nmol = len(pdata) # number of molecules # <<<<<<<<<<<<<< + * cdef int n = len(pdata[0]) # number of time steps + * cdef int maxdt = n */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_pdata)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 874, __pyx_L1_error) + __pyx_v_nmol = __pyx_t_1; - /* "View.MemoryView":1335 - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) - * + /* "newanalysis/helpers/correl.pyx":875 + * maxlen=None): + * cdef int nmol = len(pdata) # number of molecules + * cdef int n = len(pdata[0]) # number of time steps # <<<<<<<<<<<<<< + * cdef int maxdt = n + * if maxlen != None: */ - copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pdata), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 875, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n = __pyx_t_1; - /* "View.MemoryView":1336 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * - * free(tmpdata) + /* "newanalysis/helpers/correl.pyx":876 + * cdef int nmol = len(pdata) # number of molecules + * cdef int n = len(pdata[0]) # number of time steps + * cdef int maxdt = n # <<<<<<<<<<<<<< + * if maxlen != None: + * maxdt = maxlen */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + __pyx_v_maxdt = __pyx_v_n; - /* "View.MemoryView":1338 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 - * + /* "newanalysis/helpers/correl.pyx":877 + * cdef int n = len(pdata[0]) # number of time steps + * cdef int maxdt = n + * if maxlen != None: # <<<<<<<<<<<<<< + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) */ - free(__pyx_v_tmpdata); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 877, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 877, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { - /* "View.MemoryView":1339 - * - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_broadcast_leading') + /* "newanalysis/helpers/correl.pyx":878 + * cdef int maxdt = n + * if maxlen != None: + * maxdt = maxlen # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef double *cdata = contdata.data */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 878, __pyx_L1_error) + __pyx_v_maxdt = __pyx_t_4; - /* "View.MemoryView":1270 - * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, + /* "newanalysis/helpers/correl.pyx":877 + * cdef int n = len(pdata[0]) # number of time steps + * cdef int maxdt = n + * if maxlen != None: # <<<<<<<<<<<<<< + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) */ + } - /* function exit code */ - __pyx_L1_error:; + /* "newanalysis/helpers/correl.pyx":879 + * if maxlen != None: + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) # <<<<<<<<<<<<<< + * cdef double *cdata = contdata.data + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] corr = np.zeros(maxdt,dtype=np.float64) + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 879, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 879, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; + } + } + #endif { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_pdata)}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 879, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __pyx_r = -1; - __pyx_L0:; - return __pyx_r; -} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 879, __pyx_L1_error) + __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_contdata = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_contdata.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 879, __pyx_L1_error) + } else {__pyx_pybuffernd_contdata.diminfo[0].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_contdata.diminfo[0].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_contdata.diminfo[1].strides = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_contdata.diminfo[1].shape = __pyx_pybuffernd_contdata.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_7 = 0; + __pyx_v_contdata = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; -/* "View.MemoryView":1342 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: + /* "newanalysis/helpers/correl.pyx":880 + * maxdt = maxlen + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef double *cdata = contdata.data # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] corr = np.zeros(maxdt,dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ctr = np.zeros(maxdt,dtype=np.float64) */ + __pyx_t_8 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_contdata)); if (unlikely(__pyx_t_8 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L1_error) + __pyx_v_cdata = ((double *)__pyx_t_8); -static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { - int __pyx_v_i; - int __pyx_v_offset; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; + /* "newanalysis/helpers/correl.pyx":881 + * cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) + * cdef double *cdata = contdata.data + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] corr = np.zeros(maxdt,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ctr = np.zeros(maxdt,dtype=np.float64) + * cdef double *ccorr = corr.data + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 881, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 881, __pyx_L1_error) + __pyx_t_11 = ((PyArrayObject *)__pyx_t_10); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corr.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { + __pyx_v_corr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_corr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 881, __pyx_L1_error) + } else {__pyx_pybuffernd_corr.diminfo[0].strides = __pyx_pybuffernd_corr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corr.diminfo[0].shape = __pyx_pybuffernd_corr.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_11 = 0; + __pyx_v_corr = ((PyArrayObject *)__pyx_t_10); + __pyx_t_10 = 0; + + /* "newanalysis/helpers/correl.pyx":882 + * cdef double *cdata = contdata.data + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] corr = np.zeros(maxdt,dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ctr = np.zeros(maxdt,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *ccorr = corr.data + * cdef double *cctr = ctr.data + */ + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_maxdt); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_10); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10)) __PYX_ERR(0, 882, __pyx_L1_error); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 882, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_9); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 882, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_12 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; + + /* "newanalysis/helpers/correl.pyx":883 + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] corr = np.zeros(maxdt,dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ctr = np.zeros(maxdt,dtype=np.float64) + * cdef double *ccorr = corr.data # <<<<<<<<<<<<<< + * cdef double *cctr = ctr.data + * cdef double value + */ + __pyx_t_8 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_corr)); if (unlikely(__pyx_t_8 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 883, __pyx_L1_error) + __pyx_v_ccorr = ((double *)__pyx_t_8); + + /* "newanalysis/helpers/correl.pyx":884 + * cdef np.ndarray[np.float64_t,ndim=1,mode="c"] ctr = np.zeros(maxdt,dtype=np.float64) + * cdef double *ccorr = corr.data + * cdef double *cctr = ctr.data # <<<<<<<<<<<<<< + * cdef double value + * cdef int start,dt,mol + */ + __pyx_t_8 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_8 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 884, __pyx_L1_error) + __pyx_v_cctr = ((double *)__pyx_t_8); - /* "View.MemoryView":1346 - * int ndim_other) nogil: - * cdef int i - * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":888 + * cdef int start,dt,mol * - * for i in range(ndim - 1, -1, -1): + * for dt in prange(maxdt,nogil=True): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_14 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_14 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_3) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_start) lastprivate(__pyx_v_value) + #endif /* _OPENMP */ + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ + { + __pyx_v_dt = (int)(0 + 1 * __pyx_t_13); + /* Initialize private variables to invalid values */ + __pyx_v_mol = ((int)0xbad0bad0); + __pyx_v_start = ((int)0xbad0bad0); + __pyx_v_value = ((double)__PYX_NAN()); - /* "View.MemoryView":1348 - * cdef int offset = ndim_other - ndim + /* "newanalysis/helpers/correl.pyx":889 * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] + * for dt in prange(maxdt,nogil=True): # loop over all delta t + * for start in range(n-dt): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_15 = (__pyx_v_n - __pyx_v_dt); + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_start = __pyx_t_17; - /* "View.MemoryView":1349 - * - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + /* "newanalysis/helpers/correl.pyx":890 + * for dt in prange(maxdt,nogil=True): # loop over all delta t + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + * if value != 0: */ - (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + __pyx_t_18 = __pyx_v_nmol; + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { + __pyx_v_mol = __pyx_t_20; - /* "View.MemoryView":1350 - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - * + /* "newanalysis/helpers/correl.pyx":891 + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] # <<<<<<<<<<<<<< + * if value != 0: + * ccorr[dt] += value */ - (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + __pyx_v_value = ((__pyx_v_cdata[((__pyx_v_mol * __pyx_v_n) + __pyx_v_start)]) * (__pyx_v_cdata[(((__pyx_v_mol * __pyx_v_n) + __pyx_v_start) + __pyx_v_dt)])); - /* "View.MemoryView":1351 - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< - * - * for i in range(offset): + /* "newanalysis/helpers/correl.pyx":892 + * for mol in range(nmol): # loop over molecules/entries + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + * if value != 0: # <<<<<<<<<<<<<< + * ccorr[dt] += value + * cctr[dt] += 1 */ - (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); - } + __pyx_t_3 = (__pyx_v_value != 0.0); + if (__pyx_t_3) { - /* "View.MemoryView":1353 - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + /* "newanalysis/helpers/correl.pyx":893 + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + * if value != 0: + * ccorr[dt] += value # <<<<<<<<<<<<<< + * cctr[dt] += 1 * - * for i in range(offset): # <<<<<<<<<<<<<< - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] */ - __pyx_t_1 = __pyx_v_offset; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_21 = __pyx_v_dt; + (__pyx_v_ccorr[__pyx_t_21]) = ((__pyx_v_ccorr[__pyx_t_21]) + __pyx_v_value); - /* "View.MemoryView":1354 + /* "newanalysis/helpers/correl.pyx":894 + * if value != 0: + * ccorr[dt] += value + * cctr[dt] += 1 # <<<<<<<<<<<<<< + * * - * for i in range(offset): - * mslice.shape[i] = 1 # <<<<<<<<<<<<<< - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 */ - (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + __pyx_t_21 = __pyx_v_dt; + (__pyx_v_cctr[__pyx_t_21]) = ((__pyx_v_cctr[__pyx_t_21]) + 1.0); - /* "View.MemoryView":1355 - * for i in range(offset): - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< - * mslice.suboffsets[i] = -1 - * + /* "newanalysis/helpers/correl.pyx":892 + * for mol in range(nmol): # loop over molecules/entries + * value = cdata[mol*n+start]*cdata[mol*n+start+dt] + * if value != 0: # <<<<<<<<<<<<<< + * ccorr[dt] += value + * cctr[dt] += 1 */ - (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1356 - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":888 + * cdef int start,dt,mol * + * for dt in prange(maxdt,nogil=True): # loop over all delta t # <<<<<<<<<<<<<< + * for start in range(n-dt): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } } - /* "View.MemoryView":1342 + /* "newanalysis/helpers/correl.pyx":897 * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: + * + * for i in range(maxdt): # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] */ + __pyx_t_14 = __pyx_v_maxdt; + __pyx_t_13 = __pyx_t_14; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_13; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* function exit code */ -} - -/* "View.MemoryView":1364 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: + /* "newanalysis/helpers/correl.pyx":898 * + * for i in range(maxdt): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: */ + __pyx_t_3 = ((__pyx_v_cctr[__pyx_v_i]) != 0.0); + if (__pyx_t_3) { -static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - int __pyx_t_1; + /* "newanalysis/helpers/correl.pyx":899 + * for i in range(maxdt): + * if cctr[i] != 0: + * ccorr[i] /= cctr[i] # <<<<<<<<<<<<<< + * else: + * print('too sparse') + */ + __pyx_t_15 = __pyx_v_i; + if (unlikely((__pyx_v_cctr[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 899, __pyx_L1_error) + } + (__pyx_v_ccorr[__pyx_t_15]) = ((__pyx_v_ccorr[__pyx_t_15]) / (__pyx_v_cctr[__pyx_v_i])); - /* "View.MemoryView":1368 + /* "newanalysis/helpers/correl.pyx":898 * - * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) + * for i in range(maxdt): + * if cctr[i] != 0: # <<<<<<<<<<<<<< + * ccorr[i] /= cctr[i] + * else: */ - __pyx_t_1 = (__pyx_v_dtype_is_object != 0); - if (__pyx_t_1) { + goto __pyx_L20; + } - /* "View.MemoryView":1369 - * - * if dtype_is_object: - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< - * dst.strides, ndim, inc) + /* "newanalysis/helpers/correl.pyx":901 + * ccorr[i] /= cctr[i] + * else: + * print('too sparse') # <<<<<<<<<<<<<< * + * return corr */ - __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + /*else*/ { + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 901, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_L20:; + } - /* "View.MemoryView":1368 + /* "newanalysis/helpers/correl.pyx":903 + * print('too sparse') * + * return corr # <<<<<<<<<<<<<< * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) + * @cython.boundscheck(False) */ - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_corr); + __pyx_r = ((PyObject *)__pyx_v_corr); + goto __pyx_L0; - /* "View.MemoryView":1364 + /* "newanalysis/helpers/correl.pyx":871 * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * maxlen=None): */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.sparsecorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_contdata.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pdata.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_contdata); + __Pyx_XDECREF((PyObject *)__pyx_v_corr); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1373 +/* "newanalysis/helpers/correl.pyx":905 + * return corr + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularDisplacement(np.ndarray[np.float64_t,ndim=3] coor_ts, delta): * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: */ -static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_31calcAngularDisplacement(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_31calcAngularDisplacement = {"calcAngularDisplacement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_31calcAngularDisplacement, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_31calcAngularDisplacement(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_coor_ts = 0; + PyObject *__pyx_v_delta = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("calcAngularDisplacement (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 905, __pyx_L3_error) #endif - __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - - /* "View.MemoryView":1376 - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - - /* "View.MemoryView":1373 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - */ + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor_ts,&__pyx_n_s_delta,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 905, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_delta)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 905, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcAngularDisplacement", 1, 2, 2, 1); __PYX_ERR(0, 905, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcAngularDisplacement") < 0)) __PYX_ERR(0, 905, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_coor_ts = ((PyArrayObject *)values[0]); + __pyx_v_delta = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcAngularDisplacement", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 905, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.correl.calcAngularDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_ts), __pyx_ptype_5numpy_ndarray, 1, "coor_ts", 0))) __PYX_ERR(0, 906, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_30calcAngularDisplacement(__pyx_self, __pyx_v_coor_ts, __pyx_v_delta); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + return __pyx_r; } -/* "View.MemoryView":1379 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i - */ - -static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; +static PyObject *__pyx_pf_11newanalysis_6correl_30calcAngularDisplacement(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor_ts, PyObject *__pyx_v_delta) { + int __pyx_v_maxTime; + int __pyx_v_natoms; + double __pyx_v_dt; + PyArrayObject *__pyx_v_msd = 0; + Correl *__pyx_v_myCorrel; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_ts; + __Pyx_Buffer __pyx_pybuffer_coor_ts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_msd; + __Pyx_Buffer __pyx_pybuffer_msd; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); + npy_intp *__pyx_t_1; + double __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyArrayObject *__pyx_t_8 = NULL; + Correl *__pyx_t_9; + char *__pyx_t_10; + char *__pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcAngularDisplacement", 0); + __pyx_pybuffer_msd.pybuffer.buf = NULL; + __pyx_pybuffer_msd.refcount = 0; + __pyx_pybuffernd_msd.data = NULL; + __pyx_pybuffernd_msd.rcbuffer = &__pyx_pybuffer_msd; + __pyx_pybuffer_coor_ts.pybuffer.buf = NULL; + __pyx_pybuffer_coor_ts.refcount = 0; + __pyx_pybuffernd_coor_ts.data = NULL; + __pyx_pybuffernd_coor_ts.rcbuffer = &__pyx_pybuffer_coor_ts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 905, __pyx_L1_error) + } + __pyx_pybuffernd_coor_ts.diminfo[0].strides = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_ts.diminfo[0].shape = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_ts.diminfo[1].strides = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_ts.diminfo[1].shape = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coor_ts.diminfo[2].strides = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coor_ts.diminfo[2].shape = __pyx_pybuffernd_coor_ts.rcbuffer->pybuffer.shape[2]; - /* "View.MemoryView":1383 - * cdef Py_ssize_t i + /* "newanalysis/helpers/correl.pyx":908 + * def calcAngularDisplacement(np.ndarray[np.float64_t,ndim=3] coor_ts, delta): * - * for i in range(shape[0]): # <<<<<<<<<<<<<< - * if ndim == 1: - * if inc: + * cdef int maxTime = coor_ts.shape[0] # <<<<<<<<<<<<<< + * cdef int natoms = coor_ts.shape[1] + * cdef double dt = delta */ - __pyx_t_1 = (__pyx_v_shape[0]); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_coor_ts)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 908, __pyx_L1_error) + __pyx_v_maxTime = ((int)(__pyx_t_1[0])); - /* "View.MemoryView":1384 + /* "newanalysis/helpers/correl.pyx":909 + * + * cdef int maxTime = coor_ts.shape[0] + * cdef int natoms = coor_ts.shape[1] # <<<<<<<<<<<<<< + * cdef double dt = delta * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) - */ - __pyx_t_4 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: - */ - __pyx_t_4 = (__pyx_v_inc != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":1386 - * if ndim == 1: - * if inc: - * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * Py_DECREF(( data)[0]) */ - Py_INCREF((((PyObject **)__pyx_v_data)[0])); + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_coor_ts)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 909, __pyx_L1_error) + __pyx_v_natoms = ((int)(__pyx_t_1[1])); - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: + /* "newanalysis/helpers/correl.pyx":910 + * cdef int maxTime = coor_ts.shape[0] + * cdef int natoms = coor_ts.shape[1] + * cdef double dt = delta # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.float64_t,ndim=2] msd = np.zeros((maxTime,3)) */ - goto __pyx_L6; - } + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_delta); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 910, __pyx_L1_error) + __pyx_v_dt = ((double)__pyx_t_2); - /* "View.MemoryView":1388 - * Py_INCREF(( data)[0]) - * else: - * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, + /* "newanalysis/helpers/correl.pyx":912 + * cdef double dt = delta + * + * cdef np.ndarray[np.float64_t,ndim=2] msd = np.zeros((maxTime,3)) # <<<<<<<<<<<<<< + * + * cdef Correl *myCorrel = new Correl() */ - /*else*/ { - Py_DECREF((((PyObject **)__pyx_v_data)[0])); - } - __pyx_L6:; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 912, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 912, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_maxTime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 912, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 912, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4)) __PYX_ERR(0, 912, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_3)) __PYX_ERR(0, 912, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 912, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 912, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msd.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_msd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 912, __pyx_L1_error) + } else {__pyx_pybuffernd_msd.diminfo[0].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msd.diminfo[0].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_msd.diminfo[1].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_msd.diminfo[1].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_8 = 0; + __pyx_v_msd = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":1384 + /* "newanalysis/helpers/correl.pyx":914 + * cdef np.ndarray[np.float64_t,ndim=2] msd = np.zeros((maxTime,3)) * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) + * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< + * + * myCorrel.msd_angvelmf( coor_ts.data, msd.data, natoms, maxTime, dt) */ - goto __pyx_L5; - } + try { + __pyx_t_9 = new Correl(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 914, __pyx_L1_error) + } + __pyx_v_myCorrel = __pyx_t_9; - /* "View.MemoryView":1390 - * Py_DECREF(( data)[0]) - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, inc) + /* "newanalysis/helpers/correl.pyx":916 + * cdef Correl *myCorrel = new Correl() + * + * myCorrel.msd_angvelmf( coor_ts.data, msd.data, natoms, maxTime, dt) # <<<<<<<<<<<<<< * + * del myCorrel */ - /*else*/ { + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coor_ts)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 916, __pyx_L1_error) + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_msd)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 916, __pyx_L1_error) + __pyx_v_myCorrel->msd_angvelmf(((double *)__pyx_t_10), ((double *)__pyx_t_11), __pyx_v_natoms, __pyx_v_maxTime, __pyx_v_dt); - /* "View.MemoryView":1391 - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, - * ndim - 1, inc) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":918 + * myCorrel.msd_angvelmf( coor_ts.data, msd.data, natoms, maxTime, dt) + * + * del myCorrel # <<<<<<<<<<<<<< * - * data += strides[0] + * return msd */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); - } - __pyx_L5:; + delete __pyx_v_myCorrel; - /* "View.MemoryView":1393 - * ndim - 1, inc) - * - * data += strides[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":920 + * del myCorrel * + * return msd # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0])); - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_msd); + __pyx_r = ((PyObject *)__pyx_v_msd); + goto __pyx_L0; - /* "View.MemoryView":1379 + /* "newanalysis/helpers/correl.pyx":905 + * return corr + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularDisplacement(np.ndarray[np.float64_t,ndim=3] coor_ts, delta): * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.calcAngularDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_msd); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1399 - * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - */ - -static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - - /* "View.MemoryView":1402 - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1403 - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) - */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - - /* "View.MemoryView":1405 - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * +/* "newanalysis/helpers/correl.pyx":922 + * return msd * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularVelocityXCorrel(np.ndarray[np.float64_t,ndim=3] coor1_ts, + * np.ndarray[np.float64_t,ndim=3] coor2_ts, */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":1399 - * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - */ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6correl_33calcAngularVelocityXCorrel(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_33calcAngularVelocityXCorrel = {"calcAngularVelocityXCorrel", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_33calcAngularVelocityXCorrel, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_33calcAngularVelocityXCorrel(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_coor1_ts = 0; + PyArrayObject *__pyx_v_coor2_ts = 0; + PyObject *__pyx_v_delta = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcAngularVelocityXCorrel (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 922, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1_ts,&__pyx_n_s_coor2_ts,&__pyx_n_s_delta,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor1_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor2_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcAngularVelocityXCorrel", 1, 3, 3, 1); __PYX_ERR(0, 922, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_delta)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcAngularVelocityXCorrel", 1, 3, 3, 2); __PYX_ERR(0, 922, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcAngularVelocityXCorrel") < 0)) __PYX_ERR(0, 922, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_coor1_ts = ((PyArrayObject *)values[0]); + __pyx_v_coor2_ts = ((PyArrayObject *)values[1]); + __pyx_v_delta = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcAngularVelocityXCorrel", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 922, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.correl.calcAngularVelocityXCorrel", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor1_ts), __pyx_ptype_5numpy_ndarray, 1, "coor1_ts", 0))) __PYX_ERR(0, 923, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor2_ts), __pyx_ptype_5numpy_ndarray, 1, "coor2_ts", 0))) __PYX_ERR(0, 924, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_32calcAngularVelocityXCorrel(__pyx_self, __pyx_v_coor1_ts, __pyx_v_coor2_ts, __pyx_v_delta); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1409 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: - */ - -static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_extent; - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; +static PyObject *__pyx_pf_11newanalysis_6correl_32calcAngularVelocityXCorrel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor1_ts, PyArrayObject *__pyx_v_coor2_ts, PyObject *__pyx_v_delta) { + int __pyx_v_maxTime; + int __pyx_v_natoms1; + int __pyx_v_natoms2; + double __pyx_v_dt; + PyArrayObject *__pyx_v_xcf = 0; + Correl *__pyx_v_myCorrel; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor1_ts; + __Pyx_Buffer __pyx_pybuffer_coor1_ts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor2_ts; + __Pyx_Buffer __pyx_pybuffer_coor2_ts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xcf; + __Pyx_Buffer __pyx_pybuffer_xcf; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + npy_intp *__pyx_t_1; + double __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyArrayObject *__pyx_t_8 = NULL; + Correl *__pyx_t_9; + char *__pyx_t_10; + char *__pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcAngularVelocityXCorrel", 0); + __pyx_pybuffer_xcf.pybuffer.buf = NULL; + __pyx_pybuffer_xcf.refcount = 0; + __pyx_pybuffernd_xcf.data = NULL; + __pyx_pybuffernd_xcf.rcbuffer = &__pyx_pybuffer_xcf; + __pyx_pybuffer_coor1_ts.pybuffer.buf = NULL; + __pyx_pybuffer_coor1_ts.refcount = 0; + __pyx_pybuffernd_coor1_ts.data = NULL; + __pyx_pybuffernd_coor1_ts.rcbuffer = &__pyx_pybuffer_coor1_ts; + __pyx_pybuffer_coor2_ts.pybuffer.buf = NULL; + __pyx_pybuffer_coor2_ts.refcount = 0; + __pyx_pybuffernd_coor2_ts.data = NULL; + __pyx_pybuffernd_coor2_ts.rcbuffer = &__pyx_pybuffer_coor2_ts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor1_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 922, __pyx_L1_error) + } + __pyx_pybuffernd_coor1_ts.diminfo[0].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor1_ts.diminfo[0].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor1_ts.diminfo[1].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor1_ts.diminfo[1].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coor1_ts.diminfo[2].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coor1_ts.diminfo[2].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor2_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 922, __pyx_L1_error) + } + __pyx_pybuffernd_coor2_ts.diminfo[0].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor2_ts.diminfo[0].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor2_ts.diminfo[1].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor2_ts.diminfo[1].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coor2_ts.diminfo[2].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coor2_ts.diminfo[2].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[2]; - /* "View.MemoryView":1413 - * size_t itemsize, void *item) nogil: - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t extent = shape[0] + /* "newanalysis/helpers/correl.pyx":927 + * delta): * + * cdef int maxTime = coor1_ts.shape[0] # <<<<<<<<<<<<<< + * cdef int natoms1 = coor1_ts.shape[1] + * cdef int natoms2 = coor2_ts.shape[1] */ - __pyx_v_stride = (__pyx_v_strides[0]); + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_coor1_ts)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 927, __pyx_L1_error) + __pyx_v_maxTime = ((int)(__pyx_t_1[0])); - /* "View.MemoryView":1414 - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] - * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":928 * - * if ndim == 1: + * cdef int maxTime = coor1_ts.shape[0] + * cdef int natoms1 = coor1_ts.shape[1] # <<<<<<<<<<<<<< + * cdef int natoms2 = coor2_ts.shape[1] + * cdef double dt = delta */ - __pyx_v_extent = (__pyx_v_shape[0]); + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_coor1_ts)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 928, __pyx_L1_error) + __pyx_v_natoms1 = ((int)(__pyx_t_1[1])); - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] + /* "newanalysis/helpers/correl.pyx":929 + * cdef int maxTime = coor1_ts.shape[0] + * cdef int natoms1 = coor1_ts.shape[1] + * cdef int natoms2 = coor2_ts.shape[1] # <<<<<<<<<<<<<< + * cdef double dt = delta * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_coor2_ts)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 929, __pyx_L1_error) + __pyx_v_natoms2 = ((int)(__pyx_t_1[1])); - /* "View.MemoryView":1417 + /* "newanalysis/helpers/correl.pyx":930 + * cdef int natoms1 = coor1_ts.shape[1] + * cdef int natoms2 = coor2_ts.shape[1] + * cdef double dt = delta # <<<<<<<<<<<<<< * - * if ndim == 1: - * for i in range(extent): # <<<<<<<<<<<<<< - * memcpy(data, item, itemsize) - * data += stride - */ - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1418 - * if ndim == 1: - * for i in range(extent): - * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< - * data += stride - * else: + * cdef np.ndarray[np.float64_t,ndim=2] xcf = np.zeros((maxTime,3)) */ - (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_delta); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 930, __pyx_L1_error) + __pyx_v_dt = ((double)__pyx_t_2); - /* "View.MemoryView":1419 - * for i in range(extent): - * memcpy(data, item, itemsize) - * data += stride # <<<<<<<<<<<<<< - * else: - * for i in range(extent): + /* "newanalysis/helpers/correl.pyx":932 + * cdef double dt = delta + * + * cdef np.ndarray[np.float64_t,ndim=2] xcf = np.zeros((maxTime,3)) # <<<<<<<<<<<<<< + * + * cdef Correl *myCorrel = new Correl() */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_maxTime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4)) __PYX_ERR(0, 932, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_3)) __PYX_ERR(0, 932, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 932, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xcf.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_xcf = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_xcf.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 932, __pyx_L1_error) + } else {__pyx_pybuffernd_xcf.diminfo[0].strides = __pyx_pybuffernd_xcf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xcf.diminfo[0].shape = __pyx_pybuffernd_xcf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xcf.diminfo[1].strides = __pyx_pybuffernd_xcf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xcf.diminfo[1].shape = __pyx_pybuffernd_xcf.rcbuffer->pybuffer.shape[1]; } + } + __pyx_t_8 = 0; + __pyx_v_xcf = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] + /* "newanalysis/helpers/correl.pyx":934 + * cdef np.ndarray[np.float64_t,ndim=2] xcf = np.zeros((maxTime,3)) * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) + * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< + * + * myCorrel.xcorrel_angvelmf( coor1_ts.data, coor2_ts.data, xcf.data, natoms1, natoms2, maxTime, dt) */ - goto __pyx_L3; + try { + __pyx_t_9 = new Correl(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 934, __pyx_L1_error) } + __pyx_v_myCorrel = __pyx_t_9; - /* "View.MemoryView":1421 - * data += stride - * else: - * for i in range(extent): # <<<<<<<<<<<<<< - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) + /* "newanalysis/helpers/correl.pyx":936 + * cdef Correl *myCorrel = new Correl() + * + * myCorrel.xcorrel_angvelmf( coor1_ts.data, coor2_ts.data, xcf.data, natoms1, natoms2, maxTime, dt) # <<<<<<<<<<<<<< + * + * del myCorrel */ - /*else*/ { - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coor1_ts)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 936, __pyx_L1_error) + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coor2_ts)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 936, __pyx_L1_error) + __pyx_t_12 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xcf)); if (unlikely(__pyx_t_12 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 936, __pyx_L1_error) + __pyx_v_myCorrel->xcorrel_angvelmf(((double *)__pyx_t_10), ((double *)__pyx_t_11), ((double *)__pyx_t_12), __pyx_v_natoms1, __pyx_v_natoms2, __pyx_v_maxTime, __pyx_v_dt); - /* "View.MemoryView":1422 - * else: - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, itemsize, item) - * data += stride + /* "newanalysis/helpers/correl.pyx":938 + * myCorrel.xcorrel_angvelmf( coor1_ts.data, coor2_ts.data, xcf.data, natoms1, natoms2, maxTime, dt) + * + * del myCorrel # <<<<<<<<<<<<<< + * + * return xcf */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + delete __pyx_v_myCorrel; - /* "View.MemoryView":1424 - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - * data += stride # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":940 + * del myCorrel * + * return xcf # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - } - __pyx_L3:; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_xcf); + __pyx_r = ((PyObject *)__pyx_v_xcf); + goto __pyx_L0; - /* "View.MemoryView":1409 + /* "newanalysis/helpers/correl.pyx":922 + * return msd * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularVelocityXCorrel(np.ndarray[np.float64_t,ndim=3] coor1_ts, + * np.ndarray[np.float64_t,ndim=3] coor2_ts, */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xcf.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.calcAngularVelocityXCorrel", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xcf.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_xcf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result +/* "newanalysis/helpers/correl.pyx":942 + * return xcf + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcRelativeAngDisp(np.ndarray[np.float64_t,ndim=3] coor1_ts, + * np.ndarray[np.float64_t,ndim=3] coor2_ts, */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; +static PyObject *__pyx_pw_11newanalysis_6correl_35calcRelativeAngDisp(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6correl_35calcRelativeAngDisp = {"calcRelativeAngDisp", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6correl_35calcRelativeAngDisp, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6correl_35calcRelativeAngDisp(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_coor1_ts = 0; + PyArrayObject *__pyx_v_coor2_ts = 0; + PyObject *__pyx_v_delta = 0; + PyObject *__pyx_v_ncut = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + __Pyx_RefNannySetupContext("calcRelativeAngDisp (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 942, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1_ts,&__pyx_n_s_coor2_ts,&__pyx_n_s_delta,&__pyx_n_s_ncut,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor1_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor2_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calcRelativeAngDisp", 1, 4, 4, 1); __PYX_ERR(0, 942, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_delta)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcRelativeAngDisp", 1, 4, 4, 2); __PYX_ERR(0, 942, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ncut)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calcRelativeAngDisp", 1, 4, 4, 3); __PYX_ERR(0, 942, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcRelativeAngDisp") < 0)) __PYX_ERR(0, 942, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 4)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); } - __pyx_v___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error) - __pyx_v___pyx_state = values[2]; + __pyx_v_coor1_ts = ((PyArrayObject *)values[0]); + __pyx_v_coor2_ts = ((PyArrayObject *)values[1]); + __pyx_v_delta = values[2]; + __pyx_v_ncut = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calcRelativeAngDisp", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 942, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.correl.calcRelativeAngDisp", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor1_ts), __pyx_ptype_5numpy_ndarray, 1, "coor1_ts", 0))) __PYX_ERR(0, 943, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor2_ts), __pyx_ptype_5numpy_ndarray, 1, "coor2_ts", 0))) __PYX_ERR(0, 944, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6correl_34calcRelativeAngDisp(__pyx_self, __pyx_v_coor1_ts, __pyx_v_coor2_ts, __pyx_v_delta, __pyx_v_ncut); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; +static PyObject *__pyx_pf_11newanalysis_6correl_34calcRelativeAngDisp(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor1_ts, PyArrayObject *__pyx_v_coor2_ts, PyObject *__pyx_v_delta, PyObject *__pyx_v_ncut) { + int __pyx_v_maxTime; + int __pyx_v_natoms1; + int __pyx_v_natoms2; + double __pyx_v_dt; + PyArrayObject *__pyx_v_wcorr1 = 0; + PyArrayObject *__pyx_v_wcorr2 = 0; + PyArrayObject *__pyx_v_wxcorr = 0; + Correl *__pyx_v_myCorrel; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor1_ts; + __Pyx_Buffer __pyx_pybuffer_coor1_ts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor2_ts; + __Pyx_Buffer __pyx_pybuffer_coor2_ts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_wcorr1; + __Pyx_Buffer __pyx_pybuffer_wcorr1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_wcorr2; + __Pyx_Buffer __pyx_pybuffer_wcorr2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_wxcorr; + __Pyx_Buffer __pyx_pybuffer_wxcorr; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; + npy_intp *__pyx_t_1; + double __pyx_t_2; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; + int __pyx_t_6; + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + Correl *__pyx_t_10; + char *__pyx_t_11; + char *__pyx_t_12; + char *__pyx_t_13; + char *__pyx_t_14; + char *__pyx_t_15; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + __Pyx_RefNannySetupContext("calcRelativeAngDisp", 0); + __pyx_pybuffer_wcorr1.pybuffer.buf = NULL; + __pyx_pybuffer_wcorr1.refcount = 0; + __pyx_pybuffernd_wcorr1.data = NULL; + __pyx_pybuffernd_wcorr1.rcbuffer = &__pyx_pybuffer_wcorr1; + __pyx_pybuffer_wcorr2.pybuffer.buf = NULL; + __pyx_pybuffer_wcorr2.refcount = 0; + __pyx_pybuffernd_wcorr2.data = NULL; + __pyx_pybuffernd_wcorr2.rcbuffer = &__pyx_pybuffer_wcorr2; + __pyx_pybuffer_wxcorr.pybuffer.buf = NULL; + __pyx_pybuffer_wxcorr.refcount = 0; + __pyx_pybuffernd_wxcorr.data = NULL; + __pyx_pybuffernd_wxcorr.rcbuffer = &__pyx_pybuffer_wxcorr; + __pyx_pybuffer_coor1_ts.pybuffer.buf = NULL; + __pyx_pybuffer_coor1_ts.refcount = 0; + __pyx_pybuffernd_coor1_ts.data = NULL; + __pyx_pybuffernd_coor1_ts.rcbuffer = &__pyx_pybuffer_coor1_ts; + __pyx_pybuffer_coor2_ts.pybuffer.buf = NULL; + __pyx_pybuffer_coor2_ts.refcount = 0; + __pyx_pybuffernd_coor2_ts.data = NULL; + __pyx_pybuffernd_coor2_ts.rcbuffer = &__pyx_pybuffer_coor2_ts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor1_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 942, __pyx_L1_error) + } + __pyx_pybuffernd_coor1_ts.diminfo[0].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor1_ts.diminfo[0].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor1_ts.diminfo[1].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor1_ts.diminfo[1].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coor1_ts.diminfo[2].strides = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coor1_ts.diminfo[2].shape = __pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor2_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 942, __pyx_L1_error) + } + __pyx_pybuffernd_coor2_ts.diminfo[0].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor2_ts.diminfo[0].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor2_ts.diminfo[1].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor2_ts.diminfo[1].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coor2_ts.diminfo[2].strides = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coor2_ts.diminfo[2].shape = __pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer.shape[2]; - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) + /* "newanalysis/helpers/correl.pyx":947 + * delta, ncut): + * + * cdef int maxTime = coor1_ts.shape[0] # <<<<<<<<<<<<<< + * cdef int natoms1 = coor1_ts.shape[1] + * cdef int natoms2 = coor2_ts.shape[1] + */ + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_coor1_ts)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 947, __pyx_L1_error) + __pyx_v_maxTime = ((int)(__pyx_t_1[0])); + + /* "newanalysis/helpers/correl.pyx":948 + * + * cdef int maxTime = coor1_ts.shape[0] + * cdef int natoms1 = coor1_ts.shape[1] # <<<<<<<<<<<<<< + * cdef int natoms2 = coor2_ts.shape[1] + * cdef double dt = delta + */ + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_coor1_ts)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 948, __pyx_L1_error) + __pyx_v_natoms1 = ((int)(__pyx_t_1[1])); + + /* "newanalysis/helpers/correl.pyx":949 + * cdef int maxTime = coor1_ts.shape[0] + * cdef int natoms1 = coor1_ts.shape[1] + * cdef int natoms2 = coor2_ts.shape[1] # <<<<<<<<<<<<<< + * cdef double dt = delta + * */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__21, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_coor2_ts)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L1_error) + __pyx_v_natoms2 = ((int)(__pyx_t_1[1])); - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) + /* "newanalysis/helpers/correl.pyx":950 + * cdef int natoms1 = coor1_ts.shape[1] + * cdef int natoms2 = coor2_ts.shape[1] + * cdef double dt = delta # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.float64_t,ndim=1] wcorr1 = np.zeros(ncut) */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); - __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_delta); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 950, __pyx_L1_error) + __pyx_v_dt = ((double)__pyx_t_2); - /* "(tree fragment)":6 - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: + /* "newanalysis/helpers/correl.pyx":952 + * cdef double dt = delta + * + * cdef np.ndarray[np.float64_t,ndim=1] wcorr1 = np.zeros(ncut) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] wcorr2 = np.zeros(ncut) + * cdef np.ndarray[np.float64_t,ndim=1] wxcorr = np.zeros(ncut) */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_v___pyx_PickleError); - __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_ncut}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 6, __pyx_L1_error) - - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - */ } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 952, __pyx_L1_error) + __pyx_t_7 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wcorr1.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_wcorr1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_wcorr1.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 952, __pyx_L1_error) + } else {__pyx_pybuffernd_wcorr1.diminfo[0].strides = __pyx_pybuffernd_wcorr1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wcorr1.diminfo[0].shape = __pyx_pybuffernd_wcorr1.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_7 = 0; + __pyx_v_wcorr1 = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + /* "newanalysis/helpers/correl.pyx":953 + * + * cdef np.ndarray[np.float64_t,ndim=1] wcorr1 = np.zeros(ncut) + * cdef np.ndarray[np.float64_t,ndim=1] wcorr2 = np.zeros(ncut) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] wxcorr = np.zeros(ncut) + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 953, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 953, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_ncut}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 953, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 953, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wcorr2.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_wcorr2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_wcorr2.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 953, __pyx_L1_error) + } else {__pyx_pybuffernd_wcorr2.diminfo[0].strides = __pyx_pybuffernd_wcorr2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wcorr2.diminfo[0].shape = __pyx_pybuffernd_wcorr2.rcbuffer->pybuffer.shape[0]; } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 7, __pyx_L1_error) + __pyx_t_8 = 0; + __pyx_v_wcorr2 = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "newanalysis/helpers/correl.pyx":954 + * cdef np.ndarray[np.float64_t,ndim=1] wcorr1 = np.zeros(ncut) + * cdef np.ndarray[np.float64_t,ndim=1] wcorr2 = np.zeros(ncut) + * cdef np.ndarray[np.float64_t,ndim=1] wxcorr = np.zeros(ncut) # <<<<<<<<<<<<<< + * + * cdef Correl *myCorrel = new Correl() + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 954, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 954, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_ncut}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 954, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 954, __pyx_L1_error) + __pyx_t_9 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wxcorr.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_wxcorr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_wxcorr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 954, __pyx_L1_error) + } else {__pyx_pybuffernd_wxcorr.diminfo[0].strides = __pyx_pybuffernd_wxcorr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wxcorr.diminfo[0].shape = __pyx_pybuffernd_wxcorr.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_9 = 0; + __pyx_v_wxcorr = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "newanalysis/helpers/correl.pyx":956 + * cdef np.ndarray[np.float64_t,ndim=1] wxcorr = np.zeros(ncut) + * + * cdef Correl *myCorrel = new Correl() # <<<<<<<<<<<<<< + * + * myCorrel.rel_angvelmf( coor1_ts.data, coor2_ts.data, wcorr1.data, wcorr2.data, wxcorr.data, natoms1, natoms2, maxTime, ncut, dt) */ - __pyx_t_3 = (__pyx_v___pyx_state != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { + try { + __pyx_t_10 = new Correl(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 956, __pyx_L1_error) + } + __pyx_v_myCorrel = __pyx_t_10; - /* "(tree fragment)":9 - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + /* "newanalysis/helpers/correl.pyx":958 + * cdef Correl *myCorrel = new Correl() + * + * myCorrel.rel_angvelmf( coor1_ts.data, coor2_ts.data, wcorr1.data, wcorr2.data, wxcorr.data, natoms1, natoms2, maxTime, ncut, dt) # <<<<<<<<<<<<<< + * + * del myCorrel */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_t_4 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coor1_ts)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L1_error) + __pyx_t_12 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coor2_ts)); if (unlikely(__pyx_t_12 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L1_error) + __pyx_t_13 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_wcorr1)); if (unlikely(__pyx_t_13 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L1_error) + __pyx_t_14 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_wcorr2)); if (unlikely(__pyx_t_14 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L1_error) + __pyx_t_15 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_wxcorr)); if (unlikely(__pyx_t_15 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_ncut); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L1_error) + __pyx_v_myCorrel->rel_angvelmf(((double *)__pyx_t_11), ((double *)__pyx_t_12), ((double *)__pyx_t_13), ((double *)__pyx_t_14), ((double *)__pyx_t_15), __pyx_v_natoms1, __pyx_v_natoms2, __pyx_v_maxTime, ((int)__pyx_t_6), __pyx_v_dt); - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "newanalysis/helpers/correl.pyx":960 + * myCorrel.rel_angvelmf( coor1_ts.data, coor2_ts.data, wcorr1.data, wcorr2.data, wxcorr.data, natoms1, natoms2, maxTime, ncut, dt) + * + * del myCorrel # <<<<<<<<<<<<<< + * + * return wcorr1, wcorr2, wxcorr */ - } + delete __pyx_v_myCorrel; - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] + /* "newanalysis/helpers/correl.pyx":962 + * del myCorrel + * + * return wcorr1, wcorr2, wxcorr # <<<<<<<<<<<<<< + * + * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 962, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF((PyObject *)__pyx_v_wcorr1); + __Pyx_GIVEREF((PyObject *)__pyx_v_wcorr1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_wcorr1))) __PYX_ERR(0, 962, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_wcorr2); + __Pyx_GIVEREF((PyObject *)__pyx_v_wcorr2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_wcorr2))) __PYX_ERR(0, 962, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_wxcorr); + __Pyx_GIVEREF((PyObject *)__pyx_v_wxcorr); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_wxcorr))) __PYX_ERR(0, 962, __pyx_L1_error); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "newanalysis/helpers/correl.pyx":942 + * return xcf + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcRelativeAngDisp(np.ndarray[np.float64_t,ndim=3] coor1_ts, + * np.ndarray[np.float64_t,ndim=3] coor2_ts, */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wcorr1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wcorr2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wxcorr.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.correl.calcRelativeAngDisp", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - */ - -static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->name); - __Pyx_DECREF(__pyx_v___pyx_result->name); - __pyx_v___pyx_result->name = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 13, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_4 = ((__pyx_t_3 > 1) != 0); - if (__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { - - /* "(tree fragment)":14 - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 14, __pyx_L1_error) - } - __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - } - - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor1_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor2_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wcorr1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wcorr2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wxcorr.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_wcorr1); + __Pyx_XDECREF((PyObject *)__pyx_v_wcorr2); + __Pyx_XDECREF((PyObject *)__pyx_v_wxcorr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -33113,12 +37479,17 @@ static struct __pyx_vtabstruct_array __pyx_vtable_array; static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_array_obj *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_array_obj *)o); p->__pyx_vtab = __pyx_vtabptr_array; p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); @@ -33133,8 +37504,10 @@ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { static void __pyx_tp_dealloc_array(PyObject *o) { struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif { @@ -33147,7 +37520,14 @@ static void __pyx_tp_dealloc_array(PyObject *o) { } Py_CLEAR(p->mode); Py_CLEAR(p->_format); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { PyObject *r; @@ -33162,8 +37542,11 @@ static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { return __pyx_array___setitem__(o, i, v); } else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); return -1; } } @@ -33183,8 +37566,8 @@ static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED vo static PyMethodDef __pyx_methods_array[] = { {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -33192,6 +37575,50 @@ static struct PyGetSetDef __pyx_getsets_array[] = { {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "newanalysis.correl.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else static PySequenceMethods __pyx_tp_as_sequence_array = { __pyx_array___len__, /*sq_length*/ @@ -33231,7 +37658,7 @@ static PyBufferProcs __pyx_tp_as_buffer_array = { static PyTypeObject __pyx_type___pyx_array = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.correl.array", /*tp_name*/ + "newanalysis.correl.""array", /*tp_name*/ sizeof(struct __pyx_array_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_array, /*tp_dealloc*/ @@ -33259,7 +37686,7 @@ static PyTypeObject __pyx_type___pyx_array = { __pyx_tp_getattro_array, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ @@ -33274,7 +37701,9 @@ static PyTypeObject __pyx_type___pyx_array = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_array, /*tp_new*/ @@ -33288,28 +37717,41 @@ static PyTypeObject __pyx_type___pyx_array = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_MemviewEnum_obj *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_MemviewEnum_obj *)o); p->name = Py_None; Py_INCREF(Py_None); return o; @@ -33318,13 +37760,22 @@ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, C static void __pyx_tp_dealloc_Enum(PyObject *o) { struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); Py_CLEAR(p->name); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { @@ -33345,15 +37796,39 @@ static int __pyx_tp_clear_Enum(PyObject *o) { return 0; } +static PyObject *__pyx_specialmethod___pyx_MemviewEnum___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_MemviewEnum___repr__(self); +} + static PyMethodDef __pyx_methods_Enum[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0}, + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_MemviewEnum___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "newanalysis.correl.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_MemviewEnum_slots, +}; +#else static PyTypeObject __pyx_type___pyx_MemviewEnum = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.correl.Enum", /*tp_name*/ + "newanalysis.correl.""Enum", /*tp_name*/ sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_Enum, /*tp_dealloc*/ @@ -33396,7 +37871,9 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif __pyx_MemviewEnum___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_Enum, /*tp_new*/ @@ -33410,29 +37887,42 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_memoryview_obj *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_memoryview_obj *)o); p->__pyx_vtab = __pyx_vtabptr_memoryview; p->obj = Py_None; Py_INCREF(Py_None); @@ -33449,8 +37939,10 @@ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject static void __pyx_tp_dealloc_memoryview(PyObject *o) { struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -33465,7 +37957,14 @@ static void __pyx_tp_dealloc_memoryview(PyObject *o) { Py_CLEAR(p->obj); Py_CLEAR(p->_size); Py_CLEAR(p->_array_interface); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { @@ -33514,8 +38013,11 @@ static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject return __pyx_memoryview___setitem__(o, i, v); } else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); return -1; } } @@ -33556,13 +38058,18 @@ static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); } +static PyObject *__pyx_specialmethod___pyx_memoryview___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_memoryview___repr__(self); +} + static PyMethodDef __pyx_methods_memoryview[] = { - {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0}, - {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0}, - {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0}, - {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0}, + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_memoryview___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"is_c_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -33578,6 +38085,53 @@ static struct PyGetSetDef __pyx_getsets_memoryview[] = { {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "newanalysis.correl.memoryview", + sizeof(struct __pyx_memoryview_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_memoryview_slots, +}; +#else static PySequenceMethods __pyx_tp_as_sequence_memoryview = { __pyx_memoryview___len__, /*sq_length*/ @@ -33617,7 +38171,7 @@ static PyBufferProcs __pyx_tp_as_buffer_memoryview = { static PyTypeObject __pyx_type___pyx_memoryview = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.correl.memoryview", /*tp_name*/ + "newanalysis.correl.""memoryview", /*tp_name*/ sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ @@ -33660,7 +38214,9 @@ static PyTypeObject __pyx_type___pyx_memoryview = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_memoryview, /*tp_new*/ @@ -33674,18 +38230,26 @@ static PyTypeObject __pyx_type___pyx_memoryview = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { @@ -33694,6 +38258,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO if (unlikely(!o)) return 0; p = ((struct __pyx_memoryviewslice_obj *)o); p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + new((void*)&(p->from_slice)) __Pyx_memviewslice(); p->from_object = Py_None; Py_INCREF(Py_None); p->from_slice.memview = NULL; return o; @@ -33702,8 +38267,10 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -33715,6 +38282,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } + __Pyx_call_destructor(p->from_slice); Py_CLEAR(p->from_object); PyObject_GC_Track(o); __pyx_tp_dealloc_memoryview(o); @@ -33737,28 +38305,37 @@ static int __pyx_tp_clear__memoryviewslice(PyObject *o) { tmp = ((PyObject*)p->from_object); p->from_object = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - __PYX_XDEC_MEMVIEW(&p->from_slice, 1); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); return 0; } -static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o); -} - static PyMethodDef __pyx_methods__memoryviewslice[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; - -static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = { - {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, }; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "newanalysis.correl._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else static PyTypeObject __pyx_type___pyx_memoryviewslice = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.correl._memoryviewslice", /*tp_name*/ + "newanalysis.correl.""_memoryviewslice", /*tp_name*/ sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ @@ -33776,7 +38353,7 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif - #if CYTHON_COMPILING_IN_PYPY + #if CYTHON_COMPILING_IN_PYPY || 0 __pyx_memoryview___repr__, /*tp_repr*/ #else 0, /*tp_repr*/ @@ -33786,7 +38363,7 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY + #if CYTHON_COMPILING_IN_PYPY || 0 __pyx_memoryview___str__, /*tp_str*/ #else 0, /*tp_str*/ @@ -33794,8 +38371,8 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Internal class for passing memoryview slices to Python", /*tp_doc*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ __pyx_tp_clear__memoryviewslice, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -33804,12 +38381,14 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_iternext*/ __pyx_methods__memoryviewslice, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets__memoryviewslice, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new__memoryviewslice, /*tp_new*/ @@ -33823,54 +38402,30 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_correl(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_correl}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "correl", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE @@ -33880,768 +38435,719 @@ static struct PyModuleDef __pyx_moduledef = { #define CYTHON_SMALL_CODE #endif #endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, - {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, - {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0}, - {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, - {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, - {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, - {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0}, - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, - {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, - {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, - {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, - {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, - {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, - {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, - {&__pyx_n_s_ans, __pyx_k_ans, sizeof(__pyx_k_ans), 0, 0, 1, 1}, - {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, - {&__pyx_n_s_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 0, 0, 1, 1}, - {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, - {&__pyx_n_s_calcAngularDisplacement, __pyx_k_calcAngularDisplacement, sizeof(__pyx_k_calcAngularDisplacement), 0, 0, 1, 1}, - {&__pyx_n_s_calcAngularVelocityXCorrel, __pyx_k_calcAngularVelocityXCorrel, sizeof(__pyx_k_calcAngularVelocityXCorrel), 0, 0, 1, 1}, - {&__pyx_n_s_calcRelativeAngDisp, __pyx_k_calcRelativeAngDisp, sizeof(__pyx_k_calcRelativeAngDisp), 0, 0, 1, 1}, - {&__pyx_n_s_ccorr, __pyx_k_ccorr, sizeof(__pyx_k_ccorr), 0, 0, 1, 1}, - {&__pyx_n_s_ccrosscorr, __pyx_k_ccrosscorr, sizeof(__pyx_k_ccrosscorr), 0, 0, 1, 1}, - {&__pyx_n_s_ccrossctr, __pyx_k_ccrossctr, sizeof(__pyx_k_ccrossctr), 0, 0, 1, 1}, - {&__pyx_n_s_cctr, __pyx_k_cctr, sizeof(__pyx_k_cctr), 0, 0, 1, 1}, - {&__pyx_n_s_cdata, __pyx_k_cdata, sizeof(__pyx_k_cdata), 0, 0, 1, 1}, - {&__pyx_n_s_cdata1, __pyx_k_cdata1, sizeof(__pyx_k_cdata1), 0, 0, 1, 1}, - {&__pyx_n_s_cdata2, __pyx_k_cdata2, sizeof(__pyx_k_cdata2), 0, 0, 1, 1}, - {&__pyx_n_s_cds, __pyx_k_cds, sizeof(__pyx_k_cds), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_contdata, __pyx_k_contdata, sizeof(__pyx_k_contdata), 0, 0, 1, 1}, - {&__pyx_n_s_contdata1, __pyx_k_contdata1, sizeof(__pyx_k_contdata1), 0, 0, 1, 1}, - {&__pyx_n_s_contdata2, __pyx_k_contdata2, sizeof(__pyx_k_contdata2), 0, 0, 1, 1}, - {&__pyx_n_s_contds, __pyx_k_contds, sizeof(__pyx_k_contds), 0, 0, 1, 1}, - {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, - {&__pyx_n_s_coor1_ts, __pyx_k_coor1_ts, sizeof(__pyx_k_coor1_ts), 0, 0, 1, 1}, - {&__pyx_n_s_coor2_ts, __pyx_k_coor2_ts, sizeof(__pyx_k_coor2_ts), 0, 0, 1, 1}, - {&__pyx_n_s_coor_ts, __pyx_k_coor_ts, sizeof(__pyx_k_coor_ts), 0, 0, 1, 1}, - {&__pyx_n_s_corr, __pyx_k_corr, sizeof(__pyx_k_corr), 0, 0, 1, 1}, - {&__pyx_n_s_corrdim, __pyx_k_corrdim, sizeof(__pyx_k_corrdim), 0, 0, 1, 1}, - {&__pyx_n_s_correlate, __pyx_k_correlate, sizeof(__pyx_k_correlate), 0, 0, 1, 1}, - {&__pyx_n_s_correlateParallel, __pyx_k_correlateParallel, sizeof(__pyx_k_correlateParallel), 0, 0, 1, 1}, - {&__pyx_n_s_crosscorr, __pyx_k_crosscorr, sizeof(__pyx_k_crosscorr), 0, 0, 1, 1}, - {&__pyx_n_s_crossctr, __pyx_k_crossctr, sizeof(__pyx_k_crossctr), 0, 0, 1, 1}, - {&__pyx_n_s_cselfcorr, __pyx_k_cselfcorr, sizeof(__pyx_k_cselfcorr), 0, 0, 1, 1}, - {&__pyx_n_s_cselfctr, __pyx_k_cselfctr, sizeof(__pyx_k_cselfctr), 0, 0, 1, 1}, - {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, - {&__pyx_n_s_d1, __pyx_k_d1, sizeof(__pyx_k_d1), 0, 0, 1, 1}, - {&__pyx_n_s_d2, __pyx_k_d2, sizeof(__pyx_k_d2), 0, 0, 1, 1}, - {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, - {&__pyx_n_s_data1, __pyx_k_data1, sizeof(__pyx_k_data1), 0, 0, 1, 1}, - {&__pyx_n_s_data2, __pyx_k_data2, sizeof(__pyx_k_data2), 0, 0, 1, 1}, - {&__pyx_n_s_datapoints, __pyx_k_datapoints, sizeof(__pyx_k_datapoints), 0, 0, 1, 1}, - {&__pyx_n_s_delta, __pyx_k_delta, sizeof(__pyx_k_delta), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 0, 0, 1, 1}, - {&__pyx_n_s_ds, __pyx_k_ds, sizeof(__pyx_k_ds), 0, 0, 1, 1}, - {&__pyx_n_s_dsidx, __pyx_k_dsidx, sizeof(__pyx_k_dsidx), 0, 0, 1, 1}, - {&__pyx_n_s_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, - {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1}, - {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, - {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, - {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_istart, __pyx_k_istart, sizeof(__pyx_k_istart), 0, 0, 1, 1}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, - {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, - {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, - {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, - {&__pyx_n_s_lowhigh, __pyx_k_lowhigh, sizeof(__pyx_k_lowhigh), 0, 0, 1, 1}, - {&__pyx_n_s_ltc, __pyx_k_ltc, sizeof(__pyx_k_ltc), 0, 0, 1, 1}, - {&__pyx_n_s_ltc_2, __pyx_k_ltc_2, sizeof(__pyx_k_ltc_2), 0, 0, 1, 1}, - {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_maxTime, __pyx_k_maxTime, sizeof(__pyx_k_maxTime), 0, 0, 1, 1}, - {&__pyx_n_s_maxdt, __pyx_k_maxdt, sizeof(__pyx_k_maxdt), 0, 0, 1, 1}, - {&__pyx_n_s_maxlen, __pyx_k_maxlen, sizeof(__pyx_k_maxlen), 0, 0, 1, 1}, - {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, - {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, - {&__pyx_n_s_mol, __pyx_k_mol, sizeof(__pyx_k_mol), 0, 0, 1, 1}, - {&__pyx_n_s_msd, __pyx_k_msd, sizeof(__pyx_k_msd), 0, 0, 1, 1}, - {&__pyx_n_s_myCorrel, __pyx_k_myCorrel, sizeof(__pyx_k_myCorrel), 0, 0, 1, 1}, - {&__pyx_n_s_myplan, __pyx_k_myplan, sizeof(__pyx_k_myplan), 0, 0, 1, 1}, - {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, - {&__pyx_n_s_n_2, __pyx_k_n_2, sizeof(__pyx_k_n_2), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_natoms, __pyx_k_natoms, sizeof(__pyx_k_natoms), 0, 0, 1, 1}, - {&__pyx_n_s_natoms1, __pyx_k_natoms1, sizeof(__pyx_k_natoms1), 0, 0, 1, 1}, - {&__pyx_n_s_natoms2, __pyx_k_natoms2, sizeof(__pyx_k_natoms2), 0, 0, 1, 1}, - {&__pyx_n_s_nc, __pyx_k_nc, sizeof(__pyx_k_nc), 0, 0, 1, 1}, - {&__pyx_n_s_ncut, __pyx_k_ncut, sizeof(__pyx_k_ncut), 0, 0, 1, 1}, - {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, - {&__pyx_n_s_nds, __pyx_k_nds, sizeof(__pyx_k_nds), 0, 0, 1, 1}, - {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, - {&__pyx_n_s_newanalysis_correl, __pyx_k_newanalysis_correl, sizeof(__pyx_k_newanalysis_correl), 0, 0, 1, 1}, - {&__pyx_n_s_nmol, __pyx_k_nmol, sizeof(__pyx_k_nmol), 0, 0, 1, 1}, - {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, - {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, - {&__pyx_n_s_nshells, __pyx_k_nshells, sizeof(__pyx_k_nshells), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, - {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1}, - {&__pyx_n_s_p_ans, __pyx_k_p_ans, sizeof(__pyx_k_p_ans), 0, 0, 1, 1}, - {&__pyx_n_s_p_data1, __pyx_k_p_data1, sizeof(__pyx_k_p_data1), 0, 0, 1, 1}, - {&__pyx_n_s_p_data2, __pyx_k_p_data2, sizeof(__pyx_k_p_data2), 0, 0, 1, 1}, - {&__pyx_n_s_p_out, __pyx_k_p_out, sizeof(__pyx_k_p_out), 0, 0, 1, 1}, - {&__pyx_n_s_p_tmp, __pyx_k_p_tmp, sizeof(__pyx_k_p_tmp), 0, 0, 1, 1}, - {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, - {&__pyx_n_s_pcorr, __pyx_k_pcorr, sizeof(__pyx_k_pcorr), 0, 0, 1, 1}, - {&__pyx_n_s_pcorrdim, __pyx_k_pcorrdim, sizeof(__pyx_k_pcorrdim), 0, 0, 1, 1}, - {&__pyx_n_s_pcrosscorr, __pyx_k_pcrosscorr, sizeof(__pyx_k_pcrosscorr), 0, 0, 1, 1}, - {&__pyx_n_s_pdata, __pyx_k_pdata, sizeof(__pyx_k_pdata), 0, 0, 1, 1}, - {&__pyx_n_s_pdata1, __pyx_k_pdata1, sizeof(__pyx_k_pdata1), 0, 0, 1, 1}, - {&__pyx_n_s_pdata2, __pyx_k_pdata2, sizeof(__pyx_k_pdata2), 0, 0, 1, 1}, - {&__pyx_n_s_pds, __pyx_k_pds, sizeof(__pyx_k_pds), 0, 0, 1, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_n_s_pnshells, __pyx_k_pnshells, sizeof(__pyx_k_pnshells), 0, 0, 1, 1}, - {&__pyx_n_s_point, __pyx_k_point, sizeof(__pyx_k_point), 0, 0, 1, 1}, - {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, - {&__pyx_n_s_pselfcorr, __pyx_k_pselfcorr, sizeof(__pyx_k_pselfcorr), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_rotTs, __pyx_k_rotTs, sizeof(__pyx_k_rotTs), 0, 0, 1, 1}, - {&__pyx_n_s_rotTs1, __pyx_k_rotTs1, sizeof(__pyx_k_rotTs1), 0, 0, 1, 1}, - {&__pyx_n_s_rotTs2, __pyx_k_rotTs2, sizeof(__pyx_k_rotTs2), 0, 0, 1, 1}, - {&__pyx_n_s_rotTs3, __pyx_k_rotTs3, sizeof(__pyx_k_rotTs3), 0, 0, 1, 1}, - {&__pyx_n_s_rotationMatrixShellCorrelate, __pyx_k_rotationMatrixShellCorrelate, sizeof(__pyx_k_rotationMatrixShellCorrelate), 0, 0, 1, 1}, - {&__pyx_n_s_rotationMatrixShellCorrelateDist, __pyx_k_rotationMatrixShellCorrelateDist, sizeof(__pyx_k_rotationMatrixShellCorrelateDist), 0, 0, 1, 1}, - {&__pyx_n_s_rotationMatrixShellCorrelateTot, __pyx_k_rotationMatrixShellCorrelateTot, sizeof(__pyx_k_rotationMatrixShellCorrelateTot), 0, 0, 1, 1}, - {&__pyx_n_s_rotationMatrixShellCorrelateTotP, __pyx_k_rotationMatrixShellCorrelateTotP, sizeof(__pyx_k_rotationMatrixShellCorrelateTotP), 0, 0, 1, 1}, - {&__pyx_kp_s_self_too_sparse, __pyx_k_self_too_sparse, sizeof(__pyx_k_self_too_sparse), 0, 0, 1, 0}, - {&__pyx_n_s_selfcorr, __pyx_k_selfcorr, sizeof(__pyx_k_selfcorr), 0, 0, 1, 1}, - {&__pyx_n_s_selfctr, __pyx_k_selfctr, sizeof(__pyx_k_selfctr), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, - {&__pyx_n_s_shell, __pyx_k_shell, sizeof(__pyx_k_shell), 0, 0, 1, 1}, - {&__pyx_n_s_shelldt, __pyx_k_shelldt, sizeof(__pyx_k_shelldt), 0, 0, 1, 1}, - {&__pyx_n_s_shellstart, __pyx_k_shellstart, sizeof(__pyx_k_shellstart), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_sparsecorrelate, __pyx_k_sparsecorrelate, sizeof(__pyx_k_sparsecorrelate), 0, 0, 1, 1}, - {&__pyx_n_s_sparsecrosscorrelate, __pyx_k_sparsecrosscorrelate, sizeof(__pyx_k_sparsecrosscorrelate), 0, 0, 1, 1}, - {&__pyx_n_s_sparsefullcorrelate, __pyx_k_sparsefullcorrelate, sizeof(__pyx_k_sparsefullcorrelate), 0, 0, 1, 1}, - {&__pyx_n_s_sparsefullcrosscorrelate, __pyx_k_sparsefullcrosscorrelate, sizeof(__pyx_k_sparsefullcrosscorrelate), 0, 0, 1, 1}, - {&__pyx_n_s_sparsefullnobulkcorrelate, __pyx_k_sparsefullnobulkcorrelate, sizeof(__pyx_k_sparsefullnobulkcorrelate), 0, 0, 1, 1}, - {&__pyx_n_s_sparsefullnobulkthincorrelate, __pyx_k_sparsefullnobulkthincorrelate, sizeof(__pyx_k_sparsefullnobulkthincorrelate), 0, 0, 1, 1}, - {&__pyx_n_s_sparsefullnobulkthingreenkubo, __pyx_k_sparsefullnobulkthingreenkubo, sizeof(__pyx_k_sparsefullnobulkthingreenkubo), 0, 0, 1, 1}, - {&__pyx_kp_s_src_helpers_correl_pyx, __pyx_k_src_helpers_correl_pyx, sizeof(__pyx_k_src_helpers_correl_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_startingpoints, __pyx_k_startingpoints, sizeof(__pyx_k_startingpoints), 0, 0, 1, 1}, - {&__pyx_n_s_startmax, __pyx_k_startmax, sizeof(__pyx_k_startmax), 0, 0, 1, 1}, - {&__pyx_n_s_startskip, __pyx_k_startskip, sizeof(__pyx_k_startskip), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, - {&__pyx_n_s_t1, __pyx_k_t1, sizeof(__pyx_k_t1), 0, 0, 1, 1}, - {&__pyx_n_s_t2, __pyx_k_t2, sizeof(__pyx_k_t2), 0, 0, 1, 1}, - {&__pyx_n_s_t3, __pyx_k_t3, sizeof(__pyx_k_t3), 0, 0, 1, 1}, - {&__pyx_n_s_t4, __pyx_k_t4, sizeof(__pyx_k_t4), 0, 0, 1, 1}, - {&__pyx_n_s_t5, __pyx_k_t5, sizeof(__pyx_k_t5), 0, 0, 1, 1}, - {&__pyx_n_s_t6, __pyx_k_t6, sizeof(__pyx_k_t6), 0, 0, 1, 1}, - {&__pyx_n_s_tempvalue, __pyx_k_tempvalue, sizeof(__pyx_k_tempvalue), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_tmp, __pyx_k_tmp, sizeof(__pyx_k_tmp), 0, 0, 1, 1}, - {&__pyx_kp_s_too_sparse, __pyx_k_too_sparse, sizeof(__pyx_k_too_sparse), 0, 0, 1, 0}, - {&__pyx_kp_s_tot_too_sparse, __pyx_k_tot_too_sparse, sizeof(__pyx_k_tot_too_sparse), 0, 0, 1, 0}, - {&__pyx_n_s_transform, __pyx_k_transform, sizeof(__pyx_k_transform), 0, 0, 1, 1}, - {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, - {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, - {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {&__pyx_n_s_validx, __pyx_k_validx, sizeof(__pyx_k_validx), 0, 0, 1, 1}, - {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, - {&__pyx_n_s_vectorRotation, __pyx_k_vectorRotation, sizeof(__pyx_k_vectorRotation), 0, 0, 1, 1}, - {&__pyx_n_s_wcorr1, __pyx_k_wcorr1, sizeof(__pyx_k_wcorr1), 0, 0, 1, 1}, - {&__pyx_n_s_wcorr2, __pyx_k_wcorr2, sizeof(__pyx_k_wcorr2), 0, 0, 1, 1}, - {&__pyx_n_s_wxcorr, __pyx_k_wxcorr, sizeof(__pyx_k_wxcorr), 0, 0, 1, 1}, - {&__pyx_n_s_xcf, __pyx_k_xcf, sizeof(__pyx_k_xcf), 0, 0, 1, 1}, - {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, + {&__pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_k_All_dimensions_preceding_dimensi, sizeof(__pyx_k_All_dimensions_preceding_dimensi), 0, 0, 1, 0}, + {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, + {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, + {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, + {&__pyx_kp_u_Cannot_index_with_type, __pyx_k_Cannot_index_with_type, sizeof(__pyx_k_Cannot_index_with_type), 0, 1, 0, 0}, + {&__pyx_kp_s_Cannot_transpose_memoryview_with, __pyx_k_Cannot_transpose_memoryview_with, sizeof(__pyx_k_Cannot_transpose_memoryview_with), 0, 0, 1, 0}, + {&__pyx_kp_s_Dimension_d_is_not_direct, __pyx_k_Dimension_d_is_not_direct, sizeof(__pyx_k_Dimension_d_is_not_direct), 0, 0, 1, 0}, + {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, + {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, + {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_k_Index_out_of_bounds_axis_d, sizeof(__pyx_k_Index_out_of_bounds_axis_d), 0, 0, 1, 0}, + {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, + {&__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 1, 0, 0}, + {&__pyx_kp_u_Invalid_shape_in_axis, __pyx_k_Invalid_shape_in_axis, sizeof(__pyx_k_Invalid_shape_in_axis), 0, 1, 0, 0}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, + {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, + {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, + {&__pyx_kp_u_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 1, 0, 0}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1}, + {&__pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_k_Step_may_not_be_zero_axis_d, sizeof(__pyx_k_Step_may_not_be_zero_axis_d), 0, 0, 1, 0}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, + {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, + {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, + {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, + {&__pyx_n_s__64, __pyx_k__64, sizeof(__pyx_k__64), 0, 0, 1, 1}, + {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, + {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, + {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, + {&__pyx_kp_u_and, __pyx_k_and, sizeof(__pyx_k_and), 0, 1, 0, 0}, + {&__pyx_n_s_ans, __pyx_k_ans, sizeof(__pyx_k_ans), 0, 0, 1, 1}, + {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, + {&__pyx_n_s_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, + {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, + {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, + {&__pyx_n_s_calcAngularDisplacement, __pyx_k_calcAngularDisplacement, sizeof(__pyx_k_calcAngularDisplacement), 0, 0, 1, 1}, + {&__pyx_n_s_calcAngularVelocityXCorrel, __pyx_k_calcAngularVelocityXCorrel, sizeof(__pyx_k_calcAngularVelocityXCorrel), 0, 0, 1, 1}, + {&__pyx_n_s_calcRelativeAngDisp, __pyx_k_calcRelativeAngDisp, sizeof(__pyx_k_calcRelativeAngDisp), 0, 0, 1, 1}, + {&__pyx_n_s_ccorr, __pyx_k_ccorr, sizeof(__pyx_k_ccorr), 0, 0, 1, 1}, + {&__pyx_n_s_ccrosscorr, __pyx_k_ccrosscorr, sizeof(__pyx_k_ccrosscorr), 0, 0, 1, 1}, + {&__pyx_n_s_ccrossctr, __pyx_k_ccrossctr, sizeof(__pyx_k_ccrossctr), 0, 0, 1, 1}, + {&__pyx_n_s_cctr, __pyx_k_cctr, sizeof(__pyx_k_cctr), 0, 0, 1, 1}, + {&__pyx_n_s_cdata, __pyx_k_cdata, sizeof(__pyx_k_cdata), 0, 0, 1, 1}, + {&__pyx_n_s_cdata1, __pyx_k_cdata1, sizeof(__pyx_k_cdata1), 0, 0, 1, 1}, + {&__pyx_n_s_cdata2, __pyx_k_cdata2, sizeof(__pyx_k_cdata2), 0, 0, 1, 1}, + {&__pyx_n_s_cds, __pyx_k_cds, sizeof(__pyx_k_cds), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, + {&__pyx_kp_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 0}, + {&__pyx_n_s_contdata, __pyx_k_contdata, sizeof(__pyx_k_contdata), 0, 0, 1, 1}, + {&__pyx_n_s_contdata1, __pyx_k_contdata1, sizeof(__pyx_k_contdata1), 0, 0, 1, 1}, + {&__pyx_n_s_contdata2, __pyx_k_contdata2, sizeof(__pyx_k_contdata2), 0, 0, 1, 1}, + {&__pyx_n_s_contds, __pyx_k_contds, sizeof(__pyx_k_contds), 0, 0, 1, 1}, + {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, + {&__pyx_n_s_coor1_ts, __pyx_k_coor1_ts, sizeof(__pyx_k_coor1_ts), 0, 0, 1, 1}, + {&__pyx_n_s_coor2_ts, __pyx_k_coor2_ts, sizeof(__pyx_k_coor2_ts), 0, 0, 1, 1}, + {&__pyx_n_s_coor_ts, __pyx_k_coor_ts, sizeof(__pyx_k_coor_ts), 0, 0, 1, 1}, + {&__pyx_n_s_corr, __pyx_k_corr, sizeof(__pyx_k_corr), 0, 0, 1, 1}, + {&__pyx_n_s_corrdim, __pyx_k_corrdim, sizeof(__pyx_k_corrdim), 0, 0, 1, 1}, + {&__pyx_n_s_correlate, __pyx_k_correlate, sizeof(__pyx_k_correlate), 0, 0, 1, 1}, + {&__pyx_n_s_correlateParallel, __pyx_k_correlateParallel, sizeof(__pyx_k_correlateParallel), 0, 0, 1, 1}, + {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, + {&__pyx_n_s_crosscorr, __pyx_k_crosscorr, sizeof(__pyx_k_crosscorr), 0, 0, 1, 1}, + {&__pyx_n_s_crossctr, __pyx_k_crossctr, sizeof(__pyx_k_crossctr), 0, 0, 1, 1}, + {&__pyx_n_s_cselfcorr, __pyx_k_cselfcorr, sizeof(__pyx_k_cselfcorr), 0, 0, 1, 1}, + {&__pyx_n_s_cselfctr, __pyx_k_cselfctr, sizeof(__pyx_k_cselfctr), 0, 0, 1, 1}, + {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, + {&__pyx_n_s_d1, __pyx_k_d1, sizeof(__pyx_k_d1), 0, 0, 1, 1}, + {&__pyx_n_s_d2, __pyx_k_d2, sizeof(__pyx_k_d2), 0, 0, 1, 1}, + {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, + {&__pyx_n_s_data1, __pyx_k_data1, sizeof(__pyx_k_data1), 0, 0, 1, 1}, + {&__pyx_n_s_data2, __pyx_k_data2, sizeof(__pyx_k_data2), 0, 0, 1, 1}, + {&__pyx_n_s_datapoints, __pyx_k_datapoints, sizeof(__pyx_k_datapoints), 0, 0, 1, 1}, + {&__pyx_n_s_delta, __pyx_k_delta, sizeof(__pyx_k_delta), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_ds, __pyx_k_ds, sizeof(__pyx_k_ds), 0, 0, 1, 1}, + {&__pyx_n_s_dsidx, __pyx_k_dsidx, sizeof(__pyx_k_dsidx), 0, 0, 1, 1}, + {&__pyx_n_s_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, + {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, + {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, + {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0}, + {&__pyx_kp_u_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 1, 0, 0}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_istart, __pyx_k_istart, sizeof(__pyx_k_istart), 0, 0, 1, 1}, + {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, + {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, + {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, + {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, + {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, + {&__pyx_n_s_lowhigh, __pyx_k_lowhigh, sizeof(__pyx_k_lowhigh), 0, 0, 1, 1}, + {&__pyx_n_s_ltc, __pyx_k_ltc, sizeof(__pyx_k_ltc), 0, 0, 1, 1}, + {&__pyx_n_s_ltc_2, __pyx_k_ltc_2, sizeof(__pyx_k_ltc_2), 0, 0, 1, 1}, + {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_maxTime, __pyx_k_maxTime, sizeof(__pyx_k_maxTime), 0, 0, 1, 1}, + {&__pyx_n_s_maxdt, __pyx_k_maxdt, sizeof(__pyx_k_maxdt), 0, 0, 1, 1}, + {&__pyx_n_s_maxlen, __pyx_k_maxlen, sizeof(__pyx_k_maxlen), 0, 0, 1, 1}, + {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, + {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_mol, __pyx_k_mol, sizeof(__pyx_k_mol), 0, 0, 1, 1}, + {&__pyx_n_s_msd, __pyx_k_msd, sizeof(__pyx_k_msd), 0, 0, 1, 1}, + {&__pyx_n_s_myCorrel, __pyx_k_myCorrel, sizeof(__pyx_k_myCorrel), 0, 0, 1, 1}, + {&__pyx_n_s_myplan, __pyx_k_myplan, sizeof(__pyx_k_myplan), 0, 0, 1, 1}, + {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, + {&__pyx_n_s_n_2, __pyx_k_n_2, sizeof(__pyx_k_n_2), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_s_natoms, __pyx_k_natoms, sizeof(__pyx_k_natoms), 0, 0, 1, 1}, + {&__pyx_n_s_natoms1, __pyx_k_natoms1, sizeof(__pyx_k_natoms1), 0, 0, 1, 1}, + {&__pyx_n_s_natoms2, __pyx_k_natoms2, sizeof(__pyx_k_natoms2), 0, 0, 1, 1}, + {&__pyx_n_s_nc, __pyx_k_nc, sizeof(__pyx_k_nc), 0, 0, 1, 1}, + {&__pyx_n_s_ncut, __pyx_k_ncut, sizeof(__pyx_k_ncut), 0, 0, 1, 1}, + {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_s_nds, __pyx_k_nds, sizeof(__pyx_k_nds), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_n_s_newanalysis_correl, __pyx_k_newanalysis_correl, sizeof(__pyx_k_newanalysis_correl), 0, 0, 1, 1}, + {&__pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_k_newanalysis_helpers_correl_pyx, sizeof(__pyx_k_newanalysis_helpers_correl_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_nmol, __pyx_k_nmol, sizeof(__pyx_k_nmol), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, + {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_nshells, __pyx_k_nshells, sizeof(__pyx_k_nshells), 0, 0, 1, 1}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, + {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, + {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, + {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1}, + {&__pyx_n_s_p_ans, __pyx_k_p_ans, sizeof(__pyx_k_p_ans), 0, 0, 1, 1}, + {&__pyx_n_s_p_data1, __pyx_k_p_data1, sizeof(__pyx_k_p_data1), 0, 0, 1, 1}, + {&__pyx_n_s_p_data2, __pyx_k_p_data2, sizeof(__pyx_k_p_data2), 0, 0, 1, 1}, + {&__pyx_n_s_p_out, __pyx_k_p_out, sizeof(__pyx_k_p_out), 0, 0, 1, 1}, + {&__pyx_n_s_p_tmp, __pyx_k_p_tmp, sizeof(__pyx_k_p_tmp), 0, 0, 1, 1}, + {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_pcorr, __pyx_k_pcorr, sizeof(__pyx_k_pcorr), 0, 0, 1, 1}, + {&__pyx_n_s_pcorrdim, __pyx_k_pcorrdim, sizeof(__pyx_k_pcorrdim), 0, 0, 1, 1}, + {&__pyx_n_s_pcrosscorr, __pyx_k_pcrosscorr, sizeof(__pyx_k_pcrosscorr), 0, 0, 1, 1}, + {&__pyx_n_s_pdata, __pyx_k_pdata, sizeof(__pyx_k_pdata), 0, 0, 1, 1}, + {&__pyx_n_s_pdata1, __pyx_k_pdata1, sizeof(__pyx_k_pdata1), 0, 0, 1, 1}, + {&__pyx_n_s_pdata2, __pyx_k_pdata2, sizeof(__pyx_k_pdata2), 0, 0, 1, 1}, + {&__pyx_n_s_pds, __pyx_k_pds, sizeof(__pyx_k_pds), 0, 0, 1, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_pnshells, __pyx_k_pnshells, sizeof(__pyx_k_pnshells), 0, 0, 1, 1}, + {&__pyx_n_s_point, __pyx_k_point, sizeof(__pyx_k_point), 0, 0, 1, 1}, + {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, + {&__pyx_n_s_pselfcorr, __pyx_k_pselfcorr, sizeof(__pyx_k_pselfcorr), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1}, + {&__pyx_n_s_rotTs, __pyx_k_rotTs, sizeof(__pyx_k_rotTs), 0, 0, 1, 1}, + {&__pyx_n_s_rotTs1, __pyx_k_rotTs1, sizeof(__pyx_k_rotTs1), 0, 0, 1, 1}, + {&__pyx_n_s_rotTs2, __pyx_k_rotTs2, sizeof(__pyx_k_rotTs2), 0, 0, 1, 1}, + {&__pyx_n_s_rotTs3, __pyx_k_rotTs3, sizeof(__pyx_k_rotTs3), 0, 0, 1, 1}, + {&__pyx_n_s_rotationMatrixShellCorrelate, __pyx_k_rotationMatrixShellCorrelate, sizeof(__pyx_k_rotationMatrixShellCorrelate), 0, 0, 1, 1}, + {&__pyx_n_s_rotationMatrixShellCorrelateDist, __pyx_k_rotationMatrixShellCorrelateDist, sizeof(__pyx_k_rotationMatrixShellCorrelateDist), 0, 0, 1, 1}, + {&__pyx_n_s_rotationMatrixShellCorrelateTot, __pyx_k_rotationMatrixShellCorrelateTot, sizeof(__pyx_k_rotationMatrixShellCorrelateTot), 0, 0, 1, 1}, + {&__pyx_n_s_rotationMatrixShellCorrelateTotP, __pyx_k_rotationMatrixShellCorrelateTotP, sizeof(__pyx_k_rotationMatrixShellCorrelateTotP), 0, 0, 1, 1}, + {&__pyx_kp_s_self_too_sparse, __pyx_k_self_too_sparse, sizeof(__pyx_k_self_too_sparse), 0, 0, 1, 0}, + {&__pyx_n_s_selfcorr, __pyx_k_selfcorr, sizeof(__pyx_k_selfcorr), 0, 0, 1, 1}, + {&__pyx_n_s_selfctr, __pyx_k_selfctr, sizeof(__pyx_k_selfctr), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_shell, __pyx_k_shell, sizeof(__pyx_k_shell), 0, 0, 1, 1}, + {&__pyx_n_s_shelldt, __pyx_k_shelldt, sizeof(__pyx_k_shelldt), 0, 0, 1, 1}, + {&__pyx_n_s_shellstart, __pyx_k_shellstart, sizeof(__pyx_k_shellstart), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_sparsecorrelate, __pyx_k_sparsecorrelate, sizeof(__pyx_k_sparsecorrelate), 0, 0, 1, 1}, + {&__pyx_n_s_sparsecrosscorrelate, __pyx_k_sparsecrosscorrelate, sizeof(__pyx_k_sparsecrosscorrelate), 0, 0, 1, 1}, + {&__pyx_n_s_sparsefullcorrelate, __pyx_k_sparsefullcorrelate, sizeof(__pyx_k_sparsefullcorrelate), 0, 0, 1, 1}, + {&__pyx_n_s_sparsefullcrosscorrelate, __pyx_k_sparsefullcrosscorrelate, sizeof(__pyx_k_sparsefullcrosscorrelate), 0, 0, 1, 1}, + {&__pyx_n_s_sparsefullnobulkcorrelate, __pyx_k_sparsefullnobulkcorrelate, sizeof(__pyx_k_sparsefullnobulkcorrelate), 0, 0, 1, 1}, + {&__pyx_n_s_sparsefullnobulkthincorrelate, __pyx_k_sparsefullnobulkthincorrelate, sizeof(__pyx_k_sparsefullnobulkthincorrelate), 0, 0, 1, 1}, + {&__pyx_n_s_sparsefullnobulkthingreenkubo, __pyx_k_sparsefullnobulkthingreenkubo, sizeof(__pyx_k_sparsefullnobulkthingreenkubo), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_startingpoints, __pyx_k_startingpoints, sizeof(__pyx_k_startingpoints), 0, 0, 1, 1}, + {&__pyx_n_s_startmax, __pyx_k_startmax, sizeof(__pyx_k_startmax), 0, 0, 1, 1}, + {&__pyx_n_s_startskip, __pyx_k_startskip, sizeof(__pyx_k_startskip), 0, 0, 1, 1}, + {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, + {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, + {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, + {&__pyx_n_s_t1, __pyx_k_t1, sizeof(__pyx_k_t1), 0, 0, 1, 1}, + {&__pyx_n_s_t2, __pyx_k_t2, sizeof(__pyx_k_t2), 0, 0, 1, 1}, + {&__pyx_n_s_t3, __pyx_k_t3, sizeof(__pyx_k_t3), 0, 0, 1, 1}, + {&__pyx_n_s_t4, __pyx_k_t4, sizeof(__pyx_k_t4), 0, 0, 1, 1}, + {&__pyx_n_s_t5, __pyx_k_t5, sizeof(__pyx_k_t5), 0, 0, 1, 1}, + {&__pyx_n_s_t6, __pyx_k_t6, sizeof(__pyx_k_t6), 0, 0, 1, 1}, + {&__pyx_n_s_tempvalue, __pyx_k_tempvalue, sizeof(__pyx_k_tempvalue), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_tmp, __pyx_k_tmp, sizeof(__pyx_k_tmp), 0, 0, 1, 1}, + {&__pyx_kp_s_too_sparse, __pyx_k_too_sparse, sizeof(__pyx_k_too_sparse), 0, 0, 1, 0}, + {&__pyx_kp_s_tot_too_sparse, __pyx_k_tot_too_sparse, sizeof(__pyx_k_tot_too_sparse), 0, 0, 1, 0}, + {&__pyx_n_s_transform, __pyx_k_transform, sizeof(__pyx_k_transform), 0, 0, 1, 1}, + {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, + {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, + {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_validx, __pyx_k_validx, sizeof(__pyx_k_validx), 0, 0, 1, 1}, + {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, + {&__pyx_n_s_vectorRotation, __pyx_k_vectorRotation, sizeof(__pyx_k_vectorRotation), 0, 0, 1, 1}, + {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, + {&__pyx_n_s_wcorr1, __pyx_k_wcorr1, sizeof(__pyx_k_wcorr1), 0, 0, 1, 1}, + {&__pyx_n_s_wcorr2, __pyx_k_wcorr2, sizeof(__pyx_k_wcorr2), 0, 0, 1, 1}, + {&__pyx_n_s_wxcorr, __pyx_k_wxcorr, sizeof(__pyx_k_wxcorr), 0, 0, 1, 1}, + {&__pyx_n_s_xcf, __pyx_k_xcf, sizeof(__pyx_k_xcf), 0, 0, 1, 1}, + {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 90, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 944, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 134, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 149, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 152, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error) - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 406, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 615, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 834, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 100, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 141, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 156, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 159, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 373, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 408, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 618, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 914, __pyx_L1_error) + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 983, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } +/* #### Code section: cached_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_umath() except -1: - */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 944, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_ufunc() except -1: - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 950, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "View.MemoryView":134 - * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< - * - * if itemsize <= 0: - */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - - /* "View.MemoryView":137 - * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * - * if not isinstance(format, bytes): + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 137, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_New(1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 582, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_tuple__4, 0, __pyx_int_neg_1)) __PYX_ERR(1, 582, __pyx_L1_error); __Pyx_GIVEREF(__pyx_tuple__4); - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) * - * if self.dtype_is_object: - */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(3, __pyx_int_136983863, __pyx_int_112105877, __pyx_int_184977713); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 983, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * - * have_slices, index = _unellipsify(index, self.view.ndim) + * cdef inline int import_ufunc() except -1: */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 420, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 989, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":192 + * ccorr[i] /= cctr[i] * else: - * if len(self.view.format) == 1: + * print('too sparse') # <<<<<<<<<<<<<< + * + * return corr */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 497, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_too_sparse); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< - * - * if flags & PyBUF_ND: + /* "newanalysis/helpers/correl.pyx":249 + * ccorr[i] /= cctr[i] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if cctr[i] != 0: + * cselfcorr[i] /= cselfctr[i] */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 522, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_tot_too_sparse); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - /* "View.MemoryView":572 - * if self.view.strides == NULL: - * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":253 + * cselfcorr[i] /= cselfctr[i] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * for i in range(maxdt*nshells): */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_self_too_sparse); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: */ - __pyx_tuple__14 = PyTuple_New(1); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 579, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_sys); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_INCREF(__pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__14, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_tuple__14); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_collections_abc); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16); - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * */ - __pyx_slice__17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__17)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__17); - __Pyx_GIVEREF(__pyx_slice__17); + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_collections); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< - * + /* "View.MemoryView":309 + * return self.name * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 705, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 309, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_tuple__21 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 4, __pyx_L1_error) + + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * + */ + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 314, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - /* "src/helpers/correl.pyx":25 + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) - * def correlateParallel(np.ndarray[np.float64_t,ndim=2] data1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] data2, - * np.ndarray[np.float64_t,ndim=1] out, */ - __pyx_tuple__22 = PyTuple_Pack(20, __pyx_n_s_data1, __pyx_n_s_data2, __pyx_n_s_out, __pyx_n_s_ltc, __pyx_n_s_n, __pyx_n_s_ncut, __pyx_n_s_m, __pyx_n_s_ltc_2, __pyx_n_s_lowhigh, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_d1, __pyx_n_s_d2, __pyx_n_s_p_data1, __pyx_n_s_p_data2, __pyx_n_s_p_out, __pyx_n_s_myCorrel, __pyx_n_s_myplan, __pyx_n_s_tmp, __pyx_n_s_p_tmp); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 315, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(4, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_correlateParallel, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 25, __pyx_L1_error) - /* "src/helpers/correl.pyx":98 + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_tuple__23 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "newanalysis/helpers/correl.pyx":24 + * void transform( double *data, int ncut, double *ans_re, double *ans_im, int ltc ) nogil + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateParallel(np.ndarray[np.float64_t,ndim=2] data1, + * np.ndarray[np.float64_t,ndim=2] data2, + */ + __pyx_tuple__25 = PyTuple_Pack(20, __pyx_n_s_data1, __pyx_n_s_data2, __pyx_n_s_out, __pyx_n_s_ltc, __pyx_n_s_n, __pyx_n_s_ncut, __pyx_n_s_m, __pyx_n_s_ltc_2, __pyx_n_s_lowhigh, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_d1, __pyx_n_s_d2, __pyx_n_s_p_data1, __pyx_n_s_p_data2, __pyx_n_s_p_out, __pyx_n_s_myCorrel, __pyx_n_s_myplan, __pyx_n_s_tmp, __pyx_n_s_p_tmp); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_correlateParallel, 24, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_tuple__27 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + + /* "newanalysis/helpers/correl.pyx":98 * del myplan * * def correlate(np.ndarray[np.float64_t,ndim=1] data1, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t,ndim=1] data2, * ltc=0): */ - __pyx_tuple__24 = PyTuple_Pack(15, __pyx_n_s_data1, __pyx_n_s_data2, __pyx_n_s_ltc, __pyx_n_s_ncut, __pyx_n_s_ans, __pyx_n_s_m, __pyx_n_s_ltc_2, __pyx_n_s_lowhigh, __pyx_n_s_d1, __pyx_n_s_d2, __pyx_n_s_p_data1, __pyx_n_s_p_data2, __pyx_n_s_p_ans, __pyx_n_s_myCorrel, __pyx_n_s_myplan); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(3, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_correlate, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(15, __pyx_n_s_data1, __pyx_n_s_data2, __pyx_n_s_ltc, __pyx_n_s_ncut, __pyx_n_s_ans, __pyx_n_s_m, __pyx_n_s_ltc_2, __pyx_n_s_lowhigh, __pyx_n_s_d1, __pyx_n_s_d2, __pyx_n_s_p_data1, __pyx_n_s_p_data2, __pyx_n_s_p_ans, __pyx_n_s_myCorrel, __pyx_n_s_myplan); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_correlate, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 98, __pyx_L1_error) - /* "src/helpers/correl.pyx":141 + /* "newanalysis/helpers/correl.pyx":141 * return ans * * def transform(double [:] data, ltc = 0): # <<<<<<<<<<<<<< * """ * transform(data, ltc=0) */ - __pyx_tuple__26 = PyTuple_Pack(6, __pyx_n_s_data, __pyx_n_s_ltc, __pyx_n_s_ncut, __pyx_n_s_nc, __pyx_n_s_ans, __pyx_n_s_myCorrel); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_transform, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(6, __pyx_n_s_data, __pyx_n_s_ltc, __pyx_n_s_ncut, __pyx_n_s_nc, __pyx_n_s_ans, __pyx_n_s_myCorrel); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_transform, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 141, __pyx_L1_error) - /* "src/helpers/correl.pyx":157 + /* "newanalysis/helpers/correl.pyx":156 + * return np.asarray(ans) * - * @cython.boundscheck(False) - * def sparsecrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsecrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata, * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, */ - __pyx_tuple__28 = PyTuple_Pack(23, __pyx_n_s_pdata, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_contdata, __pyx_n_s_contds, __pyx_n_s_cdata, __pyx_n_s_cds, __pyx_n_s_corr, __pyx_n_s_ctr, __pyx_n_s_ccorr, __pyx_n_s_cctr, __pyx_n_s_value, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shell, __pyx_n_s_i); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_sparsecrosscorrelate, 157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_tuple__32 = PyTuple_Pack(23, __pyx_n_s_pdata, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_contdata, __pyx_n_s_contds, __pyx_n_s_cdata, __pyx_n_s_cds, __pyx_n_s_corr, __pyx_n_s_ctr, __pyx_n_s_ccorr, __pyx_n_s_cctr, __pyx_n_s_value, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shell, __pyx_n_s_i); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_sparsecrosscorrelate, 156, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); - /* "src/helpers/correl.pyx":198 + /* "newanalysis/helpers/correl.pyx":197 * - * @cython.boundscheck(False) - * def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, */ - __pyx_tuple__30 = PyTuple_Pack(36, __pyx_n_s_pdata, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_contdata, __pyx_n_s_contds, __pyx_n_s_cdata, __pyx_n_s_cds, __pyx_n_s_pcorr, __pyx_n_s_pselfcorr, __pyx_n_s_pcrosscorr, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_ccorr, __pyx_n_s_cselfcorr, __pyx_n_s_ccrosscorr, __pyx_n_s_cctr, __pyx_n_s_cselfctr, __pyx_n_s_ccrossctr, __pyx_n_s_value, __pyx_n_s_i, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_idx); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(4, 0, 36, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_sparsefullcorrelate, 198, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_tuple__35 = PyTuple_Pack(36, __pyx_n_s_pdata, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_contdata, __pyx_n_s_contds, __pyx_n_s_cdata, __pyx_n_s_cds, __pyx_n_s_pcorr, __pyx_n_s_pselfcorr, __pyx_n_s_pcrosscorr, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_ccorr, __pyx_n_s_cselfcorr, __pyx_n_s_ccrosscorr, __pyx_n_s_cctr, __pyx_n_s_cselfctr, __pyx_n_s_ccrossctr, __pyx_n_s_value, __pyx_n_s_i, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_idx); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 36, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_sparsefullcorrelate, 197, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 197, __pyx_L1_error) - /* "src/helpers/correl.pyx":327 + /* "newanalysis/helpers/correl.pyx":326 * - * @cython.boundscheck(False) - * def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, */ - __pyx_tuple__32 = PyTuple_Pack(41, __pyx_n_s_pdata, __pyx_n_s_pcorrdim, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_corrdim, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_contdata, __pyx_n_s_contds, __pyx_n_s_cdata, __pyx_n_s_cds, __pyx_n_s_pcorr, __pyx_n_s_pselfcorr, __pyx_n_s_pcrosscorr, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_ccorr, __pyx_n_s_cselfcorr, __pyx_n_s_ccrosscorr, __pyx_n_s_cctr, __pyx_n_s_cselfctr, __pyx_n_s_ccrossctr, __pyx_n_s_value, __pyx_n_s_i, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_idx, __pyx_n_s_dim, __pyx_n_s_validx, __pyx_n_s_dsidx); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(5, 0, 41, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_sparsefullnobulkcorrelate, 327, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 327, __pyx_L1_error) + __pyx_tuple__37 = PyTuple_Pack(41, __pyx_n_s_pdata, __pyx_n_s_pcorrdim, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_corrdim, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_contdata, __pyx_n_s_contds, __pyx_n_s_cdata, __pyx_n_s_cds, __pyx_n_s_pcorr, __pyx_n_s_pselfcorr, __pyx_n_s_pcrosscorr, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_ccorr, __pyx_n_s_cselfcorr, __pyx_n_s_ccrosscorr, __pyx_n_s_cctr, __pyx_n_s_cselfctr, __pyx_n_s_ccrossctr, __pyx_n_s_value, __pyx_n_s_i, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_idx, __pyx_n_s_dim, __pyx_n_s_validx, __pyx_n_s_dsidx); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 41, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_sparsefullnobulkcorrelate, 326, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 326, __pyx_L1_error) - /* "src/helpers/correl.pyx":397 + /* "newanalysis/helpers/correl.pyx":396 + * return corr,selfcorr,crosscorr * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps */ - __pyx_tuple__34 = PyTuple_Pack(26, __pyx_n_s_rotTs, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_ctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_l); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 397, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__34); - __Pyx_GIVEREF(__pyx_tuple__34); - __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(5, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_rotationMatrixShellCorrelateDist, 397, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 397, __pyx_L1_error) + __pyx_tuple__39 = PyTuple_Pack(26, __pyx_n_s_rotTs, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_ctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_l); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 396, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_rotationMatrixShellCorrelateDist, 396, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 396, __pyx_L1_error) - /* "src/helpers/correl.pyx":442 + /* "newanalysis/helpers/correl.pyx":441 * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps */ - __pyx_tuple__36 = PyTuple_Pack(29, __pyx_n_s_rotTs, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 442, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__36); - __Pyx_GIVEREF(__pyx_tuple__36); - __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(5, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_rotationMatrixShellCorrelate, 442, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 442, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(29, __pyx_n_s_rotTs, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_rotationMatrixShellCorrelate, 441, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 441, __pyx_L1_error) - /* "src/helpers/correl.pyx":523 + /* "newanalysis/helpers/correl.pyx":522 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps */ - __pyx_tuple__38 = PyTuple_Pack(25, __pyx_n_s_rotTs, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_ctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 523, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__38); - __Pyx_GIVEREF(__pyx_tuple__38); - __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(5, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_rotationMatrixShellCorrelateTot, 523, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 523, __pyx_L1_error) + __pyx_tuple__43 = PyTuple_Pack(25, __pyx_n_s_rotTs, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_ctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_rotationMatrixShellCorrelateTot, 522, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 522, __pyx_L1_error) - /* "src/helpers/correl.pyx":573 + /* "newanalysis/helpers/correl.pyx":572 + * return corr * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): * cdef long nmol = len(rotTs1) # number of molecules - * cdef long n = len(rotTs1[0]) # number of time steps */ - __pyx_tuple__40 = PyTuple_Pack(27, __pyx_n_s_rotTs1, __pyx_n_s_rotTs2, __pyx_n_s_rotTs3, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_ctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__40); - __Pyx_GIVEREF(__pyx_tuple__40); - __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(7, 0, 27, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_rotationMatrixShellCorrelateTotP, 573, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 573, __pyx_L1_error) + __pyx_tuple__45 = PyTuple_Pack(27, __pyx_n_s_rotTs1, __pyx_n_s_rotTs2, __pyx_n_s_rotTs3, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_ctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 27, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_rotationMatrixShellCorrelateTotP, 572, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 572, __pyx_L1_error) - /* "src/helpers/correl.pyx":637 + /* "newanalysis/helpers/correl.pyx":636 * - * @cython.boundscheck(False) - * def vectorRotation(double [:,:] rotTs, int datapoints): # <<<<<<<<<<<<<< - * # cdef long datapoints = len(rotTs) - * cdef double [:,:] corr = np.zeros((2,datapoints)) - */ - __pyx_tuple__42 = PyTuple_Pack(13, __pyx_n_s_rotTs, __pyx_n_s_datapoints, __pyx_n_s_corr, __pyx_n_s_t, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); - __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_vectorRotation, 637, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 637, __pyx_L1_error) - - /* "src/helpers/correl.pyx":656 * - * @cython.boundscheck(False) - * def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vectorRotation(double [:,:] rotTs, int datapoints): + * # cdef long datapoints = len(rotTs) */ - __pyx_tuple__44 = PyTuple_Pack(45, __pyx_n_s_pdata, __pyx_n_s_pcorrdim, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_startingpoints, __pyx_n_s_corrdim, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_startskip, __pyx_n_s_startmax, __pyx_n_s_contdata, __pyx_n_s_contds, __pyx_n_s_cdata, __pyx_n_s_cds, __pyx_n_s_pcorr, __pyx_n_s_pselfcorr, __pyx_n_s_pcrosscorr, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_ccorr, __pyx_n_s_cselfcorr, __pyx_n_s_ccrosscorr, __pyx_n_s_cctr, __pyx_n_s_cselfctr, __pyx_n_s_ccrossctr, __pyx_n_s_value, __pyx_n_s_i, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_idx, __pyx_n_s_dim, __pyx_n_s_validx, __pyx_n_s_dsidx, __pyx_n_s_istart); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 656, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(6, 0, 45, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_sparsefullnobulkthincorrelate, 656, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 656, __pyx_L1_error) + __pyx_tuple__47 = PyTuple_Pack(13, __pyx_n_s_rotTs, __pyx_n_s_datapoints, __pyx_n_s_corr, __pyx_n_s_t, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 636, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__47); + __Pyx_GIVEREF(__pyx_tuple__47); + __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_vectorRotation, 636, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 636, __pyx_L1_error) - /* "src/helpers/correl.pyx":729 + /* "newanalysis/helpers/correl.pyx":655 + * return corr * - * @cython.boundscheck(False) - * def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, - */ - __pyx_tuple__46 = PyTuple_Pack(46, __pyx_n_s_pdata, __pyx_n_s_pcorrdim, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_startingpoints, __pyx_n_s_corrdim, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_startskip, __pyx_n_s_startmax, __pyx_n_s_contdata, __pyx_n_s_contds, __pyx_n_s_cdata, __pyx_n_s_cds, __pyx_n_s_pcorr, __pyx_n_s_pselfcorr, __pyx_n_s_pcrosscorr, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_ccorr, __pyx_n_s_cselfcorr, __pyx_n_s_ccrosscorr, __pyx_n_s_cctr, __pyx_n_s_cselfctr, __pyx_n_s_ccrossctr, __pyx_n_s_value, __pyx_n_s_tempvalue, __pyx_n_s_i, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_idx, __pyx_n_s_dim, __pyx_n_s_validx, __pyx_n_s_dsidx, __pyx_n_s_istart); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(6, 0, 46, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_sparsefullnobulkthingreenkubo, 729, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 729, __pyx_L1_error) - - /* "src/helpers/correl.pyx":804 - * - * @cython.boundscheck(False) - * def sparsefullcrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] pdata2, - * np.ndarray[np.int32_t,ndim=2] pds, - */ - __pyx_tuple__48 = PyTuple_Pack(39, __pyx_n_s_pdata1, __pyx_n_s_pdata2, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_contdata1, __pyx_n_s_contdata2, __pyx_n_s_contds, __pyx_n_s_cdata1, __pyx_n_s_cdata2, __pyx_n_s_cds, __pyx_n_s_pcorr, __pyx_n_s_pselfcorr, __pyx_n_s_pcrosscorr, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_ccorr, __pyx_n_s_cselfcorr, __pyx_n_s_ccrosscorr, __pyx_n_s_cctr, __pyx_n_s_cselfctr, __pyx_n_s_ccrossctr, __pyx_n_s_value, __pyx_n_s_i, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_idx); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(5, 0, 39, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_sparsefullcrosscorrelate, 804, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 804, __pyx_L1_error) - - /* "src/helpers/correl.pyx":872 - * - * @cython.boundscheck(False) - * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * maxlen=None): - * cdef int nmol = len(pdata) # number of molecules */ - __pyx_tuple__50 = PyTuple_Pack(16, __pyx_n_s_pdata, __pyx_n_s_maxlen, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_maxdt, __pyx_n_s_contdata, __pyx_n_s_cdata, __pyx_n_s_corr, __pyx_n_s_ctr, __pyx_n_s_ccorr, __pyx_n_s_cctr, __pyx_n_s_value, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_i); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 872, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_sparsecorrelate, 872, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 872, __pyx_L1_error) + __pyx_tuple__49 = PyTuple_Pack(45, __pyx_n_s_pdata, __pyx_n_s_pcorrdim, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_startingpoints, __pyx_n_s_corrdim, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_startskip, __pyx_n_s_startmax, __pyx_n_s_contdata, __pyx_n_s_contds, __pyx_n_s_cdata, __pyx_n_s_cds, __pyx_n_s_pcorr, __pyx_n_s_pselfcorr, __pyx_n_s_pcrosscorr, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_ccorr, __pyx_n_s_cselfcorr, __pyx_n_s_ccrosscorr, __pyx_n_s_cctr, __pyx_n_s_cselfctr, __pyx_n_s_ccrossctr, __pyx_n_s_value, __pyx_n_s_i, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_idx, __pyx_n_s_dim, __pyx_n_s_validx, __pyx_n_s_dsidx, __pyx_n_s_istart); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__49); + __Pyx_GIVEREF(__pyx_tuple__49); + __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 45, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_sparsefullnobulkthincorrelate, 655, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 655, __pyx_L1_error) + __pyx_tuple__51 = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__51); + __Pyx_GIVEREF(__pyx_tuple__51); - /* "src/helpers/correl.pyx":906 + /* "newanalysis/helpers/correl.pyx":728 * - * @cython.boundscheck(False) - * def calcAngularDisplacement(np.ndarray[np.float64_t,ndim=3] coor_ts, delta): # <<<<<<<<<<<<<< * - * cdef int maxTime = coor_ts.shape[0] + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, */ - __pyx_tuple__52 = PyTuple_Pack(7, __pyx_n_s_coor_ts, __pyx_n_s_delta, __pyx_n_s_maxTime, __pyx_n_s_natoms, __pyx_n_s_dt, __pyx_n_s_msd, __pyx_n_s_myCorrel); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 906, __pyx_L1_error) + __pyx_tuple__52 = PyTuple_Pack(46, __pyx_n_s_pdata, __pyx_n_s_pcorrdim, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_startingpoints, __pyx_n_s_corrdim, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_startskip, __pyx_n_s_startmax, __pyx_n_s_contdata, __pyx_n_s_contds, __pyx_n_s_cdata, __pyx_n_s_cds, __pyx_n_s_pcorr, __pyx_n_s_pselfcorr, __pyx_n_s_pcrosscorr, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_ccorr, __pyx_n_s_cselfcorr, __pyx_n_s_ccrosscorr, __pyx_n_s_cctr, __pyx_n_s_cselfctr, __pyx_n_s_ccrossctr, __pyx_n_s_value, __pyx_n_s_tempvalue, __pyx_n_s_i, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_idx, __pyx_n_s_dim, __pyx_n_s_validx, __pyx_n_s_dsidx, __pyx_n_s_istart); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 728, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__52); __Pyx_GIVEREF(__pyx_tuple__52); - __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_calcAngularDisplacement, 906, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 906, __pyx_L1_error) + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 46, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_sparsefullnobulkthingreenkubo, 728, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 728, __pyx_L1_error) - /* "src/helpers/correl.pyx":923 + /* "newanalysis/helpers/correl.pyx":803 * - * @cython.boundscheck(False) - * def calcAngularVelocityXCorrel(np.ndarray[np.float64_t,ndim=3] coor1_ts, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coor2_ts, - * delta): + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullcrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata1, + * np.ndarray[np.float64_t,ndim=2] pdata2, */ - __pyx_tuple__54 = PyTuple_Pack(9, __pyx_n_s_coor1_ts, __pyx_n_s_coor2_ts, __pyx_n_s_delta, __pyx_n_s_maxTime, __pyx_n_s_natoms1, __pyx_n_s_natoms2, __pyx_n_s_dt, __pyx_n_s_xcf, __pyx_n_s_myCorrel); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 923, __pyx_L1_error) + __pyx_tuple__54 = PyTuple_Pack(39, __pyx_n_s_pdata1, __pyx_n_s_pdata2, __pyx_n_s_pds, __pyx_n_s_pnshells, __pyx_n_s_maxlen, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_nds, __pyx_n_s_maxdt, __pyx_n_s_nshells, __pyx_n_s_contdata1, __pyx_n_s_contdata2, __pyx_n_s_contds, __pyx_n_s_cdata1, __pyx_n_s_cdata2, __pyx_n_s_cds, __pyx_n_s_pcorr, __pyx_n_s_pselfcorr, __pyx_n_s_pcrosscorr, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_ccorr, __pyx_n_s_cselfcorr, __pyx_n_s_ccrosscorr, __pyx_n_s_cctr, __pyx_n_s_cselfctr, __pyx_n_s_ccrossctr, __pyx_n_s_value, __pyx_n_s_i, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_idx); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 803, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__54); __Pyx_GIVEREF(__pyx_tuple__54); - __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_calcAngularVelocityXCorrel, 923, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 923, __pyx_L1_error) + __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 39, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_sparsefullcrosscorrelate, 803, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 803, __pyx_L1_error) - /* "src/helpers/correl.pyx":943 + /* "newanalysis/helpers/correl.pyx":871 * - * @cython.boundscheck(False) - * def calcRelativeAngDisp(np.ndarray[np.float64_t,ndim=3] coor1_ts, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coor2_ts, - * delta, ncut): + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * maxlen=None): */ - __pyx_tuple__56 = PyTuple_Pack(12, __pyx_n_s_coor1_ts, __pyx_n_s_coor2_ts, __pyx_n_s_delta, __pyx_n_s_ncut, __pyx_n_s_maxTime, __pyx_n_s_natoms1, __pyx_n_s_natoms2, __pyx_n_s_dt, __pyx_n_s_wcorr1, __pyx_n_s_wcorr2, __pyx_n_s_wxcorr, __pyx_n_s_myCorrel); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 943, __pyx_L1_error) + __pyx_tuple__56 = PyTuple_Pack(16, __pyx_n_s_pdata, __pyx_n_s_maxlen, __pyx_n_s_nmol, __pyx_n_s_n_2, __pyx_n_s_maxdt, __pyx_n_s_contdata, __pyx_n_s_cdata, __pyx_n_s_corr, __pyx_n_s_ctr, __pyx_n_s_ccorr, __pyx_n_s_cctr, __pyx_n_s_value, __pyx_n_s_start, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_i); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__56); __Pyx_GIVEREF(__pyx_tuple__56); - __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_correl_pyx, __pyx_n_s_calcRelativeAngDisp, 943, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 943, __pyx_L1_error) + __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_sparsecorrelate, 871, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 871, __pyx_L1_error) - /* "View.MemoryView":287 - * return self.name + /* "newanalysis/helpers/correl.pyx":905 + * return corr + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularDisplacement(np.ndarray[np.float64_t,ndim=3] coor_ts, delta): * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") */ - __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(2, 287, __pyx_L1_error) + __pyx_tuple__58 = PyTuple_Pack(7, __pyx_n_s_coor_ts, __pyx_n_s_delta, __pyx_n_s_maxTime, __pyx_n_s_natoms, __pyx_n_s_dt, __pyx_n_s_msd, __pyx_n_s_myCorrel); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 905, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__58); __Pyx_GIVEREF(__pyx_tuple__58); + __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_calcAngularDisplacement, 905, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 905, __pyx_L1_error) - /* "View.MemoryView":288 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__59); - __Pyx_GIVEREF(__pyx_tuple__59); - - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":922 + * return msd * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularVelocityXCorrel(np.ndarray[np.float64_t,ndim=3] coor1_ts, + * np.ndarray[np.float64_t,ndim=3] coor2_ts, */ - __pyx_tuple__60 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(2, 289, __pyx_L1_error) + __pyx_tuple__60 = PyTuple_Pack(9, __pyx_n_s_coor1_ts, __pyx_n_s_coor2_ts, __pyx_n_s_delta, __pyx_n_s_maxTime, __pyx_n_s_natoms1, __pyx_n_s_natoms2, __pyx_n_s_dt, __pyx_n_s_xcf, __pyx_n_s_myCorrel); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 922, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__60); __Pyx_GIVEREF(__pyx_tuple__60); + __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_calcAngularVelocityXCorrel, 922, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 922, __pyx_L1_error) - /* "View.MemoryView":292 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_tuple__61 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__61); - __Pyx_GIVEREF(__pyx_tuple__61); - - /* "View.MemoryView":293 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":942 + * return xcf * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcRelativeAngDisp(np.ndarray[np.float64_t,ndim=3] coor1_ts, + * np.ndarray[np.float64_t,ndim=3] coor2_ts, */ - __pyx_tuple__62 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(2, 293, __pyx_L1_error) + __pyx_tuple__62 = PyTuple_Pack(12, __pyx_n_s_coor1_ts, __pyx_n_s_coor2_ts, __pyx_n_s_delta, __pyx_n_s_ncut, __pyx_n_s_maxTime, __pyx_n_s_natoms1, __pyx_n_s_natoms2, __pyx_n_s_dt, __pyx_n_s_wcorr1, __pyx_n_s_wcorr2, __pyx_n_s_wxcorr, __pyx_n_s_myCorrel); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 942, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__62); __Pyx_GIVEREF(__pyx_tuple__62); - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_tuple__63 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__63); - __Pyx_GIVEREF(__pyx_tuple__63); - __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(2, 1, __pyx_L1_error) + __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_correl_pyx, __pyx_n_s_calcRelativeAngDisp, 942, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 942, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } +/* #### Code section: init_constants ### */ -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - /* InitThreads.init */ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 -PyEval_InitThreads(); -#endif - -if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error) +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -34657,6 +39163,38 @@ if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_L1_error:; return -1; } +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 0)); else + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* NumpyImportArray.init */ + /* + * Cython has automatically inserted a call to _import_array since + * you didn't include one when you cimported numpy. To disable this + * add the line + * numpy._import_array + */ +#ifdef NPY_FEATURE_VERSION +#ifndef NO_IMPORT_ARRAY +if (unlikely(_import_array() == -1)) { + PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import " + "(auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; " + "use 'numpy._import_array' to disable if you are certain you don't need it)."); +} +#endif +#endif + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_module ### */ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ @@ -34670,6 +39208,7 @@ static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ + __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); generic = Py_None; Py_INCREF(Py_None); strided = Py_None; Py_INCREF(Py_None); indirect = Py_None; Py_INCREF(Py_None); @@ -34697,6 +39236,7 @@ static int __Pyx_modinit_function_export_code(void) { static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -34704,22 +39244,61 @@ static int __Pyx_modinit_type_init_code(void) { /*--- Type init code ---*/ __pyx_vtabptr_array = &__pyx_vtable_array; __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; - if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_array.tp_print = 0; + #if CYTHON_USE_TYPE_SPECS + __pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_array_type)) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_array_type->tp_base->tp_as_buffer && __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." #endif - if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #else __pyx_array_type = &__pyx_type___pyx_array; - if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_MemviewEnum.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_array_type->tp_print = 0; + #endif + if (__Pyx_SetVtable(__pyx_array_type, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_MemviewEnum_type)) __PYX_ERR(1, 302, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #else __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_MemviewEnum_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_MemviewEnum_type->tp_dictoffset && __pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_MemviewEnum_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; @@ -34728,34 +39307,85 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; - if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryview.tp_print = 0; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_memoryview_type)) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #else __pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryview_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryview_type->tp_dictoffset && __pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryview_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_memoryview_type, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; - __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; - if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryviewslice.tp_print = 0; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_memoryviewslice_type)) __PYX_ERR(1, 952, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #else + __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryviewslice_type->tp_base = __pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr; + #if PY_MAJOR_VERSION < 3 + __pyx_memoryviewslice_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryviewslice_type->tp_dictoffset && __pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryviewslice_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + if (__Pyx_SetVtable(__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } @@ -34770,62 +39400,33 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_2(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyTypeObject), + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), #else - sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyHeapTypeObject), + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyHeapTypeObject), #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT(PyArray_Descr), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 199, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 222, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayMultiIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 226, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error) - __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 770, __pyx_L1_error) - __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 772, __pyx_L1_error) - __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 774, __pyx_L1_error) - __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 776, __pyx_L1_error) - __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 778, __pyx_L1_error) - __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 780, __pyx_L1_error) - __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 782, __pyx_L1_error) - __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 784, __pyx_L1_error) - __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 786, __pyx_L1_error) - __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 788, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT(PyUFuncObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 826, __pyx_L1_error) + __pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArray_Descr),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 202, __pyx_L1_error) + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 225, __pyx_L1_error) + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayMultiIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 229, __pyx_L1_error) + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 238, __pyx_L1_error) + __pyx_ptype_5numpy_generic = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 809, __pyx_L1_error) + __pyx_ptype_5numpy_number = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 811, __pyx_L1_error) + __pyx_ptype_5numpy_integer = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 813, __pyx_L1_error) + __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 815, __pyx_L1_error) + __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 817, __pyx_L1_error) + __pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 819, __pyx_L1_error) + __pyx_ptype_5numpy_floating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 821, __pyx_L1_error) + __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 823, __pyx_L1_error) + __pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_ptype_5numpy_character = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyUFuncObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 865, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -34852,6 +39453,55 @@ static int __Pyx_modinit_function_import_code(void) { } +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_correl(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_correl}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "correl", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #elif PY_MAJOR_VERSION < 3 @@ -34902,12 +39552,21 @@ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { } return 0; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else result = PyDict_SetItemString(moddict, to_name, value); +#endif } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -34917,8 +39576,9 @@ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject } return result; } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) @@ -34928,8 +39588,12 @@ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNU module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; +#endif if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; @@ -34945,8 +39609,18 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_correl(PyObject *__pyx_pyinit_modu #endif #endif { + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif PyObject *__pyx_t_1 = NULL; - static PyThread_type_lock __pyx_t_2[8]; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + static PyThread_type_lock __pyx_t_8[8]; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -34960,6 +39634,35 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_correl(PyObject *__pyx_pyinit_modu #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("correl", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to correl pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { @@ -34978,48 +39681,31 @@ if (!__Pyx_RefNanny) { __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("correl", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -35031,7 +39717,7 @@ if (!__Pyx_RefNanny) { { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "newanalysis.correl")) { - if (unlikely(PyDict_SetItemString(modules, "newanalysis.correl", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((PyDict_SetItemString(modules, "newanalysis.correl", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif @@ -35043,8 +39729,8 @@ if (!__Pyx_RefNanny) { (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_variable_import_code(); (void)__Pyx_modinit_function_import_code(); /*--- Execution code ---*/ @@ -35052,407 +39738,789 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "src/helpers/correl.pyx":4 - * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_version_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__15, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + goto __pyx_L8; + } + + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":104 + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None + */ + /*except:*/ { + __Pyx_AddTraceback("View.MemoryView", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(1, 104, __pyx_L4_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_7); + + /* "View.MemoryView":106 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * + */ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L3_exception_handled; + } + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + __pyx_L4_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":242 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":243 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L16_try_end; + __pyx_L11_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":244 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L12_exception_handled; + } + __pyx_L12_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L16_try_end:; + } + + /* "View.MemoryView":309 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< * - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; - /* "src/helpers/correl.pyx":25 + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") * - * @cython.boundscheck(False) - * def correlateParallel(np.ndarray[np.float64_t,ndim=2] data1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] data2, - * np.ndarray[np.float64_t,ndim=1] out, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_1correlateParallel, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateParallel, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; - /* "src/helpers/correl.pyx":98 - * del myplan + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * * - * def correlate(np.ndarray[np.float64_t,ndim=1] data1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] data2, - * ltc=0): */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_3correlate, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlate, __pyx_t_1) < 0) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; - /* "src/helpers/correl.pyx":141 - * return ans + /* "View.MemoryView":323 * - * def transform(double [:] data, ltc = 0): # <<<<<<<<<<<<<< - * """ - * transform(data, ltc=0) + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_5transform, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_transform, __pyx_t_1) < 0) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_memoryview_thread_locks_used = 0; - /* "src/helpers/correl.pyx":157 + /* "View.MemoryView":324 * - * @cython.boundscheck(False) - * def sparsecrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_7sparsecrosscorrelate, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsecrosscorrelate, __pyx_t_1) < 0) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8[0] = PyThread_allocate_lock(); + __pyx_t_8[1] = PyThread_allocate_lock(); + __pyx_t_8[2] = PyThread_allocate_lock(); + __pyx_t_8[3] = PyThread_allocate_lock(); + __pyx_t_8[4] = PyThread_allocate_lock(); + __pyx_t_8[5] = PyThread_allocate_lock(); + __pyx_t_8[6] = PyThread_allocate_lock(); + __pyx_t_8[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_8, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); - /* "src/helpers/correl.pyx":198 + /* "View.MemoryView":982 * - * @cython.boundscheck(False) - * def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=2] pds, - * int pnshells, + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_9sparsefullcorrelate, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsefullcorrelate, __pyx_t_1) < 0) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "src/helpers/correl.pyx":327 + /* "View.MemoryView":983 * - * @cython.boundscheck(False) - * def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_11sparsefullnobulkcorrelate, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsefullnobulkcorrelate, __pyx_t_1) < 0) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); + + /* "View.MemoryView":984 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); - /* "src/helpers/correl.pyx":397 + /* "View.MemoryView":982 * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_13rotationMatrixShellCorrelateDist, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixShellCorrelateDist, __pyx_t_1) < 0) __PYX_ERR(0, 397, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L22_try_end; + __pyx_L17_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/correl.pyx":442 + /* "View.MemoryView":985 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_15rotationMatrixShellCorrelate, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixShellCorrelate, __pyx_t_1) < 0) __PYX_ERR(0, 442, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L18_exception_handled; + } + __pyx_L18_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L22_try_end:; + } - /* "src/helpers/correl.pyx":523 + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_17rotationMatrixShellCorrelateTot, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixShellCorrelateTot, __pyx_t_1) < 0) __PYX_ERR(0, 523, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { - /* "src/helpers/correl.pyx":573 + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) - * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs1) # number of molecules - * cdef long n = len(rotTs1[0]) # number of time steps */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_19rotationMatrixShellCorrelateTotParts, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixShellCorrelateTotP, __pyx_t_1) < 0) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 989, __pyx_L23_error) + if (__pyx_t_6) { - /* "src/helpers/correl.pyx":637 + /* "View.MemoryView":993 * - * @cython.boundscheck(False) - * def vectorRotation(double [:,:] rotTs, int datapoints): # <<<<<<<<<<<<<< - * # cdef long datapoints = len(rotTs) - * cdef double [:,:] corr = np.zeros((2,datapoints)) + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_21vectorRotation, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_vectorRotation, __pyx_t_1) < 0) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_memoryviewslice_type)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/correl.pyx":656 + /* "View.MemoryView":994 * - * @cython.boundscheck(False) - * def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_23sparsefullnobulkthincorrelate, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsefullnobulkthincorrelate, __pyx_t_1) < 0) __PYX_ERR(0, 656, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_array_type)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/correl.pyx":729 + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) - * def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * int pcorrdim, - * np.ndarray[np.int32_t,ndim=2] pds, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_25sparsefullnobulkthingreenkubo, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsefullnobulkthingreenkubo, __pyx_t_1) < 0) __PYX_ERR(0, 729, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } - /* "src/helpers/correl.pyx":804 + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: * - * @cython.boundscheck(False) - * def sparsefullcrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] pdata2, - * np.ndarray[np.int32_t,ndim=2] pds, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_27sparsefullcrosscorrelate, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsefullcrosscorrelate, __pyx_t_1) < 0) __PYX_ERR(0, 804, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L28_try_end; + __pyx_L23_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/correl.pyx":872 + /* "View.MemoryView":995 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue * - * @cython.boundscheck(False) - * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # <<<<<<<<<<<<<< - * maxlen=None): - * cdef int nmol = len(pdata) # number of molecules */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_29sparsecorrelate, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 872, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsecorrelate, __pyx_t_1) < 0) __PYX_ERR(0, 872, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L24_exception_handled; + } + __pyx_L24_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L28_try_end:; + } + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/correl.pyx":906 + /* "newanalysis/helpers/correl.pyx":4 + * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 * - * @cython.boundscheck(False) - * def calcAngularDisplacement(np.ndarray[np.float64_t,ndim=3] coor_ts, delta): # <<<<<<<<<<<<<< + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np * - * cdef int maxTime = coor_ts.shape[0] */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_31calcAngularDisplacement, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcAngularDisplacement, __pyx_t_1) < 0) __PYX_ERR(0, 906, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_7) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/correl.pyx":923 + /* "newanalysis/helpers/correl.pyx":24 + * void transform( double *data, int ncut, double *ans_re, double *ans_im, int ltc ) nogil * - * @cython.boundscheck(False) - * def calcAngularVelocityXCorrel(np.ndarray[np.float64_t,ndim=3] coor1_ts, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coor2_ts, - * delta): + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateParallel(np.ndarray[np.float64_t,ndim=2] data1, + * np.ndarray[np.float64_t,ndim=2] data2, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_33calcAngularVelocityXCorrel, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 923, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcAngularVelocityXCorrel, __pyx_t_1) < 0) __PYX_ERR(0, 923, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_1correlateParallel, 0, __pyx_n_s_correlateParallel, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__27); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateParallel, __pyx_t_7) < 0) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/correl.pyx":943 + /* "newanalysis/helpers/correl.pyx":98 + * del myplan * - * @cython.boundscheck(False) - * def calcRelativeAngDisp(np.ndarray[np.float64_t,ndim=3] coor1_ts, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coor2_ts, - * delta, ncut): + * def correlate(np.ndarray[np.float64_t,ndim=1] data1, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=1] data2, + * ltc=0): */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6correl_35calcRelativeAngDisp, NULL, __pyx_n_s_newanalysis_correl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcRelativeAngDisp, __pyx_t_1) < 0) __PYX_ERR(0, 943, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_3correlate, 0, __pyx_n_s_correlate, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__27); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlate, __pyx_t_7) < 0) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/correl.pyx":1 - * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< - * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + /* "newanalysis/helpers/correl.pyx":141 + * return ans * + * def transform(double [:] data, ltc = 0): # <<<<<<<<<<<<<< + * """ + * transform(data, ltc=0) */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_5transform, 0, __pyx_n_s_transform, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__27); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_transform, __pyx_t_7) < 0) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":210 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/correl.pyx":156 + * return np.asarray(ans) * - * def __dealloc__(array self): + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsecrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * np.ndarray[np.int32_t,ndim=2] pds, */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_array_type); + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_7sparsecrosscorrelate, 0, __pyx_n_s_sparsecrosscorrelate, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__34); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsecrosscorrelate, __pyx_t_7) < 0) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":287 - * return self.name + /* "newanalysis/helpers/correl.pyx":197 * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * np.ndarray[np.int32_t,ndim=2] pds, */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(generic); - __Pyx_DECREF_SET(generic, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_9sparsefullcorrelate, 0, __pyx_n_s_sparsefullcorrelate, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__34); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsefullcorrelate, __pyx_t_7) < 0) __PYX_ERR(0, 197, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":288 + /* "newanalysis/helpers/correl.pyx":326 * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(strided); - __Pyx_DECREF_SET(strided, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_11sparsefullnobulkcorrelate, 0, __pyx_n_s_sparsefullnobulkcorrelate, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__34); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsefullnobulkcorrelate, __pyx_t_7) < 0) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/correl.pyx":396 + * return corr,selfcorr,crosscorr * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(indirect); - __Pyx_DECREF_SET(indirect, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_13rotationMatrixShellCorrelateDist, 0, __pyx_n_s_rotationMatrixShellCorrelateDist, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 396, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixShellCorrelateDist, __pyx_t_7) < 0) __PYX_ERR(0, 396, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":292 + /* "newanalysis/helpers/correl.pyx":441 * * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_15rotationMatrixShellCorrelate, 0, __pyx_n_s_rotationMatrixShellCorrelate, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixShellCorrelate, __pyx_t_7) < 0) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/correl.pyx":522 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(contiguous); - __Pyx_DECREF_SET(contiguous, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_17rotationMatrixShellCorrelateTot, 0, __pyx_n_s_rotationMatrixShellCorrelateTot, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixShellCorrelateTot, __pyx_t_7) < 0) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":293 + /* "newanalysis/helpers/correl.pyx":572 + * return corr * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] rotTs2,double [:,:,:] rotTs3, int [:,:] ds, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs1) # number of molecules + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_19rotationMatrixShellCorrelateTotParts, 0, __pyx_n_s_rotationMatrixShellCorrelateTotP, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixShellCorrelateTotP, __pyx_t_7) < 0) __PYX_ERR(0, 572, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/correl.pyx":636 * * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vectorRotation(double [:,:] rotTs, int datapoints): + * # cdef long datapoints = len(rotTs) */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__62, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(indirect_contiguous); - __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_21vectorRotation, 0, __pyx_n_s_vectorRotation, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 636, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_vectorRotation, __pyx_t_7) < 0) __PYX_ERR(0, 636, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":317 + /* "newanalysis/helpers/correl.pyx":655 + * return corr * - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ - * PyThread_allocate_lock(), + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, */ - __pyx_memoryview_thread_locks_used = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_23sparsefullnobulkthincorrelate, 0, __pyx_n_s_sparsefullnobulkthincorrelate, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__51); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsefullnobulkthincorrelate, __pyx_t_7) < 0) __PYX_ERR(0, 655, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":318 - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< - * PyThread_allocate_lock(), - * PyThread_allocate_lock(), + /* "newanalysis/helpers/correl.pyx":728 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, + * int pcorrdim, */ - __pyx_t_2[0] = PyThread_allocate_lock(); - __pyx_t_2[1] = PyThread_allocate_lock(); - __pyx_t_2[2] = PyThread_allocate_lock(); - __pyx_t_2[3] = PyThread_allocate_lock(); - __pyx_t_2[4] = PyThread_allocate_lock(); - __pyx_t_2[5] = PyThread_allocate_lock(); - __pyx_t_2[6] = PyThread_allocate_lock(); - __pyx_t_2[7] = PyThread_allocate_lock(); - memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_25sparsefullnobulkthingreenkubo, 0, __pyx_n_s_sparsefullnobulkthingreenkubo, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__51); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsefullnobulkthingreenkubo, __pyx_t_7) < 0) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":551 - * info.obj = self + /* "newanalysis/helpers/correl.pyx":803 * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsefullcrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata1, + * np.ndarray[np.float64_t,ndim=2] pdata2, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_27sparsefullcrosscorrelate, 0, __pyx_n_s_sparsefullcrosscorrelate, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 803, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__34); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsefullcrosscorrelate, __pyx_t_7) < 0) __PYX_ERR(0, 803, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/correl.pyx":871 * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, + * maxlen=None): */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_memoryview_type); + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_29sparsecorrelate, 0, __pyx_n_s_sparsecorrelate, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 871, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__34); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparsecorrelate, __pyx_t_7) < 0) __PYX_ERR(0, 871, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":997 - * return self.from_object + /* "newanalysis/helpers/correl.pyx":905 + * return corr * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularDisplacement(np.ndarray[np.float64_t,ndim=3] coor_ts, delta): * + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_31calcAngularDisplacement, 0, __pyx_n_s_calcAngularDisplacement, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 905, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcAngularDisplacement, __pyx_t_7) < 0) __PYX_ERR(0, 905, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/correl.pyx":922 + * return msd * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularVelocityXCorrel(np.ndarray[np.float64_t,ndim=3] coor1_ts, + * np.ndarray[np.float64_t,ndim=3] coor2_ts, */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_memoryviewslice_type); + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_33calcAngularVelocityXCorrel, 0, __pyx_n_s_calcAngularVelocityXCorrel, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 922, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcAngularVelocityXCorrel, __pyx_t_7) < 0) __PYX_ERR(0, 922, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "newanalysis/helpers/correl.pyx":942 + * return xcf + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcRelativeAngDisp(np.ndarray[np.float64_t,ndim=3] coor1_ts, + * np.ndarray[np.float64_t,ndim=3] coor2_ts, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6correl_35calcRelativeAngDisp, 0, __pyx_n_s_calcRelativeAngDisp, NULL, __pyx_n_s_newanalysis_correl, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcRelativeAngDisp, __pyx_t_7) < 0) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + /* "newanalysis/helpers/correl.pyx":1 + * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< + * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + * */ + __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); if (__pyx_m) { - if (__pyx_d) { + if (__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init newanalysis.correl", __pyx_clineno, __pyx_lineno, __pyx_filename); } + #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init newanalysis.correl"); } @@ -35466,6 +40534,22 @@ if (!__Pyx_RefNanny) { return; #endif } +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ @@ -35485,6 +40569,106 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + /* PyObjectGetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { @@ -35495,23 +40679,252 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif - return PyObject_GetAttr(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif } -#endif -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); #else - "name '%.200s' is not defined", PyString_AS_STRING(name)); +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; #endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; } - return result; + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) } +#endif /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( @@ -35556,6 +40969,7 @@ static void __Pyx_RaiseDoubleKeywordsError( /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, + PyObject *const *kwvalues, PyObject **argnames[], PyObject *kwds2, PyObject *values[], @@ -35566,13 +40980,54 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); // transfer ownership of value to values + Py_DECREF(key); +#endif + key = NULL; + value = NULL; continue; } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_Check(key))) { @@ -35580,6 +41035,9 @@ static int __Pyx_ParseOptionalKeywords( if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif break; } name++; @@ -35600,14 +41058,18 @@ static int __Pyx_ParseOptionalKeywords( #endif if (likely(PyUnicode_Check(key))) { while (*name) { - int cmp = (**name == key) ? 0 : + int cmp = ( #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif - PyUnicode_Compare(**name, key); + PyUnicode_Compare(**name, key) + ); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif break; } name++; @@ -35634,6 +41096,8 @@ static int __Pyx_ParseOptionalKeywords( goto invalid_keyword; } } + Py_XDECREF(key); + Py_XDECREF(value); return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); @@ -35643,21 +41107,26 @@ static int __Pyx_ParseOptionalKeywords( "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: - PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else + PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: + Py_XDECREF(key); + Py_XDECREF(value); return -1; } /* ArgTypeTest */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; @@ -35670,576 +41139,761 @@ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *nam else { if (likely(__Pyx_TypeCheck(obj, type))) return 1; } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); return 0; } -/* IsLittleEndian */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) -{ - union { - uint32_t u32; - uint8_t u8[4]; - } S; - S.u32 = 0x01020304; - return S.u8[0] == 4; -} - -/* BufferFormatCheck */ -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type) { - stack[0].field = &ctx->root; - stack[0].parent_offset = 0; - ctx->root.type = type; - ctx->root.name = "buffer dtype"; - ctx->root.offset = 0; - ctx->head = stack; - ctx->head->field = &ctx->root; - ctx->fmt_offset = 0; - ctx->head->parent_offset = 0; - ctx->new_packmode = '@'; - ctx->enc_packmode = '@'; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->is_complex = 0; - ctx->is_valid_array = 0; - ctx->struct_alignment = 0; - while (type->typegroup == 'S') { - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = 0; - type = type->fields->type; - } -} -static int __Pyx_BufFmt_ParseNumber(const char** ts) { - int count; - const char* t = *ts; - if (*t < '0' || *t > '9') { - return -1; +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); } else { - count = *t++ - '0'; - while (*t >= '0' && *t <= '9') { - count *= 10; - count += *t++ - '0'; + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; } } - *ts = t; - return count; -} -static int __Pyx_BufFmt_ExpectNumber(const char **ts) { - int number = __Pyx_BufFmt_ParseNumber(ts); - if (number == -1) - PyErr_Format(PyExc_ValueError,\ - "Does not understand character buffer dtype format string ('%c')", **ts); - return number; -} -static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - PyErr_Format(PyExc_ValueError, - "Unexpected format string character: '%c'", ch); -} -static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { - switch (ch) { - case '?': return "'bool'"; - case 'c': return "'char'"; - case 'b': return "'signed char'"; - case 'B': return "'unsigned char'"; - case 'h': return "'short'"; - case 'H': return "'unsigned short'"; - case 'i': return "'int'"; - case 'I': return "'unsigned int'"; - case 'l': return "'long'"; - case 'L': return "'unsigned long'"; - case 'q': return "'long long'"; - case 'Q': return "'unsigned long long'"; - case 'f': return (is_complex ? "'complex float'" : "'float'"); - case 'd': return (is_complex ? "'complex double'" : "'double'"); - case 'g': return (is_complex ? "'complex long double'" : "'long double'"); - case 'T': return "a struct"; - case 'O': return "Python object"; - case 'P': return "a pointer"; - case 's': case 'p': return "a string"; - case 0: return "end"; - default: return "unparseable format string"; - } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; } -static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return 2; - case 'i': case 'I': case 'l': case 'L': return 4; - case 'q': case 'Q': return 8; - case 'f': return (is_complex ? 8 : 4); - case 'd': return (is_complex ? 16 : 8); - case 'g': { - PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); - return 0; +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; } - case 'O': case 'P': return sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif } +bad: + Py_XDECREF(owned_instance); + return; } -static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(short); - case 'i': case 'I': return sizeof(int); - case 'l': case 'L': return sizeof(long); - #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(PY_LONG_LONG); - #endif - case 'f': return sizeof(float) * (is_complex ? 2 : 1); - case 'd': return sizeof(double) * (is_complex ? 2 : 1); - case 'g': return sizeof(long double) * (is_complex ? 2 : 1); - case 'O': case 'P': return sizeof(void*); - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; +#endif + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; } - } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; } -typedef struct { char c; short x; } __Pyx_st_short; -typedef struct { char c; int x; } __Pyx_st_int; -typedef struct { char c; long x; } __Pyx_st_long; -typedef struct { char c; float x; } __Pyx_st_float; -typedef struct { char c; double x; } __Pyx_st_double; -typedef struct { char c; long double x; } __Pyx_st_longdouble; -typedef struct { char c; void *x; } __Pyx_st_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; #endif -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { + return NULL; + } + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && #endif - case 'f': return sizeof(__Pyx_st_float) - sizeof(float); - case 'd': return sizeof(__Pyx_st_double) - sizeof(double); - case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); } -} -/* These are for computing the padding at the end of the struct to align - on the first member of the struct. This will probably the same as above, - but we don't have any guarantees. - */ -typedef struct { short x; char c; } __Pyx_pad_short; -typedef struct { int x; char c; } __Pyx_pad_int; -typedef struct { long x; char c; } __Pyx_pad_long; -typedef struct { float x; char c; } __Pyx_pad_float; -typedef struct { double x; char c; } __Pyx_pad_double; -typedef struct { long double x; char c; } __Pyx_pad_longdouble; -typedef struct { void *x; char c; } __Pyx_pad_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); #endif -static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} #endif - case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); - case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); - case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); } + return result; } -static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { - switch (ch) { - case 'c': - return 'H'; - case 'b': case 'h': case 'i': - case 'l': case 'q': case 's': case 'p': - return 'I'; - case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': - return 'U'; - case 'f': case 'd': case 'g': - return (is_complex ? 'C' : 'R'); - case 'O': - return 'O'; - case 'P': - return 'P'; - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; +#endif + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); } - } + return result; } -static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { - if (ctx->head == NULL || ctx->head->field == &ctx->root) { - const char* expected; - const char* quote; - if (ctx->head == NULL) { - expected = "end"; - quote = ""; - } else { - expected = ctx->head->field->type->name; - quote = "'"; - } - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected %s%s%s but got %s", - quote, expected, quote, - __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); - } else { - __Pyx_StructField* field = ctx->head->field; - __Pyx_StructField* parent = (ctx->head - 1)->field; - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", - field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), - parent->type->name, field->name); - } +#endif + +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; } -static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { - char group; - size_t size, offset, arraysize = 1; - if (ctx->enc_type == 0) return 0; - if (ctx->head->field->type->arraysize[0]) { - int i, ndim = 0; - if (ctx->enc_type == 's' || ctx->enc_type == 'p') { - ctx->is_valid_array = ctx->head->field->type->ndim == 1; - ndim = 1; - if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { - PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %zu", - ctx->head->field->type->arraysize[0], ctx->enc_count); - return -1; +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) +#else + if (PyCFunction_Check(func)) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } } } - if (!ctx->is_valid_array) { - PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", - ctx->head->field->type->ndim, ndim); - return -1; + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } + } } - for (i = 0; i < ctx->head->field->type->ndim; i++) { - arraysize *= ctx->head->field->type->arraysize[i]; +#endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } } - ctx->is_valid_array = 0; - ctx->enc_count = 1; - } - group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); - do { - __Pyx_StructField* field = ctx->head->field; - __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { - size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); - } else { - size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); } - if (ctx->enc_packmode == '@') { - size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - size_t align_mod_offset; - if (align_at == 0) return -1; - align_mod_offset = ctx->fmt_offset % align_at; - if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; - if (ctx->struct_alignment == 0) - ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, - ctx->is_complex); + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); } - if (type->size != size || type->typegroup != group) { - if (type->typegroup == 'C' && type->fields != NULL) { - size_t parent_offset = ctx->head->parent_offset + field->offset; - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = parent_offset; - continue; - } - if ((type->typegroup == 'H' || group == 'H') && type->size == size) { - } else { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } + #endif + #endif + #if CYTHON_VECTORCALL + #if Py_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, kwargs); } - offset = ctx->head->parent_offset + field->offset; - if (ctx->fmt_offset != offset) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", - (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); - return -1; + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); } - ctx->fmt_offset += size; - if (arraysize) - ctx->fmt_offset += (arraysize - 1) * size; - --ctx->enc_count; - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - break; - } - ctx->head->field = ++field; - if (field->type == NULL) { - --ctx->head; - field = ctx->head->field; - continue; - } else if (field->type->typegroup == 'S') { - size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; - field = field->type->fields; - ++ctx->head; - ctx->head->field = field; - ctx->head->parent_offset = parent_offset; - break; - } else { - break; - } + #endif + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); } - } while (ctx->enc_count); - ctx->enc_type = 0; - ctx->is_complex = 0; - return 0; + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); } -static PyObject * -__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) { - const char *ts = *tsp; - int i = 0, number, ndim; - ++ts; - if (ctx->new_count != 1) { - PyErr_SetString(PyExc_ValueError, - "Cannot handle repeated arrays in format string"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ndim = ctx->head->field->type->ndim; - while (*ts && *ts != ')') { - switch (*ts) { - case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; - default: break; + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* CIntToDigits */ +static const char DIGIT_PAIRS_10[2*10*10+1] = { + "00010203040506070809" + "10111213141516171819" + "20212223242526272829" + "30313233343536373839" + "40414243444546474849" + "50515253545556575859" + "60616263646566676869" + "70717273747576777879" + "80818283848586878889" + "90919293949596979899" +}; +static const char DIGIT_PAIRS_8[2*8*8+1] = { + "0001020304050607" + "1011121314151617" + "2021222324252627" + "3031323334353637" + "4041424344454647" + "5051525354555657" + "6061626364656667" + "7071727374757677" +}; +static const char DIGITS_HEX[2*16+1] = { + "0123456789abcdef" + "0123456789ABCDEF" +}; + +/* BuildPyUnicode */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char) { + PyObject *uval; + Py_ssize_t uoffset = ulength - clength; +#if CYTHON_USE_UNICODE_INTERNALS + Py_ssize_t i; +#if CYTHON_PEP393_ENABLED + void *udata; + uval = PyUnicode_New(ulength, 127); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_DATA(uval); +#else + Py_UNICODE *udata; + uval = PyUnicode_FromUnicode(NULL, ulength); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_AS_UNICODE(uval); +#endif + if (uoffset > 0) { + i = 0; + if (prepend_sign) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); + i++; + } + for (; i < uoffset; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); } - number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) - return PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %d", - ctx->head->field->type->arraysize[i], number); - if (*ts != ',' && *ts != ')') - return PyErr_Format(PyExc_ValueError, - "Expected a comma in format string, got '%c'", *ts); - if (*ts == ',') ts++; - i++; } - if (i != ndim) - return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", - ctx->head->field->type->ndim, i); - if (!*ts) { - PyErr_SetString(PyExc_ValueError, - "Unexpected end of format string, expected ')'"); - return NULL; + for (i=0; i < clength; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); } - ctx->is_valid_array = 1; - ctx->new_count = 1; - *tsp = ++ts; - return Py_None; -} -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { - int got_Z = 0; - while (1) { - switch(*ts) { - case 0: - if (ctx->enc_type != 0 && ctx->head == NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - if (ctx->head != NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; +#else + { + PyObject *sign = NULL, *padding = NULL; + uval = NULL; + if (uoffset > 0) { + prepend_sign = !!prepend_sign; + if (uoffset > prepend_sign) { + padding = PyUnicode_FromOrdinal(padding_char); + if (likely(padding) && uoffset > prepend_sign + 1) { + PyObject *tmp; + PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign); + if (unlikely(!repeat)) goto done_or_error; + tmp = PyNumber_Multiply(padding, repeat); + Py_DECREF(repeat); + Py_DECREF(padding); + padding = tmp; + } + if (unlikely(!padding)) goto done_or_error; + } + if (prepend_sign) { + sign = PyUnicode_FromOrdinal('-'); + if (unlikely(!sign)) goto done_or_error; + } } - return ts; - case ' ': - case '\r': - case '\n': - ++ts; - break; - case '<': - if (!__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; + uval = PyUnicode_DecodeASCII(chars, clength, NULL); + if (likely(uval) && padding) { + PyObject *tmp = PyNumber_Add(padding, uval); + Py_DECREF(uval); + uval = tmp; } - ctx->new_packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); - return NULL; + if (likely(uval) && sign) { + PyObject *tmp = PyNumber_Add(sign, uval); + Py_DECREF(uval); + uval = tmp; } - ctx->new_packmode = '='; - ++ts; - break; - case '=': - case '@': - case '^': - ctx->new_packmode = *ts++; - break; - case 'T': - { - const char* ts_after_sub; - size_t i, struct_count = ctx->new_count; - size_t struct_alignment = ctx->struct_alignment; - ctx->new_count = 1; - ++ts; - if (*ts != '{') { - PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - ctx->enc_count = 0; - ctx->struct_alignment = 0; - ++ts; - ts_after_sub = ts; - for (i = 0; i != struct_count; ++i) { - ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); - if (!ts_after_sub) return NULL; - } - ts = ts_after_sub; - if (struct_alignment) ctx->struct_alignment = struct_alignment; +done_or_error: + Py_XDECREF(padding); + Py_XDECREF(sign); + } +#endif + return uval; +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(int)*3+2]; + char *dpos, *end = digits + sizeof(int)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + int remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (int) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (int) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (int) (remaining / 16); + break; + default: + assert(0); + break; } - break; - case '}': - { - size_t alignment = ctx->struct_alignment; - ++ts; - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - if (alignment && ctx->fmt_offset % alignment) { - ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); - } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; } - return ts; - case 'x': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->fmt_offset += ctx->new_count; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->enc_packmode = ctx->new_packmode; - ++ts; - break; - case 'Z': - got_Z = 1; - ++ts; - if (*ts != 'f' && *ts != 'd' && *ts != 'g') { - __Pyx_BufFmt_RaiseUnexpectedChar('Z'); - return NULL; + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (Py_ssize_t) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (Py_ssize_t) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (Py_ssize_t) (remaining / 16); + break; + default: + assert(0); + break; } - CYTHON_FALLTHROUGH; - case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': - case 'l': case 'L': case 'q': case 'Q': - case 'f': case 'd': case 'g': - case 'O': case 'p': - if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && - (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { - ctx->enc_count += ctx->new_count; - ctx->new_count = 1; - got_Z = 0; - ++ts; - break; + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; } - CYTHON_FALLTHROUGH; - case 's': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_count = ctx->new_count; - ctx->enc_packmode = ctx->new_packmode; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; - ++ts; - ctx->new_count = 1; - got_Z = 0; - break; - case ':': - ++ts; - while(*ts != ':') ++ts; - ++ts; - break; - case '(': - if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; - break; - default: - { - int number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - ctx->new_count = (size_t)number; + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + CYTHON_MAYBE_UNUSED_VAR(max_char); +#if CYTHON_PEP393_ENABLED + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); +#else + result_uval = PyUnicode_FromUnicode(NULL, result_ulength); + if (unlikely(!result_uval)) return NULL; + result_ukind = sizeof(Py_UNICODE); + kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; + result_udata = PyUnicode_AS_UNICODE(result_uval); +#endif + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); + if (unlikely(__Pyx_PyUnicode_READY(uval))) + goto bad; + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030D0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif } + char_pos += ulength; } - } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; +#else + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + CYTHON_UNUSED_VAR(value_count); + return PyUnicode_Join(__pyx_empty_unicode, value_tuple); +#endif } -/* BufferGetAndValidate */ - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (unlikely(info->buf == NULL)) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); -} -static void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; -} -static int __Pyx__GetBufferAndValidate( - Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, - int nd, int cast, __Pyx_BufFmt_StackElem* stack) -{ - buf->buf = NULL; - if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { - __Pyx_ZeroBuffer(buf); - return -1; - } - if (unlikely(buf->ndim != nd)) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - nd, buf->ndim); - goto fail; - } - if (!cast) { - __Pyx_BufFmt_Context ctx; - __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; - } - if (unlikely((size_t)buf->itemsize != dtype->size)) { - PyErr_Format(PyExc_ValueError, - "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", - buf->itemsize, (buf->itemsize > 1) ? "s" : "", - dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); - goto fail; - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_SafeReleaseBuffer(buf); - return -1; +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); } /* GetItemInt */ - static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; - if (!j) return NULL; + if (unlikely(!j)) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; @@ -36300,10 +41954,18 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return r; } } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); if (likely(l >= 0)) { i += l; } else { @@ -36312,7 +41974,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, PyErr_Clear(); } } - return m->sq_item(o, i); + return sm->sq_item(o, i); } } #else @@ -36323,8 +41985,169 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (meth) { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } + } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + Py_ssize_t kwsize; +#if CYTHON_ASSUME_SAFE_MACROS + kwsize = PyTuple_GET_SIZE(kw); +#else + kwsize = PyTuple_Size(kw); + if (kwsize < 0) return 0; +#endif + if (unlikely(kwsize == 0)) + return 1; + if (!kw_allowed) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, 0); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + goto invalid_keyword; + } +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < kwsize; pos++) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } +#endif + return 1; + } + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +/* GetAttr3 */ +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyString_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } +#endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +} + /* PyDictVersioning */ - #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { PyObject *dict = Py_TYPE(obj)->tp_dict; return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; @@ -36350,7 +42173,7 @@ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UIN #endif /* GetModuleGlobalName */ - #if CYTHON_USE_DICT_VERSIONS +#if CYTHON_USE_DICT_VERSIONS static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) #else static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) @@ -36366,6 +42189,14 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) } else if (unlikely(PyErr_Occurred())) { return NULL; } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } #else result = PyDict_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) @@ -36383,515 +42214,52 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #endif return __Pyx_GetBuiltinName(name); } - -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); - } -} -#endif - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif -#endif - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCall2Args */ - static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(__Pyx_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -/* PyIntCompare */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) { - if (op1 == op2) { - Py_RETURN_TRUE; - } - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long a = PyInt_AS_LONG(op1); - if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - int unequal; - unsigned long uintval; - Py_ssize_t size = Py_SIZE(op1); - const digit* digits = ((PyLongObject*)op1)->ob_digit; - if (intval == 0) { - if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } else if (intval < 0) { - if (size >= 0) - Py_RETURN_FALSE; - intval = -intval; - size = -size; - } else { - if (size <= 0) - Py_RETURN_FALSE; - } - uintval = (unsigned long) intval; -#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 4)) { - unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 3)) { - unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 2)) { - unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 1)) { - unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif - unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); - if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } - return ( - PyObject_RichCompare(op1, op2, Py_EQ)); -} - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* BufferIndexError */ - static void __Pyx_RaiseBufferIndexError(int axis) { - PyErr_Format(PyExc_IndexError, - "Out of bounds on buffer access (axis %d)", axis); -} - -/* MemviewSliceInit */ - static int -__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference) -{ - __Pyx_RefNannyDeclarations - int i, retval=-1; - Py_buffer *buf = &memview->view; - __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (unlikely(memviewslice->memview || memviewslice->data)) { - PyErr_SetString(PyExc_ValueError, - "memviewslice is already initialized!"); - goto fail; - } - if (buf->strides) { - for (i = 0; i < ndim; i++) { - memviewslice->strides[i] = buf->strides[i]; - } - } else { - Py_ssize_t stride = buf->itemsize; - for (i = ndim - 1; i >= 0; i--) { - memviewslice->strides[i] = stride; - stride *= buf->shape[i]; - } - } - for (i = 0; i < ndim; i++) { - memviewslice->shape[i] = buf->shape[i]; - if (buf->suboffsets) { - memviewslice->suboffsets[i] = buf->suboffsets[i]; - } else { - memviewslice->suboffsets[i] = -1; - } - } - memviewslice->memview = memview; - memviewslice->data = (char *)buf->buf; - if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { - Py_INCREF(memview); - } - retval = 0; - goto no_fail; -fail: - memviewslice->memview = 0; - memviewslice->data = 0; - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; -} -#ifndef Py_NO_RETURN -#define Py_NO_RETURN -#endif -static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { - va_list vargs; - char msg[200]; -#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) - va_start(vargs, fmt); -#else - va_start(vargs); -#endif - vsnprintf(msg, 200, fmt, vargs); - va_end(vargs); - Py_FatalError(msg); -} -static CYTHON_INLINE int -__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)++; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE int -__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)--; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE void -__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) -{ - int first_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) - return; - if (unlikely(__pyx_get_slice_count(memview) < 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - first_time = __pyx_add_acquisition_count(memview) == 0; - if (unlikely(first_time)) { - if (have_gil) { - Py_INCREF((PyObject *) memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_INCREF((PyObject *) memview); - PyGILState_Release(_gilstate); - } - } -} -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, - int have_gil, int lineno) { - int last_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) { - memslice->memview = NULL; - return; - } - if (unlikely(__pyx_get_slice_count(memview) <= 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - last_time = __pyx_sub_acquisition_count(memview) == 1; - memslice->data = NULL; - if (unlikely(last_time)) { - if (have_gil) { - Py_CLEAR(memslice->memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_CLEAR(memslice->memview); - PyGILState_Release(_gilstate); - } - } else { - memslice->memview = NULL; - } + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -/* DivInt[long] */ - static CYTHON_INLINE long __Pyx_div_long(long a, long b) { - long q = a / b; - long r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; } /* GetTopmostException */ - #if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; @@ -36901,23 +42269,48 @@ __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) #endif /* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; - #else + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; - #endif Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); + #endif } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; @@ -36938,55 +42331,43 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); -} -#endif - -/* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; icurexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + #endif } #endif /* GetException */ - #if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { - PyObject *local_type, *local_value, *local_tb; + PyObject *local_type = NULL, *local_value, *local_tb = NULL; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; + #endif #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) @@ -37008,12 +42389,21 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; + #endif } #else tmp_type = tstate->exc_type; @@ -37040,435 +42430,30 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return -1; } -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { +/* SwapException */ #if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } -#endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -#endif -} - -/* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } -#if CYTHON_USE_UNICODE_INTERNALS - { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } - } -#endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); + tmp_tb = PyException_GetTraceback(tmp_value); #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - -/* DivInt[Py_ssize_t] */ - static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { - Py_ssize_t q = a / b; - Py_ssize_t r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -/* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) -#else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); -#endif - return PyObject_GetAttr(o, n); -} - -/* ObjectGetItem */ - #if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr = NULL; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); - } - return __Pyx_PyObject_GetIndex(obj, key); -} -#endif - -/* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; - } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - } - if (unlikely(stop <= start)) - return __Pyx_NewRef(__pyx_empty_unicode); - length = stop - start; - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); } -} - -/* GetAttr3 */ - static PyObject *__Pyx_GetAttr3Default(PyObject *d) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(d); - return d; -} -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r = __Pyx_GetAttr(o, n); - return (likely(r)) ? r : __Pyx_GetAttr3Default(d); -} - -/* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -/* SwapException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK + #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; @@ -37476,14 +42461,14 @@ static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject * exc_info->exc_type = *type; exc_info->exc_value = *value; exc_info->exc_traceback = *tb; - #else + #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = *type; tstate->exc_value = *value; tstate->exc_traceback = *tb; - #endif + #endif *type = tmp_type; *value = tmp_value; *tb = tmp_tb; @@ -37500,40 +42485,33 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, #endif /* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *module = 0; - PyObject *global_dict = 0; PyObject *empty_dict = 0; - PyObject *list; + PyObject *empty_list = 0; #if PY_MAJOR_VERSION < 3 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) + if (unlikely(!py_import)) goto bad; - #endif - if (from_list) - list = from_list; - else { + if (!from_list) { empty_list = PyList_New(0); - if (!empty_list) + if (unlikely(!empty_list)) goto bad; - list = empty_list; + from_list = empty_list; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; + #endif empty_dict = PyDict_New(); - if (!empty_dict) + if (unlikely(!empty_dict)) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) goto bad; PyErr_Clear(); } @@ -37544,31 +42522,169 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, if (!module) { #if PY_MAJOR_VERSION < 3 PyObject *py_level = PyInt_FromLong(level); - if (!py_level) + if (unlikely(!py_level)) goto bad; module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); + name, __pyx_d, empty_dict, from_list, level); #endif } } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + return module; +} + +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); + } + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); +#endif + return imported_module; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; + } + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; +} +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__3; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; + } + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); + } + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); + } +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); +} + +/* ssize_strlen */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; } /* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { - a = a->tp_base; + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } @@ -37589,6 +42705,22 @@ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { } return __Pyx_InBases(a, b); } +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} #if PY_MAJOR_VERSION == 2 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { PyObject *exception, *value, *tb; @@ -37601,241 +42733,881 @@ static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc PyErr_WriteUnraisable(err); res = 0; } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) +#else + if (is_list || PySequence_Check(o)) +#endif + { + return PySequence_SetItem(o, i, v); + } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +} + +/* RaiseUnboundLocalError */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +/* HasAttr */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_GetAttr(o, n); + if (!r) { + PyErr_Clear(); + return 0; + } else { + Py_DECREF(r); + return 1; + } +} + +/* IsLittleEndian */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) +{ + union { + uint32_t u32; + uint8_t u8[4]; + } S; + S.u32 = 0x01020304; + return S.u8[0] == 4; +} + +/* BufferFormatCheck */ +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t <= '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case '?': return "'bool'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparsable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); + } + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + } + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; + } + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} +static int +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number, ndim; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return -1; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return -1; + ndim = ctx->head->field->type->ndim; + while (*ts && *ts != ')') { + switch (*ts) { + case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; + default: break; } + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return -1; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + return -1; + } + if (*ts != ',' && *ts != ')') { + PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + return -1; + } + if (*ts == ',') ts++; + i++; } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } - return res; -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; ihead->field->type->ndim, i); + return -1; } -#endif - for (i=0; iis_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; return 0; } -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { - if (likely(err == exc_type)) return 1; - if (likely(PyExceptionClass_Check(err))) { - if (likely(PyExceptionClass_Check(exc_type))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); - } else if (likely(PyTuple_Check(exc_type))) { - return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); - } else { +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case '\r': + case '\n': + ++ts; + break; + case '<': + if (!__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; + } + break; + case '}': + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } + CYTHON_FALLTHROUGH; + case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 'p': + if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && + (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { + ctx->enc_count += ctx->new_count; + ctx->new_count = 1; + got_Z = 0; + ++ts; + break; + } + CYTHON_FALLTHROUGH; + case 's': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (__pyx_buffmt_parse_array(ctx, &ts) < 0) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } } - return PyErr_GivenExceptionMatches(err, exc_type); + } } -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { - assert(PyExceptionClass_Check(exc_type1)); - assert(PyExceptionClass_Check(exc_type2)); - if (likely(err == exc_type1 || err == exc_type2)) return 1; - if (likely(PyExceptionClass_Check(err))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); - } - return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); + +/* BufferGetAndValidate */ + static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (unlikely(info->buf == NULL)) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} +static void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} +static int __Pyx__GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + buf->buf = NULL; + if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { + __Pyx_ZeroBuffer(buf); + return -1; + } + if (unlikely(buf->ndim != nd)) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if (unlikely((size_t)buf->itemsize != dtype->size)) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_SafeReleaseBuffer(buf); + return -1; } -#endif -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; +/* PyIntCompare */ + static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { + return 1; + } #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; - long x; long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); + return (a == b); } #endif #if CYTHON_USE_PYLONG_INTERNALS if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; + int unequal; + unsigned long uintval; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + if (intval == 0) { + return (__Pyx_PyLong_IsZero(op1) == 1); + } else if (intval < 0) { + if (__Pyx_PyLong_IsNonNeg(op1)) + return 0; + intval = -intval; } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + if (__Pyx_PyLong_IsNeg(op1)) + return 0; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else #endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else #endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else #endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else #endif - - + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + return (unequal == 0); } #endif if (PyFloat_CheckExact(op1)) { const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); -} #endif - -/* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif + return ((double)a == (double)b); } - return value; + return __Pyx_PyObject_IsTrueAndDecref( + PyObject_RichCompare(op1, op2, Py_EQ)); } -/* HasAttr */ - static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { - PyObject *r; - if (unlikely(!__Pyx_PyBaseString_Check(n))) { - PyErr_SetString(PyExc_TypeError, - "hasattr(): attribute name must be string"); - return -1; - } - r = __Pyx_GetAttr(o, n); - if (unlikely(!r)) { - PyErr_Clear(); - return 0; - } else { - Py_DECREF(r); - return 1; - } +/* BufferIndexError */ + static void __Pyx_RaiseBufferIndexError(int axis) { + PyErr_Format(PyExc_IndexError, + "Out of bounds on buffer access (axis %d)", axis); } /* PyObject_GenericGetAttrNoDict */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif + __Pyx_DECREF_TypeName(type_name); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { @@ -37875,16 +43647,379 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam } #endif +/* FixUpExtensionType */ + #if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; + } + if (changed) + PyType_Modified(type); + } +#endif + return 0; +} +#endif + +/* PyObjectCallNoArg */ + static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod */ + static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); +#endif + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} + +/* PyObjectCallMethod0 */ + static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +} + +/* ValidateBasesTuple */ + #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_MACROS + n = PyTuple_GET_SIZE(bases); +#else + n = PyTuple_Size(bases); + if (n < 0) return -1; +#endif + for (i = 1; i < n; i++) + { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#if !CYTHON_USE_TYPE_SLOTS + if (dictoffset == 0) { + PyErr_Format(PyExc_TypeError, + "extension type '%s.200s': " + "unable to validate whether bases have a __dict__ " + "when CYTHON_USE_TYPE_SLOTS is off " + "(likely because you are building in the limited API). " + "Therefore, all extension types with multiple bases " + "must add 'cdef dict __dict__' in this compilation mode", + type_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#else + if (dictoffset == 0 && b->tp_dictoffset) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + } + return 0; +} +#endif + +/* PyType_Ready */ + static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + /* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 + static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) #else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) #endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) goto bad; Py_DECREF(ob); return 0; @@ -37893,33 +44028,85 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam return -1; } -/* PyObjectGetAttrStrNoError */ - static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); +/* GetVTable */ + static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + +/* MergeVTables */ + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i; + void** base_vtables; + __Pyx_TypeName tp_base_name; + __Pyx_TypeName base_name; + void* unknown = (void*)-1; + PyObject* bases = type->tp_bases; + int base_depth = 0; + { + PyTypeObject* base = type->tp_base; + while (base) { + base_depth += 1; + base = base->tp_base; + } } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; + for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { + void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); + if (base_vtable != NULL) { + int j; + PyTypeObject* base = type->tp_base; + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = base->tp_base; + } + } } - return result; + PyErr_Clear(); + free(base_vtables); + return 0; +bad: + tp_base_name = __Pyx_PyType_GetName(type->tp_base); + base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); + free(base_vtables); + return -1; } +#endif /* SetupReduce */ - static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { @@ -37985,7 +44172,7 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } else if (reduce == object_reduce || PyErr_Occurred()) { goto __PYX_BAD; } - setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); @@ -38001,8 +44188,13 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } goto __PYX_GOOD; __PYX_BAD: - if (!PyErr_Occurred()) - PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } ret = -1; __PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP @@ -38018,18 +44210,19 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { Py_XDECREF(setstate_cython); return ret; } +#endif /* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size) + #ifndef __PYX_HAVE_RT_ImportType_3_0_2 +#define __PYX_HAVE_RT_ImportType_3_0_2 +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; Py_ssize_t itemsize; -#ifdef Py_LIMITED_API +#if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; PyObject *py_itemsize; #endif @@ -38042,7 +44235,7 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, module_name, class_name); goto bad; } -#ifndef Py_LIMITED_API +#if !CYTHON_COMPILING_IN_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; itemsize = ((PyTypeObject *)result)->tp_itemsize; #else @@ -38074,17 +44267,18 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_2 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_2 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -38098,14 +44292,1181 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, } #endif +/* FetchSharedCythonModule */ + static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; +} + +/* FetchCommonType */ + static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { + goto bad; + } + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; +done: + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#endif + +/* PyVectorcallFastCallDict */ + #if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared */ + static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) +{ + CYTHON_UNUSED_VAR(closure); + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#elif PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_name, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_dict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); + } +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + CYTHON_UNUSED_VAR(args); +#if PY_MAJOR_VERSION >= 3 + Py_INCREF(m->func_qualname); + return m->func_qualname; +#else + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults_size = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyObject *py_name = NULL; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); +#endif + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); +#endif + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", + py_name); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); +#endif + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_MACROS + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(!argc) < 0) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); +#else + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); +#endif + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL + 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_PyMethod_New, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, +#endif +}; +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + m->defaults_size = size; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ + static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -38119,7 +45480,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -38141,7 +45502,8 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -38219,17 +45581,99 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + PyErr_Clear(); + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #endif +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + py_funcname = PyUnicode_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -38264,6 +45708,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -38326,13 +45771,19 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + __Pyx_TypeName obj_type_name; if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags); - PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' does not have the buffer interface", + obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { @@ -38407,19 +45858,6 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, return (start1 < end2) && (start2 < end1); } -/* Capsule */ - static CYTHON_INLINE PyObject * -__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) -{ - PyObject *cobj; -#if PY_VERSION_HEX >= 0x02070000 - cobj = PyCapsule_New(p, sig, NULL); -#else - cobj = PyCObject_FromVoidPtr(p, NULL); -#endif - return cobj; -} - /* TypeInfoCompare */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) @@ -38516,8 +45954,9 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) return 0; } static int -__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec) +__pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec) { + CYTHON_UNUSED_VAR(ndim); if (spec & __Pyx_MEMVIEW_DIRECT) { if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { PyErr_Format(PyExc_ValueError, @@ -38785,120 +46224,14 @@ static int __Pyx_ValidateAndInit_memviewslice( } static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) { double value = __pyx_PyFloat_AsDouble(obj); - if ((value == (double)-1) && PyErr_Occurred()) + if (unlikely((value == (double)-1) && PyErr_Occurred())) return 0; *(double *) itemp = value; return 1; } -/* Print */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static PyObject *__Pyx_GetStdout(void) { - PyObject *f = PySys_GetObject((char *)"stdout"); - if (!f) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); - } - return f; -} -static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - int i; - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { - PyObject* v; - if (PyFile_SoftSpace(f, 1)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - v = PyTuple_GET_ITEM(arg_tuple, i); - if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - goto error; - if (PyString_Check(v)) { - char *s = PyString_AsString(v); - Py_ssize_t len = PyString_Size(v); - if (len > 0) { - switch (s[len-1]) { - case ' ': break; - case '\f': case '\r': case '\n': case '\t': case '\v': - PyFile_SoftSpace(f, 0); - break; - default: break; - } - } - } - } - if (newline) { - if (PyFile_WriteString("\n", f) < 0) - goto error; - PyFile_SoftSpace(f, 0); - } - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; -} -#else -static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { - PyObject* kwargs = 0; - PyObject* result = 0; - PyObject* end_string; - if (unlikely(!__pyx_print)) { - __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print); - if (!__pyx_print) - return -1; - } - if (stream) { - kwargs = PyDict_New(); - if (unlikely(!kwargs)) - return -1; - if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0)) - goto bad; - if (!newline) { - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - goto bad; - if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - goto bad; - } - Py_DECREF(end_string); - } - } else if (!newline) { - if (unlikely(!__pyx_print_kwargs)) { - __pyx_print_kwargs = PyDict_New(); - if (unlikely(!__pyx_print_kwargs)) - return -1; - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - return -1; - if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - return -1; - } - Py_DECREF(end_string); - } - kwargs = __pyx_print_kwargs; - } - result = PyObject_Call(__pyx_print, arg_tuple, kwargs); - if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) - Py_DECREF(kwargs); - if (!result) - return -1; - Py_DECREF(result); - return 0; -bad: - if (kwargs != __pyx_print_kwargs) - Py_XDECREF(kwargs); - return -1; -} -#endif - /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); @@ -38918,7 +46251,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -39052,7 +46385,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); @@ -39072,7 +46405,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -39272,6 +46605,141 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return new_mvs; } +/* MemviewSliceInit */ + static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF(memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} +#ifndef Py_NO_RETURN +#define Py_NO_RETURN +#endif +static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -39285,7 +46753,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -39299,40 +46767,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -39345,109 +46818,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -39481,7 +47026,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -39495,40 +47040,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -39541,109 +47091,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -39697,8 +47319,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } @@ -39735,47 +47381,34 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); - } -} - -/* PrintOne */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static int __Pyx_PrintOne(PyObject* f, PyObject *o) { - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - if (PyFile_SoftSpace(f, 0)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) - goto error; - if (PyFile_WriteString("\n", f) < 0) - goto error; - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; - /* the line below is just to avoid C compiler - * warnings about unused functions */ - return __Pyx_Print(f, NULL, 0); -} #else -static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { - int res; - PyObject* arg_tuple = PyTuple_Pack(1, o); - if (unlikely(!arg_tuple)) - return -1; - res = __Pyx_Print(stream, arg_tuple, 1); - Py_DECREF(arg_tuple); - return res; -} + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; #endif + } +} /* CIntFromPy */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { @@ -39790,7 +47423,7 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(char) < sizeof(long)) { + if ((sizeof(char) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -39804,40 +47437,45 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { - return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { - return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { - return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -39850,109 +47488,181 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { goto raise_neg_overflow; } #endif - if (sizeof(char) <= sizeof(unsigned long)) { + if ((sizeof(char) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) - case -2: - if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(char) <= sizeof(long)) { + if ((sizeof(char) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (char) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (char) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (char) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (char) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (char) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (char) -1; } } else { @@ -39973,6 +47683,22 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { return (char) -1; } +/* FormatTypeName */ + #if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name_2); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__64); + } + return name; +} +#endif + /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[5]; @@ -40003,7 +47729,7 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { rtversion[i] = rt_from_call[i]; } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -40012,9 +47738,31 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { } /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + #if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -40022,23 +47770,11 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -40100,7 +47836,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -40129,22 +47865,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -40210,13 +47950,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -40284,4 +48022,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/newanalysis/helpers/correl.pyx b/newanalysis/helpers/correl.pyx index 1a4fe5f..e06ae6d 100644 --- a/newanalysis/helpers/correl.pyx +++ b/newanalysis/helpers/correl.pyx @@ -189,7 +189,7 @@ def sparsecrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata, if cctr[i] != 0: ccorr[i] /= cctr[i] else: - print 'too sparse' + print('too sparse') return corr @@ -246,11 +246,11 @@ def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, if cctr[i] != 0: ccorr[i] /= cctr[i] else: - print 'tot too sparse' + print('tot too sparse') if cctr[i] != 0: cselfcorr[i] /= cselfctr[i] else: - print 'self too sparse' + print('self too sparse') for i in range(maxdt*nshells): ccrosscorr[i] = ccorr[i] - cselfcorr[i] @@ -310,11 +310,11 @@ def sparsefullcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, # if cctr[i] != 0: # ccorr[i] /= cctr[i] # else: -# print 'tot too sparse' +# print('tot too sparse') # if cctr[i] != 0: # cselfcorr[i] /= cselfctr[i] # else: -# print 'self too sparse' +# print('self too sparse') # for i in range(maxdt*nshells): # ccrosscorr[i] = ccorr[i] - cselfcorr[i] @@ -331,7 +331,7 @@ def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, maxlen=None,): cdef long corrdim = pcorrdim - cdef long nmol = len(pdata)/pcorrdim # number of molecules + cdef long nmol = len(pdata)//pcorrdim # number of molecules cdef long n = len(pdata[0]) # number of time steps cdef long nds = len(pds[0]) # number of steps in delaunay array cdef long maxdt = n @@ -381,11 +381,11 @@ def sparsefullnobulkcorrelate(np.ndarray[np.float64_t,ndim=2] pdata, if cctr[i] != 0: ccorr[i] /= cctr[i] else: - print 'tot too sparse' + print('tot too sparse') if cctr[i] != 0: cselfcorr[i] /= cselfctr[i] else: - print 'self too sparse' + print('self too sparse') for i in range(maxdt*nshells): ccrosscorr[i] = ccorr[i] - cselfcorr[i] @@ -398,7 +398,7 @@ def rotationMatrixShellCorrelateDist(double [:,:,:,:] rotTs, int [:,:] ds, long cdef long nmol = len(rotTs) # number of molecules cdef long n = len(rotTs[0]) # number of time steps # cdef long nds = len(ds) # number of steps in delaunay array - cdef long startskip = (n-maxdt)/startingpoints + cdef long startskip = (n-maxdt)//startingpoints cdef double [:,:,:,:] corr = np.zeros((6,nshells,maxdt,20)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 cdef double [:,:] ctr = np.zeros((nshells,maxdt)) cdef double t1,t2,t3,t4,t5,t6 @@ -443,7 +443,7 @@ def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshe cdef long nmol = len(rotTs) # number of molecules cdef long n = len(rotTs[0]) # number of time steps # cdef long nds = len(ds) # number of steps in delaunay array - cdef long startskip = (n-maxdt)/startingpoints + cdef long startskip = (n-maxdt)//startingpoints cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) @@ -505,12 +505,12 @@ def rotationMatrixShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds, long nshe for k in range(12): corr[k,i,j] /= ctr[i,j] else: - print 'tot too sparse' + print('tot too sparse') if selfctr[i,j] != 0: for k in range(12): selfcorr[k,i,j] /= selfctr[i,j] else: - print 'self too sparse' + print('self too sparse') for i in range(nshells): for j in range(maxdt): crossctr[i,j] = ctr[i,j] - selfctr[i,j] @@ -524,7 +524,7 @@ def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long n cdef long nmol = len(rotTs) # number of molecules cdef long n = len(rotTs[0]) # number of time steps # cdef long nds = len(ds) # number of steps in delaunay array - cdef long startskip = (n-maxdt)/startingpoints + cdef long startskip = (n-maxdt)//startingpoints cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries cdef double t1,t2,t3,t4,t5,t6 @@ -565,7 +565,7 @@ def rotationMatrixShellCorrelateTot(double [:,:,:,:] rotTs, int [:,:] ds, long n for k in range(12): corr[k,i,j] /= ctr[i,j] else: - print 'tot too sparse' + print('tot too sparse') return corr @@ -574,7 +574,7 @@ def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] ro cdef long nmol = len(rotTs1) # number of molecules cdef long n = len(rotTs1[0]) # number of time steps # cdef long nds = len(ds) # number of steps in delaunay array - cdef long startskip = (n-maxdt)/startingpoints + cdef long startskip = (n-maxdt)//startingpoints cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries cdef double t1,t2,t3,t4,t5,t6 @@ -628,7 +628,7 @@ def rotationMatrixShellCorrelateTotParts(double [:,:,:] rotTs1,double [:,:,:] ro for k in range(12): corr[k,i,j] /= ctr[i,j] else: - print 'tot too sparse' + print('tot too sparse') return corr @@ -661,13 +661,13 @@ def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, startingpoints=None): cdef long corrdim = pcorrdim - cdef long nmol = len(pdata)/pcorrdim # number of molecules + cdef long nmol = len(pdata)//pcorrdim # number of molecules cdef long n = len(pdata[0]) # number of time steps cdef long nds = len(pds[0]) # number of steps in delaunay array cdef long maxdt = maxlen cdef long nshells = pnshells - cdef long startskip = (n-maxdt)/startingpoints - cdef long startmax = (n-maxdt)/startskip + cdef long startskip = (n-maxdt)//startingpoints + cdef long startmax = (n-maxdt)//startskip cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) cdef double *cdata = contdata.data @@ -712,11 +712,11 @@ def sparsefullnobulkthincorrelate(np.ndarray[np.float64_t,ndim=2] pdata, if cctr[i] != 0: ccorr[i] /= cctr[i] else: - print 'tot too sparse' + print('tot too sparse') if cselfctr[i] != 0: cselfcorr[i] /= cselfctr[i] else: - print 'self too sparse' + print('self too sparse') for i in range(maxdt*nshells): ccrosscorr[i] = ccorr[i] - cselfcorr[i] @@ -734,13 +734,13 @@ def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, startingpoints=None): cdef long corrdim = pcorrdim - cdef long nmol = len(pdata)/pcorrdim # number of molecules + cdef long nmol = len(pdata)//pcorrdim # number of molecules cdef long n = len(pdata[0]) # number of time steps cdef long nds = len(pds[0]) # number of steps in delaunay array cdef long maxdt = maxlen cdef long nshells = pnshells - cdef long startskip = (n-maxdt)/startingpoints - cdef long startmax = (n-maxdt)/startskip + cdef long startskip = (n-maxdt)//startingpoints + cdef long startmax = (n-maxdt)//startskip cdef np.ndarray[np.float64_t,ndim=2,mode="c"] contdata = np.ascontiguousarray(pdata) cdef np.ndarray[np.int32_t,ndim=2,mode="c"] contds = np.ascontiguousarray(pds) cdef double *cdata = contdata.data @@ -786,11 +786,11 @@ def sparsefullnobulkthingreenkubo(np.ndarray[np.float64_t,ndim=2] pdata, if cctr[i] != 0: ccorr[i] /= cctr[i] else: - print 'tot too sparse' + print('tot too sparse') if cctr[i] != 0: cselfcorr[i] /= cselfctr[i] else: - print 'self too sparse' + print('self too sparse') for i in range(maxdt*nshells): ccrosscorr[i] = ccorr[i] - cselfcorr[i] @@ -855,11 +855,11 @@ def sparsefullcrosscorrelate(np.ndarray[np.float64_t,ndim=2] pdata1, if cctr[i] != 0: ccorr[i] /= cctr[i] else: - print 'tot too sparse' + print('tot too sparse') if cctr[i] != 0: cselfcorr[i] /= cselfctr[i] else: - print 'self too sparse' + print('self too sparse') for i in range(maxdt*nshells): ccrosscorr[i] = ccorr[i] - cselfcorr[i] @@ -898,7 +898,7 @@ def sparsecorrelate(np.ndarray[np.float64_t,ndim=2] pdata, if cctr[i] != 0: ccorr[i] /= cctr[i] else: - print 'too sparse' + print('too sparse') return corr diff --git a/newanalysis/helpers/diffusion.cpp b/newanalysis/helpers/diffusion.cpp index bf64010..6157b6d 100644 --- a/newanalysis/helpers/diffusion.cpp +++ b/newanalysis/helpers/diffusion.cpp @@ -1,22 +1,68 @@ -/* Generated by Cython 0.29.34 */ +/* Generated by Cython 3.0.2 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayscalars.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ufuncobject.h" + ], + "extra_compile_args": [ + "-fopenmp" + ], + "extra_link_args": [ + "-fopenmp" + ], + "include_dirs": [ + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include" + ], + "language": "c++", + "name": "newanalysis.diffusion", + "sources": [ + "newanalysis/helpers/diffusion.pyx" + ] + }, + "module_name": "newanalysis.diffusion" +} +END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. +#else +#if CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" #else -#define CYTHON_ABI "0_29_34" -#define CYTHON_HEX_VERSION 0x001D22F0 -#define CYTHON_FUTURE_DIVISION 0 +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_2" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030002F0 +#define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -35,9 +81,7 @@ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -45,13 +89,19 @@ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -76,10 +126,19 @@ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS @@ -89,44 +148,121 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK @@ -136,8 +272,9 @@ #endif #elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 @@ -181,16 +318,17 @@ #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -199,11 +337,8 @@ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5) + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 @@ -226,29 +361,47 @@ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) + #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #endif - #if PY_VERSION_HEX >= 0x030B00A4 + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 @@ -257,6 +410,10 @@ #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -285,6 +442,17 @@ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -298,13 +466,16 @@ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -312,28 +483,59 @@ # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -343,13 +545,26 @@ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." @@ -373,91 +588,151 @@ class __Pyx_FakeReference { T *operator->() { return ptr; } T *operator&() { return ptr; } operator T&() { return *ptr; } - template bool operator ==(U other) { return *ptr == other; } - template bool operator !=(U other) { return *ptr != other; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } private: T *ptr; }; -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + PyObject *version_info; // borrowed + PyObject *py_minor_version = NULL; + long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; - } - end: - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(call_result); - Py_XDECREF(empty); + #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 + minor_version = 11; // we don't yet need to distinguish between versions > 11 + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + Py_XDECREF(py_minor_version); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here + if (!empty_bytes) return NULL; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -471,6 +746,12 @@ class __Pyx_FakeReference { #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -485,30 +766,53 @@ class __Pyx_FakeReference { #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -517,6 +821,22 @@ class __Pyx_FakeReference { #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -547,6 +867,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -559,12 +901,69 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) +#else + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) @@ -575,10 +974,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else @@ -596,11 +995,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -611,14 +1010,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -647,8 +1052,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -658,15 +1069,33 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif #if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -678,6 +1107,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -695,11 +1127,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -744,12 +1171,17 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" #endif #define __PYX_HAVE__newanalysis__diffusion @@ -757,18 +1189,17 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + #include "numpy/arrayobject.h" #include "numpy/ndarrayobject.h" #include "numpy/ndarraytypes.h" #include "numpy/arrayscalars.h" #include "numpy/ufuncobject.h" - - /* NumPy API declarations from "numpy/__init__.pxd" */ - #include #include "pythread.h" #include -#include "pystate.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -837,9 +1268,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -847,11 +1278,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -877,7 +1319,52 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -899,7 +1386,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -964,23 +1451,19 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; /* Header.proto */ #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__)) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 @@ -998,15 +1481,28 @@ static const char *__pyx_filename; #define _Complex_I 1.0fj #endif +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { - "src/helpers/diffusion.pyx", - "__init__.pxd", - "stringsource", + "newanalysis/helpers/diffusion.pyx", + "", + "__init__.cython-30.pxd", "type.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + /* BufferFormatStructs.proto */ -#define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { @@ -1041,24 +1537,6 @@ typedef struct { char is_valid_array; } __Pyx_BufFmt_Context; -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - -/* MemviewSliceStruct.proto */ -struct __pyx_memoryview_obj; -typedef struct { - struct __pyx_memoryview_obj *memview; - char *data; - Py_ssize_t shape[8]; - Py_ssize_t strides[8]; - Py_ssize_t suboffsets[8]; -} __Pyx_memviewslice; -#define __Pyx_MemoryView_Len(m) (m.shape[0]) - /* Atomics.proto */ #include #ifndef CYTHON_ATOMICS @@ -1066,7 +1544,44 @@ typedef struct { #endif #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS #define __pyx_atomic_int_type int -#if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_incr_aligned(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_incr_aligned(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1) @@ -1074,10 +1589,11 @@ typedef struct { #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif -#elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL +#elif CYTHON_ATOMICS && defined(_MSC_VER) #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type long + #define __pyx_nonatomic_int_type long #pragma intrinsic (_InterlockedExchangeAdd) #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1) @@ -1091,7 +1607,6 @@ typedef struct { #warning "Not using atomics" #endif #endif -typedef volatile __pyx_atomic_int_type __pyx_atomic_int; #if CYTHON_ATOMICS #define __pyx_add_acquisition_count(memview)\ __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview)) @@ -1104,13 +1619,20 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) #endif -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +/* #### Code section: numeric_typedefs ### */ -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":689 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":730 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -1119,7 +1641,7 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":690 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":731 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -1128,7 +1650,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":691 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":732 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -1137,7 +1659,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":692 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":733 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -1146,7 +1668,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":696 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":737 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -1155,7 +1677,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":697 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":738 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -1164,7 +1686,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":698 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":739 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -1173,7 +1695,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":699 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":740 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -1182,7 +1704,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":703 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":744 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -1191,7 +1713,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":704 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":745 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -1200,61 +1722,43 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":713 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":754 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t + * */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":714 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":755 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":715 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":717 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":757 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t + * */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":718 - * - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":758 * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":719 * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":721 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":760 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1263,7 +1767,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":722 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":761 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1272,7 +1776,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":724 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":763 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1281,7 +1785,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":725 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":764 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1290,7 +1794,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":726 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":765 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1298,8 +1802,9 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* #### Code section: complex_type_declarations ### */ /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else @@ -1311,7 +1816,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else @@ -1322,6 +1827,7 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_array_obj; @@ -1329,7 +1835,7 @@ struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":728 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":767 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1338,7 +1844,7 @@ struct __pyx_memoryviewslice_obj; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":729 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":768 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1347,7 +1853,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":730 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":769 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1356,7 +1862,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":732 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":771 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1365,8 +1871,8 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1390,7 +1896,7 @@ struct __pyx_array_obj { }; -/* "View.MemoryView":280 +/* "View.MemoryView":302 * * @cname('__pyx_MemviewEnum') * cdef class Enum(object): # <<<<<<<<<<<<<< @@ -1403,10 +1909,10 @@ struct __pyx_MemviewEnum_obj { }; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1417,8 +1923,7 @@ struct __pyx_memoryview_obj { PyObject *_size; PyObject *_array_interface; PyThread_type_lock lock; - __pyx_atomic_int acquisition_count[2]; - __pyx_atomic_int *acquisition_count_aligned_p; + __pyx_atomic_int_type acquisition_count; Py_buffer view; int flags; int dtype_is_object; @@ -1426,8 +1931,8 @@ struct __pyx_memoryview_obj { }; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1443,8 +1948,8 @@ struct __pyx_memoryviewslice_obj { -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1457,10 +1962,10 @@ struct __pyx_vtabstruct_array { static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1473,12 +1978,13 @@ struct __pyx_vtabstruct_memoryview { PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); }; static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1489,6 +1995,7 @@ struct __pyx_vtabstruct__memoryviewslice { struct __pyx_vtabstruct_memoryview __pyx_base; }; static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1497,11 +2004,11 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1511,28 +2018,40 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1543,6 +2062,10 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1554,6 +2077,57 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); @@ -1561,9 +2135,71 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#else + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) +#endif +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) + #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) +#else + #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op + #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs + #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS + #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) + #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); @@ -1572,36 +2208,126 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); -/* IsLittleEndian.proto */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); -/* BufferFormatCheck.proto */ -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type); +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); +#endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 + #include "frameobject.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) + #define __Pyx_PyFrame_GetLocalsplus(frame)\ + (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif +#endif +#endif -/* BufferGetAndValidate.proto */ -#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ - ((obj == Py_None || obj == NULL) ?\ - (__Pyx_ZeroBuffer(buf), 0) :\ - __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) -static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, - __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static void __Pyx_ZeroBuffer(Py_buffer* buf); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; -static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* BuildPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char); + +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); + +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); + +/* JoinPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); + +/* StrEquals.proto */ +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + +/* PyObjectFormatSimple.proto */ +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#elif PY_MAJOR_VERSION < 3 + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\ + PyObject_Format(s, f)) +#elif CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ + likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ + PyObject_Format(s, f)) +#else + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#endif + +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ @@ -1625,6 +2351,29 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) @@ -1672,151 +2421,52 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (1) +#elif CYTHON_COMPILING_IN_LIMITED_API || (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000) + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } #else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) #endif -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#define __Pyx_BUILD_ASSERT_EXPR(cond)\ - (sizeof(char [1 - 2*!(cond)]) - 1) -#ifndef Py_MEMBER_SIZE -#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) -#endif -#if CYTHON_FAST_PYCALL - static size_t __pyx_pyframe_localsplus_offset = 0; - #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 - #ifndef Py_BUILD_CORE - #define Py_BUILD_CORE 1 - #endif - #include "internal/pycore_frame.h" -#endif - #define __Pxy_PyFrame_Initialize_Offsets()\ - ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ - (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) - #define __Pyx_PyFrame_GetLocalsplus(frame)\ - (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) -/* SetItemInt.proto */ -#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) -static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, - int is_list, int wraparound, int boundscheck); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* MemviewSliceInit.proto */ -#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d -#define __Pyx_MEMVIEW_DIRECT 1 -#define __Pyx_MEMVIEW_PTR 2 -#define __Pyx_MEMVIEW_FULL 4 -#define __Pyx_MEMVIEW_CONTIG 8 -#define __Pyx_MEMVIEW_STRIDED 16 -#define __Pyx_MEMVIEW_FOLLOW 32 -#define __Pyx_IS_C_CONTIG 1 -#define __Pyx_IS_F_CONTIG 2 -static int __Pyx_init_memviewslice( - struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference); -static CYTHON_INLINE int __pyx_add_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p) -#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview)) -#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) -#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__) -static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif /* SaveResetException.proto */ @@ -1830,14 +2480,6 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) @@ -1846,73 +2488,6 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - -/* DivInt[Py_ssize_t].proto */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); - -/* UnaryNegOverflows.proto */ -#define UNARY_NEG_WOULD_OVERFLOW(x)\ - (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) - -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ -/* GetAttr.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); - -/* ObjectGetItem.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); -#else -#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) -#endif - -/* decode_c_string_utf16.proto */ -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 0; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = -1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} - -/* decode_c_string.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); - -/* GetAttr3.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) @@ -1924,20 +2499,33 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* ssize_strlen.proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); + /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { @@ -1955,45 +2543,21 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif - -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck); -/* None.proto */ +/* RaiseUnboundLocalError.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); /* DivInt[long].proto */ @@ -2011,6 +2575,36 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* HasAttr.proto */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +/* IsLittleEndian.proto */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); + +/* BufferFormatCheck.proto */ +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type); + +/* BufferGetAndValidate.proto */ +#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ + ((obj == Py_None || obj == NULL) ?\ + (__Pyx_ZeroBuffer(buf), 0) :\ + __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) +static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static void __Pyx_ZeroBuffer(Py_buffer* buf); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; +static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +/* PyIntBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_MultiplyObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyInt_MultiplyObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceMultiply(op1, op2) : PyNumber_Multiply(op1, op2)) +#endif + +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); @@ -2025,42 +2619,211 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr #endif +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + /* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type); +#endif /* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce(PyObject* type_obj); +#endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -#if __STDC_VERSION__ >= 201112L +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_2 +#define __PYX_HAVE_RT_ImportType_proto_3_0_2 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif -#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT(s) alignof(s) +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +enum __Pyx_ImportType_CheckSize_3_0_2 { + __Pyx_ImportType_CheckSize_Error_3_0_2 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_2 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_2 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size); #endif -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + typesModule = PyImport_ImportModule("types"); + if (!typesModule) return NULL; + methodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + if (!methodType) return NULL; + result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); + Py_DECREF(methodType); + return result; +} +#elif PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + void *defaults; + int defaults_pyobjects; + size_t defaults_size; // used by FusedFunction for copying defaults + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* CLineInTraceback.proto */ +#ifdef CYTHON_CLINE_IN_TRACEBACK +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) #else static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -2074,6 +2837,7 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -2110,9 +2874,6 @@ static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, __Pyx_memviewslice *slice2, int ndim, size_t itemsize); -/* Capsule.proto */ -static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); - /* TypeInfoCompare.proto */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b); @@ -2133,27 +2894,12 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *, int writable_flag); -/* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - -/* Print.proto */ -static int __Pyx_Print(PyObject*, PyObject *, int); -#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 -static PyObject* __pyx_print = 0; -static PyObject* __pyx_print_kwargs = 0; -#endif - /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *, int writable_flag); /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *, int writable_flag); -/* IntPow.proto */ -static CYTHON_INLINE long __Pyx_pow_long(long, long); - /* RealImag.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -2177,7 +2923,7 @@ static CYTHON_INLINE long __Pyx_pow_long(long, long); #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_float(a, b) ((a)==(b)) #define __Pyx_c_sum_float(a, b) ((a)+(b)) #define __Pyx_c_diff_float(a, b) ((a)-(b)) @@ -2215,7 +2961,7 @@ static CYTHON_INLINE long __Pyx_pow_long(long, long); #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_double(a, b) ((a)==(b)) #define __Pyx_c_sum_double(a, b) ((a)+(b)) #define __Pyx_c_diff_double(a, b) ((a)-(b)) @@ -2259,6 +3005,31 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, size_t sizeof_dtype, int contig_flag, int dtype_is_object); +/* MemviewSliceInit.proto */ +#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); @@ -2268,8 +3039,8 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); -/* PrintOne.proto */ -static int __Pyx_PrintOne(PyObject* stream, PyObject *o); +/* None.proto */ +#include /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); @@ -2277,12 +3048,26 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ @@ -2291,58 +3076,46 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ -/* Module declarations from 'cpython.buffer' */ +/* Module declarations from "libc.string" */ -/* Module declarations from 'libc.string' */ +/* Module declarations from "libc.stdio" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.type" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "cpython" */ -/* Module declarations from 'cpython' */ +/* Module declarations from "cpython.object" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.ref" */ -/* Module declarations from 'cpython.ref' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'cpython.mem' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'numpy' */ +/* Module declarations from "cython.view" */ -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_generic = 0; -static PyTypeObject *__pyx_ptype_5numpy_number = 0; -static PyTypeObject *__pyx_ptype_5numpy_integer = 0; -static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_inexact = 0; -static PyTypeObject *__pyx_ptype_5numpy_floating = 0; -static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0; -static PyTypeObject *__pyx_ptype_5numpy_flexible = 0; -static PyTypeObject *__pyx_ptype_5numpy_character = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +/* Module declarations from "cython.dataclasses" */ -/* Module declarations from 'cython.view' */ +/* Module declarations from "cython" */ -/* Module declarations from 'cython' */ +/* Module declarations from "libc.math" */ -/* Module declarations from 'libc.math' */ - -/* Module declarations from 'newanalysis.diffusion' */ -static PyTypeObject *__pyx_array_type = 0; -static PyTypeObject *__pyx_MemviewEnum_type = 0; -static PyTypeObject *__pyx_memoryview_type = 0; -static PyTypeObject *__pyx_memoryviewslice_type = 0; +/* Module declarations from "newanalysis.diffusion" */ +static PyObject *__pyx_collections_abc_Sequence = 0; static PyObject *generic = 0; static PyObject *strided = 0; static PyObject *indirect = 0; @@ -2350,12 +3123,12 @@ static PyObject *contiguous = 0; static PyObject *indirect_contiguous = 0; static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ -static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ static PyObject *_unellipsify(PyObject *, int); /*proto*/ -static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ @@ -2373,8 +3146,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /* static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ -static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/ -static int __pyx_memoryview_err(PyObject *, char *); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ @@ -2383,24 +3157,32 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, __PYX_IS_UNSIGNED(int) ? 'U' : 'I', __PYX_IS_UNSIGNED(int), 0 }; +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "newanalysis.diffusion" extern int __pyx_module_is_main_newanalysis__diffusion; int __pyx_module_is_main_newanalysis__diffusion = 0; -/* Implementation of 'newanalysis.diffusion' */ +/* Implementation of "newanalysis.diffusion" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_ImportError; +static PyObject *__pyx_builtin___import__; static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_AssertionError; static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_ImportError; +/* #### Code section: string_decls ### */ +static const char __pyx_k_[] = ": "; static const char __pyx_k_O[] = "O"; static const char __pyx_k_c[] = "c"; static const char __pyx_k_d[] = "d"; @@ -2410,6 +3192,10 @@ static const char __pyx_k_k[] = "k"; static const char __pyx_k_l[] = "l"; static const char __pyx_k_m[] = "m"; static const char __pyx_k_n[] = "n"; +static const char __pyx_k__2[] = "."; +static const char __pyx_k__3[] = "*"; +static const char __pyx_k__6[] = "'"; +static const char __pyx_k__7[] = ")"; static const char __pyx_k_an[] = "an"; static const char __pyx_k_b2[] = "b2"; static const char __pyx_k_c1[] = "c1"; @@ -2418,6 +3204,7 @@ static const char __pyx_k_ch[] = "ch"; static const char __pyx_k_dx[] = "dx"; static const char __pyx_k_dy[] = "dy"; static const char __pyx_k_dz[] = "dz"; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_md[] = "md"; static const char __pyx_k_mj[] = "mj"; @@ -2430,7 +3217,10 @@ static const char __pyx_k_np[] = "np"; static const char __pyx_k_s1[] = "s1"; static const char __pyx_k_s2[] = "s2"; static const char __pyx_k_vh[] = "vh"; +static const char __pyx_k__48[] = "?"; +static const char __pyx_k_abc[] = "abc"; static const char __pyx_k_all[] = "all"; +static const char __pyx_k_and[] = " and "; static const char __pyx_k_can[] = "can"; static const char __pyx_k_cat[] = "cat"; static const char __pyx_k_cmj[] = "cmj"; @@ -2448,7 +3238,7 @@ static const char __pyx_k_dz1[] = "dz1"; static const char __pyx_k_dz2[] = "dz2"; static const char __pyx_k_dz3[] = "dz3"; static const char __pyx_k_dzs[] = "dzs"; -static const char __pyx_k_end[] = "end"; +static const char __pyx_k_got[] = " (got "; static const char __pyx_k_mj1[] = "mj1"; static const char __pyx_k_mj2[] = "mj2"; static const char __pyx_k_msd[] = "msd"; @@ -2457,6 +3247,7 @@ static const char __pyx_k_nts[] = "nts"; static const char __pyx_k_obj[] = "obj"; static const char __pyx_k_pos[] = "pos"; static const char __pyx_k_sep[] = "sep"; +static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_tmp[] = "tmp"; static const char __pyx_k_xyz[] = "xyz"; static const char __pyx_k_base[] = "base"; @@ -2469,7 +3260,6 @@ static const char __pyx_k_data[] = "data"; static const char __pyx_k_diag[] = "diag"; static const char __pyx_k_dict[] = "__dict__"; static const char __pyx_k_disp[] = "disp"; -static const char __pyx_k_file[] = "file"; static const char __pyx_k_idx1[] = "idx1"; static const char __pyx_k_idx2[] = "idx2"; static const char __pyx_k_idx3[] = "idx3"; @@ -2483,6 +3273,7 @@ static const char __pyx_k_nion[] = "nion"; static const char __pyx_k_pack[] = "pack"; static const char __pyx_k_res2[] = "res2"; static const char __pyx_k_size[] = "size"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_step[] = "step"; static const char __pyx_k_stop[] = "stop"; static const char __pyx_k_test[] = "__test__"; @@ -2490,10 +3281,12 @@ static const char __pyx_k_xyz2[] = "xyz2"; static const char __pyx_k_ASCII[] = "ASCII"; static const char __pyx_k_alpha[] = "alpha"; static const char __pyx_k_class[] = "__class__"; +static const char __pyx_k_count[] = "count"; static const char __pyx_k_data2[] = "data2"; static const char __pyx_k_dtype[] = "dtype"; static const char __pyx_k_error[] = "error"; static const char __pyx_k_flags[] = "flags"; +static const char __pyx_k_index[] = "index"; static const char __pyx_k_int32[] = "int32"; static const char __pyx_k_lower[] = "lower"; static const char __pyx_k_msdMJ[] = "msdMJ"; @@ -2510,6 +3303,7 @@ static const char __pyx_k_upper[] = "upper"; static const char __pyx_k_vhmax[] = "vhmax"; static const char __pyx_k_zeros[] = "zeros"; static const char __pyx_k_charge[] = "charge"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_factor[] = "factor"; static const char __pyx_k_format[] = "format"; @@ -2532,6 +3326,7 @@ static const char __pyx_k_coms_an[] = "coms_an"; static const char __pyx_k_coms_s1[] = "coms_s1"; static const char __pyx_k_coms_s2[] = "coms_s2"; static const char __pyx_k_ctr_arr[] = "ctr_arr"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_float64[] = "float64"; static const char __pyx_k_fortran[] = "fortran"; static const char __pyx_k_memview[] = "memview"; @@ -2539,6 +3334,7 @@ static const char __pyx_k_nframes[] = "nframes"; static const char __pyx_k_shorter[] = "shorter"; static const char __pyx_k_xyz_tmp[] = "xyz_tmp"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; +static const char __pyx_k_Sequence[] = "Sequence"; static const char __pyx_k_coms_cat[] = "coms_cat"; static const char __pyx_k_coms_sep[] = "coms_sep"; static const char __pyx_k_data_tmp[] = "data_tmp"; @@ -2547,6 +3343,7 @@ static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_itemsize[] = "itemsize"; static const char __pyx_k_msd_data[] = "msd_data"; static const char __pyx_k_pyx_type[] = "__pyx_type"; +static const char __pyx_k_register[] = "register"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_van_hove[] = "van_hove"; static const char __pyx_k_TypeError[] = "TypeError"; @@ -2555,6 +3352,7 @@ static const char __pyx_k_charge_an[] = "charge_an"; static const char __pyx_k_charge_s1[] = "charge_s1"; static const char __pyx_k_charge_s2[] = "charge_s2"; static const char __pyx_k_enumerate[] = "enumerate"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_IndexError[] = "IndexError"; @@ -2569,284 +3367,68 @@ static const char __pyx_k_vh_maxdist[] = "vh_maxdist"; static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_PickleError[] = "PickleError"; +static const char __pyx_k_collections[] = "collections"; static const char __pyx_k_msdMJdecomp[] = "msdMJdecomp"; static const char __pyx_k_msddeg_data[] = "msddeg_data"; static const char __pyx_k_n_must_be_1[] = "n must be >1"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; static const char __pyx_k_msdMJCharges[] = "msdMJCharges"; static const char __pyx_k_non_gaussian[] = "non_gaussian"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; -static const char __pyx_k_stringsource[] = "stringsource"; -static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; +static const char __pyx_k_stringsource[] = ""; +static const char __pyx_k_version_info[] = "version_info"; +static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; +static const char __pyx_k_AssertionError[] = "AssertionError"; static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; +static const char __pyx_k_collections_abc[] = "collections.abc"; static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; static const char __pyx_k_msdMJcrossterms[] = "msdMJcrossterms"; static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; static const char __pyx_k_pairDisplacement[] = "pairDisplacement"; static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_strided_and_direct[] = ""; static const char __pyx_k_nonGaussianParameter[] = "nonGaussianParameter"; static const char __pyx_k_strided_and_indirect[] = ""; +static const char __pyx_k_Invalid_shape_in_axis[] = "Invalid shape in axis "; static const char __pyx_k_contiguous_and_direct[] = ""; static const char __pyx_k_crossDisplacementMdMj[] = "crossDisplacementMdMj"; static const char __pyx_k_newanalysis_diffusion[] = "newanalysis.diffusion"; +static const char __pyx_k_Cannot_index_with_type[] = "Cannot index with type '"; static const char __pyx_k_MemoryView_of_r_object[] = ""; static const char __pyx_k_MemoryView_of_r_at_0x_x[] = ""; static const char __pyx_k_contiguous_and_indirect[] = ""; -static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; -static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; -static const char __pyx_k_src_helpers_diffusion_pyx[] = "src/helpers/diffusion.pyx"; +static const char __pyx_k_Dimension_d_is_not_direct[] = "Dimension %d is not direct"; +static const char __pyx_k_Index_out_of_bounds_axis_d[] = "Index out of bounds (axis %d)"; +static const char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero (axis %d)"; static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; static const char __pyx_k_strided_and_direct_or_indirect[] = ""; static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; +static const char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced"; static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview"; static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview"; +static const char __pyx_k_Cannot_transpose_memoryview_with[] = "Cannot transpose memoryview with indirect dimensions"; static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; -static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))"; +static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))"; static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; -static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; -static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)"; +static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got "; +static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis "; static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; static const char __pyx_k_WARNING_same_number_of_cation_an[] = "WARNING: same number of cation/anion species. Use msdMJ instead."; -static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)"; +static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension "; +static const char __pyx_k_newanalysis_helpers_diffusion_py[] = "newanalysis/helpers/diffusion.pyx"; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; -static PyObject *__pyx_n_s_ASCII; -static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; -static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; -static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; -static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; -static PyObject *__pyx_kp_s_Cannot_index_with_type_s; -static PyObject *__pyx_n_s_Ellipsis; -static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; -static PyObject *__pyx_n_s_ImportError; -static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; -static PyObject *__pyx_n_s_IndexError; -static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; -static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; -static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d; -static PyObject *__pyx_n_s_MemoryError; -static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; -static PyObject *__pyx_kp_s_MemoryView_of_r_object; -static PyObject *__pyx_n_b_O; -static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a; -static PyObject *__pyx_n_s_PickleError; -static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s_View_MemoryView; -static PyObject *__pyx_kp_s_WARNING_same_number_of_cation_an; -static PyObject *__pyx_n_s_all; -static PyObject *__pyx_n_s_allocate_buffer; -static PyObject *__pyx_n_s_alpha; -static PyObject *__pyx_n_s_alpha_data; -static PyObject *__pyx_n_s_an; -static PyObject *__pyx_n_s_b2; -static PyObject *__pyx_n_s_base; -static PyObject *__pyx_n_s_boxl; -static PyObject *__pyx_n_s_boxlength; -static PyObject *__pyx_n_s_c; -static PyObject *__pyx_n_u_c; -static PyObject *__pyx_n_s_c1; -static PyObject *__pyx_n_s_c2; -static PyObject *__pyx_n_s_can; -static PyObject *__pyx_n_s_cat; -static PyObject *__pyx_n_s_ccat; -static PyObject *__pyx_n_s_ch; -static PyObject *__pyx_n_s_charge; -static PyObject *__pyx_n_s_charge_an; -static PyObject *__pyx_n_s_charge_cat; -static PyObject *__pyx_n_s_charge_s1; -static PyObject *__pyx_n_s_charge_s2; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_cmj; -static PyObject *__pyx_n_s_cmj1; -static PyObject *__pyx_n_s_cmj2; -static PyObject *__pyx_n_s_cmj_sep; -static PyObject *__pyx_n_s_coms_an; -static PyObject *__pyx_n_s_coms_cat; -static PyObject *__pyx_n_s_coms_s1; -static PyObject *__pyx_n_s_coms_s2; -static PyObject *__pyx_n_s_coms_sep; -static PyObject *__pyx_kp_s_contiguous_and_direct; -static PyObject *__pyx_kp_s_contiguous_and_indirect; -static PyObject *__pyx_n_s_copy; -static PyObject *__pyx_n_s_crossDisplacementMdMj; -static PyObject *__pyx_n_s_ctr; -static PyObject *__pyx_n_s_ctr_arr; -static PyObject *__pyx_n_s_d; -static PyObject *__pyx_n_s_data; -static PyObject *__pyx_n_s_data2; -static PyObject *__pyx_n_s_data_tmp; -static PyObject *__pyx_n_s_deg; -static PyObject *__pyx_n_s_diag; -static PyObject *__pyx_n_s_dict; -static PyObject *__pyx_n_s_disp; -static PyObject *__pyx_n_s_disp_arr; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_dtype_is_object; -static PyObject *__pyx_n_s_dx; -static PyObject *__pyx_n_s_dx1; -static PyObject *__pyx_n_s_dx2; -static PyObject *__pyx_n_s_dx3; -static PyObject *__pyx_n_s_dxs; -static PyObject *__pyx_n_s_dy; -static PyObject *__pyx_n_s_dy1; -static PyObject *__pyx_n_s_dy2; -static PyObject *__pyx_n_s_dy3; -static PyObject *__pyx_n_s_dys; -static PyObject *__pyx_n_s_dz; -static PyObject *__pyx_n_s_dz1; -static PyObject *__pyx_n_s_dz2; -static PyObject *__pyx_n_s_dz3; -static PyObject *__pyx_n_s_dzs; -static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_end; -static PyObject *__pyx_n_s_enumerate; -static PyObject *__pyx_n_s_error; -static PyObject *__pyx_n_s_factor; -static PyObject *__pyx_n_s_file; -static PyObject *__pyx_n_s_flags; -static PyObject *__pyx_n_s_float64; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_fortran; -static PyObject *__pyx_n_u_fortran; -static PyObject *__pyx_n_s_getstate; -static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_idx1; -static PyObject *__pyx_n_s_idx2; -static PyObject *__pyx_n_s_idx3; -static PyObject *__pyx_n_s_idx4; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_int32; -static PyObject *__pyx_n_s_irel; -static PyObject *__pyx_n_s_itemsize; -static PyObject *__pyx_kp_s_itemsize_0_for_cython_array; -static PyObject *__pyx_n_s_j; -static PyObject *__pyx_n_s_k; -static PyObject *__pyx_n_s_l; -static PyObject *__pyx_n_s_longer; -static PyObject *__pyx_n_s_lower; -static PyObject *__pyx_n_s_m; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_maxlen; -static PyObject *__pyx_n_s_md; -static PyObject *__pyx_n_s_memview; -static PyObject *__pyx_n_s_mj; -static PyObject *__pyx_n_s_mj1; -static PyObject *__pyx_n_s_mj2; -static PyObject *__pyx_n_s_mj_arr; -static PyObject *__pyx_n_s_mj_sep; -static PyObject *__pyx_n_s_mode; -static PyObject *__pyx_n_s_msd; -static PyObject *__pyx_n_s_msdCOM; -static PyObject *__pyx_n_s_msdCOMvHnG; -static PyObject *__pyx_n_s_msdMJ; -static PyObject *__pyx_n_s_msdMJCharges; -static PyObject *__pyx_n_s_msdMJcrossterms; -static PyObject *__pyx_n_s_msdMJdecomp; -static PyObject *__pyx_n_s_msd_data; -static PyObject *__pyx_n_s_msddeg; -static PyObject *__pyx_n_s_msddeg_data; -static PyObject *__pyx_n_s_msdmj; -static PyObject *__pyx_n_s_n; -static PyObject *__pyx_n_s_n1; -static PyObject *__pyx_n_s_n2; -static PyObject *__pyx_n_s_n3; -static PyObject *__pyx_n_s_n4; -static PyObject *__pyx_kp_s_n_must_be_1; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_name_2; -static PyObject *__pyx_n_s_ndim; -static PyObject *__pyx_n_s_new; -static PyObject *__pyx_n_s_newanalysis_diffusion; -static PyObject *__pyx_n_s_nframes; -static PyObject *__pyx_n_s_ng; -static PyObject *__pyx_n_s_nion; -static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; -static PyObject *__pyx_n_s_nonGaussianParameter; -static PyObject *__pyx_n_s_non_gaussian; -static PyObject *__pyx_n_s_np; -static PyObject *__pyx_n_s_nstep; -static PyObject *__pyx_n_s_nts; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; -static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; -static PyObject *__pyx_n_s_obj; -static PyObject *__pyx_n_s_pack; -static PyObject *__pyx_n_s_pairDisplacement; -static PyObject *__pyx_n_s_pickle; -static PyObject *__pyx_n_s_pos; -static PyObject *__pyx_n_s_print; -static PyObject *__pyx_n_s_pyx_PickleError; -static PyObject *__pyx_n_s_pyx_checksum; -static PyObject *__pyx_n_s_pyx_getbuffer; -static PyObject *__pyx_n_s_pyx_result; -static PyObject *__pyx_n_s_pyx_state; -static PyObject *__pyx_n_s_pyx_type; -static PyObject *__pyx_n_s_pyx_unpickle_Enum; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_reduce; -static PyObject *__pyx_n_s_reduce_cython; -static PyObject *__pyx_n_s_reduce_ex; -static PyObject *__pyx_n_s_res2; -static PyObject *__pyx_n_s_result; -static PyObject *__pyx_n_s_s1; -static PyObject *__pyx_n_s_s1_n2; -static PyObject *__pyx_n_s_s2; -static PyObject *__pyx_n_s_s2_n2; -static PyObject *__pyx_n_s_sep; -static PyObject *__pyx_n_s_setstate; -static PyObject *__pyx_n_s_setstate_cython; -static PyObject *__pyx_n_s_shape; -static PyObject *__pyx_n_s_shorter; -static PyObject *__pyx_n_s_size; -static PyObject *__pyx_kp_s_src_helpers_diffusion_pyx; -static PyObject *__pyx_n_s_start; -static PyObject *__pyx_n_s_step; -static PyObject *__pyx_n_s_stop; -static PyObject *__pyx_kp_s_strided_and_direct; -static PyObject *__pyx_kp_s_strided_and_direct_or_indirect; -static PyObject *__pyx_kp_s_strided_and_indirect; -static PyObject *__pyx_kp_s_stringsource; -static PyObject *__pyx_n_s_struct; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_tmp; -static PyObject *__pyx_kp_s_unable_to_allocate_array_data; -static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; -static PyObject *__pyx_n_s_unfoldTraj; -static PyObject *__pyx_n_s_unpack; -static PyObject *__pyx_n_s_update; -static PyObject *__pyx_n_s_upper; -static PyObject *__pyx_n_s_van_hove; -static PyObject *__pyx_n_s_vh; -static PyObject *__pyx_n_s_vh_maxdist; -static PyObject *__pyx_n_s_vhmax; -static PyObject *__pyx_n_s_xyz; -static PyObject *__pyx_n_s_xyz2; -static PyObject *__pyx_n_s_xyz_tmp; -static PyObject *__pyx_n_s_zeros; -static PyObject *__pyx_pf_11newanalysis_9diffusion_unfoldTraj(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_boxlength); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9diffusion_2msdCOMvHnG(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_vh_maxdist); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9diffusion_4msdCOM(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_maxlen); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9diffusion_6pairDisplacement(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_xyz2, PyObject *__pyx_v_maxlen); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9diffusion_8msdMJ(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_charge_cat, PyObject *__pyx_v_charge_an); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9diffusion_10msdMJCharges(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_charge_cat, PyObject *__pyx_v_charge_an); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9diffusion_12crossDisplacementMdMj(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coms_cat, __Pyx_memviewslice __pyx_v_coms_an, __Pyx_memviewslice __pyx_v_md); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9diffusion_14msdMJdecomp(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyArrayObject *__pyx_v_coms_sep, int __pyx_v_charge, PyObject *__pyx_v_maxlen); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9diffusion_16msdMJcrossterms(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_s1, PyArrayObject *__pyx_v_coms_s2, int __pyx_v_charge_s1, int __pyx_v_charge_s2, PyObject *__pyx_v_maxlen); /* proto */ -static PyObject *__pyx_pf_11newanalysis_9diffusion_18nonGaussianParameter(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_n, PyObject *__pyx_v_maxlen); /* proto */ +/* #### Code section: decls ### */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ @@ -2885,11185 +3467,11325 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9diffusion_unfoldTraj(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_boxlength); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9diffusion_2msdCOMvHnG(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_vh_maxdist); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9diffusion_4msdCOM(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_maxlen); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9diffusion_6pairDisplacement(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_xyz2, PyObject *__pyx_v_maxlen); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9diffusion_8msdMJ(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_charge_cat, PyObject *__pyx_v_charge_an); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9diffusion_10msdMJCharges(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_charge_cat, PyObject *__pyx_v_charge_an); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9diffusion_12crossDisplacementMdMj(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coms_cat, __Pyx_memviewslice __pyx_v_coms_an, __Pyx_memviewslice __pyx_v_md); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9diffusion_14msdMJdecomp(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyArrayObject *__pyx_v_coms_sep, int __pyx_v_charge, PyObject *__pyx_v_maxlen); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9diffusion_16msdMJcrossterms(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_s1, PyArrayObject *__pyx_v_coms_s2, int __pyx_v_charge_s1, int __pyx_v_charge_s2, PyObject *__pyx_v_maxlen); /* proto */ +static PyObject *__pyx_pf_11newanalysis_9diffusion_18nonGaussianParameter(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_n, PyObject *__pyx_v_maxlen); /* proto */ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_float_200_0; -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_2; -static PyObject *__pyx_int_3; -static PyObject *__pyx_int_10; -static PyObject *__pyx_int_112105877; -static PyObject *__pyx_int_136983863; -static PyObject *__pyx_int_184977713; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__18; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_tuple__29; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__33; -static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__37; -static PyObject *__pyx_tuple__39; -static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__44; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__46; -static PyObject *__pyx_tuple__47; -static PyObject *__pyx_tuple__48; -static PyObject *__pyx_codeobj__24; -static PyObject *__pyx_codeobj__26; -static PyObject *__pyx_codeobj__28; -static PyObject *__pyx_codeobj__30; -static PyObject *__pyx_codeobj__32; -static PyObject *__pyx_codeobj__34; -static PyObject *__pyx_codeobj__36; -static PyObject *__pyx_codeobj__38; -static PyObject *__pyx_codeobj__40; -static PyObject *__pyx_codeobj__42; -static PyObject *__pyx_codeobj__49; -/* Late includes */ - -/* "src/helpers/diffusion.pyx":12 - * from libc.math cimport fabs, sqrt, floor, pow +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4type_type; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + #endif + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + PyObject *__pyx_kp_u_; + PyObject *__pyx_n_s_ASCII; + PyObject *__pyx_kp_s_All_dimensions_preceding_dimensi; + PyObject *__pyx_n_s_AssertionError; + PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; + PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; + PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; + PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; + PyObject *__pyx_kp_u_Cannot_index_with_type; + PyObject *__pyx_kp_s_Cannot_transpose_memoryview_with; + PyObject *__pyx_kp_s_Dimension_d_is_not_direct; + PyObject *__pyx_n_s_Ellipsis; + PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; + PyObject *__pyx_n_s_ImportError; + PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; + PyObject *__pyx_n_s_IndexError; + PyObject *__pyx_kp_s_Index_out_of_bounds_axis_d; + PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; + PyObject *__pyx_kp_u_Invalid_mode_expected_c_or_fortr; + PyObject *__pyx_kp_u_Invalid_shape_in_axis; + PyObject *__pyx_n_s_MemoryError; + PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; + PyObject *__pyx_kp_s_MemoryView_of_r_object; + PyObject *__pyx_n_b_O; + PyObject *__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + PyObject *__pyx_n_s_PickleError; + PyObject *__pyx_n_s_Sequence; + PyObject *__pyx_kp_s_Step_may_not_be_zero_axis_d; + PyObject *__pyx_n_s_TypeError; + PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; + PyObject *__pyx_n_s_ValueError; + PyObject *__pyx_n_s_View_MemoryView; + PyObject *__pyx_kp_s_WARNING_same_number_of_cation_an; + PyObject *__pyx_kp_u__2; + PyObject *__pyx_n_s__3; + PyObject *__pyx_n_s__48; + PyObject *__pyx_kp_u__6; + PyObject *__pyx_kp_u__7; + PyObject *__pyx_n_s_abc; + PyObject *__pyx_n_s_all; + PyObject *__pyx_n_s_allocate_buffer; + PyObject *__pyx_n_s_alpha; + PyObject *__pyx_n_s_alpha_data; + PyObject *__pyx_n_s_an; + PyObject *__pyx_kp_u_and; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_b2; + PyObject *__pyx_n_s_base; + PyObject *__pyx_n_s_boxl; + PyObject *__pyx_n_s_boxlength; + PyObject *__pyx_n_s_c; + PyObject *__pyx_n_u_c; + PyObject *__pyx_n_s_c1; + PyObject *__pyx_n_s_c2; + PyObject *__pyx_n_s_can; + PyObject *__pyx_n_s_cat; + PyObject *__pyx_n_s_ccat; + PyObject *__pyx_n_s_ch; + PyObject *__pyx_n_s_charge; + PyObject *__pyx_n_s_charge_an; + PyObject *__pyx_n_s_charge_cat; + PyObject *__pyx_n_s_charge_s1; + PyObject *__pyx_n_s_charge_s2; + PyObject *__pyx_n_s_class; + PyObject *__pyx_n_s_class_getitem; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_cmj; + PyObject *__pyx_n_s_cmj1; + PyObject *__pyx_n_s_cmj2; + PyObject *__pyx_n_s_cmj_sep; + PyObject *__pyx_n_s_collections; + PyObject *__pyx_kp_s_collections_abc; + PyObject *__pyx_n_s_coms_an; + PyObject *__pyx_n_s_coms_cat; + PyObject *__pyx_n_s_coms_s1; + PyObject *__pyx_n_s_coms_s2; + PyObject *__pyx_n_s_coms_sep; + PyObject *__pyx_kp_s_contiguous_and_direct; + PyObject *__pyx_kp_s_contiguous_and_indirect; + PyObject *__pyx_n_s_copy; + PyObject *__pyx_n_s_count; + PyObject *__pyx_n_s_crossDisplacementMdMj; + PyObject *__pyx_n_s_ctr; + PyObject *__pyx_n_s_ctr_arr; + PyObject *__pyx_n_s_d; + PyObject *__pyx_n_s_data; + PyObject *__pyx_n_s_data2; + PyObject *__pyx_n_s_data_tmp; + PyObject *__pyx_n_s_deg; + PyObject *__pyx_n_s_diag; + PyObject *__pyx_n_s_dict; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_n_s_disp; + PyObject *__pyx_n_s_disp_arr; + PyObject *__pyx_n_s_dtype; + PyObject *__pyx_n_s_dtype_is_object; + PyObject *__pyx_n_s_dx; + PyObject *__pyx_n_s_dx1; + PyObject *__pyx_n_s_dx2; + PyObject *__pyx_n_s_dx3; + PyObject *__pyx_n_s_dxs; + PyObject *__pyx_n_s_dy; + PyObject *__pyx_n_s_dy1; + PyObject *__pyx_n_s_dy2; + PyObject *__pyx_n_s_dy3; + PyObject *__pyx_n_s_dys; + PyObject *__pyx_n_s_dz; + PyObject *__pyx_n_s_dz1; + PyObject *__pyx_n_s_dz2; + PyObject *__pyx_n_s_dz3; + PyObject *__pyx_n_s_dzs; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_encode; + PyObject *__pyx_n_s_enumerate; + PyObject *__pyx_n_s_error; + PyObject *__pyx_n_s_factor; + PyObject *__pyx_n_s_flags; + PyObject *__pyx_n_s_float64; + PyObject *__pyx_n_s_format; + PyObject *__pyx_n_s_fortran; + PyObject *__pyx_n_u_fortran; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_getstate; + PyObject *__pyx_kp_u_got; + PyObject *__pyx_kp_u_got_differing_extents_in_dimensi; + PyObject *__pyx_n_s_i; + PyObject *__pyx_n_s_id; + PyObject *__pyx_n_s_idx1; + PyObject *__pyx_n_s_idx2; + PyObject *__pyx_n_s_idx3; + PyObject *__pyx_n_s_idx4; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_index; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_int32; + PyObject *__pyx_n_s_irel; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_itemsize; + PyObject *__pyx_kp_s_itemsize_0_for_cython_array; + PyObject *__pyx_n_s_j; + PyObject *__pyx_n_s_k; + PyObject *__pyx_n_s_l; + PyObject *__pyx_n_s_longer; + PyObject *__pyx_n_s_lower; + PyObject *__pyx_n_s_m; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_maxlen; + PyObject *__pyx_n_s_md; + PyObject *__pyx_n_s_memview; + PyObject *__pyx_n_s_mj; + PyObject *__pyx_n_s_mj1; + PyObject *__pyx_n_s_mj2; + PyObject *__pyx_n_s_mj_arr; + PyObject *__pyx_n_s_mj_sep; + PyObject *__pyx_n_s_mode; + PyObject *__pyx_n_s_msd; + PyObject *__pyx_n_s_msdCOM; + PyObject *__pyx_n_s_msdCOMvHnG; + PyObject *__pyx_n_s_msdMJ; + PyObject *__pyx_n_s_msdMJCharges; + PyObject *__pyx_n_s_msdMJcrossterms; + PyObject *__pyx_n_s_msdMJdecomp; + PyObject *__pyx_n_s_msd_data; + PyObject *__pyx_n_s_msddeg; + PyObject *__pyx_n_s_msddeg_data; + PyObject *__pyx_n_s_msdmj; + PyObject *__pyx_n_s_n; + PyObject *__pyx_n_s_n1; + PyObject *__pyx_n_s_n2; + PyObject *__pyx_n_s_n3; + PyObject *__pyx_n_s_n4; + PyObject *__pyx_kp_s_n_must_be_1; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_name_2; + PyObject *__pyx_n_s_ndim; + PyObject *__pyx_n_s_new; + PyObject *__pyx_n_s_newanalysis_diffusion; + PyObject *__pyx_kp_s_newanalysis_helpers_diffusion_py; + PyObject *__pyx_n_s_nframes; + PyObject *__pyx_n_s_ng; + PyObject *__pyx_n_s_nion; + PyObject *__pyx_kp_s_no_default___reduce___due_to_non; + PyObject *__pyx_n_s_nonGaussianParameter; + PyObject *__pyx_n_s_non_gaussian; + PyObject *__pyx_n_s_np; + PyObject *__pyx_n_s_nstep; + PyObject *__pyx_n_s_nts; + PyObject *__pyx_n_s_numpy; + PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; + PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; + PyObject *__pyx_n_s_obj; + PyObject *__pyx_n_s_pack; + PyObject *__pyx_n_s_pairDisplacement; + PyObject *__pyx_n_s_pickle; + PyObject *__pyx_n_s_pos; + PyObject *__pyx_n_s_print; + PyObject *__pyx_n_s_pyx_PickleError; + PyObject *__pyx_n_s_pyx_checksum; + PyObject *__pyx_n_s_pyx_result; + PyObject *__pyx_n_s_pyx_state; + PyObject *__pyx_n_s_pyx_type; + PyObject *__pyx_n_s_pyx_unpickle_Enum; + PyObject *__pyx_n_s_pyx_vtable; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_reduce; + PyObject *__pyx_n_s_reduce_cython; + PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_register; + PyObject *__pyx_n_s_res2; + PyObject *__pyx_n_s_result; + PyObject *__pyx_n_s_s1; + PyObject *__pyx_n_s_s1_n2; + PyObject *__pyx_n_s_s2; + PyObject *__pyx_n_s_s2_n2; + PyObject *__pyx_n_s_sep; + PyObject *__pyx_n_s_setstate; + PyObject *__pyx_n_s_setstate_cython; + PyObject *__pyx_n_s_shape; + PyObject *__pyx_n_s_shorter; + PyObject *__pyx_n_s_size; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_start; + PyObject *__pyx_n_s_step; + PyObject *__pyx_n_s_stop; + PyObject *__pyx_kp_s_strided_and_direct; + PyObject *__pyx_kp_s_strided_and_direct_or_indirect; + PyObject *__pyx_kp_s_strided_and_indirect; + PyObject *__pyx_kp_s_stringsource; + PyObject *__pyx_n_s_struct; + PyObject *__pyx_n_s_sys; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_tmp; + PyObject *__pyx_kp_s_unable_to_allocate_array_data; + PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; + PyObject *__pyx_n_s_unfoldTraj; + PyObject *__pyx_n_s_unpack; + PyObject *__pyx_n_s_update; + PyObject *__pyx_n_s_upper; + PyObject *__pyx_n_s_van_hove; + PyObject *__pyx_n_s_version_info; + PyObject *__pyx_n_s_vh; + PyObject *__pyx_n_s_vh_maxdist; + PyObject *__pyx_n_s_vhmax; + PyObject *__pyx_n_s_xyz; + PyObject *__pyx_n_s_xyz2; + PyObject *__pyx_n_s_xyz_tmp; + PyObject *__pyx_n_s_zeros; + PyObject *__pyx_float_200_0; + PyObject *__pyx_int_0; + PyObject *__pyx_int_1; + PyObject *__pyx_int_2; + PyObject *__pyx_int_3; + PyObject *__pyx_int_10; + PyObject *__pyx_int_112105877; + PyObject *__pyx_int_136983863; + PyObject *__pyx_int_184977713; + PyObject *__pyx_int_neg_1; + PyObject *__pyx_slice__5; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__8; + PyObject *__pyx_tuple__9; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__11; + PyObject *__pyx_tuple__12; + PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__14; + PyObject *__pyx_tuple__15; + PyObject *__pyx_tuple__16; + PyObject *__pyx_tuple__17; + PyObject *__pyx_tuple__18; + PyObject *__pyx_tuple__19; + PyObject *__pyx_tuple__20; + PyObject *__pyx_tuple__21; + PyObject *__pyx_tuple__22; + PyObject *__pyx_tuple__24; + PyObject *__pyx_tuple__26; + PyObject *__pyx_tuple__28; + PyObject *__pyx_tuple__29; + PyObject *__pyx_tuple__31; + PyObject *__pyx_tuple__32; + PyObject *__pyx_tuple__34; + PyObject *__pyx_tuple__36; + PyObject *__pyx_tuple__37; + PyObject *__pyx_tuple__39; + PyObject *__pyx_tuple__41; + PyObject *__pyx_tuple__43; + PyObject *__pyx_tuple__45; + PyObject *__pyx_tuple__47; + PyObject *__pyx_codeobj__23; + PyObject *__pyx_codeobj__25; + PyObject *__pyx_codeobj__27; + PyObject *__pyx_codeobj__30; + PyObject *__pyx_codeobj__33; + PyObject *__pyx_codeobj__35; + PyObject *__pyx_codeobj__38; + PyObject *__pyx_codeobj__40; + PyObject *__pyx_codeobj__42; + PyObject *__pyx_codeobj__44; + PyObject *__pyx_codeobj__46; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) + +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_n_s_ASCII); + Py_CLEAR(clear_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_CLEAR(clear_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_CLEAR(clear_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_CLEAR(clear_module_state->__pyx_n_s_Ellipsis); + Py_CLEAR(clear_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_CLEAR(clear_module_state->__pyx_n_s_ImportError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_CLEAR(clear_module_state->__pyx_n_s_IndexError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_CLEAR(clear_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_CLEAR(clear_module_state->__pyx_n_b_O); + Py_CLEAR(clear_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_Sequence); + Py_CLEAR(clear_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); + Py_CLEAR(clear_module_state->__pyx_n_s_View_MemoryView); + Py_CLEAR(clear_module_state->__pyx_kp_s_WARNING_same_number_of_cation_an); + Py_CLEAR(clear_module_state->__pyx_kp_u__2); + Py_CLEAR(clear_module_state->__pyx_n_s__3); + Py_CLEAR(clear_module_state->__pyx_n_s__48); + Py_CLEAR(clear_module_state->__pyx_kp_u__6); + Py_CLEAR(clear_module_state->__pyx_kp_u__7); + Py_CLEAR(clear_module_state->__pyx_n_s_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_all); + Py_CLEAR(clear_module_state->__pyx_n_s_allocate_buffer); + Py_CLEAR(clear_module_state->__pyx_n_s_alpha); + Py_CLEAR(clear_module_state->__pyx_n_s_alpha_data); + Py_CLEAR(clear_module_state->__pyx_n_s_an); + Py_CLEAR(clear_module_state->__pyx_kp_u_and); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_b2); + Py_CLEAR(clear_module_state->__pyx_n_s_base); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl); + Py_CLEAR(clear_module_state->__pyx_n_s_boxlength); + Py_CLEAR(clear_module_state->__pyx_n_s_c); + Py_CLEAR(clear_module_state->__pyx_n_u_c); + Py_CLEAR(clear_module_state->__pyx_n_s_c1); + Py_CLEAR(clear_module_state->__pyx_n_s_c2); + Py_CLEAR(clear_module_state->__pyx_n_s_can); + Py_CLEAR(clear_module_state->__pyx_n_s_cat); + Py_CLEAR(clear_module_state->__pyx_n_s_ccat); + Py_CLEAR(clear_module_state->__pyx_n_s_ch); + Py_CLEAR(clear_module_state->__pyx_n_s_charge); + Py_CLEAR(clear_module_state->__pyx_n_s_charge_an); + Py_CLEAR(clear_module_state->__pyx_n_s_charge_cat); + Py_CLEAR(clear_module_state->__pyx_n_s_charge_s1); + Py_CLEAR(clear_module_state->__pyx_n_s_charge_s2); + Py_CLEAR(clear_module_state->__pyx_n_s_class); + Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_cmj); + Py_CLEAR(clear_module_state->__pyx_n_s_cmj1); + Py_CLEAR(clear_module_state->__pyx_n_s_cmj2); + Py_CLEAR(clear_module_state->__pyx_n_s_cmj_sep); + Py_CLEAR(clear_module_state->__pyx_n_s_collections); + Py_CLEAR(clear_module_state->__pyx_kp_s_collections_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_coms_an); + Py_CLEAR(clear_module_state->__pyx_n_s_coms_cat); + Py_CLEAR(clear_module_state->__pyx_n_s_coms_s1); + Py_CLEAR(clear_module_state->__pyx_n_s_coms_s2); + Py_CLEAR(clear_module_state->__pyx_n_s_coms_sep); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_CLEAR(clear_module_state->__pyx_n_s_copy); + Py_CLEAR(clear_module_state->__pyx_n_s_count); + Py_CLEAR(clear_module_state->__pyx_n_s_crossDisplacementMdMj); + Py_CLEAR(clear_module_state->__pyx_n_s_ctr); + Py_CLEAR(clear_module_state->__pyx_n_s_ctr_arr); + Py_CLEAR(clear_module_state->__pyx_n_s_d); + Py_CLEAR(clear_module_state->__pyx_n_s_data); + Py_CLEAR(clear_module_state->__pyx_n_s_data2); + Py_CLEAR(clear_module_state->__pyx_n_s_data_tmp); + Py_CLEAR(clear_module_state->__pyx_n_s_deg); + Py_CLEAR(clear_module_state->__pyx_n_s_diag); + Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_disp); + Py_CLEAR(clear_module_state->__pyx_n_s_disp_arr); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype_is_object); + Py_CLEAR(clear_module_state->__pyx_n_s_dx); + Py_CLEAR(clear_module_state->__pyx_n_s_dx1); + Py_CLEAR(clear_module_state->__pyx_n_s_dx2); + Py_CLEAR(clear_module_state->__pyx_n_s_dx3); + Py_CLEAR(clear_module_state->__pyx_n_s_dxs); + Py_CLEAR(clear_module_state->__pyx_n_s_dy); + Py_CLEAR(clear_module_state->__pyx_n_s_dy1); + Py_CLEAR(clear_module_state->__pyx_n_s_dy2); + Py_CLEAR(clear_module_state->__pyx_n_s_dy3); + Py_CLEAR(clear_module_state->__pyx_n_s_dys); + Py_CLEAR(clear_module_state->__pyx_n_s_dz); + Py_CLEAR(clear_module_state->__pyx_n_s_dz1); + Py_CLEAR(clear_module_state->__pyx_n_s_dz2); + Py_CLEAR(clear_module_state->__pyx_n_s_dz3); + Py_CLEAR(clear_module_state->__pyx_n_s_dzs); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); + Py_CLEAR(clear_module_state->__pyx_n_s_error); + Py_CLEAR(clear_module_state->__pyx_n_s_factor); + Py_CLEAR(clear_module_state->__pyx_n_s_flags); + Py_CLEAR(clear_module_state->__pyx_n_s_float64); + Py_CLEAR(clear_module_state->__pyx_n_s_format); + Py_CLEAR(clear_module_state->__pyx_n_s_fortran); + Py_CLEAR(clear_module_state->__pyx_n_u_fortran); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_kp_u_got); + Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_i); + Py_CLEAR(clear_module_state->__pyx_n_s_id); + Py_CLEAR(clear_module_state->__pyx_n_s_idx1); + Py_CLEAR(clear_module_state->__pyx_n_s_idx2); + Py_CLEAR(clear_module_state->__pyx_n_s_idx3); + Py_CLEAR(clear_module_state->__pyx_n_s_idx4); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_index); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_int32); + Py_CLEAR(clear_module_state->__pyx_n_s_irel); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_itemsize); + Py_CLEAR(clear_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_CLEAR(clear_module_state->__pyx_n_s_j); + Py_CLEAR(clear_module_state->__pyx_n_s_k); + Py_CLEAR(clear_module_state->__pyx_n_s_l); + Py_CLEAR(clear_module_state->__pyx_n_s_longer); + Py_CLEAR(clear_module_state->__pyx_n_s_lower); + Py_CLEAR(clear_module_state->__pyx_n_s_m); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_maxlen); + Py_CLEAR(clear_module_state->__pyx_n_s_md); + Py_CLEAR(clear_module_state->__pyx_n_s_memview); + Py_CLEAR(clear_module_state->__pyx_n_s_mj); + Py_CLEAR(clear_module_state->__pyx_n_s_mj1); + Py_CLEAR(clear_module_state->__pyx_n_s_mj2); + Py_CLEAR(clear_module_state->__pyx_n_s_mj_arr); + Py_CLEAR(clear_module_state->__pyx_n_s_mj_sep); + Py_CLEAR(clear_module_state->__pyx_n_s_mode); + Py_CLEAR(clear_module_state->__pyx_n_s_msd); + Py_CLEAR(clear_module_state->__pyx_n_s_msdCOM); + Py_CLEAR(clear_module_state->__pyx_n_s_msdCOMvHnG); + Py_CLEAR(clear_module_state->__pyx_n_s_msdMJ); + Py_CLEAR(clear_module_state->__pyx_n_s_msdMJCharges); + Py_CLEAR(clear_module_state->__pyx_n_s_msdMJcrossterms); + Py_CLEAR(clear_module_state->__pyx_n_s_msdMJdecomp); + Py_CLEAR(clear_module_state->__pyx_n_s_msd_data); + Py_CLEAR(clear_module_state->__pyx_n_s_msddeg); + Py_CLEAR(clear_module_state->__pyx_n_s_msddeg_data); + Py_CLEAR(clear_module_state->__pyx_n_s_msdmj); + Py_CLEAR(clear_module_state->__pyx_n_s_n); + Py_CLEAR(clear_module_state->__pyx_n_s_n1); + Py_CLEAR(clear_module_state->__pyx_n_s_n2); + Py_CLEAR(clear_module_state->__pyx_n_s_n3); + Py_CLEAR(clear_module_state->__pyx_n_s_n4); + Py_CLEAR(clear_module_state->__pyx_kp_s_n_must_be_1); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_name_2); + Py_CLEAR(clear_module_state->__pyx_n_s_ndim); + Py_CLEAR(clear_module_state->__pyx_n_s_new); + Py_CLEAR(clear_module_state->__pyx_n_s_newanalysis_diffusion); + Py_CLEAR(clear_module_state->__pyx_kp_s_newanalysis_helpers_diffusion_py); + Py_CLEAR(clear_module_state->__pyx_n_s_nframes); + Py_CLEAR(clear_module_state->__pyx_n_s_ng); + Py_CLEAR(clear_module_state->__pyx_n_s_nion); + Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_CLEAR(clear_module_state->__pyx_n_s_nonGaussianParameter); + Py_CLEAR(clear_module_state->__pyx_n_s_non_gaussian); + Py_CLEAR(clear_module_state->__pyx_n_s_np); + Py_CLEAR(clear_module_state->__pyx_n_s_nstep); + Py_CLEAR(clear_module_state->__pyx_n_s_nts); + Py_CLEAR(clear_module_state->__pyx_n_s_numpy); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_CLEAR(clear_module_state->__pyx_n_s_obj); + Py_CLEAR(clear_module_state->__pyx_n_s_pack); + Py_CLEAR(clear_module_state->__pyx_n_s_pairDisplacement); + Py_CLEAR(clear_module_state->__pyx_n_s_pickle); + Py_CLEAR(clear_module_state->__pyx_n_s_pos); + Py_CLEAR(clear_module_state->__pyx_n_s_print); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_register); + Py_CLEAR(clear_module_state->__pyx_n_s_res2); + Py_CLEAR(clear_module_state->__pyx_n_s_result); + Py_CLEAR(clear_module_state->__pyx_n_s_s1); + Py_CLEAR(clear_module_state->__pyx_n_s_s1_n2); + Py_CLEAR(clear_module_state->__pyx_n_s_s2); + Py_CLEAR(clear_module_state->__pyx_n_s_s2_n2); + Py_CLEAR(clear_module_state->__pyx_n_s_sep); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_shape); + Py_CLEAR(clear_module_state->__pyx_n_s_shorter); + Py_CLEAR(clear_module_state->__pyx_n_s_size); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_start); + Py_CLEAR(clear_module_state->__pyx_n_s_step); + Py_CLEAR(clear_module_state->__pyx_n_s_stop); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_struct); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_tmp); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_CLEAR(clear_module_state->__pyx_n_s_unfoldTraj); + Py_CLEAR(clear_module_state->__pyx_n_s_unpack); + Py_CLEAR(clear_module_state->__pyx_n_s_update); + Py_CLEAR(clear_module_state->__pyx_n_s_upper); + Py_CLEAR(clear_module_state->__pyx_n_s_van_hove); + Py_CLEAR(clear_module_state->__pyx_n_s_version_info); + Py_CLEAR(clear_module_state->__pyx_n_s_vh); + Py_CLEAR(clear_module_state->__pyx_n_s_vh_maxdist); + Py_CLEAR(clear_module_state->__pyx_n_s_vhmax); + Py_CLEAR(clear_module_state->__pyx_n_s_xyz); + Py_CLEAR(clear_module_state->__pyx_n_s_xyz2); + Py_CLEAR(clear_module_state->__pyx_n_s_xyz_tmp); + Py_CLEAR(clear_module_state->__pyx_n_s_zeros); + Py_CLEAR(clear_module_state->__pyx_float_200_0); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_2); + Py_CLEAR(clear_module_state->__pyx_int_3); + Py_CLEAR(clear_module_state->__pyx_int_10); + Py_CLEAR(clear_module_state->__pyx_int_112105877); + Py_CLEAR(clear_module_state->__pyx_int_136983863); + Py_CLEAR(clear_module_state->__pyx_int_184977713); + Py_CLEAR(clear_module_state->__pyx_int_neg_1); + Py_CLEAR(clear_module_state->__pyx_slice__5); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_tuple__9); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__14); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__16); + Py_CLEAR(clear_module_state->__pyx_tuple__17); + Py_CLEAR(clear_module_state->__pyx_tuple__18); + Py_CLEAR(clear_module_state->__pyx_tuple__19); + Py_CLEAR(clear_module_state->__pyx_tuple__20); + Py_CLEAR(clear_module_state->__pyx_tuple__21); + Py_CLEAR(clear_module_state->__pyx_tuple__22); + Py_CLEAR(clear_module_state->__pyx_tuple__24); + Py_CLEAR(clear_module_state->__pyx_tuple__26); + Py_CLEAR(clear_module_state->__pyx_tuple__28); + Py_CLEAR(clear_module_state->__pyx_tuple__29); + Py_CLEAR(clear_module_state->__pyx_tuple__31); + Py_CLEAR(clear_module_state->__pyx_tuple__32); + Py_CLEAR(clear_module_state->__pyx_tuple__34); + Py_CLEAR(clear_module_state->__pyx_tuple__36); + Py_CLEAR(clear_module_state->__pyx_tuple__37); + Py_CLEAR(clear_module_state->__pyx_tuple__39); + Py_CLEAR(clear_module_state->__pyx_tuple__41); + Py_CLEAR(clear_module_state->__pyx_tuple__43); + Py_CLEAR(clear_module_state->__pyx_tuple__45); + Py_CLEAR(clear_module_state->__pyx_tuple__47); + Py_CLEAR(clear_module_state->__pyx_codeobj__23); + Py_CLEAR(clear_module_state->__pyx_codeobj__25); + Py_CLEAR(clear_module_state->__pyx_codeobj__27); + Py_CLEAR(clear_module_state->__pyx_codeobj__30); + Py_CLEAR(clear_module_state->__pyx_codeobj__33); + Py_CLEAR(clear_module_state->__pyx_codeobj__35); + Py_CLEAR(clear_module_state->__pyx_codeobj__38); + Py_CLEAR(clear_module_state->__pyx_codeobj__40); + Py_CLEAR(clear_module_state->__pyx_codeobj__42); + Py_CLEAR(clear_module_state->__pyx_codeobj__44); + Py_CLEAR(clear_module_state->__pyx_codeobj__46); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_n_s_ASCII); + Py_VISIT(traverse_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_VISIT(traverse_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_VISIT(traverse_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_VISIT(traverse_module_state->__pyx_n_s_Ellipsis); + Py_VISIT(traverse_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_VISIT(traverse_module_state->__pyx_n_s_ImportError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_VISIT(traverse_module_state->__pyx_n_s_IndexError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_VISIT(traverse_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_VISIT(traverse_module_state->__pyx_n_b_O); + Py_VISIT(traverse_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_Sequence); + Py_VISIT(traverse_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); + Py_VISIT(traverse_module_state->__pyx_n_s_View_MemoryView); + Py_VISIT(traverse_module_state->__pyx_kp_s_WARNING_same_number_of_cation_an); + Py_VISIT(traverse_module_state->__pyx_kp_u__2); + Py_VISIT(traverse_module_state->__pyx_n_s__3); + Py_VISIT(traverse_module_state->__pyx_n_s__48); + Py_VISIT(traverse_module_state->__pyx_kp_u__6); + Py_VISIT(traverse_module_state->__pyx_kp_u__7); + Py_VISIT(traverse_module_state->__pyx_n_s_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_all); + Py_VISIT(traverse_module_state->__pyx_n_s_allocate_buffer); + Py_VISIT(traverse_module_state->__pyx_n_s_alpha); + Py_VISIT(traverse_module_state->__pyx_n_s_alpha_data); + Py_VISIT(traverse_module_state->__pyx_n_s_an); + Py_VISIT(traverse_module_state->__pyx_kp_u_and); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_b2); + Py_VISIT(traverse_module_state->__pyx_n_s_base); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl); + Py_VISIT(traverse_module_state->__pyx_n_s_boxlength); + Py_VISIT(traverse_module_state->__pyx_n_s_c); + Py_VISIT(traverse_module_state->__pyx_n_u_c); + Py_VISIT(traverse_module_state->__pyx_n_s_c1); + Py_VISIT(traverse_module_state->__pyx_n_s_c2); + Py_VISIT(traverse_module_state->__pyx_n_s_can); + Py_VISIT(traverse_module_state->__pyx_n_s_cat); + Py_VISIT(traverse_module_state->__pyx_n_s_ccat); + Py_VISIT(traverse_module_state->__pyx_n_s_ch); + Py_VISIT(traverse_module_state->__pyx_n_s_charge); + Py_VISIT(traverse_module_state->__pyx_n_s_charge_an); + Py_VISIT(traverse_module_state->__pyx_n_s_charge_cat); + Py_VISIT(traverse_module_state->__pyx_n_s_charge_s1); + Py_VISIT(traverse_module_state->__pyx_n_s_charge_s2); + Py_VISIT(traverse_module_state->__pyx_n_s_class); + Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_cmj); + Py_VISIT(traverse_module_state->__pyx_n_s_cmj1); + Py_VISIT(traverse_module_state->__pyx_n_s_cmj2); + Py_VISIT(traverse_module_state->__pyx_n_s_cmj_sep); + Py_VISIT(traverse_module_state->__pyx_n_s_collections); + Py_VISIT(traverse_module_state->__pyx_kp_s_collections_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_coms_an); + Py_VISIT(traverse_module_state->__pyx_n_s_coms_cat); + Py_VISIT(traverse_module_state->__pyx_n_s_coms_s1); + Py_VISIT(traverse_module_state->__pyx_n_s_coms_s2); + Py_VISIT(traverse_module_state->__pyx_n_s_coms_sep); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_VISIT(traverse_module_state->__pyx_n_s_copy); + Py_VISIT(traverse_module_state->__pyx_n_s_count); + Py_VISIT(traverse_module_state->__pyx_n_s_crossDisplacementMdMj); + Py_VISIT(traverse_module_state->__pyx_n_s_ctr); + Py_VISIT(traverse_module_state->__pyx_n_s_ctr_arr); + Py_VISIT(traverse_module_state->__pyx_n_s_d); + Py_VISIT(traverse_module_state->__pyx_n_s_data); + Py_VISIT(traverse_module_state->__pyx_n_s_data2); + Py_VISIT(traverse_module_state->__pyx_n_s_data_tmp); + Py_VISIT(traverse_module_state->__pyx_n_s_deg); + Py_VISIT(traverse_module_state->__pyx_n_s_diag); + Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_disp); + Py_VISIT(traverse_module_state->__pyx_n_s_disp_arr); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype_is_object); + Py_VISIT(traverse_module_state->__pyx_n_s_dx); + Py_VISIT(traverse_module_state->__pyx_n_s_dx1); + Py_VISIT(traverse_module_state->__pyx_n_s_dx2); + Py_VISIT(traverse_module_state->__pyx_n_s_dx3); + Py_VISIT(traverse_module_state->__pyx_n_s_dxs); + Py_VISIT(traverse_module_state->__pyx_n_s_dy); + Py_VISIT(traverse_module_state->__pyx_n_s_dy1); + Py_VISIT(traverse_module_state->__pyx_n_s_dy2); + Py_VISIT(traverse_module_state->__pyx_n_s_dy3); + Py_VISIT(traverse_module_state->__pyx_n_s_dys); + Py_VISIT(traverse_module_state->__pyx_n_s_dz); + Py_VISIT(traverse_module_state->__pyx_n_s_dz1); + Py_VISIT(traverse_module_state->__pyx_n_s_dz2); + Py_VISIT(traverse_module_state->__pyx_n_s_dz3); + Py_VISIT(traverse_module_state->__pyx_n_s_dzs); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); + Py_VISIT(traverse_module_state->__pyx_n_s_error); + Py_VISIT(traverse_module_state->__pyx_n_s_factor); + Py_VISIT(traverse_module_state->__pyx_n_s_flags); + Py_VISIT(traverse_module_state->__pyx_n_s_float64); + Py_VISIT(traverse_module_state->__pyx_n_s_format); + Py_VISIT(traverse_module_state->__pyx_n_s_fortran); + Py_VISIT(traverse_module_state->__pyx_n_u_fortran); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_kp_u_got); + Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_i); + Py_VISIT(traverse_module_state->__pyx_n_s_id); + Py_VISIT(traverse_module_state->__pyx_n_s_idx1); + Py_VISIT(traverse_module_state->__pyx_n_s_idx2); + Py_VISIT(traverse_module_state->__pyx_n_s_idx3); + Py_VISIT(traverse_module_state->__pyx_n_s_idx4); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_index); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_int32); + Py_VISIT(traverse_module_state->__pyx_n_s_irel); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_itemsize); + Py_VISIT(traverse_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_VISIT(traverse_module_state->__pyx_n_s_j); + Py_VISIT(traverse_module_state->__pyx_n_s_k); + Py_VISIT(traverse_module_state->__pyx_n_s_l); + Py_VISIT(traverse_module_state->__pyx_n_s_longer); + Py_VISIT(traverse_module_state->__pyx_n_s_lower); + Py_VISIT(traverse_module_state->__pyx_n_s_m); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_maxlen); + Py_VISIT(traverse_module_state->__pyx_n_s_md); + Py_VISIT(traverse_module_state->__pyx_n_s_memview); + Py_VISIT(traverse_module_state->__pyx_n_s_mj); + Py_VISIT(traverse_module_state->__pyx_n_s_mj1); + Py_VISIT(traverse_module_state->__pyx_n_s_mj2); + Py_VISIT(traverse_module_state->__pyx_n_s_mj_arr); + Py_VISIT(traverse_module_state->__pyx_n_s_mj_sep); + Py_VISIT(traverse_module_state->__pyx_n_s_mode); + Py_VISIT(traverse_module_state->__pyx_n_s_msd); + Py_VISIT(traverse_module_state->__pyx_n_s_msdCOM); + Py_VISIT(traverse_module_state->__pyx_n_s_msdCOMvHnG); + Py_VISIT(traverse_module_state->__pyx_n_s_msdMJ); + Py_VISIT(traverse_module_state->__pyx_n_s_msdMJCharges); + Py_VISIT(traverse_module_state->__pyx_n_s_msdMJcrossterms); + Py_VISIT(traverse_module_state->__pyx_n_s_msdMJdecomp); + Py_VISIT(traverse_module_state->__pyx_n_s_msd_data); + Py_VISIT(traverse_module_state->__pyx_n_s_msddeg); + Py_VISIT(traverse_module_state->__pyx_n_s_msddeg_data); + Py_VISIT(traverse_module_state->__pyx_n_s_msdmj); + Py_VISIT(traverse_module_state->__pyx_n_s_n); + Py_VISIT(traverse_module_state->__pyx_n_s_n1); + Py_VISIT(traverse_module_state->__pyx_n_s_n2); + Py_VISIT(traverse_module_state->__pyx_n_s_n3); + Py_VISIT(traverse_module_state->__pyx_n_s_n4); + Py_VISIT(traverse_module_state->__pyx_kp_s_n_must_be_1); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_name_2); + Py_VISIT(traverse_module_state->__pyx_n_s_ndim); + Py_VISIT(traverse_module_state->__pyx_n_s_new); + Py_VISIT(traverse_module_state->__pyx_n_s_newanalysis_diffusion); + Py_VISIT(traverse_module_state->__pyx_kp_s_newanalysis_helpers_diffusion_py); + Py_VISIT(traverse_module_state->__pyx_n_s_nframes); + Py_VISIT(traverse_module_state->__pyx_n_s_ng); + Py_VISIT(traverse_module_state->__pyx_n_s_nion); + Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_VISIT(traverse_module_state->__pyx_n_s_nonGaussianParameter); + Py_VISIT(traverse_module_state->__pyx_n_s_non_gaussian); + Py_VISIT(traverse_module_state->__pyx_n_s_np); + Py_VISIT(traverse_module_state->__pyx_n_s_nstep); + Py_VISIT(traverse_module_state->__pyx_n_s_nts); + Py_VISIT(traverse_module_state->__pyx_n_s_numpy); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_VISIT(traverse_module_state->__pyx_n_s_obj); + Py_VISIT(traverse_module_state->__pyx_n_s_pack); + Py_VISIT(traverse_module_state->__pyx_n_s_pairDisplacement); + Py_VISIT(traverse_module_state->__pyx_n_s_pickle); + Py_VISIT(traverse_module_state->__pyx_n_s_pos); + Py_VISIT(traverse_module_state->__pyx_n_s_print); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_register); + Py_VISIT(traverse_module_state->__pyx_n_s_res2); + Py_VISIT(traverse_module_state->__pyx_n_s_result); + Py_VISIT(traverse_module_state->__pyx_n_s_s1); + Py_VISIT(traverse_module_state->__pyx_n_s_s1_n2); + Py_VISIT(traverse_module_state->__pyx_n_s_s2); + Py_VISIT(traverse_module_state->__pyx_n_s_s2_n2); + Py_VISIT(traverse_module_state->__pyx_n_s_sep); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_shape); + Py_VISIT(traverse_module_state->__pyx_n_s_shorter); + Py_VISIT(traverse_module_state->__pyx_n_s_size); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_start); + Py_VISIT(traverse_module_state->__pyx_n_s_step); + Py_VISIT(traverse_module_state->__pyx_n_s_stop); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_struct); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_tmp); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_VISIT(traverse_module_state->__pyx_n_s_unfoldTraj); + Py_VISIT(traverse_module_state->__pyx_n_s_unpack); + Py_VISIT(traverse_module_state->__pyx_n_s_update); + Py_VISIT(traverse_module_state->__pyx_n_s_upper); + Py_VISIT(traverse_module_state->__pyx_n_s_van_hove); + Py_VISIT(traverse_module_state->__pyx_n_s_version_info); + Py_VISIT(traverse_module_state->__pyx_n_s_vh); + Py_VISIT(traverse_module_state->__pyx_n_s_vh_maxdist); + Py_VISIT(traverse_module_state->__pyx_n_s_vhmax); + Py_VISIT(traverse_module_state->__pyx_n_s_xyz); + Py_VISIT(traverse_module_state->__pyx_n_s_xyz2); + Py_VISIT(traverse_module_state->__pyx_n_s_xyz_tmp); + Py_VISIT(traverse_module_state->__pyx_n_s_zeros); + Py_VISIT(traverse_module_state->__pyx_float_200_0); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_2); + Py_VISIT(traverse_module_state->__pyx_int_3); + Py_VISIT(traverse_module_state->__pyx_int_10); + Py_VISIT(traverse_module_state->__pyx_int_112105877); + Py_VISIT(traverse_module_state->__pyx_int_136983863); + Py_VISIT(traverse_module_state->__pyx_int_184977713); + Py_VISIT(traverse_module_state->__pyx_int_neg_1); + Py_VISIT(traverse_module_state->__pyx_slice__5); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_tuple__9); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__14); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__16); + Py_VISIT(traverse_module_state->__pyx_tuple__17); + Py_VISIT(traverse_module_state->__pyx_tuple__18); + Py_VISIT(traverse_module_state->__pyx_tuple__19); + Py_VISIT(traverse_module_state->__pyx_tuple__20); + Py_VISIT(traverse_module_state->__pyx_tuple__21); + Py_VISIT(traverse_module_state->__pyx_tuple__22); + Py_VISIT(traverse_module_state->__pyx_tuple__24); + Py_VISIT(traverse_module_state->__pyx_tuple__26); + Py_VISIT(traverse_module_state->__pyx_tuple__28); + Py_VISIT(traverse_module_state->__pyx_tuple__29); + Py_VISIT(traverse_module_state->__pyx_tuple__31); + Py_VISIT(traverse_module_state->__pyx_tuple__32); + Py_VISIT(traverse_module_state->__pyx_tuple__34); + Py_VISIT(traverse_module_state->__pyx_tuple__36); + Py_VISIT(traverse_module_state->__pyx_tuple__37); + Py_VISIT(traverse_module_state->__pyx_tuple__39); + Py_VISIT(traverse_module_state->__pyx_tuple__41); + Py_VISIT(traverse_module_state->__pyx_tuple__43); + Py_VISIT(traverse_module_state->__pyx_tuple__45); + Py_VISIT(traverse_module_state->__pyx_tuple__47); + Py_VISIT(traverse_module_state->__pyx_codeobj__23); + Py_VISIT(traverse_module_state->__pyx_codeobj__25); + Py_VISIT(traverse_module_state->__pyx_codeobj__27); + Py_VISIT(traverse_module_state->__pyx_codeobj__30); + Py_VISIT(traverse_module_state->__pyx_codeobj__33); + Py_VISIT(traverse_module_state->__pyx_codeobj__35); + Py_VISIT(traverse_module_state->__pyx_codeobj__38); + Py_VISIT(traverse_module_state->__pyx_codeobj__40); + Py_VISIT(traverse_module_state->__pyx_codeobj__42); + Py_VISIT(traverse_module_state->__pyx_codeobj__44); + Py_VISIT(traverse_module_state->__pyx_codeobj__46); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_5numpy_dtype __pyx_mstate_global->__pyx_ptype_5numpy_dtype +#define __pyx_ptype_5numpy_flatiter __pyx_mstate_global->__pyx_ptype_5numpy_flatiter +#define __pyx_ptype_5numpy_broadcast __pyx_mstate_global->__pyx_ptype_5numpy_broadcast +#define __pyx_ptype_5numpy_ndarray __pyx_mstate_global->__pyx_ptype_5numpy_ndarray +#define __pyx_ptype_5numpy_generic __pyx_mstate_global->__pyx_ptype_5numpy_generic +#define __pyx_ptype_5numpy_number __pyx_mstate_global->__pyx_ptype_5numpy_number +#define __pyx_ptype_5numpy_integer __pyx_mstate_global->__pyx_ptype_5numpy_integer +#define __pyx_ptype_5numpy_signedinteger __pyx_mstate_global->__pyx_ptype_5numpy_signedinteger +#define __pyx_ptype_5numpy_unsignedinteger __pyx_mstate_global->__pyx_ptype_5numpy_unsignedinteger +#define __pyx_ptype_5numpy_inexact __pyx_mstate_global->__pyx_ptype_5numpy_inexact +#define __pyx_ptype_5numpy_floating __pyx_mstate_global->__pyx_ptype_5numpy_floating +#define __pyx_ptype_5numpy_complexfloating __pyx_mstate_global->__pyx_ptype_5numpy_complexfloating +#define __pyx_ptype_5numpy_flexible __pyx_mstate_global->__pyx_ptype_5numpy_flexible +#define __pyx_ptype_5numpy_character __pyx_mstate_global->__pyx_ptype_5numpy_character +#define __pyx_ptype_5numpy_ufunc __pyx_mstate_global->__pyx_ptype_5numpy_ufunc +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type___pyx_array __pyx_mstate_global->__pyx_type___pyx_array +#define __pyx_type___pyx_MemviewEnum __pyx_mstate_global->__pyx_type___pyx_MemviewEnum +#define __pyx_type___pyx_memoryview __pyx_mstate_global->__pyx_type___pyx_memoryview +#define __pyx_type___pyx_memoryviewslice __pyx_mstate_global->__pyx_type___pyx_memoryviewslice +#endif +#define __pyx_array_type __pyx_mstate_global->__pyx_array_type +#define __pyx_MemviewEnum_type __pyx_mstate_global->__pyx_MemviewEnum_type +#define __pyx_memoryview_type __pyx_mstate_global->__pyx_memoryview_type +#define __pyx_memoryviewslice_type __pyx_mstate_global->__pyx_memoryviewslice_type +#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_n_s_ASCII __pyx_mstate_global->__pyx_n_s_ASCII +#define __pyx_kp_s_All_dimensions_preceding_dimensi __pyx_mstate_global->__pyx_kp_s_All_dimensions_preceding_dimensi +#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError +#define __pyx_kp_s_Buffer_view_does_not_expose_stri __pyx_mstate_global->__pyx_kp_s_Buffer_view_does_not_expose_stri +#define __pyx_kp_s_Can_only_create_a_buffer_that_is __pyx_mstate_global->__pyx_kp_s_Can_only_create_a_buffer_that_is +#define __pyx_kp_s_Cannot_assign_to_read_only_memor __pyx_mstate_global->__pyx_kp_s_Cannot_assign_to_read_only_memor +#define __pyx_kp_s_Cannot_create_writable_memory_vi __pyx_mstate_global->__pyx_kp_s_Cannot_create_writable_memory_vi +#define __pyx_kp_u_Cannot_index_with_type __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type +#define __pyx_kp_s_Cannot_transpose_memoryview_with __pyx_mstate_global->__pyx_kp_s_Cannot_transpose_memoryview_with +#define __pyx_kp_s_Dimension_d_is_not_direct __pyx_mstate_global->__pyx_kp_s_Dimension_d_is_not_direct +#define __pyx_n_s_Ellipsis __pyx_mstate_global->__pyx_n_s_Ellipsis +#define __pyx_kp_s_Empty_shape_tuple_for_cython_arr __pyx_mstate_global->__pyx_kp_s_Empty_shape_tuple_for_cython_arr +#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError +#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 +#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError +#define __pyx_kp_s_Index_out_of_bounds_axis_d __pyx_mstate_global->__pyx_kp_s_Index_out_of_bounds_axis_d +#define __pyx_kp_s_Indirect_dimensions_not_supporte __pyx_mstate_global->__pyx_kp_s_Indirect_dimensions_not_supporte +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis +#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError +#define __pyx_kp_s_MemoryView_of_r_at_0x_x __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_at_0x_x +#define __pyx_kp_s_MemoryView_of_r_object __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_object +#define __pyx_n_b_O __pyx_mstate_global->__pyx_n_b_O +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a +#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError +#define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence +#define __pyx_kp_s_Step_may_not_be_zero_axis_d __pyx_mstate_global->__pyx_kp_s_Step_may_not_be_zero_axis_d +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_kp_s_Unable_to_convert_item_to_object __pyx_mstate_global->__pyx_kp_s_Unable_to_convert_item_to_object +#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError +#define __pyx_n_s_View_MemoryView __pyx_mstate_global->__pyx_n_s_View_MemoryView +#define __pyx_kp_s_WARNING_same_number_of_cation_an __pyx_mstate_global->__pyx_kp_s_WARNING_same_number_of_cation_an +#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 +#define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3 +#define __pyx_n_s__48 __pyx_mstate_global->__pyx_n_s__48 +#define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6 +#define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7 +#define __pyx_n_s_abc __pyx_mstate_global->__pyx_n_s_abc +#define __pyx_n_s_all __pyx_mstate_global->__pyx_n_s_all +#define __pyx_n_s_allocate_buffer __pyx_mstate_global->__pyx_n_s_allocate_buffer +#define __pyx_n_s_alpha __pyx_mstate_global->__pyx_n_s_alpha +#define __pyx_n_s_alpha_data __pyx_mstate_global->__pyx_n_s_alpha_data +#define __pyx_n_s_an __pyx_mstate_global->__pyx_n_s_an +#define __pyx_kp_u_and __pyx_mstate_global->__pyx_kp_u_and +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_b2 __pyx_mstate_global->__pyx_n_s_b2 +#define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base +#define __pyx_n_s_boxl __pyx_mstate_global->__pyx_n_s_boxl +#define __pyx_n_s_boxlength __pyx_mstate_global->__pyx_n_s_boxlength +#define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c +#define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c +#define __pyx_n_s_c1 __pyx_mstate_global->__pyx_n_s_c1 +#define __pyx_n_s_c2 __pyx_mstate_global->__pyx_n_s_c2 +#define __pyx_n_s_can __pyx_mstate_global->__pyx_n_s_can +#define __pyx_n_s_cat __pyx_mstate_global->__pyx_n_s_cat +#define __pyx_n_s_ccat __pyx_mstate_global->__pyx_n_s_ccat +#define __pyx_n_s_ch __pyx_mstate_global->__pyx_n_s_ch +#define __pyx_n_s_charge __pyx_mstate_global->__pyx_n_s_charge +#define __pyx_n_s_charge_an __pyx_mstate_global->__pyx_n_s_charge_an +#define __pyx_n_s_charge_cat __pyx_mstate_global->__pyx_n_s_charge_cat +#define __pyx_n_s_charge_s1 __pyx_mstate_global->__pyx_n_s_charge_s1 +#define __pyx_n_s_charge_s2 __pyx_mstate_global->__pyx_n_s_charge_s2 +#define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class +#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_cmj __pyx_mstate_global->__pyx_n_s_cmj +#define __pyx_n_s_cmj1 __pyx_mstate_global->__pyx_n_s_cmj1 +#define __pyx_n_s_cmj2 __pyx_mstate_global->__pyx_n_s_cmj2 +#define __pyx_n_s_cmj_sep __pyx_mstate_global->__pyx_n_s_cmj_sep +#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections +#define __pyx_kp_s_collections_abc __pyx_mstate_global->__pyx_kp_s_collections_abc +#define __pyx_n_s_coms_an __pyx_mstate_global->__pyx_n_s_coms_an +#define __pyx_n_s_coms_cat __pyx_mstate_global->__pyx_n_s_coms_cat +#define __pyx_n_s_coms_s1 __pyx_mstate_global->__pyx_n_s_coms_s1 +#define __pyx_n_s_coms_s2 __pyx_mstate_global->__pyx_n_s_coms_s2 +#define __pyx_n_s_coms_sep __pyx_mstate_global->__pyx_n_s_coms_sep +#define __pyx_kp_s_contiguous_and_direct __pyx_mstate_global->__pyx_kp_s_contiguous_and_direct +#define __pyx_kp_s_contiguous_and_indirect __pyx_mstate_global->__pyx_kp_s_contiguous_and_indirect +#define __pyx_n_s_copy __pyx_mstate_global->__pyx_n_s_copy +#define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count +#define __pyx_n_s_crossDisplacementMdMj __pyx_mstate_global->__pyx_n_s_crossDisplacementMdMj +#define __pyx_n_s_ctr __pyx_mstate_global->__pyx_n_s_ctr +#define __pyx_n_s_ctr_arr __pyx_mstate_global->__pyx_n_s_ctr_arr +#define __pyx_n_s_d __pyx_mstate_global->__pyx_n_s_d +#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data +#define __pyx_n_s_data2 __pyx_mstate_global->__pyx_n_s_data2 +#define __pyx_n_s_data_tmp __pyx_mstate_global->__pyx_n_s_data_tmp +#define __pyx_n_s_deg __pyx_mstate_global->__pyx_n_s_deg +#define __pyx_n_s_diag __pyx_mstate_global->__pyx_n_s_diag +#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_disp __pyx_mstate_global->__pyx_n_s_disp +#define __pyx_n_s_disp_arr __pyx_mstate_global->__pyx_n_s_disp_arr +#define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype +#define __pyx_n_s_dtype_is_object __pyx_mstate_global->__pyx_n_s_dtype_is_object +#define __pyx_n_s_dx __pyx_mstate_global->__pyx_n_s_dx +#define __pyx_n_s_dx1 __pyx_mstate_global->__pyx_n_s_dx1 +#define __pyx_n_s_dx2 __pyx_mstate_global->__pyx_n_s_dx2 +#define __pyx_n_s_dx3 __pyx_mstate_global->__pyx_n_s_dx3 +#define __pyx_n_s_dxs __pyx_mstate_global->__pyx_n_s_dxs +#define __pyx_n_s_dy __pyx_mstate_global->__pyx_n_s_dy +#define __pyx_n_s_dy1 __pyx_mstate_global->__pyx_n_s_dy1 +#define __pyx_n_s_dy2 __pyx_mstate_global->__pyx_n_s_dy2 +#define __pyx_n_s_dy3 __pyx_mstate_global->__pyx_n_s_dy3 +#define __pyx_n_s_dys __pyx_mstate_global->__pyx_n_s_dys +#define __pyx_n_s_dz __pyx_mstate_global->__pyx_n_s_dz +#define __pyx_n_s_dz1 __pyx_mstate_global->__pyx_n_s_dz1 +#define __pyx_n_s_dz2 __pyx_mstate_global->__pyx_n_s_dz2 +#define __pyx_n_s_dz3 __pyx_mstate_global->__pyx_n_s_dz3 +#define __pyx_n_s_dzs __pyx_mstate_global->__pyx_n_s_dzs +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate +#define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error +#define __pyx_n_s_factor __pyx_mstate_global->__pyx_n_s_factor +#define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags +#define __pyx_n_s_float64 __pyx_mstate_global->__pyx_n_s_float64 +#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format +#define __pyx_n_s_fortran __pyx_mstate_global->__pyx_n_s_fortran +#define __pyx_n_u_fortran __pyx_mstate_global->__pyx_n_u_fortran +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi +#define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i +#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id +#define __pyx_n_s_idx1 __pyx_mstate_global->__pyx_n_s_idx1 +#define __pyx_n_s_idx2 __pyx_mstate_global->__pyx_n_s_idx2 +#define __pyx_n_s_idx3 __pyx_mstate_global->__pyx_n_s_idx3 +#define __pyx_n_s_idx4 __pyx_mstate_global->__pyx_n_s_idx4 +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_int32 __pyx_mstate_global->__pyx_n_s_int32 +#define __pyx_n_s_irel __pyx_mstate_global->__pyx_n_s_irel +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_itemsize __pyx_mstate_global->__pyx_n_s_itemsize +#define __pyx_kp_s_itemsize_0_for_cython_array __pyx_mstate_global->__pyx_kp_s_itemsize_0_for_cython_array +#define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j +#define __pyx_n_s_k __pyx_mstate_global->__pyx_n_s_k +#define __pyx_n_s_l __pyx_mstate_global->__pyx_n_s_l +#define __pyx_n_s_longer __pyx_mstate_global->__pyx_n_s_longer +#define __pyx_n_s_lower __pyx_mstate_global->__pyx_n_s_lower +#define __pyx_n_s_m __pyx_mstate_global->__pyx_n_s_m +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_maxlen __pyx_mstate_global->__pyx_n_s_maxlen +#define __pyx_n_s_md __pyx_mstate_global->__pyx_n_s_md +#define __pyx_n_s_memview __pyx_mstate_global->__pyx_n_s_memview +#define __pyx_n_s_mj __pyx_mstate_global->__pyx_n_s_mj +#define __pyx_n_s_mj1 __pyx_mstate_global->__pyx_n_s_mj1 +#define __pyx_n_s_mj2 __pyx_mstate_global->__pyx_n_s_mj2 +#define __pyx_n_s_mj_arr __pyx_mstate_global->__pyx_n_s_mj_arr +#define __pyx_n_s_mj_sep __pyx_mstate_global->__pyx_n_s_mj_sep +#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode +#define __pyx_n_s_msd __pyx_mstate_global->__pyx_n_s_msd +#define __pyx_n_s_msdCOM __pyx_mstate_global->__pyx_n_s_msdCOM +#define __pyx_n_s_msdCOMvHnG __pyx_mstate_global->__pyx_n_s_msdCOMvHnG +#define __pyx_n_s_msdMJ __pyx_mstate_global->__pyx_n_s_msdMJ +#define __pyx_n_s_msdMJCharges __pyx_mstate_global->__pyx_n_s_msdMJCharges +#define __pyx_n_s_msdMJcrossterms __pyx_mstate_global->__pyx_n_s_msdMJcrossterms +#define __pyx_n_s_msdMJdecomp __pyx_mstate_global->__pyx_n_s_msdMJdecomp +#define __pyx_n_s_msd_data __pyx_mstate_global->__pyx_n_s_msd_data +#define __pyx_n_s_msddeg __pyx_mstate_global->__pyx_n_s_msddeg +#define __pyx_n_s_msddeg_data __pyx_mstate_global->__pyx_n_s_msddeg_data +#define __pyx_n_s_msdmj __pyx_mstate_global->__pyx_n_s_msdmj +#define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n +#define __pyx_n_s_n1 __pyx_mstate_global->__pyx_n_s_n1 +#define __pyx_n_s_n2 __pyx_mstate_global->__pyx_n_s_n2 +#define __pyx_n_s_n3 __pyx_mstate_global->__pyx_n_s_n3 +#define __pyx_n_s_n4 __pyx_mstate_global->__pyx_n_s_n4 +#define __pyx_kp_s_n_must_be_1 __pyx_mstate_global->__pyx_kp_s_n_must_be_1 +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 +#define __pyx_n_s_ndim __pyx_mstate_global->__pyx_n_s_ndim +#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new +#define __pyx_n_s_newanalysis_diffusion __pyx_mstate_global->__pyx_n_s_newanalysis_diffusion +#define __pyx_kp_s_newanalysis_helpers_diffusion_py __pyx_mstate_global->__pyx_kp_s_newanalysis_helpers_diffusion_py +#define __pyx_n_s_nframes __pyx_mstate_global->__pyx_n_s_nframes +#define __pyx_n_s_ng __pyx_mstate_global->__pyx_n_s_ng +#define __pyx_n_s_nion __pyx_mstate_global->__pyx_n_s_nion +#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non +#define __pyx_n_s_nonGaussianParameter __pyx_mstate_global->__pyx_n_s_nonGaussianParameter +#define __pyx_n_s_non_gaussian __pyx_mstate_global->__pyx_n_s_non_gaussian +#define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np +#define __pyx_n_s_nstep __pyx_mstate_global->__pyx_n_s_nstep +#define __pyx_n_s_nts __pyx_mstate_global->__pyx_n_s_nts +#define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy +#define __pyx_kp_s_numpy_core_multiarray_failed_to __pyx_mstate_global->__pyx_kp_s_numpy_core_multiarray_failed_to +#define __pyx_kp_s_numpy_core_umath_failed_to_impor __pyx_mstate_global->__pyx_kp_s_numpy_core_umath_failed_to_impor +#define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj +#define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack +#define __pyx_n_s_pairDisplacement __pyx_mstate_global->__pyx_n_s_pairDisplacement +#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle +#define __pyx_n_s_pos __pyx_mstate_global->__pyx_n_s_pos +#define __pyx_n_s_print __pyx_mstate_global->__pyx_n_s_print +#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError +#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum +#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type +#define __pyx_n_s_pyx_unpickle_Enum __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Enum +#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce +#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython +#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register +#define __pyx_n_s_res2 __pyx_mstate_global->__pyx_n_s_res2 +#define __pyx_n_s_result __pyx_mstate_global->__pyx_n_s_result +#define __pyx_n_s_s1 __pyx_mstate_global->__pyx_n_s_s1 +#define __pyx_n_s_s1_n2 __pyx_mstate_global->__pyx_n_s_s1_n2 +#define __pyx_n_s_s2 __pyx_mstate_global->__pyx_n_s_s2 +#define __pyx_n_s_s2_n2 __pyx_mstate_global->__pyx_n_s_s2_n2 +#define __pyx_n_s_sep __pyx_mstate_global->__pyx_n_s_sep +#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate +#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython +#define __pyx_n_s_shape __pyx_mstate_global->__pyx_n_s_shape +#define __pyx_n_s_shorter __pyx_mstate_global->__pyx_n_s_shorter +#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start +#define __pyx_n_s_step __pyx_mstate_global->__pyx_n_s_step +#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop +#define __pyx_kp_s_strided_and_direct __pyx_mstate_global->__pyx_kp_s_strided_and_direct +#define __pyx_kp_s_strided_and_direct_or_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_direct_or_indirect +#define __pyx_kp_s_strided_and_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_indirect +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_tmp __pyx_mstate_global->__pyx_n_s_tmp +#define __pyx_kp_s_unable_to_allocate_array_data __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_array_data +#define __pyx_kp_s_unable_to_allocate_shape_and_str __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_shape_and_str +#define __pyx_n_s_unfoldTraj __pyx_mstate_global->__pyx_n_s_unfoldTraj +#define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack +#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update +#define __pyx_n_s_upper __pyx_mstate_global->__pyx_n_s_upper +#define __pyx_n_s_van_hove __pyx_mstate_global->__pyx_n_s_van_hove +#define __pyx_n_s_version_info __pyx_mstate_global->__pyx_n_s_version_info +#define __pyx_n_s_vh __pyx_mstate_global->__pyx_n_s_vh +#define __pyx_n_s_vh_maxdist __pyx_mstate_global->__pyx_n_s_vh_maxdist +#define __pyx_n_s_vhmax __pyx_mstate_global->__pyx_n_s_vhmax +#define __pyx_n_s_xyz __pyx_mstate_global->__pyx_n_s_xyz +#define __pyx_n_s_xyz2 __pyx_mstate_global->__pyx_n_s_xyz2 +#define __pyx_n_s_xyz_tmp __pyx_mstate_global->__pyx_n_s_xyz_tmp +#define __pyx_n_s_zeros __pyx_mstate_global->__pyx_n_s_zeros +#define __pyx_float_200_0 __pyx_mstate_global->__pyx_float_200_0 +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_2 __pyx_mstate_global->__pyx_int_2 +#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3 +#define __pyx_int_10 __pyx_mstate_global->__pyx_int_10 +#define __pyx_int_112105877 __pyx_mstate_global->__pyx_int_112105877 +#define __pyx_int_136983863 __pyx_mstate_global->__pyx_int_136983863 +#define __pyx_int_184977713 __pyx_mstate_global->__pyx_int_184977713 +#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 +#define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 +#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 +#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 +#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 +#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 +#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 +#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24 +#define __pyx_tuple__26 __pyx_mstate_global->__pyx_tuple__26 +#define __pyx_tuple__28 __pyx_mstate_global->__pyx_tuple__28 +#define __pyx_tuple__29 __pyx_mstate_global->__pyx_tuple__29 +#define __pyx_tuple__31 __pyx_mstate_global->__pyx_tuple__31 +#define __pyx_tuple__32 __pyx_mstate_global->__pyx_tuple__32 +#define __pyx_tuple__34 __pyx_mstate_global->__pyx_tuple__34 +#define __pyx_tuple__36 __pyx_mstate_global->__pyx_tuple__36 +#define __pyx_tuple__37 __pyx_mstate_global->__pyx_tuple__37 +#define __pyx_tuple__39 __pyx_mstate_global->__pyx_tuple__39 +#define __pyx_tuple__41 __pyx_mstate_global->__pyx_tuple__41 +#define __pyx_tuple__43 __pyx_mstate_global->__pyx_tuple__43 +#define __pyx_tuple__45 __pyx_mstate_global->__pyx_tuple__45 +#define __pyx_tuple__47 __pyx_mstate_global->__pyx_tuple__47 +#define __pyx_codeobj__23 __pyx_mstate_global->__pyx_codeobj__23 +#define __pyx_codeobj__25 __pyx_mstate_global->__pyx_codeobj__25 +#define __pyx_codeobj__27 __pyx_mstate_global->__pyx_codeobj__27 +#define __pyx_codeobj__30 __pyx_mstate_global->__pyx_codeobj__30 +#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33 +#define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35 +#define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38 +#define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40 +#define __pyx_codeobj__42 __pyx_mstate_global->__pyx_codeobj__42 +#define __pyx_codeobj__44 __pyx_mstate_global->__pyx_codeobj__44 +#define __pyx_codeobj__46 __pyx_mstate_global->__pyx_codeobj__46 +/* #### Code section: module_code ### */ + +/* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): * - * def unfoldTraj(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * boxlength): - * """ */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9diffusion_1unfoldTraj(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9diffusion_unfoldTraj[] = "\n unfoldTraj(xyz,boxlength)\n\n Arguments:\n xyz .. numpy array (float64, ndim=3) of the centers-of-mass of the whole trajectory [timestep, molecule, xyz]\n boxlength .. the box length\n\n Usage:\n This function unfolds a trajectory as a whole.\n\n Example: \n com = unfoldTraj(com, boxlength)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_1unfoldTraj = {"unfoldTraj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9diffusion_1unfoldTraj, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_unfoldTraj}; -static PyObject *__pyx_pw_11newanalysis_9diffusion_1unfoldTraj(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_xyz = 0; - PyObject *__pyx_v_boxlength = 0; +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("unfoldTraj (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 131, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_boxlength,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; + values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_n_s_c)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shape)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_itemsize)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("unfoldTraj", 1, 2, 2, 1); __PYX_ERR(0, 12, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 131, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_format)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 131, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode); + if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_allocate_buffer); + if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unfoldTraj") < 0)) __PYX_ERR(0, 12, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 131, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 132, __pyx_L3_error) + } else { + + /* "View.MemoryView":132 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx + */ + __pyx_v_allocate_buffer = ((int)1); } - __pyx_v_xyz = ((PyArrayObject *)values[0]); - __pyx_v_boxlength = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("unfoldTraj", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 12, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 131, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.diffusion.unfoldTraj", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 12, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9diffusion_unfoldTraj(__pyx_self, __pyx_v_xyz, __pyx_v_boxlength); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 131, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 131, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * + */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __pyx_r = NULL; + __pyx_r = -1; __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9diffusion_unfoldTraj(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_boxlength) { - double __pyx_v_boxl; - double __pyx_v_b2; - int __pyx_v_n; - int __pyx_v_nframes; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - double __pyx_v_d; - PyArrayObject *__pyx_v_xyz_tmp = 0; - double *__pyx_v_data; - double *__pyx_v_data_tmp; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; - __Pyx_Buffer __pyx_pybuffer_xyz; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_tmp; - __Pyx_Buffer __pyx_pybuffer_xyz_tmp; - PyObject *__pyx_r = NULL; +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; __Pyx_RefNannyDeclarations - double __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; + int __pyx_t_7; + char *__pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_UCS4 __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("unfoldTraj", 0); - __pyx_pybuffer_xyz_tmp.pybuffer.buf = NULL; - __pyx_pybuffer_xyz_tmp.refcount = 0; - __pyx_pybuffernd_xyz_tmp.data = NULL; - __pyx_pybuffernd_xyz_tmp.rcbuffer = &__pyx_pybuffer_xyz_tmp; - __pyx_pybuffer_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_xyz.refcount = 0; - __pyx_pybuffernd_xyz.data = NULL; - __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 12, __pyx_L1_error) - } - __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz.diminfo[2].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz.diminfo[2].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[2]; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); - /* "src/helpers/diffusion.pyx":27 - * com = unfoldTraj(com, boxlength) - * """ - * cdef double boxl = boxlength # <<<<<<<<<<<<<< - * cdef double b2 = boxl/2.0 - * cdef int n = len(xyz[0]) + /* "View.MemoryView":137 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_boxlength); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 27, __pyx_L1_error) - __pyx_v_boxl = __pyx_t_1; + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 137, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 137, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); - /* "src/helpers/diffusion.pyx":28 - * """ - * cdef double boxl = boxlength - * cdef double b2 = boxl/2.0 # <<<<<<<<<<<<<< - * cdef int n = len(xyz[0]) - * cdef int nframes = len(xyz) + /* "View.MemoryView":138 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: */ - __pyx_v_b2 = (__pyx_v_boxl / 2.0); + __pyx_v_self->itemsize = __pyx_v_itemsize; - /* "src/helpers/diffusion.pyx":29 - * cdef double boxl = boxlength - * cdef double b2 = boxl/2.0 - * cdef int n = len(xyz[0]) # <<<<<<<<<<<<<< - * cdef int nframes = len(xyz) - * cdef int i, j, k + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n = __pyx_t_3; + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/diffusion.pyx":30 - * cdef double b2 = boxl/2.0 - * cdef int n = len(xyz[0]) - * cdef int nframes = len(xyz) # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef double d + /* "View.MemoryView":141 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: */ - __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 30, __pyx_L1_error) - __pyx_v_nframes = __pyx_t_3; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 141, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":33 - * cdef int i, j, k - * cdef double d - * cdef np.ndarray[np.float64_t,ndim=2] xyz_tmp = np.copy(xyz[0]) # <<<<<<<<<<<<<< - * cdef double *data = xyz.data - * cdef double *data_tmp = xyz_tmp.data + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 33, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_xyz_tmp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 33, __pyx_L1_error) - } else {__pyx_pybuffernd_xyz_tmp.diminfo[0].strides = __pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_tmp.diminfo[0].shape = __pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_tmp.diminfo[1].strides = __pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_tmp.diminfo[1].shape = __pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer.shape[1]; - } } - __pyx_t_7 = 0; - __pyx_v_xyz_tmp = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - /* "src/helpers/diffusion.pyx":34 - * cdef double d - * cdef np.ndarray[np.float64_t,ndim=2] xyz_tmp = np.copy(xyz[0]) - * cdef double *data = xyz.data # <<<<<<<<<<<<<< - * cdef double *data_tmp = xyz_tmp.data + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" * */ - __pyx_v_data = ((double *)__pyx_v_xyz->data); + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/diffusion.pyx":35 - * cdef np.ndarray[np.float64_t,ndim=2] xyz_tmp = np.copy(xyz[0]) - * cdef double *data = xyz.data - * cdef double *data_tmp = xyz_tmp.data # <<<<<<<<<<<<<< + /* "View.MemoryView":144 * - * for i in range(1,nframes): + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): */ - __pyx_v_data_tmp = ((double *)__pyx_v_xyz_tmp->data); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 144, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":37 - * cdef double *data_tmp = xyz_tmp.data + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" * - * for i in range(1,nframes): # <<<<<<<<<<<<<< - * for j in range(n): - * for k in range(3): */ - __pyx_t_8 = __pyx_v_nframes; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 1; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; + } - /* "src/helpers/diffusion.pyx":38 + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" * - * for i in range(1,nframes): - * for j in range(n): # <<<<<<<<<<<<<< - * for k in range(3): - * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - __pyx_t_11 = __pyx_v_n; - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_j = __pyx_t_13; + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { - /* "src/helpers/diffusion.pyx":39 - * for i in range(1,nframes): - * for j in range(n): - * for k in range(3): # <<<<<<<<<<<<<< - * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] - * if d <= -b2: + /* "View.MemoryView":147 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format */ - for (__pyx_t_14 = 0; __pyx_t_14 < 3; __pyx_t_14+=1) { - __pyx_v_k = __pyx_t_14; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; - /* "src/helpers/diffusion.pyx":40 - * for j in range(n): - * for k in range(3): - * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] # <<<<<<<<<<<<<< - * if d <= -b2: - * d+=boxl + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - __pyx_v_d = ((__pyx_v_data[((((__pyx_v_i * __pyx_v_n) * 3) + (__pyx_v_j * 3)) + __pyx_v_k)]) - (__pyx_v_data_tmp[((__pyx_v_j * 3) + __pyx_v_k)])); + } - /* "src/helpers/diffusion.pyx":41 - * for k in range(3): - * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] - * if d <= -b2: # <<<<<<<<<<<<<< - * d+=boxl - * elif d > b2: + /* "View.MemoryView":148 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * */ - __pyx_t_15 = ((__pyx_v_d <= (-__pyx_v_b2)) != 0); - if (__pyx_t_15) { + if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_format))) __PYX_ERR(1, 148, __pyx_L1_error) + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "src/helpers/diffusion.pyx":42 - * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] - * if d <= -b2: - * d+=boxl # <<<<<<<<<<<<<< - * elif d > b2: - * d-=boxl + /* "View.MemoryView":149 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * */ - __pyx_v_d = (__pyx_v_d + __pyx_v_boxl); + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 149, __pyx_L1_error) + } + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 149, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_8; - /* "src/helpers/diffusion.pyx":41 - * for k in range(3): - * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] - * if d <= -b2: # <<<<<<<<<<<<<< - * d+=boxl - * elif d > b2: + /* "View.MemoryView":152 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * */ - goto __pyx_L9; - } + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - /* "src/helpers/diffusion.pyx":43 - * if d <= -b2: - * d+=boxl - * elif d > b2: # <<<<<<<<<<<<<< - * d-=boxl - * data_tmp[j*3+k] = data[i*n*3+j*3+k] + /* "View.MemoryView":153 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: */ - __pyx_t_15 = ((__pyx_v_d > __pyx_v_b2) != 0); - if (__pyx_t_15) { + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - /* "src/helpers/diffusion.pyx":44 - * d+=boxl - * elif d > b2: - * d-=boxl # <<<<<<<<<<<<<< - * data_tmp[j*3+k] = data[i*n*3+j*3+k] - * data[i*n*3+j*3+k] = data[(i-1)*n*3+j*3+k] + d + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * */ - __pyx_v_d = (__pyx_v_d - __pyx_v_boxl); + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { - /* "src/helpers/diffusion.pyx":43 - * if d <= -b2: - * d+=boxl - * elif d > b2: # <<<<<<<<<<<<<< - * d-=boxl - * data_tmp[j*3+k] = data[i*n*3+j*3+k] + /* "View.MemoryView":156 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * */ - } - __pyx_L9:; + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 156, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":45 - * elif d > b2: - * d-=boxl - * data_tmp[j*3+k] = data[i*n*3+j*3+k] # <<<<<<<<<<<<<< - * data[i*n*3+j*3+k] = data[(i-1)*n*3+j*3+k] + d + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." * */ - (__pyx_v_data_tmp[((__pyx_v_j * 3) + __pyx_v_k)]) = (__pyx_v_data[((((__pyx_v_i * __pyx_v_n) * 3) + (__pyx_v_j * 3)) + __pyx_v_k)]); + } - /* "src/helpers/diffusion.pyx":46 - * d-=boxl - * data_tmp[j*3+k] = data[i*n*3+j*3+k] - * data[i*n*3+j*3+k] = data[(i-1)*n*3+j*3+k] + d # <<<<<<<<<<<<<< + /* "View.MemoryView":159 * - * return xyz + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + */ + __pyx_t_7 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(1, 159, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_7; + __pyx_t_7 = (__pyx_t_7 + 1); + + /* "View.MemoryView":160 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim + */ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":161 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim + * + */ + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = 0; + __pyx_t_10 = 127; + __Pyx_INCREF(__pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_9 += 22; + __Pyx_GIVEREF(__pyx_kp_u_Invalid_shape_in_axis); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u_); + __pyx_t_9 += 2; + __Pyx_GIVEREF(__pyx_kp_u_); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_); + __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u__2); + __pyx_t_9 += 1; + __Pyx_GIVEREF(__pyx_kp_u__2); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2); + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 161, __pyx_L1_error) + + /* "View.MemoryView":160 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim */ - (__pyx_v_data[((((__pyx_v_i * __pyx_v_n) * 3) + (__pyx_v_j * 3)) + __pyx_v_k)]) = ((__pyx_v_data[(((((__pyx_v_i - 1) * __pyx_v_n) * 3) + (__pyx_v_j * 3)) + __pyx_v_k)]) + __pyx_v_d); - } } + + /* "View.MemoryView":162 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order + */ + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + + /* "View.MemoryView":159 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + */ } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/diffusion.pyx":48 - * data[i*n*3+j*3+k] = data[(i-1)*n*3+j*3+k] + d + /* "View.MemoryView":165 * - * return xyz # <<<<<<<<<<<<<< + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' + */ + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 165, __pyx_L1_error) + if (__pyx_t_3) { + + /* "View.MemoryView":166 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': + */ + __pyx_v_order = 'C'; + + /* "View.MemoryView":167 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' + */ + __Pyx_INCREF(__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_c; + + /* "View.MemoryView":165 * - * @cython.boundscheck(False) + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_xyz)); - __pyx_r = ((PyObject *)__pyx_v_xyz); - goto __pyx_L0; + goto __pyx_L11; + } - /* "src/helpers/diffusion.pyx":12 - * from libc.math cimport fabs, sqrt, floor, pow + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' + */ + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 168, __pyx_L1_error) + if (likely(__pyx_t_3)) { + + /* "View.MemoryView":169 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: + */ + __pyx_v_order = 'F'; + + /* "View.MemoryView":170 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + */ + __Pyx_INCREF(__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_fortran; + + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' + */ + goto __pyx_L11; + } + + /* "View.MemoryView":172 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 172, __pyx_L1_error) + } + __pyx_L11:; + + /* "View.MemoryView":174 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer + */ + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + + /* "View.MemoryView":176 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * + */ + __pyx_v_self->free_data = __pyx_v_allocate_buffer; + + /* "View.MemoryView":177 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: + */ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 177, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; + + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * + */ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":180 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') + */ + __pyx_t_7 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 180, __pyx_L1_error) + + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * + */ + } + + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): * - * def unfoldTraj(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * boxlength): - * """ */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.diffusion.unfoldTraj", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_xyz_tmp); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_format); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/diffusion.pyx":51 +/* "View.MemoryView":182 + * _allocate_buffer(self) * - * @cython.boundscheck(False) - * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * maxlen=None, vh_maxdist=200.0): - * """ + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9diffusion_3msdCOMvHnG(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9diffusion_2msdCOMvHnG[] = "\n msdCOMvHnG(xyz, maxlen=None, vh_maxdist=200.0)\n\n This function calculates the single-particle mean square displacement, the van Hove function and the non-Gaussian parameter \n simultaneously.\n\n Args:\n xyz .. unfolded centers of mass of a whole trajectory, as yielded from unfoldTraj()\n maxlen .. maximum length of the sliding window\n vh_maxdist .. maximum distance to consider for the van Hove function\n\n Usage:\n msd, van_hove, non_gaussian = msdCOMvHnG(xyz)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_3msdCOMvHnG = {"msdCOMvHnG", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9diffusion_3msdCOMvHnG, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_2msdCOMvHnG}; -static PyObject *__pyx_pw_11newanalysis_9diffusion_3msdCOMvHnG(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_xyz = 0; - PyObject *__pyx_v_maxlen = 0; - PyObject *__pyx_v_vh_maxdist = 0; +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("msdCOMvHnG (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_maxlen,&__pyx_n_s_vh_maxdist,0}; - PyObject* values[3] = {0,0,0}; - - /* "src/helpers/diffusion.pyx":52 - * @cython.boundscheck(False) - * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, - * maxlen=None, vh_maxdist=200.0): # <<<<<<<<<<<<<< - * """ - * msdCOMvHnG(xyz, maxlen=None, vh_maxdist=200.0) + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":184 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": */ - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)__pyx_float_200_0); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[1] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vh_maxdist); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msdCOMvHnG") < 0)) __PYX_ERR(0, 51, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + __pyx_v_bufmode = -1; + + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + */ + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + */ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":187 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + */ + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + */ + goto __pyx_L4; } - __pyx_v_xyz = ((PyArrayObject *)values[0]); - __pyx_v_maxlen = values[1]; - __pyx_v_vh_maxdist = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("msdCOMvHnG", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 51, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.diffusion.msdCOMvHnG", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 51, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9diffusion_2msdCOMvHnG(__pyx_self, __pyx_v_xyz, __pyx_v_maxlen, __pyx_v_vh_maxdist); - /* "src/helpers/diffusion.pyx":51 - * - * @cython.boundscheck(False) - * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * maxlen=None, vh_maxdist=200.0): - * """ + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): */ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 188, __pyx_L1_error) + if (__pyx_t_1) { - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":189 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + */ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); -static PyObject *__pyx_pf_11newanalysis_9diffusion_2msdCOMvHnG(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_vh_maxdist) { - double __pyx_v_result; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_res2; - int __pyx_v_n1; - int __pyx_v_n2; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_m; - int __pyx_v_pos; - int __pyx_v_idx1; - int __pyx_v_idx2; - int __pyx_v_vhmax; - PyArrayObject *__pyx_v_msd = 0; - double *__pyx_v_msd_data; - double *__pyx_v_data; - PyArrayObject *__pyx_v_van_hove = 0; - double *__pyx_v_vh; - PyArrayObject *__pyx_v_non_gaussian = 0; - double *__pyx_v_ng; - PyArrayObject *__pyx_v_ctr = 0; - int *__pyx_v_c; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_msd; - __Pyx_Buffer __pyx_pybuffer_msd; - __Pyx_LocalBuf_ND __pyx_pybuffernd_non_gaussian; - __Pyx_Buffer __pyx_pybuffer_non_gaussian; - __Pyx_LocalBuf_ND __pyx_pybuffernd_van_hove; - __Pyx_Buffer __pyx_pybuffer_van_hove; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; - __Pyx_Buffer __pyx_pybuffer_xyz; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - double __pyx_t_24; - double __pyx_t_25; - __pyx_t_5numpy_float64_t __pyx_t_26; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("msdCOMvHnG", 0); - __pyx_pybuffer_msd.pybuffer.buf = NULL; - __pyx_pybuffer_msd.refcount = 0; - __pyx_pybuffernd_msd.data = NULL; - __pyx_pybuffernd_msd.rcbuffer = &__pyx_pybuffer_msd; - __pyx_pybuffer_van_hove.pybuffer.buf = NULL; - __pyx_pybuffer_van_hove.refcount = 0; - __pyx_pybuffernd_van_hove.data = NULL; - __pyx_pybuffernd_van_hove.rcbuffer = &__pyx_pybuffer_van_hove; - __pyx_pybuffer_non_gaussian.pybuffer.buf = NULL; - __pyx_pybuffer_non_gaussian.refcount = 0; - __pyx_pybuffernd_non_gaussian.data = NULL; - __pyx_pybuffernd_non_gaussian.rcbuffer = &__pyx_pybuffer_non_gaussian; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_xyz.refcount = 0; - __pyx_pybuffernd_xyz.data = NULL; - __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 51, __pyx_L1_error) - } - __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz.diminfo[2].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz.diminfo[2].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[2]; + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + */ + } + __pyx_L4:; - /* "src/helpers/diffusion.pyx":68 - * """ - * cdef double tmp, result, dx, dy, dz, res2 - * cdef int n1, n2, i, j, k, m, pos, idx1, idx2, vhmax = vh_maxdist*10 # <<<<<<<<<<<<<< - * - * n1 = len(xyz) + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data */ - __pyx_t_1 = PyNumber_Multiply(__pyx_v_vh_maxdist, __pyx_int_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_vhmax = __pyx_t_2; + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/diffusion.pyx":70 - * cdef int n1, n2, i, j, k, m, pos, idx1, idx2, vhmax = vh_maxdist*10 - * - * n1 = len(xyz) # <<<<<<<<<<<<<< - * n2 = len(xyz[0]) - * + /* "View.MemoryView":191 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len */ - __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 70, __pyx_L1_error) - __pyx_v_n1 = __pyx_t_3; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 191, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":71 - * - * n1 = len(xyz) - * n2 = len(xyz[0]) # <<<<<<<<<<<<<< - * - * if maxlen == None: + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data */ - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_n2 = __pyx_t_3; + } - /* "src/helpers/diffusion.pyx":73 - * n2 = len(xyz[0]) - * - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { + } - /* "src/helpers/diffusion.pyx":74 + /* "View.MemoryView":192 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len * - * if maxlen == None: - * m = n1 # <<<<<<<<<<<<<< - * else: - * m = maxlen */ - __pyx_v_m = __pyx_v_n1; + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; - /* "src/helpers/diffusion.pyx":73 - * n2 = len(xyz[0]) + /* "View.MemoryView":193 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< * - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: + * if flags & PyBUF_STRIDES: */ - goto __pyx_L3; - } + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; - /* "src/helpers/diffusion.pyx":76 - * m = n1 - * else: - * m = maxlen # <<<<<<<<<<<<<< + /* "View.MemoryView":195 + * info.len = self.len * - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape */ - /*else*/ { - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 76, __pyx_L1_error) - __pyx_v_m = ((int)__pyx_t_2); - } - __pyx_L3:; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":78 - * m = maxlen - * - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double* msd_data = msd.data + /* "View.MemoryView":196 * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 78, __pyx_L1_error) - __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_msd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 78, __pyx_L1_error) - } else {__pyx_pybuffernd_msd.diminfo[0].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msd.diminfo[0].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_9 = 0; - __pyx_v_msd = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; - /* "src/helpers/diffusion.pyx":79 - * - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) - * cdef double* msd_data = msd.data # <<<<<<<<<<<<<< - * - * cdef double *data = xyz.data + /* "View.MemoryView":197 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: */ - __pyx_v_msd_data = ((double *)__pyx_v_msd->data); + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; - /* "src/helpers/diffusion.pyx":81 - * cdef double* msd_data = msd.data - * - * cdef double *data = xyz.data # <<<<<<<<<<<<<< - * - * cdef np.ndarray[np.float64_t,ndim=2] van_hove = np.zeros((m,vhmax),dtype=np.float64) + /* "View.MemoryView":198 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 */ - __pyx_v_data = ((double *)__pyx_v_xyz->data); + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; - /* "src/helpers/diffusion.pyx":83 - * cdef double *data = xyz.data - * - * cdef np.ndarray[np.float64_t,ndim=2] van_hove = np.zeros((m,vhmax),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *vh = van_hove.data + /* "View.MemoryView":195 + * info.len = self.len * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_vhmax); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __pyx_t_8 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 83, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_7); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_van_hove.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_van_hove = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_van_hove.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 83, __pyx_L1_error) - } else {__pyx_pybuffernd_van_hove.diminfo[0].strides = __pyx_pybuffernd_van_hove.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_van_hove.diminfo[0].shape = __pyx_pybuffernd_van_hove.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_van_hove.diminfo[1].strides = __pyx_pybuffernd_van_hove.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_van_hove.diminfo[1].shape = __pyx_pybuffernd_van_hove.rcbuffer->pybuffer.shape[1]; - } + goto __pyx_L6; } - __pyx_t_10 = 0; - __pyx_v_van_hove = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; - /* "src/helpers/diffusion.pyx":84 - * - * cdef np.ndarray[np.float64_t,ndim=2] van_hove = np.zeros((m,vhmax),dtype=np.float64) - * cdef double *vh = van_hove.data # <<<<<<<<<<<<<< - * - * cdef np.ndarray[np.float64_t,ndim=1] non_gaussian = np.zeros(m,dtype=np.float64) + /* "View.MemoryView":200 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL */ - __pyx_v_vh = ((double *)__pyx_v_van_hove->data); + /*else*/ { + __pyx_v_info->ndim = 1; - /* "src/helpers/diffusion.pyx":86 - * cdef double *vh = van_hove.data - * - * cdef np.ndarray[np.float64_t,ndim=1] non_gaussian = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *ng = non_gaussian.data + /* "View.MemoryView":201 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL * */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 86, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_non_gaussian = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 86, __pyx_L1_error) - } else {__pyx_pybuffernd_non_gaussian.diminfo[0].strides = __pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_non_gaussian.diminfo[0].shape = __pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer.shape[0]; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; } - } - __pyx_t_11 = 0; - __pyx_v_non_gaussian = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; + __pyx_v_info->shape = __pyx_t_5; - /* "src/helpers/diffusion.pyx":87 + /* "View.MemoryView":202 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< * - * cdef np.ndarray[np.float64_t,ndim=1] non_gaussian = np.zeros(m,dtype=np.float64) - * cdef double *ng = non_gaussian.data # <<<<<<<<<<<<<< + * info.suboffsets = NULL + */ + __pyx_v_info->strides = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":204 + * info.strides = NULL * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 */ - __pyx_v_ng = ((double *)__pyx_v_non_gaussian->data); + __pyx_v_info->suboffsets = NULL; - /* "src/helpers/diffusion.pyx":89 - * cdef double *ng = non_gaussian.data + /* "View.MemoryView":205 * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< - * cdef int *c = ctr.data + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + */ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":206 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self + */ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":207 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self * */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 89, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_1); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 89, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; - } + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; } - __pyx_t_12 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_info->format = __pyx_t_2; - /* "src/helpers/diffusion.pyx":90 - * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) - * cdef int *c = ctr.data # <<<<<<<<<<<<<< + /* "View.MemoryView":208 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< * - * # loop over all delta t + * def __dealloc__(array self): */ - __pyx_v_c = ((int *)__pyx_v_ctr->data); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "src/helpers/diffusion.pyx":93 + /* "View.MemoryView":182 + * _allocate_buffer(self) * - * # loop over all delta t - * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< - * # loop over all possible interval start points - * for j in range(n1-i): + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_2 = __pyx_v_m; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_14 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_14 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_4) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_idx1) lastprivate(__pyx_v_idx2) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_pos) lastprivate(__pyx_v_res2) lastprivate(__pyx_v_result) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_idx1 = ((int)0xbad0bad0); - __pyx_v_idx2 = ((int)0xbad0bad0); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); - __pyx_v_pos = ((int)0xbad0bad0); - __pyx_v_res2 = ((double)__PYX_NAN()); - __pyx_v_result = ((double)__PYX_NAN()); - /* "src/helpers/diffusion.pyx":95 - * for i in prange(m,nogil=True,schedule=guided): - * # loop over all possible interval start points - * for j in range(n1-i): # <<<<<<<<<<<<<< - * # loop over residues - * for k in range(n2): - */ - __pyx_t_15 = (__pyx_v_n1 - __pyx_v_i); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":97 - * for j in range(n1-i): - * # loop over residues - * for k in range(n2): # <<<<<<<<<<<<<< - * idx1 = j*n2*3+3*k - * idx2 = (j+i)*n2*3+3*k +/* "View.MemoryView":210 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ - __pyx_t_18 = __pyx_v_n2; - __pyx_t_19 = __pyx_t_18; - for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { - __pyx_v_k = __pyx_t_20; - /* "src/helpers/diffusion.pyx":98 - * # loop over residues - * for k in range(n2): - * idx1 = j*n2*3+3*k # <<<<<<<<<<<<<< - * idx2 = (j+i)*n2*3+3*k - * dx = data[idx1] - data[idx2] - */ - __pyx_v_idx1 = (((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k)); +/* Python wrapper */ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); - /* "src/helpers/diffusion.pyx":99 - * for k in range(n2): - * idx1 = j*n2*3+3*k - * idx2 = (j+i)*n2*3+3*k # <<<<<<<<<<<<<< - * dx = data[idx1] - data[idx2] - * dy = data[idx1+1] - data[idx2+1] - */ - __pyx_v_idx2 = ((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k)); + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} - /* "src/helpers/diffusion.pyx":100 - * idx1 = j*n2*3+3*k - * idx2 = (j+i)*n2*3+3*k - * dx = data[idx1] - data[idx2] # <<<<<<<<<<<<<< - * dy = data[idx1+1] - data[idx2+1] - * dz = data[idx1+2] - data[idx2+2] - */ - __pyx_v_dx = ((__pyx_v_data[__pyx_v_idx1]) - (__pyx_v_data[__pyx_v_idx2])); +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "src/helpers/diffusion.pyx":101 - * idx2 = (j+i)*n2*3+3*k - * dx = data[idx1] - data[idx2] - * dy = data[idx1+1] - data[idx2+1] # <<<<<<<<<<<<<< - * dz = data[idx1+2] - data[idx2+2] - * result = dx*dx+dy*dy+dz*dz + /* "View.MemoryView":211 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - __pyx_v_dy = ((__pyx_v_data[(__pyx_v_idx1 + 1)]) - (__pyx_v_data[(__pyx_v_idx2 + 1)])); + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":102 - * dx = data[idx1] - data[idx2] - * dy = data[idx1+1] - data[idx2+1] - * dz = data[idx1+2] - data[idx2+2] # <<<<<<<<<<<<<< - * result = dx*dx+dy*dy+dz*dz - * res2 = result*result + /* "View.MemoryView":212 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: */ - __pyx_v_dz = ((__pyx_v_data[(__pyx_v_idx1 + 2)]) - (__pyx_v_data[(__pyx_v_idx2 + 2)])); + __pyx_v_self->callback_free_data(__pyx_v_self->data); - /* "src/helpers/diffusion.pyx":103 - * dy = data[idx1+1] - data[idx2+1] - * dz = data[idx1+2] - data[idx2+2] - * result = dx*dx+dy*dy+dz*dz # <<<<<<<<<<<<<< - * res2 = result*result - * pos= floor(sqrt(result)*10.0) + /* "View.MemoryView":211 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); + goto __pyx_L3; + } - /* "src/helpers/diffusion.pyx":104 - * dz = data[idx1+2] - data[idx2+2] - * result = dx*dx+dy*dy+dz*dz - * res2 = result*result # <<<<<<<<<<<<<< - * pos= floor(sqrt(result)*10.0) - * if posfree_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":105 - * result = dx*dx+dy*dy+dz*dz - * res2 = result*result - * pos= floor(sqrt(result)*10.0) # <<<<<<<<<<<<<< - * if posdtype_is_object) { - /* "src/helpers/diffusion.pyx":106 - * res2 = result*result - * pos= floor(sqrt(result)*10.0) - * if posdata, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); - /* "src/helpers/diffusion.pyx":107 - * pos= floor(sqrt(result)*10.0) - * if pos floor(sqrt(result)*10.0) - * if posdata); - /* "src/helpers/diffusion.pyx":108 - * if pos_shape); - /* "src/helpers/diffusion.pyx":110 - * msd_data[i]+=result - * ng[i]+=res2 - * c[i]+=1 # <<<<<<<<<<<<<< + /* "View.MemoryView":210 + * info.obj = self * - * for i in range(m): + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ - __pyx_t_21 = __pyx_v_i; - (__pyx_v_c[__pyx_t_21]) = ((__pyx_v_c[__pyx_t_21]) + 1); - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/helpers/diffusion.pyx":93 + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "View.MemoryView":219 + * PyObject_Free(self._shape) * - * # loop over all delta t - * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< - * # loop over all possible interval start points - * for j in range(n1-i): + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } - /* "src/helpers/diffusion.pyx":112 - * c[i]+=1 - * - * for i in range(m): # <<<<<<<<<<<<<< - * msd[i] /= ctr[i] - * van_hove[i] /= ctr[i] - */ - __pyx_t_14 = __pyx_v_m; - __pyx_t_13 = __pyx_t_14; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_13; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); - /* "src/helpers/diffusion.pyx":113 - * - * for i in range(m): - * msd[i] /= ctr[i] # <<<<<<<<<<<<<< - * van_hove[i] /= ctr[i] - * if floor(msd[i]) != 0: - */ - __pyx_t_22 = __pyx_v_i; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_ctr.diminfo[0].shape; - __pyx_t_23 = __pyx_v_i; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_msd.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_msd.diminfo[0].strides) /= ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_ctr.diminfo[0].strides))); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":114 - * for i in range(m): - * msd[i] /= ctr[i] - * van_hove[i] /= ctr[i] # <<<<<<<<<<<<<< - * if floor(msd[i]) != 0: - * ng[i] = 0.6 * (ng[i]/ctr[i]) / (msd[i]*msd[i]) - 1.0 - */ - __pyx_t_15 = __pyx_v_i; - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_van_hove), __pyx_t_15, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_22 = __pyx_v_i; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_ctr.diminfo[0].shape; - __pyx_t_8 = PyFloat_FromDouble(((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_ctr.diminfo[0].strides)))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_van_hove), __pyx_t_15, __pyx_t_6, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/diffusion.pyx":115 - * msd[i] /= ctr[i] - * van_hove[i] /= ctr[i] - * if floor(msd[i]) != 0: # <<<<<<<<<<<<<< - * ng[i] = 0.6 * (ng[i]/ctr[i]) / (msd[i]*msd[i]) - 1.0 + /* "View.MemoryView":221 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< * + * @cname('get_memview') */ - __pyx_t_22 = __pyx_v_i; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_msd.diminfo[0].shape; - __pyx_t_4 = ((floor((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_msd.diminfo[0].strides))) != 0.0) != 0); - if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":116 - * van_hove[i] /= ctr[i] - * if floor(msd[i]) != 0: - * ng[i] = 0.6 * (ng[i]/ctr[i]) / (msd[i]*msd[i]) - 1.0 # <<<<<<<<<<<<<< + /* "View.MemoryView":219 + * PyObject_Free(self._shape) * - * return msd, van_hove, non_gaussian + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() */ - __pyx_t_22 = __pyx_v_i; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_ctr.diminfo[0].shape; - __pyx_t_24 = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_ctr.diminfo[0].strides))); - if (unlikely(__pyx_t_24 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 116, __pyx_L1_error) - } - __pyx_t_25 = (0.6 * ((__pyx_v_ng[__pyx_v_i]) / __pyx_t_24)); - __pyx_t_22 = __pyx_v_i; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_msd.diminfo[0].shape; - __pyx_t_23 = __pyx_v_i; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_msd.diminfo[0].shape; - __pyx_t_26 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_msd.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_msd.diminfo[0].strides))); - if (unlikely(__pyx_t_26 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 116, __pyx_L1_error) - } - (__pyx_v_ng[__pyx_v_i]) = ((__pyx_t_25 / __pyx_t_26) - 1.0); - /* "src/helpers/diffusion.pyx":115 - * msd[i] /= ctr[i] - * van_hove[i] /= ctr[i] - * if floor(msd[i]) != 0: # <<<<<<<<<<<<<< - * ng[i] = 0.6 * (ng[i]/ctr[i]) / (msd[i]*msd[i]) - 1.0 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":224 * + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) */ - } - } - /* "src/helpers/diffusion.pyx":118 - * ng[i] = 0.6 * (ng[i]/ctr[i]) / (msd[i]*msd[i]) - 1.0 +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":225 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) * - * return msd, van_hove, non_gaussian # <<<<<<<<<<<<<< + */ + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + + /* "View.MemoryView":226 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * def __len__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(((PyObject *)__pyx_v_msd)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_msd)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_msd)); - __Pyx_INCREF(((PyObject *)__pyx_v_van_hove)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_van_hove)); - PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_van_hove)); - __Pyx_INCREF(((PyObject *)__pyx_v_non_gaussian)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_non_gaussian)); - PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_v_non_gaussian)); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "src/helpers/diffusion.pyx":51 + /* "View.MemoryView":224 * - * @cython.boundscheck(False) - * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * maxlen=None, vh_maxdist=200.0): - * """ + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_van_hove.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.diffusion.msdCOMvHnG", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_van_hove.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_msd); - __Pyx_XDECREF((PyObject *)__pyx_v_van_hove); - __Pyx_XDECREF((PyObject *)__pyx_v_non_gaussian); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/diffusion.pyx":121 +/* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * - * @cython.boundscheck(False) - * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * maxlen=None): - * """ */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9diffusion_5msdCOM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9diffusion_4msdCOM[] = "\n msdCOM(xyz, maxlen=None)\n\n This function takes as input a three-dimensional coordinate array of the molecular centers of mass of a whole unfolded trajectory \n [timestep, molecule, xyz]. The optional parameter maxlen can be set to limit the length of the resulting MSD. This can be useful\n when dealing with very long trajectories, e.g. maxlen=n/2.\n\n Usage:\n msd = msdCOM(xyz)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_5msdCOM = {"msdCOM", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9diffusion_5msdCOM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_4msdCOM}; -static PyObject *__pyx_pw_11newanalysis_9diffusion_5msdCOM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_xyz = 0; - PyObject *__pyx_v_maxlen = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("msdCOM (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_maxlen,0}; - PyObject* values[2] = {0,0}; - - /* "src/helpers/diffusion.pyx":122 - * @cython.boundscheck(False) - * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, - * maxlen=None): # <<<<<<<<<<<<<< - * """ - * msdCOM(xyz, maxlen=None) - */ - values[1] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msdCOM") < 0)) __PYX_ERR(0, 121, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_xyz = ((PyArrayObject *)values[0]); - __pyx_v_maxlen = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("msdCOM", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 121, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.diffusion.msdCOM", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 121, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9diffusion_4msdCOM(__pyx_self, __pyx_v_xyz, __pyx_v_maxlen); - - /* "src/helpers/diffusion.pyx":121 - * - * @cython.boundscheck(False) - * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * maxlen=None): - * """ - */ + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9diffusion_4msdCOM(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_maxlen) { - double __pyx_v_result; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - int __pyx_v_n1; - int __pyx_v_n2; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_m; - PyArrayObject *__pyx_v_msd = 0; - double *__pyx_v_msd_data; - double *__pyx_v_data; - PyArrayObject *__pyx_v_ctr = 0; - int *__pyx_v_c; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_msd; - __Pyx_Buffer __pyx_pybuffer_msd; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; - __Pyx_Buffer __pyx_pybuffer_xyz; - PyObject *__pyx_r = NULL; +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("msdCOM", 0); - __pyx_pybuffer_msd.pybuffer.buf = NULL; - __pyx_pybuffer_msd.refcount = 0; - __pyx_pybuffernd_msd.data = NULL; - __pyx_pybuffernd_msd.rcbuffer = &__pyx_pybuffer_msd; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_xyz.refcount = 0; - __pyx_pybuffernd_xyz.data = NULL; - __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 121, __pyx_L1_error) - } - __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz.diminfo[2].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz.diminfo[2].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[2]; + __Pyx_RefNannySetupContext("__len__", 0); - /* "src/helpers/diffusion.pyx":136 - * cdef int n1, n2, i, j, k, m, pos + /* "View.MemoryView":229 * - * n1 = len(xyz) # <<<<<<<<<<<<<< - * n2 = len(xyz[0]) + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< * + * def __getattr__(self, attr): */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 136, __pyx_L1_error) - __pyx_v_n1 = __pyx_t_1; + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":137 + /* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) * - * n1 = len(xyz) - * n2 = len(xyz[0]) # <<<<<<<<<<<<<< + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * - * if maxlen == None: */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n2 = __pyx_t_1; - /* "src/helpers/diffusion.pyx":139 - * n2 = len(xyz[0]) - * - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":140 +/* "View.MemoryView":231 + * return self._shape[0] * - * if maxlen == None: - * m = n1 # <<<<<<<<<<<<<< - * else: - * m = maxlen - */ - __pyx_v_m = __pyx_v_n1; - - /* "src/helpers/diffusion.pyx":139 - * n2 = len(xyz[0]) + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: */ - goto __pyx_L3; - } - /* "src/helpers/diffusion.pyx":142 - * m = n1 - * else: - * m = maxlen # <<<<<<<<<<<<<< - * - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error) - __pyx_v_m = ((int)__pyx_t_4); - } - __pyx_L3:; +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); - /* "src/helpers/diffusion.pyx":144 - * m = maxlen + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "View.MemoryView":232 * - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double* msd_data = msd.data + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< * + * def __getitem__(self, item): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 144, __pyx_L1_error) - __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_msd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 144, __pyx_L1_error) - } else {__pyx_pybuffernd_msd.diminfo[0].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msd.diminfo[0].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_9 = 0; - __pyx_v_msd = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":145 + /* "View.MemoryView":231 + * return self._shape[0] * - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) - * cdef double* msd_data = msd.data # <<<<<<<<<<<<<< + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * - * cdef double *data = xyz.data */ - __pyx_v_msd_data = ((double *)__pyx_v_msd->data); - /* "src/helpers/diffusion.pyx":147 - * cdef double* msd_data = msd.data + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":234 + * return getattr(self.memview, attr) * - * cdef double *data = xyz.data # <<<<<<<<<<<<<< + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) */ - __pyx_v_data = ((double *)__pyx_v_xyz->data); - /* "src/helpers/diffusion.pyx":149 - * cdef double *data = xyz.data +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":235 * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< - * cdef int *c = ctr.data + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< * + * def __setitem__(self, item, value): */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 149, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_7); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 149, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_10 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":150 - * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) - * cdef int *c = ctr.data # <<<<<<<<<<<<<< + /* "View.MemoryView":234 + * return getattr(self.memview, attr) * - * # loop over all delta t - */ - __pyx_v_c = ((int *)__pyx_v_ctr->data); - - /* "src/helpers/diffusion.pyx":153 + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] * - * # loop over all delta t - * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< - * # loop over all possible interval start points - * for j in range(n1-i): - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_m; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_12 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_12 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_result) - #endif /* _OPENMP */ - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_11); - /* Initialize private variables to invalid values */ - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); - __pyx_v_result = ((double)__PYX_NAN()); - - /* "src/helpers/diffusion.pyx":155 - * for i in prange(m,nogil=True,schedule=guided): - * # loop over all possible interval start points - * for j in range(n1-i): # <<<<<<<<<<<<<< - * # loop over residues - * for k in range(n2): - */ - __pyx_t_13 = (__pyx_v_n1 - __pyx_v_i); - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_j = __pyx_t_15; - - /* "src/helpers/diffusion.pyx":157 - * for j in range(n1-i): - * # loop over residues - * for k in range(n2): # <<<<<<<<<<<<<< - * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] - * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] - */ - __pyx_t_16 = __pyx_v_n2; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_k = __pyx_t_18; - - /* "src/helpers/diffusion.pyx":158 - * # loop over residues - * for k in range(n2): - * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] # <<<<<<<<<<<<<< - * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] - * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] */ - __pyx_v_dx = ((__pyx_v_data[(((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k))]) - (__pyx_v_data[((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k))])); - /* "src/helpers/diffusion.pyx":159 - * for k in range(n2): - * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] - * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] # <<<<<<<<<<<<<< - * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] - * result = dx*dx+dy*dy+dz*dz - */ - __pyx_v_dy = ((__pyx_v_data[((((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 1)]) - (__pyx_v_data[(((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 1)])); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":160 - * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] - * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] - * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] # <<<<<<<<<<<<<< - * result = dx*dx+dy*dy+dz*dz - * msd_data[i] += result +/* "View.MemoryView":237 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * */ - __pyx_v_dz = ((__pyx_v_data[((((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 2)]) - (__pyx_v_data[(((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 2)])); - /* "src/helpers/diffusion.pyx":161 - * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] - * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] - * result = dx*dx+dy*dy+dz*dz # <<<<<<<<<<<<<< - * msd_data[i] += result - * c[i]+=1 - */ - __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); - /* "src/helpers/diffusion.pyx":162 - * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] - * result = dx*dx+dy*dy+dz*dz - * msd_data[i] += result # <<<<<<<<<<<<<< - * c[i]+=1 - * - */ - __pyx_t_19 = __pyx_v_i; - (__pyx_v_msd_data[__pyx_t_19]) = ((__pyx_v_msd_data[__pyx_t_19]) + __pyx_v_result); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":163 - * result = dx*dx+dy*dy+dz*dz - * msd_data[i] += result - * c[i]+=1 # <<<<<<<<<<<<<< - * - * for i in range(m): - */ - __pyx_t_19 = __pyx_v_i; - (__pyx_v_c[__pyx_t_19]) = ((__pyx_v_c[__pyx_t_19]) + 1); - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); - /* "src/helpers/diffusion.pyx":153 + /* "View.MemoryView":238 * - * # loop over all delta t - * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< - * # loop over all possible interval start points - * for j in range(n1-i): - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } - - /* "src/helpers/diffusion.pyx":165 - * c[i]+=1 + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< * - * for i in range(m): # <<<<<<<<<<<<<< - * msd[i] /= ctr[i] * */ - __pyx_t_12 = __pyx_v_m; - __pyx_t_11 = __pyx_t_12; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_11; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/diffusion.pyx":166 + /* "View.MemoryView":237 + * return self.memview[item] * - * for i in range(m): - * msd[i] /= ctr[i] # <<<<<<<<<<<<<< + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value * - * return msd */ - __pyx_t_20 = __pyx_v_i; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_pybuffernd_ctr.diminfo[0].shape; - __pyx_t_21 = __pyx_v_i; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_pybuffernd_msd.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_msd.diminfo[0].strides) /= ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_ctr.diminfo[0].strides))); - } - /* "src/helpers/diffusion.pyx":168 - * msd[i] /= ctr[i] - * - * return msd # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_msd)); - __pyx_r = ((PyObject *)__pyx_v_msd); + /* function exit code */ + __pyx_r = 0; goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":121 - * - * @cython.boundscheck(False) - * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * maxlen=None): - * """ +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.diffusion.msdCOM", __pyx_clineno, __pyx_lineno, __pyx_filename); +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_msd); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/diffusion.pyx":171 - * - * @cython.boundscheck(False) - * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] xyz2, - * maxlen=None): +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9diffusion_7pairDisplacement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9diffusion_6pairDisplacement[] = "\n pairDisplacement(xyz1, xyz2, maxlen=None)\n\n Takes two unfolded center of mass coordinate sets. maxlen can be set to cap the length of the pair displacement.\n\n Usage:\n pair_displacement = pairDisplacement(xyz1, xyz2)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_7pairDisplacement = {"pairDisplacement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9diffusion_7pairDisplacement, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_6pairDisplacement}; -static PyObject *__pyx_pw_11newanalysis_9diffusion_7pairDisplacement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_xyz = 0; - PyArrayObject *__pyx_v_xyz2 = 0; - PyObject *__pyx_v_maxlen = 0; +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pairDisplacement (wrapper)", 0); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_xyz2,&__pyx_n_s_maxlen,0}; - PyObject* values[3] = {0,0,0}; - - /* "src/helpers/diffusion.pyx":173 - * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, - * np.ndarray[np.float64_t,ndim=3] xyz2, - * maxlen=None): # <<<<<<<<<<<<<< - * """ - * pairDisplacement(xyz1, xyz2, maxlen=None) - */ - values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("pairDisplacement", 0, 2, 3, 1); __PYX_ERR(0, 171, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[2] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pairDisplacement") < 0)) __PYX_ERR(0, 171, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_xyz = ((PyArrayObject *)values[0]); - __pyx_v_xyz2 = ((PyArrayObject *)values[1]); - __pyx_v_maxlen = values[2]; + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("pairDisplacement", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 171, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.diffusion.pairDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 171, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz2), __pyx_ptype_5numpy_ndarray, 1, "xyz2", 0))) __PYX_ERR(0, 172, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9diffusion_6pairDisplacement(__pyx_self, __pyx_v_xyz, __pyx_v_xyz2, __pyx_v_maxlen); + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state); - /* "src/helpers/diffusion.pyx":171 - * - * @cython.boundscheck(False) - * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] xyz2, - * maxlen=None): + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9diffusion_6pairDisplacement(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_xyz2, PyObject *__pyx_v_maxlen) { - double __pyx_v_result; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_dx2; - double __pyx_v_dy2; - double __pyx_v_dz2; - double __pyx_v_dx3; - double __pyx_v_dy3; - double __pyx_v_dz3; - int __pyx_v_n1; - int __pyx_v_n2; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_l; - int __pyx_v_irel; - int __pyx_v_m; - int __pyx_v_nstep; - int __pyx_v_idx1; - int __pyx_v_idx2; - int __pyx_v_idx3; - int __pyx_v_idx4; - int __pyx_v_diag; - PyArrayObject *__pyx_v_msd = 0; - double *__pyx_v_msd_data; - double *__pyx_v_data; - double *__pyx_v_data2; - PyArrayObject *__pyx_v_ctr = 0; - int *__pyx_v_c; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_msd; - __Pyx_Buffer __pyx_pybuffer_msd; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; - __Pyx_Buffer __pyx_pybuffer_xyz; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz2; - __Pyx_Buffer __pyx_pybuffer_xyz2; - PyObject *__pyx_r = NULL; +/* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * + * + */ + +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyObject *(*__pyx_t_12)(PyObject *); - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pairDisplacement", 0); - __pyx_pybuffer_msd.pybuffer.buf = NULL; - __pyx_pybuffer_msd.refcount = 0; - __pyx_pybuffernd_msd.data = NULL; - __pyx_pybuffernd_msd.rcbuffer = &__pyx_pybuffer_msd; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_xyz.refcount = 0; - __pyx_pybuffernd_xyz.data = NULL; - __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; - __pyx_pybuffer_xyz2.pybuffer.buf = NULL; - __pyx_pybuffer_xyz2.refcount = 0; - __pyx_pybuffernd_xyz2.data = NULL; - __pyx_pybuffernd_xyz2.rcbuffer = &__pyx_pybuffer_xyz2; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 171, __pyx_L1_error) - } - __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz.diminfo[2].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz.diminfo[2].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz2.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 171, __pyx_L1_error) - } - __pyx_pybuffernd_xyz2.diminfo[0].strides = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz2.diminfo[0].shape = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz2.diminfo[1].strides = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz2.diminfo[1].shape = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz2.diminfo[2].strides = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz2.diminfo[2].shape = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.shape[2]; + __Pyx_RefNannySetupContext("_allocate_buffer", 0); - /* "src/helpers/diffusion.pyx":185 - * cdef int n1, n2, i, j, k, l, irel, m, nstep, idx1, idx2, idx3, idx4 - * - * n1 = len(xyz) # <<<<<<<<<<<<<< - * n2 = len(xyz[0]) + /* "View.MemoryView":254 + * cdef PyObject **p * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 185, __pyx_L1_error) - __pyx_v_n1 = __pyx_t_1; + __pyx_v_self->free_data = 1; - /* "src/helpers/diffusion.pyx":186 + /* "View.MemoryView":255 * - * n1 = len(xyz) - * n2 = len(xyz[0]) # <<<<<<<<<<<<<< + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." + */ + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." * - * if maxlen == None: */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n2 = __pyx_t_1; + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/diffusion.pyx":188 - * n2 = len(xyz[0]) + /* "View.MemoryView":257 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< * - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: + * if self.dtype_is_object: */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 257, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":189 + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." * - * if maxlen == None: - * m = n1 # <<<<<<<<<<<<<< - * else: - * m = maxlen */ - __pyx_v_m = __pyx_v_n1; + } - /* "src/helpers/diffusion.pyx":188 - * n2 = len(xyz[0]) + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." * - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - goto __pyx_L3; - } + if (__pyx_v_self->dtype_is_object) { - /* "src/helpers/diffusion.pyx":191 - * m = n1 - * else: - * m = maxlen # <<<<<<<<<<<<<< + /* "View.MemoryView":260 * - * nstep= floor(m/10.) + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None */ - /*else*/ { - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error) - __pyx_v_m = ((int)__pyx_t_4); - } - __pyx_L3:; + __pyx_v_p = ((PyObject **)__pyx_v_self->data); - /* "src/helpers/diffusion.pyx":193 - * m = maxlen - * - * nstep= floor(m/10.) # <<<<<<<<<<<<<< - * - * cdef bint diag=True + /* "View.MemoryView":261 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) */ - __pyx_v_nstep = ((int)floor((__pyx_v_m / 10.))); + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/diffusion.pyx":195 - * nstep= floor(m/10.) - * - * cdef bint diag=True # <<<<<<<<<<<<<< - * if (xyz[0][0] == xyz2[0][0]).all() and (xyz[-1][0] == xyz2[-1][0]).all(): - * diag = False + /* "View.MemoryView":262 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 */ - __pyx_v_diag = 1; + (__pyx_v_p[__pyx_v_i]) = Py_None; - /* "src/helpers/diffusion.pyx":196 - * - * cdef bint diag=True - * if (xyz[0][0] == xyz2[0][0]).all() and (xyz[-1][0] == xyz2[-1][0]).all(): # <<<<<<<<<<<<<< - * diag = False + /* "View.MemoryView":263 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 * */ - __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz2), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_all); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_8) { - } else { - __pyx_t_3 = __pyx_t_8; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz2), -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_all); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + Py_INCREF(Py_None); } + + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): + */ } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __pyx_t_8; - __pyx_L5_bool_binop_done:; - if (__pyx_t_3) { - /* "src/helpers/diffusion.pyx":197 - * cdef bint diag=True - * if (xyz[0][0] == xyz2[0][0]).all() and (xyz[-1][0] == xyz2[-1][0]).all(): - * diag = False # <<<<<<<<<<<<<< + /* "View.MemoryView":264 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * * - * # msd contains pair cross term, msd2 contains pair self term */ - __pyx_v_diag = 0; + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":196 + /* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< * - * cdef bint diag=True - * if (xyz[0][0] == xyz2[0][0]).all() and (xyz[-1][0] == xyz2[-1][0]).all(): # <<<<<<<<<<<<<< - * diag = False * */ - } - /* "src/helpers/diffusion.pyx":200 + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":268 * - * # msd contains pair cross term, msd2 contains pair self term - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double* msd_data = msd.data - * cdef double *data = xyz.data + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 200, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msd.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_msd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 200, __pyx_L1_error) - } else {__pyx_pybuffernd_msd.diminfo[0].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msd.diminfo[0].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_10 = 0; - __pyx_v_msd = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; - /* "src/helpers/diffusion.pyx":201 - * # msd contains pair cross term, msd2 contains pair self term - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) - * cdef double* msd_data = msd.data # <<<<<<<<<<<<<< - * cdef double *data = xyz.data - * cdef double *data2 = xyz2.data +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":270 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: */ - __pyx_v_msd_data = ((double *)__pyx_v_msd->data); + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_n_s_fortran); + __pyx_t_1 = __pyx_n_s_fortran; + } else { + __Pyx_INCREF(__pyx_n_s_c); + __pyx_t_1 = __pyx_n_s_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/diffusion.pyx":202 - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) - * cdef double* msd_data = msd.data - * cdef double *data = xyz.data # <<<<<<<<<<<<<< - * cdef double *data2 = xyz2.data + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - __pyx_v_data = ((double *)__pyx_v_xyz->data); + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { - /* "src/helpers/diffusion.pyx":203 - * cdef double* msd_data = msd.data - * cdef double *data = xyz.data - * cdef double *data2 = xyz2.data # <<<<<<<<<<<<<< + /* "View.MemoryView":273 * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) */ - __pyx_v_data2 = ((double *)__pyx_v_xyz2->data); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/diffusion.pyx":205 - * cdef double *data2 = xyz2.data + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< - * cdef int *c = ctr.data + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + */ + goto __pyx_L3; + } + + /* "View.MemoryView":275 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 205, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 205, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; - } + /*else*/ { + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode)) __PYX_ERR(1, 275, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 275, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":276 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< + * + * return result + */ + __pyx_v_result->data = __pyx_v_buf; } - __pyx_t_11 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_L3:; - /* "src/helpers/diffusion.pyx":206 + /* "View.MemoryView":278 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) - * cdef int *c = ctr.data # <<<<<<<<<<<<<< * - * # loop over all starting points */ - __pyx_v_c = ((int *)__pyx_v_ctr->data); + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":209 + /* "View.MemoryView":268 * - * # loop over all starting points - * for j in range(0,n1-m,nstep): # <<<<<<<<<<<<<< - * idx1=j*n2*3 - * # loop over all delta t + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ - __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_n1 - __pyx_v_m)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_nstep); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_9); - __pyx_t_5 = 0; - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { - __pyx_t_7 = __pyx_t_9; __Pyx_INCREF(__pyx_t_7); __pyx_t_1 = 0; - __pyx_t_12 = NULL; - } else { - __pyx_t_1 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_12 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 209, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - for (;;) { - if (likely(!__pyx_t_12)) { - if (likely(PyList_CheckExact(__pyx_t_7))) { - if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_7)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_1); __Pyx_INCREF(__pyx_t_9); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 209, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } else { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_7)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_1); __Pyx_INCREF(__pyx_t_9); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 209, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): + */ + +/* Python wrapper */ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 304, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } else { - __pyx_t_9 = __pyx_t_12(__pyx_t_7); - if (unlikely(!__pyx_t_9)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 209, __pyx_L1_error) + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; } - break; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } - __Pyx_GOTREF(__pyx_t_9); + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 304, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_j = __pyx_t_4; + __pyx_v_name = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 304, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); - /* "src/helpers/diffusion.pyx":210 - * # loop over all starting points - * for j in range(0,n1-m,nstep): - * idx1=j*n2*3 # <<<<<<<<<<<<<< - * # loop over all delta t - * for i in prange(j,j+m,nogil=True,schedule=guided): - */ - __pyx_v_idx1 = ((__pyx_v_j * __pyx_v_n2) * 3); + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":212 - * idx1=j*n2*3 - * # loop over all delta t - * for i in prange(j,j+m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< - * idx2=i*n2*3 - * irel=i-j +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "View.MemoryView":305 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_j; - __pyx_t_13 = (__pyx_v_j + __pyx_v_m); - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_15 = (__pyx_t_13 - __pyx_t_4 + 1 - 1/abs(1)) / 1; - if (__pyx_t_15 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_3, __pyx_t_8) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dx2) lastprivate(__pyx_v_dx3) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dy2) lastprivate(__pyx_v_dy3) lastprivate(__pyx_v_dz) lastprivate(__pyx_v_dz2) lastprivate(__pyx_v_dz3) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_idx2) lastprivate(__pyx_v_idx3) lastprivate(__pyx_v_idx4) lastprivate(__pyx_v_irel) lastprivate(__pyx_v_k) lastprivate(__pyx_v_l) lastprivate(__pyx_v_result) - #endif /* _OPENMP */ - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){ - { - __pyx_v_i = (int)(__pyx_t_4 + 1 * __pyx_t_14); - /* Initialize private variables to invalid values */ - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dx2 = ((double)__PYX_NAN()); - __pyx_v_dx3 = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dy2 = ((double)__PYX_NAN()); - __pyx_v_dy3 = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_dz2 = ((double)__PYX_NAN()); - __pyx_v_dz3 = ((double)__PYX_NAN()); - __pyx_v_idx2 = ((int)0xbad0bad0); - __pyx_v_idx3 = ((int)0xbad0bad0); - __pyx_v_idx4 = ((int)0xbad0bad0); - __pyx_v_irel = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); - __pyx_v_l = ((int)0xbad0bad0); - __pyx_v_result = ((double)__PYX_NAN()); + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; - /* "src/helpers/diffusion.pyx":213 - * # loop over all delta t - * for i in prange(j,j+m,nogil=True,schedule=guided): - * idx2=i*n2*3 # <<<<<<<<<<<<<< - * irel=i-j - * # loop over residues + /* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ - __pyx_v_idx2 = ((__pyx_v_i * __pyx_v_n2) * 3); - /* "src/helpers/diffusion.pyx":214 - * for i in prange(j,j+m,nogil=True,schedule=guided): - * idx2=i*n2*3 - * irel=i-j # <<<<<<<<<<<<<< - * # loop over residues - * for k in range(n2): - */ - __pyx_v_irel = (__pyx_v_i - __pyx_v_j); + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":216 - * irel=i-j - * # loop over residues - * for k in range(n2): # <<<<<<<<<<<<<< - * idx3=3*k - * for l in range(n2): +/* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * */ - __pyx_t_16 = __pyx_v_n2; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_k = __pyx_t_18; - /* "src/helpers/diffusion.pyx":217 - * # loop over residues - * for k in range(n2): - * idx3=3*k # <<<<<<<<<<<<<< - * for l in range(n2): - * if k == l and not diag: - */ - __pyx_v_idx3 = (3 * __pyx_v_k); +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - /* "src/helpers/diffusion.pyx":218 - * for k in range(n2): - * idx3=3*k - * for l in range(n2): # <<<<<<<<<<<<<< - * if k == l and not diag: - * continue - */ - __pyx_t_19 = __pyx_v_n2; - __pyx_t_20 = __pyx_t_19; - for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { - __pyx_v_l = __pyx_t_21; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":219 - * idx3=3*k - * for l in range(n2): - * if k == l and not diag: # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_t_8 = ((__pyx_v_k == __pyx_v_l) != 0); - if (__pyx_t_8) { - } else { - __pyx_t_3 = __pyx_t_8; - goto __pyx_L23_bool_binop_done; - } - __pyx_t_8 = ((!(__pyx_v_diag != 0)) != 0); - __pyx_t_3 = __pyx_t_8; - __pyx_L23_bool_binop_done:; - if (__pyx_t_3) { +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/helpers/diffusion.pyx":220 - * for l in range(n2): - * if k == l and not diag: - * continue # <<<<<<<<<<<<<< + /* "View.MemoryView":307 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< * - * idx4=3*l + * cdef generic = Enum("") */ - goto __pyx_L20_continue; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":219 - * idx3=3*k - * for l in range(n2): - * if k == l and not diag: # <<<<<<<<<<<<<< - * continue + /* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name * */ - } - /* "src/helpers/diffusion.pyx":222 - * continue - * - * idx4=3*l # <<<<<<<<<<<<<< - * dx = data[idx2+idx3] - data[idx1+idx3] - * dy = data[idx2+idx3+1] - data[idx1+idx3+1] - */ - __pyx_v_idx4 = (3 * __pyx_v_l); + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":223 - * - * idx4=3*l - * dx = data[idx2+idx3] - data[idx1+idx3] # <<<<<<<<<<<<<< - * dy = data[idx2+idx3+1] - data[idx1+idx3+1] - * dz = data[idx2+idx3+2] - data[idx1+idx3+2] +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - __pyx_v_dx = ((__pyx_v_data[(__pyx_v_idx2 + __pyx_v_idx3)]) - (__pyx_v_data[(__pyx_v_idx1 + __pyx_v_idx3)])); - /* "src/helpers/diffusion.pyx":224 - * idx4=3*l - * dx = data[idx2+idx3] - data[idx1+idx3] - * dy = data[idx2+idx3+1] - data[idx1+idx3+1] # <<<<<<<<<<<<<< - * dz = data[idx2+idx3+2] - data[idx1+idx3+2] - * dx2 = data2[idx2+idx4] - data2[idx1+idx4] - */ - __pyx_v_dy = ((__pyx_v_data[((__pyx_v_idx2 + __pyx_v_idx3) + 1)]) - (__pyx_v_data[((__pyx_v_idx1 + __pyx_v_idx3) + 1)])); +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - /* "src/helpers/diffusion.pyx":225 - * dx = data[idx2+idx3] - data[idx1+idx3] - * dy = data[idx2+idx3+1] - data[idx1+idx3+1] - * dz = data[idx2+idx3+2] - data[idx1+idx3+2] # <<<<<<<<<<<<<< - * dx2 = data2[idx2+idx4] - data2[idx1+idx4] - * dy2 = data2[idx2+idx4+1] - data2[idx1+idx4+1] - */ - __pyx_v_dz = ((__pyx_v_data[((__pyx_v_idx2 + __pyx_v_idx3) + 2)]) - (__pyx_v_data[((__pyx_v_idx1 + __pyx_v_idx3) + 2)])); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":226 - * dy = data[idx2+idx3+1] - data[idx1+idx3+1] - * dz = data[idx2+idx3+2] - data[idx1+idx3+2] - * dx2 = data2[idx2+idx4] - data2[idx1+idx4] # <<<<<<<<<<<<<< - * dy2 = data2[idx2+idx4+1] - data2[idx1+idx4+1] - * dz2 = data2[idx2+idx4+2] - data2[idx1+idx4+2] - */ - __pyx_v_dx2 = ((__pyx_v_data2[(__pyx_v_idx2 + __pyx_v_idx4)]) - (__pyx_v_data2[(__pyx_v_idx1 + __pyx_v_idx4)])); +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "src/helpers/diffusion.pyx":227 - * dz = data[idx2+idx3+2] - data[idx1+idx3+2] - * dx2 = data2[idx2+idx4] - data2[idx1+idx4] - * dy2 = data2[idx2+idx4+1] - data2[idx1+idx4+1] # <<<<<<<<<<<<<< - * dz2 = data2[idx2+idx4+2] - data2[idx1+idx4+2] - * dx3 = dx-dx2 + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: */ - __pyx_v_dy2 = ((__pyx_v_data2[((__pyx_v_idx2 + __pyx_v_idx4) + 1)]) - (__pyx_v_data2[((__pyx_v_idx1 + __pyx_v_idx4) + 1)])); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/diffusion.pyx":228 - * dx2 = data2[idx2+idx4] - data2[idx1+idx4] - * dy2 = data2[idx2+idx4+1] - data2[idx1+idx4+1] - * dz2 = data2[idx2+idx4+2] - data2[idx1+idx4+2] # <<<<<<<<<<<<<< - * dx3 = dx-dx2 - * dy3 = dy-dy2 + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) */ - __pyx_v_dz2 = ((__pyx_v_data2[((__pyx_v_idx2 + __pyx_v_idx4) + 2)]) - (__pyx_v_data2[((__pyx_v_idx1 + __pyx_v_idx4) + 2)])); + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/diffusion.pyx":229 - * dy2 = data2[idx2+idx4+1] - data2[idx1+idx4+1] - * dz2 = data2[idx2+idx4+2] - data2[idx1+idx4+2] - * dx3 = dx-dx2 # <<<<<<<<<<<<<< - * dy3 = dy-dy2 - * dz3 = dz-dz2 + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - __pyx_v_dx3 = (__pyx_v_dx - __pyx_v_dx2); + __pyx_t_2 = (__pyx_v__dict != Py_None); + if (__pyx_t_2) { - /* "src/helpers/diffusion.pyx":230 - * dz2 = data2[idx2+idx4+2] - data2[idx1+idx4+2] - * dx3 = dx-dx2 - * dy3 = dy-dy2 # <<<<<<<<<<<<<< - * dz3 = dz-dz2 - * result = dx3*dx3+dy3*dy3+dz3*dz3 + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: */ - __pyx_v_dy3 = (__pyx_v_dy - __pyx_v_dy2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "src/helpers/diffusion.pyx":231 - * dx3 = dx-dx2 - * dy3 = dy-dy2 - * dz3 = dz-dz2 # <<<<<<<<<<<<<< - * result = dx3*dx3+dy3*dy3+dz3*dz3 - * msd_data[irel]+=result + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.name is not None */ - __pyx_v_dz3 = (__pyx_v_dz - __pyx_v_dz2); + __pyx_v_use_setstate = 1; - /* "src/helpers/diffusion.pyx":232 - * dy3 = dy-dy2 - * dz3 = dz-dz2 - * result = dx3*dx3+dy3*dy3+dz3*dz3 # <<<<<<<<<<<<<< - * msd_data[irel]+=result - * c[irel]+=1 + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - __pyx_v_result = (((__pyx_v_dx3 * __pyx_v_dx3) + (__pyx_v_dy3 * __pyx_v_dy3)) + (__pyx_v_dz3 * __pyx_v_dz3)); + goto __pyx_L3; + } - /* "src/helpers/diffusion.pyx":233 - * dz3 = dz-dz2 - * result = dx3*dx3+dy3*dy3+dz3*dz3 - * msd_data[irel]+=result # <<<<<<<<<<<<<< - * c[irel]+=1 - * + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = self.name is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state */ - __pyx_t_22 = __pyx_v_irel; - (__pyx_v_msd_data[__pyx_t_22]) = ((__pyx_v_msd_data[__pyx_t_22]) + __pyx_v_result); + /*else*/ { + __pyx_t_2 = (__pyx_v_self->name != Py_None); + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; - /* "src/helpers/diffusion.pyx":234 - * result = dx3*dx3+dy3*dy3+dz3*dz3 - * msd_data[irel]+=result - * c[irel]+=1 # <<<<<<<<<<<<<< - * - * for i in range(m): + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: */ - __pyx_t_22 = __pyx_v_irel; - (__pyx_v_c[__pyx_t_22]) = ((__pyx_v_c[__pyx_t_22]) + 1); - __pyx_L20_continue:; - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + if (__pyx_v_use_setstate) { - /* "src/helpers/diffusion.pyx":212 - * idx1=j*n2*3 - * # loop over all delta t - * for i in prange(j,j+m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< - * idx2=i*n2*3 - * irel=i-j + /* "(tree fragment)":13 + * use_setstate = self.name is not None + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L13; - } - __pyx_L13:; - } - } + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":209 - * - * # loop over all starting points - * for j in range(0,n1-m,nstep): # <<<<<<<<<<<<<< - * idx1=j*n2*3 - * # loop over all delta t + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: */ } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "src/helpers/diffusion.pyx":236 - * c[irel]+=1 - * - * for i in range(m): # <<<<<<<<<<<<<< - * msd[i]/=ctr[i] - * - */ - __pyx_t_15 = __pyx_v_m; - __pyx_t_14 = __pyx_t_15; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) { - __pyx_v_i = __pyx_t_13; - /* "src/helpers/diffusion.pyx":237 - * - * for i in range(m): - * msd[i]/=ctr[i] # <<<<<<<<<<<<<< - * - * return msd + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ - __pyx_t_23 = __pyx_v_i; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_ctr.diminfo[0].shape; - __pyx_t_24 = __pyx_v_i; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_msd.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_msd.diminfo[0].strides) /= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_ctr.diminfo[0].strides)); + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; } - /* "src/helpers/diffusion.pyx":239 - * msd[i]/=ctr[i] - * - * return msd # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_msd)); - __pyx_r = ((PyObject *)__pyx_v_msd); - goto __pyx_L0; - - /* "src/helpers/diffusion.pyx":171 - * - * @cython.boundscheck(False) - * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] xyz2, - * maxlen=None): + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz2.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.diffusion.pairDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz2.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_msd); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/diffusion.pyx":242 - * - * @cython.boundscheck(False) - * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9diffusion_9msdMJ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9diffusion_8msdMJ[] = "\n msdMJ(coms_cat, coms_an, maxlen=None, charge_cat=None, charge_an=None)\n\n Takes two center-of-mass arrays of the whole unfolded trajectory, one for cations, the other for anions.\n\n Usage:\n msdmj = msdMJ(coms_cat, coms_an)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_9msdMJ = {"msdMJ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9diffusion_9msdMJ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_8msdMJ}; -static PyObject *__pyx_pw_11newanalysis_9diffusion_9msdMJ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_coms_cat = 0; - PyArrayObject *__pyx_v_coms_an = 0; - PyObject *__pyx_v_maxlen = 0; - PyObject *__pyx_v_charge_cat = 0; - PyObject *__pyx_v_charge_an = 0; +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("msdMJ (wrapper)", 0); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 16, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms_cat,&__pyx_n_s_coms_an,&__pyx_n_s_maxlen,&__pyx_n_s_charge_cat,&__pyx_n_s_charge_an,0}; - PyObject* values[5] = {0,0,0,0,0}; - - /* "src/helpers/diffusion.pyx":244 - * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, # <<<<<<<<<<<<<< - * charge_cat = None, - * charge_an = None): - */ - values[2] = ((PyObject *)Py_None); - - /* "src/helpers/diffusion.pyx":245 - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, - * charge_cat = None, # <<<<<<<<<<<<<< - * charge_an = None): - * """ - */ - values[3] = ((PyObject *)Py_None); - - /* "src/helpers/diffusion.pyx":246 - * maxlen=None, - * charge_cat = None, - * charge_an = None): # <<<<<<<<<<<<<< - * """ - * msdMJ(coms_cat, coms_an, maxlen=None, charge_cat=None, charge_an=None) - */ - values[4] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms_cat)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms_an)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("msdMJ", 0, 2, 5, 1); __PYX_ERR(0, 242, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[2] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_cat); - if (value) { values[3] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_an); - if (value) { values[4] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msdMJ") < 0)) __PYX_ERR(0, 242, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_coms_cat = ((PyArrayObject *)values[0]); - __pyx_v_coms_an = ((PyArrayObject *)values[1]); - __pyx_v_maxlen = values[2]; - __pyx_v_charge_cat = values[3]; - __pyx_v_charge_an = values[4]; + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("msdMJ", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 242, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.diffusion.msdMJ", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_cat), __pyx_ptype_5numpy_ndarray, 1, "coms_cat", 0))) __PYX_ERR(0, 242, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_an), __pyx_ptype_5numpy_ndarray, 1, "coms_an", 0))) __PYX_ERR(0, 243, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9diffusion_8msdMJ(__pyx_self, __pyx_v_coms_cat, __pyx_v_coms_an, __pyx_v_maxlen, __pyx_v_charge_cat, __pyx_v_charge_an); + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state); - /* "src/helpers/diffusion.pyx":242 - * - * @cython.boundscheck(False) - * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9diffusion_8msdMJ(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_charge_cat, PyObject *__pyx_v_charge_an) { - int __pyx_v_n1; - int __pyx_v_n2; - int __pyx_v_m; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_ccat; - int __pyx_v_can; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_result; - double *__pyx_v_cat; - double *__pyx_v_an; - PyArrayObject *__pyx_v_mj = 0; - double *__pyx_v_cmj; - PyArrayObject *__pyx_v_msdmj = 0; - double *__pyx_v_msd; - PyArrayObject *__pyx_v_ctr = 0; - int *__pyx_v_c; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_an; - __Pyx_Buffer __pyx_pybuffer_coms_an; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_cat; - __Pyx_Buffer __pyx_pybuffer_coms_cat; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_mj; - __Pyx_Buffer __pyx_pybuffer_mj; - __Pyx_LocalBuf_ND __pyx_pybuffernd_msdmj; - __Pyx_Buffer __pyx_pybuffer_msdmj; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; +/* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags + */ + +/* Python wrapper */ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("msdMJ", 0); - __pyx_pybuffer_mj.pybuffer.buf = NULL; - __pyx_pybuffer_mj.refcount = 0; - __pyx_pybuffernd_mj.data = NULL; - __pyx_pybuffernd_mj.rcbuffer = &__pyx_pybuffer_mj; - __pyx_pybuffer_msdmj.pybuffer.buf = NULL; - __pyx_pybuffer_msdmj.refcount = 0; - __pyx_pybuffernd_msdmj.data = NULL; - __pyx_pybuffernd_msdmj.rcbuffer = &__pyx_pybuffer_msdmj; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_coms_cat.pybuffer.buf = NULL; - __pyx_pybuffer_coms_cat.refcount = 0; - __pyx_pybuffernd_coms_cat.data = NULL; - __pyx_pybuffernd_coms_cat.rcbuffer = &__pyx_pybuffer_coms_cat; - __pyx_pybuffer_coms_an.pybuffer.buf = NULL; - __pyx_pybuffer_coms_an.refcount = 0; - __pyx_pybuffernd_coms_an.data = NULL; - __pyx_pybuffernd_coms_an.rcbuffer = &__pyx_pybuffer_coms_an; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 349, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_cat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 242, __pyx_L1_error) + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 349, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype_is_object); + if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 349, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); + } } - __pyx_pybuffernd_coms_cat.diminfo[0].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_cat.diminfo[0].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_cat.diminfo[1].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_cat.diminfo[1].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_cat.diminfo[2].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_cat.diminfo[2].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[2]; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 349, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_an, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 242, __pyx_L1_error) + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } } - __pyx_pybuffernd_coms_an.diminfo[0].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_an.diminfo[0].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_an.diminfo[1].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_an.diminfo[1].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_an.diminfo[2].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_an.diminfo[2].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[2]; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); - /* "src/helpers/diffusion.pyx":259 - * cdef double dx,dy,dz,result - * - * n1 = len(coms_cat) # <<<<<<<<<<<<<< - * n2 = len(coms_cat[0]) - * if maxlen == None: - */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coms_cat)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 259, __pyx_L1_error) - __pyx_v_n1 = __pyx_t_1; + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":260 - * - * n1 = len(coms_cat) - * n2 = len(coms_cat[0]) # <<<<<<<<<<<<<< - * if maxlen == None: - * m = n1 - */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_cat), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n2 = __pyx_t_1; +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "src/helpers/diffusion.pyx":261 - * n1 = len(coms_cat) - * n2 = len(coms_cat[0]) - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: + /* "View.MemoryView":350 + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; - /* "src/helpers/diffusion.pyx":262 - * n2 = len(coms_cat[0]) - * if maxlen == None: - * m = n1 # <<<<<<<<<<<<<< - * else: - * m = maxlen + /* "View.MemoryView":351 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) */ - __pyx_v_m = __pyx_v_n1; + __pyx_v_self->flags = __pyx_v_flags; - /* "src/helpers/diffusion.pyx":261 - * n1 = len(coms_cat) - * n2 = len(coms_cat[0]) - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ - goto __pyx_L3; + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":264 - * m = n1 - * else: - * m = maxlen # <<<<<<<<<<<<<< - * if charge_cat is None: - * ccat = 1 + /* "View.MemoryView":353 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None */ - /*else*/ { - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 264, __pyx_L1_error) - __pyx_v_m = ((int)__pyx_t_4); - } - __pyx_L3:; + __pyx_t_3 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 353, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":265 - * else: - * m = maxlen - * if charge_cat is None: # <<<<<<<<<<<<<< - * ccat = 1 - * else: + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) */ - __pyx_t_3 = (__pyx_v_charge_cat == Py_None); - __pyx_t_5 = (__pyx_t_3 != 0); - if (__pyx_t_5) { + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":266 - * m = maxlen - * if charge_cat is None: - * ccat = 1 # <<<<<<<<<<<<<< - * else: - * ccat = charge_cat + /* "View.MemoryView":355 + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * */ - __pyx_v_ccat = 1; + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - /* "src/helpers/diffusion.pyx":265 - * else: - * m = maxlen - * if charge_cat is None: # <<<<<<<<<<<<<< - * ccat = 1 - * else: + /* "View.MemoryView":356 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + */ + Py_INCREF(Py_None); + + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) + */ + } + + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ - goto __pyx_L4; } - /* "src/helpers/diffusion.pyx":268 - * ccat = 1 - * else: - * ccat = charge_cat # <<<<<<<<<<<<<< + /* "View.MemoryView":358 + * Py_INCREF(Py_None) * - * if charge_an is None: + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + */ + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { + + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + */ + __pyx_t_1 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_1) { + + /* "View.MemoryView":361 + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + */ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":362 + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + */ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + */ + } + + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + */ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":364 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError + */ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * + */ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":366 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: + */ + PyErr_NoMemory(); __PYX_ERR(1, 366, __pyx_L1_error) + + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * + */ + } + + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + */ + } + + /* "View.MemoryView":358 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: */ - /*else*/ { - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_charge_cat); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 268, __pyx_L1_error) - __pyx_v_ccat = ((int)__pyx_t_4); } - __pyx_L4:; - /* "src/helpers/diffusion.pyx":270 - * ccat = charge_cat + /* "View.MemoryView":368 + * raise MemoryError * - * if charge_an is None: # <<<<<<<<<<<<<< - * can = -1 - * else: + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: */ - __pyx_t_5 = (__pyx_v_charge_an == Py_None); - __pyx_t_3 = (__pyx_t_5 != 0); - if (__pyx_t_3) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":271 + /* "View.MemoryView":369 * - * if charge_an is None: - * can = -1 # <<<<<<<<<<<<<< - * else: - * can = charge_an + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object */ - __pyx_v_can = -1; + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L12_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L12_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; - /* "src/helpers/diffusion.pyx":270 - * ccat = charge_cat + /* "View.MemoryView":368 + * raise MemoryError * - * if charge_an is None: # <<<<<<<<<<<<<< - * can = -1 - * else: + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: */ - goto __pyx_L5; + goto __pyx_L11; } - /* "src/helpers/diffusion.pyx":273 - * can = -1 - * else: - * can = charge_an # <<<<<<<<<<<<<< + /* "View.MemoryView":371 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< * - * cdef double *cat = coms_cat.data + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 */ /*else*/ { - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_charge_an); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error) - __pyx_v_can = ((int)__pyx_t_4); + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; } - __pyx_L5:; + __pyx_L11:; - /* "src/helpers/diffusion.pyx":275 - * can = charge_an + /* "View.MemoryView":373 + * self.dtype_is_object = dtype_is_object * - * cdef double *cat = coms_cat.data # <<<<<<<<<<<<<< - * cdef double *an = coms_an.data + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL * */ - __pyx_v_cat = ((double *)__pyx_v_coms_cat->data); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 373, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 373, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 373, __pyx_L1_error) + #endif - /* "src/helpers/diffusion.pyx":276 + /* "View.MemoryView":374 * - * cdef double *cat = coms_cat.data - * cdef double *an = coms_an.data # <<<<<<<<<<<<<< + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< * - * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) + * def __dealloc__(memoryview self): */ - __pyx_v_an = ((double *)__pyx_v_coms_an->data); + __pyx_v_self->typeinfo = NULL; - /* "src/helpers/diffusion.pyx":278 - * cdef double *an = coms_an.data - * - * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *cmj = mj.data + /* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_3); - __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 278, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_mj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 278, __pyx_L1_error) - } else {__pyx_pybuffernd_mj.diminfo[0].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj.diminfo[0].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj.diminfo[1].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj.diminfo[1].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_10 = 0; - __pyx_v_mj = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; - /* "src/helpers/diffusion.pyx":279 + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":376 + * self.typeinfo = NULL * - * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) - * cdef double *cmj = mj.data # <<<<<<<<<<<<<< + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + */ + +/* Python wrapper */ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "View.MemoryView":377 * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - __pyx_v_cmj = ((double *)__pyx_v_mj->data); + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":281 - * cdef double *cmj = mj.data + /* "View.MemoryView":378 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *msd = msdmj.data + */ + __Pyx_ReleaseBuffer((&__pyx_v_self->view)); + + /* "View.MemoryView":377 * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 281, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_msdmj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 281, __pyx_L1_error) - } else {__pyx_pybuffernd_msdmj.diminfo[0].strides = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msdmj.diminfo[0].shape = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.shape[0]; - } + goto __pyx_L3; } - __pyx_t_11 = 0; - __pyx_v_msdmj = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; - /* "src/helpers/diffusion.pyx":282 - * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) - * cdef double *msd = msdmj.data # <<<<<<<<<<<<<< + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * (<__pyx_buffer *> &self.view).obj = NULL */ - __pyx_v_msd = ((double *)__pyx_v_msdmj->data); + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":284 - * cdef double *msd = msdmj.data + /* "View.MemoryView":381 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< - * cdef int *c = ctr.data + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) * */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 284, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 284, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_12 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; - /* "src/helpers/diffusion.pyx":285 + /* "View.MemoryView":382 * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) - * cdef int *c = ctr.data # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< * - * for i in prange(n1,nogil=True): + * cdef int i */ - __pyx_v_c = ((int *)__pyx_v_ctr->data); + Py_DECREF(Py_None); - /* "src/helpers/diffusion.pyx":287 - * cdef int *c = ctr.data + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n2): - * cmj[i*3] += ccat*cat[i*n2*3+3*j] + * (<__pyx_buffer *> &self.view).obj = NULL */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_n1; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_14 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_14 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); + } + __pyx_L3:; - /* "src/helpers/diffusion.pyx":288 - * - * for i in prange(n1,nogil=True): - * for j in range(n2): # <<<<<<<<<<<<<< - * cmj[i*3] += ccat*cat[i*n2*3+3*j] - * cmj[i*3+1] += ccat*cat[i*n2*3+3*j+1] + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: */ - __pyx_t_15 = __pyx_v_n2; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":289 - * for i in prange(n1,nogil=True): - * for j in range(n2): - * cmj[i*3] += ccat*cat[i*n2*3+3*j] # <<<<<<<<<<<<<< - * cmj[i*3+1] += ccat*cat[i*n2*3+3*j+1] - * cmj[i*3+2] += ccat*cat[i*n2*3+3*j+2] + /* "View.MemoryView":387 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 */ - __pyx_t_18 = (__pyx_v_i * 3); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_ccat * (__pyx_v_cat[(((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j))]))); + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/diffusion.pyx":290 - * for j in range(n2): - * cmj[i*3] += ccat*cat[i*n2*3+3*j] - * cmj[i*3+1] += ccat*cat[i*n2*3+3*j+1] # <<<<<<<<<<<<<< - * cmj[i*3+2] += ccat*cat[i*n2*3+3*j+2] - * cmj[i*3] += can*an[i*n2*3+3*j] + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: */ - __pyx_t_18 = ((__pyx_v_i * 3) + 1); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_ccat * (__pyx_v_cat[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 1)]))); + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":291 - * cmj[i*3] += ccat*cat[i*n2*3+3*j] - * cmj[i*3+1] += ccat*cat[i*n2*3+3*j+1] - * cmj[i*3+2] += ccat*cat[i*n2*3+3*j+2] # <<<<<<<<<<<<<< - * cmj[i*3] += can*an[i*n2*3+3*j] - * cmj[i*3+1] += can*an[i*n2*3+3*j+1] + /* "View.MemoryView":389 + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( */ - __pyx_t_18 = ((__pyx_v_i * 3) + 2); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_ccat * (__pyx_v_cat[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 2)]))); + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); - /* "src/helpers/diffusion.pyx":292 - * cmj[i*3+1] += ccat*cat[i*n2*3+3*j+1] - * cmj[i*3+2] += ccat*cat[i*n2*3+3*j+2] - * cmj[i*3] += can*an[i*n2*3+3*j] # <<<<<<<<<<<<<< - * cmj[i*3+1] += can*an[i*n2*3+3*j+1] - * cmj[i*3+2] += can*an[i*n2*3+3*j+2] + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) */ - __pyx_t_18 = (__pyx_v_i * 3); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_can * (__pyx_v_an[(((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j))]))); + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":293 - * cmj[i*3+2] += ccat*cat[i*n2*3+3*j+2] - * cmj[i*3] += can*an[i*n2*3+3*j] - * cmj[i*3+1] += can*an[i*n2*3+3*j+1] # <<<<<<<<<<<<<< - * cmj[i*3+2] += can*an[i*n2*3+3*j+2] - * + /* "View.MemoryView":392 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: */ - __pyx_t_18 = ((__pyx_v_i * 3) + 1); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_can * (__pyx_v_an[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 1)]))); + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); - /* "src/helpers/diffusion.pyx":294 - * cmj[i*3] += can*an[i*n2*3+3*j] - * cmj[i*3+1] += can*an[i*n2*3+3*j+1] - * cmj[i*3+2] += can*an[i*n2*3+3*j+2] # <<<<<<<<<<<<<< - * - * for i in prange(m,nogil=True): + /* "View.MemoryView":391 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break */ - __pyx_t_18 = ((__pyx_v_i * 3) + 2); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_can * (__pyx_v_an[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 2)]))); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; - /* "src/helpers/diffusion.pyx":287 - * cdef int *c = ctr.data - * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n2): - * cmj[i*3] += ccat*cat[i*n2*3+3*j] + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L8; } - __pyx_L8:; - } - } - /* "src/helpers/diffusion.pyx":296 - * cmj[i*3+2] += can*an[i*n2*3+3*j+2] - * - * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n1-i): - * dx = cmj[j*3] - cmj[(j+i)*3] + /* "View.MemoryView":393 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_14 = __pyx_v_m; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_4 = (__pyx_t_14 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_4 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_19) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_result) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_4; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_result = ((double)__PYX_NAN()); + goto __pyx_L6_break; - /* "src/helpers/diffusion.pyx":297 - * - * for i in prange(m,nogil=True): - * for j in range(n1-i): # <<<<<<<<<<<<<< - * dx = cmj[j*3] - cmj[(j+i)*3] - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: */ - __pyx_t_15 = (__pyx_v_n1 - __pyx_v_i); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; + } + } + /*else*/ { - /* "src/helpers/diffusion.pyx":298 - * for i in prange(m,nogil=True): - * for j in range(n1-i): - * dx = cmj[j*3] - cmj[(j+i)*3] # <<<<<<<<<<<<<< - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] + /* "View.MemoryView":395 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: */ - __pyx_v_dx = ((__pyx_v_cmj[(__pyx_v_j * 3)]) - (__pyx_v_cmj[((__pyx_v_j + __pyx_v_i) * 3)])); + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; - /* "src/helpers/diffusion.pyx":299 - * for j in range(n1-i): - * dx = cmj[j*3] - cmj[(j+i)*3] - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] # <<<<<<<<<<<<<< - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] - * result = dx*dx+dy*dy+dz*dz + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: */ - __pyx_v_dy = ((__pyx_v_cmj[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); + } - /* "src/helpers/diffusion.pyx":300 - * dx = cmj[j*3] - cmj[(j+i)*3] - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] # <<<<<<<<<<<<<< - * result = dx*dx+dy*dy+dz*dz - * msd[i]+=result + /* "View.MemoryView":376 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ - __pyx_v_dz = ((__pyx_v_cmj[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); - /* "src/helpers/diffusion.pyx":301 - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] - * result = dx*dx+dy*dy+dz*dz # <<<<<<<<<<<<<< - * msd[i]+=result - * c[i]+=1 - */ - __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} - /* "src/helpers/diffusion.pyx":302 - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] - * result = dx*dx+dy*dy+dz*dz - * msd[i]+=result # <<<<<<<<<<<<<< - * c[i]+=1 +/* "View.MemoryView":397 + * PyThread_free_lock(self.lock) * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf */ - __pyx_t_19 = __pyx_v_i; - (__pyx_v_msd[__pyx_t_19]) = ((__pyx_v_msd[__pyx_t_19]) + __pyx_v_result); - /* "src/helpers/diffusion.pyx":303 - * result = dx*dx+dy*dy+dz*dz - * msd[i]+=result - * c[i]+=1 # <<<<<<<<<<<<<< +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); + + /* "View.MemoryView":399 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< * - * for i in range(m): + * for dim, idx in enumerate(index): */ - __pyx_t_19 = __pyx_v_i; - (__pyx_v_c[__pyx_t_19]) = ((__pyx_v_c[__pyx_t_19]) + 1); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - /* "src/helpers/diffusion.pyx":296 - * cmj[i*3+2] += can*an[i*n2*3+3*j+2] + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * - * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n1-i): - * dx = cmj[j*3] - cmj[(j+i)*3] */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L19; + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 401, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 401, __pyx_L1_error) } - __pyx_L19:; + break; } - } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); - /* "src/helpers/diffusion.pyx":305 - * c[i]+=1 + /* "View.MemoryView":402 * - * for i in range(m): # <<<<<<<<<<<<<< - * msd[i]/=c[i] + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< * + * return itemp */ - __pyx_t_4 = __pyx_v_m; - __pyx_t_13 = __pyx_t_4; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_i = __pyx_t_14; + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; - /* "src/helpers/diffusion.pyx":306 + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf * - * for i in range(m): - * msd[i]/=c[i] # <<<<<<<<<<<<<< + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * - * return msdmj */ - __pyx_t_15 = __pyx_v_i; - if (unlikely((__pyx_v_c[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 306, __pyx_L1_error) - } - (__pyx_v_msd[__pyx_t_15]) = ((__pyx_v_msd[__pyx_t_15]) / (__pyx_v_c[__pyx_v_i])); } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/diffusion.pyx":308 - * msd[i]/=c[i] + /* "View.MemoryView":404 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * - * return msdmj # <<<<<<<<<<<<<< + * return itemp # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_msdmj)); - __pyx_r = ((PyObject *)__pyx_v_msdmj); + __pyx_r = __pyx_v_itemp; goto __pyx_L0; - /* "src/helpers/diffusion.pyx":242 + /* "View.MemoryView":397 + * PyThread_free_lock(self.lock) * - * @cython.boundscheck(False) - * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.diffusion.msdMJ", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_mj); - __Pyx_XDECREF((PyObject *)__pyx_v_msdmj); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_idx); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/diffusion.pyx":312 +/* "View.MemoryView":407 * - * @cython.boundscheck(False) - * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9diffusion_11msdMJCharges(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9diffusion_10msdMJCharges[] = "\n msdMJCharges(coms_cat, coms_an, maxlen=None, charge_cat=None, charge_an=None)\n\n Takes two center-of-mass arrays of the whole unfolded trajectory, one for cations, the other for anions.\n Multiplies CoM by charge. Cations and Anions can have different n_residues\n\n Usage:\n msdmj = msdMJCharges(coms_cat, coms_an)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_11msdMJCharges = {"msdMJCharges", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9diffusion_11msdMJCharges, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_10msdMJCharges}; -static PyObject *__pyx_pw_11newanalysis_9diffusion_11msdMJCharges(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_coms_cat = 0; - PyArrayObject *__pyx_v_coms_an = 0; - PyObject *__pyx_v_maxlen = 0; - PyObject *__pyx_v_charge_cat = 0; - PyObject *__pyx_v_charge_an = 0; +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("msdMJCharges (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms_cat,&__pyx_n_s_coms_an,&__pyx_n_s_maxlen,&__pyx_n_s_charge_cat,&__pyx_n_s_charge_an,0}; - PyObject* values[5] = {0,0,0,0,0}; + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "src/helpers/diffusion.pyx":314 - * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, # <<<<<<<<<<<<<< - * charge_cat=None, - * charge_an=None): + /* "View.MemoryView":408 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * */ - values[2] = ((PyObject *)Py_None); + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":315 - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, - * charge_cat=None, # <<<<<<<<<<<<<< - * charge_an=None): - * """ + /* "View.MemoryView":409 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) */ - values[3] = ((PyObject *)Py_None); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":316 - * maxlen=None, - * charge_cat=None, - * charge_an=None): # <<<<<<<<<<<<<< - * """ - * msdMJCharges(coms_cat, coms_an, maxlen=None, charge_cat=None, charge_an=None) + /* "View.MemoryView":408 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * */ - values[4] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms_cat)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms_an)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("msdMJCharges", 0, 2, 5, 1); __PYX_ERR(0, 312, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[2] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_cat); - if (value) { values[3] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_an); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msdMJCharges") < 0)) __PYX_ERR(0, 312, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_coms_cat = ((PyArrayObject *)values[0]); - __pyx_v_coms_an = ((PyArrayObject *)values[1]); - __pyx_v_maxlen = values[2]; - __pyx_v_charge_cat = values[3]; - __pyx_v_charge_an = values[4]; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("msdMJCharges", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 312, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.diffusion.msdMJCharges", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_cat), __pyx_ptype_5numpy_ndarray, 1, "coms_cat", 0))) __PYX_ERR(0, 312, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_an), __pyx_ptype_5numpy_ndarray, 1, "coms_an", 0))) __PYX_ERR(0, 313, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9diffusion_10msdMJCharges(__pyx_self, __pyx_v_coms_cat, __pyx_v_coms_an, __pyx_v_maxlen, __pyx_v_charge_cat, __pyx_v_charge_an); - /* "src/helpers/diffusion.pyx":312 + /* "View.MemoryView":411 + * return self * - * @cython.boundscheck(False) - * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp + */ + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 411, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 411, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; + + /* "View.MemoryView":414 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 414, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":415 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":414 + * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: + */ + } + + /* "View.MemoryView":417 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) + * + */ + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((char *)NULL))) __PYX_ERR(1, 417, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; + + /* "View.MemoryView":418 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * + * def __setitem__(memoryview self, object index, object value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":407 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9diffusion_10msdMJCharges(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_charge_cat, PyObject *__pyx_v_charge_an) { - int __pyx_v_n1; - int __pyx_v_n2; - int __pyx_v_m; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_c1; - int __pyx_v_c2; - int __pyx_v_n4; - int __pyx_v_upper; - int __pyx_v_lower; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_result; - double *__pyx_v_shorter; - double *__pyx_v_longer; - long __pyx_v_ccat; - long __pyx_v_can; - PyArrayObject *__pyx_v_mj = 0; - double *__pyx_v_cmj; - PyArrayObject *__pyx_v_msdmj = 0; - double *__pyx_v_msd; - PyArrayObject *__pyx_v_ctr = 0; - int *__pyx_v_c; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_an; - __Pyx_Buffer __pyx_pybuffer_coms_an; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_cat; - __Pyx_Buffer __pyx_pybuffer_coms_cat; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_mj; - __Pyx_Buffer __pyx_pybuffer_mj; - __Pyx_LocalBuf_ND __pyx_pybuffernd_msdmj; - __Pyx_Buffer __pyx_pybuffer_msdmj; - PyObject *__pyx_r = NULL; +/* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" + */ + +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("msdMJCharges", 0); - __pyx_pybuffer_mj.pybuffer.buf = NULL; - __pyx_pybuffer_mj.refcount = 0; - __pyx_pybuffernd_mj.data = NULL; - __pyx_pybuffernd_mj.rcbuffer = &__pyx_pybuffer_mj; - __pyx_pybuffer_msdmj.pybuffer.buf = NULL; - __pyx_pybuffer_msdmj.refcount = 0; - __pyx_pybuffernd_msdmj.data = NULL; - __pyx_pybuffernd_msdmj.rcbuffer = &__pyx_pybuffer_msdmj; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_coms_cat.pybuffer.buf = NULL; - __pyx_pybuffer_coms_cat.refcount = 0; - __pyx_pybuffernd_coms_cat.data = NULL; - __pyx_pybuffernd_coms_cat.rcbuffer = &__pyx_pybuffer_coms_cat; - __pyx_pybuffer_coms_an.pybuffer.buf = NULL; - __pyx_pybuffer_coms_an.refcount = 0; - __pyx_pybuffernd_coms_an.data = NULL; - __pyx_pybuffernd_coms_an.rcbuffer = &__pyx_pybuffer_coms_an; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_cat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 312, __pyx_L1_error) - } - __pyx_pybuffernd_coms_cat.diminfo[0].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_cat.diminfo[0].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_cat.diminfo[1].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_cat.diminfo[1].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_cat.diminfo[2].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_cat.diminfo[2].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_an, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 312, __pyx_L1_error) - } - __pyx_pybuffernd_coms_an.diminfo[0].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_an.diminfo[0].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_an.diminfo[1].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_an.diminfo[1].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_an.diminfo[2].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_an.diminfo[2].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[2]; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); - /* "src/helpers/diffusion.pyx":332 - * cdef double *longer + /* "View.MemoryView":421 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * - * n1 = len(coms_cat) # n_frames # <<<<<<<<<<<<<< - * n2 = len(coms_cat[0]) # n_residues - * n4 = len(coms_an[0]) */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coms_cat)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 332, __pyx_L1_error) - __pyx_v_n1 = __pyx_t_1; + if (unlikely(__pyx_v_self->view.readonly)) { - /* "src/helpers/diffusion.pyx":333 + /* "View.MemoryView":422 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< * - * n1 = len(coms_cat) # n_frames - * n2 = len(coms_cat[0]) # n_residues # <<<<<<<<<<<<<< - * n4 = len(coms_an[0]) - * if charge_cat is None: + * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_cat), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n2 = __pyx_t_1; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 422, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":334 - * n1 = len(coms_cat) # n_frames - * n2 = len(coms_cat[0]) # n_residues - * n4 = len(coms_an[0]) # <<<<<<<<<<<<<< - * if charge_cat is None: - * ccat = 1 + /* "View.MemoryView":421 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_an), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 334, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n4 = __pyx_t_1; + } - /* "src/helpers/diffusion.pyx":335 - * n2 = len(coms_cat[0]) # n_residues - * n4 = len(coms_an[0]) - * if charge_cat is None: # <<<<<<<<<<<<<< - * ccat = 1 - * else: + /* "View.MemoryView":424 + * raise TypeError, "Cannot assign to read-only memoryview" + * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: */ - __pyx_t_3 = (__pyx_v_charge_cat == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 424, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 424, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) + * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 426, __pyx_L1_error) if (__pyx_t_4) { - /* "src/helpers/diffusion.pyx":336 - * n4 = len(coms_an[0]) - * if charge_cat is None: - * ccat = 1 # <<<<<<<<<<<<<< - * else: - * ccat = charge_cat + /* "View.MemoryView":427 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj: + * self.setitem_slice_assignment(self[index], obj) */ - __pyx_v_ccat = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/diffusion.pyx":335 - * n2 = len(coms_cat[0]) # n_residues - * n4 = len(coms_an[0]) - * if charge_cat is None: # <<<<<<<<<<<<<< - * ccat = 1 - * else: + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: */ - goto __pyx_L3; - } + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 428, __pyx_L1_error) + if (__pyx_t_4) { - /* "src/helpers/diffusion.pyx":338 - * ccat = 1 - * else: - * ccat = charge_cat # <<<<<<<<<<<<<< - * - * if charge_an is None: + /* "View.MemoryView":429 + * obj = self.is_slice(value) + * if obj: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) */ - /*else*/ { - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_charge_cat); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L1_error) - __pyx_v_ccat = ((int)__pyx_t_5); - } - __pyx_L3:; + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/helpers/diffusion.pyx":340 - * ccat = charge_cat - * - * if charge_an is None: # <<<<<<<<<<<<<< - * can = -1 - * else: + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: */ - __pyx_t_4 = (__pyx_v_charge_an == Py_None); - __pyx_t_3 = (__pyx_t_4 != 0); - if (__pyx_t_3) { + goto __pyx_L5; + } - /* "src/helpers/diffusion.pyx":341 - * - * if charge_an is None: - * can = -1 # <<<<<<<<<<<<<< - * else: - * can = charge_an + /* "View.MemoryView":431 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) */ - __pyx_v_can = -1L; + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 431, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; - /* "src/helpers/diffusion.pyx":340 - * ccat = charge_cat + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) * - * if charge_an is None: # <<<<<<<<<<<<<< - * can = -1 - * else: + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ goto __pyx_L4; } - /* "src/helpers/diffusion.pyx":343 - * can = -1 - * else: - * can = charge_an # <<<<<<<<<<<<<< + /* "View.MemoryView":433 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< * - * if maxlen is None: + * cdef is_slice(self, obj): */ /*else*/ { - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_charge_an); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error) - __pyx_v_can = ((int)__pyx_t_5); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __pyx_L4:; - /* "src/helpers/diffusion.pyx":345 - * can = charge_an + /* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) * - * if maxlen is None: # <<<<<<<<<<<<<< - * m = n1 - * else: + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ - __pyx_t_3 = (__pyx_v_maxlen == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { - /* "src/helpers/diffusion.pyx":346 - * - * if maxlen is None: - * m = n1 # <<<<<<<<<<<<<< - * else: - * m = maxlen - */ - __pyx_v_m = __pyx_v_n1; + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":345 - * can = charge_an +/* "View.MemoryView":435 + * self.setitem_indexed(index, value) * - * if maxlen is None: # <<<<<<<<<<<<<< - * m = n1 - * else: + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ - goto __pyx_L5; - } - /* "src/helpers/diffusion.pyx":348 - * m = n1 - * else: - * m = maxlen # <<<<<<<<<<<<<< - * - * if n2 > n4: - */ - /*else*/ { - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 348, __pyx_L1_error) - __pyx_v_m = ((int)__pyx_t_5); - } - __pyx_L5:; +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); - /* "src/helpers/diffusion.pyx":350 - * m = maxlen + /* "View.MemoryView":436 * - * if n2 > n4: # <<<<<<<<<<<<<< - * shorter = coms_an.data - * longer = coms_cat.data + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - __pyx_t_4 = ((__pyx_v_n2 > __pyx_v_n4) != 0); - if (__pyx_t_4) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "src/helpers/diffusion.pyx":351 - * - * if n2 > n4: - * shorter = coms_an.data # <<<<<<<<<<<<<< - * longer = coms_cat.data - * upper = n2 + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ - __pyx_v_shorter = ((double *)__pyx_v_coms_an->data); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { - /* "src/helpers/diffusion.pyx":352 - * if n2 > n4: - * shorter = coms_an.data - * longer = coms_cat.data # <<<<<<<<<<<<<< - * upper = n2 - * lower = n4 + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: */ - __pyx_v_longer = ((double *)__pyx_v_coms_cat->data); + __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); - /* "src/helpers/diffusion.pyx":353 - * shorter = coms_an.data - * longer = coms_cat.data - * upper = n2 # <<<<<<<<<<<<<< - * lower = n4 - * c1 = can + /* "View.MemoryView":439 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None */ - __pyx_v_upper = __pyx_v_n2; + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); - /* "src/helpers/diffusion.pyx":354 - * longer = coms_cat.data - * upper = n2 - * lower = n4 # <<<<<<<<<<<<<< - * c1 = can - * c2 = ccat + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: */ - __pyx_v_lower = __pyx_v_n4; - - /* "src/helpers/diffusion.pyx":355 - * upper = n2 - * lower = n4 - * c1 = can # <<<<<<<<<<<<<< - * c2 = ccat - * elif n2 < n4: - */ - __pyx_v_c1 = __pyx_v_can; + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); + __pyx_t_7 = 0; - /* "src/helpers/diffusion.pyx":356 - * lower = n4 - * c1 = can - * c2 = ccat # <<<<<<<<<<<<<< - * elif n2 < n4: - * shorter = coms_cat.data + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ - __pyx_v_c2 = __pyx_v_ccat; + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/helpers/diffusion.pyx":350 - * m = maxlen + /* "View.MemoryView":440 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None * - * if n2 > n4: # <<<<<<<<<<<<<< - * shorter = coms_an.data - * longer = coms_cat.data - */ - goto __pyx_L6; - } - - /* "src/helpers/diffusion.pyx":357 - * c1 = can - * c2 = ccat - * elif n2 < n4: # <<<<<<<<<<<<<< - * shorter = coms_cat.data - * longer = coms_an.data - */ - __pyx_t_4 = ((__pyx_v_n2 < __pyx_v_n4) != 0); - if (__pyx_t_4) { - - /* "src/helpers/diffusion.pyx":358 - * c2 = ccat - * elif n2 < n4: - * shorter = coms_cat.data # <<<<<<<<<<<<<< - * longer = coms_an.data - * upper = n4 */ - __pyx_v_shorter = ((double *)__pyx_v_coms_cat->data); + __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); + if (__pyx_t_9) { + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 440, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); - /* "src/helpers/diffusion.pyx":359 - * elif n2 < n4: - * shorter = coms_cat.data - * longer = coms_an.data # <<<<<<<<<<<<<< - * upper = n4 - * lower = n2 + /* "View.MemoryView":441 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj */ - __pyx_v_longer = ((double *)__pyx_v_coms_an->data); + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; - /* "src/helpers/diffusion.pyx":360 - * shorter = coms_cat.data - * longer = coms_an.data - * upper = n4 # <<<<<<<<<<<<<< - * lower = n2 - * c2 = can + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ - __pyx_v_upper = __pyx_v_n4; + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; + } - /* "src/helpers/diffusion.pyx":361 - * longer = coms_an.data - * upper = n4 - * lower = n2 # <<<<<<<<<<<<<< - * c2 = can - * c1 = ccat + /* "View.MemoryView":436 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - __pyx_v_lower = __pyx_v_n2; + } - /* "src/helpers/diffusion.pyx":362 - * upper = n4 - * lower = n2 - * c2 = can # <<<<<<<<<<<<<< - * c1 = ccat - * elif n2 == n4: + /* "View.MemoryView":443 + * return None + * + * return obj # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assignment(self, dst, src): */ - __pyx_v_c2 = __pyx_v_can; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":363 - * lower = n2 - * c2 = can - * c1 = ccat # <<<<<<<<<<<<<< - * elif n2 == n4: - * print("WARNING: same number of cation/anion species. Use msdMJ instead.") + /* "View.MemoryView":435 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ - __pyx_v_c1 = __pyx_v_ccat; - /* "src/helpers/diffusion.pyx":357 - * c1 = can - * c2 = ccat - * elif n2 < n4: # <<<<<<<<<<<<<< - * shorter = coms_cat.data - * longer = coms_an.data - */ - goto __pyx_L6; - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":364 - * c2 = can - * c1 = ccat - * elif n2 == n4: # <<<<<<<<<<<<<< - * print("WARNING: same number of cation/anion species. Use msdMJ instead.") +/* "View.MemoryView":445 + * return obj * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ - __pyx_t_4 = ((__pyx_v_n2 == __pyx_v_n4) != 0); - if (__pyx_t_4) { - /* "src/helpers/diffusion.pyx":365 - * c1 = ccat - * elif n2 == n4: - * print("WARNING: same number of cation/anion species. Use msdMJ instead.") # <<<<<<<<<<<<<< +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":448 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] * - * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) */ - if (__Pyx_PrintOne(0, __pyx_kp_s_WARNING_same_number_of_cation_an) < 0) __PYX_ERR(0, 365, __pyx_L1_error) + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); - /* "src/helpers/diffusion.pyx":364 - * c2 = can - * c1 = ccat - * elif n2 == n4: # <<<<<<<<<<<<<< - * print("WARNING: same number of cation/anion species. Use msdMJ instead.") + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) */ - } - __pyx_L6:; + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); - /* "src/helpers/diffusion.pyx":367 - * print("WARNING: same number of cation/anion species. Use msdMJ instead.") + /* "View.MemoryView":451 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] * - * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *cmj = mj.data + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_3); - __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 367, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_mj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 367, __pyx_L1_error) - } else {__pyx_pybuffernd_mj.diminfo[0].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj.diminfo[0].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj.diminfo[1].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj.diminfo[1].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_10 = 0; - __pyx_v_mj = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 451, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":368 - * - * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) - * cdef double *cmj = mj.data # <<<<<<<<<<<<<< - * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) - */ - __pyx_v_cmj = ((double *)__pyx_v_mj->data); - - /* "src/helpers/diffusion.pyx":370 - * cdef double *cmj = mj.data - * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *msd = msdmj.data + /* "View.MemoryView":445 + * return obj * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 370, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_msdmj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 370, __pyx_L1_error) - } else {__pyx_pybuffernd_msdmj.diminfo[0].strides = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msdmj.diminfo[0].shape = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_11 = 0; - __pyx_v_msdmj = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; - /* "src/helpers/diffusion.pyx":371 - * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) - * cdef double *msd = msdmj.data # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL */ - __pyx_v_msd = ((double *)__pyx_v_msdmj->data); - /* "src/helpers/diffusion.pyx":373 - * cdef double *msd = msdmj.data - * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< - * cdef int *c = ctr.data +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[0x80]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + + /* "View.MemoryView":455 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item * */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 373, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 373, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_12 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_v_tmp = NULL; - /* "src/helpers/diffusion.pyx":374 - * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) - * cdef int *c = ctr.data # <<<<<<<<<<<<<< + /* "View.MemoryView":460 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< * - * for i in prange(n1,nogil=True): + * if self.view.itemsize > sizeof(array): */ - __pyx_v_c = ((int *)__pyx_v_ctr->data); + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 460, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; - /* "src/helpers/diffusion.pyx":376 - * cdef int *c = ctr.data + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(lower): - * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_5 = __pyx_v_n1; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_14 = (__pyx_t_5 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_14 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { - /* "src/helpers/diffusion.pyx":377 + /* "View.MemoryView":463 * - * for i in prange(n1,nogil=True): - * for j in range(lower): # <<<<<<<<<<<<<< - * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) - * cmj[i*3+1] += c1*(shorter[i*lower*3+3*j+1]) + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError */ - __pyx_t_15 = __pyx_v_lower; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - /* "src/helpers/diffusion.pyx":378 - * for i in prange(n1,nogil=True): - * for j in range(lower): - * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) # <<<<<<<<<<<<<< - * cmj[i*3+1] += c1*(shorter[i*lower*3+3*j+1]) - * cmj[i*3+2] += c1*(shorter[i*lower*3+3*j+2]) + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp */ - __pyx_t_18 = (__pyx_v_i * 3); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c1 * (__pyx_v_shorter[(((__pyx_v_i * __pyx_v_lower) * 3) + (3 * __pyx_v_j))]))); + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/diffusion.pyx":379 - * for j in range(lower): - * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) - * cmj[i*3+1] += c1*(shorter[i*lower*3+3*j+1]) # <<<<<<<<<<<<<< - * cmj[i*3+2] += c1*(shorter[i*lower*3+3*j+2]) - * for k in range(upper): + /* "View.MemoryView":465 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: */ - __pyx_t_18 = ((__pyx_v_i * 3) + 1); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c1 * (__pyx_v_shorter[((((__pyx_v_i * __pyx_v_lower) * 3) + (3 * __pyx_v_j)) + 1)]))); + PyErr_NoMemory(); __PYX_ERR(1, 465, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":380 - * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) - * cmj[i*3+1] += c1*(shorter[i*lower*3+3*j+1]) - * cmj[i*3+2] += c1*(shorter[i*lower*3+3*j+2]) # <<<<<<<<<<<<<< - * for k in range(upper): - * cmj[i*3] += c2*(longer[i*upper*3+3*k]) + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp */ - __pyx_t_18 = ((__pyx_v_i * 3) + 2); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c1 * (__pyx_v_shorter[((((__pyx_v_i * __pyx_v_lower) * 3) + (3 * __pyx_v_j)) + 2)]))); - } + } - /* "src/helpers/diffusion.pyx":381 - * cmj[i*3+1] += c1*(shorter[i*lower*3+3*j+1]) - * cmj[i*3+2] += c1*(shorter[i*lower*3+3*j+2]) - * for k in range(upper): # <<<<<<<<<<<<<< - * cmj[i*3] += c2*(longer[i*upper*3+3*k]) - * cmj[i*3+1] += c2*(longer[i*upper*3+3*k+1]) + /* "View.MemoryView":466 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array */ - __pyx_t_15 = __pyx_v_upper; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_k = __pyx_t_17; + __pyx_v_item = __pyx_v_tmp; - /* "src/helpers/diffusion.pyx":382 - * cmj[i*3+2] += c1*(shorter[i*lower*3+3*j+2]) - * for k in range(upper): - * cmj[i*3] += c2*(longer[i*upper*3+3*k]) # <<<<<<<<<<<<<< - * cmj[i*3+1] += c2*(longer[i*upper*3+3*k+1]) - * cmj[i*3+2] += c2*(longer[i*upper*3+3*k+2]) - */ - __pyx_t_18 = (__pyx_v_i * 3); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c2 * (__pyx_v_longer[(((__pyx_v_i * __pyx_v_upper) * 3) + (3 * __pyx_v_k))]))); - - /* "src/helpers/diffusion.pyx":383 - * for k in range(upper): - * cmj[i*3] += c2*(longer[i*upper*3+3*k]) - * cmj[i*3+1] += c2*(longer[i*upper*3+3*k+1]) # <<<<<<<<<<<<<< - * cmj[i*3+2] += c2*(longer[i*upper*3+3*k+2]) - * - */ - __pyx_t_18 = ((__pyx_v_i * 3) + 1); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c2 * (__pyx_v_longer[((((__pyx_v_i * __pyx_v_upper) * 3) + (3 * __pyx_v_k)) + 1)]))); - - /* "src/helpers/diffusion.pyx":384 - * cmj[i*3] += c2*(longer[i*upper*3+3*k]) - * cmj[i*3+1] += c2*(longer[i*upper*3+3*k+1]) - * cmj[i*3+2] += c2*(longer[i*upper*3+3*k+2]) # <<<<<<<<<<<<<< + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) * - * for i in prange(m,nogil=True): + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ - __pyx_t_18 = ((__pyx_v_i * 3) + 2); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c2 * (__pyx_v_longer[((((__pyx_v_i * __pyx_v_upper) * 3) + (3 * __pyx_v_k)) + 2)]))); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + goto __pyx_L3; + } - /* "src/helpers/diffusion.pyx":376 - * cdef int *c = ctr.data + /* "View.MemoryView":468 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(lower): - * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) + * try: */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L9; - } - __pyx_L9:; - } + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); } + __pyx_L3:; - /* "src/helpers/diffusion.pyx":386 - * cmj[i*3+2] += c2*(longer[i*upper*3+3*k+2]) + /* "View.MemoryView":470 + * item = array * - * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< - * for j in range(m-i): - * dx = cmj[j*3] - cmj[(j+i)*3] + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_14 = __pyx_v_m; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_5 = (__pyx_t_14 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_5 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_19) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_result) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_5; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_result = ((double)__PYX_NAN()); + /*try:*/ { - /* "src/helpers/diffusion.pyx":387 + /* "View.MemoryView":471 * - * for i in prange(m,nogil=True): - * for j in range(m-i): # <<<<<<<<<<<<<< - * dx = cmj[j*3] - cmj[(j+i)*3] - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] - */ - __pyx_t_15 = (__pyx_v_m - __pyx_v_i); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; - - /* "src/helpers/diffusion.pyx":388 - * for i in prange(m,nogil=True): - * for j in range(m-i): - * dx = cmj[j*3] - cmj[(j+i)*3] # <<<<<<<<<<<<<< - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] - */ - __pyx_v_dx = ((__pyx_v_cmj[(__pyx_v_j * 3)]) - (__pyx_v_cmj[((__pyx_v_j + __pyx_v_i) * 3)])); - - /* "src/helpers/diffusion.pyx":389 - * for j in range(m-i): - * dx = cmj[j*3] - cmj[(j+i)*3] - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] # <<<<<<<<<<<<<< - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] - * result = dx*dx+dy*dy+dz*dz - */ - __pyx_v_dy = ((__pyx_v_cmj[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); - - /* "src/helpers/diffusion.pyx":390 - * dx = cmj[j*3] - cmj[(j+i)*3] - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] # <<<<<<<<<<<<<< - * result = dx*dx+dy*dy+dz*dz - * msd[i]+=result + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - __pyx_v_dz = ((__pyx_v_cmj[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); + if (__pyx_v_self->dtype_is_object) { - /* "src/helpers/diffusion.pyx":391 - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] - * result = dx*dx+dy*dy+dz*dz # <<<<<<<<<<<<<< - * msd[i]+=result - * c[i]+=1 + /* "View.MemoryView":472 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) */ - __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - /* "src/helpers/diffusion.pyx":392 - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] - * result = dx*dx+dy*dy+dz*dz - * msd[i]+=result # <<<<<<<<<<<<<< - * c[i]+=1 + /* "View.MemoryView":471 * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - __pyx_t_19 = __pyx_v_i; - (__pyx_v_msd[__pyx_t_19]) = ((__pyx_v_msd[__pyx_t_19]) + __pyx_v_result); + goto __pyx_L8; + } - /* "src/helpers/diffusion.pyx":393 - * result = dx*dx+dy*dy+dz*dz - * msd[i]+=result - * c[i]+=1 # <<<<<<<<<<<<<< + /* "View.MemoryView":474 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< * - * for i in range(m): - */ - __pyx_t_19 = __pyx_v_i; - (__pyx_v_c[__pyx_t_19]) = ((__pyx_v_c[__pyx_t_19]) + 1); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - - /* "src/helpers/diffusion.pyx":386 - * cmj[i*3+2] += c2*(longer[i*upper*3+3*k+2]) * - * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< - * for j in range(m-i): - * dx = cmj[j*3] - cmj[(j+i)*3] */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L22; - } - __pyx_L22:; - } - } + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; - /* "src/helpers/diffusion.pyx":395 - * c[i]+=1 + /* "View.MemoryView":478 * - * for i in range(m): # <<<<<<<<<<<<<< - * msd[i]/=c[i] * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - __pyx_t_5 = __pyx_v_m; - __pyx_t_13 = __pyx_t_5; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_i = __pyx_t_14; + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { - /* "src/helpers/diffusion.pyx":396 - * - * for i in range(m): - * msd[i]/=c[i] # <<<<<<<<<<<<<< + /* "View.MemoryView":479 * - * return msdmj + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) */ - __pyx_t_15 = __pyx_v_i; - if (unlikely((__pyx_v_c[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 396, __pyx_L1_error) - } - (__pyx_v_msd[__pyx_t_15]) = ((__pyx_v_msd[__pyx_t_15]) / (__pyx_v_c[__pyx_v_i])); - } + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 479, __pyx_L6_error) - /* "src/helpers/diffusion.pyx":398 - * msd[i]/=c[i] + /* "View.MemoryView":478 * - * return msdmj # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_msdmj)); - __pyx_r = ((PyObject *)__pyx_v_msdmj); - goto __pyx_L0; + } - /* "src/helpers/diffusion.pyx":312 - * - * @cython.boundscheck(False) - * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, + /* "View.MemoryView":480 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: */ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } - /* function exit code */ + /* "View.MemoryView":483 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< + * + * cdef setitem_indexed(self, index, value): + */ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + } + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.diffusion.msdMJCharges", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_mj); - __Pyx_XDECREF((PyObject *)__pyx_v_msdmj); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/diffusion.pyx":401 +/* "View.MemoryView":485 + * PyMem_Free(tmp) * - * @cython.boundscheck(False) - * def crossDisplacementMdMj(double [:, :, :] coms_cat, # <<<<<<<<<<<<<< - * double [:, :, :] coms_an, - * double [:, :] md): + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9diffusion_13crossDisplacementMdMj(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_13crossDisplacementMdMj = {"crossDisplacementMdMj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9diffusion_13crossDisplacementMdMj, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_9diffusion_13crossDisplacementMdMj(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coms_cat = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coms_an = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_md = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("crossDisplacementMdMj (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms_cat,&__pyx_n_s_coms_an,&__pyx_n_s_md,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms_cat)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms_an)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("crossDisplacementMdMj", 1, 3, 3, 1); __PYX_ERR(0, 401, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_md)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("crossDisplacementMdMj", 1, 3, 3, 2); __PYX_ERR(0, 401, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "crossDisplacementMdMj") < 0)) __PYX_ERR(0, 401, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_coms_cat = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms_cat.memview)) __PYX_ERR(0, 401, __pyx_L3_error) - __pyx_v_coms_an = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms_an.memview)) __PYX_ERR(0, 402, __pyx_L3_error) - __pyx_v_md = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_md.memview)) __PYX_ERR(0, 403, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("crossDisplacementMdMj", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 401, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.diffusion.crossDisplacementMdMj", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_9diffusion_12crossDisplacementMdMj(__pyx_self, __pyx_v_coms_cat, __pyx_v_coms_an, __pyx_v_md); + __Pyx_RefNannySetupContext("setitem_indexed", 0); + + /* "View.MemoryView":486 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 486, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; + + /* "View.MemoryView":487 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":485 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) + */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9diffusion_12crossDisplacementMdMj(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coms_cat, __Pyx_memviewslice __pyx_v_coms_an, __Pyx_memviewslice __pyx_v_md) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_nts; - int __pyx_v_nion; - PyObject *__pyx_v_mj_arr = NULL; - __Pyx_memviewslice __pyx_v_mj = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_v_ctr_arr = NULL; - __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_v_disp_arr = NULL; - __Pyx_memviewslice __pyx_v_disp = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_result; +/* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + */ + +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_9; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("crossDisplacementMdMj", 0); + __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "src/helpers/diffusion.pyx":405 - * double [:, :] md): - * - * cdef int i, j, nts=coms_cat.shape[0], nion=coms_cat.shape[1] # <<<<<<<<<<<<<< + /* "View.MemoryView":492 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem * - * mj_arr = cython.view.array(shape=(nts,3), itemsize=sizeof(double), format="d") */ - __pyx_v_nts = (__pyx_v_coms_cat.shape[0]); - __pyx_v_nion = (__pyx_v_coms_cat.shape[1]); + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/diffusion.pyx":407 - * cdef int i, j, nts=coms_cat.shape[0], nion=coms_cat.shape[1] + /* "View.MemoryView":495 + * cdef bytes bytesitem * - * mj_arr = cython.view.array(shape=(nts,3), itemsize=sizeof(double), format="d") # <<<<<<<<<<<<<< - * cdef double [:, :] mj = mj_arr - * ctr_arr = np.zeros(nts, dtype=np.int32) + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3); - __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_3) < 0) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 407, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_mj_arr = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/diffusion.pyx":408 + /* "View.MemoryView":496 * - * mj_arr = cython.view.array(shape=(nts,3), itemsize=sizeof(double), format="d") - * cdef double [:, :] mj = mj_arr # <<<<<<<<<<<<<< - * ctr_arr = np.zeros(nts, dtype=np.int32) - * cdef int [:] ctr = ctr_arr - */ - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_mj_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 408, __pyx_L1_error) - __pyx_v_mj = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; - - /* "src/helpers/diffusion.pyx":409 - * mj_arr = cython.view.array(shape=(nts,3), itemsize=sizeof(double), format="d") - * cdef double [:, :] mj = mj_arr - * ctr_arr = np.zeros(nts, dtype=np.int32) # <<<<<<<<<<<<<< - * cdef int [:] ctr = ctr_arr - * disp_arr = np.zeros(nts) + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_ctr_arr = __pyx_t_6; - __pyx_t_6 = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { - /* "src/helpers/diffusion.pyx":410 - * cdef double [:, :] mj = mj_arr - * ctr_arr = np.zeros(nts, dtype=np.int32) - * cdef int [:] ctr = ctr_arr # <<<<<<<<<<<<<< - * disp_arr = np.zeros(nts) - * cdef double [:] disp = disp_arr + /* "View.MemoryView":497 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" */ - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_ctr_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 410, __pyx_L1_error) - __pyx_v_ctr = __pyx_t_7; - __pyx_t_7.memview = NULL; - __pyx_t_7.data = NULL; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/diffusion.pyx":411 - * ctr_arr = np.zeros(nts, dtype=np.int32) - * cdef int [:] ctr = ctr_arr - * disp_arr = np.zeros(nts) # <<<<<<<<<<<<<< - * cdef double [:] disp = disp_arr + /* "View.MemoryView":496 * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); } - } - __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_disp_arr = __pyx_t_6; - __pyx_t_6 = 0; - /* "src/helpers/diffusion.pyx":412 - * cdef int [:] ctr = ctr_arr - * disp_arr = np.zeros(nts) - * cdef double [:] disp = disp_arr # <<<<<<<<<<<<<< - * - * cdef double dx, dy, dz, result + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result */ - __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_disp_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 412, __pyx_L1_error) - __pyx_v_disp = __pyx_t_8; - __pyx_t_8.memview = NULL; - __pyx_t_8.data = NULL; + /*else:*/ { + __pyx_t_9 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 501, __pyx_L5_except_error) + __pyx_t_10 = (__pyx_t_9 == 1); + if (__pyx_t_10) { - /* "src/helpers/diffusion.pyx":416 - * cdef double dx, dy, dz, result + /* "View.MemoryView":502 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result * - * for i in prange(nts, nogil=True): # <<<<<<<<<<<<<< - * for j in range(nion): - * mj[i][0] += coms_cat[i][j][0] */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_9 = __pyx_v_nts; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_11 = (__pyx_t_9 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_11 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) - #endif /* _OPENMP */ - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_10); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 502, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; + + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result + */ + } - /* "src/helpers/diffusion.pyx":417 + /* "View.MemoryView":503 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< * - * for i in prange(nts, nogil=True): - * for j in range(nion): # <<<<<<<<<<<<<< - * mj[i][0] += coms_cat[i][j][0] - * mj[i][1] += coms_cat[i][j][1] + * cdef assign_item_from_object(self, char *itemp, object value): */ - __pyx_t_12 = __pyx_v_nion; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_j = __pyx_t_14; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/diffusion.pyx":418 - * for i in prange(nts, nogil=True): - * for j in range(nion): - * mj[i][0] += coms_cat[i][j][0] # <<<<<<<<<<<<<< - * mj[i][1] += coms_cat[i][j][1] - * mj[i][2] += coms_cat[i][j][2] + /* "View.MemoryView":498 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: */ - __pyx_t_15 = __pyx_v_i; - __pyx_t_16 = __pyx_v_j; - __pyx_t_17 = 0; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_cat.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_cat.shape[1]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_cat.shape[2]; - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_18 * __pyx_v_mj.strides[0]) ) + __pyx_t_19 * __pyx_v_mj.strides[1]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_cat.data + __pyx_t_15 * __pyx_v_coms_cat.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_cat.strides[1]) ) + __pyx_t_17 * __pyx_v_coms_cat.strides[2]) ))); + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_6); + __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; + if (__pyx_t_8) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_1); - /* "src/helpers/diffusion.pyx":419 - * for j in range(nion): - * mj[i][0] += coms_cat[i][j][0] - * mj[i][1] += coms_cat[i][j][1] # <<<<<<<<<<<<<< - * mj[i][2] += coms_cat[i][j][2] - * mj[i][0] -= coms_an[i][j][0] + /* "View.MemoryView":499 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: */ - __pyx_t_17 = __pyx_v_i; - __pyx_t_16 = __pyx_v_j; - __pyx_t_15 = 1; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_cat.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_cat.shape[1]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_cat.shape[2]; - __pyx_t_19 = __pyx_v_i; - __pyx_t_18 = 1; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_19 * __pyx_v_mj.strides[0]) ) + __pyx_t_18 * __pyx_v_mj.strides[1]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_cat.data + __pyx_t_17 * __pyx_v_coms_cat.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_cat.strides[1]) ) + __pyx_t_15 * __pyx_v_coms_cat.strides[2]) ))); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 499, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "src/helpers/diffusion.pyx":420 - * mj[i][0] += coms_cat[i][j][0] - * mj[i][1] += coms_cat[i][j][1] - * mj[i][2] += coms_cat[i][j][2] # <<<<<<<<<<<<<< - * mj[i][0] -= coms_an[i][j][0] - * mj[i][1] -= coms_an[i][j][1] + /* "View.MemoryView":496 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - __pyx_t_15 = __pyx_v_i; - __pyx_t_16 = __pyx_v_j; - __pyx_t_17 = 2; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_cat.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_cat.shape[1]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_cat.shape[2]; - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_18 * __pyx_v_mj.strides[0]) ) + __pyx_t_19 * __pyx_v_mj.strides[1]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_cat.data + __pyx_t_15 * __pyx_v_coms_cat.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_cat.strides[1]) ) + __pyx_t_17 * __pyx_v_coms_cat.strides[2]) ))); + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; + } - /* "src/helpers/diffusion.pyx":421 - * mj[i][1] += coms_cat[i][j][1] - * mj[i][2] += coms_cat[i][j][2] - * mj[i][0] -= coms_an[i][j][0] # <<<<<<<<<<<<<< - * mj[i][1] -= coms_an[i][j][1] - * mj[i][2] -= coms_an[i][j][2] + /* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_t_17 = __pyx_v_i; - __pyx_t_16 = __pyx_v_j; - __pyx_t_15 = 0; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_an.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_an.shape[1]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_an.shape[2]; - __pyx_t_19 = __pyx_v_i; - __pyx_t_18 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_19 * __pyx_v_mj.strides[0]) ) + __pyx_t_18 * __pyx_v_mj.strides[1]) )) -= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_an.data + __pyx_t_17 * __pyx_v_coms_an.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_an.strides[1]) ) + __pyx_t_15 * __pyx_v_coms_an.strides[2]) ))); - /* "src/helpers/diffusion.pyx":422 - * mj[i][2] += coms_cat[i][j][2] - * mj[i][0] -= coms_an[i][j][0] - * mj[i][1] -= coms_an[i][j][1] # <<<<<<<<<<<<<< - * mj[i][2] -= coms_an[i][j][2] + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":505 + * return result * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_t_15 = __pyx_v_i; - __pyx_t_16 = __pyx_v_j; - __pyx_t_17 = 1; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_an.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_an.shape[1]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_an.shape[2]; - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = 1; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_18 * __pyx_v_mj.strides[0]) ) + __pyx_t_19 * __pyx_v_mj.strides[1]) )) -= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_an.data + __pyx_t_15 * __pyx_v_coms_an.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_an.strides[1]) ) + __pyx_t_17 * __pyx_v_coms_an.strides[2]) ))); - /* "src/helpers/diffusion.pyx":423 - * mj[i][0] -= coms_an[i][j][0] - * mj[i][1] -= coms_an[i][j][1] - * mj[i][2] -= coms_an[i][j][2] # <<<<<<<<<<<<<< - * - * for i in prange(nts, nogil=True): +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + char *__pyx_t_10; + char *__pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":508 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue */ - __pyx_t_17 = __pyx_v_i; - __pyx_t_16 = __pyx_v_j; - __pyx_t_15 = 2; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_an.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_an.shape[1]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_an.shape[2]; - __pyx_t_19 = __pyx_v_i; - __pyx_t_18 = 2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_19 * __pyx_v_mj.strides[0]) ) + __pyx_t_18 * __pyx_v_mj.strides[1]) )) -= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_an.data + __pyx_t_17 * __pyx_v_coms_an.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_an.strides[1]) ) + __pyx_t_15 * __pyx_v_coms_an.strides[2]) ))); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/diffusion.pyx":416 - * cdef double dx, dy, dz, result + /* "View.MemoryView":513 + * cdef Py_ssize_t i * - * for i in prange(nts, nogil=True): # <<<<<<<<<<<<<< - * for j in range(nion): - * mj[i][0] += coms_cat[i][j][0] + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } + __pyx_t_2 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_2) { - /* "src/helpers/diffusion.pyx":425 - * mj[i][2] -= coms_an[i][j][2] + /* "View.MemoryView":514 * - * for i in prange(nts, nogil=True): # <<<<<<<<<<<<<< - * for j in range(nts-i): - * dx = md[j][0] - mj[i+j][0] + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_11 = __pyx_v_nts; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_9 = (__pyx_t_11 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_9 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_result) - #endif /* _OPENMP */ - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_10); - /* Initialize private variables to invalid values */ - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_result = ((double)__PYX_NAN()); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 514, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/diffusion.pyx":426 + /* "View.MemoryView":513 + * cdef Py_ssize_t i * - * for i in prange(nts, nogil=True): - * for j in range(nts-i): # <<<<<<<<<<<<<< - * dx = md[j][0] - mj[i+j][0] - * dy = md[j][1] - mj[i+j][1] + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: */ - __pyx_t_12 = (__pyx_v_nts - __pyx_v_i); - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_j = __pyx_t_14; + goto __pyx_L3; + } - /* "src/helpers/diffusion.pyx":427 - * for i in prange(nts, nogil=True): - * for j in range(nts-i): - * dx = md[j][0] - mj[i+j][0] # <<<<<<<<<<<<<< - * dy = md[j][1] - mj[i+j][1] - * dz = md[j][2] - mj[i+j][2] + /* "View.MemoryView":516 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + * + * for i, c in enumerate(bytesvalue): */ - __pyx_t_15 = __pyx_v_j; - __pyx_t_16 = 0; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_md.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_md.shape[1]; - __pyx_t_17 = (__pyx_v_i + __pyx_v_j); - __pyx_t_18 = 0; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_mj.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_md.data + __pyx_t_15 * __pyx_v_md.strides[0]) ) + __pyx_t_16 * __pyx_v_md.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_17 * __pyx_v_mj.strides[0]) ) + __pyx_t_18 * __pyx_v_mj.strides[1]) )))); - - /* "src/helpers/diffusion.pyx":428 - * for j in range(nts-i): - * dx = md[j][0] - mj[i+j][0] - * dy = md[j][1] - mj[i+j][1] # <<<<<<<<<<<<<< - * dz = md[j][2] - mj[i+j][2] - * result = dx*dx + dy*dy + dz*dz - */ - __pyx_t_18 = __pyx_v_j; - __pyx_t_17 = 1; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_md.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_md.shape[1]; - __pyx_t_16 = (__pyx_v_i + __pyx_v_j); - __pyx_t_15 = 1; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_mj.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_mj.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_md.data + __pyx_t_18 * __pyx_v_md.strides[0]) ) + __pyx_t_17 * __pyx_v_md.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_16 * __pyx_v_mj.strides[0]) ) + __pyx_t_15 * __pyx_v_mj.strides[1]) )))); - - /* "src/helpers/diffusion.pyx":429 - * dx = md[j][0] - mj[i+j][0] - * dy = md[j][1] - mj[i+j][1] - * dz = md[j][2] - mj[i+j][2] # <<<<<<<<<<<<<< - * result = dx*dx + dy*dy + dz*dz - * disp[i] = disp[i] + result - */ - __pyx_t_15 = __pyx_v_j; - __pyx_t_16 = 2; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_md.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_md.shape[1]; - __pyx_t_17 = (__pyx_v_i + __pyx_v_j); - __pyx_t_18 = 2; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_mj.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_md.data + __pyx_t_15 * __pyx_v_md.strides[0]) ) + __pyx_t_16 * __pyx_v_md.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_17 * __pyx_v_mj.strides[0]) ) + __pyx_t_18 * __pyx_v_mj.strides[1]) )))); - - /* "src/helpers/diffusion.pyx":430 - * dy = md[j][1] - mj[i+j][1] - * dz = md[j][2] - mj[i+j][2] - * result = dx*dx + dy*dy + dz*dz # <<<<<<<<<<<<<< - * disp[i] = disp[i] + result - * ctr[i] = ctr[i] + 1 - */ - __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); - - /* "src/helpers/diffusion.pyx":431 - * dz = md[j][2] - mj[i+j][2] - * result = dx*dx + dy*dy + dz*dz - * disp[i] = disp[i] + result # <<<<<<<<<<<<<< - * ctr[i] = ctr[i] + 1 - * disp[i] /= ctr[i] - */ - __pyx_t_18 = __pyx_v_i; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_disp.shape[0]; - __pyx_t_17 = __pyx_v_i; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_disp.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_17 * __pyx_v_disp.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_18 * __pyx_v_disp.strides[0]) ))) + __pyx_v_result); + /*else*/ { + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_value}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L3:; - /* "src/helpers/diffusion.pyx":432 - * result = dx*dx + dy*dy + dz*dz - * disp[i] = disp[i] + result - * ctr[i] = ctr[i] + 1 # <<<<<<<<<<<<<< - * disp[i] /= ctr[i] + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c * */ - __pyx_t_18 = __pyx_v_i; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[0]; - __pyx_t_17 = __pyx_v_i; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_ctr.shape[0]; - *((int *) ( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_17 * __pyx_v_ctr.strides[0]) )) = ((*((int *) ( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_18 * __pyx_v_ctr.strides[0]) ))) + 1); - } + __pyx_t_7 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 518, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_8 = __pyx_v_bytesvalue; + __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8); + __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8)); + for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) { + __pyx_t_9 = __pyx_t_12; + __pyx_v_c = (__pyx_t_9[0]); - /* "src/helpers/diffusion.pyx":433 - * disp[i] = disp[i] + result - * ctr[i] = ctr[i] + 1 - * disp[i] /= ctr[i] # <<<<<<<<<<<<<< + /* "View.MemoryView":519 * - * return disp_arr + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') */ - __pyx_t_18 = __pyx_v_i; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[0]; - __pyx_t_17 = __pyx_v_i; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_disp.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_17 * __pyx_v_disp.strides[0]) )) /= (*((int *) ( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_18 * __pyx_v_ctr.strides[0]) ))); - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_v_i = __pyx_t_7; - /* "src/helpers/diffusion.pyx":425 - * mj[i][2] -= coms_an[i][j][2] + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c * - * for i in prange(nts, nogil=True): # <<<<<<<<<<<<<< - * for j in range(nts-i): - * dx = md[j][0] - mj[i+j][0] */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L16; - } - __pyx_L16:; - } - } + __pyx_t_7 = (__pyx_t_7 + 1); - /* "src/helpers/diffusion.pyx":435 - * disp[i] /= ctr[i] + /* "View.MemoryView":519 * - * return disp_arr # <<<<<<<<<<<<<< + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * @cname('getbuffer') */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_disp_arr); - __pyx_r = __pyx_v_disp_arr; - goto __pyx_L0; + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/helpers/diffusion.pyx":401 + /* "View.MemoryView":505 + * return result * - * @cython.boundscheck(False) - * def crossDisplacementMdMj(double [:, :, :] coms_cat, # <<<<<<<<<<<<<< - * double [:, :, :] coms_an, - * double [:, :] md): + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); - __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1); - __Pyx_AddTraceback("newanalysis.diffusion.crossDisplacementMdMj", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_mj_arr); - __PYX_XDEC_MEMVIEW(&__pyx_v_mj, 1); - __Pyx_XDECREF(__pyx_v_ctr_arr); - __PYX_XDEC_MEMVIEW(&__pyx_v_ctr, 1); - __Pyx_XDECREF(__pyx_v_disp_arr); - __PYX_XDEC_MEMVIEW(&__pyx_v_disp, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coms_cat, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coms_an, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_md, 1); + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/diffusion.pyx":438 +/* "View.MemoryView":521 + * itemp[i] = c * - * @cython.boundscheck(False) - * def msdMJdecomp(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * np.ndarray[np.float64_t,ndim=3] coms_sep, + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9diffusion_15msdMJdecomp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9diffusion_14msdMJdecomp[] = "\n msdMJdecomp(coms_cat, coms_an, coms_sep, charge, maxlen=None)\n\n Calculates part of total autocorrelation, namely .\n\n Takes three center-of-mass arrays of the whole unfolded trajectory, one for cations, the second for anions,\n the third of the separate species and an integer that specifies the charge of the separate species.\n\n Usage:\n msdmj = msdMJdecomp(coms_cat, coms_an, coms_sep, charge)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_15msdMJdecomp = {"msdMJdecomp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9diffusion_15msdMJdecomp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_14msdMJdecomp}; -static PyObject *__pyx_pw_11newanalysis_9diffusion_15msdMJdecomp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_coms_cat = 0; - PyArrayObject *__pyx_v_coms_an = 0; - PyArrayObject *__pyx_v_coms_sep = 0; - int __pyx_v_charge; - PyObject *__pyx_v_maxlen = 0; +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("msdMJdecomp (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms_cat,&__pyx_n_s_coms_an,&__pyx_n_s_coms_sep,&__pyx_n_s_charge,&__pyx_n_s_maxlen,0}; - PyObject* values[5] = {0,0,0,0,0}; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); - /* "src/helpers/diffusion.pyx":442 - * np.ndarray[np.float64_t,ndim=3] coms_sep, - * int charge, - * maxlen=None): # <<<<<<<<<<<<<< - * """ - * msdMJdecomp(coms_cat, coms_an, coms_sep, charge, maxlen=None) + /* "View.MemoryView":523 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * */ - values[4] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms_cat)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms_an)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("msdMJdecomp", 0, 4, 5, 1); __PYX_ERR(0, 438, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms_sep)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("msdMJdecomp", 0, 4, 5, 2); __PYX_ERR(0, 438, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("msdMJdecomp", 0, 4, 5, 3); __PYX_ERR(0, 438, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msdMJdecomp") < 0)) __PYX_ERR(0, 438, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_coms_cat = ((PyArrayObject *)values[0]); - __pyx_v_coms_an = ((PyArrayObject *)values[1]); - __pyx_v_coms_sep = ((PyArrayObject *)values[2]); - __pyx_v_charge = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_charge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) - __pyx_v_maxlen = values[4]; + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("msdMJdecomp", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 438, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.diffusion.msdMJdecomp", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_cat), __pyx_ptype_5numpy_ndarray, 1, "coms_cat", 0))) __PYX_ERR(0, 438, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_an), __pyx_ptype_5numpy_ndarray, 1, "coms_an", 0))) __PYX_ERR(0, 439, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_sep), __pyx_ptype_5numpy_ndarray, 1, "coms_sep", 0))) __PYX_ERR(0, 440, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9diffusion_14msdMJdecomp(__pyx_self, __pyx_v_coms_cat, __pyx_v_coms_an, __pyx_v_coms_sep, __pyx_v_charge, __pyx_v_maxlen); + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "src/helpers/diffusion.pyx":438 + /* "View.MemoryView":524 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def msdMJdecomp(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * np.ndarray[np.float64_t,ndim=3] coms_sep, + * if flags & PyBUF_ND: */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 524, __pyx_L1_error) - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_9diffusion_14msdMJdecomp(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyArrayObject *__pyx_v_coms_sep, int __pyx_v_charge, PyObject *__pyx_v_maxlen) { - int __pyx_v_n1; - int __pyx_v_n2; - int __pyx_v_n3; - int __pyx_v_m; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_ch; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_dxs; - double __pyx_v_dys; - double __pyx_v_dzs; - double __pyx_v_result; - double *__pyx_v_cat; - double *__pyx_v_an; - double *__pyx_v_sep; - PyArrayObject *__pyx_v_mj = 0; - double *__pyx_v_cmj; - PyArrayObject *__pyx_v_mj_sep = 0; - double *__pyx_v_cmj_sep; - PyArrayObject *__pyx_v_msdmj = 0; - double *__pyx_v_msd; - PyArrayObject *__pyx_v_ctr = 0; - int *__pyx_v_c; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_an; - __Pyx_Buffer __pyx_pybuffer_coms_an; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_cat; - __Pyx_Buffer __pyx_pybuffer_coms_cat; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_sep; - __Pyx_Buffer __pyx_pybuffer_coms_sep; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_mj; - __Pyx_Buffer __pyx_pybuffer_mj; - __Pyx_LocalBuf_ND __pyx_pybuffernd_mj_sep; - __Pyx_Buffer __pyx_pybuffer_mj_sep; - __Pyx_LocalBuf_ND __pyx_pybuffernd_msdmj; - __Pyx_Buffer __pyx_pybuffer_msdmj; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("msdMJdecomp", 0); - __pyx_pybuffer_mj.pybuffer.buf = NULL; - __pyx_pybuffer_mj.refcount = 0; - __pyx_pybuffernd_mj.data = NULL; - __pyx_pybuffernd_mj.rcbuffer = &__pyx_pybuffer_mj; - __pyx_pybuffer_mj_sep.pybuffer.buf = NULL; - __pyx_pybuffer_mj_sep.refcount = 0; - __pyx_pybuffernd_mj_sep.data = NULL; - __pyx_pybuffernd_mj_sep.rcbuffer = &__pyx_pybuffer_mj_sep; - __pyx_pybuffer_msdmj.pybuffer.buf = NULL; - __pyx_pybuffer_msdmj.refcount = 0; - __pyx_pybuffernd_msdmj.data = NULL; - __pyx_pybuffernd_msdmj.rcbuffer = &__pyx_pybuffer_msdmj; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_coms_cat.pybuffer.buf = NULL; - __pyx_pybuffer_coms_cat.refcount = 0; - __pyx_pybuffernd_coms_cat.data = NULL; - __pyx_pybuffernd_coms_cat.rcbuffer = &__pyx_pybuffer_coms_cat; - __pyx_pybuffer_coms_an.pybuffer.buf = NULL; - __pyx_pybuffer_coms_an.refcount = 0; - __pyx_pybuffernd_coms_an.data = NULL; - __pyx_pybuffernd_coms_an.rcbuffer = &__pyx_pybuffer_coms_an; - __pyx_pybuffer_coms_sep.pybuffer.buf = NULL; - __pyx_pybuffer_coms_sep.refcount = 0; - __pyx_pybuffernd_coms_sep.data = NULL; - __pyx_pybuffernd_coms_sep.rcbuffer = &__pyx_pybuffer_coms_sep; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_cat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 438, __pyx_L1_error) - } - __pyx_pybuffernd_coms_cat.diminfo[0].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_cat.diminfo[0].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_cat.diminfo[1].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_cat.diminfo[1].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_cat.diminfo[2].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_cat.diminfo[2].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_an, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 438, __pyx_L1_error) - } - __pyx_pybuffernd_coms_an.diminfo[0].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_an.diminfo[0].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_an.diminfo[1].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_an.diminfo[1].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_an.diminfo[2].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_an.diminfo[2].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_sep.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_sep, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 438, __pyx_L1_error) + /* "View.MemoryView":523 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + */ } - __pyx_pybuffernd_coms_sep.diminfo[0].strides = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_sep.diminfo[0].shape = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_sep.diminfo[1].strides = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_sep.diminfo[1].shape = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_sep.diminfo[2].strides = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_sep.diminfo[2].shape = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.shape[2]; - /* "src/helpers/diffusion.pyx":458 - * cdef double dx,dy,dz,dxs,dys,dzs,result - * - * ch = charge # <<<<<<<<<<<<<< + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * - * n1 = len(coms_cat) + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ - __pyx_v_ch = __pyx_v_charge; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":460 - * ch = charge + /* "View.MemoryView":527 * - * n1 = len(coms_cat) # <<<<<<<<<<<<<< - * n2 = len(coms_cat[0]) - * n3 = len(coms_sep[0]) + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coms_cat)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 460, __pyx_L1_error) - __pyx_v_n1 = __pyx_t_1; + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; - /* "src/helpers/diffusion.pyx":461 - * - * n1 = len(coms_cat) - * n2 = len(coms_cat[0]) # <<<<<<<<<<<<<< - * n3 = len(coms_sep[0]) + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_cat), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 461, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n2 = __pyx_t_1; + goto __pyx_L6; + } - /* "src/helpers/diffusion.pyx":462 - * n1 = len(coms_cat) - * n2 = len(coms_cat[0]) - * n3 = len(coms_sep[0]) # <<<<<<<<<<<<<< + /* "View.MemoryView":529 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< * - * if maxlen == None: + * if flags & PyBUF_STRIDES: */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_sep), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_n3 = __pyx_t_1; + /*else*/ { + __pyx_v_info->shape = NULL; + } + __pyx_L6:; - /* "src/helpers/diffusion.pyx":464 - * n3 = len(coms_sep[0]) + /* "View.MemoryView":531 + * info.shape = NULL * - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":465 + /* "View.MemoryView":532 * - * if maxlen == None: - * m = n1 # <<<<<<<<<<<<<< - * else: - * m = maxlen + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL */ - __pyx_v_m = __pyx_v_n1; + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; - /* "src/helpers/diffusion.pyx":464 - * n3 = len(coms_sep[0]) + /* "View.MemoryView":531 + * info.shape = NULL * - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - goto __pyx_L3; + goto __pyx_L7; } - /* "src/helpers/diffusion.pyx":467 - * m = n1 - * else: - * m = maxlen # <<<<<<<<<<<<<< + /* "View.MemoryView":534 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< * - * cdef double *cat = coms_cat.data + * if flags & PyBUF_INDIRECT: */ /*else*/ { - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 467, __pyx_L1_error) - __pyx_v_m = ((int)__pyx_t_4); + __pyx_v_info->strides = NULL; } - __pyx_L3:; + __pyx_L7:; - /* "src/helpers/diffusion.pyx":469 - * m = maxlen + /* "View.MemoryView":536 + * info.strides = NULL * - * cdef double *cat = coms_cat.data # <<<<<<<<<<<<<< - * cdef double *an = coms_an.data - * cdef double *sep = coms_sep.data + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: */ - __pyx_v_cat = ((double *)__pyx_v_coms_cat->data); - - /* "src/helpers/diffusion.pyx":470 - * - * cdef double *cat = coms_cat.data - * cdef double *an = coms_an.data # <<<<<<<<<<<<<< - * cdef double *sep = coms_sep.data + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":537 * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL */ - __pyx_v_an = ((double *)__pyx_v_coms_an->data); + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; - /* "src/helpers/diffusion.pyx":471 - * cdef double *cat = coms_cat.data - * cdef double *an = coms_an.data - * cdef double *sep = coms_sep.data # <<<<<<<<<<<<<< + /* "View.MemoryView":536 + * info.strides = NULL * - * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: */ - __pyx_v_sep = ((double *)__pyx_v_coms_sep->data); + goto __pyx_L8; + } - /* "src/helpers/diffusion.pyx":473 - * cdef double *sep = coms_sep.data - * - * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *cmj = mj.data + /* "View.MemoryView":539 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< * + * if flags & PyBUF_FORMAT: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_3); - __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 473, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 473, __pyx_L1_error) - __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_mj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 473, __pyx_L1_error) - } else {__pyx_pybuffernd_mj.diminfo[0].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj.diminfo[0].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj.diminfo[1].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj.diminfo[1].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[1]; - } + /*else*/ { + __pyx_v_info->suboffsets = NULL; } - __pyx_t_9 = 0; - __pyx_v_mj = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; + __pyx_L8:; - /* "src/helpers/diffusion.pyx":474 - * - * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) - * cdef double *cmj = mj.data # <<<<<<<<<<<<<< + /* "View.MemoryView":541 + * info.suboffsets = NULL * - * cdef np.ndarray[np.float64_t,ndim=2] mj_sep = np.zeros((n1,3),dtype=np.float64) + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: */ - __pyx_v_cmj = ((double *)__pyx_v_mj->data); + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":476 - * cdef double *cmj = mj.data - * - * cdef np.ndarray[np.float64_t,ndim=2] mj_sep = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *cmj_sep = mj_sep.data + /* "View.MemoryView":542 * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_3); - __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 476, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 476, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_7); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj_sep.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_mj_sep = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj_sep.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 476, __pyx_L1_error) - } else {__pyx_pybuffernd_mj_sep.diminfo[0].strides = __pyx_pybuffernd_mj_sep.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj_sep.diminfo[0].shape = __pyx_pybuffernd_mj_sep.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj_sep.diminfo[1].strides = __pyx_pybuffernd_mj_sep.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj_sep.diminfo[1].shape = __pyx_pybuffernd_mj_sep.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_10 = 0; - __pyx_v_mj_sep = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; - /* "src/helpers/diffusion.pyx":477 - * - * cdef np.ndarray[np.float64_t,ndim=2] mj_sep = np.zeros((n1,3),dtype=np.float64) - * cdef double *cmj_sep = mj_sep.data # <<<<<<<<<<<<<< + /* "View.MemoryView":541 + * info.suboffsets = NULL * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: */ - __pyx_v_cmj_sep = ((double *)__pyx_v_mj_sep->data); + goto __pyx_L9; + } - /* "src/helpers/diffusion.pyx":479 - * cdef double *cmj_sep = mj_sep.data - * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *msd = msdmj.data + /* "View.MemoryView":544 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< * + * info.buf = self.view.buf */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 479, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 479, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_msdmj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 479, __pyx_L1_error) - } else {__pyx_pybuffernd_msdmj.diminfo[0].strides = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msdmj.diminfo[0].shape = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.shape[0]; - } + /*else*/ { + __pyx_v_info->format = NULL; } - __pyx_t_11 = 0; - __pyx_v_msdmj = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_L9:; - /* "src/helpers/diffusion.pyx":480 - * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) - * cdef double *msd = msdmj.data # <<<<<<<<<<<<<< + /* "View.MemoryView":546 + * info.format = NULL * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize */ - __pyx_v_msd = ((double *)__pyx_v_msdmj->data); + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; - /* "src/helpers/diffusion.pyx":482 - * cdef double *msd = msdmj.data - * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< - * cdef int *c = ctr.data + /* "View.MemoryView":547 * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 482, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 482, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_12 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":548 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly + */ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":549 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self + */ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; - /* "src/helpers/diffusion.pyx":483 + /* "View.MemoryView":550 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) - * cdef int *c = ctr.data # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":551 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< * * */ - __pyx_v_c = ((int *)__pyx_v_ctr->data); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "src/helpers/diffusion.pyx":486 - * + /* "View.MemoryView":521 + * itemp[i] = c * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n2): - * cmj[i*3] += cat[i*n2*3+3*j] + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_n1; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_14 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_14 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); - /* "src/helpers/diffusion.pyx":487 + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":554 * - * for i in prange(n1,nogil=True): - * for j in range(n2): # <<<<<<<<<<<<<< - * cmj[i*3] += cat[i*n2*3+3*j] - * cmj[i*3+1] += cat[i*n2*3+3*j+1] + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ - __pyx_t_15 = __pyx_v_n2; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; - /* "src/helpers/diffusion.pyx":488 - * for i in prange(n1,nogil=True): - * for j in range(n2): - * cmj[i*3] += cat[i*n2*3+3*j] # <<<<<<<<<<<<<< - * cmj[i*3+1] += cat[i*n2*3+3*j+1] - * cmj[i*3+2] += cat[i*n2*3+3*j+2] - */ - __pyx_t_18 = (__pyx_v_i * 3); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_cat[(((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j))])); +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/diffusion.pyx":489 - * for j in range(n2): - * cmj[i*3] += cat[i*n2*3+3*j] - * cmj[i*3+1] += cat[i*n2*3+3*j+1] # <<<<<<<<<<<<<< - * cmj[i*3+2] += cat[i*n2*3+3*j+2] - * cmj[i*3] -= an[i*n2*3+3*j] - */ - __pyx_t_18 = ((__pyx_v_i * 3) + 1); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_cat[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 1)])); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":490 - * cmj[i*3] += cat[i*n2*3+3*j] - * cmj[i*3+1] += cat[i*n2*3+3*j+1] - * cmj[i*3+2] += cat[i*n2*3+3*j+2] # <<<<<<<<<<<<<< - * cmj[i*3] -= an[i*n2*3+3*j] - * cmj[i*3+1] -= an[i*n2*3+3*j+1] - */ - __pyx_t_18 = ((__pyx_v_i * 3) + 2); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_cat[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 2)])); +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/diffusion.pyx":491 - * cmj[i*3+1] += cat[i*n2*3+3*j+1] - * cmj[i*3+2] += cat[i*n2*3+3*j+2] - * cmj[i*3] -= an[i*n2*3+3*j] # <<<<<<<<<<<<<< - * cmj[i*3+1] -= an[i*n2*3+3*j+1] - * cmj[i*3+2] -= an[i*n2*3+3*j+2] + /* "View.MemoryView":556 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result */ - __pyx_t_18 = (__pyx_v_i * 3); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) - (__pyx_v_an[(((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j))])); + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 556, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/diffusion.pyx":492 - * cmj[i*3+2] += cat[i*n2*3+3*j+2] - * cmj[i*3] -= an[i*n2*3+3*j] - * cmj[i*3+1] -= an[i*n2*3+3*j+1] # <<<<<<<<<<<<<< - * cmj[i*3+2] -= an[i*n2*3+3*j+2] + /* "View.MemoryView":557 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result * */ - __pyx_t_18 = ((__pyx_v_i * 3) + 1); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) - (__pyx_v_an[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 1)])); + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 557, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":493 - * cmj[i*3] -= an[i*n2*3+3*j] - * cmj[i*3+1] -= an[i*n2*3+3*j+1] - * cmj[i*3+2] -= an[i*n2*3+3*j+2] # <<<<<<<<<<<<<< + /* "View.MemoryView":558 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< * - * for i in prange(n1,nogil=True): + * @property */ - __pyx_t_18 = ((__pyx_v_i * 3) + 2); - (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) - (__pyx_v_an[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 2)])); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":486 + /* "View.MemoryView":554 * * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n2): - * cmj[i*3] += cat[i*n2*3+3*j] + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } - /* "src/helpers/diffusion.pyx":495 - * cmj[i*3+2] -= an[i*n2*3+3*j+2] - * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n3): - * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_14 = __pyx_v_n1; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_4 = (__pyx_t_14 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_4 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_4; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":496 +/* "View.MemoryView":560 + * return result * - * for i in prange(n1,nogil=True): - * for j in range(n3): # <<<<<<<<<<<<<< - * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] - * cmj_sep[i*3+1]+= ch*sep[i*n3*3+3*j+1] + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ - __pyx_t_15 = __pyx_v_n3; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; - /* "src/helpers/diffusion.pyx":497 - * for i in prange(n1,nogil=True): - * for j in range(n3): - * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] # <<<<<<<<<<<<<< - * cmj_sep[i*3+1]+= ch*sep[i*n3*3+3*j+1] - * cmj_sep[i*3+2]+= ch*sep[i*n3*3+3*j+2] - */ - __pyx_t_18 = (__pyx_v_i * 3); - (__pyx_v_cmj_sep[__pyx_t_18]) = ((__pyx_v_cmj_sep[__pyx_t_18]) + (__pyx_v_ch * (__pyx_v_sep[(((__pyx_v_i * __pyx_v_n3) * 3) + (3 * __pyx_v_j))]))); +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/diffusion.pyx":498 - * for j in range(n3): - * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] - * cmj_sep[i*3+1]+= ch*sep[i*n3*3+3*j+1] # <<<<<<<<<<<<<< - * cmj_sep[i*3+2]+= ch*sep[i*n3*3+3*j+2] - * - */ - __pyx_t_18 = ((__pyx_v_i * 3) + 1); - (__pyx_v_cmj_sep[__pyx_t_18]) = ((__pyx_v_cmj_sep[__pyx_t_18]) + (__pyx_v_ch * (__pyx_v_sep[((((__pyx_v_i * __pyx_v_n3) * 3) + (3 * __pyx_v_j)) + 1)]))); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":499 - * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] - * cmj_sep[i*3+1]+= ch*sep[i*n3*3+3*j+1] - * cmj_sep[i*3+2]+= ch*sep[i*n3*3+3*j+2] # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_18 = ((__pyx_v_i * 3) + 2); - (__pyx_v_cmj_sep[__pyx_t_18]) = ((__pyx_v_cmj_sep[__pyx_t_18]) + (__pyx_v_ch * (__pyx_v_sep[((((__pyx_v_i * __pyx_v_n3) * 3) + (3 * __pyx_v_j)) + 2)]))); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - - /* "src/helpers/diffusion.pyx":495 - * cmj[i*3+2] -= an[i*n2*3+3*j+2] - * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n3): - * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L17; - } - __pyx_L17:; - } - } +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/diffusion.pyx":502 - * + /* "View.MemoryView":562 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< * - * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n1-i): - * dx = cmj[j*3] - cmj[(j+i)*3] + * cdef _get_base(self): */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_m; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_14 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_14 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_19) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dxs) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dys) lastprivate(__pyx_v_dz) lastprivate(__pyx_v_dzs) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_result) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dxs = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dys = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_dzs = ((double)__PYX_NAN()); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_result = ((double)__PYX_NAN()); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":503 + /* "View.MemoryView":560 + * return result * - * for i in prange(m,nogil=True): - * for j in range(n1-i): # <<<<<<<<<<<<<< - * dx = cmj[j*3] - cmj[(j+i)*3] - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ - __pyx_t_15 = (__pyx_v_n1 - __pyx_v_i); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; - /* "src/helpers/diffusion.pyx":504 - * for i in prange(m,nogil=True): - * for j in range(n1-i): - * dx = cmj[j*3] - cmj[(j+i)*3] # <<<<<<<<<<<<<< - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] - */ - __pyx_v_dx = ((__pyx_v_cmj[(__pyx_v_j * 3)]) - (__pyx_v_cmj[((__pyx_v_j + __pyx_v_i) * 3)])); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":505 - * for j in range(n1-i): - * dx = cmj[j*3] - cmj[(j+i)*3] - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] # <<<<<<<<<<<<<< - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] +/* "View.MemoryView":564 + * return self._get_base() * - */ - __pyx_v_dy = ((__pyx_v_cmj[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); - - /* "src/helpers/diffusion.pyx":506 - * dx = cmj[j*3] - cmj[(j+i)*3] - * dy = cmj[j*3+1] - cmj[(j+i)*3+1] - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] # <<<<<<<<<<<<<< + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj * - * dxs= cmj_sep[j*3] - cmj_sep[(j+i)*3] */ - __pyx_v_dz = ((__pyx_v_cmj[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); - /* "src/helpers/diffusion.pyx":508 - * dz = cmj[j*3+2] - cmj[(j+i)*3+2] +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":565 * - * dxs= cmj_sep[j*3] - cmj_sep[(j+i)*3] # <<<<<<<<<<<<<< - * dys= cmj_sep[j*3+1] - cmj_sep[(j+i)*3+1] - * dzs= cmj_sep[j*3+2] - cmj_sep[(j+i)*3+2] + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property */ - __pyx_v_dxs = ((__pyx_v_cmj_sep[(__pyx_v_j * 3)]) - (__pyx_v_cmj_sep[((__pyx_v_j + __pyx_v_i) * 3)])); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":509 + /* "View.MemoryView":564 + * return self._get_base() * - * dxs= cmj_sep[j*3] - cmj_sep[(j+i)*3] - * dys= cmj_sep[j*3+1] - cmj_sep[(j+i)*3+1] # <<<<<<<<<<<<<< - * dzs= cmj_sep[j*3+2] - cmj_sep[(j+i)*3+2] + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj * */ - __pyx_v_dys = ((__pyx_v_cmj_sep[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj_sep[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); - /* "src/helpers/diffusion.pyx":510 - * dxs= cmj_sep[j*3] - cmj_sep[(j+i)*3] - * dys= cmj_sep[j*3+1] - cmj_sep[(j+i)*3+1] - * dzs= cmj_sep[j*3+2] - cmj_sep[(j+i)*3+2] # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":567 + * return self.obj * - * result = dx*dxs+dy*dys+dz*dzs + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ - __pyx_v_dzs = ((__pyx_v_cmj_sep[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj_sep[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); - /* "src/helpers/diffusion.pyx":512 - * dzs= cmj_sep[j*3+2] - cmj_sep[(j+i)*3+2] +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":569 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< * - * result = dx*dxs+dy*dys+dz*dzs # <<<<<<<<<<<<<< - * msd[i]+=result - * c[i]+=1 + * @property */ - __pyx_v_result = (((__pyx_v_dx * __pyx_v_dxs) + (__pyx_v_dy * __pyx_v_dys)) + (__pyx_v_dz * __pyx_v_dzs)); + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyInt_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":513 - * - * result = dx*dxs+dy*dys+dz*dzs - * msd[i]+=result # <<<<<<<<<<<<<< - * c[i]+=1 + /* "View.MemoryView":567 + * return self.obj * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ - __pyx_t_19 = __pyx_v_i; - (__pyx_v_msd[__pyx_t_19]) = ((__pyx_v_msd[__pyx_t_19]) + __pyx_v_result); - /* "src/helpers/diffusion.pyx":514 - * result = dx*dxs+dy*dys+dz*dzs - * msd[i]+=result - * c[i]+=1 # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) * - * for i in range(m): + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ - __pyx_t_19 = __pyx_v_i; - (__pyx_v_c[__pyx_t_19]) = ((__pyx_v_c[__pyx_t_19]) + 1); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/helpers/diffusion.pyx":502 - * - * - * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n1-i): - * dx = cmj[j*3] - cmj[(j+i)*3] +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L28; - } - __pyx_L28:; - } - } + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/diffusion.pyx":516 - * c[i]+=1 + /* "View.MemoryView":575 + * if self.view.strides == NULL: * - * for i in range(m): # <<<<<<<<<<<<<< - * msd[i]/=c[i] + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_14 = __pyx_v_m; - __pyx_t_13 = __pyx_t_14; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_13; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 575, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":517 - * - * for i in range(m): - * msd[i]/=c[i] # <<<<<<<<<<<<<< + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< * - * return msdmj + * raise ValueError, "Buffer view does not expose strides" */ - __pyx_t_15 = __pyx_v_i; - if (unlikely((__pyx_v_c[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 517, __pyx_L1_error) - } - (__pyx_v_msd[__pyx_t_15]) = ((__pyx_v_msd[__pyx_t_15]) / (__pyx_v_c[__pyx_v_i])); } - /* "src/helpers/diffusion.pyx":519 - * msd[i]/=c[i] - * - * return msdmj # <<<<<<<<<<<<<< + /* "View.MemoryView":577 + * raise ValueError, "Buffer view does not expose strides" * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< * + * @property */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_msdmj)); - __pyx_r = ((PyObject *)__pyx_v_msdmj); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; goto __pyx_L0; - /* "src/helpers/diffusion.pyx":438 + /* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) * - * @cython.boundscheck(False) - * def msdMJdecomp(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * np.ndarray[np.float64_t,ndim=3] coms_sep, + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_sep.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj_sep.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.diffusion.msdMJdecomp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_sep.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj_sep.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_mj); - __Pyx_XDECREF((PyObject *)__pyx_v_mj_sep); - __Pyx_XDECREF((PyObject *)__pyx_v_msdmj); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/diffusion.pyx":523 +/* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) * - * @cython.boundscheck(False) - * def msdMJcrossterms(np.ndarray[np.float64_t,ndim=3] coms_s1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_s2, - * int charge_s1, + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9diffusion_17msdMJcrossterms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9diffusion_16msdMJcrossterms[] = "\n msdMJcrossterms(coms_s1, coms_s2, charge_s1, charge_s2, maxlen=None)\n\n Calculates the MJ^2 correlation function for two arbitrary species.\n Takes two center-of-mass arrays of the whole unfolded trajectory, one for first species, the other for second species.\n\n Usage:\n msdmj = msdMJ(coms_cat, coms_an)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_17msdMJcrossterms = {"msdMJcrossterms", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9diffusion_17msdMJcrossterms, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_16msdMJcrossterms}; -static PyObject *__pyx_pw_11newanalysis_9diffusion_17msdMJcrossterms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_coms_s1 = 0; - PyArrayObject *__pyx_v_coms_s2 = 0; - int __pyx_v_charge_s1; - int __pyx_v_charge_s2; - PyObject *__pyx_v_maxlen = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("msdMJcrossterms (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms_s1,&__pyx_n_s_coms_s2,&__pyx_n_s_charge_s1,&__pyx_n_s_charge_s2,&__pyx_n_s_maxlen,0}; - PyObject* values[5] = {0,0,0,0,0}; - - /* "src/helpers/diffusion.pyx":527 - * int charge_s1, - * int charge_s2, - * maxlen=None): # <<<<<<<<<<<<<< - * """ - * msdMJcrossterms(coms_s1, coms_s2, charge_s1, charge_s2, maxlen=None) - */ - values[4] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms_s1)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms_s2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("msdMJcrossterms", 0, 4, 5, 1); __PYX_ERR(0, 523, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_s1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("msdMJcrossterms", 0, 4, 5, 2); __PYX_ERR(0, 523, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charge_s2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("msdMJcrossterms", 0, 4, 5, 3); __PYX_ERR(0, 523, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msdMJcrossterms") < 0)) __PYX_ERR(0, 523, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_coms_s1 = ((PyArrayObject *)values[0]); - __pyx_v_coms_s2 = ((PyArrayObject *)values[1]); - __pyx_v_charge_s1 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_charge_s1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 525, __pyx_L3_error) - __pyx_v_charge_s2 = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_charge_s2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 526, __pyx_L3_error) - __pyx_v_maxlen = values[4]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("msdMJcrossterms", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 523, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.diffusion.msdMJcrossterms", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_s1), __pyx_ptype_5numpy_ndarray, 1, "coms_s1", 0))) __PYX_ERR(0, 523, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_s2), __pyx_ptype_5numpy_ndarray, 1, "coms_s2", 0))) __PYX_ERR(0, 524, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9diffusion_16msdMJcrossterms(__pyx_self, __pyx_v_coms_s1, __pyx_v_coms_s2, __pyx_v_charge_s1, __pyx_v_charge_s2, __pyx_v_maxlen); - - /* "src/helpers/diffusion.pyx":523 - * - * @cython.boundscheck(False) - * def msdMJcrossterms(np.ndarray[np.float64_t,ndim=3] coms_s1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_s2, - * int charge_s1, - */ + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9diffusion_16msdMJcrossterms(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_s1, PyArrayObject *__pyx_v_coms_s2, int __pyx_v_charge_s1, int __pyx_v_charge_s2, PyObject *__pyx_v_maxlen) { - int __pyx_v_n1; - int __pyx_v_c1; - int __pyx_v_c2; - int __pyx_v_s1_n2; - int __pyx_v_s2_n2; - int __pyx_v_m; - int __pyx_v_i; - int __pyx_v_j; - double __pyx_v_dx1; - double __pyx_v_dy1; - double __pyx_v_dz1; - double __pyx_v_dx2; - double __pyx_v_dy2; - double __pyx_v_dz2; - double __pyx_v_result; - double *__pyx_v_s1; - double *__pyx_v_s2; - PyArrayObject *__pyx_v_mj1 = 0; - double *__pyx_v_cmj1; - PyArrayObject *__pyx_v_mj2 = 0; - double *__pyx_v_cmj2; - PyArrayObject *__pyx_v_msdmj = 0; - double *__pyx_v_msd; - PyArrayObject *__pyx_v_ctr = 0; - int *__pyx_v_c; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_s1; - __Pyx_Buffer __pyx_pybuffer_coms_s1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_s2; - __Pyx_Buffer __pyx_pybuffer_coms_s2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_mj1; - __Pyx_Buffer __pyx_pybuffer_mj1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_mj2; - __Pyx_Buffer __pyx_pybuffer_mj2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_msdmj; - __Pyx_Buffer __pyx_pybuffer_msdmj; +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("msdMJcrossterms", 0); - __pyx_pybuffer_mj1.pybuffer.buf = NULL; - __pyx_pybuffer_mj1.refcount = 0; - __pyx_pybuffernd_mj1.data = NULL; - __pyx_pybuffernd_mj1.rcbuffer = &__pyx_pybuffer_mj1; - __pyx_pybuffer_mj2.pybuffer.buf = NULL; - __pyx_pybuffer_mj2.refcount = 0; - __pyx_pybuffernd_mj2.data = NULL; - __pyx_pybuffernd_mj2.rcbuffer = &__pyx_pybuffer_mj2; - __pyx_pybuffer_msdmj.pybuffer.buf = NULL; - __pyx_pybuffer_msdmj.refcount = 0; - __pyx_pybuffernd_msdmj.data = NULL; - __pyx_pybuffernd_msdmj.rcbuffer = &__pyx_pybuffer_msdmj; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_coms_s1.pybuffer.buf = NULL; - __pyx_pybuffer_coms_s1.refcount = 0; - __pyx_pybuffernd_coms_s1.data = NULL; - __pyx_pybuffernd_coms_s1.rcbuffer = &__pyx_pybuffer_coms_s1; - __pyx_pybuffer_coms_s2.pybuffer.buf = NULL; - __pyx_pybuffer_coms_s2.refcount = 0; - __pyx_pybuffernd_coms_s2.data = NULL; - __pyx_pybuffernd_coms_s2.rcbuffer = &__pyx_pybuffer_coms_s2; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_s1.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_s1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 523, __pyx_L1_error) - } - __pyx_pybuffernd_coms_s1.diminfo[0].strides = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_s1.diminfo[0].shape = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_s1.diminfo[1].strides = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_s1.diminfo[1].shape = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_s1.diminfo[2].strides = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_s1.diminfo[2].shape = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_s2.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_s2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 523, __pyx_L1_error) - } - __pyx_pybuffernd_coms_s2.diminfo[0].strides = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_s2.diminfo[0].shape = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_s2.diminfo[1].strides = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_s2.diminfo[1].shape = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_s2.diminfo[2].strides = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_s2.diminfo[2].shape = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.shape[2]; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/diffusion.pyx":542 - * - * - * c1 = charge_s1 # <<<<<<<<<<<<<< - * c2 = charge_s2 + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim * */ - __pyx_v_c1 = __pyx_v_charge_s1; + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":543 - * - * c1 = charge_s1 - * c2 = charge_s2 # <<<<<<<<<<<<<< + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * - * n1 = len(coms_s1) + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_v_c2 = __pyx_v_charge_s2; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":545 - * c2 = charge_s2 + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim * - * n1 = len(coms_s1) # <<<<<<<<<<<<<< - * s1_n2 = len(coms_s1[0]) - * s2_n2 = len(coms_s2[0]) */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coms_s1)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 545, __pyx_L1_error) - __pyx_v_n1 = __pyx_t_1; + } - /* "src/helpers/diffusion.pyx":546 + /* "View.MemoryView":584 + * return (-1,) * self.view.ndim * - * n1 = len(coms_s1) - * s1_n2 = len(coms_s1[0]) # <<<<<<<<<<<<<< - * s2_n2 = len(coms_s2[0]) - * if maxlen == None: + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_s1), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_s1_n2 = __pyx_t_1; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":547 - * n1 = len(coms_s1) - * s1_n2 = len(coms_s1[0]) - * s2_n2 = len(coms_s2[0]) # <<<<<<<<<<<<<< - * if maxlen == None: - * m = n1 + /* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_s2), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 547, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_s2_n2 = __pyx_t_1; - /* "src/helpers/diffusion.pyx":548 - * s1_n2 = len(coms_s1[0]) - * s2_n2 = len(coms_s2[0]) - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 548, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":549 - * s2_n2 = len(coms_s2[0]) - * if maxlen == None: - * m = n1 # <<<<<<<<<<<<<< - * else: - * m = maxlen +/* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ - __pyx_v_m = __pyx_v_n1; - /* "src/helpers/diffusion.pyx":548 - * s1_n2 = len(coms_s1[0]) - * s2_n2 = len(coms_s2[0]) - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: - */ - goto __pyx_L3; - } +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/diffusion.pyx":551 - * m = n1 - * else: - * m = maxlen # <<<<<<<<<<<<<< + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":588 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< * - * cdef double *s1 = coms_s1.data + * @property */ - /*else*/ { - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 551, __pyx_L1_error) - __pyx_v_m = ((int)__pyx_t_4); - } - __pyx_L3:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 588, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":553 - * m = maxlen - * - * cdef double *s1 = coms_s1.data # <<<<<<<<<<<<<< - * cdef double *s2 = coms_s2.data + /* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ - __pyx_v_s1 = ((double *)__pyx_v_coms_s1->data); - /* "src/helpers/diffusion.pyx":554 - * - * cdef double *s1 = coms_s1.data - * cdef double *s2 = coms_s2.data # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":590 + * return self.view.ndim * - * cdef np.ndarray[np.float64_t,ndim=2] mj1 = np.zeros((n1,3),dtype=np.float64) + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ - __pyx_v_s2 = ((double *)__pyx_v_coms_s2->data); - /* "src/helpers/diffusion.pyx":556 - * cdef double *s2 = coms_s2.data - * - * cdef np.ndarray[np.float64_t,ndim=2] mj1 = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *cmj1 = mj1.data +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":592 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< * + * @property */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_3); - __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 556, __pyx_L1_error) - __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj1.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_mj1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj1.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 556, __pyx_L1_error) - } else {__pyx_pybuffernd_mj1.diminfo[0].strides = __pyx_pybuffernd_mj1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj1.diminfo[0].shape = __pyx_pybuffernd_mj1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj1.diminfo[1].strides = __pyx_pybuffernd_mj1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj1.diminfo[1].shape = __pyx_pybuffernd_mj1.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_9 = 0; - __pyx_v_mj1 = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":557 - * - * cdef np.ndarray[np.float64_t,ndim=2] mj1 = np.zeros((n1,3),dtype=np.float64) - * cdef double *cmj1 = mj1.data # <<<<<<<<<<<<<< + /* "View.MemoryView":590 + * return self.view.ndim * - * cdef np.ndarray[np.float64_t,ndim=2] mj2 = np.zeros((n1,3),dtype=np.float64) + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ - __pyx_v_cmj1 = ((double *)__pyx_v_mj1->data); - /* "src/helpers/diffusion.pyx":559 - * cdef double *cmj1 = mj1.data + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":594 + * return self.view.itemsize * - * cdef np.ndarray[np.float64_t,ndim=2] mj2 = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *cmj2 = mj2.data + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":596 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< * + * @property */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 559, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 559, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 559, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 559, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_3); - __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 559, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 559, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 559, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 559, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 559, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 559, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_7); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj2.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_mj2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj2.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 559, __pyx_L1_error) - } else {__pyx_pybuffernd_mj2.diminfo[0].strides = __pyx_pybuffernd_mj2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj2.diminfo[0].shape = __pyx_pybuffernd_mj2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj2.diminfo[1].strides = __pyx_pybuffernd_mj2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj2.diminfo[1].shape = __pyx_pybuffernd_mj2.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_10 = 0; - __pyx_v_mj2 = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":560 + /* "View.MemoryView":594 + * return self.view.itemsize * - * cdef np.ndarray[np.float64_t,ndim=2] mj2 = np.zeros((n1,3),dtype=np.float64) - * cdef double *cmj2 = mj2.data # <<<<<<<<<<<<<< + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":598 + * return self.size * self.view.itemsize * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ - __pyx_v_cmj2 = ((double *)__pyx_v_mj2->data); - /* "src/helpers/diffusion.pyx":562 - * cdef double *cmj2 = mj2.data +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *msd = msdmj.data + */ + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":601 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< * + * for length in self.view.shape[:self.view.ndim]: */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 562, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_msdmj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 562, __pyx_L1_error) - } else {__pyx_pybuffernd_msdmj.diminfo[0].strides = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msdmj.diminfo[0].shape = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_11 = 0; - __pyx_v_msdmj = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_int_1); + __pyx_v_result = __pyx_int_1; - /* "src/helpers/diffusion.pyx":563 + /* "View.MemoryView":603 + * result = 1 * - * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) - * cdef double *msd = msdmj.data # <<<<<<<<<<<<<< + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) */ - __pyx_v_msd = ((double *)__pyx_v_msdmj->data); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyInt_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; - /* "src/helpers/diffusion.pyx":565 - * cdef double *msd = msdmj.data + /* "View.MemoryView":604 * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< - * cdef int *c = ctr.data + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< * + * self._size = result */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 565, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 565, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; } - } - __pyx_t_12 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - /* "src/helpers/diffusion.pyx":566 + /* "View.MemoryView":606 + * result *= length * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) - * cdef int *c = ctr.data # <<<<<<<<<<<<<< + * self._size = result # <<<<<<<<<<<<<< * - * for i in prange(n1,nogil=True): + * return self._size */ - __pyx_v_c = ((int *)__pyx_v_ctr->data); + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; - /* "src/helpers/diffusion.pyx":568 - * cdef int *c = ctr.data + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(s1_n2): - * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_n1; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_14 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_14 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); + } - /* "src/helpers/diffusion.pyx":569 + /* "View.MemoryView":608 + * self._size = result * - * for i in prange(n1,nogil=True): - * for j in range(s1_n2): # <<<<<<<<<<<<<< - * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] - * cmj1[i*3+1] += c1*s1[i*s1_n2*3+3*j+1] - */ - __pyx_t_15 = __pyx_v_s1_n2; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; - - /* "src/helpers/diffusion.pyx":570 - * for i in prange(n1,nogil=True): - * for j in range(s1_n2): - * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] # <<<<<<<<<<<<<< - * cmj1[i*3+1] += c1*s1[i*s1_n2*3+3*j+1] - * cmj1[i*3+2] += c1*s1[i*s1_n2*3+3*j+2] + * return self._size # <<<<<<<<<<<<<< + * + * def __len__(self): */ - __pyx_t_18 = (__pyx_v_i * 3); - (__pyx_v_cmj1[__pyx_t_18]) = ((__pyx_v_cmj1[__pyx_t_18]) + (__pyx_v_c1 * (__pyx_v_s1[(((__pyx_v_i * __pyx_v_s1_n2) * 3) + (3 * __pyx_v_j))]))); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":571 - * for j in range(s1_n2): - * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] - * cmj1[i*3+1] += c1*s1[i*s1_n2*3+3*j+1] # <<<<<<<<<<<<<< - * cmj1[i*3+2] += c1*s1[i*s1_n2*3+3*j+2] + /* "View.MemoryView":598 + * return self.size * self.view.itemsize * + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ - __pyx_t_18 = ((__pyx_v_i * 3) + 1); - (__pyx_v_cmj1[__pyx_t_18]) = ((__pyx_v_cmj1[__pyx_t_18]) + (__pyx_v_c1 * (__pyx_v_s1[((((__pyx_v_i * __pyx_v_s1_n2) * 3) + (3 * __pyx_v_j)) + 1)]))); - /* "src/helpers/diffusion.pyx":572 - * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] - * cmj1[i*3+1] += c1*s1[i*s1_n2*3+3*j+1] - * cmj1[i*3+2] += c1*s1[i*s1_n2*3+3*j+2] # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":610 + * return self._size * - * for i in prange(n1,nogil=True): + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ - __pyx_t_18 = ((__pyx_v_i * 3) + 2); - (__pyx_v_cmj1[__pyx_t_18]) = ((__pyx_v_cmj1[__pyx_t_18]) + (__pyx_v_c1 * (__pyx_v_s1[((((__pyx_v_i * __pyx_v_s1_n2) * 3) + (3 * __pyx_v_j)) + 2)]))); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/helpers/diffusion.pyx":568 - * cdef int *c = ctr.data +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__len__", 0); + + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(s1_n2): - * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { - /* "src/helpers/diffusion.pyx":574 - * cmj1[i*3+2] += c1*s1[i*s1_n2*3+3*j+2] + /* "View.MemoryView":612 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(s2_n2): - * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] + * return 0 */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_14 = __pyx_v_n1; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_4 = (__pyx_t_14 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_4 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_4; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":575 + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] * - * for i in prange(n1,nogil=True): - * for j in range(s2_n2): # <<<<<<<<<<<<<< - * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] - * cmj2[i*3+1] += c2*s2[i*s2_n2*3+3*j+1] */ - __pyx_t_15 = __pyx_v_s2_n2; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; + } - /* "src/helpers/diffusion.pyx":576 - * for i in prange(n1,nogil=True): - * for j in range(s2_n2): - * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] # <<<<<<<<<<<<<< - * cmj2[i*3+1] += c2*s2[i*s2_n2*3+3*j+1] - * cmj2[i*3+2] += c2*s2[i*s2_n2*3+3*j+2] + /* "View.MemoryView":614 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): */ - __pyx_t_18 = (__pyx_v_i * 3); - (__pyx_v_cmj2[__pyx_t_18]) = ((__pyx_v_cmj2[__pyx_t_18]) + (__pyx_v_c2 * (__pyx_v_s2[(((__pyx_v_i * __pyx_v_s2_n2) * 3) + (3 * __pyx_v_j))]))); + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":577 - * for j in range(s2_n2): - * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] - * cmj2[i*3+1] += c2*s2[i*s2_n2*3+3*j+1] # <<<<<<<<<<<<<< - * cmj2[i*3+2] += c2*s2[i*s2_n2*3+3*j+2] + /* "View.MemoryView":610 + * return self._size * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ - __pyx_t_18 = ((__pyx_v_i * 3) + 1); - (__pyx_v_cmj2[__pyx_t_18]) = ((__pyx_v_cmj2[__pyx_t_18]) + (__pyx_v_c2 * (__pyx_v_s2[((((__pyx_v_i * __pyx_v_s2_n2) * 3) + (3 * __pyx_v_j)) + 1)]))); - /* "src/helpers/diffusion.pyx":578 - * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] - * cmj2[i*3+1] += c2*s2[i*s2_n2*3+3*j+1] - * cmj2[i*3+2] += c2*s2[i*s2_n2*3+3*j+2] # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":616 + * return 0 * - * for i in prange(m,nogil=True): + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ - __pyx_t_18 = ((__pyx_v_i * 3) + 2); - (__pyx_v_cmj2[__pyx_t_18]) = ((__pyx_v_cmj2[__pyx_t_18]) + (__pyx_v_c2 * (__pyx_v_s2[((((__pyx_v_i * __pyx_v_s2_n2) * 3) + (3 * __pyx_v_j)) + 2)]))); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - - /* "src/helpers/diffusion.pyx":574 - * cmj1[i*3+2] += c1*s1[i*s1_n2*3+3*j+2] - * - * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< - * for j in range(s2_n2): - * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L17; - } - __pyx_L17:; - } - } - /* "src/helpers/diffusion.pyx":580 - * cmj2[i*3+2] += c2*s2[i*s2_n2*3+3*j+2] - * - * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n1-i): - * dx1 = cmj1[j*3] - cmj1[(j+i)*3] - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_m; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_14 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_14 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_19) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dx1) lastprivate(__pyx_v_dx2) lastprivate(__pyx_v_dy1) lastprivate(__pyx_v_dy2) lastprivate(__pyx_v_dz1) lastprivate(__pyx_v_dz2) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_result) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_dx1 = ((double)__PYX_NAN()); - __pyx_v_dx2 = ((double)__PYX_NAN()); - __pyx_v_dy1 = ((double)__PYX_NAN()); - __pyx_v_dy2 = ((double)__PYX_NAN()); - __pyx_v_dz1 = ((double)__PYX_NAN()); - __pyx_v_dz2 = ((double)__PYX_NAN()); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_result = ((double)__PYX_NAN()); +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/diffusion.pyx":581 - * - * for i in prange(m,nogil=True): - * for j in range(n1-i): # <<<<<<<<<<<<<< - * dx1 = cmj1[j*3] - cmj1[(j+i)*3] - * dy1 = cmj1[j*3+1] - cmj1[(j+i)*3+1] - */ - __pyx_t_15 = (__pyx_v_n1 - __pyx_v_i); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":582 - * for i in prange(m,nogil=True): - * for j in range(n1-i): - * dx1 = cmj1[j*3] - cmj1[(j+i)*3] # <<<<<<<<<<<<<< - * dy1 = cmj1[j*3+1] - cmj1[(j+i)*3+1] - * dz1 = cmj1[j*3+2] - cmj1[(j+i)*3+2] - */ - __pyx_v_dx1 = ((__pyx_v_cmj1[(__pyx_v_j * 3)]) - (__pyx_v_cmj1[((__pyx_v_j + __pyx_v_i) * 3)])); +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/helpers/diffusion.pyx":583 - * for j in range(n1-i): - * dx1 = cmj1[j*3] - cmj1[(j+i)*3] - * dy1 = cmj1[j*3+1] - cmj1[(j+i)*3+1] # <<<<<<<<<<<<<< - * dz1 = cmj1[j*3+2] - cmj1[(j+i)*3+2] + /* "View.MemoryView":617 * - */ - __pyx_v_dy1 = ((__pyx_v_cmj1[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj1[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); - - /* "src/helpers/diffusion.pyx":584 - * dx1 = cmj1[j*3] - cmj1[(j+i)*3] - * dy1 = cmj1[j*3+1] - cmj1[(j+i)*3+1] - * dz1 = cmj1[j*3+2] - cmj1[(j+i)*3+2] # <<<<<<<<<<<<<< + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) * - * dx2 = cmj2[j*3] - cmj2[(j+i)*3] */ - __pyx_v_dz1 = ((__pyx_v_cmj1[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj1[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/diffusion.pyx":586 - * dz1 = cmj1[j*3+2] - cmj1[(j+i)*3+2] + /* "View.MemoryView":618 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< * - * dx2 = cmj2[j*3] - cmj2[(j+i)*3] # <<<<<<<<<<<<<< - * dy2 = cmj2[j*3+1] - cmj2[(j+i)*3+1] - * dz2 = cmj2[j*3+2] - cmj2[(j+i)*3+2] + * def __str__(self): */ - __pyx_v_dx2 = ((__pyx_v_cmj2[(__pyx_v_j * 3)]) - (__pyx_v_cmj2[((__pyx_v_j + __pyx_v_i) * 3)])); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "src/helpers/diffusion.pyx":587 + /* "View.MemoryView":617 * - * dx2 = cmj2[j*3] - cmj2[(j+i)*3] - * dy2 = cmj2[j*3+1] - cmj2[(j+i)*3+1] # <<<<<<<<<<<<<< - * dz2 = cmj2[j*3+2] - cmj2[(j+i)*3+2] + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) * */ - __pyx_v_dy2 = ((__pyx_v_cmj2[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj2[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":588 - * dx2 = cmj2[j*3] - cmj2[(j+i)*3] - * dy2 = cmj2[j*3+1] - cmj2[(j+i)*3+1] - * dz2 = cmj2[j*3+2] - cmj2[(j+i)*3+2] # <<<<<<<<<<<<<< + /* "View.MemoryView":616 + * return 0 * - * result = dx1*dx2+dy1*dy2+dz1*dz2 + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ - __pyx_v_dz2 = ((__pyx_v_cmj2[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj2[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); - /* "src/helpers/diffusion.pyx":590 - * dz2 = cmj2[j*3+2] - cmj2[(j+i)*3+2] + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) * - * result = dx1*dx2+dy1*dy2+dz1*dz2 # <<<<<<<<<<<<<< - * msd[i]+=result - * c[i]+=1 */ - __pyx_v_result = (((__pyx_v_dx1 * __pyx_v_dx2) + (__pyx_v_dy1 * __pyx_v_dy2)) + (__pyx_v_dz1 * __pyx_v_dz2)); - /* "src/helpers/diffusion.pyx":591 +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "View.MemoryView":621 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< * - * result = dx1*dx2+dy1*dy2+dz1*dz2 - * msd[i]+=result # <<<<<<<<<<<<<< - * c[i]+=1 * */ - __pyx_t_19 = __pyx_v_i; - (__pyx_v_msd[__pyx_t_19]) = ((__pyx_v_msd[__pyx_t_19]) + __pyx_v_result); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":592 - * result = dx1*dx2+dy1*dy2+dz1*dz2 - * msd[i]+=result - * c[i]+=1 # <<<<<<<<<<<<<< + /* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) * - * for i in range(m): */ - __pyx_t_19 = __pyx_v_i; - (__pyx_v_c[__pyx_t_19]) = ((__pyx_v_c[__pyx_t_19]) + 1); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/helpers/diffusion.pyx":580 - * cmj2[i*3+2] += c2*s2[i*s2_n2*3+3*j+2] - * - * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< - * for j in range(n1-i): - * dx1 = cmj1[j*3] - cmj1[(j+i)*3] - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L28; - } - __pyx_L28:; - } - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":594 - * c[i]+=1 +/* "View.MemoryView":624 * - * for i in range(m): # <<<<<<<<<<<<<< - * msd[i]/=c[i] * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - __pyx_t_14 = __pyx_v_m; - __pyx_t_13 = __pyx_t_14; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_13; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - /* "src/helpers/diffusion.pyx":595 - * - * for i in range(m): - * msd[i]/=c[i] # <<<<<<<<<<<<<< +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 624, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_c_contig", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); + + /* "View.MemoryView":627 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * - * return msdmj */ - __pyx_t_15 = __pyx_v_i; - if (unlikely((__pyx_v_c[__pyx_v_i]) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 595, __pyx_L1_error) - } - (__pyx_v_msd[__pyx_t_15]) = ((__pyx_v_msd[__pyx_t_15]) / (__pyx_v_c[__pyx_v_i])); - } + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 627, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/helpers/diffusion.pyx":597 - * msd[i]/=c[i] - * - * return msdmj # <<<<<<<<<<<<<< - * + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< * + * def is_f_contig(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_msdmj)); - __pyx_r = ((PyObject *)__pyx_v_msdmj); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "src/helpers/diffusion.pyx":523 + /* "View.MemoryView":624 * - * @cython.boundscheck(False) - * def msdMJcrossterms(np.ndarray[np.float64_t,ndim=3] coms_s1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_s2, - * int charge_s1, + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_s1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_s2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.diffusion.msdMJcrossterms", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_s1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_s2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_mj1); - __Pyx_XDECREF((PyObject *)__pyx_v_mj2); - __Pyx_XDECREF((PyObject *)__pyx_v_msdmj); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/diffusion.pyx":601 +/* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * - * @cython.boundscheck(False) - * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * n=2, - * maxlen=None): + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_9diffusion_19nonGaussianParameter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_9diffusion_18nonGaussianParameter[] = "\n nonGaussianParameter(xyz, n=2, maxlen=None)\n\n This function takes as input a three-dimensional coordinate array of the molecular centers of mass of a whole unfolded trajectory \n [timestep, molecule, xyz] and calculates the non-Gaussian Parameter according to Rahman, A. Physical Review 136, A405\342\200\223A411 (1964).\n n is the \"moment\" of the distribution and 2 per default. The non-Gaussian parameter describes the deviation of the time-dependent\n molecular displacement from theGaussian distribution and is zero for n>1 if the distribution of the displacements is actually Gaussian. \n The optional parameter maxlen can be set to limit the length of the resulting MSD. This can be useful\n when dealing with very long trajectories, e.g. maxlen=n/2.\n\n Usage:\n nonGaussianParameter = nonGaussianParameter(xyz)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_19nonGaussianParameter = {"nonGaussianParameter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_9diffusion_19nonGaussianParameter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_18nonGaussianParameter}; -static PyObject *__pyx_pw_11newanalysis_9diffusion_19nonGaussianParameter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_xyz = 0; - PyObject *__pyx_v_n = 0; - PyObject *__pyx_v_maxlen = 0; +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("nonGaussianParameter (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_n,&__pyx_n_s_maxlen,0}; - PyObject* values[3] = {0,0,0}; - values[1] = ((PyObject *)__pyx_int_2); - - /* "src/helpers/diffusion.pyx":603 - * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, - * n=2, - * maxlen=None): # <<<<<<<<<<<<<< - * """ - * nonGaussianParameter(xyz, n=2, maxlen=None) - */ - values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n); - if (value) { values[1] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxlen); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nonGaussianParameter") < 0)) __PYX_ERR(0, 601, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_xyz = ((PyArrayObject *)values[0]); - __pyx_v_n = values[1]; - __pyx_v_maxlen = values[2]; - } + __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 630, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_f_contig", 0))) return NULL; goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("nonGaussianParameter", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 601, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.diffusion.nonGaussianParameter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 601, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_9diffusion_18nonGaussianParameter(__pyx_self, __pyx_v_xyz, __pyx_v_n, __pyx_v_maxlen); - - /* "src/helpers/diffusion.pyx":601 - * - * @cython.boundscheck(False) - * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * n=2, - * maxlen=None): - */ + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_9diffusion_18nonGaussianParameter(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_n, PyObject *__pyx_v_maxlen) { - double __pyx_v_factor; - double __pyx_v_result; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - int __pyx_v_deg; - int __pyx_v_n1; - int __pyx_v_n2; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_m; - PyArrayObject *__pyx_v_msd = 0; - double *__pyx_v_msd_data; - PyArrayObject *__pyx_v_msddeg = 0; - double *__pyx_v_msddeg_data; - PyArrayObject *__pyx_v_alpha = 0; - CYTHON_UNUSED double *__pyx_v_alpha_data; - double *__pyx_v_data; - PyArrayObject *__pyx_v_ctr = 0; - int *__pyx_v_c; - __Pyx_LocalBuf_ND __pyx_pybuffernd_alpha; - __Pyx_Buffer __pyx_pybuffer_alpha; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; - __Pyx_Buffer __pyx_pybuffer_ctr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_msd; - __Pyx_Buffer __pyx_pybuffer_msd; - __Pyx_LocalBuf_ND __pyx_pybuffernd_msddeg; - __Pyx_Buffer __pyx_pybuffer_msddeg; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; - __Pyx_Buffer __pyx_pybuffer_xyz; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - long __pyx_t_22; - long __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - __pyx_t_5numpy_float64_t __pyx_t_26; - __pyx_t_5numpy_float64_t __pyx_t_27; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("nonGaussianParameter", 0); - __pyx_pybuffer_msd.pybuffer.buf = NULL; - __pyx_pybuffer_msd.refcount = 0; - __pyx_pybuffernd_msd.data = NULL; - __pyx_pybuffernd_msd.rcbuffer = &__pyx_pybuffer_msd; - __pyx_pybuffer_msddeg.pybuffer.buf = NULL; - __pyx_pybuffer_msddeg.refcount = 0; - __pyx_pybuffernd_msddeg.data = NULL; - __pyx_pybuffernd_msddeg.rcbuffer = &__pyx_pybuffer_msddeg; - __pyx_pybuffer_alpha.pybuffer.buf = NULL; - __pyx_pybuffer_alpha.refcount = 0; - __pyx_pybuffernd_alpha.data = NULL; - __pyx_pybuffernd_alpha.rcbuffer = &__pyx_pybuffer_alpha; - __pyx_pybuffer_ctr.pybuffer.buf = NULL; - __pyx_pybuffer_ctr.refcount = 0; - __pyx_pybuffernd_ctr.data = NULL; - __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; - __pyx_pybuffer_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_xyz.refcount = 0; - __pyx_pybuffernd_xyz.data = NULL; - __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 601, __pyx_L1_error) - } - __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz.diminfo[2].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz.diminfo[2].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[2]; + __Pyx_RefNannySetupContext("is_f_contig", 0); - /* "src/helpers/diffusion.pyx":618 - * """ - * - * if n < 1: # <<<<<<<<<<<<<< - * raise ValueError("n must be >1") + /* "View.MemoryView":633 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_n, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 618, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__pyx_t_2)) { + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 633, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/helpers/diffusion.pyx":619 - * - * if n < 1: - * raise ValueError("n must be >1") # <<<<<<<<<<<<<< + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< * - * cdef double factor, result, dx, dy, dz, res2 + * def copy(self): */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 619, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":618 - * """ - * - * if n < 1: # <<<<<<<<<<<<<< - * raise ValueError("n must be >1") + /* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - } - /* "src/helpers/diffusion.pyx":624 - * cdef int deg, n1, n2, i, j, k, m, pos - * - * n1 = len(xyz) # <<<<<<<<<<<<<< - * n2 = len(xyz[0]) - * deg = n - */ - __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 624, __pyx_L1_error) - __pyx_v_n1 = __pyx_t_3; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":625 - * - * n1 = len(xyz) - * n2 = len(xyz[0]) # <<<<<<<<<<<<<< - * deg = n +/* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 625, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_n2 = __pyx_t_3; - /* "src/helpers/diffusion.pyx":626 - * n1 = len(xyz) - * n2 = len(xyz[0]) - * deg = n # <<<<<<<<<<<<<< - * +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 636, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":638 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< * + * slice_copy(self, &mslice) */ - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_n); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 626, __pyx_L1_error) - __pyx_v_deg = __pyx_t_4; + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - /* "src/helpers/diffusion.pyx":629 - * + /* "View.MemoryView":640 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS * - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 629, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - /* "src/helpers/diffusion.pyx":630 + /* "View.MemoryView":641 * - * if maxlen == None: - * m = n1 # <<<<<<<<<<<<<< - * else: - * m = maxlen + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, */ - __pyx_v_m = __pyx_v_n1; + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 641, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/helpers/diffusion.pyx":629 + /* "View.MemoryView":646 + * self.dtype_is_object) * + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< * - * if maxlen == None: # <<<<<<<<<<<<<< - * m = n1 - * else: + * def copy_fortran(self): */ - goto __pyx_L4; - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":632 - * m = n1 - * else: - * m = maxlen # <<<<<<<<<<<<<< + /* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ - /*else*/ { - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 632, __pyx_L1_error) - __pyx_v_m = ((int)__pyx_t_4); - } - __pyx_L4:; - /* "src/helpers/diffusion.pyx":634 - * m = maxlen - * - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double* msd_data = msd.data + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 634, __pyx_L1_error) - __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_msd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 634, __pyx_L1_error) - } else {__pyx_pybuffernd_msd.diminfo[0].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msd.diminfo[0].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_9 = 0; - __pyx_v_msd = ((PyArrayObject *)__pyx_t_8); - __pyx_t_8 = 0; - /* "src/helpers/diffusion.pyx":635 - * - * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) - * cdef double* msd_data = msd.data # <<<<<<<<<<<<<< - * - * cdef np.ndarray[np.float64_t,ndim=1] msddeg = np.zeros(m, dtype=np.float64) - */ - __pyx_v_msd_data = ((double *)__pyx_v_msd->data); +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 648, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy_fortran", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/diffusion.pyx":637 - * cdef double* msd_data = msd.data - * - * cdef np.ndarray[np.float64_t,ndim=1] msddeg = np.zeros(m, dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double* msddeg_data = msddeg.data - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 637, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_7); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msddeg.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_msddeg = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msddeg.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 637, __pyx_L1_error) - } else {__pyx_pybuffernd_msddeg.diminfo[0].strides = __pyx_pybuffernd_msddeg.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msddeg.diminfo[0].shape = __pyx_pybuffernd_msddeg.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_10 = 0; - __pyx_v_msddeg = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":638 - * - * cdef np.ndarray[np.float64_t,ndim=1] msddeg = np.zeros(m, dtype=np.float64) - * cdef double* msddeg_data = msddeg.data # <<<<<<<<<<<<<< +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":650 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< * - * cdef np.ndarray[np.float64_t,ndim=1] alpha = np.zeros(m, dtype=np.float64) + * slice_copy(self, &src) */ - __pyx_v_msddeg_data = ((double *)__pyx_v_msddeg->data); + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - /* "src/helpers/diffusion.pyx":640 - * cdef double* msddeg_data = msddeg.data - * - * cdef np.ndarray[np.float64_t,ndim=1] alpha = np.zeros(m, dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double* alpha_data = alpha.data + /* "View.MemoryView":652 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 640, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_alpha = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 640, __pyx_L1_error) - } else {__pyx_pybuffernd_alpha.diminfo[0].strides = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alpha.diminfo[0].shape = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_11 = 0; - __pyx_v_alpha = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); - /* "src/helpers/diffusion.pyx":641 + /* "View.MemoryView":653 * - * cdef np.ndarray[np.float64_t,ndim=1] alpha = np.zeros(m, dtype=np.float64) - * cdef double* alpha_data = alpha.data # <<<<<<<<<<<<<< - * - * cdef double *data = xyz.data + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, */ - __pyx_v_alpha_data = ((double *)__pyx_v_alpha->data); + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 653, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; - /* "src/helpers/diffusion.pyx":643 - * cdef double* alpha_data = alpha.data + /* "View.MemoryView":658 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< * - * cdef double *data = xyz.data # <<<<<<<<<<<<<< * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) */ - __pyx_v_data = ((double *)__pyx_v_xyz->data); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/diffusion.pyx":645 - * cdef double *data = xyz.data - * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< - * cdef int *c = ctr.data + /* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 645, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_1); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 645, __pyx_L1_error) - } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_12 = 0; - __pyx_v_ctr = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - /* "src/helpers/diffusion.pyx":646 - * - * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) - * cdef int *c = ctr.data # <<<<<<<<<<<<<< - * - * # loop over all delta t + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - __pyx_v_c = ((int *)__pyx_v_ctr->data); - /* "src/helpers/diffusion.pyx":649 - * - * # loop over all delta t - * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< - * # loop over all possible interval start points - * for j in range(n1-i): - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_4 = __pyx_v_m; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_14 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_14 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_result) - #endif /* _OPENMP */ - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_13); - /* Initialize private variables to invalid values */ - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); - __pyx_v_result = ((double)__PYX_NAN()); - - /* "src/helpers/diffusion.pyx":651 - * for i in prange(m,nogil=True,schedule=guided): - * # loop over all possible interval start points - * for j in range(n1-i): # <<<<<<<<<<<<<< - * # loop over residues - * for k in range(n2): - */ - __pyx_t_15 = (__pyx_v_n1 - __pyx_v_i); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_j = __pyx_t_17; - - /* "src/helpers/diffusion.pyx":653 - * for j in range(n1-i): - * # loop over residues - * for k in range(n2): # <<<<<<<<<<<<<< - * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] - * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] - */ - __pyx_t_18 = __pyx_v_n2; - __pyx_t_19 = __pyx_t_18; - for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { - __pyx_v_k = __pyx_t_20; +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/diffusion.pyx":654 - * # loop over residues - * for k in range(n2): - * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] # <<<<<<<<<<<<<< - * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] - * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] - */ - __pyx_v_dx = ((__pyx_v_data[(((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k))]) - (__pyx_v_data[((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k))])); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":655 - * for k in range(n2): - * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] - * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] # <<<<<<<<<<<<<< - * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] - * result = dx*dx+dy*dy+dz*dz - */ - __pyx_v_dy = ((__pyx_v_data[((((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 1)]) - (__pyx_v_data[(((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 1)])); +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "src/helpers/diffusion.pyx":656 - * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] - * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] - * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] # <<<<<<<<<<<<<< - * result = dx*dx+dy*dy+dz*dz - * msd_data[i] += result + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_v_dz = ((__pyx_v_data[((((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 2)]) - (__pyx_v_data[(((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 2)])); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":657 - * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] - * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] - * result = dx*dx+dy*dy+dz*dz # <<<<<<<<<<<<<< - * msd_data[i] += result - * msddeg_data[i] += result**deg + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); - /* "src/helpers/diffusion.pyx":658 - * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] - * result = dx*dx+dy*dy+dz*dz - * msd_data[i] += result # <<<<<<<<<<<<<< - * msddeg_data[i] += result**deg - * c[i]+=1 - */ - __pyx_t_21 = __pyx_v_i; - (__pyx_v_msd_data[__pyx_t_21]) = ((__pyx_v_msd_data[__pyx_t_21]) + __pyx_v_result); + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":659 - * result = dx*dx+dy*dy+dz*dz - * msd_data[i] += result - * msddeg_data[i] += result**deg # <<<<<<<<<<<<<< - * c[i]+=1 - * +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_21 = __pyx_v_i; - (__pyx_v_msddeg_data[__pyx_t_21]) = ((__pyx_v_msddeg_data[__pyx_t_21]) + pow(__pyx_v_result, ((double)__pyx_v_deg))); - /* "src/helpers/diffusion.pyx":660 - * msd_data[i] += result - * msddeg_data[i] += result**deg - * c[i]+=1 # <<<<<<<<<<<<<< - * - * factor = 1 - */ - __pyx_t_21 = __pyx_v_i; - (__pyx_v_c[__pyx_t_21]) = ((__pyx_v_c[__pyx_t_21]) + 1); - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - - /* "src/helpers/diffusion.pyx":649 - * - * # loop over all delta t - * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< - * # loop over all possible interval start points - * for j in range(n1-i): - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L7; + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } - __pyx_L7:; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state); - /* "src/helpers/diffusion.pyx":662 - * c[i]+=1 - * - * factor = 1 # <<<<<<<<<<<<<< - * for i in range(1,deg+1): - * factor = factor * (2*i+1) - */ - __pyx_v_factor = 1.0; + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/diffusion.pyx":663 - * - * factor = 1 - * for i in range(1,deg+1): # <<<<<<<<<<<<<< - * factor = factor * (2*i+1) - * factor /= 3**deg +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_t_22 = (__pyx_v_deg + 1); - __pyx_t_23 = __pyx_t_22; - for (__pyx_t_14 = 1; __pyx_t_14 < __pyx_t_23; __pyx_t_14+=1) { - __pyx_v_i = __pyx_t_14; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/helpers/diffusion.pyx":664 - * factor = 1 - * for i in range(1,deg+1): - * factor = factor * (2*i+1) # <<<<<<<<<<<<<< - * factor /= 3**deg - * - */ - __pyx_v_factor = (__pyx_v_factor * ((2 * __pyx_v_i) + 1)); - } - - /* "src/helpers/diffusion.pyx":665 - * for i in range(1,deg+1): - * factor = factor * (2*i+1) - * factor /= 3**deg # <<<<<<<<<<<<<< - * - * alpha[0] = 0 - */ - __pyx_t_22 = __Pyx_pow_long(3, ((long)__pyx_v_deg)); - if (unlikely(__pyx_t_22 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 665, __pyx_L1_error) - } - __pyx_v_factor = (__pyx_v_factor / __pyx_t_22); - - /* "src/helpers/diffusion.pyx":667 - * factor /= 3**deg - * - * alpha[0] = 0 # <<<<<<<<<<<<<< - * for i in range(1,m): - * msd[i] /= ctr[i] - */ - __pyx_t_24 = 0; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_alpha.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_alpha.diminfo[0].strides) = 0.0; - - /* "src/helpers/diffusion.pyx":668 - * - * alpha[0] = 0 - * for i in range(1,m): # <<<<<<<<<<<<<< - * msd[i] /= ctr[i] - * msddeg[i] /= ctr[i] - */ - __pyx_t_14 = __pyx_v_m; - __pyx_t_13 = __pyx_t_14; - for (__pyx_t_4 = 1; __pyx_t_4 < __pyx_t_13; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "src/helpers/diffusion.pyx":669 - * alpha[0] = 0 - * for i in range(1,m): - * msd[i] /= ctr[i] # <<<<<<<<<<<<<< - * msddeg[i] /= ctr[i] - * alpha[i] = msddeg[i]/(msd[i]**deg * factor) - 1 - */ - __pyx_t_24 = __pyx_v_i; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_ctr.diminfo[0].shape; - __pyx_t_25 = __pyx_v_i; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_pybuffernd_msd.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_msd.diminfo[0].strides) /= ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_ctr.diminfo[0].strides))); - - /* "src/helpers/diffusion.pyx":670 - * for i in range(1,m): - * msd[i] /= ctr[i] - * msddeg[i] /= ctr[i] # <<<<<<<<<<<<<< - * alpha[i] = msddeg[i]/(msd[i]**deg * factor) - 1 - * - */ - __pyx_t_24 = __pyx_v_i; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_ctr.diminfo[0].shape; - __pyx_t_25 = __pyx_v_i; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_pybuffernd_msddeg.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msddeg.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_msddeg.diminfo[0].strides) /= ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_ctr.diminfo[0].strides))); - - /* "src/helpers/diffusion.pyx":671 - * msd[i] /= ctr[i] - * msddeg[i] /= ctr[i] - * alpha[i] = msddeg[i]/(msd[i]**deg * factor) - 1 # <<<<<<<<<<<<<< - * - * return alpha - */ - __pyx_t_24 = __pyx_v_i; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_msddeg.diminfo[0].shape; - __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msddeg.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_msddeg.diminfo[0].strides)); - __pyx_t_24 = __pyx_v_i; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_msd.diminfo[0].shape; - __pyx_t_27 = (pow((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_msd.diminfo[0].strides)), ((__pyx_t_5numpy_float64_t)__pyx_v_deg)) * __pyx_v_factor); - if (unlikely(__pyx_t_27 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 671, __pyx_L1_error) - } - __pyx_t_24 = __pyx_v_i; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_alpha.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_alpha.diminfo[0].strides) = ((__pyx_t_26 / __pyx_t_27) - 1.0); - } - - /* "src/helpers/diffusion.pyx":673 - * alpha[i] = msddeg[i]/(msd[i]**deg * factor) - 1 - * - * return alpha # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_alpha)); - __pyx_r = ((PyObject *)__pyx_v_alpha); - goto __pyx_L0; - - /* "src/helpers/diffusion.pyx":601 - * - * @cython.boundscheck(False) - * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * n=2, - * maxlen=None): + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msddeg.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.diffusion.nonGaussianParameter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msddeg.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_msd); - __Pyx_XDECREF((PyObject *)__pyx_v_msddeg); - __Pyx_XDECREF((PyObject *)__pyx_v_alpha); - __Pyx_XDECREF((PyObject *)__pyx_v_ctr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) +/* "View.MemoryView":662 * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":663 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result + */ + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":735 + /* "View.MemoryView":664 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + */ + __pyx_v_result->typeinfo = __pyx_v_typeinfo; + + /* "View.MemoryView":665 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew2(a, b): + * @cname('__pyx_memoryview_check') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) + /* "View.MemoryView":662 * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) +/* "View.MemoryView":668 * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) * */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + int __pyx_t_1; + __Pyx_RefNannySetupContext("memoryview_check", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":738 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + /* "View.MemoryView":669 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew3(a, b, c): + * cdef tuple _unellipsify(object index, int ndim): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) + /* "View.MemoryView":668 * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) * */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) +/* "View.MemoryView":671 + * return isinstance(o, memoryview) * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_UCS4 __pyx_t_6; + PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + __Pyx_RefNannySetupContext("_unellipsify", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":741 + /* "View.MemoryView":677 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * result = [slice(None)] * ndim + */ + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index)) __PYX_ERR(1, 677, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 741, __pyx_L1_error) + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) + /* "View.MemoryView":680 * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 */ + __pyx_v_have_slices = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":681 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: + */ + __pyx_v_seen_ellipsis = 0; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) + /* "View.MemoryView":682 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: + */ + __pyx_v_idx = 0; + + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: + */ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 683, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; + for (;;) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 683, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) + */ + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True + */ + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":686 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True + */ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 686, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 686, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); + + /* "View.MemoryView":687 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: + */ + __pyx_v_seen_ellipsis = 1; + + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True + */ + } + + /* "View.MemoryView":688 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): + */ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) + */ + goto __pyx_L5; + } + + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): + */ + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { + + /* "View.MemoryView":691 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + */ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): + */ + goto __pyx_L7; + } + + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + */ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":693 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = 127; + __Pyx_INCREF(__pyx_kp_u_Cannot_index_with_type); + __pyx_t_5 += 24; + __Pyx_GIVEREF(__pyx_kp_u_Cannot_index_with_type); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Cannot_index_with_type); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_5 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__6); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 693, __pyx_L1_error) + + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + */ + } + __pyx_L7:; + + /* "View.MemoryView":694 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) + */ + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0))) __PYX_ERR(1, 694, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":695 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< * + * nslices = ndim - idx */ + __pyx_v_idx = (__pyx_v_idx + 1); -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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":744 + /* "View.MemoryView":697 + * idx += 1 * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); + + /* "View.MemoryView":698 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: */ __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 744, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 698, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error); __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) + /* "View.MemoryView":671 + * return isinstance(o, memoryview) * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) +/* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: */ -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) { - PyObject *__pyx_r = NULL; +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":747 + /* "View.MemoryView":701 * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + */ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag + */ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":703 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag * - * cdef inline tuple PyDataType_SHAPE(dtype d): */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 703, __pyx_L1_error) - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag + */ + } + } + + /* "View.MemoryView":704 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) * + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) +/* "View.MemoryView":711 * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 - * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: - */ - __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); - if (__pyx_t_1) { +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":751 - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape # <<<<<<<<<<<<<< - * else: - * return () + /* "View.MemoryView":712 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); - __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); - goto __pyx_L0; + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 + /* "View.MemoryView":719 * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj */ - } + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":753 - * return d.subarray.shape - * else: - * return () # <<<<<<<<<<<<<< + /* "View.MemoryView":723 + * cdef _memoryviewslice memviewsliceobj * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< * + * if isinstance(memview, _memoryviewslice): */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_empty_tuple); - __pyx_r = __pyx_empty_tuple; - goto __pyx_L0; + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 723, __pyx_L1_error) + } } + #else + if ((1)); else __PYX_ERR(1, 723, __pyx_L1_error) + #endif - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 + /* "View.MemoryView":726 * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: */ + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 726, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_array_base", 0); + /* "View.MemoryView":727 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) + */ + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":929 - * - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< - * PyArray_SetBaseObject(arr, base) + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ - Py_INCREF(__pyx_v_base); + goto __pyx_L3; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":930 - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + /* "View.MemoryView":729 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src * - * cdef inline object get_array_base(ndarray arr): */ - (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 + /* "View.MemoryView":730 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) */ + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) + /* "View.MemoryView":736 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: */ + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_v_base; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":933 + /* "View.MemoryView":737 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * * - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< - * if base is NULL: - * return None */ - __pyx_v_base = PyArray_BASE(__pyx_v_arr); + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base + /* "View.MemoryView":742 + * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex */ - __pyx_t_1 = ((__pyx_v_base == NULL) != 0); - if (__pyx_t_1) { + __pyx_v_p_dst = (&__pyx_v_dst); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":935 - * base = PyArray_BASE(arr) - * if base is NULL: - * return None # <<<<<<<<<<<<<< - * return base + /* "View.MemoryView":743 * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index */ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 747, __pyx_L1_error) } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 747, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":936 - * if base is NULL: - * return None - * return base # <<<<<<<<<<<<<< + /* "View.MemoryView":748 * - * # Versions of the import_* functions which are more suitable for + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_base)); - __pyx_r = ((PyObject *)__pyx_v_base); - goto __pyx_L0; + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: + /* "View.MemoryView":749 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], */ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 749, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":750 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, + */ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 750, __pyx_L1_error) -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() + /* "View.MemoryView":748 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ + goto __pyx_L6; + } -static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_array", 0); + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + */ + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":757 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":942 - * cdef inline int import_array() except -1: - * try: - * __pyx_import_array() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":758 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 942, __pyx_L3_error) + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":759 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: + */ + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + + /* "View.MemoryView":760 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 + */ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 */ + goto __pyx_L6; } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":943 - * try: - * __pyx_import_array() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":762 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 + */ + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 762, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 762, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; + + /* "View.MemoryView":763 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 * */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 943, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":764 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< * - * cdef inline int import_umath() except -1: + * have_start = index.start is not None */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 944, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 944, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":766 + * step = index.step or 0 + * + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() + /* "View.MemoryView":767 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None + * */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":768 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":770 + * have_step = index.step is not None * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 770, __pyx_L1_error) -static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_umath", 0); + /* "View.MemoryView":776 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): + */ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":948 - * cdef inline int import_umath() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":778 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 948, __pyx_L3_error) + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "View.MemoryView":779 * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + __Pyx_XDECREF((PyObject *)__pyx_r); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":949 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":780 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 780, __pyx_L1_error) } + + /* "View.MemoryView":781 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":779 * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 949, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 779, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":778 + * new_ndim += 1 * - * cdef inline int import_ufunc() except -1: + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 950, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 950, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":785 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * + */ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 784, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":711 * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") +/* "View.MemoryView":793 * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ -static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_ufunc", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("slice_memviewslice", 1); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + /* "View.MemoryView":813 + * cdef bint negative_step * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":954 - * cdef inline int import_ufunc() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 954, __pyx_L3_error) + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + /* "View.MemoryView":815 + * if not is_slice: * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":955 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":816 * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 955, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":956 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":815 + * if not is_slice: * - * cdef extern from *: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 956, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 956, __pyx_L5_except_error) } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":818 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() */ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 818, __pyx_L1_error) - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: + */ + } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 + /* "View.MemoryView":813 + * cdef bint negative_step * + * if not is_slice: # <<<<<<<<<<<<<< * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` + * if start < 0: */ + goto __pyx_L3; + } -static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_timedelta64_object", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":978 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< - * + /* "View.MemoryView":821 + * else: * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); - goto __pyx_L0; + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 - * + /* "View.MemoryView":822 * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) */ + __pyx_v_negative_step = (__pyx_v_step < 0); - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * - * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: */ + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { -static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_datetime64_object", 0); + /* "View.MemoryView":824 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False + */ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 824, __pyx_L1_error) - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":993 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< - * - * + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); - goto __pyx_L0; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * + /* "View.MemoryView":821 + * else: * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ + goto __pyx_L6; + } - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 - * + /* "View.MemoryView":826 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object */ + /*else*/ { + __pyx_v_negative_step = 0; -static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { - npy_datetime __pyx_r; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1003 - * also needed. That can be found using `get_datetime64_unit`. - * """ - * return (obj).obval # <<<<<<<<<<<<<< + /* "View.MemoryView":827 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< * * */ - __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; + __pyx_v_step = 1; + } + __pyx_L6:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 + /* "View.MemoryView":830 * * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 - * + /* "View.MemoryView":831 * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { -static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { - npy_timedelta __pyx_r; + /* "View.MemoryView":832 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 + */ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1010 - * returns the int64 value underlying scalar numpy timedelta64 object - * """ - * return (obj).obval # <<<<<<<<<<<<<< - * - * + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: */ - __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 - * - * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object + /* "View.MemoryView":834 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: */ + __pyx_v_start = 0; - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: + */ + } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 - * + /* "View.MemoryView":831 * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ + goto __pyx_L9; + } -static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { - NPY_DATETIMEUNIT __pyx_r; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1017 - * returns the unit part of the dtype for a numpy datetime64 object. - * """ - * return (obj).obmeta.base # <<<<<<<<<<<<<< + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 */ - __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); - goto __pyx_L0; + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 - * - * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ + if (__pyx_v_negative_step) { - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * + /* "View.MemoryView":837 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape */ + __pyx_v_start = (__pyx_v_shape - 1); -/* Python wrapper */ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_shape = 0; - Py_ssize_t __pyx_v_itemsize; - PyObject *__pyx_v_format = 0; - PyObject *__pyx_v_mode = 0; - int __pyx_v_allocate_buffer; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; - PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_n_s_c); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 123, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 123, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode); - if (value) { values[3] = value; kw_args--; } + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: + */ + goto __pyx_L11; } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer); - if (value) { values[4] = value; kw_args--; } + + /* "View.MemoryView":839 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: + */ + /*else*/ { + __pyx_v_start = __pyx_v_shape; } + __pyx_L11:; + + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 + */ } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 123, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_shape = ((PyObject*)values[0]); - __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_v_format = values[2]; - __pyx_v_mode = values[3]; - if (values[4]) { - __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 124, __pyx_L3_error) - } else { + __pyx_L9:; - /* "View.MemoryView":124 + /* "View.MemoryView":830 * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, - * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< * - * cdef int idx + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ - __pyx_v_allocate_buffer = ((int)1); + goto __pyx_L8; } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 123, __pyx_L1_error) - if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 123, __pyx_L1_error) - } - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); - /* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ + /*else*/ { + if (__pyx_v_negative_step) { - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { - int __pyx_v_idx; - Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_dim; - PyObject **__pyx_v_p; - char __pyx_v_order; - int __pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - Py_ssize_t __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_format); + /* "View.MemoryView":842 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 + */ + __pyx_v_start = (__pyx_v_shape - 1); - /* "View.MemoryView":130 - * cdef PyObject **p - * - * self.ndim = len(shape) # <<<<<<<<<<<<<< - * self.itemsize = itemsize - * + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - if (unlikely(__pyx_v_shape == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 130, __pyx_L1_error) - } - __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 130, __pyx_L1_error) - __pyx_v_self->ndim = ((int)__pyx_t_1); + goto __pyx_L12; + } - /* "View.MemoryView":131 - * - * self.ndim = len(shape) - * self.itemsize = itemsize # <<<<<<<<<<<<<< + /* "View.MemoryView":844 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< * - * if not self.ndim: + * if have_stop: */ - __pyx_v_self->itemsize = __pyx_v_itemsize; + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; - /* "View.MemoryView":133 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") + /* "View.MemoryView":846 + * start = 0 * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ - __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { - /* "View.MemoryView":134 - * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< + /* "View.MemoryView":847 * - * if itemsize <= 0: + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 134, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { - /* "View.MemoryView":133 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") - * + /* "View.MemoryView":848 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 */ - } + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") - * + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ - __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { - /* "View.MemoryView":137 - * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< - * - * if not isinstance(format, bytes): + /* "View.MemoryView":850 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 137, __pyx_L1_error) + __pyx_v_stop = 0; - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") - * + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ - } + } - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") + /* "View.MemoryView":847 * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: */ - __pyx_t_2 = PyBytes_Check(__pyx_v_format); - __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_4) { + goto __pyx_L14; + } - /* "View.MemoryView":140 - * - * if not isinstance(format, bytes): - * format = format.encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format # keep a reference to the byte string - * self.format = self._format + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: + */ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":852 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: + */ + __pyx_v_stop = __pyx_v_shape; + + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); } - } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_L14:; - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") + /* "View.MemoryView":846 + * start = 0 * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ - } + goto __pyx_L13; + } - /* "View.MemoryView":141 - * if not isinstance(format, bytes): - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< - * self.format = self._format - * + /* "View.MemoryView":854 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 141, __pyx_L1_error) - __pyx_t_3 = __pyx_v_format; - __Pyx_INCREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->_format); - __Pyx_DECREF(__pyx_v_self->_format); - __pyx_v_self->_format = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + /*else*/ { + if (__pyx_v_negative_step) { - /* "View.MemoryView":142 - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - * self.format = self._format # <<<<<<<<<<<<<< - * - * + /* "View.MemoryView":855 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape */ - if (unlikely(__pyx_v_self->_format == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(2, 142, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 142, __pyx_L1_error) - __pyx_v_self->format = __pyx_t_7; + __pyx_v_stop = -1L; - /* "View.MemoryView":145 - * + /* "View.MemoryView":854 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: + */ + goto __pyx_L16; + } + + /* "View.MemoryView":857 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< - * self._strides = self._shape + self.ndim * */ - __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; - /* "View.MemoryView":146 + /* "View.MemoryView":861 * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) - * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< * - * if not self._shape: + * if (stop - start) - step * new_shape: */ - __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim + /* "View.MemoryView":863 + * new_shape = (stop - start) // step * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 * */ - __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< + /* "View.MemoryView":864 * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< * + * if new_shape < 0: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 149, __pyx_L1_error) + __pyx_v_new_shape = (__pyx_v_new_shape + 1); - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim + /* "View.MemoryView":863 + * new_shape = (stop - start) // step * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 * */ - } + } - /* "View.MemoryView":152 + /* "View.MemoryView":866 + * new_shape += 1 * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ - __pyx_t_8 = 0; - __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; - for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 152, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_9; - __pyx_v_idx = __pyx_t_8; - __pyx_t_8 = (__pyx_t_8 + 1); + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { - /* "View.MemoryView":153 + /* "View.MemoryView":867 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim */ - __pyx_t_4 = ((__pyx_v_dim <= 0) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_v_new_shape = 0; - /* "View.MemoryView":154 - * for idx, dim in enumerate(shape): - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<< - * self._shape[idx] = dim + /* "View.MemoryView":866 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 * */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 154, __pyx_L1_error) + } - /* "View.MemoryView":153 + /* "View.MemoryView":870 * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset */ - } + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - /* "View.MemoryView":155 - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim # <<<<<<<<<<<<<< + /* "View.MemoryView":871 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset * - * cdef char order */ - (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - /* "View.MemoryView":152 + /* "View.MemoryView":872 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< * * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_L3:; - /* "View.MemoryView":158 + /* "View.MemoryView":875 * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 158, __pyx_L1_error) - if (__pyx_t_4) { + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { - /* "View.MemoryView":159 - * cdef char order - * if mode == 'fortran': - * order = b'F' # <<<<<<<<<<<<<< - * self.mode = u'fortran' - * elif mode == 'c': + /* "View.MemoryView":876 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride */ - __pyx_v_order = 'F'; + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); - /* "View.MemoryView":160 - * if mode == 'fortran': - * order = b'F' - * self.mode = u'fortran' # <<<<<<<<<<<<<< - * elif mode == 'c': - * order = b'C' + /* "View.MemoryView":875 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ - __Pyx_INCREF(__pyx_n_u_fortran); - __Pyx_GIVEREF(__pyx_n_u_fortran); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_fortran; + goto __pyx_L19; + } - /* "View.MemoryView":158 + /* "View.MemoryView":878 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' + * if suboffset >= 0: */ - goto __pyx_L10; + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); } + __pyx_L19:; - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 161, __pyx_L1_error) - if (likely(__pyx_t_4)) { + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { - /* "View.MemoryView":162 - * self.mode = u'fortran' - * elif mode == 'c': - * order = b'C' # <<<<<<<<<<<<<< - * self.mode = u'c' - * else: - */ - __pyx_v_order = 'C'; - - /* "View.MemoryView":163 - * elif mode == 'c': - * order = b'C' - * self.mode = u'c' # <<<<<<<<<<<<<< - * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) - */ - __Pyx_INCREF(__pyx_n_u_c); - __Pyx_GIVEREF(__pyx_n_u_c); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_c; - - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - goto __pyx_L10; - } - - /* "View.MemoryView":165 - * self.mode = u'c' - * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< - * - * self.len = fill_contig_strides_array(self._shape, self._strides, - */ - /*else*/ { - __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 165, __pyx_L1_error) - } - __pyx_L10:; - - /* "View.MemoryView":167 - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) - * - * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<< - * itemsize, self.ndim, order) - * - */ - __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - - /* "View.MemoryView":170 - * itemsize, self.ndim, order) + /* "View.MemoryView":881 * - * self.free_data = allocate_buffer # <<<<<<<<<<<<<< - * self.dtype_is_object = format == b'O' - * if allocate_buffer: + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ - __pyx_v_self->free_data = __pyx_v_allocate_buffer; + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { - /* "View.MemoryView":171 - * - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< - * if allocate_buffer: - * + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 171, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 171, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_self->dtype_is_object = __pyx_t_4; + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< - * - * + /* "View.MemoryView":883 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " */ - __pyx_t_4 = (__pyx_v_allocate_buffer != 0); - if (__pyx_t_4) { + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); - /* "View.MemoryView":175 - * - * - * self.data = malloc(self.len) # <<<<<<<<<<<<<< - * if not self.data: - * raise MemoryError("unable to allocate array data.") + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: */ - __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + goto __pyx_L22; + } - /* "View.MemoryView":176 - * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") - * + /* "View.MemoryView":885 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: */ - __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0); - if (unlikely(__pyx_t_4)) { + /*else*/ { - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< - * - * if self.dtype_is_object: + /* "View.MemoryView":886 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 177, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 885, __pyx_L1_error) + } + __pyx_L22:; - /* "View.MemoryView":176 - * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") + /* "View.MemoryView":881 * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ + goto __pyx_L21; } - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") - * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): - */ - __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":180 - * - * if self.dtype_is_object: - * p = self.data # <<<<<<<<<<<<<< - * for i in range(self.len / itemsize): - * p[i] = Py_None - */ - __pyx_v_p = ((PyObject **)__pyx_v_self->data); - - /* "View.MemoryView":181 - * if self.dtype_is_object: - * p = self.data - * for i in range(self.len / itemsize): # <<<<<<<<<<<<<< - * p[i] = Py_None - * Py_INCREF(Py_None) - */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize); - __pyx_t_9 = __pyx_t_1; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; - - /* "View.MemoryView":182 - * p = self.data - * for i in range(self.len / itemsize): - * p[i] = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "View.MemoryView":888 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< * + * return 0 */ - (__pyx_v_p[__pyx_v_i]) = Py_None; + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; - /* "View.MemoryView":183 - * for i in range(self.len / itemsize): - * p[i] = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride * - * @cname('getbuffer') + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: */ - Py_INCREF(Py_None); - } + } - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") + /* "View.MemoryView":890 + * suboffset_dim[0] = new_ndim * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): - */ - } - - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< + * return 0 # <<<<<<<<<<<<<< * * */ - } + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): + /* "View.MemoryView":793 * + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_XDECREF(__pyx_v_format); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "View.MemoryView":186 +/* "View.MemoryView":896 * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_bufmode; - int __pyx_r; +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + Py_ssize_t __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - Py_ssize_t *__pyx_t_7; + Py_UCS4 __pyx_t_4; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); + __Pyx_RefNannySetupContext("pybuffer_index", 0); - /* "View.MemoryView":187 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 # <<<<<<<<<<<<<< - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + /* "View.MemoryView":898 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp */ - __pyx_v_bufmode = -1; + __pyx_v_suboffset = -1L; - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": + /* "View.MemoryView":899 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp + * */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 188, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":189 - * cdef int bufmode = -1 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + /* "View.MemoryView":902 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize */ - __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": + /* "View.MemoryView":903 + * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: */ - goto __pyx_L3; - } + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 903, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 903, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): + /* "View.MemoryView":904 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 190, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_v_stride = __pyx_v_itemsize; - /* "View.MemoryView":191 - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") - */ - __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): + /* "View.MemoryView":902 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize */ + goto __pyx_L3; } - __pyx_L3:; - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data + /* "View.MemoryView":906 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: */ - __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0); - if (unlikely(__pyx_t_1)) { + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len + /* "View.MemoryView":907 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 193, __pyx_L1_error) + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * */ - } + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { - /* "View.MemoryView":194 - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data # <<<<<<<<<<<<<< - * info.len = self.len - * info.ndim = self.ndim + /* "View.MemoryView":909 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + * + * if index < 0: */ - __pyx_t_4 = __pyx_v_self->data; - __pyx_v_info->buf = __pyx_t_4; + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); - /* "View.MemoryView":195 - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - * info.len = self.len # <<<<<<<<<<<<<< - * info.ndim = self.ndim - * info.shape = self._shape + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * */ - __pyx_t_5 = __pyx_v_self->len; - __pyx_v_info->len = __pyx_t_5; + } + } + __pyx_L3:; - /* "View.MemoryView":196 - * info.buf = self.data - * info.len = self.len - * info.ndim = self.ndim # <<<<<<<<<<<<<< - * info.shape = self._shape - * info.strides = self._strides + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ - __pyx_t_6 = __pyx_v_self->ndim; - __pyx_v_info->ndim = __pyx_t_6; + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { - /* "View.MemoryView":197 - * info.len = self.len - * info.ndim = self.ndim - * info.shape = self._shape # <<<<<<<<<<<<<< - * info.strides = self._strides - * info.suboffsets = NULL + /* "View.MemoryView":912 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" */ - __pyx_t_7 = __pyx_v_self->_shape; - __pyx_v_info->shape = __pyx_t_7; + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); - /* "View.MemoryView":198 - * info.ndim = self.ndim - * info.shape = self._shape - * info.strides = self._strides # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = self.itemsize + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * */ - __pyx_t_7 = __pyx_v_self->_strides; - __pyx_v_info->strides = __pyx_t_7; + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":199 - * info.shape = self._shape - * info.strides = self._strides - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = self.itemsize - * info.readonly = 0 + /* "View.MemoryView":914 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * if index >= shape: */ - __pyx_v_info->suboffsets = NULL; + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__7); + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 914, __pyx_L1_error) - /* "View.MemoryView":200 - * info.strides = self._strides - * info.suboffsets = NULL - * info.itemsize = self.itemsize # <<<<<<<<<<<<<< - * info.readonly = 0 + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * */ - __pyx_t_5 = __pyx_v_self->itemsize; - __pyx_v_info->itemsize = __pyx_t_5; + } - /* "View.MemoryView":201 - * info.suboffsets = NULL - * info.itemsize = self.itemsize - * info.readonly = 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] * - * if flags & PyBUF_FORMAT: + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ - __pyx_v_info->readonly = 0; + } - /* "View.MemoryView":203 - * info.readonly = 0 + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format - * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":204 + /* "View.MemoryView":917 * - * if flags & PyBUF_FORMAT: - * info.format = self.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride */ - __pyx_t_4 = __pyx_v_self->format; - __pyx_v_info->format = __pyx_t_4; + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__7); + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 917, __pyx_L1_error) - /* "View.MemoryView":203 - * info.readonly = 0 + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format - * else: */ - goto __pyx_L5; } - /* "View.MemoryView":206 - * info.format = self.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":919 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset + */ + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + + /* "View.MemoryView":920 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * + */ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":921 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + * + * return resultp + */ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":920 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset * - * info.obj = self */ - /*else*/ { - __pyx_v_info->format = NULL; } - __pyx_L5:; - /* "View.MemoryView":208 - * info.format = NULL + /* "View.MemoryView":923 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< * - * info.obj = self # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; - /* "View.MemoryView":186 + /* "View.MemoryView":896 * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") +/* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) */ -/* Python wrapper */ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__", 0); + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("transpose_memslice", 1); - /* "View.MemoryView":213 + /* "View.MemoryView":930 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: + * cdef Py_ssize_t *shape = memslice.shape */ - __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":214 - * def __dealloc__(array self): - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) # <<<<<<<<<<<<<< - * elif self.free_data: - * if self.dtype_is_object: + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; + + /* "View.MemoryView":932 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides + * */ - __pyx_v_self->callback_free_data(__pyx_v_self->data); + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; - /* "View.MemoryView":213 + /* "View.MemoryView":933 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: */ - goto __pyx_L3; - } + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, + /* "View.MemoryView":937 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] */ - __pyx_t_1 = (__pyx_v_self->free_data != 0); - if (__pyx_t_1) { + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) + /* "View.MemoryView":938 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] */ - __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_1) { + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); - /* "View.MemoryView":217 - * elif self.free_data: - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< - * self._strides, self.ndim, False) - * free(self.data) + /* "View.MemoryView":939 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) + /* "View.MemoryView":940 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + */ + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * */ + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { - /* "View.MemoryView":219 - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) - * free(self.data) # <<<<<<<<<<<<<< - * PyObject_Free(self._shape) + /* "View.MemoryView":943 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< * + * return 0 */ - free(__pyx_v_self->data); + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_kp_s_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L1_error) - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * */ + } } - __pyx_L3:; - /* "View.MemoryView":220 - * self._strides, self.ndim, False) - * free(self.data) - * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + /* "View.MemoryView":945 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * * - * @property */ - PyObject_Free(__pyx_v_self->_shape); + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + /* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; } -/* "View.MemoryView":223 +/* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":224 - * @property - * def memview(self): - * return self.get_memview() # <<<<<<<<<<<<<< + /* "View.MemoryView":964 * - * @cname('get_memview') + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); - /* "View.MemoryView":223 + /* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":227 +/* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) */ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { - int __pyx_v_flags; +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_memview", 0); + __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "View.MemoryView":228 - * @cname('get_memview') - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< - * return memoryview(self, flags, self.dtype_is_object) + /* "View.MemoryView":967 * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: */ - __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { - /* "View.MemoryView":229 - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + /* "View.MemoryView":968 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 968, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":967 * - * def __len__(self): + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + } - /* "View.MemoryView":227 + /* "View.MemoryView":970 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) + * cdef assign_item_from_object(self, char *itemp, object value): + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 970, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -14071,16521 +14793,22342 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { return __pyx_r; } -/* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] +/* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ -/* Python wrapper */ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":973 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: + */ + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { -static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); + /* "View.MemoryView":974 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) + */ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 974, __pyx_L1_error) - /* "View.MemoryView":232 - * - * def __len__(self): - * return self._shape[0] # <<<<<<<<<<<<<< + /* "View.MemoryView":973 * - * def __getattr__(self, attr): + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: */ - __pyx_r = (__pyx_v_self->_shape[0]); - goto __pyx_L0; + goto __pyx_L3; + } - /* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) + /* "View.MemoryView":976 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] + * cdef _get_base(self): + */ + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; + + /* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":234 - * return self._shape[0] +/* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object * */ -/* Python wrapper */ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getattr__", 0); + __Pyx_RefNannySetupContext("_get_base", 0); - /* "View.MemoryView":235 + /* "View.MemoryView":979 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< * - * def __getattr__(self, attr): - * return getattr(self.memview, attr) # <<<<<<<<<<<<<< * - * def __getitem__(self, item): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; goto __pyx_L0; - /* "View.MemoryView":234 - * return self._shape[0] + /* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object * */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":237 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "View.MemoryView":238 - * - * def __getitem__(self, item): - * return self.memview[item] # <<<<<<<<<<<<<< - * - * def __setitem__(self, item, value): + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "View.MemoryView":237 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":240 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value - * +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - - /* "View.MemoryView":241 - * - * def __setitem__(self, item, value): - * self.memview[item] = value # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 241, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "View.MemoryView":240 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":245 +/* "View.MemoryView":999 * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ -static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) { - struct __pyx_array_obj *__pyx_v_result = 0; - struct __pyx_array_obj *__pyx_r = NULL; +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + __Pyx_TypeInfo *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("array_cwrapper", 0); + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - /* "View.MemoryView":249 - * cdef array result + /* "View.MemoryView":1007 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: */ - __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); if (__pyx_t_1) { - /* "View.MemoryView":250 + /* "View.MemoryView":1008 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * * - * if buf == NULL: - * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<< - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); - __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "View.MemoryView":249 - * cdef array result + /* "View.MemoryView":1007 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: */ - goto __pyx_L3; } - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf + /* "View.MemoryView":1013 + * + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice */ - /*else*/ { - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":253 - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) # <<<<<<<<<<<<<< - * result.data = buf + /* "View.MemoryView":1015 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 253, __pyx_L1_error) + __pyx_v_result->from_slice = __pyx_v_memviewslice; - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf + /* "View.MemoryView":1016 + * + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() */ - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5); - __pyx_t_5 = 0; + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - /* "View.MemoryView":254 - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) - * result.data = buf # <<<<<<<<<<<<<< + /* "View.MemoryView":1018 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo * - * return result */ - __pyx_v_result->data = __pyx_v_buf; - } - __pyx_L3:; + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; - /* "View.MemoryView":256 - * result.data = buf + /* "View.MemoryView":1019 * - * return result # <<<<<<<<<<<<<< + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< * + * result.view = memviewslice.memview.view + */ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + + /* "View.MemoryView":1021 + * result.typeinfo = memviewslice.memview.typeinfo * + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = __pyx_v_result; - goto __pyx_L0; + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; - /* "View.MemoryView":245 + /* "View.MemoryView":1022 * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None */ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1023 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) + */ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; -/* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): + /* "View.MemoryView":1024 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * */ + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; -/* Python wrapper */ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 282, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_name = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 282, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + /* "View.MemoryView":1025 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + */ + Py_INCREF(Py_None); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: + */ + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); + /* "View.MemoryView":1028 + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO + */ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - /* "View.MemoryView":283 - * cdef object name - * def __init__(self, name): - * self.name = name # <<<<<<<<<<<<<< - * def __repr__(self): - * return self.name + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: */ - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __Pyx_GOTREF(__pyx_v_self->name); - __Pyx_DECREF(__pyx_v_self->name); - __pyx_v_self->name = __pyx_v_name; + goto __pyx_L4; + } - /* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): + /* "View.MemoryView":1030 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape */ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1032 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides + * + */ + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); -/* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name + /* "View.MemoryView":1033 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * * */ + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); -/* Python wrapper */ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + /* "View.MemoryView":1036 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + */ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1037 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + */ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__", 0); + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break + */ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { - /* "View.MemoryView":285 - * self.name = name - * def __repr__(self): - * return self.name # <<<<<<<<<<<<<< + /* "View.MemoryView":1039 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break * - * cdef generic = Enum("") */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->name); - __pyx_r = __pyx_v_self->name; - goto __pyx_L0; + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - /* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name + /* "View.MemoryView":1040 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< * + * result.view.len = result.view.itemsize */ + goto __pyx_L6_break; - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break + */ + } + } + __pyx_L6_break:; -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "View.MemoryView":1042 + * break + * + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length */ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + /* "View.MemoryView":1043 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * + */ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self.name,) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: + /* "View.MemoryView":1044 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_self->name); - __Pyx_GIVEREF(__pyx_v_self->name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); - __pyx_v_state = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) + /* "View.MemoryView":1046 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v__dict = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_result->to_object_func = __pyx_v_to_object_func; - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* "View.MemoryView":1047 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result */ - __pyx_t_2 = (__pyx_v__dict != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: + /* "View.MemoryView":1049 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); - __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self.name is not None + /* "View.MemoryView":999 + * + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ - __pyx_v_use_setstate = 1; - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1052 + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ - goto __pyx_L3; - } - /* "(tree fragment)":11 - * use_setstate = True - * else: - * use_setstate = self.name is not None # <<<<<<<<<<<<<< - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice */ - /*else*/ { - __pyx_t_3 = (__pyx_v_self->name != Py_None); - __pyx_v_use_setstate = __pyx_t_3; - } - __pyx_L3:; + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + /* "View.MemoryView":1056 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice * else: */ - __pyx_t_3 = (__pyx_v_use_setstate != 0); - if (__pyx_t_3) { + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "(tree fragment)":13 - * use_setstate = self.name is not None - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<< + /* "View.MemoryView":1057 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) + * slice_copy(memview, mslice) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); - __pyx_t_4 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_r = (&__pyx_v_obj->from_slice); goto __pyx_L0; - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice */ } - /* "(tree fragment)":15 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state + /* "View.MemoryView":1059 + * return &obj.from_slice * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice + * */ /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + + /* "View.MemoryView":1060 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_slice_copy') + */ + __pyx_r = __pyx_v_mslice; goto __pyx_L0; } - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "View.MemoryView":1052 + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v__dict); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_obj); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) +/* "View.MemoryView":1063 + * + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("slice_copy", 0); + + /* "View.MemoryView":1067 + * cdef (Py_ssize_t*) shape, strides, suboffsets + * + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets + */ + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; + + /* "View.MemoryView":1068 + * + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets + * + */ + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; + + /* "View.MemoryView":1069 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + * + * dst.memview = <__pyx_memoryview *> memview + */ + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; + + /* "View.MemoryView":1071 + * suboffsets = memview.view.suboffsets + * + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf + * + */ + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + + /* "View.MemoryView":1072 + * + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): + */ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + + /* "View.MemoryView":1074 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + */ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; + + /* "View.MemoryView":1075 + * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + */ + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + + /* "View.MemoryView":1076 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * + */ + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + + /* "View.MemoryView":1077 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object') + */ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } + + /* "View.MemoryView":1063 + * + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets + */ /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +/* "View.MemoryView":1080 + * + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + */ + +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("memoryview_copy", 0); - /* "(tree fragment)":17 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + /* "View.MemoryView":1083 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * + */ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1084 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) + /* "View.MemoryView":1080 + * + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":299 +/* "View.MemoryView":1087 * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ -static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) { - Py_intptr_t __pyx_v_aligned_p; - size_t __pyx_v_offset; - void *__pyx_r; +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - /* "View.MemoryView":301 - * cdef void *align_pointer(void *memory, size_t alignment) nogil: - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<< - * cdef size_t offset + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory); + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "View.MemoryView":305 - * - * with cython.cdivision(True): - * offset = aligned_p % alignment # <<<<<<<<<<<<<< + /* "View.MemoryView":1095 * - * if offset > 0: + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: */ - __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment); + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; - /* "View.MemoryView":307 - * offset = aligned_p % alignment - * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset - * + /* "View.MemoryView":1096 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL */ - __pyx_t_1 = ((__pyx_v_offset > 0) != 0); - if (__pyx_t_1) { + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; - /* "View.MemoryView":308 - * - * if offset > 0: - * aligned_p += alignment - offset # <<<<<<<<<<<<<< + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * return aligned_p + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset)); + goto __pyx_L3; + } - /* "View.MemoryView":307 - * offset = aligned_p % alignment + /* "View.MemoryView":1098 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset + */ + /*else*/ { + __pyx_v_to_object_func = NULL; + + /* "View.MemoryView":1099 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, */ + __pyx_v_to_dtype_func = NULL; } + __pyx_L3:; - /* "View.MemoryView":310 - * aligned_p += alignment - offset + /* "View.MemoryView":1101 + * to_dtype_func = NULL * - * return aligned_p # <<<<<<<<<<<<<< + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) + */ + __Pyx_XDECREF(__pyx_r); + + /* "View.MemoryView":1103 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< * * */ - __pyx_r = ((void *)__pyx_v_aligned_p); + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "View.MemoryView":299 + /* "View.MemoryView":1087 * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo +/* "View.MemoryView":1109 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags */ -/* Python wrapper */ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_obj = 0; - int __pyx_v_flags; - int __pyx_v_dtype_is_object; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 346, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 346, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) - if (values[2]) { - __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) - } else { - __pyx_v_dtype_is_object = ((int)0); - } +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1110 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') + */ + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 346, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":1109 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { - int __pyx_r; - __Pyx_RefNannyDeclarations +/* "View.MemoryView":1113 + * + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. + */ + +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - /* "View.MemoryView":347 + /* "View.MemoryView":1118 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj # <<<<<<<<<<<<<< - * self.flags = flags - * if type(self) is memoryview or obj is not None: - */ - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - __Pyx_GOTREF(__pyx_v_self->obj); - __Pyx_DECREF(__pyx_v_self->obj); - __pyx_v_self->obj = __pyx_v_obj; - - /* "View.MemoryView":348 - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj - * self.flags = flags # <<<<<<<<<<<<<< - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) */ - __pyx_v_self->flags = __pyx_v_flags; + __pyx_v_c_stride = 0; - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: + /* "View.MemoryView":1119 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): */ - __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_3 = (__pyx_v_obj != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { + __pyx_v_f_stride = 0; - /* "View.MemoryView":350 - * self.flags = flags - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None + /* "View.MemoryView":1121 + * cdef Py_ssize_t f_stride = 0 + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] */ - __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 350, __pyx_L1_error) + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) + /* "View.MemoryView":1122 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break */ - __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { - /* "View.MemoryView":352 - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "View.MemoryView":1123 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break * */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":353 - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "View.MemoryView":1124 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * for i in range(ndim): */ - Py_INCREF(Py_None); + goto __pyx_L4_break; - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) + /* "View.MemoryView":1122 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break */ } - - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - */ } + __pyx_L4_break:; - /* "View.MemoryView":355 - * Py_INCREF(Py_None) + /* "View.MemoryView":1126 + * break * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] */ - __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 + /* "View.MemoryView":1127 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break */ - __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { - /* "View.MemoryView":358 - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: + /* "View.MemoryView":1128 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * */ - __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":359 - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() + /* "View.MemoryView":1129 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + goto __pyx_L7_break; - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 + /* "View.MemoryView":1127 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break */ } + } + __pyx_L7_break:; - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: + /* "View.MemoryView":1131 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (__pyx_t_1) { + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { - /* "View.MemoryView":361 - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< - * if self.lock is NULL: - * raise MemoryError + /* "View.MemoryView":1132 + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' */ - __pyx_v_self->lock = PyThread_allocate_lock(); + __pyx_r = 'C'; + goto __pyx_L0; - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError + /* "View.MemoryView":1131 + * break * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (unlikely(__pyx_t_1)) { + } - /* "View.MemoryView":363 - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - * raise MemoryError # <<<<<<<<<<<<<< + /* "View.MemoryView":1134 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< * - * if flags & PyBUF_FORMAT: + * @cython.cdivision(True) */ - PyErr_NoMemory(); __PYX_ERR(2, 363, __pyx_L1_error) + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError + /* "View.MemoryView":1113 * + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. */ - } - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1137 + * + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ - } - /* "View.MemoryView":355 - * Py_INCREF(Py_None) +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1144 * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] */ - } + __pyx_v_src_extent = (__pyx_v_src_shape[0]); - /* "View.MemoryView":365 - * raise MemoryError + /* "View.MemoryView":1145 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] + */ + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + + /* "View.MemoryView":1146 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + __pyx_v_src_stride = (__pyx_v_src_strides[0]); + + /* "View.MemoryView":1147 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: + */ + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + */ + __pyx_t_1 = (__pyx_v_ndim == 1); if (__pyx_t_1) { - /* "View.MemoryView":366 + /* "View.MemoryView":1150 * - * if flags & PyBUF_FORMAT: - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< - * else: - * self.dtype_is_object = dtype_is_object + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0); + __pyx_t_2 = (__pyx_v_src_stride > 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; - goto __pyx_L12_bool_binop_done; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; } - __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L12_bool_binop_done:; - __pyx_v_self->dtype_is_object = __pyx_t_1; - /* "View.MemoryView":365 - * raise MemoryError - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + /* "View.MemoryView":1151 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) * else: */ - goto __pyx_L11; - } + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; - /* "View.MemoryView":368 - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + /* "View.MemoryView":1150 * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - /*else*/ { - __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; - } - __pyx_L11:; + if (__pyx_t_1) { - /* "View.MemoryView":370 - * self.dtype_is_object = dtype_is_object - * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<< - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL + /* "View.MemoryView":1152 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): */ - __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int)))); + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); - /* "View.MemoryView":372 - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":1150 * - * def __dealloc__(memoryview self): + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - __pyx_v_self->typeinfo = NULL; + goto __pyx_L4; + } - /* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags + /* "View.MemoryView":1154 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride */ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":374 - * self.typeinfo = NULL - * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) + /* "View.MemoryView":1155 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride */ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); -/* Python wrapper */ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { - int __pyx_v_i; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyThread_type_lock __pyx_t_6; - PyThread_type_lock __pyx_t_7; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":375 - * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: + /* "View.MemoryView":1156 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: */ - __pyx_t_1 = (__pyx_v_self->obj != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "View.MemoryView":376 - * def __dealloc__(memoryview self): - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - * + /* "View.MemoryView":1157 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): */ - __Pyx_ReleaseBuffer((&__pyx_v_self->view)); + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; - /* "View.MemoryView":375 + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): */ goto __pyx_L3; } - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< - * - * (<__pyx_buffer *> &self.view).obj = NULL + /* "View.MemoryView":1159 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, */ - __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0); - if (__pyx_t_2) { + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":379 - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - * - * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< - * Py_DECREF(Py_None) - * + /* "View.MemoryView":1160 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - /* "View.MemoryView":380 - * - * (<__pyx_buffer *> &self.view).obj = NULL - * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + /* "View.MemoryView":1164 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride * - * cdef int i */ - Py_DECREF(Py_None); + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + /* "View.MemoryView":1165 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< * - * (<__pyx_buffer *> &self.view).obj = NULL + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, */ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } } __pyx_L3:; - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: + /* "View.MemoryView":1137 + * + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ - __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":385 - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - */ - __pyx_t_3 = __pyx_memoryview_thread_locks_used; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; + /* function exit code */ +} - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: +/* "View.MemoryView":1167 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ - __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":387 - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + /* "View.MemoryView":1170 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) + * */ - __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0); - if (__pyx_t_2) { + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); - /* "View.MemoryView":390 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< - * break - * else: + /* "View.MemoryView":1167 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ - __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]); - /* "View.MemoryView":389 - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break - */ - (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6; - (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7; + /* function exit code */ +} - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) +/* "View.MemoryView":1174 + * + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ - } - /* "View.MemoryView":391 - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break # <<<<<<<<<<<<<< - * else: - * PyThread_free_lock(self.lock) - */ - goto __pyx_L6_break; +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: + /* "View.MemoryView":1176 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + * + * for shape in src.shape[:ndim]: */ - } - } - /*else*/ { + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; - /* "View.MemoryView":393 - * break - * else: - * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + /* "View.MemoryView":1178 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: */ - PyThread_free_lock(__pyx_v_self->lock); - } - __pyx_L6_break:; + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: + /* "View.MemoryView":1179 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size */ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); } - /* "View.MemoryView":374 - * self.typeinfo = NULL + /* "View.MemoryView":1181 + * size *= shape * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') + */ + __pyx_r = __pyx_v_size; + goto __pyx_L0; + + /* "View.MemoryView":1174 + * + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; + return __pyx_r; } -/* "View.MemoryView":395 - * PyThread_free_lock(self.lock) +/* "View.MemoryView":1184 * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ -static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - Py_ssize_t __pyx_v_dim; - char *__pyx_v_itemp; - PyObject *__pyx_v_idx = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - char *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_item_pointer", 0); +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; - /* "View.MemoryView":397 - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + /* "View.MemoryView":1193 + * cdef int idx * - * for dim, idx in enumerate(index): + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ - __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) + /* "View.MemoryView":1194 * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] */ - __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { - __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 399, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 399, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1195 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: + */ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1196 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): + */ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_1; - __pyx_t_1 = (__pyx_t_1 + 1); - /* "View.MemoryView":400 - * - * for dim, idx in enumerate(index): - * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + /* "View.MemoryView":1193 + * cdef int idx * - * return itemp + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_7; + goto __pyx_L3; + } - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf + /* "View.MemoryView":1198 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] + */ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; + + /* "View.MemoryView":1199 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) + */ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1200 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< * + * return stride */ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_L3:; - /* "View.MemoryView":402 - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - * return itemp # <<<<<<<<<<<<<< + /* "View.MemoryView":1202 + * stride *= shape[idx] * + * return stride # <<<<<<<<<<<<<< * + * @cname('__pyx_memoryview_copy_data_to_temp') */ - __pyx_r = __pyx_v_itemp; + __pyx_r = __pyx_v_stride; goto __pyx_L0; - /* "View.MemoryView":395 - * PyThread_free_lock(self.lock) + /* "View.MemoryView":1184 * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":405 - * +/* "View.MemoryView":1205 * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ -/* Python wrapper */ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_indices = NULL; - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + Py_ssize_t __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - char *__pyx_t_6; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("copy_data_to_temp", 1); - /* "View.MemoryView":406 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self + /* "View.MemoryView":1216 + * cdef void *result * - */ - __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":407 - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: - * return self # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) * - * have_slices, indices = _unellipsify(index, self.view.ndim) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":406 + /* "View.MemoryView":1217 * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< * + * result = malloc(size) */ - } + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - /* "View.MemoryView":409 - * return self - * - * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + /* "View.MemoryView":1219 + * cdef size_t size = slice_get_size(src, ndim) * - * cdef char *itemp + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() */ - __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(__pyx_t_3 != Py_None)) { - PyObject* sequence = __pyx_t_3; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 409, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 409, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_v_indices = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_v_result = malloc(__pyx_v_size); - /* "View.MemoryView":412 + /* "View.MemoryView":1220 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 412, __pyx_L1_error) + __pyx_t_2 = (!(__pyx_v_result != 0)); if (__pyx_t_2) { - /* "View.MemoryView":413 - * cdef char *itemp - * if have_slices: - * return memview_slice(self, indices) # <<<<<<<<<<<<<< - * else: - * itemp = self.get_item_pointer(indices) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "View.MemoryView":412 + /* "View.MemoryView":1221 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: - */ - } - - /* "View.MemoryView":415 - * return memview_slice(self, indices) - * else: - * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< - * return self.convert_item_to_object(itemp) * */ - /*else*/ { - __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 415, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_6; + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error) - /* "View.MemoryView":416 - * else: - * itemp = self.get_item_pointer(indices) - * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + /* "View.MemoryView":1220 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() * - * def __setitem__(memoryview self, object index, object value): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; } - /* "View.MemoryView":405 + /* "View.MemoryView":1224 * * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): */ + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_indices); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) + /* "View.MemoryView":1225 * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] */ + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; -/* Python wrapper */ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_obj = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - __Pyx_INCREF(__pyx_v_index); - - /* "View.MemoryView":419 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") - * + /* "View.MemoryView":1226 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 */ - __pyx_t_1 = (__pyx_v_self->view.readonly != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< + /* "View.MemoryView":1227 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 * - * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 420, __pyx_L1_error) + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - /* "View.MemoryView":419 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") + /* "View.MemoryView":1228 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) */ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; } - /* "View.MemoryView":422 - * raise TypeError("Cannot assign to read-only memoryview") + /* "View.MemoryView":1230 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< * - * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * - * if have_slices: */ - __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(__pyx_t_2 != Py_None)) { - PyObject* sequence = __pyx_t_2; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 422, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 422, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); - __pyx_t_4 = 0; + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "View.MemoryView":1233 * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":425 + /* "View.MemoryView":1234 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 * - * if have_slices: - * obj = self.is_slice(value) # <<<<<<<<<<<<<< - * if obj: - * self.setitem_slice_assignment(self[index], obj) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_obj = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: + /* "View.MemoryView":1235 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 426, __pyx_L1_error) - if (__pyx_t_1) { + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - /* "View.MemoryView":427 - * obj = self.is_slice(value) - * if obj: - * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< - * else: - * self.setitem_slice_assign_scalar(self[index], value) + /* "View.MemoryView":1234 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * */ - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - goto __pyx_L5; - } + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":429 - * self.setitem_slice_assignment(self[index], obj) - * else: - * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< - * else: - * self.setitem_indexed(index, value) + /* "View.MemoryView":1238 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 429, __pyx_L1_error) - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L5:; + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - goto __pyx_L4; + goto __pyx_L9; } - /* "View.MemoryView":431 - * self.setitem_slice_assign_scalar(self[index], value) - * else: - * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + /* "View.MemoryView":1240 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< * - * cdef is_slice(self, obj): + * return result */ /*else*/ { - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); } - __pyx_L4:; + __pyx_L9:; - /* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) + /* "View.MemoryView":1242 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "View.MemoryView":1205 + * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "View.MemoryView":433 - * self.setitem_indexed(index, value) +/* "View.MemoryView":1247 * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ -static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { - PyObject *__pyx_r = NULL; +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_UCS4 __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_slice", 0); - __Pyx_INCREF(__pyx_v_obj); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_extents", 0); - /* "View.MemoryView":434 + /* "View.MemoryView":1249 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_5); - /*try:*/ { - - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: - */ - __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - - /* "View.MemoryView":437 - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * except TypeError: - * return None + * @cname('__pyx_memoryview_err_dim') */ - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 437, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 127; + __Pyx_INCREF(__pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_2 += 35; + __Pyx_GIVEREF(__pyx_kp_u_got_differing_extents_in_dimensi); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_got); + __pyx_t_2 += 6; + __Pyx_GIVEREF(__pyx_kp_u_got); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_got); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_and); + __pyx_t_2 += 5; + __Pyx_GIVEREF(__pyx_kp_u_and); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_and); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_2 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__7); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 1249, __pyx_L1_error) - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: + /* "View.MemoryView":1247 + * + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); - __pyx_t_7 = 0; - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} - /* "View.MemoryView":438 - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - * except TypeError: # <<<<<<<<<<<<<< - * return None +/* "View.MemoryView":1252 * - */ - __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); - if (__pyx_t_9) { - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 438, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_6); - - /* "View.MemoryView":439 - * self.dtype_is_object) - * except TypeError: - * return None # <<<<<<<<<<<<<< + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * - * return obj */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_except_return; - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L1_error; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L0; - __pyx_L9_try_end:; - } +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); - /* "View.MemoryView":434 + /* "View.MemoryView":1253 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * @cname('__pyx_memoryview_err') */ - } + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1253, __pyx_L1_error) - /* "View.MemoryView":441 - * return None + /* "View.MemoryView":1252 * - * return obj # <<<<<<<<<<<<<< - * - * cdef setitem_slice_assignment(self, dst, src): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_obj); - __pyx_r = __pyx_v_obj; - goto __pyx_L0; - - /* "View.MemoryView":433 - * self.setitem_indexed(index, value) + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "View.MemoryView":443 - * return obj +/* "View.MemoryView":1256 + * + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice */ -static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { - __Pyx_memviewslice __pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_src_slice; - PyObject *__pyx_r = NULL; +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - __Pyx_memviewslice *__pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice + /* "View.MemoryView":1257 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) + * @cname('__pyx_memoryview_err_no_memory') */ - if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 447, __pyx_L1_error) - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 447, __pyx_L1_error) + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1257, __pyx_L1_error) - /* "View.MemoryView":448 + /* "View.MemoryView":1256 * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<< - * src.ndim, dst.ndim, self.dtype_is_object) + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg * */ - if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 448, __pyx_L1_error) - __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 448, __pyx_L1_error) - /* "View.MemoryView":449 - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< - * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice +/* "View.MemoryView":1260 + * + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) */ - __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 447, __pyx_L1_error) - /* "View.MemoryView":443 - * return obj +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_no_memory", 0); + + /* "View.MemoryView":1261 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * + * + */ + PyErr_NoMemory(); __PYX_ERR(1, 1261, __pyx_L1_error) + + /* "View.MemoryView":1260 + * + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) +/* "View.MemoryView":1265 * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ -static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { - int __pyx_v_array[0x80]; - void *__pyx_v_tmp; - void *__pyx_v_item; - __Pyx_memviewslice *__pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_tmp_slice; - PyObject *__pyx_r = NULL; +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; + Py_ssize_t __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_3; int __pyx_t_4; int __pyx_t_5; - char const *__pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; + int __pyx_t_6; + void *__pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("memoryview_copy_contents", 1); - /* "View.MemoryView":453 - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - * cdef int array[128] - * cdef void *tmp = NULL # <<<<<<<<<<<<<< - * cdef void *item - * + /* "View.MemoryView":1273 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i */ - __pyx_v_tmp = NULL; + __pyx_v_tmpdata = NULL; - /* "View.MemoryView":458 - * cdef __Pyx_memviewslice *dst_slice - * cdef __Pyx_memviewslice tmp_slice - * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< - * - * if self.view.itemsize > sizeof(array): + /* "View.MemoryView":1274 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 458, __pyx_L1_error) - __pyx_v_dst_slice = __pyx_t_1; + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) + /* "View.MemoryView":1276 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False + */ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + + /* "View.MemoryView":1277 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp + */ + __pyx_v_broadcasting = 0; + + /* "View.MemoryView":1278 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: */ - __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); - if (__pyx_t_2) { + __pyx_v_direct_copy = 0; - /* "View.MemoryView":461 + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp * - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< - * if tmp == NULL: - * raise MemoryError + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ - __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp + /* "View.MemoryView":1282 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) */ - __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); - /* "View.MemoryView":463 - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * item = tmp - * else: + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ - PyErr_NoMemory(); __PYX_ERR(2, 463, __pyx_L1_error) + goto __pyx_L3; + } - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * */ - } + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":464 - * if tmp == NULL: - * raise MemoryError - * item = tmp # <<<<<<<<<<<<<< - * else: - * item = array + /* "View.MemoryView":1284 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) */ - __pyx_v_item = __pyx_v_tmp; + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: */ - goto __pyx_L3; } + __pyx_L3:; - /* "View.MemoryView":466 - * item = tmp - * else: - * item = array # <<<<<<<<<<<<<< + /* "View.MemoryView":1286 + * broadcast_leading(&dst, dst_ndim, src_ndim) * - * try: + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): */ - /*else*/ { - __pyx_v_item = ((void *)__pyx_v_array); + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; } - __pyx_L3:; + __pyx_v_ndim = __pyx_t_5; - /* "View.MemoryView":468 - * item = array + /* "View.MemoryView":1288 + * cdef int ndim = max(src_ndim, dst_ndim) * - * try: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * ( item)[0] = value + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: */ - /*try:*/ { + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":469 + /* "View.MemoryView":1289 * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ - __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0); + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); if (__pyx_t_2) { - /* "View.MemoryView":470 - * try: - * if self.dtype_is_object: - * ( item)[0] = value # <<<<<<<<<<<<<< - * else: - * self.assign_item_from_object( item, value) + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 */ - (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { - /* "View.MemoryView":469 - * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value + /* "View.MemoryView":1291 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 * else: */ - goto __pyx_L8; - } + __pyx_v_broadcasting = 1; - /* "View.MemoryView":472 - * ( item)[0] = value + /* "View.MemoryView":1292 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< * else: - * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + * _err_extents(i, dst.shape[i], src.shape[i]) + */ + (__pyx_v_src.strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 + */ + goto __pyx_L7; + } + + /* "View.MemoryView":1294 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< * + * if src.suboffsets[i] >= 0: + */ + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1294, __pyx_L1_error) + } + __pyx_L7:; + + /* "View.MemoryView":1289 * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ - /*else*/ { - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 472, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __pyx_L8:; - /* "View.MemoryView":476 + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0); + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); if (__pyx_t_2) { - /* "View.MemoryView":477 + /* "View.MemoryView":1297 * - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + * + * if slices_overlap(&src, &dst, ndim, itemsize): */ - __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 477, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error) - /* "View.MemoryView":476 + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ } + } - /* "View.MemoryView":478 - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< - * item, self.dtype_is_object) - * finally: + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): */ - __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); - } + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { - /* "View.MemoryView":481 - * item, self.dtype_is_object) - * finally: - * PyMem_Free(tmp) # <<<<<<<<<<<<<< + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) * - * cdef setitem_indexed(self, index, value): */ - /*finally:*/ { - /*normal exit:*/{ - PyMem_Free(__pyx_v_tmp); - goto __pyx_L7; - } - __pyx_L6_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; - { - PyMem_Free(__pyx_v_tmp); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; - goto __pyx_L1_error; - } - __pyx_L7:; - } + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { - /* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) + /* "View.MemoryView":1302 * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) */ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * + */ + } -/* "View.MemoryView":483 - * PyMem_Free(tmp) + /* "View.MemoryView":1304 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) */ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1304, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; -static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_indexed", 0); + /* "View.MemoryView":1305 + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: + */ + __pyx_v_src = __pyx_v_tmp; - /* "View.MemoryView":484 + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< - * self.assign_item_from_object(itemp, value) + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< * + * if not slice_is_contig(src, order, ndim): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 484, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_1; + } - /* "View.MemoryView":485 - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * * - * cdef convert_item_to_object(self, char *itemp): */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 485, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { - /* "View.MemoryView":483 - * PyMem_Free(tmp) + /* "View.MemoryView":1310 * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1311 + * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) + */ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); -/* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) + /* "View.MemoryView":1310 * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ + goto __pyx_L12; + } -static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_v_struct = NULL; - PyObject *__pyx_v_bytesitem = 0; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - size_t __pyx_t_10; - int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":490 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef bytes bytesitem + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":493 - * cdef bytes bytesitem + /* "View.MemoryView":1313 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< * - * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< - * try: - * result = struct.unpack(self.view.format, bytesitem) + * if direct_copy: */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - /* "View.MemoryView":494 + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { - - /* "View.MemoryView":495 - * bytesitem = itemp[:self.view.itemsize] - * try: - * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< - * except struct.error: - * raise ValueError("Unable to convert item to object") */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); - __Pyx_INCREF(__pyx_v_bytesitem); - __Pyx_GIVEREF(__pyx_v_bytesitem); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; + } + __pyx_L12:; - /* "View.MemoryView":494 + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - } + if (__pyx_v_direct_copy) { - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result + /* "View.MemoryView":1317 + * if direct_copy: + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) */ - /*else:*/ { - __pyx_t_10 = strlen(__pyx_v_self->view.format); - __pyx_t_11 = ((__pyx_t_10 == 1) != 0); - if (__pyx_t_11) { + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":500 - * else: - * if len(self.view.format) == 1: - * return result[0] # <<<<<<<<<<<<<< - * return result + /* "View.MemoryView":1318 * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L6_except_return; + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result + /* "View.MemoryView":1319 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 */ - } + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":501 - * if len(self.view.format) == 1: - * return result[0] - * return result # <<<<<<<<<<<<<< + /* "View.MemoryView":1320 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 * - * cdef assign_item_from_object(self, char *itemp, object value): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L6_except_return; - } - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + free(__pyx_v_tmpdata); - /* "View.MemoryView":496 - * try: - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: # <<<<<<<<<<<<<< - * raise ValueError("Unable to convert item to object") - * else: + /* "View.MemoryView":1321 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9); - __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0; - if (__pyx_t_8) { - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 497, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(2, 497, __pyx_L5_except_error) } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - /* "View.MemoryView":494 + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: */ - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L6_except_return:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L0; } - /* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" */ + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesitem); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1326 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) + * + */ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1326, __pyx_L1_error) -/* "View.MemoryView":503 - * return result + /* "View.MemoryView":1327 * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) -static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_v_struct = NULL; - char __pyx_v_c; - PyObject *__pyx_v_bytesvalue = 0; - Py_ssize_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - char *__pyx_t_11; - char *__pyx_t_12; - char *__pyx_t_13; - char *__pyx_t_14; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); - - /* "View.MemoryView":506 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef char c - * cdef bytes bytesvalue - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":511 - * cdef Py_ssize_t i + /* "View.MemoryView":1323 + * return 0 * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: - */ - __pyx_t_2 = PyTuple_Check(__pyx_v_value); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "View.MemoryView":512 + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< * - * if isinstance(value, tuple): - * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< - * else: - * bytesvalue = struct.pack(self.view.format, value) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - - /* "View.MemoryView":511 - * cdef Py_ssize_t i * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: */ - goto __pyx_L3; } - /* "View.MemoryView":514 - * bytesvalue = struct.pack(self.view.format, *value) - * else: - * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + /* "View.MemoryView":1329 + * transpose_memslice(&dst) * - * for i, c in enumerate(bytesvalue): + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 514, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - } - __pyx_L3:; + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) + /* "View.MemoryView":1330 * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * */ - __pyx_t_9 = 0; - if (unlikely(__pyx_v_bytesvalue == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(2, 516, __pyx_L1_error) - } - __Pyx_INCREF(__pyx_v_bytesvalue); - __pyx_t_10 = __pyx_v_bytesvalue; - __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10); - __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10)); - for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { - __pyx_t_11 = __pyx_t_14; - __pyx_v_c = (__pyx_t_11[0]); + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - /* "View.MemoryView":517 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< + /* "View.MemoryView":1331 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< * - * @cname('getbuffer') + * free(tmpdata) */ - __pyx_v_i = __pyx_t_9; + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) + /* "View.MemoryView":1333 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 * */ - __pyx_t_9 = (__pyx_t_9 + 1); + free(__pyx_v_tmpdata); - /* "View.MemoryView":517 + /* "View.MemoryView":1334 * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< * - * @cname('getbuffer') + * @cname('__pyx_memoryview_broadcast_leading') */ - (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":503 - * return result + /* "View.MemoryView":1265 * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesvalue); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "View.MemoryView":520 +/* "View.MemoryView":1337 * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - char *__pyx_t_5; - void *__pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); + int __pyx_t_3; - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "View.MemoryView":1341 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< * + * for i in range(ndim - 1, -1, -1): */ - __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_self->view.readonly != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< + /* "View.MemoryView":1343 + * cdef int offset = ndim_other - ndim * - * if flags & PyBUF_ND: + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 522, __pyx_L1_error) + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "View.MemoryView":1344 * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] */ - } + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "View.MemoryView":1345 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); - if (__pyx_t_1) { + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":525 + /* "View.MemoryView":1346 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< * - * if flags & PyBUF_ND: - * info.shape = self.view.shape # <<<<<<<<<<<<<< - * else: - * info.shape = NULL - */ - __pyx_t_4 = __pyx_v_self->view.shape; - __pyx_v_info->shape = __pyx_t_4; - - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: + * for i in range(offset): */ - goto __pyx_L6; + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); } - /* "View.MemoryView":527 - * info.shape = self.view.shape - * else: - * info.shape = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":1348 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] * - * if flags & PyBUF_STRIDES: + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] */ - /*else*/ { - __pyx_v_info->shape = NULL; - } - __pyx_L6:; + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":529 - * info.shape = NULL + /* "View.MemoryView":1349 * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); - if (__pyx_t_1) { + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; - /* "View.MemoryView":530 + /* "View.MemoryView":1350 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 * - * if flags & PyBUF_STRIDES: - * info.strides = self.view.strides # <<<<<<<<<<<<<< - * else: - * info.strides = NULL */ - __pyx_t_4 = __pyx_v_self->view.strides; - __pyx_v_info->strides = __pyx_t_4; + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); - /* "View.MemoryView":529 - * info.shape = NULL + /* "View.MemoryView":1351 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: - */ - goto __pyx_L7; - } - - /* "View.MemoryView":532 - * info.strides = self.view.strides - * else: - * info.strides = NULL # <<<<<<<<<<<<<< * - * if flags & PyBUF_INDIRECT: */ - /*else*/ { - __pyx_v_info->strides = NULL; + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; } - __pyx_L7:; - /* "View.MemoryView":534 - * info.strides = NULL + /* "View.MemoryView":1337 * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":535 - * - * if flags & PyBUF_INDIRECT: - * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< - * else: - * info.suboffsets = NULL - */ - __pyx_t_4 = __pyx_v_self->view.suboffsets; - __pyx_v_info->suboffsets = __pyx_t_4; + /* function exit code */ +} - /* "View.MemoryView":534 - * info.strides = NULL +/* "View.MemoryView":1359 * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: - */ - goto __pyx_L8; - } - - /* "View.MemoryView":537 - * info.suboffsets = self.view.suboffsets - * else: - * info.suboffsets = NULL # <<<<<<<<<<<<<< + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< * - * if flags & PyBUF_FORMAT: + * if dtype_is_object: */ - /*else*/ { - __pyx_v_info->suboffsets = NULL; - } - __pyx_L8:; - /* "View.MemoryView":539 - * info.suboffsets = NULL - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - /* "View.MemoryView":540 + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) * - * if flags & PyBUF_FORMAT: - * info.format = self.view.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL */ - __pyx_t_5 = __pyx_v_self->view.format; - __pyx_v_info->format = __pyx_t_5; + if (__pyx_v_dtype_is_object) { - /* "View.MemoryView":539 - * info.suboffsets = NULL + /* "View.MemoryView":1362 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') */ - goto __pyx_L9; - } + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); - /* "View.MemoryView":542 - * info.format = self.view.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) * - * info.buf = self.view.buf */ - /*else*/ { - __pyx_v_info->format = NULL; } - __pyx_L9:; - /* "View.MemoryView":544 - * info.format = NULL + /* "View.MemoryView":1359 * - * info.buf = self.view.buf # <<<<<<<<<<<<<< - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - */ - __pyx_t_6 = __pyx_v_self->view.buf; - __pyx_v_info->buf = __pyx_t_6; - - /* "View.MemoryView":545 + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< * - * info.buf = self.view.buf - * info.ndim = self.view.ndim # <<<<<<<<<<<<<< - * info.itemsize = self.view.itemsize - * info.len = self.view.len - */ - __pyx_t_7 = __pyx_v_self->view.ndim; - __pyx_v_info->ndim = __pyx_t_7; - - /* "View.MemoryView":546 - * info.buf = self.view.buf - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< - * info.len = self.view.len - * info.readonly = self.view.readonly + * if dtype_is_object: */ - __pyx_t_8 = __pyx_v_self->view.itemsize; - __pyx_v_info->itemsize = __pyx_t_8; - /* "View.MemoryView":547 - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - * info.len = self.view.len # <<<<<<<<<<<<<< - * info.readonly = self.view.readonly - * info.obj = self - */ - __pyx_t_8 = __pyx_v_self->view.len; - __pyx_v_info->len = __pyx_t_8; + /* function exit code */ +} - /* "View.MemoryView":548 - * info.itemsize = self.view.itemsize - * info.len = self.view.len - * info.readonly = self.view.readonly # <<<<<<<<<<<<<< - * info.obj = self +/* "View.MemoryView":1365 * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: */ - __pyx_t_1 = __pyx_v_self->view.readonly; - __pyx_v_info->readonly = __pyx_t_1; - /* "View.MemoryView":549 - * info.len = self.view.len - * info.readonly = self.view.readonly - * info.obj = self # <<<<<<<<<<<<<< +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + __Pyx_RefNannyDeclarations + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); + + /* "View.MemoryView":1368 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") + * @cname('__pyx_memoryview_refcount_objects_in_slice') */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - /* "View.MemoryView":520 + /* "View.MemoryView":1365 * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; __Pyx_RefNannyFinishContext(); - return __pyx_r; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif } -/* "View.MemoryView":555 +/* "View.MemoryView":1371 * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":556 - * @property - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< - * transpose_memslice(&result.from_slice) - * return result - */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 556, __pyx_L1_error) - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":557 - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< - * return result + /* "View.MemoryView":1374 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< * + * for i in range(shape[0]): */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 557, __pyx_L1_error) + __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":558 - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - * return result # <<<<<<<<<<<<<< + /* "View.MemoryView":1376 + * cdef Py_ssize_t stride = strides[0] * - * @property + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":555 + /* "View.MemoryView":1377 * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) */ + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj - * + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: */ + if (__pyx_v_inc) { -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "View.MemoryView":1379 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) + */ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: + */ + goto __pyx_L6; + } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":1381 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + */ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; - /* "View.MemoryView":562 - * @property - * def base(self): - * return self.obj # <<<<<<<<<<<<<< + /* "View.MemoryView":1377 * - * @property + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->obj); - __pyx_r = __pyx_v_self->obj; - goto __pyx_L0; + goto __pyx_L5; + } - /* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj + /* "View.MemoryView":1383 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< * + * data += stride */ + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":565 + /* "View.MemoryView":1385 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * data += stride # <<<<<<<<<<<<<< * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_length; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":566 - * @property - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< * - * @property */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_length = (__pyx_t_2[0]); - __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); } - __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - /* "View.MemoryView":565 - * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) + /* "View.MemoryView":1371 * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":569 - * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: +/* "View.MemoryView":1391 * + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: */ -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_stride; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":1394 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + */ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< + /* "View.MemoryView":1395 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) * - * raise ValueError("Buffer view does not expose strides") */ - __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":572 - * if self.view.strides == NULL: + /* "View.MemoryView":1396 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< - * - * raise ValueError("Buffer view does not expose strides") - */ - } - - /* "View.MemoryView":574 - * raise ValueError("Buffer view does not expose strides") - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_v_stride = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - /* "View.MemoryView":569 - * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: + /* "View.MemoryView":1391 * + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":577 +/* "View.MemoryView":1400 * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - Py_ssize_t *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim + /* "View.MemoryView":1404 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] * */ - __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); - if (__pyx_t_1) { + __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + /* "View.MemoryView":1405 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * if ndim == 1: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__15, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_v_extent = (__pyx_v_shape[0]); - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) */ - } + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { - /* "View.MemoryView":581 - * return (-1,) * self.view.ndim + /* "View.MemoryView":1408 * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); - for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) { - __pyx_t_4 = __pyx_t_6; - __pyx_v_suboffset = (__pyx_t_4[0]); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":577 - * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + /* "View.MemoryView":1409 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: */ + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1410 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): + */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } -/* "View.MemoryView":584 - * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) */ + goto __pyx_L3; + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":1412 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride + */ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":585 - * @property - * def ndim(self): - * return self.view.ndim # <<<<<<<<<<<<<< + /* "View.MemoryView":1413 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride * - * @property */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 585, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":584 + /* "View.MemoryView":1414 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim * + */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1400 + * + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":588 - * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize - * +/* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); - /* "View.MemoryView":589 - * @property - * def itemsize(self): - * return self.view.itemsize # <<<<<<<<<<<<<< - * - * @property + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 589, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "View.MemoryView":588 - * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize - * + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) -/* "View.MemoryView":592 - * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize - * + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":593 - * @property - * def nbytes(self): - * return self.size * self.view.itemsize # <<<<<<<<<<<<<< - * - * @property + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; goto __pyx_L0; - /* "View.MemoryView":592 - * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize - * + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":596 - * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_length = NULL; +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 - * + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) */ - __pyx_t_1 = (__pyx_v_self->_size == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":598 - * def size(self): - * if self._size is None: - * result = 1 # <<<<<<<<<<<<<< - * - * for length in self.view.shape[:self.view.ndim]: + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_result = __pyx_int_1; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 > 1); + if (__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { - /* "View.MemoryView":600 - * result = 1 - * - * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< - * result *= length - * + /* "(tree fragment)":14 + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< */ - __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":601 - * - * for length in self.view.shape[:self.view.ndim]: - * result *= length # <<<<<<<<<<<<<< - * - * self._size = result + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) */ - __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 601, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6); - __pyx_t_6 = 0; - } + } - /* "View.MemoryView":603 - * result *= length - * - * self._size = result # <<<<<<<<<<<<<< - * - * return self._size + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ - __Pyx_INCREF(__pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - __Pyx_GOTREF(__pyx_v_self->_size); - __Pyx_DECREF(__pyx_v_self->_size); - __pyx_v_self->_size = __pyx_v_result; - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ - } - /* "View.MemoryView":605 - * self._size = result - * - * return self._size # <<<<<<<<<<<<<< +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":248 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< * - * def __len__(self): + * @property */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_size); - __pyx_r = __pyx_v_self->_size; + __pyx_r = PyArray_BASE(__pyx_v_self); goto __pyx_L0; - /* "View.MemoryView":596 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":607 - * return self._size +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ */ -/* Python wrapper */ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":254 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 + * + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ + */ /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__len__", 0); - - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 * + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ */ - __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":609 - * def __len__(self): - * if self.view.ndim >= 1: - * return self.view.shape[0] # <<<<<<<<<<<<<< +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":260 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< * - * return 0 + * @property */ - __pyx_r = (__pyx_v_self->view.shape[0]); - goto __pyx_L0; + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 * + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ */ - } - /* "View.MemoryView":611 - * return self.view.shape[0] + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 * - * return 0 # <<<<<<<<<<<<<< + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). + */ + +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":268 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< * - * def __repr__(self): + * @property */ - __pyx_r = 0; + __pyx_r = PyArray_DIMS(__pyx_v_self); goto __pyx_L0; - /* "View.MemoryView":607 - * return self._size + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ /* function exit code */ __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":613 - * return 0 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ -/* Python wrapper */ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":275 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 + * + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__repr__", 0); +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 + * + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ + */ - /* "View.MemoryView":614 +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":281 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) + * @property + */ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 * + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":615 - * def __repr__(self): - * return "" % (self.base.__class__.__name__, - * id(self)) # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 * - * def __str__(self): + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - /* "View.MemoryView":614 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":290 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< * + * ctypedef unsigned char npy_bool */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_r = PyArray_BYTES(__pyx_v_self); goto __pyx_L0; - /* "View.MemoryView":613 - * return 0 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":617 - * id(self)) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) * */ -/* Python wrapper */ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "View.MemoryView":618 - * - * def __str__(self): - * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":774 * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * + * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":617 - * id(self)) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":621 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp */ -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_c_contig", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "View.MemoryView":624 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":777 * - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 624, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; - - /* "View.MemoryView":625 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * - * def is_f_contig(self): + * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":621 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp */ -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_f_contig", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "View.MemoryView":630 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":780 * - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 630, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; - - /* "View.MemoryView":631 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * - * def copy(self): + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_mslice; - int __pyx_v_flags; +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "View.MemoryView":635 - * def copy(self): - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":783 * - * slice_copy(self, &mslice) + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + __Pyx_XDECREF(__pyx_r); + __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_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":637 - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * - * slice_copy(self, &mslice) # <<<<<<<<<<<<<< - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, - * self.view.itemsize, */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - /* "View.MemoryView":638 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * slice_copy(self, &mslice) - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_C_CONTIGUOUS, */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 638, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; - /* "View.MemoryView":643 - * self.dtype_is_object) +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":786 * - * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * - * def copy_fortran(self): + * cdef inline tuple PyDataType_SHAPE(dtype d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __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_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape */ -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - int __pyx_v_flags; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy_fortran", 0); + int __pyx_t_1; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - /* "View.MemoryView":647 - * def copy_fortran(self): - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 * - * slice_copy(self, &src) + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { - /* "View.MemoryView":649 - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS - * - * slice_copy(self, &src) # <<<<<<<<<<<<<< - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, - * self.view.itemsize, + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":790 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); + __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); + goto __pyx_L0; - /* "View.MemoryView":650 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 * - * slice_copy(self, &src) - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_F_CONTIGUOUS, + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 650, __pyx_L1_error) - __pyx_v_dst = __pyx_t_1; + } - /* "View.MemoryView":655 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":792 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_empty_tuple); + __pyx_r = __pyx_empty_tuple; + goto __pyx_L0; + } - /* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":968 + * + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + Py_INCREF(__pyx_v_base); - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":969 + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 969, __pyx_L1_error) + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":972 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_v_base = PyArray_BASE(__pyx_v_arr); - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base + */ + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":974 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base + */ + } + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":975 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< + * + * # Versions of the import_* functions which are more suitable for + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":659 - * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ -static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { - struct __pyx_memoryview_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + __Pyx_RefNannySetupContext("import_array", 0); - /* "View.MemoryView":660 - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< - * result.typeinfo = typeinfo - * return result + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_o); - __Pyx_GIVEREF(__pyx_v_o); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":661 - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo # <<<<<<<<<<<<<< - * return result - * + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":981 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") */ - __pyx_v_result->typeinfo = __pyx_v_typeinfo; + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 981, __pyx_L3_error) - /* "View.MemoryView":662 - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - * return result # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_check') + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":659 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":982 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.multiarray failed to import") * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo */ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 982, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * + * cdef inline int import_umath() except -1: */ + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 983, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 983, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; -static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("memoryview_check", 0); - - /* "View.MemoryView":666 - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): - * return isinstance(o, memoryview) # <<<<<<<<<<<<<< - * - * cdef tuple _unellipsify(object index, int ndim): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); - __pyx_r = __pyx_t_1; - goto __pyx_L0; + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } - /* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) - * + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":668 - * return isinstance(o, memoryview) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ -static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { - PyObject *__pyx_v_tup = NULL; - PyObject *__pyx_v_result = NULL; - int __pyx_v_have_slices; - int __pyx_v_seen_ellipsis; - CYTHON_UNUSED PyObject *__pyx_v_idx = NULL; - PyObject *__pyx_v_item = NULL; - Py_ssize_t __pyx_v_nslices; - PyObject *__pyx_r = NULL; +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_unellipsify", 0); - - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: - */ - __pyx_t_1 = PyTuple_Check(__pyx_v_index); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __Pyx_RefNannySetupContext("import_umath", 0); - /* "View.MemoryView":674 - * """ - * if not isinstance(index, tuple): - * tup = (index,) # <<<<<<<<<<<<<< - * else: - * tup = index + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 674, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); - __pyx_v_tup = __pyx_t_3; - __pyx_t_3 = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":987 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") */ - goto __pyx_L3; - } + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 987, __pyx_L3_error) - /* "View.MemoryView":676 - * tup = (index,) - * else: - * tup = index # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * result = [] + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - /*else*/ { - __Pyx_INCREF(__pyx_v_index); - __pyx_v_tup = __pyx_v_index; - } - __pyx_L3:; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":678 - * tup = index + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":988 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") * - * result = [] # <<<<<<<<<<<<<< - * have_slices = False - * seen_ellipsis = False */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 678, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_result = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 988, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":679 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * - * result = [] - * have_slices = False # <<<<<<<<<<<<<< - * seen_ellipsis = False - * for idx, item in enumerate(tup): - */ - __pyx_v_have_slices = 0; - - /* "View.MemoryView":680 - * result = [] - * have_slices = False - * seen_ellipsis = False # <<<<<<<<<<<<<< - * for idx, item in enumerate(tup): - * if item is Ellipsis: - */ - __pyx_v_seen_ellipsis = 0; - - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: + * cdef inline int import_ufunc() except -1: */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_3 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) { - __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 681, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } - } else { - __pyx_t_7 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_7)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 681, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 989, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 989, __pyx_L5_except_error) } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_7; - __pyx_t_7 = 0; + goto __pyx_L5_except_error; - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ - __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: - */ - __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__18); - __Pyx_GIVEREF(__pyx_slice__18); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__18); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":685 - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True # <<<<<<<<<<<<<< - * else: - * result.append(slice(None)) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ - __pyx_v_seen_ellipsis = 1; - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True - */ - goto __pyx_L7; - } +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); - /* "View.MemoryView":687 - * seen_ellipsis = True - * else: - * result.append(slice(None)) # <<<<<<<<<<<<<< - * have_slices = True - * else: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__18); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 687, __pyx_L1_error) - } - __pyx_L7:; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":688 - * else: - * result.append(slice(None)) - * have_slices = True # <<<<<<<<<<<<<< - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":993 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") */ - __pyx_v_have_slices = 1; + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 993, __pyx_L3_error) - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - goto __pyx_L6; } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":994 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") * */ - /*else*/ { - __pyx_t_2 = PySlice_Check(__pyx_v_item); - __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0); - __pyx_t_1 = __pyx_t_10; - __pyx_L9_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 994, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":691 - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): - * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":995 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * * - * have_slices = have_slices or isinstance(item, slice) */ - __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(2, 691, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 995, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 995, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - } + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } - /* "View.MemoryView":693 - * raise TypeError("Cannot index with type '%s'" % type(item)) - * - * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< - * result.append(item) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ - __pyx_t_10 = (__pyx_v_have_slices != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = PySlice_Check(__pyx_v_item); - __pyx_t_2 = (__pyx_t_10 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L11_bool_binop_done:; - __pyx_v_have_slices = __pyx_t_1; - /* "View.MemoryView":694 + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - * have_slices = have_slices or isinstance(item, slice) - * result.append(item) # <<<<<<<<<<<<<< * - * nslices = ndim - len(result) + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 694, __pyx_L1_error) - } - __pyx_L6:; - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: - */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_timedelta64_object", 0); - /* "View.MemoryView":696 - * result.append(item) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1010 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * * - * nslices = ndim - len(result) # <<<<<<<<<<<<<< - * if nslices: - * result.extend([slice(None)] * nslices) */ - __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 696, __pyx_L1_error) - __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; - /* "View.MemoryView":697 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) * + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ - __pyx_t_1 = (__pyx_v_nslices != 0); - if (__pyx_t_1) { - /* "View.MemoryView":698 - * nslices = ndim - len(result) - * if nslices: - * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< - * - * return have_slices or nslices, tuple(result) - */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__18); - __Pyx_GIVEREF(__pyx_slice__18); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__18); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":697 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) * + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` */ - } - /* "View.MemoryView":700 - * result.extend([slice(None)] * nslices) +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_datetime64_object", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1025 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< * - * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): */ - __Pyx_XDECREF(__pyx_r); - if (!__pyx_v_have_slices) { - } else { - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L14_bool_binop_done; - } - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_L14_bool_binop_done:; - __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject*)__pyx_t_11); - __pyx_t_11 = 0; + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); goto __pyx_L0; - /* "View.MemoryView":668 - * return isinstance(o, memoryview) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< * """ - * Replace all ellipses with full slices and fill incomplete indices with + * Cython equivalent of `isinstance(obj, np.datetime64)` */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tup); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_XDECREF(__pyx_v_item); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: + * + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object */ -static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; - /* "View.MemoryView":703 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1035 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") */ - __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); - for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { - __pyx_t_1 = __pyx_t_3; - __pyx_v_suboffset = (__pyx_t_1[0]); + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 + * * + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object */ - __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0); - if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 * * + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(2, 705, __pyx_L1_error) - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1042 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * * */ - } - } + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; - /* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":712 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. */ -static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { - int __pyx_v_new_ndim; - int __pyx_v_suboffset_dim; - int __pyx_v_dim; - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - __Pyx_memviewslice *__pyx_v_p_src; - struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; - __Pyx_memviewslice *__pyx_v_p_dst; - int *__pyx_v_p_suboffset_dim; - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - int __pyx_v_have_start; - int __pyx_v_have_stop; - int __pyx_v_have_step; - PyObject *__pyx_v_index = NULL; - struct __pyx_memoryview_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - struct __pyx_memoryview_obj *__pyx_t_4; - char *__pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memview_slice", 0); +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; - /* "View.MemoryView":713 - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): - * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< - * cdef bint negative_step - * cdef __Pyx_memviewslice src, dst + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1049 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< */ - __pyx_v_new_ndim = 0; - __pyx_v_suboffset_dim = -1; + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; - /* "View.MemoryView":720 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 * * - * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< - * - * cdef _memoryviewslice memviewsliceobj + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. */ - (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - /* "View.MemoryView":724 - * cdef _memoryviewslice memviewsliceobj - * - * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< - * - * if isinstance(memview, _memoryviewslice): - */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { - PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(2, 724, __pyx_L1_error) - } - } - #endif + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 +/* "newanalysis/helpers/diffusion.pyx":12 + * from libc.math cimport fabs, sqrt, floor, pow * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice + * def unfoldTraj(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< + * boxlength): + * """ */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - /* "View.MemoryView":727 - * - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview # <<<<<<<<<<<<<< - * p_src = &memviewsliceobj.from_slice - * else: - */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 727, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9diffusion_1unfoldTraj(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9diffusion_unfoldTraj, "\n unfoldTraj(xyz,boxlength)\n\n Arguments:\n xyz .. numpy array (float64, ndim=3) of the centers-of-mass of the whole trajectory [timestep, molecule, xyz]\n boxlength .. the box length\n\n Usage:\n This function unfolds a trajectory as a whole.\n\n Example: \n com = unfoldTraj(com, boxlength)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_1unfoldTraj = {"unfoldTraj", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9diffusion_1unfoldTraj, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_unfoldTraj}; +static PyObject *__pyx_pw_11newanalysis_9diffusion_1unfoldTraj(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_xyz = 0; + PyObject *__pyx_v_boxlength = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unfoldTraj (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 12, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_boxlength,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfoldTraj", 1, 2, 2, 1); __PYX_ERR(0, 12, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "unfoldTraj") < 0)) __PYX_ERR(0, 12, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_xyz = ((PyArrayObject *)values[0]); + __pyx_v_boxlength = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unfoldTraj", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 12, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.diffusion.unfoldTraj", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 12, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9diffusion_unfoldTraj(__pyx_self, __pyx_v_xyz, __pyx_v_boxlength); - /* "View.MemoryView":728 - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, &src) - */ - __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice - */ - goto __pyx_L3; +static PyObject *__pyx_pf_11newanalysis_9diffusion_unfoldTraj(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_boxlength) { + double __pyx_v_boxl; + double __pyx_v_b2; + int __pyx_v_n; + int __pyx_v_nframes; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + double __pyx_v_d; + PyArrayObject *__pyx_v_xyz_tmp = 0; + double *__pyx_v_data; + double *__pyx_v_data_tmp; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; + __Pyx_Buffer __pyx_pybuffer_xyz; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_tmp; + __Pyx_Buffer __pyx_pybuffer_xyz_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyArrayObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unfoldTraj", 0); + __pyx_pybuffer_xyz_tmp.pybuffer.buf = NULL; + __pyx_pybuffer_xyz_tmp.refcount = 0; + __pyx_pybuffernd_xyz_tmp.data = NULL; + __pyx_pybuffernd_xyz_tmp.rcbuffer = &__pyx_pybuffer_xyz_tmp; + __pyx_pybuffer_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_xyz.refcount = 0; + __pyx_pybuffernd_xyz.data = NULL; + __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 12, __pyx_L1_error) } + __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz.diminfo[2].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz.diminfo[2].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[2]; - /* "View.MemoryView":730 - * p_src = &memviewsliceobj.from_slice - * else: - * slice_copy(memview, &src) # <<<<<<<<<<<<<< - * p_src = &src - * + /* "newanalysis/helpers/diffusion.pyx":27 + * com = unfoldTraj(com, boxlength) + * """ + * cdef double boxl = boxlength # <<<<<<<<<<<<<< + * cdef double b2 = boxl/2.0 + * cdef int n = len(xyz[0]) */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_boxlength); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 27, __pyx_L1_error) + __pyx_v_boxl = __pyx_t_1; - /* "View.MemoryView":731 - * else: - * slice_copy(memview, &src) - * p_src = &src # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/diffusion.pyx":28 + * """ + * cdef double boxl = boxlength + * cdef double b2 = boxl/2.0 # <<<<<<<<<<<<<< + * cdef int n = len(xyz[0]) + * cdef int nframes = len(xyz) */ - __pyx_v_p_src = (&__pyx_v_src); - } - __pyx_L3:; + __pyx_v_b2 = (__pyx_v_boxl / 2.0); - /* "View.MemoryView":737 - * - * - * dst.memview = p_src.memview # <<<<<<<<<<<<<< - * dst.data = p_src.data - * + /* "newanalysis/helpers/diffusion.pyx":29 + * cdef double boxl = boxlength + * cdef double b2 = boxl/2.0 + * cdef int n = len(xyz[0]) # <<<<<<<<<<<<<< + * cdef int nframes = len(xyz) + * cdef int i, j, k */ - __pyx_t_4 = __pyx_v_p_src->memview; - __pyx_v_dst.memview = __pyx_t_4; + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n = __pyx_t_3; - /* "View.MemoryView":738 - * - * dst.memview = p_src.memview - * dst.data = p_src.data # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/diffusion.pyx":30 + * cdef double b2 = boxl/2.0 + * cdef int n = len(xyz[0]) + * cdef int nframes = len(xyz) # <<<<<<<<<<<<<< + * cdef int i, j, k + * cdef double d */ - __pyx_t_5 = __pyx_v_p_src->data; - __pyx_v_dst.data = __pyx_t_5; + __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_v_nframes = __pyx_t_3; - /* "View.MemoryView":743 - * - * - * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< - * cdef int *p_suboffset_dim = &suboffset_dim - * cdef Py_ssize_t start, stop, step + /* "newanalysis/helpers/diffusion.pyx":33 + * cdef int i, j, k + * cdef double d + * cdef np.ndarray[np.float64_t,ndim=2] xyz_tmp = np.copy(xyz[0]) # <<<<<<<<<<<<<< + * cdef double *data = xyz.data + * cdef double *data_tmp = xyz_tmp.data */ - __pyx_v_p_dst = (&__pyx_v_dst); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_xyz_tmp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 33, __pyx_L1_error) + } else {__pyx_pybuffernd_xyz_tmp.diminfo[0].strides = __pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_tmp.diminfo[0].shape = __pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_tmp.diminfo[1].strides = __pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_tmp.diminfo[1].shape = __pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_8 = 0; + __pyx_v_xyz_tmp = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":744 + /* "newanalysis/helpers/diffusion.pyx":34 + * cdef double d + * cdef np.ndarray[np.float64_t,ndim=2] xyz_tmp = np.copy(xyz[0]) + * cdef double *data = xyz.data # <<<<<<<<<<<<<< + * cdef double *data_tmp = xyz_tmp.data * - * cdef __Pyx_memviewslice *p_dst = &dst - * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< - * cdef Py_ssize_t start, stop, step - * cdef bint have_start, have_stop, have_step */ - __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 34, __pyx_L1_error) + __pyx_v_data = ((double *)__pyx_t_9); - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step + /* "newanalysis/helpers/diffusion.pyx":35 + * cdef np.ndarray[np.float64_t,ndim=2] xyz_tmp = np.copy(xyz[0]) + * cdef double *data = xyz.data + * cdef double *data_tmp = xyz_tmp.data # <<<<<<<<<<<<<< * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( + * for i in range(1,nframes): */ - __pyx_t_6 = 0; - if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 748, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } - } else { - __pyx_t_9 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_9)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 748, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_9); - } - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_v_dim = __pyx_t_6; - __pyx_t_6 = (__pyx_t_6 + 1); + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz_tmp)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_v_data_tmp = ((double *)__pyx_t_9); - /* "View.MemoryView":749 + /* "newanalysis/helpers/diffusion.pyx":37 + * cdef double *data_tmp = xyz_tmp.data * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * for i in range(1,nframes): # <<<<<<<<<<<<<< + * for j in range(n): + * for k in range(3): */ - __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0); - if (__pyx_t_2) { + __pyx_t_7 = __pyx_v_nframes; + __pyx_t_10 = __pyx_t_7; + for (__pyx_t_11 = 1; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; - /* "View.MemoryView":753 - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<< - * 0, 0, 0, # have_{start,stop,step} - * False) + /* "newanalysis/helpers/diffusion.pyx":38 + * + * for i in range(1,nframes): + * for j in range(n): # <<<<<<<<<<<<<< + * for k in range(3): + * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] */ - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 753, __pyx_L1_error) + __pyx_t_12 = __pyx_v_n; + __pyx_t_13 = __pyx_t_12; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_j = __pyx_t_14; - /* "View.MemoryView":750 - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + /* "newanalysis/helpers/diffusion.pyx":39 + * for i in range(1,nframes): + * for j in range(n): + * for k in range(3): # <<<<<<<<<<<<<< + * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] + * if d <= -b2: */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 750, __pyx_L1_error) + for (__pyx_t_15 = 0; __pyx_t_15 < 3; __pyx_t_15+=1) { + __pyx_v_k = __pyx_t_15; - /* "View.MemoryView":749 - * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + /* "newanalysis/helpers/diffusion.pyx":40 + * for j in range(n): + * for k in range(3): + * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] # <<<<<<<<<<<<<< + * if d <= -b2: + * d+=boxl */ - goto __pyx_L6; - } + __pyx_v_d = ((__pyx_v_data[((((__pyx_v_i * __pyx_v_n) * 3) + (__pyx_v_j * 3)) + __pyx_v_k)]) - (__pyx_v_data_tmp[((__pyx_v_j * 3) + __pyx_v_k)])); - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 + /* "newanalysis/helpers/diffusion.pyx":41 + * for k in range(3): + * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] + * if d <= -b2: # <<<<<<<<<<<<<< + * d+=boxl + * elif d > b2: */ - __pyx_t_2 = (__pyx_v_index == Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_t_16 = (__pyx_v_d <= (-__pyx_v_b2)); + if (__pyx_t_16) { - /* "View.MemoryView":757 - * False) - * elif index is None: - * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 + /* "newanalysis/helpers/diffusion.pyx":42 + * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] + * if d <= -b2: + * d+=boxl # <<<<<<<<<<<<<< + * elif d > b2: + * d-=boxl */ - (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + __pyx_v_d = (__pyx_v_d + __pyx_v_boxl); - /* "View.MemoryView":758 - * elif index is None: - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 + /* "newanalysis/helpers/diffusion.pyx":41 + * for k in range(3): + * d = data[i*n*3+j*3+k] - data_tmp[j*3+k] + * if d <= -b2: # <<<<<<<<<<<<<< + * d+=boxl + * elif d > b2: */ - (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + goto __pyx_L9; + } - /* "View.MemoryView":759 - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< - * new_ndim += 1 - * else: + /* "newanalysis/helpers/diffusion.pyx":43 + * if d <= -b2: + * d+=boxl + * elif d > b2: # <<<<<<<<<<<<<< + * d-=boxl + * data_tmp[j*3+k] = data[i*n*3+j*3+k] */ - (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + __pyx_t_16 = (__pyx_v_d > __pyx_v_b2); + if (__pyx_t_16) { - /* "View.MemoryView":760 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 # <<<<<<<<<<<<<< - * else: - * start = index.start or 0 + /* "newanalysis/helpers/diffusion.pyx":44 + * d+=boxl + * elif d > b2: + * d-=boxl # <<<<<<<<<<<<<< + * data_tmp[j*3+k] = data[i*n*3+j*3+k] + * data[i*n*3+j*3+k] = data[(i-1)*n*3+j*3+k] + d */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + __pyx_v_d = (__pyx_v_d - __pyx_v_boxl); - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 + /* "newanalysis/helpers/diffusion.pyx":43 + * if d <= -b2: + * d+=boxl + * elif d > b2: # <<<<<<<<<<<<<< + * d-=boxl + * data_tmp[j*3+k] = data[i*n*3+j*3+k] */ - goto __pyx_L6; - } + } + __pyx_L9:; - /* "View.MemoryView":762 - * new_ndim += 1 - * else: - * start = index.start or 0 # <<<<<<<<<<<<<< - * stop = index.stop or 0 - * step = index.step or 0 + /* "newanalysis/helpers/diffusion.pyx":45 + * elif d > b2: + * d-=boxl + * data_tmp[j*3+k] = data[i*n*3+j*3+k] # <<<<<<<<<<<<<< + * data[i*n*3+j*3+k] = data[(i-1)*n*3+j*3+k] + d + * */ - /*else*/ { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L7_bool_binop_done:; - __pyx_v_start = __pyx_t_10; + (__pyx_v_data_tmp[((__pyx_v_j * 3) + __pyx_v_k)]) = (__pyx_v_data[((((__pyx_v_i * __pyx_v_n) * 3) + (__pyx_v_j * 3)) + __pyx_v_k)]); - /* "View.MemoryView":763 - * else: - * start = index.start or 0 - * stop = index.stop or 0 # <<<<<<<<<<<<<< - * step = index.step or 0 + /* "newanalysis/helpers/diffusion.pyx":46 + * d-=boxl + * data_tmp[j*3+k] = data[i*n*3+j*3+k] + * data[i*n*3+j*3+k] = data[(i-1)*n*3+j*3+k] + d # <<<<<<<<<<<<<< * + * return xyz */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 763, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 763, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 763, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L9_bool_binop_done; + (__pyx_v_data[((((__pyx_v_i * __pyx_v_n) * 3) + (__pyx_v_j * 3)) + __pyx_v_k)]) = ((__pyx_v_data[(((((__pyx_v_i - 1) * __pyx_v_n) * 3) + (__pyx_v_j * 3)) + __pyx_v_k)]) + __pyx_v_d); } - __pyx_t_10 = 0; - __pyx_L9_bool_binop_done:; - __pyx_v_stop = __pyx_t_10; + } + } - /* "View.MemoryView":764 - * start = index.start or 0 - * stop = index.stop or 0 - * step = index.step or 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":48 + * data[i*n*3+j*3+k] = data[(i-1)*n*3+j*3+k] + d * - * have_start = index.start is not None + * return xyz # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 764, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 764, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L11_bool_binop_done:; - __pyx_v_step = __pyx_t_10; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_xyz); + __pyx_r = ((PyObject *)__pyx_v_xyz); + goto __pyx_L0; - /* "View.MemoryView":766 - * step = index.step or 0 + /* "newanalysis/helpers/diffusion.pyx":12 + * from libc.math cimport fabs, sqrt, floor, pow * - * have_start = index.start is not None # <<<<<<<<<<<<<< - * have_stop = index.stop is not None - * have_step = index.step is not None + * def unfoldTraj(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< + * boxlength): + * """ */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_start = __pyx_t_1; - /* "View.MemoryView":767 - * - * have_start = index.start is not None - * have_stop = index.stop is not None # <<<<<<<<<<<<<< - * have_step = index.step is not None - * - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 767, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_stop = __pyx_t_1; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.diffusion.unfoldTraj", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_tmp.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_xyz_tmp); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":768 - * have_start = index.start is not None - * have_stop = index.stop is not None - * have_step = index.step is not None # <<<<<<<<<<<<<< +/* "newanalysis/helpers/diffusion.pyx":50 + * return xyz * - * slice_memviewslice( + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None, vh_maxdist=200.0): */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_step = __pyx_t_1; - /* "View.MemoryView":770 - * have_step = index.step is not None - * - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 770, __pyx_L1_error) +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9diffusion_3msdCOMvHnG(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9diffusion_2msdCOMvHnG, "\n msdCOMvHnG(xyz, maxlen=None, vh_maxdist=200.0)\n\n This function calculates the single-particle mean square displacement, the van Hove function and the non-Gaussian parameter \n simultaneously.\n\n Args:\n xyz .. unfolded centers of mass of a whole trajectory, as yielded from unfoldTraj()\n maxlen .. maximum length of the sliding window\n vh_maxdist .. maximum distance to consider for the van Hove function\n\n Usage:\n msd, van_hove, non_gaussian = msdCOMvHnG(xyz)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_3msdCOMvHnG = {"msdCOMvHnG", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9diffusion_3msdCOMvHnG, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_2msdCOMvHnG}; +static PyObject *__pyx_pw_11newanalysis_9diffusion_3msdCOMvHnG(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_xyz = 0; + PyObject *__pyx_v_maxlen = 0; + PyObject *__pyx_v_vh_maxdist = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("msdCOMvHnG (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 50, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_maxlen,&__pyx_n_s_vh_maxdist,0}; - /* "View.MemoryView":776 - * have_start, have_stop, have_step, - * True) - * new_ndim += 1 # <<<<<<<<<<<<<< - * - * if isinstance(memview, _memoryviewslice): + /* "newanalysis/helpers/diffusion.pyx":52 + * @cython.boundscheck(False) + * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None, vh_maxdist=200.0): # <<<<<<<<<<<<<< + * """ + * msdCOMvHnG(xyz, maxlen=None, vh_maxdist=200.0) */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_float_200_0))); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_vh_maxdist); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "msdCOMvHnG") < 0)) __PYX_ERR(0, 50, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } - __pyx_L6:; - - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step - * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "View.MemoryView":778 - * new_ndim += 1 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":779 - * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - - /* "View.MemoryView":780 - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< - * memviewsliceobj.to_dtype_func, - * memview.dtype_is_object) - */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 780, __pyx_L1_error) } - - /* "View.MemoryView":781 - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * else: - */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 781, __pyx_L1_error) } - - /* "View.MemoryView":779 - * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, - */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 779, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 779, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "View.MemoryView":778 - * new_ndim += 1 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - */ + __pyx_v_xyz = ((PyArrayObject *)values[0]); + __pyx_v_maxlen = values[1]; + __pyx_v_vh_maxdist = values[2]; } - - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * - */ - /*else*/ { - __Pyx_XDECREF(((PyObject *)__pyx_r)); - - /* "View.MemoryView":785 - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, - * memview.dtype_is_object) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * - */ - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 784, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("msdCOMvHnG", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 50, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_AddTraceback("newanalysis.diffusion.msdCOMvHnG", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9diffusion_2msdCOMvHnG(__pyx_self, __pyx_v_xyz, __pyx_v_maxlen, __pyx_v_vh_maxdist); - /* "View.MemoryView":712 + /* "newanalysis/helpers/diffusion.pyx":50 + * return xyz * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None, vh_maxdist=200.0): */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF((PyObject *)__pyx_r); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":809 - * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, - */ - -static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { - Py_ssize_t __pyx_v_new_shape; - int __pyx_v_negative_step; - int __pyx_r; - int __pyx_t_1; +static PyObject *__pyx_pf_11newanalysis_9diffusion_2msdCOMvHnG(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_vh_maxdist) { + double __pyx_v_result; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_res2; + int __pyx_v_n1; + int __pyx_v_n2; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_m; + int __pyx_v_pos; + int __pyx_v_idx1; + int __pyx_v_idx2; + int __pyx_v_vhmax; + PyArrayObject *__pyx_v_msd = 0; + double *__pyx_v_msd_data; + double *__pyx_v_data; + PyArrayObject *__pyx_v_van_hove = 0; + double *__pyx_v_vh; + PyArrayObject *__pyx_v_non_gaussian = 0; + double *__pyx_v_ng; + PyArrayObject *__pyx_v_ctr = 0; + int *__pyx_v_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_msd; + __Pyx_Buffer __pyx_pybuffer_msd; + __Pyx_LocalBuf_ND __pyx_pybuffernd_non_gaussian; + __Pyx_Buffer __pyx_pybuffer_non_gaussian; + __Pyx_LocalBuf_ND __pyx_pybuffernd_van_hove; + __Pyx_Buffer __pyx_pybuffer_van_hove; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; + __Pyx_Buffer __pyx_pybuffer_xyz; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - int __pyx_t_3; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + PyArrayObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + double __pyx_t_25; + double __pyx_t_26; + __pyx_t_5numpy_float64_t __pyx_t_27; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("msdCOMvHnG", 0); + __pyx_pybuffer_msd.pybuffer.buf = NULL; + __pyx_pybuffer_msd.refcount = 0; + __pyx_pybuffernd_msd.data = NULL; + __pyx_pybuffernd_msd.rcbuffer = &__pyx_pybuffer_msd; + __pyx_pybuffer_van_hove.pybuffer.buf = NULL; + __pyx_pybuffer_van_hove.refcount = 0; + __pyx_pybuffernd_van_hove.data = NULL; + __pyx_pybuffernd_van_hove.rcbuffer = &__pyx_pybuffer_van_hove; + __pyx_pybuffer_non_gaussian.pybuffer.buf = NULL; + __pyx_pybuffer_non_gaussian.refcount = 0; + __pyx_pybuffernd_non_gaussian.data = NULL; + __pyx_pybuffernd_non_gaussian.rcbuffer = &__pyx_pybuffer_non_gaussian; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_xyz.refcount = 0; + __pyx_pybuffernd_xyz.data = NULL; + __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 50, __pyx_L1_error) + } + __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz.diminfo[2].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz.diminfo[2].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[2]; - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":68 + * """ + * cdef double tmp, result, dx, dy, dz, res2 + * cdef int n1, n2, i, j, k, m, pos, idx1, idx2, vhmax = vh_maxdist*10 # <<<<<<<<<<<<<< * - * if start < 0: + * n1 = len(xyz) */ - __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyInt_MultiplyObjC(__pyx_v_vh_maxdist, __pyx_int_10, 10, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_vhmax = __pyx_t_2; - /* "View.MemoryView":831 - * if not is_slice: + /* "newanalysis/helpers/diffusion.pyx":70 + * cdef int n1, n2, i, j, k, m, pos, idx1, idx2, vhmax = vh_maxdist*10 * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: - */ - __pyx_t_1 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":832 + * n1 = len(xyz) # <<<<<<<<<<<<<< + * n2 = len(xyz[0]) * - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_v_n1 = __pyx_t_3; - /* "View.MemoryView":831 - * if not is_slice: + /* "newanalysis/helpers/diffusion.pyx":71 * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: + * n1 = len(xyz) + * n2 = len(xyz[0]) # <<<<<<<<<<<<<< + * + * if maxlen == None: */ - } + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_n2 = __pyx_t_3; - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) + /* "newanalysis/helpers/diffusion.pyx":73 + * n2 = len(xyz[0]) + * + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 * else: */ - __pyx_t_1 = (0 <= __pyx_v_start); - if (__pyx_t_1) { - __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); - } - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_1 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { - /* "View.MemoryView":834 - * start += shape - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< - * else: + /* "newanalysis/helpers/diffusion.pyx":74 * - */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 834, __pyx_L1_error) - - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) + * if maxlen == None: + * m = n1 # <<<<<<<<<<<<<< * else: + * m = maxlen */ - } + __pyx_v_m = __pyx_v_n1; - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":73 + * n2 = len(xyz[0]) * - * if start < 0: + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ goto __pyx_L3; } - /* "View.MemoryView":837 + /* "newanalysis/helpers/diffusion.pyx":76 + * m = n1 * else: + * m = maxlen # <<<<<<<<<<<<<< * - * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< - * - * if have_step and step == 0: + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) */ /*else*/ { - __pyx_t_1 = ((__pyx_v_have_step != 0) != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_1 = ((__pyx_v_step < 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L6_bool_binop_done:; - __pyx_v_negative_step = __pyx_t_2; + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 76, __pyx_L1_error) + __pyx_v_m = ((int)__pyx_t_2); + } + __pyx_L3:; - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 + /* "newanalysis/helpers/diffusion.pyx":78 + * m = maxlen * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double* msd_data = msd.data * */ - __pyx_t_1 = (__pyx_v_have_step != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L9_bool_binop_done; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_msd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 78, __pyx_L1_error) + } else {__pyx_pybuffernd_msd.diminfo[0].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msd.diminfo[0].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[0]; } - __pyx_t_1 = ((__pyx_v_step == 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L9_bool_binop_done:; - if (__pyx_t_2) { + } + __pyx_t_9 = 0; + __pyx_v_msd = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; - /* "View.MemoryView":840 - * - * if have_step and step == 0: - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":79 * + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) + * cdef double* msd_data = msd.data # <<<<<<<<<<<<<< * + * cdef double *data = xyz.data */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 840, __pyx_L1_error) + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_msd)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_v_msd_data = ((double *)__pyx_t_10); - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 + /* "newanalysis/helpers/diffusion.pyx":81 + * cdef double* msd_data = msd.data * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + * cdef double *data = xyz.data # <<<<<<<<<<<<<< * + * cdef np.ndarray[np.float64_t,ndim=2] van_hove = np.zeros((m,vhmax),dtype=np.float64) */ - } + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_v_data = ((double *)__pyx_t_10); - /* "View.MemoryView":843 - * + /* "newanalysis/helpers/diffusion.pyx":83 + * cdef double *data = xyz.data * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape - */ - __pyx_t_2 = (__pyx_v_have_start != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":844 + * cdef np.ndarray[np.float64_t,ndim=2] van_hove = np.zeros((m,vhmax),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *vh = van_hove.data * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":845 - * if have_start: - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if start < 0: - * start = 0 - */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_vhmax); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_11 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_van_hove.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_van_hove = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_van_hove.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 83, __pyx_L1_error) + } else {__pyx_pybuffernd_van_hove.diminfo[0].strides = __pyx_pybuffernd_van_hove.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_van_hove.diminfo[0].shape = __pyx_pybuffernd_van_hove.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_van_hove.diminfo[1].strides = __pyx_pybuffernd_van_hove.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_van_hove.diminfo[1].shape = __pyx_pybuffernd_van_hove.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_11 = 0; + __pyx_v_van_hove = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "newanalysis/helpers/diffusion.pyx":84 + * + * cdef np.ndarray[np.float64_t,ndim=2] van_hove = np.zeros((m,vhmax),dtype=np.float64) + * cdef double *vh = van_hove.data # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.float64_t,ndim=1] non_gaussian = np.zeros(m,dtype=np.float64) */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_van_hove)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_v_vh = ((double *)__pyx_t_10); - /* "View.MemoryView":847 - * start += shape - * if start < 0: - * start = 0 # <<<<<<<<<<<<<< - * elif start >= shape: - * if negative_step: + /* "newanalysis/helpers/diffusion.pyx":86 + * cdef double *vh = van_hove.data + * + * cdef np.ndarray[np.float64_t,ndim=1] non_gaussian = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *ng = non_gaussian.data + * */ - __pyx_v_start = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_non_gaussian = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 86, __pyx_L1_error) + } else {__pyx_pybuffernd_non_gaussian.diminfo[0].strides = __pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_non_gaussian.diminfo[0].shape = __pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_12 = 0; + __pyx_v_non_gaussian = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "newanalysis/helpers/diffusion.pyx":87 + * + * cdef np.ndarray[np.float64_t,ndim=1] non_gaussian = np.zeros(m,dtype=np.float64) + * cdef double *ng = non_gaussian.data # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) */ - } + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_non_gaussian)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_v_ng = ((double *)__pyx_t_10); - /* "View.MemoryView":844 + /* "newanalysis/helpers/diffusion.pyx":89 + * cdef double *ng = non_gaussian.data + * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< + * cdef int *c = ctr.data * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: */ - goto __pyx_L12; - } + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8)) __PYX_ERR(0, 89, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_1); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 89, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_13 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 + /* "newanalysis/helpers/diffusion.pyx":90 + * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * cdef int *c = ctr.data # <<<<<<<<<<<<<< + * + * # loop over all delta t */ - __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0); - if (__pyx_t_2) { + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_v_c = ((int *)__pyx_t_10); - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/diffusion.pyx":93 + * + * # loop over all delta t + * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< + * # loop over all possible interval start points + * for j in range(n1-i): */ - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_2 = __pyx_v_m; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_15 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_15 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_4) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_idx1) lastprivate(__pyx_v_idx2) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_pos) lastprivate(__pyx_v_res2) lastprivate(__pyx_v_result) + #endif /* _OPENMP */ + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_14); + /* Initialize private variables to invalid values */ + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_idx1 = ((int)0xbad0bad0); + __pyx_v_idx2 = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); + __pyx_v_pos = ((int)0xbad0bad0); + __pyx_v_res2 = ((double)__PYX_NAN()); + __pyx_v_result = ((double)__PYX_NAN()); - /* "View.MemoryView":850 - * elif start >= shape: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = shape + /* "newanalysis/helpers/diffusion.pyx":95 + * for i in prange(m,nogil=True,schedule=guided): + * # loop over all possible interval start points + * for j in range(n1-i): # <<<<<<<<<<<<<< + * # loop over residues + * for k in range(n2): */ - __pyx_v_start = (__pyx_v_shape - 1); + __pyx_t_16 = (__pyx_v_n1 - __pyx_v_i); + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_j = __pyx_t_18; - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/diffusion.pyx":97 + * for j in range(n1-i): + * # loop over residues + * for k in range(n2): # <<<<<<<<<<<<<< + * idx1 = j*n2*3+3*k + * idx2 = (j+i)*n2*3+3*k */ - goto __pyx_L14; - } + __pyx_t_19 = __pyx_v_n2; + __pyx_t_20 = __pyx_t_19; + for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { + __pyx_v_k = __pyx_t_21; - /* "View.MemoryView":852 - * start = shape - 1 - * else: - * start = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: + /* "newanalysis/helpers/diffusion.pyx":98 + * # loop over residues + * for k in range(n2): + * idx1 = j*n2*3+3*k # <<<<<<<<<<<<<< + * idx2 = (j+i)*n2*3+3*k + * dx = data[idx1] - data[idx2] */ - /*else*/ { - __pyx_v_start = __pyx_v_shape; - } - __pyx_L14:; + __pyx_v_idx1 = (((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k)); - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 + /* "newanalysis/helpers/diffusion.pyx":99 + * for k in range(n2): + * idx1 = j*n2*3+3*k + * idx2 = (j+i)*n2*3+3*k # <<<<<<<<<<<<<< + * dx = data[idx1] - data[idx2] + * dy = data[idx1+1] - data[idx2+1] */ - } - __pyx_L12:; + __pyx_v_idx2 = ((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k)); - /* "View.MemoryView":843 - * - * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape + /* "newanalysis/helpers/diffusion.pyx":100 + * idx1 = j*n2*3+3*k + * idx2 = (j+i)*n2*3+3*k + * dx = data[idx1] - data[idx2] # <<<<<<<<<<<<<< + * dy = data[idx1+1] - data[idx2+1] + * dz = data[idx1+2] - data[idx2+2] */ - goto __pyx_L11; - } + __pyx_v_dx = ((__pyx_v_data[__pyx_v_idx1]) - (__pyx_v_data[__pyx_v_idx2])); - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/diffusion.pyx":101 + * idx2 = (j+i)*n2*3+3*k + * dx = data[idx1] - data[idx2] + * dy = data[idx1+1] - data[idx2+1] # <<<<<<<<<<<<<< + * dz = data[idx1+2] - data[idx2+2] + * result = dx*dx+dy*dy+dz*dz */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + __pyx_v_dy = ((__pyx_v_data[(__pyx_v_idx1 + 1)]) - (__pyx_v_data[(__pyx_v_idx2 + 1)])); - /* "View.MemoryView":855 - * else: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = 0 + /* "newanalysis/helpers/diffusion.pyx":102 + * dx = data[idx1] - data[idx2] + * dy = data[idx1+1] - data[idx2+1] + * dz = data[idx1+2] - data[idx2+2] # <<<<<<<<<<<<<< + * result = dx*dx+dy*dy+dz*dz + * res2 = result*result */ - __pyx_v_start = (__pyx_v_shape - 1); + __pyx_v_dz = ((__pyx_v_data[(__pyx_v_idx1 + 2)]) - (__pyx_v_data[(__pyx_v_idx2 + 2)])); - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/diffusion.pyx":103 + * dy = data[idx1+1] - data[idx2+1] + * dz = data[idx1+2] - data[idx2+2] + * result = dx*dx+dy*dy+dz*dz # <<<<<<<<<<<<<< + * res2 = result*result + * pos= floor(sqrt(result)*10.0) */ - goto __pyx_L15; - } + __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); - /* "View.MemoryView":857 - * start = shape - 1 - * else: - * start = 0 # <<<<<<<<<<<<<< - * - * if have_stop: + /* "newanalysis/helpers/diffusion.pyx":104 + * dz = data[idx1+2] - data[idx2+2] + * result = dx*dx+dy*dy+dz*dz + * res2 = result*result # <<<<<<<<<<<<<< + * pos= floor(sqrt(result)*10.0) + * if pos floor(sqrt(result)*10.0) # <<<<<<<<<<<<<< + * if pos floor(sqrt(result)*10.0) + * if pos floor(sqrt(result)*10.0) + * if pos shape: + /* "newanalysis/helpers/diffusion.pyx":106 + * res2 = result*result + * pos= floor(sqrt(result)*10.0) + * if pos shape: - * stop = shape + /* "newanalysis/helpers/diffusion.pyx":108 + * if pos shape: + /* "newanalysis/helpers/diffusion.pyx":109 + * vh[i*vhmax+pos]+=1 + * msd_data[i]+=result + * ng[i]+=res2 # <<<<<<<<<<<<<< + * c[i]+=1 + * + */ + __pyx_t_22 = __pyx_v_i; + (__pyx_v_ng[__pyx_t_22]) = ((__pyx_v_ng[__pyx_t_22]) + __pyx_v_res2); + + /* "newanalysis/helpers/diffusion.pyx":110 + * msd_data[i]+=result + * ng[i]+=res2 + * c[i]+=1 # <<<<<<<<<<<<<< + * + * for i in range(m): */ + __pyx_t_22 = __pyx_v_i; + (__pyx_v_c[__pyx_t_22]) = ((__pyx_v_c[__pyx_t_22]) + 1); + } + } + } + } + } + } } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":860 + /* "newanalysis/helpers/diffusion.pyx":93 * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: + * # loop over all delta t + * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< + * # loop over all possible interval start points + * for j in range(n1-i): */ - goto __pyx_L17; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; } + } - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: + /* "newanalysis/helpers/diffusion.pyx":112 + * c[i]+=1 + * + * for i in range(m): # <<<<<<<<<<<<<< + * msd[i] /= ctr[i] + * van_hove[i] /= ctr[i] */ - __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0); - if (__pyx_t_2) { + __pyx_t_15 = __pyx_v_m; + __pyx_t_14 = __pyx_t_15; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_14; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":865 - * stop = 0 - * elif stop > shape: - * stop = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: + /* "newanalysis/helpers/diffusion.pyx":113 + * + * for i in range(m): + * msd[i] /= ctr[i] # <<<<<<<<<<<<<< + * van_hove[i] /= ctr[i] + * if floor(msd[i]) != 0: */ - __pyx_v_stop = __pyx_v_shape; + __pyx_t_23 = __pyx_v_i; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_ctr.diminfo[0].shape; + __pyx_t_24 = __pyx_v_i; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_msd.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_msd.diminfo[0].strides) /= ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_ctr.diminfo[0].strides))); - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: + /* "newanalysis/helpers/diffusion.pyx":114 + * for i in range(m): + * msd[i] /= ctr[i] + * van_hove[i] /= ctr[i] # <<<<<<<<<<<<<< + * if floor(msd[i]) != 0: + * ng[i] = 0.6 * (ng[i]/ctr[i]) / (msd[i]*msd[i]) - 1.0 */ - } - __pyx_L17:; + __pyx_t_16 = __pyx_v_i; + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_van_hove), __pyx_t_16, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_23 = __pyx_v_i; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_ctr.diminfo[0].shape; + __pyx_t_8 = PyFloat_FromDouble(((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_ctr.diminfo[0].strides)))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_van_hove), __pyx_t_16, __pyx_t_6, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0))) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "View.MemoryView":859 - * start = 0 + /* "newanalysis/helpers/diffusion.pyx":115 + * msd[i] /= ctr[i] + * van_hove[i] /= ctr[i] + * if floor(msd[i]) != 0: # <<<<<<<<<<<<<< + * ng[i] = 0.6 * (ng[i]/ctr[i]) / (msd[i]*msd[i]) - 1.0 * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape */ - goto __pyx_L16; - } + __pyx_t_23 = __pyx_v_i; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_msd.diminfo[0].shape; + __pyx_t_4 = (floor((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_msd.diminfo[0].strides))) != 0.0); + if (__pyx_t_4) { - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":868 - * else: - * if negative_step: - * stop = -1 # <<<<<<<<<<<<<< - * else: - * stop = shape - */ - __pyx_v_stop = -1L; - - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - goto __pyx_L19; - } - - /* "View.MemoryView":870 - * stop = -1 - * else: - * stop = shape # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":116 + * van_hove[i] /= ctr[i] + * if floor(msd[i]) != 0: + * ng[i] = 0.6 * (ng[i]/ctr[i]) / (msd[i]*msd[i]) - 1.0 # <<<<<<<<<<<<<< * - * if not have_step: + * return msd, van_hove, non_gaussian */ - /*else*/ { - __pyx_v_stop = __pyx_v_shape; + __pyx_t_23 = __pyx_v_i; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_ctr.diminfo[0].shape; + __pyx_t_25 = ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_ctr.diminfo[0].strides))); + if (unlikely(__pyx_t_25 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 116, __pyx_L1_error) } - __pyx_L19:; - } - __pyx_L16:; - - /* "View.MemoryView":872 - * stop = shape - * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 - * - */ - __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":873 - * - * if not have_step: - * step = 1 # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_step = 1; + __pyx_t_26 = (0.6 * ((__pyx_v_ng[__pyx_v_i]) / __pyx_t_25)); + __pyx_t_23 = __pyx_v_i; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_msd.diminfo[0].shape; + __pyx_t_24 = __pyx_v_i; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_msd.diminfo[0].shape; + __pyx_t_27 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_msd.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_msd.diminfo[0].strides))); + if (unlikely(__pyx_t_27 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 116, __pyx_L1_error) + } + (__pyx_v_ng[__pyx_v_i]) = ((((__pyx_t_5numpy_float64_t)__pyx_t_26) / __pyx_t_27) - 1.0); - /* "View.MemoryView":872 - * stop = shape - * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 + /* "newanalysis/helpers/diffusion.pyx":115 + * msd[i] /= ctr[i] + * van_hove[i] /= ctr[i] + * if floor(msd[i]) != 0: # <<<<<<<<<<<<<< + * ng[i] = 0.6 * (ng[i]/ctr[i]) / (msd[i]*msd[i]) - 1.0 * */ } + } - /* "View.MemoryView":877 - * - * with cython.cdivision(True): - * new_shape = (stop - start) // step # <<<<<<<<<<<<<< - * - * if (stop - start) - step * new_shape: - */ - __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - - /* "View.MemoryView":879 - * new_shape = (stop - start) // step + /* "newanalysis/helpers/diffusion.pyx":118 + * ng[i] = 0.6 * (ng[i]/ctr[i]) / (msd[i]*msd[i]) - 1.0 * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 + * return msd, van_hove, non_gaussian # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); - if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF((PyObject *)__pyx_v_msd); + __Pyx_GIVEREF((PyObject *)__pyx_v_msd); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_msd))) __PYX_ERR(0, 118, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_van_hove); + __Pyx_GIVEREF((PyObject *)__pyx_v_van_hove); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_van_hove))) __PYX_ERR(0, 118, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_non_gaussian); + __Pyx_GIVEREF((PyObject *)__pyx_v_non_gaussian); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_v_non_gaussian))) __PYX_ERR(0, 118, __pyx_L1_error); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "View.MemoryView":880 - * - * if (stop - start) - step * new_shape: - * new_shape += 1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":50 + * return xyz * - * if new_shape < 0: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None, vh_maxdist=200.0): */ - __pyx_v_new_shape = (__pyx_v_new_shape + 1); - /* "View.MemoryView":879 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 - * - */ - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_van_hove.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.diffusion.msdCOMvHnG", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_non_gaussian.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_van_hove.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_msd); + __Pyx_XDECREF((PyObject *)__pyx_v_van_hove); + __Pyx_XDECREF((PyObject *)__pyx_v_non_gaussian); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":882 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 +/* "newanalysis/helpers/diffusion.pyx":120 + * return msd, van_hove, non_gaussian * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None): */ - __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":883 - * - * if new_shape < 0: - * new_shape = 0 # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_new_shape = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9diffusion_5msdCOM(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9diffusion_4msdCOM, "\n msdCOM(xyz, maxlen=None)\n\n This function takes as input a three-dimensional coordinate array of the molecular centers of mass of a whole unfolded trajectory \n [timestep, molecule, xyz]. The optional parameter maxlen can be set to limit the length of the resulting MSD. This can be useful\n when dealing with very long trajectories, e.g. maxlen=n/2.\n\n Usage:\n msd = msdCOM(xyz)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_5msdCOM = {"msdCOM", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9diffusion_5msdCOM, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_4msdCOM}; +static PyObject *__pyx_pw_11newanalysis_9diffusion_5msdCOM(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_xyz = 0; + PyObject *__pyx_v_maxlen = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("msdCOM (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 120, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_maxlen,0}; - /* "View.MemoryView":882 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 - * + /* "newanalysis/helpers/diffusion.pyx":122 + * @cython.boundscheck(False) + * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None): # <<<<<<<<<<<<<< + * """ + * msdCOM(xyz, maxlen=None) */ + values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "msdCOM") < 0)) __PYX_ERR(0, 120, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } + __pyx_v_xyz = ((PyArrayObject *)values[0]); + __pyx_v_maxlen = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("msdCOM", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 120, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.diffusion.msdCOM", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9diffusion_4msdCOM(__pyx_self, __pyx_v_xyz, __pyx_v_maxlen); - /* "View.MemoryView":886 - * - * - * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset - */ - (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - - /* "View.MemoryView":887 - * - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< - * dst.suboffsets[new_ndim] = suboffset + /* "newanalysis/helpers/diffusion.pyx":120 + * return msd, van_hove, non_gaussian * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None): */ - (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - /* "View.MemoryView":888 - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< - * - * - */ - (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_L3:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":891 - * - * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: - */ - __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0); - if (__pyx_t_2) { +static PyObject *__pyx_pf_11newanalysis_9diffusion_4msdCOM(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_maxlen) { + double __pyx_v_result; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + int __pyx_v_n1; + int __pyx_v_n2; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_m; + PyArrayObject *__pyx_v_msd = 0; + double *__pyx_v_msd_data; + double *__pyx_v_data; + PyArrayObject *__pyx_v_ctr = 0; + int *__pyx_v_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_msd; + __Pyx_Buffer __pyx_pybuffer_msd; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; + __Pyx_Buffer __pyx_pybuffer_xyz; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + PyArrayObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("msdCOM", 0); + __pyx_pybuffer_msd.pybuffer.buf = NULL; + __pyx_pybuffer_msd.refcount = 0; + __pyx_pybuffernd_msd.data = NULL; + __pyx_pybuffernd_msd.rcbuffer = &__pyx_pybuffer_msd; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_xyz.refcount = 0; + __pyx_pybuffernd_xyz.data = NULL; + __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 120, __pyx_L1_error) + } + __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz.diminfo[2].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz.diminfo[2].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[2]; - /* "View.MemoryView":892 + /* "newanalysis/helpers/diffusion.pyx":136 + * cdef int n1, n2, i, j, k, m, pos + * + * n1 = len(xyz) # <<<<<<<<<<<<<< + * n2 = len(xyz[0]) * - * if suboffset_dim[0] < 0: - * dst.data += start * stride # <<<<<<<<<<<<<< - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride */ - __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_v_n1 = __pyx_t_1; - /* "View.MemoryView":891 + /* "newanalysis/helpers/diffusion.pyx":137 * + * n1 = len(xyz) + * n2 = len(xyz[0]) # <<<<<<<<<<<<<< * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: + * if maxlen == None: */ - goto __pyx_L23; - } + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n2 = __pyx_t_1; - /* "View.MemoryView":894 - * dst.data += start * stride - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":139 + * n2 = len(xyz[0]) * - * if suboffset >= 0: + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ - /*else*/ { - __pyx_t_3 = (__pyx_v_suboffset_dim[0]); - (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); - } - __pyx_L23:; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride + /* "newanalysis/helpers/diffusion.pyx":140 * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: + * if maxlen == None: + * m = n1 # <<<<<<<<<<<<<< + * else: + * m = maxlen */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { + __pyx_v_m = __pyx_v_n1; - /* "View.MemoryView":897 + /* "newanalysis/helpers/diffusion.pyx":139 + * n2 = len(xyz[0]) * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset - */ - __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: - */ - __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":899 - * if not is_slice: - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - */ - __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); - - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: - */ - goto __pyx_L26; - } - - /* "View.MemoryView":901 - * dst.data = ( dst.data)[0] + suboffset - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< - * "must be indexed and not sliced", dim) - * else: - */ - /*else*/ { - - /* "View.MemoryView":902 - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< - * else: - * suboffset_dim[0] = new_ndim + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 901, __pyx_L1_error) - } - __pyx_L26:; + goto __pyx_L3; + } - /* "View.MemoryView":897 + /* "newanalysis/helpers/diffusion.pyx":142 + * m = n1 + * else: + * m = maxlen # <<<<<<<<<<<<<< * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) */ - goto __pyx_L25; - } + /*else*/ { + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_v_m = ((int)__pyx_t_4); + } + __pyx_L3:; - /* "View.MemoryView":904 - * "must be indexed and not sliced", dim) - * else: - * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":144 + * m = maxlen + * + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double* msd_data = msd.data * - * return 0 */ - /*else*/ { - (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_msd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 144, __pyx_L1_error) + } else {__pyx_pybuffernd_msd.diminfo[0].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msd.diminfo[0].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[0]; } - __pyx_L25:; + } + __pyx_t_9 = 0; + __pyx_v_msd = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride + /* "newanalysis/helpers/diffusion.pyx":145 * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) + * cdef double* msd_data = msd.data # <<<<<<<<<<<<<< + * + * cdef double *data = xyz.data */ - } + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_msd)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_v_msd_data = ((double *)__pyx_t_10); - /* "View.MemoryView":906 - * suboffset_dim[0] = new_ndim - * - * return 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":147 + * cdef double* msd_data = msd.data * + * cdef double *data = xyz.data # <<<<<<<<<<<<<< * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_v_data = ((double *)__pyx_t_10); - /* "View.MemoryView":809 + /* "newanalysis/helpers/diffusion.pyx":149 + * cdef double *data = xyz.data + * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< + * cdef int *c = ctr.data * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ - - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_11 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 149, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; + } } - __pyx_r = -1; - __pyx_L0:; - return __pyx_r; -} + __pyx_t_11 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; -/* "View.MemoryView":912 + /* "newanalysis/helpers/diffusion.pyx":150 * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - */ - -static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_suboffset; - Py_ssize_t __pyx_v_itemsize; - char *__pyx_v_resultp; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pybuffer_index", 0); - - /* "View.MemoryView":914 - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< - * cdef Py_ssize_t itemsize = view.itemsize - * cdef char *resultp + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * cdef int *c = ctr.data # <<<<<<<<<<<<<< + * + * # loop over all delta t */ - __pyx_v_suboffset = -1L; + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_v_c = ((int *)__pyx_t_10); - /* "View.MemoryView":915 - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< - * cdef char *resultp + /* "newanalysis/helpers/diffusion.pyx":153 * + * # loop over all delta t + * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< + * # loop over all possible interval start points + * for j in range(n1-i): */ - __pyx_t_1 = __pyx_v_view->itemsize; - __pyx_v_itemsize = __pyx_t_1; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_m; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_13 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_13 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_result) + #endif /* _OPENMP */ + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_12); + /* Initialize private variables to invalid values */ + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); + __pyx_v_result = ((double)__PYX_NAN()); - /* "View.MemoryView":918 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + /* "newanalysis/helpers/diffusion.pyx":155 + * for i in prange(m,nogil=True,schedule=guided): + * # loop over all possible interval start points + * for j in range(n1-i): # <<<<<<<<<<<<<< + * # loop over residues + * for k in range(n2): */ - __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0); - if (__pyx_t_2) { + __pyx_t_14 = (__pyx_v_n1 - __pyx_v_i); + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_j = __pyx_t_16; - /* "View.MemoryView":919 - * - * if view.ndim == 0: - * shape = view.len / itemsize # <<<<<<<<<<<<<< - * stride = itemsize - * else: + /* "newanalysis/helpers/diffusion.pyx":157 + * for j in range(n1-i): + * # loop over residues + * for k in range(n2): # <<<<<<<<<<<<<< + * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] + * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); + __pyx_t_17 = __pyx_v_n2; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_k = __pyx_t_19; - /* "View.MemoryView":920 - * if view.ndim == 0: - * shape = view.len / itemsize - * stride = itemsize # <<<<<<<<<<<<<< - * else: - * shape = view.shape[dim] + /* "newanalysis/helpers/diffusion.pyx":158 + * # loop over residues + * for k in range(n2): + * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] # <<<<<<<<<<<<<< + * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] + * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] */ - __pyx_v_stride = __pyx_v_itemsize; + __pyx_v_dx = ((__pyx_v_data[(((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k))]) - (__pyx_v_data[((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k))])); - /* "View.MemoryView":918 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + /* "newanalysis/helpers/diffusion.pyx":159 + * for k in range(n2): + * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] + * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] # <<<<<<<<<<<<<< + * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] + * result = dx*dx+dy*dy+dz*dz */ - goto __pyx_L3; - } + __pyx_v_dy = ((__pyx_v_data[((((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 1)]) - (__pyx_v_data[(((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 1)])); - /* "View.MemoryView":922 - * stride = itemsize - * else: - * shape = view.shape[dim] # <<<<<<<<<<<<<< - * stride = view.strides[dim] - * if view.suboffsets != NULL: + /* "newanalysis/helpers/diffusion.pyx":160 + * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] + * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] + * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] # <<<<<<<<<<<<<< + * result = dx*dx+dy*dy+dz*dz + * msd_data[i] += result */ - /*else*/ { - __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + __pyx_v_dz = ((__pyx_v_data[((((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 2)]) - (__pyx_v_data[(((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 2)])); - /* "View.MemoryView":923 - * else: - * shape = view.shape[dim] - * stride = view.strides[dim] # <<<<<<<<<<<<<< - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] + /* "newanalysis/helpers/diffusion.pyx":161 + * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] + * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] + * result = dx*dx+dy*dy+dz*dz # <<<<<<<<<<<<<< + * msd_data[i] += result + * c[i]+=1 */ - __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] + /* "newanalysis/helpers/diffusion.pyx":162 + * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] + * result = dx*dx+dy*dy+dz*dz + * msd_data[i] += result # <<<<<<<<<<<<<< + * c[i]+=1 * */ - __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0); - if (__pyx_t_2) { + __pyx_t_20 = __pyx_v_i; + (__pyx_v_msd_data[__pyx_t_20]) = ((__pyx_v_msd_data[__pyx_t_20]) + __pyx_v_result); - /* "View.MemoryView":925 - * stride = view.strides[dim] - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":163 + * result = dx*dx+dy*dy+dz*dz + * msd_data[i] += result + * c[i]+=1 # <<<<<<<<<<<<<< * - * if index < 0: + * for i in range(m): */ - __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + __pyx_t_20 = __pyx_v_i; + (__pyx_v_c[__pyx_t_20]) = ((__pyx_v_c[__pyx_t_20]) + 1); + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] + /* "newanalysis/helpers/diffusion.pyx":153 * + * # loop over all delta t + * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< + * # loop over all possible interval start points + * for j in range(n1-i): */ - } + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } } - __pyx_L3:; - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] + /* "newanalysis/helpers/diffusion.pyx":165 + * c[i]+=1 * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: - */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":928 + * for i in range(m): # <<<<<<<<<<<<<< + * msd[i] /= ctr[i] * - * if index < 0: - * index += view.shape[dim] # <<<<<<<<<<<<<< - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) */ - __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + __pyx_t_13 = __pyx_v_m; + __pyx_t_12 = __pyx_t_13; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_12; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":930 - * index += view.shape[dim] - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< - * - * if index >= shape: - */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 930, __pyx_L1_error) - - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - */ - } - - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] - * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: - */ - } - - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - */ - __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":933 - * - * if index >= shape: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< - * - * resultp = bufp + index * stride - */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 933, __pyx_L1_error) - - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - */ - } - - /* "View.MemoryView":935 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * resultp = bufp + index * stride # <<<<<<<<<<<<<< - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset - */ - __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - - /* "View.MemoryView":936 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset - * - */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":937 - * resultp = bufp + index * stride - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< - * - * return resultp - */ - __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); - - /* "View.MemoryView":936 + /* "newanalysis/helpers/diffusion.pyx":166 * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset + * for i in range(m): + * msd[i] /= ctr[i] # <<<<<<<<<<<<<< * + * return msd */ + __pyx_t_21 = __pyx_v_i; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_pybuffernd_ctr.diminfo[0].shape; + __pyx_t_22 = __pyx_v_i; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_msd.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_msd.diminfo[0].strides) /= ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_ctr.diminfo[0].strides))); } - /* "View.MemoryView":939 - * resultp = ( resultp)[0] + suboffset - * - * return resultp # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":168 + * msd[i] /= ctr[i] * + * return msd # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_r = __pyx_v_resultp; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_msd); + __pyx_r = ((PyObject *)__pyx_v_msd); goto __pyx_L0; - /* "View.MemoryView":912 + /* "newanalysis/helpers/diffusion.pyx":120 + * return msd, van_hove, non_gaussian * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None): */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.diffusion.msdCOM", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_msd); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":945 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim +/* "newanalysis/helpers/diffusion.pyx":170 + * return msd * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, + * np.ndarray[np.float64_t,ndim=3] xyz2, */ -static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { - int __pyx_v_ndim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_r; - int __pyx_t_1; - Py_ssize_t *__pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9diffusion_7pairDisplacement(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9diffusion_6pairDisplacement, "\n pairDisplacement(xyz1, xyz2, maxlen=None)\n\n Takes two unfolded center of mass coordinate sets. maxlen can be set to cap the length of the pair displacement.\n\n Usage:\n pair_displacement = pairDisplacement(xyz1, xyz2)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_7pairDisplacement = {"pairDisplacement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9diffusion_7pairDisplacement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_6pairDisplacement}; +static PyObject *__pyx_pw_11newanalysis_9diffusion_7pairDisplacement(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_xyz = 0; + PyArrayObject *__pyx_v_xyz2 = 0; + PyObject *__pyx_v_maxlen = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pairDisplacement (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 170, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_xyz2,&__pyx_n_s_maxlen,0}; - /* "View.MemoryView":946 - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: - * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< - * - * cdef Py_ssize_t *shape = memslice.shape + /* "newanalysis/helpers/diffusion.pyx":173 + * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, + * np.ndarray[np.float64_t,ndim=3] xyz2, + * maxlen=None): # <<<<<<<<<<<<<< + * """ + * pairDisplacement(xyz1, xyz2, maxlen=None) */ - __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; - __pyx_v_ndim = __pyx_t_1; + values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("pairDisplacement", 0, 2, 3, 1); __PYX_ERR(0, 170, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pairDisplacement") < 0)) __PYX_ERR(0, 170, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_xyz = ((PyArrayObject *)values[0]); + __pyx_v_xyz2 = ((PyArrayObject *)values[1]); + __pyx_v_maxlen = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("pairDisplacement", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 170, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.diffusion.pairDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 171, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz2), __pyx_ptype_5numpy_ndarray, 1, "xyz2", 0))) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9diffusion_6pairDisplacement(__pyx_self, __pyx_v_xyz, __pyx_v_xyz2, __pyx_v_maxlen); - /* "View.MemoryView":948 - * cdef int ndim = memslice.memview.view.ndim - * - * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< - * cdef Py_ssize_t *strides = memslice.strides + /* "newanalysis/helpers/diffusion.pyx":170 + * return msd * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, + * np.ndarray[np.float64_t,ndim=3] xyz2, */ - __pyx_t_2 = __pyx_v_memslice->shape; - __pyx_v_shape = __pyx_t_2; - /* "View.MemoryView":949 - * - * cdef Py_ssize_t *shape = memslice.shape - * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __pyx_v_memslice->strides; - __pyx_v_strides = __pyx_t_2; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":953 - * - * cdef int i, j - * for i in range(ndim / 2): # <<<<<<<<<<<<<< - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - */ - __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; - - /* "View.MemoryView":954 - * cdef int i, j - * for i in range(ndim / 2): - * j = ndim - 1 - i # <<<<<<<<<<<<<< - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] - */ - __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); +static PyObject *__pyx_pf_11newanalysis_9diffusion_6pairDisplacement(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_xyz2, PyObject *__pyx_v_maxlen) { + double __pyx_v_result; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_dx2; + double __pyx_v_dy2; + double __pyx_v_dz2; + double __pyx_v_dx3; + double __pyx_v_dy3; + double __pyx_v_dz3; + int __pyx_v_n1; + int __pyx_v_n2; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_l; + int __pyx_v_irel; + int __pyx_v_m; + int __pyx_v_nstep; + int __pyx_v_idx1; + int __pyx_v_idx2; + int __pyx_v_idx3; + int __pyx_v_idx4; + int __pyx_v_diag; + PyArrayObject *__pyx_v_msd = 0; + double *__pyx_v_msd_data; + double *__pyx_v_data; + double *__pyx_v_data2; + PyArrayObject *__pyx_v_ctr = 0; + int *__pyx_v_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_msd; + __Pyx_Buffer __pyx_pybuffer_msd; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; + __Pyx_Buffer __pyx_pybuffer_xyz; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz2; + __Pyx_Buffer __pyx_pybuffer_xyz2; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + char *__pyx_t_11; + PyArrayObject *__pyx_t_12 = NULL; + PyObject *(*__pyx_t_13)(PyObject *); + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pairDisplacement", 0); + __pyx_pybuffer_msd.pybuffer.buf = NULL; + __pyx_pybuffer_msd.refcount = 0; + __pyx_pybuffernd_msd.data = NULL; + __pyx_pybuffernd_msd.rcbuffer = &__pyx_pybuffer_msd; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_xyz.refcount = 0; + __pyx_pybuffernd_xyz.data = NULL; + __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; + __pyx_pybuffer_xyz2.pybuffer.buf = NULL; + __pyx_pybuffer_xyz2.refcount = 0; + __pyx_pybuffernd_xyz2.data = NULL; + __pyx_pybuffernd_xyz2.rcbuffer = &__pyx_pybuffer_xyz2; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 170, __pyx_L1_error) + } + __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz.diminfo[2].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz.diminfo[2].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz2.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 170, __pyx_L1_error) + } + __pyx_pybuffernd_xyz2.diminfo[0].strides = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz2.diminfo[0].shape = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz2.diminfo[1].strides = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz2.diminfo[1].shape = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz2.diminfo[2].strides = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz2.diminfo[2].shape = __pyx_pybuffernd_xyz2.rcbuffer->pybuffer.shape[2]; - /* "View.MemoryView":955 - * for i in range(ndim / 2): - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< - * shape[i], shape[j] = shape[j], shape[i] + /* "newanalysis/helpers/diffusion.pyx":185 + * cdef int n1, n2, i, j, k, l, irel, m, nstep, idx1, idx2, idx3, idx4 * - */ - __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); - __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); - (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; - (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; - - /* "View.MemoryView":956 - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * n1 = len(xyz) # <<<<<<<<<<<<<< + * n2 = len(xyz[0]) * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: */ - __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); - __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); - (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; - (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_v_n1 = __pyx_t_1; - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] + /* "newanalysis/helpers/diffusion.pyx":186 * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") + * n1 = len(xyz) + * n2 = len(xyz[0]) # <<<<<<<<<<<<<< * + * if maxlen == None: */ - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0); - __pyx_t_7 = __pyx_t_8; - __pyx_L6_bool_binop_done:; - if (__pyx_t_7) { + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n2 = __pyx_t_1; - /* "View.MemoryView":959 - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":188 + * n2 = len(xyz[0]) * - * return 1 + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ - __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 959, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 188, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") + /* "newanalysis/helpers/diffusion.pyx":189 * + * if maxlen == None: + * m = n1 # <<<<<<<<<<<<<< + * else: + * m = maxlen */ - } - } + __pyx_v_m = __pyx_v_n1; - /* "View.MemoryView":961 - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") - * - * return 1 # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/diffusion.pyx":188 + * n2 = len(xyz[0]) * + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ - __pyx_r = 1; - goto __pyx_L0; + goto __pyx_L3; + } - /* "View.MemoryView":945 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim + /* "newanalysis/helpers/diffusion.pyx":191 + * m = n1 + * else: + * m = maxlen # <<<<<<<<<<<<<< * + * nstep= floor(m/10.) */ - - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + /*else*/ { + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_v_m = ((int)__pyx_t_4); } - __pyx_r = 0; - __pyx_L0:; - return __pyx_r; -} + __pyx_L3:; -/* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 + /* "newanalysis/helpers/diffusion.pyx":193 + * m = maxlen * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + * nstep= floor(m/10.) # <<<<<<<<<<<<<< * + * cdef bint diag=True */ + __pyx_v_nstep = ((int)floor((((double)__pyx_v_m) / 10.))); -/* Python wrapper */ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":979 - * - * def __dealloc__(self): - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":195 + * nstep= floor(m/10.) * - * cdef convert_item_to_object(self, char *itemp): + * cdef bint diag=True # <<<<<<<<<<<<<< + * if (xyz[0][0] == xyz2[0][0]).all() and (xyz[-1][0] == xyz2[-1][0]).all(): + * diag = False */ - __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); + __pyx_v_diag = 1; - /* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + /* "newanalysis/helpers/diffusion.pyx":196 * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + * cdef bint diag=True + * if (xyz[0][0] == xyz2[0][0]).all() and (xyz[-1][0] == xyz2[-1][0]).all(): # <<<<<<<<<<<<<< + * diag = False * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) */ - -static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":982 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: - */ - __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":983 - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) # <<<<<<<<<<<<<< - * else: - * return memoryview.convert_item_to_object(self, itemp) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz2), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_all); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[1] = {__pyx_t_5, }; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":982 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: - */ + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } - - /* "View.MemoryView":985 - * return self.to_object_func(itemp) - * else: - * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 985, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_8) { + } else { + __pyx_t_3 = __pyx_t_8; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz2), -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_all); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[1] = {__pyx_t_7, }; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __pyx_t_8; + __pyx_L5_bool_binop_done:; + if (__pyx_t_3) { - /* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + /* "newanalysis/helpers/diffusion.pyx":197 + * cdef bint diag=True + * if (xyz[0][0] == xyz2[0][0]).all() and (xyz[-1][0] == xyz2[-1][0]).all(): + * diag = False # <<<<<<<<<<<<<< * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) + * # msd contains pair cross term, msd2 contains pair self term */ + __pyx_v_diag = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) + /* "newanalysis/helpers/diffusion.pyx":196 * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) - */ - -static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); - - /* "View.MemoryView":988 + * cdef bint diag=True + * if (xyz[0][0] == xyz2[0][0]).all() and (xyz[-1][0] == xyz2[-1][0]).all(): # <<<<<<<<<<<<<< + * diag = False * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: - */ - __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":989 - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< - * else: - * memoryview.assign_item_from_object(self, itemp, value) */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 989, __pyx_L1_error) + } - /* "View.MemoryView":988 + /* "newanalysis/helpers/diffusion.pyx":200 * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: + * # msd contains pair cross term, msd2 contains pair self term + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double* msd_data = msd.data + * cdef double *data = xyz.data */ - goto __pyx_L3; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msd.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_msd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 200, __pyx_L1_error) + } else {__pyx_pybuffernd_msd.diminfo[0].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msd.diminfo[0].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[0]; + } } + __pyx_t_10 = 0; + __pyx_v_msd = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; - /* "View.MemoryView":991 - * self.to_dtype_func(itemp, value) - * else: - * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/diffusion.pyx":201 + * # msd contains pair cross term, msd2 contains pair self term + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) + * cdef double* msd_data = msd.data # <<<<<<<<<<<<<< + * cdef double *data = xyz.data + * cdef double *data2 = xyz2.data */ - /*else*/ { - __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 991, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L3:; + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_msd)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_v_msd_data = ((double *)__pyx_t_11); - /* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) + /* "newanalysis/helpers/diffusion.pyx":202 + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) + * cdef double* msd_data = msd.data + * cdef double *data = xyz.data # <<<<<<<<<<<<<< + * cdef double *data2 = xyz2.data * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) */ + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_v_data = ((double *)__pyx_t_11); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/diffusion.pyx":203 + * cdef double* msd_data = msd.data + * cdef double *data = xyz.data + * cdef double *data2 = xyz2.data # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + */ + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz2)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_v_data2 = ((double *)__pyx_t_11); -/* "View.MemoryView":994 + /* "newanalysis/helpers/diffusion.pyx":205 + * cdef double *data2 = xyz2.data * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< + * cdef int *c = ctr.data * */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9)) __PYX_ERR(0, 205, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 205, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_12 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":995 - * @property - * def base(self): - * return self.from_object # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":206 + * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * cdef int *c = ctr.data # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") + * # loop over all starting points */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->from_object); - __pyx_r = __pyx_v_self->from_object; - goto __pyx_L0; + __pyx_t_11 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_11 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_v_c = ((int *)__pyx_t_11); - /* "View.MemoryView":994 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object + /* "newanalysis/helpers/diffusion.pyx":209 * + * # loop over all starting points + * for j in range(0,n1-m,nstep): # <<<<<<<<<<<<<< + * idx1=j*n2*3 + * # loop over all delta t */ + __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_n1 - __pyx_v_m)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_nstep); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_0)) __PYX_ERR(0, 209, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { + __pyx_t_7 = __pyx_t_9; __Pyx_INCREF(__pyx_t_7); __pyx_t_1 = 0; + __pyx_t_13 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 209, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + for (;;) { + if (likely(!__pyx_t_13)) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_1); __Pyx_INCREF(__pyx_t_9); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 209, __pyx_L1_error) + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + #endif + } else { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_1); __Pyx_INCREF(__pyx_t_9); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 209, __pyx_L1_error) + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + #endif + } + } else { + __pyx_t_9 = __pyx_t_13(__pyx_t_7); + if (unlikely(!__pyx_t_9)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 209, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_9); + } + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_j = __pyx_t_4; - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/helpers/diffusion.pyx":210 + * # loop over all starting points + * for j in range(0,n1-m,nstep): + * idx1=j*n2*3 # <<<<<<<<<<<<<< + * # loop over all delta t + * for i in prange(j,j+m,nogil=True,schedule=guided): */ + __pyx_v_idx1 = ((__pyx_v_j * __pyx_v_n2) * 3); -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + /* "newanalysis/helpers/diffusion.pyx":212 + * idx1=j*n2*3 + * # loop over all delta t + * for i in prange(j,j+m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< + * idx2=i*n2*3 + * irel=i-j + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_j; + __pyx_t_14 = (__pyx_v_j + __pyx_v_m); + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_16 = (__pyx_t_14 - __pyx_t_4 + 1 - 1/abs(1)) / 1; + if (__pyx_t_16 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_3, __pyx_t_8) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dx2) lastprivate(__pyx_v_dx3) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dy2) lastprivate(__pyx_v_dy3) lastprivate(__pyx_v_dz) lastprivate(__pyx_v_dz2) lastprivate(__pyx_v_dz3) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_idx2) lastprivate(__pyx_v_idx3) lastprivate(__pyx_v_idx4) lastprivate(__pyx_v_irel) lastprivate(__pyx_v_k) lastprivate(__pyx_v_l) lastprivate(__pyx_v_result) + #endif /* _OPENMP */ + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){ + { + __pyx_v_i = (int)(__pyx_t_4 + 1 * __pyx_t_15); + /* Initialize private variables to invalid values */ + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dx2 = ((double)__PYX_NAN()); + __pyx_v_dx3 = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dy2 = ((double)__PYX_NAN()); + __pyx_v_dy3 = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_dz2 = ((double)__PYX_NAN()); + __pyx_v_dz3 = ((double)__PYX_NAN()); + __pyx_v_idx2 = ((int)0xbad0bad0); + __pyx_v_idx3 = ((int)0xbad0bad0); + __pyx_v_idx4 = ((int)0xbad0bad0); + __pyx_v_irel = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); + __pyx_v_l = ((int)0xbad0bad0); + __pyx_v_result = ((double)__PYX_NAN()); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/diffusion.pyx":213 + * # loop over all delta t + * for i in prange(j,j+m,nogil=True,schedule=guided): + * idx2=i*n2*3 # <<<<<<<<<<<<<< + * irel=i-j + * # loop over residues + */ + __pyx_v_idx2 = ((__pyx_v_i * __pyx_v_n2) * 3); -static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + /* "newanalysis/helpers/diffusion.pyx":214 + * for i in prange(j,j+m,nogil=True,schedule=guided): + * idx2=i*n2*3 + * irel=i-j # <<<<<<<<<<<<<< + * # loop over residues + * for k in range(n2): + */ + __pyx_v_irel = (__pyx_v_i - __pyx_v_j); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/diffusion.pyx":216 + * irel=i-j + * # loop over residues + * for k in range(n2): # <<<<<<<<<<<<<< + * idx3=3*k + * for l in range(n2): */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_17 = __pyx_v_n2; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_k = __pyx_t_19; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/helpers/diffusion.pyx":217 + * # loop over residues + * for k in range(n2): + * idx3=3*k # <<<<<<<<<<<<<< + * for l in range(n2): + * if k == l and not diag: */ + __pyx_v_idx3 = (3 * __pyx_v_k); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/diffusion.pyx":218 + * for k in range(n2): + * idx3=3*k + * for l in range(n2): # <<<<<<<<<<<<<< + * if k == l and not diag: + * continue + */ + __pyx_t_20 = __pyx_v_n2; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_l = __pyx_t_22; -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/diffusion.pyx":219 + * idx3=3*k + * for l in range(n2): + * if k == l and not diag: # <<<<<<<<<<<<<< + * continue + * */ + __pyx_t_8 = (__pyx_v_k == __pyx_v_l); + if (__pyx_t_8) { + } else { + __pyx_t_3 = __pyx_t_8; + goto __pyx_L23_bool_binop_done; + } + __pyx_t_8 = (!__pyx_v_diag); + __pyx_t_3 = __pyx_t_8; + __pyx_L23_bool_binop_done:; + if (__pyx_t_3) { -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1001 - * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), - */ - -static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_TypeInfo *__pyx_t_4; - Py_buffer __pyx_t_5; - Py_ssize_t *__pyx_t_6; - Py_ssize_t *__pyx_t_7; - Py_ssize_t *__pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - - /* "View.MemoryView":1009 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None + /* "newanalysis/helpers/diffusion.pyx":220 + * for l in range(n2): + * if k == l and not diag: + * continue # <<<<<<<<<<<<<< * + * idx4=3*l */ - __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0); - if (__pyx_t_1) { + goto __pyx_L20_continue; - /* "View.MemoryView":1010 - * - * if memviewslice.memview == Py_None: - * return None # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/diffusion.pyx":219 + * idx3=3*k + * for l in range(n2): + * if k == l and not diag: # <<<<<<<<<<<<<< + * continue * */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + } - /* "View.MemoryView":1009 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None + /* "newanalysis/helpers/diffusion.pyx":222 + * continue * + * idx4=3*l # <<<<<<<<<<<<<< + * dx = data[idx2+idx3] - data[idx1+idx3] + * dy = data[idx2+idx3+1] - data[idx1+idx3+1] */ - } + __pyx_v_idx4 = (3 * __pyx_v_l); - /* "View.MemoryView":1015 + /* "newanalysis/helpers/diffusion.pyx":223 * - * - * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<< - * - * result.from_slice = memviewslice + * idx4=3*l + * dx = data[idx2+idx3] - data[idx1+idx3] # <<<<<<<<<<<<<< + * dy = data[idx2+idx3+1] - data[idx1+idx3+1] + * dz = data[idx2+idx3+2] - data[idx1+idx3+2] */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_dx = ((__pyx_v_data[(__pyx_v_idx2 + __pyx_v_idx3)]) - (__pyx_v_data[(__pyx_v_idx1 + __pyx_v_idx3)])); - /* "View.MemoryView":1017 - * result = _memoryviewslice(None, 0, dtype_is_object) - * - * result.from_slice = memviewslice # <<<<<<<<<<<<<< - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * + /* "newanalysis/helpers/diffusion.pyx":224 + * idx4=3*l + * dx = data[idx2+idx3] - data[idx1+idx3] + * dy = data[idx2+idx3+1] - data[idx1+idx3+1] # <<<<<<<<<<<<<< + * dz = data[idx2+idx3+2] - data[idx1+idx3+2] + * dx2 = data2[idx2+idx4] - data2[idx1+idx4] */ - __pyx_v_result->from_slice = __pyx_v_memviewslice; + __pyx_v_dy = ((__pyx_v_data[((__pyx_v_idx2 + __pyx_v_idx3) + 1)]) - (__pyx_v_data[((__pyx_v_idx1 + __pyx_v_idx3) + 1)])); - /* "View.MemoryView":1018 - * - * result.from_slice = memviewslice - * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< - * - * result.from_object = ( memviewslice.memview).base + /* "newanalysis/helpers/diffusion.pyx":225 + * dx = data[idx2+idx3] - data[idx1+idx3] + * dy = data[idx2+idx3+1] - data[idx1+idx3+1] + * dz = data[idx2+idx3+2] - data[idx1+idx3+2] # <<<<<<<<<<<<<< + * dx2 = data2[idx2+idx4] - data2[idx1+idx4] + * dy2 = data2[idx2+idx4+1] - data2[idx1+idx4+1] */ - __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + __pyx_v_dz = ((__pyx_v_data[((__pyx_v_idx2 + __pyx_v_idx3) + 2)]) - (__pyx_v_data[((__pyx_v_idx1 + __pyx_v_idx3) + 2)])); - /* "View.MemoryView":1020 - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - * result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<< - * result.typeinfo = memviewslice.memview.typeinfo - * + /* "newanalysis/helpers/diffusion.pyx":226 + * dy = data[idx2+idx3+1] - data[idx1+idx3+1] + * dz = data[idx2+idx3+2] - data[idx1+idx3+2] + * dx2 = data2[idx2+idx4] - data2[idx1+idx4] # <<<<<<<<<<<<<< + * dy2 = data2[idx2+idx4+1] - data2[idx1+idx4+1] + * dz2 = data2[idx2+idx4+2] - data2[idx1+idx4+2] */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_result->from_object); - __Pyx_DECREF(__pyx_v_result->from_object); - __pyx_v_result->from_object = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_dx2 = ((__pyx_v_data2[(__pyx_v_idx2 + __pyx_v_idx4)]) - (__pyx_v_data2[(__pyx_v_idx1 + __pyx_v_idx4)])); - /* "View.MemoryView":1021 - * - * result.from_object = ( memviewslice.memview).base - * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< - * - * result.view = memviewslice.memview.view + /* "newanalysis/helpers/diffusion.pyx":227 + * dz = data[idx2+idx3+2] - data[idx1+idx3+2] + * dx2 = data2[idx2+idx4] - data2[idx1+idx4] + * dy2 = data2[idx2+idx4+1] - data2[idx1+idx4+1] # <<<<<<<<<<<<<< + * dz2 = data2[idx2+idx4+2] - data2[idx1+idx4+2] + * dx3 = dx-dx2 */ - __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; - __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + __pyx_v_dy2 = ((__pyx_v_data2[((__pyx_v_idx2 + __pyx_v_idx4) + 1)]) - (__pyx_v_data2[((__pyx_v_idx1 + __pyx_v_idx4) + 1)])); - /* "View.MemoryView":1023 - * result.typeinfo = memviewslice.memview.typeinfo - * - * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< - * result.view.buf = memviewslice.data - * result.view.ndim = ndim + /* "newanalysis/helpers/diffusion.pyx":228 + * dx2 = data2[idx2+idx4] - data2[idx1+idx4] + * dy2 = data2[idx2+idx4+1] - data2[idx1+idx4+1] + * dz2 = data2[idx2+idx4+2] - data2[idx1+idx4+2] # <<<<<<<<<<<<<< + * dx3 = dx-dx2 + * dy3 = dy-dy2 */ - __pyx_t_5 = __pyx_v_memviewslice.memview->view; - __pyx_v_result->__pyx_base.view = __pyx_t_5; + __pyx_v_dz2 = ((__pyx_v_data2[((__pyx_v_idx2 + __pyx_v_idx4) + 2)]) - (__pyx_v_data2[((__pyx_v_idx1 + __pyx_v_idx4) + 2)])); - /* "View.MemoryView":1024 - * - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None + /* "newanalysis/helpers/diffusion.pyx":229 + * dy2 = data2[idx2+idx4+1] - data2[idx1+idx4+1] + * dz2 = data2[idx2+idx4+2] - data2[idx1+idx4+2] + * dx3 = dx-dx2 # <<<<<<<<<<<<<< + * dy3 = dy-dy2 + * dz3 = dz-dz2 */ - __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); + __pyx_v_dx3 = (__pyx_v_dx - __pyx_v_dx2); - /* "View.MemoryView":1025 - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data - * result.view.ndim = ndim # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) + /* "newanalysis/helpers/diffusion.pyx":230 + * dz2 = data2[idx2+idx4+2] - data2[idx1+idx4+2] + * dx3 = dx-dx2 + * dy3 = dy-dy2 # <<<<<<<<<<<<<< + * dz3 = dz-dz2 + * result = dx3*dx3+dy3*dy3+dz3*dz3 */ - __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + __pyx_v_dy3 = (__pyx_v_dy - __pyx_v_dy2); - /* "View.MemoryView":1026 - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) - * + /* "newanalysis/helpers/diffusion.pyx":231 + * dx3 = dx-dx2 + * dy3 = dy-dy2 + * dz3 = dz-dz2 # <<<<<<<<<<<<<< + * result = dx3*dx3+dy3*dy3+dz3*dz3 + * msd_data[irel]+=result */ - ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + __pyx_v_dz3 = (__pyx_v_dz - __pyx_v_dz2); - /* "View.MemoryView":1027 - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: + /* "newanalysis/helpers/diffusion.pyx":232 + * dy3 = dy-dy2 + * dz3 = dz-dz2 + * result = dx3*dx3+dy3*dy3+dz3*dz3 # <<<<<<<<<<<<<< + * msd_data[irel]+=result + * c[irel]+=1 */ - Py_INCREF(Py_None); + __pyx_v_result = (((__pyx_v_dx3 * __pyx_v_dx3) + (__pyx_v_dy3 * __pyx_v_dy3)) + (__pyx_v_dz3 * __pyx_v_dz3)); - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) + /* "newanalysis/helpers/diffusion.pyx":233 + * dz3 = dz-dz2 + * result = dx3*dx3+dy3*dy3+dz3*dz3 + * msd_data[irel]+=result # <<<<<<<<<<<<<< + * c[irel]+=1 * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: */ - __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_1) { + __pyx_t_23 = __pyx_v_irel; + (__pyx_v_msd_data[__pyx_t_23]) = ((__pyx_v_msd_data[__pyx_t_23]) + __pyx_v_result); - /* "View.MemoryView":1030 + /* "newanalysis/helpers/diffusion.pyx":234 + * result = dx3*dx3+dy3*dy3+dz3*dz3 + * msd_data[irel]+=result + * c[irel]+=1 # <<<<<<<<<<<<<< * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: - * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< - * else: - * result.flags = PyBUF_RECORDS_RO + * for i in range(m): */ - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: - */ - goto __pyx_L4; - } - - /* "View.MemoryView":1032 - * result.flags = PyBUF_RECORDS - * else: - * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< - * - * result.view.shape = result.from_slice.shape - */ - /*else*/ { - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; - } - __pyx_L4:; - - /* "View.MemoryView":1034 - * result.flags = PyBUF_RECORDS_RO - * - * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< - * result.view.strides = result.from_slice.strides - * - */ - __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); - - /* "View.MemoryView":1035 - * - * result.view.shape = result.from_slice.shape - * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - - /* "View.MemoryView":1038 - * - * - * result.view.suboffsets = NULL # <<<<<<<<<<<<<< - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - */ - __pyx_v_result->__pyx_base.view.suboffsets = NULL; - - /* "View.MemoryView":1039 - * - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - */ - __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_v_suboffset = (__pyx_t_6[0]); - - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break - */ - __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1041 - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - - /* "View.MemoryView":1042 - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - * break # <<<<<<<<<<<<<< - * - * result.view.len = result.view.itemsize - */ - goto __pyx_L6_break; + __pyx_t_23 = __pyx_v_irel; + (__pyx_v_c[__pyx_t_23]) = ((__pyx_v_c[__pyx_t_23]) + 1); + __pyx_L20_continue:; + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break + /* "newanalysis/helpers/diffusion.pyx":212 + * idx1=j*n2*3 + * # loop over all delta t + * for i in prange(j,j+m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< + * idx2=i*n2*3 + * irel=i-j */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L13; + } + __pyx_L13:; + } } - } - __pyx_L6_break:; - - /* "View.MemoryView":1044 - * break - * - * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< - * for length in result.view.shape[:ndim]: - * result.view.len *= length - */ - __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - - /* "View.MemoryView":1045 - * - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< - * result.view.len *= length - * - */ - __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1045, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); - __pyx_t_2 = 0; - /* "View.MemoryView":1046 - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: - * result.view.len *= length # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":209 * - * result.to_object_func = to_object_func + * # loop over all starting points + * for j in range(0,n1-m,nstep): # <<<<<<<<<<<<<< + * idx1=j*n2*3 + * # loop over all delta t */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":1048 - * result.view.len *= length + /* "newanalysis/helpers/diffusion.pyx":236 + * c[irel]+=1 * - * result.to_object_func = to_object_func # <<<<<<<<<<<<<< - * result.to_dtype_func = to_dtype_func + * for i in range(m): # <<<<<<<<<<<<<< + * msd[i]/=ctr[i] * */ - __pyx_v_result->to_object_func = __pyx_v_to_object_func; + __pyx_t_16 = __pyx_v_m; + __pyx_t_15 = __pyx_t_16; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14+=1) { + __pyx_v_i = __pyx_t_14; - /* "View.MemoryView":1049 + /* "newanalysis/helpers/diffusion.pyx":237 * - * result.to_object_func = to_object_func - * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * for i in range(m): + * msd[i]/=ctr[i] # <<<<<<<<<<<<<< * - * return result + * return msd */ - __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + __pyx_t_24 = __pyx_v_i; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_ctr.diminfo[0].shape; + __pyx_t_25 = __pyx_v_i; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_pybuffernd_msd.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_msd.diminfo[0].strides) /= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_ctr.diminfo[0].strides)); + } - /* "View.MemoryView":1051 - * result.to_dtype_func = to_dtype_func + /* "newanalysis/helpers/diffusion.pyx":239 + * msd[i]/=ctr[i] * - * return result # <<<<<<<<<<<<<< + * return msd # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_get_slice_from_memoryview') + * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); + __Pyx_INCREF((PyObject *)__pyx_v_msd); + __pyx_r = ((PyObject *)__pyx_v_msd); goto __pyx_L0; - /* "View.MemoryView":1001 + /* "newanalysis/helpers/diffusion.pyx":170 + * return msd * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, + * np.ndarray[np.float64_t,ndim=3] xyz2, */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz2.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.diffusion.pairDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz2.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_msd); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1054 +/* "newanalysis/helpers/diffusion.pyx":241 + * return msd * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, */ -static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { - struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; - __Pyx_memviewslice *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9diffusion_9msdMJ(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9diffusion_8msdMJ, "\n msdMJ(coms_cat, coms_an, maxlen=None, charge_cat=None, charge_an=None)\n\n Takes two center-of-mass arrays of the whole unfolded trajectory, one for cations, the other for anions.\n\n Usage:\n msdmj = msdMJ(coms_cat, coms_an)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_9msdMJ = {"msdMJ", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9diffusion_9msdMJ, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_8msdMJ}; +static PyObject *__pyx_pw_11newanalysis_9diffusion_9msdMJ(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_coms_cat = 0; + PyArrayObject *__pyx_v_coms_an = 0; + PyObject *__pyx_v_maxlen = 0; + PyObject *__pyx_v_charge_cat = 0; + PyObject *__pyx_v_charge_an = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("msdMJ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 241, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms_cat,&__pyx_n_s_coms_an,&__pyx_n_s_maxlen,&__pyx_n_s_charge_cat,&__pyx_n_s_charge_an,0}; - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1058 - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): - * obj = memview # <<<<<<<<<<<<<< - * return &obj.from_slice - * else: + /* "newanalysis/helpers/diffusion.pyx":244 + * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, + * maxlen=None, # <<<<<<<<<<<<<< + * charge_cat = None, + * charge_an = None): */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1058, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); - /* "View.MemoryView":1059 - * if isinstance(memview, _memoryviewslice): - * obj = memview - * return &obj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, mslice) + /* "newanalysis/helpers/diffusion.pyx":245 + * np.ndarray[np.float64_t,ndim=3] coms_an, + * maxlen=None, + * charge_cat = None, # <<<<<<<<<<<<<< + * charge_an = None): + * """ */ - __pyx_r = (&__pyx_v_obj->from_slice); - goto __pyx_L0; + values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "newanalysis/helpers/diffusion.pyx":246 + * maxlen=None, + * charge_cat = None, + * charge_an = None): # <<<<<<<<<<<<<< + * """ + * msdMJ(coms_cat, coms_an, maxlen=None, charge_cat=None, charge_an=None) */ + values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms_cat)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms_an)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("msdMJ", 0, 2, 5, 1); __PYX_ERR(0, 241, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charge_cat); + if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charge_an); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "msdMJ") < 0)) __PYX_ERR(0, 241, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_coms_cat = ((PyArrayObject *)values[0]); + __pyx_v_coms_an = ((PyArrayObject *)values[1]); + __pyx_v_maxlen = values[2]; + __pyx_v_charge_cat = values[3]; + __pyx_v_charge_an = values[4]; } - - /* "View.MemoryView":1061 - * return &obj.from_slice - * else: - * slice_copy(memview, mslice) # <<<<<<<<<<<<<< - * return mslice - * - */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - - /* "View.MemoryView":1062 - * else: - * slice_copy(memview, mslice) - * return mslice # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_slice_copy') - */ - __pyx_r = __pyx_v_mslice; - goto __pyx_L0; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("msdMJ", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 241, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_AddTraceback("newanalysis.diffusion.msdMJ", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_cat), __pyx_ptype_5numpy_ndarray, 1, "coms_cat", 0))) __PYX_ERR(0, 242, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_an), __pyx_ptype_5numpy_ndarray, 1, "coms_an", 0))) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9diffusion_8msdMJ(__pyx_self, __pyx_v_coms_cat, __pyx_v_coms_an, __pyx_v_maxlen, __pyx_v_charge_cat, __pyx_v_charge_an); - /* "View.MemoryView":1054 + /* "newanalysis/helpers/diffusion.pyx":241 + * return msd * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_obj); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1065 - * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets - */ - -static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { - int __pyx_v_dim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - Py_ssize_t *__pyx_v_suboffsets; +static PyObject *__pyx_pf_11newanalysis_9diffusion_8msdMJ(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_charge_cat, PyObject *__pyx_v_charge_an) { + int __pyx_v_n1; + int __pyx_v_n2; + int __pyx_v_m; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_ccat; + int __pyx_v_can; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_result; + double *__pyx_v_cat; + double *__pyx_v_an; + PyArrayObject *__pyx_v_mj = 0; + double *__pyx_v_cmj; + PyArrayObject *__pyx_v_msdmj = 0; + double *__pyx_v_msd; + PyArrayObject *__pyx_v_ctr = 0; + int *__pyx_v_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_an; + __Pyx_Buffer __pyx_pybuffer_coms_an; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_cat; + __Pyx_Buffer __pyx_pybuffer_coms_cat; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mj; + __Pyx_Buffer __pyx_pybuffer_mj; + __Pyx_LocalBuf_ND __pyx_pybuffernd_msdmj; + __Pyx_Buffer __pyx_pybuffer_msdmj; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - int __pyx_t_2; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("slice_copy", 0); + char *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + long __pyx_t_18; + int __pyx_t_19; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("msdMJ", 0); + __pyx_pybuffer_mj.pybuffer.buf = NULL; + __pyx_pybuffer_mj.refcount = 0; + __pyx_pybuffernd_mj.data = NULL; + __pyx_pybuffernd_mj.rcbuffer = &__pyx_pybuffer_mj; + __pyx_pybuffer_msdmj.pybuffer.buf = NULL; + __pyx_pybuffer_msdmj.refcount = 0; + __pyx_pybuffernd_msdmj.data = NULL; + __pyx_pybuffernd_msdmj.rcbuffer = &__pyx_pybuffer_msdmj; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_coms_cat.pybuffer.buf = NULL; + __pyx_pybuffer_coms_cat.refcount = 0; + __pyx_pybuffernd_coms_cat.data = NULL; + __pyx_pybuffernd_coms_cat.rcbuffer = &__pyx_pybuffer_coms_cat; + __pyx_pybuffer_coms_an.pybuffer.buf = NULL; + __pyx_pybuffer_coms_an.refcount = 0; + __pyx_pybuffernd_coms_an.data = NULL; + __pyx_pybuffernd_coms_an.rcbuffer = &__pyx_pybuffer_coms_an; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_cat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 241, __pyx_L1_error) + } + __pyx_pybuffernd_coms_cat.diminfo[0].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_cat.diminfo[0].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_cat.diminfo[1].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_cat.diminfo[1].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_cat.diminfo[2].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_cat.diminfo[2].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_an, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 241, __pyx_L1_error) + } + __pyx_pybuffernd_coms_an.diminfo[0].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_an.diminfo[0].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_an.diminfo[1].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_an.diminfo[1].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_an.diminfo[2].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_an.diminfo[2].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[2]; - /* "View.MemoryView":1069 - * cdef (Py_ssize_t*) shape, strides, suboffsets + /* "newanalysis/helpers/diffusion.pyx":259 + * cdef double dx,dy,dz,result * - * shape = memview.view.shape # <<<<<<<<<<<<<< - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets + * n1 = len(coms_cat) # <<<<<<<<<<<<<< + * n2 = len(coms_cat[0]) + * if maxlen == None: */ - __pyx_t_1 = __pyx_v_memview->view.shape; - __pyx_v_shape = __pyx_t_1; + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coms_cat)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_v_n1 = __pyx_t_1; - /* "View.MemoryView":1070 - * - * shape = memview.view.shape - * strides = memview.view.strides # <<<<<<<<<<<<<< - * suboffsets = memview.view.suboffsets + /* "newanalysis/helpers/diffusion.pyx":260 * + * n1 = len(coms_cat) + * n2 = len(coms_cat[0]) # <<<<<<<<<<<<<< + * if maxlen == None: + * m = n1 */ - __pyx_t_1 = __pyx_v_memview->view.strides; - __pyx_v_strides = __pyx_t_1; + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_cat), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n2 = __pyx_t_1; - /* "View.MemoryView":1071 - * shape = memview.view.shape - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< - * - * dst.memview = <__pyx_memoryview *> memview + /* "newanalysis/helpers/diffusion.pyx":261 + * n1 = len(coms_cat) + * n2 = len(coms_cat[0]) + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ - __pyx_t_1 = __pyx_v_memview->view.suboffsets; - __pyx_v_suboffsets = __pyx_t_1; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 261, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { - /* "View.MemoryView":1073 - * suboffsets = memview.view.suboffsets - * - * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< - * dst.data = memview.view.buf - * + /* "newanalysis/helpers/diffusion.pyx":262 + * n2 = len(coms_cat[0]) + * if maxlen == None: + * m = n1 # <<<<<<<<<<<<<< + * else: + * m = maxlen */ - __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + __pyx_v_m = __pyx_v_n1; - /* "View.MemoryView":1074 - * - * dst.memview = <__pyx_memoryview *> memview - * dst.data = memview.view.buf # <<<<<<<<<<<<<< - * - * for dim in range(memview.view.ndim): + /* "newanalysis/helpers/diffusion.pyx":261 + * n1 = len(coms_cat) + * n2 = len(coms_cat[0]) + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ - __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + goto __pyx_L3; + } - /* "View.MemoryView":1076 - * dst.data = memview.view.buf - * - * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] + /* "newanalysis/helpers/diffusion.pyx":264 + * m = n1 + * else: + * m = maxlen # <<<<<<<<<<<<<< + * if charge_cat is None: + * ccat = 1 */ - __pyx_t_2 = __pyx_v_memview->view.ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_dim = __pyx_t_4; + /*else*/ { + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 264, __pyx_L1_error) + __pyx_v_m = ((int)__pyx_t_4); + } + __pyx_L3:; - /* "View.MemoryView":1077 - * - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + /* "newanalysis/helpers/diffusion.pyx":265 + * else: + * m = maxlen + * if charge_cat is None: # <<<<<<<<<<<<<< + * ccat = 1 + * else: */ - (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + __pyx_t_3 = (__pyx_v_charge_cat == Py_None); + if (__pyx_t_3) { - /* "View.MemoryView":1078 - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 - * + /* "newanalysis/helpers/diffusion.pyx":266 + * m = maxlen + * if charge_cat is None: + * ccat = 1 # <<<<<<<<<<<<<< + * else: + * ccat = charge_cat */ - (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + __pyx_v_ccat = 1; - /* "View.MemoryView":1079 - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_object') + /* "newanalysis/helpers/diffusion.pyx":265 + * else: + * m = maxlen + * if charge_cat is None: # <<<<<<<<<<<<<< + * ccat = 1 + * else: */ - if ((__pyx_v_suboffsets != 0)) { - __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); - } else { - __pyx_t_5 = -1L; - } - (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + goto __pyx_L4; } - /* "View.MemoryView":1065 + /* "newanalysis/helpers/diffusion.pyx":268 + * ccat = 1 + * else: + * ccat = charge_cat # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets + * if charge_an is None: */ + /*else*/ { + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_charge_cat); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 268, __pyx_L1_error) + __pyx_v_ccat = ((int)__pyx_t_4); + } + __pyx_L4:; - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":1082 + /* "newanalysis/helpers/diffusion.pyx":270 + * ccat = charge_cat * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice + * if charge_an is None: # <<<<<<<<<<<<<< + * can = -1 + * else: */ + __pyx_t_3 = (__pyx_v_charge_an == Py_None); + if (__pyx_t_3) { -static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { - __Pyx_memviewslice __pyx_v_memviewslice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy", 0); - - /* "View.MemoryView":1085 - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< - * return memoryview_copy_from_slice(memview, &memviewslice) + /* "newanalysis/helpers/diffusion.pyx":271 * + * if charge_an is None: + * can = -1 # <<<<<<<<<<<<<< + * else: + * can = charge_an */ - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + __pyx_v_can = -1; - /* "View.MemoryView":1086 - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) - * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":270 + * ccat = charge_cat * - * @cname('__pyx_memoryview_copy_object_from_slice') + * if charge_an is None: # <<<<<<<<<<<<<< + * can = -1 + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1086, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + goto __pyx_L5; + } - /* "View.MemoryView":1082 + /* "newanalysis/helpers/diffusion.pyx":273 + * can = -1 + * else: + * can = charge_an # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice + * cdef double *cat = coms_cat.data */ + /*else*/ { + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_charge_an); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error) + __pyx_v_can = ((int)__pyx_t_4); + } + __pyx_L5:; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1089 + /* "newanalysis/helpers/diffusion.pyx":275 + * can = charge_an * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. - */ - -static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { - PyObject *(*__pyx_v_to_object_func)(char *); - int (*__pyx_v_to_dtype_func)(char *, PyObject *); - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *(*__pyx_t_3)(char *); - int (*__pyx_t_4)(char *, PyObject *); - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 + * cdef double *cat = coms_cat.data # <<<<<<<<<<<<<< + * cdef double *an = coms_an.data * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coms_cat)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_v_cat = ((double *)__pyx_t_5); - /* "View.MemoryView":1097 + /* "newanalysis/helpers/diffusion.pyx":276 * - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - */ - __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; - __pyx_v_to_object_func = __pyx_t_3; - - /* "View.MemoryView":1098 - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< - * else: - * to_object_func = NULL - */ - __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; - __pyx_v_to_dtype_func = __pyx_t_4; - - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 + * cdef double *cat = coms_cat.data + * cdef double *an = coms_an.data # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) */ - goto __pyx_L3; - } + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coms_an)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_v_an = ((double *)__pyx_t_5); - /* "View.MemoryView":1100 - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - * to_object_func = NULL # <<<<<<<<<<<<<< - * to_dtype_func = NULL + /* "newanalysis/helpers/diffusion.pyx":278 + * cdef double *an = coms_an.data * - */ - /*else*/ { - __pyx_v_to_object_func = NULL; - - /* "View.MemoryView":1101 - * else: - * to_object_func = NULL - * to_dtype_func = NULL # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *cmj = mj.data * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, */ - __pyx_v_to_dtype_func = NULL; - } - __pyx_L3:; - - /* "View.MemoryView":1103 - * to_dtype_func = NULL - * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< - * to_object_func, to_dtype_func, - * memview.dtype_is_object) - */ - __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_3)) __PYX_ERR(0, 278, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_mj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 278, __pyx_L1_error) + } else {__pyx_pybuffernd_mj.diminfo[0].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj.diminfo[0].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj.diminfo[1].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj.diminfo[1].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_10 = 0; + __pyx_v_mj = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; - /* "View.MemoryView":1105 - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - * to_object_func, to_dtype_func, - * memview.dtype_is_object) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":279 * + * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) + * cdef double *cmj = mj.data # <<<<<<<<<<<<<< * + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) */ - __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "View.MemoryView":1089 - * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. - */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_mj)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_v_cmj = ((double *)__pyx_t_5); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1111 + /* "newanalysis/helpers/diffusion.pyx":281 + * cdef double *cmj = mj.data * + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *msd = msdmj.data * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9)) __PYX_ERR(0, 281, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_msdmj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 281, __pyx_L1_error) + } else {__pyx_pybuffernd_msdmj.diminfo[0].strides = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msdmj.diminfo[0].shape = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_11 = 0; + __pyx_v_msdmj = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; -static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { - Py_ssize_t __pyx_r; - int __pyx_t_1; - - /* "View.MemoryView":1112 + /* "newanalysis/helpers/diffusion.pyx":282 * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: - */ - __pyx_t_1 = ((__pyx_v_arg < 0) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1113 - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: - * return -arg # <<<<<<<<<<<<<< - * else: - * return arg - */ - __pyx_r = (-__pyx_v_arg); - goto __pyx_L0; - - /* "View.MemoryView":1112 + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) + * cdef double *msd = msdmj.data # <<<<<<<<<<<<<< * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) */ - } + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_msdmj)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 282, __pyx_L1_error) + __pyx_v_msd = ((double *)__pyx_t_5); - /* "View.MemoryView":1115 - * return -arg - * else: - * return arg # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":284 + * cdef double *msd = msdmj.data + * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< + * cdef int *c = ctr.data * - * @cname('__pyx_get_best_slice_order') */ - /*else*/ { - __pyx_r = __pyx_v_arg; - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8)) __PYX_ERR(0, 284, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_6); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 284, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; + } } + __pyx_t_12 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; - /* "View.MemoryView":1111 + /* "newanalysis/helpers/diffusion.pyx":285 * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * cdef int *c = ctr.data # <<<<<<<<<<<<<< * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg + * for i in prange(n1,nogil=True): */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_v_c = ((int *)__pyx_t_5); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1118 + /* "newanalysis/helpers/diffusion.pyx":287 + * cdef int *c = ctr.data * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n2): + * cmj[i*3] += ccat*cat[i*n2*3+3*j] */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_n1; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_14 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_14 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) + #endif /* _OPENMP */ + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_13); + /* Initialize private variables to invalid values */ + __pyx_v_j = ((int)0xbad0bad0); -static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { - int __pyx_v_i; - Py_ssize_t __pyx_v_c_stride; - Py_ssize_t __pyx_v_f_stride; - char __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1123 - * """ - * cdef int i - * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< - * cdef Py_ssize_t f_stride = 0 + /* "newanalysis/helpers/diffusion.pyx":288 * + * for i in prange(n1,nogil=True): + * for j in range(n2): # <<<<<<<<<<<<<< + * cmj[i*3] += ccat*cat[i*n2*3+3*j] + * cmj[i*3+1] += ccat*cat[i*n2*3+3*j+1] */ - __pyx_v_c_stride = 0; + __pyx_t_15 = __pyx_v_n2; + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_j = __pyx_t_17; - /* "View.MemoryView":1124 - * cdef int i - * cdef Py_ssize_t c_stride = 0 - * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): + /* "newanalysis/helpers/diffusion.pyx":289 + * for i in prange(n1,nogil=True): + * for j in range(n2): + * cmj[i*3] += ccat*cat[i*n2*3+3*j] # <<<<<<<<<<<<<< + * cmj[i*3+1] += ccat*cat[i*n2*3+3*j+1] + * cmj[i*3+2] += ccat*cat[i*n2*3+3*j+2] */ - __pyx_v_f_stride = 0; + __pyx_t_18 = (__pyx_v_i * 3); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_ccat * (__pyx_v_cat[(((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j))]))); - /* "View.MemoryView":1126 - * cdef Py_ssize_t f_stride = 0 - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] + /* "newanalysis/helpers/diffusion.pyx":290 + * for j in range(n2): + * cmj[i*3] += ccat*cat[i*n2*3+3*j] + * cmj[i*3+1] += ccat*cat[i*n2*3+3*j+1] # <<<<<<<<<<<<<< + * cmj[i*3+2] += ccat*cat[i*n2*3+3*j+2] + * cmj[i*3] += can*an[i*n2*3+3*j] */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_18 = ((__pyx_v_i * 3) + 1); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_ccat * (__pyx_v_cat[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 1)]))); - /* "View.MemoryView":1127 - * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break + /* "newanalysis/helpers/diffusion.pyx":291 + * cmj[i*3] += ccat*cat[i*n2*3+3*j] + * cmj[i*3+1] += ccat*cat[i*n2*3+3*j+1] + * cmj[i*3+2] += ccat*cat[i*n2*3+3*j+2] # <<<<<<<<<<<<<< + * cmj[i*3] += can*an[i*n2*3+3*j] + * cmj[i*3+1] += can*an[i*n2*3+3*j+1] */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { + __pyx_t_18 = ((__pyx_v_i * 3) + 2); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_ccat * (__pyx_v_cat[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 2)]))); - /* "View.MemoryView":1128 - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break + /* "newanalysis/helpers/diffusion.pyx":292 + * cmj[i*3+1] += ccat*cat[i*n2*3+3*j+1] + * cmj[i*3+2] += ccat*cat[i*n2*3+3*j+2] + * cmj[i*3] += can*an[i*n2*3+3*j] # <<<<<<<<<<<<<< + * cmj[i*3+1] += can*an[i*n2*3+3*j+1] + * cmj[i*3+2] += can*an[i*n2*3+3*j+2] + */ + __pyx_t_18 = (__pyx_v_i * 3); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_can * (__pyx_v_an[(((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j))]))); + + /* "newanalysis/helpers/diffusion.pyx":293 + * cmj[i*3+2] += ccat*cat[i*n2*3+3*j+2] + * cmj[i*3] += can*an[i*n2*3+3*j] + * cmj[i*3+1] += can*an[i*n2*3+3*j+1] # <<<<<<<<<<<<<< + * cmj[i*3+2] += can*an[i*n2*3+3*j+2] * */ - __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + __pyx_t_18 = ((__pyx_v_i * 3) + 1); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_can * (__pyx_v_an[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 1)]))); - /* "View.MemoryView":1129 - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":294 + * cmj[i*3] += can*an[i*n2*3+3*j] + * cmj[i*3+1] += can*an[i*n2*3+3*j+1] + * cmj[i*3+2] += can*an[i*n2*3+3*j+2] # <<<<<<<<<<<<<< * - * for i in range(ndim): + * for i in prange(m,nogil=True): */ - goto __pyx_L4_break; + __pyx_t_18 = ((__pyx_v_i * 3) + 2); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_can * (__pyx_v_an[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 2)]))); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1127 + /* "newanalysis/helpers/diffusion.pyx":287 + * cdef int *c = ctr.data * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n2): + * cmj[i*3] += ccat*cat[i*n2*3+3*j] */ - } + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L8; + } + __pyx_L8:; + } } - __pyx_L4_break:; - /* "View.MemoryView":1131 - * break + /* "newanalysis/helpers/diffusion.pyx":296 + * cmj[i*3+2] += can*an[i*n2*3+3*j+2] * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] + * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n1-i): + * dx = cmj[j*3] - cmj[(j+i)*3] */ - __pyx_t_1 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_1; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_14 = __pyx_v_m; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_4 = (__pyx_t_14 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_4 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_19) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_result) + #endif /* _OPENMP */ + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_4; __pyx_t_13++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_13); + /* Initialize private variables to invalid values */ + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_result = ((double)__PYX_NAN()); - /* "View.MemoryView":1132 + /* "newanalysis/helpers/diffusion.pyx":297 * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break + * for i in prange(m,nogil=True): + * for j in range(n1-i): # <<<<<<<<<<<<<< + * dx = cmj[j*3] - cmj[(j+i)*3] + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { + __pyx_t_15 = (__pyx_v_n1 - __pyx_v_i); + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_j = __pyx_t_17; - /* "View.MemoryView":1133 - * for i in range(ndim): - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * + /* "newanalysis/helpers/diffusion.pyx":298 + * for i in prange(m,nogil=True): + * for j in range(n1-i): + * dx = cmj[j*3] - cmj[(j+i)*3] # <<<<<<<<<<<<<< + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] */ - __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + __pyx_v_dx = ((__pyx_v_cmj[(__pyx_v_j * 3)]) - (__pyx_v_cmj[((__pyx_v_j + __pyx_v_i) * 3)])); - /* "View.MemoryView":1134 - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + /* "newanalysis/helpers/diffusion.pyx":299 + * for j in range(n1-i): + * dx = cmj[j*3] - cmj[(j+i)*3] + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] # <<<<<<<<<<<<<< + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] + * result = dx*dx+dy*dy+dz*dz */ - goto __pyx_L7_break; + __pyx_v_dy = ((__pyx_v_cmj[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); - /* "View.MemoryView":1132 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break + /* "newanalysis/helpers/diffusion.pyx":300 + * dx = cmj[j*3] - cmj[(j+i)*3] + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] # <<<<<<<<<<<<<< + * result = dx*dx+dy*dy+dz*dz + * msd[i]+=result */ - } - } - __pyx_L7_break:; + __pyx_v_dz = ((__pyx_v_cmj[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); - /* "View.MemoryView":1136 - * break - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: + /* "newanalysis/helpers/diffusion.pyx":301 + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] + * result = dx*dx+dy*dy+dz*dz # <<<<<<<<<<<<<< + * msd[i]+=result + * c[i]+=1 */ - __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0); - if (__pyx_t_2) { + __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); - /* "View.MemoryView":1137 + /* "newanalysis/helpers/diffusion.pyx":302 + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] + * result = dx*dx+dy*dy+dz*dz + * msd[i]+=result # <<<<<<<<<<<<<< + * c[i]+=1 * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - * return 'C' # <<<<<<<<<<<<<< - * else: - * return 'F' */ - __pyx_r = 'C'; - goto __pyx_L0; + __pyx_t_19 = __pyx_v_i; + (__pyx_v_msd[__pyx_t_19]) = ((__pyx_v_msd[__pyx_t_19]) + __pyx_v_result); - /* "View.MemoryView":1136 - * break + /* "newanalysis/helpers/diffusion.pyx":303 + * result = dx*dx+dy*dy+dz*dz + * msd[i]+=result + * c[i]+=1 # <<<<<<<<<<<<<< * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: + * for i in range(m): */ - } + __pyx_t_19 = __pyx_v_i; + (__pyx_v_c[__pyx_t_19]) = ((__pyx_v_c[__pyx_t_19]) + 1); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1139 - * return 'C' - * else: - * return 'F' # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":296 + * cmj[i*3+2] += can*an[i*n2*3+3*j+2] * - * @cython.cdivision(True) + * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n1-i): + * dx = cmj[j*3] - cmj[(j+i)*3] */ - /*else*/ { - __pyx_r = 'F'; - goto __pyx_L0; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L19; + } + __pyx_L19:; + } } - /* "View.MemoryView":1118 + /* "newanalysis/helpers/diffusion.pyx":305 + * c[i]+=1 * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1142 + * for i in range(m): # <<<<<<<<<<<<<< + * msd[i]/=c[i] * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ + __pyx_t_4 = __pyx_v_m; + __pyx_t_13 = __pyx_t_4; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_i = __pyx_t_14; -static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; - Py_ssize_t __pyx_v_dst_extent; - Py_ssize_t __pyx_v_src_stride; - Py_ssize_t __pyx_v_dst_stride; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - - /* "View.MemoryView":1149 + /* "newanalysis/helpers/diffusion.pyx":306 * - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - */ - __pyx_v_src_extent = (__pyx_v_src_shape[0]); - - /* "View.MemoryView":1150 - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] - */ - __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - - /* "View.MemoryView":1151 - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_stride = dst_strides[0] + * for i in range(m): + * msd[i]/=c[i] # <<<<<<<<<<<<<< * + * return msdmj */ - __pyx_v_src_stride = (__pyx_v_src_strides[0]); + __pyx_t_15 = __pyx_v_i; + if (unlikely((__pyx_v_c[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 306, __pyx_L1_error) + } + (__pyx_v_msd[__pyx_t_15]) = ((__pyx_v_msd[__pyx_t_15]) / (__pyx_v_c[__pyx_v_i])); + } - /* "View.MemoryView":1152 - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":308 + * msd[i]/=c[i] * - * if ndim == 1: - */ - __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); - - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] + * return msdmj # <<<<<<<<<<<<<< * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1155 * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) - */ - __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - - /* "View.MemoryView":1156 - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: */ - __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); - if (__pyx_t_2) { - __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); - } - __pyx_t_3 = (__pyx_t_2 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L5_bool_binop_done:; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_msdmj); + __pyx_r = ((PyObject *)__pyx_v_msdmj); + goto __pyx_L0; - /* "View.MemoryView":1155 + /* "newanalysis/helpers/diffusion.pyx":241 + * return msd * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, */ - if (__pyx_t_1) { - /* "View.MemoryView":1157 - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): - */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.diffusion.msdMJ", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_mj); + __Pyx_XDECREF((PyObject *)__pyx_v_msdmj); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1155 +/* "newanalysis/helpers/diffusion.pyx":311 * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, */ - goto __pyx_L4; - } - /* "View.MemoryView":1159 - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1160 - * else: - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< - * src_data += src_stride - * dst_data += dst_stride +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9diffusion_11msdMJCharges(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9diffusion_10msdMJCharges, "\n msdMJCharges(coms_cat, coms_an, maxlen=None, charge_cat=None, charge_an=None)\n\n Takes two center-of-mass arrays of the whole unfolded trajectory, one for cations, the other for anions.\n Multiplies CoM by charge. Cations and Anions can have different n_residues\n\n Usage:\n msdmj = msdMJCharges(coms_cat, coms_an)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_11msdMJCharges = {"msdMJCharges", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9diffusion_11msdMJCharges, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_10msdMJCharges}; +static PyObject *__pyx_pw_11newanalysis_9diffusion_11msdMJCharges(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_coms_cat = 0; + PyArrayObject *__pyx_v_coms_an = 0; + PyObject *__pyx_v_maxlen = 0; + PyObject *__pyx_v_charge_cat = 0; + PyObject *__pyx_v_charge_an = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("msdMJCharges (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 311, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms_cat,&__pyx_n_s_coms_an,&__pyx_n_s_maxlen,&__pyx_n_s_charge_cat,&__pyx_n_s_charge_an,0}; + + /* "newanalysis/helpers/diffusion.pyx":314 + * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, + * maxlen=None, # <<<<<<<<<<<<<< + * charge_cat=None, + * charge_an=None): */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); - /* "View.MemoryView":1161 - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * else: + /* "newanalysis/helpers/diffusion.pyx":315 + * np.ndarray[np.float64_t,ndim=3] coms_an, + * maxlen=None, + * charge_cat=None, # <<<<<<<<<<<<<< + * charge_an=None): + * """ */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); - /* "View.MemoryView":1162 - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): + /* "newanalysis/helpers/diffusion.pyx":316 + * maxlen=None, + * charge_cat=None, + * charge_an=None): # <<<<<<<<<<<<<< + * """ + * msdMJCharges(coms_cat, coms_an, maxlen=None, charge_cat=None, charge_an=None) */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms_cat)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 311, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms_an)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 311, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("msdMJCharges", 0, 2, 5, 1); __PYX_ERR(0, 311, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 311, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charge_cat); + if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 311, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charge_an); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 311, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "msdMJCharges") < 0)) __PYX_ERR(0, 311, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - __pyx_L4:; - - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - */ - goto __pyx_L3; + __pyx_v_coms_cat = ((PyArrayObject *)values[0]); + __pyx_v_coms_an = ((PyArrayObject *)values[1]); + __pyx_v_maxlen = values[2]; + __pyx_v_charge_cat = values[3]; + __pyx_v_charge_an = values[4]; } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("msdMJCharges", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 311, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.diffusion.msdMJCharges", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_cat), __pyx_ptype_5numpy_ndarray, 1, "coms_cat", 0))) __PYX_ERR(0, 312, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_an), __pyx_ptype_5numpy_ndarray, 1, "coms_an", 0))) __PYX_ERR(0, 313, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9diffusion_10msdMJCharges(__pyx_self, __pyx_v_coms_cat, __pyx_v_coms_an, __pyx_v_maxlen, __pyx_v_charge_cat, __pyx_v_charge_an); + + /* "newanalysis/helpers/diffusion.pyx":311 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_9diffusion_10msdMJCharges(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyObject *__pyx_v_maxlen, PyObject *__pyx_v_charge_cat, PyObject *__pyx_v_charge_an) { + int __pyx_v_n1; + int __pyx_v_n2; + int __pyx_v_m; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_c1; + int __pyx_v_c2; + int __pyx_v_n4; + int __pyx_v_upper; + int __pyx_v_lower; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_result; + double *__pyx_v_shorter; + double *__pyx_v_longer; + long __pyx_v_ccat; + long __pyx_v_can; + PyArrayObject *__pyx_v_mj = 0; + double *__pyx_v_cmj; + PyArrayObject *__pyx_v_msdmj = 0; + double *__pyx_v_msd; + PyArrayObject *__pyx_v_ctr = 0; + int *__pyx_v_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_an; + __Pyx_Buffer __pyx_pybuffer_coms_an; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_cat; + __Pyx_Buffer __pyx_pybuffer_coms_cat; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mj; + __Pyx_Buffer __pyx_pybuffer_mj; + __Pyx_LocalBuf_ND __pyx_pybuffernd_msdmj; + __Pyx_Buffer __pyx_pybuffer_msdmj; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + char *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + long __pyx_t_18; + int __pyx_t_19; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("msdMJCharges", 0); + __pyx_pybuffer_mj.pybuffer.buf = NULL; + __pyx_pybuffer_mj.refcount = 0; + __pyx_pybuffernd_mj.data = NULL; + __pyx_pybuffernd_mj.rcbuffer = &__pyx_pybuffer_mj; + __pyx_pybuffer_msdmj.pybuffer.buf = NULL; + __pyx_pybuffer_msdmj.refcount = 0; + __pyx_pybuffernd_msdmj.data = NULL; + __pyx_pybuffernd_msdmj.rcbuffer = &__pyx_pybuffer_msdmj; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_coms_cat.pybuffer.buf = NULL; + __pyx_pybuffer_coms_cat.refcount = 0; + __pyx_pybuffernd_coms_cat.data = NULL; + __pyx_pybuffernd_coms_cat.rcbuffer = &__pyx_pybuffer_coms_cat; + __pyx_pybuffer_coms_an.pybuffer.buf = NULL; + __pyx_pybuffer_coms_an.refcount = 0; + __pyx_pybuffernd_coms_an.data = NULL; + __pyx_pybuffernd_coms_an.rcbuffer = &__pyx_pybuffer_coms_an; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_cat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 311, __pyx_L1_error) + } + __pyx_pybuffernd_coms_cat.diminfo[0].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_cat.diminfo[0].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_cat.diminfo[1].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_cat.diminfo[1].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_cat.diminfo[2].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_cat.diminfo[2].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_an, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 311, __pyx_L1_error) + } + __pyx_pybuffernd_coms_an.diminfo[0].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_an.diminfo[0].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_an.diminfo[1].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_an.diminfo[1].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_an.diminfo[2].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_an.diminfo[2].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[2]; + + /* "newanalysis/helpers/diffusion.pyx":332 + * cdef double *longer + * + * n1 = len(coms_cat) # n_frames # <<<<<<<<<<<<<< + * n2 = len(coms_cat[0]) # n_residues + * n4 = len(coms_an[0]) + */ + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coms_cat)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 332, __pyx_L1_error) + __pyx_v_n1 = __pyx_t_1; + + /* "newanalysis/helpers/diffusion.pyx":333 + * + * n1 = len(coms_cat) # n_frames + * n2 = len(coms_cat[0]) # n_residues # <<<<<<<<<<<<<< + * n4 = len(coms_an[0]) + * if charge_cat is None: + */ + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_cat), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n2 = __pyx_t_1; + + /* "newanalysis/helpers/diffusion.pyx":334 + * n1 = len(coms_cat) # n_frames + * n2 = len(coms_cat[0]) # n_residues + * n4 = len(coms_an[0]) # <<<<<<<<<<<<<< + * if charge_cat is None: + * ccat = 1 + */ + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_an), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n4 = __pyx_t_1; - /* "View.MemoryView":1164 - * dst_data += dst_stride + /* "newanalysis/helpers/diffusion.pyx":335 + * n2 = len(coms_cat[0]) # n_residues + * n4 = len(coms_an[0]) + * if charge_cat is None: # <<<<<<<<<<<<<< + * ccat = 1 * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * _copy_strided_to_strided(src_data, src_strides + 1, - * dst_data, dst_strides + 1, */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_3 = (__pyx_v_charge_cat == Py_None); + if (__pyx_t_3) { - /* "View.MemoryView":1165 + /* "newanalysis/helpers/diffusion.pyx":336 + * n4 = len(coms_an[0]) + * if charge_cat is None: + * ccat = 1 # <<<<<<<<<<<<<< * else: - * for i in range(dst_extent): - * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< - * dst_data, dst_strides + 1, - * src_shape + 1, dst_shape + 1, + * ccat = charge_cat */ - _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + __pyx_v_ccat = 1; - /* "View.MemoryView":1169 - * src_shape + 1, dst_shape + 1, - * ndim - 1, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * + /* "newanalysis/helpers/diffusion.pyx":335 + * n2 = len(coms_cat[0]) # n_residues + * n4 = len(coms_an[0]) + * if charge_cat is None: # <<<<<<<<<<<<<< + * ccat = 1 + * else: */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + goto __pyx_L3; + } - /* "View.MemoryView":1170 - * ndim - 1, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":338 + * ccat = 1 + * else: + * ccat = charge_cat # <<<<<<<<<<<<<< * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, + * if charge_an is None: */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } + /*else*/ { + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_charge_cat); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L1_error) + __pyx_v_ccat = ((int)__pyx_t_4); } __pyx_L3:; - /* "View.MemoryView":1142 + /* "newanalysis/helpers/diffusion.pyx":340 + * ccat = charge_cat * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + * if charge_an is None: # <<<<<<<<<<<<<< + * can = -1 + * else: */ + __pyx_t_3 = (__pyx_v_charge_an == Py_None); + if (__pyx_t_3) { - /* function exit code */ -} - -/* "View.MemoryView":1172 - * dst_data += dst_stride + /* "newanalysis/helpers/diffusion.pyx":341 * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + * if charge_an is None: + * can = -1 # <<<<<<<<<<<<<< + * else: + * can = charge_an */ + __pyx_v_can = -1L; -static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - - /* "View.MemoryView":1175 - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: - * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< - * src.shape, dst.shape, ndim, itemsize) + /* "newanalysis/helpers/diffusion.pyx":340 + * ccat = charge_cat * + * if charge_an is None: # <<<<<<<<<<<<<< + * can = -1 + * else: */ - _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + goto __pyx_L4; + } - /* "View.MemoryView":1172 - * dst_data += dst_stride + /* "newanalysis/helpers/diffusion.pyx":343 + * can = -1 + * else: + * can = charge_an # <<<<<<<<<<<<<< * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + * if maxlen is None: */ + /*else*/ { + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_charge_an); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_v_can = ((int)__pyx_t_4); + } + __pyx_L4:; - /* function exit code */ -} - -/* "View.MemoryView":1179 + /* "newanalysis/helpers/diffusion.pyx":345 + * can = charge_an * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * if maxlen is None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ + __pyx_t_3 = (__pyx_v_maxlen == Py_None); + if (__pyx_t_3) { -static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_size; - Py_ssize_t __pyx_r; - Py_ssize_t __pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - - /* "View.MemoryView":1181 - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":346 * - * for shape in src.shape[:ndim]: + * if maxlen is None: + * m = n1 # <<<<<<<<<<<<<< + * else: + * m = maxlen */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_size = __pyx_t_1; + __pyx_v_m = __pyx_v_n1; - /* "View.MemoryView":1183 - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - * - * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< - * size *= shape + /* "newanalysis/helpers/diffusion.pyx":345 + * can = charge_an * + * if maxlen is None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ - __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); - for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_shape = (__pyx_t_2[0]); + goto __pyx_L5; + } - /* "View.MemoryView":1184 - * - * for shape in src.shape[:ndim]: - * size *= shape # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":348 + * m = n1 + * else: + * m = maxlen # <<<<<<<<<<<<<< * - * return size + * if n2 > n4: */ - __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + /*else*/ { + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 348, __pyx_L1_error) + __pyx_v_m = ((int)__pyx_t_4); } + __pyx_L5:; - /* "View.MemoryView":1186 - * size *= shape - * - * return size # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":350 + * m = maxlen * - * @cname('__pyx_fill_contig_strides_array') + * if n2 > n4: # <<<<<<<<<<<<<< + * shorter = coms_an.data + * longer = coms_cat.data */ - __pyx_r = __pyx_v_size; - goto __pyx_L0; + __pyx_t_3 = (__pyx_v_n2 > __pyx_v_n4); + if (__pyx_t_3) { - /* "View.MemoryView":1179 + /* "newanalysis/helpers/diffusion.pyx":351 * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * if n2 > n4: + * shorter = coms_an.data # <<<<<<<<<<<<<< + * longer = coms_cat.data + * upper = n2 */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coms_an)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 351, __pyx_L1_error) + __pyx_v_shorter = ((double *)__pyx_t_5); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} + /* "newanalysis/helpers/diffusion.pyx":352 + * if n2 > n4: + * shorter = coms_an.data + * longer = coms_cat.data # <<<<<<<<<<<<<< + * upper = n2 + * lower = n4 + */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coms_cat)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error) + __pyx_v_longer = ((double *)__pyx_t_5); -/* "View.MemoryView":1189 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + /* "newanalysis/helpers/diffusion.pyx":353 + * shorter = coms_an.data + * longer = coms_cat.data + * upper = n2 # <<<<<<<<<<<<<< + * lower = n4 + * c1 = can */ + __pyx_v_upper = __pyx_v_n2; -static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { - int __pyx_v_idx; - Py_ssize_t __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; + /* "newanalysis/helpers/diffusion.pyx":354 + * longer = coms_cat.data + * upper = n2 + * lower = n4 # <<<<<<<<<<<<<< + * c1 = can + * c2 = ccat + */ + __pyx_v_lower = __pyx_v_n4; - /* "View.MemoryView":1198 - * cdef int idx - * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride + /* "newanalysis/helpers/diffusion.pyx":355 + * upper = n2 + * lower = n4 + * c1 = can # <<<<<<<<<<<<<< + * c2 = ccat + * elif n2 < n4: */ - __pyx_t_1 = ((__pyx_v_order == 'F') != 0); - if (__pyx_t_1) { + __pyx_v_c1 = __pyx_v_can; + + /* "newanalysis/helpers/diffusion.pyx":356 + * lower = n4 + * c1 = can + * c2 = ccat # <<<<<<<<<<<<<< + * elif n2 < n4: + * shorter = coms_cat.data + */ + __pyx_v_c2 = __pyx_v_ccat; - /* "View.MemoryView":1199 + /* "newanalysis/helpers/diffusion.pyx":350 + * m = maxlen * - * if order == 'F': - * for idx in range(ndim): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] + * if n2 > n4: # <<<<<<<<<<<<<< + * shorter = coms_an.data + * longer = coms_cat.data */ - __pyx_t_2 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_idx = __pyx_t_4; + goto __pyx_L6; + } - /* "View.MemoryView":1200 - * if order == 'F': - * for idx in range(ndim): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * else: + /* "newanalysis/helpers/diffusion.pyx":357 + * c1 = can + * c2 = ccat + * elif n2 < n4: # <<<<<<<<<<<<<< + * shorter = coms_cat.data + * longer = coms_an.data */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + __pyx_t_3 = (__pyx_v_n2 < __pyx_v_n4); + if (__pyx_t_3) { - /* "View.MemoryView":1201 - * for idx in range(ndim): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * else: - * for idx in range(ndim - 1, -1, -1): + /* "newanalysis/helpers/diffusion.pyx":358 + * c2 = ccat + * elif n2 < n4: + * shorter = coms_cat.data # <<<<<<<<<<<<<< + * longer = coms_an.data + * upper = n4 */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coms_cat)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 358, __pyx_L1_error) + __pyx_v_shorter = ((double *)__pyx_t_5); - /* "View.MemoryView":1198 - * cdef int idx - * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride + /* "newanalysis/helpers/diffusion.pyx":359 + * elif n2 < n4: + * shorter = coms_cat.data + * longer = coms_an.data # <<<<<<<<<<<<<< + * upper = n4 + * lower = n2 */ - goto __pyx_L3; - } + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coms_an)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L1_error) + __pyx_v_longer = ((double *)__pyx_t_5); - /* "View.MemoryView":1203 - * stride *= shape[idx] - * else: - * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] + /* "newanalysis/helpers/diffusion.pyx":360 + * shorter = coms_cat.data + * longer = coms_an.data + * upper = n4 # <<<<<<<<<<<<<< + * lower = n2 + * c2 = can */ - /*else*/ { - for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { - __pyx_v_idx = __pyx_t_2; + __pyx_v_upper = __pyx_v_n4; - /* "View.MemoryView":1204 - * else: - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * + /* "newanalysis/helpers/diffusion.pyx":361 + * longer = coms_an.data + * upper = n4 + * lower = n2 # <<<<<<<<<<<<<< + * c2 = can + * c1 = ccat */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + __pyx_v_lower = __pyx_v_n2; - /* "View.MemoryView":1205 - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * - * return stride + /* "newanalysis/helpers/diffusion.pyx":362 + * upper = n4 + * lower = n2 + * c2 = can # <<<<<<<<<<<<<< + * c1 = ccat + * elif n2 == n4: */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } - } - __pyx_L3:; + __pyx_v_c2 = __pyx_v_can; - /* "View.MemoryView":1207 - * stride *= shape[idx] - * - * return stride # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_data_to_temp') + /* "newanalysis/helpers/diffusion.pyx":363 + * lower = n2 + * c2 = can + * c1 = ccat # <<<<<<<<<<<<<< + * elif n2 == n4: + * print("WARNING: same number of cation/anion species. Use msdMJ instead.") */ - __pyx_r = __pyx_v_stride; - goto __pyx_L0; + __pyx_v_c1 = __pyx_v_ccat; - /* "View.MemoryView":1189 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + /* "newanalysis/helpers/diffusion.pyx":357 + * c1 = can + * c2 = ccat + * elif n2 < n4: # <<<<<<<<<<<<<< + * shorter = coms_cat.data + * longer = coms_an.data */ + goto __pyx_L6; + } - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} + /* "newanalysis/helpers/diffusion.pyx":364 + * c2 = can + * c1 = ccat + * elif n2 == n4: # <<<<<<<<<<<<<< + * print("WARNING: same number of cation/anion species. Use msdMJ instead.") + * + */ + __pyx_t_3 = (__pyx_v_n2 == __pyx_v_n4); + if (__pyx_t_3) { -/* "View.MemoryView":1210 + /* "newanalysis/helpers/diffusion.pyx":365 + * c1 = ccat + * elif n2 == n4: + * print("WARNING: same number of cation/anion species. Use msdMJ instead.") # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) */ + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; -static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { - int __pyx_v_i; - void *__pyx_v_result; - size_t __pyx_v_itemsize; - size_t __pyx_v_size; - void *__pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - struct __pyx_memoryview_obj *__pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - - /* "View.MemoryView":1221 - * cdef void *result - * - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef size_t size = slice_get_size(src, ndim) + /* "newanalysis/helpers/diffusion.pyx":364 + * c2 = can + * c1 = ccat + * elif n2 == n4: # <<<<<<<<<<<<<< + * print("WARNING: same number of cation/anion species. Use msdMJ instead.") * */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; + } + __pyx_L6:; - /* "View.MemoryView":1222 + /* "newanalysis/helpers/diffusion.pyx":367 + * print("WARNING: same number of cation/anion species. Use msdMJ instead.") * - * cdef size_t itemsize = src.memview.view.itemsize - * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *cmj = mj.data * - * result = malloc(size) */ - __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_3)) __PYX_ERR(0, 367, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_mj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 367, __pyx_L1_error) + } else {__pyx_pybuffernd_mj.diminfo[0].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj.diminfo[0].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj.diminfo[1].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj.diminfo[1].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_10 = 0; + __pyx_v_mj = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; - /* "View.MemoryView":1224 - * cdef size_t size = slice_get_size(src, ndim) + /* "newanalysis/helpers/diffusion.pyx":368 * - * result = malloc(size) # <<<<<<<<<<<<<< - * if not result: - * _err(MemoryError, NULL) + * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) + * cdef double *cmj = mj.data # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) */ - __pyx_v_result = malloc(__pyx_v_size); + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_mj)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_v_cmj = ((double *)__pyx_t_5); - /* "View.MemoryView":1225 + /* "newanalysis/helpers/diffusion.pyx":370 + * cdef double *cmj = mj.data * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *msd = msdmj.data * */ - __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0); - if (__pyx_t_2) { + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9)) __PYX_ERR(0, 370, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_msdmj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 370, __pyx_L1_error) + } else {__pyx_pybuffernd_msdmj.diminfo[0].strides = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msdmj.diminfo[0].shape = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_11 = 0; + __pyx_v_msdmj = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; - /* "View.MemoryView":1226 - * result = malloc(size) - * if not result: - * _err(MemoryError, NULL) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":371 * + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) + * cdef double *msd = msdmj.data # <<<<<<<<<<<<<< * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) */ - __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1226, __pyx_L1_error) + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_msdmj)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 371, __pyx_L1_error) + __pyx_v_msd = ((double *)__pyx_t_5); - /* "View.MemoryView":1225 + /* "newanalysis/helpers/diffusion.pyx":373 + * cdef double *msd = msdmj.data * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< + * cdef int *c = ctr.data * */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8)) __PYX_ERR(0, 373, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 373, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_6); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 373, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; + } } + __pyx_t_12 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; - /* "View.MemoryView":1229 + /* "newanalysis/helpers/diffusion.pyx":374 * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * cdef int *c = ctr.data # <<<<<<<<<<<<<< * - * tmpslice.data = result # <<<<<<<<<<<<<< - * tmpslice.memview = src.memview - * for i in range(ndim): + * for i in prange(n1,nogil=True): */ - __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L1_error) + __pyx_v_c = ((int *)__pyx_t_5); - /* "View.MemoryView":1230 + /* "newanalysis/helpers/diffusion.pyx":376 + * cdef int *c = ctr.data * - * tmpslice.data = result - * tmpslice.memview = src.memview # <<<<<<<<<<<<<< - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - */ - __pyx_t_4 = __pyx_v_src->memview; - __pyx_v_tmpslice->memview = __pyx_t_4; - - /* "View.MemoryView":1231 - * tmpslice.data = result - * tmpslice.memview = src.memview - * for i in range(ndim): # <<<<<<<<<<<<<< - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(lower): + * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_n1; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_14 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_14 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) + #endif /* _OPENMP */ + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_13); + /* Initialize private variables to invalid values */ + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); - /* "View.MemoryView":1232 - * tmpslice.memview = src.memview - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< - * tmpslice.suboffsets[i] = -1 + /* "newanalysis/helpers/diffusion.pyx":377 * + * for i in prange(n1,nogil=True): + * for j in range(lower): # <<<<<<<<<<<<<< + * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) + * cmj[i*3+1] += c1*(shorter[i*lower*3+3*j+1]) */ - (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + __pyx_t_15 = __pyx_v_lower; + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_j = __pyx_t_17; - /* "View.MemoryView":1233 - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, - */ - (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; - } - - /* "View.MemoryView":1235 - * tmpslice.suboffsets[i] = -1 - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< - * ndim, order) - * + /* "newanalysis/helpers/diffusion.pyx":378 + * for i in prange(n1,nogil=True): + * for j in range(lower): + * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) # <<<<<<<<<<<<<< + * cmj[i*3+1] += c1*(shorter[i*lower*3+3*j+1]) + * cmj[i*3+2] += c1*(shorter[i*lower*3+3*j+2]) */ - (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + __pyx_t_18 = (__pyx_v_i * 3); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c1 * (__pyx_v_shorter[(((__pyx_v_i * __pyx_v_lower) * 3) + (3 * __pyx_v_j))]))); - /* "View.MemoryView":1239 - * - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 + /* "newanalysis/helpers/diffusion.pyx":379 + * for j in range(lower): + * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) + * cmj[i*3+1] += c1*(shorter[i*lower*3+3*j+1]) # <<<<<<<<<<<<<< + * cmj[i*3+2] += c1*(shorter[i*lower*3+3*j+2]) + * for k in range(upper): */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_18 = ((__pyx_v_i * 3) + 1); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c1 * (__pyx_v_shorter[((((__pyx_v_i * __pyx_v_lower) * 3) + (3 * __pyx_v_j)) + 1)]))); - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * + /* "newanalysis/helpers/diffusion.pyx":380 + * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) + * cmj[i*3+1] += c1*(shorter[i*lower*3+3*j+1]) + * cmj[i*3+2] += c1*(shorter[i*lower*3+3*j+2]) # <<<<<<<<<<<<<< + * for k in range(upper): + * cmj[i*3] += c2*(longer[i*upper*3+3*k]) */ - __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { + __pyx_t_18 = ((__pyx_v_i * 3) + 2); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c1 * (__pyx_v_shorter[((((__pyx_v_i * __pyx_v_lower) * 3) + (3 * __pyx_v_j)) + 2)]))); + } - /* "View.MemoryView":1241 - * for i in range(ndim): - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< - * - * if slice_is_contig(src[0], order, ndim): + /* "newanalysis/helpers/diffusion.pyx":381 + * cmj[i*3+1] += c1*(shorter[i*lower*3+3*j+1]) + * cmj[i*3+2] += c1*(shorter[i*lower*3+3*j+2]) + * for k in range(upper): # <<<<<<<<<<<<<< + * cmj[i*3] += c2*(longer[i*upper*3+3*k]) + * cmj[i*3+1] += c2*(longer[i*upper*3+3*k+1]) */ - (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + __pyx_t_15 = __pyx_v_upper; + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_k = __pyx_t_17; - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * + /* "newanalysis/helpers/diffusion.pyx":382 + * cmj[i*3+2] += c1*(shorter[i*lower*3+3*j+2]) + * for k in range(upper): + * cmj[i*3] += c2*(longer[i*upper*3+3*k]) # <<<<<<<<<<<<<< + * cmj[i*3+1] += c2*(longer[i*upper*3+3*k+1]) + * cmj[i*3+2] += c2*(longer[i*upper*3+3*k+2]) */ - } - } + __pyx_t_18 = (__pyx_v_i * 3); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c2 * (__pyx_v_longer[(((__pyx_v_i * __pyx_v_upper) * 3) + (3 * __pyx_v_k))]))); - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 + /* "newanalysis/helpers/diffusion.pyx":383 + * for k in range(upper): + * cmj[i*3] += c2*(longer[i*upper*3+3*k]) + * cmj[i*3+1] += c2*(longer[i*upper*3+3*k+1]) # <<<<<<<<<<<<<< + * cmj[i*3+2] += c2*(longer[i*upper*3+3*k+2]) * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: */ - __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_18 = ((__pyx_v_i * 3) + 1); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c2 * (__pyx_v_longer[((((__pyx_v_i * __pyx_v_upper) * 3) + (3 * __pyx_v_k)) + 1)]))); - /* "View.MemoryView":1244 + /* "newanalysis/helpers/diffusion.pyx":384 + * cmj[i*3] += c2*(longer[i*upper*3+3*k]) + * cmj[i*3+1] += c2*(longer[i*upper*3+3*k+1]) + * cmj[i*3+2] += c2*(longer[i*upper*3+3*k+2]) # <<<<<<<<<<<<<< * - * if slice_is_contig(src[0], order, ndim): - * memcpy(result, src.data, size) # <<<<<<<<<<<<<< - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * for i in prange(m,nogil=True): */ - (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + __pyx_t_18 = ((__pyx_v_i * 3) + 2); + (__pyx_v_cmj[__pyx_t_18]) = ((__pyx_v_cmj[__pyx_t_18]) + (__pyx_v_c2 * (__pyx_v_longer[((((__pyx_v_i * __pyx_v_upper) * 3) + (3 * __pyx_v_k)) + 2)]))); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 + /* "newanalysis/helpers/diffusion.pyx":376 + * cdef int *c = ctr.data * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(lower): + * cmj[i*3] += c1*(shorter[i*lower*3+3*j]) */ - goto __pyx_L9; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L9; + } + __pyx_L9:; + } } - /* "View.MemoryView":1246 - * memcpy(result, src.data, size) - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":386 + * cmj[i*3+2] += c2*(longer[i*upper*3+3*k+2]) * - * return result + * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< + * for j in range(m-i): + * dx = cmj[j*3] - cmj[(j+i)*3] */ - /*else*/ { - copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); - } - __pyx_L9:; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_14 = __pyx_v_m; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_4 = (__pyx_t_14 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_4 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_19) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_result) + #endif /* _OPENMP */ + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_4; __pyx_t_13++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_13); + /* Initialize private variables to invalid values */ + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_result = ((double)__PYX_NAN()); - /* "View.MemoryView":1248 - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) - * - * return result # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/diffusion.pyx":387 * + * for i in prange(m,nogil=True): + * for j in range(m-i): # <<<<<<<<<<<<<< + * dx = cmj[j*3] - cmj[(j+i)*3] + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; + __pyx_t_15 = (__pyx_v_m - __pyx_v_i); + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_j = __pyx_t_17; - /* "View.MemoryView":1210 - * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + /* "newanalysis/helpers/diffusion.pyx":388 + * for i in prange(m,nogil=True): + * for j in range(m-i): + * dx = cmj[j*3] - cmj[(j+i)*3] # <<<<<<<<<<<<<< + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] */ + __pyx_v_dx = ((__pyx_v_cmj[(__pyx_v_j * 3)]) - (__pyx_v_cmj[((__pyx_v_j + __pyx_v_i) * 3)])); - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = NULL; - __pyx_L0:; - return __pyx_r; -} + /* "newanalysis/helpers/diffusion.pyx":389 + * for j in range(m-i): + * dx = cmj[j*3] - cmj[(j+i)*3] + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] # <<<<<<<<<<<<<< + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] + * result = dx*dx+dy*dy+dz*dz + */ + __pyx_v_dy = ((__pyx_v_cmj[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); -/* "View.MemoryView":1253 - * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + /* "newanalysis/helpers/diffusion.pyx":390 + * dx = cmj[j*3] - cmj[(j+i)*3] + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] # <<<<<<<<<<<<<< + * result = dx*dx+dy*dy+dz*dz + * msd[i]+=result */ + __pyx_v_dz = ((__pyx_v_cmj[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); -static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_extents", 0); + /* "newanalysis/helpers/diffusion.pyx":391 + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] + * result = dx*dx+dy*dy+dz*dz # <<<<<<<<<<<<<< + * msd[i]+=result + * c[i]+=1 + */ + __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); - /* "View.MemoryView":1256 - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % - * (i, extent1, extent2)) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":392 + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] + * result = dx*dx+dy*dy+dz*dz + * msd[i]+=result # <<<<<<<<<<<<<< + * c[i]+=1 * - * @cname('__pyx_memoryview_err_dim') */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; + __pyx_t_19 = __pyx_v_i; + (__pyx_v_msd[__pyx_t_19]) = ((__pyx_v_msd[__pyx_t_19]) + __pyx_v_result); - /* "View.MemoryView":1255 - * cdef int _err_extents(int i, Py_ssize_t extent1, - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<< - * (i, extent1, extent2)) + /* "newanalysis/helpers/diffusion.pyx":393 + * result = dx*dx+dy*dy+dz*dz + * msd[i]+=result + * c[i]+=1 # <<<<<<<<<<<<<< * + * for i in range(m): */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 1255, __pyx_L1_error) + __pyx_t_19 = __pyx_v_i; + (__pyx_v_c[__pyx_t_19]) = ((__pyx_v_c[__pyx_t_19]) + 1); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1253 + /* "newanalysis/helpers/diffusion.pyx":386 + * cmj[i*3+2] += c2*(longer[i*upper*3+3*k+2]) * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< + * for j in range(m-i): + * dx = cmj[j*3] - cmj[(j+i)*3] */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L22; + } + __pyx_L22:; + } + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1259 + /* "newanalysis/helpers/diffusion.pyx":395 + * c[i]+=1 * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) + * for i in range(m): # <<<<<<<<<<<<<< + * msd[i]/=c[i] * */ + __pyx_t_4 = __pyx_v_m; + __pyx_t_13 = __pyx_t_4; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_i = __pyx_t_14; -static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_dim", 0); - __Pyx_INCREF(__pyx_v_error); - - /* "View.MemoryView":1260 - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: - * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":396 * - * @cname('__pyx_memoryview_err') + * for i in range(m): + * msd[i]/=c[i] # <<<<<<<<<<<<<< + * + * return msdmj */ - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_v_error); - __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_15 = __pyx_v_i; + if (unlikely((__pyx_v_c[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 396, __pyx_L1_error) } + (__pyx_v_msd[__pyx_t_15]) = ((__pyx_v_msd[__pyx_t_15]) / (__pyx_v_c[__pyx_v_i])); } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 1260, __pyx_L1_error) - /* "View.MemoryView":1259 + /* "newanalysis/helpers/diffusion.pyx":398 + * msd[i]/=c[i] + * + * return msdmj # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_msdmj); + __pyx_r = ((PyObject *)__pyx_v_msdmj); + goto __pyx_L0; + + /* "newanalysis/helpers/diffusion.pyx":311 * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.diffusion.msdMJCharges", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_mj); + __Pyx_XDECREF((PyObject *)__pyx_v_msdmj); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif return __pyx_r; } -/* "View.MemoryView":1263 +/* "newanalysis/helpers/diffusion.pyx":400 + * return msdmj * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossDisplacementMdMj(double [:, :, :] coms_cat, + * double [:, :, :] coms_an, */ -static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9diffusion_13crossDisplacementMdMj(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_13crossDisplacementMdMj = {"crossDisplacementMdMj", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9diffusion_13crossDisplacementMdMj, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_9diffusion_13crossDisplacementMdMj(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coms_cat = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coms_an = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_md = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("crossDisplacementMdMj (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 400, __pyx_L3_error) #endif - __Pyx_RefNannySetupContext("_err", 0); - __Pyx_INCREF(__pyx_v_error); - - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: - */ - __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":1265 - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: - * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< - * else: - * raise error - */ - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_error); - __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms_cat,&__pyx_n_s_coms_an,&__pyx_n_s_md,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms_cat)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms_an)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("crossDisplacementMdMj", 1, 3, 3, 1); __PYX_ERR(0, 400, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_md)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("crossDisplacementMdMj", 1, 3, 3, 2); __PYX_ERR(0, 400, __pyx_L3_error) + } } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "crossDisplacementMdMj") < 0)) __PYX_ERR(0, 400, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 1265, __pyx_L1_error) - - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: - */ + __pyx_v_coms_cat = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms_cat.memview)) __PYX_ERR(0, 401, __pyx_L3_error) + __pyx_v_coms_an = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms_an.memview)) __PYX_ERR(0, 402, __pyx_L3_error) + __pyx_v_md = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_md.memview)) __PYX_ERR(0, 403, __pyx_L3_error) } - - /* "View.MemoryView":1267 - * raise error(msg.decode('ascii')) - * else: - * raise error # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_contents') - */ - /*else*/ { - __Pyx_Raise(__pyx_v_error, 0, 0, 0); - __PYX_ERR(2, 1267, __pyx_L1_error) + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("crossDisplacementMdMj", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 400, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - - /* "View.MemoryView":1263 - * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) - */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms_cat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms_an, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_md, 1); + __Pyx_AddTraceback("newanalysis.diffusion.crossDisplacementMdMj", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_9diffusion_12crossDisplacementMdMj(__pyx_self, __pyx_v_coms_cat, __pyx_v_coms_an, __pyx_v_md); /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms_cat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms_an, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_md, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif return __pyx_r; } -/* "View.MemoryView":1270 - * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ - -static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { - void *__pyx_v_tmpdata; - size_t __pyx_v_itemsize; +static PyObject *__pyx_pf_11newanalysis_9diffusion_12crossDisplacementMdMj(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coms_cat, __Pyx_memviewslice __pyx_v_coms_an, __Pyx_memviewslice __pyx_v_md) { int __pyx_v_i; - char __pyx_v_order; - int __pyx_v_broadcasting; - int __pyx_v_direct_copy; - __Pyx_memviewslice __pyx_v_tmp; - int __pyx_v_ndim; - int __pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - void *__pyx_t_7; + int __pyx_v_j; + int __pyx_v_nts; + int __pyx_v_nion; + PyObject *__pyx_v_mj_arr = NULL; + __Pyx_memviewslice __pyx_v_mj = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_ctr_arr = NULL; + __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_disp_arr = NULL; + __Pyx_memviewslice __pyx_v_disp = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_result; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_t_8; + __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("crossDisplacementMdMj", 0); - /* "View.MemoryView":1278 - * Check for overlapping memory and verify the shapes. - * """ - * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - */ - __pyx_v_tmpdata = NULL; - - /* "View.MemoryView":1279 - * """ - * cdef void *tmpdata = NULL - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - */ - __pyx_t_1 = __pyx_v_src.memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":1281 - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< - * cdef bint broadcasting = False - * cdef bint direct_copy = False + /* "newanalysis/helpers/diffusion.pyx":405 + * double [:, :] md): + * + * cdef int i, j, nts=coms_cat.shape[0], nion=coms_cat.shape[1] # <<<<<<<<<<<<<< + * + * mj_arr = cython.view.array(shape=(nts,3), itemsize=sizeof(double), format="d") */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + __pyx_v_nts = (__pyx_v_coms_cat.shape[0]); + __pyx_v_nion = (__pyx_v_coms_cat.shape[1]); - /* "View.MemoryView":1282 - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False # <<<<<<<<<<<<<< - * cdef bint direct_copy = False - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/diffusion.pyx":407 + * cdef int i, j, nts=coms_cat.shape[0], nion=coms_cat.shape[1] + * + * mj_arr = cython.view.array(shape=(nts,3), itemsize=sizeof(double), format="d") # <<<<<<<<<<<<<< + * cdef double [:, :] mj = mj_arr + * ctr_arr = np.zeros(nts, dtype=np.int32) */ - __pyx_v_broadcasting = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3)) __PYX_ERR(0, 407, __pyx_L1_error); + __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_3) < 0) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_mj_arr = __pyx_t_3; + __pyx_t_3 = 0; - /* "View.MemoryView":1283 - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False - * cdef bint direct_copy = False # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/diffusion.pyx":408 * + * mj_arr = cython.view.array(shape=(nts,3), itemsize=sizeof(double), format="d") + * cdef double [:, :] mj = mj_arr # <<<<<<<<<<<<<< + * ctr_arr = np.zeros(nts, dtype=np.int32) + * cdef int [:] ctr = ctr_arr */ - __pyx_v_direct_copy = 0; + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_mj_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 408, __pyx_L1_error) + __pyx_v_mj = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp - * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: + /* "newanalysis/helpers/diffusion.pyx":409 + * mj_arr = cython.view.array(shape=(nts,3), itemsize=sizeof(double), format="d") + * cdef double [:, :] mj = mj_arr + * ctr_arr = np.zeros(nts, dtype=np.int32) # <<<<<<<<<<<<<< + * cdef int [:] ctr = ctr_arr + * disp_arr = np.zeros(nts) */ - __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0); - if (__pyx_t_2) { + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_ctr_arr = __pyx_t_6; + __pyx_t_6 = 0; - /* "View.MemoryView":1287 - * - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) + /* "newanalysis/helpers/diffusion.pyx":410 + * cdef double [:, :] mj = mj_arr + * ctr_arr = np.zeros(nts, dtype=np.int32) + * cdef int [:] ctr = ctr_arr # <<<<<<<<<<<<<< + * disp_arr = np.zeros(nts) + * cdef double [:] disp = disp_arr */ - __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_ctr_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 410, __pyx_L1_error) + __pyx_v_ctr = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/diffusion.pyx":411 + * ctr_arr = np.zeros(nts, dtype=np.int32) + * cdef int [:] ctr = ctr_arr + * disp_arr = np.zeros(nts) # <<<<<<<<<<<<<< + * cdef double [:] disp = disp_arr * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: */ - goto __pyx_L3; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_3}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_v_disp_arr = __pyx_t_6; + __pyx_t_6 = 0; - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) + /* "newanalysis/helpers/diffusion.pyx":412 + * cdef int [:] ctr = ctr_arr + * disp_arr = np.zeros(nts) + * cdef double [:] disp = disp_arr # <<<<<<<<<<<<<< * + * cdef double dx, dy, dz, result */ - __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_disp_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 412, __pyx_L1_error) + __pyx_v_disp = __pyx_t_9; + __pyx_t_9.memview = NULL; + __pyx_t_9.data = NULL; - /* "View.MemoryView":1289 - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":416 + * cdef double dx, dy, dz, result * - * cdef int ndim = max(src_ndim, dst_ndim) - */ - __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - */ - } - __pyx_L3:; - - /* "View.MemoryView":1291 - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * - * for i in range(ndim): - */ - __pyx_t_3 = __pyx_v_dst_ndim; - __pyx_t_4 = __pyx_v_src_ndim; - if (((__pyx_t_3 > __pyx_t_4) != 0)) { - __pyx_t_5 = __pyx_t_3; - } else { - __pyx_t_5 = __pyx_t_4; - } - __pyx_v_ndim = __pyx_t_5; - - /* "View.MemoryView":1293 - * cdef int ndim = max(src_ndim, dst_ndim) - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: + * for i in prange(nts, nogil=True): # <<<<<<<<<<<<<< + * for j in range(nion): + * mj[i][0] += coms_cat[i][j][0] */ - __pyx_t_5 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_5; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_8 = __pyx_v_nts; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_11 = (__pyx_t_8 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_11 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) + #endif /* _OPENMP */ + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_10); + /* Initialize private variables to invalid values */ + __pyx_v_j = ((int)0xbad0bad0); - /* "View.MemoryView":1294 + /* "newanalysis/helpers/diffusion.pyx":417 * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + * for i in prange(nts, nogil=True): + * for j in range(nion): # <<<<<<<<<<<<<< + * mj[i][0] += coms_cat[i][j][0] + * mj[i][1] += coms_cat[i][j][1] */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0); - if (__pyx_t_2) { + __pyx_t_12 = __pyx_v_nion; + __pyx_t_13 = __pyx_t_12; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_j = __pyx_t_14; - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/helpers/diffusion.pyx":418 + * for i in prange(nts, nogil=True): + * for j in range(nion): + * mj[i][0] += coms_cat[i][j][0] # <<<<<<<<<<<<<< + * mj[i][1] += coms_cat[i][j][1] + * mj[i][2] += coms_cat[i][j][2] */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = __pyx_v_j; + __pyx_t_17 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_cat.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_cat.shape[1]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_cat.shape[2]; + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_18 * __pyx_v_mj.strides[0]) ) + __pyx_t_19 * __pyx_v_mj.strides[1]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_cat.data + __pyx_t_15 * __pyx_v_coms_cat.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_cat.strides[1]) ) + __pyx_t_17 * __pyx_v_coms_cat.strides[2]) ))); - /* "View.MemoryView":1296 - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - * broadcasting = True # <<<<<<<<<<<<<< - * src.strides[i] = 0 - * else: + /* "newanalysis/helpers/diffusion.pyx":419 + * for j in range(nion): + * mj[i][0] += coms_cat[i][j][0] + * mj[i][1] += coms_cat[i][j][1] # <<<<<<<<<<<<<< + * mj[i][2] += coms_cat[i][j][2] + * mj[i][0] -= coms_an[i][j][0] */ - __pyx_v_broadcasting = 1; + __pyx_t_17 = __pyx_v_i; + __pyx_t_16 = __pyx_v_j; + __pyx_t_15 = 1; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_cat.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_cat.shape[1]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_cat.shape[2]; + __pyx_t_19 = __pyx_v_i; + __pyx_t_18 = 1; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_19 * __pyx_v_mj.strides[0]) ) + __pyx_t_18 * __pyx_v_mj.strides[1]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_cat.data + __pyx_t_17 * __pyx_v_coms_cat.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_cat.strides[1]) ) + __pyx_t_15 * __pyx_v_coms_cat.strides[2]) ))); - /* "View.MemoryView":1297 - * if src.shape[i] == 1: - * broadcasting = True - * src.strides[i] = 0 # <<<<<<<<<<<<<< - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) + /* "newanalysis/helpers/diffusion.pyx":420 + * mj[i][0] += coms_cat[i][j][0] + * mj[i][1] += coms_cat[i][j][1] + * mj[i][2] += coms_cat[i][j][2] # <<<<<<<<<<<<<< + * mj[i][0] -= coms_an[i][j][0] + * mj[i][1] -= coms_an[i][j][1] */ - (__pyx_v_src.strides[__pyx_v_i]) = 0; + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = __pyx_v_j; + __pyx_t_17 = 2; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_cat.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_cat.shape[1]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_cat.shape[2]; + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = 2; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_18 * __pyx_v_mj.strides[0]) ) + __pyx_t_19 * __pyx_v_mj.strides[1]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_cat.data + __pyx_t_15 * __pyx_v_coms_cat.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_cat.strides[1]) ) + __pyx_t_17 * __pyx_v_coms_cat.strides[2]) ))); - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/helpers/diffusion.pyx":421 + * mj[i][1] += coms_cat[i][j][1] + * mj[i][2] += coms_cat[i][j][2] + * mj[i][0] -= coms_an[i][j][0] # <<<<<<<<<<<<<< + * mj[i][1] -= coms_an[i][j][1] + * mj[i][2] -= coms_an[i][j][2] */ - goto __pyx_L7; - } + __pyx_t_17 = __pyx_v_i; + __pyx_t_16 = __pyx_v_j; + __pyx_t_15 = 0; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_an.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_an.shape[1]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_an.shape[2]; + __pyx_t_19 = __pyx_v_i; + __pyx_t_18 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_19 * __pyx_v_mj.strides[0]) ) + __pyx_t_18 * __pyx_v_mj.strides[1]) )) -= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_an.data + __pyx_t_17 * __pyx_v_coms_an.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_an.strides[1]) ) + __pyx_t_15 * __pyx_v_coms_an.strides[2]) ))); - /* "View.MemoryView":1299 - * src.strides[i] = 0 - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":422 + * mj[i][2] += coms_cat[i][j][2] + * mj[i][0] -= coms_an[i][j][0] + * mj[i][1] -= coms_an[i][j][1] # <<<<<<<<<<<<<< + * mj[i][2] -= coms_an[i][j][2] * - * if src.suboffsets[i] >= 0: */ - /*else*/ { - __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1299, __pyx_L1_error) - } - __pyx_L7:; + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = __pyx_v_j; + __pyx_t_17 = 1; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_an.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_an.shape[1]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_an.shape[2]; + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = 1; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_18 * __pyx_v_mj.strides[0]) ) + __pyx_t_19 * __pyx_v_mj.strides[1]) )) -= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_an.data + __pyx_t_15 * __pyx_v_coms_an.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_an.strides[1]) ) + __pyx_t_17 * __pyx_v_coms_an.strides[2]) ))); - /* "View.MemoryView":1294 + /* "newanalysis/helpers/diffusion.pyx":423 + * mj[i][0] -= coms_an[i][j][0] + * mj[i][1] -= coms_an[i][j][1] + * mj[i][2] -= coms_an[i][j][2] # <<<<<<<<<<<<<< * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + * for i in prange(nts, nogil=True): */ - } + __pyx_t_17 = __pyx_v_i; + __pyx_t_16 = __pyx_v_j; + __pyx_t_15 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms_an.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms_an.shape[1]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms_an.shape[2]; + __pyx_t_19 = __pyx_v_i; + __pyx_t_18 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_mj.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_19 * __pyx_v_mj.strides[0]) ) + __pyx_t_18 * __pyx_v_mj.strides[1]) )) -= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms_an.data + __pyx_t_17 * __pyx_v_coms_an.strides[0]) ) + __pyx_t_16 * __pyx_v_coms_an.strides[1]) ) + __pyx_t_15 * __pyx_v_coms_an.strides[2]) ))); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) + /* "newanalysis/helpers/diffusion.pyx":416 + * cdef double dx, dy, dz, result * + * for i in prange(nts, nogil=True): # <<<<<<<<<<<<<< + * for j in range(nion): + * mj[i][0] += coms_cat[i][j][0] */ - __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0); - if (__pyx_t_2) { + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } - /* "View.MemoryView":1302 - * - * if src.suboffsets[i] >= 0: - * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":425 + * mj[i][2] -= coms_an[i][j][2] * - * if slices_overlap(&src, &dst, ndim, itemsize): + * for i in prange(nts, nogil=True): # <<<<<<<<<<<<<< + * for j in range(nts-i): + * dx = md[j][0] - mj[i+j][0] */ - __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1302, __pyx_L1_error) - - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - */ - } - } - - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): - */ - __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0); - if (__pyx_t_2) { + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_11 = __pyx_v_nts; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_8 = (__pyx_t_11 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_8 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_result) + #endif /* _OPENMP */ + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_8; __pyx_t_10++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_10); + /* Initialize private variables to invalid values */ + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_result = ((double)__PYX_NAN()); - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) + /* "newanalysis/helpers/diffusion.pyx":426 * + * for i in prange(nts, nogil=True): + * for j in range(nts-i): # <<<<<<<<<<<<<< + * dx = md[j][0] - mj[i+j][0] + * dy = md[j][1] - mj[i+j][1] */ - __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_12 = (__pyx_v_nts - __pyx_v_i); + __pyx_t_13 = __pyx_t_12; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_j = __pyx_t_14; - /* "View.MemoryView":1307 - * - * if not slice_is_contig(src, order, ndim): - * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + /* "newanalysis/helpers/diffusion.pyx":427 + * for i in prange(nts, nogil=True): + * for j in range(nts-i): + * dx = md[j][0] - mj[i+j][0] # <<<<<<<<<<<<<< + * dy = md[j][1] - mj[i+j][1] + * dz = md[j][2] - mj[i+j][2] */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + __pyx_t_15 = __pyx_v_j; + __pyx_t_16 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_md.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_md.shape[1]; + __pyx_t_17 = (__pyx_v_i + __pyx_v_j); + __pyx_t_18 = 0; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_mj.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_md.data + __pyx_t_15 * __pyx_v_md.strides[0]) ) + __pyx_t_16 * __pyx_v_md.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_17 * __pyx_v_mj.strides[0]) ) + __pyx_t_18 * __pyx_v_mj.strides[1]) )))); - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * + /* "newanalysis/helpers/diffusion.pyx":428 + * for j in range(nts-i): + * dx = md[j][0] - mj[i+j][0] + * dy = md[j][1] - mj[i+j][1] # <<<<<<<<<<<<<< + * dz = md[j][2] - mj[i+j][2] + * result = dx*dx + dy*dy + dz*dz */ - } + __pyx_t_18 = __pyx_v_j; + __pyx_t_17 = 1; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_md.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_md.shape[1]; + __pyx_t_16 = (__pyx_v_i + __pyx_v_j); + __pyx_t_15 = 1; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_mj.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_mj.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_md.data + __pyx_t_18 * __pyx_v_md.strides[0]) ) + __pyx_t_17 * __pyx_v_md.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_16 * __pyx_v_mj.strides[0]) ) + __pyx_t_15 * __pyx_v_mj.strides[1]) )))); - /* "View.MemoryView":1309 - * order = get_best_order(&dst, ndim) - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< - * src = tmp - * + /* "newanalysis/helpers/diffusion.pyx":429 + * dx = md[j][0] - mj[i+j][0] + * dy = md[j][1] - mj[i+j][1] + * dz = md[j][2] - mj[i+j][2] # <<<<<<<<<<<<<< + * result = dx*dx + dy*dy + dz*dz + * disp[i] = disp[i] + result */ - __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1309, __pyx_L1_error) - __pyx_v_tmpdata = __pyx_t_7; + __pyx_t_15 = __pyx_v_j; + __pyx_t_16 = 2; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_md.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_md.shape[1]; + __pyx_t_17 = (__pyx_v_i + __pyx_v_j); + __pyx_t_18 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_mj.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_mj.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_md.data + __pyx_t_15 * __pyx_v_md.strides[0]) ) + __pyx_t_16 * __pyx_v_md.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mj.data + __pyx_t_17 * __pyx_v_mj.strides[0]) ) + __pyx_t_18 * __pyx_v_mj.strides[1]) )))); - /* "View.MemoryView":1310 - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) - * src = tmp # <<<<<<<<<<<<<< - * - * if not broadcasting: + /* "newanalysis/helpers/diffusion.pyx":430 + * dy = md[j][1] - mj[i+j][1] + * dz = md[j][2] - mj[i+j][2] + * result = dx*dx + dy*dy + dz*dz # <<<<<<<<<<<<<< + * disp[i] = disp[i] + result + * ctr[i] = ctr[i] + 1 */ - __pyx_v_src = __pyx_v_tmp; + __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): + /* "newanalysis/helpers/diffusion.pyx":431 + * dz = md[j][2] - mj[i+j][2] + * result = dx*dx + dy*dy + dz*dz + * disp[i] = disp[i] + result # <<<<<<<<<<<<<< + * ctr[i] = ctr[i] + 1 + * disp[i] /= ctr[i] */ - } + __pyx_t_18 = __pyx_v_i; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_disp.shape[0]; + __pyx_t_17 = __pyx_v_i; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_disp.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_17 * __pyx_v_disp.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_18 * __pyx_v_disp.strides[0]) ))) + __pyx_v_result); - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/diffusion.pyx":432 + * result = dx*dx + dy*dy + dz*dz + * disp[i] = disp[i] + result + * ctr[i] = ctr[i] + 1 # <<<<<<<<<<<<<< + * disp[i] /= ctr[i] * */ - __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_18 = __pyx_v_i; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[0]; + __pyx_t_17 = __pyx_v_i; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_ctr.shape[0]; + *((int *) ( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_17 * __pyx_v_ctr.strides[0]) )) = ((*((int *) ( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_18 * __pyx_v_ctr.strides[0]) ))) + 1); + } - /* "View.MemoryView":1315 - * + /* "newanalysis/helpers/diffusion.pyx":433 + * disp[i] = disp[i] + result + * ctr[i] = ctr[i] + 1 + * disp[i] /= ctr[i] # <<<<<<<<<<<<<< * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + * return disp_arr */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_18 = __pyx_v_i; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[0]; + __pyx_t_17 = __pyx_v_i; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_disp.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_17 * __pyx_v_disp.strides[0]) )) /= (*((int *) ( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_18 * __pyx_v_ctr.strides[0]) ))); + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1316 + /* "newanalysis/helpers/diffusion.pyx":425 + * mj[i][2] -= coms_an[i][j][2] * - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) + * for i in prange(nts, nogil=True): # <<<<<<<<<<<<<< + * for j in range(nts-i): + * dx = md[j][0] - mj[i+j][0] */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L16; + } + __pyx_L16:; + } + } - /* "View.MemoryView":1315 + /* "newanalysis/helpers/diffusion.pyx":435 + * disp[i] /= ctr[i] * + * return disp_arr # <<<<<<<<<<<<<< * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + * @cython.boundscheck(False) */ - goto __pyx_L12; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_disp_arr); + __pyx_r = __pyx_v_disp_arr; + goto __pyx_L0; - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/helpers/diffusion.pyx":400 + * return msdmj * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossDisplacementMdMj(double [:, :, :] coms_cat, + * double [:, :, :] coms_an, */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1318 - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1); + __Pyx_AddTraceback("newanalysis.diffusion.crossDisplacementMdMj", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_mj_arr); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mj, 1); + __Pyx_XDECREF(__pyx_v_ctr_arr); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ctr, 1); + __Pyx_XDECREF(__pyx_v_disp_arr); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_disp, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/diffusion.pyx":437 + * return disp_arr * - * if direct_copy: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJdecomp(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - */ - } - __pyx_L12:; - - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - */ - __pyx_t_2 = (__pyx_v_direct_copy != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1322 - * if direct_copy: - * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1323 - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) - */ - (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - - /* "View.MemoryView":1324 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * free(tmpdata) - * return 0 - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - - /* "View.MemoryView":1325 - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 - * - */ - free(__pyx_v_tmpdata); - - /* "View.MemoryView":1326 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< - * - * if order == 'F' == get_best_order(&dst, ndim): - */ - __pyx_r = 0; - goto __pyx_L0; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9diffusion_15msdMJdecomp(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9diffusion_14msdMJdecomp, "\n msdMJdecomp(coms_cat, coms_an, coms_sep, charge, maxlen=None)\n\n Calculates part of total autocorrelation, namely .\n\n Takes three center-of-mass arrays of the whole unfolded trajectory, one for cations, the second for anions,\n the third of the separate species and an integer that specifies the charge of the separate species.\n\n Usage:\n msdmj = msdMJdecomp(coms_cat, coms_an, coms_sep, charge)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_15msdMJdecomp = {"msdMJdecomp", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9diffusion_15msdMJdecomp, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_14msdMJdecomp}; +static PyObject *__pyx_pw_11newanalysis_9diffusion_15msdMJdecomp(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_coms_cat = 0; + PyArrayObject *__pyx_v_coms_an = 0; + PyArrayObject *__pyx_v_coms_sep = 0; + int __pyx_v_charge; + PyObject *__pyx_v_maxlen = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("msdMJdecomp (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 437, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms_cat,&__pyx_n_s_coms_an,&__pyx_n_s_coms_sep,&__pyx_n_s_charge,&__pyx_n_s_maxlen,0}; - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) + /* "newanalysis/helpers/diffusion.pyx":442 + * np.ndarray[np.float64_t,ndim=3] coms_sep, + * int charge, + * maxlen=None): # <<<<<<<<<<<<<< + * """ + * msdMJdecomp(coms_cat, coms_an, coms_sep, charge, maxlen=None) */ + values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms_cat)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms_an)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("msdMJdecomp", 0, 4, 5, 1); __PYX_ERR(0, 437, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms_sep)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("msdMJdecomp", 0, 4, 5, 2); __PYX_ERR(0, 437, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charge)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("msdMJdecomp", 0, 4, 5, 3); __PYX_ERR(0, 437, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "msdMJdecomp") < 0)) __PYX_ERR(0, 437, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } - - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * - * - */ - } - - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = (__pyx_v_order == 'F'); - if (__pyx_t_2) { - __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + __pyx_v_coms_cat = ((PyArrayObject *)values[0]); + __pyx_v_coms_an = ((PyArrayObject *)values[1]); + __pyx_v_coms_sep = ((PyArrayObject *)values[2]); + __pyx_v_charge = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_charge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) + __pyx_v_maxlen = values[4]; } - __pyx_t_8 = (__pyx_t_2 != 0); - if (__pyx_t_8) { - - /* "View.MemoryView":1331 - * - * - * transpose_memslice(&src) # <<<<<<<<<<<<<< - * transpose_memslice(&dst) - * - */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1331, __pyx_L1_error) - - /* "View.MemoryView":1332 - * - * transpose_memslice(&src) - * transpose_memslice(&dst) # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1332, __pyx_L1_error) - - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * - */ + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("msdMJdecomp", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 437, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_AddTraceback("newanalysis.diffusion.msdMJdecomp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_cat), __pyx_ptype_5numpy_ndarray, 1, "coms_cat", 0))) __PYX_ERR(0, 438, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_an), __pyx_ptype_5numpy_ndarray, 1, "coms_an", 0))) __PYX_ERR(0, 439, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_sep), __pyx_ptype_5numpy_ndarray, 1, "coms_sep", 0))) __PYX_ERR(0, 440, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9diffusion_14msdMJdecomp(__pyx_self, __pyx_v_coms_cat, __pyx_v_coms_an, __pyx_v_coms_sep, __pyx_v_charge, __pyx_v_maxlen); - /* "View.MemoryView":1334 - * transpose_memslice(&dst) - * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1335 - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) - * - */ - copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - - /* "View.MemoryView":1336 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * - * free(tmpdata) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - - /* "View.MemoryView":1338 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 - * - */ - free(__pyx_v_tmpdata); - - /* "View.MemoryView":1339 - * - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_broadcast_leading') - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":1270 + /* "newanalysis/helpers/diffusion.pyx":437 + * return disp_arr * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJdecomp(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_r = -1; - __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1342 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: - */ - -static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { +static PyObject *__pyx_pf_11newanalysis_9diffusion_14msdMJdecomp(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_cat, PyArrayObject *__pyx_v_coms_an, PyArrayObject *__pyx_v_coms_sep, int __pyx_v_charge, PyObject *__pyx_v_maxlen) { + int __pyx_v_n1; + int __pyx_v_n2; + int __pyx_v_n3; + int __pyx_v_m; int __pyx_v_i; - int __pyx_v_offset; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - - /* "View.MemoryView":1346 - * int ndim_other) nogil: - * cdef int i - * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): - */ - __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - - /* "View.MemoryView":1348 - * cdef int offset = ndim_other - ndim - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; + int __pyx_v_j; + int __pyx_v_ch; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_dxs; + double __pyx_v_dys; + double __pyx_v_dzs; + double __pyx_v_result; + double *__pyx_v_cat; + double *__pyx_v_an; + double *__pyx_v_sep; + PyArrayObject *__pyx_v_mj = 0; + double *__pyx_v_cmj; + PyArrayObject *__pyx_v_mj_sep = 0; + double *__pyx_v_cmj_sep; + PyArrayObject *__pyx_v_msdmj = 0; + double *__pyx_v_msd; + PyArrayObject *__pyx_v_ctr = 0; + int *__pyx_v_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_an; + __Pyx_Buffer __pyx_pybuffer_coms_an; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_cat; + __Pyx_Buffer __pyx_pybuffer_coms_cat; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_sep; + __Pyx_Buffer __pyx_pybuffer_coms_sep; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mj; + __Pyx_Buffer __pyx_pybuffer_mj; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mj_sep; + __Pyx_Buffer __pyx_pybuffer_mj_sep; + __Pyx_LocalBuf_ND __pyx_pybuffernd_msdmj; + __Pyx_Buffer __pyx_pybuffer_msdmj; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + char *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + long __pyx_t_19; + int __pyx_t_20; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("msdMJdecomp", 0); + __pyx_pybuffer_mj.pybuffer.buf = NULL; + __pyx_pybuffer_mj.refcount = 0; + __pyx_pybuffernd_mj.data = NULL; + __pyx_pybuffernd_mj.rcbuffer = &__pyx_pybuffer_mj; + __pyx_pybuffer_mj_sep.pybuffer.buf = NULL; + __pyx_pybuffer_mj_sep.refcount = 0; + __pyx_pybuffernd_mj_sep.data = NULL; + __pyx_pybuffernd_mj_sep.rcbuffer = &__pyx_pybuffer_mj_sep; + __pyx_pybuffer_msdmj.pybuffer.buf = NULL; + __pyx_pybuffer_msdmj.refcount = 0; + __pyx_pybuffernd_msdmj.data = NULL; + __pyx_pybuffernd_msdmj.rcbuffer = &__pyx_pybuffer_msdmj; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_coms_cat.pybuffer.buf = NULL; + __pyx_pybuffer_coms_cat.refcount = 0; + __pyx_pybuffernd_coms_cat.data = NULL; + __pyx_pybuffernd_coms_cat.rcbuffer = &__pyx_pybuffer_coms_cat; + __pyx_pybuffer_coms_an.pybuffer.buf = NULL; + __pyx_pybuffer_coms_an.refcount = 0; + __pyx_pybuffernd_coms_an.data = NULL; + __pyx_pybuffernd_coms_an.rcbuffer = &__pyx_pybuffer_coms_an; + __pyx_pybuffer_coms_sep.pybuffer.buf = NULL; + __pyx_pybuffer_coms_sep.refcount = 0; + __pyx_pybuffernd_coms_sep.data = NULL; + __pyx_pybuffernd_coms_sep.rcbuffer = &__pyx_pybuffer_coms_sep; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_cat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 437, __pyx_L1_error) + } + __pyx_pybuffernd_coms_cat.diminfo[0].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_cat.diminfo[0].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_cat.diminfo[1].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_cat.diminfo[1].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_cat.diminfo[2].strides = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_cat.diminfo[2].shape = __pyx_pybuffernd_coms_cat.rcbuffer->pybuffer.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_an, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 437, __pyx_L1_error) + } + __pyx_pybuffernd_coms_an.diminfo[0].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_an.diminfo[0].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_an.diminfo[1].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_an.diminfo[1].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_an.diminfo[2].strides = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_an.diminfo[2].shape = __pyx_pybuffernd_coms_an.rcbuffer->pybuffer.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_sep.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_sep, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 437, __pyx_L1_error) + } + __pyx_pybuffernd_coms_sep.diminfo[0].strides = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_sep.diminfo[0].shape = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_sep.diminfo[1].strides = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_sep.diminfo[1].shape = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_sep.diminfo[2].strides = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_sep.diminfo[2].shape = __pyx_pybuffernd_coms_sep.rcbuffer->pybuffer.shape[2]; - /* "View.MemoryView":1349 + /* "newanalysis/helpers/diffusion.pyx":458 + * cdef double dx,dy,dz,dxs,dys,dzs,result * - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - */ - (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - - /* "View.MemoryView":1350 - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * ch = charge # <<<<<<<<<<<<<< * + * n1 = len(coms_cat) */ - (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + __pyx_v_ch = __pyx_v_charge; - /* "View.MemoryView":1351 - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":460 + * ch = charge * - * for i in range(offset): + * n1 = len(coms_cat) # <<<<<<<<<<<<<< + * n2 = len(coms_cat[0]) + * n3 = len(coms_sep[0]) */ - (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); - } + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coms_cat)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 460, __pyx_L1_error) + __pyx_v_n1 = __pyx_t_1; - /* "View.MemoryView":1353 - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + /* "newanalysis/helpers/diffusion.pyx":461 * - * for i in range(offset): # <<<<<<<<<<<<<< - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - */ - __pyx_t_1 = __pyx_v_offset; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "View.MemoryView":1354 + * n1 = len(coms_cat) + * n2 = len(coms_cat[0]) # <<<<<<<<<<<<<< + * n3 = len(coms_sep[0]) * - * for i in range(offset): - * mslice.shape[i] = 1 # <<<<<<<<<<<<<< - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 */ - (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_cat), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n2 = __pyx_t_1; - /* "View.MemoryView":1355 - * for i in range(offset): - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< - * mslice.suboffsets[i] = -1 + /* "newanalysis/helpers/diffusion.pyx":462 + * n1 = len(coms_cat) + * n2 = len(coms_cat[0]) + * n3 = len(coms_sep[0]) # <<<<<<<<<<<<<< * + * if maxlen == None: */ - (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_sep), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n3 = __pyx_t_1; - /* "View.MemoryView":1356 - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/diffusion.pyx":464 + * n3 = len(coms_sep[0]) * + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ - (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; - } + __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { - /* "View.MemoryView":1342 + /* "newanalysis/helpers/diffusion.pyx":465 * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: + * if maxlen == None: + * m = n1 # <<<<<<<<<<<<<< + * else: + * m = maxlen */ + __pyx_v_m = __pyx_v_n1; - /* function exit code */ -} - -/* "View.MemoryView":1364 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: + /* "newanalysis/helpers/diffusion.pyx":464 + * n3 = len(coms_sep[0]) * + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ + goto __pyx_L3; + } -static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - int __pyx_t_1; - - /* "View.MemoryView":1368 - * + /* "newanalysis/helpers/diffusion.pyx":467 + * m = n1 + * else: + * m = maxlen # <<<<<<<<<<<<<< * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) + * cdef double *cat = coms_cat.data */ - __pyx_t_1 = (__pyx_v_dtype_is_object != 0); - if (__pyx_t_1) { + /*else*/ { + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 467, __pyx_L1_error) + __pyx_v_m = ((int)__pyx_t_4); + } + __pyx_L3:; - /* "View.MemoryView":1369 - * - * if dtype_is_object: - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< - * dst.strides, ndim, inc) + /* "newanalysis/helpers/diffusion.pyx":469 + * m = maxlen * + * cdef double *cat = coms_cat.data # <<<<<<<<<<<<<< + * cdef double *an = coms_an.data + * cdef double *sep = coms_sep.data */ - __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coms_cat)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 469, __pyx_L1_error) + __pyx_v_cat = ((double *)__pyx_t_5); - /* "View.MemoryView":1368 + /* "newanalysis/helpers/diffusion.pyx":470 * + * cdef double *cat = coms_cat.data + * cdef double *an = coms_an.data # <<<<<<<<<<<<<< + * cdef double *sep = coms_sep.data * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) */ - } + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coms_an)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_v_an = ((double *)__pyx_t_5); - /* "View.MemoryView":1364 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: + /* "newanalysis/helpers/diffusion.pyx":471 + * cdef double *cat = coms_cat.data + * cdef double *an = coms_an.data + * cdef double *sep = coms_sep.data # <<<<<<<<<<<<<< * + * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coms_sep)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 471, __pyx_L1_error) + __pyx_v_sep = ((double *)__pyx_t_5); - /* function exit code */ -} - -/* "View.MemoryView":1373 + /* "newanalysis/helpers/diffusion.pyx":473 + * cdef double *sep = coms_sep.data * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - */ - -static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - __Pyx_RefNannyDeclarations - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - - /* "View.MemoryView":1376 - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *cmj = mj.data * - * @cname('__pyx_memoryview_refcount_objects_in_slice') */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_3)) __PYX_ERR(0, 473, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7)) __PYX_ERR(0, 473, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 473, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 473, __pyx_L1_error) + __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_mj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 473, __pyx_L1_error) + } else {__pyx_pybuffernd_mj.diminfo[0].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj.diminfo[0].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj.diminfo[1].strides = __pyx_pybuffernd_mj.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj.diminfo[1].shape = __pyx_pybuffernd_mj.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_10 = 0; + __pyx_v_mj = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; - /* "View.MemoryView":1373 + /* "newanalysis/helpers/diffusion.pyx":474 * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif -} - -/* "View.MemoryView":1379 + * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) + * cdef double *cmj = mj.data # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i + * cdef np.ndarray[np.float64_t,ndim=2] mj_sep = np.zeros((n1,3),dtype=np.float64) */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_mj)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 474, __pyx_L1_error) + __pyx_v_cmj = ((double *)__pyx_t_5); -static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - - /* "View.MemoryView":1383 - * cdef Py_ssize_t i + /* "newanalysis/helpers/diffusion.pyx":476 + * cdef double *cmj = mj.data * - * for i in range(shape[0]): # <<<<<<<<<<<<<< - * if ndim == 1: - * if inc: - */ - __pyx_t_1 = (__pyx_v_shape[0]); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "View.MemoryView":1384 + * cdef np.ndarray[np.float64_t,ndim=2] mj_sep = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *cmj_sep = mj_sep.data * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) - */ - __pyx_t_4 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: - */ - __pyx_t_4 = (__pyx_v_inc != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":1386 - * if ndim == 1: - * if inc: - * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * Py_DECREF(( data)[0]) - */ - Py_INCREF((((PyObject **)__pyx_v_data)[0])); - - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: */ - goto __pyx_L6; - } + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9)) __PYX_ERR(0, 476, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_3)) __PYX_ERR(0, 476, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj_sep.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_mj_sep = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj_sep.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 476, __pyx_L1_error) + } else {__pyx_pybuffernd_mj_sep.diminfo[0].strides = __pyx_pybuffernd_mj_sep.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj_sep.diminfo[0].shape = __pyx_pybuffernd_mj_sep.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj_sep.diminfo[1].strides = __pyx_pybuffernd_mj_sep.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj_sep.diminfo[1].shape = __pyx_pybuffernd_mj_sep.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_11 = 0; + __pyx_v_mj_sep = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; - /* "View.MemoryView":1388 - * Py_INCREF(( data)[0]) - * else: - * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, + /* "newanalysis/helpers/diffusion.pyx":477 + * + * cdef np.ndarray[np.float64_t,ndim=2] mj_sep = np.zeros((n1,3),dtype=np.float64) + * cdef double *cmj_sep = mj_sep.data # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) */ - /*else*/ { - Py_DECREF((((PyObject **)__pyx_v_data)[0])); - } - __pyx_L6:; + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_mj_sep)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L1_error) + __pyx_v_cmj_sep = ((double *)__pyx_t_5); - /* "View.MemoryView":1384 + /* "newanalysis/helpers/diffusion.pyx":479 + * cdef double *cmj_sep = mj_sep.data + * + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *msd = msdmj.data * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) */ - goto __pyx_L5; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8)) __PYX_ERR(0, 479, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 479, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_6); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_msdmj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 479, __pyx_L1_error) + } else {__pyx_pybuffernd_msdmj.diminfo[0].strides = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msdmj.diminfo[0].shape = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.shape[0]; } + } + __pyx_t_12 = 0; + __pyx_v_msdmj = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; - /* "View.MemoryView":1390 - * Py_DECREF(( data)[0]) - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, inc) + /* "newanalysis/helpers/diffusion.pyx":480 * - */ - /*else*/ { - - /* "View.MemoryView":1391 - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, - * ndim - 1, inc) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) + * cdef double *msd = msdmj.data # <<<<<<<<<<<<<< * - * data += strides[0] + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); - } - __pyx_L5:; + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_msdmj)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 480, __pyx_L1_error) + __pyx_v_msd = ((double *)__pyx_t_5); - /* "View.MemoryView":1393 - * ndim - 1, inc) - * - * data += strides[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":482 + * cdef double *msd = msdmj.data * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< + * cdef int *c = ctr.data * */ - __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0])); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 482, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 482, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; + } } + __pyx_t_13 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":1379 + /* "newanalysis/helpers/diffusion.pyx":483 + * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * cdef int *c = ctr.data # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":1399 * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - */ - -static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - - /* "View.MemoryView":1402 - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1403 - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L1_error) + __pyx_v_c = ((int *)__pyx_t_5); - /* "View.MemoryView":1405 - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":486 * * + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n2): + * cmj[i*3] += cat[i*n2*3+3*j] */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_n1; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_15 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_15 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) + #endif /* _OPENMP */ + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_14); + /* Initialize private variables to invalid values */ + __pyx_v_j = ((int)0xbad0bad0); - /* "View.MemoryView":1399 + /* "newanalysis/helpers/diffusion.pyx":487 * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: + * for i in prange(n1,nogil=True): + * for j in range(n2): # <<<<<<<<<<<<<< + * cmj[i*3] += cat[i*n2*3+3*j] + * cmj[i*3+1] += cat[i*n2*3+3*j+1] */ + __pyx_t_16 = __pyx_v_n2; + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_j = __pyx_t_18; - /* function exit code */ -} - -/* "View.MemoryView":1409 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: + /* "newanalysis/helpers/diffusion.pyx":488 + * for i in prange(n1,nogil=True): + * for j in range(n2): + * cmj[i*3] += cat[i*n2*3+3*j] # <<<<<<<<<<<<<< + * cmj[i*3+1] += cat[i*n2*3+3*j+1] + * cmj[i*3+2] += cat[i*n2*3+3*j+2] */ + __pyx_t_19 = (__pyx_v_i * 3); + (__pyx_v_cmj[__pyx_t_19]) = ((__pyx_v_cmj[__pyx_t_19]) + (__pyx_v_cat[(((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j))])); -static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_extent; - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; + /* "newanalysis/helpers/diffusion.pyx":489 + * for j in range(n2): + * cmj[i*3] += cat[i*n2*3+3*j] + * cmj[i*3+1] += cat[i*n2*3+3*j+1] # <<<<<<<<<<<<<< + * cmj[i*3+2] += cat[i*n2*3+3*j+2] + * cmj[i*3] -= an[i*n2*3+3*j] + */ + __pyx_t_19 = ((__pyx_v_i * 3) + 1); + (__pyx_v_cmj[__pyx_t_19]) = ((__pyx_v_cmj[__pyx_t_19]) + (__pyx_v_cat[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 1)])); - /* "View.MemoryView":1413 - * size_t itemsize, void *item) nogil: - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t extent = shape[0] - * + /* "newanalysis/helpers/diffusion.pyx":490 + * cmj[i*3] += cat[i*n2*3+3*j] + * cmj[i*3+1] += cat[i*n2*3+3*j+1] + * cmj[i*3+2] += cat[i*n2*3+3*j+2] # <<<<<<<<<<<<<< + * cmj[i*3] -= an[i*n2*3+3*j] + * cmj[i*3+1] -= an[i*n2*3+3*j+1] */ - __pyx_v_stride = (__pyx_v_strides[0]); + __pyx_t_19 = ((__pyx_v_i * 3) + 2); + (__pyx_v_cmj[__pyx_t_19]) = ((__pyx_v_cmj[__pyx_t_19]) + (__pyx_v_cat[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 2)])); - /* "View.MemoryView":1414 - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] - * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: + /* "newanalysis/helpers/diffusion.pyx":491 + * cmj[i*3+1] += cat[i*n2*3+3*j+1] + * cmj[i*3+2] += cat[i*n2*3+3*j+2] + * cmj[i*3] -= an[i*n2*3+3*j] # <<<<<<<<<<<<<< + * cmj[i*3+1] -= an[i*n2*3+3*j+1] + * cmj[i*3+2] -= an[i*n2*3+3*j+2] */ - __pyx_v_extent = (__pyx_v_shape[0]); + __pyx_t_19 = (__pyx_v_i * 3); + (__pyx_v_cmj[__pyx_t_19]) = ((__pyx_v_cmj[__pyx_t_19]) - (__pyx_v_an[(((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j))])); - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] + /* "newanalysis/helpers/diffusion.pyx":492 + * cmj[i*3+2] += cat[i*n2*3+3*j+2] + * cmj[i*3] -= an[i*n2*3+3*j] + * cmj[i*3+1] -= an[i*n2*3+3*j+1] # <<<<<<<<<<<<<< + * cmj[i*3+2] -= an[i*n2*3+3*j+2] * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { + __pyx_t_19 = ((__pyx_v_i * 3) + 1); + (__pyx_v_cmj[__pyx_t_19]) = ((__pyx_v_cmj[__pyx_t_19]) - (__pyx_v_an[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 1)])); - /* "View.MemoryView":1417 + /* "newanalysis/helpers/diffusion.pyx":493 + * cmj[i*3] -= an[i*n2*3+3*j] + * cmj[i*3+1] -= an[i*n2*3+3*j+1] + * cmj[i*3+2] -= an[i*n2*3+3*j+2] # <<<<<<<<<<<<<< * - * if ndim == 1: - * for i in range(extent): # <<<<<<<<<<<<<< - * memcpy(data, item, itemsize) - * data += stride + * for i in prange(n1,nogil=True): */ - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_19 = ((__pyx_v_i * 3) + 2); + (__pyx_v_cmj[__pyx_t_19]) = ((__pyx_v_cmj[__pyx_t_19]) - (__pyx_v_an[((((__pyx_v_i * __pyx_v_n2) * 3) + (3 * __pyx_v_j)) + 2)])); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1418 - * if ndim == 1: - * for i in range(extent): - * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< - * data += stride - * else: + /* "newanalysis/helpers/diffusion.pyx":486 + * + * + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n2): + * cmj[i*3] += cat[i*n2*3+3*j] */ - (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } + } - /* "View.MemoryView":1419 - * for i in range(extent): - * memcpy(data, item, itemsize) - * data += stride # <<<<<<<<<<<<<< - * else: - * for i in range(extent): + /* "newanalysis/helpers/diffusion.pyx":495 + * cmj[i*3+2] -= an[i*n2*3+3*j+2] + * + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n3): + * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_15 = __pyx_v_n1; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_4 = (__pyx_t_15 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_4 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) + #endif /* _OPENMP */ + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_4; __pyx_t_14++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_14); + /* Initialize private variables to invalid values */ + __pyx_v_j = ((int)0xbad0bad0); - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] + /* "newanalysis/helpers/diffusion.pyx":496 * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) + * for i in prange(n1,nogil=True): + * for j in range(n3): # <<<<<<<<<<<<<< + * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] + * cmj_sep[i*3+1]+= ch*sep[i*n3*3+3*j+1] */ - goto __pyx_L3; - } + __pyx_t_16 = __pyx_v_n3; + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_j = __pyx_t_18; - /* "View.MemoryView":1421 - * data += stride - * else: - * for i in range(extent): # <<<<<<<<<<<<<< - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) + /* "newanalysis/helpers/diffusion.pyx":497 + * for i in prange(n1,nogil=True): + * for j in range(n3): + * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] # <<<<<<<<<<<<<< + * cmj_sep[i*3+1]+= ch*sep[i*n3*3+3*j+1] + * cmj_sep[i*3+2]+= ch*sep[i*n3*3+3*j+2] */ - /*else*/ { - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_19 = (__pyx_v_i * 3); + (__pyx_v_cmj_sep[__pyx_t_19]) = ((__pyx_v_cmj_sep[__pyx_t_19]) + (__pyx_v_ch * (__pyx_v_sep[(((__pyx_v_i * __pyx_v_n3) * 3) + (3 * __pyx_v_j))]))); - /* "View.MemoryView":1422 - * else: - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, itemsize, item) - * data += stride + /* "newanalysis/helpers/diffusion.pyx":498 + * for j in range(n3): + * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] + * cmj_sep[i*3+1]+= ch*sep[i*n3*3+3*j+1] # <<<<<<<<<<<<<< + * cmj_sep[i*3+2]+= ch*sep[i*n3*3+3*j+2] + * */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + __pyx_t_19 = ((__pyx_v_i * 3) + 1); + (__pyx_v_cmj_sep[__pyx_t_19]) = ((__pyx_v_cmj_sep[__pyx_t_19]) + (__pyx_v_ch * (__pyx_v_sep[((((__pyx_v_i * __pyx_v_n3) * 3) + (3 * __pyx_v_j)) + 1)]))); - /* "View.MemoryView":1424 - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - * data += stride # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":499 + * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] + * cmj_sep[i*3+1]+= ch*sep[i*n3*3+3*j+1] + * cmj_sep[i*3+2]+= ch*sep[i*n3*3+3*j+2] # <<<<<<<<<<<<<< * * */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - } - __pyx_L3:; + __pyx_t_19 = ((__pyx_v_i * 3) + 2); + (__pyx_v_cmj_sep[__pyx_t_19]) = ((__pyx_v_cmj_sep[__pyx_t_19]) + (__pyx_v_ch * (__pyx_v_sep[((((__pyx_v_i * __pyx_v_n3) * 3) + (3 * __pyx_v_j)) + 2)]))); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1409 + /* "newanalysis/helpers/diffusion.pyx":495 + * cmj[i*3+2] -= an[i*n2*3+3*j+2] * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n3): + * cmj_sep[i*3] += ch*sep[i*n3*3+3*j] */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L17; + } + __pyx_L17:; + } + } - /* function exit code */ -} - -/* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "newanalysis/helpers/diffusion.pyx":502 + * + * + * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n1-i): + * dx = cmj[j*3] - cmj[(j+i)*3] */ - + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_m; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_15 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_15 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_20) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dxs) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dys) lastprivate(__pyx_v_dz) lastprivate(__pyx_v_dzs) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_result) + #endif /* _OPENMP */ + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_14); + /* Initialize private variables to invalid values */ + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dxs = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dys = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_dzs = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_result = ((double)__PYX_NAN()); + + /* "newanalysis/helpers/diffusion.pyx":503 + * + * for i in prange(m,nogil=True): + * for j in range(n1-i): # <<<<<<<<<<<<<< + * dx = cmj[j*3] - cmj[(j+i)*3] + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] + */ + __pyx_t_16 = (__pyx_v_n1 - __pyx_v_i); + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_j = __pyx_t_18; + + /* "newanalysis/helpers/diffusion.pyx":504 + * for i in prange(m,nogil=True): + * for j in range(n1-i): + * dx = cmj[j*3] - cmj[(j+i)*3] # <<<<<<<<<<<<<< + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] + */ + __pyx_v_dx = ((__pyx_v_cmj[(__pyx_v_j * 3)]) - (__pyx_v_cmj[((__pyx_v_j + __pyx_v_i) * 3)])); + + /* "newanalysis/helpers/diffusion.pyx":505 + * for j in range(n1-i): + * dx = cmj[j*3] - cmj[(j+i)*3] + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] # <<<<<<<<<<<<<< + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] + * + */ + __pyx_v_dy = ((__pyx_v_cmj[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); + + /* "newanalysis/helpers/diffusion.pyx":506 + * dx = cmj[j*3] - cmj[(j+i)*3] + * dy = cmj[j*3+1] - cmj[(j+i)*3+1] + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] # <<<<<<<<<<<<<< + * + * dxs= cmj_sep[j*3] - cmj_sep[(j+i)*3] + */ + __pyx_v_dz = ((__pyx_v_cmj[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); + + /* "newanalysis/helpers/diffusion.pyx":508 + * dz = cmj[j*3+2] - cmj[(j+i)*3+2] + * + * dxs= cmj_sep[j*3] - cmj_sep[(j+i)*3] # <<<<<<<<<<<<<< + * dys= cmj_sep[j*3+1] - cmj_sep[(j+i)*3+1] + * dzs= cmj_sep[j*3+2] - cmj_sep[(j+i)*3+2] + */ + __pyx_v_dxs = ((__pyx_v_cmj_sep[(__pyx_v_j * 3)]) - (__pyx_v_cmj_sep[((__pyx_v_j + __pyx_v_i) * 3)])); + + /* "newanalysis/helpers/diffusion.pyx":509 + * + * dxs= cmj_sep[j*3] - cmj_sep[(j+i)*3] + * dys= cmj_sep[j*3+1] - cmj_sep[(j+i)*3+1] # <<<<<<<<<<<<<< + * dzs= cmj_sep[j*3+2] - cmj_sep[(j+i)*3+2] + * + */ + __pyx_v_dys = ((__pyx_v_cmj_sep[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj_sep[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); + + /* "newanalysis/helpers/diffusion.pyx":510 + * dxs= cmj_sep[j*3] - cmj_sep[(j+i)*3] + * dys= cmj_sep[j*3+1] - cmj_sep[(j+i)*3+1] + * dzs= cmj_sep[j*3+2] - cmj_sep[(j+i)*3+2] # <<<<<<<<<<<<<< + * + * result = dx*dxs+dy*dys+dz*dzs + */ + __pyx_v_dzs = ((__pyx_v_cmj_sep[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj_sep[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); + + /* "newanalysis/helpers/diffusion.pyx":512 + * dzs= cmj_sep[j*3+2] - cmj_sep[(j+i)*3+2] + * + * result = dx*dxs+dy*dys+dz*dzs # <<<<<<<<<<<<<< + * msd[i]+=result + * c[i]+=1 + */ + __pyx_v_result = (((__pyx_v_dx * __pyx_v_dxs) + (__pyx_v_dy * __pyx_v_dys)) + (__pyx_v_dz * __pyx_v_dzs)); + + /* "newanalysis/helpers/diffusion.pyx":513 + * + * result = dx*dxs+dy*dys+dz*dzs + * msd[i]+=result # <<<<<<<<<<<<<< + * c[i]+=1 + * + */ + __pyx_t_20 = __pyx_v_i; + (__pyx_v_msd[__pyx_t_20]) = ((__pyx_v_msd[__pyx_t_20]) + __pyx_v_result); + + /* "newanalysis/helpers/diffusion.pyx":514 + * result = dx*dxs+dy*dys+dz*dzs + * msd[i]+=result + * c[i]+=1 # <<<<<<<<<<<<<< + * + * for i in range(m): + */ + __pyx_t_20 = __pyx_v_i; + (__pyx_v_c[__pyx_t_20]) = ((__pyx_v_c[__pyx_t_20]) + 1); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/diffusion.pyx":502 + * + * + * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n1-i): + * dx = cmj[j*3] - cmj[(j+i)*3] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L28; + } + __pyx_L28:; + } + } + + /* "newanalysis/helpers/diffusion.pyx":516 + * c[i]+=1 + * + * for i in range(m): # <<<<<<<<<<<<<< + * msd[i]/=c[i] + * + */ + __pyx_t_15 = __pyx_v_m; + __pyx_t_14 = __pyx_t_15; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_14; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "newanalysis/helpers/diffusion.pyx":517 + * + * for i in range(m): + * msd[i]/=c[i] # <<<<<<<<<<<<<< + * + * return msdmj + */ + __pyx_t_16 = __pyx_v_i; + if (unlikely((__pyx_v_c[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 517, __pyx_L1_error) + } + (__pyx_v_msd[__pyx_t_16]) = ((__pyx_v_msd[__pyx_t_16]) / (__pyx_v_c[__pyx_v_i])); + } + + /* "newanalysis/helpers/diffusion.pyx":519 + * msd[i]/=c[i] + * + * return msdmj # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_msdmj); + __pyx_r = ((PyObject *)__pyx_v_msdmj); + goto __pyx_L0; + + /* "newanalysis/helpers/diffusion.pyx":437 + * return disp_arr + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJdecomp(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_sep.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj_sep.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.diffusion.msdMJdecomp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_an.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_cat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_sep.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj_sep.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_mj); + __Pyx_XDECREF((PyObject *)__pyx_v_mj_sep); + __Pyx_XDECREF((PyObject *)__pyx_v_msdmj); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/diffusion.pyx":522 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJcrossterms(np.ndarray[np.float64_t,ndim=3] coms_s1, + * np.ndarray[np.float64_t,ndim=3] coms_s2, + */ + /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; +static PyObject *__pyx_pw_11newanalysis_9diffusion_17msdMJcrossterms(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9diffusion_16msdMJcrossterms, "\n msdMJcrossterms(coms_s1, coms_s2, charge_s1, charge_s2, maxlen=None)\n\n Calculates the MJ^2 correlation function for two arbitrary species.\n Takes two center-of-mass arrays of the whole unfolded trajectory, one for first species, the other for second species.\n\n Usage:\n msdmj = msdMJ(coms_cat, coms_an)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_17msdMJcrossterms = {"msdMJcrossterms", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9diffusion_17msdMJcrossterms, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_16msdMJcrossterms}; +static PyObject *__pyx_pw_11newanalysis_9diffusion_17msdMJcrossterms(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_coms_s1 = 0; + PyArrayObject *__pyx_v_coms_s2 = 0; + int __pyx_v_charge_s1; + int __pyx_v_charge_s2; + PyObject *__pyx_v_maxlen = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + __Pyx_RefNannySetupContext("msdMJcrossterms (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 522, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms_s1,&__pyx_n_s_coms_s2,&__pyx_n_s_charge_s1,&__pyx_n_s_charge_s2,&__pyx_n_s_maxlen,0}; + + /* "newanalysis/helpers/diffusion.pyx":527 + * int charge_s1, + * int charge_s2, + * maxlen=None): # <<<<<<<<<<<<<< + * """ + * msdMJcrossterms(coms_s1, coms_s2, charge_s1, charge_s2, maxlen=None) + */ + values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms_s1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms_s2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("msdMJcrossterms", 0, 4, 5, 1); __PYX_ERR(0, 522, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charge_s1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("msdMJcrossterms", 0, 4, 5, 2); __PYX_ERR(0, 522, __pyx_L3_error) } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charge_s2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("msdMJcrossterms", 0, 4, 5, 3); __PYX_ERR(0, 522, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "msdMJcrossterms") < 0)) __PYX_ERR(0, 522, __pyx_L3_error) + } } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } - __pyx_v___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error) - __pyx_v___pyx_state = values[2]; + __pyx_v_coms_s1 = ((PyArrayObject *)values[0]); + __pyx_v_coms_s2 = ((PyArrayObject *)values[1]); + __pyx_v_charge_s1 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_charge_s1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 525, __pyx_L3_error) + __pyx_v_charge_s2 = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_charge_s2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 526, __pyx_L3_error) + __pyx_v_maxlen = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("msdMJcrossterms", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 522, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.diffusion.msdMJcrossterms", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_s1), __pyx_ptype_5numpy_ndarray, 1, "coms_s1", 0))) __PYX_ERR(0, 523, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coms_s2), __pyx_ptype_5numpy_ndarray, 1, "coms_s2", 0))) __PYX_ERR(0, 524, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9diffusion_16msdMJcrossterms(__pyx_self, __pyx_v_coms_s1, __pyx_v_coms_s2, __pyx_v_charge_s1, __pyx_v_charge_s2, __pyx_v_maxlen); + + /* "newanalysis/helpers/diffusion.pyx":522 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJcrossterms(np.ndarray[np.float64_t,ndim=3] coms_s1, + * np.ndarray[np.float64_t,ndim=3] coms_s2, + */ /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; +static PyObject *__pyx_pf_11newanalysis_9diffusion_16msdMJcrossterms(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coms_s1, PyArrayObject *__pyx_v_coms_s2, int __pyx_v_charge_s1, int __pyx_v_charge_s2, PyObject *__pyx_v_maxlen) { + int __pyx_v_n1; + int __pyx_v_c1; + int __pyx_v_c2; + int __pyx_v_s1_n2; + int __pyx_v_s2_n2; + int __pyx_v_m; + int __pyx_v_i; + int __pyx_v_j; + double __pyx_v_dx1; + double __pyx_v_dy1; + double __pyx_v_dz1; + double __pyx_v_dx2; + double __pyx_v_dy2; + double __pyx_v_dz2; + double __pyx_v_result; + double *__pyx_v_s1; + double *__pyx_v_s2; + PyArrayObject *__pyx_v_mj1 = 0; + double *__pyx_v_cmj1; + PyArrayObject *__pyx_v_mj2 = 0; + double *__pyx_v_cmj2; + PyArrayObject *__pyx_v_msdmj = 0; + double *__pyx_v_msd; + PyArrayObject *__pyx_v_ctr = 0; + int *__pyx_v_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_s1; + __Pyx_Buffer __pyx_pybuffer_coms_s1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coms_s2; + __Pyx_Buffer __pyx_pybuffer_coms_s2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mj1; + __Pyx_Buffer __pyx_pybuffer_mj1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mj2; + __Pyx_Buffer __pyx_pybuffer_mj2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_msdmj; + __Pyx_Buffer __pyx_pybuffer_msdmj; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_4; + char *__pyx_t_5; PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + long __pyx_t_19; + int __pyx_t_20; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + __Pyx_RefNannySetupContext("msdMJcrossterms", 0); + __pyx_pybuffer_mj1.pybuffer.buf = NULL; + __pyx_pybuffer_mj1.refcount = 0; + __pyx_pybuffernd_mj1.data = NULL; + __pyx_pybuffernd_mj1.rcbuffer = &__pyx_pybuffer_mj1; + __pyx_pybuffer_mj2.pybuffer.buf = NULL; + __pyx_pybuffer_mj2.refcount = 0; + __pyx_pybuffernd_mj2.data = NULL; + __pyx_pybuffernd_mj2.rcbuffer = &__pyx_pybuffer_mj2; + __pyx_pybuffer_msdmj.pybuffer.buf = NULL; + __pyx_pybuffer_msdmj.refcount = 0; + __pyx_pybuffernd_msdmj.data = NULL; + __pyx_pybuffernd_msdmj.rcbuffer = &__pyx_pybuffer_msdmj; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_coms_s1.pybuffer.buf = NULL; + __pyx_pybuffer_coms_s1.refcount = 0; + __pyx_pybuffernd_coms_s1.data = NULL; + __pyx_pybuffernd_coms_s1.rcbuffer = &__pyx_pybuffer_coms_s1; + __pyx_pybuffer_coms_s2.pybuffer.buf = NULL; + __pyx_pybuffer_coms_s2.refcount = 0; + __pyx_pybuffernd_coms_s2.data = NULL; + __pyx_pybuffernd_coms_s2.rcbuffer = &__pyx_pybuffer_coms_s2; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_s1.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_s1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 522, __pyx_L1_error) + } + __pyx_pybuffernd_coms_s1.diminfo[0].strides = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_s1.diminfo[0].shape = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_s1.diminfo[1].strides = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_s1.diminfo[1].shape = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_s1.diminfo[2].strides = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_s1.diminfo[2].shape = __pyx_pybuffernd_coms_s1.rcbuffer->pybuffer.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coms_s2.rcbuffer->pybuffer, (PyObject*)__pyx_v_coms_s2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 522, __pyx_L1_error) + } + __pyx_pybuffernd_coms_s2.diminfo[0].strides = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coms_s2.diminfo[0].shape = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coms_s2.diminfo[1].strides = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coms_s2.diminfo[1].shape = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coms_s2.diminfo[2].strides = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coms_s2.diminfo[2].shape = __pyx_pybuffernd_coms_s2.rcbuffer->pybuffer.shape[2]; - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) + /* "newanalysis/helpers/diffusion.pyx":542 + * + * + * c1 = charge_s1 # <<<<<<<<<<<<<< + * c2 = charge_s2 + * */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__22, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_v_c1 = __pyx_v_charge_s1; - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) + /* "newanalysis/helpers/diffusion.pyx":543 + * + * c1 = charge_s1 + * c2 = charge_s2 # <<<<<<<<<<<<<< + * + * n1 = len(coms_s1) */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); - __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_c2 = __pyx_v_charge_s2; - /* "(tree fragment)":6 - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: + /* "newanalysis/helpers/diffusion.pyx":545 + * c2 = charge_s2 + * + * n1 = len(coms_s1) # <<<<<<<<<<<<<< + * s1_n2 = len(coms_s1[0]) + * s2_n2 = len(coms_s2[0]) */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_v___pyx_PickleError); - __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coms_s1)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 545, __pyx_L1_error) + __pyx_v_n1 = __pyx_t_1; - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) + /* "newanalysis/helpers/diffusion.pyx":546 + * + * n1 = len(coms_s1) + * s1_n2 = len(coms_s1[0]) # <<<<<<<<<<<<<< + * s2_n2 = len(coms_s2[0]) + * if maxlen == None: */ - } + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_s1), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_s1_n2 = __pyx_t_1; - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + /* "newanalysis/helpers/diffusion.pyx":547 + * n1 = len(coms_s1) + * s1_n2 = len(coms_s1[0]) + * s2_n2 = len(coms_s2[0]) # <<<<<<<<<<<<<< + * if maxlen == None: + * m = n1 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coms_s2), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 547, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_s2_n2 = __pyx_t_1; - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "newanalysis/helpers/diffusion.pyx":548 + * s1_n2 = len(coms_s1[0]) + * s2_n2 = len(coms_s2[0]) + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ - __pyx_t_3 = (__pyx_v___pyx_state != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { + __pyx_t_2 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 548, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { - /* "(tree fragment)":9 - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + /* "newanalysis/helpers/diffusion.pyx":549 + * s2_n2 = len(coms_s2[0]) + * if maxlen == None: + * m = n1 # <<<<<<<<<<<<<< + * else: + * m = maxlen */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_t_4 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_m = __pyx_v_n1; - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "newanalysis/helpers/diffusion.pyx":548 + * s1_n2 = len(coms_s1[0]) + * s2_n2 = len(coms_s2[0]) + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ + goto __pyx_L3; } - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] + /* "newanalysis/helpers/diffusion.pyx":551 + * m = n1 + * else: + * m = maxlen # <<<<<<<<<<<<<< + * + * cdef double *s1 = coms_s1.data */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; - goto __pyx_L0; + /*else*/ { + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 551, __pyx_L1_error) + __pyx_v_m = ((int)__pyx_t_4); + } + __pyx_L3:; - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "newanalysis/helpers/diffusion.pyx":553 + * m = maxlen + * + * cdef double *s1 = coms_s1.data # <<<<<<<<<<<<<< + * cdef double *s2 = coms_s2.data + * */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coms_s1)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 553, __pyx_L1_error) + __pyx_v_s1 = ((double *)__pyx_t_5); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + /* "newanalysis/helpers/diffusion.pyx":554 + * + * cdef double *s1 = coms_s1.data + * cdef double *s2 = coms_s2.data # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.float64_t,ndim=2] mj1 = np.zeros((n1,3),dtype=np.float64) */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coms_s2)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 554, __pyx_L1_error) + __pyx_v_s2 = ((double *)__pyx_t_5); -static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) + /* "newanalysis/helpers/diffusion.pyx":556 + * cdef double *s2 = coms_s2.data + * + * cdef np.ndarray[np.float64_t,ndim=2] mj1 = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *cmj1 = mj1.data + * */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_3)) __PYX_ERR(0, 556, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7)) __PYX_ERR(0, 556, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 556, __pyx_L1_error) + __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj1.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_mj1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj1.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 556, __pyx_L1_error) + } else {__pyx_pybuffernd_mj1.diminfo[0].strides = __pyx_pybuffernd_mj1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj1.diminfo[0].shape = __pyx_pybuffernd_mj1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj1.diminfo[1].strides = __pyx_pybuffernd_mj1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj1.diminfo[1].shape = __pyx_pybuffernd_mj1.rcbuffer->pybuffer.shape[1]; + } } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->name); - __Pyx_DECREF(__pyx_v___pyx_result->name); - __pyx_v___pyx_result->name = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_10 = 0; + __pyx_v_mj1 = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) + /* "newanalysis/helpers/diffusion.pyx":557 + * + * cdef np.ndarray[np.float64_t,ndim=2] mj1 = np.zeros((n1,3),dtype=np.float64) + * cdef double *cmj1 = mj1.data # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.float64_t,ndim=2] mj2 = np.zeros((n1,3),dtype=np.float64) */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 13, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_4 = ((__pyx_t_3 > 1) != 0); - if (__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_mj1)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 557, __pyx_L1_error) + __pyx_v_cmj1 = ((double *)__pyx_t_5); - /* "(tree fragment)":14 - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":559 + * cdef double *cmj1 = mj1.data + * + * cdef np.ndarray[np.float64_t,ndim=2] mj2 = np.zeros((n1,3),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *cmj2 = mj2.data + * */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 14, __pyx_L1_error) - } - __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_n1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9)) __PYX_ERR(0, 559, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_3)) __PYX_ERR(0, 559, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2)) __PYX_ERR(0, 559, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 559, __pyx_L1_error) + __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mj2.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_mj2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_mj2.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 559, __pyx_L1_error) + } else {__pyx_pybuffernd_mj2.diminfo[0].strides = __pyx_pybuffernd_mj2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mj2.diminfo[0].shape = __pyx_pybuffernd_mj2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mj2.diminfo[1].strides = __pyx_pybuffernd_mj2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mj2.diminfo[1].shape = __pyx_pybuffernd_mj2.rcbuffer->pybuffer.shape[1]; } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) - */ } + __pyx_t_11 = 0; + __pyx_v_mj2 = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + /* "newanalysis/helpers/diffusion.pyx":560 + * + * cdef np.ndarray[np.float64_t,ndim=2] mj2 = np.zeros((n1,3),dtype=np.float64) + * cdef double *cmj2 = mj2.data # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_mj2)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 560, __pyx_L1_error) + __pyx_v_cmj2 = ((double *)__pyx_t_5); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static struct __pyx_vtabstruct_array __pyx_vtable_array; - -static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_array_obj *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_array_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_array; - p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_array(PyObject *o) { - struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif + /* "newanalysis/helpers/diffusion.pyx":562 + * cdef double *cmj2 = mj2.data + * + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *msd = msdmj.data + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8)) __PYX_ERR(0, 562, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 562, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_6); { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_array___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_msdmj = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 562, __pyx_L1_error) + } else {__pyx_pybuffernd_msdmj.diminfo[0].strides = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msdmj.diminfo[0].shape = __pyx_pybuffernd_msdmj.rcbuffer->pybuffer.shape[0]; + } } - Py_CLEAR(p->mode); - Py_CLEAR(p->_format); - (*Py_TYPE(o)->tp_free)(o); -} -static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} + __pyx_t_12 = 0; + __pyx_v_msdmj = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; -static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_array___setitem__(o, i, v); - } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); - return -1; - } -} + /* "newanalysis/helpers/diffusion.pyx":563 + * + * cdef np.ndarray[np.float64_t,ndim=1] msdmj = np.zeros(m,dtype=np.float64) + * cdef double *msd = msdmj.data # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_msdmj)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_v_msd = ((double *)__pyx_t_5); -static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { - PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n); - if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - v = __pyx_array___getattr__(o, n); + /* "newanalysis/helpers/diffusion.pyx":565 + * cdef double *msd = msdmj.data + * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< + * cdef int *c = ctr.data + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6)) __PYX_ERR(0, 565, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 565, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 565, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; + } } - return v; -} + __pyx_t_13 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; -static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); -} + /* "newanalysis/helpers/diffusion.pyx":566 + * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * cdef int *c = ctr.data # <<<<<<<<<<<<<< + * + * for i in prange(n1,nogil=True): + */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 566, __pyx_L1_error) + __pyx_v_c = ((int *)__pyx_t_5); -static PyMethodDef __pyx_methods_array[] = { - {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; + /* "newanalysis/helpers/diffusion.pyx":568 + * cdef int *c = ctr.data + * + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(s1_n2): + * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_n1; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_15 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_15 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) + #endif /* _OPENMP */ + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_14); + /* Initialize private variables to invalid values */ + __pyx_v_j = ((int)0xbad0bad0); -static struct PyGetSetDef __pyx_getsets_array[] = { - {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; + /* "newanalysis/helpers/diffusion.pyx":569 + * + * for i in prange(n1,nogil=True): + * for j in range(s1_n2): # <<<<<<<<<<<<<< + * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] + * cmj1[i*3+1] += c1*s1[i*s1_n2*3+3*j+1] + */ + __pyx_t_16 = __pyx_v_s1_n2; + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_j = __pyx_t_18; -static PySequenceMethods __pyx_tp_as_sequence_array = { - __pyx_array___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_array, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; + /* "newanalysis/helpers/diffusion.pyx":570 + * for i in prange(n1,nogil=True): + * for j in range(s1_n2): + * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] # <<<<<<<<<<<<<< + * cmj1[i*3+1] += c1*s1[i*s1_n2*3+3*j+1] + * cmj1[i*3+2] += c1*s1[i*s1_n2*3+3*j+2] + */ + __pyx_t_19 = (__pyx_v_i * 3); + (__pyx_v_cmj1[__pyx_t_19]) = ((__pyx_v_cmj1[__pyx_t_19]) + (__pyx_v_c1 * (__pyx_v_s1[(((__pyx_v_i * __pyx_v_s1_n2) * 3) + (3 * __pyx_v_j))]))); -static PyMappingMethods __pyx_tp_as_mapping_array = { - __pyx_array___len__, /*mp_length*/ - __pyx_array___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ -}; + /* "newanalysis/helpers/diffusion.pyx":571 + * for j in range(s1_n2): + * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] + * cmj1[i*3+1] += c1*s1[i*s1_n2*3+3*j+1] # <<<<<<<<<<<<<< + * cmj1[i*3+2] += c1*s1[i*s1_n2*3+3*j+2] + * + */ + __pyx_t_19 = ((__pyx_v_i * 3) + 1); + (__pyx_v_cmj1[__pyx_t_19]) = ((__pyx_v_cmj1[__pyx_t_19]) + (__pyx_v_c1 * (__pyx_v_s1[((((__pyx_v_i * __pyx_v_s1_n2) * 3) + (3 * __pyx_v_j)) + 1)]))); -static PyBufferProcs __pyx_tp_as_buffer_array = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_array_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; + /* "newanalysis/helpers/diffusion.pyx":572 + * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] + * cmj1[i*3+1] += c1*s1[i*s1_n2*3+3*j+1] + * cmj1[i*3+2] += c1*s1[i*s1_n2*3+3*j+2] # <<<<<<<<<<<<<< + * + * for i in prange(n1,nogil=True): + */ + __pyx_t_19 = ((__pyx_v_i * 3) + 2); + (__pyx_v_cmj1[__pyx_t_19]) = ((__pyx_v_cmj1[__pyx_t_19]) + (__pyx_v_c1 * (__pyx_v_s1[((((__pyx_v_i * __pyx_v_s1_n2) * 3) + (3 * __pyx_v_j)) + 2)]))); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } -static PyTypeObject __pyx_type___pyx_array = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.diffusion.array", /*tp_name*/ - sizeof(struct __pyx_array_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_array, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - __pyx_tp_getattro_array, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_array, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_array, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_array, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; - -static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_MemviewEnum_obj *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + /* "newanalysis/helpers/diffusion.pyx":568 + * cdef int *c = ctr.data + * + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(s1_n2): + * cmj1[i*3] += c1*s1[i*s1_n2*3+3*j] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } } - if (unlikely(!o)) return 0; - p = ((struct __pyx_MemviewEnum_obj *)o); - p->name = Py_None; Py_INCREF(Py_None); - return o; -} -static void __pyx_tp_dealloc_Enum(PyObject *o) { - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->name); - (*Py_TYPE(o)->tp_free)(o); -} + /* "newanalysis/helpers/diffusion.pyx":574 + * cmj1[i*3+2] += c1*s1[i*s1_n2*3+3*j+2] + * + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(s2_n2): + * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_15 = __pyx_v_n1; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_4 = (__pyx_t_15 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_4 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) + #endif /* _OPENMP */ + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_4; __pyx_t_14++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_14); + /* Initialize private variables to invalid values */ + __pyx_v_j = ((int)0xbad0bad0); -static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - if (p->name) { - e = (*v)(p->name, a); if (e) return e; - } - return 0; -} + /* "newanalysis/helpers/diffusion.pyx":575 + * + * for i in prange(n1,nogil=True): + * for j in range(s2_n2): # <<<<<<<<<<<<<< + * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] + * cmj2[i*3+1] += c2*s2[i*s2_n2*3+3*j+1] + */ + __pyx_t_16 = __pyx_v_s2_n2; + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_j = __pyx_t_18; -static int __pyx_tp_clear_Enum(PyObject *o) { - PyObject* tmp; - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - tmp = ((PyObject*)p->name); - p->name = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} + /* "newanalysis/helpers/diffusion.pyx":576 + * for i in prange(n1,nogil=True): + * for j in range(s2_n2): + * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] # <<<<<<<<<<<<<< + * cmj2[i*3+1] += c2*s2[i*s2_n2*3+3*j+1] + * cmj2[i*3+2] += c2*s2[i*s2_n2*3+3*j+2] + */ + __pyx_t_19 = (__pyx_v_i * 3); + (__pyx_v_cmj2[__pyx_t_19]) = ((__pyx_v_cmj2[__pyx_t_19]) + (__pyx_v_c2 * (__pyx_v_s2[(((__pyx_v_i * __pyx_v_s2_n2) * 3) + (3 * __pyx_v_j))]))); -static PyMethodDef __pyx_methods_Enum[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; + /* "newanalysis/helpers/diffusion.pyx":577 + * for j in range(s2_n2): + * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] + * cmj2[i*3+1] += c2*s2[i*s2_n2*3+3*j+1] # <<<<<<<<<<<<<< + * cmj2[i*3+2] += c2*s2[i*s2_n2*3+3*j+2] + * + */ + __pyx_t_19 = ((__pyx_v_i * 3) + 1); + (__pyx_v_cmj2[__pyx_t_19]) = ((__pyx_v_cmj2[__pyx_t_19]) + (__pyx_v_c2 * (__pyx_v_s2[((((__pyx_v_i * __pyx_v_s2_n2) * 3) + (3 * __pyx_v_j)) + 1)]))); -static PyTypeObject __pyx_type___pyx_MemviewEnum = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.diffusion.Enum", /*tp_name*/ - sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_Enum, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_MemviewEnum___repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_Enum, /*tp_traverse*/ - __pyx_tp_clear_Enum, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_Enum, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_MemviewEnum___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_Enum, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; -static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; + /* "newanalysis/helpers/diffusion.pyx":578 + * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] + * cmj2[i*3+1] += c2*s2[i*s2_n2*3+3*j+1] + * cmj2[i*3+2] += c2*s2[i*s2_n2*3+3*j+2] # <<<<<<<<<<<<<< + * + * for i in prange(m,nogil=True): + */ + __pyx_t_19 = ((__pyx_v_i * 3) + 2); + (__pyx_v_cmj2[__pyx_t_19]) = ((__pyx_v_cmj2[__pyx_t_19]) + (__pyx_v_c2 * (__pyx_v_s2[((((__pyx_v_i * __pyx_v_s2_n2) * 3) + (3 * __pyx_v_j)) + 2)]))); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } -static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryview_obj *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_memoryview_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_memoryview; - p->obj = Py_None; Py_INCREF(Py_None); - p->_size = Py_None; Py_INCREF(Py_None); - p->_array_interface = Py_None; Py_INCREF(Py_None); - p->view.obj = NULL; - if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_memoryview(PyObject *o) { - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_memoryview___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->obj); - Py_CLEAR(p->_size); - Py_CLEAR(p->_array_interface); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - if (p->obj) { - e = (*v)(p->obj, a); if (e) return e; - } - if (p->_size) { - e = (*v)(p->_size, a); if (e) return e; - } - if (p->_array_interface) { - e = (*v)(p->_array_interface, a); if (e) return e; - } - if (p->view.obj) { - e = (*v)(p->view.obj, a); if (e) return e; + /* "newanalysis/helpers/diffusion.pyx":574 + * cmj1[i*3+2] += c1*s1[i*s1_n2*3+3*j+2] + * + * for i in prange(n1,nogil=True): # <<<<<<<<<<<<<< + * for j in range(s2_n2): + * cmj2[i*3] += c2*s2[i*s2_n2*3+3*j] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L17; + } + __pyx_L17:; + } } - return 0; -} -static int __pyx_tp_clear_memoryview(PyObject *o) { - PyObject* tmp; - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - tmp = ((PyObject*)p->obj); - p->obj = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_size); - p->_size = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_array_interface); - p->_array_interface = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - Py_CLEAR(p->view.obj); - return 0; -} -static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} + /* "newanalysis/helpers/diffusion.pyx":580 + * cmj2[i*3+2] += c2*s2[i*s2_n2*3+3*j+2] + * + * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n1-i): + * dx1 = cmj1[j*3] - cmj1[(j+i)*3] + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_m; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_15 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_15 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_20) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dx1) lastprivate(__pyx_v_dx2) lastprivate(__pyx_v_dy1) lastprivate(__pyx_v_dy2) lastprivate(__pyx_v_dz1) lastprivate(__pyx_v_dz2) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_result) + #endif /* _OPENMP */ + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_14); + /* Initialize private variables to invalid values */ + __pyx_v_dx1 = ((double)__PYX_NAN()); + __pyx_v_dx2 = ((double)__PYX_NAN()); + __pyx_v_dy1 = ((double)__PYX_NAN()); + __pyx_v_dy2 = ((double)__PYX_NAN()); + __pyx_v_dz1 = ((double)__PYX_NAN()); + __pyx_v_dz2 = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_result = ((double)__PYX_NAN()); -static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_memoryview___setitem__(o, i, v); - } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); - return -1; - } -} + /* "newanalysis/helpers/diffusion.pyx":581 + * + * for i in prange(m,nogil=True): + * for j in range(n1-i): # <<<<<<<<<<<<<< + * dx1 = cmj1[j*3] - cmj1[(j+i)*3] + * dy1 = cmj1[j*3+1] - cmj1[(j+i)*3+1] + */ + __pyx_t_16 = (__pyx_v_n1 - __pyx_v_i); + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_j = __pyx_t_18; -static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); -} + /* "newanalysis/helpers/diffusion.pyx":582 + * for i in prange(m,nogil=True): + * for j in range(n1-i): + * dx1 = cmj1[j*3] - cmj1[(j+i)*3] # <<<<<<<<<<<<<< + * dy1 = cmj1[j*3+1] - cmj1[(j+i)*3+1] + * dz1 = cmj1[j*3+2] - cmj1[(j+i)*3+2] + */ + __pyx_v_dx1 = ((__pyx_v_cmj1[(__pyx_v_j * 3)]) - (__pyx_v_cmj1[((__pyx_v_j + __pyx_v_i) * 3)])); -static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); -} + /* "newanalysis/helpers/diffusion.pyx":583 + * for j in range(n1-i): + * dx1 = cmj1[j*3] - cmj1[(j+i)*3] + * dy1 = cmj1[j*3+1] - cmj1[(j+i)*3+1] # <<<<<<<<<<<<<< + * dz1 = cmj1[j*3+2] - cmj1[(j+i)*3+2] + * + */ + __pyx_v_dy1 = ((__pyx_v_cmj1[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj1[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); -static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); -} + /* "newanalysis/helpers/diffusion.pyx":584 + * dx1 = cmj1[j*3] - cmj1[(j+i)*3] + * dy1 = cmj1[j*3+1] - cmj1[(j+i)*3+1] + * dz1 = cmj1[j*3+2] - cmj1[(j+i)*3+2] # <<<<<<<<<<<<<< + * + * dx2 = cmj2[j*3] - cmj2[(j+i)*3] + */ + __pyx_v_dz1 = ((__pyx_v_cmj1[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj1[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); -static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); -} + /* "newanalysis/helpers/diffusion.pyx":586 + * dz1 = cmj1[j*3+2] - cmj1[(j+i)*3+2] + * + * dx2 = cmj2[j*3] - cmj2[(j+i)*3] # <<<<<<<<<<<<<< + * dy2 = cmj2[j*3+1] - cmj2[(j+i)*3+1] + * dz2 = cmj2[j*3+2] - cmj2[(j+i)*3+2] + */ + __pyx_v_dx2 = ((__pyx_v_cmj2[(__pyx_v_j * 3)]) - (__pyx_v_cmj2[((__pyx_v_j + __pyx_v_i) * 3)])); -static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); -} + /* "newanalysis/helpers/diffusion.pyx":587 + * + * dx2 = cmj2[j*3] - cmj2[(j+i)*3] + * dy2 = cmj2[j*3+1] - cmj2[(j+i)*3+1] # <<<<<<<<<<<<<< + * dz2 = cmj2[j*3+2] - cmj2[(j+i)*3+2] + * + */ + __pyx_v_dy2 = ((__pyx_v_cmj2[((__pyx_v_j * 3) + 1)]) - (__pyx_v_cmj2[(((__pyx_v_j + __pyx_v_i) * 3) + 1)])); -static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); -} + /* "newanalysis/helpers/diffusion.pyx":588 + * dx2 = cmj2[j*3] - cmj2[(j+i)*3] + * dy2 = cmj2[j*3+1] - cmj2[(j+i)*3+1] + * dz2 = cmj2[j*3+2] - cmj2[(j+i)*3+2] # <<<<<<<<<<<<<< + * + * result = dx1*dx2+dy1*dy2+dz1*dz2 + */ + __pyx_v_dz2 = ((__pyx_v_cmj2[((__pyx_v_j * 3) + 2)]) - (__pyx_v_cmj2[(((__pyx_v_j + __pyx_v_i) * 3) + 2)])); -static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); -} + /* "newanalysis/helpers/diffusion.pyx":590 + * dz2 = cmj2[j*3+2] - cmj2[(j+i)*3+2] + * + * result = dx1*dx2+dy1*dy2+dz1*dz2 # <<<<<<<<<<<<<< + * msd[i]+=result + * c[i]+=1 + */ + __pyx_v_result = (((__pyx_v_dx1 * __pyx_v_dx2) + (__pyx_v_dy1 * __pyx_v_dy2)) + (__pyx_v_dz1 * __pyx_v_dz2)); -static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); -} + /* "newanalysis/helpers/diffusion.pyx":591 + * + * result = dx1*dx2+dy1*dy2+dz1*dz2 + * msd[i]+=result # <<<<<<<<<<<<<< + * c[i]+=1 + * + */ + __pyx_t_20 = __pyx_v_i; + (__pyx_v_msd[__pyx_t_20]) = ((__pyx_v_msd[__pyx_t_20]) + __pyx_v_result); -static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); -} + /* "newanalysis/helpers/diffusion.pyx":592 + * result = dx1*dx2+dy1*dy2+dz1*dz2 + * msd[i]+=result + * c[i]+=1 # <<<<<<<<<<<<<< + * + * for i in range(m): + */ + __pyx_t_20 = __pyx_v_i; + (__pyx_v_c[__pyx_t_20]) = ((__pyx_v_c[__pyx_t_20]) + 1); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } -static PyMethodDef __pyx_methods_memoryview[] = { - {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0}, - {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0}, - {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0}, - {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; + /* "newanalysis/helpers/diffusion.pyx":580 + * cmj2[i*3+2] += c2*s2[i*s2_n2*3+3*j+2] + * + * for i in prange(m,nogil=True): # <<<<<<<<<<<<<< + * for j in range(n1-i): + * dx1 = cmj1[j*3] - cmj1[(j+i)*3] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L28; + } + __pyx_L28:; + } + } -static struct PyGetSetDef __pyx_getsets_memoryview[] = { - {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0}, - {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0}, - {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0}, - {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0}, - {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0}, - {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0}, - {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0}, - {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0}, - {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_memoryview = { - __pyx_memoryview___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_memoryview, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_memoryview = { - __pyx_memoryview___len__, /*mp_length*/ - __pyx_memoryview___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_memoryview = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_memoryview_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; - -static PyTypeObject __pyx_type___pyx_memoryview = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.diffusion.memoryview", /*tp_name*/ - sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_memoryview___repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_memoryview___str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_memoryview, /*tp_traverse*/ - __pyx_tp_clear_memoryview, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_memoryview, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_memoryview, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_memoryview, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; -static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; - -static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryviewslice_obj *p; - PyObject *o = __pyx_tp_new_memoryview(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_memoryviewslice_obj *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; - p->from_object = Py_None; Py_INCREF(Py_None); - p->from_slice.memview = NULL; - return o; -} + /* "newanalysis/helpers/diffusion.pyx":594 + * c[i]+=1 + * + * for i in range(m): # <<<<<<<<<<<<<< + * msd[i]/=c[i] + * + */ + __pyx_t_15 = __pyx_v_m; + __pyx_t_14 = __pyx_t_15; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_14; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; -static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_memoryviewslice___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); + /* "newanalysis/helpers/diffusion.pyx":595 + * + * for i in range(m): + * msd[i]/=c[i] # <<<<<<<<<<<<<< + * + * return msdmj + */ + __pyx_t_16 = __pyx_v_i; + if (unlikely((__pyx_v_c[__pyx_v_i]) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 595, __pyx_L1_error) + } + (__pyx_v_msd[__pyx_t_16]) = ((__pyx_v_msd[__pyx_t_16]) / (__pyx_v_c[__pyx_v_i])); } - Py_CLEAR(p->from_object); - PyObject_GC_Track(o); - __pyx_tp_dealloc_memoryview(o); -} -static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; - if (p->from_object) { - e = (*v)(p->from_object, a); if (e) return e; - } - return 0; -} + /* "newanalysis/helpers/diffusion.pyx":597 + * msd[i]/=c[i] + * + * return msdmj # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_msdmj); + __pyx_r = ((PyObject *)__pyx_v_msdmj); + goto __pyx_L0; -static int __pyx_tp_clear__memoryviewslice(PyObject *o) { - PyObject* tmp; - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - __pyx_tp_clear_memoryview(o); - tmp = ((PyObject*)p->from_object); - p->from_object = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - __PYX_XDEC_MEMVIEW(&p->from_slice, 1); - return 0; -} + /* "newanalysis/helpers/diffusion.pyx":522 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJcrossterms(np.ndarray[np.float64_t,ndim=3] coms_s1, + * np.ndarray[np.float64_t,ndim=3] coms_s2, + */ -static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_s1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_s2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.diffusion.msdMJcrossterms", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_s1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coms_s2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mj2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msdmj.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_mj1); + __Pyx_XDECREF((PyObject *)__pyx_v_mj2); + __Pyx_XDECREF((PyObject *)__pyx_v_msdmj); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyMethodDef __pyx_methods__memoryviewslice[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = { - {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; +/* "newanalysis/helpers/diffusion.pyx":600 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, + * n=2, + */ -static PyTypeObject __pyx_type___pyx_memoryviewslice = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.diffusion._memoryviewslice", /*tp_name*/ - sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_9diffusion_19nonGaussianParameter(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_9diffusion_18nonGaussianParameter, "\n nonGaussianParameter(xyz, n=2, maxlen=None)\n\n This function takes as input a three-dimensional coordinate array of the molecular centers of mass of a whole unfolded trajectory \n [timestep, molecule, xyz] and calculates the non-Gaussian Parameter according to Rahman, A. Physical Review 136, A405\342\200\223A411 (1964).\n n is the \"moment\" of the distribution and 2 per default. The non-Gaussian parameter describes the deviation of the time-dependent\n molecular displacement from theGaussian distribution and is zero for n>1 if the distribution of the displacements is actually Gaussian. \n The optional parameter maxlen can be set to limit the length of the resulting MSD. This can be useful\n when dealing with very long trajectories, e.g. maxlen=n/2.\n\n Usage:\n nonGaussianParameter = nonGaussianParameter(xyz)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_9diffusion_19nonGaussianParameter = {"nonGaussianParameter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_9diffusion_19nonGaussianParameter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_9diffusion_18nonGaussianParameter}; +static PyObject *__pyx_pw_11newanalysis_9diffusion_19nonGaussianParameter(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_xyz = 0; + PyObject *__pyx_v_n = 0; + PyObject *__pyx_v_maxlen = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - #if CYTHON_COMPILING_IN_PYPY - __pyx_memoryview___repr__, /*tp_repr*/ - #else - 0, /*tp_repr*/ - #endif - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_memoryview___str__, /*tp_str*/ + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("nonGaussianParameter (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Internal class for passing memoryview slices to Python", /*tp_doc*/ - __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ - __pyx_tp_clear__memoryviewslice, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods__memoryviewslice, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets__memoryviewslice, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new__memoryviewslice, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 600, __pyx_L3_error) #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_n,&__pyx_n_s_maxlen,0}; + values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_2))); -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_diffusion(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_diffusion}, - {0, NULL} -}; -#endif + /* "newanalysis/helpers/diffusion.pyx":603 + * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, + * n=2, + * maxlen=None): # <<<<<<<<<<<<<< + * """ + * nonGaussianParameter(xyz, n=2, maxlen=None) + */ + values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 600, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n); + if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 600, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxlen); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 600, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "nonGaussianParameter") < 0)) __PYX_ERR(0, 600, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_xyz = ((PyArrayObject *)values[0]); + __pyx_v_n = values[1]; + __pyx_v_maxlen = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("nonGaussianParameter", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 600, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.diffusion.nonGaussianParameter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 601, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_9diffusion_18nonGaussianParameter(__pyx_self, __pyx_v_xyz, __pyx_v_n, __pyx_v_maxlen); -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "diffusion", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif + /* "newanalysis/helpers/diffusion.pyx":600 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, + * n=2, + */ -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, - {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, - {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0}, - {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, - {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, - {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, - {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0}, - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, - {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, - {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, - {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, - {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, - {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, - {&__pyx_kp_s_WARNING_same_number_of_cation_an, __pyx_k_WARNING_same_number_of_cation_an, sizeof(__pyx_k_WARNING_same_number_of_cation_an), 0, 0, 1, 0}, - {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, - {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, - {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1}, - {&__pyx_n_s_alpha_data, __pyx_k_alpha_data, sizeof(__pyx_k_alpha_data), 0, 0, 1, 1}, - {&__pyx_n_s_an, __pyx_k_an, sizeof(__pyx_k_an), 0, 0, 1, 1}, - {&__pyx_n_s_b2, __pyx_k_b2, sizeof(__pyx_k_b2), 0, 0, 1, 1}, - {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, - {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, - {&__pyx_n_s_boxlength, __pyx_k_boxlength, sizeof(__pyx_k_boxlength), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, - {&__pyx_n_s_c1, __pyx_k_c1, sizeof(__pyx_k_c1), 0, 0, 1, 1}, - {&__pyx_n_s_c2, __pyx_k_c2, sizeof(__pyx_k_c2), 0, 0, 1, 1}, - {&__pyx_n_s_can, __pyx_k_can, sizeof(__pyx_k_can), 0, 0, 1, 1}, - {&__pyx_n_s_cat, __pyx_k_cat, sizeof(__pyx_k_cat), 0, 0, 1, 1}, - {&__pyx_n_s_ccat, __pyx_k_ccat, sizeof(__pyx_k_ccat), 0, 0, 1, 1}, - {&__pyx_n_s_ch, __pyx_k_ch, sizeof(__pyx_k_ch), 0, 0, 1, 1}, - {&__pyx_n_s_charge, __pyx_k_charge, sizeof(__pyx_k_charge), 0, 0, 1, 1}, - {&__pyx_n_s_charge_an, __pyx_k_charge_an, sizeof(__pyx_k_charge_an), 0, 0, 1, 1}, - {&__pyx_n_s_charge_cat, __pyx_k_charge_cat, sizeof(__pyx_k_charge_cat), 0, 0, 1, 1}, - {&__pyx_n_s_charge_s1, __pyx_k_charge_s1, sizeof(__pyx_k_charge_s1), 0, 0, 1, 1}, - {&__pyx_n_s_charge_s2, __pyx_k_charge_s2, sizeof(__pyx_k_charge_s2), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_cmj, __pyx_k_cmj, sizeof(__pyx_k_cmj), 0, 0, 1, 1}, - {&__pyx_n_s_cmj1, __pyx_k_cmj1, sizeof(__pyx_k_cmj1), 0, 0, 1, 1}, - {&__pyx_n_s_cmj2, __pyx_k_cmj2, sizeof(__pyx_k_cmj2), 0, 0, 1, 1}, - {&__pyx_n_s_cmj_sep, __pyx_k_cmj_sep, sizeof(__pyx_k_cmj_sep), 0, 0, 1, 1}, - {&__pyx_n_s_coms_an, __pyx_k_coms_an, sizeof(__pyx_k_coms_an), 0, 0, 1, 1}, - {&__pyx_n_s_coms_cat, __pyx_k_coms_cat, sizeof(__pyx_k_coms_cat), 0, 0, 1, 1}, - {&__pyx_n_s_coms_s1, __pyx_k_coms_s1, sizeof(__pyx_k_coms_s1), 0, 0, 1, 1}, - {&__pyx_n_s_coms_s2, __pyx_k_coms_s2, sizeof(__pyx_k_coms_s2), 0, 0, 1, 1}, - {&__pyx_n_s_coms_sep, __pyx_k_coms_sep, sizeof(__pyx_k_coms_sep), 0, 0, 1, 1}, - {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, - {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, - {&__pyx_n_s_crossDisplacementMdMj, __pyx_k_crossDisplacementMdMj, sizeof(__pyx_k_crossDisplacementMdMj), 0, 0, 1, 1}, - {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, - {&__pyx_n_s_ctr_arr, __pyx_k_ctr_arr, sizeof(__pyx_k_ctr_arr), 0, 0, 1, 1}, - {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1}, - {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, - {&__pyx_n_s_data2, __pyx_k_data2, sizeof(__pyx_k_data2), 0, 0, 1, 1}, - {&__pyx_n_s_data_tmp, __pyx_k_data_tmp, sizeof(__pyx_k_data_tmp), 0, 0, 1, 1}, - {&__pyx_n_s_deg, __pyx_k_deg, sizeof(__pyx_k_deg), 0, 0, 1, 1}, - {&__pyx_n_s_diag, __pyx_k_diag, sizeof(__pyx_k_diag), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_n_s_disp, __pyx_k_disp, sizeof(__pyx_k_disp), 0, 0, 1, 1}, - {&__pyx_n_s_disp_arr, __pyx_k_disp_arr, sizeof(__pyx_k_disp_arr), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, - {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1}, - {&__pyx_n_s_dx1, __pyx_k_dx1, sizeof(__pyx_k_dx1), 0, 0, 1, 1}, - {&__pyx_n_s_dx2, __pyx_k_dx2, sizeof(__pyx_k_dx2), 0, 0, 1, 1}, - {&__pyx_n_s_dx3, __pyx_k_dx3, sizeof(__pyx_k_dx3), 0, 0, 1, 1}, - {&__pyx_n_s_dxs, __pyx_k_dxs, sizeof(__pyx_k_dxs), 0, 0, 1, 1}, - {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1}, - {&__pyx_n_s_dy1, __pyx_k_dy1, sizeof(__pyx_k_dy1), 0, 0, 1, 1}, - {&__pyx_n_s_dy2, __pyx_k_dy2, sizeof(__pyx_k_dy2), 0, 0, 1, 1}, - {&__pyx_n_s_dy3, __pyx_k_dy3, sizeof(__pyx_k_dy3), 0, 0, 1, 1}, - {&__pyx_n_s_dys, __pyx_k_dys, sizeof(__pyx_k_dys), 0, 0, 1, 1}, - {&__pyx_n_s_dz, __pyx_k_dz, sizeof(__pyx_k_dz), 0, 0, 1, 1}, - {&__pyx_n_s_dz1, __pyx_k_dz1, sizeof(__pyx_k_dz1), 0, 0, 1, 1}, - {&__pyx_n_s_dz2, __pyx_k_dz2, sizeof(__pyx_k_dz2), 0, 0, 1, 1}, - {&__pyx_n_s_dz3, __pyx_k_dz3, sizeof(__pyx_k_dz3), 0, 0, 1, 1}, - {&__pyx_n_s_dzs, __pyx_k_dzs, sizeof(__pyx_k_dzs), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, - {&__pyx_n_s_factor, __pyx_k_factor, sizeof(__pyx_k_factor), 0, 0, 1, 1}, - {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1}, - {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, - {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, - {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_idx1, __pyx_k_idx1, sizeof(__pyx_k_idx1), 0, 0, 1, 1}, - {&__pyx_n_s_idx2, __pyx_k_idx2, sizeof(__pyx_k_idx2), 0, 0, 1, 1}, - {&__pyx_n_s_idx3, __pyx_k_idx3, sizeof(__pyx_k_idx3), 0, 0, 1, 1}, - {&__pyx_n_s_idx4, __pyx_k_idx4, sizeof(__pyx_k_idx4), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, - {&__pyx_n_s_irel, __pyx_k_irel, sizeof(__pyx_k_irel), 0, 0, 1, 1}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, - {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, - {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, - {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, - {&__pyx_n_s_longer, __pyx_k_longer, sizeof(__pyx_k_longer), 0, 0, 1, 1}, - {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1}, - {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_maxlen, __pyx_k_maxlen, sizeof(__pyx_k_maxlen), 0, 0, 1, 1}, - {&__pyx_n_s_md, __pyx_k_md, sizeof(__pyx_k_md), 0, 0, 1, 1}, - {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, - {&__pyx_n_s_mj, __pyx_k_mj, sizeof(__pyx_k_mj), 0, 0, 1, 1}, - {&__pyx_n_s_mj1, __pyx_k_mj1, sizeof(__pyx_k_mj1), 0, 0, 1, 1}, - {&__pyx_n_s_mj2, __pyx_k_mj2, sizeof(__pyx_k_mj2), 0, 0, 1, 1}, - {&__pyx_n_s_mj_arr, __pyx_k_mj_arr, sizeof(__pyx_k_mj_arr), 0, 0, 1, 1}, - {&__pyx_n_s_mj_sep, __pyx_k_mj_sep, sizeof(__pyx_k_mj_sep), 0, 0, 1, 1}, - {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, - {&__pyx_n_s_msd, __pyx_k_msd, sizeof(__pyx_k_msd), 0, 0, 1, 1}, - {&__pyx_n_s_msdCOM, __pyx_k_msdCOM, sizeof(__pyx_k_msdCOM), 0, 0, 1, 1}, - {&__pyx_n_s_msdCOMvHnG, __pyx_k_msdCOMvHnG, sizeof(__pyx_k_msdCOMvHnG), 0, 0, 1, 1}, - {&__pyx_n_s_msdMJ, __pyx_k_msdMJ, sizeof(__pyx_k_msdMJ), 0, 0, 1, 1}, - {&__pyx_n_s_msdMJCharges, __pyx_k_msdMJCharges, sizeof(__pyx_k_msdMJCharges), 0, 0, 1, 1}, - {&__pyx_n_s_msdMJcrossterms, __pyx_k_msdMJcrossterms, sizeof(__pyx_k_msdMJcrossterms), 0, 0, 1, 1}, - {&__pyx_n_s_msdMJdecomp, __pyx_k_msdMJdecomp, sizeof(__pyx_k_msdMJdecomp), 0, 0, 1, 1}, - {&__pyx_n_s_msd_data, __pyx_k_msd_data, sizeof(__pyx_k_msd_data), 0, 0, 1, 1}, - {&__pyx_n_s_msddeg, __pyx_k_msddeg, sizeof(__pyx_k_msddeg), 0, 0, 1, 1}, - {&__pyx_n_s_msddeg_data, __pyx_k_msddeg_data, sizeof(__pyx_k_msddeg_data), 0, 0, 1, 1}, - {&__pyx_n_s_msdmj, __pyx_k_msdmj, sizeof(__pyx_k_msdmj), 0, 0, 1, 1}, - {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, - {&__pyx_n_s_n1, __pyx_k_n1, sizeof(__pyx_k_n1), 0, 0, 1, 1}, - {&__pyx_n_s_n2, __pyx_k_n2, sizeof(__pyx_k_n2), 0, 0, 1, 1}, - {&__pyx_n_s_n3, __pyx_k_n3, sizeof(__pyx_k_n3), 0, 0, 1, 1}, - {&__pyx_n_s_n4, __pyx_k_n4, sizeof(__pyx_k_n4), 0, 0, 1, 1}, - {&__pyx_kp_s_n_must_be_1, __pyx_k_n_must_be_1, sizeof(__pyx_k_n_must_be_1), 0, 0, 1, 0}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, - {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, - {&__pyx_n_s_newanalysis_diffusion, __pyx_k_newanalysis_diffusion, sizeof(__pyx_k_newanalysis_diffusion), 0, 0, 1, 1}, - {&__pyx_n_s_nframes, __pyx_k_nframes, sizeof(__pyx_k_nframes), 0, 0, 1, 1}, - {&__pyx_n_s_ng, __pyx_k_ng, sizeof(__pyx_k_ng), 0, 0, 1, 1}, - {&__pyx_n_s_nion, __pyx_k_nion, sizeof(__pyx_k_nion), 0, 0, 1, 1}, - {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, - {&__pyx_n_s_nonGaussianParameter, __pyx_k_nonGaussianParameter, sizeof(__pyx_k_nonGaussianParameter), 0, 0, 1, 1}, - {&__pyx_n_s_non_gaussian, __pyx_k_non_gaussian, sizeof(__pyx_k_non_gaussian), 0, 0, 1, 1}, - {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, - {&__pyx_n_s_nstep, __pyx_k_nstep, sizeof(__pyx_k_nstep), 0, 0, 1, 1}, - {&__pyx_n_s_nts, __pyx_k_nts, sizeof(__pyx_k_nts), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, - {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, - {&__pyx_n_s_pairDisplacement, __pyx_k_pairDisplacement, sizeof(__pyx_k_pairDisplacement), 0, 0, 1, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, - {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_res2, __pyx_k_res2, sizeof(__pyx_k_res2), 0, 0, 1, 1}, - {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, - {&__pyx_n_s_s1, __pyx_k_s1, sizeof(__pyx_k_s1), 0, 0, 1, 1}, - {&__pyx_n_s_s1_n2, __pyx_k_s1_n2, sizeof(__pyx_k_s1_n2), 0, 0, 1, 1}, - {&__pyx_n_s_s2, __pyx_k_s2, sizeof(__pyx_k_s2), 0, 0, 1, 1}, - {&__pyx_n_s_s2_n2, __pyx_k_s2_n2, sizeof(__pyx_k_s2_n2), 0, 0, 1, 1}, - {&__pyx_n_s_sep, __pyx_k_sep, sizeof(__pyx_k_sep), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, - {&__pyx_n_s_shorter, __pyx_k_shorter, sizeof(__pyx_k_shorter), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_kp_s_src_helpers_diffusion_pyx, __pyx_k_src_helpers_diffusion_pyx, sizeof(__pyx_k_src_helpers_diffusion_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_tmp, __pyx_k_tmp, sizeof(__pyx_k_tmp), 0, 0, 1, 1}, - {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, - {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, - {&__pyx_n_s_unfoldTraj, __pyx_k_unfoldTraj, sizeof(__pyx_k_unfoldTraj), 0, 0, 1, 1}, - {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1}, - {&__pyx_n_s_van_hove, __pyx_k_van_hove, sizeof(__pyx_k_van_hove), 0, 0, 1, 1}, - {&__pyx_n_s_vh, __pyx_k_vh, sizeof(__pyx_k_vh), 0, 0, 1, 1}, - {&__pyx_n_s_vh_maxdist, __pyx_k_vh_maxdist, sizeof(__pyx_k_vh_maxdist), 0, 0, 1, 1}, - {&__pyx_n_s_vhmax, __pyx_k_vhmax, sizeof(__pyx_k_vhmax), 0, 0, 1, 1}, - {&__pyx_n_s_xyz, __pyx_k_xyz, sizeof(__pyx_k_xyz), 0, 0, 1, 1}, - {&__pyx_n_s_xyz2, __pyx_k_xyz2, sizeof(__pyx_k_xyz2), 0, 0, 1, 1}, - {&__pyx_n_s_xyz_tmp, __pyx_k_xyz_tmp, sizeof(__pyx_k_xyz_tmp), 0, 0, 1, 1}, - {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 37, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 619, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 944, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 149, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 152, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error) - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 406, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 615, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 834, __pyx_L1_error) - return 0; + /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - return -1; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { +static PyObject *__pyx_pf_11newanalysis_9diffusion_18nonGaussianParameter(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_n, PyObject *__pyx_v_maxlen) { + double __pyx_v_factor; + double __pyx_v_result; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + int __pyx_v_deg; + int __pyx_v_n1; + int __pyx_v_n2; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_m; + PyArrayObject *__pyx_v_msd = 0; + double *__pyx_v_msd_data; + PyArrayObject *__pyx_v_msddeg = 0; + double *__pyx_v_msddeg_data; + PyArrayObject *__pyx_v_alpha = 0; + CYTHON_UNUSED double *__pyx_v_alpha_data; + double *__pyx_v_data; + PyArrayObject *__pyx_v_ctr = 0; + int *__pyx_v_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_alpha; + __Pyx_Buffer __pyx_pybuffer_alpha; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ctr; + __Pyx_Buffer __pyx_pybuffer_ctr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_msd; + __Pyx_Buffer __pyx_pybuffer_msd; + __Pyx_LocalBuf_ND __pyx_pybuffernd_msddeg; + __Pyx_Buffer __pyx_pybuffer_msddeg; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; + __Pyx_Buffer __pyx_pybuffer_xyz; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + PyArrayObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + long __pyx_t_23; + long __pyx_t_24; + double __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + __pyx_t_5numpy_float64_t __pyx_t_28; + __pyx_t_5numpy_float64_t __pyx_t_29; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("nonGaussianParameter", 0); + __pyx_pybuffer_msd.pybuffer.buf = NULL; + __pyx_pybuffer_msd.refcount = 0; + __pyx_pybuffernd_msd.data = NULL; + __pyx_pybuffernd_msd.rcbuffer = &__pyx_pybuffer_msd; + __pyx_pybuffer_msddeg.pybuffer.buf = NULL; + __pyx_pybuffer_msddeg.refcount = 0; + __pyx_pybuffernd_msddeg.data = NULL; + __pyx_pybuffernd_msddeg.rcbuffer = &__pyx_pybuffer_msddeg; + __pyx_pybuffer_alpha.pybuffer.buf = NULL; + __pyx_pybuffer_alpha.refcount = 0; + __pyx_pybuffernd_alpha.data = NULL; + __pyx_pybuffernd_alpha.rcbuffer = &__pyx_pybuffer_alpha; + __pyx_pybuffer_ctr.pybuffer.buf = NULL; + __pyx_pybuffer_ctr.refcount = 0; + __pyx_pybuffernd_ctr.data = NULL; + __pyx_pybuffernd_ctr.rcbuffer = &__pyx_pybuffer_ctr; + __pyx_pybuffer_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_xyz.refcount = 0; + __pyx_pybuffernd_xyz.data = NULL; + __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 600, __pyx_L1_error) + } + __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_xyz.diminfo[2].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_xyz.diminfo[2].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[2]; - /* "src/helpers/diffusion.pyx":619 + /* "newanalysis/helpers/diffusion.pyx":618 + * """ * - * if n < 1: - * raise ValueError("n must be >1") # <<<<<<<<<<<<<< + * if n < 1: # <<<<<<<<<<<<<< + * raise ValueError("n must be >1") * - * cdef double factor, result, dx, dy, dz, res2 */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_n_must_be_1); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_n, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 618, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_t_2)) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":619 * - * cdef inline int import_umath() except -1: - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 944, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * if n < 1: + * raise ValueError("n must be >1") # <<<<<<<<<<<<<< * - * cdef inline int import_ufunc() except -1: + * cdef double factor, result, dx, dy, dz, res2 */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 950, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 619, __pyx_L1_error) - /* "View.MemoryView":134 + /* "newanalysis/helpers/diffusion.pyx":618 + * """ * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< + * if n < 1: # <<<<<<<<<<<<<< + * raise ValueError("n must be >1") * - * if itemsize <= 0: */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + } - /* "View.MemoryView":137 - * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":624 + * cdef int deg, n1, n2, i, j, k, m, pos * - * if not isinstance(format, bytes): + * n1 = len(xyz) # <<<<<<<<<<<<<< + * n2 = len(xyz[0]) + * deg = n */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 624, __pyx_L1_error) + __pyx_v_n1 = __pyx_t_3; - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/diffusion.pyx":625 * - */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< + * n1 = len(xyz) + * n2 = len(xyz[0]) # <<<<<<<<<<<<<< + * deg = n * - * if self.dtype_is_object: - */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len - */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_xyz), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 625, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_n2 = __pyx_t_3; - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":626 + * n1 = len(xyz) + * n2 = len(xyz[0]) + * deg = n # <<<<<<<<<<<<<< * - * have_slices, index = _unellipsify(index, self.view.ndim) - */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: - */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< * - * if flags & PyBUF_ND: */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_n); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 626, __pyx_L1_error) + __pyx_v_deg = __pyx_t_4; - /* "View.MemoryView":572 - * if self.view.strides == NULL: + /* "newanalysis/helpers/diffusion.pyx":629 * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_maxlen, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 629, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":630 * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - */ - __pyx_tuple__15 = PyTuple_New(1); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_INCREF(__pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__15, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_tuple__15); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: + * if maxlen == None: + * m = n1 # <<<<<<<<<<<<<< + * else: + * m = maxlen */ - __pyx_slice__18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__18)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__18); - __Pyx_GIVEREF(__pyx_slice__18); + __pyx_v_m = __pyx_v_n1; - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":629 * * + * if maxlen == None: # <<<<<<<<<<<<<< + * m = n1 + * else: */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_tuple__22 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); + goto __pyx_L4; + } - /* "src/helpers/diffusion.pyx":12 - * from libc.math cimport fabs, sqrt, floor, pow + /* "newanalysis/helpers/diffusion.pyx":632 + * m = n1 + * else: + * m = maxlen # <<<<<<<<<<<<<< * - * def unfoldTraj(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * boxlength): - * """ + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) */ - __pyx_tuple__23 = PyTuple_Pack(13, __pyx_n_s_xyz, __pyx_n_s_boxlength, __pyx_n_s_boxl, __pyx_n_s_b2, __pyx_n_s_n, __pyx_n_s_nframes, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_d, __pyx_n_s_xyz_tmp, __pyx_n_s_data, __pyx_n_s_data_tmp); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_diffusion_pyx, __pyx_n_s_unfoldTraj, 12, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 12, __pyx_L1_error) + /*else*/ { + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_maxlen); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 632, __pyx_L1_error) + __pyx_v_m = ((int)__pyx_t_4); + } + __pyx_L4:; - /* "src/helpers/diffusion.pyx":51 + /* "newanalysis/helpers/diffusion.pyx":634 + * m = maxlen * - * @cython.boundscheck(False) - * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * maxlen=None, vh_maxdist=200.0): - * """ - */ - __pyx_tuple__25 = PyTuple_Pack(28, __pyx_n_s_xyz, __pyx_n_s_maxlen, __pyx_n_s_vh_maxdist, __pyx_n_s_tmp, __pyx_n_s_result, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_res2, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_m, __pyx_n_s_pos, __pyx_n_s_idx1, __pyx_n_s_idx2, __pyx_n_s_vhmax, __pyx_n_s_msd, __pyx_n_s_msd_data, __pyx_n_s_data, __pyx_n_s_van_hove, __pyx_n_s_vh, __pyx_n_s_non_gaussian, __pyx_n_s_ng, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(3, 0, 28, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_diffusion_pyx, __pyx_n_s_msdCOMvHnG, 51, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 51, __pyx_L1_error) - - /* "src/helpers/diffusion.pyx":121 + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double* msd_data = msd.data * - * @cython.boundscheck(False) - * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * maxlen=None): - * """ */ - __pyx_tuple__27 = PyTuple_Pack(20, __pyx_n_s_xyz, __pyx_n_s_maxlen, __pyx_n_s_tmp, __pyx_n_s_result, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_res2, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_m, __pyx_n_s_pos, __pyx_n_s_msd, __pyx_n_s_msd_data, __pyx_n_s_data, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_diffusion_pyx, __pyx_n_s_msdCOM, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 634, __pyx_L1_error) + __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msd.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_msd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 634, __pyx_L1_error) + } else {__pyx_pybuffernd_msd.diminfo[0].strides = __pyx_pybuffernd_msd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msd.diminfo[0].shape = __pyx_pybuffernd_msd.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_9 = 0; + __pyx_v_msd = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; - /* "src/helpers/diffusion.pyx":171 + /* "newanalysis/helpers/diffusion.pyx":635 * - * @cython.boundscheck(False) - * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] xyz2, - * maxlen=None): - */ - __pyx_tuple__29 = PyTuple_Pack(35, __pyx_n_s_xyz, __pyx_n_s_xyz2, __pyx_n_s_maxlen, __pyx_n_s_tmp, __pyx_n_s_result, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_res2, __pyx_n_s_dx2, __pyx_n_s_dy2, __pyx_n_s_dz2, __pyx_n_s_dx3, __pyx_n_s_dy3, __pyx_n_s_dz3, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_irel, __pyx_n_s_m, __pyx_n_s_nstep, __pyx_n_s_idx1, __pyx_n_s_idx2, __pyx_n_s_idx3, __pyx_n_s_idx4, __pyx_n_s_diag, __pyx_n_s_msd, __pyx_n_s_msd_data, __pyx_n_s_data, __pyx_n_s_data2, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 35, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_diffusion_pyx, __pyx_n_s_pairDisplacement, 171, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 171, __pyx_L1_error) - - /* "src/helpers/diffusion.pyx":242 + * cdef np.ndarray[np.float64_t,ndim=1] msd = np.zeros(m,dtype=np.float64) + * cdef double* msd_data = msd.data # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, + * cdef np.ndarray[np.float64_t,ndim=1] msddeg = np.zeros(m, dtype=np.float64) */ - __pyx_tuple__31 = PyTuple_Pack(25, __pyx_n_s_coms_cat, __pyx_n_s_coms_an, __pyx_n_s_maxlen, __pyx_n_s_charge_cat, __pyx_n_s_charge_an, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_m, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_ccat, __pyx_n_s_can, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_result, __pyx_n_s_cat, __pyx_n_s_an, __pyx_n_s_mj, __pyx_n_s_cmj, __pyx_n_s_msdmj, __pyx_n_s_msd, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(5, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_diffusion_pyx, __pyx_n_s_msdMJ, 242, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_msd)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 635, __pyx_L1_error) + __pyx_v_msd_data = ((double *)__pyx_t_10); - /* "src/helpers/diffusion.pyx":312 + /* "newanalysis/helpers/diffusion.pyx":637 + * cdef double* msd_data = msd.data * - * @cython.boundscheck(False) - * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, - */ - __pyx_tuple__33 = PyTuple_Pack(30, __pyx_n_s_coms_cat, __pyx_n_s_coms_an, __pyx_n_s_maxlen, __pyx_n_s_charge_cat, __pyx_n_s_charge_an, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_m, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_n4, __pyx_n_s_upper, __pyx_n_s_lower, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_result, __pyx_n_s_shorter, __pyx_n_s_longer, __pyx_n_s_ccat, __pyx_n_s_can, __pyx_n_s_mj, __pyx_n_s_cmj, __pyx_n_s_msdmj, __pyx_n_s_msd, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(5, 0, 30, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_diffusion_pyx, __pyx_n_s_msdMJCharges, 312, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 312, __pyx_L1_error) - - /* "src/helpers/diffusion.pyx":401 + * cdef np.ndarray[np.float64_t,ndim=1] msddeg = np.zeros(m, dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double* msddeg_data = msddeg.data * - * @cython.boundscheck(False) - * def crossDisplacementMdMj(double [:, :, :] coms_cat, # <<<<<<<<<<<<<< - * double [:, :, :] coms_an, - * double [:, :] md): */ - __pyx_tuple__35 = PyTuple_Pack(17, __pyx_n_s_coms_cat, __pyx_n_s_coms_an, __pyx_n_s_md, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_nts, __pyx_n_s_nion, __pyx_n_s_mj_arr, __pyx_n_s_mj, __pyx_n_s_ctr_arr, __pyx_n_s_ctr, __pyx_n_s_disp_arr, __pyx_n_s_disp, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_result); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 401, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_diffusion_pyx, __pyx_n_s_crossDisplacementMdMj, 401, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8)) __PYX_ERR(0, 637, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 637, __pyx_L1_error) + __pyx_t_11 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_msddeg.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_msddeg = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_msddeg.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 637, __pyx_L1_error) + } else {__pyx_pybuffernd_msddeg.diminfo[0].strides = __pyx_pybuffernd_msddeg.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_msddeg.diminfo[0].shape = __pyx_pybuffernd_msddeg.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_11 = 0; + __pyx_v_msddeg = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; - /* "src/helpers/diffusion.pyx":438 + /* "newanalysis/helpers/diffusion.pyx":638 * - * @cython.boundscheck(False) - * def msdMJdecomp(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * np.ndarray[np.float64_t,ndim=3] coms_sep, - */ - __pyx_tuple__37 = PyTuple_Pack(31, __pyx_n_s_coms_cat, __pyx_n_s_coms_an, __pyx_n_s_coms_sep, __pyx_n_s_charge, __pyx_n_s_maxlen, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_n3, __pyx_n_s_m, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_ch, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_dxs, __pyx_n_s_dys, __pyx_n_s_dzs, __pyx_n_s_result, __pyx_n_s_cat, __pyx_n_s_an, __pyx_n_s_sep, __pyx_n_s_mj, __pyx_n_s_cmj, __pyx_n_s_mj_sep, __pyx_n_s_cmj_sep, __pyx_n_s_msdmj, __pyx_n_s_msd, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(5, 0, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_diffusion_pyx, __pyx_n_s_msdMJdecomp, 438, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 438, __pyx_L1_error) - - /* "src/helpers/diffusion.pyx":523 + * cdef np.ndarray[np.float64_t,ndim=1] msddeg = np.zeros(m, dtype=np.float64) + * cdef double* msddeg_data = msddeg.data # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def msdMJcrossterms(np.ndarray[np.float64_t,ndim=3] coms_s1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_s2, - * int charge_s1, + * cdef np.ndarray[np.float64_t,ndim=1] alpha = np.zeros(m, dtype=np.float64) */ - __pyx_tuple__39 = PyTuple_Pack(31, __pyx_n_s_coms_s1, __pyx_n_s_coms_s2, __pyx_n_s_charge_s1, __pyx_n_s_charge_s2, __pyx_n_s_maxlen, __pyx_n_s_n1, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_s1_n2, __pyx_n_s_s2_n2, __pyx_n_s_m, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_dx1, __pyx_n_s_dy1, __pyx_n_s_dz1, __pyx_n_s_dx2, __pyx_n_s_dy2, __pyx_n_s_dz2, __pyx_n_s_result, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_mj1, __pyx_n_s_cmj1, __pyx_n_s_mj2, __pyx_n_s_cmj2, __pyx_n_s_msdmj, __pyx_n_s_msd, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 523, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(5, 0, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_diffusion_pyx, __pyx_n_s_msdMJcrossterms, 523, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 523, __pyx_L1_error) + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_msddeg)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L1_error) + __pyx_v_msddeg_data = ((double *)__pyx_t_10); - /* "src/helpers/diffusion.pyx":601 + /* "newanalysis/helpers/diffusion.pyx":640 + * cdef double* msddeg_data = msddeg.data * - * @cython.boundscheck(False) - * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * n=2, - * maxlen=None): - */ - __pyx_tuple__41 = PyTuple_Pack(26, __pyx_n_s_xyz, __pyx_n_s_n, __pyx_n_s_maxlen, __pyx_n_s_factor, __pyx_n_s_result, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_res2, __pyx_n_s_deg, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_m, __pyx_n_s_pos, __pyx_n_s_msd, __pyx_n_s_msd_data, __pyx_n_s_msddeg, __pyx_n_s_msddeg_data, __pyx_n_s_alpha, __pyx_n_s_alpha_data, __pyx_n_s_data, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 601, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(3, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_diffusion_pyx, __pyx_n_s_nonGaussianParameter, 601, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 601, __pyx_L1_error) - - /* "View.MemoryView":287 - * return self.name + * cdef np.ndarray[np.float64_t,ndim=1] alpha = np.zeros(m, dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double* alpha_data = alpha.data * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") */ - __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7)) __PYX_ERR(0, 640, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 640, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_alpha = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 640, __pyx_L1_error) + } else {__pyx_pybuffernd_alpha.diminfo[0].strides = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alpha.diminfo[0].shape = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_12 = 0; + __pyx_v_alpha = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; - /* "View.MemoryView":288 + /* "newanalysis/helpers/diffusion.pyx":641 * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") + * cdef np.ndarray[np.float64_t,ndim=1] alpha = np.zeros(m, dtype=np.float64) + * cdef double* alpha_data = alpha.data # <<<<<<<<<<<<<< * + * cdef double *data = xyz.data */ - __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_alpha)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 641, __pyx_L1_error) + __pyx_v_alpha_data = ((double *)__pyx_t_10); - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/diffusion.pyx":643 + * cdef double* alpha_data = alpha.data * + * cdef double *data = xyz.data # <<<<<<<<<<<<<< * + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 643, __pyx_L1_error) + __pyx_v_data = ((double *)__pyx_t_10); - /* "View.MemoryView":292 - * + /* "newanalysis/helpers/diffusion.pyx":645 + * cdef double *data = xyz.data * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) # <<<<<<<<<<<<<< + * cdef int *c = ctr.data * */ - __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_m); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 645, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_1); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_ctr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 645, __pyx_L1_error) + } else {__pyx_pybuffernd_ctr.diminfo[0].strides = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ctr.diminfo[0].shape = __pyx_pybuffernd_ctr.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_13 = 0; + __pyx_v_ctr = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":293 + /* "newanalysis/helpers/diffusion.pyx":646 * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int32_t,ndim=1] ctr = np.zeros(m,dtype=np.int32) + * cdef int *c = ctr.data # <<<<<<<<<<<<<< * + * # loop over all delta t + */ + __pyx_t_10 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ctr)); if (unlikely(__pyx_t_10 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 646, __pyx_L1_error) + __pyx_v_c = ((int *)__pyx_t_10); + + /* "newanalysis/helpers/diffusion.pyx":649 * + * # loop over all delta t + * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< + * # loop over all possible interval start points + * for j in range(n1-i): */ - __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__47); - __Pyx_GIVEREF(__pyx_tuple__47); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_4 = __pyx_v_m; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_15 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_15 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dz) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_result) + #endif /* _OPENMP */ + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_15; __pyx_t_14++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_14); + /* Initialize private variables to invalid values */ + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); + __pyx_v_result = ((double)__PYX_NAN()); - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "newanalysis/helpers/diffusion.pyx":651 + * for i in prange(m,nogil=True,schedule=guided): + * # loop over all possible interval start points + * for j in range(n1-i): # <<<<<<<<<<<<<< + * # loop over residues + * for k in range(n2): */ - __pyx_tuple__48 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} + __pyx_t_16 = (__pyx_v_n1 - __pyx_v_i); + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_j = __pyx_t_18; -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - /* InitThreads.init */ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 -PyEval_InitThreads(); -#endif + /* "newanalysis/helpers/diffusion.pyx":653 + * for j in range(n1-i): + * # loop over residues + * for k in range(n2): # <<<<<<<<<<<<<< + * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] + * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] + */ + __pyx_t_19 = __pyx_v_n2; + __pyx_t_20 = __pyx_t_19; + for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { + __pyx_v_k = __pyx_t_21; -if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + /* "newanalysis/helpers/diffusion.pyx":654 + * # loop over residues + * for k in range(n2): + * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] # <<<<<<<<<<<<<< + * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] + * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] + */ + __pyx_v_dx = ((__pyx_v_data[(((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k))]) - (__pyx_v_data[((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k))])); - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_float_200_0 = PyFloat_FromDouble(200.0); if (unlikely(!__pyx_float_200_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} + /* "newanalysis/helpers/diffusion.pyx":655 + * for k in range(n2): + * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] + * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] # <<<<<<<<<<<<<< + * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] + * result = dx*dx+dy*dy+dz*dz + */ + __pyx_v_dy = ((__pyx_v_data[((((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 1)]) - (__pyx_v_data[(((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 1)])); -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + /* "newanalysis/helpers/diffusion.pyx":656 + * dx = data[j*n2*3+3*k] - data[(j+i)*n2*3+3*k] + * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] + * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] # <<<<<<<<<<<<<< + * result = dx*dx+dy*dy+dz*dz + * msd_data[i] += result + */ + __pyx_v_dz = ((__pyx_v_data[((((__pyx_v_j * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 2)]) - (__pyx_v_data[(((((__pyx_v_j + __pyx_v_i) * __pyx_v_n2) * 3) + (3 * __pyx_v_k)) + 2)])); -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - generic = Py_None; Py_INCREF(Py_None); - strided = Py_None; Py_INCREF(Py_None); - indirect = Py_None; Py_INCREF(Py_None); - contiguous = Py_None; Py_INCREF(Py_None); - indirect_contiguous = Py_None; Py_INCREF(Py_None); - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "newanalysis/helpers/diffusion.pyx":657 + * dy = data[j*n2*3+3*k+1] - data[(j+i)*n2*3+3*k+1] + * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] + * result = dx*dx+dy*dy+dz*dz # <<<<<<<<<<<<<< + * msd_data[i] += result + * msddeg_data[i] += result**deg + */ + __pyx_v_result = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "newanalysis/helpers/diffusion.pyx":658 + * dz = data[j*n2*3+3*k+2] - data[(j+i)*n2*3+3*k+2] + * result = dx*dx+dy*dy+dz*dz + * msd_data[i] += result # <<<<<<<<<<<<<< + * msddeg_data[i] += result**deg + * c[i]+=1 + */ + __pyx_t_22 = __pyx_v_i; + (__pyx_v_msd_data[__pyx_t_22]) = ((__pyx_v_msd_data[__pyx_t_22]) + __pyx_v_result); -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "newanalysis/helpers/diffusion.pyx":659 + * result = dx*dx+dy*dy+dz*dz + * msd_data[i] += result + * msddeg_data[i] += result**deg # <<<<<<<<<<<<<< + * c[i]+=1 + * + */ + __pyx_t_22 = __pyx_v_i; + (__pyx_v_msddeg_data[__pyx_t_22]) = ((__pyx_v_msddeg_data[__pyx_t_22]) + pow(__pyx_v_result, ((double)__pyx_v_deg))); -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __pyx_vtabptr_array = &__pyx_vtable_array; - __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; - if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_array.tp_print = 0; - #endif - if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - __pyx_array_type = &__pyx_type___pyx_array; - if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_MemviewEnum.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) - __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; - __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; - __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; - __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; - __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; - __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; - __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; - __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; - __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; - if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryview.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr; + /* "newanalysis/helpers/diffusion.pyx":660 + * msd_data[i] += result + * msddeg_data[i] += result**deg + * c[i]+=1 # <<<<<<<<<<<<<< + * + * factor = 1 + */ + __pyx_t_22 = __pyx_v_i; + (__pyx_v_c[__pyx_t_22]) = ((__pyx_v_c[__pyx_t_22]) + 1); + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/diffusion.pyx":649 + * + * # loop over all delta t + * for i in prange(m,nogil=True,schedule=guided): # <<<<<<<<<<<<<< + * # loop over all possible interval start points + * for j in range(n1-i): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L7; + } + __pyx_L7:; + } } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - __pyx_memoryview_type = &__pyx_type___pyx_memoryview; - __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; - __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; - __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; - __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; - __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; - if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryviewslice.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr; + + /* "newanalysis/helpers/diffusion.pyx":662 + * c[i]+=1 + * + * factor = 1 # <<<<<<<<<<<<<< + * for i in range(1,deg+1): + * factor = factor * (2*i+1) + */ + __pyx_v_factor = 1.0; + + /* "newanalysis/helpers/diffusion.pyx":663 + * + * factor = 1 + * for i in range(1,deg+1): # <<<<<<<<<<<<<< + * factor = factor * (2*i+1) + * factor /= 3**deg + */ + __pyx_t_23 = (__pyx_v_deg + 1); + __pyx_t_24 = __pyx_t_23; + for (__pyx_t_15 = 1; __pyx_t_15 < __pyx_t_24; __pyx_t_15+=1) { + __pyx_v_i = __pyx_t_15; + + /* "newanalysis/helpers/diffusion.pyx":664 + * factor = 1 + * for i in range(1,deg+1): + * factor = factor * (2*i+1) # <<<<<<<<<<<<<< + * factor /= 3**deg + * + */ + __pyx_v_factor = (__pyx_v_factor * ((2 * __pyx_v_i) + 1)); } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", - #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyTypeObject), - #else - sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyHeapTypeObject), - #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT(PyArray_Descr), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 199, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 222, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayMultiIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 226, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error) - __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 770, __pyx_L1_error) - __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 772, __pyx_L1_error) - __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 774, __pyx_L1_error) - __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 776, __pyx_L1_error) - __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 778, __pyx_L1_error) - __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 780, __pyx_L1_error) - __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 782, __pyx_L1_error) - __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 784, __pyx_L1_error) - __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 786, __pyx_L1_error) - __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 788, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT(PyUFuncObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} + /* "newanalysis/helpers/diffusion.pyx":665 + * for i in range(1,deg+1): + * factor = factor * (2*i+1) + * factor /= 3**deg # <<<<<<<<<<<<<< + * + * alpha[0] = 0 + */ + __pyx_t_25 = pow(3.0, ((double)__pyx_v_deg)); + if (unlikely(__pyx_t_25 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 665, __pyx_L1_error) + } + __pyx_v_factor = (__pyx_v_factor / __pyx_t_25); -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "newanalysis/helpers/diffusion.pyx":667 + * factor /= 3**deg + * + * alpha[0] = 0 # <<<<<<<<<<<<<< + * for i in range(1,m): + * msd[i] /= ctr[i] + */ + __pyx_t_26 = 0; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_alpha.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_alpha.diminfo[0].strides) = 0.0; -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "newanalysis/helpers/diffusion.pyx":668 + * + * alpha[0] = 0 + * for i in range(1,m): # <<<<<<<<<<<<<< + * msd[i] /= ctr[i] + * msddeg[i] /= ctr[i] + */ + __pyx_t_15 = __pyx_v_m; + __pyx_t_14 = __pyx_t_15; + for (__pyx_t_4 = 1; __pyx_t_4 < __pyx_t_14; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + /* "newanalysis/helpers/diffusion.pyx":669 + * alpha[0] = 0 + * for i in range(1,m): + * msd[i] /= ctr[i] # <<<<<<<<<<<<<< + * msddeg[i] /= ctr[i] + * alpha[i] = msddeg[i]/(msd[i]**deg * factor) - 1 + */ + __pyx_t_26 = __pyx_v_i; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_ctr.diminfo[0].shape; + __pyx_t_27 = __pyx_v_i; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_pybuffernd_msd.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_msd.diminfo[0].strides) /= ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ctr.diminfo[0].strides))); -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif -#else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif + /* "newanalysis/helpers/diffusion.pyx":670 + * for i in range(1,m): + * msd[i] /= ctr[i] + * msddeg[i] /= ctr[i] # <<<<<<<<<<<<<< + * alpha[i] = msddeg[i]/(msd[i]**deg * factor) - 1 + * + */ + __pyx_t_26 = __pyx_v_i; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_ctr.diminfo[0].shape; + __pyx_t_27 = __pyx_v_i; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_pybuffernd_msddeg.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msddeg.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_msddeg.diminfo[0].strides) /= ((double)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_ctr.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ctr.diminfo[0].strides))); + /* "newanalysis/helpers/diffusion.pyx":671 + * msd[i] /= ctr[i] + * msddeg[i] /= ctr[i] + * alpha[i] = msddeg[i]/(msd[i]**deg * factor) - 1 # <<<<<<<<<<<<<< + * + * return alpha + */ + __pyx_t_26 = __pyx_v_i; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_msddeg.diminfo[0].shape; + __pyx_t_28 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msddeg.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_msddeg.diminfo[0].strides)); + __pyx_t_26 = __pyx_v_i; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_msd.diminfo[0].shape; + __pyx_t_29 = (pow((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_msd.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_msd.diminfo[0].strides)), ((__pyx_t_5numpy_float64_t)__pyx_v_deg)) * __pyx_v_factor); + if (unlikely(__pyx_t_29 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 671, __pyx_L1_error) + } + __pyx_t_26 = __pyx_v_i; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_alpha.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_alpha.diminfo[0].strides) = ((__pyx_t_28 / __pyx_t_29) - 1.0); + } -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initdiffusion(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initdiffusion(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_diffusion(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_diffusion(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); + /* "newanalysis/helpers/diffusion.pyx":673 + * alpha[i] = msddeg[i]/(msd[i]**deg * factor) - 1 + * + * return alpha # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_alpha); + __pyx_r = ((PyObject *)__pyx_v_alpha); + goto __pyx_L0; + + /* "newanalysis/helpers/diffusion.pyx":600 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, + * n=2, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msddeg.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.diffusion.nonGaussianParameter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ctr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msd.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_msddeg.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_msd); + __Pyx_XDECREF((PyObject *)__pyx_v_msddeg); + __Pyx_XDECREF((PyObject *)__pyx_v_alpha); + __Pyx_XDECREF((PyObject *)__pyx_v_ctr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; +static struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { - result = PyDict_SetItemString(moddict, to_name, value); - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; } - return result; + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; +static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; } - -static CYTHON_SMALL_CODE int __pyx_pymod_exec_diffusion(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - PyObject *__pyx_t_1 = NULL; - static PyThread_type_lock __pyx_t_2[8]; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'diffusion' has already been imported. Re-initialisation is not supported."); +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); return -1; } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); } -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_diffusion(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - PyEval_InitThreads(); + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("diffusion", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); + 0, /*bf_getcharbuffer*/ #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "newanalysis.diffusion.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ #endif - if (__pyx_module_is_main_newanalysis__diffusion) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "newanalysis.diffusion")) { - if (unlikely(PyDict_SetItemString(modules, "newanalysis.diffusion", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; - /* "src/helpers/diffusion.pyx":4 - * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - * - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/helpers/diffusion.pyx":12 - * from libc.math cimport fabs, sqrt, floor, pow - * - * def unfoldTraj(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * boxlength): - * """ - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9diffusion_1unfoldTraj, NULL, __pyx_n_s_newanalysis_diffusion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_unfoldTraj, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/helpers/diffusion.pyx":51 - * - * @cython.boundscheck(False) - * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * maxlen=None, vh_maxdist=200.0): - * """ - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9diffusion_3msdCOMvHnG, NULL, __pyx_n_s_newanalysis_diffusion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdCOMvHnG, __pyx_t_1) < 0) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.diffusion.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_array, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_array, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_array, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif - /* "src/helpers/diffusion.pyx":121 - * - * @cython.boundscheck(False) - * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * maxlen=None): - * """ - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9diffusion_5msdCOM, NULL, __pyx_n_s_newanalysis_diffusion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdCOM, __pyx_t_1) < 0) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); + return o; +} - /* "src/helpers/diffusion.pyx":171 - * - * @cython.boundscheck(False) - * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] xyz2, - * maxlen=None): - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9diffusion_7pairDisplacement, NULL, __pyx_n_s_newanalysis_diffusion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pairDisplacement, __pyx_t_1) < 0) __PYX_ERR(0, 171, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} - /* "src/helpers/diffusion.pyx":242 - * - * @cython.boundscheck(False) - * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9diffusion_9msdMJ, NULL, __pyx_n_s_newanalysis_diffusion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdMJ, __pyx_t_1) < 0) __PYX_ERR(0, 242, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} - /* "src/helpers/diffusion.pyx":312 - * - * @cython.boundscheck(False) - * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * maxlen=None, - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9diffusion_11msdMJCharges, NULL, __pyx_n_s_newanalysis_diffusion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdMJCharges, __pyx_t_1) < 0) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} - /* "src/helpers/diffusion.pyx":401 - * - * @cython.boundscheck(False) - * def crossDisplacementMdMj(double [:, :, :] coms_cat, # <<<<<<<<<<<<<< - * double [:, :, :] coms_an, - * double [:, :] md): - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9diffusion_13crossDisplacementMdMj, NULL, __pyx_n_s_newanalysis_diffusion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_crossDisplacementMdMj, __pyx_t_1) < 0) __PYX_ERR(0, 401, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyObject *__pyx_specialmethod___pyx_MemviewEnum___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_MemviewEnum___repr__(self); +} - /* "src/helpers/diffusion.pyx":438 - * - * @cython.boundscheck(False) - * def msdMJdecomp(np.ndarray[np.float64_t,ndim=3] coms_cat, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_an, - * np.ndarray[np.float64_t,ndim=3] coms_sep, - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9diffusion_15msdMJdecomp, NULL, __pyx_n_s_newanalysis_diffusion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdMJdecomp, __pyx_t_1) < 0) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyMethodDef __pyx_methods_Enum[] = { + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_MemviewEnum___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "newanalysis.diffusion.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_MemviewEnum_slots, +}; +#else - /* "src/helpers/diffusion.pyx":523 - * - * @cython.boundscheck(False) - * def msdMJcrossterms(np.ndarray[np.float64_t,ndim=3] coms_s1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=3] coms_s2, - * int charge_s1, - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9diffusion_17msdMJcrossterms, NULL, __pyx_n_s_newanalysis_diffusion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdMJcrossterms, __pyx_t_1) < 0) __PYX_ERR(0, 523, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyTypeObject __pyx_type___pyx_MemviewEnum = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.diffusion.""Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_Enum, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_MemviewEnum___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_Enum, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; - /* "src/helpers/diffusion.pyx":601 - * - * @cython.boundscheck(False) - * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< - * n=2, - * maxlen=None): - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_9diffusion_19nonGaussianParameter, NULL, __pyx_n_s_newanalysis_diffusion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_nonGaussianParameter, __pyx_t_1) < 0) __PYX_ERR(0, 601, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->_array_interface = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} - /* "src/helpers/diffusion.pyx":1 - * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< - * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - * - */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_memoryview___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + Py_CLEAR(p->_array_interface); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} - /* "View.MemoryView":210 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * def __dealloc__(array self): - */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_array_type); +static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->_array_interface) { + e = (*v)(p->_array_interface, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} - /* "View.MemoryView":287 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(generic); - __Pyx_DECREF_SET(generic, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_array_interface); + p->_array_interface = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} - /* "View.MemoryView":288 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(strided); - __Pyx_DECREF_SET(strided, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(indirect); - __Pyx_DECREF_SET(indirect, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); +} - /* "View.MemoryView":292 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(contiguous); - __Pyx_DECREF_SET(contiguous, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); +} - /* "View.MemoryView":293 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(indirect_contiguous); - __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); +} - /* "View.MemoryView":317 - * - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ - * PyThread_allocate_lock(), - */ - __pyx_memoryview_thread_locks_used = 0; - - /* "View.MemoryView":318 - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< - * PyThread_allocate_lock(), - * PyThread_allocate_lock(), - */ - __pyx_t_2[0] = PyThread_allocate_lock(); - __pyx_t_2[1] = PyThread_allocate_lock(); - __pyx_t_2[2] = PyThread_allocate_lock(); - __pyx_t_2[3] = PyThread_allocate_lock(); - __pyx_t_2[4] = PyThread_allocate_lock(); - __pyx_t_2[5] = PyThread_allocate_lock(); - __pyx_t_2[6] = PyThread_allocate_lock(); - __pyx_t_2[7] = PyThread_allocate_lock(); - memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); - - /* "View.MemoryView":551 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_memoryview_type); - - /* "View.MemoryView":997 - * return self.from_object - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_memoryviewslice_type); - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - */ - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init newanalysis.diffusion", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_CLEAR(__pyx_m); - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init newanalysis.diffusion"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); } -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); } -#endif -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); } -#endif -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); } -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); } -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); } -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; +static PyObject *__pyx_specialmethod___pyx_memoryview___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_memoryview___repr__(self); } -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; +static PyMethodDef __pyx_methods_memoryview[] = { + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_memoryview___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"is_c_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0}, + {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0}, + {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0}, + {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0}, + {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0}, + {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0}, + {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0}, + {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0}, + {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "newanalysis.diffusion.memoryview", + sizeof(struct __pyx_memoryview_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_memoryview_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.diffusion.""memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_memoryview, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_memoryview, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_memoryview, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + new((void*)&(p->from_slice)) __Pyx_memviewslice(); + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; + return o; } -/* IsLittleEndian */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) -{ - union { - uint32_t u32; - uint8_t u8[4]; - } S; - S.u32 = 0x01020304; - return S.u8[0] == 4; +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_memoryviewslice___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->from_slice); + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); } -/* BufferFormatCheck */ -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type) { - stack[0].field = &ctx->root; - stack[0].parent_offset = 0; - ctx->root.type = type; - ctx->root.name = "buffer dtype"; - ctx->root.offset = 0; - ctx->head = stack; - ctx->head->field = &ctx->root; - ctx->fmt_offset = 0; - ctx->head->parent_offset = 0; - ctx->new_packmode = '@'; - ctx->enc_packmode = '@'; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->is_complex = 0; - ctx->is_valid_array = 0; - ctx->struct_alignment = 0; - while (type->typegroup == 'S') { - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = 0; - type = type->fields->type; +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; } + return 0; } -static int __Pyx_BufFmt_ParseNumber(const char** ts) { - int count; - const char* t = *ts; - if (*t < '0' || *t > '9') { - return -1; - } else { - count = *t++ - '0'; - while (*t >= '0' && *t <= '9') { - count *= 10; - count += *t++ - '0'; - } - } - *ts = t; - return count; + +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); + return 0; } -static int __Pyx_BufFmt_ExpectNumber(const char **ts) { - int number = __Pyx_BufFmt_ParseNumber(ts); - if (number == -1) - PyErr_Format(PyExc_ValueError,\ - "Does not understand character buffer dtype format string ('%c')", **ts); - return number; + +static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "newanalysis.diffusion._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.diffusion.""_memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods__memoryviewslice, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new__memoryviewslice, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, + {&__pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_k_All_dimensions_preceding_dimensi, sizeof(__pyx_k_All_dimensions_preceding_dimensi), 0, 0, 1, 0}, + {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, + {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, + {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, + {&__pyx_kp_u_Cannot_index_with_type, __pyx_k_Cannot_index_with_type, sizeof(__pyx_k_Cannot_index_with_type), 0, 1, 0, 0}, + {&__pyx_kp_s_Cannot_transpose_memoryview_with, __pyx_k_Cannot_transpose_memoryview_with, sizeof(__pyx_k_Cannot_transpose_memoryview_with), 0, 0, 1, 0}, + {&__pyx_kp_s_Dimension_d_is_not_direct, __pyx_k_Dimension_d_is_not_direct, sizeof(__pyx_k_Dimension_d_is_not_direct), 0, 0, 1, 0}, + {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, + {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, + {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_k_Index_out_of_bounds_axis_d, sizeof(__pyx_k_Index_out_of_bounds_axis_d), 0, 0, 1, 0}, + {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, + {&__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 1, 0, 0}, + {&__pyx_kp_u_Invalid_shape_in_axis, __pyx_k_Invalid_shape_in_axis, sizeof(__pyx_k_Invalid_shape_in_axis), 0, 1, 0, 0}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, + {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, + {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, + {&__pyx_kp_u_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 1, 0, 0}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1}, + {&__pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_k_Step_may_not_be_zero_axis_d, sizeof(__pyx_k_Step_may_not_be_zero_axis_d), 0, 0, 1, 0}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, + {&__pyx_kp_s_WARNING_same_number_of_cation_an, __pyx_k_WARNING_same_number_of_cation_an, sizeof(__pyx_k_WARNING_same_number_of_cation_an), 0, 0, 1, 0}, + {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, + {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, + {&__pyx_n_s__48, __pyx_k__48, sizeof(__pyx_k__48), 0, 0, 1, 1}, + {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, + {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, + {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, + {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, + {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1}, + {&__pyx_n_s_alpha_data, __pyx_k_alpha_data, sizeof(__pyx_k_alpha_data), 0, 0, 1, 1}, + {&__pyx_n_s_an, __pyx_k_an, sizeof(__pyx_k_an), 0, 0, 1, 1}, + {&__pyx_kp_u_and, __pyx_k_and, sizeof(__pyx_k_and), 0, 1, 0, 0}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_b2, __pyx_k_b2, sizeof(__pyx_k_b2), 0, 0, 1, 1}, + {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, + {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, + {&__pyx_n_s_boxlength, __pyx_k_boxlength, sizeof(__pyx_k_boxlength), 0, 0, 1, 1}, + {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, + {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, + {&__pyx_n_s_c1, __pyx_k_c1, sizeof(__pyx_k_c1), 0, 0, 1, 1}, + {&__pyx_n_s_c2, __pyx_k_c2, sizeof(__pyx_k_c2), 0, 0, 1, 1}, + {&__pyx_n_s_can, __pyx_k_can, sizeof(__pyx_k_can), 0, 0, 1, 1}, + {&__pyx_n_s_cat, __pyx_k_cat, sizeof(__pyx_k_cat), 0, 0, 1, 1}, + {&__pyx_n_s_ccat, __pyx_k_ccat, sizeof(__pyx_k_ccat), 0, 0, 1, 1}, + {&__pyx_n_s_ch, __pyx_k_ch, sizeof(__pyx_k_ch), 0, 0, 1, 1}, + {&__pyx_n_s_charge, __pyx_k_charge, sizeof(__pyx_k_charge), 0, 0, 1, 1}, + {&__pyx_n_s_charge_an, __pyx_k_charge_an, sizeof(__pyx_k_charge_an), 0, 0, 1, 1}, + {&__pyx_n_s_charge_cat, __pyx_k_charge_cat, sizeof(__pyx_k_charge_cat), 0, 0, 1, 1}, + {&__pyx_n_s_charge_s1, __pyx_k_charge_s1, sizeof(__pyx_k_charge_s1), 0, 0, 1, 1}, + {&__pyx_n_s_charge_s2, __pyx_k_charge_s2, sizeof(__pyx_k_charge_s2), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_cmj, __pyx_k_cmj, sizeof(__pyx_k_cmj), 0, 0, 1, 1}, + {&__pyx_n_s_cmj1, __pyx_k_cmj1, sizeof(__pyx_k_cmj1), 0, 0, 1, 1}, + {&__pyx_n_s_cmj2, __pyx_k_cmj2, sizeof(__pyx_k_cmj2), 0, 0, 1, 1}, + {&__pyx_n_s_cmj_sep, __pyx_k_cmj_sep, sizeof(__pyx_k_cmj_sep), 0, 0, 1, 1}, + {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, + {&__pyx_kp_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 0}, + {&__pyx_n_s_coms_an, __pyx_k_coms_an, sizeof(__pyx_k_coms_an), 0, 0, 1, 1}, + {&__pyx_n_s_coms_cat, __pyx_k_coms_cat, sizeof(__pyx_k_coms_cat), 0, 0, 1, 1}, + {&__pyx_n_s_coms_s1, __pyx_k_coms_s1, sizeof(__pyx_k_coms_s1), 0, 0, 1, 1}, + {&__pyx_n_s_coms_s2, __pyx_k_coms_s2, sizeof(__pyx_k_coms_s2), 0, 0, 1, 1}, + {&__pyx_n_s_coms_sep, __pyx_k_coms_sep, sizeof(__pyx_k_coms_sep), 0, 0, 1, 1}, + {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, + {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, + {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, + {&__pyx_n_s_crossDisplacementMdMj, __pyx_k_crossDisplacementMdMj, sizeof(__pyx_k_crossDisplacementMdMj), 0, 0, 1, 1}, + {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, + {&__pyx_n_s_ctr_arr, __pyx_k_ctr_arr, sizeof(__pyx_k_ctr_arr), 0, 0, 1, 1}, + {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1}, + {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, + {&__pyx_n_s_data2, __pyx_k_data2, sizeof(__pyx_k_data2), 0, 0, 1, 1}, + {&__pyx_n_s_data_tmp, __pyx_k_data_tmp, sizeof(__pyx_k_data_tmp), 0, 0, 1, 1}, + {&__pyx_n_s_deg, __pyx_k_deg, sizeof(__pyx_k_deg), 0, 0, 1, 1}, + {&__pyx_n_s_diag, __pyx_k_diag, sizeof(__pyx_k_diag), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_disp, __pyx_k_disp, sizeof(__pyx_k_disp), 0, 0, 1, 1}, + {&__pyx_n_s_disp_arr, __pyx_k_disp_arr, sizeof(__pyx_k_disp_arr), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, + {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1}, + {&__pyx_n_s_dx1, __pyx_k_dx1, sizeof(__pyx_k_dx1), 0, 0, 1, 1}, + {&__pyx_n_s_dx2, __pyx_k_dx2, sizeof(__pyx_k_dx2), 0, 0, 1, 1}, + {&__pyx_n_s_dx3, __pyx_k_dx3, sizeof(__pyx_k_dx3), 0, 0, 1, 1}, + {&__pyx_n_s_dxs, __pyx_k_dxs, sizeof(__pyx_k_dxs), 0, 0, 1, 1}, + {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1}, + {&__pyx_n_s_dy1, __pyx_k_dy1, sizeof(__pyx_k_dy1), 0, 0, 1, 1}, + {&__pyx_n_s_dy2, __pyx_k_dy2, sizeof(__pyx_k_dy2), 0, 0, 1, 1}, + {&__pyx_n_s_dy3, __pyx_k_dy3, sizeof(__pyx_k_dy3), 0, 0, 1, 1}, + {&__pyx_n_s_dys, __pyx_k_dys, sizeof(__pyx_k_dys), 0, 0, 1, 1}, + {&__pyx_n_s_dz, __pyx_k_dz, sizeof(__pyx_k_dz), 0, 0, 1, 1}, + {&__pyx_n_s_dz1, __pyx_k_dz1, sizeof(__pyx_k_dz1), 0, 0, 1, 1}, + {&__pyx_n_s_dz2, __pyx_k_dz2, sizeof(__pyx_k_dz2), 0, 0, 1, 1}, + {&__pyx_n_s_dz3, __pyx_k_dz3, sizeof(__pyx_k_dz3), 0, 0, 1, 1}, + {&__pyx_n_s_dzs, __pyx_k_dzs, sizeof(__pyx_k_dzs), 0, 0, 1, 1}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, + {&__pyx_n_s_factor, __pyx_k_factor, sizeof(__pyx_k_factor), 0, 0, 1, 1}, + {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, + {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, + {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0}, + {&__pyx_kp_u_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 1, 0, 0}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_idx1, __pyx_k_idx1, sizeof(__pyx_k_idx1), 0, 0, 1, 1}, + {&__pyx_n_s_idx2, __pyx_k_idx2, sizeof(__pyx_k_idx2), 0, 0, 1, 1}, + {&__pyx_n_s_idx3, __pyx_k_idx3, sizeof(__pyx_k_idx3), 0, 0, 1, 1}, + {&__pyx_n_s_idx4, __pyx_k_idx4, sizeof(__pyx_k_idx4), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, + {&__pyx_n_s_irel, __pyx_k_irel, sizeof(__pyx_k_irel), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, + {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, + {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, + {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, + {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, + {&__pyx_n_s_longer, __pyx_k_longer, sizeof(__pyx_k_longer), 0, 0, 1, 1}, + {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1}, + {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_maxlen, __pyx_k_maxlen, sizeof(__pyx_k_maxlen), 0, 0, 1, 1}, + {&__pyx_n_s_md, __pyx_k_md, sizeof(__pyx_k_md), 0, 0, 1, 1}, + {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, + {&__pyx_n_s_mj, __pyx_k_mj, sizeof(__pyx_k_mj), 0, 0, 1, 1}, + {&__pyx_n_s_mj1, __pyx_k_mj1, sizeof(__pyx_k_mj1), 0, 0, 1, 1}, + {&__pyx_n_s_mj2, __pyx_k_mj2, sizeof(__pyx_k_mj2), 0, 0, 1, 1}, + {&__pyx_n_s_mj_arr, __pyx_k_mj_arr, sizeof(__pyx_k_mj_arr), 0, 0, 1, 1}, + {&__pyx_n_s_mj_sep, __pyx_k_mj_sep, sizeof(__pyx_k_mj_sep), 0, 0, 1, 1}, + {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_msd, __pyx_k_msd, sizeof(__pyx_k_msd), 0, 0, 1, 1}, + {&__pyx_n_s_msdCOM, __pyx_k_msdCOM, sizeof(__pyx_k_msdCOM), 0, 0, 1, 1}, + {&__pyx_n_s_msdCOMvHnG, __pyx_k_msdCOMvHnG, sizeof(__pyx_k_msdCOMvHnG), 0, 0, 1, 1}, + {&__pyx_n_s_msdMJ, __pyx_k_msdMJ, sizeof(__pyx_k_msdMJ), 0, 0, 1, 1}, + {&__pyx_n_s_msdMJCharges, __pyx_k_msdMJCharges, sizeof(__pyx_k_msdMJCharges), 0, 0, 1, 1}, + {&__pyx_n_s_msdMJcrossterms, __pyx_k_msdMJcrossterms, sizeof(__pyx_k_msdMJcrossterms), 0, 0, 1, 1}, + {&__pyx_n_s_msdMJdecomp, __pyx_k_msdMJdecomp, sizeof(__pyx_k_msdMJdecomp), 0, 0, 1, 1}, + {&__pyx_n_s_msd_data, __pyx_k_msd_data, sizeof(__pyx_k_msd_data), 0, 0, 1, 1}, + {&__pyx_n_s_msddeg, __pyx_k_msddeg, sizeof(__pyx_k_msddeg), 0, 0, 1, 1}, + {&__pyx_n_s_msddeg_data, __pyx_k_msddeg_data, sizeof(__pyx_k_msddeg_data), 0, 0, 1, 1}, + {&__pyx_n_s_msdmj, __pyx_k_msdmj, sizeof(__pyx_k_msdmj), 0, 0, 1, 1}, + {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, + {&__pyx_n_s_n1, __pyx_k_n1, sizeof(__pyx_k_n1), 0, 0, 1, 1}, + {&__pyx_n_s_n2, __pyx_k_n2, sizeof(__pyx_k_n2), 0, 0, 1, 1}, + {&__pyx_n_s_n3, __pyx_k_n3, sizeof(__pyx_k_n3), 0, 0, 1, 1}, + {&__pyx_n_s_n4, __pyx_k_n4, sizeof(__pyx_k_n4), 0, 0, 1, 1}, + {&__pyx_kp_s_n_must_be_1, __pyx_k_n_must_be_1, sizeof(__pyx_k_n_must_be_1), 0, 0, 1, 0}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_n_s_newanalysis_diffusion, __pyx_k_newanalysis_diffusion, sizeof(__pyx_k_newanalysis_diffusion), 0, 0, 1, 1}, + {&__pyx_kp_s_newanalysis_helpers_diffusion_py, __pyx_k_newanalysis_helpers_diffusion_py, sizeof(__pyx_k_newanalysis_helpers_diffusion_py), 0, 0, 1, 0}, + {&__pyx_n_s_nframes, __pyx_k_nframes, sizeof(__pyx_k_nframes), 0, 0, 1, 1}, + {&__pyx_n_s_ng, __pyx_k_ng, sizeof(__pyx_k_ng), 0, 0, 1, 1}, + {&__pyx_n_s_nion, __pyx_k_nion, sizeof(__pyx_k_nion), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, + {&__pyx_n_s_nonGaussianParameter, __pyx_k_nonGaussianParameter, sizeof(__pyx_k_nonGaussianParameter), 0, 0, 1, 1}, + {&__pyx_n_s_non_gaussian, __pyx_k_non_gaussian, sizeof(__pyx_k_non_gaussian), 0, 0, 1, 1}, + {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_nstep, __pyx_k_nstep, sizeof(__pyx_k_nstep), 0, 0, 1, 1}, + {&__pyx_n_s_nts, __pyx_k_nts, sizeof(__pyx_k_nts), 0, 0, 1, 1}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, + {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, + {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, + {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_pairDisplacement, __pyx_k_pairDisplacement, sizeof(__pyx_k_pairDisplacement), 0, 0, 1, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, + {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1}, + {&__pyx_n_s_res2, __pyx_k_res2, sizeof(__pyx_k_res2), 0, 0, 1, 1}, + {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, + {&__pyx_n_s_s1, __pyx_k_s1, sizeof(__pyx_k_s1), 0, 0, 1, 1}, + {&__pyx_n_s_s1_n2, __pyx_k_s1_n2, sizeof(__pyx_k_s1_n2), 0, 0, 1, 1}, + {&__pyx_n_s_s2, __pyx_k_s2, sizeof(__pyx_k_s2), 0, 0, 1, 1}, + {&__pyx_n_s_s2_n2, __pyx_k_s2_n2, sizeof(__pyx_k_s2_n2), 0, 0, 1, 1}, + {&__pyx_n_s_sep, __pyx_k_sep, sizeof(__pyx_k_sep), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_shorter, __pyx_k_shorter, sizeof(__pyx_k_shorter), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, + {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, + {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_tmp, __pyx_k_tmp, sizeof(__pyx_k_tmp), 0, 0, 1, 1}, + {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, + {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, + {&__pyx_n_s_unfoldTraj, __pyx_k_unfoldTraj, sizeof(__pyx_k_unfoldTraj), 0, 0, 1, 1}, + {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1}, + {&__pyx_n_s_van_hove, __pyx_k_van_hove, sizeof(__pyx_k_van_hove), 0, 0, 1, 1}, + {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, + {&__pyx_n_s_vh, __pyx_k_vh, sizeof(__pyx_k_vh), 0, 0, 1, 1}, + {&__pyx_n_s_vh_maxdist, __pyx_k_vh_maxdist, sizeof(__pyx_k_vh_maxdist), 0, 0, 1, 1}, + {&__pyx_n_s_vhmax, __pyx_k_vhmax, sizeof(__pyx_k_vhmax), 0, 0, 1, 1}, + {&__pyx_n_s_xyz, __pyx_k_xyz, sizeof(__pyx_k_xyz), 0, 0, 1, 1}, + {&__pyx_n_s_xyz2, __pyx_k_xyz2, sizeof(__pyx_k_xyz2), 0, 0, 1, 1}, + {&__pyx_n_s_xyz_tmp, __pyx_k_xyz_tmp, sizeof(__pyx_k_xyz_tmp), 0, 0, 1, 1}, + {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 37, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 365, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 619, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 100, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 156, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 159, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 373, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 408, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 618, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 914, __pyx_L1_error) + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 983, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cached_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + */ + __pyx_tuple__4 = PyTuple_New(1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_tuple__4, 0, __pyx_int_neg_1)) __PYX_ERR(1, 582, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_tuple__4); + + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False + */ + __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + */ + __pyx_tuple__8 = PyTuple_Pack(3, __pyx_int_136983863, __pyx_int_112105877, __pyx_int_184977713); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: + */ + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: + */ + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 989, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + + /* "newanalysis/helpers/diffusion.pyx":365 + * c1 = ccat + * elif n2 == n4: + * print("WARNING: same number of cation/anion species. Use msdMJ instead.") # <<<<<<<<<<<<<< + * + * cdef np.ndarray[np.float64_t,ndim=2] mj = np.zeros((n1,3),dtype=np.float64) + */ + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_WARNING_same_number_of_cation_an); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + + /* "newanalysis/helpers/diffusion.pyx":619 + * + * if n < 1: + * raise ValueError("n must be >1") # <<<<<<<<<<<<<< + * + * cdef double factor, result, dx, dy, dz, res2 + */ + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_n_must_be_1); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_sys); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_tuple__14 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + */ + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_collections_abc); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * + */ + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_collections); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + + /* "View.MemoryView":309 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") + */ + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * + */ + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * + */ + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_tuple__22 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "newanalysis/helpers/diffusion.pyx":12 + * from libc.math cimport fabs, sqrt, floor, pow + * + * def unfoldTraj(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< + * boxlength): + * """ + */ + __pyx_tuple__24 = PyTuple_Pack(13, __pyx_n_s_xyz, __pyx_n_s_boxlength, __pyx_n_s_boxl, __pyx_n_s_b2, __pyx_n_s_n, __pyx_n_s_nframes, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_d, __pyx_n_s_xyz_tmp, __pyx_n_s_data, __pyx_n_s_data_tmp); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_diffusion_py, __pyx_n_s_unfoldTraj, 12, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 12, __pyx_L1_error) + + /* "newanalysis/helpers/diffusion.pyx":50 + * return xyz + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None, vh_maxdist=200.0): + */ + __pyx_tuple__26 = PyTuple_Pack(28, __pyx_n_s_xyz, __pyx_n_s_maxlen, __pyx_n_s_vh_maxdist, __pyx_n_s_tmp, __pyx_n_s_result, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_res2, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_m, __pyx_n_s_pos, __pyx_n_s_idx1, __pyx_n_s_idx2, __pyx_n_s_vhmax, __pyx_n_s_msd, __pyx_n_s_msd_data, __pyx_n_s_data, __pyx_n_s_van_hove, __pyx_n_s_vh, __pyx_n_s_non_gaussian, __pyx_n_s_ng, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 28, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_diffusion_py, __pyx_n_s_msdCOMvHnG, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(2, Py_None, ((PyObject*)__pyx_float_200_0)); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + + /* "newanalysis/helpers/diffusion.pyx":120 + * return msd, van_hove, non_gaussian + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None): + */ + __pyx_tuple__29 = PyTuple_Pack(20, __pyx_n_s_xyz, __pyx_n_s_maxlen, __pyx_n_s_tmp, __pyx_n_s_result, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_res2, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_m, __pyx_n_s_pos, __pyx_n_s_msd, __pyx_n_s_msd_data, __pyx_n_s_data, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_diffusion_py, __pyx_n_s_msdCOM, 120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); + + /* "newanalysis/helpers/diffusion.pyx":170 + * return msd + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, + * np.ndarray[np.float64_t,ndim=3] xyz2, + */ + __pyx_tuple__32 = PyTuple_Pack(35, __pyx_n_s_xyz, __pyx_n_s_xyz2, __pyx_n_s_maxlen, __pyx_n_s_tmp, __pyx_n_s_result, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_res2, __pyx_n_s_dx2, __pyx_n_s_dy2, __pyx_n_s_dz2, __pyx_n_s_dx3, __pyx_n_s_dy3, __pyx_n_s_dz3, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_irel, __pyx_n_s_m, __pyx_n_s_nstep, __pyx_n_s_idx1, __pyx_n_s_idx2, __pyx_n_s_idx3, __pyx_n_s_idx4, __pyx_n_s_diag, __pyx_n_s_msd, __pyx_n_s_msd_data, __pyx_n_s_data, __pyx_n_s_data2, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 35, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_diffusion_py, __pyx_n_s_pairDisplacement, 170, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 170, __pyx_L1_error) + + /* "newanalysis/helpers/diffusion.pyx":241 + * return msd + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, + */ + __pyx_tuple__34 = PyTuple_Pack(25, __pyx_n_s_coms_cat, __pyx_n_s_coms_an, __pyx_n_s_maxlen, __pyx_n_s_charge_cat, __pyx_n_s_charge_an, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_m, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_ccat, __pyx_n_s_can, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_result, __pyx_n_s_cat, __pyx_n_s_an, __pyx_n_s_mj, __pyx_n_s_cmj, __pyx_n_s_msdmj, __pyx_n_s_msd, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_diffusion_py, __pyx_n_s_msdMJ, 241, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_tuple__36 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + + /* "newanalysis/helpers/diffusion.pyx":311 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, + */ + __pyx_tuple__37 = PyTuple_Pack(30, __pyx_n_s_coms_cat, __pyx_n_s_coms_an, __pyx_n_s_maxlen, __pyx_n_s_charge_cat, __pyx_n_s_charge_an, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_m, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_n4, __pyx_n_s_upper, __pyx_n_s_lower, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_result, __pyx_n_s_shorter, __pyx_n_s_longer, __pyx_n_s_ccat, __pyx_n_s_can, __pyx_n_s_mj, __pyx_n_s_cmj, __pyx_n_s_msdmj, __pyx_n_s_msd, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 30, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_diffusion_py, __pyx_n_s_msdMJCharges, 311, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 311, __pyx_L1_error) + + /* "newanalysis/helpers/diffusion.pyx":400 + * return msdmj + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossDisplacementMdMj(double [:, :, :] coms_cat, + * double [:, :, :] coms_an, + */ + __pyx_tuple__39 = PyTuple_Pack(17, __pyx_n_s_coms_cat, __pyx_n_s_coms_an, __pyx_n_s_md, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_nts, __pyx_n_s_nion, __pyx_n_s_mj_arr, __pyx_n_s_mj, __pyx_n_s_ctr_arr, __pyx_n_s_ctr, __pyx_n_s_disp_arr, __pyx_n_s_disp, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_result); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_diffusion_py, __pyx_n_s_crossDisplacementMdMj, 400, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 400, __pyx_L1_error) + + /* "newanalysis/helpers/diffusion.pyx":437 + * return disp_arr + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJdecomp(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, + */ + __pyx_tuple__41 = PyTuple_Pack(31, __pyx_n_s_coms_cat, __pyx_n_s_coms_an, __pyx_n_s_coms_sep, __pyx_n_s_charge, __pyx_n_s_maxlen, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_n3, __pyx_n_s_m, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_ch, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_dxs, __pyx_n_s_dys, __pyx_n_s_dzs, __pyx_n_s_result, __pyx_n_s_cat, __pyx_n_s_an, __pyx_n_s_sep, __pyx_n_s_mj, __pyx_n_s_cmj, __pyx_n_s_mj_sep, __pyx_n_s_cmj_sep, __pyx_n_s_msdmj, __pyx_n_s_msd, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_diffusion_py, __pyx_n_s_msdMJdecomp, 437, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 437, __pyx_L1_error) + + /* "newanalysis/helpers/diffusion.pyx":522 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJcrossterms(np.ndarray[np.float64_t,ndim=3] coms_s1, + * np.ndarray[np.float64_t,ndim=3] coms_s2, + */ + __pyx_tuple__43 = PyTuple_Pack(31, __pyx_n_s_coms_s1, __pyx_n_s_coms_s2, __pyx_n_s_charge_s1, __pyx_n_s_charge_s2, __pyx_n_s_maxlen, __pyx_n_s_n1, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_s1_n2, __pyx_n_s_s2_n2, __pyx_n_s_m, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_dx1, __pyx_n_s_dy1, __pyx_n_s_dz1, __pyx_n_s_dx2, __pyx_n_s_dy2, __pyx_n_s_dz2, __pyx_n_s_result, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_mj1, __pyx_n_s_cmj1, __pyx_n_s_mj2, __pyx_n_s_cmj2, __pyx_n_s_msdmj, __pyx_n_s_msd, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_diffusion_py, __pyx_n_s_msdMJcrossterms, 522, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 522, __pyx_L1_error) + + /* "newanalysis/helpers/diffusion.pyx":600 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, + * n=2, + */ + __pyx_tuple__45 = PyTuple_Pack(26, __pyx_n_s_xyz, __pyx_n_s_n, __pyx_n_s_maxlen, __pyx_n_s_factor, __pyx_n_s_result, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_res2, __pyx_n_s_deg, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_m, __pyx_n_s_pos, __pyx_n_s_msd, __pyx_n_s_msd_data, __pyx_n_s_msddeg, __pyx_n_s_msddeg_data, __pyx_n_s_alpha, __pyx_n_s_alpha_data, __pyx_n_s_data, __pyx_n_s_ctr, __pyx_n_s_c); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_diffusion_py, __pyx_n_s_nonGaussianParameter, 600, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 600, __pyx_L1_error) + __pyx_tuple__47 = PyTuple_Pack(2, ((PyObject *)__pyx_int_2), Py_None); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__47); + __Pyx_GIVEREF(__pyx_tuple__47); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_float_200_0 = PyFloat_FromDouble(200.0); if (unlikely(!__pyx_float_200_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 0)); else + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* NumpyImportArray.init */ + /* + * Cython has automatically inserted a call to _import_array since + * you didn't include one when you cimported numpy. To disable this + * add the line + * numpy._import_array + */ +#ifdef NPY_FEATURE_VERSION +#ifndef NO_IMPORT_ARRAY +if (unlikely(_import_array() == -1)) { + PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import " + "(auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; " + "use 'numpy._import_array' to disable if you are certain you don't need it)."); +} +#endif +#endif + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_module ### */ + +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_array_type)) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_array_type->tp_base->tp_as_buffer && __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #else + __pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_array_type->tp_print = 0; + #endif + if (__Pyx_SetVtable(__pyx_array_type, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_MemviewEnum_type)) __PYX_ERR(1, 302, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #else + __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_MemviewEnum_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_MemviewEnum_type->tp_dictoffset && __pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_MemviewEnum_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_memoryview_type)) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #else + __pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryview_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryview_type->tp_dictoffset && __pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryview_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_memoryview_type, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_memoryviewslice_type)) __PYX_ERR(1, 952, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #else + __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryviewslice_type->tp_base = __pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryviewslice_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryviewslice_type->tp_dictoffset && __pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryviewslice_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_2(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArray_Descr),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 202, __pyx_L1_error) + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 225, __pyx_L1_error) + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayMultiIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 229, __pyx_L1_error) + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 238, __pyx_L1_error) + __pyx_ptype_5numpy_generic = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 809, __pyx_L1_error) + __pyx_ptype_5numpy_number = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 811, __pyx_L1_error) + __pyx_ptype_5numpy_integer = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 813, __pyx_L1_error) + __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 815, __pyx_L1_error) + __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 817, __pyx_L1_error) + __pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 819, __pyx_L1_error) + __pyx_ptype_5numpy_floating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 821, __pyx_L1_error) + __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 823, __pyx_L1_error) + __pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_ptype_5numpy_character = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyUFuncObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 865, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_diffusion(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_diffusion}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "diffusion", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void +#endif +#else +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initdiffusion(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initdiffusion(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_diffusion(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_diffusion(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else + result = PyDict_SetItemString(moddict, to_name, value); +#endif + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + if (__Pyx_check_single_interpreter()) + return NULL; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; +#endif + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_diffusion(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + static PyThread_type_lock __pyx_t_8[8]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'diffusion' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("diffusion", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to diffusion pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_diffusion(void)", 0); + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + PyEval_InitThreads(); + #endif + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_newanalysis__diffusion) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "newanalysis.diffusion")) { + if (unlikely((PyDict_SetItemString(modules, "newanalysis.diffusion", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_version_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__14, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + goto __pyx_L8; + } + + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":104 + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None + */ + /*except:*/ { + __Pyx_AddTraceback("View.MemoryView", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(1, 104, __pyx_L4_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_7); + + /* "View.MemoryView":106 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * + */ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L3_exception_handled; + } + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + __pyx_L4_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":242 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":243 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L16_try_end; + __pyx_L11_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":244 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L12_exception_handled; + } + __pyx_L12_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L16_try_end:; + } + + /* "View.MemoryView":309 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":323 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), + */ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":324 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), + */ + __pyx_t_8[0] = PyThread_allocate_lock(); + __pyx_t_8[1] = PyThread_allocate_lock(); + __pyx_t_8[2] = PyThread_allocate_lock(); + __pyx_t_8[3] = PyThread_allocate_lock(); + __pyx_t_8[4] = PyThread_allocate_lock(); + __pyx_t_8[5] = PyThread_allocate_lock(); + __pyx_t_8[6] = PyThread_allocate_lock(); + __pyx_t_8[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_8, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":983 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); + + /* "View.MemoryView":984 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); + + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L22_try_end; + __pyx_L17_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":985 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L18_exception_handled; + } + __pyx_L18_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L22_try_end:; + } + + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 989, __pyx_L23_error) + if (__pyx_t_6) { + + /* "View.MemoryView":993 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_memoryviewslice_type)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":994 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_array_type)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + } + + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L28_try_end; + __pyx_L23_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":995 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L24_exception_handled; + } + __pyx_L24_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L28_try_end:; + } + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":4 + * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * + */ + __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_7) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":12 + * from libc.math cimport fabs, sqrt, floor, pow + * + * def unfoldTraj(np.ndarray[np.float64_t,ndim=3] xyz, # <<<<<<<<<<<<<< + * boxlength): + * """ + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9diffusion_1unfoldTraj, 0, __pyx_n_s_unfoldTraj, NULL, __pyx_n_s_newanalysis_diffusion, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_unfoldTraj, __pyx_t_7) < 0) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":50 + * return xyz + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdCOMvHnG(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None, vh_maxdist=200.0): + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9diffusion_3msdCOMvHnG, 0, __pyx_n_s_msdCOMvHnG, NULL, __pyx_n_s_newanalysis_diffusion, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__28); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdCOMvHnG, __pyx_t_7) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":120 + * return msd, van_hove, non_gaussian + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdCOM(np.ndarray[np.float64_t,ndim=3] xyz, + * maxlen=None): + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9diffusion_5msdCOM, 0, __pyx_n_s_msdCOM, NULL, __pyx_n_s_newanalysis_diffusion, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__31); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdCOM, __pyx_t_7) < 0) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":170 + * return msd + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def pairDisplacement(np.ndarray[np.float64_t,ndim=3] xyz, + * np.ndarray[np.float64_t,ndim=3] xyz2, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9diffusion_7pairDisplacement, 0, __pyx_n_s_pairDisplacement, NULL, __pyx_n_s_newanalysis_diffusion, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__31); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pairDisplacement, __pyx_t_7) < 0) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":241 + * return msd + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJ(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9diffusion_9msdMJ, 0, __pyx_n_s_msdMJ, NULL, __pyx_n_s_newanalysis_diffusion, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__36); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdMJ, __pyx_t_7) < 0) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":311 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJCharges(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9diffusion_11msdMJCharges, 0, __pyx_n_s_msdMJCharges, NULL, __pyx_n_s_newanalysis_diffusion, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__36); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdMJCharges, __pyx_t_7) < 0) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":400 + * return msdmj + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossDisplacementMdMj(double [:, :, :] coms_cat, + * double [:, :, :] coms_an, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9diffusion_13crossDisplacementMdMj, 0, __pyx_n_s_crossDisplacementMdMj, NULL, __pyx_n_s_newanalysis_diffusion, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_crossDisplacementMdMj, __pyx_t_7) < 0) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":437 + * return disp_arr + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJdecomp(np.ndarray[np.float64_t,ndim=3] coms_cat, + * np.ndarray[np.float64_t,ndim=3] coms_an, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9diffusion_15msdMJdecomp, 0, __pyx_n_s_msdMJdecomp, NULL, __pyx_n_s_newanalysis_diffusion, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__31); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdMJdecomp, __pyx_t_7) < 0) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":522 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def msdMJcrossterms(np.ndarray[np.float64_t,ndim=3] coms_s1, + * np.ndarray[np.float64_t,ndim=3] coms_s2, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9diffusion_17msdMJcrossterms, 0, __pyx_n_s_msdMJcrossterms, NULL, __pyx_n_s_newanalysis_diffusion, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__31); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdMJcrossterms, __pyx_t_7) < 0) __PYX_ERR(0, 522, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":600 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def nonGaussianParameter(np.ndarray[np.float64_t,ndim=3] xyz, + * n=2, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_9diffusion_19nonGaussianParameter, 0, __pyx_n_s_nonGaussianParameter, NULL, __pyx_n_s_newanalysis_diffusion, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__47); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_nonGaussianParameter, __pyx_t_7) < 0) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/diffusion.pyx":1 + * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< + * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + * + */ + __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + if (__pyx_m) { + if (__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init newanalysis.diffusion", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init newanalysis.diffusion"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) +} +#endif + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); // transfer ownership of value to values + Py_DECREF(key); +#endif + key = NULL; + value = NULL; + continue; + } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = ( + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key) + ); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + Py_XDECREF(key); + Py_XDECREF(value); + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + Py_XDECREF(key); + Py_XDECREF(value); + return -1; +} + +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { + return NULL; + } + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; } -static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - PyErr_Format(PyExc_ValueError, - "Unexpected format string character: '%c'", ch); +#endif + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) +#else + if (PyCFunction_Check(func)) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + } + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } + } + } +#endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + #if CYTHON_VECTORCALL + #if Py_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); + } + #endif + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); +} + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* CIntToDigits */ +static const char DIGIT_PAIRS_10[2*10*10+1] = { + "00010203040506070809" + "10111213141516171819" + "20212223242526272829" + "30313233343536373839" + "40414243444546474849" + "50515253545556575859" + "60616263646566676869" + "70717273747576777879" + "80818283848586878889" + "90919293949596979899" +}; +static const char DIGIT_PAIRS_8[2*8*8+1] = { + "0001020304050607" + "1011121314151617" + "2021222324252627" + "3031323334353637" + "4041424344454647" + "5051525354555657" + "6061626364656667" + "7071727374757677" +}; +static const char DIGITS_HEX[2*16+1] = { + "0123456789abcdef" + "0123456789ABCDEF" +}; + +/* BuildPyUnicode */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char) { + PyObject *uval; + Py_ssize_t uoffset = ulength - clength; +#if CYTHON_USE_UNICODE_INTERNALS + Py_ssize_t i; +#if CYTHON_PEP393_ENABLED + void *udata; + uval = PyUnicode_New(ulength, 127); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_DATA(uval); +#else + Py_UNICODE *udata; + uval = PyUnicode_FromUnicode(NULL, ulength); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_AS_UNICODE(uval); +#endif + if (uoffset > 0) { + i = 0; + if (prepend_sign) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); + i++; + } + for (; i < uoffset; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); + } + } + for (i=0; i < clength; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); + } +#else + { + PyObject *sign = NULL, *padding = NULL; + uval = NULL; + if (uoffset > 0) { + prepend_sign = !!prepend_sign; + if (uoffset > prepend_sign) { + padding = PyUnicode_FromOrdinal(padding_char); + if (likely(padding) && uoffset > prepend_sign + 1) { + PyObject *tmp; + PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign); + if (unlikely(!repeat)) goto done_or_error; + tmp = PyNumber_Multiply(padding, repeat); + Py_DECREF(repeat); + Py_DECREF(padding); + padding = tmp; + } + if (unlikely(!padding)) goto done_or_error; + } + if (prepend_sign) { + sign = PyUnicode_FromOrdinal('-'); + if (unlikely(!sign)) goto done_or_error; + } + } + uval = PyUnicode_DecodeASCII(chars, clength, NULL); + if (likely(uval) && padding) { + PyObject *tmp = PyNumber_Add(padding, uval); + Py_DECREF(uval); + uval = tmp; + } + if (likely(uval) && sign) { + PyObject *tmp = PyNumber_Add(sign, uval); + Py_DECREF(uval); + uval = tmp; + } +done_or_error: + Py_XDECREF(padding); + Py_XDECREF(sign); + } +#endif + return uval; +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(int)*3+2]; + char *dpos, *end = digits + sizeof(int)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + int remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (int) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (int) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (int) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (Py_ssize_t) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (Py_ssize_t) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (Py_ssize_t) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + CYTHON_MAYBE_UNUSED_VAR(max_char); +#if CYTHON_PEP393_ENABLED + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); +#else + result_uval = PyUnicode_FromUnicode(NULL, result_ulength); + if (unlikely(!result_uval)) return NULL; + result_ukind = sizeof(Py_UNICODE); + kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; + result_udata = PyUnicode_AS_UNICODE(result_uval); +#endif + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); + if (unlikely(__Pyx_PyUnicode_READY(uval))) + goto bad; + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030D0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif + } + char_pos += ulength; + } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; +#else + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + CYTHON_UNUSED_VAR(value_count); + return PyUnicode_Join(__pyx_empty_unicode, value_tuple); +#endif +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { - switch (ch) { - case '?': return "'bool'"; - case 'c': return "'char'"; - case 'b': return "'signed char'"; - case 'B': return "'unsigned char'"; - case 'h': return "'short'"; - case 'H': return "'unsigned short'"; - case 'i': return "'int'"; - case 'I': return "'unsigned int'"; - case 'l': return "'long'"; - case 'L': return "'unsigned long'"; - case 'q': return "'long long'"; - case 'Q': return "'unsigned long long'"; - case 'f': return (is_complex ? "'complex float'" : "'float'"); - case 'd': return (is_complex ? "'complex double'" : "'double'"); - case 'g': return (is_complex ? "'complex long double'" : "'long double'"); - case 'T': return "a struct"; - case 'O': return "Python object"; - case 'P': return "a pointer"; - case 's': case 'p': return "a string"; - case 0: return "end"; - default: return "unparseable format string"; - } + +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } -static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return 2; - case 'i': case 'I': case 'l': case 'L': return 4; - case 'q': case 'Q': return 8; - case 'f': return (is_complex ? 8 : 4); - case 'd': return (is_complex ? 16 : 8); - case 'g': { - PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); - return 0; + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); } - case 'O': case 'P': return sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); } + return NULL; } -static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(short); - case 'i': case 'I': return sizeof(int); - case 'l': case 'L': return sizeof(long); - #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(PY_LONG_LONG); - #endif - case 'f': return sizeof(float) * (is_complex ? 2 : 1); - case 'd': return sizeof(double) * (is_complex ? 2 : 1); - case 'g': return sizeof(long double) * (is_complex ? 2 : 1); - case 'O': case 'P': return sizeof(void*); - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (meth) { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } } - } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; } -typedef struct { char c; short x; } __Pyx_st_short; -typedef struct { char c; int x; } __Pyx_st_int; -typedef struct { char c; long x; } __Pyx_st_long; -typedef struct { char c; float x; } __Pyx_st_float; -typedef struct { char c; double x; } __Pyx_st_double; -typedef struct { char c; long double x; } __Pyx_st_longdouble; -typedef struct { char c; void *x; } __Pyx_st_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; -#endif -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); -#endif - case 'f': return sizeof(__Pyx_st_float) - sizeof(float); - case 'd': return sizeof(__Pyx_st_double) - sizeof(double); - case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); } + return __Pyx_PyObject_GetItem_Slow(obj, key); } -/* These are for computing the padding at the end of the struct to align - on the first member of the struct. This will probably the same as above, - but we don't have any guarantees. - */ -typedef struct { short x; char c; } __Pyx_pad_short; -typedef struct { int x; char c; } __Pyx_pad_int; -typedef struct { long x; char c; } __Pyx_pad_long; -typedef struct { float x; char c; } __Pyx_pad_float; -typedef struct { double x; char c; } __Pyx_pad_double; -typedef struct { long double x; char c; } __Pyx_pad_longdouble; -typedef struct { void *x; char c; } __Pyx_pad_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif -static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + Py_ssize_t kwsize; +#if CYTHON_ASSUME_SAFE_MACROS + kwsize = PyTuple_GET_SIZE(kw); +#else + kwsize = PyTuple_Size(kw); + if (kwsize < 0) return 0; #endif - case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); - case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); - case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + if (unlikely(kwsize == 0)) + return 1; + if (!kw_allowed) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, 0); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + goto invalid_keyword; + } +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < kwsize; pos++) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } +#endif + return 1; + } + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; } + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; } -static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { - switch (ch) { - case 'c': - return 'H'; - case 'b': case 'h': case 'i': - case 'l': case 'q': case 's': case 'p': - return 'I'; - case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': - return 'U'; - case 'f': case 'd': case 'g': - return (is_complex ? 'C' : 'R'); - case 'O': - return 'O'; - case 'P': - return 'P'; - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +/* GetAttr3 */ +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyString_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; } - } +#endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); } -static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { - if (ctx->head == NULL || ctx->head->field == &ctx->root) { - const char* expected; - const char* quote; - if (ctx->head == NULL) { - expected = "end"; - quote = ""; - } else { - expected = ctx->head->field->type->name; - quote = "'"; + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif } - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected %s%s%s but got %s", - quote, expected, quote, - __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); - } else { - __Pyx_StructField* field = ctx->head->field; - __Pyx_StructField* parent = (ctx->head - 1)->field; - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", - field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), - parent->type->name, field->name); - } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); } -static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { - char group; - size_t size, offset, arraysize = 1; - if (ctx->enc_type == 0) return 0; - if (ctx->head->field->type->arraysize[0]) { - int i, ndim = 0; - if (ctx->enc_type == 's' || ctx->enc_type == 'p') { - ctx->is_valid_array = ctx->head->field->type->ndim == 1; - ndim = 1; - if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { - PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %zu", - ctx->head->field->type->arraysize[0], ctx->enc_count); - return -1; - } +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; } - if (!ctx->is_valid_array) { - PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", - ctx->head->field->type->ndim, ndim); - return -1; +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; } - for (i = 0; i < ctx->head->field->type->ndim; i++) { - arraysize *= ctx->head->field->type->arraysize[i]; + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; } - ctx->is_valid_array = 0; - ctx->enc_count = 1; - } - group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); - do { - __Pyx_StructField* field = ctx->head->field; - __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { - size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); - } else { - size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); } - if (ctx->enc_packmode == '@') { - size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - size_t align_mod_offset; - if (align_at == 0) return -1; - align_mod_offset = ctx->fmt_offset % align_at; - if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; - if (ctx->struct_alignment == 0) - ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, - ctx->is_complex); +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); } - if (type->size != size || type->typegroup != group) { - if (type->typegroup == 'C' && type->fields != NULL) { - size_t parent_offset = ctx->head->parent_offset + field->offset; - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = parent_offset; - continue; - } - if ((type->typegroup == 'H' || group == 'H') && type->size == size) { - } else { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; } - offset = ctx->head->parent_offset + field->offset; - if (ctx->fmt_offset != offset) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", - (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); - return -1; + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* GetTopmostException */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; } - ctx->fmt_offset += size; - if (arraysize) - ctx->fmt_offset += (arraysize - 1) * size; - --ctx->enc_count; - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - break; - } - ctx->head->field = ++field; - if (field->type == NULL) { - --ctx->head; - field = ctx->head->field; - continue; - } else if (field->type->typegroup == 'S') { - size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; - field = field->type->fields; - ++ctx->head; - ctx->head->field = field; - ctx->head->parent_offset = parent_offset; - break; - } else { - break; - } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); } - } while (ctx->enc_count); - ctx->enc_type = 0; - ctx->is_complex = 0; - return 0; + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif } -static PyObject * -__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif { - const char *ts = *tsp; - int i = 0, number, ndim; - ++ts; - if (ctx->new_count != 1) { - PyErr_SetString(PyExc_ValueError, - "Cannot handle repeated arrays in format string"); - return NULL; + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ndim = ctx->head->field->type->ndim; - while (*ts && *ts != ')') { - switch (*ts) { - case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; - default: break; - } - number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) - return PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %d", - ctx->head->field->type->arraysize[i], number); - if (*ts != ',' && *ts != ')') - return PyErr_Format(PyExc_ValueError, - "Expected a comma in format string, got '%c'", *ts); - if (*ts == ',') ts++; - i++; + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif } - if (i != ndim) - return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", - ctx->head->field->type->ndim, i); - if (!*ts) { - PyErr_SetString(PyExc_ValueError, - "Unexpected end of format string, expected ')'"); - return NULL; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif } - ctx->is_valid_array = 1; - ctx->new_count = 1; - *tsp = ++ts; - return Py_None; + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; } -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { - int got_Z = 0; - while (1) { - switch(*ts) { - case 0: - if (ctx->enc_type != 0 && ctx->head == NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - if (ctx->head != NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - return ts; - case ' ': - case '\r': - case '\n': - ++ts; - break; - case '<': - if (!__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '=': - case '@': - case '^': - ctx->new_packmode = *ts++; - break; - case 'T': - { - const char* ts_after_sub; - size_t i, struct_count = ctx->new_count; - size_t struct_alignment = ctx->struct_alignment; - ctx->new_count = 1; - ++ts; - if (*ts != '{') { - PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - ctx->enc_count = 0; - ctx->struct_alignment = 0; - ++ts; - ts_after_sub = ts; - for (i = 0; i != struct_count; ++i) { - ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); - if (!ts_after_sub) return NULL; - } - ts = ts_after_sub; - if (struct_alignment) ctx->struct_alignment = struct_alignment; - } - break; - case '}': - { - size_t alignment = ctx->struct_alignment; - ++ts; - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - if (alignment && ctx->fmt_offset % alignment) { - ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); - } - } - return ts; - case 'x': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->fmt_offset += ctx->new_count; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->enc_packmode = ctx->new_packmode; - ++ts; - break; - case 'Z': - got_Z = 1; - ++ts; - if (*ts != 'f' && *ts != 'd' && *ts != 'g') { - __Pyx_BufFmt_RaiseUnexpectedChar('Z'); - return NULL; - } - CYTHON_FALLTHROUGH; - case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': - case 'l': case 'L': case 'q': case 'Q': - case 'f': case 'd': case 'g': - case 'O': case 'p': - if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && - (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { - ctx->enc_count += ctx->new_count; - ctx->new_count = 1; - got_Z = 0; - ++ts; - break; - } - CYTHON_FALLTHROUGH; - case 's': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_count = ctx->new_count; - ctx->enc_packmode = ctx->new_packmode; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; - ++ts; - ctx->new_count = 1; - got_Z = 0; - break; - case ':': - ++ts; - while(*ts != ':') ++ts; - ++ts; - break; - case '(': - if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; - break; - default: - { - int number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - ctx->new_count = (size_t)number; +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) + goto bad; + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) + goto bad; + from_list = empty_list; + } + #endif + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif } } - } +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + return module; } -/* BufferGetAndValidate */ - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (unlikely(info->buf == NULL)) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); + } + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; } -static void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); +#endif + return imported_module; } -static int __Pyx__GetBufferAndValidate( - Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, - int nd, int cast, __Pyx_BufFmt_StackElem* stack) -{ - buf->buf = NULL; - if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { - __Pyx_ZeroBuffer(buf); - return -1; - } - if (unlikely(buf->ndim != nd)) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - nd, buf->ndim); - goto fail; - } - if (!cast) { - __Pyx_BufFmt_Context ctx; - __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; - } - if (unlikely((size_t)buf->itemsize != dtype->size)) { - PyErr_Format(PyExc_ValueError, - "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", - buf->itemsize, (buf->itemsize > 1) ? "s" : "", - dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); - goto fail; - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_SafeReleaseBuffer(buf); - return -1; +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; + } + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; +} +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__3; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; + } + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); + } + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); + } +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); } -/* GetItemInt */ - static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; +/* ssize_strlen */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} #else - return PySequence_GetItem(o, i); +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else #endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} + +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); + } else { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); return r; } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); + if (likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); if (likely(l >= 0)) { i += l; } else { if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; + return -1; PyErr_Clear(); } } - return m->sq_item(o, i); + return sm->sq_ass_item(o, i, v); } } #else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) +#else + if (is_list || PySequence_Check(o)) +#endif + { + return PySequence_SetItem(o, i, v); } #endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } -/* PyDictVersioning */ - #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +/* RaiseUnboundLocalError */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; } -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + +/* HasAttr */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_GetAttr(o, n); + if (!r) { + PyErr_Clear(); return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); + } else { + Py_DECREF(r); + return 1; + } } -#endif -/* GetModuleGlobalName */ - #if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif +/* IsLittleEndian */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; + union { + uint32_t u32; + uint8_t u8[4]; + } S; + S.u32 = 0x01020304; + return S.u8[0] == 4; +} + +/* BufferFormatCheck */ +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t <= '9') { + count *= 10; + count += *t++ - '0'; + } } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case '?': return "'bool'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparsable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - PyErr_Clear(); +} +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif - return __Pyx_GetBuiltinName(name); -} - -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } } +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; } -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } + } +} +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; } - nk = i / 2; } - else { - kwtuple = NULL; - k = NULL; + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; } - else { - d = NULL; - nd = 0; + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif -#endif - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); } - return result; -} -#endif - -/* PyObjectCall2Args */ - static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); +static int +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number, ndim; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return -1; } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return -1; + ndim = ctx->head->field->type->ndim; + while (*ts && *ts != ')') { + switch (*ts) { + case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; + default: break; + } + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return -1; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + return -1; + } + if (*ts != ',' && *ts != ')') { + PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + return -1; } + if (*ts == ',') ts++; + i++; } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; + if (i != ndim) { + PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + return -1; + } + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return -1; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return 0; } -#endif - -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case '\r': + case '\n': + ++ts; + break; + case '<': + if (!__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; + } + break; + case '}': + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } + CYTHON_FALLTHROUGH; + case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 'p': + if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && + (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { + ctx->enc_count += ctx->new_count; + ctx->new_count = 1; + got_Z = 0; + ++ts; + break; + } + CYTHON_FALLTHROUGH; + case 's': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (__pyx_buffmt_parse_array(ctx, &ts) < 0) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; + } } - if (likely(__Pyx_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; + } } -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; +/* BufferGetAndValidate */ + static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (unlikely(info->buf == NULL)) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); } -#endif - -/* SetItemInt */ - static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; +static void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; } -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, - CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { - PyObject* old = PyList_GET_ITEM(o, n); - Py_INCREF(v); - PyList_SET_ITEM(o, n, v); - Py_DECREF(old); - return 1; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_ass_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return -1; - PyErr_Clear(); - } - } - return m->sq_ass_item(o, i, v); - } - } -#else -#if CYTHON_COMPILING_IN_PYPY - if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) -#else - if (is_list || PySequence_Check(o)) -#endif - { - return PySequence_SetItem(o, i, v); - } -#endif - return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +static int __Pyx__GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + buf->buf = NULL; + if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { + __Pyx_ZeroBuffer(buf); + return -1; + } + if (unlikely(buf->ndim != nd)) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if (unlikely((size_t)buf->itemsize != dtype->size)) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_SafeReleaseBuffer(buf); + return -1; } -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } +/* PyIntBinop */ + #if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_MultiplyObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op1))) { + const long b = intval; + long a = PyInt_AS_LONG(op1); + +#ifdef HAVE_LONG_LONG + if (sizeof(PY_LONG_LONG) > sizeof(long)) { + PY_LONG_LONG result = (PY_LONG_LONG)a * (PY_LONG_LONG)b; + return (result >= LONG_MIN && result <= LONG_MAX) ? + PyInt_FromLong((long)result) : PyLong_FromLongLong(result); + } #endif -#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) +#if CYTHON_USE_TYPE_SLOTS + return PyInt_Type.tp_as_number->nb_multiply(op1, op2); #else - if (likely(PyCFunction_Check(func))) + return PyNumber_Multiply(op1, op2); #endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} + #endif + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + const long b = intval; + long a, x; +#ifdef HAVE_LONG_LONG + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla, llx; #endif - -/* MemviewSliceInit */ - static int -__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference) -{ - __Pyx_RefNannyDeclarations - int i, retval=-1; - Py_buffer *buf = &memview->view; - __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (unlikely(memviewslice->memview || memviewslice->data)) { - PyErr_SetString(PyExc_ValueError, - "memviewslice is already initialized!"); - goto fail; - } - if (buf->strides) { - for (i = 0; i < ndim; i++) { - memviewslice->strides[i] = buf->strides[i]; - } - } else { - Py_ssize_t stride = buf->itemsize; - for (i = ndim - 1; i >= 0; i--) { - memviewslice->strides[i] = stride; - stride *= buf->shape[i]; + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op1); } - } - for (i = 0; i < ndim; i++) { - memviewslice->shape[i] = buf->shape[i]; - if (buf->suboffsets) { - memviewslice->suboffsets[i] = buf->suboffsets[i]; + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); } else { - memviewslice->suboffsets[i] = -1; + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); + switch (size) { + case -2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) { + a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) { + lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) { + lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case -3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) { + a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) { + lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) { + lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case -4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) { + a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) { + lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) { + lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + default: return PyLong_Type.tp_as_number->nb_multiply(op1, op2); + } } + CYTHON_UNUSED_VAR(a); + CYTHON_UNUSED_VAR(b); + #ifdef HAVE_LONG_LONG + lla = a; + goto long_long; + #else + return PyLong_Type.tp_as_number->nb_multiply(op1, op2); + #endif + return PyLong_FromLong(x); +#ifdef HAVE_LONG_LONG + long_long: + llx = lla * llb; + return PyLong_FromLongLong(llx); +#endif + + } - memviewslice->memview = memview; - memviewslice->data = (char *)buf->buf; - if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { - Py_INCREF(memview); - } - retval = 0; - goto no_fail; -fail: - memviewslice->memview = 0; - memviewslice->data = 0; - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else + double a = PyFloat_AS_DOUBLE(op1); +#endif + double result; + + PyFPE_START_PROTECT("multiply", return NULL) + result = ((double)a) * (double)b; + PyFPE_END_PROTECT(result) + return PyFloat_FromDouble(result); + } + return (inplace ? PyNumber_InPlaceMultiply : PyNumber_Multiply)(op1, op2); } -#ifndef Py_NO_RETURN -#define Py_NO_RETURN #endif -static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { - va_list vargs; - char msg[200]; -#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) - va_start(vargs, fmt); + +/* PyObject_GenericGetAttrNoDict */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else - va_start(vargs); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif - vsnprintf(msg, 200, fmt, vargs); - va_end(vargs); - Py_FatalError(msg); -} -static CYTHON_INLINE int -__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)++; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE int -__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)--; - PyThread_release_lock(lock); - return result; + __Pyx_DECREF_TypeName(type_name); + return NULL; } -static CYTHON_INLINE void -__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) -{ - int first_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) - return; - if (unlikely(__pyx_get_slice_count(memview) < 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - first_time = __pyx_add_acquisition_count(memview) == 0; - if (unlikely(first_time)) { - if (have_gil) { - Py_INCREF((PyObject *) memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_INCREF((PyObject *) memview); - PyGILState_Release(_gilstate); - } +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); } -} -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, - int have_gil, int lineno) { - int last_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) { - memslice->memview = NULL; - return; + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); } - if (unlikely(__pyx_get_slice_count(memview) <= 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - last_time = __pyx_sub_acquisition_count(memview) == 1; - memslice->data = NULL; - if (unlikely(last_time)) { - if (have_gil) { - Py_CLEAR(memslice->memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_CLEAR(memslice->memview); - PyGILState_Release(_gilstate); + Py_INCREF(descr); + #if PY_MAJOR_VERSION < 3 + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) + #endif + { + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; } - } else { - memslice->memview = NULL; } + return descr; } - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } #endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } + +/* PyObject_GenericGetAttr */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { + if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { + return PyObject_GenericGetAttr(obj, attr_name); } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; + return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); } +#endif + +/* FixUpExtensionType */ + #if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); #else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; #else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); + type->tp_print = (printfunc) memb->offset; #endif - } -bad: - Py_XDECREF(owned_instance); - return; -} + changed = 1; + } #endif - -/* GetTopmostException */ - #if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; + } + if (changed) + PyType_Modified(type); } - return exc_info; +#endif + return 0; } #endif -/* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); +/* PyObjectCallNoArg */ + static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } -#endif -/* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; itp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif #endif - for (i=0; itp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); +#endif + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; } +#endif + *method = attr; return 0; } -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { - PyObject *exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + +/* PyObjectCallMethod0 */ + static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; } -#endif -/* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +/* ValidateBasesTuple */ + #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_MACROS + n = PyTuple_GET_SIZE(bases); #else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) + n = PyTuple_Size(bases); + if (n < 0) return -1; #endif -{ - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; + for (i = 1; i < n; i++) + { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); #else - PyErr_Fetch(&local_type, &local_value, &local_tb); + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; #endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#if !CYTHON_USE_TYPE_SLOTS + if (dictoffset == 0) { + PyErr_Format(PyExc_TypeError, + "extension type '%s.200s': " + "unable to validate whether bases have a __dict__ " + "when CYTHON_USE_TYPE_SLOTS is off " + "(likely because you are building in the limited API). " + "Therefore, all extension types with multiple bases " + "must add 'cdef dict __dict__' in this compilation mode", + type_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } #else - if (unlikely(PyErr_Occurred())) + if (dictoffset == 0 && b->tp_dictoffset) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); #endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if CYTHON_USE_EXC_INFO_STACK + return 0; +} +#endif + +/* PyType_Ready */ + static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) { - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; - } + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif #else - PyErr_SetExcInfo(local_type, local_value, local_tb); + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + +/* SetVTable */ + static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) #endif + goto bad; + Py_DECREF(ob); return 0; bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); + Py_XDECREF(ob); return -1; } -/* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); +/* GetVTable */ + static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); #else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); #endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i; + void** base_vtables; + __Pyx_TypeName tp_base_name; + __Pyx_TypeName base_name; + void* unknown = (void*)-1; + PyObject* bases = type->tp_bases; + int base_depth = 0; + { + PyTypeObject* base = type->tp_base; + while (base) { + base_depth += 1; + base = base->tp_base; + } + } + base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; + for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { + void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); + if (base_vtable != NULL) { + int j; + PyTypeObject* base = type->tp_base; + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = base->tp_base; + } } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; } -#endif + PyErr_Clear(); + free(base_vtables); + return 0; +bad: + tp_base_name = __Pyx_PyType_GetName(type->tp_base); + base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); + free(base_vtables); + return -1; } +#endif -/* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); +/* SetupReduce */ + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); #else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; } #endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } -#if CYTHON_USE_UNICODE_INTERNALS - { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; - #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } + if (getstate) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); +#else + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; } #endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; + if (object_getstate != getstate) { + goto __PYX_GOOD; } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); + } +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); + if (likely(reduce_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); + if (likely(setstate_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } + } + PyType_Modified((PyTypeObject*)type_obj); } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } + ret = -1; +__PYX_GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); + Py_XDECREF(object_getstate); + Py_XDECREF(getstate); #endif + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; } +#endif -/* DivInt[Py_ssize_t] */ - static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { - Py_ssize_t q = a / b; - Py_ssize_t r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; +/* TypeImport */ + #ifndef __PYX_HAVE_RT_ImportType_3_0_2 +#define __PYX_HAVE_RT_ImportType_3_0_2 +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size) +{ + PyObject *result = 0; + char warning[200]; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + PyObject *py_itemsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#if !CYTHON_COMPILING_IN_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_2 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_2 && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; } - -/* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) -#else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); #endif - return PyObject_GetAttr(o, n); + +/* FetchSharedCythonModule */ + static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; } -/* ObjectGetItem */ - #if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr = NULL; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); +/* FetchCommonType */ + static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; } - return NULL; + return 0; } -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { + goto bad; + } + goto done; } - return __Pyx_PyObject_GetIndex(obj, key); + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; } +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; #endif - -/* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { + goto bad; } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - } - if (unlikely(stop <= start)) - return __Pyx_NewRef(__pyx_empty_unicode); - length = stop - start; - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); + goto done; } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; +done: + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; } +#endif -/* GetAttr3 */ - static PyObject *__Pyx_GetAttr3Default(PyObject *d) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) +/* PyVectorcallFastCallDict */ + #if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(d); - return d; -} -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r = __Pyx_GetAttr(o, n); - return (likely(r)) ? r : __Pyx_GetAttr3Default(d); + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; } - -/* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); } +#endif -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); +/* CythonFunctionShared */ + static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif } - -/* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) +{ + CYTHON_UNUSED_VAR(closure); + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; } - -/* SwapException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = *type; - exc_info->exc_value = *value; - exc_info->exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + return 0; } +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#elif PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; + if (unlikely(op->func_name == NULL)) + return NULL; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_name, value); + return 0; } - -/* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; } - return b == &PyBaseObject_Type; + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + return 0; } -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; } - return __Pyx_InBases(a, b); + Py_INCREF(op->func_dict); + return op->func_dict; } -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; } - __Pyx_ErrRestore(exception, value, tb); - return res; + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_dict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; } -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; } - return res; + #endif + Py_DECREF(res); + return result; } -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; idefaults_tuple, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; } else { + result = Py_None; } } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); return 0; } -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { - if (likely(err == exc_type)) return 1; - if (likely(PyExceptionClass_Check(err))) { - if (likely(PyExceptionClass_Check(exc_type))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); - } else if (likely(PyTuple_Check(exc_type))) { - return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; } else { + result = Py_None; } } - return PyErr_GivenExceptionMatches(err, exc_type); + Py_INCREF(result); + return result; } -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { - assert(PyExceptionClass_Check(exc_type1)); - assert(PyExceptionClass_Check(exc_type2)); - if (likely(err == exc_type1 || err == exc_type2)) return 1; - if (likely(PyExceptionClass_Check(err))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; } - return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); + Py_XINCREF(value); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + return 0; } -#endif - -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } #endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); + } #endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, #endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; #endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; #endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, #endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); -} #endif - -/* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -/* DivInt[long] */ - static CYTHON_INLINE long __Pyx_div_long(long a, long b) { - long q = a / b; - long r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -/* HasAttr */ - static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { - PyObject *r; - if (unlikely(!__Pyx_PyBaseString_Check(n))) { - PyErr_SetString(PyExc_TypeError, - "hasattr(): attribute name must be string"); - return -1; - } - r = __Pyx_GetAttr(o, n); - if (unlikely(!r)) { - PyErr_Clear(); - return 0; - } else { - Py_DECREF(r); - return 1; - } -} - -/* PyObject_GenericGetAttrNoDict */ - #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { - PyErr_Format(PyExc_AttributeError, + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + CYTHON_UNUSED_VAR(args); #if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); + Py_INCREF(m->func_qualname); + return m->func_qualname; #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); #endif - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { - PyObject *descr; - PyTypeObject *tp = Py_TYPE(obj); - if (unlikely(!PyString_Check(attr_name))) { - return PyObject_GenericGetAttr(obj, attr_name); - } - assert(!tp->tp_dictoffset); - descr = _PyType_Lookup(tp, attr_name); - if (unlikely(!descr)) { - return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); - } - Py_INCREF(descr); - #if PY_MAJOR_VERSION < 3 - if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) - #endif - { - descrgetfunc f = Py_TYPE(descr)->tp_descr_get; - if (unlikely(f)) { - PyObject *res = f(descr, obj, (PyObject *)tp); - Py_DECREF(descr); - return res; - } - } - return descr; } +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif - -/* PyObject_GenericGetAttr */ - #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { - if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { - return PyObject_GenericGetAttr(obj, attr_name); +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults_size = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; } - return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); -} #endif - -/* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); #else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } #endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; + } return 0; -bad: - Py_XDECREF(ob); - return -1; } - -/* PyObjectGetAttrStrNoError */ - static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); } + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyObject *py_name = NULL; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); #endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); +#endif + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; } - return result; -} - -/* SetupReduce */ - static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { - int ret; - PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); - if (likely(name_attr)) { - ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); - } else { - ret = -1; - } - if (unlikely(ret < 0)) { - PyErr_Clear(); - ret = 0; - } - Py_XDECREF(name_attr); - return ret; +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", + py_name); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); +#endif + return NULL; } -static int __Pyx_setup_reduce(PyObject* type_obj) { - int ret = 0; - PyObject *object_reduce = NULL; - PyObject *object_getstate = NULL; - PyObject *object_reduce_ex = NULL; - PyObject *reduce = NULL; - PyObject *reduce_ex = NULL; - PyObject *reduce_cython = NULL; - PyObject *setstate = NULL; - PyObject *setstate_cython = NULL; - PyObject *getstate = NULL; -#if CYTHON_USE_PYTYPE_LOOKUP - getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; #else - getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); - if (!getstate && PyErr_Occurred()) { - goto __PYX_BAD; - } + self = ((PyCFunctionObject*)func)->m_self; #endif - if (getstate) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); #else - object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); - if (!object_getstate && PyErr_Occurred()) { - goto __PYX_BAD; - } + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); #endif - if (object_getstate != getstate) { - goto __PYX_GOOD; - } } -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_MACROS + argc = PyTuple_GET_SIZE(args); #else - object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; + argc = PyTuple_Size(args); + if (unlikely(!argc) < 0) return NULL; #endif - reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; - if (reduce_ex == object_reduce_ex) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); #else - object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); #endif - reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; - if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { - reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); - if (likely(reduce_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (reduce == object_reduce || PyErr_Occurred()) { - goto __PYX_BAD; - } - setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); - if (!setstate) PyErr_Clear(); - if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { - setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); - if (likely(setstate_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (!setstate || PyErr_Occurred()) { - goto __PYX_BAD; - } - } - PyType_Modified((PyTypeObject*)type_obj); + return NULL; } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; } - goto __PYX_GOOD; -__PYX_BAD: - if (!PyErr_Occurred()) - PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); - ret = -1; -__PYX_GOOD: -#if !CYTHON_USE_PYTYPE_LOOKUP - Py_XDECREF(object_reduce); - Py_XDECREF(object_reduce_ex); - Py_XDECREF(object_getstate); - Py_XDECREF(getstate); -#endif - Py_XDECREF(reduce); - Py_XDECREF(reduce_ex); - Py_XDECREF(reduce_cython); - Py_XDECREF(setstate); - Py_XDECREF(setstate_cython); return ret; } - -/* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size) +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { - PyObject *result = 0; - char warning[200]; - Py_ssize_t basicsize; - Py_ssize_t itemsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; - PyObject *py_itemsize; -#endif - result = PyObject_GetAttrString(module, class_name); - if (!result) - goto bad; - if (!PyType_Check(result)) { + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; - itemsize = ((PyTypeObject *)result)->tp_itemsize; + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; #else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; - py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); - if (!py_itemsize) - goto bad; - itemsize = PyLong_AsSsize_t(py_itemsize); - Py_DECREF(py_itemsize); - py_itemsize = 0; - if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (itemsize) { - if (size % alignment) { - alignment = size % alignment; - } - if (itemsize < (Py_ssize_t)alignment) - itemsize = (Py_ssize_t)alignment; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; } - if ((size_t)(basicsize + itemsize) < size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL + 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_PyMethod_New, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, +#endif +}; +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + m->defaults_size = size; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ + static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); } - return (PyTypeObject *)result; -bad: - Py_XDECREF(result); - return NULL; + return op; } -#endif /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -30599,7 +37142,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -30621,7 +37164,8 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -30699,17 +37243,99 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + PyErr_Clear(); + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #endif +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + py_funcname = PyUnicode_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -30744,6 +37370,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -30806,13 +37433,19 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + __Pyx_TypeName obj_type_name; if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags); - PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' does not have the buffer interface", + obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { @@ -30887,19 +37520,6 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, return (start1 < end2) && (start2 < end1); } -/* Capsule */ - static CYTHON_INLINE PyObject * -__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) -{ - PyObject *cobj; -#if PY_VERSION_HEX >= 0x02070000 - cobj = PyCapsule_New(p, sig, NULL); -#else - cobj = PyCObject_FromVoidPtr(p, NULL); -#endif - return cobj; -} - /* TypeInfoCompare */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) @@ -30996,8 +37616,9 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) return 0; } static int -__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec) +__pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec) { + CYTHON_UNUSED_VAR(ndim); if (spec & __Pyx_MEMVIEW_DIRECT) { if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { PyErr_Format(PyExc_ValueError, @@ -31190,112 +37811,6 @@ static int __Pyx_ValidateAndInit_memviewslice( return (target_type) value;\ } -/* Print */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static PyObject *__Pyx_GetStdout(void) { - PyObject *f = PySys_GetObject((char *)"stdout"); - if (!f) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); - } - return f; -} -static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - int i; - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { - PyObject* v; - if (PyFile_SoftSpace(f, 1)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - v = PyTuple_GET_ITEM(arg_tuple, i); - if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - goto error; - if (PyString_Check(v)) { - char *s = PyString_AsString(v); - Py_ssize_t len = PyString_Size(v); - if (len > 0) { - switch (s[len-1]) { - case ' ': break; - case '\f': case '\r': case '\n': case '\t': case '\v': - PyFile_SoftSpace(f, 0); - break; - default: break; - } - } - } - } - if (newline) { - if (PyFile_WriteString("\n", f) < 0) - goto error; - PyFile_SoftSpace(f, 0); - } - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; -} -#else -static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { - PyObject* kwargs = 0; - PyObject* result = 0; - PyObject* end_string; - if (unlikely(!__pyx_print)) { - __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print); - if (!__pyx_print) - return -1; - } - if (stream) { - kwargs = PyDict_New(); - if (unlikely(!kwargs)) - return -1; - if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0)) - goto bad; - if (!newline) { - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - goto bad; - if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - goto bad; - } - Py_DECREF(end_string); - } - } else if (!newline) { - if (unlikely(!__pyx_print_kwargs)) { - __pyx_print_kwargs = PyDict_New(); - if (unlikely(!__pyx_print_kwargs)) - return -1; - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - return -1; - if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - return -1; - } - Py_DECREF(end_string); - } - kwargs = __pyx_print_kwargs; - } - result = PyObject_Call(__pyx_print, arg_tuple, kwargs); - if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) - Py_DECREF(kwargs); - if (!result) - return -1; - Py_DECREF(result); - return 0; -bad: - if (kwargs != __pyx_print_kwargs) - Py_XDECREF(kwargs); - return -1; -} -#endif - /* ObjectToMemviewSlice */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *obj, int writable_flag) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; @@ -31342,35 +37857,8 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { return result; } -/* IntPow */ - static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { - long t = b; - switch (e) { - case 3: - t *= b; - CYTHON_FALLTHROUGH; - case 2: - t *= b; - CYTHON_FALLTHROUGH; - case 1: - return t; - case 0: - return 1; - } - #if 1 - if (unlikely(e<0)) return 0; - #endif - t = 1; - while (likely(e)) { - t *= (b * (e&1)) | ((~e)&1); - b *= b; - e >>= 1; - } - return t; -} - /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); @@ -31390,7 +37878,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -31524,7 +38012,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); @@ -31544,7 +38032,7 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -31744,6 +38232,141 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return new_mvs; } +/* MemviewSliceInit */ + static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF(memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} +#ifndef Py_NO_RETURN +#define Py_NO_RETURN +#endif +static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -31757,7 +38380,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -31771,40 +38394,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -31817,109 +38445,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -31973,8 +38673,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } @@ -32011,47 +38735,34 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); - } -} - -/* PrintOne */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static int __Pyx_PrintOne(PyObject* f, PyObject *o) { - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - if (PyFile_SoftSpace(f, 0)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) - goto error; - if (PyFile_WriteString("\n", f) < 0) - goto error; - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; - /* the line below is just to avoid C compiler - * warnings about unused functions */ - return __Pyx_Print(f, NULL, 0); -} #else -static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { - int res; - PyObject* arg_tuple = PyTuple_Pack(1, o); - if (unlikely(!arg_tuple)) - return -1; - res = __Pyx_Print(stream, arg_tuple, 1); - Py_DECREF(arg_tuple); - return res; -} + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; #endif + } +} /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { @@ -32066,7 +38777,7 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -32080,40 +38791,45 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -32126,109 +38842,181 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -32262,7 +39050,7 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(char) < sizeof(long)) { + if ((sizeof(char) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -32276,40 +39064,45 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { - return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { - return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { - return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -32322,109 +39115,181 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { goto raise_neg_overflow; } #endif - if (sizeof(char) <= sizeof(unsigned long)) { + if ((sizeof(char) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) - case -2: - if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(char) <= sizeof(long)) { + if ((sizeof(char) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (char) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (char) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (char) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (char) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (char) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (char) -1; } } else { @@ -32445,6 +39310,22 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { return (char) -1; } +/* FormatTypeName */ + #if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name_2); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__48); + } + return name; +} +#endif + /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[5]; @@ -32475,7 +39356,7 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { rtversion[i] = rt_from_call[i]; } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -32484,9 +39365,31 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { } /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + #if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -32494,23 +39397,11 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -32572,7 +39463,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -32601,22 +39492,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -32682,13 +39577,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -32756,4 +39649,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/newanalysis/helpers/helpers.cpp b/newanalysis/helpers/helpers.cpp index a2e7f64..0dc3e53 100644 --- a/newanalysis/helpers/helpers.cpp +++ b/newanalysis/helpers/helpers.cpp @@ -1,22 +1,71 @@ -/* Generated by Cython 0.29.34 */ +/* Generated by Cython 3.0.2 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayscalars.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ufuncobject.h", + "newanalysis/helpers/BertholdHorn.h" + ], + "extra_compile_args": [ + "-fopenmp" + ], + "extra_link_args": [ + "-fopenmp" + ], + "include_dirs": [ + "newanalysis/helpers", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include" + ], + "language": "c++", + "name": "newanalysis.helpers", + "sources": [ + "newanalysis/helpers/helpers.pyx", + "newanalysis/helpers/BertholdHorn.cpp" + ] + }, + "module_name": "newanalysis.helpers" +} +END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. +#else +#if CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" #else -#define CYTHON_ABI "0_29_34" -#define CYTHON_HEX_VERSION 0x001D22F0 -#define CYTHON_FUTURE_DIVISION 0 +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_2" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030002F0 +#define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -35,9 +84,7 @@ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -45,13 +92,19 @@ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -76,10 +129,19 @@ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS @@ -89,44 +151,121 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK @@ -136,8 +275,9 @@ #endif #elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 @@ -181,16 +321,17 @@ #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -199,11 +340,8 @@ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5) + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 @@ -226,29 +364,47 @@ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) + #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #endif - #if PY_VERSION_HEX >= 0x030B00A4 + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 @@ -257,6 +413,10 @@ #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -285,6 +445,17 @@ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -298,13 +469,16 @@ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -312,28 +486,59 @@ # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; + #else + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -343,13 +548,26 @@ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." @@ -373,91 +591,151 @@ class __Pyx_FakeReference { T *operator->() { return ptr; } T *operator&() { return ptr; } operator T&() { return *ptr; } - template bool operator ==(U other) { return *ptr == other; } - template bool operator !=(U other) { return *ptr != other; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } private: T *ptr; }; -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + PyObject *version_info; // borrowed + PyObject *py_minor_version = NULL; + long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; - } - end: - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(call_result); - Py_XDECREF(empty); + #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 + minor_version = 11; // we don't yet need to distinguish between versions > 11 + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + Py_XDECREF(py_minor_version); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here + if (!empty_bytes) return NULL; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -471,6 +749,12 @@ class __Pyx_FakeReference { #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -485,30 +769,53 @@ class __Pyx_FakeReference { #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -517,6 +824,22 @@ class __Pyx_FakeReference { #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -547,6 +870,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -559,12 +904,69 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) @@ -575,10 +977,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else @@ -596,11 +998,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -611,14 +1013,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -647,8 +1055,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -658,15 +1072,33 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif #if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -678,6 +1110,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -695,11 +1130,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -744,12 +1174,17 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" #endif #define __PYX_HAVE__newanalysis__helpers @@ -757,19 +1192,18 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + #include "numpy/arrayobject.h" #include "numpy/ndarrayobject.h" #include "numpy/ndarraytypes.h" #include "numpy/arrayscalars.h" #include "numpy/ufuncobject.h" - - /* NumPy API declarations from "numpy/__init__.pxd" */ - #include #include #include "BertholdHorn.h" #include "pythread.h" -#include "pystate.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -838,9 +1272,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -848,11 +1282,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -878,7 +1323,52 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -900,7 +1390,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -965,23 +1455,19 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; /* Header.proto */ #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__)) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 @@ -999,13 +1485,20 @@ static const char *__pyx_filename; #define _Complex_I 1.0fj #endif +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { - "src/helpers/helpers.pyx", - "__init__.pxd", - "stringsource", + "newanalysis/helpers/helpers.pyx", + "", + "__init__.cython-30.pxd", "type.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + /* NoFastGil.proto */ #define __Pyx_PyGILState_Ensure PyGILState_Ensure #define __Pyx_PyGILState_Release PyGILState_Release @@ -1013,16 +1506,40 @@ static const char *__pyx_f[] = { #define __Pyx_FastGIL_Forget() #define __Pyx_FastGilFuncInit() -/* MemviewSliceStruct.proto */ -struct __pyx_memoryview_obj; +/* BufferFormatStructs.proto */ +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { - struct __pyx_memoryview_obj *memview; - char *data; - Py_ssize_t shape[8]; - Py_ssize_t strides[8]; - Py_ssize_t suboffsets[8]; -} __Pyx_memviewslice; -#define __Pyx_MemoryView_Len(m) (m.shape[0]) + const char* name; + struct __Pyx_StructField_* fields; + size_t size; + size_t arraysize[8]; + int ndim; + char typegroup; + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; /* Atomics.proto */ #include @@ -1031,7 +1548,44 @@ typedef struct { #endif #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS #define __pyx_atomic_int_type int -#if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_incr_aligned(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_incr_aligned(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1) @@ -1039,10 +1593,11 @@ typedef struct { #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif -#elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL +#elif CYTHON_ATOMICS && defined(_MSC_VER) #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type long + #define __pyx_nonatomic_int_type long #pragma intrinsic (_InterlockedExchangeAdd) #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1) @@ -1056,7 +1611,6 @@ typedef struct { #warning "Not using atomics" #endif #endif -typedef volatile __pyx_atomic_int_type __pyx_atomic_int; #if CYTHON_ATOMICS #define __pyx_add_acquisition_count(memview)\ __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview)) @@ -1069,49 +1623,20 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) #endif -/* BufferFormatStructs.proto */ -#define IS_UNSIGNED(type) (((type) -1) > 0) -struct __Pyx_StructField_; -#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) -typedef struct { - const char* name; - struct __Pyx_StructField_* fields; - size_t size; - size_t arraysize[8]; - int ndim; - char typegroup; - char is_unsigned; - int flags; -} __Pyx_TypeInfo; -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - size_t new_count, enc_count; - size_t struct_alignment; - int is_complex; - char enc_type; - char new_packmode; - char enc_packmode; - char is_valid_array; -} __Pyx_BufFmt_Context; - -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +/* #### Code section: numeric_typedefs ### */ -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":689 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":730 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -1120,7 +1645,7 @@ typedef struct { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":690 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":731 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -1129,7 +1654,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":691 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":732 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -1138,7 +1663,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":692 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":733 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -1147,7 +1672,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":696 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":737 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -1156,7 +1681,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":697 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":738 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -1165,7 +1690,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":698 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":739 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -1174,7 +1699,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":699 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":740 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -1183,7 +1708,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":703 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":744 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -1192,7 +1717,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":704 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":745 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -1201,61 +1726,43 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":713 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":754 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t + * */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":714 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":755 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":715 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":717 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":757 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t + * */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":718 - * - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":758 * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":719 * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":721 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":760 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1264,7 +1771,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":722 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":761 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1273,7 +1780,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":724 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":763 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1282,7 +1789,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":725 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":764 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1291,7 +1798,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":726 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":765 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1299,30 +1806,32 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* #### Code section: complex_type_declarations ### */ /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus - typedef ::std::complex< float > __pyx_t_float_complex; + typedef ::std::complex< double > __pyx_t_double_complex; #else - typedef float _Complex __pyx_t_float_complex; + typedef double _Complex __pyx_t_double_complex; #endif #else - typedef struct { float real, imag; } __pyx_t_float_complex; + typedef struct { double real, imag; } __pyx_t_double_complex; #endif -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus - typedef ::std::complex< double > __pyx_t_double_complex; + typedef ::std::complex< float > __pyx_t_float_complex; #else - typedef double _Complex __pyx_t_double_complex; + typedef float _Complex __pyx_t_float_complex; #endif #else - typedef struct { double real, imag; } __pyx_t_double_complex; + typedef struct { float real, imag; } __pyx_t_float_complex; #endif -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_array_obj; @@ -1330,7 +1839,7 @@ struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":728 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":767 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1339,7 +1848,7 @@ struct __pyx_memoryviewslice_obj; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":729 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":768 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1348,7 +1857,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":730 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":769 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1357,7 +1866,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":732 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":771 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1366,8 +1875,8 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1391,7 +1900,7 @@ struct __pyx_array_obj { }; -/* "View.MemoryView":280 +/* "View.MemoryView":302 * * @cname('__pyx_MemviewEnum') * cdef class Enum(object): # <<<<<<<<<<<<<< @@ -1404,10 +1913,10 @@ struct __pyx_MemviewEnum_obj { }; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1418,8 +1927,7 @@ struct __pyx_memoryview_obj { PyObject *_size; PyObject *_array_interface; PyThread_type_lock lock; - __pyx_atomic_int acquisition_count[2]; - __pyx_atomic_int *acquisition_count_aligned_p; + __pyx_atomic_int_type acquisition_count; Py_buffer view; int flags; int dtype_is_object; @@ -1427,8 +1935,8 @@ struct __pyx_memoryview_obj { }; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1444,8 +1952,8 @@ struct __pyx_memoryviewslice_obj { -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1458,10 +1966,10 @@ struct __pyx_vtabstruct_array { static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1474,12 +1982,13 @@ struct __pyx_vtabstruct_memoryview { PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); }; static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1490,6 +1999,7 @@ struct __pyx_vtabstruct__memoryviewslice { struct __pyx_vtabstruct_memoryview __pyx_base; }; static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1498,11 +2008,11 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1512,28 +2022,40 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1544,6 +2066,10 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1555,6 +2081,57 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); @@ -1562,9 +2139,71 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#else + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) +#endif +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) + #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) +#else + #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op + #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs + #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS + #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) + #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); @@ -1573,93 +2212,53 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) do {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif -#if CYTHON_FAST_PYCALL - static size_t __pyx_pyframe_localsplus_offset = 0; +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL +#endif +#endif #endif /* PyObjectCall.proto */ @@ -1669,48 +2268,70 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); -/* MemviewSliceInit.proto */ -#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d -#define __Pyx_MEMVIEW_DIRECT 1 -#define __Pyx_MEMVIEW_PTR 2 -#define __Pyx_MEMVIEW_FULL 4 -#define __Pyx_MEMVIEW_CONTIG 8 -#define __Pyx_MEMVIEW_STRIDED 16 -#define __Pyx_MEMVIEW_FOLLOW 32 -#define __Pyx_IS_C_CONTIG 1 -#define __Pyx_IS_F_CONTIG 2 -static int __Pyx_init_memviewslice( - struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference); -static CYTHON_INLINE int __pyx_add_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p) -#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview)) -#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) -#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__) -static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif -/* None.proto */ -static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname); +/* BuildPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char); + +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); + +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); + +/* JoinPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); + +/* StrEquals.proto */ +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + +/* PyObjectFormatSimple.proto */ +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#elif PY_MAJOR_VERSION < 3 + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\ + PyObject_Format(s, f)) +#elif CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ + likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ + PyObject_Format(s, f)) +#else + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#endif + +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ @@ -1734,99 +2355,121 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + /* ObjectGetItem.proto */ #if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); #else #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif -/* SliceObject.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** py_start, PyObject** py_stop, PyObject** py_slice, - int has_cstart, int has_cstop, int wraparound); - -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); -/* IsLittleEndian.proto */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); - -/* BufferFormatCheck.proto */ -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type); +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); -/* BufferGetAndValidate.proto */ -#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ - ((obj == Py_None || obj == NULL) ?\ - (__Pyx_ZeroBuffer(buf), 0) :\ - __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) -static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, - __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static void __Pyx_ZeroBuffer(Py_buffer* buf); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; -static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); -#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); #else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (1) +#elif CYTHON_COMPILING_IN_LIMITED_API || (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000) + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } #else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) #endif -#define __Pyx_BufPtrCContig3d(type, buf, i0, s0, i1, s1, i2, s2) ((type)((char*)buf + i0 * s0 + i1 * s1) + i2) -/* DivInt[Py_ssize_t].proto */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -/* DivInt[long].proto */ -static CYTHON_INLINE long __Pyx_div_long(long, long); +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -/* UnaryNegOverflows.proto */ -#define UNARY_NEG_WOULD_OVERFLOW(x)\ - (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif @@ -1841,14 +2484,6 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) @@ -1857,62 +2492,6 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ -/* GetAttr.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); - -/* decode_c_string_utf16.proto */ -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 0; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = -1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} - -/* decode_c_string.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); - -/* GetAttr3.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) @@ -1924,20 +2503,33 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* ssize_strlen.proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); + /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { @@ -1955,43 +2547,25 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck); + +/* RaiseUnboundLocalError.proto */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long); /* PySequenceContains.proto */ static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { @@ -2005,6 +2579,38 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* HasAttr.proto */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +/* RaiseUnboundMemoryviewSliceNogil.proto */ +static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname); + +/* SliceObject.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +/* IsLittleEndian.proto */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); + +/* BufferFormatCheck.proto */ +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type); + +/* BufferGetAndValidate.proto */ +#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ + ((obj == Py_None || obj == NULL) ?\ + (__Pyx_ZeroBuffer(buf), 0) :\ + __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) +static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static void __Pyx_ZeroBuffer(Py_buffer* buf); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; +static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) +#define __Pyx_BufPtrCContig3d(type, buf, i0, s0, i1, s1, i2, s2) ((type)((char*)buf + i0 * s0 + i1 * s1) + i2) /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); @@ -2019,34 +2625,202 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr #endif +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + /* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type); +#endif /* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce(PyObject* type_obj); +#endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -#if __STDC_VERSION__ >= 201112L +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_2 +#define __PYX_HAVE_RT_ImportType_proto_3_0_2 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif -#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT(s) alignof(s) +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +enum __Pyx_ImportType_CheckSize_3_0_2 { + __Pyx_ImportType_CheckSize_Error_3_0_2 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_2 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_2 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size); #endif +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + typesModule = PyImport_ImportModule("types"); + if (!typesModule) return NULL; + methodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + if (!methodType) return NULL; + result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); + Py_DECREF(methodType); + return result; +} +#elif PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + void *defaults; + int defaults_pyobjects; + size_t defaults_size; // used by FusedFunction for copying defaults + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -2055,6 +2829,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -2068,6 +2843,7 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -2104,14 +2880,6 @@ static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, __Pyx_memviewslice *slice2, int ndim, size_t itemsize); -/* Capsule.proto */ -static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); - -/* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - /* TypeInfoCompare.proto */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b); @@ -2161,13 +2929,6 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp); static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj); -/* MemviewDtypeToObject.proto */ -static CYTHON_INLINE PyObject *__pyx_memview_get_char(const char *itemp); -static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj); - -/* FromPy.proto */ -static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject*); - /* RealImag.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -2191,45 +2952,7 @@ static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq_float(a, b) ((a)==(b)) - #define __Pyx_c_sum_float(a, b) ((a)+(b)) - #define __Pyx_c_diff_float(a, b) ((a)-(b)) - #define __Pyx_c_prod_float(a, b) ((a)*(b)) - #define __Pyx_c_quot_float(a, b) ((a)/(b)) - #define __Pyx_c_neg_float(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero_float(z) ((z)==(float)0) - #define __Pyx_c_conj_float(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_abs_float(z) (::std::abs(z)) - #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zero_float(z) ((z)==0) - #define __Pyx_c_conj_float(z) (conjf(z)) - #if 1 - #define __Pyx_c_abs_float(z) (cabsf(z)) - #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); - #if 1 - static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); - #endif -#endif - -/* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_double(a, b) ((a)==(b)) #define __Pyx_c_sum_double(a, b) ((a)+(b)) #define __Pyx_c_diff_double(a, b) ((a)-(b)) @@ -2266,6 +2989,51 @@ static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject #endif #endif +/* MemviewDtypeToObject.proto */ +static CYTHON_INLINE PyObject *__pyx_memview_get_char(const char *itemp); +static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj); + +/* FromPy.proto */ +static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject*); + +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + /* MemviewSliceCopyTemplate.proto */ static __Pyx_memviewslice __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, @@ -2273,15 +3041,40 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, size_t sizeof_dtype, int contig_flag, int dtype_is_object); -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); +/* MemviewSliceInit.proto */ +#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); /* CIntFromPy.proto */ -static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +/* CIntFromPy.proto */ +static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *); + /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); @@ -2291,15 +3084,32 @@ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value); +/* None.proto */ +#include + /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ @@ -2308,60 +3118,48 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ -/* Module declarations from 'cpython.buffer' */ +/* Module declarations from "libc.string" */ -/* Module declarations from 'libc.string' */ +/* Module declarations from "libc.stdio" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.type" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "cpython" */ -/* Module declarations from 'cpython' */ +/* Module declarations from "cpython.object" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.ref" */ -/* Module declarations from 'cpython.ref' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'cpython.mem' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'numpy' */ +/* Module declarations from "cython.view" */ -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_generic = 0; -static PyTypeObject *__pyx_ptype_5numpy_number = 0; -static PyTypeObject *__pyx_ptype_5numpy_integer = 0; -static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_inexact = 0; -static PyTypeObject *__pyx_ptype_5numpy_floating = 0; -static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0; -static PyTypeObject *__pyx_ptype_5numpy_flexible = 0; -static PyTypeObject *__pyx_ptype_5numpy_character = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +/* Module declarations from "cython.dataclasses" */ -/* Module declarations from 'cython.view' */ +/* Module declarations from "cython" */ -/* Module declarations from 'cython' */ +/* Module declarations from "libc.math" */ -/* Module declarations from 'libc.math' */ +/* Module declarations from "libc.stdlib" */ -/* Module declarations from 'libc.stdlib' */ - -/* Module declarations from 'newanalysis.helpers' */ -static PyTypeObject *__pyx_array_type = 0; -static PyTypeObject *__pyx_MemviewEnum_type = 0; -static PyTypeObject *__pyx_memoryview_type = 0; -static PyTypeObject *__pyx_memoryviewslice_type = 0; +/* Module declarations from "newanalysis.helpers" */ +static PyObject *__pyx_collections_abc_Sequence = 0; static PyObject *generic = 0; static PyObject *strided = 0; static PyObject *indirect = 0; @@ -2370,12 +3168,12 @@ static PyObject *indirect_contiguous = 0; static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; static int __pyx_f_11newanalysis_7helpers_sgn2bin(double); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ -static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ static PyObject *_unellipsify(PyObject *, int); /*proto*/ -static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ @@ -2393,8 +3191,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /* static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ -static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/ -static int __pyx_memoryview_err(PyObject *, char *); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ @@ -2403,26 +3202,33 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_char = { "char", NULL, sizeof(char), { 0 }, 0, 'H', IS_UNSIGNED(char), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, __PYX_IS_UNSIGNED(int) ? 'U' : 'I', __PYX_IS_UNSIGNED(int), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_char = { "char", NULL, sizeof(char), { 0 }, 0, 'H', __PYX_IS_UNSIGNED(char), 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo___pyx_t_double_complex = { "double complex", NULL, sizeof(__pyx_t_double_complex), { 0 }, 0, 'C', 0, 0 }; +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "newanalysis.helpers" extern int __pyx_module_is_main_newanalysis__helpers; int __pyx_module_is_main_newanalysis__helpers = 0; -/* Implementation of 'newanalysis.helpers' */ +/* Implementation of "newanalysis.helpers" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_ImportError; +static PyObject *__pyx_builtin___import__; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_AssertionError; static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_ImportError; +/* #### Code section: string_decls ### */ +static const char __pyx_k_[] = ": "; static const char __pyx_k_A[] = "A"; static const char __pyx_k_B[] = "B"; static const char __pyx_k_E[] = "E"; @@ -2448,6 +3254,10 @@ static const char __pyx_k_z[] = "z"; static const char __pyx_k_B1[] = "B1"; static const char __pyx_k_B2[] = "B2"; static const char __pyx_k_B3[] = "B3"; +static const char __pyx_k__2[] = "."; +static const char __pyx_k__3[] = "*"; +static const char __pyx_k__6[] = "'"; +static const char __pyx_k__7[] = ")"; static const char __pyx_k_a1[] = "a1"; static const char __pyx_k_a2[] = "a2"; static const char __pyx_k_c1[] = "c1"; @@ -2462,6 +3272,7 @@ static const char __pyx_k_dy[] = "dy"; static const char __pyx_k_dz[] = "dz"; static const char __pyx_k_f1[] = "f1"; static const char __pyx_k_f2[] = "f2"; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_hs[] = "hs"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_l1[] = "l1"; @@ -2488,6 +3299,8 @@ static const char __pyx_k_H1z[] = "H1z"; static const char __pyx_k_H2x[] = "H2x"; static const char __pyx_k_H2y[] = "H2y"; static const char __pyx_k_H2z[] = "H2z"; +static const char __pyx_k_abc[] = "abc"; +static const char __pyx_k_and[] = " and "; static const char __pyx_k_apr[] = "apr"; static const char __pyx_k_auf[] = "auf"; static const char __pyx_k_azi[] = "azi"; @@ -2501,6 +3314,7 @@ static const char __pyx_k_dy2[] = "dy2"; static const char __pyx_k_dz2[] = "dz2"; static const char __pyx_k_end[] = "end"; static const char __pyx_k_epa[] = "epa"; +static const char __pyx_k_got[] = " (got "; static const char __pyx_k_idx[] = "idx"; static const char __pyx_k_ind[] = "ind"; static const char __pyx_k_m1r[] = "m1r"; @@ -2514,6 +3328,7 @@ static const char __pyx_k_pyE[] = "pyE"; static const char __pyx_k_qqr[] = "qqr"; static const char __pyx_k_rep[] = "rep"; static const char __pyx_k_rfa[] = "rfa"; +static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_tmp[] = "tmp"; static const char __pyx_k_tyH[] = "tyH"; static const char __pyx_k_tzH[] = "tzH"; @@ -2522,6 +3337,7 @@ static const char __pyx_k_vol[] = "vol"; static const char __pyx_k_wt1[] = "wt1"; static const char __pyx_k_wts[] = "wts"; static const char __pyx_k_xyz[] = "xyz"; +static const char __pyx_k__109[] = "?"; static const char __pyx_k_actr[] = "actr"; static const char __pyx_k_auf3[] = "auf3"; static const char __pyx_k_auf6[] = "auf6"; @@ -2563,6 +3379,7 @@ static const char __pyx_k_pack[] = "pack"; static const char __pyx_k_roxy[] = "roxy"; static const char __pyx_k_rtre[] = "rtre"; static const char __pyx_k_size[] = "size"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_step[] = "step"; static const char __pyx_k_stop[] = "stop"; static const char __pyx_k_sumr[] = "sumr"; @@ -2591,6 +3408,7 @@ static const char __pyx_k_frame[] = "frame"; static const char __pyx_k_gfunc[] = "gfunc"; static const char __pyx_k_hbond[] = "hbond"; static const char __pyx_k_histo[] = "histo"; +static const char __pyx_k_index[] = "index"; static const char __pyx_k_int32[] = "int32"; static const char __pyx_k_len_H[] = "len_H"; static const char __pyx_k_nsurr[] = "nsurr"; @@ -2632,6 +3450,7 @@ static const char __pyx_k_dipTt2[] = "dipTt2"; static const char __pyx_k_dipTt3[] = "dipTt3"; static const char __pyx_k_dipTt4[] = "dipTt4"; static const char __pyx_k_dipTt5[] = "dipTt5"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_energy[] = "energy"; static const char __pyx_k_findDS[] = "findDS"; @@ -2659,6 +3478,7 @@ static const char __pyx_k_asarray[] = "asarray"; static const char __pyx_k_centers[] = "centers"; static const char __pyx_k_charges[] = "charges"; static const char __pyx_k_dip_wat[] = "dip_wat"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_epa_ind[] = "epa_ind"; static const char __pyx_k_epa_oct[] = "epa_oct"; static const char __pyx_k_epa_xyz[] = "epa_xyz"; @@ -2676,6 +3496,7 @@ static const char __pyx_k_qq_diff[] = "qq_diff"; static const char __pyx_k_timectr[] = "timectr"; static const char __pyx_k_tmp_ind[] = "tmp_ind"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; +static const char __pyx_k_Sequence[] = "Sequence"; static const char __pyx_k_an_first[] = "an_first"; static const char __pyx_k_aufpunkt[] = "aufpunkt"; static const char __pyx_k_cat_last[] = "cat_last"; @@ -2690,6 +3511,7 @@ static const char __pyx_k_mindist2[] = "mindist2"; static const char __pyx_k_nres_wat[] = "nres_wat"; static const char __pyx_k_nshells2[] = "nshells2"; static const char __pyx_k_pyx_type[] = "__pyx_type"; +static const char __pyx_k_register[] = "register"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_sph_harm[] = "sph_harm"; static const char __pyx_k_tmp_ener[] = "tmp_ener"; @@ -2706,6 +3528,7 @@ static const char __pyx_k_enumerate[] = "enumerate"; static const char __pyx_k_histo_ind[] = "histo_ind"; static const char __pyx_k_histo_max[] = "histo_max"; static const char __pyx_k_histo_min[] = "histo_min"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_mdcage_ts[] = "mdcage_ts"; static const char __pyx_k_mu_solute[] = "mu_solute"; static const char __pyx_k_nres_surr[] = "nres_surr"; @@ -2737,6 +3560,7 @@ static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_NQRselfAndB[] = "NQRselfAndB"; static const char __pyx_k_PickleError[] = "PickleError"; +static const char __pyx_k_collections[] = "collections"; static const char __pyx_k_corrsubmean[] = "corrsubmean"; static const char __pyx_k_energy_perm[] = "energy_perm"; static const char __pyx_k_exclude_end[] = "exclude_end"; @@ -2747,23 +3571,28 @@ static const char __pyx_k_calcEnergyAA[] = "calcEnergyAA"; static const char __pyx_k_comByResidue[] = "comByResidue"; static const char __pyx_k_dipByResidue[] = "dipByResidue"; static const char __pyx_k_dipTenCorrel[] = "dipTenCorrel"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; -static const char __pyx_k_stringsource[] = "stringsource"; +static const char __pyx_k_stringsource[] = ""; +static const char __pyx_k_version_info[] = "version_info"; static const char __pyx_k_atomicCurrent[] = "atomicCurrent"; static const char __pyx_k_calcEnergyMuA[] = "calcEnergyMuA"; +static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_energy_octant[] = "energy_octant"; static const char __pyx_k_exclude_begin[] = "exclude_begin"; -static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_scipy_special[] = "scipy.special"; static const char __pyx_k_sites_per_res[] = "sites_per_res"; static const char __pyx_k_sphHarmMatrix[] = "sphHarmMatrix"; static const char __pyx_k_squared_r_oxy[] = "squared_r_oxy"; static const char __pyx_k_squared_r_tre[] = "squared_r_tre"; +static const char __pyx_k_AssertionError[] = "AssertionError"; static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; static const char __pyx_k_calcEnergyAASep[] = "calcEnergyAASep"; static const char __pyx_k_centerOrientBox[] = "centerOrientBox"; +static const char __pyx_k_collections_abc[] = "collections.abc"; static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; static const char __pyx_k_energy_per_atom[] = "energy_per_atom"; static const char __pyx_k_findNearestAtom[] = "findNearestAtom"; @@ -2777,6 +3606,7 @@ static const char __pyx_k_atoms_per_residue[] = "atoms_per_residue"; static const char __pyx_k_calcEnergyAAhisto[] = "calcEnergyAAhisto"; static const char __pyx_k_calcInertiaTensor[] = "calcInertiaTensor"; static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_calcEnergyAAhisto1[] = "calcEnergyAAhisto1"; static const char __pyx_k_calcRotationMatrix[] = "calcRotationMatrix"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; @@ -2790,7 +3620,9 @@ static const char __pyx_k_newanalysis_helpers[] = "newanalysis.helpers"; static const char __pyx_k_waterRotationMatrix[] = "waterRotationMatrix"; static const char __pyx_k_calcEnergyAtomicVoro[] = "calcEnergyAtomicVoro"; static const char __pyx_k_strided_and_indirect[] = ""; +static const char __pyx_k_Invalid_shape_in_axis[] = "Invalid shape in axis "; static const char __pyx_k_contiguous_and_direct[] = ""; +static const char __pyx_k_Cannot_index_with_type[] = "Cannot index with type '"; static const char __pyx_k_MemoryView_of_r_object[] = ""; static const char __pyx_k_calcDipDipEnergyAtomic[] = "calcDipDipEnergyAtomic"; static const char __pyx_k_centerToPointOrientBox[] = "centerToPointOrientBox"; @@ -2799,475 +3631,35 @@ static const char __pyx_k_MemoryView_of_r_at_0x_x[] = " 0.0 < val) - * - */ - -static int __pyx_f_11newanalysis_7helpers_sgn2bin(double __pyx_v_val) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sgn2bin", 0); +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4type_type; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + #endif + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + PyObject *__pyx_kp_u_; + PyObject *__pyx_n_s_A; + PyObject *__pyx_n_s_ASCII; + PyObject *__pyx_kp_s_All_dimensions_preceding_dimensi; + PyObject *__pyx_n_s_AssertionError; + PyObject *__pyx_n_s_B; + PyObject *__pyx_n_s_B1; + PyObject *__pyx_n_s_B2; + PyObject *__pyx_n_s_B3; + PyObject *__pyx_n_s_B_out; + PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; + PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; + PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; + PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; + PyObject *__pyx_kp_u_Cannot_index_with_type; + PyObject *__pyx_kp_s_Cannot_transpose_memoryview_with; + PyObject *__pyx_kp_s_Dimension_d_is_not_direct; + PyObject *__pyx_n_s_E; + PyObject *__pyx_n_s_Ellipsis; + PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; + PyObject *__pyx_n_s_Exx; + PyObject *__pyx_n_s_Eyy; + PyObject *__pyx_n_s_Ezz; + PyObject *__pyx_n_s_H1x; + PyObject *__pyx_n_s_H1y; + PyObject *__pyx_n_s_H1z; + PyObject *__pyx_n_s_H2x; + PyObject *__pyx_n_s_H2y; + PyObject *__pyx_n_s_H2z; + PyObject *__pyx_n_s_H_indices; + PyObject *__pyx_n_s_H_shell; + PyObject *__pyx_n_s_I; + PyObject *__pyx_n_s_ImportError; + PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; + PyObject *__pyx_n_s_IndexError; + PyObject *__pyx_kp_s_Index_out_of_bounds_axis_d; + PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; + PyObject *__pyx_kp_u_Invalid_mode_expected_c_or_fortr; + PyObject *__pyx_kp_u_Invalid_shape_in_axis; + PyObject *__pyx_n_s_L; + PyObject *__pyx_n_s_MemoryError; + PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; + PyObject *__pyx_kp_s_MemoryView_of_r_object; + PyObject *__pyx_n_s_N; + PyObject *__pyx_n_s_NQRdipTen; + PyObject *__pyx_n_s_NQRself; + PyObject *__pyx_n_s_NQRselfAndB; + PyObject *__pyx_n_b_O; + PyObject *__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + PyObject *__pyx_n_s_PickleError; + PyObject *__pyx_n_s_R; + PyObject *__pyx_n_s_Sequence; + PyObject *__pyx_n_s_SphereinCube; + PyObject *__pyx_kp_s_Step_may_not_be_zero_axis_d; + PyObject *__pyx_n_s_T; + PyObject *__pyx_n_s_TypeError; + PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; + PyObject *__pyx_n_s_ValueError; + PyObject *__pyx_n_s_View_MemoryView; + PyObject *__pyx_n_s__109; + PyObject *__pyx_kp_u__2; + PyObject *__pyx_n_s__3; + PyObject *__pyx_kp_u__6; + PyObject *__pyx_kp_u__7; + PyObject *__pyx_n_s_a1; + PyObject *__pyx_n_s_a2; + PyObject *__pyx_n_s_abc; + PyObject *__pyx_n_s_actr; + PyObject *__pyx_n_s_allocate_buffer; + PyObject *__pyx_n_s_an_first; + PyObject *__pyx_n_s_an_last; + PyObject *__pyx_kp_u_and; + PyObject *__pyx_n_s_applyRotationMatrix; + PyObject *__pyx_n_s_apr; + PyObject *__pyx_n_s_arccos; + PyObject *__pyx_n_s_arctan2; + PyObject *__pyx_n_s_asarray; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_atomicCurrent; + PyObject *__pyx_n_s_atoms_per_residue; + PyObject *__pyx_n_s_auf; + PyObject *__pyx_n_s_auf3; + PyObject *__pyx_n_s_auf6; + PyObject *__pyx_n_s_auf_x1; + PyObject *__pyx_n_s_auf_x2; + PyObject *__pyx_n_s_auf_y1; + PyObject *__pyx_n_s_auf_y2; + PyObject *__pyx_n_s_auf_z1; + PyObject *__pyx_n_s_auf_z2; + PyObject *__pyx_n_s_aufpunkt; + PyObject *__pyx_n_s_azi; + PyObject *__pyx_n_s_base; + PyObject *__pyx_n_s_boxl; + PyObject *__pyx_n_s_c; + PyObject *__pyx_n_u_c; + PyObject *__pyx_n_s_c1; + PyObject *__pyx_n_s_c2; + PyObject *__pyx_n_s_cI; + PyObject *__pyx_n_s_cL; + PyObject *__pyx_n_s_c_rv; + PyObject *__pyx_n_s_calcAngularDisplacement; + PyObject *__pyx_n_s_calcAngularMomentum; + PyObject *__pyx_n_s_calcDipDipEnergyAtomic; + PyObject *__pyx_n_s_calcEnergyAA; + PyObject *__pyx_n_s_calcEnergyAASep; + PyObject *__pyx_n_s_calcEnergyAAhisto; + PyObject *__pyx_n_s_calcEnergyAAhisto1; + PyObject *__pyx_n_s_calcEnergyAApermind; + PyObject *__pyx_n_s_calcEnergyAApermindhisto; + PyObject *__pyx_n_s_calcEnergyAtomic; + PyObject *__pyx_n_s_calcEnergyAtomicVoro; + PyObject *__pyx_n_s_calcEnergyDouble; + PyObject *__pyx_n_s_calcEnergyMuA; + PyObject *__pyx_n_s_calcFourierLaplaceTransform; + PyObject *__pyx_n_s_calcInertiaTensor; + PyObject *__pyx_n_s_calcOctant; + PyObject *__pyx_n_s_calcResidenceTimeseries; + PyObject *__pyx_n_s_calcRotationMatrix; + PyObject *__pyx_n_s_cat_first; + PyObject *__pyx_n_s_cat_last; + PyObject *__pyx_n_s_ccom; + PyObject *__pyx_n_s_cds; + PyObject *__pyx_n_s_center; + PyObject *__pyx_n_s_centerOrientBox; + PyObject *__pyx_n_s_centerToPointOrientBox; + PyObject *__pyx_n_s_centers; + PyObject *__pyx_n_s_charges; + PyObject *__pyx_n_s_charges1; + PyObject *__pyx_n_s_checkHBond; + PyObject *__pyx_n_s_class; + PyObject *__pyx_n_s_class_getitem; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_cn; + PyObject *__pyx_n_s_coct; + PyObject *__pyx_n_s_collections; + PyObject *__pyx_kp_s_collections_abc; + PyObject *__pyx_n_s_collectiveDipoleMomentWaterShell; + PyObject *__pyx_n_s_com; + PyObject *__pyx_n_s_comByResidue; + PyObject *__pyx_n_s_coms; + PyObject *__pyx_n_s_comslt; + PyObject *__pyx_n_s_conjugate; + PyObject *__pyx_kp_s_contiguous_and_direct; + PyObject *__pyx_kp_s_contiguous_and_indirect; + PyObject *__pyx_n_s_coo_H; + PyObject *__pyx_n_s_coo_center; + PyObject *__pyx_n_s_coor; + PyObject *__pyx_n_s_coorA; + PyObject *__pyx_n_s_coorB; + PyObject *__pyx_n_s_coor_core; + PyObject *__pyx_n_s_coor_oh2; + PyObject *__pyx_n_s_coor_surr; + PyObject *__pyx_n_s_corrsubmean; + PyObject *__pyx_n_s_cosine; + PyObject *__pyx_n_s_count; + PyObject *__pyx_n_s_ctr; + PyObject *__pyx_n_s_cxyz; + PyObject *__pyx_n_s_data_x; + PyObject *__pyx_n_s_data_y; + PyObject *__pyx_n_s_deltaA; + PyObject *__pyx_n_s_dict; + PyObject *__pyx_n_s_dip; + PyObject *__pyx_n_s_dipByResidue; + PyObject *__pyx_n_s_dipT0; + PyObject *__pyx_n_s_dipTen; + PyObject *__pyx_n_s_dipTenCorrel; + PyObject *__pyx_n_s_dipTenInit; + PyObject *__pyx_n_s_dipTt0; + PyObject *__pyx_n_s_dipTt1; + PyObject *__pyx_n_s_dipTt2; + PyObject *__pyx_n_s_dipTt3; + PyObject *__pyx_n_s_dipTt4; + PyObject *__pyx_n_s_dipTt5; + PyObject *__pyx_n_s_dip_wat; + PyObject *__pyx_n_s_dipol; + PyObject *__pyx_n_s_dipoleMomentNeutralSelection; + PyObject *__pyx_n_s_dipt; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_n_s_dist; + PyObject *__pyx_n_s_dist2; + PyObject *__pyx_n_s_dot; + PyObject *__pyx_n_s_dot2; + PyObject *__pyx_n_s_drude; + PyObject *__pyx_n_s_ds; + PyObject *__pyx_n_s_dt; + PyObject *__pyx_n_s_dtype; + PyObject *__pyx_n_s_dtype_is_object; + PyObject *__pyx_n_s_dx; + PyObject *__pyx_n_s_dx2; + PyObject *__pyx_n_s_dy; + PyObject *__pyx_n_s_dy2; + PyObject *__pyx_n_s_dz; + PyObject *__pyx_n_s_dz2; + PyObject *__pyx_n_s_edip; + PyObject *__pyx_n_s_empty; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_encode; + PyObject *__pyx_n_s_end; + PyObject *__pyx_n_s_energy; + PyObject *__pyx_n_s_energy_ind; + PyObject *__pyx_n_s_energy_octant; + PyObject *__pyx_n_s_energy_octant_per_atom; + PyObject *__pyx_n_s_energy_per_atom; + PyObject *__pyx_n_s_energy_perm; + PyObject *__pyx_n_s_energy_xyz; + PyObject *__pyx_n_s_energy_xyz_per_atom; + PyObject *__pyx_n_s_enumerate; + PyObject *__pyx_n_s_epa; + PyObject *__pyx_n_s_epa1; + PyObject *__pyx_n_s_epa_ind; + PyObject *__pyx_n_s_epa_oct; + PyObject *__pyx_n_s_epa_perm; + PyObject *__pyx_n_s_epa_xyz; + PyObject *__pyx_n_s_error; + PyObject *__pyx_n_s_exclude_begin; + PyObject *__pyx_n_s_exclude_end; + PyObject *__pyx_n_s_f1; + PyObject *__pyx_n_s_f2; + PyObject *__pyx_n_s_f2_0; + PyObject *__pyx_n_s_f2_1; + PyObject *__pyx_n_s_f2_2; + PyObject *__pyx_n_s_f2_x; + PyObject *__pyx_n_s_f2_y; + PyObject *__pyx_n_s_f2_z; + PyObject *__pyx_n_s_findDS; + PyObject *__pyx_n_s_findNearestAtom; + PyObject *__pyx_n_s_first; + PyObject *__pyx_n_s_flags; + PyObject *__pyx_n_s_float64; + PyObject *__pyx_n_s_format; + PyObject *__pyx_n_s_fortran; + PyObject *__pyx_n_u_fortran; + PyObject *__pyx_n_s_frame; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_getstate; + PyObject *__pyx_n_s_gfunc; + PyObject *__pyx_kp_u_got; + PyObject *__pyx_kp_u_got_differing_extents_in_dimensi; + PyObject *__pyx_n_s_hbond; + PyObject *__pyx_n_s_histo; + PyObject *__pyx_n_s_histo_bins; + PyObject *__pyx_n_s_histo_error; + PyObject *__pyx_n_s_histo_ind; + PyObject *__pyx_n_s_histo_max; + PyObject *__pyx_n_s_histo_min; + PyObject *__pyx_n_s_histo_perm; + PyObject *__pyx_n_s_histo_width; + PyObject *__pyx_n_s_hs; + PyObject *__pyx_n_s_i; + PyObject *__pyx_n_s_id; + PyObject *__pyx_n_s_idx; + PyObject *__pyx_n_s_idx2; + PyObject *__pyx_n_s_idx3; + PyObject *__pyx_n_s_idx4; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_ind; + PyObject *__pyx_n_s_index; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_int32; + PyObject *__pyx_n_s_int8; + PyObject *__pyx_n_s_integral; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_islt; + PyObject *__pyx_n_s_isolute; + PyObject *__pyx_n_s_itemsize; + PyObject *__pyx_kp_s_itemsize_0_for_cython_array; + PyObject *__pyx_n_s_j; + PyObject *__pyx_n_s_k; + PyObject *__pyx_n_s_l; + PyObject *__pyx_n_s_l1; + PyObject *__pyx_n_s_l2; + PyObject *__pyx_n_s_laplace_im; + PyObject *__pyx_n_s_laplace_re; + PyObject *__pyx_n_s_last; + PyObject *__pyx_n_s_len_H; + PyObject *__pyx_n_s_len_center; + PyObject *__pyx_n_s_lmax; + PyObject *__pyx_n_s_m1; + PyObject *__pyx_n_s_m1r; + PyObject *__pyx_n_s_m2; + PyObject *__pyx_n_s_m2r; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_masses; + PyObject *__pyx_n_s_maxdist; + PyObject *__pyx_n_s_maxshell; + PyObject *__pyx_n_s_mdcage_ts; + PyObject *__pyx_n_s_memview; + PyObject *__pyx_n_s_mindist; + PyObject *__pyx_n_s_mindist2; + PyObject *__pyx_n_s_minvec; + PyObject *__pyx_n_s_mode; + PyObject *__pyx_n_s_msd; + PyObject *__pyx_n_s_mu_solute; + PyObject *__pyx_n_s_n; + PyObject *__pyx_n_s_n1; + PyObject *__pyx_n_s_n2; + PyObject *__pyx_n_s_n3; + PyObject *__pyx_n_s_n_core; + PyObject *__pyx_n_s_n_surr; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_name_2; + PyObject *__pyx_n_s_nat; + PyObject *__pyx_n_s_natoms; + PyObject *__pyx_n_s_ndim; + PyObject *__pyx_n_s_new; + PyObject *__pyx_n_s_newanalysis_helpers; + PyObject *__pyx_kp_s_newanalysis_helpers_helpers_pyx; + PyObject *__pyx_n_s_next_id; + PyObject *__pyx_n_s_nmol; + PyObject *__pyx_n_s_nmolecules; + PyObject *__pyx_kp_s_no_default___reduce___due_to_non; + PyObject *__pyx_n_s_np; + PyObject *__pyx_n_s_nres; + PyObject *__pyx_n_s_nres_surr; + PyObject *__pyx_n_s_nres_wat; + PyObject *__pyx_n_s_nshells; + PyObject *__pyx_n_s_nshells2; + PyObject *__pyx_n_s_nsurr; + PyObject *__pyx_n_s_nt; + PyObject *__pyx_n_s_numpoints; + PyObject *__pyx_n_s_numpy; + PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; + PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; + PyObject *__pyx_n_s_nwat; + PyObject *__pyx_n_s_obj; + PyObject *__pyx_n_s_octants; + PyObject *__pyx_n_s_oxyquinol; + PyObject *__pyx_n_s_pack; + PyObject *__pyx_n_s_pickle; + PyObject *__pyx_n_s_pol; + PyObject *__pyx_n_s_pyE; + PyObject *__pyx_n_s_py_B1; + PyObject *__pyx_n_s_py_B2; + PyObject *__pyx_n_s_py_B3; + PyObject *__pyx_n_s_py_charges; + PyObject *__pyx_n_s_py_dipt; + PyObject *__pyx_n_s_py_xyz; + PyObject *__pyx_n_s_pyx_PickleError; + PyObject *__pyx_n_s_pyx_checksum; + PyObject *__pyx_n_s_pyx_result; + PyObject *__pyx_n_s_pyx_state; + PyObject *__pyx_n_s_pyx_type; + PyObject *__pyx_n_s_pyx_unpickle_Enum; + PyObject *__pyx_n_s_pyx_vtable; + PyObject *__pyx_n_s_q; + PyObject *__pyx_n_s_qq; + PyObject *__pyx_n_s_qq_diff; + PyObject *__pyx_n_s_qqr; + PyObject *__pyx_n_s_r; + PyObject *__pyx_n_s_r2; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_reduce; + PyObject *__pyx_n_s_reduce_cython; + PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_register; + PyObject *__pyx_n_s_rep; + PyObject *__pyx_n_s_residue_first_atom; + PyObject *__pyx_n_s_result; + PyObject *__pyx_n_s_rfa; + PyObject *__pyx_n_s_roxy; + PyObject *__pyx_n_s_rtre; + PyObject *__pyx_n_s_rv; + PyObject *__pyx_n_s_rvec0; + PyObject *__pyx_n_s_rvec1; + PyObject *__pyx_n_s_rvec2; + PyObject *__pyx_n_s_scipy_special; + PyObject *__pyx_n_s_setstate; + PyObject *__pyx_n_s_setstate_cython; + PyObject *__pyx_n_s_shape; + PyObject *__pyx_n_s_shell; + PyObject *__pyx_n_s_shift; + PyObject *__pyx_n_s_sites_per_res; + PyObject *__pyx_n_s_size; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_sphHarmMatrix; + PyObject *__pyx_n_s_sph_harm; + PyObject *__pyx_n_s_squared_r_oxy; + PyObject *__pyx_n_s_squared_r_tre; + PyObject *__pyx_n_s_start; + PyObject *__pyx_n_s_step; + PyObject *__pyx_n_s_stop; + PyObject *__pyx_n_s_store; + PyObject *__pyx_kp_s_strided_and_direct; + PyObject *__pyx_kp_s_strided_and_direct_or_indirect; + PyObject *__pyx_kp_s_strided_and_indirect; + PyObject *__pyx_kp_s_stringsource; + PyObject *__pyx_n_s_struct; + PyObject *__pyx_n_s_sumMDCage; + PyObject *__pyx_n_s_sumMDCageSingle; + PyObject *__pyx_n_s_sumr; + PyObject *__pyx_n_s_sys; + PyObject *__pyx_n_s_t; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_timectr; + PyObject *__pyx_n_s_tmp; + PyObject *__pyx_n_s_tmp_ener; + PyObject *__pyx_n_s_tmp_ind; + PyObject *__pyx_n_s_tmp_perm; + PyObject *__pyx_n_s_tmp_x; + PyObject *__pyx_n_s_tmp_y; + PyObject *__pyx_n_s_tmp_z; + PyObject *__pyx_n_s_tmpx; + PyObject *__pyx_n_s_tmpy; + PyObject *__pyx_n_s_tmpz; + PyObject *__pyx_n_s_tn; + PyObject *__pyx_n_s_tot_mass; + PyObject *__pyx_n_s_transform; + PyObject *__pyx_n_s_trehalose; + PyObject *__pyx_n_s_ts; + PyObject *__pyx_n_s_tyH; + PyObject *__pyx_n_s_tzH; + PyObject *__pyx_kp_s_unable_to_allocate_array_data; + PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; + PyObject *__pyx_n_s_unpack; + PyObject *__pyx_n_s_update; + PyObject *__pyx_n_s_vel; + PyObject *__pyx_n_s_velcom; + PyObject *__pyx_n_s_velcomByResidue; + PyObject *__pyx_n_s_vels; + PyObject *__pyx_n_s_version_info; + PyObject *__pyx_n_s_vol; + PyObject *__pyx_n_s_w; + PyObject *__pyx_n_s_waterRotationMatrix; + PyObject *__pyx_n_s_wt; + PyObject *__pyx_n_s_wt1; + PyObject *__pyx_n_s_wts; + PyObject *__pyx_n_s_x; + PyObject *__pyx_n_s_xyz; + PyObject *__pyx_n_s_y; + PyObject *__pyx_n_s_y_mat; + PyObject *__pyx_n_s_z; + PyObject *__pyx_n_s_zeros; + PyObject *__pyx_float_0_2400; + PyObject *__pyx_float_1_8086; + PyObject *__pyx_float_1390_02; + PyObject *__pyx_float_neg_2_0487; + PyObject *__pyx_int_0; + PyObject *__pyx_int_1; + PyObject *__pyx_int_2; + PyObject *__pyx_int_3; + PyObject *__pyx_int_6; + PyObject *__pyx_int_8; + PyObject *__pyx_int_15; + PyObject *__pyx_int_112105877; + PyObject *__pyx_int_136983863; + PyObject *__pyx_int_184977713; + PyObject *__pyx_int_neg_1; + PyObject *__pyx_slice__5; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__8; + PyObject *__pyx_tuple__9; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__11; + PyObject *__pyx_tuple__12; + PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__14; + PyObject *__pyx_tuple__15; + PyObject *__pyx_tuple__16; + PyObject *__pyx_tuple__17; + PyObject *__pyx_tuple__18; + PyObject *__pyx_tuple__19; + PyObject *__pyx_tuple__20; + PyObject *__pyx_tuple__21; + PyObject *__pyx_tuple__22; + PyObject *__pyx_tuple__23; + PyObject *__pyx_tuple__24; + PyObject *__pyx_tuple__26; + PyObject *__pyx_tuple__28; + PyObject *__pyx_tuple__30; + PyObject *__pyx_tuple__32; + PyObject *__pyx_tuple__34; + PyObject *__pyx_tuple__36; + PyObject *__pyx_tuple__38; + PyObject *__pyx_tuple__40; + PyObject *__pyx_tuple__42; + PyObject *__pyx_tuple__44; + PyObject *__pyx_tuple__46; + PyObject *__pyx_tuple__48; + PyObject *__pyx_tuple__50; + PyObject *__pyx_tuple__52; + PyObject *__pyx_tuple__54; + PyObject *__pyx_tuple__56; + PyObject *__pyx_tuple__58; + PyObject *__pyx_tuple__60; + PyObject *__pyx_tuple__62; + PyObject *__pyx_tuple__64; + PyObject *__pyx_tuple__66; + PyObject *__pyx_tuple__67; + PyObject *__pyx_tuple__69; + PyObject *__pyx_tuple__71; + PyObject *__pyx_tuple__73; + PyObject *__pyx_tuple__75; + PyObject *__pyx_tuple__77; + PyObject *__pyx_tuple__79; + PyObject *__pyx_tuple__81; + PyObject *__pyx_tuple__83; + PyObject *__pyx_tuple__85; + PyObject *__pyx_tuple__87; + PyObject *__pyx_tuple__89; + PyObject *__pyx_tuple__91; + PyObject *__pyx_tuple__93; + PyObject *__pyx_tuple__95; + PyObject *__pyx_tuple__97; + PyObject *__pyx_tuple__99; + PyObject *__pyx_tuple__101; + PyObject *__pyx_tuple__103; + PyObject *__pyx_tuple__105; + PyObject *__pyx_tuple__107; + PyObject *__pyx_codeobj__25; + PyObject *__pyx_codeobj__27; + PyObject *__pyx_codeobj__29; + PyObject *__pyx_codeobj__31; + PyObject *__pyx_codeobj__33; + PyObject *__pyx_codeobj__35; + PyObject *__pyx_codeobj__37; + PyObject *__pyx_codeobj__39; + PyObject *__pyx_codeobj__41; + PyObject *__pyx_codeobj__43; + PyObject *__pyx_codeobj__45; + PyObject *__pyx_codeobj__47; + PyObject *__pyx_codeobj__49; + PyObject *__pyx_codeobj__51; + PyObject *__pyx_codeobj__53; + PyObject *__pyx_codeobj__55; + PyObject *__pyx_codeobj__57; + PyObject *__pyx_codeobj__59; + PyObject *__pyx_codeobj__61; + PyObject *__pyx_codeobj__63; + PyObject *__pyx_codeobj__65; + PyObject *__pyx_codeobj__68; + PyObject *__pyx_codeobj__70; + PyObject *__pyx_codeobj__72; + PyObject *__pyx_codeobj__74; + PyObject *__pyx_codeobj__76; + PyObject *__pyx_codeobj__78; + PyObject *__pyx_codeobj__80; + PyObject *__pyx_codeobj__82; + PyObject *__pyx_codeobj__84; + PyObject *__pyx_codeobj__86; + PyObject *__pyx_codeobj__88; + PyObject *__pyx_codeobj__90; + PyObject *__pyx_codeobj__92; + PyObject *__pyx_codeobj__94; + PyObject *__pyx_codeobj__96; + PyObject *__pyx_codeobj__98; + PyObject *__pyx_codeobj__100; + PyObject *__pyx_codeobj__102; + PyObject *__pyx_codeobj__104; + PyObject *__pyx_codeobj__106; + PyObject *__pyx_codeobj__108; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif - /* "src/helpers/helpers.pyx":21 - * - * cdef int sgn2bin(double val): - * return ( 0.0 < val) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __pyx_r = (((double)0.0) < __pyx_v_val); - goto __pyx_L0; +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) - /* "src/helpers/helpers.pyx":20 - * void GetRotation(double *R_ptr, int n, double *APoints_ptr, double *BPoints_ptr, int debug) - * - * cdef int sgn2bin(double val): # <<<<<<<<<<<<<< - * return ( 0.0 < val) - * - */ +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_n_s_A); + Py_CLEAR(clear_module_state->__pyx_n_s_ASCII); + Py_CLEAR(clear_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError); + Py_CLEAR(clear_module_state->__pyx_n_s_B); + Py_CLEAR(clear_module_state->__pyx_n_s_B1); + Py_CLEAR(clear_module_state->__pyx_n_s_B2); + Py_CLEAR(clear_module_state->__pyx_n_s_B3); + Py_CLEAR(clear_module_state->__pyx_n_s_B_out); + Py_CLEAR(clear_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_CLEAR(clear_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_CLEAR(clear_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_CLEAR(clear_module_state->__pyx_n_s_E); + Py_CLEAR(clear_module_state->__pyx_n_s_Ellipsis); + Py_CLEAR(clear_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_CLEAR(clear_module_state->__pyx_n_s_Exx); + Py_CLEAR(clear_module_state->__pyx_n_s_Eyy); + Py_CLEAR(clear_module_state->__pyx_n_s_Ezz); + Py_CLEAR(clear_module_state->__pyx_n_s_H1x); + Py_CLEAR(clear_module_state->__pyx_n_s_H1y); + Py_CLEAR(clear_module_state->__pyx_n_s_H1z); + Py_CLEAR(clear_module_state->__pyx_n_s_H2x); + Py_CLEAR(clear_module_state->__pyx_n_s_H2y); + Py_CLEAR(clear_module_state->__pyx_n_s_H2z); + Py_CLEAR(clear_module_state->__pyx_n_s_H_indices); + Py_CLEAR(clear_module_state->__pyx_n_s_H_shell); + Py_CLEAR(clear_module_state->__pyx_n_s_I); + Py_CLEAR(clear_module_state->__pyx_n_s_ImportError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_CLEAR(clear_module_state->__pyx_n_s_IndexError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_CLEAR(clear_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_CLEAR(clear_module_state->__pyx_n_s_L); + Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_CLEAR(clear_module_state->__pyx_n_s_N); + Py_CLEAR(clear_module_state->__pyx_n_s_NQRdipTen); + Py_CLEAR(clear_module_state->__pyx_n_s_NQRself); + Py_CLEAR(clear_module_state->__pyx_n_s_NQRselfAndB); + Py_CLEAR(clear_module_state->__pyx_n_b_O); + Py_CLEAR(clear_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_R); + Py_CLEAR(clear_module_state->__pyx_n_s_Sequence); + Py_CLEAR(clear_module_state->__pyx_n_s_SphereinCube); + Py_CLEAR(clear_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_CLEAR(clear_module_state->__pyx_n_s_T); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); + Py_CLEAR(clear_module_state->__pyx_n_s_View_MemoryView); + Py_CLEAR(clear_module_state->__pyx_n_s__109); + Py_CLEAR(clear_module_state->__pyx_kp_u__2); + Py_CLEAR(clear_module_state->__pyx_n_s__3); + Py_CLEAR(clear_module_state->__pyx_kp_u__6); + Py_CLEAR(clear_module_state->__pyx_kp_u__7); + Py_CLEAR(clear_module_state->__pyx_n_s_a1); + Py_CLEAR(clear_module_state->__pyx_n_s_a2); + Py_CLEAR(clear_module_state->__pyx_n_s_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_actr); + Py_CLEAR(clear_module_state->__pyx_n_s_allocate_buffer); + Py_CLEAR(clear_module_state->__pyx_n_s_an_first); + Py_CLEAR(clear_module_state->__pyx_n_s_an_last); + Py_CLEAR(clear_module_state->__pyx_kp_u_and); + Py_CLEAR(clear_module_state->__pyx_n_s_applyRotationMatrix); + Py_CLEAR(clear_module_state->__pyx_n_s_apr); + Py_CLEAR(clear_module_state->__pyx_n_s_arccos); + Py_CLEAR(clear_module_state->__pyx_n_s_arctan2); + Py_CLEAR(clear_module_state->__pyx_n_s_asarray); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_atomicCurrent); + Py_CLEAR(clear_module_state->__pyx_n_s_atoms_per_residue); + Py_CLEAR(clear_module_state->__pyx_n_s_auf); + Py_CLEAR(clear_module_state->__pyx_n_s_auf3); + Py_CLEAR(clear_module_state->__pyx_n_s_auf6); + Py_CLEAR(clear_module_state->__pyx_n_s_auf_x1); + Py_CLEAR(clear_module_state->__pyx_n_s_auf_x2); + Py_CLEAR(clear_module_state->__pyx_n_s_auf_y1); + Py_CLEAR(clear_module_state->__pyx_n_s_auf_y2); + Py_CLEAR(clear_module_state->__pyx_n_s_auf_z1); + Py_CLEAR(clear_module_state->__pyx_n_s_auf_z2); + Py_CLEAR(clear_module_state->__pyx_n_s_aufpunkt); + Py_CLEAR(clear_module_state->__pyx_n_s_azi); + Py_CLEAR(clear_module_state->__pyx_n_s_base); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl); + Py_CLEAR(clear_module_state->__pyx_n_s_c); + Py_CLEAR(clear_module_state->__pyx_n_u_c); + Py_CLEAR(clear_module_state->__pyx_n_s_c1); + Py_CLEAR(clear_module_state->__pyx_n_s_c2); + Py_CLEAR(clear_module_state->__pyx_n_s_cI); + Py_CLEAR(clear_module_state->__pyx_n_s_cL); + Py_CLEAR(clear_module_state->__pyx_n_s_c_rv); + Py_CLEAR(clear_module_state->__pyx_n_s_calcAngularDisplacement); + Py_CLEAR(clear_module_state->__pyx_n_s_calcAngularMomentum); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDipDipEnergyAtomic); + Py_CLEAR(clear_module_state->__pyx_n_s_calcEnergyAA); + Py_CLEAR(clear_module_state->__pyx_n_s_calcEnergyAASep); + Py_CLEAR(clear_module_state->__pyx_n_s_calcEnergyAAhisto); + Py_CLEAR(clear_module_state->__pyx_n_s_calcEnergyAAhisto1); + Py_CLEAR(clear_module_state->__pyx_n_s_calcEnergyAApermind); + Py_CLEAR(clear_module_state->__pyx_n_s_calcEnergyAApermindhisto); + Py_CLEAR(clear_module_state->__pyx_n_s_calcEnergyAtomic); + Py_CLEAR(clear_module_state->__pyx_n_s_calcEnergyAtomicVoro); + Py_CLEAR(clear_module_state->__pyx_n_s_calcEnergyDouble); + Py_CLEAR(clear_module_state->__pyx_n_s_calcEnergyMuA); + Py_CLEAR(clear_module_state->__pyx_n_s_calcFourierLaplaceTransform); + Py_CLEAR(clear_module_state->__pyx_n_s_calcInertiaTensor); + Py_CLEAR(clear_module_state->__pyx_n_s_calcOctant); + Py_CLEAR(clear_module_state->__pyx_n_s_calcResidenceTimeseries); + Py_CLEAR(clear_module_state->__pyx_n_s_calcRotationMatrix); + Py_CLEAR(clear_module_state->__pyx_n_s_cat_first); + Py_CLEAR(clear_module_state->__pyx_n_s_cat_last); + Py_CLEAR(clear_module_state->__pyx_n_s_ccom); + Py_CLEAR(clear_module_state->__pyx_n_s_cds); + Py_CLEAR(clear_module_state->__pyx_n_s_center); + Py_CLEAR(clear_module_state->__pyx_n_s_centerOrientBox); + Py_CLEAR(clear_module_state->__pyx_n_s_centerToPointOrientBox); + Py_CLEAR(clear_module_state->__pyx_n_s_centers); + Py_CLEAR(clear_module_state->__pyx_n_s_charges); + Py_CLEAR(clear_module_state->__pyx_n_s_charges1); + Py_CLEAR(clear_module_state->__pyx_n_s_checkHBond); + Py_CLEAR(clear_module_state->__pyx_n_s_class); + Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_cn); + Py_CLEAR(clear_module_state->__pyx_n_s_coct); + Py_CLEAR(clear_module_state->__pyx_n_s_collections); + Py_CLEAR(clear_module_state->__pyx_kp_s_collections_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_collectiveDipoleMomentWaterShell); + Py_CLEAR(clear_module_state->__pyx_n_s_com); + Py_CLEAR(clear_module_state->__pyx_n_s_comByResidue); + Py_CLEAR(clear_module_state->__pyx_n_s_coms); + Py_CLEAR(clear_module_state->__pyx_n_s_comslt); + Py_CLEAR(clear_module_state->__pyx_n_s_conjugate); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_CLEAR(clear_module_state->__pyx_n_s_coo_H); + Py_CLEAR(clear_module_state->__pyx_n_s_coo_center); + Py_CLEAR(clear_module_state->__pyx_n_s_coor); + Py_CLEAR(clear_module_state->__pyx_n_s_coorA); + Py_CLEAR(clear_module_state->__pyx_n_s_coorB); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_core); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_oh2); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_surr); + Py_CLEAR(clear_module_state->__pyx_n_s_corrsubmean); + Py_CLEAR(clear_module_state->__pyx_n_s_cosine); + Py_CLEAR(clear_module_state->__pyx_n_s_count); + Py_CLEAR(clear_module_state->__pyx_n_s_ctr); + Py_CLEAR(clear_module_state->__pyx_n_s_cxyz); + Py_CLEAR(clear_module_state->__pyx_n_s_data_x); + Py_CLEAR(clear_module_state->__pyx_n_s_data_y); + Py_CLEAR(clear_module_state->__pyx_n_s_deltaA); + Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_n_s_dip); + Py_CLEAR(clear_module_state->__pyx_n_s_dipByResidue); + Py_CLEAR(clear_module_state->__pyx_n_s_dipT0); + Py_CLEAR(clear_module_state->__pyx_n_s_dipTen); + Py_CLEAR(clear_module_state->__pyx_n_s_dipTenCorrel); + Py_CLEAR(clear_module_state->__pyx_n_s_dipTenInit); + Py_CLEAR(clear_module_state->__pyx_n_s_dipTt0); + Py_CLEAR(clear_module_state->__pyx_n_s_dipTt1); + Py_CLEAR(clear_module_state->__pyx_n_s_dipTt2); + Py_CLEAR(clear_module_state->__pyx_n_s_dipTt3); + Py_CLEAR(clear_module_state->__pyx_n_s_dipTt4); + Py_CLEAR(clear_module_state->__pyx_n_s_dipTt5); + Py_CLEAR(clear_module_state->__pyx_n_s_dip_wat); + Py_CLEAR(clear_module_state->__pyx_n_s_dipol); + Py_CLEAR(clear_module_state->__pyx_n_s_dipoleMomentNeutralSelection); + Py_CLEAR(clear_module_state->__pyx_n_s_dipt); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_dist); + Py_CLEAR(clear_module_state->__pyx_n_s_dist2); + Py_CLEAR(clear_module_state->__pyx_n_s_dot); + Py_CLEAR(clear_module_state->__pyx_n_s_dot2); + Py_CLEAR(clear_module_state->__pyx_n_s_drude); + Py_CLEAR(clear_module_state->__pyx_n_s_ds); + Py_CLEAR(clear_module_state->__pyx_n_s_dt); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype_is_object); + Py_CLEAR(clear_module_state->__pyx_n_s_dx); + Py_CLEAR(clear_module_state->__pyx_n_s_dx2); + Py_CLEAR(clear_module_state->__pyx_n_s_dy); + Py_CLEAR(clear_module_state->__pyx_n_s_dy2); + Py_CLEAR(clear_module_state->__pyx_n_s_dz); + Py_CLEAR(clear_module_state->__pyx_n_s_dz2); + Py_CLEAR(clear_module_state->__pyx_n_s_edip); + Py_CLEAR(clear_module_state->__pyx_n_s_empty); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_end); + Py_CLEAR(clear_module_state->__pyx_n_s_energy); + Py_CLEAR(clear_module_state->__pyx_n_s_energy_ind); + Py_CLEAR(clear_module_state->__pyx_n_s_energy_octant); + Py_CLEAR(clear_module_state->__pyx_n_s_energy_octant_per_atom); + Py_CLEAR(clear_module_state->__pyx_n_s_energy_per_atom); + Py_CLEAR(clear_module_state->__pyx_n_s_energy_perm); + Py_CLEAR(clear_module_state->__pyx_n_s_energy_xyz); + Py_CLEAR(clear_module_state->__pyx_n_s_energy_xyz_per_atom); + Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); + Py_CLEAR(clear_module_state->__pyx_n_s_epa); + Py_CLEAR(clear_module_state->__pyx_n_s_epa1); + Py_CLEAR(clear_module_state->__pyx_n_s_epa_ind); + Py_CLEAR(clear_module_state->__pyx_n_s_epa_oct); + Py_CLEAR(clear_module_state->__pyx_n_s_epa_perm); + Py_CLEAR(clear_module_state->__pyx_n_s_epa_xyz); + Py_CLEAR(clear_module_state->__pyx_n_s_error); + Py_CLEAR(clear_module_state->__pyx_n_s_exclude_begin); + Py_CLEAR(clear_module_state->__pyx_n_s_exclude_end); + Py_CLEAR(clear_module_state->__pyx_n_s_f1); + Py_CLEAR(clear_module_state->__pyx_n_s_f2); + Py_CLEAR(clear_module_state->__pyx_n_s_f2_0); + Py_CLEAR(clear_module_state->__pyx_n_s_f2_1); + Py_CLEAR(clear_module_state->__pyx_n_s_f2_2); + Py_CLEAR(clear_module_state->__pyx_n_s_f2_x); + Py_CLEAR(clear_module_state->__pyx_n_s_f2_y); + Py_CLEAR(clear_module_state->__pyx_n_s_f2_z); + Py_CLEAR(clear_module_state->__pyx_n_s_findDS); + Py_CLEAR(clear_module_state->__pyx_n_s_findNearestAtom); + Py_CLEAR(clear_module_state->__pyx_n_s_first); + Py_CLEAR(clear_module_state->__pyx_n_s_flags); + Py_CLEAR(clear_module_state->__pyx_n_s_float64); + Py_CLEAR(clear_module_state->__pyx_n_s_format); + Py_CLEAR(clear_module_state->__pyx_n_s_fortran); + Py_CLEAR(clear_module_state->__pyx_n_u_fortran); + Py_CLEAR(clear_module_state->__pyx_n_s_frame); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_n_s_gfunc); + Py_CLEAR(clear_module_state->__pyx_kp_u_got); + Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_hbond); + Py_CLEAR(clear_module_state->__pyx_n_s_histo); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_bins); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_error); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_ind); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_max); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_min); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_perm); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_width); + Py_CLEAR(clear_module_state->__pyx_n_s_hs); + Py_CLEAR(clear_module_state->__pyx_n_s_i); + Py_CLEAR(clear_module_state->__pyx_n_s_id); + Py_CLEAR(clear_module_state->__pyx_n_s_idx); + Py_CLEAR(clear_module_state->__pyx_n_s_idx2); + Py_CLEAR(clear_module_state->__pyx_n_s_idx3); + Py_CLEAR(clear_module_state->__pyx_n_s_idx4); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_ind); + Py_CLEAR(clear_module_state->__pyx_n_s_index); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_int32); + Py_CLEAR(clear_module_state->__pyx_n_s_int8); + Py_CLEAR(clear_module_state->__pyx_n_s_integral); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_islt); + Py_CLEAR(clear_module_state->__pyx_n_s_isolute); + Py_CLEAR(clear_module_state->__pyx_n_s_itemsize); + Py_CLEAR(clear_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_CLEAR(clear_module_state->__pyx_n_s_j); + Py_CLEAR(clear_module_state->__pyx_n_s_k); + Py_CLEAR(clear_module_state->__pyx_n_s_l); + Py_CLEAR(clear_module_state->__pyx_n_s_l1); + Py_CLEAR(clear_module_state->__pyx_n_s_l2); + Py_CLEAR(clear_module_state->__pyx_n_s_laplace_im); + Py_CLEAR(clear_module_state->__pyx_n_s_laplace_re); + Py_CLEAR(clear_module_state->__pyx_n_s_last); + Py_CLEAR(clear_module_state->__pyx_n_s_len_H); + Py_CLEAR(clear_module_state->__pyx_n_s_len_center); + Py_CLEAR(clear_module_state->__pyx_n_s_lmax); + Py_CLEAR(clear_module_state->__pyx_n_s_m1); + Py_CLEAR(clear_module_state->__pyx_n_s_m1r); + Py_CLEAR(clear_module_state->__pyx_n_s_m2); + Py_CLEAR(clear_module_state->__pyx_n_s_m2r); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_masses); + Py_CLEAR(clear_module_state->__pyx_n_s_maxdist); + Py_CLEAR(clear_module_state->__pyx_n_s_maxshell); + Py_CLEAR(clear_module_state->__pyx_n_s_mdcage_ts); + Py_CLEAR(clear_module_state->__pyx_n_s_memview); + Py_CLEAR(clear_module_state->__pyx_n_s_mindist); + Py_CLEAR(clear_module_state->__pyx_n_s_mindist2); + Py_CLEAR(clear_module_state->__pyx_n_s_minvec); + Py_CLEAR(clear_module_state->__pyx_n_s_mode); + Py_CLEAR(clear_module_state->__pyx_n_s_msd); + Py_CLEAR(clear_module_state->__pyx_n_s_mu_solute); + Py_CLEAR(clear_module_state->__pyx_n_s_n); + Py_CLEAR(clear_module_state->__pyx_n_s_n1); + Py_CLEAR(clear_module_state->__pyx_n_s_n2); + Py_CLEAR(clear_module_state->__pyx_n_s_n3); + Py_CLEAR(clear_module_state->__pyx_n_s_n_core); + Py_CLEAR(clear_module_state->__pyx_n_s_n_surr); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_name_2); + Py_CLEAR(clear_module_state->__pyx_n_s_nat); + Py_CLEAR(clear_module_state->__pyx_n_s_natoms); + Py_CLEAR(clear_module_state->__pyx_n_s_ndim); + Py_CLEAR(clear_module_state->__pyx_n_s_new); + Py_CLEAR(clear_module_state->__pyx_n_s_newanalysis_helpers); + Py_CLEAR(clear_module_state->__pyx_kp_s_newanalysis_helpers_helpers_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_next_id); + Py_CLEAR(clear_module_state->__pyx_n_s_nmol); + Py_CLEAR(clear_module_state->__pyx_n_s_nmolecules); + Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_CLEAR(clear_module_state->__pyx_n_s_np); + Py_CLEAR(clear_module_state->__pyx_n_s_nres); + Py_CLEAR(clear_module_state->__pyx_n_s_nres_surr); + Py_CLEAR(clear_module_state->__pyx_n_s_nres_wat); + Py_CLEAR(clear_module_state->__pyx_n_s_nshells); + Py_CLEAR(clear_module_state->__pyx_n_s_nshells2); + Py_CLEAR(clear_module_state->__pyx_n_s_nsurr); + Py_CLEAR(clear_module_state->__pyx_n_s_nt); + Py_CLEAR(clear_module_state->__pyx_n_s_numpoints); + Py_CLEAR(clear_module_state->__pyx_n_s_numpy); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_CLEAR(clear_module_state->__pyx_n_s_nwat); + Py_CLEAR(clear_module_state->__pyx_n_s_obj); + Py_CLEAR(clear_module_state->__pyx_n_s_octants); + Py_CLEAR(clear_module_state->__pyx_n_s_oxyquinol); + Py_CLEAR(clear_module_state->__pyx_n_s_pack); + Py_CLEAR(clear_module_state->__pyx_n_s_pickle); + Py_CLEAR(clear_module_state->__pyx_n_s_pol); + Py_CLEAR(clear_module_state->__pyx_n_s_pyE); + Py_CLEAR(clear_module_state->__pyx_n_s_py_B1); + Py_CLEAR(clear_module_state->__pyx_n_s_py_B2); + Py_CLEAR(clear_module_state->__pyx_n_s_py_B3); + Py_CLEAR(clear_module_state->__pyx_n_s_py_charges); + Py_CLEAR(clear_module_state->__pyx_n_s_py_dipt); + Py_CLEAR(clear_module_state->__pyx_n_s_py_xyz); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); + Py_CLEAR(clear_module_state->__pyx_n_s_q); + Py_CLEAR(clear_module_state->__pyx_n_s_qq); + Py_CLEAR(clear_module_state->__pyx_n_s_qq_diff); + Py_CLEAR(clear_module_state->__pyx_n_s_qqr); + Py_CLEAR(clear_module_state->__pyx_n_s_r); + Py_CLEAR(clear_module_state->__pyx_n_s_r2); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_register); + Py_CLEAR(clear_module_state->__pyx_n_s_rep); + Py_CLEAR(clear_module_state->__pyx_n_s_residue_first_atom); + Py_CLEAR(clear_module_state->__pyx_n_s_result); + Py_CLEAR(clear_module_state->__pyx_n_s_rfa); + Py_CLEAR(clear_module_state->__pyx_n_s_roxy); + Py_CLEAR(clear_module_state->__pyx_n_s_rtre); + Py_CLEAR(clear_module_state->__pyx_n_s_rv); + Py_CLEAR(clear_module_state->__pyx_n_s_rvec0); + Py_CLEAR(clear_module_state->__pyx_n_s_rvec1); + Py_CLEAR(clear_module_state->__pyx_n_s_rvec2); + Py_CLEAR(clear_module_state->__pyx_n_s_scipy_special); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_shape); + Py_CLEAR(clear_module_state->__pyx_n_s_shell); + Py_CLEAR(clear_module_state->__pyx_n_s_shift); + Py_CLEAR(clear_module_state->__pyx_n_s_sites_per_res); + Py_CLEAR(clear_module_state->__pyx_n_s_size); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_sphHarmMatrix); + Py_CLEAR(clear_module_state->__pyx_n_s_sph_harm); + Py_CLEAR(clear_module_state->__pyx_n_s_squared_r_oxy); + Py_CLEAR(clear_module_state->__pyx_n_s_squared_r_tre); + Py_CLEAR(clear_module_state->__pyx_n_s_start); + Py_CLEAR(clear_module_state->__pyx_n_s_step); + Py_CLEAR(clear_module_state->__pyx_n_s_stop); + Py_CLEAR(clear_module_state->__pyx_n_s_store); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_struct); + Py_CLEAR(clear_module_state->__pyx_n_s_sumMDCage); + Py_CLEAR(clear_module_state->__pyx_n_s_sumMDCageSingle); + Py_CLEAR(clear_module_state->__pyx_n_s_sumr); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_t); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_timectr); + Py_CLEAR(clear_module_state->__pyx_n_s_tmp); + Py_CLEAR(clear_module_state->__pyx_n_s_tmp_ener); + Py_CLEAR(clear_module_state->__pyx_n_s_tmp_ind); + Py_CLEAR(clear_module_state->__pyx_n_s_tmp_perm); + Py_CLEAR(clear_module_state->__pyx_n_s_tmp_x); + Py_CLEAR(clear_module_state->__pyx_n_s_tmp_y); + Py_CLEAR(clear_module_state->__pyx_n_s_tmp_z); + Py_CLEAR(clear_module_state->__pyx_n_s_tmpx); + Py_CLEAR(clear_module_state->__pyx_n_s_tmpy); + Py_CLEAR(clear_module_state->__pyx_n_s_tmpz); + Py_CLEAR(clear_module_state->__pyx_n_s_tn); + Py_CLEAR(clear_module_state->__pyx_n_s_tot_mass); + Py_CLEAR(clear_module_state->__pyx_n_s_transform); + Py_CLEAR(clear_module_state->__pyx_n_s_trehalose); + Py_CLEAR(clear_module_state->__pyx_n_s_ts); + Py_CLEAR(clear_module_state->__pyx_n_s_tyH); + Py_CLEAR(clear_module_state->__pyx_n_s_tzH); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_CLEAR(clear_module_state->__pyx_n_s_unpack); + Py_CLEAR(clear_module_state->__pyx_n_s_update); + Py_CLEAR(clear_module_state->__pyx_n_s_vel); + Py_CLEAR(clear_module_state->__pyx_n_s_velcom); + Py_CLEAR(clear_module_state->__pyx_n_s_velcomByResidue); + Py_CLEAR(clear_module_state->__pyx_n_s_vels); + Py_CLEAR(clear_module_state->__pyx_n_s_version_info); + Py_CLEAR(clear_module_state->__pyx_n_s_vol); + Py_CLEAR(clear_module_state->__pyx_n_s_w); + Py_CLEAR(clear_module_state->__pyx_n_s_waterRotationMatrix); + Py_CLEAR(clear_module_state->__pyx_n_s_wt); + Py_CLEAR(clear_module_state->__pyx_n_s_wt1); + Py_CLEAR(clear_module_state->__pyx_n_s_wts); + Py_CLEAR(clear_module_state->__pyx_n_s_x); + Py_CLEAR(clear_module_state->__pyx_n_s_xyz); + Py_CLEAR(clear_module_state->__pyx_n_s_y); + Py_CLEAR(clear_module_state->__pyx_n_s_y_mat); + Py_CLEAR(clear_module_state->__pyx_n_s_z); + Py_CLEAR(clear_module_state->__pyx_n_s_zeros); + Py_CLEAR(clear_module_state->__pyx_float_0_2400); + Py_CLEAR(clear_module_state->__pyx_float_1_8086); + Py_CLEAR(clear_module_state->__pyx_float_1390_02); + Py_CLEAR(clear_module_state->__pyx_float_neg_2_0487); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_2); + Py_CLEAR(clear_module_state->__pyx_int_3); + Py_CLEAR(clear_module_state->__pyx_int_6); + Py_CLEAR(clear_module_state->__pyx_int_8); + Py_CLEAR(clear_module_state->__pyx_int_15); + Py_CLEAR(clear_module_state->__pyx_int_112105877); + Py_CLEAR(clear_module_state->__pyx_int_136983863); + Py_CLEAR(clear_module_state->__pyx_int_184977713); + Py_CLEAR(clear_module_state->__pyx_int_neg_1); + Py_CLEAR(clear_module_state->__pyx_slice__5); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_tuple__9); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__14); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__16); + Py_CLEAR(clear_module_state->__pyx_tuple__17); + Py_CLEAR(clear_module_state->__pyx_tuple__18); + Py_CLEAR(clear_module_state->__pyx_tuple__19); + Py_CLEAR(clear_module_state->__pyx_tuple__20); + Py_CLEAR(clear_module_state->__pyx_tuple__21); + Py_CLEAR(clear_module_state->__pyx_tuple__22); + Py_CLEAR(clear_module_state->__pyx_tuple__23); + Py_CLEAR(clear_module_state->__pyx_tuple__24); + Py_CLEAR(clear_module_state->__pyx_tuple__26); + Py_CLEAR(clear_module_state->__pyx_tuple__28); + Py_CLEAR(clear_module_state->__pyx_tuple__30); + Py_CLEAR(clear_module_state->__pyx_tuple__32); + Py_CLEAR(clear_module_state->__pyx_tuple__34); + Py_CLEAR(clear_module_state->__pyx_tuple__36); + Py_CLEAR(clear_module_state->__pyx_tuple__38); + Py_CLEAR(clear_module_state->__pyx_tuple__40); + Py_CLEAR(clear_module_state->__pyx_tuple__42); + Py_CLEAR(clear_module_state->__pyx_tuple__44); + Py_CLEAR(clear_module_state->__pyx_tuple__46); + Py_CLEAR(clear_module_state->__pyx_tuple__48); + Py_CLEAR(clear_module_state->__pyx_tuple__50); + Py_CLEAR(clear_module_state->__pyx_tuple__52); + Py_CLEAR(clear_module_state->__pyx_tuple__54); + Py_CLEAR(clear_module_state->__pyx_tuple__56); + Py_CLEAR(clear_module_state->__pyx_tuple__58); + Py_CLEAR(clear_module_state->__pyx_tuple__60); + Py_CLEAR(clear_module_state->__pyx_tuple__62); + Py_CLEAR(clear_module_state->__pyx_tuple__64); + Py_CLEAR(clear_module_state->__pyx_tuple__66); + Py_CLEAR(clear_module_state->__pyx_tuple__67); + Py_CLEAR(clear_module_state->__pyx_tuple__69); + Py_CLEAR(clear_module_state->__pyx_tuple__71); + Py_CLEAR(clear_module_state->__pyx_tuple__73); + Py_CLEAR(clear_module_state->__pyx_tuple__75); + Py_CLEAR(clear_module_state->__pyx_tuple__77); + Py_CLEAR(clear_module_state->__pyx_tuple__79); + Py_CLEAR(clear_module_state->__pyx_tuple__81); + Py_CLEAR(clear_module_state->__pyx_tuple__83); + Py_CLEAR(clear_module_state->__pyx_tuple__85); + Py_CLEAR(clear_module_state->__pyx_tuple__87); + Py_CLEAR(clear_module_state->__pyx_tuple__89); + Py_CLEAR(clear_module_state->__pyx_tuple__91); + Py_CLEAR(clear_module_state->__pyx_tuple__93); + Py_CLEAR(clear_module_state->__pyx_tuple__95); + Py_CLEAR(clear_module_state->__pyx_tuple__97); + Py_CLEAR(clear_module_state->__pyx_tuple__99); + Py_CLEAR(clear_module_state->__pyx_tuple__101); + Py_CLEAR(clear_module_state->__pyx_tuple__103); + Py_CLEAR(clear_module_state->__pyx_tuple__105); + Py_CLEAR(clear_module_state->__pyx_tuple__107); + Py_CLEAR(clear_module_state->__pyx_codeobj__25); + Py_CLEAR(clear_module_state->__pyx_codeobj__27); + Py_CLEAR(clear_module_state->__pyx_codeobj__29); + Py_CLEAR(clear_module_state->__pyx_codeobj__31); + Py_CLEAR(clear_module_state->__pyx_codeobj__33); + Py_CLEAR(clear_module_state->__pyx_codeobj__35); + Py_CLEAR(clear_module_state->__pyx_codeobj__37); + Py_CLEAR(clear_module_state->__pyx_codeobj__39); + Py_CLEAR(clear_module_state->__pyx_codeobj__41); + Py_CLEAR(clear_module_state->__pyx_codeobj__43); + Py_CLEAR(clear_module_state->__pyx_codeobj__45); + Py_CLEAR(clear_module_state->__pyx_codeobj__47); + Py_CLEAR(clear_module_state->__pyx_codeobj__49); + Py_CLEAR(clear_module_state->__pyx_codeobj__51); + Py_CLEAR(clear_module_state->__pyx_codeobj__53); + Py_CLEAR(clear_module_state->__pyx_codeobj__55); + Py_CLEAR(clear_module_state->__pyx_codeobj__57); + Py_CLEAR(clear_module_state->__pyx_codeobj__59); + Py_CLEAR(clear_module_state->__pyx_codeobj__61); + Py_CLEAR(clear_module_state->__pyx_codeobj__63); + Py_CLEAR(clear_module_state->__pyx_codeobj__65); + Py_CLEAR(clear_module_state->__pyx_codeobj__68); + Py_CLEAR(clear_module_state->__pyx_codeobj__70); + Py_CLEAR(clear_module_state->__pyx_codeobj__72); + Py_CLEAR(clear_module_state->__pyx_codeobj__74); + Py_CLEAR(clear_module_state->__pyx_codeobj__76); + Py_CLEAR(clear_module_state->__pyx_codeobj__78); + Py_CLEAR(clear_module_state->__pyx_codeobj__80); + Py_CLEAR(clear_module_state->__pyx_codeobj__82); + Py_CLEAR(clear_module_state->__pyx_codeobj__84); + Py_CLEAR(clear_module_state->__pyx_codeobj__86); + Py_CLEAR(clear_module_state->__pyx_codeobj__88); + Py_CLEAR(clear_module_state->__pyx_codeobj__90); + Py_CLEAR(clear_module_state->__pyx_codeobj__92); + Py_CLEAR(clear_module_state->__pyx_codeobj__94); + Py_CLEAR(clear_module_state->__pyx_codeobj__96); + Py_CLEAR(clear_module_state->__pyx_codeobj__98); + Py_CLEAR(clear_module_state->__pyx_codeobj__100); + Py_CLEAR(clear_module_state->__pyx_codeobj__102); + Py_CLEAR(clear_module_state->__pyx_codeobj__104); + Py_CLEAR(clear_module_state->__pyx_codeobj__106); + Py_CLEAR(clear_module_state->__pyx_codeobj__108); + return 0; } - -/* "src/helpers/helpers.pyx":24 +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_n_s_A); + Py_VISIT(traverse_module_state->__pyx_n_s_ASCII); + Py_VISIT(traverse_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError); + Py_VISIT(traverse_module_state->__pyx_n_s_B); + Py_VISIT(traverse_module_state->__pyx_n_s_B1); + Py_VISIT(traverse_module_state->__pyx_n_s_B2); + Py_VISIT(traverse_module_state->__pyx_n_s_B3); + Py_VISIT(traverse_module_state->__pyx_n_s_B_out); + Py_VISIT(traverse_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_VISIT(traverse_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_VISIT(traverse_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_VISIT(traverse_module_state->__pyx_n_s_E); + Py_VISIT(traverse_module_state->__pyx_n_s_Ellipsis); + Py_VISIT(traverse_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_VISIT(traverse_module_state->__pyx_n_s_Exx); + Py_VISIT(traverse_module_state->__pyx_n_s_Eyy); + Py_VISIT(traverse_module_state->__pyx_n_s_Ezz); + Py_VISIT(traverse_module_state->__pyx_n_s_H1x); + Py_VISIT(traverse_module_state->__pyx_n_s_H1y); + Py_VISIT(traverse_module_state->__pyx_n_s_H1z); + Py_VISIT(traverse_module_state->__pyx_n_s_H2x); + Py_VISIT(traverse_module_state->__pyx_n_s_H2y); + Py_VISIT(traverse_module_state->__pyx_n_s_H2z); + Py_VISIT(traverse_module_state->__pyx_n_s_H_indices); + Py_VISIT(traverse_module_state->__pyx_n_s_H_shell); + Py_VISIT(traverse_module_state->__pyx_n_s_I); + Py_VISIT(traverse_module_state->__pyx_n_s_ImportError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_VISIT(traverse_module_state->__pyx_n_s_IndexError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_VISIT(traverse_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_VISIT(traverse_module_state->__pyx_n_s_L); + Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_VISIT(traverse_module_state->__pyx_n_s_N); + Py_VISIT(traverse_module_state->__pyx_n_s_NQRdipTen); + Py_VISIT(traverse_module_state->__pyx_n_s_NQRself); + Py_VISIT(traverse_module_state->__pyx_n_s_NQRselfAndB); + Py_VISIT(traverse_module_state->__pyx_n_b_O); + Py_VISIT(traverse_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_R); + Py_VISIT(traverse_module_state->__pyx_n_s_Sequence); + Py_VISIT(traverse_module_state->__pyx_n_s_SphereinCube); + Py_VISIT(traverse_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_VISIT(traverse_module_state->__pyx_n_s_T); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); + Py_VISIT(traverse_module_state->__pyx_n_s_View_MemoryView); + Py_VISIT(traverse_module_state->__pyx_n_s__109); + Py_VISIT(traverse_module_state->__pyx_kp_u__2); + Py_VISIT(traverse_module_state->__pyx_n_s__3); + Py_VISIT(traverse_module_state->__pyx_kp_u__6); + Py_VISIT(traverse_module_state->__pyx_kp_u__7); + Py_VISIT(traverse_module_state->__pyx_n_s_a1); + Py_VISIT(traverse_module_state->__pyx_n_s_a2); + Py_VISIT(traverse_module_state->__pyx_n_s_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_actr); + Py_VISIT(traverse_module_state->__pyx_n_s_allocate_buffer); + Py_VISIT(traverse_module_state->__pyx_n_s_an_first); + Py_VISIT(traverse_module_state->__pyx_n_s_an_last); + Py_VISIT(traverse_module_state->__pyx_kp_u_and); + Py_VISIT(traverse_module_state->__pyx_n_s_applyRotationMatrix); + Py_VISIT(traverse_module_state->__pyx_n_s_apr); + Py_VISIT(traverse_module_state->__pyx_n_s_arccos); + Py_VISIT(traverse_module_state->__pyx_n_s_arctan2); + Py_VISIT(traverse_module_state->__pyx_n_s_asarray); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_atomicCurrent); + Py_VISIT(traverse_module_state->__pyx_n_s_atoms_per_residue); + Py_VISIT(traverse_module_state->__pyx_n_s_auf); + Py_VISIT(traverse_module_state->__pyx_n_s_auf3); + Py_VISIT(traverse_module_state->__pyx_n_s_auf6); + Py_VISIT(traverse_module_state->__pyx_n_s_auf_x1); + Py_VISIT(traverse_module_state->__pyx_n_s_auf_x2); + Py_VISIT(traverse_module_state->__pyx_n_s_auf_y1); + Py_VISIT(traverse_module_state->__pyx_n_s_auf_y2); + Py_VISIT(traverse_module_state->__pyx_n_s_auf_z1); + Py_VISIT(traverse_module_state->__pyx_n_s_auf_z2); + Py_VISIT(traverse_module_state->__pyx_n_s_aufpunkt); + Py_VISIT(traverse_module_state->__pyx_n_s_azi); + Py_VISIT(traverse_module_state->__pyx_n_s_base); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl); + Py_VISIT(traverse_module_state->__pyx_n_s_c); + Py_VISIT(traverse_module_state->__pyx_n_u_c); + Py_VISIT(traverse_module_state->__pyx_n_s_c1); + Py_VISIT(traverse_module_state->__pyx_n_s_c2); + Py_VISIT(traverse_module_state->__pyx_n_s_cI); + Py_VISIT(traverse_module_state->__pyx_n_s_cL); + Py_VISIT(traverse_module_state->__pyx_n_s_c_rv); + Py_VISIT(traverse_module_state->__pyx_n_s_calcAngularDisplacement); + Py_VISIT(traverse_module_state->__pyx_n_s_calcAngularMomentum); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDipDipEnergyAtomic); + Py_VISIT(traverse_module_state->__pyx_n_s_calcEnergyAA); + Py_VISIT(traverse_module_state->__pyx_n_s_calcEnergyAASep); + Py_VISIT(traverse_module_state->__pyx_n_s_calcEnergyAAhisto); + Py_VISIT(traverse_module_state->__pyx_n_s_calcEnergyAAhisto1); + Py_VISIT(traverse_module_state->__pyx_n_s_calcEnergyAApermind); + Py_VISIT(traverse_module_state->__pyx_n_s_calcEnergyAApermindhisto); + Py_VISIT(traverse_module_state->__pyx_n_s_calcEnergyAtomic); + Py_VISIT(traverse_module_state->__pyx_n_s_calcEnergyAtomicVoro); + Py_VISIT(traverse_module_state->__pyx_n_s_calcEnergyDouble); + Py_VISIT(traverse_module_state->__pyx_n_s_calcEnergyMuA); + Py_VISIT(traverse_module_state->__pyx_n_s_calcFourierLaplaceTransform); + Py_VISIT(traverse_module_state->__pyx_n_s_calcInertiaTensor); + Py_VISIT(traverse_module_state->__pyx_n_s_calcOctant); + Py_VISIT(traverse_module_state->__pyx_n_s_calcResidenceTimeseries); + Py_VISIT(traverse_module_state->__pyx_n_s_calcRotationMatrix); + Py_VISIT(traverse_module_state->__pyx_n_s_cat_first); + Py_VISIT(traverse_module_state->__pyx_n_s_cat_last); + Py_VISIT(traverse_module_state->__pyx_n_s_ccom); + Py_VISIT(traverse_module_state->__pyx_n_s_cds); + Py_VISIT(traverse_module_state->__pyx_n_s_center); + Py_VISIT(traverse_module_state->__pyx_n_s_centerOrientBox); + Py_VISIT(traverse_module_state->__pyx_n_s_centerToPointOrientBox); + Py_VISIT(traverse_module_state->__pyx_n_s_centers); + Py_VISIT(traverse_module_state->__pyx_n_s_charges); + Py_VISIT(traverse_module_state->__pyx_n_s_charges1); + Py_VISIT(traverse_module_state->__pyx_n_s_checkHBond); + Py_VISIT(traverse_module_state->__pyx_n_s_class); + Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_cn); + Py_VISIT(traverse_module_state->__pyx_n_s_coct); + Py_VISIT(traverse_module_state->__pyx_n_s_collections); + Py_VISIT(traverse_module_state->__pyx_kp_s_collections_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_collectiveDipoleMomentWaterShell); + Py_VISIT(traverse_module_state->__pyx_n_s_com); + Py_VISIT(traverse_module_state->__pyx_n_s_comByResidue); + Py_VISIT(traverse_module_state->__pyx_n_s_coms); + Py_VISIT(traverse_module_state->__pyx_n_s_comslt); + Py_VISIT(traverse_module_state->__pyx_n_s_conjugate); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_VISIT(traverse_module_state->__pyx_n_s_coo_H); + Py_VISIT(traverse_module_state->__pyx_n_s_coo_center); + Py_VISIT(traverse_module_state->__pyx_n_s_coor); + Py_VISIT(traverse_module_state->__pyx_n_s_coorA); + Py_VISIT(traverse_module_state->__pyx_n_s_coorB); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_core); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_oh2); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_surr); + Py_VISIT(traverse_module_state->__pyx_n_s_corrsubmean); + Py_VISIT(traverse_module_state->__pyx_n_s_cosine); + Py_VISIT(traverse_module_state->__pyx_n_s_count); + Py_VISIT(traverse_module_state->__pyx_n_s_ctr); + Py_VISIT(traverse_module_state->__pyx_n_s_cxyz); + Py_VISIT(traverse_module_state->__pyx_n_s_data_x); + Py_VISIT(traverse_module_state->__pyx_n_s_data_y); + Py_VISIT(traverse_module_state->__pyx_n_s_deltaA); + Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_n_s_dip); + Py_VISIT(traverse_module_state->__pyx_n_s_dipByResidue); + Py_VISIT(traverse_module_state->__pyx_n_s_dipT0); + Py_VISIT(traverse_module_state->__pyx_n_s_dipTen); + Py_VISIT(traverse_module_state->__pyx_n_s_dipTenCorrel); + Py_VISIT(traverse_module_state->__pyx_n_s_dipTenInit); + Py_VISIT(traverse_module_state->__pyx_n_s_dipTt0); + Py_VISIT(traverse_module_state->__pyx_n_s_dipTt1); + Py_VISIT(traverse_module_state->__pyx_n_s_dipTt2); + Py_VISIT(traverse_module_state->__pyx_n_s_dipTt3); + Py_VISIT(traverse_module_state->__pyx_n_s_dipTt4); + Py_VISIT(traverse_module_state->__pyx_n_s_dipTt5); + Py_VISIT(traverse_module_state->__pyx_n_s_dip_wat); + Py_VISIT(traverse_module_state->__pyx_n_s_dipol); + Py_VISIT(traverse_module_state->__pyx_n_s_dipoleMomentNeutralSelection); + Py_VISIT(traverse_module_state->__pyx_n_s_dipt); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_dist); + Py_VISIT(traverse_module_state->__pyx_n_s_dist2); + Py_VISIT(traverse_module_state->__pyx_n_s_dot); + Py_VISIT(traverse_module_state->__pyx_n_s_dot2); + Py_VISIT(traverse_module_state->__pyx_n_s_drude); + Py_VISIT(traverse_module_state->__pyx_n_s_ds); + Py_VISIT(traverse_module_state->__pyx_n_s_dt); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype_is_object); + Py_VISIT(traverse_module_state->__pyx_n_s_dx); + Py_VISIT(traverse_module_state->__pyx_n_s_dx2); + Py_VISIT(traverse_module_state->__pyx_n_s_dy); + Py_VISIT(traverse_module_state->__pyx_n_s_dy2); + Py_VISIT(traverse_module_state->__pyx_n_s_dz); + Py_VISIT(traverse_module_state->__pyx_n_s_dz2); + Py_VISIT(traverse_module_state->__pyx_n_s_edip); + Py_VISIT(traverse_module_state->__pyx_n_s_empty); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_end); + Py_VISIT(traverse_module_state->__pyx_n_s_energy); + Py_VISIT(traverse_module_state->__pyx_n_s_energy_ind); + Py_VISIT(traverse_module_state->__pyx_n_s_energy_octant); + Py_VISIT(traverse_module_state->__pyx_n_s_energy_octant_per_atom); + Py_VISIT(traverse_module_state->__pyx_n_s_energy_per_atom); + Py_VISIT(traverse_module_state->__pyx_n_s_energy_perm); + Py_VISIT(traverse_module_state->__pyx_n_s_energy_xyz); + Py_VISIT(traverse_module_state->__pyx_n_s_energy_xyz_per_atom); + Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); + Py_VISIT(traverse_module_state->__pyx_n_s_epa); + Py_VISIT(traverse_module_state->__pyx_n_s_epa1); + Py_VISIT(traverse_module_state->__pyx_n_s_epa_ind); + Py_VISIT(traverse_module_state->__pyx_n_s_epa_oct); + Py_VISIT(traverse_module_state->__pyx_n_s_epa_perm); + Py_VISIT(traverse_module_state->__pyx_n_s_epa_xyz); + Py_VISIT(traverse_module_state->__pyx_n_s_error); + Py_VISIT(traverse_module_state->__pyx_n_s_exclude_begin); + Py_VISIT(traverse_module_state->__pyx_n_s_exclude_end); + Py_VISIT(traverse_module_state->__pyx_n_s_f1); + Py_VISIT(traverse_module_state->__pyx_n_s_f2); + Py_VISIT(traverse_module_state->__pyx_n_s_f2_0); + Py_VISIT(traverse_module_state->__pyx_n_s_f2_1); + Py_VISIT(traverse_module_state->__pyx_n_s_f2_2); + Py_VISIT(traverse_module_state->__pyx_n_s_f2_x); + Py_VISIT(traverse_module_state->__pyx_n_s_f2_y); + Py_VISIT(traverse_module_state->__pyx_n_s_f2_z); + Py_VISIT(traverse_module_state->__pyx_n_s_findDS); + Py_VISIT(traverse_module_state->__pyx_n_s_findNearestAtom); + Py_VISIT(traverse_module_state->__pyx_n_s_first); + Py_VISIT(traverse_module_state->__pyx_n_s_flags); + Py_VISIT(traverse_module_state->__pyx_n_s_float64); + Py_VISIT(traverse_module_state->__pyx_n_s_format); + Py_VISIT(traverse_module_state->__pyx_n_s_fortran); + Py_VISIT(traverse_module_state->__pyx_n_u_fortran); + Py_VISIT(traverse_module_state->__pyx_n_s_frame); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_n_s_gfunc); + Py_VISIT(traverse_module_state->__pyx_kp_u_got); + Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_hbond); + Py_VISIT(traverse_module_state->__pyx_n_s_histo); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_bins); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_error); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_ind); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_max); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_min); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_perm); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_width); + Py_VISIT(traverse_module_state->__pyx_n_s_hs); + Py_VISIT(traverse_module_state->__pyx_n_s_i); + Py_VISIT(traverse_module_state->__pyx_n_s_id); + Py_VISIT(traverse_module_state->__pyx_n_s_idx); + Py_VISIT(traverse_module_state->__pyx_n_s_idx2); + Py_VISIT(traverse_module_state->__pyx_n_s_idx3); + Py_VISIT(traverse_module_state->__pyx_n_s_idx4); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_ind); + Py_VISIT(traverse_module_state->__pyx_n_s_index); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_int32); + Py_VISIT(traverse_module_state->__pyx_n_s_int8); + Py_VISIT(traverse_module_state->__pyx_n_s_integral); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_islt); + Py_VISIT(traverse_module_state->__pyx_n_s_isolute); + Py_VISIT(traverse_module_state->__pyx_n_s_itemsize); + Py_VISIT(traverse_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_VISIT(traverse_module_state->__pyx_n_s_j); + Py_VISIT(traverse_module_state->__pyx_n_s_k); + Py_VISIT(traverse_module_state->__pyx_n_s_l); + Py_VISIT(traverse_module_state->__pyx_n_s_l1); + Py_VISIT(traverse_module_state->__pyx_n_s_l2); + Py_VISIT(traverse_module_state->__pyx_n_s_laplace_im); + Py_VISIT(traverse_module_state->__pyx_n_s_laplace_re); + Py_VISIT(traverse_module_state->__pyx_n_s_last); + Py_VISIT(traverse_module_state->__pyx_n_s_len_H); + Py_VISIT(traverse_module_state->__pyx_n_s_len_center); + Py_VISIT(traverse_module_state->__pyx_n_s_lmax); + Py_VISIT(traverse_module_state->__pyx_n_s_m1); + Py_VISIT(traverse_module_state->__pyx_n_s_m1r); + Py_VISIT(traverse_module_state->__pyx_n_s_m2); + Py_VISIT(traverse_module_state->__pyx_n_s_m2r); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_masses); + Py_VISIT(traverse_module_state->__pyx_n_s_maxdist); + Py_VISIT(traverse_module_state->__pyx_n_s_maxshell); + Py_VISIT(traverse_module_state->__pyx_n_s_mdcage_ts); + Py_VISIT(traverse_module_state->__pyx_n_s_memview); + Py_VISIT(traverse_module_state->__pyx_n_s_mindist); + Py_VISIT(traverse_module_state->__pyx_n_s_mindist2); + Py_VISIT(traverse_module_state->__pyx_n_s_minvec); + Py_VISIT(traverse_module_state->__pyx_n_s_mode); + Py_VISIT(traverse_module_state->__pyx_n_s_msd); + Py_VISIT(traverse_module_state->__pyx_n_s_mu_solute); + Py_VISIT(traverse_module_state->__pyx_n_s_n); + Py_VISIT(traverse_module_state->__pyx_n_s_n1); + Py_VISIT(traverse_module_state->__pyx_n_s_n2); + Py_VISIT(traverse_module_state->__pyx_n_s_n3); + Py_VISIT(traverse_module_state->__pyx_n_s_n_core); + Py_VISIT(traverse_module_state->__pyx_n_s_n_surr); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_name_2); + Py_VISIT(traverse_module_state->__pyx_n_s_nat); + Py_VISIT(traverse_module_state->__pyx_n_s_natoms); + Py_VISIT(traverse_module_state->__pyx_n_s_ndim); + Py_VISIT(traverse_module_state->__pyx_n_s_new); + Py_VISIT(traverse_module_state->__pyx_n_s_newanalysis_helpers); + Py_VISIT(traverse_module_state->__pyx_kp_s_newanalysis_helpers_helpers_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_next_id); + Py_VISIT(traverse_module_state->__pyx_n_s_nmol); + Py_VISIT(traverse_module_state->__pyx_n_s_nmolecules); + Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_VISIT(traverse_module_state->__pyx_n_s_np); + Py_VISIT(traverse_module_state->__pyx_n_s_nres); + Py_VISIT(traverse_module_state->__pyx_n_s_nres_surr); + Py_VISIT(traverse_module_state->__pyx_n_s_nres_wat); + Py_VISIT(traverse_module_state->__pyx_n_s_nshells); + Py_VISIT(traverse_module_state->__pyx_n_s_nshells2); + Py_VISIT(traverse_module_state->__pyx_n_s_nsurr); + Py_VISIT(traverse_module_state->__pyx_n_s_nt); + Py_VISIT(traverse_module_state->__pyx_n_s_numpoints); + Py_VISIT(traverse_module_state->__pyx_n_s_numpy); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_VISIT(traverse_module_state->__pyx_n_s_nwat); + Py_VISIT(traverse_module_state->__pyx_n_s_obj); + Py_VISIT(traverse_module_state->__pyx_n_s_octants); + Py_VISIT(traverse_module_state->__pyx_n_s_oxyquinol); + Py_VISIT(traverse_module_state->__pyx_n_s_pack); + Py_VISIT(traverse_module_state->__pyx_n_s_pickle); + Py_VISIT(traverse_module_state->__pyx_n_s_pol); + Py_VISIT(traverse_module_state->__pyx_n_s_pyE); + Py_VISIT(traverse_module_state->__pyx_n_s_py_B1); + Py_VISIT(traverse_module_state->__pyx_n_s_py_B2); + Py_VISIT(traverse_module_state->__pyx_n_s_py_B3); + Py_VISIT(traverse_module_state->__pyx_n_s_py_charges); + Py_VISIT(traverse_module_state->__pyx_n_s_py_dipt); + Py_VISIT(traverse_module_state->__pyx_n_s_py_xyz); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); + Py_VISIT(traverse_module_state->__pyx_n_s_q); + Py_VISIT(traverse_module_state->__pyx_n_s_qq); + Py_VISIT(traverse_module_state->__pyx_n_s_qq_diff); + Py_VISIT(traverse_module_state->__pyx_n_s_qqr); + Py_VISIT(traverse_module_state->__pyx_n_s_r); + Py_VISIT(traverse_module_state->__pyx_n_s_r2); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_register); + Py_VISIT(traverse_module_state->__pyx_n_s_rep); + Py_VISIT(traverse_module_state->__pyx_n_s_residue_first_atom); + Py_VISIT(traverse_module_state->__pyx_n_s_result); + Py_VISIT(traverse_module_state->__pyx_n_s_rfa); + Py_VISIT(traverse_module_state->__pyx_n_s_roxy); + Py_VISIT(traverse_module_state->__pyx_n_s_rtre); + Py_VISIT(traverse_module_state->__pyx_n_s_rv); + Py_VISIT(traverse_module_state->__pyx_n_s_rvec0); + Py_VISIT(traverse_module_state->__pyx_n_s_rvec1); + Py_VISIT(traverse_module_state->__pyx_n_s_rvec2); + Py_VISIT(traverse_module_state->__pyx_n_s_scipy_special); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_shape); + Py_VISIT(traverse_module_state->__pyx_n_s_shell); + Py_VISIT(traverse_module_state->__pyx_n_s_shift); + Py_VISIT(traverse_module_state->__pyx_n_s_sites_per_res); + Py_VISIT(traverse_module_state->__pyx_n_s_size); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_sphHarmMatrix); + Py_VISIT(traverse_module_state->__pyx_n_s_sph_harm); + Py_VISIT(traverse_module_state->__pyx_n_s_squared_r_oxy); + Py_VISIT(traverse_module_state->__pyx_n_s_squared_r_tre); + Py_VISIT(traverse_module_state->__pyx_n_s_start); + Py_VISIT(traverse_module_state->__pyx_n_s_step); + Py_VISIT(traverse_module_state->__pyx_n_s_stop); + Py_VISIT(traverse_module_state->__pyx_n_s_store); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_struct); + Py_VISIT(traverse_module_state->__pyx_n_s_sumMDCage); + Py_VISIT(traverse_module_state->__pyx_n_s_sumMDCageSingle); + Py_VISIT(traverse_module_state->__pyx_n_s_sumr); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_t); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_timectr); + Py_VISIT(traverse_module_state->__pyx_n_s_tmp); + Py_VISIT(traverse_module_state->__pyx_n_s_tmp_ener); + Py_VISIT(traverse_module_state->__pyx_n_s_tmp_ind); + Py_VISIT(traverse_module_state->__pyx_n_s_tmp_perm); + Py_VISIT(traverse_module_state->__pyx_n_s_tmp_x); + Py_VISIT(traverse_module_state->__pyx_n_s_tmp_y); + Py_VISIT(traverse_module_state->__pyx_n_s_tmp_z); + Py_VISIT(traverse_module_state->__pyx_n_s_tmpx); + Py_VISIT(traverse_module_state->__pyx_n_s_tmpy); + Py_VISIT(traverse_module_state->__pyx_n_s_tmpz); + Py_VISIT(traverse_module_state->__pyx_n_s_tn); + Py_VISIT(traverse_module_state->__pyx_n_s_tot_mass); + Py_VISIT(traverse_module_state->__pyx_n_s_transform); + Py_VISIT(traverse_module_state->__pyx_n_s_trehalose); + Py_VISIT(traverse_module_state->__pyx_n_s_ts); + Py_VISIT(traverse_module_state->__pyx_n_s_tyH); + Py_VISIT(traverse_module_state->__pyx_n_s_tzH); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_VISIT(traverse_module_state->__pyx_n_s_unpack); + Py_VISIT(traverse_module_state->__pyx_n_s_update); + Py_VISIT(traverse_module_state->__pyx_n_s_vel); + Py_VISIT(traverse_module_state->__pyx_n_s_velcom); + Py_VISIT(traverse_module_state->__pyx_n_s_velcomByResidue); + Py_VISIT(traverse_module_state->__pyx_n_s_vels); + Py_VISIT(traverse_module_state->__pyx_n_s_version_info); + Py_VISIT(traverse_module_state->__pyx_n_s_vol); + Py_VISIT(traverse_module_state->__pyx_n_s_w); + Py_VISIT(traverse_module_state->__pyx_n_s_waterRotationMatrix); + Py_VISIT(traverse_module_state->__pyx_n_s_wt); + Py_VISIT(traverse_module_state->__pyx_n_s_wt1); + Py_VISIT(traverse_module_state->__pyx_n_s_wts); + Py_VISIT(traverse_module_state->__pyx_n_s_x); + Py_VISIT(traverse_module_state->__pyx_n_s_xyz); + Py_VISIT(traverse_module_state->__pyx_n_s_y); + Py_VISIT(traverse_module_state->__pyx_n_s_y_mat); + Py_VISIT(traverse_module_state->__pyx_n_s_z); + Py_VISIT(traverse_module_state->__pyx_n_s_zeros); + Py_VISIT(traverse_module_state->__pyx_float_0_2400); + Py_VISIT(traverse_module_state->__pyx_float_1_8086); + Py_VISIT(traverse_module_state->__pyx_float_1390_02); + Py_VISIT(traverse_module_state->__pyx_float_neg_2_0487); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_2); + Py_VISIT(traverse_module_state->__pyx_int_3); + Py_VISIT(traverse_module_state->__pyx_int_6); + Py_VISIT(traverse_module_state->__pyx_int_8); + Py_VISIT(traverse_module_state->__pyx_int_15); + Py_VISIT(traverse_module_state->__pyx_int_112105877); + Py_VISIT(traverse_module_state->__pyx_int_136983863); + Py_VISIT(traverse_module_state->__pyx_int_184977713); + Py_VISIT(traverse_module_state->__pyx_int_neg_1); + Py_VISIT(traverse_module_state->__pyx_slice__5); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_tuple__9); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__14); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__16); + Py_VISIT(traverse_module_state->__pyx_tuple__17); + Py_VISIT(traverse_module_state->__pyx_tuple__18); + Py_VISIT(traverse_module_state->__pyx_tuple__19); + Py_VISIT(traverse_module_state->__pyx_tuple__20); + Py_VISIT(traverse_module_state->__pyx_tuple__21); + Py_VISIT(traverse_module_state->__pyx_tuple__22); + Py_VISIT(traverse_module_state->__pyx_tuple__23); + Py_VISIT(traverse_module_state->__pyx_tuple__24); + Py_VISIT(traverse_module_state->__pyx_tuple__26); + Py_VISIT(traverse_module_state->__pyx_tuple__28); + Py_VISIT(traverse_module_state->__pyx_tuple__30); + Py_VISIT(traverse_module_state->__pyx_tuple__32); + Py_VISIT(traverse_module_state->__pyx_tuple__34); + Py_VISIT(traverse_module_state->__pyx_tuple__36); + Py_VISIT(traverse_module_state->__pyx_tuple__38); + Py_VISIT(traverse_module_state->__pyx_tuple__40); + Py_VISIT(traverse_module_state->__pyx_tuple__42); + Py_VISIT(traverse_module_state->__pyx_tuple__44); + Py_VISIT(traverse_module_state->__pyx_tuple__46); + Py_VISIT(traverse_module_state->__pyx_tuple__48); + Py_VISIT(traverse_module_state->__pyx_tuple__50); + Py_VISIT(traverse_module_state->__pyx_tuple__52); + Py_VISIT(traverse_module_state->__pyx_tuple__54); + Py_VISIT(traverse_module_state->__pyx_tuple__56); + Py_VISIT(traverse_module_state->__pyx_tuple__58); + Py_VISIT(traverse_module_state->__pyx_tuple__60); + Py_VISIT(traverse_module_state->__pyx_tuple__62); + Py_VISIT(traverse_module_state->__pyx_tuple__64); + Py_VISIT(traverse_module_state->__pyx_tuple__66); + Py_VISIT(traverse_module_state->__pyx_tuple__67); + Py_VISIT(traverse_module_state->__pyx_tuple__69); + Py_VISIT(traverse_module_state->__pyx_tuple__71); + Py_VISIT(traverse_module_state->__pyx_tuple__73); + Py_VISIT(traverse_module_state->__pyx_tuple__75); + Py_VISIT(traverse_module_state->__pyx_tuple__77); + Py_VISIT(traverse_module_state->__pyx_tuple__79); + Py_VISIT(traverse_module_state->__pyx_tuple__81); + Py_VISIT(traverse_module_state->__pyx_tuple__83); + Py_VISIT(traverse_module_state->__pyx_tuple__85); + Py_VISIT(traverse_module_state->__pyx_tuple__87); + Py_VISIT(traverse_module_state->__pyx_tuple__89); + Py_VISIT(traverse_module_state->__pyx_tuple__91); + Py_VISIT(traverse_module_state->__pyx_tuple__93); + Py_VISIT(traverse_module_state->__pyx_tuple__95); + Py_VISIT(traverse_module_state->__pyx_tuple__97); + Py_VISIT(traverse_module_state->__pyx_tuple__99); + Py_VISIT(traverse_module_state->__pyx_tuple__101); + Py_VISIT(traverse_module_state->__pyx_tuple__103); + Py_VISIT(traverse_module_state->__pyx_tuple__105); + Py_VISIT(traverse_module_state->__pyx_tuple__107); + Py_VISIT(traverse_module_state->__pyx_codeobj__25); + Py_VISIT(traverse_module_state->__pyx_codeobj__27); + Py_VISIT(traverse_module_state->__pyx_codeobj__29); + Py_VISIT(traverse_module_state->__pyx_codeobj__31); + Py_VISIT(traverse_module_state->__pyx_codeobj__33); + Py_VISIT(traverse_module_state->__pyx_codeobj__35); + Py_VISIT(traverse_module_state->__pyx_codeobj__37); + Py_VISIT(traverse_module_state->__pyx_codeobj__39); + Py_VISIT(traverse_module_state->__pyx_codeobj__41); + Py_VISIT(traverse_module_state->__pyx_codeobj__43); + Py_VISIT(traverse_module_state->__pyx_codeobj__45); + Py_VISIT(traverse_module_state->__pyx_codeobj__47); + Py_VISIT(traverse_module_state->__pyx_codeobj__49); + Py_VISIT(traverse_module_state->__pyx_codeobj__51); + Py_VISIT(traverse_module_state->__pyx_codeobj__53); + Py_VISIT(traverse_module_state->__pyx_codeobj__55); + Py_VISIT(traverse_module_state->__pyx_codeobj__57); + Py_VISIT(traverse_module_state->__pyx_codeobj__59); + Py_VISIT(traverse_module_state->__pyx_codeobj__61); + Py_VISIT(traverse_module_state->__pyx_codeobj__63); + Py_VISIT(traverse_module_state->__pyx_codeobj__65); + Py_VISIT(traverse_module_state->__pyx_codeobj__68); + Py_VISIT(traverse_module_state->__pyx_codeobj__70); + Py_VISIT(traverse_module_state->__pyx_codeobj__72); + Py_VISIT(traverse_module_state->__pyx_codeobj__74); + Py_VISIT(traverse_module_state->__pyx_codeobj__76); + Py_VISIT(traverse_module_state->__pyx_codeobj__78); + Py_VISIT(traverse_module_state->__pyx_codeobj__80); + Py_VISIT(traverse_module_state->__pyx_codeobj__82); + Py_VISIT(traverse_module_state->__pyx_codeobj__84); + Py_VISIT(traverse_module_state->__pyx_codeobj__86); + Py_VISIT(traverse_module_state->__pyx_codeobj__88); + Py_VISIT(traverse_module_state->__pyx_codeobj__90); + Py_VISIT(traverse_module_state->__pyx_codeobj__92); + Py_VISIT(traverse_module_state->__pyx_codeobj__94); + Py_VISIT(traverse_module_state->__pyx_codeobj__96); + Py_VISIT(traverse_module_state->__pyx_codeobj__98); + Py_VISIT(traverse_module_state->__pyx_codeobj__100); + Py_VISIT(traverse_module_state->__pyx_codeobj__102); + Py_VISIT(traverse_module_state->__pyx_codeobj__104); + Py_VISIT(traverse_module_state->__pyx_codeobj__106); + Py_VISIT(traverse_module_state->__pyx_codeobj__108); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_5numpy_dtype __pyx_mstate_global->__pyx_ptype_5numpy_dtype +#define __pyx_ptype_5numpy_flatiter __pyx_mstate_global->__pyx_ptype_5numpy_flatiter +#define __pyx_ptype_5numpy_broadcast __pyx_mstate_global->__pyx_ptype_5numpy_broadcast +#define __pyx_ptype_5numpy_ndarray __pyx_mstate_global->__pyx_ptype_5numpy_ndarray +#define __pyx_ptype_5numpy_generic __pyx_mstate_global->__pyx_ptype_5numpy_generic +#define __pyx_ptype_5numpy_number __pyx_mstate_global->__pyx_ptype_5numpy_number +#define __pyx_ptype_5numpy_integer __pyx_mstate_global->__pyx_ptype_5numpy_integer +#define __pyx_ptype_5numpy_signedinteger __pyx_mstate_global->__pyx_ptype_5numpy_signedinteger +#define __pyx_ptype_5numpy_unsignedinteger __pyx_mstate_global->__pyx_ptype_5numpy_unsignedinteger +#define __pyx_ptype_5numpy_inexact __pyx_mstate_global->__pyx_ptype_5numpy_inexact +#define __pyx_ptype_5numpy_floating __pyx_mstate_global->__pyx_ptype_5numpy_floating +#define __pyx_ptype_5numpy_complexfloating __pyx_mstate_global->__pyx_ptype_5numpy_complexfloating +#define __pyx_ptype_5numpy_flexible __pyx_mstate_global->__pyx_ptype_5numpy_flexible +#define __pyx_ptype_5numpy_character __pyx_mstate_global->__pyx_ptype_5numpy_character +#define __pyx_ptype_5numpy_ufunc __pyx_mstate_global->__pyx_ptype_5numpy_ufunc +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type___pyx_array __pyx_mstate_global->__pyx_type___pyx_array +#define __pyx_type___pyx_MemviewEnum __pyx_mstate_global->__pyx_type___pyx_MemviewEnum +#define __pyx_type___pyx_memoryview __pyx_mstate_global->__pyx_type___pyx_memoryview +#define __pyx_type___pyx_memoryviewslice __pyx_mstate_global->__pyx_type___pyx_memoryviewslice +#endif +#define __pyx_array_type __pyx_mstate_global->__pyx_array_type +#define __pyx_MemviewEnum_type __pyx_mstate_global->__pyx_MemviewEnum_type +#define __pyx_memoryview_type __pyx_mstate_global->__pyx_memoryview_type +#define __pyx_memoryviewslice_type __pyx_mstate_global->__pyx_memoryviewslice_type +#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_n_s_A __pyx_mstate_global->__pyx_n_s_A +#define __pyx_n_s_ASCII __pyx_mstate_global->__pyx_n_s_ASCII +#define __pyx_kp_s_All_dimensions_preceding_dimensi __pyx_mstate_global->__pyx_kp_s_All_dimensions_preceding_dimensi +#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError +#define __pyx_n_s_B __pyx_mstate_global->__pyx_n_s_B +#define __pyx_n_s_B1 __pyx_mstate_global->__pyx_n_s_B1 +#define __pyx_n_s_B2 __pyx_mstate_global->__pyx_n_s_B2 +#define __pyx_n_s_B3 __pyx_mstate_global->__pyx_n_s_B3 +#define __pyx_n_s_B_out __pyx_mstate_global->__pyx_n_s_B_out +#define __pyx_kp_s_Buffer_view_does_not_expose_stri __pyx_mstate_global->__pyx_kp_s_Buffer_view_does_not_expose_stri +#define __pyx_kp_s_Can_only_create_a_buffer_that_is __pyx_mstate_global->__pyx_kp_s_Can_only_create_a_buffer_that_is +#define __pyx_kp_s_Cannot_assign_to_read_only_memor __pyx_mstate_global->__pyx_kp_s_Cannot_assign_to_read_only_memor +#define __pyx_kp_s_Cannot_create_writable_memory_vi __pyx_mstate_global->__pyx_kp_s_Cannot_create_writable_memory_vi +#define __pyx_kp_u_Cannot_index_with_type __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type +#define __pyx_kp_s_Cannot_transpose_memoryview_with __pyx_mstate_global->__pyx_kp_s_Cannot_transpose_memoryview_with +#define __pyx_kp_s_Dimension_d_is_not_direct __pyx_mstate_global->__pyx_kp_s_Dimension_d_is_not_direct +#define __pyx_n_s_E __pyx_mstate_global->__pyx_n_s_E +#define __pyx_n_s_Ellipsis __pyx_mstate_global->__pyx_n_s_Ellipsis +#define __pyx_kp_s_Empty_shape_tuple_for_cython_arr __pyx_mstate_global->__pyx_kp_s_Empty_shape_tuple_for_cython_arr +#define __pyx_n_s_Exx __pyx_mstate_global->__pyx_n_s_Exx +#define __pyx_n_s_Eyy __pyx_mstate_global->__pyx_n_s_Eyy +#define __pyx_n_s_Ezz __pyx_mstate_global->__pyx_n_s_Ezz +#define __pyx_n_s_H1x __pyx_mstate_global->__pyx_n_s_H1x +#define __pyx_n_s_H1y __pyx_mstate_global->__pyx_n_s_H1y +#define __pyx_n_s_H1z __pyx_mstate_global->__pyx_n_s_H1z +#define __pyx_n_s_H2x __pyx_mstate_global->__pyx_n_s_H2x +#define __pyx_n_s_H2y __pyx_mstate_global->__pyx_n_s_H2y +#define __pyx_n_s_H2z __pyx_mstate_global->__pyx_n_s_H2z +#define __pyx_n_s_H_indices __pyx_mstate_global->__pyx_n_s_H_indices +#define __pyx_n_s_H_shell __pyx_mstate_global->__pyx_n_s_H_shell +#define __pyx_n_s_I __pyx_mstate_global->__pyx_n_s_I +#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError +#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 +#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError +#define __pyx_kp_s_Index_out_of_bounds_axis_d __pyx_mstate_global->__pyx_kp_s_Index_out_of_bounds_axis_d +#define __pyx_kp_s_Indirect_dimensions_not_supporte __pyx_mstate_global->__pyx_kp_s_Indirect_dimensions_not_supporte +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis +#define __pyx_n_s_L __pyx_mstate_global->__pyx_n_s_L +#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError +#define __pyx_kp_s_MemoryView_of_r_at_0x_x __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_at_0x_x +#define __pyx_kp_s_MemoryView_of_r_object __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_object +#define __pyx_n_s_N __pyx_mstate_global->__pyx_n_s_N +#define __pyx_n_s_NQRdipTen __pyx_mstate_global->__pyx_n_s_NQRdipTen +#define __pyx_n_s_NQRself __pyx_mstate_global->__pyx_n_s_NQRself +#define __pyx_n_s_NQRselfAndB __pyx_mstate_global->__pyx_n_s_NQRselfAndB +#define __pyx_n_b_O __pyx_mstate_global->__pyx_n_b_O +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a +#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError +#define __pyx_n_s_R __pyx_mstate_global->__pyx_n_s_R +#define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence +#define __pyx_n_s_SphereinCube __pyx_mstate_global->__pyx_n_s_SphereinCube +#define __pyx_kp_s_Step_may_not_be_zero_axis_d __pyx_mstate_global->__pyx_kp_s_Step_may_not_be_zero_axis_d +#define __pyx_n_s_T __pyx_mstate_global->__pyx_n_s_T +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_kp_s_Unable_to_convert_item_to_object __pyx_mstate_global->__pyx_kp_s_Unable_to_convert_item_to_object +#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError +#define __pyx_n_s_View_MemoryView __pyx_mstate_global->__pyx_n_s_View_MemoryView +#define __pyx_n_s__109 __pyx_mstate_global->__pyx_n_s__109 +#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 +#define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3 +#define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6 +#define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7 +#define __pyx_n_s_a1 __pyx_mstate_global->__pyx_n_s_a1 +#define __pyx_n_s_a2 __pyx_mstate_global->__pyx_n_s_a2 +#define __pyx_n_s_abc __pyx_mstate_global->__pyx_n_s_abc +#define __pyx_n_s_actr __pyx_mstate_global->__pyx_n_s_actr +#define __pyx_n_s_allocate_buffer __pyx_mstate_global->__pyx_n_s_allocate_buffer +#define __pyx_n_s_an_first __pyx_mstate_global->__pyx_n_s_an_first +#define __pyx_n_s_an_last __pyx_mstate_global->__pyx_n_s_an_last +#define __pyx_kp_u_and __pyx_mstate_global->__pyx_kp_u_and +#define __pyx_n_s_applyRotationMatrix __pyx_mstate_global->__pyx_n_s_applyRotationMatrix +#define __pyx_n_s_apr __pyx_mstate_global->__pyx_n_s_apr +#define __pyx_n_s_arccos __pyx_mstate_global->__pyx_n_s_arccos +#define __pyx_n_s_arctan2 __pyx_mstate_global->__pyx_n_s_arctan2 +#define __pyx_n_s_asarray __pyx_mstate_global->__pyx_n_s_asarray +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_atomicCurrent __pyx_mstate_global->__pyx_n_s_atomicCurrent +#define __pyx_n_s_atoms_per_residue __pyx_mstate_global->__pyx_n_s_atoms_per_residue +#define __pyx_n_s_auf __pyx_mstate_global->__pyx_n_s_auf +#define __pyx_n_s_auf3 __pyx_mstate_global->__pyx_n_s_auf3 +#define __pyx_n_s_auf6 __pyx_mstate_global->__pyx_n_s_auf6 +#define __pyx_n_s_auf_x1 __pyx_mstate_global->__pyx_n_s_auf_x1 +#define __pyx_n_s_auf_x2 __pyx_mstate_global->__pyx_n_s_auf_x2 +#define __pyx_n_s_auf_y1 __pyx_mstate_global->__pyx_n_s_auf_y1 +#define __pyx_n_s_auf_y2 __pyx_mstate_global->__pyx_n_s_auf_y2 +#define __pyx_n_s_auf_z1 __pyx_mstate_global->__pyx_n_s_auf_z1 +#define __pyx_n_s_auf_z2 __pyx_mstate_global->__pyx_n_s_auf_z2 +#define __pyx_n_s_aufpunkt __pyx_mstate_global->__pyx_n_s_aufpunkt +#define __pyx_n_s_azi __pyx_mstate_global->__pyx_n_s_azi +#define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base +#define __pyx_n_s_boxl __pyx_mstate_global->__pyx_n_s_boxl +#define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c +#define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c +#define __pyx_n_s_c1 __pyx_mstate_global->__pyx_n_s_c1 +#define __pyx_n_s_c2 __pyx_mstate_global->__pyx_n_s_c2 +#define __pyx_n_s_cI __pyx_mstate_global->__pyx_n_s_cI +#define __pyx_n_s_cL __pyx_mstate_global->__pyx_n_s_cL +#define __pyx_n_s_c_rv __pyx_mstate_global->__pyx_n_s_c_rv +#define __pyx_n_s_calcAngularDisplacement __pyx_mstate_global->__pyx_n_s_calcAngularDisplacement +#define __pyx_n_s_calcAngularMomentum __pyx_mstate_global->__pyx_n_s_calcAngularMomentum +#define __pyx_n_s_calcDipDipEnergyAtomic __pyx_mstate_global->__pyx_n_s_calcDipDipEnergyAtomic +#define __pyx_n_s_calcEnergyAA __pyx_mstate_global->__pyx_n_s_calcEnergyAA +#define __pyx_n_s_calcEnergyAASep __pyx_mstate_global->__pyx_n_s_calcEnergyAASep +#define __pyx_n_s_calcEnergyAAhisto __pyx_mstate_global->__pyx_n_s_calcEnergyAAhisto +#define __pyx_n_s_calcEnergyAAhisto1 __pyx_mstate_global->__pyx_n_s_calcEnergyAAhisto1 +#define __pyx_n_s_calcEnergyAApermind __pyx_mstate_global->__pyx_n_s_calcEnergyAApermind +#define __pyx_n_s_calcEnergyAApermindhisto __pyx_mstate_global->__pyx_n_s_calcEnergyAApermindhisto +#define __pyx_n_s_calcEnergyAtomic __pyx_mstate_global->__pyx_n_s_calcEnergyAtomic +#define __pyx_n_s_calcEnergyAtomicVoro __pyx_mstate_global->__pyx_n_s_calcEnergyAtomicVoro +#define __pyx_n_s_calcEnergyDouble __pyx_mstate_global->__pyx_n_s_calcEnergyDouble +#define __pyx_n_s_calcEnergyMuA __pyx_mstate_global->__pyx_n_s_calcEnergyMuA +#define __pyx_n_s_calcFourierLaplaceTransform __pyx_mstate_global->__pyx_n_s_calcFourierLaplaceTransform +#define __pyx_n_s_calcInertiaTensor __pyx_mstate_global->__pyx_n_s_calcInertiaTensor +#define __pyx_n_s_calcOctant __pyx_mstate_global->__pyx_n_s_calcOctant +#define __pyx_n_s_calcResidenceTimeseries __pyx_mstate_global->__pyx_n_s_calcResidenceTimeseries +#define __pyx_n_s_calcRotationMatrix __pyx_mstate_global->__pyx_n_s_calcRotationMatrix +#define __pyx_n_s_cat_first __pyx_mstate_global->__pyx_n_s_cat_first +#define __pyx_n_s_cat_last __pyx_mstate_global->__pyx_n_s_cat_last +#define __pyx_n_s_ccom __pyx_mstate_global->__pyx_n_s_ccom +#define __pyx_n_s_cds __pyx_mstate_global->__pyx_n_s_cds +#define __pyx_n_s_center __pyx_mstate_global->__pyx_n_s_center +#define __pyx_n_s_centerOrientBox __pyx_mstate_global->__pyx_n_s_centerOrientBox +#define __pyx_n_s_centerToPointOrientBox __pyx_mstate_global->__pyx_n_s_centerToPointOrientBox +#define __pyx_n_s_centers __pyx_mstate_global->__pyx_n_s_centers +#define __pyx_n_s_charges __pyx_mstate_global->__pyx_n_s_charges +#define __pyx_n_s_charges1 __pyx_mstate_global->__pyx_n_s_charges1 +#define __pyx_n_s_checkHBond __pyx_mstate_global->__pyx_n_s_checkHBond +#define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class +#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_cn __pyx_mstate_global->__pyx_n_s_cn +#define __pyx_n_s_coct __pyx_mstate_global->__pyx_n_s_coct +#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections +#define __pyx_kp_s_collections_abc __pyx_mstate_global->__pyx_kp_s_collections_abc +#define __pyx_n_s_collectiveDipoleMomentWaterShell __pyx_mstate_global->__pyx_n_s_collectiveDipoleMomentWaterShell +#define __pyx_n_s_com __pyx_mstate_global->__pyx_n_s_com +#define __pyx_n_s_comByResidue __pyx_mstate_global->__pyx_n_s_comByResidue +#define __pyx_n_s_coms __pyx_mstate_global->__pyx_n_s_coms +#define __pyx_n_s_comslt __pyx_mstate_global->__pyx_n_s_comslt +#define __pyx_n_s_conjugate __pyx_mstate_global->__pyx_n_s_conjugate +#define __pyx_kp_s_contiguous_and_direct __pyx_mstate_global->__pyx_kp_s_contiguous_and_direct +#define __pyx_kp_s_contiguous_and_indirect __pyx_mstate_global->__pyx_kp_s_contiguous_and_indirect +#define __pyx_n_s_coo_H __pyx_mstate_global->__pyx_n_s_coo_H +#define __pyx_n_s_coo_center __pyx_mstate_global->__pyx_n_s_coo_center +#define __pyx_n_s_coor __pyx_mstate_global->__pyx_n_s_coor +#define __pyx_n_s_coorA __pyx_mstate_global->__pyx_n_s_coorA +#define __pyx_n_s_coorB __pyx_mstate_global->__pyx_n_s_coorB +#define __pyx_n_s_coor_core __pyx_mstate_global->__pyx_n_s_coor_core +#define __pyx_n_s_coor_oh2 __pyx_mstate_global->__pyx_n_s_coor_oh2 +#define __pyx_n_s_coor_surr __pyx_mstate_global->__pyx_n_s_coor_surr +#define __pyx_n_s_corrsubmean __pyx_mstate_global->__pyx_n_s_corrsubmean +#define __pyx_n_s_cosine __pyx_mstate_global->__pyx_n_s_cosine +#define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count +#define __pyx_n_s_ctr __pyx_mstate_global->__pyx_n_s_ctr +#define __pyx_n_s_cxyz __pyx_mstate_global->__pyx_n_s_cxyz +#define __pyx_n_s_data_x __pyx_mstate_global->__pyx_n_s_data_x +#define __pyx_n_s_data_y __pyx_mstate_global->__pyx_n_s_data_y +#define __pyx_n_s_deltaA __pyx_mstate_global->__pyx_n_s_deltaA +#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_n_s_dip __pyx_mstate_global->__pyx_n_s_dip +#define __pyx_n_s_dipByResidue __pyx_mstate_global->__pyx_n_s_dipByResidue +#define __pyx_n_s_dipT0 __pyx_mstate_global->__pyx_n_s_dipT0 +#define __pyx_n_s_dipTen __pyx_mstate_global->__pyx_n_s_dipTen +#define __pyx_n_s_dipTenCorrel __pyx_mstate_global->__pyx_n_s_dipTenCorrel +#define __pyx_n_s_dipTenInit __pyx_mstate_global->__pyx_n_s_dipTenInit +#define __pyx_n_s_dipTt0 __pyx_mstate_global->__pyx_n_s_dipTt0 +#define __pyx_n_s_dipTt1 __pyx_mstate_global->__pyx_n_s_dipTt1 +#define __pyx_n_s_dipTt2 __pyx_mstate_global->__pyx_n_s_dipTt2 +#define __pyx_n_s_dipTt3 __pyx_mstate_global->__pyx_n_s_dipTt3 +#define __pyx_n_s_dipTt4 __pyx_mstate_global->__pyx_n_s_dipTt4 +#define __pyx_n_s_dipTt5 __pyx_mstate_global->__pyx_n_s_dipTt5 +#define __pyx_n_s_dip_wat __pyx_mstate_global->__pyx_n_s_dip_wat +#define __pyx_n_s_dipol __pyx_mstate_global->__pyx_n_s_dipol +#define __pyx_n_s_dipoleMomentNeutralSelection __pyx_mstate_global->__pyx_n_s_dipoleMomentNeutralSelection +#define __pyx_n_s_dipt __pyx_mstate_global->__pyx_n_s_dipt +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_dist __pyx_mstate_global->__pyx_n_s_dist +#define __pyx_n_s_dist2 __pyx_mstate_global->__pyx_n_s_dist2 +#define __pyx_n_s_dot __pyx_mstate_global->__pyx_n_s_dot +#define __pyx_n_s_dot2 __pyx_mstate_global->__pyx_n_s_dot2 +#define __pyx_n_s_drude __pyx_mstate_global->__pyx_n_s_drude +#define __pyx_n_s_ds __pyx_mstate_global->__pyx_n_s_ds +#define __pyx_n_s_dt __pyx_mstate_global->__pyx_n_s_dt +#define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype +#define __pyx_n_s_dtype_is_object __pyx_mstate_global->__pyx_n_s_dtype_is_object +#define __pyx_n_s_dx __pyx_mstate_global->__pyx_n_s_dx +#define __pyx_n_s_dx2 __pyx_mstate_global->__pyx_n_s_dx2 +#define __pyx_n_s_dy __pyx_mstate_global->__pyx_n_s_dy +#define __pyx_n_s_dy2 __pyx_mstate_global->__pyx_n_s_dy2 +#define __pyx_n_s_dz __pyx_mstate_global->__pyx_n_s_dz +#define __pyx_n_s_dz2 __pyx_mstate_global->__pyx_n_s_dz2 +#define __pyx_n_s_edip __pyx_mstate_global->__pyx_n_s_edip +#define __pyx_n_s_empty __pyx_mstate_global->__pyx_n_s_empty +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_end __pyx_mstate_global->__pyx_n_s_end +#define __pyx_n_s_energy __pyx_mstate_global->__pyx_n_s_energy +#define __pyx_n_s_energy_ind __pyx_mstate_global->__pyx_n_s_energy_ind +#define __pyx_n_s_energy_octant __pyx_mstate_global->__pyx_n_s_energy_octant +#define __pyx_n_s_energy_octant_per_atom __pyx_mstate_global->__pyx_n_s_energy_octant_per_atom +#define __pyx_n_s_energy_per_atom __pyx_mstate_global->__pyx_n_s_energy_per_atom +#define __pyx_n_s_energy_perm __pyx_mstate_global->__pyx_n_s_energy_perm +#define __pyx_n_s_energy_xyz __pyx_mstate_global->__pyx_n_s_energy_xyz +#define __pyx_n_s_energy_xyz_per_atom __pyx_mstate_global->__pyx_n_s_energy_xyz_per_atom +#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate +#define __pyx_n_s_epa __pyx_mstate_global->__pyx_n_s_epa +#define __pyx_n_s_epa1 __pyx_mstate_global->__pyx_n_s_epa1 +#define __pyx_n_s_epa_ind __pyx_mstate_global->__pyx_n_s_epa_ind +#define __pyx_n_s_epa_oct __pyx_mstate_global->__pyx_n_s_epa_oct +#define __pyx_n_s_epa_perm __pyx_mstate_global->__pyx_n_s_epa_perm +#define __pyx_n_s_epa_xyz __pyx_mstate_global->__pyx_n_s_epa_xyz +#define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error +#define __pyx_n_s_exclude_begin __pyx_mstate_global->__pyx_n_s_exclude_begin +#define __pyx_n_s_exclude_end __pyx_mstate_global->__pyx_n_s_exclude_end +#define __pyx_n_s_f1 __pyx_mstate_global->__pyx_n_s_f1 +#define __pyx_n_s_f2 __pyx_mstate_global->__pyx_n_s_f2 +#define __pyx_n_s_f2_0 __pyx_mstate_global->__pyx_n_s_f2_0 +#define __pyx_n_s_f2_1 __pyx_mstate_global->__pyx_n_s_f2_1 +#define __pyx_n_s_f2_2 __pyx_mstate_global->__pyx_n_s_f2_2 +#define __pyx_n_s_f2_x __pyx_mstate_global->__pyx_n_s_f2_x +#define __pyx_n_s_f2_y __pyx_mstate_global->__pyx_n_s_f2_y +#define __pyx_n_s_f2_z __pyx_mstate_global->__pyx_n_s_f2_z +#define __pyx_n_s_findDS __pyx_mstate_global->__pyx_n_s_findDS +#define __pyx_n_s_findNearestAtom __pyx_mstate_global->__pyx_n_s_findNearestAtom +#define __pyx_n_s_first __pyx_mstate_global->__pyx_n_s_first +#define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags +#define __pyx_n_s_float64 __pyx_mstate_global->__pyx_n_s_float64 +#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format +#define __pyx_n_s_fortran __pyx_mstate_global->__pyx_n_s_fortran +#define __pyx_n_u_fortran __pyx_mstate_global->__pyx_n_u_fortran +#define __pyx_n_s_frame __pyx_mstate_global->__pyx_n_s_frame +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_n_s_gfunc __pyx_mstate_global->__pyx_n_s_gfunc +#define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi +#define __pyx_n_s_hbond __pyx_mstate_global->__pyx_n_s_hbond +#define __pyx_n_s_histo __pyx_mstate_global->__pyx_n_s_histo +#define __pyx_n_s_histo_bins __pyx_mstate_global->__pyx_n_s_histo_bins +#define __pyx_n_s_histo_error __pyx_mstate_global->__pyx_n_s_histo_error +#define __pyx_n_s_histo_ind __pyx_mstate_global->__pyx_n_s_histo_ind +#define __pyx_n_s_histo_max __pyx_mstate_global->__pyx_n_s_histo_max +#define __pyx_n_s_histo_min __pyx_mstate_global->__pyx_n_s_histo_min +#define __pyx_n_s_histo_perm __pyx_mstate_global->__pyx_n_s_histo_perm +#define __pyx_n_s_histo_width __pyx_mstate_global->__pyx_n_s_histo_width +#define __pyx_n_s_hs __pyx_mstate_global->__pyx_n_s_hs +#define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i +#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id +#define __pyx_n_s_idx __pyx_mstate_global->__pyx_n_s_idx +#define __pyx_n_s_idx2 __pyx_mstate_global->__pyx_n_s_idx2 +#define __pyx_n_s_idx3 __pyx_mstate_global->__pyx_n_s_idx3 +#define __pyx_n_s_idx4 __pyx_mstate_global->__pyx_n_s_idx4 +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_ind __pyx_mstate_global->__pyx_n_s_ind +#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_int32 __pyx_mstate_global->__pyx_n_s_int32 +#define __pyx_n_s_int8 __pyx_mstate_global->__pyx_n_s_int8 +#define __pyx_n_s_integral __pyx_mstate_global->__pyx_n_s_integral +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_islt __pyx_mstate_global->__pyx_n_s_islt +#define __pyx_n_s_isolute __pyx_mstate_global->__pyx_n_s_isolute +#define __pyx_n_s_itemsize __pyx_mstate_global->__pyx_n_s_itemsize +#define __pyx_kp_s_itemsize_0_for_cython_array __pyx_mstate_global->__pyx_kp_s_itemsize_0_for_cython_array +#define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j +#define __pyx_n_s_k __pyx_mstate_global->__pyx_n_s_k +#define __pyx_n_s_l __pyx_mstate_global->__pyx_n_s_l +#define __pyx_n_s_l1 __pyx_mstate_global->__pyx_n_s_l1 +#define __pyx_n_s_l2 __pyx_mstate_global->__pyx_n_s_l2 +#define __pyx_n_s_laplace_im __pyx_mstate_global->__pyx_n_s_laplace_im +#define __pyx_n_s_laplace_re __pyx_mstate_global->__pyx_n_s_laplace_re +#define __pyx_n_s_last __pyx_mstate_global->__pyx_n_s_last +#define __pyx_n_s_len_H __pyx_mstate_global->__pyx_n_s_len_H +#define __pyx_n_s_len_center __pyx_mstate_global->__pyx_n_s_len_center +#define __pyx_n_s_lmax __pyx_mstate_global->__pyx_n_s_lmax +#define __pyx_n_s_m1 __pyx_mstate_global->__pyx_n_s_m1 +#define __pyx_n_s_m1r __pyx_mstate_global->__pyx_n_s_m1r +#define __pyx_n_s_m2 __pyx_mstate_global->__pyx_n_s_m2 +#define __pyx_n_s_m2r __pyx_mstate_global->__pyx_n_s_m2r +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_masses __pyx_mstate_global->__pyx_n_s_masses +#define __pyx_n_s_maxdist __pyx_mstate_global->__pyx_n_s_maxdist +#define __pyx_n_s_maxshell __pyx_mstate_global->__pyx_n_s_maxshell +#define __pyx_n_s_mdcage_ts __pyx_mstate_global->__pyx_n_s_mdcage_ts +#define __pyx_n_s_memview __pyx_mstate_global->__pyx_n_s_memview +#define __pyx_n_s_mindist __pyx_mstate_global->__pyx_n_s_mindist +#define __pyx_n_s_mindist2 __pyx_mstate_global->__pyx_n_s_mindist2 +#define __pyx_n_s_minvec __pyx_mstate_global->__pyx_n_s_minvec +#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode +#define __pyx_n_s_msd __pyx_mstate_global->__pyx_n_s_msd +#define __pyx_n_s_mu_solute __pyx_mstate_global->__pyx_n_s_mu_solute +#define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n +#define __pyx_n_s_n1 __pyx_mstate_global->__pyx_n_s_n1 +#define __pyx_n_s_n2 __pyx_mstate_global->__pyx_n_s_n2 +#define __pyx_n_s_n3 __pyx_mstate_global->__pyx_n_s_n3 +#define __pyx_n_s_n_core __pyx_mstate_global->__pyx_n_s_n_core +#define __pyx_n_s_n_surr __pyx_mstate_global->__pyx_n_s_n_surr +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 +#define __pyx_n_s_nat __pyx_mstate_global->__pyx_n_s_nat +#define __pyx_n_s_natoms __pyx_mstate_global->__pyx_n_s_natoms +#define __pyx_n_s_ndim __pyx_mstate_global->__pyx_n_s_ndim +#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new +#define __pyx_n_s_newanalysis_helpers __pyx_mstate_global->__pyx_n_s_newanalysis_helpers +#define __pyx_kp_s_newanalysis_helpers_helpers_pyx __pyx_mstate_global->__pyx_kp_s_newanalysis_helpers_helpers_pyx +#define __pyx_n_s_next_id __pyx_mstate_global->__pyx_n_s_next_id +#define __pyx_n_s_nmol __pyx_mstate_global->__pyx_n_s_nmol +#define __pyx_n_s_nmolecules __pyx_mstate_global->__pyx_n_s_nmolecules +#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non +#define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np +#define __pyx_n_s_nres __pyx_mstate_global->__pyx_n_s_nres +#define __pyx_n_s_nres_surr __pyx_mstate_global->__pyx_n_s_nres_surr +#define __pyx_n_s_nres_wat __pyx_mstate_global->__pyx_n_s_nres_wat +#define __pyx_n_s_nshells __pyx_mstate_global->__pyx_n_s_nshells +#define __pyx_n_s_nshells2 __pyx_mstate_global->__pyx_n_s_nshells2 +#define __pyx_n_s_nsurr __pyx_mstate_global->__pyx_n_s_nsurr +#define __pyx_n_s_nt __pyx_mstate_global->__pyx_n_s_nt +#define __pyx_n_s_numpoints __pyx_mstate_global->__pyx_n_s_numpoints +#define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy +#define __pyx_kp_s_numpy_core_multiarray_failed_to __pyx_mstate_global->__pyx_kp_s_numpy_core_multiarray_failed_to +#define __pyx_kp_s_numpy_core_umath_failed_to_impor __pyx_mstate_global->__pyx_kp_s_numpy_core_umath_failed_to_impor +#define __pyx_n_s_nwat __pyx_mstate_global->__pyx_n_s_nwat +#define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj +#define __pyx_n_s_octants __pyx_mstate_global->__pyx_n_s_octants +#define __pyx_n_s_oxyquinol __pyx_mstate_global->__pyx_n_s_oxyquinol +#define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack +#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle +#define __pyx_n_s_pol __pyx_mstate_global->__pyx_n_s_pol +#define __pyx_n_s_pyE __pyx_mstate_global->__pyx_n_s_pyE +#define __pyx_n_s_py_B1 __pyx_mstate_global->__pyx_n_s_py_B1 +#define __pyx_n_s_py_B2 __pyx_mstate_global->__pyx_n_s_py_B2 +#define __pyx_n_s_py_B3 __pyx_mstate_global->__pyx_n_s_py_B3 +#define __pyx_n_s_py_charges __pyx_mstate_global->__pyx_n_s_py_charges +#define __pyx_n_s_py_dipt __pyx_mstate_global->__pyx_n_s_py_dipt +#define __pyx_n_s_py_xyz __pyx_mstate_global->__pyx_n_s_py_xyz +#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError +#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum +#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type +#define __pyx_n_s_pyx_unpickle_Enum __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Enum +#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable +#define __pyx_n_s_q __pyx_mstate_global->__pyx_n_s_q +#define __pyx_n_s_qq __pyx_mstate_global->__pyx_n_s_qq +#define __pyx_n_s_qq_diff __pyx_mstate_global->__pyx_n_s_qq_diff +#define __pyx_n_s_qqr __pyx_mstate_global->__pyx_n_s_qqr +#define __pyx_n_s_r __pyx_mstate_global->__pyx_n_s_r +#define __pyx_n_s_r2 __pyx_mstate_global->__pyx_n_s_r2 +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce +#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython +#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register +#define __pyx_n_s_rep __pyx_mstate_global->__pyx_n_s_rep +#define __pyx_n_s_residue_first_atom __pyx_mstate_global->__pyx_n_s_residue_first_atom +#define __pyx_n_s_result __pyx_mstate_global->__pyx_n_s_result +#define __pyx_n_s_rfa __pyx_mstate_global->__pyx_n_s_rfa +#define __pyx_n_s_roxy __pyx_mstate_global->__pyx_n_s_roxy +#define __pyx_n_s_rtre __pyx_mstate_global->__pyx_n_s_rtre +#define __pyx_n_s_rv __pyx_mstate_global->__pyx_n_s_rv +#define __pyx_n_s_rvec0 __pyx_mstate_global->__pyx_n_s_rvec0 +#define __pyx_n_s_rvec1 __pyx_mstate_global->__pyx_n_s_rvec1 +#define __pyx_n_s_rvec2 __pyx_mstate_global->__pyx_n_s_rvec2 +#define __pyx_n_s_scipy_special __pyx_mstate_global->__pyx_n_s_scipy_special +#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate +#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython +#define __pyx_n_s_shape __pyx_mstate_global->__pyx_n_s_shape +#define __pyx_n_s_shell __pyx_mstate_global->__pyx_n_s_shell +#define __pyx_n_s_shift __pyx_mstate_global->__pyx_n_s_shift +#define __pyx_n_s_sites_per_res __pyx_mstate_global->__pyx_n_s_sites_per_res +#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_sphHarmMatrix __pyx_mstate_global->__pyx_n_s_sphHarmMatrix +#define __pyx_n_s_sph_harm __pyx_mstate_global->__pyx_n_s_sph_harm +#define __pyx_n_s_squared_r_oxy __pyx_mstate_global->__pyx_n_s_squared_r_oxy +#define __pyx_n_s_squared_r_tre __pyx_mstate_global->__pyx_n_s_squared_r_tre +#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start +#define __pyx_n_s_step __pyx_mstate_global->__pyx_n_s_step +#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop +#define __pyx_n_s_store __pyx_mstate_global->__pyx_n_s_store +#define __pyx_kp_s_strided_and_direct __pyx_mstate_global->__pyx_kp_s_strided_and_direct +#define __pyx_kp_s_strided_and_direct_or_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_direct_or_indirect +#define __pyx_kp_s_strided_and_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_indirect +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct +#define __pyx_n_s_sumMDCage __pyx_mstate_global->__pyx_n_s_sumMDCage +#define __pyx_n_s_sumMDCageSingle __pyx_mstate_global->__pyx_n_s_sumMDCageSingle +#define __pyx_n_s_sumr __pyx_mstate_global->__pyx_n_s_sumr +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_t __pyx_mstate_global->__pyx_n_s_t +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_timectr __pyx_mstate_global->__pyx_n_s_timectr +#define __pyx_n_s_tmp __pyx_mstate_global->__pyx_n_s_tmp +#define __pyx_n_s_tmp_ener __pyx_mstate_global->__pyx_n_s_tmp_ener +#define __pyx_n_s_tmp_ind __pyx_mstate_global->__pyx_n_s_tmp_ind +#define __pyx_n_s_tmp_perm __pyx_mstate_global->__pyx_n_s_tmp_perm +#define __pyx_n_s_tmp_x __pyx_mstate_global->__pyx_n_s_tmp_x +#define __pyx_n_s_tmp_y __pyx_mstate_global->__pyx_n_s_tmp_y +#define __pyx_n_s_tmp_z __pyx_mstate_global->__pyx_n_s_tmp_z +#define __pyx_n_s_tmpx __pyx_mstate_global->__pyx_n_s_tmpx +#define __pyx_n_s_tmpy __pyx_mstate_global->__pyx_n_s_tmpy +#define __pyx_n_s_tmpz __pyx_mstate_global->__pyx_n_s_tmpz +#define __pyx_n_s_tn __pyx_mstate_global->__pyx_n_s_tn +#define __pyx_n_s_tot_mass __pyx_mstate_global->__pyx_n_s_tot_mass +#define __pyx_n_s_transform __pyx_mstate_global->__pyx_n_s_transform +#define __pyx_n_s_trehalose __pyx_mstate_global->__pyx_n_s_trehalose +#define __pyx_n_s_ts __pyx_mstate_global->__pyx_n_s_ts +#define __pyx_n_s_tyH __pyx_mstate_global->__pyx_n_s_tyH +#define __pyx_n_s_tzH __pyx_mstate_global->__pyx_n_s_tzH +#define __pyx_kp_s_unable_to_allocate_array_data __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_array_data +#define __pyx_kp_s_unable_to_allocate_shape_and_str __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_shape_and_str +#define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack +#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update +#define __pyx_n_s_vel __pyx_mstate_global->__pyx_n_s_vel +#define __pyx_n_s_velcom __pyx_mstate_global->__pyx_n_s_velcom +#define __pyx_n_s_velcomByResidue __pyx_mstate_global->__pyx_n_s_velcomByResidue +#define __pyx_n_s_vels __pyx_mstate_global->__pyx_n_s_vels +#define __pyx_n_s_version_info __pyx_mstate_global->__pyx_n_s_version_info +#define __pyx_n_s_vol __pyx_mstate_global->__pyx_n_s_vol +#define __pyx_n_s_w __pyx_mstate_global->__pyx_n_s_w +#define __pyx_n_s_waterRotationMatrix __pyx_mstate_global->__pyx_n_s_waterRotationMatrix +#define __pyx_n_s_wt __pyx_mstate_global->__pyx_n_s_wt +#define __pyx_n_s_wt1 __pyx_mstate_global->__pyx_n_s_wt1 +#define __pyx_n_s_wts __pyx_mstate_global->__pyx_n_s_wts +#define __pyx_n_s_x __pyx_mstate_global->__pyx_n_s_x +#define __pyx_n_s_xyz __pyx_mstate_global->__pyx_n_s_xyz +#define __pyx_n_s_y __pyx_mstate_global->__pyx_n_s_y +#define __pyx_n_s_y_mat __pyx_mstate_global->__pyx_n_s_y_mat +#define __pyx_n_s_z __pyx_mstate_global->__pyx_n_s_z +#define __pyx_n_s_zeros __pyx_mstate_global->__pyx_n_s_zeros +#define __pyx_float_0_2400 __pyx_mstate_global->__pyx_float_0_2400 +#define __pyx_float_1_8086 __pyx_mstate_global->__pyx_float_1_8086 +#define __pyx_float_1390_02 __pyx_mstate_global->__pyx_float_1390_02 +#define __pyx_float_neg_2_0487 __pyx_mstate_global->__pyx_float_neg_2_0487 +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_2 __pyx_mstate_global->__pyx_int_2 +#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3 +#define __pyx_int_6 __pyx_mstate_global->__pyx_int_6 +#define __pyx_int_8 __pyx_mstate_global->__pyx_int_8 +#define __pyx_int_15 __pyx_mstate_global->__pyx_int_15 +#define __pyx_int_112105877 __pyx_mstate_global->__pyx_int_112105877 +#define __pyx_int_136983863 __pyx_mstate_global->__pyx_int_136983863 +#define __pyx_int_184977713 __pyx_mstate_global->__pyx_int_184977713 +#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 +#define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 +#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 +#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 +#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 +#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 +#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 +#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23 +#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24 +#define __pyx_tuple__26 __pyx_mstate_global->__pyx_tuple__26 +#define __pyx_tuple__28 __pyx_mstate_global->__pyx_tuple__28 +#define __pyx_tuple__30 __pyx_mstate_global->__pyx_tuple__30 +#define __pyx_tuple__32 __pyx_mstate_global->__pyx_tuple__32 +#define __pyx_tuple__34 __pyx_mstate_global->__pyx_tuple__34 +#define __pyx_tuple__36 __pyx_mstate_global->__pyx_tuple__36 +#define __pyx_tuple__38 __pyx_mstate_global->__pyx_tuple__38 +#define __pyx_tuple__40 __pyx_mstate_global->__pyx_tuple__40 +#define __pyx_tuple__42 __pyx_mstate_global->__pyx_tuple__42 +#define __pyx_tuple__44 __pyx_mstate_global->__pyx_tuple__44 +#define __pyx_tuple__46 __pyx_mstate_global->__pyx_tuple__46 +#define __pyx_tuple__48 __pyx_mstate_global->__pyx_tuple__48 +#define __pyx_tuple__50 __pyx_mstate_global->__pyx_tuple__50 +#define __pyx_tuple__52 __pyx_mstate_global->__pyx_tuple__52 +#define __pyx_tuple__54 __pyx_mstate_global->__pyx_tuple__54 +#define __pyx_tuple__56 __pyx_mstate_global->__pyx_tuple__56 +#define __pyx_tuple__58 __pyx_mstate_global->__pyx_tuple__58 +#define __pyx_tuple__60 __pyx_mstate_global->__pyx_tuple__60 +#define __pyx_tuple__62 __pyx_mstate_global->__pyx_tuple__62 +#define __pyx_tuple__64 __pyx_mstate_global->__pyx_tuple__64 +#define __pyx_tuple__66 __pyx_mstate_global->__pyx_tuple__66 +#define __pyx_tuple__67 __pyx_mstate_global->__pyx_tuple__67 +#define __pyx_tuple__69 __pyx_mstate_global->__pyx_tuple__69 +#define __pyx_tuple__71 __pyx_mstate_global->__pyx_tuple__71 +#define __pyx_tuple__73 __pyx_mstate_global->__pyx_tuple__73 +#define __pyx_tuple__75 __pyx_mstate_global->__pyx_tuple__75 +#define __pyx_tuple__77 __pyx_mstate_global->__pyx_tuple__77 +#define __pyx_tuple__79 __pyx_mstate_global->__pyx_tuple__79 +#define __pyx_tuple__81 __pyx_mstate_global->__pyx_tuple__81 +#define __pyx_tuple__83 __pyx_mstate_global->__pyx_tuple__83 +#define __pyx_tuple__85 __pyx_mstate_global->__pyx_tuple__85 +#define __pyx_tuple__87 __pyx_mstate_global->__pyx_tuple__87 +#define __pyx_tuple__89 __pyx_mstate_global->__pyx_tuple__89 +#define __pyx_tuple__91 __pyx_mstate_global->__pyx_tuple__91 +#define __pyx_tuple__93 __pyx_mstate_global->__pyx_tuple__93 +#define __pyx_tuple__95 __pyx_mstate_global->__pyx_tuple__95 +#define __pyx_tuple__97 __pyx_mstate_global->__pyx_tuple__97 +#define __pyx_tuple__99 __pyx_mstate_global->__pyx_tuple__99 +#define __pyx_tuple__101 __pyx_mstate_global->__pyx_tuple__101 +#define __pyx_tuple__103 __pyx_mstate_global->__pyx_tuple__103 +#define __pyx_tuple__105 __pyx_mstate_global->__pyx_tuple__105 +#define __pyx_tuple__107 __pyx_mstate_global->__pyx_tuple__107 +#define __pyx_codeobj__25 __pyx_mstate_global->__pyx_codeobj__25 +#define __pyx_codeobj__27 __pyx_mstate_global->__pyx_codeobj__27 +#define __pyx_codeobj__29 __pyx_mstate_global->__pyx_codeobj__29 +#define __pyx_codeobj__31 __pyx_mstate_global->__pyx_codeobj__31 +#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33 +#define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35 +#define __pyx_codeobj__37 __pyx_mstate_global->__pyx_codeobj__37 +#define __pyx_codeobj__39 __pyx_mstate_global->__pyx_codeobj__39 +#define __pyx_codeobj__41 __pyx_mstate_global->__pyx_codeobj__41 +#define __pyx_codeobj__43 __pyx_mstate_global->__pyx_codeobj__43 +#define __pyx_codeobj__45 __pyx_mstate_global->__pyx_codeobj__45 +#define __pyx_codeobj__47 __pyx_mstate_global->__pyx_codeobj__47 +#define __pyx_codeobj__49 __pyx_mstate_global->__pyx_codeobj__49 +#define __pyx_codeobj__51 __pyx_mstate_global->__pyx_codeobj__51 +#define __pyx_codeobj__53 __pyx_mstate_global->__pyx_codeobj__53 +#define __pyx_codeobj__55 __pyx_mstate_global->__pyx_codeobj__55 +#define __pyx_codeobj__57 __pyx_mstate_global->__pyx_codeobj__57 +#define __pyx_codeobj__59 __pyx_mstate_global->__pyx_codeobj__59 +#define __pyx_codeobj__61 __pyx_mstate_global->__pyx_codeobj__61 +#define __pyx_codeobj__63 __pyx_mstate_global->__pyx_codeobj__63 +#define __pyx_codeobj__65 __pyx_mstate_global->__pyx_codeobj__65 +#define __pyx_codeobj__68 __pyx_mstate_global->__pyx_codeobj__68 +#define __pyx_codeobj__70 __pyx_mstate_global->__pyx_codeobj__70 +#define __pyx_codeobj__72 __pyx_mstate_global->__pyx_codeobj__72 +#define __pyx_codeobj__74 __pyx_mstate_global->__pyx_codeobj__74 +#define __pyx_codeobj__76 __pyx_mstate_global->__pyx_codeobj__76 +#define __pyx_codeobj__78 __pyx_mstate_global->__pyx_codeobj__78 +#define __pyx_codeobj__80 __pyx_mstate_global->__pyx_codeobj__80 +#define __pyx_codeobj__82 __pyx_mstate_global->__pyx_codeobj__82 +#define __pyx_codeobj__84 __pyx_mstate_global->__pyx_codeobj__84 +#define __pyx_codeobj__86 __pyx_mstate_global->__pyx_codeobj__86 +#define __pyx_codeobj__88 __pyx_mstate_global->__pyx_codeobj__88 +#define __pyx_codeobj__90 __pyx_mstate_global->__pyx_codeobj__90 +#define __pyx_codeobj__92 __pyx_mstate_global->__pyx_codeobj__92 +#define __pyx_codeobj__94 __pyx_mstate_global->__pyx_codeobj__94 +#define __pyx_codeobj__96 __pyx_mstate_global->__pyx_codeobj__96 +#define __pyx_codeobj__98 __pyx_mstate_global->__pyx_codeobj__98 +#define __pyx_codeobj__100 __pyx_mstate_global->__pyx_codeobj__100 +#define __pyx_codeobj__102 __pyx_mstate_global->__pyx_codeobj__102 +#define __pyx_codeobj__104 __pyx_mstate_global->__pyx_codeobj__104 +#define __pyx_codeobj__106 __pyx_mstate_global->__pyx_codeobj__106 +#define __pyx_codeobj__108 __pyx_mstate_global->__pyx_codeobj__108 +/* #### Code section: module_code ### */ + +/* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): * - * @cython.boundscheck(False) - * def SphereinCube(double A, int numpoints, double gfunc, double deltaA): # <<<<<<<<<<<<<< - * cdef int i, j, k, sumr - * cdef double vol,x,y,z */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_1SphereinCube(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_1SphereinCube = {"SphereinCube", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_1SphereinCube, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_1SphereinCube(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - double __pyx_v_A; - int __pyx_v_numpoints; - double __pyx_v_gfunc; - double __pyx_v_deltaA; +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("SphereinCube (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 131, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_numpoints,&__pyx_n_s_gfunc,&__pyx_n_s_deltaA,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; + values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_n_s_c)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shape)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numpoints)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_itemsize)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("SphereinCube", 1, 4, 4, 1); __PYX_ERR(0, 24, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gfunc)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_format)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("SphereinCube", 1, 4, 4, 2); __PYX_ERR(0, 24, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_deltaA)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("SphereinCube", 1, 4, 4, 3); __PYX_ERR(0, 24, __pyx_L3_error) + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode); + if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_allocate_buffer); + if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "SphereinCube") < 0)) __PYX_ERR(0, 24, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 131, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 132, __pyx_L3_error) + } else { + + /* "View.MemoryView":132 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx + */ + __pyx_v_allocate_buffer = ((int)1); } - __pyx_v_A = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_A == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) - __pyx_v_numpoints = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_numpoints == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) - __pyx_v_gfunc = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_gfunc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) - __pyx_v_deltaA = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_deltaA == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("SphereinCube", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 24, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 131, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.SphereinCube", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_SphereinCube(__pyx_self, __pyx_v_A, __pyx_v_numpoints, __pyx_v_gfunc, __pyx_v_deltaA); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 131, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 131, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * + */ /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_SphereinCube(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_A, int __pyx_v_numpoints, double __pyx_v_gfunc, double __pyx_v_deltaA) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_sumr; - double __pyx_v_x; - double __pyx_v_y; - double __pyx_v_z; - PyObject *__pyx_r = NULL; +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + Py_ssize_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; + char *__pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_UCS4 __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("SphereinCube", 0); + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); - /* "src/helpers/helpers.pyx":28 - * cdef double vol,x,y,z + /* "View.MemoryView":137 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize * - * sumr=0 # <<<<<<<<<<<<<< - * for i in prange(numpoints,nogil=True): - * x=-A/2+(i+0.5)*deltaA */ - __pyx_v_sumr = 0; + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 137, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 137, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); - /* "src/helpers/helpers.pyx":29 + /* "View.MemoryView":138 * - * sumr=0 - * for i in prange(numpoints,nogil=True): # <<<<<<<<<<<<<< - * x=-A/2+(i+0.5)*deltaA - * for j in range(numpoints): + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_numpoints; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel reduction(+:__pyx_v_sumr) private(__pyx_t_10, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_x) lastprivate(__pyx_v_y) lastprivate(__pyx_v_z) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); - __pyx_v_x = ((double)__PYX_NAN()); - __pyx_v_y = ((double)__PYX_NAN()); - __pyx_v_z = ((double)__PYX_NAN()); + __pyx_v_self->itemsize = __pyx_v_itemsize; - /* "src/helpers/helpers.pyx":30 - * sumr=0 - * for i in prange(numpoints,nogil=True): - * x=-A/2+(i+0.5)*deltaA # <<<<<<<<<<<<<< - * for j in range(numpoints): - * y=-A/2+(j+0.5)*deltaA + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * */ - __pyx_v_x = (((-__pyx_v_A) / 2.0) + ((__pyx_v_i + 0.5) * __pyx_v_deltaA)); + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/helpers.pyx":31 - * for i in prange(numpoints,nogil=True): - * x=-A/2+(i+0.5)*deltaA - * for j in range(numpoints): # <<<<<<<<<<<<<< - * y=-A/2+(j+0.5)*deltaA - * for k in range(numpoints): + /* "View.MemoryView":141 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: */ - __pyx_t_4 = __pyx_v_numpoints; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_j = __pyx_t_6; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 141, __pyx_L1_error) - /* "src/helpers/helpers.pyx":32 - * x=-A/2+(i+0.5)*deltaA - * for j in range(numpoints): - * y=-A/2+(j+0.5)*deltaA # <<<<<<<<<<<<<< - * for k in range(numpoints): - * z=-A/2+(k+0.5)*deltaA + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * */ - __pyx_v_y = (((-__pyx_v_A) / 2.0) + ((__pyx_v_j + 0.5) * __pyx_v_deltaA)); + } - /* "src/helpers/helpers.pyx":33 - * for j in range(numpoints): - * y=-A/2+(j+0.5)*deltaA - * for k in range(numpoints): # <<<<<<<<<<<<<< - * z=-A/2+(k+0.5)*deltaA + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" * */ - __pyx_t_7 = __pyx_v_numpoints; - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_k = __pyx_t_9; + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/helpers.pyx":34 - * y=-A/2+(j+0.5)*deltaA - * for k in range(numpoints): - * z=-A/2+(k+0.5)*deltaA # <<<<<<<<<<<<<< + /* "View.MemoryView":144 * - * if x*x+y*y+z*z <= gfunc**2: + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): */ - __pyx_v_z = (((-__pyx_v_A) / 2.0) + ((__pyx_v_k + 0.5) * __pyx_v_deltaA)); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 144, __pyx_L1_error) - /* "src/helpers/helpers.pyx":36 - * z=-A/2+(k+0.5)*deltaA + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" * - * if x*x+y*y+z*z <= gfunc**2: # <<<<<<<<<<<<<< - * sumr+=1 - * return(sumr) */ - __pyx_t_10 = (((((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)) + (__pyx_v_z * __pyx_v_z)) <= pow(__pyx_v_gfunc, 2.0)) != 0); - if (__pyx_t_10) { + } - /* "src/helpers/helpers.pyx":37 - * - * if x*x+y*y+z*z <= gfunc**2: - * sumr+=1 # <<<<<<<<<<<<<< - * return(sumr) + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - __pyx_v_sumr = (__pyx_v_sumr + 1); + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { - /* "src/helpers/helpers.pyx":36 - * z=-A/2+(k+0.5)*deltaA + /* "View.MemoryView":147 * - * if x*x+y*y+z*z <= gfunc**2: # <<<<<<<<<<<<<< - * sumr+=1 - * return(sumr) + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":29 + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" * - * sumr=0 - * for i in prange(numpoints,nogil=True): # <<<<<<<<<<<<<< - * x=-A/2+(i+0.5)*deltaA - * for j in range(numpoints): + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } - /* "src/helpers/helpers.pyx":38 - * if x*x+y*y+z*z <= gfunc**2: - * sumr+=1 - * return(sumr) # <<<<<<<<<<<<<< + /* "View.MemoryView":148 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_sumr); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_r = __pyx_t_11; - __pyx_t_11 = 0; - goto __pyx_L0; + if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_format))) __PYX_ERR(1, 148, __pyx_L1_error) + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":24 + /* "View.MemoryView":149 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) - * def SphereinCube(double A, int numpoints, double gfunc, double deltaA): # <<<<<<<<<<<<<< - * cdef int i, j, k, sumr - * cdef double vol,x,y,z */ + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 149, __pyx_L1_error) + } + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 149, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_8; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("newanalysis.helpers.SphereinCube", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/helpers.pyx":41 + /* "View.MemoryView":152 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim * - * @cython.boundscheck(False) - * def velcomByResidue(double [:,:] vels, double [:] masses, int nres, int [:] apr, int [:] rfa): # <<<<<<<<<<<<<< - * """ - * velcomByResidue(vels,masses,nres,atoms_per_residue) */ + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_3velcomByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_2velcomByResidue[] = "\n velcomByResidue(vels,masses,nres,atoms_per_residue)\n\n Calculates the center-of-mass velocities for a given selection.\n\n NOTE:\n Don't call this function directly, use the AtomGroup interface instead!\n E.g. for an atom selection 'sel', call \n\n velcom = sel.velcomByResidue() \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_3velcomByResidue = {"velcomByResidue", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_3velcomByResidue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_2velcomByResidue}; -static PyObject *__pyx_pw_11newanalysis_7helpers_3velcomByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_vels = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_masses = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_nres; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("velcomByResidue (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vels,&__pyx_n_s_masses,&__pyx_n_s_nres,&__pyx_n_s_apr,&__pyx_n_s_rfa,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vels)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_masses)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 5, 5, 1); __PYX_ERR(0, 41, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nres)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 5, 5, 2); __PYX_ERR(0, 41, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 5, 5, 3); __PYX_ERR(0, 41, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 5, 5, 4); __PYX_ERR(0, 41, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "velcomByResidue") < 0)) __PYX_ERR(0, 41, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - } - __pyx_v_vels = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vels.memview)) __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_v_masses = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_masses.memview)) __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_v_nres = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nres == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 41, __pyx_L3_error) + /* "View.MemoryView":153 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: + */ + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * + */ + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { + + /* "View.MemoryView":156 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * + */ + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 156, __pyx_L1_error) + + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * + */ } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 41, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.velcomByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_2velcomByResidue(__pyx_self, __pyx_v_vels, __pyx_v_masses, __pyx_v_nres, __pyx_v_apr, __pyx_v_rfa); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":159 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + */ + __pyx_t_7 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(1, 159, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_7; + __pyx_t_7 = (__pyx_t_7 + 1); -static PyObject *__pyx_pf_11newanalysis_7helpers_2velcomByResidue(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_vels, __Pyx_memviewslice __pyx_v_masses, int __pyx_v_nres, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa) { - __Pyx_memviewslice __pyx_v_velcom = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_actr; - double __pyx_v_tot_mass; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("velcomByResidue", 0); + /* "View.MemoryView":160 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim + */ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { - /* "src/helpers/helpers.pyx":54 - * """ + /* "View.MemoryView":161 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim * - * cdef double [:,:] velcom = np.zeros((nres,3)) # <<<<<<<<<<<<<< - * cdef int i, j, k, actr - * cdef double tot_mass */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nres); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3); - __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = 0; + __pyx_t_10 = 127; + __Pyx_INCREF(__pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_9 += 22; + __Pyx_GIVEREF(__pyx_kp_u_Invalid_shape_in_axis); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u_); + __pyx_t_9 += 2; + __Pyx_GIVEREF(__pyx_kp_u_); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_); + __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u__2); + __pyx_t_9 += 1; + __Pyx_GIVEREF(__pyx_kp_u__2); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2); + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 161, __pyx_L1_error) + + /* "View.MemoryView":160 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim + */ } + + /* "View.MemoryView":162 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order + */ + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + + /* "View.MemoryView":159 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + */ } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_velcom = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; - /* "src/helpers/helpers.pyx":58 - * cdef double tot_mass + /* "View.MemoryView":165 * - * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< - * tot_mass = 0.0 - * for j in range(apr[i]): + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_6 = __pyx_v_nres; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_8 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_8 > 0) - { - #ifdef _OPENMP - #pragma omp parallel reduction(+:__pyx_v_tot_mass) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_actr) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) - #endif /* _OPENMP */ - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_7); - /* Initialize private variables to invalid values */ - __pyx_v_actr = ((int)0xbad0bad0); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 165, __pyx_L1_error) + if (__pyx_t_3) { + + /* "View.MemoryView":166 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': + */ + __pyx_v_order = 'C'; + + /* "View.MemoryView":167 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' + */ + __Pyx_INCREF(__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_c; - /* "src/helpers/helpers.pyx":59 + /* "View.MemoryView":165 * - * for i in prange(nres, nogil=True): - * tot_mass = 0.0 # <<<<<<<<<<<<<< - * for j in range(apr[i]): - * actr = rfa[i] + j + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' */ - __pyx_v_tot_mass = 0.0; + goto __pyx_L11; + } - /* "src/helpers/helpers.pyx":60 - * for i in prange(nres, nogil=True): - * tot_mass = 0.0 - * for j in range(apr[i]): # <<<<<<<<<<<<<< - * actr = rfa[i] + j - * for k in range(3): + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' */ - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_apr.shape[0]; - __pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_9 * __pyx_v_apr.strides[0]) ))); - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 168, __pyx_L1_error) + if (likely(__pyx_t_3)) { - /* "src/helpers/helpers.pyx":61 - * tot_mass = 0.0 - * for j in range(apr[i]): - * actr = rfa[i] + j # <<<<<<<<<<<<<< - * for k in range(3): - * velcom[i,k] += vels[actr,k] * masses[actr] + /* "View.MemoryView":169 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: */ - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_rfa.shape[0]; - __pyx_v_actr = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_9 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_j); + __pyx_v_order = 'F'; - /* "src/helpers/helpers.pyx":62 - * for j in range(apr[i]): - * actr = rfa[i] + j - * for k in range(3): # <<<<<<<<<<<<<< - * velcom[i,k] += vels[actr,k] * masses[actr] - * tot_mass += masses[actr] + /* "View.MemoryView":170 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" */ - for (__pyx_t_13 = 0; __pyx_t_13 < 3; __pyx_t_13+=1) { - __pyx_v_k = __pyx_t_13; + __Pyx_INCREF(__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_fortran; - /* "src/helpers/helpers.pyx":63 - * actr = rfa[i] + j - * for k in range(3): - * velcom[i,k] += vels[actr,k] * masses[actr] # <<<<<<<<<<<<<< - * tot_mass += masses[actr] - * for k in range(3): + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' */ - __pyx_t_9 = __pyx_v_actr; - __pyx_t_14 = __pyx_v_k; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_vels.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_vels.shape[1]; - __pyx_t_15 = __pyx_v_actr; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_masses.shape[0]; - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = __pyx_v_k; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_velcom.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_velcom.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_velcom.data + __pyx_t_16 * __pyx_v_velcom.strides[0]) ) + __pyx_t_17 * __pyx_v_velcom.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vels.data + __pyx_t_9 * __pyx_v_vels.strides[0]) ) + __pyx_t_14 * __pyx_v_vels.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_15 * __pyx_v_masses.strides[0]) )))); - } + goto __pyx_L11; + } - /* "src/helpers/helpers.pyx":64 - * for k in range(3): - * velcom[i,k] += vels[actr,k] * masses[actr] - * tot_mass += masses[actr] # <<<<<<<<<<<<<< - * for k in range(3): - * velcom[i,k] /= tot_mass + /* "View.MemoryView":172 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) */ - __pyx_t_15 = __pyx_v_actr; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_masses.shape[0]; - __pyx_v_tot_mass = (__pyx_v_tot_mass + (*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_15 * __pyx_v_masses.strides[0]) )))); - } + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 172, __pyx_L1_error) + } + __pyx_L11:; - /* "src/helpers/helpers.pyx":65 - * velcom[i,k] += vels[actr,k] * masses[actr] - * tot_mass += masses[actr] - * for k in range(3): # <<<<<<<<<<<<<< - * velcom[i,k] /= tot_mass + /* "View.MemoryView":174 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer */ - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_k = __pyx_t_10; + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - /* "src/helpers/helpers.pyx":66 - * tot_mass += masses[actr] - * for k in range(3): - * velcom[i,k] /= tot_mass # <<<<<<<<<<<<<< + /* "View.MemoryView":176 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' * - * return np.asarray(velcom) */ - __pyx_t_15 = __pyx_v_i; - __pyx_t_14 = __pyx_v_k; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_velcom.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_velcom.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_velcom.data + __pyx_t_15 * __pyx_v_velcom.strides[0]) ) + __pyx_t_14 * __pyx_v_velcom.strides[1]) )) /= __pyx_v_tot_mass; - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_v_self->free_data = __pyx_v_allocate_buffer; - /* "src/helpers/helpers.pyx":58 - * cdef double tot_mass + /* "View.MemoryView":177 * - * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< - * tot_mass = 0.0 - * for j in range(apr[i]): + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } + __pyx_t_6 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 177, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; - /* "src/helpers/helpers.pyx":68 - * velcom[i,k] /= tot_mass + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' * - * return np.asarray(velcom) # <<<<<<<<<<<<<< + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * + */ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":180 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') + */ + __pyx_t_7 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 180, __pyx_L1_error) + + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_velcom, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - /* "src/helpers/helpers.pyx":41 + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): * - * @cython.boundscheck(False) - * def velcomByResidue(double [:,:] vels, double [:] masses, int nres, int [:] apr, int [:] rfa): # <<<<<<<<<<<<<< - * """ - * velcomByResidue(vels,masses,nres,atoms_per_residue) */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __Pyx_AddTraceback("newanalysis.helpers.velcomByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_velcom, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_vels, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_masses, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_format); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":71 +/* "View.MemoryView":182 + * _allocate_buffer(self) * - * @cython.boundscheck(False) - * def comByResidue(double [:,:] coor, double [:] masses, int nres, int [:] apr, int [:] rfa): # <<<<<<<<<<<<<< - * """ - * comByResidue(coor,masses,nres,atoms_per_residue) + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_5comByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_4comByResidue[] = "\n comByResidue(coor,masses,nres,atoms_per_residue)\n\n Calculates the center-of-mass coordinates for a given selection.\n\n NOTE:\n Don't call this function directly, use the AtomGroup interface instead!\n E.g. for an atom selection 'sel', call \n\n com = sel.comByResidue() \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_5comByResidue = {"comByResidue", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_5comByResidue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_4comByResidue}; -static PyObject *__pyx_pw_11newanalysis_7helpers_5comByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_masses = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_nres; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("comByResidue (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_masses,&__pyx_n_s_nres,&__pyx_n_s_apr,&__pyx_n_s_rfa,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_masses)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("comByResidue", 1, 5, 5, 1); __PYX_ERR(0, 71, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nres)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("comByResidue", 1, 5, 5, 2); __PYX_ERR(0, 71, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("comByResidue", 1, 5, 5, 3); __PYX_ERR(0, 71, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("comByResidue", 1, 5, 5, 4); __PYX_ERR(0, 71, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "comByResidue") < 0)) __PYX_ERR(0, 71, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 71, __pyx_L3_error) - __pyx_v_masses = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_masses.memview)) __PYX_ERR(0, 71, __pyx_L3_error) - __pyx_v_nres = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nres == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 71, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 71, __pyx_L3_error) + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("comByResidue", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 71, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.comByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_4comByResidue(__pyx_self, __pyx_v_coor, __pyx_v_masses, __pyx_v_nres, __pyx_v_apr, __pyx_v_rfa); + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":184 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + */ + __pyx_v_bufmode = -1; -static PyObject *__pyx_pf_11newanalysis_7helpers_4comByResidue(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_masses, int __pyx_v_nres, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa) { - __Pyx_memviewslice __pyx_v_com = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_actr; - double __pyx_v_tot_mass; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("comByResidue", 0); + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + */ + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":84 - * """ - * - * cdef double [:,:] com = np.zeros((nres,3)) # <<<<<<<<<<<<<< - * cdef int i, j, k, actr - * cdef double tot_mass + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + */ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":187 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + */ + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + */ + goto __pyx_L4; + } + + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + */ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 188, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":189 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + */ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + */ + } + __pyx_L4:; + + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + */ + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":191 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 191, __pyx_L1_error) + + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nres); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3); - __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); } + + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + */ } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_com = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; - /* "src/helpers/helpers.pyx":88 - * cdef double tot_mass + /* "View.MemoryView":192 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len * - * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< - * tot_mass = 0.0 - * for j in range(apr[i]): */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_6 = __pyx_v_nres; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_8 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_8 > 0) - { - #ifdef _OPENMP - #pragma omp parallel reduction(+:__pyx_v_tot_mass) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_actr) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) - #endif /* _OPENMP */ - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_7); - /* Initialize private variables to invalid values */ - __pyx_v_actr = ((int)0xbad0bad0); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; - /* "src/helpers/helpers.pyx":89 + /* "View.MemoryView":193 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< * - * for i in prange(nres, nogil=True): - * tot_mass = 0.0 # <<<<<<<<<<<<<< - * for j in range(apr[i]): - * actr = rfa[i] + j + * if flags & PyBUF_STRIDES: */ - __pyx_v_tot_mass = 0.0; + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; - /* "src/helpers/helpers.pyx":90 - * for i in prange(nres, nogil=True): - * tot_mass = 0.0 - * for j in range(apr[i]): # <<<<<<<<<<<<<< - * actr = rfa[i] + j - * for k in range(3): + /* "View.MemoryView":195 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape */ - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_apr.shape[0]; - __pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_9 * __pyx_v_apr.strides[0]) ))); - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":91 - * tot_mass = 0.0 - * for j in range(apr[i]): - * actr = rfa[i] + j # <<<<<<<<<<<<<< - * for k in range(3): - * com[i,k] += coor[actr,k] * masses[actr] + /* "View.MemoryView":196 + * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides */ - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_rfa.shape[0]; - __pyx_v_actr = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_9 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_j); + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; - /* "src/helpers/helpers.pyx":92 - * for j in range(apr[i]): - * actr = rfa[i] + j - * for k in range(3): # <<<<<<<<<<<<<< - * com[i,k] += coor[actr,k] * masses[actr] - * tot_mass += masses[actr] + /* "View.MemoryView":197 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: */ - for (__pyx_t_13 = 0; __pyx_t_13 < 3; __pyx_t_13+=1) { - __pyx_v_k = __pyx_t_13; + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; - /* "src/helpers/helpers.pyx":93 - * actr = rfa[i] + j - * for k in range(3): - * com[i,k] += coor[actr,k] * masses[actr] # <<<<<<<<<<<<<< - * tot_mass += masses[actr] - * for k in range(3): + /* "View.MemoryView":198 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 */ - __pyx_t_9 = __pyx_v_actr; - __pyx_t_14 = __pyx_v_k; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; - __pyx_t_15 = __pyx_v_actr; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_masses.shape[0]; - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = __pyx_v_k; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_com.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_com.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_16 * __pyx_v_com.strides[0]) ) + __pyx_t_17 * __pyx_v_com.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_15 * __pyx_v_masses.strides[0]) )))); - } + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; - /* "src/helpers/helpers.pyx":94 - * for k in range(3): - * com[i,k] += coor[actr,k] * masses[actr] - * tot_mass += masses[actr] # <<<<<<<<<<<<<< - * for k in range(3): - * com[i,k] /= tot_mass + /* "View.MemoryView":195 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape */ - __pyx_t_15 = __pyx_v_actr; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_masses.shape[0]; - __pyx_v_tot_mass = (__pyx_v_tot_mass + (*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_15 * __pyx_v_masses.strides[0]) )))); - } + goto __pyx_L6; + } - /* "src/helpers/helpers.pyx":95 - * com[i,k] += coor[actr,k] * masses[actr] - * tot_mass += masses[actr] - * for k in range(3): # <<<<<<<<<<<<<< - * com[i,k] /= tot_mass - * + /* "View.MemoryView":200 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL */ - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_k = __pyx_t_10; + /*else*/ { + __pyx_v_info->ndim = 1; - /* "src/helpers/helpers.pyx":96 - * tot_mass += masses[actr] - * for k in range(3): - * com[i,k] /= tot_mass # <<<<<<<<<<<<<< + /* "View.MemoryView":201 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL * - * return np.asarray(com) */ - __pyx_t_15 = __pyx_v_i; - __pyx_t_14 = __pyx_v_k; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_com.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_com.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_15 * __pyx_v_com.strides[0]) ) + __pyx_t_14 * __pyx_v_com.strides[1]) )) /= __pyx_v_tot_mass; - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; - /* "src/helpers/helpers.pyx":88 - * cdef double tot_mass + /* "View.MemoryView":202 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< * - * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< - * tot_mass = 0.0 - * for j in range(apr[i]): + * info.suboffsets = NULL */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } + __pyx_v_info->strides = NULL; } + __pyx_L6:; - /* "src/helpers/helpers.pyx":98 - * com[i,k] /= tot_mass + /* "View.MemoryView":204 + * info.strides = NULL * - * return np.asarray(com) # <<<<<<<<<<<<<< + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 + */ + __pyx_v_info->suboffsets = NULL; + + /* "View.MemoryView":205 * - * @cython.boundscheck(False) + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_com, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":206 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self + */ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":207 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self + * + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_info->format = __pyx_t_2; + + /* "View.MemoryView":208 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< + * + * def __dealloc__(array self): + */ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "src/helpers/helpers.pyx":71 + /* "View.MemoryView":182 + * _allocate_buffer(self) * - * @cython.boundscheck(False) - * def comByResidue(double [:,:] coor, double [:] masses, int nres, int [:] apr, int [:] rfa): # <<<<<<<<<<<<<< - * """ - * comByResidue(coor,masses,nres,atoms_per_residue) + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __Pyx_AddTraceback("newanalysis.helpers.comByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_com, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_masses, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __Pyx_XGIVEREF(__pyx_r); + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":101 +/* "View.MemoryView":210 + * info.obj = self * - * @cython.boundscheck(False) - * def dipByResidue(double [:,:] coor, double [:] charges, double [:] masses, int nres, int [:] apr, int [:] rfa, double [:,:] com): # <<<<<<<<<<<<<< - * """ - * dipByResidue(coor,charges,masses,nresidues,atoms_per_residue,com) + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_7dipByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_6dipByResidue[] = "\n dipByResidue(coor,charges,masses,nresidues,atoms_per_residue,com)\n\n Calculates the molecular dipole moments, each referenced to the respective center of mass, \n for a given selection.\n\n NOTE:\n Don't call this function directly, use the AtomGroup interface instead!\n E.g. for an atom selection 'sel', call \n\n dip = sel.dipByResidue() \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_7dipByResidue = {"dipByResidue", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_7dipByResidue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_6dipByResidue}; -static PyObject *__pyx_pw_11newanalysis_7helpers_7dipByResidue(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - CYTHON_UNUSED __Pyx_memviewslice __pyx_v_masses = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_nres; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_com = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("dipByResidue (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_masses,&__pyx_n_s_nres,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_com,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 1); __PYX_ERR(0, 101, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_masses)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 2); __PYX_ERR(0, 101, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nres)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 3); __PYX_ERR(0, 101, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 4); __PYX_ERR(0, 101, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 5); __PYX_ERR(0, 101, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_com)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 6); __PYX_ERR(0, 101, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dipByResidue") < 0)) __PYX_ERR(0, 101, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 101, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 101, __pyx_L3_error) - __pyx_v_masses = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_masses.memview)) __PYX_ERR(0, 101, __pyx_L3_error) - __pyx_v_nres = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nres == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 101, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 101, __pyx_L3_error) - __pyx_v_com = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_com.memview)) __PYX_ERR(0, 101, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 101, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.dipByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_6dipByResidue(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_masses, __pyx_v_nres, __pyx_v_apr, __pyx_v_rfa, __pyx_v_com); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_6dipByResidue(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_masses, int __pyx_v_nres, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, __Pyx_memviewslice __pyx_v_com) { - __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_actr; - PyObject *__pyx_r = NULL; +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dipByResidue", 0); + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "src/helpers/helpers.pyx":114 - * dip = sel.dipByResidue() - * """ - * cdef double [:,:] dip = np.zeros((nres,3)) # <<<<<<<<<<<<<< - * cdef int i, j, k, actr + /* "View.MemoryView":211 * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nres); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3); - __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_dip = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":117 - * cdef int i, j, k, actr - * - * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< - * for j in range(apr[i]): - * actr = rfa[i] + j + /* "View.MemoryView":212 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_6 = __pyx_v_nres; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_8 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_8 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_actr) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) - #endif /* _OPENMP */ - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_7); - /* Initialize private variables to invalid values */ - __pyx_v_actr = ((int)0xbad0bad0); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); + __pyx_v_self->callback_free_data(__pyx_v_self->data); - /* "src/helpers/helpers.pyx":118 + /* "View.MemoryView":211 * - * for i in prange(nres, nogil=True): - * for j in range(apr[i]): # <<<<<<<<<<<<<< - * actr = rfa[i] + j - * for k in range(3): + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_apr.shape[0]; - __pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_9 * __pyx_v_apr.strides[0]) ))); - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; + goto __pyx_L3; + } - /* "src/helpers/helpers.pyx":119 - * for i in prange(nres, nogil=True): - * for j in range(apr[i]): - * actr = rfa[i] + j # <<<<<<<<<<<<<< - * for k in range(3): - * dip[i,k] += (coor[actr,k] - com[i,k]) * charges[actr] + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) */ - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_rfa.shape[0]; - __pyx_v_actr = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_9 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_j); + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":120 - * for j in range(apr[i]): - * actr = rfa[i] + j - * for k in range(3): # <<<<<<<<<<<<<< - * dip[i,k] += (coor[actr,k] - com[i,k]) * charges[actr] - * + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) */ - for (__pyx_t_13 = 0; __pyx_t_13 < 3; __pyx_t_13+=1) { - __pyx_v_k = __pyx_t_13; + if (__pyx_v_self->dtype_is_object) { - /* "src/helpers/helpers.pyx":121 - * actr = rfa[i] + j - * for k in range(3): - * dip[i,k] += (coor[actr,k] - com[i,k]) * charges[actr] # <<<<<<<<<<<<<< - * - * return np.asarray(dip) + /* "View.MemoryView":215 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) */ - __pyx_t_9 = __pyx_v_actr; - __pyx_t_14 = __pyx_v_k; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; - __pyx_t_15 = __pyx_v_i; - __pyx_t_16 = __pyx_v_k; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_com.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_com.shape[1]; - __pyx_t_17 = __pyx_v_actr; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_charges.shape[0]; - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_k; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_dip.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_dip.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_18 * __pyx_v_dip.strides[0]) ) + __pyx_t_19 * __pyx_v_dip.strides[1]) )) += (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_15 * __pyx_v_com.strides[0]) ) + __pyx_t_16 * __pyx_v_com.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_17 * __pyx_v_charges.strides[0]) )))); - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); - /* "src/helpers/helpers.pyx":117 - * cdef int i, j, k, actr + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + */ + } + + /* "View.MemoryView":216 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) * - * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< - * for j in range(apr[i]): - * actr = rfa[i] + j */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } + free(__pyx_v_self->data); + + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + */ } + __pyx_L3:; - /* "src/helpers/helpers.pyx":123 - * dip[i,k] += (coor[actr,k] - com[i,k]) * charges[actr] - * - * return np.asarray(dip) # <<<<<<<<<<<<<< + /* "View.MemoryView":217 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * @property */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dip, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + PyObject_Free(__pyx_v_self->_shape); - /* "src/helpers/helpers.pyx":101 + /* "View.MemoryView":210 + * info.obj = self * - * @cython.boundscheck(False) - * def dipByResidue(double [:,:] coor, double [:] charges, double [:] masses, int nres, int [:] apr, int [:] rfa, double [:,:] com): # <<<<<<<<<<<<<< - * """ - * dipByResidue(coor,charges,masses,nresidues,atoms_per_residue,com) + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __Pyx_AddTraceback("newanalysis.helpers.dipByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_dip, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_masses, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_com, 1); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "src/helpers/helpers.pyx":126 - * - * @cython.boundscheck(False) - * def dipoleMomentNeutralSelection(double [:,:] coor, double [:] charges): # <<<<<<<<<<<<<< +/* "View.MemoryView":219 + * PyObject_Free(self._shape) * - * cdef double [:] dip = np.zeros(3) + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_9dipoleMomentNeutralSelection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_9dipoleMomentNeutralSelection = {"dipoleMomentNeutralSelection", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_9dipoleMomentNeutralSelection, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_9dipoleMomentNeutralSelection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("dipoleMomentNeutralSelection (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipoleMomentNeutralSelection", 1, 2, 2, 1); __PYX_ERR(0, 126, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dipoleMomentNeutralSelection") < 0)) __PYX_ERR(0, 126, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 126, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 126, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dipoleMomentNeutralSelection", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 126, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.dipoleMomentNeutralSelection", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_8dipoleMomentNeutralSelection(__pyx_self, __pyx_v_coor, __pyx_v_charges); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_8dipoleMomentNeutralSelection(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges) { - __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_i; - int __pyx_v_natoms; +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - PyObject *__pyx_t_12 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dipoleMomentNeutralSelection", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/helpers.pyx":128 - * def dipoleMomentNeutralSelection(double [:,:] coor, double [:] charges): - * - * cdef double [:] dip = np.zeros(3) # <<<<<<<<<<<<<< - * cdef int i, natoms = coor.shape[0] + /* "View.MemoryView":221 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< * + * @cname('get_memview') */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_dip = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":129 - * - * cdef double [:] dip = np.zeros(3) - * cdef int i, natoms = coor.shape[0] # <<<<<<<<<<<<<< + /* "View.MemoryView":219 + * PyObject_Free(self._shape) * - * for i in range(natoms): + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() */ - __pyx_v_natoms = (__pyx_v_coor.shape[0]); - /* "src/helpers/helpers.pyx":131 - * cdef int i, natoms = coor.shape[0] - * - * for i in range(natoms): # <<<<<<<<<<<<<< - * dip[0] += coor[i,0] * charges[i] - * dip[1] += coor[i,1] * charges[i] - */ - __pyx_t_5 = __pyx_v_natoms; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":132 +/* "View.MemoryView":224 * - * for i in range(natoms): - * dip[0] += coor[i,0] * charges[i] # <<<<<<<<<<<<<< - * dip[1] += coor[i,1] * charges[i] - * dip[2] += coor[i,2] * charges[i] + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) */ - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_charges.shape[0]; - __pyx_t_11 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dip.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_11 * __pyx_v_dip.strides[0]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_10 * __pyx_v_charges.strides[0]) )))); - /* "src/helpers/helpers.pyx":133 - * for i in range(natoms): - * dip[0] += coor[i,0] * charges[i] - * dip[1] += coor[i,1] * charges[i] # <<<<<<<<<<<<<< - * dip[2] += coor[i,2] * charges[i] - * - */ - __pyx_t_10 = __pyx_v_i; - __pyx_t_9 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; - __pyx_t_8 = __pyx_v_i; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_charges.shape[0]; - __pyx_t_11 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dip.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_11 * __pyx_v_dip.strides[0]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_8 * __pyx_v_charges.strides[0]) )))); +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); - /* "src/helpers/helpers.pyx":134 - * dip[0] += coor[i,0] * charges[i] - * dip[1] += coor[i,1] * charges[i] - * dip[2] += coor[i,2] * charges[i] # <<<<<<<<<<<<<< + /* "View.MemoryView":225 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) * - * return np.asarray(dip) */ - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = 2; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_charges.shape[0]; - __pyx_t_11 = 2; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dip.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_11 * __pyx_v_dip.strides[0]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_10 * __pyx_v_charges.strides[0]) )))); - } + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); - /* "src/helpers/helpers.pyx":136 - * dip[2] += coor[i,2] * charges[i] - * - * return np.asarray(dip) # <<<<<<<<<<<<<< - * + /* "View.MemoryView":226 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< * + * def __len__(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dip, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_12, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error); __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "src/helpers/helpers.pyx":126 - * - * @cython.boundscheck(False) - * def dipoleMomentNeutralSelection(double [:,:] coor, double [:] charges): # <<<<<<<<<<<<<< + /* "View.MemoryView":224 * - * cdef double [:] dip = np.zeros(3) + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) */ /* function exit code */ @@ -5288,7778 +7545,4783 @@ static PyObject *__pyx_pf_11newanalysis_7helpers_8dipoleMomentNeutralSelection(C __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("newanalysis.helpers.dipoleMomentNeutralSelection", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_dip, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":140 +/* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) * - * @cython.boundscheck(False) - * def collectiveDipoleMomentWaterShells(double [:,:] coor, double [:] charges, int [:] ds, int nshells): # <<<<<<<<<<<<<< + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * - * cdef int i,j,shell */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_11collectiveDipoleMomentWaterShells(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_11collectiveDipoleMomentWaterShells = {"collectiveDipoleMomentWaterShells", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_11collectiveDipoleMomentWaterShells, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_11collectiveDipoleMomentWaterShells(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_nshells; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("collectiveDipoleMomentWaterShells (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_ds,&__pyx_n_s_nshells,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("collectiveDipoleMomentWaterShells", 1, 4, 4, 1); __PYX_ERR(0, 140, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("collectiveDipoleMomentWaterShells", 1, 4, 4, 2); __PYX_ERR(0, 140, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("collectiveDipoleMomentWaterShells", 1, 4, 4, 3); __PYX_ERR(0, 140, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "collectiveDipoleMomentWaterShells") < 0)) __PYX_ERR(0, 140, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 140, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 140, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 140, __pyx_L3_error) - __pyx_v_nshells = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("collectiveDipoleMomentWaterShells", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 140, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.collectiveDipoleMomentWaterShells", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_10collectiveDipoleMomentWaterShells(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_ds, __pyx_v_nshells); + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_10collectiveDipoleMomentWaterShells(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_nshells) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_shell; - CYTHON_UNUSED int __pyx_v_natoms; - int __pyx_v_nmol; - __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_r = NULL; +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - Py_ssize_t __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("collectiveDipoleMomentWaterShells", 0); + __Pyx_RefNannySetupContext("__len__", 0); - /* "src/helpers/helpers.pyx":143 + /* "View.MemoryView":229 * - * cdef int i,j,shell - * cdef int natoms = coor.shape[0] # <<<<<<<<<<<<<< - * cdef int nmol = len(ds) - * cdef double [:,:] dip = np.zeros((nshells,3)) - */ - __pyx_v_natoms = (__pyx_v_coor.shape[0]); - - /* "src/helpers/helpers.pyx":144 - * cdef int i,j,shell - * cdef int natoms = coor.shape[0] - * cdef int nmol = len(ds) # <<<<<<<<<<<<<< - * cdef double [:,:] dip = np.zeros((nshells,3)) + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< * + * def __getattr__(self, attr): */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ds); - __pyx_v_nmol = __pyx_t_1; + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":145 - * cdef int natoms = coor.shape[0] - * cdef int nmol = len(ds) - * cdef double [:,:] dip = np.zeros((nshells,3)) # <<<<<<<<<<<<<< + /* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) * - * for shell in prange(nshells,nogil=True): - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_3); - __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_dip = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - - /* "src/helpers/helpers.pyx":147 - * cdef double [:,:] dip = np.zeros((nshells,3)) + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * - * for shell in prange(nshells,nogil=True): # <<<<<<<<<<<<<< - * for i in range(nmol): - * if ds[i] == shell+1: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_7 = __pyx_v_nshells; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_9 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_9 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) firstprivate(__pyx_v_shell) lastprivate(__pyx_v_shell) - #endif /* _OPENMP */ - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){ - { - __pyx_v_shell = (int)(0 + 1 * __pyx_t_8); - /* Initialize private variables to invalid values */ - __pyx_v_i = ((int)0xbad0bad0); - __pyx_v_j = ((int)0xbad0bad0); - /* "src/helpers/helpers.pyx":148 + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":231 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * - * for shell in prange(nshells,nogil=True): - * for i in range(nmol): # <<<<<<<<<<<<<< - * if ds[i] == shell+1: - * for j in range(3): */ - __pyx_t_10 = __pyx_v_nmol; - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_i = __pyx_t_12; - /* "src/helpers/helpers.pyx":149 - * for shell in prange(nshells,nogil=True): - * for i in range(nmol): - * if ds[i] == shell+1: # <<<<<<<<<<<<<< - * for j in range(3): - * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] - */ - __pyx_t_13 = __pyx_v_i; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_ds.shape[0]; - __pyx_t_14 = (((*((int *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_13 * __pyx_v_ds.strides[0]) ))) == (__pyx_v_shell + 1)) != 0); - if (__pyx_t_14) { +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); - /* "src/helpers/helpers.pyx":150 - * for i in range(nmol): - * if ds[i] == shell+1: - * for j in range(3): # <<<<<<<<<<<<<< - * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] - * dip[shell,1] += coor[i*3+j,1] * charges[i*3+j] - */ - for (__pyx_t_15 = 0; __pyx_t_15 < 3; __pyx_t_15+=1) { - __pyx_v_j = __pyx_t_15; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":151 - * if ds[i] == shell+1: - * for j in range(3): - * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] # <<<<<<<<<<<<<< - * dip[shell,1] += coor[i*3+j,1] * charges[i*3+j] - * dip[shell,2] += coor[i*3+j,2] * charges[i*3+j] - */ - __pyx_t_13 = ((__pyx_v_i * 3) + __pyx_v_j); - __pyx_t_16 = 0; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; - __pyx_t_17 = ((__pyx_v_i * 3) + __pyx_v_j); - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_charges.shape[0]; - __pyx_t_18 = __pyx_v_shell; - __pyx_t_19 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_dip.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_dip.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_18 * __pyx_v_dip.strides[0]) ) + __pyx_t_19 * __pyx_v_dip.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_17 * __pyx_v_charges.strides[0]) )))); +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); - /* "src/helpers/helpers.pyx":152 - * for j in range(3): - * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] - * dip[shell,1] += coor[i*3+j,1] * charges[i*3+j] # <<<<<<<<<<<<<< - * dip[shell,2] += coor[i*3+j,2] * charges[i*3+j] - * return np.asarray(dip) + /* "View.MemoryView":232 + * + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): */ - __pyx_t_17 = ((__pyx_v_i * 3) + __pyx_v_j); - __pyx_t_16 = 1; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; - __pyx_t_13 = ((__pyx_v_i * 3) + __pyx_v_j); - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_charges.shape[0]; - __pyx_t_19 = __pyx_v_shell; - __pyx_t_18 = 1; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_dip.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_dip.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_19 * __pyx_v_dip.strides[0]) ) + __pyx_t_18 * __pyx_v_dip.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_13 * __pyx_v_charges.strides[0]) )))); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":153 - * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] - * dip[shell,1] += coor[i*3+j,1] * charges[i*3+j] - * dip[shell,2] += coor[i*3+j,2] * charges[i*3+j] # <<<<<<<<<<<<<< - * return np.asarray(dip) + /* "View.MemoryView":231 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * */ - __pyx_t_13 = ((__pyx_v_i * 3) + __pyx_v_j); - __pyx_t_16 = 2; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; - __pyx_t_17 = ((__pyx_v_i * 3) + __pyx_v_j); - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_charges.shape[0]; - __pyx_t_18 = __pyx_v_shell; - __pyx_t_19 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_dip.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_dip.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_18 * __pyx_v_dip.strides[0]) ) + __pyx_t_19 * __pyx_v_dip.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_17 * __pyx_v_charges.strides[0]) )))); - } - /* "src/helpers/helpers.pyx":149 - * for shell in prange(nshells,nogil=True): - * for i in range(nmol): - * if ds[i] == shell+1: # <<<<<<<<<<<<<< - * for j in range(3): - * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] - */ - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":147 - * cdef double [:,:] dip = np.zeros((nshells,3)) +/* "View.MemoryView":234 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] * - * for shell in prange(nshells,nogil=True): # <<<<<<<<<<<<<< - * for i in range(nmol): - * if ds[i] == shell+1: */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - /* "src/helpers/helpers.pyx":154 - * dip[shell,1] += coor[i*3+j,1] * charges[i*3+j] - * dip[shell,2] += coor[i*3+j,2] * charges[i*3+j] - * return np.asarray(dip) # <<<<<<<<<<<<<< +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":235 * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< * + * def __setitem__(self, item, value): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_dip, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "src/helpers/helpers.pyx":140 + /* "View.MemoryView":234 + * return getattr(self.memview, attr) * - * @cython.boundscheck(False) - * def collectiveDipoleMomentWaterShells(double [:,:] coor, double [:] charges, int [:] ds, int nshells): # <<<<<<<<<<<<<< + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] * - * cdef int i,j,shell */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_AddTraceback("newanalysis.helpers.collectiveDipoleMomentWaterShells", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_dip, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":159 +/* "View.MemoryView":237 + * return self.memview[item] * - * @cython.boundscheck(False) - * def atomicCurrent(double [:,:] vel, double [:] charges, double [:,:] result, int ctr): # <<<<<<<<<<<<<< - * cdef int i, natoms=len(vel) + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value * */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_13atomicCurrent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_13atomicCurrent = {"atomicCurrent", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_13atomicCurrent, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_13atomicCurrent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_vel = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_ctr; +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "View.MemoryView":238 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":237 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("atomicCurrent (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vel,&__pyx_n_s_charges,&__pyx_n_s_result,&__pyx_n_s_ctr,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vel)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicCurrent", 1, 4, 4, 1); __PYX_ERR(0, 159, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicCurrent", 1, 4, 4, 2); __PYX_ERR(0, 159, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ctr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicCurrent", 1, 4, 4, 3); __PYX_ERR(0, 159, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atomicCurrent") < 0)) __PYX_ERR(0, 159, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_vel = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vel.memview)) __PYX_ERR(0, 159, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 159, __pyx_L3_error) - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 159, __pyx_L3_error) - __pyx_v_ctr = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_ctr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L3_error) - } + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("atomicCurrent", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 159, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.atomicCurrent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_12atomicCurrent(__pyx_self, __pyx_v_vel, __pyx_v_charges, __pyx_v_result, __pyx_v_ctr); + __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_12atomicCurrent(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_vel, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_result, int __pyx_v_ctr) { - int __pyx_v_i; - int __pyx_v_natoms; +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - __Pyx_RefNannySetupContext("atomicCurrent", 0); - - /* "src/helpers/helpers.pyx":160 - * @cython.boundscheck(False) - * def atomicCurrent(double [:,:] vel, double [:] charges, double [:,:] result, int ctr): - * cdef int i, natoms=len(vel) # <<<<<<<<<<<<<< - * - * for i in range(natoms): - */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_vel); - __pyx_v_natoms = __pyx_t_1; - - /* "src/helpers/helpers.pyx":162 - * cdef int i, natoms=len(vel) - * - * for i in range(natoms): # <<<<<<<<<<<<<< - * result[ctr,0] += vel[i,0] * charges[i] - * result[ctr,1] += vel[i,1] * charges[i] - */ - __pyx_t_2 = __pyx_v_natoms; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "src/helpers/helpers.pyx":163 - * - * for i in range(natoms): - * result[ctr,0] += vel[i,0] * charges[i] # <<<<<<<<<<<<<< - * result[ctr,1] += vel[i,1] * charges[i] - * result[ctr,2] += vel[i,2] * charges[i] - */ - __pyx_t_5 = __pyx_v_i; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_vel.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_vel.shape[1]; - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_charges.shape[0]; - __pyx_t_8 = __pyx_v_ctr; - __pyx_t_9 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_result.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_result.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_8 * __pyx_v_result.strides[0]) ) + __pyx_t_9 * __pyx_v_result.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_5 * __pyx_v_vel.strides[0]) ) + __pyx_t_6 * __pyx_v_vel.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_7 * __pyx_v_charges.strides[0]) )))); - - /* "src/helpers/helpers.pyx":164 - * for i in range(natoms): - * result[ctr,0] += vel[i,0] * charges[i] - * result[ctr,1] += vel[i,1] * charges[i] # <<<<<<<<<<<<<< - * result[ctr,2] += vel[i,2] * charges[i] - * - */ - __pyx_t_7 = __pyx_v_i; - __pyx_t_6 = 1; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_vel.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_vel.shape[1]; - __pyx_t_5 = __pyx_v_i; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_charges.shape[0]; - __pyx_t_9 = __pyx_v_ctr; - __pyx_t_8 = 1; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_result.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_result.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_9 * __pyx_v_result.strides[0]) ) + __pyx_t_8 * __pyx_v_result.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_7 * __pyx_v_vel.strides[0]) ) + __pyx_t_6 * __pyx_v_vel.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_5 * __pyx_v_charges.strides[0]) )))); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "src/helpers/helpers.pyx":165 - * result[ctr,0] += vel[i,0] * charges[i] - * result[ctr,1] += vel[i,1] * charges[i] - * result[ctr,2] += vel[i,2] * charges[i] # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_5 = __pyx_v_i; - __pyx_t_6 = 2; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_vel.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_vel.shape[1]; - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_charges.shape[0]; - __pyx_t_8 = __pyx_v_ctr; - __pyx_t_9 = 2; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_result.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_result.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_8 * __pyx_v_result.strides[0]) ) + __pyx_t_9 * __pyx_v_result.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_5 * __pyx_v_vel.strides[0]) ) + __pyx_t_6 * __pyx_v_vel.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_7 * __pyx_v_charges.strides[0]) )))); - } + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "src/helpers/helpers.pyx":159 - * - * @cython.boundscheck(False) - * def atomicCurrent(double [:,:] vel, double [:] charges, double [:,:] result, int ctr): # <<<<<<<<<<<<<< - * cdef int i, natoms=len(vel) - * + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_vel, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1); + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":168 - * - * @cython.boundscheck(False) - * def centerOrientBox(double [:,:] com, double [:,:] coor, double boxl, int isolute, # <<<<<<<<<<<<<< - * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): - * """ +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_15centerOrientBox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_14centerOrientBox[] = "\n centerOrientBox(com, xyz, boxlength, isolute, atoms_per_residue, residue_first_atom, coorA, coorB)\n\n Centers the box to the center of mass of a given molecule and rotates the box so that two sets of coordinates\n are as identical as possible.\n\n Args:\n com .. centers of mass of all molecules in the box\n xyz .. coordinates of all atoms\n boxlength .. edge length of the cubic box\n isolute .. index of the solute / center molecule (count starts with 0)\n atoms_per_residue .. array showing how many atoms each residue contains\n residue_first_atom .. index of the first atom of each residue\n coorA .. template coordinates\n coorB .. corresponding coordinates of the current frame\n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_15centerOrientBox = {"centerOrientBox", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_15centerOrientBox, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_14centerOrientBox}; -static PyObject *__pyx_pw_11newanalysis_7helpers_15centerOrientBox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_com = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxl; - int __pyx_v_isolute; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coorA = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coorB = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("centerOrientBox (wrapper)", 0); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_com,&__pyx_n_s_coor,&__pyx_n_s_boxl,&__pyx_n_s_isolute,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_coorA,&__pyx_n_s_coorB,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_com)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 1); __PYX_ERR(0, 168, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 2); __PYX_ERR(0, 168, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 3); __PYX_ERR(0, 168, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 4); __PYX_ERR(0, 168, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 5); __PYX_ERR(0, 168, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coorA)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 6); __PYX_ERR(0, 168, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coorB)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 7); __PYX_ERR(0, 168, __pyx_L3_error) + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "centerOrientBox") < 0)) __PYX_ERR(0, 168, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_com = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_com.memview)) __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_v_isolute = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 169, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 169, __pyx_L3_error) - __pyx_v_coorA = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorA.memview)) __PYX_ERR(0, 169, __pyx_L3_error) - __pyx_v_coorB = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorB.memview)) __PYX_ERR(0, 169, __pyx_L3_error) + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 168, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.centerOrientBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_14centerOrientBox(__pyx_self, __pyx_v_com, __pyx_v_coor, __pyx_v_boxl, __pyx_v_isolute, __pyx_v_apr, __pyx_v_rfa, __pyx_v_coorA, __pyx_v_coorB); + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_14centerOrientBox(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_com, __Pyx_memviewslice __pyx_v_coor, double __pyx_v_boxl, int __pyx_v_isolute, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, __Pyx_memviewslice __pyx_v_coorA, __Pyx_memviewslice __pyx_v_coorB) { - double __pyx_v_shift[3]; - double __pyx_v_comslt[3]; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_nmol; - __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_tmpx; - double __pyx_v_tmpy; - double __pyx_v_tmpz; +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - double __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("centerOrientBox", 0); + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/helpers/helpers.pyx":188 - * cdef double[3] shift - * cdef double[3] comslt - * cdef int i, j, k, nmol = com.shape[0] # <<<<<<<<<<<<<< - * cdef double [:,:] R = np.zeros((3,3)) - * cdef double tmpx, tmpy, tmpz + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_v_nmol = (__pyx_v_com.shape[0]); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/helpers/helpers.pyx":189 - * cdef double[3] comslt - * cdef int i, j, k, nmol = com.shape[0] - * cdef double [:,:] R = np.zeros((3,3)) # <<<<<<<<<<<<<< - * cdef double tmpx, tmpy, tmpz + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_tuple_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple_); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_R = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; - /* "src/helpers/helpers.pyx":192 - * cdef double tmpx, tmpy, tmpz +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_allocate_buffer", 0); + + /* "View.MemoryView":254 + * cdef PyObject **p * - * for j in range(3): # <<<<<<<<<<<<<< - * comslt[j] = com[isolute,j] + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: + */ + __pyx_v_self->free_data = 1; + + /* "View.MemoryView":255 * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." */ - for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) { - __pyx_v_j = __pyx_t_5; + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); - /* "src/helpers/helpers.pyx":193 + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." * - * for j in range(3): - * comslt[j] = com[isolute,j] # <<<<<<<<<<<<<< + */ + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":257 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: + */ + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 257, __pyx_L1_error) + + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." * - * for i in range(nmol): */ - __pyx_t_6 = __pyx_v_isolute; - __pyx_t_7 = __pyx_v_j; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_com.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_com.shape[1]; - (__pyx_v_comslt[__pyx_v_j]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_6 * __pyx_v_com.strides[0]) ) + __pyx_t_7 * __pyx_v_com.strides[1]) ))); } - /* "src/helpers/helpers.pyx":195 - * comslt[j] = com[isolute,j] + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." * - * for i in range(nmol): # <<<<<<<<<<<<<< - * for j in range(3): - * com[i,j] -= comslt[j] + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - __pyx_t_5 = __pyx_v_nmol; - __pyx_t_8 = __pyx_t_5; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + if (__pyx_v_self->dtype_is_object) { - /* "src/helpers/helpers.pyx":196 + /* "View.MemoryView":260 * - * for i in range(nmol): - * for j in range(3): # <<<<<<<<<<<<<< - * com[i,j] -= comslt[j] - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None */ - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_j = __pyx_t_10; + __pyx_v_p = ((PyObject **)__pyx_v_self->data); - /* "src/helpers/helpers.pyx":197 - * for i in range(nmol): - * for j in range(3): - * com[i,j] -= comslt[j] # <<<<<<<<<<<<<< - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) - * com[i,j] -= shift[j] + /* "View.MemoryView":261 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) */ - __pyx_t_7 = __pyx_v_i; - __pyx_t_6 = __pyx_v_j; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_com.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_com.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_7 * __pyx_v_com.strides[0]) ) + __pyx_t_6 * __pyx_v_com.strides[1]) )) -= (__pyx_v_comslt[__pyx_v_j]); + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/helpers.pyx":198 - * for j in range(3): - * com[i,j] -= comslt[j] - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) # <<<<<<<<<<<<<< - * com[i,j] -= shift[j] - * + /* "View.MemoryView":262 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 */ - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = __pyx_v_j; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_com.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_com.shape[1]; - __pyx_t_11 = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_6 * __pyx_v_com.strides[0]) ) + __pyx_t_7 * __pyx_v_com.strides[1]) ))); - if (unlikely(__pyx_v_boxl == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 198, __pyx_L1_error) - } - (__pyx_v_shift[__pyx_v_j]) = (__pyx_v_boxl * floor(((__pyx_t_11 / __pyx_v_boxl) + 0.5))); + (__pyx_v_p[__pyx_v_i]) = Py_None; - /* "src/helpers/helpers.pyx":199 - * com[i,j] -= comslt[j] - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) - * com[i,j] -= shift[j] # <<<<<<<<<<<<<< + /* "View.MemoryView":263 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 * - * for k in range(rfa[i], rfa[i] + apr[i]): */ - __pyx_t_7 = __pyx_v_i; - __pyx_t_6 = __pyx_v_j; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_com.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_com.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_7 * __pyx_v_com.strides[0]) ) + __pyx_t_6 * __pyx_v_com.strides[1]) )) -= (__pyx_v_shift[__pyx_v_j]); + Py_INCREF(Py_None); } - /* "src/helpers/helpers.pyx":201 - * com[i,j] -= shift[j] + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." * - * for k in range(rfa[i], rfa[i] + apr[i]): # <<<<<<<<<<<<<< - * for j in range(3): - * coor[k,j] -= comslt[j] - shift[j] + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - __pyx_t_6 = __pyx_v_i; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rfa.shape[0]; - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_apr.shape[0]; - __pyx_t_10 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_6 * __pyx_v_rfa.strides[0]) ))) + (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_7 * __pyx_v_apr.strides[0]) )))); - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_rfa.shape[0]; - __pyx_t_12 = __pyx_t_10; - for (__pyx_t_13 = (*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_7 * __pyx_v_rfa.strides[0]) ))); __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_k = __pyx_t_13; + } - /* "src/helpers/helpers.pyx":202 + /* "View.MemoryView":264 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< * - * for k in range(rfa[i], rfa[i] + apr[i]): - * for j in range(3): # <<<<<<<<<<<<<< - * coor[k,j] -= comslt[j] - shift[j] * */ - for (__pyx_t_14 = 0; __pyx_t_14 < 3; __pyx_t_14+=1) { - __pyx_v_j = __pyx_t_14; + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":203 - * for k in range(rfa[i], rfa[i] + apr[i]): - * for j in range(3): - * coor[k,j] -= comslt[j] - shift[j] # <<<<<<<<<<<<<< + /* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * * - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) */ - __pyx_t_6 = __pyx_v_k; - __pyx_t_15 = __pyx_v_j; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_6 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) )) -= ((__pyx_v_comslt[__pyx_v_j]) - (__pyx_v_shift[__pyx_v_j])); - } - } - } - /* "src/helpers/helpers.pyx":205 - * coor[k,j] -= comslt[j] - shift[j] + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":268 * - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) # <<<<<<<<<<<<<< + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + */ + +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":270 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< * - * for i in prange(coor.shape[0], nogil=True): + * if buf is NULL: */ - __pyx_t_7 = 0; - __pyx_t_15 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_R.shape[1]; - __pyx_t_6 = 0; - __pyx_t_16 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coorA.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coorA.shape[1]; - __pyx_t_17 = 0; - __pyx_t_18 = 0; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coorB.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coorB.shape[1]; - GetRotation((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_7 * __pyx_v_R.strides[0]) ) + __pyx_t_15 * __pyx_v_R.strides[1]) )))), (__pyx_v_coorA.shape[0]), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorA.data + __pyx_t_6 * __pyx_v_coorA.strides[0]) ) + __pyx_t_16 * __pyx_v_coorA.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorB.data + __pyx_t_17 * __pyx_v_coorB.strides[0]) ) + __pyx_t_18 * __pyx_v_coorB.strides[1]) )))), 0); + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_n_s_fortran); + __pyx_t_1 = __pyx_n_s_fortran; + } else { + __Pyx_INCREF(__pyx_n_s_c); + __pyx_t_1 = __pyx_n_s_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/helpers.pyx":207 - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. * - * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - if (unlikely(!__pyx_v_coor.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("coor"); __PYX_ERR(0, 207, __pyx_L14_error) } - __pyx_t_19 = (__pyx_v_coor.shape[0]); - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_21 = (__pyx_t_19 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_21 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_6, __pyx_t_7) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_tmpx) lastprivate(__pyx_v_tmpy) lastprivate(__pyx_v_tmpz) - #endif /* _OPENMP */ - for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_21; __pyx_t_20++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_20); - /* Initialize private variables to invalid values */ - __pyx_v_tmpx = ((double)__PYX_NAN()); - __pyx_v_tmpy = ((double)__PYX_NAN()); - __pyx_v_tmpz = ((double)__PYX_NAN()); + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":208 + /* "View.MemoryView":273 * - * for i in prange(coor.shape[0], nogil=True): - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] # <<<<<<<<<<<<<< - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) */ - __pyx_t_18 = 0; - __pyx_t_17 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_R.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[1]; - __pyx_t_16 = __pyx_v_i; - __pyx_t_6 = 0; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[1]; - __pyx_t_15 = 0; - __pyx_t_7 = 1; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_R.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[1]; - __pyx_t_22 = __pyx_v_i; - __pyx_t_23 = 1; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_coor.shape[1]; - __pyx_t_24 = 0; - __pyx_t_25 = 2; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_R.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_R.shape[1]; - __pyx_t_26 = __pyx_v_i; - __pyx_t_27 = 2; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; - __pyx_v_tmpx = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_18 * __pyx_v_R.strides[0]) ) + __pyx_t_17 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_16 * __pyx_v_coor.strides[0]) ) + __pyx_t_6 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_15 * __pyx_v_R.strides[0]) ) + __pyx_t_7 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_22 * __pyx_v_coor.strides[0]) ) + __pyx_t_23 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_24 * __pyx_v_R.strides[0]) ) + __pyx_t_25 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) ))))); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/helpers.pyx":209 - * for i in prange(coor.shape[0], nogil=True): - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] # <<<<<<<<<<<<<< - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - __pyx_t_27 = 1; - __pyx_t_26 = 0; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_R.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_R.shape[1]; - __pyx_t_25 = __pyx_v_i; - __pyx_t_24 = 0; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_coor.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_coor.shape[1]; - __pyx_t_23 = 1; - __pyx_t_22 = 1; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_R.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_R.shape[1]; - __pyx_t_7 = __pyx_v_i; - __pyx_t_15 = 1; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - __pyx_t_6 = 1; - __pyx_t_16 = 2; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_R.shape[1]; - __pyx_t_17 = __pyx_v_i; - __pyx_t_18 = 2; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_v_tmpy = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_27 * __pyx_v_R.strides[0]) ) + __pyx_t_26 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_25 * __pyx_v_coor.strides[0]) ) + __pyx_t_24 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_23 * __pyx_v_R.strides[0]) ) + __pyx_t_22 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_7 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_6 * __pyx_v_R.strides[0]) ) + __pyx_t_16 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))))); - - /* "src/helpers/helpers.pyx":210 - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] # <<<<<<<<<<<<<< - * coor[i,0] = tmpx - * coor[i,1] = tmpy - */ - __pyx_t_18 = 2; - __pyx_t_17 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_R.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[1]; - __pyx_t_16 = __pyx_v_i; - __pyx_t_6 = 0; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[1]; - __pyx_t_15 = 2; - __pyx_t_7 = 1; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_R.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[1]; - __pyx_t_22 = __pyx_v_i; - __pyx_t_23 = 1; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_coor.shape[1]; - __pyx_t_24 = 2; - __pyx_t_25 = 2; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_R.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_R.shape[1]; - __pyx_t_26 = __pyx_v_i; - __pyx_t_27 = 2; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; - __pyx_v_tmpz = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_18 * __pyx_v_R.strides[0]) ) + __pyx_t_17 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_16 * __pyx_v_coor.strides[0]) ) + __pyx_t_6 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_15 * __pyx_v_R.strides[0]) ) + __pyx_t_7 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_22 * __pyx_v_coor.strides[0]) ) + __pyx_t_23 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_24 * __pyx_v_R.strides[0]) ) + __pyx_t_25 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) ))))); - - /* "src/helpers/helpers.pyx":211 - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx # <<<<<<<<<<<<<< - * coor[i,1] = tmpy - * coor[i,2] = tmpz - */ - __pyx_t_27 = __pyx_v_i; - __pyx_t_26 = 0; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_27 * __pyx_v_coor.strides[0]) ) + __pyx_t_26 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpx; + goto __pyx_L3; + } - /* "src/helpers/helpers.pyx":212 - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx - * coor[i,1] = tmpy # <<<<<<<<<<<<<< - * coor[i,2] = tmpz + /* "View.MemoryView":275 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf * */ - __pyx_t_26 = __pyx_v_i; - __pyx_t_27 = 1; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpy; + /*else*/ { + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode)) __PYX_ERR(1, 275, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 275, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/helpers.pyx":213 - * coor[i,0] = tmpx - * coor[i,1] = tmpy - * coor[i,2] = tmpz # <<<<<<<<<<<<<< + /* "View.MemoryView":276 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * return result */ - __pyx_t_27 = __pyx_v_i; - __pyx_t_26 = 2; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_27 * __pyx_v_coor.strides[0]) ) + __pyx_t_26 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpz; - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_v_result->data = __pyx_v_buf; + } + __pyx_L3:; - /* "src/helpers/helpers.pyx":207 - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) + /* "View.MemoryView":278 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * * - * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L15; - } - __pyx_L14_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L15:; - } - } + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":168 + /* "View.MemoryView":268 * - * @cython.boundscheck(False) - * def centerOrientBox(double [:,:] com, double [:,:] coor, double boxl, int isolute, # <<<<<<<<<<<<<< - * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): - * """ + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); - __Pyx_AddTraceback("newanalysis.helpers.centerOrientBox", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_R, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_com, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coorA, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coorB, 1); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":216 - * - * @cython.boundscheck(False) - * def centerToPointOrientBox(double [:,:] com, double [:,:] coor, double [:] center, double boxl, # <<<<<<<<<<<<<< - * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): - * """ +/* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_17centerToPointOrientBox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_16centerToPointOrientBox[] = "\n centerOrientToPointBox(com, xyz, center, boxlength, atoms_per_residue, residue_first_atom, coorA, coorB)\n\n Centers the box to the center of mass of a given molecule and rotates the box so that two sets of coordinates\n are as identical as possible.\n\n Args:\n com .. centers of mass of all molecules in the box\n xyz .. coordinates of all atoms\n boxlength .. edge length of the cubic box\n atoms_per_residue .. array showing how many atoms each residue contains\n residue_first_atom .. index of the first atom of each residue\n coorA .. template coordinates\n coorB .. corresponding coordinates of the current frame\n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_17centerToPointOrientBox = {"centerToPointOrientBox", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_17centerToPointOrientBox, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_16centerToPointOrientBox}; -static PyObject *__pyx_pw_11newanalysis_7helpers_17centerToPointOrientBox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_com = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_center = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxl; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coorA = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coorB = { 0, 0, { 0 }, { 0 }, { 0 } }; +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("centerToPointOrientBox (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 304, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_com,&__pyx_n_s_coor,&__pyx_n_s_center,&__pyx_n_s_boxl,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_coorA,&__pyx_n_s_coorB,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_com)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 1); __PYX_ERR(0, 216, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_center)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 2); __PYX_ERR(0, 216, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 3); __PYX_ERR(0, 216, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 4); __PYX_ERR(0, 216, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 5); __PYX_ERR(0, 216, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coorA)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 6); __PYX_ERR(0, 216, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coorB)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 7); __PYX_ERR(0, 216, __pyx_L3_error) + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "centerToPointOrientBox") < 0)) __PYX_ERR(0, 216, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 304, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } - __pyx_v_com = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_com.memview)) __PYX_ERR(0, 216, __pyx_L3_error) - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 216, __pyx_L3_error) - __pyx_v_center = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_center.memview)) __PYX_ERR(0, 216, __pyx_L3_error) - __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 217, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 217, __pyx_L3_error) - __pyx_v_coorA = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorA.memview)) __PYX_ERR(0, 217, __pyx_L3_error) - __pyx_v_coorB = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorB.memview)) __PYX_ERR(0, 217, __pyx_L3_error) + __pyx_v_name = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 304, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.centerToPointOrientBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_16centerToPointOrientBox(__pyx_self, __pyx_v_com, __pyx_v_coor, __pyx_v_center, __pyx_v_boxl, __pyx_v_apr, __pyx_v_rfa, __pyx_v_coorA, __pyx_v_coorB); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_16centerToPointOrientBox(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_com, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_center, double __pyx_v_boxl, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, __Pyx_memviewslice __pyx_v_coorA, __Pyx_memviewslice __pyx_v_coorB) { - double __pyx_v_shift[3]; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_nmol; - __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_tmpx; - double __pyx_v_tmpy; - double __pyx_v_tmpz; - PyObject *__pyx_r = NULL; +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - double __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("centerToPointOrientBox", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "src/helpers/helpers.pyx":234 - * """ - * cdef double[3] shift - * cdef int i, j, k, nmol = com.shape[0] # <<<<<<<<<<<<<< - * cdef double [:,:] R = np.zeros((3,3)) - * cdef double tmpx, tmpy, tmpz + /* "View.MemoryView":305 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name */ - __pyx_v_nmol = (__pyx_v_com.shape[0]); + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; - /* "src/helpers/helpers.pyx":235 - * cdef double[3] shift - * cdef int i, j, k, nmol = com.shape[0] - * cdef double [:,:] R = np.zeros((3,3)) # <<<<<<<<<<<<<< - * cdef double tmpx, tmpy, tmpz - * + /* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_tuple_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple_); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_R = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; - /* "src/helpers/helpers.pyx":238 - * cdef double tmpx, tmpy, tmpz - * - * for i in range(nmol): # <<<<<<<<<<<<<< - * for j in range(3): - * com[i,j] -= center[j] - */ - __pyx_t_5 = __pyx_v_nmol; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":239 +/* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name * - * for i in range(nmol): - * for j in range(3): # <<<<<<<<<<<<<< - * com[i,j] -= center[j] - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) */ - for (__pyx_t_8 = 0; __pyx_t_8 < 3; __pyx_t_8+=1) { - __pyx_v_j = __pyx_t_8; - /* "src/helpers/helpers.pyx":240 - * for i in range(nmol): - * for j in range(3): - * com[i,j] -= center[j] # <<<<<<<<<<<<<< - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) - * com[i,j] -= shift[j] - */ - __pyx_t_9 = __pyx_v_j; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_center.shape[0]; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = __pyx_v_j; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_com.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_com.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_10 * __pyx_v_com.strides[0]) ) + __pyx_t_11 * __pyx_v_com.strides[1]) )) -= (*((double *) ( /* dim=0 */ (__pyx_v_center.data + __pyx_t_9 * __pyx_v_center.strides[0]) ))); +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - /* "src/helpers/helpers.pyx":241 - * for j in range(3): - * com[i,j] -= center[j] - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) # <<<<<<<<<<<<<< - * com[i,j] -= shift[j] - * - */ - __pyx_t_9 = __pyx_v_i; - __pyx_t_11 = __pyx_v_j; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_com.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_com.shape[1]; - __pyx_t_12 = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_9 * __pyx_v_com.strides[0]) ) + __pyx_t_11 * __pyx_v_com.strides[1]) ))); - if (unlikely(__pyx_v_boxl == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 241, __pyx_L1_error) - } - (__pyx_v_shift[__pyx_v_j]) = (__pyx_v_boxl * floor(((__pyx_t_12 / __pyx_v_boxl) + 0.5))); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":242 - * com[i,j] -= center[j] - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) - * com[i,j] -= shift[j] # <<<<<<<<<<<<<< - * - * for k in range(rfa[i], rfa[i] + apr[i]): - */ - __pyx_t_11 = __pyx_v_i; - __pyx_t_9 = __pyx_v_j; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_com.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_com.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_11 * __pyx_v_com.strides[0]) ) + __pyx_t_9 * __pyx_v_com.strides[1]) )) -= (__pyx_v_shift[__pyx_v_j]); - } +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/helpers/helpers.pyx":244 - * com[i,j] -= shift[j] + /* "View.MemoryView":307 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< * - * for k in range(rfa[i], rfa[i] + apr[i]): # <<<<<<<<<<<<<< - * for j in range(3): - * coor[k,j] -= center[j] - shift[j] + * cdef generic = Enum("") */ - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_rfa.shape[0]; - __pyx_t_11 = __pyx_v_i; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_apr.shape[0]; - __pyx_t_8 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_9 * __pyx_v_rfa.strides[0]) ))) + (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_11 * __pyx_v_apr.strides[0]) )))); - __pyx_t_11 = __pyx_v_i; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_rfa.shape[0]; - __pyx_t_13 = __pyx_t_8; - for (__pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_11 * __pyx_v_rfa.strides[0]) ))); __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_k = __pyx_t_14; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":245 - * - * for k in range(rfa[i], rfa[i] + apr[i]): - * for j in range(3): # <<<<<<<<<<<<<< - * coor[k,j] -= center[j] - shift[j] + /* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name * */ - for (__pyx_t_15 = 0; __pyx_t_15 < 3; __pyx_t_15+=1) { - __pyx_v_j = __pyx_t_15; - /* "src/helpers/helpers.pyx":246 - * for k in range(rfa[i], rfa[i] + apr[i]): - * for j in range(3): - * coor[k,j] -= center[j] - shift[j] # <<<<<<<<<<<<<< - * - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) - */ - __pyx_t_9 = __pyx_v_j; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_center.shape[0]; - __pyx_t_10 = __pyx_v_k; - __pyx_t_16 = __pyx_v_j; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) )) -= ((*((double *) ( /* dim=0 */ (__pyx_v_center.data + __pyx_t_9 * __pyx_v_center.strides[0]) ))) - (__pyx_v_shift[__pyx_v_j])); - } - } - } + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":248 - * coor[k,j] -= center[j] - shift[j] - * - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) # <<<<<<<<<<<<<< - * - * for i in prange(coor.shape[0], nogil=True): +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - __pyx_t_11 = 0; - __pyx_t_9 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_R.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[1]; - __pyx_t_16 = 0; - __pyx_t_10 = 0; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coorA.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coorA.shape[1]; - __pyx_t_17 = 0; - __pyx_t_18 = 0; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coorB.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coorB.shape[1]; - GetRotation((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_11 * __pyx_v_R.strides[0]) ) + __pyx_t_9 * __pyx_v_R.strides[1]) )))), (__pyx_v_coorA.shape[0]), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorA.data + __pyx_t_16 * __pyx_v_coorA.strides[0]) ) + __pyx_t_10 * __pyx_v_coorA.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorB.data + __pyx_t_17 * __pyx_v_coorB.strides[0]) ) + __pyx_t_18 * __pyx_v_coorB.strides[1]) )))), 0); - /* "src/helpers/helpers.pyx":250 - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) - * - * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - if (unlikely(!__pyx_v_coor.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("coor"); __PYX_ERR(0, 250, __pyx_L12_error) } - __pyx_t_19 = (__pyx_v_coor.shape[0]); - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_21 = (__pyx_t_19 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_21 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_tmpx) lastprivate(__pyx_v_tmpy) lastprivate(__pyx_v_tmpz) - #endif /* _OPENMP */ - for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_21; __pyx_t_20++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_20); - /* Initialize private variables to invalid values */ - __pyx_v_tmpx = ((double)__PYX_NAN()); - __pyx_v_tmpy = ((double)__PYX_NAN()); - __pyx_v_tmpz = ((double)__PYX_NAN()); +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - /* "src/helpers/helpers.pyx":251 - * - * for i in prange(coor.shape[0], nogil=True): - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] # <<<<<<<<<<<<<< - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: */ - __pyx_t_18 = 0; - __pyx_t_17 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_R.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[1]; - __pyx_t_10 = __pyx_v_i; - __pyx_t_16 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; - __pyx_t_9 = 0; - __pyx_t_11 = 1; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_R.shape[1]; - __pyx_t_22 = __pyx_v_i; - __pyx_t_23 = 1; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_coor.shape[1]; - __pyx_t_24 = 0; - __pyx_t_25 = 2; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_R.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_R.shape[1]; - __pyx_t_26 = __pyx_v_i; - __pyx_t_27 = 2; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; - __pyx_v_tmpx = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_18 * __pyx_v_R.strides[0]) ) + __pyx_t_17 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_9 * __pyx_v_R.strides[0]) ) + __pyx_t_11 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_22 * __pyx_v_coor.strides[0]) ) + __pyx_t_23 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_24 * __pyx_v_R.strides[0]) ) + __pyx_t_25 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) ))))); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/helpers.pyx":252 - * for i in prange(coor.shape[0], nogil=True): - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] # <<<<<<<<<<<<<< - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) */ - __pyx_t_27 = 1; - __pyx_t_26 = 0; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_R.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_R.shape[1]; - __pyx_t_25 = __pyx_v_i; - __pyx_t_24 = 0; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_coor.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_coor.shape[1]; - __pyx_t_23 = 1; - __pyx_t_22 = 1; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_R.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_R.shape[1]; - __pyx_t_11 = __pyx_v_i; - __pyx_t_9 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; - __pyx_t_16 = 1; - __pyx_t_10 = 2; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_R.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_R.shape[1]; - __pyx_t_17 = __pyx_v_i; - __pyx_t_18 = 2; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_v_tmpy = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_27 * __pyx_v_R.strides[0]) ) + __pyx_t_26 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_25 * __pyx_v_coor.strides[0]) ) + __pyx_t_24 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_23 * __pyx_v_R.strides[0]) ) + __pyx_t_22 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_11 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_16 * __pyx_v_R.strides[0]) ) + __pyx_t_10 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))))); + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/helpers.pyx":253 - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] # <<<<<<<<<<<<<< - * coor[i,0] = tmpx - * coor[i,1] = tmpy + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - __pyx_t_18 = 2; - __pyx_t_17 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_R.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[1]; - __pyx_t_10 = __pyx_v_i; - __pyx_t_16 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; - __pyx_t_9 = 2; - __pyx_t_11 = 1; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_R.shape[1]; - __pyx_t_22 = __pyx_v_i; - __pyx_t_23 = 1; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_coor.shape[1]; - __pyx_t_24 = 2; - __pyx_t_25 = 2; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_R.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_R.shape[1]; - __pyx_t_26 = __pyx_v_i; - __pyx_t_27 = 2; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; - __pyx_v_tmpz = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_18 * __pyx_v_R.strides[0]) ) + __pyx_t_17 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_9 * __pyx_v_R.strides[0]) ) + __pyx_t_11 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_22 * __pyx_v_coor.strides[0]) ) + __pyx_t_23 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_24 * __pyx_v_R.strides[0]) ) + __pyx_t_25 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) ))))); + __pyx_t_2 = (__pyx_v__dict != Py_None); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":254 - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx # <<<<<<<<<<<<<< - * coor[i,1] = tmpy - * coor[i,2] = tmpz + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: */ - __pyx_t_27 = __pyx_v_i; - __pyx_t_26 = 0; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_27 * __pyx_v_coor.strides[0]) ) + __pyx_t_26 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpx; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "src/helpers/helpers.pyx":255 - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx - * coor[i,1] = tmpy # <<<<<<<<<<<<<< - * coor[i,2] = tmpz - * + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.name is not None */ - __pyx_t_26 = __pyx_v_i; - __pyx_t_27 = 1; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpy; + __pyx_v_use_setstate = 1; - /* "src/helpers/helpers.pyx":256 - * coor[i,0] = tmpx - * coor[i,1] = tmpy - * coor[i,2] = tmpz # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - __pyx_t_27 = __pyx_v_i; - __pyx_t_26 = 2; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_27 * __pyx_v_coor.strides[0]) ) + __pyx_t_26 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpz; - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + goto __pyx_L3; + } - /* "src/helpers/helpers.pyx":250 - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) - * - * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = self.name is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L13; - } - __pyx_L12_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L13:; - } + /*else*/ { + __pyx_t_2 = (__pyx_v_self->name != Py_None); + __pyx_v_use_setstate = __pyx_t_2; } + __pyx_L3:; - /* "src/helpers/helpers.pyx":216 - * - * @cython.boundscheck(False) - * def centerToPointOrientBox(double [:,:] com, double [:,:] coor, double [:] center, double boxl, # <<<<<<<<<<<<<< - * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): - * """ + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + */ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = self.name is not None + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + */ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); - __Pyx_AddTraceback("newanalysis.helpers.centerToPointOrientBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_R, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_com, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_center, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coorA, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coorB, 1); + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":259 - * - * @cython.boundscheck(False) - * def calcEnergyAA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules) +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_19calcEnergyAA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_18calcEnergyAA[] = "\n energy = calcEnergyAA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules)\n\n Calculates the solvation energy of a solute in any solvent for a specific coordinate set.\n \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_19calcEnergyAA = {"calcEnergyAA", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_19calcEnergyAA, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_18calcEnergyAA}; -static PyObject *__pyx_pw_11newanalysis_7helpers_19calcEnergyAA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_isolute; - int __pyx_v_nmol; +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcEnergyAA (wrapper)", 0); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 16, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, 1); __PYX_ERR(0, 259, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, 2); __PYX_ERR(0, 259, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, 3); __PYX_ERR(0, 259, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, 4); __PYX_ERR(0, 259, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, 5); __PYX_ERR(0, 259, __pyx_L3_error) + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcEnergyAA") < 0)) __PYX_ERR(0, 259, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 259, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 259, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 259, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 259, __pyx_L3_error) - __pyx_v_isolute = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error) - __pyx_v_nmol = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error) + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 259, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAA", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_18calcEnergyAA(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol); + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_18calcEnergyAA(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_idx; - int __pyx_v_idx2; - __Pyx_memviewslice __pyx_v_epa = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_r; - PyObject *__pyx_v_energy = NULL; +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - double __pyx_t_20; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcEnergyAA", 0); + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/helpers/helpers.pyx":267 - * """ - * cdef int i, j, k, idx, idx2 - * cdef double [:] epa = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, r - * + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_epa = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - /* "src/helpers/helpers.pyx":270 - * cdef double dx, dy, dz, r - * - * energy = 0.0 # <<<<<<<<<<<<<< + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo * - * # loop over solute atoms - */ - __Pyx_INCREF(__pyx_float_0_0); - __pyx_v_energy = __pyx_float_0_0; - - /* "src/helpers/helpers.pyx":274 - * # loop over solute atoms - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * idx = rfa[isolute] + i - * # loop over solvent molecules - */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_7 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - - /* "src/helpers/helpers.pyx":275 - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): - * idx = rfa[isolute] + i # <<<<<<<<<<<<<< - * # loop over solvent molecules - * for j in range(nmol): - */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); - - /* "src/helpers/helpers.pyx":277 - * idx = rfa[isolute] + i - * # loop over solvent molecules - * for j in range(nmol): # <<<<<<<<<<<<<< - * if j == isolute: - * continue - */ - __pyx_t_10 = __pyx_v_nmol; - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; - - /* "src/helpers/helpers.pyx":278 - * # loop over solvent molecules - * for j in range(nmol): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): - */ - __pyx_t_13 = ((__pyx_v_j == __pyx_v_isolute) != 0); - if (__pyx_t_13) { - - /* "src/helpers/helpers.pyx":279 - * for j in range(nmol): - * if j == isolute: - * continue # <<<<<<<<<<<<<< - * for k in range(apr[j]): - * idx2 = rfa[j] + k - */ - goto __pyx_L5_continue; - - /* "src/helpers/helpers.pyx":278 - * # loop over solvent molecules - * for j in range(nmol): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): - */ - } - - /* "src/helpers/helpers.pyx":280 - * if j == isolute: - * continue - * for k in range(apr[j]): # <<<<<<<<<<<<<< - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] - */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { - __pyx_v_k = __pyx_t_16; - - /* "src/helpers/helpers.pyx":281 - * continue - * for k in range(apr[j]): - * idx2 = rfa[j] + k # <<<<<<<<<<<<<< - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] - */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); - - /* "src/helpers/helpers.pyx":282 - * for k in range(apr[j]): - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] - */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_17 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[1]; - __pyx_t_18 = __pyx_v_idx2; - __pyx_t_19 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_17 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )))); - - /* "src/helpers/helpers.pyx":283 - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - */ - __pyx_t_19 = __pyx_v_idx; - __pyx_t_18 = 1; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_17 = __pyx_v_idx2; - __pyx_t_4 = 1; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); - - /* "src/helpers/helpers.pyx":284 - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< - * r = sqrt(dx*dx + dy*dy + dz*dz) - * epa[i] += charges[idx] * charges[idx2] / r - */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_17 = 2; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[1]; - __pyx_t_18 = __pyx_v_idx2; - __pyx_t_19 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_17 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )))); - - /* "src/helpers/helpers.pyx":285 - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< - * epa[i] += charges[idx] * charges[idx2] / r - * - */ - __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - - /* "src/helpers/helpers.pyx":286 - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - * epa[i] += charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< - * - * for i in range(apr[isolute]): - */ - __pyx_t_19 = __pyx_v_idx; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; - __pyx_t_18 = __pyx_v_idx2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_charges.shape[0]; - __pyx_t_20 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_18 * __pyx_v_charges.strides[0]) )))); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 286, __pyx_L1_error) - } - __pyx_t_18 = __pyx_v_i; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_epa.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_18 * __pyx_v_epa.strides[0]) )) += (__pyx_t_20 / __pyx_v_r); - } - __pyx_L5_continue:; - } - } - - /* "src/helpers/helpers.pyx":288 - * epa[i] += charges[idx] * charges[idx2] / r - * - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * energy += epa[i] - * - */ - __pyx_t_18 = __pyx_v_isolute; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_apr.shape[0]; - __pyx_t_7 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_18 * __pyx_v_apr.strides[0]) ))); - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - - /* "src/helpers/helpers.pyx":289 - * - * for i in range(apr[isolute]): - * energy += epa[i] # <<<<<<<<<<<<<< - * - * return energy * 1390.02 - */ - __pyx_t_18 = __pyx_v_i; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_epa.shape[0]; - __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_18 * __pyx_v_epa.strides[0]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_energy, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_energy, __pyx_t_3); - __pyx_t_3 = 0; - } - - /* "src/helpers/helpers.pyx":291 - * energy += epa[i] - * - * return energy * 1390.02 # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyNumber_Multiply(__pyx_v_energy, __pyx_float_1390_02); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "src/helpers/helpers.pyx":259 - * - * @cython.boundscheck(False) - * def calcEnergyAA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAA", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_epa, 1); - __Pyx_XDECREF(__pyx_v_energy); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/helpers.pyx":294 - * - * @cython.boundscheck(False) - * def calcEnergyMuA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double [:] mu_solute): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyMuA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,mu_solute) + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_21calcEnergyMuA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_20calcEnergyMuA[] = "\n energy = calcEnergyMuA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,mu_solute)\n\n Calculates the solvation energy of a solute in any solvent for a specific coordinate set.\n \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_21calcEnergyMuA = {"calcEnergyMuA", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_21calcEnergyMuA, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_20calcEnergyMuA}; -static PyObject *__pyx_pw_11newanalysis_7helpers_21calcEnergyMuA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_isolute; - int __pyx_v_nmol; - __Pyx_memviewslice __pyx_v_mu_solute = { 0, 0, { 0 }, { 0 }, { 0 } }; +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcEnergyMuA (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 349, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_mu_solute,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 1); __PYX_ERR(0, 294, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 2); __PYX_ERR(0, 294, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 3); __PYX_ERR(0, 294, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 4); __PYX_ERR(0, 294, __pyx_L3_error) + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmol)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 5); __PYX_ERR(0, 294, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 349, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mu_solute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 6); __PYX_ERR(0, 294, __pyx_L3_error) + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype_is_object); + if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcEnergyMuA") < 0)) __PYX_ERR(0, 294, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 349, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 294, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 294, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 294, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 294, __pyx_L3_error) - __pyx_v_isolute = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L3_error) - __pyx_v_nmol = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L3_error) - __pyx_v_mu_solute = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mu_solute.memview)) __PYX_ERR(0, 294, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 294, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 349, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyMuA", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_20calcEnergyMuA(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_mu_solute); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_20calcEnergyMuA(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, __Pyx_memviewslice __pyx_v_mu_solute) { - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_idx2; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_r; - double __pyx_v_energy; - PyObject *__pyx_r = NULL; +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - double __pyx_t_12; - double __pyx_t_13; - PyObject *__pyx_t_14 = NULL; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcEnergyMuA", 0); + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "src/helpers/helpers.pyx":304 - * cdef double dx, dy, dz, r, energy - * - * energy = 0.0 # <<<<<<<<<<<<<< + /* "View.MemoryView":350 * - * # loop over solvent molecules + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: */ - __pyx_v_energy = 0.0; + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; - /* "src/helpers/helpers.pyx":307 - * - * # loop over solvent molecules - * for j in range(nmol): # <<<<<<<<<<<<<< - * if j == isolute: - * continue + /* "View.MemoryView":351 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) */ - __pyx_t_1 = __pyx_v_nmol; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_j = __pyx_t_3; + __pyx_v_self->flags = __pyx_v_flags; - /* "src/helpers/helpers.pyx":308 - * # loop over solvent molecules - * for j in range(nmol): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ - __pyx_t_4 = ((__pyx_v_j == __pyx_v_isolute) != 0); - if (__pyx_t_4) { + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":309 - * for j in range(nmol): - * if j == isolute: - * continue # <<<<<<<<<<<<<< - * for k in range(apr[j]): - * idx2 = rfa[j] + k + /* "View.MemoryView":353 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None */ - goto __pyx_L3_continue; + __pyx_t_3 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 353, __pyx_L1_error) - /* "src/helpers/helpers.pyx":308 - * # loop over solvent molecules - * for j in range(nmol): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) */ - } + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":310 - * if j == isolute: - * continue - * for k in range(apr[j]): # <<<<<<<<<<<<<< - * idx2 = rfa[j] + k - * dx = coor[idx2,0] + /* "View.MemoryView":355 + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * */ - __pyx_t_5 = __pyx_v_j; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_apr.shape[0]; - __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_5 * __pyx_v_apr.strides[0]) ))); - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_k = __pyx_t_8; + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - /* "src/helpers/helpers.pyx":311 - * continue - * for k in range(apr[j]): - * idx2 = rfa[j] + k # <<<<<<<<<<<<<< - * dx = coor[idx2,0] - * dy = coor[idx2,1] + /* "View.MemoryView":356 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): */ - __pyx_t_5 = __pyx_v_j; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_rfa.shape[0]; - __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_5 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); + Py_INCREF(Py_None); - /* "src/helpers/helpers.pyx":312 - * for k in range(apr[j]): - * idx2 = rfa[j] + k - * dx = coor[idx2,0] # <<<<<<<<<<<<<< - * dy = coor[idx2,1] - * dz = coor[idx2,2] + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) */ - __pyx_t_5 = __pyx_v_idx2; - __pyx_t_9 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; - __pyx_v_dx = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_5 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))); + } - /* "src/helpers/helpers.pyx":313 - * idx2 = rfa[j] + k - * dx = coor[idx2,0] - * dy = coor[idx2,1] # <<<<<<<<<<<<<< - * dz = coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ - __pyx_t_9 = __pyx_v_idx2; - __pyx_t_5 = 1; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor.shape[1]; - __pyx_v_dy = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_5 * __pyx_v_coor.strides[1]) ))); + } - /* "src/helpers/helpers.pyx":314 - * dx = coor[idx2,0] - * dy = coor[idx2,1] - * dz = coor[idx2,2] # <<<<<<<<<<<<<< - * r = sqrt(dx*dx + dy*dy + dz*dz) + /* "View.MemoryView":358 + * Py_INCREF(Py_None) * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: */ - __pyx_t_5 = __pyx_v_idx2; - __pyx_t_9 = 2; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; - __pyx_v_dz = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_5 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))); + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":315 - * dy = coor[idx2,1] - * dz = coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< - * - * energy+=charges[idx2]*(mu_solute[0]*dx+mu_solute[1]*dy+mu_solute[2]*dz)/(r*r*r) + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 */ - __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + __pyx_t_1 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":317 - * r = sqrt(dx*dx + dy*dy + dz*dz) - * - * energy+=charges[idx2]*(mu_solute[0]*dx+mu_solute[1]*dy+mu_solute[2]*dz)/(r*r*r) # <<<<<<<<<<<<<< - * - * return energy * 1390.02 + /* "View.MemoryView":361 + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: */ - __pyx_t_9 = __pyx_v_idx2; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_charges.shape[0]; - __pyx_t_5 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_mu_solute.shape[0]; - __pyx_t_10 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mu_solute.shape[0]; - __pyx_t_11 = 2; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_mu_solute.shape[0]; - __pyx_t_12 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_9 * __pyx_v_charges.strides[0]) ))) * ((((*((double *) ( /* dim=0 */ (__pyx_v_mu_solute.data + __pyx_t_5 * __pyx_v_mu_solute.strides[0]) ))) * __pyx_v_dx) + ((*((double *) ( /* dim=0 */ (__pyx_v_mu_solute.data + __pyx_t_10 * __pyx_v_mu_solute.strides[0]) ))) * __pyx_v_dy)) + ((*((double *) ( /* dim=0 */ (__pyx_v_mu_solute.data + __pyx_t_11 * __pyx_v_mu_solute.strides[0]) ))) * __pyx_v_dz))); - __pyx_t_13 = ((__pyx_v_r * __pyx_v_r) * __pyx_v_r); - if (unlikely(__pyx_t_13 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 317, __pyx_L1_error) - } - __pyx_v_energy = (__pyx_v_energy + (__pyx_t_12 / __pyx_t_13)); - } - __pyx_L3_continue:; - } + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - /* "src/helpers/helpers.pyx":319 - * energy+=charges[idx2]*(mu_solute[0]*dx+mu_solute[1]*dy+mu_solute[2]*dz)/(r*r*r) - * - * return energy * 1390.02 # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) + /* "View.MemoryView":362 + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_14 = PyFloat_FromDouble((__pyx_v_energy * 1390.02)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 319, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_r = __pyx_t_14; - __pyx_t_14 = 0; - goto __pyx_L0; + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + */ + } + + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + */ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":364 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError + */ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * + */ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/helpers.pyx":294 + /* "View.MemoryView":366 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def calcEnergyMuA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double [:] mu_solute): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyMuA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,mu_solute) + * if flags & PyBUF_FORMAT: + */ + PyErr_NoMemory(); __PYX_ERR(1, 366, __pyx_L1_error) + + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * + */ + } + + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + */ + } + + /* "View.MemoryView":358 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + */ + } + + /* "View.MemoryView":368 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":369 + * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object + */ + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L12_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L12_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; + + /* "View.MemoryView":368 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + */ + goto __pyx_L11; + } + + /* "View.MemoryView":371 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + */ + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L11:; + + /* "View.MemoryView":373 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 373, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 373, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 373, __pyx_L1_error) + #endif + + /* "View.MemoryView":374 + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(memoryview self): + */ + __pyx_v_self->typeinfo = NULL; + + /* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyMuA", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_mu_solute, 1); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":322 +/* "View.MemoryView":376 + * self.typeinfo = NULL * - * @cython.boundscheck(False) - * def calcEnergyAApermind(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list) + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_23calcEnergyAApermind(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_22calcEnergyAApermind[] = "\n energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list)\n\n Calculates the permanent and induced part of the solvation energy of a solute in any solvent for a specific coordinate set.\n \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_23calcEnergyAApermind = {"calcEnergyAApermind", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_23calcEnergyAApermind, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_22calcEnergyAApermind}; -static PyObject *__pyx_pw_11newanalysis_7helpers_23calcEnergyAApermind(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coms = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_isolute; - int __pyx_v_first; - int __pyx_v_last; - __Pyx_memviewslice __pyx_v_drude = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcEnergyAApermind (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_coms,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_first,&__pyx_n_s_last,&__pyx_n_s_drude,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 1); __PYX_ERR(0, 322, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 2); __PYX_ERR(0, 322, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 3); __PYX_ERR(0, 322, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 4); __PYX_ERR(0, 322, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 5); __PYX_ERR(0, 322, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_first)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 6); __PYX_ERR(0, 322, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_last)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 7); __PYX_ERR(0, 322, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_drude)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 8); __PYX_ERR(0, 322, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcEnergyAApermind") < 0)) __PYX_ERR(0, 322, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 322, __pyx_L3_error) - __pyx_v_coms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms.memview)) __PYX_ERR(0, 322, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 322, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 322, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 322, __pyx_L3_error) - __pyx_v_isolute = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L3_error) - __pyx_v_first = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_first == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L3_error) - __pyx_v_last = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_last == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L3_error) - __pyx_v_drude = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_drude.memview)) __PYX_ERR(0, 322, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 322, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAApermind", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_22calcEnergyAApermind(__pyx_self, __pyx_v_coor, __pyx_v_coms, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_first, __pyx_v_last, __pyx_v_drude); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_22calcEnergyAApermind(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coms, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_first, int __pyx_v_last, __Pyx_memviewslice __pyx_v_drude) { +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_idx; - int __pyx_v_idx2; - __Pyx_memviewslice __pyx_v_epa_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_epa_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_r; - double __pyx_v_qq; - double __pyx_v_energy_perm; - double __pyx_v_energy_ind; - double __pyx_v_qq_diff; - PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - long __pyx_t_10; - long __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - double __pyx_t_20; - int __pyx_t_21; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcEnergyAApermind", 0); + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "src/helpers/helpers.pyx":330 - * """ - * cdef int i, j, k, idx, idx2, histo_error - * cdef double [:] epa_ind = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< - * cdef double [:] epa_perm = np.zeros(apr[isolute]) - * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, qq_diff + /* "View.MemoryView":377 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 330, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_epa_ind = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":331 - * cdef int i, j, k, idx, idx2, histo_error - * cdef double [:] epa_ind = np.zeros(apr[isolute]) - * cdef double [:] epa_perm = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, qq_diff + /* "View.MemoryView":378 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_3 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } + __Pyx_ReleaseBuffer((&__pyx_v_self->view)); + + /* "View.MemoryView":377 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + */ + goto __pyx_L3; } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 331, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_epa_perm = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - /* "src/helpers/helpers.pyx":334 - * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, qq_diff + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * - * energy_perm = 0.0 # <<<<<<<<<<<<<< - * energy_ind = 0.0 + * (<__pyx_buffer *> &self.view).obj = NULL + */ + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":381 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) * */ - __pyx_v_energy_perm = 0.0; + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; - /* "src/helpers/helpers.pyx":335 + /* "View.MemoryView":382 * - * energy_perm = 0.0 - * energy_ind = 0.0 # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< * - * # loop over solute atoms + * cdef int i */ - __pyx_v_energy_ind = 0.0; + Py_DECREF(Py_None); - /* "src/helpers/helpers.pyx":339 - * # loop over solute atoms - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * idx = rfa[isolute] + i - * # loop over solvent molecules + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_7 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + } + __pyx_L3:; - /* "src/helpers/helpers.pyx":340 - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): - * idx = rfa[isolute] + i # <<<<<<<<<<<<<< - * # loop over solvent molecules - * for j in range(first,last+1): + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":342 - * idx = rfa[isolute] + i - * # loop over solvent molecules - * for j in range(first,last+1): # <<<<<<<<<<<<<< - * if j == isolute: - * continue + /* "View.MemoryView":387 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 */ - __pyx_t_10 = (__pyx_v_last + 1); - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = __pyx_v_first; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/helpers.pyx":343 - * # loop over solvent molecules - * for j in range(first,last+1): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: */ - __pyx_t_13 = ((__pyx_v_j == __pyx_v_isolute) != 0); - if (__pyx_t_13) { + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":344 - * for j in range(first,last+1): - * if j == isolute: - * continue # <<<<<<<<<<<<<< - * for k in range(apr[j]): - * idx2 = rfa[j] + k + /* "View.MemoryView":389 + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( */ - goto __pyx_L5_continue; + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); - /* "src/helpers/helpers.pyx":343 - * # loop over solvent molecules - * for j in range(first,last+1): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) */ - } + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":345 - * if j == isolute: - * continue - * for k in range(apr[j]): # <<<<<<<<<<<<<< - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] + /* "View.MemoryView":392 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { - __pyx_v_k = __pyx_t_16; + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); - /* "src/helpers/helpers.pyx":346 - * continue - * for k in range(apr[j]): - * idx2 = rfa[j] + k # <<<<<<<<<<<<<< - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] + /* "View.MemoryView":391 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; - /* "src/helpers/helpers.pyx":347 - * for k in range(apr[j]): - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_17 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[1]; - __pyx_t_18 = __pyx_v_idx2; - __pyx_t_19 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_17 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )))); + } - /* "src/helpers/helpers.pyx":348 - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) + /* "View.MemoryView":393 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) */ - __pyx_t_19 = __pyx_v_idx; - __pyx_t_18 = 1; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_17 = __pyx_v_idx2; - __pyx_t_4 = 1; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); + goto __pyx_L6_break; - /* "src/helpers/helpers.pyx":349 - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< - * r = sqrt(dx*dx + dy*dy + dz*dz) - * qq = charges[idx] * charges[idx2] / r + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_17 = 2; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[1]; - __pyx_t_18 = __pyx_v_idx2; - __pyx_t_19 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_17 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )))); + } + } + /*else*/ { - /* "src/helpers/helpers.pyx":350 - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< - * qq = charges[idx] * charges[idx2] / r + /* "View.MemoryView":395 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: */ - __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; - /* "src/helpers/helpers.pyx":351 - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - * qq = charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< - * - * if drude[k]==1: + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: */ - __pyx_t_19 = __pyx_v_idx; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; - __pyx_t_18 = __pyx_v_idx2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_charges.shape[0]; - __pyx_t_20 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_18 * __pyx_v_charges.strides[0]) )))); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 351, __pyx_L1_error) - } - __pyx_v_qq = (__pyx_t_20 / __pyx_v_r); + } - /* "src/helpers/helpers.pyx":353 - * qq = charges[idx] * charges[idx2] / r + /* "View.MemoryView":376 + * self.typeinfo = NULL * - * if drude[k]==1: # <<<<<<<<<<<<<< - * epa_ind[i]+=qq - * else: + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ - __pyx_t_18 = __pyx_v_k; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_drude.shape[0]; - __pyx_t_13 = (((*((double *) ( /* dim=0 */ (__pyx_v_drude.data + __pyx_t_18 * __pyx_v_drude.strides[0]) ))) == 1.0) != 0); - if (__pyx_t_13) { - /* "src/helpers/helpers.pyx":354 - * - * if drude[k]==1: - * epa_ind[i]+=qq # <<<<<<<<<<<<<< - * else: - * epa_perm[i]+=qq - */ - __pyx_t_18 = __pyx_v_i; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_epa_ind.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_epa_ind.data + __pyx_t_18 * __pyx_v_epa_ind.strides[0]) )) += __pyx_v_qq; + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} - /* "src/helpers/helpers.pyx":353 - * qq = charges[idx] * charges[idx2] / r +/* "View.MemoryView":397 + * PyThread_free_lock(self.lock) * - * if drude[k]==1: # <<<<<<<<<<<<<< - * epa_ind[i]+=qq - * else: - */ - goto __pyx_L10; - } - - /* "src/helpers/helpers.pyx":356 - * epa_ind[i]+=qq - * else: - * epa_perm[i]+=qq # <<<<<<<<<<<<<< - * if k self.view.buf */ - __pyx_t_18 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_apr.shape[0]; - __pyx_t_21 = ((__pyx_v_k < ((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_18 * __pyx_v_apr.strides[0]) ))) - 1)) != 0); - if (__pyx_t_21) { - } else { - __pyx_t_13 = __pyx_t_21; - goto __pyx_L12_bool_binop_done; - } - __pyx_t_18 = (__pyx_v_k + 1); - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_drude.shape[0]; - __pyx_t_21 = (((*((double *) ( /* dim=0 */ (__pyx_v_drude.data + __pyx_t_18 * __pyx_v_drude.strides[0]) ))) == 1.0) != 0); - __pyx_t_13 = __pyx_t_21; - __pyx_L12_bool_binop_done:; - if (__pyx_t_13) { - /* "src/helpers/helpers.pyx":358 - * epa_perm[i]+=qq - * if k self.view.buf # <<<<<<<<<<<<<< * + * for dim, idx in enumerate(index): */ - __pyx_t_19 = __pyx_v_i; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa_ind.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_epa_ind.data + __pyx_t_19 * __pyx_v_epa_ind.strides[0]) )) -= __pyx_v_qq_diff; + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - /* "src/helpers/helpers.pyx":360 - * qq_diff=charges[idx]*charges[idx2+1] / r - * epa_ind[i] -= qq_diff - * epa_perm[i]+= qq_diff # <<<<<<<<<<<<<< + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * - * for i in range(apr[isolute]): - */ - __pyx_t_19 = __pyx_v_i; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa_perm.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_epa_perm.data + __pyx_t_19 * __pyx_v_epa_perm.strides[0]) )) += __pyx_v_qq_diff; - - /* "src/helpers/helpers.pyx":357 - * else: - * epa_perm[i]+=qq - * if k= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 401, __pyx_L1_error) } - __pyx_L10:; + break; } - __pyx_L5_continue:; + __Pyx_GOTREF(__pyx_t_5); } - } - - /* "src/helpers/helpers.pyx":362 - * epa_perm[i]+= qq_diff - * - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * energy_perm += epa_perm[i] - * energy_ind += epa_ind[i] - */ - __pyx_t_19 = __pyx_v_isolute; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_apr.shape[0]; - __pyx_t_7 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_19 * __pyx_v_apr.strides[0]) ))); - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); - /* "src/helpers/helpers.pyx":363 + /* "View.MemoryView":402 * - * for i in range(apr[isolute]): - * energy_perm += epa_perm[i] # <<<<<<<<<<<<<< - * energy_ind += epa_ind[i] + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< * + * return itemp */ - __pyx_t_19 = __pyx_v_i; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa_perm.shape[0]; - __pyx_v_energy_perm = (__pyx_v_energy_perm + (*((double *) ( /* dim=0 */ (__pyx_v_epa_perm.data + __pyx_t_19 * __pyx_v_epa_perm.strides[0]) )))); + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; - /* "src/helpers/helpers.pyx":364 - * for i in range(apr[isolute]): - * energy_perm += epa_perm[i] - * energy_ind += epa_ind[i] # <<<<<<<<<<<<<< + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * - * return energy_perm * 1390.02 , energy_ind * 1390.02 */ - __pyx_t_19 = __pyx_v_i; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa_ind.shape[0]; - __pyx_v_energy_ind = (__pyx_v_energy_ind + (*((double *) ( /* dim=0 */ (__pyx_v_epa_ind.data + __pyx_t_19 * __pyx_v_epa_ind.strides[0]) )))); } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/helpers.pyx":366 - * energy_ind += epa_ind[i] + /* "View.MemoryView":404 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< * - * return energy_perm * 1390.02 , energy_ind * 1390.02 # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_energy_perm * 1390.02)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble((__pyx_v_energy_ind * 1390.02)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_r = __pyx_v_itemp; goto __pyx_L0; - /* "src/helpers/helpers.pyx":322 + /* "View.MemoryView":397 + * PyThread_free_lock(self.lock) * - * @cython.boundscheck(False) - * def calcEnergyAApermind(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list) + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAApermind", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_epa_ind, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_epa_perm, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coms, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_drude, 1); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_idx); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":369 +/* "View.MemoryView":407 * - * @cython.boundscheck(False) - * def calcEnergyAAhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose, int[:] oxyquinol): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAAhisto(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, min_histo, max_histo, bins_hist,array indices, array indices 2) + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_25calcEnergyAAhisto(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_24calcEnergyAAhisto[] = "\n energy = calcEnergyAAhisto(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, min_histo, max_histo, bins_hist,array indices, array indices 2)\n\n Calculates the solvation energy of a solute in any solvent for a specific coordinate set.\n \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_25calcEnergyAAhisto = {"calcEnergyAAhisto", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_25calcEnergyAAhisto, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_24calcEnergyAAhisto}; -static PyObject *__pyx_pw_11newanalysis_7helpers_25calcEnergyAAhisto(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coms = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_isolute; - int __pyx_v_nmol; - double __pyx_v_histo_min; - double __pyx_v_histo_max; - int __pyx_v_histo_bins; - __Pyx_memviewslice __pyx_v_trehalose = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_oxyquinol = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcEnergyAAhisto (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_coms,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_histo_bins,&__pyx_n_s_trehalose,&__pyx_n_s_oxyquinol,0}; - PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, 1); __PYX_ERR(0, 369, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, 2); __PYX_ERR(0, 369, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, 3); __PYX_ERR(0, 369, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, 4); __PYX_ERR(0, 369, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, 5); __PYX_ERR(0, 369, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, 6); __PYX_ERR(0, 369, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_min)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, 7); __PYX_ERR(0, 369, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_max)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, 8); __PYX_ERR(0, 369, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 9: - if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_bins)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, 9); __PYX_ERR(0, 369, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 10: - if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trehalose)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, 10); __PYX_ERR(0, 369, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 11: - if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_oxyquinol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, 11); __PYX_ERR(0, 369, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcEnergyAAhisto") < 0)) __PYX_ERR(0, 369, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 12) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_v_coms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms.memview)) __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_v_isolute = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_v_nmol = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_v_histo_min = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_histo_min == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_v_histo_max = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_histo_max == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_v_histo_bins = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_histo_bins == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_v_trehalose = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[10], PyBUF_WRITABLE); if (unlikely(!__pyx_v_trehalose.memview)) __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_v_oxyquinol = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[11], PyBUF_WRITABLE); if (unlikely(!__pyx_v_oxyquinol.memview)) __PYX_ERR(0, 369, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 369, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAAhisto", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_24calcEnergyAAhisto(__pyx_self, __pyx_v_coor, __pyx_v_coms, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_bins, __pyx_v_trehalose, __pyx_v_oxyquinol); + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_24calcEnergyAAhisto(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_coms, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, double __pyx_v_histo_min, double __pyx_v_histo_max, int __pyx_v_histo_bins, __Pyx_memviewslice __pyx_v_trehalose, __Pyx_memviewslice __pyx_v_oxyquinol) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_idx; - int __pyx_v_idx2; - int __pyx_v_histo_error; - __Pyx_memviewslice __pyx_v_epa = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histo = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_count = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_store = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_r; - double __pyx_v_rtre; - double __pyx_v_tmp; - double __pyx_v_tmp_ener; - double __pyx_v_histo_width; - __Pyx_memviewslice __pyx_v_squared_r_tre = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_squared_r_oxy = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_v_energy = NULL; - double __pyx_v_roxy; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_t_7 = NULL; - __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - Py_ssize_t __pyx_t_31; - Py_ssize_t __pyx_t_32; - Py_ssize_t __pyx_t_33; - Py_ssize_t __pyx_t_34; - Py_ssize_t __pyx_t_35; - Py_ssize_t __pyx_t_36; - int __pyx_t_37; - double __pyx_t_38; - PyObject *__pyx_t_39 = NULL; - PyObject *__pyx_t_40 = NULL; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcEnergyAAhisto", 0); + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "src/helpers/helpers.pyx":377 - * """ - * cdef int i, j, k, idx, idx2, histo_error - * cdef double [:] epa = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< - * cdef double [:,:] histo=np.zeros((histo_bins,histo_bins)) - * cdef double [:,:] count=np.zeros((histo_bins,histo_bins)) - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 377, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_epa = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - - /* "src/helpers/helpers.pyx":378 - * cdef int i, j, k, idx, idx2, histo_error - * cdef double [:] epa = np.zeros(apr[isolute]) - * cdef double [:,:] histo=np.zeros((histo_bins,histo_bins)) # <<<<<<<<<<<<<< - * cdef double [:,:] count=np.zeros((histo_bins,histo_bins)) - * cdef double [:] store=np.zeros(nmol) - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5); - __pyx_t_3 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_histo = __pyx_t_8; - __pyx_t_8.memview = NULL; - __pyx_t_8.data = NULL; - - /* "src/helpers/helpers.pyx":379 - * cdef double [:] epa = np.zeros(apr[isolute]) - * cdef double [:,:] histo=np.zeros((histo_bins,histo_bins)) - * cdef double [:,:] count=np.zeros((histo_bins,histo_bins)) # <<<<<<<<<<<<<< - * cdef double [:] store=np.zeros(nmol) - * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width + /* "View.MemoryView":408 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __pyx_t_2 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 379, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_count = __pyx_t_8; - __pyx_t_8.memview = NULL; - __pyx_t_8.data = NULL; + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":380 - * cdef double [:,:] histo=np.zeros((histo_bins,histo_bins)) - * cdef double [:,:] count=np.zeros((histo_bins,histo_bins)) - * cdef double [:] store=np.zeros(nmol) # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width - * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) + /* "View.MemoryView":409 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_nmol); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_store = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":382 - * cdef double [:] store=np.zeros(nmol) - * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width - * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) # <<<<<<<<<<<<<< - * cdef double [:] squared_r_oxy = np.zeros(oxyquinol.shape[0]) + /* "View.MemoryView":408 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 382, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_trehalose.shape[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 382, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_squared_r_tre = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - /* "src/helpers/helpers.pyx":383 - * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width - * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) - * cdef double [:] squared_r_oxy = np.zeros(oxyquinol.shape[0]) # <<<<<<<<<<<<<< + /* "View.MemoryView":411 + * return self * - * energy = 0.0 + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyInt_FromSsize_t((__pyx_v_oxyquinol.shape[0])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 411, __pyx_L1_error) } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 411, __pyx_L1_error) } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_squared_r_oxy = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":385 - * cdef double [:] squared_r_oxy = np.zeros(oxyquinol.shape[0]) + /* "View.MemoryView":414 * - * energy = 0.0 # <<<<<<<<<<<<<< - * histo_error=0 - * histo_width=(histo_max-histo_min)/histo_bins + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: */ - __Pyx_INCREF(__pyx_float_0_0); - __pyx_v_energy = __pyx_float_0_0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 414, __pyx_L1_error) + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":386 - * - * energy = 0.0 - * histo_error=0 # <<<<<<<<<<<<<< - * histo_width=(histo_max-histo_min)/histo_bins - * + /* "View.MemoryView":415 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) */ - __pyx_v_histo_error = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":387 - * energy = 0.0 - * histo_error=0 - * histo_width=(histo_max-histo_min)/histo_bins # <<<<<<<<<<<<<< + /* "View.MemoryView":414 * - * # loop over solute atoms + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: */ - __pyx_t_9 = (__pyx_v_histo_max - __pyx_v_histo_min); - if (unlikely(__pyx_v_histo_bins == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 387, __pyx_L1_error) } - __pyx_v_histo_width = (__pyx_t_9 / __pyx_v_histo_bins); - /* "src/helpers/helpers.pyx":391 - * # loop over solute atoms - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * idx = rfa[isolute] + i - * # loop over solvent molecules - */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_i = __pyx_t_12; - - /* "src/helpers/helpers.pyx":392 - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): - * idx = rfa[isolute] + i # <<<<<<<<<<<<<< - * # loop over solvent molecules + /* "View.MemoryView":417 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) * */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((char *)NULL))) __PYX_ERR(1, 417, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; - /* "src/helpers/helpers.pyx":395 - * # loop over solvent molecules + /* "View.MemoryView":418 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< * - * for j in range(nmol): # <<<<<<<<<<<<<< - * if j == isolute: - * continue + * def __setitem__(memoryview self, object index, object value): */ - __pyx_t_13 = __pyx_v_nmol; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_j = __pyx_t_15; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } - /* "src/helpers/helpers.pyx":396 + /* "View.MemoryView":407 * - * for j in range(nmol): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * tmp_ener=0.0 - */ - __pyx_t_16 = ((__pyx_v_j == __pyx_v_isolute) != 0); - if (__pyx_t_16) { - - /* "src/helpers/helpers.pyx":397 - * for j in range(nmol): - * if j == isolute: - * continue # <<<<<<<<<<<<<< - * tmp_ener=0.0 - * for k in range(apr[j]): - */ - goto __pyx_L5_continue; - - /* "src/helpers/helpers.pyx":396 * - * for j in range(nmol): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * tmp_ener=0.0 - */ - } - - /* "src/helpers/helpers.pyx":398 - * if j == isolute: - * continue - * tmp_ener=0.0 # <<<<<<<<<<<<<< - * for k in range(apr[j]): - * idx2 = rfa[j] + k - */ - __pyx_v_tmp_ener = 0.0; - - /* "src/helpers/helpers.pyx":399 - * continue - * tmp_ener=0.0 - * for k in range(apr[j]): # <<<<<<<<<<<<<< - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_17 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_k = __pyx_t_19; - /* "src/helpers/helpers.pyx":400 - * tmp_ener=0.0 - * for k in range(apr[j]): - * idx2 = rfa[j] + k # <<<<<<<<<<<<<< - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] - */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":401 - * for k in range(apr[j]): - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] +/* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_20 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_t_21 = __pyx_v_idx2; - __pyx_t_22 = 0; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_21 * __pyx_v_coor.strides[0]) ) + __pyx_t_22 * __pyx_v_coor.strides[1]) )))); - /* "src/helpers/helpers.pyx":402 - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - */ - __pyx_t_22 = __pyx_v_idx; - __pyx_t_21 = 1; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[0]; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor.shape[1]; - __pyx_t_20 = __pyx_v_idx2; - __pyx_t_4 = 1; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_22 * __pyx_v_coor.strides[0]) ) + __pyx_t_21 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); - /* "src/helpers/helpers.pyx":403 - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< - * r = sqrt(dx*dx + dy*dy + dz*dz) - * tmp=charges[idx] * charges[idx2] / r - */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_20 = 2; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_t_21 = __pyx_v_idx2; - __pyx_t_22 = 2; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_21 * __pyx_v_coor.strides[0]) ) + __pyx_t_22 * __pyx_v_coor.strides[1]) )))); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":404 - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< - * tmp=charges[idx] * charges[idx2] / r - * tmp_ener+=tmp - */ - __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); - /* "src/helpers/helpers.pyx":405 - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - * tmp=charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< - * tmp_ener+=tmp - * epa[i] += tmp + /* "View.MemoryView":421 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" + * */ - __pyx_t_22 = __pyx_v_idx; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_charges.shape[0]; - __pyx_t_21 = __pyx_v_idx2; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_charges.shape[0]; - __pyx_t_9 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_22 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_21 * __pyx_v_charges.strides[0]) )))); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 405, __pyx_L1_error) - } - __pyx_v_tmp = (__pyx_t_9 / __pyx_v_r); + if (unlikely(__pyx_v_self->view.readonly)) { - /* "src/helpers/helpers.pyx":406 - * r = sqrt(dx*dx + dy*dy + dz*dz) - * tmp=charges[idx] * charges[idx2] / r - * tmp_ener+=tmp # <<<<<<<<<<<<<< - * epa[i] += tmp + /* "View.MemoryView":422 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< * + * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_v_tmp_ener = (__pyx_v_tmp_ener + __pyx_v_tmp); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 422, __pyx_L1_error) - /* "src/helpers/helpers.pyx":407 - * tmp=charges[idx] * charges[idx2] / r - * tmp_ener+=tmp - * epa[i] += tmp # <<<<<<<<<<<<<< + /* "View.MemoryView":421 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * - * store[j]+=tmp_ener */ - __pyx_t_21 = __pyx_v_i; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_epa.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_21 * __pyx_v_epa.strides[0]) )) += __pyx_v_tmp; - } + } - /* "src/helpers/helpers.pyx":409 - * epa[i] += tmp - * - * store[j]+=tmp_ener # <<<<<<<<<<<<<< + /* "View.MemoryView":424 + * raise TypeError, "Cannot assign to read-only memoryview" * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * + * if have_slices: */ - __pyx_t_21 = __pyx_v_j; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_store.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_store.data + __pyx_t_21 * __pyx_v_store.strides[0]) )) += __pyx_v_tmp_ener; - __pyx_L5_continue:; + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 424, __pyx_L1_error) } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 424, __pyx_L1_error) } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/helpers.pyx":412 - * + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) * - * for j in range(nmol): # <<<<<<<<<<<<<< - * if j==isolute: - * continue + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ - __pyx_t_10 = __pyx_v_nmol; - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 426, __pyx_L1_error) + if (__pyx_t_4) { - /* "src/helpers/helpers.pyx":413 + /* "View.MemoryView":427 * - * for j in range(nmol): - * if j==isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(trehalose.shape[0]): + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj: + * self.setitem_slice_assignment(self[index], obj) */ - __pyx_t_16 = ((__pyx_v_j == __pyx_v_isolute) != 0); - if (__pyx_t_16) { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/helpers.pyx":414 - * for j in range(nmol): - * if j==isolute: - * continue # <<<<<<<<<<<<<< - * for k in range(trehalose.shape[0]): - * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: */ - goto __pyx_L10_continue; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 428, __pyx_L1_error) + if (__pyx_t_4) { - /* "src/helpers/helpers.pyx":413 - * - * for j in range(nmol): - * if j==isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(trehalose.shape[0]): + /* "View.MemoryView":429 + * obj = self.is_slice(value) + * if obj: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) */ - } + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/helpers/helpers.pyx":415 - * if j==isolute: - * continue - * for k in range(trehalose.shape[0]): # <<<<<<<<<<<<<< - * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 - * if k>=1: + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: */ - __pyx_t_23 = (__pyx_v_trehalose.shape[0]); - __pyx_t_24 = __pyx_t_23; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_24; __pyx_t_13+=1) { - __pyx_v_k = __pyx_t_13; + goto __pyx_L5; + } - /* "src/helpers/helpers.pyx":416 - * continue - * for k in range(trehalose.shape[0]): - * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 # <<<<<<<<<<<<<< - * if k>=1: - * if squared_r_tre[k]__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; - /* "src/helpers/helpers.pyx":417 - * for k in range(trehalose.shape[0]): - * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 - * if k>=1: # <<<<<<<<<<<<<< - * if squared_r_tre[k]= 1) != 0); - if (__pyx_t_16) { + goto __pyx_L4; + } - /* "src/helpers/helpers.pyx":418 - * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 - * if k>=1: - * if squared_r_tre[k]__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; - /* "src/helpers/helpers.pyx":419 - * if k>=1: - * if squared_r_tre[k]=1: - * if squared_r_tre[k]=1: # <<<<<<<<<<<<<< - * if squared_r_tre[k]=1: + /* "View.MemoryView":436 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - __pyx_t_23 = (__pyx_v_oxyquinol.shape[0]); - __pyx_t_24 = __pyx_t_23; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_24; __pyx_t_13+=1) { - __pyx_v_k = __pyx_t_13; + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":423 - * rtre=sqrt(squared_r_tre[k]) - * for k in range(oxyquinol.shape[0]): - * squared_r_oxy[k]=(coor[oxyquinol[k],0]-coms[j,0])**2+(coor[oxyquinol[k],1]-coms[j,1])**2+(coor[oxyquinol[k],2]-coms[j,2])**2 # <<<<<<<<<<<<<< - * if k>=1: - * if squared_r_oxy[k]=1: # <<<<<<<<<<<<<< - * if squared_r_oxy[k]= 1) != 0); - if (__pyx_t_16) { + __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); - /* "src/helpers/helpers.pyx":425 - * squared_r_oxy[k]=(coor[oxyquinol[k],0]-coms[j,0])**2+(coor[oxyquinol[k],1]-coms[j,1])**2+(coor[oxyquinol[k],2]-coms[j,2])**2 - * if k>=1: - * if squared_r_oxy[k]dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); - /* "src/helpers/helpers.pyx":426 - * if k>=1: - * if squared_r_oxy[k]=1: - * if squared_r_oxy[k]=1: # <<<<<<<<<<<<<< - * if squared_r_oxy[k]= histo_max or roxy>=histo_max: + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ - __pyx_t_37 = ((__pyx_v_rtre < __pyx_v_histo_min) != 0); - if (!__pyx_t_37) { - } else { - __pyx_t_16 = __pyx_t_37; - goto __pyx_L22_bool_binop_done; + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; } - __pyx_t_37 = ((__pyx_v_roxy < __pyx_v_histo_min) != 0); - __pyx_t_16 = __pyx_t_37; - __pyx_L22_bool_binop_done:; - if (__pyx_t_16) { - /* "src/helpers/helpers.pyx":431 + /* "View.MemoryView":436 * - * if rtre < histo_min or roxy < histo_min: - * histo_error=1 # <<<<<<<<<<<<<< - * elif rtre >= histo_max or roxy>=histo_max: - * histo_error=2 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - __pyx_v_histo_error = 1; + } - /* "src/helpers/helpers.pyx":430 - * roxy=sqrt(squared_r_oxy[k]) + /* "View.MemoryView":443 + * return None * - * if rtre < histo_min or roxy < histo_min: # <<<<<<<<<<<<<< - * histo_error=1 - * elif rtre >= histo_max or roxy>=histo_max: + * return obj # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assignment(self, dst, src): */ - goto __pyx_L21; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":432 - * if rtre < histo_min or roxy < histo_min: - * histo_error=1 - * elif rtre >= histo_max or roxy>=histo_max: # <<<<<<<<<<<<<< - * histo_error=2 - * else: + /* "View.MemoryView":435 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ - __pyx_t_37 = ((__pyx_v_rtre >= __pyx_v_histo_max) != 0); - if (!__pyx_t_37) { - } else { - __pyx_t_16 = __pyx_t_37; - goto __pyx_L24_bool_binop_done; - } - __pyx_t_37 = ((__pyx_v_roxy >= __pyx_v_histo_max) != 0); - __pyx_t_16 = __pyx_t_37; - __pyx_L24_bool_binop_done:; - if (__pyx_t_16) { - /* "src/helpers/helpers.pyx":433 - * histo_error=1 - * elif rtre >= histo_max or roxy>=histo_max: - * histo_error=2 # <<<<<<<<<<<<<< - * else: - * histo[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=store[j] + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":445 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ - __pyx_v_histo_error = 2; - /* "src/helpers/helpers.pyx":432 - * if rtre < histo_min or roxy < histo_min: - * histo_error=1 - * elif rtre >= histo_max or roxy>=histo_max: # <<<<<<<<<<<<<< - * histo_error=2 - * else: +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":448 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * */ - goto __pyx_L21; - } + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); - /* "src/helpers/helpers.pyx":435 - * histo_error=2 - * else: - * histo[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=store[j] # <<<<<<<<<<<<<< - * count[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=1 + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) */ - /*else*/ { - __pyx_t_22 = __pyx_v_j; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_store.shape[0]; - __pyx_t_9 = (__pyx_v_rtre - __pyx_v_histo_min); - if (unlikely(__pyx_v_histo_width == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 435, __pyx_L1_error) - } - __pyx_t_38 = (__pyx_v_roxy - __pyx_v_histo_min); - if (unlikely(__pyx_v_histo_width == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 435, __pyx_L1_error) - } - __pyx_t_20 = ((Py_ssize_t)(__pyx_t_9 / __pyx_v_histo_width)); - __pyx_t_25 = ((Py_ssize_t)(__pyx_t_38 / __pyx_v_histo_width)); - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_histo.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_histo.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histo.data + __pyx_t_20 * __pyx_v_histo.strides[0]) ) + __pyx_t_25 * __pyx_v_histo.strides[1]) )) += (*((double *) ( /* dim=0 */ (__pyx_v_store.data + __pyx_t_22 * __pyx_v_store.strides[0]) ))); - - /* "src/helpers/helpers.pyx":436 - * else: - * histo[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=store[j] - * count[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=1 # <<<<<<<<<<<<<< - * - * for i in range(apr[isolute]): - */ - __pyx_t_38 = (__pyx_v_rtre - __pyx_v_histo_min); - if (unlikely(__pyx_v_histo_width == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 436, __pyx_L1_error) - } - __pyx_t_9 = (__pyx_v_roxy - __pyx_v_histo_min); - if (unlikely(__pyx_v_histo_width == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 436, __pyx_L1_error) - } - __pyx_t_22 = ((Py_ssize_t)(__pyx_t_38 / __pyx_v_histo_width)); - __pyx_t_25 = ((Py_ssize_t)(__pyx_t_9 / __pyx_v_histo_width)); - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_count.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_count.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_count.data + __pyx_t_22 * __pyx_v_count.strides[0]) ) + __pyx_t_25 * __pyx_v_count.strides[1]) )) += 1.0; - } - __pyx_L21:; - __pyx_L10_continue:; - } - - /* "src/helpers/helpers.pyx":438 - * count[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=1 - * - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * energy += epa[i] - * - */ - __pyx_t_25 = __pyx_v_isolute; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_apr.shape[0]; - __pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_25 * __pyx_v_apr.strides[0]) ))); - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_i = __pyx_t_12; + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); - /* "src/helpers/helpers.pyx":439 - * - * for i in range(apr[isolute]): - * energy += epa[i] # <<<<<<<<<<<<<< - * - * return energy * 1390.02, np.asarray(histo)[:,:] * 1390.02 , histo_error, np.asarray(count)[:,:] - */ - __pyx_t_25 = __pyx_v_i; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_epa.shape[0]; - __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_25 * __pyx_v_epa.strides[0]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_energy, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 439, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_energy, __pyx_t_3); - __pyx_t_3 = 0; - } - - /* "src/helpers/helpers.pyx":441 - * energy += epa[i] + /* "View.MemoryView":451 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] * - * return energy * 1390.02, np.asarray(histo)[:,:] * 1390.02 , histo_error, np.asarray(count)[:,:] # <<<<<<<<<<<<<< + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyNumber_Multiply(__pyx_v_energy, __pyx_float_1390_02); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_histo, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_tuple__3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_float_1390_02); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_histo_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_39 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_39)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_39); + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_count, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_40 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_39))) { - __pyx_t_40 = PyMethod_GET_SELF(__pyx_t_39); - if (likely(__pyx_t_40)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_39); - __Pyx_INCREF(__pyx_t_40); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_39, function); - } - } - __pyx_t_7 = (__pyx_t_40) ? __Pyx_PyObject_Call2Args(__pyx_t_39, __pyx_t_40, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_39, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_40); __pyx_t_40 = 0; + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_39); __pyx_t_39 = 0; - __pyx_t_39 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_tuple__3); if (unlikely(!__pyx_t_39)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_39); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_39); - PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_39); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_5 = 0; - __pyx_t_39 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 451, __pyx_L1_error) - /* "src/helpers/helpers.pyx":369 + /* "View.MemoryView":445 + * return obj * - * @cython.boundscheck(False) - * def calcEnergyAAhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose, int[:] oxyquinol): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAAhisto(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, min_histo, max_histo, bins_hist,array indices, array indices 2) + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_XDECREF(__pyx_t_7); - __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1); - __Pyx_XDECREF(__pyx_t_39); - __Pyx_XDECREF(__pyx_t_40); - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAAhisto", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_epa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histo, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_count, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_store, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_squared_r_tre, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_squared_r_oxy, 1); - __Pyx_XDECREF(__pyx_v_energy); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coms, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_trehalose, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_oxyquinol, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":444 +/* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) * - * @cython.boundscheck(False) - * def calcEnergyAAhisto1(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAAhisto(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, min_histo, max_histo, bins_hist,array indices) + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_27calcEnergyAAhisto1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_26calcEnergyAAhisto1[] = "\n energy = calcEnergyAAhisto(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, min_histo, max_histo, bins_hist,array indices)\n\n Calculates the solvation energy of a solute in any solvent for a specific coordinate set.\n \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_27calcEnergyAAhisto1 = {"calcEnergyAAhisto1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_27calcEnergyAAhisto1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_26calcEnergyAAhisto1}; -static PyObject *__pyx_pw_11newanalysis_7helpers_27calcEnergyAAhisto1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coms = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_isolute; - int __pyx_v_nmol; - double __pyx_v_histo_min; - double __pyx_v_histo_max; - int __pyx_v_histo_bins; - __Pyx_memviewslice __pyx_v_trehalose = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcEnergyAAhisto1 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_coms,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_histo_bins,&__pyx_n_s_trehalose,0}; - PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 1); __PYX_ERR(0, 444, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 2); __PYX_ERR(0, 444, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 3); __PYX_ERR(0, 444, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 4); __PYX_ERR(0, 444, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 5); __PYX_ERR(0, 444, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 6); __PYX_ERR(0, 444, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_min)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 7); __PYX_ERR(0, 444, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_max)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 8); __PYX_ERR(0, 444, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 9: - if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_bins)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 9); __PYX_ERR(0, 444, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 10: - if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trehalose)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 10); __PYX_ERR(0, 444, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcEnergyAAhisto1") < 0)) __PYX_ERR(0, 444, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 11) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 444, __pyx_L3_error) - __pyx_v_coms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms.memview)) __PYX_ERR(0, 444, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 444, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 444, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 444, __pyx_L3_error) - __pyx_v_isolute = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L3_error) - __pyx_v_nmol = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L3_error) - __pyx_v_histo_min = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_histo_min == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L3_error) - __pyx_v_histo_max = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_histo_max == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L3_error) - __pyx_v_histo_bins = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_histo_bins == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L3_error) - __pyx_v_trehalose = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[10], PyBUF_WRITABLE); if (unlikely(!__pyx_v_trehalose.memview)) __PYX_ERR(0, 444, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 444, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAAhisto1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_26calcEnergyAAhisto1(__pyx_self, __pyx_v_coor, __pyx_v_coms, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_bins, __pyx_v_trehalose); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_7helpers_26calcEnergyAAhisto1(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_coms, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, double __pyx_v_histo_min, double __pyx_v_histo_max, int __pyx_v_histo_bins, __Pyx_memviewslice __pyx_v_trehalose) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_idx; - int __pyx_v_idx2; - int __pyx_v_histo_error; - __Pyx_memviewslice __pyx_v_epa = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histo = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_count = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_store = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_r; - double __pyx_v_rtre; - double __pyx_v_tmp; - double __pyx_v_tmp_ener; - double __pyx_v_histo_width; - __Pyx_memviewslice __pyx_v_squared_r_tre = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_v_energy = NULL; +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[0x80]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - Py_ssize_t __pyx_t_31; - Py_ssize_t __pyx_t_32; - Py_ssize_t __pyx_t_33; - Py_ssize_t __pyx_t_34; - PyObject *__pyx_t_35 = NULL; - PyObject *__pyx_t_36 = NULL; - PyObject *__pyx_t_37 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcEnergyAAhisto1", 0); - - /* "src/helpers/helpers.pyx":452 - * """ - * cdef int i, j, k, idx, idx2, histo_error - * cdef double [:] epa = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< - * cdef double [:] histo=np.zeros((histo_bins)) - * cdef double [:] count=np.zeros((histo_bins)) - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_epa = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - /* "src/helpers/helpers.pyx":453 - * cdef int i, j, k, idx, idx2, histo_error - * cdef double [:] epa = np.zeros(apr[isolute]) - * cdef double [:] histo=np.zeros((histo_bins)) # <<<<<<<<<<<<<< - * cdef double [:] count=np.zeros((histo_bins)) - * cdef double [:] store=np.zeros(nmol) + /* "View.MemoryView":455 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item + * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 453, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_histo = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_v_tmp = NULL; - /* "src/helpers/helpers.pyx":454 - * cdef double [:] epa = np.zeros(apr[isolute]) - * cdef double [:] histo=np.zeros((histo_bins)) - * cdef double [:] count=np.zeros((histo_bins)) # <<<<<<<<<<<<<< - * cdef double [:] store=np.zeros(nmol) - * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width + /* "View.MemoryView":460 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + * + * if self.view.itemsize > sizeof(array): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_count = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 460, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; - /* "src/helpers/helpers.pyx":455 - * cdef double [:] histo=np.zeros((histo_bins)) - * cdef double [:] count=np.zeros((histo_bins)) - * cdef double [:] store=np.zeros(nmol) # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width - * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nmol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_store = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":457 - * cdef double [:] store=np.zeros(nmol) - * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width - * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) # <<<<<<<<<<<<<< + /* "View.MemoryView":463 * - * energy = 0.0 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_trehalose.shape[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_squared_r_tre = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - /* "src/helpers/helpers.pyx":459 - * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) - * - * energy = 0.0 # <<<<<<<<<<<<<< - * histo_error=0 - * histo_width=(histo_max-histo_min)/histo_bins + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp */ - __Pyx_INCREF(__pyx_float_0_0); - __pyx_v_energy = __pyx_float_0_0; + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/helpers.pyx":460 - * - * energy = 0.0 - * histo_error=0 # <<<<<<<<<<<<<< - * histo_width=(histo_max-histo_min)/histo_bins - * + /* "View.MemoryView":465 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: */ - __pyx_v_histo_error = 0; + PyErr_NoMemory(); __PYX_ERR(1, 465, __pyx_L1_error) - /* "src/helpers/helpers.pyx":461 - * energy = 0.0 - * histo_error=0 - * histo_width=(histo_max-histo_min)/histo_bins # <<<<<<<<<<<<<< - * - * # loop over solute atoms + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp */ - __pyx_t_7 = (__pyx_v_histo_max - __pyx_v_histo_min); - if (unlikely(__pyx_v_histo_bins == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 461, __pyx_L1_error) - } - __pyx_v_histo_width = (__pyx_t_7 / __pyx_v_histo_bins); + } - /* "src/helpers/helpers.pyx":465 - * # loop over solute atoms - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * idx = rfa[isolute] + i - * # loop over solvent molecules + /* "View.MemoryView":466 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_8 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; + __pyx_v_item = __pyx_v_tmp; - /* "src/helpers/helpers.pyx":466 - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): - * idx = rfa[isolute] + i # <<<<<<<<<<<<<< - * # loop over solvent molecules + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); + goto __pyx_L3; + } - /* "src/helpers/helpers.pyx":469 - * # loop over solvent molecules + /* "View.MemoryView":468 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< * - * for j in range(nmol): # <<<<<<<<<<<<<< - * if j == isolute: - * continue + * try: */ - __pyx_t_11 = __pyx_v_nmol; - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_j = __pyx_t_13; + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; - /* "src/helpers/helpers.pyx":470 + /* "View.MemoryView":470 + * item = array * - * for j in range(nmol): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * tmp_ener=0.0 - */ - __pyx_t_14 = ((__pyx_v_j == __pyx_v_isolute) != 0); - if (__pyx_t_14) { - - /* "src/helpers/helpers.pyx":471 - * for j in range(nmol): - * if j == isolute: - * continue # <<<<<<<<<<<<<< - * tmp_ener=0.0 - * for k in range(apr[j]): + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value */ - goto __pyx_L5_continue; + /*try:*/ { - /* "src/helpers/helpers.pyx":470 + /* "View.MemoryView":471 * - * for j in range(nmol): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * tmp_ener=0.0 - */ - } - - /* "src/helpers/helpers.pyx":472 - * if j == isolute: - * continue - * tmp_ener=0.0 # <<<<<<<<<<<<<< - * for k in range(apr[j]): - * idx2 = rfa[j] + k - */ - __pyx_v_tmp_ener = 0.0; - - /* "src/helpers/helpers.pyx":473 - * continue - * tmp_ener=0.0 - * for k in range(apr[j]): # <<<<<<<<<<<<<< - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] - */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_k = __pyx_t_17; - - /* "src/helpers/helpers.pyx":474 - * tmp_ener=0.0 - * for k in range(apr[j]): - * idx2 = rfa[j] + k # <<<<<<<<<<<<<< - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] - */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); - - /* "src/helpers/helpers.pyx":475 - * for k in range(apr[j]): - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] - */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_18 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_19 = __pyx_v_idx2; - __pyx_t_20 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); - - /* "src/helpers/helpers.pyx":476 - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - */ - __pyx_t_20 = __pyx_v_idx; - __pyx_t_19 = 1; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_t_18 = __pyx_v_idx2; - __pyx_t_4 = 1; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); - - /* "src/helpers/helpers.pyx":477 - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< - * r = sqrt(dx*dx + dy*dy + dz*dz) - * tmp=charges[idx] * charges[idx2] / r - */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_18 = 2; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_19 = __pyx_v_idx2; - __pyx_t_20 = 2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); - - /* "src/helpers/helpers.pyx":478 - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< - * tmp=charges[idx] * charges[idx2] / r - * tmp_ener+=tmp - */ - __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - - /* "src/helpers/helpers.pyx":479 - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - * tmp=charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< - * tmp_ener+=tmp - * epa[i] += tmp + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - __pyx_t_20 = __pyx_v_idx; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges.shape[0]; - __pyx_t_19 = __pyx_v_idx2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; - __pyx_t_7 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_20 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) )))); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 479, __pyx_L1_error) - } - __pyx_v_tmp = (__pyx_t_7 / __pyx_v_r); + if (__pyx_v_self->dtype_is_object) { - /* "src/helpers/helpers.pyx":480 - * r = sqrt(dx*dx + dy*dy + dz*dz) - * tmp=charges[idx] * charges[idx2] / r - * tmp_ener+=tmp # <<<<<<<<<<<<<< - * epa[i] += tmp - * + /* "View.MemoryView":472 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) */ - __pyx_v_tmp_ener = (__pyx_v_tmp_ener + __pyx_v_tmp); + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - /* "src/helpers/helpers.pyx":481 - * tmp=charges[idx] * charges[idx2] / r - * tmp_ener+=tmp - * epa[i] += tmp # <<<<<<<<<<<<<< + /* "View.MemoryView":471 * - * store[j]+=tmp_ener + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - __pyx_t_19 = __pyx_v_i; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_19 * __pyx_v_epa.strides[0]) )) += __pyx_v_tmp; - } + goto __pyx_L8; + } - /* "src/helpers/helpers.pyx":483 - * epa[i] += tmp - * - * store[j]+=tmp_ener # <<<<<<<<<<<<<< + /* "View.MemoryView":474 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< * * */ - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_store.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_store.data + __pyx_t_19 * __pyx_v_store.strides[0]) )) += __pyx_v_tmp_ener; - __pyx_L5_continue:; + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - } + __pyx_L8:; - /* "src/helpers/helpers.pyx":486 + /* "View.MemoryView":478 * * - * for j in range(nmol): # <<<<<<<<<<<<<< - * if j==isolute: - * continue + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - __pyx_t_8 = __pyx_v_nmol; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_j = __pyx_t_10; + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":487 + /* "View.MemoryView":479 * - * for j in range(nmol): - * if j==isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(trehalose.shape[0]): - */ - __pyx_t_14 = ((__pyx_v_j == __pyx_v_isolute) != 0); - if (__pyx_t_14) { - - /* "src/helpers/helpers.pyx":488 - * for j in range(nmol): - * if j==isolute: - * continue # <<<<<<<<<<<<<< - * for k in range(trehalose.shape[0]): - * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) */ - goto __pyx_L10_continue; + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 479, __pyx_L6_error) - /* "src/helpers/helpers.pyx":487 + /* "View.MemoryView":478 * - * for j in range(nmol): - * if j==isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(trehalose.shape[0]): + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ } - /* "src/helpers/helpers.pyx":489 - * if j==isolute: - * continue - * for k in range(trehalose.shape[0]): # <<<<<<<<<<<<<< - * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 - * if k>=1: - */ - __pyx_t_21 = (__pyx_v_trehalose.shape[0]); - __pyx_t_22 = __pyx_t_21; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_22; __pyx_t_11+=1) { - __pyx_v_k = __pyx_t_11; - - /* "src/helpers/helpers.pyx":490 - * continue - * for k in range(trehalose.shape[0]): - * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 # <<<<<<<<<<<<<< - * if k>=1: - * if squared_r_tre[k]view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } - /* "src/helpers/helpers.pyx":491 - * for k in range(trehalose.shape[0]): - * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 - * if k>=1: # <<<<<<<<<<<<<< - * if squared_r_tre[k]= 1) != 0); - if (__pyx_t_14) { + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + } + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } - /* "src/helpers/helpers.pyx":492 - * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 - * if k>=1: - * if squared_r_tre[k]=1: - * if squared_r_tre[k]=1: - * if squared_r_tre[k]=1: # <<<<<<<<<<<<<< - * if squared_r_tre[k]= histo_max: */ - __pyx_t_14 = ((__pyx_v_rtre < __pyx_v_histo_min) != 0); - if (__pyx_t_14) { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 486, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; - /* "src/helpers/helpers.pyx":498 + /* "View.MemoryView":487 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< * - * if rtre < histo_min: - * histo_error=1 # <<<<<<<<<<<<<< - * elif rtre >= histo_max: - * histo_error=2 + * cdef convert_item_to_object(self, char *itemp): */ - __pyx_v_histo_error = 1; + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/helpers.pyx":497 - * rtre=sqrt(squared_r_tre[k]) + /* "View.MemoryView":485 + * PyMem_Free(tmp) * - * if rtre < histo_min: # <<<<<<<<<<<<<< - * histo_error=1 - * elif rtre >= histo_max: + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) */ - goto __pyx_L17; - } - /* "src/helpers/helpers.pyx":499 - * if rtre < histo_min: - * histo_error=1 - * elif rtre >= histo_max: # <<<<<<<<<<<<<< - * histo_error=2 - * else: - */ - __pyx_t_14 = ((__pyx_v_rtre >= __pyx_v_histo_max) != 0); - if (__pyx_t_14) { + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":500 - * histo_error=1 - * elif rtre >= histo_max: - * histo_error=2 # <<<<<<<<<<<<<< - * else: - * histo[int((rtre-histo_min)/histo_width)]+=store[j] +/* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_v_histo_error = 2; - /* "src/helpers/helpers.pyx":499 - * if rtre < histo_min: - * histo_error=1 - * elif rtre >= histo_max: # <<<<<<<<<<<<<< - * histo_error=2 - * else: +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":492 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem + * */ - goto __pyx_L17; - } + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/helpers.pyx":502 - * histo_error=2 - * else: - * histo[int((rtre-histo_min)/histo_width)]+=store[j] # <<<<<<<<<<<<<< - * count[int((rtre-histo_min)/histo_width)]+=1 + /* "View.MemoryView":495 + * cdef bytes bytesitem * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) */ - /*else*/ { - __pyx_t_33 = __pyx_v_j; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_store.shape[0]; - __pyx_t_7 = (__pyx_v_rtre - __pyx_v_histo_min); - if (unlikely(__pyx_v_histo_width == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "View.MemoryView":496 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "View.MemoryView":497 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } } - __pyx_t_32 = ((Py_ssize_t)(__pyx_t_7 / __pyx_v_histo_width)); - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_histo.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_histo.data + __pyx_t_32 * __pyx_v_histo.strides[0]) )) += (*((double *) ( /* dim=0 */ (__pyx_v_store.data + __pyx_t_33 * __pyx_v_store.strides[0]) ))); + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":496 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + */ + } - /* "src/helpers/helpers.pyx":503 + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" * else: - * histo[int((rtre-histo_min)/histo_width)]+=store[j] - * count[int((rtre-histo_min)/histo_width)]+=1 # <<<<<<<<<<<<<< + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result + */ + /*else:*/ { + __pyx_t_9 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 501, __pyx_L5_except_error) + __pyx_t_10 = (__pyx_t_9 == 1); + if (__pyx_t_10) { + + /* "View.MemoryView":502 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result * - * for i in range(apr[isolute]): */ - __pyx_t_7 = (__pyx_v_rtre - __pyx_v_histo_min); - if (unlikely(__pyx_v_histo_width == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 503, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 502, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; + + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result + */ } - __pyx_t_33 = ((Py_ssize_t)(__pyx_t_7 / __pyx_v_histo_width)); - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_count.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_count.data + __pyx_t_33 * __pyx_v_count.strides[0]) )) += 1.0; + + /* "View.MemoryView":503 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< + * + * cdef assign_item_from_object(self, char *itemp, object value): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; } - __pyx_L17:; - __pyx_L10_continue:; + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":498 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: + */ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_6); + __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; + if (__pyx_t_8) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_1); + + /* "View.MemoryView":499 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 499, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "View.MemoryView":496 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; } - /* "src/helpers/helpers.pyx":505 - * count[int((rtre-histo_min)/histo_width)]+=1 + /* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) * - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * energy += epa[i] + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":505 + * return result * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_t_33 = __pyx_v_isolute; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_apr.shape[0]; - __pyx_t_8 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_33 * __pyx_v_apr.strides[0]) ))); - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; - /* "src/helpers/helpers.pyx":506 +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + char *__pyx_t_10; + char *__pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":508 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue + */ + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; + + /* "View.MemoryView":513 + * cdef Py_ssize_t i * - * for i in range(apr[isolute]): - * energy += epa[i] # <<<<<<<<<<<<<< + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: + */ + __pyx_t_2 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_2) { + + /* "View.MemoryView":514 * - * return energy * 1390.02, np.asarray(histo)[:] * 1390.02 , histo_error, np.asarray(count)[:] + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) */ - __pyx_t_33 = __pyx_v_i; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_epa.shape[0]; - __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_33 * __pyx_v_epa.strides[0]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_energy, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_energy, __pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 514, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - } - /* "src/helpers/helpers.pyx":508 - * energy += epa[i] + /* "View.MemoryView":513 + * cdef Py_ssize_t i * - * return energy * 1390.02, np.asarray(histo)[:] * 1390.02 , histo_error, np.asarray(count)[:] # <<<<<<<<<<<<<< + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: + */ + goto __pyx_L3; + } + + /* "View.MemoryView":516 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * for i, c in enumerate(bytesvalue): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyNumber_Multiply(__pyx_v_energy, __pyx_float_1390_02); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_histo, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_35 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_35 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_35)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_35); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + /*else*/ { + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } } - } - __pyx_t_1 = (__pyx_t_35) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_35, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_35); __pyx_t_35 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, NULL, NULL, &__pyx_slice__2, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_float_1390_02); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_histo_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_35, __pyx_n_s_np); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_35); - __pyx_t_36 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_asarray); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_36); - __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0; - __pyx_t_35 = __pyx_memoryview_fromslice(__pyx_v_count, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_35); - __pyx_t_37 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_36))) { - __pyx_t_37 = PyMethod_GET_SELF(__pyx_t_36); - if (likely(__pyx_t_37)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_36); - __Pyx_INCREF(__pyx_t_37); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_36, function); + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_value}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; } - __pyx_t_2 = (__pyx_t_37) ? __Pyx_PyObject_Call2Args(__pyx_t_36, __pyx_t_37, __pyx_t_35) : __Pyx_PyObject_CallOneArg(__pyx_t_36, __pyx_t_35); - __Pyx_XDECREF(__pyx_t_37); __pyx_t_37 = 0; - __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0; - __pyx_t_36 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 0, NULL, NULL, &__pyx_slice__2, 0, 0, 1); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_36); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_36); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_36); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_5 = 0; - __pyx_t_36 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_L3:; - /* "src/helpers/helpers.pyx":444 + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) * - * @cython.boundscheck(False) - * def calcEnergyAAhisto1(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAAhisto(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, min_histo, max_histo, bins_hist,array indices) + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * + */ + __pyx_t_7 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 518, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_8 = __pyx_v_bytesvalue; + __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8); + __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8)); + for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) { + __pyx_t_9 = __pyx_t_12; + __pyx_v_c = (__pyx_t_9[0]); + + /* "View.MemoryView":519 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') + */ + __pyx_v_i = __pyx_t_7; + + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * + */ + __pyx_t_7 = (__pyx_t_7 + 1); + + /* "View.MemoryView":519 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') + */ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "View.MemoryView":505 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_XDECREF(__pyx_t_35); - __Pyx_XDECREF(__pyx_t_36); - __Pyx_XDECREF(__pyx_t_37); - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAAhisto1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_epa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histo, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_count, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_store, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_squared_r_tre, 1); - __Pyx_XDECREF(__pyx_v_energy); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coms, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_trehalose, 1); + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":511 +/* "View.MemoryView":521 + * itemp[i] = c * - * @cython.boundscheck(False) - * def calcEnergyAApermindhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude,double histo_min, double histo_max, int histo_bins,): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list, min_histo, max_histo, bins_histo) + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_29calcEnergyAApermindhisto(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_28calcEnergyAApermindhisto[] = "\n energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list, min_histo, max_histo, bins_histo)\n\n Calculates the permanent and induced part of the solvation energy of a solute in any solvent for a specific coordinate set.\n \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_29calcEnergyAApermindhisto = {"calcEnergyAApermindhisto", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_29calcEnergyAApermindhisto, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_28calcEnergyAApermindhisto}; -static PyObject *__pyx_pw_11newanalysis_7helpers_29calcEnergyAApermindhisto(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coms = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_isolute; - int __pyx_v_first; - int __pyx_v_last; - __Pyx_memviewslice __pyx_v_drude = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_histo_min; - double __pyx_v_histo_max; - int __pyx_v_histo_bins; +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcEnergyAApermindhisto (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_coms,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_first,&__pyx_n_s_last,&__pyx_n_s_drude,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_histo_bins,0}; - PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 1); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 2); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 3); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 4); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 5); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_first)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 6); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_last)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 7); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_drude)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 8); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 9: - if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_min)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 9); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 10: - if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_max)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 10); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 11: - if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_bins)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 11); __PYX_ERR(0, 511, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcEnergyAApermindhisto") < 0)) __PYX_ERR(0, 511, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 12) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_coms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms.memview)) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_isolute = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_first = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_first == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_last = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_last == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_drude = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_drude.memview)) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_histo_min = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_histo_min == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_histo_max = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_histo_max == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_histo_bins = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_histo_bins == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAApermindhisto", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_28calcEnergyAApermindhisto(__pyx_self, __pyx_v_coor, __pyx_v_coms, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_first, __pyx_v_last, __pyx_v_drude, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_bins); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_7helpers_28calcEnergyAApermindhisto(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_coms, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_first, int __pyx_v_last, __Pyx_memviewslice __pyx_v_drude, double __pyx_v_histo_min, double __pyx_v_histo_max, int __pyx_v_histo_bins) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_idx; - int __pyx_v_idx2; - int __pyx_v_histo_error; - __Pyx_memviewslice __pyx_v_epa_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_epa_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histo_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histo_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_r; - double __pyx_v_qq; - double __pyx_v_energy_perm; - double __pyx_v_energy_ind; - double __pyx_v_histo_width; - double __pyx_v_tmp_perm; - double __pyx_v_tmp_ind; - double __pyx_v_qq_diff; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - long __pyx_t_11; - long __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - int __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - PyObject *__pyx_t_30 = NULL; - PyObject *__pyx_t_31 = NULL; - PyObject *__pyx_t_32 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcEnergyAApermindhisto", 0); + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); - /* "src/helpers/helpers.pyx":519 - * """ - * cdef int i, j, k, idx, idx2, histo_error - * cdef double [:] epa_ind = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< - * cdef double [:] epa_perm = np.zeros(apr[isolute]) - * cdef double [:] histo_perm=np.zeros(histo_bins), histo_ind=np.zeros(histo_bins) + /* "View.MemoryView":523 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_epa_ind = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "src/helpers/helpers.pyx":520 - * cdef int i, j, k, idx, idx2, histo_error - * cdef double [:] epa_ind = np.zeros(apr[isolute]) - * cdef double [:] epa_perm = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< - * cdef double [:] histo_perm=np.zeros(histo_bins), histo_ind=np.zeros(histo_bins) - * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, histo_width, tmp_perm, tmp_ind, qq_diff + /* "View.MemoryView":524 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_3 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_epa_perm = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 524, __pyx_L1_error) - /* "src/helpers/helpers.pyx":521 - * cdef double [:] epa_ind = np.zeros(apr[isolute]) - * cdef double [:] epa_perm = np.zeros(apr[isolute]) - * cdef double [:] histo_perm=np.zeros(histo_bins), histo_ind=np.zeros(histo_bins) # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, histo_width, tmp_perm, tmp_ind, qq_diff + /* "View.MemoryView":523 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_histo_perm = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_histo_ind = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - /* "src/helpers/helpers.pyx":524 - * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, histo_width, tmp_perm, tmp_ind, qq_diff + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * - * energy_perm = 0.0 # <<<<<<<<<<<<<< - * energy_ind = 0.0 - * histo_error=0 + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ - __pyx_v_energy_perm = 0.0; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":525 + /* "View.MemoryView":527 * - * energy_perm = 0.0 - * energy_ind = 0.0 # <<<<<<<<<<<<<< - * histo_error=0 - * histo_width=(histo_max-histo_min)/histo_bins + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL */ - __pyx_v_energy_ind = 0.0; + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; - /* "src/helpers/helpers.pyx":526 - * energy_perm = 0.0 - * energy_ind = 0.0 - * histo_error=0 # <<<<<<<<<<<<<< - * histo_width=(histo_max-histo_min)/histo_bins + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ - __pyx_v_histo_error = 0; + goto __pyx_L6; + } - /* "src/helpers/helpers.pyx":527 - * energy_ind = 0.0 - * histo_error=0 - * histo_width=(histo_max-histo_min)/histo_bins # <<<<<<<<<<<<<< + /* "View.MemoryView":529 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< * - * # loop over solute atoms + * if flags & PyBUF_STRIDES: */ - __pyx_t_7 = (__pyx_v_histo_max - __pyx_v_histo_min); - if (unlikely(__pyx_v_histo_bins == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 527, __pyx_L1_error) + /*else*/ { + __pyx_v_info->shape = NULL; } - __pyx_v_histo_width = (__pyx_t_7 / __pyx_v_histo_bins); - - /* "src/helpers/helpers.pyx":531 - * # loop over solute atoms - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * idx = rfa[isolute] + i - * # loop over solvent molecules - */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_8 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; + __pyx_L6:; - /* "src/helpers/helpers.pyx":532 - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): - * idx = rfa[isolute] + i # <<<<<<<<<<<<<< - * # loop over solvent molecules - * for j in range(first,last+1): + /* "View.MemoryView":531 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":534 - * idx = rfa[isolute] + i - * # loop over solvent molecules - * for j in range(first,last+1): # <<<<<<<<<<<<<< - * if j == isolute: - * continue + /* "View.MemoryView":532 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL */ - __pyx_t_11 = (__pyx_v_last + 1); - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = __pyx_v_first; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_j = __pyx_t_13; + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; - /* "src/helpers/helpers.pyx":535 - * # loop over solvent molecules - * for j in range(first,last+1): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * tmp_perm=0.0 + /* "View.MemoryView":531 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - __pyx_t_14 = ((__pyx_v_j == __pyx_v_isolute) != 0); - if (__pyx_t_14) { + goto __pyx_L7; + } - /* "src/helpers/helpers.pyx":536 - * for j in range(first,last+1): - * if j == isolute: - * continue # <<<<<<<<<<<<<< - * tmp_perm=0.0 - * tmp_ind=0.0 + /* "View.MemoryView":534 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_INDIRECT: */ - goto __pyx_L5_continue; + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; - /* "src/helpers/helpers.pyx":535 - * # loop over solvent molecules - * for j in range(first,last+1): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * tmp_perm=0.0 + /* "View.MemoryView":536 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: */ - } + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":537 - * if j == isolute: - * continue - * tmp_perm=0.0 # <<<<<<<<<<<<<< - * tmp_ind=0.0 - * for k in range(apr[j]): + /* "View.MemoryView":537 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL */ - __pyx_v_tmp_perm = 0.0; + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; - /* "src/helpers/helpers.pyx":538 - * continue - * tmp_perm=0.0 - * tmp_ind=0.0 # <<<<<<<<<<<<<< - * for k in range(apr[j]): - * idx2 = rfa[j] + k + /* "View.MemoryView":536 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: */ - __pyx_v_tmp_ind = 0.0; + goto __pyx_L8; + } - /* "src/helpers/helpers.pyx":539 - * tmp_perm=0.0 - * tmp_ind=0.0 - * for k in range(apr[j]): # <<<<<<<<<<<<<< - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] + /* "View.MemoryView":539 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_FORMAT: */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_k = __pyx_t_17; + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; - /* "src/helpers/helpers.pyx":540 - * tmp_ind=0.0 - * for k in range(apr[j]): - * idx2 = rfa[j] + k # <<<<<<<<<<<<<< - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] + /* "View.MemoryView":541 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":541 - * for k in range(apr[j]): - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] + /* "View.MemoryView":542 + * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_18 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_19 = __pyx_v_idx2; - __pyx_t_20 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; - /* "src/helpers/helpers.pyx":542 - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) + /* "View.MemoryView":541 + * info.suboffsets = NULL + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: */ - __pyx_t_20 = __pyx_v_idx; - __pyx_t_19 = 1; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_t_18 = __pyx_v_idx2; - __pyx_t_4 = 1; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); + goto __pyx_L9; + } - /* "src/helpers/helpers.pyx":543 - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< - * r = sqrt(dx*dx + dy*dy + dz*dz) - * qq = charges[idx] * charges[idx2] / r + /* "View.MemoryView":544 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< + * + * info.buf = self.view.buf */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_18 = 2; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_19 = __pyx_v_idx2; - __pyx_t_20 = 2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); + /*else*/ { + __pyx_v_info->format = NULL; + } + __pyx_L9:; - /* "src/helpers/helpers.pyx":544 - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< - * qq = charges[idx] * charges[idx2] / r + /* "View.MemoryView":546 + * info.format = NULL * + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize */ - __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; - /* "src/helpers/helpers.pyx":545 - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - * qq = charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< + /* "View.MemoryView":547 * - * if drude[k]==1: + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len */ - __pyx_t_20 = __pyx_v_idx; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges.shape[0]; - __pyx_t_19 = __pyx_v_idx2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; - __pyx_t_7 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_20 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) )))); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 545, __pyx_L1_error) - } - __pyx_v_qq = (__pyx_t_7 / __pyx_v_r); + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; - /* "src/helpers/helpers.pyx":547 - * qq = charges[idx] * charges[idx2] / r - * - * if drude[k]==1: # <<<<<<<<<<<<<< - * epa_ind[i]+=qq - * tmp_ind +=qq + /* "View.MemoryView":548 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly */ - __pyx_t_19 = __pyx_v_k; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_drude.shape[0]; - __pyx_t_14 = (((*((double *) ( /* dim=0 */ (__pyx_v_drude.data + __pyx_t_19 * __pyx_v_drude.strides[0]) ))) == 1.0) != 0); - if (__pyx_t_14) { + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; - /* "src/helpers/helpers.pyx":548 - * - * if drude[k]==1: - * epa_ind[i]+=qq # <<<<<<<<<<<<<< - * tmp_ind +=qq - * else: + /* "View.MemoryView":549 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self */ - __pyx_t_19 = __pyx_v_i; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa_ind.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_epa_ind.data + __pyx_t_19 * __pyx_v_epa_ind.strides[0]) )) += __pyx_v_qq; + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; - /* "src/helpers/helpers.pyx":549 - * if drude[k]==1: - * epa_ind[i]+=qq - * tmp_ind +=qq # <<<<<<<<<<<<<< - * else: - * epa_perm[i]+=qq + /* "View.MemoryView":550 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * */ - __pyx_v_tmp_ind = (__pyx_v_tmp_ind + __pyx_v_qq); + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; - /* "src/helpers/helpers.pyx":547 - * qq = charges[idx] * charges[idx2] / r + /* "View.MemoryView":551 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * * - * if drude[k]==1: # <<<<<<<<<<<<<< - * epa_ind[i]+=qq - * tmp_ind +=qq */ - goto __pyx_L10; - } + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "src/helpers/helpers.pyx":551 - * tmp_ind +=qq - * else: - * epa_perm[i]+=qq # <<<<<<<<<<<<<< - * tmp_perm +=qq - * if kobj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":553 - * epa_perm[i]+=qq - * tmp_perm +=qq - * if kfrom_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 557, __pyx_L1_error) - /* "src/helpers/helpers.pyx":560 - * tmp_perm = tmp_perm+qq_diff + /* "View.MemoryView":558 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< * - * r=sqrt(coms[j,0]*coms[j,0]+coms[j,1]*coms[j,1]+coms[j,2]*coms[j,2]) # <<<<<<<<<<<<<< - * if r < histo_min: - * histo_error=1 + * @property */ - __pyx_t_20 = __pyx_v_j; - __pyx_t_19 = 0; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coms.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coms.shape[1]; - __pyx_t_18 = __pyx_v_j; - __pyx_t_4 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coms.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coms.shape[1]; - __pyx_t_22 = __pyx_v_j; - __pyx_t_23 = 1; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coms.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_coms.shape[1]; - __pyx_t_24 = __pyx_v_j; - __pyx_t_25 = 1; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_coms.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_coms.shape[1]; - __pyx_t_26 = __pyx_v_j; - __pyx_t_27 = 2; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coms.shape[0]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coms.shape[1]; - __pyx_t_28 = __pyx_v_j; - __pyx_t_29 = 2; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_coms.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_coms.shape[1]; - __pyx_v_r = sqrt(((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_20 * __pyx_v_coms.strides[0]) ) + __pyx_t_19 * __pyx_v_coms.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_18 * __pyx_v_coms.strides[0]) ) + __pyx_t_4 * __pyx_v_coms.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_22 * __pyx_v_coms.strides[0]) ) + __pyx_t_23 * __pyx_v_coms.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_24 * __pyx_v_coms.strides[0]) ) + __pyx_t_25 * __pyx_v_coms.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_26 * __pyx_v_coms.strides[0]) ) + __pyx_t_27 * __pyx_v_coms.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_28 * __pyx_v_coms.strides[0]) ) + __pyx_t_29 * __pyx_v_coms.strides[1]) )))))); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":561 + /* "View.MemoryView":554 * - * r=sqrt(coms[j,0]*coms[j,0]+coms[j,1]*coms[j,1]+coms[j,2]*coms[j,2]) - * if r < histo_min: # <<<<<<<<<<<<<< - * histo_error=1 - * elif r >= histo_max: + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ - __pyx_t_14 = ((__pyx_v_r < __pyx_v_histo_min) != 0); - if (__pyx_t_14) { - /* "src/helpers/helpers.pyx":562 - * r=sqrt(coms[j,0]*coms[j,0]+coms[j,1]*coms[j,1]+coms[j,2]*coms[j,2]) - * if r < histo_min: - * histo_error=1 # <<<<<<<<<<<<<< - * elif r >= histo_max: - * histo_error=2 - */ - __pyx_v_histo_error = 1; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":561 +/* "View.MemoryView":560 + * return result * - * r=sqrt(coms[j,0]*coms[j,0]+coms[j,1]*coms[j,1]+coms[j,2]*coms[j,2]) - * if r < histo_min: # <<<<<<<<<<<<<< - * histo_error=1 - * elif r >= histo_max: + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ - goto __pyx_L14; - } - /* "src/helpers/helpers.pyx":563 - * if r < histo_min: - * histo_error=1 - * elif r >= histo_max: # <<<<<<<<<<<<<< - * histo_error=2 - * else: - */ - __pyx_t_14 = ((__pyx_v_r >= __pyx_v_histo_max) != 0); - if (__pyx_t_14) { +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/helpers.pyx":564 - * histo_error=1 - * elif r >= histo_max: - * histo_error=2 # <<<<<<<<<<<<<< - * else: - * histo_perm[int((r-histo_min)/histo_width)]+=tmp_perm - */ - __pyx_v_histo_error = 2; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":563 - * if r < histo_min: - * histo_error=1 - * elif r >= histo_max: # <<<<<<<<<<<<<< - * histo_error=2 - * else: - */ - goto __pyx_L14; - } +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/helpers.pyx":566 - * histo_error=2 - * else: - * histo_perm[int((r-histo_min)/histo_width)]+=tmp_perm # <<<<<<<<<<<<<< - * histo_ind[int((r-histo_min)/histo_width)] +=tmp_ind + /* "View.MemoryView":562 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< * + * cdef _get_base(self): */ - /*else*/ { - __pyx_t_7 = (__pyx_v_r - __pyx_v_histo_min); - if (unlikely(__pyx_v_histo_width == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 566, __pyx_L1_error) - } - __pyx_t_29 = ((Py_ssize_t)(__pyx_t_7 / __pyx_v_histo_width)); - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_histo_perm.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_histo_perm.data + __pyx_t_29 * __pyx_v_histo_perm.strides[0]) )) += __pyx_v_tmp_perm; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":567 - * else: - * histo_perm[int((r-histo_min)/histo_width)]+=tmp_perm - * histo_ind[int((r-histo_min)/histo_width)] +=tmp_ind # <<<<<<<<<<<<<< + /* "View.MemoryView":560 + * return result * - * for i in range(apr[isolute]): + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ - __pyx_t_7 = (__pyx_v_r - __pyx_v_histo_min); - if (unlikely(__pyx_v_histo_width == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 567, __pyx_L1_error) - } - __pyx_t_29 = ((Py_ssize_t)(__pyx_t_7 / __pyx_v_histo_width)); - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_histo_ind.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_histo_ind.data + __pyx_t_29 * __pyx_v_histo_ind.strides[0]) )) += __pyx_v_tmp_ind; - } - __pyx_L14:; - __pyx_L5_continue:; - } - } - /* "src/helpers/helpers.pyx":569 - * histo_ind[int((r-histo_min)/histo_width)] +=tmp_ind - * - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * energy_perm += epa_perm[i] - * energy_ind += epa_ind[i] - */ - __pyx_t_29 = __pyx_v_isolute; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_apr.shape[0]; - __pyx_t_8 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_29 * __pyx_v_apr.strides[0]) ))); - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":570 +/* "View.MemoryView":564 + * return self._get_base() * - * for i in range(apr[isolute]): - * energy_perm += epa_perm[i] # <<<<<<<<<<<<<< - * energy_ind += epa_ind[i] + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj * */ - __pyx_t_29 = __pyx_v_i; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_epa_perm.shape[0]; - __pyx_v_energy_perm = (__pyx_v_energy_perm + (*((double *) ( /* dim=0 */ (__pyx_v_epa_perm.data + __pyx_t_29 * __pyx_v_epa_perm.strides[0]) )))); - /* "src/helpers/helpers.pyx":571 - * for i in range(apr[isolute]): - * energy_perm += epa_perm[i] - * energy_ind += epa_ind[i] # <<<<<<<<<<<<<< - * - * return energy_perm * 1390.02 , energy_ind * 1390.02, np.asarray(histo_perm)[:] * 1390.02, np.asarray(histo_ind)[:] * 1390.02 , histo_error - */ - __pyx_t_29 = __pyx_v_i; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_epa_ind.shape[0]; - __pyx_v_energy_ind = (__pyx_v_energy_ind + (*((double *) ( /* dim=0 */ (__pyx_v_epa_ind.data + __pyx_t_29 * __pyx_v_epa_ind.strides[0]) )))); - } +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); - /* "src/helpers/helpers.pyx":573 - * energy_ind += epa_ind[i] + /* "View.MemoryView":565 * - * return energy_perm * 1390.02 , energy_ind * 1390.02, np.asarray(histo_perm)[:] * 1390.02, np.asarray(histo_ind)[:] * 1390.02 , histo_error # <<<<<<<<<<<<<< + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_energy_perm * 1390.02)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble((__pyx_v_energy_ind * 1390.02)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_30); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_histo_perm, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_31 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_30))) { - __pyx_t_31 = PyMethod_GET_SELF(__pyx_t_30); - if (likely(__pyx_t_31)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_30); - __Pyx_INCREF(__pyx_t_31); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_30, function); - } - } - __pyx_t_3 = (__pyx_t_31) ? __Pyx_PyObject_Call2Args(__pyx_t_30, __pyx_t_31, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_30, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - __pyx_t_30 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 0, NULL, NULL, &__pyx_slice__2, 0, 0, 1); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_30); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_30, __pyx_float_1390_02); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_31 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_31); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_histo_ind, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_32 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_31))) { - __pyx_t_32 = PyMethod_GET_SELF(__pyx_t_31); - if (likely(__pyx_t_32)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_31); - __Pyx_INCREF(__pyx_t_32); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_31, function); - } - } - __pyx_t_30 = (__pyx_t_32) ? __Pyx_PyObject_Call2Args(__pyx_t_31, __pyx_t_32, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_31, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_32); __pyx_t_32 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_30); - __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0; - __pyx_t_31 = __Pyx_PyObject_GetSlice(__pyx_t_30, 0, 0, NULL, NULL, &__pyx_slice__2, 0, 0, 1); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_31); - __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - __pyx_t_30 = PyNumber_Multiply(__pyx_t_31, __pyx_float_1390_02); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_30); - __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0; - __pyx_t_31 = __Pyx_PyInt_From_int(__pyx_v_histo_error); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_31); - __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_30); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_30); - __Pyx_GIVEREF(__pyx_t_31); - PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_31); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_30 = 0; - __pyx_t_31 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; goto __pyx_L0; - /* "src/helpers/helpers.pyx":511 + /* "View.MemoryView":564 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj * - * @cython.boundscheck(False) - * def calcEnergyAApermindhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude,double histo_min, double histo_max, int histo_bins,): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list, min_histo, max_histo, bins_histo) */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_XDECREF(__pyx_t_30); - __Pyx_XDECREF(__pyx_t_31); - __Pyx_XDECREF(__pyx_t_32); - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAApermindhisto", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_epa_ind, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_epa_perm, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histo_perm, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histo_ind, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coms, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_drude, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":576 +/* "View.MemoryView":567 + * return self.obj * - * @cython.boundscheck(False) - * def calcEnergyAtomic(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules) + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_31calcEnergyAtomic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_30calcEnergyAtomic[] = "\n energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules)\n\n Calculates the atom-resolved solvation energy of a solute in any solvent for a specific coordinate set.\n \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_31calcEnergyAtomic = {"calcEnergyAtomic", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_31calcEnergyAtomic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_30calcEnergyAtomic}; -static PyObject *__pyx_pw_11newanalysis_7helpers_31calcEnergyAtomic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_isolute; - int __pyx_v_nmol; - int __pyx_v_exclude_begin; - int __pyx_v_exclude_end; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcEnergyAtomic (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_exclude_begin,&__pyx_n_s_exclude_end,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, 1); __PYX_ERR(0, 576, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, 2); __PYX_ERR(0, 576, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, 3); __PYX_ERR(0, 576, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, 4); __PYX_ERR(0, 576, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, 5); __PYX_ERR(0, 576, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exclude_begin); - if (value) { values[6] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 7: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exclude_end); - if (value) { values[7] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcEnergyAtomic") < 0)) __PYX_ERR(0, 576, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 576, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 576, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 576, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 576, __pyx_L3_error) - __pyx_v_isolute = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L3_error) - __pyx_v_nmol = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L3_error) - if (values[6]) { - __pyx_v_exclude_begin = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_exclude_begin == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L3_error) - } else { - __pyx_v_exclude_begin = ((int)-1); - } - if (values[7]) { - __pyx_v_exclude_end = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_exclude_end == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L3_error) - } else { - __pyx_v_exclude_end = ((int)-1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 576, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_30calcEnergyAtomic(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_exclude_begin, __pyx_v_exclude_end); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_30calcEnergyAtomic(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, int __pyx_v_exclude_begin, int __pyx_v_exclude_end) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_idx; - int __pyx_v_idx2; - __Pyx_memviewslice __pyx_v_epa = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_r; +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - double __pyx_t_21; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcEnergyAtomic", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/helpers.pyx":584 - * """ - * cdef int i, j, k, idx, idx2 - * cdef double [:] epa = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, r + /* "View.MemoryView":569 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< * + * @property */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyInt_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 584, __pyx_L1_error) + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_epa = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":589 - * # loop over solute atoms - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * idx = rfa[isolute] + i - * # loop over solvent molecules + /* "View.MemoryView":567 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_7 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - /* "src/helpers/helpers.pyx":590 - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): - * idx = rfa[isolute] + i # <<<<<<<<<<<<<< - * # loop over solvent molecules - * for j in range(nmol): - */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":592 - * idx = rfa[isolute] + i - * # loop over solvent molecules - * for j in range(nmol): # <<<<<<<<<<<<<< - * if j == isolute or (j >= exclude_begin and j < exclude_end): - * continue +/* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ - __pyx_t_10 = __pyx_v_nmol; - __pyx_t_11 = __pyx_t_10; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; - /* "src/helpers/helpers.pyx":593 - * # loop over solvent molecules - * for j in range(nmol): - * if j == isolute or (j >= exclude_begin and j < exclude_end): # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): - */ - __pyx_t_14 = ((__pyx_v_j == __pyx_v_isolute) != 0); - if (!__pyx_t_14) { - } else { - __pyx_t_13 = __pyx_t_14; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_14 = ((__pyx_v_j >= __pyx_v_exclude_begin) != 0); - if (__pyx_t_14) { - } else { - __pyx_t_13 = __pyx_t_14; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_14 = ((__pyx_v_j < __pyx_v_exclude_end) != 0); - __pyx_t_13 = __pyx_t_14; - __pyx_L8_bool_binop_done:; - if (__pyx_t_13) { +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/helpers.pyx":594 - * for j in range(nmol): - * if j == isolute or (j >= exclude_begin and j < exclude_end): - * continue # <<<<<<<<<<<<<< - * for k in range(apr[j]): - * idx2 = rfa[j] + k + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" */ - goto __pyx_L5_continue; + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/helpers.pyx":593 - * # loop over solvent molecules - * for j in range(nmol): - * if j == isolute or (j >= exclude_begin and j < exclude_end): # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): + /* "View.MemoryView":575 + * if self.view.strides == NULL: + * + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - } + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 575, __pyx_L1_error) - /* "src/helpers/helpers.pyx":595 - * if j == isolute or (j >= exclude_begin and j < exclude_end): - * continue - * for k in range(apr[j]): # <<<<<<<<<<<<<< - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_k = __pyx_t_17; + } - /* "src/helpers/helpers.pyx":596 - * continue - * for k in range(apr[j]): - * idx2 = rfa[j] + k # <<<<<<<<<<<<<< - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] + /* "View.MemoryView":577 + * raise ValueError, "Buffer view does not expose strides" + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":597 - * for k in range(apr[j]): - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] + /* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_18 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_19 = __pyx_v_idx2; - __pyx_t_20 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); - /* "src/helpers/helpers.pyx":598 - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ - __pyx_t_20 = __pyx_v_idx; - __pyx_t_19 = 1; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_t_18 = __pyx_v_idx2; - __pyx_t_4 = 1; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); - /* "src/helpers/helpers.pyx":599 - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< - * r = sqrt(dx*dx + dy*dy + dz*dz) - * epa[i] += charges[idx] * charges[idx2] / r +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_18 = 2; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_19 = __pyx_v_idx2; - __pyx_t_20 = 2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":600 - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< - * epa[i] += charges[idx] * charges[idx2] / r + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":601 - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - * epa[i] += charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim * - * return np.asarray(epa)[:] * 1390.02 */ - __pyx_t_20 = __pyx_v_idx; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges.shape[0]; - __pyx_t_19 = __pyx_v_idx2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; - __pyx_t_21 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_20 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) )))); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 601, __pyx_L1_error) - } - __pyx_t_19 = __pyx_v_i; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_19 * __pyx_v_epa.strides[0]) )) += (__pyx_t_21 / __pyx_v_r); - } - __pyx_L5_continue:; - } } - /* "src/helpers/helpers.pyx":603 - * epa[i] += charges[idx] * charges[idx2] / r + /* "View.MemoryView":584 + * return (-1,) * self.view.ndim * - * return np.asarray(epa)[:] * 1390.02 # <<<<<<<<<<<<<< + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * @property */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_epa, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, NULL, NULL, &__pyx_slice__2, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_float_1390_02); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; goto __pyx_L0; - /* "src/helpers/helpers.pyx":576 + /* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) * - * @cython.boundscheck(False) - * def calcEnergyAtomic(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules) + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_epa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":606 +/* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) * - * @cython.boundscheck(False) - * def calcEnergyDouble(double [:,:] coor, double [:] charges1, int [:] apr, int [:] rfa, int isolute, int nmol, int start, int end): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyDouble(xyz, charges_1, charges_2, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,start_res,end_res) + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_33calcEnergyDouble(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_32calcEnergyDouble[] = "\n energy = calcEnergyDouble(xyz, charges_1, charges_2, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,start_res,end_res)\n\n Calculates the atom-resolved solvation energy of a solute in any solvent for a specific coordinate set \n \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_33calcEnergyDouble = {"calcEnergyDouble", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_33calcEnergyDouble, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_32calcEnergyDouble}; -static PyObject *__pyx_pw_11newanalysis_7helpers_33calcEnergyDouble(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_isolute; - int __pyx_v_nmol; - int __pyx_v_start; - int __pyx_v_end; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcEnergyDouble (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges1,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_start,&__pyx_n_s_end,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 1); __PYX_ERR(0, 606, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 2); __PYX_ERR(0, 606, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 3); __PYX_ERR(0, 606, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 4); __PYX_ERR(0, 606, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 5); __PYX_ERR(0, 606, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 6); __PYX_ERR(0, 606, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 7); __PYX_ERR(0, 606, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcEnergyDouble") < 0)) __PYX_ERR(0, 606, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 606, __pyx_L3_error) - __pyx_v_charges1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges1.memview)) __PYX_ERR(0, 606, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 606, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 606, __pyx_L3_error) - __pyx_v_isolute = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 606, __pyx_L3_error) - __pyx_v_nmol = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 606, __pyx_L3_error) - __pyx_v_start = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 606, __pyx_L3_error) - __pyx_v_end = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 606, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 606, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyDouble", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_32calcEnergyDouble(__pyx_self, __pyx_v_coor, __pyx_v_charges1, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_start, __pyx_v_end); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_32calcEnergyDouble(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges1, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, int __pyx_v_start, int __pyx_v_end) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_idx; - int __pyx_v_idx2; - __Pyx_memviewslice __pyx_v_epa1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_r; +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - double __pyx_t_21; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcEnergyDouble", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/helpers.pyx":614 - * """ - * cdef int i, j, k, idx, idx2 - * cdef double [:] epa1 = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, r + /* "View.MemoryView":588 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< * + * @property */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_epa1 = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - - /* "src/helpers/helpers.pyx":619 - * # loop over solute atoms - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * idx = rfa[isolute] + i - * if charges1[idx]==0: - */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_7 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_8 = __pyx_t_7; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - - /* "src/helpers/helpers.pyx":620 - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): - * idx = rfa[isolute] + i # <<<<<<<<<<<<<< - * if charges1[idx]==0: - * continue - */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); - - /* "src/helpers/helpers.pyx":621 - * for i in range(apr[isolute]): - * idx = rfa[isolute] + i - * if charges1[idx]==0: # <<<<<<<<<<<<<< - * continue - * # loop over solvent molecules - */ - __pyx_t_4 = __pyx_v_idx; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_charges1.shape[0]; - __pyx_t_10 = (((*((double *) ( /* dim=0 */ (__pyx_v_charges1.data + __pyx_t_4 * __pyx_v_charges1.strides[0]) ))) == 0.0) != 0); - if (__pyx_t_10) { + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":622 - * idx = rfa[isolute] + i - * if charges1[idx]==0: - * continue # <<<<<<<<<<<<<< - * # loop over solvent molecules - * for j in range(nmol): + /* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ - goto __pyx_L3_continue; - /* "src/helpers/helpers.pyx":621 - * for i in range(apr[isolute]): - * idx = rfa[isolute] + i - * if charges1[idx]==0: # <<<<<<<<<<<<<< - * continue - * # loop over solvent molecules - */ - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":624 - * continue - * # loop over solvent molecules - * for j in range(nmol): # <<<<<<<<<<<<<< - * if j == isolute or j < start or j > end: - * continue +/* "View.MemoryView":590 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ - __pyx_t_11 = __pyx_v_nmol; - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_j = __pyx_t_13; - /* "src/helpers/helpers.pyx":625 - * # loop over solvent molecules - * for j in range(nmol): - * if j == isolute or j < start or j > end: # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): - */ - __pyx_t_14 = ((__pyx_v_j == __pyx_v_isolute) != 0); - if (!__pyx_t_14) { - } else { - __pyx_t_10 = __pyx_t_14; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_14 = ((__pyx_v_j < __pyx_v_start) != 0); - if (!__pyx_t_14) { - } else { - __pyx_t_10 = __pyx_t_14; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_14 = ((__pyx_v_j > __pyx_v_end) != 0); - __pyx_t_10 = __pyx_t_14; - __pyx_L9_bool_binop_done:; - if (__pyx_t_10) { +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/helpers.pyx":626 - * for j in range(nmol): - * if j == isolute or j < start or j > end: - * continue # <<<<<<<<<<<<<< - * for k in range(apr[j]): - * idx2 = rfa[j] + k - */ - goto __pyx_L6_continue; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":625 - * # loop over solvent molecules - * for j in range(nmol): - * if j == isolute or j < start or j > end: # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): - */ - } +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/helpers.pyx":627 - * if j == isolute or j < start or j > end: - * continue - * for k in range(apr[j]): # <<<<<<<<<<<<<< - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] + /* "View.MemoryView":592 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_k = __pyx_t_17; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":628 - * continue - * for k in range(apr[j]): - * idx2 = rfa[j] + k # <<<<<<<<<<<<<< - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] + /* "View.MemoryView":590 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); - /* "src/helpers/helpers.pyx":629 - * for k in range(apr[j]): - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] - */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_18 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_19 = __pyx_v_idx2; - __pyx_t_20 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":630 - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) +/* "View.MemoryView":594 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize */ - __pyx_t_20 = __pyx_v_idx; - __pyx_t_19 = 1; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_t_18 = __pyx_v_idx2; - __pyx_t_4 = 1; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); - /* "src/helpers/helpers.pyx":631 - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< - * r = sqrt(dx*dx + dy*dy + dz*dz) - * epa1[i] += charges1[idx] * charges1[idx2] / r - */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_18 = 2; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_19 = __pyx_v_idx2; - __pyx_t_20 = 2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/helpers.pyx":632 - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< - * epa1[i] += charges1[idx] * charges1[idx2] / r - * - */ - __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":633 - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - * epa1[i] += charges1[idx] * charges1[idx2] / r # <<<<<<<<<<<<<< - * - * return np.asarray(epa1)[:] * 1390.02 - */ - __pyx_t_20 = __pyx_v_idx; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges1.shape[0]; - __pyx_t_19 = __pyx_v_idx2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges1.shape[0]; - __pyx_t_21 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges1.data + __pyx_t_20 * __pyx_v_charges1.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges1.data + __pyx_t_19 * __pyx_v_charges1.strides[0]) )))); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 633, __pyx_L1_error) - } - __pyx_t_19 = __pyx_v_i; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa1.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_epa1.data + __pyx_t_19 * __pyx_v_epa1.strides[0]) )) += (__pyx_t_21 / __pyx_v_r); - } - __pyx_L6_continue:; - } - __pyx_L3_continue:; - } +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/helpers.pyx":635 - * epa1[i] += charges1[idx] * charges1[idx2] / r - * - * return np.asarray(epa1)[:] * 1390.02 # <<<<<<<<<<<<<< + /* "View.MemoryView":596 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * @property */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_epa1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, NULL, NULL, &__pyx_slice__2, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_float_1390_02); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "src/helpers/helpers.pyx":606 + /* "View.MemoryView":594 + * return self.view.itemsize * - * @cython.boundscheck(False) - * def calcEnergyDouble(double [:,:] coor, double [:] charges1, int [:] apr, int [:] rfa, int isolute, int nmol, int start, int end): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyDouble(xyz, charges_1, charges_2, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,start_res,end_res) + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize */ /* function exit code */ @@ -13067,12606 +12329,9242 @@ static PyObject *__pyx_pf_11newanalysis_7helpers_32calcEnergyDouble(CYTHON_UNUSE __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyDouble", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_epa1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":638 +/* "View.MemoryView":598 + * return self.size * self.view.itemsize * - * @cython.boundscheck(False) - * def calcDipDipEnergyAtomic(double [:,:] coms, double [:,:] dipol, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): # <<<<<<<<<<<<<< - * """ - * energy = calcDipDipEnergyAtomic(coms, dipol, resnum_solute, nmolecules) + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_35calcDipDipEnergyAtomic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_34calcDipDipEnergyAtomic[] = "\n energy = calcDipDipEnergyAtomic(coms, dipol, resnum_solute, nmolecules)\n\n Calculates the atom-resolved solvation dipol-dipol energy of a solute in any solvent for a specific coordinate set.\n \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_35calcDipDipEnergyAtomic = {"calcDipDipEnergyAtomic", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_35calcDipDipEnergyAtomic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_34calcDipDipEnergyAtomic}; -static PyObject *__pyx_pw_11newanalysis_7helpers_35calcDipDipEnergyAtomic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coms = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dipol = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_isolute; - int __pyx_v_nmol; - int __pyx_v_exclude_begin; - int __pyx_v_exclude_end; +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDipDipEnergyAtomic (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms,&__pyx_n_s_dipol,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_exclude_begin,&__pyx_n_s_exclude_end,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coms)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dipol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipDipEnergyAtomic", 0, 4, 6, 1); __PYX_ERR(0, 638, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipDipEnergyAtomic", 0, 4, 6, 2); __PYX_ERR(0, 638, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipDipEnergyAtomic", 0, 4, 6, 3); __PYX_ERR(0, 638, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exclude_begin); - if (value) { values[4] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 5: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exclude_end); - if (value) { values[5] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDipDipEnergyAtomic") < 0)) __PYX_ERR(0, 638, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_coms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms.memview)) __PYX_ERR(0, 638, __pyx_L3_error) - __pyx_v_dipol = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dipol.memview)) __PYX_ERR(0, 638, __pyx_L3_error) - __pyx_v_isolute = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L3_error) - __pyx_v_nmol = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L3_error) - if (values[4]) { - __pyx_v_exclude_begin = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_exclude_begin == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L3_error) - } else { - __pyx_v_exclude_begin = ((int)-1); - } - if (values[5]) { - __pyx_v_exclude_end = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_exclude_end == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L3_error) - } else { - __pyx_v_exclude_end = ((int)-1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDipDipEnergyAtomic", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 638, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcDipDipEnergyAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_34calcDipDipEnergyAtomic(__pyx_self, __pyx_v_coms, __pyx_v_dipol, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_exclude_begin, __pyx_v_exclude_end); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_7helpers_34calcDipDipEnergyAtomic(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coms, __Pyx_memviewslice __pyx_v_dipol, int __pyx_v_isolute, int __pyx_v_nmol, int __pyx_v_exclude_begin, int __pyx_v_exclude_end) { - int __pyx_v_i; - double __pyx_v_edip; - double __pyx_v_r; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - double __pyx_t_18; - double __pyx_t_19; - double __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - Py_ssize_t __pyx_t_31; - Py_ssize_t __pyx_t_32; - PyObject *__pyx_t_33 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcDipDipEnergyAtomic", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/helpers.pyx":649 + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * # loop over solvent molecules - * for i in range(nmol): # <<<<<<<<<<<<<< - * if i == isolute or (i >= exclude_begin and i < exclude_end): - * continue */ - __pyx_t_1 = __pyx_v_nmol; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":650 - * # loop over solvent molecules - * for i in range(nmol): - * if i == isolute or (i >= exclude_begin and i < exclude_end): # <<<<<<<<<<<<<< - * continue - * r=sqrt(coms[i,0]*coms[i,0]+coms[i,1]*coms[i,1]+coms[i,2]*coms[i,2]) + /* "View.MemoryView":601 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< + * + * for length in self.view.shape[:self.view.ndim]: */ - __pyx_t_5 = ((__pyx_v_i == __pyx_v_isolute) != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_i >= __pyx_v_exclude_begin) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_4 = __pyx_t_5; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_i < __pyx_v_exclude_end) != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L6_bool_binop_done:; - if (__pyx_t_4) { + __Pyx_INCREF(__pyx_int_1); + __pyx_v_result = __pyx_int_1; - /* "src/helpers/helpers.pyx":651 - * for i in range(nmol): - * if i == isolute or (i >= exclude_begin and i < exclude_end): - * continue # <<<<<<<<<<<<<< - * r=sqrt(coms[i,0]*coms[i,0]+coms[i,1]*coms[i,1]+coms[i,2]*coms[i,2]) - * edip+=(dipol[0,0]*dipol[i,0]+dipol[0,1]*dipol[i,1]+dipol[0,2]*dipol[i,2])/(r*r*r)-3/(r*r*r*r*r)*(dipol[0,0]*coms[i,0]+dipol[0,1]*coms[i,1]+dipol[0,2]*coms[i,2])*(dipol[i,0]*coms[i,0]+dipol[i,1]*coms[i,1]+dipol[i,2]*coms[i,2]) + /* "View.MemoryView":603 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length + * */ - goto __pyx_L3_continue; + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyInt_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":650 - * # loop over solvent molecules - * for i in range(nmol): - * if i == isolute or (i >= exclude_begin and i < exclude_end): # <<<<<<<<<<<<<< - * continue - * r=sqrt(coms[i,0]*coms[i,0]+coms[i,1]*coms[i,1]+coms[i,2]*coms[i,2]) + /* "View.MemoryView":604 + * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result */ + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; } - /* "src/helpers/helpers.pyx":652 - * if i == isolute or (i >= exclude_begin and i < exclude_end): - * continue - * r=sqrt(coms[i,0]*coms[i,0]+coms[i,1]*coms[i,1]+coms[i,2]*coms[i,2]) # <<<<<<<<<<<<<< - * edip+=(dipol[0,0]*dipol[i,0]+dipol[0,1]*dipol[i,1]+dipol[0,2]*dipol[i,2])/(r*r*r)-3/(r*r*r*r*r)*(dipol[0,0]*coms[i,0]+dipol[0,1]*coms[i,1]+dipol[0,2]*coms[i,2])*(dipol[i,0]*coms[i,0]+dipol[i,1]*coms[i,1]+dipol[i,2]*coms[i,2]) + /* "View.MemoryView":606 + * result *= length * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size */ - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coms.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coms.shape[1]; - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coms.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coms.shape[1]; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coms.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coms.shape[1]; - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = 1; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coms.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coms.shape[1]; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 2; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coms.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms.shape[1]; - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = 2; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms.shape[1]; - __pyx_v_r = sqrt(((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_6 * __pyx_v_coms.strides[0]) ) + __pyx_t_7 * __pyx_v_coms.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_8 * __pyx_v_coms.strides[0]) ) + __pyx_t_9 * __pyx_v_coms.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_10 * __pyx_v_coms.strides[0]) ) + __pyx_t_11 * __pyx_v_coms.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_12 * __pyx_v_coms.strides[0]) ) + __pyx_t_13 * __pyx_v_coms.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_14 * __pyx_v_coms.strides[0]) ) + __pyx_t_15 * __pyx_v_coms.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_16 * __pyx_v_coms.strides[0]) ) + __pyx_t_17 * __pyx_v_coms.strides[1]) )))))); + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; - /* "src/helpers/helpers.pyx":653 - * continue - * r=sqrt(coms[i,0]*coms[i,0]+coms[i,1]*coms[i,1]+coms[i,2]*coms[i,2]) - * edip+=(dipol[0,0]*dipol[i,0]+dipol[0,1]*dipol[i,1]+dipol[0,2]*dipol[i,2])/(r*r*r)-3/(r*r*r*r*r)*(dipol[0,0]*coms[i,0]+dipol[0,1]*coms[i,1]+dipol[0,2]*coms[i,2])*(dipol[i,0]*coms[i,0]+dipol[i,1]*coms[i,1]+dipol[i,2]*coms[i,2]) # <<<<<<<<<<<<<< + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * return edip * 1390.02 */ - __pyx_t_17 = 0; - __pyx_t_16 = 0; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_dipol.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_dipol.shape[1]; - __pyx_t_15 = __pyx_v_i; - __pyx_t_14 = 0; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_dipol.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_dipol.shape[1]; - __pyx_t_13 = 0; - __pyx_t_12 = 1; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_dipol.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_dipol.shape[1]; - __pyx_t_11 = __pyx_v_i; - __pyx_t_10 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dipol.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_dipol.shape[1]; - __pyx_t_9 = 0; - __pyx_t_8 = 2; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_dipol.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dipol.shape[1]; - __pyx_t_7 = __pyx_v_i; - __pyx_t_6 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipol.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dipol.shape[1]; - __pyx_t_18 = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_17 * __pyx_v_dipol.strides[0]) ) + __pyx_t_16 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_15 * __pyx_v_dipol.strides[0]) ) + __pyx_t_14 * __pyx_v_dipol.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_13 * __pyx_v_dipol.strides[0]) ) + __pyx_t_12 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_11 * __pyx_v_dipol.strides[0]) ) + __pyx_t_10 * __pyx_v_dipol.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_9 * __pyx_v_dipol.strides[0]) ) + __pyx_t_8 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_7 * __pyx_v_dipol.strides[0]) ) + __pyx_t_6 * __pyx_v_dipol.strides[1]) ))))); - __pyx_t_19 = ((__pyx_v_r * __pyx_v_r) * __pyx_v_r); - if (unlikely(__pyx_t_19 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 653, __pyx_L1_error) - } - __pyx_t_20 = ((((__pyx_v_r * __pyx_v_r) * __pyx_v_r) * __pyx_v_r) * __pyx_v_r); - if (unlikely(__pyx_t_20 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 653, __pyx_L1_error) - } - __pyx_t_6 = 0; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dipol.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipol.shape[1]; - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coms.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coms.shape[1]; - __pyx_t_10 = 0; - __pyx_t_11 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_dipol.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dipol.shape[1]; - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = 1; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coms.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coms.shape[1]; - __pyx_t_14 = 0; - __pyx_t_15 = 2; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_dipol.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_dipol.shape[1]; - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = 2; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms.shape[1]; - __pyx_t_21 = __pyx_v_i; - __pyx_t_22 = 0; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_dipol.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_dipol.shape[1]; - __pyx_t_23 = __pyx_v_i; - __pyx_t_24 = 0; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_coms.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_coms.shape[1]; - __pyx_t_25 = __pyx_v_i; - __pyx_t_26 = 1; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_dipol.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_dipol.shape[1]; - __pyx_t_27 = __pyx_v_i; - __pyx_t_28 = 1; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coms.shape[0]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_coms.shape[1]; - __pyx_t_29 = __pyx_v_i; - __pyx_t_30 = 2; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_dipol.shape[0]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_dipol.shape[1]; - __pyx_t_31 = __pyx_v_i; - __pyx_t_32 = 2; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_coms.shape[0]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_coms.shape[1]; - __pyx_v_edip = (__pyx_v_edip + ((__pyx_t_18 / __pyx_t_19) - (((3.0 / __pyx_t_20) * ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_6 * __pyx_v_dipol.strides[0]) ) + __pyx_t_7 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_8 * __pyx_v_coms.strides[0]) ) + __pyx_t_9 * __pyx_v_coms.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_10 * __pyx_v_dipol.strides[0]) ) + __pyx_t_11 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_12 * __pyx_v_coms.strides[0]) ) + __pyx_t_13 * __pyx_v_coms.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_14 * __pyx_v_dipol.strides[0]) ) + __pyx_t_15 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_16 * __pyx_v_coms.strides[0]) ) + __pyx_t_17 * __pyx_v_coms.strides[1]) )))))) * ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_21 * __pyx_v_dipol.strides[0]) ) + __pyx_t_22 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_23 * __pyx_v_coms.strides[0]) ) + __pyx_t_24 * __pyx_v_coms.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_25 * __pyx_v_dipol.strides[0]) ) + __pyx_t_26 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_27 * __pyx_v_coms.strides[0]) ) + __pyx_t_28 * __pyx_v_coms.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_29 * __pyx_v_dipol.strides[0]) ) + __pyx_t_30 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_31 * __pyx_v_coms.strides[0]) ) + __pyx_t_32 * __pyx_v_coms.strides[1]) )))))))); - __pyx_L3_continue:; } - /* "src/helpers/helpers.pyx":655 - * edip+=(dipol[0,0]*dipol[i,0]+dipol[0,1]*dipol[i,1]+dipol[0,2]*dipol[i,2])/(r*r*r)-3/(r*r*r*r*r)*(dipol[0,0]*coms[i,0]+dipol[0,1]*coms[i,1]+dipol[0,2]*coms[i,2])*(dipol[i,0]*coms[i,0]+dipol[i,1]*coms[i,1]+dipol[i,2]*coms[i,2]) - * - * return edip * 1390.02 # <<<<<<<<<<<<<< + /* "View.MemoryView":608 + * self._size = result * + * return self._size # <<<<<<<<<<<<<< * + * def __len__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_33 = PyFloat_FromDouble((__pyx_v_edip * 1390.02)); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_33); - __pyx_r = __pyx_t_33; - __pyx_t_33 = 0; + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; goto __pyx_L0; - /* "src/helpers/helpers.pyx":638 + /* "View.MemoryView":598 + * return self.size * self.view.itemsize * - * @cython.boundscheck(False) - * def calcDipDipEnergyAtomic(double [:,:] coms, double [:,:] dipol, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): # <<<<<<<<<<<<<< - * """ - * energy = calcDipDipEnergyAtomic(coms, dipol, resnum_solute, nmolecules) + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_33); - __Pyx_AddTraceback("newanalysis.helpers.calcDipDipEnergyAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_coms, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dipol, 1); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":659 +/* "View.MemoryView":610 + * return self._size * - * @cython.boundscheck(False) - * def calcEnergyAtomicVoro(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, char [:] ds, int maxshell): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, delaunay_shell) + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_37calcEnergyAtomicVoro(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_36calcEnergyAtomicVoro[] = "\n energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, delaunay_shell)\n\n Calculates the atom+shell-resolved solvation energy of a solute in any solvent for a specific coordinate set.\n \n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_37calcEnergyAtomicVoro = {"calcEnergyAtomicVoro", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_37calcEnergyAtomicVoro, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_36calcEnergyAtomicVoro}; -static PyObject *__pyx_pw_11newanalysis_7helpers_37calcEnergyAtomicVoro(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_isolute; - int __pyx_v_nmol; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcEnergyAtomicVoro (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_ds,&__pyx_n_s_maxshell,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 1); __PYX_ERR(0, 659, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 2); __PYX_ERR(0, 659, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 3); __PYX_ERR(0, 659, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 4); __PYX_ERR(0, 659, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 5); __PYX_ERR(0, 659, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 6); __PYX_ERR(0, 659, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 7); __PYX_ERR(0, 659, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcEnergyAtomicVoro") < 0)) __PYX_ERR(0, 659, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 659, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 659, __pyx_L3_error) - __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 659, __pyx_L3_error) - __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 659, __pyx_L3_error) - __pyx_v_isolute = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 659, __pyx_L3_error) - __pyx_v_nmol = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 659, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 659, __pyx_L3_error) - __pyx_v_maxshell = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 659, __pyx_L3_error) + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__len__", 0); + + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * + */ + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { + + /* "View.MemoryView":612 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< + * + * return 0 + */ + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * + */ } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 659, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAtomicVoro", __pyx_clineno, __pyx_lineno, __pyx_filename); + + /* "View.MemoryView":614 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":610 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] + */ + + /* function exit code */ + __pyx_L0:; __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_36calcEnergyAtomicVoro(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_ds, __pyx_v_maxshell); + return __pyx_r; +} + +/* "View.MemoryView":616 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_36calcEnergyAtomicVoro(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_idx; - int __pyx_v_idx2; - __Pyx_memviewslice __pyx_v_epa = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_r; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - double __pyx_t_21; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcEnergyAtomicVoro", 0); + __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/helpers/helpers.pyx":667 - * """ - * cdef int i, j, k, idx, idx2 - * cdef double [:,:] epa = np.zeros((apr[isolute],maxshell+1)) # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, r + /* "View.MemoryView":617 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_v_maxshell + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __pyx_t_2 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 667, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_epa = __pyx_t_7; - __pyx_t_7.memview = NULL; - __pyx_t_7.data = NULL; - - /* "src/helpers/helpers.pyx":672 - * # loop over solute atoms - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): # <<<<<<<<<<<<<< - * idx = rfa[isolute] + i - * # loop over solvent molecules - */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_8 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; - - /* "src/helpers/helpers.pyx":673 - * # for i in prange(apr[isolute], nogil=True): - * for i in range(apr[isolute]): - * idx = rfa[isolute] + i # <<<<<<<<<<<<<< - * # loop over solvent molecules - * for j in range(nmol): - */ - __pyx_t_4 = __pyx_v_isolute; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); - - /* "src/helpers/helpers.pyx":675 - * idx = rfa[isolute] + i - * # loop over solvent molecules - * for j in range(nmol): # <<<<<<<<<<<<<< - * if j == isolute: - * continue - */ - __pyx_t_11 = __pyx_v_nmol; - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_j = __pyx_t_13; - - /* "src/helpers/helpers.pyx":676 - * # loop over solvent molecules - * for j in range(nmol): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): - */ - __pyx_t_14 = ((__pyx_v_j == __pyx_v_isolute) != 0); - if (__pyx_t_14) { - - /* "src/helpers/helpers.pyx":677 - * for j in range(nmol): - * if j == isolute: - * continue # <<<<<<<<<<<<<< - * for k in range(apr[j]): - * idx2 = rfa[j] + k - */ - goto __pyx_L5_continue; - - /* "src/helpers/helpers.pyx":676 - * # loop over solvent molecules - * for j in range(nmol): - * if j == isolute: # <<<<<<<<<<<<<< - * continue - * for k in range(apr[j]): - */ - } - - /* "src/helpers/helpers.pyx":678 - * if j == isolute: - * continue - * for k in range(apr[j]): # <<<<<<<<<<<<<< - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] - */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; - __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_k = __pyx_t_17; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/helpers.pyx":679 - * continue - * for k in range(apr[j]): - * idx2 = rfa[j] + k # <<<<<<<<<<<<<< - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] + /* "View.MemoryView":618 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): */ - __pyx_t_4 = __pyx_v_j; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; - __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "src/helpers/helpers.pyx":680 - * for k in range(apr[j]): - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] + /* "View.MemoryView":617 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_18 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_19 = __pyx_v_idx2; - __pyx_t_20 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":681 - * idx2 = rfa[j] + k - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) + /* "View.MemoryView":616 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ - __pyx_t_20 = __pyx_v_idx; - __pyx_t_19 = 1; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_t_18 = __pyx_v_idx2; - __pyx_t_4 = 1; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); - /* "src/helpers/helpers.pyx":682 - * dx = coor[idx,0] - coor[idx2,0] - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< - * r = sqrt(dx*dx + dy*dy + dz*dz) - * if ds[j-1] > maxshell: - */ - __pyx_t_4 = __pyx_v_idx; - __pyx_t_18 = 2; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - __pyx_t_19 = __pyx_v_idx2; - __pyx_t_20 = 2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":683 - * dy = coor[idx,1] - coor[idx2,1] - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< - * if ds[j-1] > maxshell: - * epa[i,maxshell] += charges[idx] * charges[idx2] / r +/* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * */ - __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* "src/helpers/helpers.pyx":684 - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - * if ds[j-1] > maxshell: # <<<<<<<<<<<<<< - * epa[i,maxshell] += charges[idx] * charges[idx2] / r - * else: - */ - __pyx_t_20 = (__pyx_v_j - 1); - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds.shape[0]; - __pyx_t_14 = (((*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_20 * __pyx_v_ds.strides[0]) ))) > __pyx_v_maxshell) != 0); - if (__pyx_t_14) { +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/helpers.pyx":685 - * r = sqrt(dx*dx + dy*dy + dz*dz) - * if ds[j-1] > maxshell: - * epa[i,maxshell] += charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< - * else: - * epa[i,ds[j-1]-1] += charges[idx] * charges[idx2] / r - */ - __pyx_t_20 = __pyx_v_idx; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges.shape[0]; - __pyx_t_19 = __pyx_v_idx2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; - __pyx_t_21 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_20 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) )))); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 685, __pyx_L1_error) - } - __pyx_t_19 = __pyx_v_i; - __pyx_t_20 = __pyx_v_maxshell; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_epa.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_19 * __pyx_v_epa.strides[0]) ) + __pyx_t_20 * __pyx_v_epa.strides[1]) )) += (__pyx_t_21 / __pyx_v_r); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":684 - * dz = coor[idx,2] - coor[idx2,2] - * r = sqrt(dx*dx + dy*dy + dz*dz) - * if ds[j-1] > maxshell: # <<<<<<<<<<<<<< - * epa[i,maxshell] += charges[idx] * charges[idx2] / r - * else: - */ - goto __pyx_L10; - } +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); - /* "src/helpers/helpers.pyx":687 - * epa[i,maxshell] += charges[idx] * charges[idx2] / r - * else: - * epa[i,ds[j-1]-1] += charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< + /* "View.MemoryView":621 * - * return np.asarray(epa)[:,:] * 1390.02 - */ - /*else*/ { - __pyx_t_20 = __pyx_v_idx; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges.shape[0]; - __pyx_t_19 = __pyx_v_idx2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; - __pyx_t_21 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_20 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) )))); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 687, __pyx_L1_error) - } - __pyx_t_19 = (__pyx_v_j - 1); - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds.shape[0]; - __pyx_t_20 = __pyx_v_i; - __pyx_t_18 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_19 * __pyx_v_ds.strides[0]) ))) - 1); - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_epa.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_epa.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_20 * __pyx_v_epa.strides[0]) ) + __pyx_t_18 * __pyx_v_epa.strides[1]) )) += (__pyx_t_21 / __pyx_v_r); - } - __pyx_L10:; - } - __pyx_L5_continue:; - } - } - - /* "src/helpers/helpers.pyx":689 - * epa[i,ds[j-1]-1] += charges[idx] * charges[idx2] / r + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< * - * return np.asarray(epa)[:,:] * 1390.02 # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_epa, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_tuple__3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_float_1390_02); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "src/helpers/helpers.pyx":659 + /* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) * - * @cython.boundscheck(False) - * def calcEnergyAtomicVoro(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, char [:] ds, int maxshell): # <<<<<<<<<<<<<< - * """ - * energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, delaunay_shell) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAtomicVoro", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_epa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_apr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rfa, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":692 +/* "View.MemoryView":624 * - * @cython.boundscheck(False) - * def calcEnergyAASep(np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] charges, - * np.ndarray[np.int32_t,ndim=1,mode="c"] atoms_per_residue, + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_39calcEnergyAASep(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_38calcEnergyAASep[] = "\n Calculates the solvation energy of a solute in an ionic liquid for a given frame.\n\n The data is returned in three decompositions:\n -) Voronoi shell-resolved\n\n -) x/y/z axis-resolved\n\n -) octant-resolved for the first shell\n\n :Example:\n\n energy, energy_xyz, energy_octant = calcEnergyAA(xyz, charges, atoms_per_residue, residue_first_atom, ds, octants, isolute, nmolecules, cat_first, cat_last, an_first, an_last, octants=None)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_39calcEnergyAASep = {"calcEnergyAASep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_39calcEnergyAASep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_38calcEnergyAASep}; -static PyObject *__pyx_pw_11newanalysis_7helpers_39calcEnergyAASep(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_xyz = 0; - PyArrayObject *__pyx_v_charges = 0; - PyArrayObject *__pyx_v_atoms_per_residue = 0; - PyArrayObject *__pyx_v_residue_first_atom = 0; - PyArrayObject *__pyx_v_ds = 0; - PyObject *__pyx_v_isolute = 0; - PyObject *__pyx_v_nmolecules = 0; - PyObject *__pyx_v_cat_first = 0; - PyObject *__pyx_v_cat_last = 0; - PyObject *__pyx_v_an_first = 0; - PyObject *__pyx_v_an_last = 0; - PyArrayObject *__pyx_v_octants = 0; +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcEnergyAASep (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_charges,&__pyx_n_s_atoms_per_residue,&__pyx_n_s_residue_first_atom,&__pyx_n_s_ds,&__pyx_n_s_isolute,&__pyx_n_s_nmolecules,&__pyx_n_s_cat_first,&__pyx_n_s_cat_last,&__pyx_n_s_an_first,&__pyx_n_s_an_last,&__pyx_n_s_octants,0}; - PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; - - /* "src/helpers/helpers.pyx":698 - * np.ndarray[np.int32_t,ndim=2,mode="c"] ds, - * isolute, nmolecules, cat_first, cat_last, an_first, an_last, - * np.ndarray[np.int32_t, ndim=1] octants=None): # <<<<<<<<<<<<<< - * """ - * Calculates the solvation energy of a solute in an ionic liquid for a given frame. - */ - values[11] = (PyObject *)((PyArrayObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 1); __PYX_ERR(0, 692, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_atoms_per_residue)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 2); __PYX_ERR(0, 692, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_residue_first_atom)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 3); __PYX_ERR(0, 692, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 4); __PYX_ERR(0, 692, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 5); __PYX_ERR(0, 692, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmolecules)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 6); __PYX_ERR(0, 692, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cat_first)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 7); __PYX_ERR(0, 692, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cat_last)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 8); __PYX_ERR(0, 692, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 9: - if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_an_first)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 9); __PYX_ERR(0, 692, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 10: - if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_an_last)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 10); __PYX_ERR(0, 692, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 11: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_octants); - if (value) { values[11] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcEnergyAASep") < 0)) __PYX_ERR(0, 692, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_xyz = ((PyArrayObject *)values[0]); - __pyx_v_charges = ((PyArrayObject *)values[1]); - __pyx_v_atoms_per_residue = ((PyArrayObject *)values[2]); - __pyx_v_residue_first_atom = ((PyArrayObject *)values[3]); - __pyx_v_ds = ((PyArrayObject *)values[4]); - __pyx_v_isolute = values[5]; - __pyx_v_nmolecules = values[6]; - __pyx_v_cat_first = values[7]; - __pyx_v_cat_last = values[8]; - __pyx_v_an_first = values[9]; - __pyx_v_an_last = values[10]; - __pyx_v_octants = ((PyArrayObject *)values[11]); - } + __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 624, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_c_contig", 0))) return NULL; goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 692, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAASep", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 692, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_charges), __pyx_ptype_5numpy_ndarray, 1, "charges", 0))) __PYX_ERR(0, 693, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_atoms_per_residue), __pyx_ptype_5numpy_ndarray, 1, "atoms_per_residue", 0))) __PYX_ERR(0, 694, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_residue_first_atom), __pyx_ptype_5numpy_ndarray, 1, "residue_first_atom", 0))) __PYX_ERR(0, 695, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ds), __pyx_ptype_5numpy_ndarray, 1, "ds", 0))) __PYX_ERR(0, 696, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_octants), __pyx_ptype_5numpy_ndarray, 1, "octants", 0))) __PYX_ERR(0, 698, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_7helpers_38calcEnergyAASep(__pyx_self, __pyx_v_xyz, __pyx_v_charges, __pyx_v_atoms_per_residue, __pyx_v_residue_first_atom, __pyx_v_ds, __pyx_v_isolute, __pyx_v_nmolecules, __pyx_v_cat_first, __pyx_v_cat_last, __pyx_v_an_first, __pyx_v_an_last, __pyx_v_octants); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); + + /* "View.MemoryView":627 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + */ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 627, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/helpers/helpers.pyx":692 + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def calcEnergyAASep(np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] charges, - * np.ndarray[np.int32_t,ndim=1,mode="c"] atoms_per_residue, + * def is_f_contig(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":624 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* function exit code */ - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_38calcEnergyAASep(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_charges, PyArrayObject *__pyx_v_atoms_per_residue, PyArrayObject *__pyx_v_residue_first_atom, PyArrayObject *__pyx_v_ds, PyObject *__pyx_v_isolute, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_cat_first, PyObject *__pyx_v_cat_last, PyObject *__pyx_v_an_first, PyObject *__pyx_v_an_last, PyArrayObject *__pyx_v_octants) { - double *__pyx_v_cxyz; - double *__pyx_v_q; - int *__pyx_v_apr; - int *__pyx_v_rfa; - int *__pyx_v_coct; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_idx; - int __pyx_v_idx2; - int __pyx_v_idx3; - int __pyx_v_nmol; - int __pyx_v_islt; - PyArrayObject *__pyx_v_energy_per_atom = 0; - double *__pyx_v_epa; - PyArrayObject *__pyx_v_energy_xyz_per_atom = 0; - double *__pyx_v_epa_xyz; - PyArrayObject *__pyx_v_energy_octant_per_atom = 0; - double *__pyx_v_epa_oct; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_r; - double __pyx_v_qqr; - int __pyx_v_c1; - int __pyx_v_c2; - int __pyx_v_a1; - int __pyx_v_a2; - int *__pyx_v_cds; - PyArrayObject *__pyx_v_energy = 0; - PyArrayObject *__pyx_v_energy_xyz = 0; - PyArrayObject *__pyx_v_energy_octant = 0; - __Pyx_LocalBuf_ND __pyx_pybuffernd_atoms_per_residue; - __Pyx_Buffer __pyx_pybuffer_atoms_per_residue; - __Pyx_LocalBuf_ND __pyx_pybuffernd_charges; - __Pyx_Buffer __pyx_pybuffer_charges; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ds; - __Pyx_Buffer __pyx_pybuffer_ds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_energy; - __Pyx_Buffer __pyx_pybuffer_energy; - __Pyx_LocalBuf_ND __pyx_pybuffernd_energy_octant; - __Pyx_Buffer __pyx_pybuffer_energy_octant; - __Pyx_LocalBuf_ND __pyx_pybuffernd_energy_octant_per_atom; - __Pyx_Buffer __pyx_pybuffer_energy_octant_per_atom; - __Pyx_LocalBuf_ND __pyx_pybuffernd_energy_per_atom; - __Pyx_Buffer __pyx_pybuffer_energy_per_atom; - __Pyx_LocalBuf_ND __pyx_pybuffernd_energy_xyz; - __Pyx_Buffer __pyx_pybuffer_energy_xyz; - __Pyx_LocalBuf_ND __pyx_pybuffernd_energy_xyz_per_atom; - __Pyx_Buffer __pyx_pybuffer_energy_xyz_per_atom; - __Pyx_LocalBuf_ND __pyx_pybuffernd_octants; - __Pyx_Buffer __pyx_pybuffer_octants; - __Pyx_LocalBuf_ND __pyx_pybuffernd_residue_first_atom; - __Pyx_Buffer __pyx_pybuffer_residue_first_atom; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; - __Pyx_Buffer __pyx_pybuffer_xyz; +/* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + */ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 630, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_f_contig", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyArrayObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - PyArrayObject *__pyx_t_13 = NULL; - int __pyx_t_14; - int __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - double __pyx_t_22; - long __pyx_t_23; - double __pyx_t_24; - int __pyx_t_25; - Py_ssize_t __pyx_t_26; + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcEnergyAASep", 0); - __pyx_pybuffer_energy_per_atom.pybuffer.buf = NULL; - __pyx_pybuffer_energy_per_atom.refcount = 0; - __pyx_pybuffernd_energy_per_atom.data = NULL; - __pyx_pybuffernd_energy_per_atom.rcbuffer = &__pyx_pybuffer_energy_per_atom; - __pyx_pybuffer_energy_xyz_per_atom.pybuffer.buf = NULL; - __pyx_pybuffer_energy_xyz_per_atom.refcount = 0; - __pyx_pybuffernd_energy_xyz_per_atom.data = NULL; - __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer = &__pyx_pybuffer_energy_xyz_per_atom; - __pyx_pybuffer_energy_octant_per_atom.pybuffer.buf = NULL; - __pyx_pybuffer_energy_octant_per_atom.refcount = 0; - __pyx_pybuffernd_energy_octant_per_atom.data = NULL; - __pyx_pybuffernd_energy_octant_per_atom.rcbuffer = &__pyx_pybuffer_energy_octant_per_atom; - __pyx_pybuffer_energy.pybuffer.buf = NULL; - __pyx_pybuffer_energy.refcount = 0; - __pyx_pybuffernd_energy.data = NULL; - __pyx_pybuffernd_energy.rcbuffer = &__pyx_pybuffer_energy; - __pyx_pybuffer_energy_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_energy_xyz.refcount = 0; - __pyx_pybuffernd_energy_xyz.data = NULL; - __pyx_pybuffernd_energy_xyz.rcbuffer = &__pyx_pybuffer_energy_xyz; - __pyx_pybuffer_energy_octant.pybuffer.buf = NULL; - __pyx_pybuffer_energy_octant.refcount = 0; - __pyx_pybuffernd_energy_octant.data = NULL; - __pyx_pybuffernd_energy_octant.rcbuffer = &__pyx_pybuffer_energy_octant; - __pyx_pybuffer_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_xyz.refcount = 0; - __pyx_pybuffernd_xyz.data = NULL; - __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; - __pyx_pybuffer_charges.pybuffer.buf = NULL; - __pyx_pybuffer_charges.refcount = 0; - __pyx_pybuffernd_charges.data = NULL; - __pyx_pybuffernd_charges.rcbuffer = &__pyx_pybuffer_charges; - __pyx_pybuffer_atoms_per_residue.pybuffer.buf = NULL; - __pyx_pybuffer_atoms_per_residue.refcount = 0; - __pyx_pybuffernd_atoms_per_residue.data = NULL; - __pyx_pybuffernd_atoms_per_residue.rcbuffer = &__pyx_pybuffer_atoms_per_residue; - __pyx_pybuffer_residue_first_atom.pybuffer.buf = NULL; - __pyx_pybuffer_residue_first_atom.refcount = 0; - __pyx_pybuffernd_residue_first_atom.data = NULL; - __pyx_pybuffernd_residue_first_atom.rcbuffer = &__pyx_pybuffer_residue_first_atom; - __pyx_pybuffer_ds.pybuffer.buf = NULL; - __pyx_pybuffer_ds.refcount = 0; - __pyx_pybuffernd_ds.data = NULL; - __pyx_pybuffernd_ds.rcbuffer = &__pyx_pybuffer_ds; - __pyx_pybuffer_octants.pybuffer.buf = NULL; - __pyx_pybuffer_octants.refcount = 0; - __pyx_pybuffernd_octants.data = NULL; - __pyx_pybuffernd_octants.rcbuffer = &__pyx_pybuffer_octants; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error) - } - __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_charges.rcbuffer->pybuffer, (PyObject*)__pyx_v_charges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error) - } - __pyx_pybuffernd_charges.diminfo[0].strides = __pyx_pybuffernd_charges.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_charges.diminfo[0].shape = __pyx_pybuffernd_charges.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer, (PyObject*)__pyx_v_atoms_per_residue, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error) - } - __pyx_pybuffernd_atoms_per_residue.diminfo[0].strides = __pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_atoms_per_residue.diminfo[0].shape = __pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer, (PyObject*)__pyx_v_residue_first_atom, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error) - } - __pyx_pybuffernd_residue_first_atom.diminfo[0].strides = __pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_residue_first_atom.diminfo[0].shape = __pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ds.rcbuffer->pybuffer, (PyObject*)__pyx_v_ds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error) - } - __pyx_pybuffernd_ds.diminfo[0].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ds.diminfo[0].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ds.diminfo[1].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ds.diminfo[1].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_octants.rcbuffer->pybuffer, (PyObject*)__pyx_v_octants, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error) - } - __pyx_pybuffernd_octants.diminfo[0].strides = __pyx_pybuffernd_octants.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_octants.diminfo[0].shape = __pyx_pybuffernd_octants.rcbuffer->pybuffer.shape[0]; + __Pyx_RefNannySetupContext("is_f_contig", 0); - /* "src/helpers/helpers.pyx":716 - * """ + /* "View.MemoryView":633 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * - * cdef double *cxyz = xyz.data # <<<<<<<<<<<<<< - * cdef double *q = charges.data - * cdef int* apr = atoms_per_residue.data */ - __pyx_v_cxyz = ((double *)__pyx_v_xyz->data); + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 633, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/helpers/helpers.pyx":717 + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< * - * cdef double *cxyz = xyz.data - * cdef double *q = charges.data # <<<<<<<<<<<<<< - * cdef int* apr = atoms_per_residue.data - * cdef int* rfa = residue_first_atom.data + * def copy(self): */ - __pyx_v_q = ((double *)__pyx_v_charges->data); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":718 - * cdef double *cxyz = xyz.data - * cdef double *q = charges.data - * cdef int* apr = atoms_per_residue.data # <<<<<<<<<<<<<< - * cdef int* rfa = residue_first_atom.data - * cdef int* coct = NULL + /* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - __pyx_v_apr = ((int *)__pyx_v_atoms_per_residue->data); - /* "src/helpers/helpers.pyx":719 - * cdef double *q = charges.data - * cdef int* apr = atoms_per_residue.data - * cdef int* rfa = residue_first_atom.data # <<<<<<<<<<<<<< - * cdef int* coct = NULL - * if octants!=None: + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ - __pyx_v_rfa = ((int *)__pyx_v_residue_first_atom->data); - /* "src/helpers/helpers.pyx":720 - * cdef int* apr = atoms_per_residue.data - * cdef int* rfa = residue_first_atom.data - * cdef int* coct = NULL # <<<<<<<<<<<<<< - * if octants!=None: - * coct = octants.data +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 636, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":638 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &mslice) */ - __pyx_v_coct = NULL; + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - /* "src/helpers/helpers.pyx":721 - * cdef int* rfa = residue_first_atom.data - * cdef int* coct = NULL - * if octants!=None: # <<<<<<<<<<<<<< - * coct = octants.data - * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute + /* "View.MemoryView":640 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, */ - __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_octants), Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 721, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - /* "src/helpers/helpers.pyx":722 - * cdef int* coct = NULL - * if octants!=None: - * coct = octants.data # <<<<<<<<<<<<<< - * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute - * cdef np.ndarray[np.float64_t,ndim=2] energy_per_atom = np.zeros((apr[islt],8),dtype=np.float64) + /* "View.MemoryView":641 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, */ - __pyx_v_coct = ((int *)__pyx_v_octants->data); + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 641, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/helpers/helpers.pyx":721 - * cdef int* rfa = residue_first_atom.data - * cdef int* coct = NULL - * if octants!=None: # <<<<<<<<<<<<<< - * coct = octants.data - * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute + /* "View.MemoryView":646 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * + * def copy_fortran(self): */ - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":723 - * if octants!=None: - * coct = octants.data - * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2] energy_per_atom = np.zeros((apr[islt],8),dtype=np.float64) - * cdef double* epa = energy_per_atom.data + /* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 723, __pyx_L1_error) - __pyx_v_nmol = ((int)__pyx_t_3); - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_isolute); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 723, __pyx_L1_error) - __pyx_v_islt = ((int)__pyx_t_3); - /* "src/helpers/helpers.pyx":724 - * coct = octants.data - * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute - * cdef np.ndarray[np.float64_t,ndim=2] energy_per_atom = np.zeros((apr[islt],8),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double* epa = energy_per_atom.data - * cdef np.ndarray[np.float64_t,ndim=2] energy_xyz_per_atom = np.zeros((apr[islt],3),dtype=np.float64) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_apr[__pyx_v_islt])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_int_8); - __Pyx_GIVEREF(__pyx_int_8); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_8); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 724, __pyx_L1_error) - __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_energy_per_atom = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 724, __pyx_L1_error) - } else {__pyx_pybuffernd_energy_per_atom.diminfo[0].strides = __pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy_per_atom.diminfo[0].shape = __pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_energy_per_atom.diminfo[1].strides = __pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_energy_per_atom.diminfo[1].shape = __pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_8 = 0; - __pyx_v_energy_per_atom = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; - /* "src/helpers/helpers.pyx":725 - * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute - * cdef np.ndarray[np.float64_t,ndim=2] energy_per_atom = np.zeros((apr[islt],8),dtype=np.float64) - * cdef double* epa = energy_per_atom.data # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2] energy_xyz_per_atom = np.zeros((apr[islt],3),dtype=np.float64) - * cdef double* epa_xyz = energy_xyz_per_atom.data +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 648, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy_fortran", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":650 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) */ - __pyx_v_epa = ((double *)__pyx_v_energy_per_atom->data); + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - /* "src/helpers/helpers.pyx":726 - * cdef np.ndarray[np.float64_t,ndim=2] energy_per_atom = np.zeros((apr[islt],8),dtype=np.float64) - * cdef double* epa = energy_per_atom.data - * cdef np.ndarray[np.float64_t,ndim=2] energy_xyz_per_atom = np.zeros((apr[islt],3),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double* epa_xyz = energy_xyz_per_atom.data - * cdef np.ndarray[np.float64_t,ndim=2] energy_octant_per_atom = np.zeros((apr[islt],8),dtype=np.float64) + /* "View.MemoryView":652 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_From_int((__pyx_v_apr[__pyx_v_islt])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3); - __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 726, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 726, __pyx_L1_error) - __pyx_t_9 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_energy_xyz_per_atom = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 726, __pyx_L1_error) - } else {__pyx_pybuffernd_energy_xyz_per_atom.diminfo[0].strides = __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy_xyz_per_atom.diminfo[0].shape = __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_energy_xyz_per_atom.diminfo[1].strides = __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_energy_xyz_per_atom.diminfo[1].shape = __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_9 = 0; - __pyx_v_energy_xyz_per_atom = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); - /* "src/helpers/helpers.pyx":727 - * cdef double* epa = energy_per_atom.data - * cdef np.ndarray[np.float64_t,ndim=2] energy_xyz_per_atom = np.zeros((apr[islt],3),dtype=np.float64) - * cdef double* epa_xyz = energy_xyz_per_atom.data # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2] energy_octant_per_atom = np.zeros((apr[islt],8),dtype=np.float64) - * cdef double* epa_oct = energy_octant_per_atom.data + /* "View.MemoryView":653 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, */ - __pyx_v_epa_xyz = ((double *)__pyx_v_energy_xyz_per_atom->data); + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 653, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; - /* "src/helpers/helpers.pyx":728 - * cdef np.ndarray[np.float64_t,ndim=2] energy_xyz_per_atom = np.zeros((apr[islt],3),dtype=np.float64) - * cdef double* epa_xyz = energy_xyz_per_atom.data - * cdef np.ndarray[np.float64_t,ndim=2] energy_octant_per_atom = np.zeros((apr[islt],8),dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double* epa_oct = energy_octant_per_atom.data - * cdef double dx, dy, dz, r, qqr + /* "View.MemoryView":658 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_apr[__pyx_v_islt])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); - __Pyx_INCREF(__pyx_int_8); - __Pyx_GIVEREF(__pyx_int_8); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_8); - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 728, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_energy_octant_per_atom = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 728, __pyx_L1_error) - } else {__pyx_pybuffernd_energy_octant_per_atom.diminfo[0].strides = __pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy_octant_per_atom.diminfo[0].shape = __pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_energy_octant_per_atom.diminfo[1].strides = __pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_energy_octant_per_atom.diminfo[1].shape = __pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_10 = 0; - __pyx_v_energy_octant_per_atom = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":729 - * cdef double* epa_xyz = energy_xyz_per_atom.data - * cdef np.ndarray[np.float64_t,ndim=2] energy_octant_per_atom = np.zeros((apr[islt],8),dtype=np.float64) - * cdef double* epa_oct = energy_octant_per_atom.data # <<<<<<<<<<<<<< - * cdef double dx, dy, dz, r, qqr - * cdef int x, y, z, idx4, c1=cat_first, c2=cat_last, a1=an_first, a2=an_last + /* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ - __pyx_v_epa_oct = ((double *)__pyx_v_energy_octant_per_atom->data); - /* "src/helpers/helpers.pyx":731 - * cdef double* epa_oct = energy_octant_per_atom.data - * cdef double dx, dy, dz, r, qqr - * cdef int x, y, z, idx4, c1=cat_first, c2=cat_last, a1=an_first, a2=an_last # <<<<<<<<<<<<<< - * cdef int *cds = ds.data - * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_cat_first); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 731, __pyx_L1_error) - __pyx_v_c1 = __pyx_t_3; - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_cat_last); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 731, __pyx_L1_error) - __pyx_v_c2 = __pyx_t_3; - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_an_first); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 731, __pyx_L1_error) - __pyx_v_a1 = __pyx_t_3; - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_an_last); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 731, __pyx_L1_error) - __pyx_v_a2 = __pyx_t_3; - /* "src/helpers/helpers.pyx":732 - * cdef double dx, dy, dz, r, qqr - * cdef int x, y, z, idx4, c1=cat_first, c2=cat_last, a1=an_first, a2=an_last - * cdef int *cds = ds.data # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_v_cds = ((int *)__pyx_v_ds->data); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "src/helpers/helpers.pyx":733 - * cdef int x, y, z, idx4, c1=cat_first, c2=cat_last, a1=an_first, a2=an_last - * cdef int *cds = ds.data - * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=1] energy_octant = np.zeros(8,dtype=np.float64) + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 733, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 733, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 733, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 733, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 733, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 733, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__4, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 733, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 733, __pyx_L1_error) - __pyx_t_11 = ((PyArrayObject *)__pyx_t_1); + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_energy = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 733, __pyx_L1_error) - } else {__pyx_pybuffernd_energy.diminfo[0].strides = __pyx_pybuffernd_energy.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy.diminfo[0].shape = __pyx_pybuffernd_energy.rcbuffer->pybuffer.shape[0]; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } + __pyx_v___pyx_state = values[0]; } - __pyx_t_11 = 0; - __pyx_v_energy = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "src/helpers/helpers.pyx":734 - * cdef int *cds = ds.data - * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1] energy_octant = np.zeros(8,dtype=np.float64) - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__5, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 734, __pyx_L1_error) - __pyx_t_12 = ((PyArrayObject *)__pyx_t_6); + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_energy_xyz = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 734, __pyx_L1_error) - } else {__pyx_pybuffernd_energy_xyz.diminfo[0].strides = __pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy_xyz.diminfo[0].shape = __pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer.shape[0]; + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __pyx_t_12 = 0; - __pyx_v_energy_xyz = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state); - /* "src/helpers/helpers.pyx":735 - * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=1] energy_octant = np.zeros(8,dtype=np.float64) # <<<<<<<<<<<<<< - * - * # for i in prange(apr[islt],nogil=True): - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__4, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 735, __pyx_L1_error) - __pyx_t_13 = ((PyArrayObject *)__pyx_t_7); + /* function exit code */ { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy_octant.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_energy_octant = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy_octant.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 735, __pyx_L1_error) - } else {__pyx_pybuffernd_energy_octant.diminfo[0].strides = __pyx_pybuffernd_energy_octant.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy_octant.diminfo[0].shape = __pyx_pybuffernd_energy_octant.rcbuffer->pybuffer.shape[0]; + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __pyx_t_13 = 0; - __pyx_v_energy_octant = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; - - /* "src/helpers/helpers.pyx":738 - * - * # for i in prange(apr[islt],nogil=True): - * for i in range(apr[islt]): # <<<<<<<<<<<<<< - * idx=rfa[islt]+i - * # cations - */ - __pyx_t_3 = (__pyx_v_apr[__pyx_v_islt]); - __pyx_t_14 = __pyx_t_3; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_i = __pyx_t_15; - - /* "src/helpers/helpers.pyx":739 - * # for i in prange(apr[islt],nogil=True): - * for i in range(apr[islt]): - * idx=rfa[islt]+i # <<<<<<<<<<<<<< - * # cations - * for j in range(c1,c2+1): - */ - __pyx_v_idx = ((__pyx_v_rfa[__pyx_v_islt]) + __pyx_v_i); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":741 - * idx=rfa[islt]+i - * # cations - * for j in range(c1,c2+1): # <<<<<<<<<<<<<< - * idx3=cds[islt*nmol+j]-1 - * for k in range(apr[j]): - */ - __pyx_t_16 = (__pyx_v_c2 + 1); - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = __pyx_v_c1; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_j = __pyx_t_18; +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/helpers/helpers.pyx":742 - * # cations - * for j in range(c1,c2+1): - * idx3=cds[islt*nmol+j]-1 # <<<<<<<<<<<<<< - * for k in range(apr[j]): - * idx2=rfa[j]+k + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_v_idx3 = ((__pyx_v_cds[((__pyx_v_islt * __pyx_v_nmol) + __pyx_v_j)]) - 1); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/helpers/helpers.pyx":743 - * for j in range(c1,c2+1): - * idx3=cds[islt*nmol+j]-1 - * for k in range(apr[j]): # <<<<<<<<<<<<<< - * idx2=rfa[j]+k - * dx=cxyz[idx*3]-cxyz[idx2*3] + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_19 = (__pyx_v_apr[__pyx_v_j]); - __pyx_t_20 = __pyx_t_19; - for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { - __pyx_v_k = __pyx_t_21; - /* "src/helpers/helpers.pyx":744 - * idx3=cds[islt*nmol+j]-1 - * for k in range(apr[j]): - * idx2=rfa[j]+k # <<<<<<<<<<<<<< - * dx=cxyz[idx*3]-cxyz[idx2*3] - * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] - */ - __pyx_v_idx2 = ((__pyx_v_rfa[__pyx_v_j]) + __pyx_v_k); + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":745 - * for k in range(apr[j]): - * idx2=rfa[j]+k - * dx=cxyz[idx*3]-cxyz[idx2*3] # <<<<<<<<<<<<<< - * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] - * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] +/* "View.MemoryView":662 + * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ - __pyx_v_dx = ((__pyx_v_cxyz[(__pyx_v_idx * 3)]) - (__pyx_v_cxyz[(__pyx_v_idx2 * 3)])); - /* "src/helpers/helpers.pyx":746 - * idx2=rfa[j]+k - * dx=cxyz[idx*3]-cxyz[idx2*3] - * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] # <<<<<<<<<<<<<< - * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] - * r=sqrt(dx*dx+dy*dy+dz*dz) - */ - __pyx_v_dy = ((__pyx_v_cxyz[((__pyx_v_idx * 3) + 1)]) - (__pyx_v_cxyz[((__pyx_v_idx2 * 3) + 1)])); +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - /* "src/helpers/helpers.pyx":747 - * dx=cxyz[idx*3]-cxyz[idx2*3] - * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] - * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] # <<<<<<<<<<<<<< - * r=sqrt(dx*dx+dy*dy+dz*dz) - * qqr=q[idx]*q[idx2]/r + /* "View.MemoryView":663 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result */ - __pyx_v_dz = ((__pyx_v_cxyz[((__pyx_v_idx * 3) + 2)]) - (__pyx_v_cxyz[((__pyx_v_idx2 * 3) + 2)])); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/helpers/helpers.pyx":748 - * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] - * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] - * r=sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< - * qqr=q[idx]*q[idx2]/r - * epa[i*8+idx3]+=qqr + /* "View.MemoryView":664 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result + * */ - __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + __pyx_v_result->typeinfo = __pyx_v_typeinfo; - /* "src/helpers/helpers.pyx":749 - * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] - * r=sqrt(dx*dx+dy*dy+dz*dz) - * qqr=q[idx]*q[idx2]/r # <<<<<<<<<<<<<< - * epa[i*8+idx3]+=qqr - * epa_xyz[i*3]+=qqr*dx*dx/(r*r) + /* "View.MemoryView":665 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_check') */ - __pyx_t_22 = ((__pyx_v_q[__pyx_v_idx]) * (__pyx_v_q[__pyx_v_idx2])); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 749, __pyx_L1_error) - } - __pyx_v_qqr = (__pyx_t_22 / __pyx_v_r); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":750 - * r=sqrt(dx*dx+dy*dy+dz*dz) - * qqr=q[idx]*q[idx2]/r - * epa[i*8+idx3]+=qqr # <<<<<<<<<<<<<< - * epa_xyz[i*3]+=qqr*dx*dx/(r*r) - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) + /* "View.MemoryView":662 + * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ - __pyx_t_23 = ((__pyx_v_i * 8) + __pyx_v_idx3); - (__pyx_v_epa[__pyx_t_23]) = ((__pyx_v_epa[__pyx_t_23]) + __pyx_v_qqr); - /* "src/helpers/helpers.pyx":751 - * qqr=q[idx]*q[idx2]/r - * epa[i*8+idx3]+=qqr - * epa_xyz[i*3]+=qqr*dx*dx/(r*r) # <<<<<<<<<<<<<< - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) - */ - __pyx_t_23 = (__pyx_v_i * 3); - __pyx_t_22 = ((__pyx_v_qqr * __pyx_v_dx) * __pyx_v_dx); - __pyx_t_24 = (__pyx_v_r * __pyx_v_r); - if (unlikely(__pyx_t_24 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 751, __pyx_L1_error) - } - (__pyx_v_epa_xyz[__pyx_t_23]) = ((__pyx_v_epa_xyz[__pyx_t_23]) + (__pyx_t_22 / __pyx_t_24)); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":752 - * epa[i*8+idx3]+=qqr - * epa_xyz[i*3]+=qqr*dx*dx/(r*r) - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) # <<<<<<<<<<<<<< - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) - * if idx3 == 0 and coct != NULL: +/* "View.MemoryView":668 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) + * */ - __pyx_t_23 = ((__pyx_v_i * 3) + 1); - __pyx_t_24 = ((__pyx_v_qqr * __pyx_v_dy) * __pyx_v_dy); - __pyx_t_22 = (__pyx_v_r * __pyx_v_r); - if (unlikely(__pyx_t_22 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 752, __pyx_L1_error) - } - (__pyx_v_epa_xyz[__pyx_t_23]) = ((__pyx_v_epa_xyz[__pyx_t_23]) + (__pyx_t_24 / __pyx_t_22)); - /* "src/helpers/helpers.pyx":753 - * epa_xyz[i*3]+=qqr*dx*dx/(r*r) - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) # <<<<<<<<<<<<<< - * if idx3 == 0 and coct != NULL: - * epa_oct[i*8+coct[j]]+=qqr - */ - __pyx_t_23 = ((__pyx_v_i * 3) + 2); - __pyx_t_22 = ((__pyx_v_qqr * __pyx_v_dz) * __pyx_v_dz); - __pyx_t_24 = (__pyx_v_r * __pyx_v_r); - if (unlikely(__pyx_t_24 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 753, __pyx_L1_error) - } - (__pyx_v_epa_xyz[__pyx_t_23]) = ((__pyx_v_epa_xyz[__pyx_t_23]) + (__pyx_t_22 / __pyx_t_24)); +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("memoryview_check", 0); - /* "src/helpers/helpers.pyx":754 - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) - * if idx3 == 0 and coct != NULL: # <<<<<<<<<<<<<< - * epa_oct[i*8+coct[j]]+=qqr + /* "View.MemoryView":669 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< * + * cdef tuple _unellipsify(object index, int ndim): */ - __pyx_t_25 = ((__pyx_v_idx3 == 0) != 0); - if (__pyx_t_25) { - } else { - __pyx_t_2 = __pyx_t_25; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_25 = ((__pyx_v_coct != NULL) != 0); - __pyx_t_2 = __pyx_t_25; - __pyx_L11_bool_binop_done:; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":755 - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) - * if idx3 == 0 and coct != NULL: - * epa_oct[i*8+coct[j]]+=qqr # <<<<<<<<<<<<<< + /* "View.MemoryView":668 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) * - * # anions */ - __pyx_t_23 = ((__pyx_v_i * 8) + (__pyx_v_coct[__pyx_v_j])); - (__pyx_v_epa_oct[__pyx_t_23]) = ((__pyx_v_epa_oct[__pyx_t_23]) + __pyx_v_qqr); - /* "src/helpers/helpers.pyx":754 - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) - * if idx3 == 0 and coct != NULL: # <<<<<<<<<<<<<< - * epa_oct[i*8+coct[j]]+=qqr + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":671 + * return isinstance(o, memoryview) * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with */ - } - } - } - /* "src/helpers/helpers.pyx":758 +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_UCS4 __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":677 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< * - * # anions - * for j in range(a1,a2+1): # <<<<<<<<<<<<<< - * idx3=cds[islt*nmol+j]-1 - * for k in range(apr[j]): + * result = [slice(None)] * ndim */ - __pyx_t_16 = (__pyx_v_a2 + 1); - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = __pyx_v_a1; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_j = __pyx_t_18; + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index)) __PYX_ERR(1, 677, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/helpers.pyx":759 - * # anions - * for j in range(a1,a2+1): - * idx3=cds[islt*nmol+j]-1 # <<<<<<<<<<<<<< - * for k in range(apr[j]): - * idx2=rfa[j]+k + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False */ - __pyx_v_idx3 = ((__pyx_v_cds[((__pyx_v_islt * __pyx_v_nmol) + __pyx_v_j)]) - 1); + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/helpers.pyx":760 - * for j in range(a1,a2+1): - * idx3=cds[islt*nmol+j]-1 - * for k in range(apr[j]): # <<<<<<<<<<<<<< - * idx2=rfa[j]+k - * dx=cxyz[idx*3]-cxyz[idx2*3] + /* "View.MemoryView":680 + * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 */ - __pyx_t_19 = (__pyx_v_apr[__pyx_v_j]); - __pyx_t_20 = __pyx_t_19; - for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { - __pyx_v_k = __pyx_t_21; + __pyx_v_have_slices = 0; - /* "src/helpers/helpers.pyx":761 - * idx3=cds[islt*nmol+j]-1 - * for k in range(apr[j]): - * idx2=rfa[j]+k # <<<<<<<<<<<<<< - * dx=cxyz[idx*3]-cxyz[idx2*3] - * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] + /* "View.MemoryView":681 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: */ - __pyx_v_idx2 = ((__pyx_v_rfa[__pyx_v_j]) + __pyx_v_k); + __pyx_v_seen_ellipsis = 0; - /* "src/helpers/helpers.pyx":762 - * for k in range(apr[j]): - * idx2=rfa[j]+k - * dx=cxyz[idx*3]-cxyz[idx2*3] # <<<<<<<<<<<<<< - * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] - * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] + /* "View.MemoryView":682 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: */ - __pyx_v_dx = ((__pyx_v_cxyz[(__pyx_v_idx * 3)]) - (__pyx_v_cxyz[(__pyx_v_idx2 * 3)])); + __pyx_v_idx = 0; - /* "src/helpers/helpers.pyx":763 - * idx2=rfa[j]+k - * dx=cxyz[idx*3]-cxyz[idx2*3] - * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] # <<<<<<<<<<<<<< - * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] - * r=sqrt(dx*dx+dy*dy+dz*dz) + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: */ - __pyx_v_dy = ((__pyx_v_cxyz[((__pyx_v_idx * 3) + 1)]) - (__pyx_v_cxyz[((__pyx_v_idx2 * 3) + 1)])); + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 683, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; + for (;;) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 683, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/helpers.pyx":764 - * dx=cxyz[idx*3]-cxyz[idx2*3] - * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] - * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] # <<<<<<<<<<<<<< - * r=sqrt(dx*dx+dy*dy+dz*dz) - * qqr=q[idx]*q[idx2]/r + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) */ - __pyx_v_dz = ((__pyx_v_cxyz[((__pyx_v_idx * 3) + 2)]) - (__pyx_v_cxyz[((__pyx_v_idx2 * 3) + 2)])); + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":765 - * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] - * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] - * r=sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< - * qqr=q[idx]*q[idx2]/r - * epa[i*8+4+idx3]+=qqr + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True */ - __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":766 - * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] - * r=sqrt(dx*dx+dy*dy+dz*dz) - * qqr=q[idx]*q[idx2]/r # <<<<<<<<<<<<<< - * epa[i*8+4+idx3]+=qqr - * epa_xyz[i*3]+=qqr*dx*dx/(r*r) + /* "View.MemoryView":686 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True */ - __pyx_t_24 = ((__pyx_v_q[__pyx_v_idx]) * (__pyx_v_q[__pyx_v_idx2])); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 766, __pyx_L1_error) + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 686, __pyx_L1_error) } - __pyx_v_qqr = (__pyx_t_24 / __pyx_v_r); + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 686, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); - /* "src/helpers/helpers.pyx":767 - * r=sqrt(dx*dx+dy*dy+dz*dz) - * qqr=q[idx]*q[idx2]/r - * epa[i*8+4+idx3]+=qqr # <<<<<<<<<<<<<< - * epa_xyz[i*3]+=qqr*dx*dx/(r*r) - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) + /* "View.MemoryView":687 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: */ - __pyx_t_23 = (((__pyx_v_i * 8) + 4) + __pyx_v_idx3); - (__pyx_v_epa[__pyx_t_23]) = ((__pyx_v_epa[__pyx_t_23]) + __pyx_v_qqr); + __pyx_v_seen_ellipsis = 1; - /* "src/helpers/helpers.pyx":768 - * qqr=q[idx]*q[idx2]/r - * epa[i*8+4+idx3]+=qqr - * epa_xyz[i*3]+=qqr*dx*dx/(r*r) # <<<<<<<<<<<<<< - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True */ - __pyx_t_23 = (__pyx_v_i * 3); - __pyx_t_24 = ((__pyx_v_qqr * __pyx_v_dx) * __pyx_v_dx); - __pyx_t_22 = (__pyx_v_r * __pyx_v_r); - if (unlikely(__pyx_t_22 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 768, __pyx_L1_error) - } - (__pyx_v_epa_xyz[__pyx_t_23]) = ((__pyx_v_epa_xyz[__pyx_t_23]) + (__pyx_t_24 / __pyx_t_22)); + } - /* "src/helpers/helpers.pyx":769 - * epa[i*8+4+idx3]+=qqr - * epa_xyz[i*3]+=qqr*dx*dx/(r*r) - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) # <<<<<<<<<<<<<< - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) - * if idx3 == 0 and coct != NULL: + /* "View.MemoryView":688 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): */ - __pyx_t_23 = ((__pyx_v_i * 3) + 1); - __pyx_t_22 = ((__pyx_v_qqr * __pyx_v_dy) * __pyx_v_dy); - __pyx_t_24 = (__pyx_v_r * __pyx_v_r); - if (unlikely(__pyx_t_24 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 769, __pyx_L1_error) - } - (__pyx_v_epa_xyz[__pyx_t_23]) = ((__pyx_v_epa_xyz[__pyx_t_23]) + (__pyx_t_22 / __pyx_t_24)); + __pyx_v_have_slices = 1; - /* "src/helpers/helpers.pyx":770 - * epa_xyz[i*3]+=qqr*dx*dx/(r*r) - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) # <<<<<<<<<<<<<< - * if idx3 == 0 and coct != NULL: - * epa_oct[i*8+coct[j]]+=qqr + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) */ - __pyx_t_23 = ((__pyx_v_i * 3) + 2); - __pyx_t_24 = ((__pyx_v_qqr * __pyx_v_dz) * __pyx_v_dz); - __pyx_t_22 = (__pyx_v_r * __pyx_v_r); - if (unlikely(__pyx_t_22 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 770, __pyx_L1_error) - } - (__pyx_v_epa_xyz[__pyx_t_23]) = ((__pyx_v_epa_xyz[__pyx_t_23]) + (__pyx_t_24 / __pyx_t_22)); + goto __pyx_L5; + } - /* "src/helpers/helpers.pyx":771 - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) - * if idx3 == 0 and coct != NULL: # <<<<<<<<<<<<<< - * epa_oct[i*8+coct[j]]+=qqr - * + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): */ - __pyx_t_25 = ((__pyx_v_idx3 == 0) != 0); - if (__pyx_t_25) { - } else { - __pyx_t_2 = __pyx_t_25; - goto __pyx_L18_bool_binop_done; - } - __pyx_t_25 = ((__pyx_v_coct != NULL) != 0); - __pyx_t_2 = __pyx_t_25; - __pyx_L18_bool_binop_done:; - if (__pyx_t_2) { + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":772 - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) - * if idx3 == 0 and coct != NULL: - * epa_oct[i*8+coct[j]]+=qqr # <<<<<<<<<<<<<< - * - * for i in range(apr[islt]): + /* "View.MemoryView":691 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" */ - __pyx_t_23 = ((__pyx_v_i * 8) + (__pyx_v_coct[__pyx_v_j])); - (__pyx_v_epa_oct[__pyx_t_23]) = ((__pyx_v_epa_oct[__pyx_t_23]) + __pyx_v_qqr); + __pyx_v_have_slices = 1; - /* "src/helpers/helpers.pyx":771 - * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) - * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) - * if idx3 == 0 and coct != NULL: # <<<<<<<<<<<<<< - * epa_oct[i*8+coct[j]]+=qqr - * + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): */ - } + goto __pyx_L7; } - } - } - /* "src/helpers/helpers.pyx":774 - * epa_oct[i*8+coct[j]]+=qqr - * - * for i in range(apr[islt]): # <<<<<<<<<<<<<< - * for j in range(8): - * energy[j]+=epa[i*8+j] + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + */ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":693 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = 127; + __Pyx_INCREF(__pyx_kp_u_Cannot_index_with_type); + __pyx_t_5 += 24; + __Pyx_GIVEREF(__pyx_kp_u_Cannot_index_with_type); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Cannot_index_with_type); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_5 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__6); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 693, __pyx_L1_error) + + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item */ - __pyx_t_3 = (__pyx_v_apr[__pyx_v_islt]); - __pyx_t_14 = __pyx_t_3; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_i = __pyx_t_15; + } + __pyx_L7:; - /* "src/helpers/helpers.pyx":775 + /* "View.MemoryView":694 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 * - * for i in range(apr[islt]): - * for j in range(8): # <<<<<<<<<<<<<< - * energy[j]+=epa[i*8+j] - * energy_octant[j]+=epa_oct[i*8+j] */ - for (__pyx_t_18 = 0; __pyx_t_18 < 8; __pyx_t_18+=1) { - __pyx_v_j = __pyx_t_18; + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0))) __PYX_ERR(1, 694, __pyx_L1_error) + } + __pyx_L5:; - /* "src/helpers/helpers.pyx":776 - * for i in range(apr[islt]): - * for j in range(8): - * energy[j]+=epa[i*8+j] # <<<<<<<<<<<<<< - * energy_octant[j]+=epa_oct[i*8+j] - * for j in range(3): + /* "View.MemoryView":695 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx */ - __pyx_t_26 = __pyx_v_j; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_energy.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_energy.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_energy.diminfo[0].strides) += (__pyx_v_epa[((__pyx_v_i * 8) + __pyx_v_j)]); + __pyx_v_idx = (__pyx_v_idx + 1); - /* "src/helpers/helpers.pyx":777 - * for j in range(8): - * energy[j]+=epa[i*8+j] - * energy_octant[j]+=epa_oct[i*8+j] # <<<<<<<<<<<<<< - * for j in range(3): - * energy_xyz[j]+=epa_xyz[i*3+j] + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: */ - __pyx_t_26 = __pyx_v_j; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_energy_octant.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_energy_octant.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_energy_octant.diminfo[0].strides) += (__pyx_v_epa_oct[((__pyx_v_i * 8) + __pyx_v_j)]); - } + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/helpers.pyx":778 - * energy[j]+=epa[i*8+j] - * energy_octant[j]+=epa_oct[i*8+j] - * for j in range(3): # <<<<<<<<<<<<<< - * energy_xyz[j]+=epa_xyz[i*3+j] + /* "View.MemoryView":697 + * idx += 1 * - */ - for (__pyx_t_18 = 0; __pyx_t_18 < 3; __pyx_t_18+=1) { - __pyx_v_j = __pyx_t_18; - - /* "src/helpers/helpers.pyx":779 - * energy_octant[j]+=epa_oct[i*8+j] - * for j in range(3): - * energy_xyz[j]+=epa_xyz[i*3+j] # <<<<<<<<<<<<<< + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) * - * return energy*1390.02, energy_xyz*1390.02, energy_octant*1390.02 */ - __pyx_t_26 = __pyx_v_j; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_energy_xyz.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_energy_xyz.diminfo[0].strides) += (__pyx_v_epa_xyz[((__pyx_v_i * 3) + __pyx_v_j)]); - } - } + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); - /* "src/helpers/helpers.pyx":781 - * energy_xyz[j]+=epa_xyz[i*3+j] + /* "View.MemoryView":698 * - * return energy*1390.02, energy_xyz*1390.02, energy_octant*1390.02 # <<<<<<<<<<<<<< + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = PyNumber_Multiply(((PyObject *)__pyx_v_energy), __pyx_float_1390_02); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 781, __pyx_L1_error) + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyNumber_Multiply(((PyObject *)__pyx_v_energy_xyz), __pyx_float_1390_02); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_energy_octant), __pyx_float_1390_02); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); + __pyx_t_1 = __pyx_t_7; __pyx_t_7 = 0; - __pyx_t_6 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 698, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error); __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; - /* "src/helpers/helpers.pyx":692 + /* "View.MemoryView":671 + * return isinstance(o, memoryview) * - * @cython.boundscheck(False) - * def calcEnergyAASep(np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] charges, - * np.ndarray[np.int32_t,ndim=1,mode="c"] atoms_per_residue, + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_charges.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_octant.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_octants.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAASep", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_charges.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_octant.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_octants.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_energy_per_atom); - __Pyx_XDECREF((PyObject *)__pyx_v_energy_xyz_per_atom); - __Pyx_XDECREF((PyObject *)__pyx_v_energy_octant_per_atom); - __Pyx_XDECREF((PyObject *)__pyx_v_energy); - __Pyx_XDECREF((PyObject *)__pyx_v_energy_xyz); - __Pyx_XDECREF((PyObject *)__pyx_v_energy_octant); + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":784 - * - * @cython.boundscheck(False) - * def findDS(char [:,:,:] ds, double [:,:] cn, int n1, int n2, int shell, int t): # <<<<<<<<<<<<<< +/* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) * - * cdef int i, j + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_41findDS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_41findDS = {"findDS", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_41findDS, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_41findDS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_cn = { 0, 0, { 0 }, { 0 }, { 0 } }; - CYTHON_UNUSED int __pyx_v_n1; - int __pyx_v_n2; - int __pyx_v_shell; - int __pyx_v_t; +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("findDS (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_cn,&__pyx_n_s_n1,&__pyx_n_s_n2,&__pyx_n_s_shell,&__pyx_n_s_t,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cn)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, 1); __PYX_ERR(0, 784, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, 2); __PYX_ERR(0, 784, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, 3); __PYX_ERR(0, 784, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, 4); __PYX_ERR(0, 784, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, 5); __PYX_ERR(0, 784, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findDS") < 0)) __PYX_ERR(0, 784, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); + + /* "View.MemoryView":701 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + */ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag + */ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":703 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 703, __pyx_L1_error) + + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag + */ } - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 784, __pyx_L3_error) - __pyx_v_cn = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cn.memview)) __PYX_ERR(0, 784, __pyx_L3_error) - __pyx_v_n1 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L3_error) - __pyx_v_n2 = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_n2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L3_error) - __pyx_v_shell = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_shell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L3_error) - __pyx_v_t = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_t == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 784, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.findDS", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_40findDS(__pyx_self, __pyx_v_ds, __pyx_v_cn, __pyx_v_n1, __pyx_v_n2, __pyx_v_shell, __pyx_v_t); + + /* "View.MemoryView":704 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + */ /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_40findDS(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_cn, CYTHON_UNUSED int __pyx_v_n1, int __pyx_v_n2, int __pyx_v_shell, int __pyx_v_t) { - int __pyx_v_i; - int __pyx_v_j; - PyObject *__pyx_r = NULL; +/* "View.MemoryView":711 + * + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step + */ + +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; int __pyx_t_10; - __Pyx_RefNannySetupContext("findDS", 0); + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); - /* "src/helpers/helpers.pyx":788 - * cdef int i, j + /* "View.MemoryView":712 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst + */ + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; + + /* "View.MemoryView":719 * - * for i in prange(n1, nogil=True): # <<<<<<<<<<<<<< - * for j in range(n2): - * if ds[t, i, j] == shell: + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_n1; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - /* "src/helpers/helpers.pyx":789 + /* "View.MemoryView":723 + * cdef _memoryviewslice memviewsliceobj * - * for i in prange(n1, nogil=True): - * for j in range(n2): # <<<<<<<<<<<<<< - * if ds[t, i, j] == shell: - * cn[t, i] += 1.0 + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): */ - __pyx_t_4 = __pyx_v_n2; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_j = __pyx_t_6; + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 723, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 723, __pyx_L1_error) + #endif - /* "src/helpers/helpers.pyx":790 - * for i in prange(n1, nogil=True): - * for j in range(n2): - * if ds[t, i, j] == shell: # <<<<<<<<<<<<<< - * cn[t, i] += 1.0 + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ - __pyx_t_7 = __pyx_v_t; - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = __pyx_v_j; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_ds.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_ds.shape[1]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_ds.shape[2]; - __pyx_t_10 = (((*((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_7 * __pyx_v_ds.strides[0]) ) + __pyx_t_8 * __pyx_v_ds.strides[1]) ) + __pyx_t_9 * __pyx_v_ds.strides[2]) ))) == __pyx_v_shell) != 0); - if (__pyx_t_10) { + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":791 - * for j in range(n2): - * if ds[t, i, j] == shell: - * cn[t, i] += 1.0 # <<<<<<<<<<<<<< - * + /* "View.MemoryView":726 * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: */ - __pyx_t_9 = __pyx_v_t; - __pyx_t_8 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_cn.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_cn.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cn.data + __pyx_t_9 * __pyx_v_cn.strides[0]) ) + __pyx_t_8 * __pyx_v_cn.strides[1]) )) += 1.0; + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 726, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/helpers/helpers.pyx":790 - * for i in prange(n1, nogil=True): - * for j in range(n2): - * if ds[t, i, j] == shell: # <<<<<<<<<<<<<< - * cn[t, i] += 1.0 - * + /* "View.MemoryView":727 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) */ - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); - /* "src/helpers/helpers.pyx":788 - * cdef int i, j + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 * - * for i in prange(n1, nogil=True): # <<<<<<<<<<<<<< - * for j in range(n2): - * if ds[t, i, j] == shell: + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } + goto __pyx_L3; } - /* "src/helpers/helpers.pyx":784 - * - * @cython.boundscheck(False) - * def findDS(char [:,:,:] ds, double [:,:] cn, int n1, int n2, int shell, int t): # <<<<<<<<<<<<<< + /* "View.MemoryView":729 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src * - * cdef int i, j */ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_cn, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/helpers.pyx":795 + /* "View.MemoryView":730 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) - * def dipTenCorrel(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, - * char [:,:] H_indices, */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_43dipTenCorrel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_43dipTenCorrel = {"dipTenCorrel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_43dipTenCorrel, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_43dipTenCorrel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_coo_center = 0; - PyArrayObject *__pyx_v_coo_H = 0; - __Pyx_memviewslice __pyx_v_H_indices = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyArrayObject *__pyx_v_dipT0 = 0; - PyArrayObject *__pyx_v_corrsubmean = 0; - __pyx_t_5numpy_int32_t __pyx_v_timectr; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("dipTenCorrel (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coo_center,&__pyx_n_s_coo_H,&__pyx_n_s_H_indices,&__pyx_n_s_dipT0,&__pyx_n_s_corrsubmean,&__pyx_n_s_timectr,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coo_center)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coo_H)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, 1); __PYX_ERR(0, 795, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H_indices)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, 2); __PYX_ERR(0, 795, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dipT0)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, 3); __PYX_ERR(0, 795, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_corrsubmean)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, 4); __PYX_ERR(0, 795, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timectr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, 5); __PYX_ERR(0, 795, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dipTenCorrel") < 0)) __PYX_ERR(0, 795, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - } - __pyx_v_coo_center = ((PyArrayObject *)values[0]); - __pyx_v_coo_H = ((PyArrayObject *)values[1]); - __pyx_v_H_indices = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_H_indices.memview)) __PYX_ERR(0, 797, __pyx_L3_error) - __pyx_v_dipT0 = ((PyArrayObject *)values[3]); - __pyx_v_corrsubmean = ((PyArrayObject *)values[4]); - __pyx_v_timectr = __Pyx_PyInt_As_npy_int32(values[5]); if (unlikely((__pyx_v_timectr == ((npy_int32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 800, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 795, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.dipTenCorrel", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coo_center), __pyx_ptype_5numpy_ndarray, 1, "coo_center", 0))) __PYX_ERR(0, 795, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coo_H), __pyx_ptype_5numpy_ndarray, 1, "coo_H", 0))) __PYX_ERR(0, 796, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dipT0), __pyx_ptype_5numpy_ndarray, 1, "dipT0", 0))) __PYX_ERR(0, 798, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_corrsubmean), __pyx_ptype_5numpy_ndarray, 1, "corrsubmean", 0))) __PYX_ERR(0, 799, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_7helpers_42dipTenCorrel(__pyx_self, __pyx_v_coo_center, __pyx_v_coo_H, __pyx_v_H_indices, __pyx_v_dipT0, __pyx_v_corrsubmean, __pyx_v_timectr); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_7helpers_42dipTenCorrel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coo_center, PyArrayObject *__pyx_v_coo_H, __Pyx_memviewslice __pyx_v_H_indices, PyArrayObject *__pyx_v_dipT0, PyArrayObject *__pyx_v_corrsubmean, __pyx_t_5numpy_int32_t __pyx_v_timectr) { - int __pyx_v_i; - int __pyx_v_center; - int __pyx_v_H_shell; - int __pyx_v_ctr; - CYTHON_UNUSED int __pyx_v_len_center; - int __pyx_v_len_H; - double __pyx_v_rvec0; - double __pyx_v_rvec1; - double __pyx_v_rvec2; - double __pyx_v_dipTt0; - double __pyx_v_dipTt1; - double __pyx_v_dipTt2; - double __pyx_v_dipTt3; - double __pyx_v_dipTt4; - double __pyx_v_dipTt5; - double __pyx_v_r2; - double __pyx_v_f1; - double __pyx_v_f2; - double __pyx_v_f2_0; - double __pyx_v_f2_1; - double __pyx_v_f2_2; - double *__pyx_v_centers; - double *__pyx_v_hs; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coo_H; - __Pyx_Buffer __pyx_pybuffer_coo_H; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coo_center; - __Pyx_Buffer __pyx_pybuffer_coo_center; - __Pyx_LocalBuf_ND __pyx_pybuffernd_corrsubmean; - __Pyx_Buffer __pyx_pybuffer_corrsubmean; - __Pyx_LocalBuf_ND __pyx_pybuffernd_dipT0; - __Pyx_Buffer __pyx_pybuffer_dipT0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - double __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - Py_ssize_t __pyx_t_31; - Py_ssize_t __pyx_t_32; - Py_ssize_t __pyx_t_33; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dipTenCorrel", 0); - __pyx_pybuffer_coo_center.pybuffer.buf = NULL; - __pyx_pybuffer_coo_center.refcount = 0; - __pyx_pybuffernd_coo_center.data = NULL; - __pyx_pybuffernd_coo_center.rcbuffer = &__pyx_pybuffer_coo_center; - __pyx_pybuffer_coo_H.pybuffer.buf = NULL; - __pyx_pybuffer_coo_H.refcount = 0; - __pyx_pybuffernd_coo_H.data = NULL; - __pyx_pybuffernd_coo_H.rcbuffer = &__pyx_pybuffer_coo_H; - __pyx_pybuffer_dipT0.pybuffer.buf = NULL; - __pyx_pybuffer_dipT0.refcount = 0; - __pyx_pybuffernd_dipT0.data = NULL; - __pyx_pybuffernd_dipT0.rcbuffer = &__pyx_pybuffer_dipT0; - __pyx_pybuffer_corrsubmean.pybuffer.buf = NULL; - __pyx_pybuffer_corrsubmean.refcount = 0; - __pyx_pybuffernd_corrsubmean.data = NULL; - __pyx_pybuffernd_corrsubmean.rcbuffer = &__pyx_pybuffer_corrsubmean; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_coo_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 795, __pyx_L1_error) - } - __pyx_pybuffernd_coo_center.diminfo[0].strides = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coo_center.diminfo[0].shape = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coo_center.diminfo[1].strides = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coo_center.diminfo[1].shape = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer, (PyObject*)__pyx_v_coo_H, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 795, __pyx_L1_error) - } - __pyx_pybuffernd_coo_H.diminfo[0].strides = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coo_H.diminfo[0].shape = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coo_H.diminfo[1].strides = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coo_H.diminfo[1].shape = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer, (PyObject*)__pyx_v_dipT0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 795, __pyx_L1_error) - } - __pyx_pybuffernd_dipT0.diminfo[0].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dipT0.diminfo[0].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dipT0.diminfo[1].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dipT0.diminfo[1].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_dipT0.diminfo[2].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_dipT0.diminfo[2].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[2]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer, (PyObject*)__pyx_v_corrsubmean, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 795, __pyx_L1_error) + __pyx_v_p_src = (&__pyx_v_src); } - __pyx_pybuffernd_corrsubmean.diminfo[0].strides = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corrsubmean.diminfo[0].shape = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corrsubmean.diminfo[1].strides = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corrsubmean.diminfo[1].shape = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_corrsubmean.diminfo[2].strides = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_corrsubmean.diminfo[2].shape = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.shape[2]; + __pyx_L3:; - /* "src/helpers/helpers.pyx":803 + /* "View.MemoryView":736 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data * - * cdef int i, center, H_shell, ctr - * cdef int len_center = len(coo_center) # <<<<<<<<<<<<<< - * cdef int len_H = len(coo_H) - * cdef double rvec0, rvec1, rvec2 */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coo_center)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 803, __pyx_L1_error) - __pyx_v_len_center = __pyx_t_1; + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; - /* "src/helpers/helpers.pyx":804 - * cdef int i, center, H_shell, ctr - * cdef int len_center = len(coo_center) - * cdef int len_H = len(coo_H) # <<<<<<<<<<<<<< - * cdef double rvec0, rvec1, rvec2 - * cdef double dipTt0, dipTt1, dipTt2, dipTt3, dipTt4, dipTt5 + /* "View.MemoryView":737 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * + * */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coo_H)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 804, __pyx_L1_error) - __pyx_v_len_H = __pyx_t_1; + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; - /* "src/helpers/helpers.pyx":808 - * cdef double dipTt0, dipTt1, dipTt2, dipTt3, dipTt4, dipTt5 - * cdef double r2, f1, f2, f2_0, f2_1, f2_2 - * cdef double *centers = coo_center.data # <<<<<<<<<<<<<< - * cdef double *hs = coo_H.data + /* "View.MemoryView":742 * + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex */ - __pyx_v_centers = ((double *)__pyx_v_coo_center->data); + __pyx_v_p_dst = (&__pyx_v_dst); - /* "src/helpers/helpers.pyx":809 - * cdef double r2, f1, f2, f2_0, f2_1, f2_2 - * cdef double *centers = coo_center.data - * cdef double *hs = coo_H.data # <<<<<<<<<<<<<< + /* "View.MemoryView":743 * - * for center in prange(len_center,nogil=True): + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step */ - __pyx_v_hs = ((double *)__pyx_v_coo_H->data); + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - /* "src/helpers/helpers.pyx":811 - * cdef double *hs = coo_H.data + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step * - * for center in prange(len_center,nogil=True): # <<<<<<<<<<<<<< - * ctr = 0 - * for i in range(len_H): + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_2 = __pyx_v_len_center; - if ((1 == 0)) abort(); - { - int __pyx_parallel_temp0 = ((int)0xbad0bad0); - int __pyx_parallel_temp1 = ((int)0xbad0bad0); - int __pyx_parallel_temp2 = ((int)0xbad0bad0); - double __pyx_parallel_temp3 = ((double)__PYX_NAN()); - double __pyx_parallel_temp4 = ((double)__PYX_NAN()); - double __pyx_parallel_temp5 = ((double)__PYX_NAN()); - double __pyx_parallel_temp6 = ((double)__PYX_NAN()); - double __pyx_parallel_temp7 = ((double)__PYX_NAN()); - double __pyx_parallel_temp8 = ((double)__PYX_NAN()); - double __pyx_parallel_temp9 = ((double)__PYX_NAN()); - double __pyx_parallel_temp10 = ((double)__PYX_NAN()); - double __pyx_parallel_temp11 = ((double)__PYX_NAN()); - double __pyx_parallel_temp12 = ((double)__PYX_NAN()); - double __pyx_parallel_temp13 = ((double)__PYX_NAN()); - int __pyx_parallel_temp14 = ((int)0xbad0bad0); - double __pyx_parallel_temp15 = ((double)__PYX_NAN()); - double __pyx_parallel_temp16 = ((double)__PYX_NAN()); - double __pyx_parallel_temp17 = ((double)__PYX_NAN()); - double __pyx_parallel_temp18 = ((double)__PYX_NAN()); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_4 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_4 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_H_shell) firstprivate(__pyx_v_center) lastprivate(__pyx_v_center) lastprivate(__pyx_v_ctr) lastprivate(__pyx_v_dipTt0) lastprivate(__pyx_v_dipTt1) lastprivate(__pyx_v_dipTt2) lastprivate(__pyx_v_dipTt3) lastprivate(__pyx_v_dipTt4) lastprivate(__pyx_v_dipTt5) lastprivate(__pyx_v_f1) lastprivate(__pyx_v_f2) lastprivate(__pyx_v_f2_0) lastprivate(__pyx_v_f2_1) lastprivate(__pyx_v_f2_2) lastprivate(__pyx_v_i) lastprivate(__pyx_v_r2) lastprivate(__pyx_v_rvec0) lastprivate(__pyx_v_rvec1) lastprivate(__pyx_v_rvec2) - #endif /* _OPENMP */ - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_center = (int)(0 + 1 * __pyx_t_3); - /* Initialize private variables to invalid values */ - __pyx_v_H_shell = ((int)0xbad0bad0); - __pyx_v_ctr = ((int)0xbad0bad0); - __pyx_v_dipTt0 = ((double)__PYX_NAN()); - __pyx_v_dipTt1 = ((double)__PYX_NAN()); - __pyx_v_dipTt2 = ((double)__PYX_NAN()); - __pyx_v_dipTt3 = ((double)__PYX_NAN()); - __pyx_v_dipTt4 = ((double)__PYX_NAN()); - __pyx_v_dipTt5 = ((double)__PYX_NAN()); - __pyx_v_f1 = ((double)__PYX_NAN()); - __pyx_v_f2 = ((double)__PYX_NAN()); - __pyx_v_f2_0 = ((double)__PYX_NAN()); - __pyx_v_f2_1 = ((double)__PYX_NAN()); - __pyx_v_f2_2 = ((double)__PYX_NAN()); - __pyx_v_i = ((int)0xbad0bad0); - __pyx_v_r2 = ((double)__PYX_NAN()); - __pyx_v_rvec0 = ((double)__PYX_NAN()); - __pyx_v_rvec1 = ((double)__PYX_NAN()); - __pyx_v_rvec2 = ((double)__PYX_NAN()); + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 747, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 747, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); - /* "src/helpers/helpers.pyx":812 + /* "View.MemoryView":748 * - * for center in prange(len_center,nogil=True): - * ctr = 0 # <<<<<<<<<<<<<< - * for i in range(len_H): - * if H_indices[center,i] > 0: + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ - __pyx_v_ctr = 0; + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":813 - * for center in prange(len_center,nogil=True): - * ctr = 0 - * for i in range(len_H): # <<<<<<<<<<<<<< - * if H_indices[center,i] > 0: - * H_shell = H_indices[center,i] + /* "View.MemoryView":749 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], */ - __pyx_t_5 = __pyx_v_len_H; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 749, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; - /* "src/helpers/helpers.pyx":814 - * ctr = 0 - * for i in range(len_H): - * if H_indices[center,i] > 0: # <<<<<<<<<<<<<< - * H_shell = H_indices[center,i] - * rvec0 = hs[3*i] - centers[3*center] + /* "View.MemoryView":750 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - __pyx_t_8 = __pyx_v_center; - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_H_indices.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_H_indices.shape[1]; - __pyx_t_10 = (((*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_H_indices.data + __pyx_t_8 * __pyx_v_H_indices.strides[0]) ) + __pyx_t_9 * __pyx_v_H_indices.strides[1]) ))) > 0) != 0); - if (__pyx_t_10) { + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 750, __pyx_L1_error) - /* "src/helpers/helpers.pyx":815 - * for i in range(len_H): - * if H_indices[center,i] > 0: - * H_shell = H_indices[center,i] # <<<<<<<<<<<<<< - * rvec0 = hs[3*i] - centers[3*center] - * rvec1 = hs[3*i+1] - centers[3*center+1] + /* "View.MemoryView":748 + * + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ - __pyx_t_9 = __pyx_v_center; - __pyx_t_8 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_H_indices.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_H_indices.shape[1]; - __pyx_v_H_shell = (*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_H_indices.data + __pyx_t_9 * __pyx_v_H_indices.strides[0]) ) + __pyx_t_8 * __pyx_v_H_indices.strides[1]) ))); + goto __pyx_L6; + } - /* "src/helpers/helpers.pyx":816 - * if H_indices[center,i] > 0: - * H_shell = H_indices[center,i] - * rvec0 = hs[3*i] - centers[3*center] # <<<<<<<<<<<<<< - * rvec1 = hs[3*i+1] - centers[3*center+1] - * rvec2 = hs[3*i+2] - centers[3*center+2] + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 */ - __pyx_v_rvec0 = ((__pyx_v_hs[(3 * __pyx_v_i)]) - (__pyx_v_centers[(3 * __pyx_v_center)])); + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":817 - * H_shell = H_indices[center,i] - * rvec0 = hs[3*i] - centers[3*center] - * rvec1 = hs[3*i+1] - centers[3*center+1] # <<<<<<<<<<<<<< - * rvec2 = hs[3*i+2] - centers[3*center+2] - * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 + /* "View.MemoryView":757 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 */ - __pyx_v_rvec1 = ((__pyx_v_hs[((3 * __pyx_v_i) + 1)]) - (__pyx_v_centers[((3 * __pyx_v_center) + 1)])); + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - /* "src/helpers/helpers.pyx":818 - * rvec0 = hs[3*i] - centers[3*center] - * rvec1 = hs[3*i+1] - centers[3*center+1] - * rvec2 = hs[3*i+2] - centers[3*center+2] # <<<<<<<<<<<<<< - * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 - * f1 = pow(r2,-1.5) + /* "View.MemoryView":758 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 */ - __pyx_v_rvec2 = ((__pyx_v_hs[((3 * __pyx_v_i) + 2)]) - (__pyx_v_centers[((3 * __pyx_v_center) + 2)])); + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - /* "src/helpers/helpers.pyx":819 - * rvec1 = hs[3*i+1] - centers[3*center+1] - * rvec2 = hs[3*i+2] - centers[3*center+2] - * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 # <<<<<<<<<<<<<< - * f1 = pow(r2,-1.5) - * f2 = 3.0 * f1 / r2 + /* "View.MemoryView":759 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: */ - __pyx_v_r2 = (((__pyx_v_rvec0 * __pyx_v_rvec0) + (__pyx_v_rvec1 * __pyx_v_rvec1)) + (__pyx_v_rvec2 * __pyx_v_rvec2)); + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; - /* "src/helpers/helpers.pyx":820 - * rvec2 = hs[3*i+2] - centers[3*center+2] - * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 - * f1 = pow(r2,-1.5) # <<<<<<<<<<<<<< - * f2 = 3.0 * f1 / r2 - * f2_0 = f2 * rvec0 + /* "View.MemoryView":760 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 */ - __pyx_v_f1 = pow(__pyx_v_r2, -1.5); + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - /* "src/helpers/helpers.pyx":821 - * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 - * f1 = pow(r2,-1.5) - * f2 = 3.0 * f1 / r2 # <<<<<<<<<<<<<< - * f2_0 = f2 * rvec0 - * f2_1 = f2 * rvec1 + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 */ - __pyx_t_11 = (3.0 * __pyx_v_f1); - if (unlikely(__pyx_v_r2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 821, __pyx_L8_error) - } - __pyx_v_f2 = (__pyx_t_11 / __pyx_v_r2); + goto __pyx_L6; + } - /* "src/helpers/helpers.pyx":822 - * f1 = pow(r2,-1.5) - * f2 = 3.0 * f1 / r2 - * f2_0 = f2 * rvec0 # <<<<<<<<<<<<<< - * f2_1 = f2 * rvec1 - * f2_2 = f2 * rvec2 + /* "View.MemoryView":762 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 */ - __pyx_v_f2_0 = (__pyx_v_f2 * __pyx_v_rvec0); + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 762, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 762, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; - /* "src/helpers/helpers.pyx":823 - * f2 = 3.0 * f1 / r2 - * f2_0 = f2 * rvec0 - * f2_1 = f2 * rvec1 # <<<<<<<<<<<<<< - * f2_2 = f2 * rvec2 + /* "View.MemoryView":763 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 * */ - __pyx_v_f2_1 = (__pyx_v_f2 * __pyx_v_rvec1); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; - /* "src/helpers/helpers.pyx":824 - * f2_0 = f2 * rvec0 - * f2_1 = f2 * rvec1 - * f2_2 = f2 * rvec2 # <<<<<<<<<<<<<< + /* "View.MemoryView":764 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< * - * dipTt0 = (f2_0 * rvec0 - f1) + * have_start = index.start is not None */ - __pyx_v_f2_2 = (__pyx_v_f2 * __pyx_v_rvec2); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; - /* "src/helpers/helpers.pyx":826 - * f2_2 = f2 * rvec2 + /* "View.MemoryView":766 + * step = index.step or 0 * - * dipTt0 = (f2_0 * rvec0 - f1) # <<<<<<<<<<<<<< - * dipTt1 = (f2_1 * rvec1 - f1) - * dipTt2 = (f2_2 * rvec2 - f1) + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None */ - __pyx_v_dipTt0 = ((__pyx_v_f2_0 * __pyx_v_rvec0) - __pyx_v_f1); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; - /* "src/helpers/helpers.pyx":827 + /* "View.MemoryView":767 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None * - * dipTt0 = (f2_0 * rvec0 - f1) - * dipTt1 = (f2_1 * rvec1 - f1) # <<<<<<<<<<<<<< - * dipTt2 = (f2_2 * rvec2 - f1) - * dipTt3 = (f2_0 * rvec1) */ - __pyx_v_dipTt1 = ((__pyx_v_f2_1 * __pyx_v_rvec1) - __pyx_v_f1); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; - /* "src/helpers/helpers.pyx":828 - * dipTt0 = (f2_0 * rvec0 - f1) - * dipTt1 = (f2_1 * rvec1 - f1) - * dipTt2 = (f2_2 * rvec2 - f1) # <<<<<<<<<<<<<< - * dipTt3 = (f2_0 * rvec1) - * dipTt4 = (f2_0 * rvec2) + /* "View.MemoryView":768 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( */ - __pyx_v_dipTt2 = ((__pyx_v_f2_2 * __pyx_v_rvec2) - __pyx_v_f1); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; - /* "src/helpers/helpers.pyx":829 - * dipTt1 = (f2_1 * rvec1 - f1) - * dipTt2 = (f2_2 * rvec2 - f1) - * dipTt3 = (f2_0 * rvec1) # <<<<<<<<<<<<<< - * dipTt4 = (f2_0 * rvec2) - * dipTt5 = (f2_1 * rvec2) + /* "View.MemoryView":770 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - __pyx_v_dipTt3 = (__pyx_v_f2_0 * __pyx_v_rvec1); + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 770, __pyx_L1_error) - /* "src/helpers/helpers.pyx":830 - * dipTt2 = (f2_2 * rvec2 - f1) - * dipTt3 = (f2_0 * rvec1) - * dipTt4 = (f2_0 * rvec2) # <<<<<<<<<<<<<< - * dipTt5 = (f2_1 * rvec2) + /* "View.MemoryView":776 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< * + * if isinstance(memview, _memoryviewslice): */ - __pyx_v_dipTt4 = (__pyx_v_f2_0 * __pyx_v_rvec2); + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; - /* "src/helpers/helpers.pyx":831 - * dipTt3 = (f2_0 * rvec1) - * dipTt4 = (f2_0 * rvec2) - * dipTt5 = (f2_1 * rvec2) # <<<<<<<<<<<<<< + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step * - * corrsubmean[center,H_shell,timectr] = corrsubmean[center,H_shell,timectr] + dipT0[center,ctr,0] * dipTt0 + dipT0[center,ctr,1] * dipTt1 + dipT0[center,ctr,2] * dipTt2 + dipT0[center,ctr,3] * dipTt3 + dipT0[center,ctr,4] * dipTt4 + dipT0[center,ctr,5] * dipTt5 + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index */ - __pyx_v_dipTt5 = (__pyx_v_f2_1 * __pyx_v_rvec2); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/helpers.pyx":833 - * dipTt5 = (f2_1 * rvec2) + /* "View.MemoryView":778 + * new_ndim += 1 * - * corrsubmean[center,H_shell,timectr] = corrsubmean[center,H_shell,timectr] + dipT0[center,ctr,0] * dipTt0 + dipT0[center,ctr,1] * dipTt1 + dipT0[center,ctr,2] * dipTt2 + dipT0[center,ctr,3] * dipTt3 + dipT0[center,ctr,4] * dipTt4 + dipT0[center,ctr,5] * dipTt5 # <<<<<<<<<<<<<< + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + */ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":779 * - * ctr = ctr + 1 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, */ - __pyx_t_8 = __pyx_v_center; - __pyx_t_9 = __pyx_v_H_shell; - __pyx_t_12 = __pyx_v_timectr; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_corrsubmean.diminfo[0].shape; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_pybuffernd_corrsubmean.diminfo[1].shape; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_pybuffernd_corrsubmean.diminfo[2].shape; - __pyx_t_13 = __pyx_v_center; - __pyx_t_14 = __pyx_v_ctr; - __pyx_t_15 = 0; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - __pyx_t_16 = __pyx_v_center; - __pyx_t_17 = __pyx_v_ctr; - __pyx_t_18 = 1; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - __pyx_t_19 = __pyx_v_center; - __pyx_t_20 = __pyx_v_ctr; - __pyx_t_21 = 2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - __pyx_t_22 = __pyx_v_center; - __pyx_t_23 = __pyx_v_ctr; - __pyx_t_24 = 3; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - __pyx_t_25 = __pyx_v_center; - __pyx_t_26 = __pyx_v_ctr; - __pyx_t_27 = 4; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - __pyx_t_28 = __pyx_v_center; - __pyx_t_29 = __pyx_v_ctr; - __pyx_t_30 = 5; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - __pyx_t_31 = __pyx_v_center; - __pyx_t_32 = __pyx_v_H_shell; - __pyx_t_33 = __pyx_v_timectr; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_pybuffernd_corrsubmean.diminfo[0].shape; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_pybuffernd_corrsubmean.diminfo[1].shape; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_pybuffernd_corrsubmean.diminfo[2].shape; - *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_corrsubmean.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_corrsubmean.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_corrsubmean.diminfo[2].strides) = (((((((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_corrsubmean.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_corrsubmean.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_corrsubmean.diminfo[2].strides)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt0)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt1)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt2)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt3)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_27, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt4)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt5)); - - /* "src/helpers/helpers.pyx":835 - * corrsubmean[center,H_shell,timectr] = corrsubmean[center,H_shell,timectr] + dipT0[center,ctr,0] * dipTt0 + dipT0[center,ctr,1] * dipTt1 + dipT0[center,ctr,2] * dipTt2 + dipT0[center,ctr,3] * dipTt3 + dipT0[center,ctr,4] * dipTt4 + dipT0[center,ctr,5] * dipTt5 + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":780 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 780, __pyx_L1_error) } + + /* "View.MemoryView":781 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":779 * - * ctr = ctr + 1 # <<<<<<<<<<<<<< + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, + */ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 779, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":778 + * new_ndim += 1 * - * @cython.boundscheck(False) + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, */ - __pyx_v_ctr = (__pyx_v_ctr + 1); + } - /* "src/helpers/helpers.pyx":814 - * ctr = 0 - * for i in range(len_H): - * if H_indices[center,i] > 0: # <<<<<<<<<<<<<< - * H_shell = H_indices[center,i] - * rvec0 = hs[3*i] - centers[3*center] + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * */ - } - } - goto __pyx_L14; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L13; - __pyx_L13:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates0) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_H_shell; - __pyx_parallel_temp1 = __pyx_v_center; - __pyx_parallel_temp2 = __pyx_v_ctr; - __pyx_parallel_temp3 = __pyx_v_dipTt0; - __pyx_parallel_temp4 = __pyx_v_dipTt1; - __pyx_parallel_temp5 = __pyx_v_dipTt2; - __pyx_parallel_temp6 = __pyx_v_dipTt3; - __pyx_parallel_temp7 = __pyx_v_dipTt4; - __pyx_parallel_temp8 = __pyx_v_dipTt5; - __pyx_parallel_temp9 = __pyx_v_f1; - __pyx_parallel_temp10 = __pyx_v_f2; - __pyx_parallel_temp11 = __pyx_v_f2_0; - __pyx_parallel_temp12 = __pyx_v_f2_1; - __pyx_parallel_temp13 = __pyx_v_f2_2; - __pyx_parallel_temp14 = __pyx_v_i; - __pyx_parallel_temp15 = __pyx_v_r2; - __pyx_parallel_temp16 = __pyx_v_rvec0; - __pyx_parallel_temp17 = __pyx_v_rvec1; - __pyx_parallel_temp18 = __pyx_v_rvec2; - } - __pyx_L14:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_H_shell = __pyx_parallel_temp0; - __pyx_v_center = __pyx_parallel_temp1; - __pyx_v_ctr = __pyx_parallel_temp2; - __pyx_v_dipTt0 = __pyx_parallel_temp3; - __pyx_v_dipTt1 = __pyx_parallel_temp4; - __pyx_v_dipTt2 = __pyx_parallel_temp5; - __pyx_v_dipTt3 = __pyx_parallel_temp6; - __pyx_v_dipTt4 = __pyx_parallel_temp7; - __pyx_v_dipTt5 = __pyx_parallel_temp8; - __pyx_v_f1 = __pyx_parallel_temp9; - __pyx_v_f2 = __pyx_parallel_temp10; - __pyx_v_f2_0 = __pyx_parallel_temp11; - __pyx_v_f2_1 = __pyx_parallel_temp12; - __pyx_v_f2_2 = __pyx_parallel_temp13; - __pyx_v_i = __pyx_parallel_temp14; - __pyx_v_r2 = __pyx_parallel_temp15; - __pyx_v_rvec0 = __pyx_parallel_temp16; - __pyx_v_rvec1 = __pyx_parallel_temp17; - __pyx_v_rvec2 = __pyx_parallel_temp18; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); - /* "src/helpers/helpers.pyx":811 - * cdef double *hs = coo_H.data + /* "View.MemoryView":785 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * * - * for center in prange(len_center,nogil=True): # <<<<<<<<<<<<<< - * ctr = 0 - * for i in range(len_H): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * + */ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 784, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; } - /* "src/helpers/helpers.pyx":795 + /* "View.MemoryView":711 * - * @cython.boundscheck(False) - * def dipTenCorrel(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, - * char [:,:] H_indices, + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.helpers.dipTenCorrel", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer); - __pyx_L2:; - __PYX_XDEC_MEMVIEW(&__pyx_v_H_indices, 1); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":838 +/* "View.MemoryView":793 * - * @cython.boundscheck(False) - * def dipTenInit(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, - * char [:,:] H_indices, + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_45dipTenInit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_45dipTenInit = {"dipTenInit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_45dipTenInit, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_45dipTenInit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_coo_center = 0; - PyArrayObject *__pyx_v_coo_H = 0; - __Pyx_memviewslice __pyx_v_H_indices = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyArrayObject *__pyx_v_dipT0 = 0; - __pyx_t_5numpy_float64_t __pyx_v_nshells2; +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("dipTenInit (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coo_center,&__pyx_n_s_coo_H,&__pyx_n_s_H_indices,&__pyx_n_s_dipT0,&__pyx_n_s_nshells2,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coo_center)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coo_H)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipTenInit", 1, 5, 5, 1); __PYX_ERR(0, 838, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H_indices)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipTenInit", 1, 5, 5, 2); __PYX_ERR(0, 838, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dipT0)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipTenInit", 1, 5, 5, 3); __PYX_ERR(0, 838, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipTenInit", 1, 5, 5, 4); __PYX_ERR(0, 838, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dipTenInit") < 0)) __PYX_ERR(0, 838, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - } - __pyx_v_coo_center = ((PyArrayObject *)values[0]); - __pyx_v_coo_H = ((PyArrayObject *)values[1]); - __pyx_v_H_indices = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_H_indices.memview)) __PYX_ERR(0, 840, __pyx_L3_error) - __pyx_v_dipT0 = ((PyArrayObject *)values[3]); - __pyx_v_nshells2 = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_nshells2 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 842, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dipTenInit", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 838, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.dipTenInit", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coo_center), __pyx_ptype_5numpy_ndarray, 1, "coo_center", 0))) __PYX_ERR(0, 838, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coo_H), __pyx_ptype_5numpy_ndarray, 1, "coo_H", 0))) __PYX_ERR(0, 839, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dipT0), __pyx_ptype_5numpy_ndarray, 1, "dipT0", 0))) __PYX_ERR(0, 841, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_7helpers_44dipTenInit(__pyx_self, __pyx_v_coo_center, __pyx_v_coo_H, __pyx_v_H_indices, __pyx_v_dipT0, __pyx_v_nshells2); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("slice_memviewslice", 1); - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":813 + * cdef bint negative_step + * + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: + */ + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { -static PyObject *__pyx_pf_11newanalysis_7helpers_44dipTenInit(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coo_center, PyArrayObject *__pyx_v_coo_H, __Pyx_memviewslice __pyx_v_H_indices, PyArrayObject *__pyx_v_dipT0, __pyx_t_5numpy_float64_t __pyx_v_nshells2) { - int __pyx_v_i; - int __pyx_v_center; - int __pyx_v_ctr; - CYTHON_UNUSED int __pyx_v_len_center; - int __pyx_v_len_H; - double __pyx_v_rvec0; - double __pyx_v_rvec1; - double __pyx_v_rvec2; - double __pyx_v_r2; - double __pyx_v_f1; - double __pyx_v_f2; - double __pyx_v_f2_0; - double __pyx_v_f2_1; - double __pyx_v_f2_2; - double *__pyx_v_centers; - double *__pyx_v_hs; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coo_H; - __Pyx_Buffer __pyx_pybuffer_coo_H; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coo_center; - __Pyx_Buffer __pyx_pybuffer_coo_center; - __Pyx_LocalBuf_ND __pyx_pybuffernd_dipT0; - __Pyx_Buffer __pyx_pybuffer_dipT0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - double __pyx_t_11; - Py_ssize_t __pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dipTenInit", 0); - __pyx_pybuffer_coo_center.pybuffer.buf = NULL; - __pyx_pybuffer_coo_center.refcount = 0; - __pyx_pybuffernd_coo_center.data = NULL; - __pyx_pybuffernd_coo_center.rcbuffer = &__pyx_pybuffer_coo_center; - __pyx_pybuffer_coo_H.pybuffer.buf = NULL; - __pyx_pybuffer_coo_H.refcount = 0; - __pyx_pybuffernd_coo_H.data = NULL; - __pyx_pybuffernd_coo_H.rcbuffer = &__pyx_pybuffer_coo_H; - __pyx_pybuffer_dipT0.pybuffer.buf = NULL; - __pyx_pybuffer_dipT0.refcount = 0; - __pyx_pybuffernd_dipT0.data = NULL; - __pyx_pybuffernd_dipT0.rcbuffer = &__pyx_pybuffer_dipT0; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_coo_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 838, __pyx_L1_error) - } - __pyx_pybuffernd_coo_center.diminfo[0].strides = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coo_center.diminfo[0].shape = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coo_center.diminfo[1].strides = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coo_center.diminfo[1].shape = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer, (PyObject*)__pyx_v_coo_H, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 838, __pyx_L1_error) - } - __pyx_pybuffernd_coo_H.diminfo[0].strides = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coo_H.diminfo[0].shape = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coo_H.diminfo[1].strides = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coo_H.diminfo[1].shape = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer, (PyObject*)__pyx_v_dipT0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 838, __pyx_L1_error) - } - __pyx_pybuffernd_dipT0.diminfo[0].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dipT0.diminfo[0].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dipT0.diminfo[1].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dipT0.diminfo[1].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_dipT0.diminfo[2].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_dipT0.diminfo[2].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[2]; + /* "View.MemoryView":815 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: + */ + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":844 - * np.float64_t nshells2): - * cdef int i, center, ctr - * cdef int len_center = len(coo_center) # <<<<<<<<<<<<<< - * cdef int len_H = len(coo_H) - * cdef double rvec0, rvec1, rvec2 + /* "View.MemoryView":816 + * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coo_center)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 844, __pyx_L1_error) - __pyx_v_len_center = __pyx_t_1; + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "src/helpers/helpers.pyx":845 - * cdef int i, center, ctr - * cdef int len_center = len(coo_center) - * cdef int len_H = len(coo_H) # <<<<<<<<<<<<<< - * cdef double rvec0, rvec1, rvec2 - * cdef double dipTt0, dipTt1, dipTt2, dipTt3, dipTt4, dipTt5 + /* "View.MemoryView":815 + * if not is_slice: + * + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coo_H)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 845, __pyx_L1_error) - __pyx_v_len_H = __pyx_t_1; + } - /* "src/helpers/helpers.pyx":849 - * cdef double dipTt0, dipTt1, dipTt2, dipTt3, dipTt4, dipTt5 - * cdef double r2, f1, f2, f2_0, f2_1, f2_2 - * cdef double *centers = coo_center.data # <<<<<<<<<<<<<< - * cdef double *hs = coo_H.data + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: + */ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":818 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: * */ - __pyx_v_centers = ((double *)__pyx_v_coo_center->data); + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 818, __pyx_L1_error) - /* "src/helpers/helpers.pyx":850 - * cdef double r2, f1, f2, f2_0, f2_1, f2_2 - * cdef double *centers = coo_center.data - * cdef double *hs = coo_H.data # <<<<<<<<<<<<<< + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: + */ + } + + /* "View.MemoryView":813 + * cdef bint negative_step * - * for center in prange(len_center,nogil=True): + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: */ - __pyx_v_hs = ((double *)__pyx_v_coo_H->data); + goto __pyx_L3; + } - /* "src/helpers/helpers.pyx":852 - * cdef double *hs = coo_H.data + /* "View.MemoryView":821 + * else: * - * for center in prange(len_center,nogil=True): # <<<<<<<<<<<<<< - * ctr = 0 - * for i in range(len_H): + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_2 = __pyx_v_len_center; - if ((1 == 0)) abort(); - { - int __pyx_parallel_temp0 = ((int)0xbad0bad0); - int __pyx_parallel_temp1 = ((int)0xbad0bad0); - double __pyx_parallel_temp2 = ((double)__PYX_NAN()); - double __pyx_parallel_temp3 = ((double)__PYX_NAN()); - double __pyx_parallel_temp4 = ((double)__PYX_NAN()); - double __pyx_parallel_temp5 = ((double)__PYX_NAN()); - double __pyx_parallel_temp6 = ((double)__PYX_NAN()); - int __pyx_parallel_temp7 = ((int)0xbad0bad0); - double __pyx_parallel_temp8 = ((double)__PYX_NAN()); - double __pyx_parallel_temp9 = ((double)__PYX_NAN()); - double __pyx_parallel_temp10 = ((double)__PYX_NAN()); - double __pyx_parallel_temp11 = ((double)__PYX_NAN()); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_4 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_4 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_center) lastprivate(__pyx_v_center) lastprivate(__pyx_v_ctr) lastprivate(__pyx_v_f1) lastprivate(__pyx_v_f2) lastprivate(__pyx_v_f2_0) lastprivate(__pyx_v_f2_1) lastprivate(__pyx_v_f2_2) lastprivate(__pyx_v_i) lastprivate(__pyx_v_r2) lastprivate(__pyx_v_rvec0) lastprivate(__pyx_v_rvec1) lastprivate(__pyx_v_rvec2) - #endif /* _OPENMP */ - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_center = (int)(0 + 1 * __pyx_t_3); - /* Initialize private variables to invalid values */ - __pyx_v_ctr = ((int)0xbad0bad0); - __pyx_v_f1 = ((double)__PYX_NAN()); - __pyx_v_f2 = ((double)__PYX_NAN()); - __pyx_v_f2_0 = ((double)__PYX_NAN()); - __pyx_v_f2_1 = ((double)__PYX_NAN()); - __pyx_v_f2_2 = ((double)__PYX_NAN()); - __pyx_v_i = ((int)0xbad0bad0); - __pyx_v_r2 = ((double)__PYX_NAN()); - __pyx_v_rvec0 = ((double)__PYX_NAN()); - __pyx_v_rvec1 = ((double)__PYX_NAN()); - __pyx_v_rvec2 = ((double)__PYX_NAN()); + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":853 + /* "View.MemoryView":822 * - * for center in prange(len_center,nogil=True): - * ctr = 0 # <<<<<<<<<<<<<< - * for i in range(len_H): - * rvec0 = hs[3*i] - centers[3*center] + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) */ - __pyx_v_ctr = 0; + __pyx_v_negative_step = (__pyx_v_step < 0); - /* "src/helpers/helpers.pyx":854 - * for center in prange(len_center,nogil=True): - * ctr = 0 - * for i in range(len_H): # <<<<<<<<<<<<<< - * rvec0 = hs[3*i] - centers[3*center] - * rvec1 = hs[3*i+1] - centers[3*center+1] + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: */ - __pyx_t_5 = __pyx_v_len_H; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":855 - * ctr = 0 - * for i in range(len_H): - * rvec0 = hs[3*i] - centers[3*center] # <<<<<<<<<<<<<< - * rvec1 = hs[3*i+1] - centers[3*center+1] - * rvec2 = hs[3*i+2] - centers[3*center+2] + /* "View.MemoryView":824 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False */ - __pyx_v_rvec0 = ((__pyx_v_hs[(3 * __pyx_v_i)]) - (__pyx_v_centers[(3 * __pyx_v_center)])); + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 824, __pyx_L1_error) - /* "src/helpers/helpers.pyx":856 - * for i in range(len_H): - * rvec0 = hs[3*i] - centers[3*center] - * rvec1 = hs[3*i+1] - centers[3*center+1] # <<<<<<<<<<<<<< - * rvec2 = hs[3*i+2] - centers[3*center+2] - * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: */ - __pyx_v_rvec1 = ((__pyx_v_hs[((3 * __pyx_v_i) + 1)]) - (__pyx_v_centers[((3 * __pyx_v_center) + 1)])); + } - /* "src/helpers/helpers.pyx":857 - * rvec0 = hs[3*i] - centers[3*center] - * rvec1 = hs[3*i+1] - centers[3*center+1] - * rvec2 = hs[3*i+2] - centers[3*center+2] # <<<<<<<<<<<<<< - * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 + /* "View.MemoryView":821 + * else: * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ - __pyx_v_rvec2 = ((__pyx_v_hs[((3 * __pyx_v_i) + 2)]) - (__pyx_v_centers[((3 * __pyx_v_center) + 2)])); + goto __pyx_L6; + } - /* "src/helpers/helpers.pyx":858 - * rvec1 = hs[3*i+1] - centers[3*center+1] - * rvec2 = hs[3*i+2] - centers[3*center+2] - * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 # <<<<<<<<<<<<<< + /* "View.MemoryView":826 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 * - * if r2 <= nshells2: */ - __pyx_v_r2 = (((__pyx_v_rvec0 * __pyx_v_rvec0) + (__pyx_v_rvec1 * __pyx_v_rvec1)) + (__pyx_v_rvec2 * __pyx_v_rvec2)); + /*else*/ { + __pyx_v_negative_step = 0; - /* "src/helpers/helpers.pyx":860 - * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 + /* "View.MemoryView":827 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * * - * if r2 <= nshells2: # <<<<<<<<<<<<<< - * H_indices[center,i] = int(floor(r2**0.5)) - * f1 = pow(r2,-1.5) */ - __pyx_t_8 = ((__pyx_v_r2 <= __pyx_v_nshells2) != 0); - if (__pyx_t_8) { + __pyx_v_step = 1; + } + __pyx_L6:; - /* "src/helpers/helpers.pyx":861 + /* "View.MemoryView":830 * - * if r2 <= nshells2: - * H_indices[center,i] = int(floor(r2**0.5)) # <<<<<<<<<<<<<< - * f1 = pow(r2,-1.5) - * f2 = 3.0 * f1 / r2 + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ - __pyx_t_9 = __pyx_v_center; - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_H_indices.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_H_indices.shape[1]; - *((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_H_indices.data + __pyx_t_9 * __pyx_v_H_indices.strides[0]) ) + __pyx_t_10 * __pyx_v_H_indices.strides[1]) )) = ((char)floor(pow(__pyx_v_r2, 0.5))); + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":862 - * if r2 <= nshells2: - * H_indices[center,i] = int(floor(r2**0.5)) - * f1 = pow(r2,-1.5) # <<<<<<<<<<<<<< - * f2 = 3.0 * f1 / r2 - * f2_0 = f2 * rvec0 + /* "View.MemoryView":831 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ - __pyx_v_f1 = pow(__pyx_v_r2, -1.5); + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":863 - * H_indices[center,i] = int(floor(r2**0.5)) - * f1 = pow(r2,-1.5) - * f2 = 3.0 * f1 / r2 # <<<<<<<<<<<<<< - * f2_0 = f2 * rvec0 - * f2_1 = f2 * rvec1 + /* "View.MemoryView":832 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 */ - __pyx_t_11 = (3.0 * __pyx_v_f1); - if (unlikely(__pyx_v_r2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 863, __pyx_L8_error) - } - __pyx_v_f2 = (__pyx_t_11 / __pyx_v_r2); + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "src/helpers/helpers.pyx":864 - * f1 = pow(r2,-1.5) - * f2 = 3.0 * f1 / r2 - * f2_0 = f2 * rvec0 # <<<<<<<<<<<<<< - * f2_1 = f2 * rvec1 - * f2_2 = f2 * rvec2 + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: */ - __pyx_v_f2_0 = (__pyx_v_f2 * __pyx_v_rvec0); + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":865 - * f2 = 3.0 * f1 / r2 - * f2_0 = f2 * rvec0 - * f2_1 = f2 * rvec1 # <<<<<<<<<<<<<< - * f2_2 = f2 * rvec2 - * + /* "View.MemoryView":834 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: */ - __pyx_v_f2_1 = (__pyx_v_f2 * __pyx_v_rvec1); + __pyx_v_start = 0; - /* "src/helpers/helpers.pyx":866 - * f2_0 = f2 * rvec0 - * f2_1 = f2 * rvec1 - * f2_2 = f2 * rvec2 # <<<<<<<<<<<<<< - * - * dipT0[center,ctr,0] = (f2_0 * rvec0 - f1) /6 # /6 for averaging the elements in the correlation + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: */ - __pyx_v_f2_2 = (__pyx_v_f2 * __pyx_v_rvec2); + } - /* "src/helpers/helpers.pyx":868 - * f2_2 = f2 * rvec2 + /* "View.MemoryView":831 * - * dipT0[center,ctr,0] = (f2_0 * rvec0 - f1) /6 # /6 for averaging the elements in the correlation # <<<<<<<<<<<<<< - * dipT0[center,ctr,1] = (f2_1 * rvec1 - f1) /6 - * dipT0[center,ctr,2] = (f2_2 * rvec2 - f1) /6 + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ - __pyx_t_10 = __pyx_v_center; - __pyx_t_9 = __pyx_v_ctr; - __pyx_t_12 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_dipT0.diminfo[2].strides) = (((__pyx_v_f2_0 * __pyx_v_rvec0) - __pyx_v_f1) / 6.0); + goto __pyx_L9; + } - /* "src/helpers/helpers.pyx":869 - * - * dipT0[center,ctr,0] = (f2_0 * rvec0 - f1) /6 # /6 for averaging the elements in the correlation - * dipT0[center,ctr,1] = (f2_1 * rvec1 - f1) /6 # <<<<<<<<<<<<<< - * dipT0[center,ctr,2] = (f2_2 * rvec2 - f1) /6 - * dipT0[center,ctr,3] = (f2_0 * rvec1) /3 # *2 because off-diag element are taken twice, when summing over all elements in the correlation + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 */ - __pyx_t_12 = __pyx_v_center; - __pyx_t_9 = __pyx_v_ctr; - __pyx_t_10 = 1; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[2].strides) = (((__pyx_v_f2_1 * __pyx_v_rvec1) - __pyx_v_f1) / 6.0); + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":870 - * dipT0[center,ctr,0] = (f2_0 * rvec0 - f1) /6 # /6 for averaging the elements in the correlation - * dipT0[center,ctr,1] = (f2_1 * rvec1 - f1) /6 - * dipT0[center,ctr,2] = (f2_2 * rvec2 - f1) /6 # <<<<<<<<<<<<<< - * dipT0[center,ctr,3] = (f2_0 * rvec1) /3 # *2 because off-diag element are taken twice, when summing over all elements in the correlation - * dipT0[center,ctr,4] = (f2_0 * rvec2) /3 + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - __pyx_t_10 = __pyx_v_center; - __pyx_t_9 = __pyx_v_ctr; - __pyx_t_12 = 2; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_dipT0.diminfo[2].strides) = (((__pyx_v_f2_2 * __pyx_v_rvec2) - __pyx_v_f1) / 6.0); + if (__pyx_v_negative_step) { - /* "src/helpers/helpers.pyx":871 - * dipT0[center,ctr,1] = (f2_1 * rvec1 - f1) /6 - * dipT0[center,ctr,2] = (f2_2 * rvec2 - f1) /6 - * dipT0[center,ctr,3] = (f2_0 * rvec1) /3 # *2 because off-diag element are taken twice, when summing over all elements in the correlation # <<<<<<<<<<<<<< - * dipT0[center,ctr,4] = (f2_0 * rvec2) /3 - * dipT0[center,ctr,5] = (f2_1 * rvec2) /3 + /* "View.MemoryView":837 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape */ - __pyx_t_12 = __pyx_v_center; - __pyx_t_9 = __pyx_v_ctr; - __pyx_t_10 = 3; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[2].strides) = ((__pyx_v_f2_0 * __pyx_v_rvec1) / 3.0); + __pyx_v_start = (__pyx_v_shape - 1); - /* "src/helpers/helpers.pyx":872 - * dipT0[center,ctr,2] = (f2_2 * rvec2 - f1) /6 - * dipT0[center,ctr,3] = (f2_0 * rvec1) /3 # *2 because off-diag element are taken twice, when summing over all elements in the correlation - * dipT0[center,ctr,4] = (f2_0 * rvec2) /3 # <<<<<<<<<<<<<< - * dipT0[center,ctr,5] = (f2_1 * rvec2) /3 - * + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - __pyx_t_10 = __pyx_v_center; - __pyx_t_9 = __pyx_v_ctr; - __pyx_t_12 = 4; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_dipT0.diminfo[2].strides) = ((__pyx_v_f2_0 * __pyx_v_rvec2) / 3.0); - - /* "src/helpers/helpers.pyx":873 - * dipT0[center,ctr,3] = (f2_0 * rvec1) /3 # *2 because off-diag element are taken twice, when summing over all elements in the correlation - * dipT0[center,ctr,4] = (f2_0 * rvec2) /3 - * dipT0[center,ctr,5] = (f2_1 * rvec2) /3 # <<<<<<<<<<<<<< - * - * ctr = ctr + 1 + goto __pyx_L11; + } + + /* "View.MemoryView":839 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: */ - __pyx_t_12 = __pyx_v_center; - __pyx_t_9 = __pyx_v_ctr; - __pyx_t_10 = 5; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_pybuffernd_dipT0.diminfo[0].shape; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_pybuffernd_dipT0.diminfo[1].shape; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[2].shape; - *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[2].strides) = ((__pyx_v_f2_1 * __pyx_v_rvec2) / 3.0); + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; - /* "src/helpers/helpers.pyx":875 - * dipT0[center,ctr,5] = (f2_1 * rvec2) /3 - * - * ctr = ctr + 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 + */ + } + __pyx_L9:; + + /* "View.MemoryView":830 * * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ - __pyx_v_ctr = (__pyx_v_ctr + 1); + goto __pyx_L8; + } - /* "src/helpers/helpers.pyx":860 - * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: + */ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":842 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 + */ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: + */ + goto __pyx_L12; + } + + /* "View.MemoryView":844 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< * - * if r2 <= nshells2: # <<<<<<<<<<<<<< - * H_indices[center,i] = int(floor(r2**0.5)) - * f1 = pow(r2,-1.5) + * if have_stop: */ - } - } - goto __pyx_L14; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L13; - __pyx_L13:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates1) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_center; - __pyx_parallel_temp1 = __pyx_v_ctr; - __pyx_parallel_temp2 = __pyx_v_f1; - __pyx_parallel_temp3 = __pyx_v_f2; - __pyx_parallel_temp4 = __pyx_v_f2_0; - __pyx_parallel_temp5 = __pyx_v_f2_1; - __pyx_parallel_temp6 = __pyx_v_f2_2; - __pyx_parallel_temp7 = __pyx_v_i; - __pyx_parallel_temp8 = __pyx_v_r2; - __pyx_parallel_temp9 = __pyx_v_rvec0; - __pyx_parallel_temp10 = __pyx_v_rvec1; - __pyx_parallel_temp11 = __pyx_v_rvec2; - } - __pyx_L14:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_center = __pyx_parallel_temp0; - __pyx_v_ctr = __pyx_parallel_temp1; - __pyx_v_f1 = __pyx_parallel_temp2; - __pyx_v_f2 = __pyx_parallel_temp3; - __pyx_v_f2_0 = __pyx_parallel_temp4; - __pyx_v_f2_1 = __pyx_parallel_temp5; - __pyx_v_f2_2 = __pyx_parallel_temp6; - __pyx_v_i = __pyx_parallel_temp7; - __pyx_v_r2 = __pyx_parallel_temp8; - __pyx_v_rvec0 = __pyx_parallel_temp9; - __pyx_v_rvec1 = __pyx_parallel_temp10; - __pyx_v_rvec2 = __pyx_parallel_temp11; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif + /*else*/ { + __pyx_v_start = 0; } + __pyx_L12:; + } + __pyx_L8:; - /* "src/helpers/helpers.pyx":852 - * cdef double *hs = coo_H.data + /* "View.MemoryView":846 + * start = 0 * - * for center in prange(len_center,nogil=True): # <<<<<<<<<<<<<< - * ctr = 0 - * for i in range(len_H): + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } - } + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":838 + /* "View.MemoryView":847 * - * @cython.boundscheck(False) - * def dipTenInit(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, - * char [:,:] H_indices, + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: */ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.helpers.dipTenInit", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer); - __pyx_L2:; - __PYX_XDEC_MEMVIEW(&__pyx_v_H_indices, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":848 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 + */ + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); -/* "src/helpers/helpers.pyx":879 - * - * @cython.boundscheck(False) - * def dipTen(np.ndarray[np.float64_t,ndim=1] rv, # <<<<<<<<<<<<<< - * np.float64_t r2): - * """ + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_47dipTen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_46dipTen[] = "\n dipTen(coo1,coo2) -> returns dip tensor\n Calculates the dipole T-tensor (see Daniel's NMR code).\n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_47dipTen = {"dipTen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_47dipTen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_46dipTen}; -static PyObject *__pyx_pw_11newanalysis_7helpers_47dipTen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_rv = 0; - __pyx_t_5numpy_float64_t __pyx_v_r2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("dipTen (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rv,&__pyx_n_s_r2,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rv)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipTen", 1, 2, 2, 1); __PYX_ERR(0, 879, __pyx_L3_error) + /* "View.MemoryView":850 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape + */ + __pyx_v_stop = 0; + + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: + */ } + + /* "View.MemoryView":847 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: + */ + goto __pyx_L14; } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dipTen") < 0)) __PYX_ERR(0, 879, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_rv = ((PyArrayObject *)values[0]); - __pyx_v_r2 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_r2 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dipTen", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 879, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.dipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rv), __pyx_ptype_5numpy_ndarray, 1, "rv", 0))) __PYX_ERR(0, 879, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_7helpers_46dipTen(__pyx_self, __pyx_v_rv, __pyx_v_r2); - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: + */ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { -static PyObject *__pyx_pf_11newanalysis_7helpers_46dipTen(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_rv, __pyx_t_5numpy_float64_t __pyx_v_r2) { - double *__pyx_v_c_rv; - PyArrayObject *__pyx_v_dipt = 0; - double __pyx_v_f1; - double __pyx_v_f2; - double __pyx_v_f2_0; - double __pyx_v_f2_1; - double __pyx_v_f2_2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_dipt; - __Pyx_Buffer __pyx_pybuffer_dipt; - __Pyx_LocalBuf_ND __pyx_pybuffernd_rv; - __Pyx_Buffer __pyx_pybuffer_rv; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - double __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dipTen", 0); - __pyx_pybuffer_dipt.pybuffer.buf = NULL; - __pyx_pybuffer_dipt.refcount = 0; - __pyx_pybuffernd_dipt.data = NULL; - __pyx_pybuffernd_dipt.rcbuffer = &__pyx_pybuffer_dipt; - __pyx_pybuffer_rv.pybuffer.buf = NULL; - __pyx_pybuffer_rv.refcount = 0; - __pyx_pybuffernd_rv.data = NULL; - __pyx_pybuffernd_rv.rcbuffer = &__pyx_pybuffer_rv; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rv.rcbuffer->pybuffer, (PyObject*)__pyx_v_rv, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 879, __pyx_L1_error) - } - __pyx_pybuffernd_rv.diminfo[0].strides = __pyx_pybuffernd_rv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rv.diminfo[0].shape = __pyx_pybuffernd_rv.rcbuffer->pybuffer.shape[0]; + /* "View.MemoryView":852 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: + */ + __pyx_v_stop = __pyx_v_shape; - /* "src/helpers/helpers.pyx":885 - * Calculates the dipole T-tensor (see Daniel's NMR code). - * """ - * cdef double* c_rv = rv.data # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1] dipt = np.empty(6,dtype=np.float64) - * + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: */ - __pyx_v_c_rv = ((double *)__pyx_v_rv->data); + } + __pyx_L14:; - /* "src/helpers/helpers.pyx":886 - * """ - * cdef double* c_rv = rv.data - * cdef np.ndarray[np.float64_t,ndim=1] dipt = np.empty(6,dtype=np.float64) # <<<<<<<<<<<<<< + /* "View.MemoryView":846 + * start = 0 * - * cdef double f1 = pow(r2,-1.5) + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 886, __pyx_L1_error) - __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dipt.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_dipt = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 886, __pyx_L1_error) - } else {__pyx_pybuffernd_dipt.diminfo[0].strides = __pyx_pybuffernd_dipt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dipt.diminfo[0].shape = __pyx_pybuffernd_dipt.rcbuffer->pybuffer.shape[0]; + goto __pyx_L13; } - } - __pyx_t_5 = 0; - __pyx_v_dipt = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":888 - * cdef np.ndarray[np.float64_t,ndim=1] dipt = np.empty(6,dtype=np.float64) + /* "View.MemoryView":854 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: + */ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":855 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape + */ + __pyx_v_stop = -1L; + + /* "View.MemoryView":854 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: + */ + goto __pyx_L16; + } + + /* "View.MemoryView":857 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * * - * cdef double f1 = pow(r2,-1.5) # <<<<<<<<<<<<<< - * cdef double f2 = 3.0 * f1 / r2 - * cdef double f2_0 = f2 * c_rv[0] */ - __pyx_v_f1 = pow(__pyx_v_r2, -1.5); + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; - /* "src/helpers/helpers.pyx":889 + /* "View.MemoryView":861 * - * cdef double f1 = pow(r2,-1.5) - * cdef double f2 = 3.0 * f1 / r2 # <<<<<<<<<<<<<< - * cdef double f2_0 = f2 * c_rv[0] - * cdef double f2_1 = f2 * c_rv[1] + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: */ - __pyx_t_6 = (3.0 * __pyx_v_f1); - if (unlikely(__pyx_v_r2 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 889, __pyx_L1_error) - } - __pyx_v_f2 = (__pyx_t_6 / __pyx_v_r2); + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - /* "src/helpers/helpers.pyx":890 - * cdef double f1 = pow(r2,-1.5) - * cdef double f2 = 3.0 * f1 / r2 - * cdef double f2_0 = f2 * c_rv[0] # <<<<<<<<<<<<<< - * cdef double f2_1 = f2 * c_rv[1] - * cdef double f2_2 = f2 * c_rv[2] + /* "View.MemoryView":863 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * */ - __pyx_v_f2_0 = (__pyx_v_f2 * (__pyx_v_c_rv[0])); + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":891 - * cdef double f2 = 3.0 * f1 / r2 - * cdef double f2_0 = f2 * c_rv[0] - * cdef double f2_1 = f2 * c_rv[1] # <<<<<<<<<<<<<< - * cdef double f2_2 = f2 * c_rv[2] + /* "View.MemoryView":864 + * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< * + * if new_shape < 0: */ - __pyx_v_f2_1 = (__pyx_v_f2 * (__pyx_v_c_rv[1])); + __pyx_v_new_shape = (__pyx_v_new_shape + 1); - /* "src/helpers/helpers.pyx":892 - * cdef double f2_0 = f2 * c_rv[0] - * cdef double f2_1 = f2 * c_rv[1] - * cdef double f2_2 = f2 * c_rv[2] # <<<<<<<<<<<<<< + /* "View.MemoryView":863 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 * - * dipt[0] = f2_0 * c_rv[0] - f1 */ - __pyx_v_f2_2 = (__pyx_v_f2 * (__pyx_v_c_rv[2])); + } - /* "src/helpers/helpers.pyx":894 - * cdef double f2_2 = f2 * c_rv[2] + /* "View.MemoryView":866 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 * - * dipt[0] = f2_0 * c_rv[0] - f1 # <<<<<<<<<<<<<< - * dipt[1] = f2_1 * c_rv[1] - f1 - * dipt[2] = f2_2 * c_rv[2] - f1 */ - __pyx_t_7 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_dipt.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dipt.diminfo[0].strides) = ((__pyx_v_f2_0 * (__pyx_v_c_rv[0])) - __pyx_v_f1); + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":895 + /* "View.MemoryView":867 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * * - * dipt[0] = f2_0 * c_rv[0] - f1 - * dipt[1] = f2_1 * c_rv[1] - f1 # <<<<<<<<<<<<<< - * dipt[2] = f2_2 * c_rv[2] - f1 - * dipt[3] = f2_0 * c_rv[1] */ - __pyx_t_7 = 1; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_dipt.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dipt.diminfo[0].strides) = ((__pyx_v_f2_1 * (__pyx_v_c_rv[1])) - __pyx_v_f1); + __pyx_v_new_shape = 0; - /* "src/helpers/helpers.pyx":896 - * dipt[0] = f2_0 * c_rv[0] - f1 - * dipt[1] = f2_1 * c_rv[1] - f1 - * dipt[2] = f2_2 * c_rv[2] - f1 # <<<<<<<<<<<<<< - * dipt[3] = f2_0 * c_rv[1] - * dipt[4] = f2_0 * c_rv[2] + /* "View.MemoryView":866 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 + * */ - __pyx_t_7 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_dipt.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dipt.diminfo[0].strides) = ((__pyx_v_f2_2 * (__pyx_v_c_rv[2])) - __pyx_v_f1); + } - /* "src/helpers/helpers.pyx":897 - * dipt[1] = f2_1 * c_rv[1] - f1 - * dipt[2] = f2_2 * c_rv[2] - f1 - * dipt[3] = f2_0 * c_rv[1] # <<<<<<<<<<<<<< - * dipt[4] = f2_0 * c_rv[2] - * dipt[5] = f2_1 * c_rv[2] + /* "View.MemoryView":870 + * + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset */ - __pyx_t_7 = 3; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_dipt.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dipt.diminfo[0].strides) = (__pyx_v_f2_0 * (__pyx_v_c_rv[1])); + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - /* "src/helpers/helpers.pyx":898 - * dipt[2] = f2_2 * c_rv[2] - f1 - * dipt[3] = f2_0 * c_rv[1] - * dipt[4] = f2_0 * c_rv[2] # <<<<<<<<<<<<<< - * dipt[5] = f2_1 * c_rv[2] + /* "View.MemoryView":871 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset * */ - __pyx_t_7 = 4; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_dipt.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dipt.diminfo[0].strides) = (__pyx_v_f2_0 * (__pyx_v_c_rv[2])); + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - /* "src/helpers/helpers.pyx":899 - * dipt[3] = f2_0 * c_rv[1] - * dipt[4] = f2_0 * c_rv[2] - * dipt[5] = f2_1 * c_rv[2] # <<<<<<<<<<<<<< + /* "View.MemoryView":872 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * * - * return dipt */ - __pyx_t_7 = 5; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_dipt.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dipt.diminfo[0].strides) = (__pyx_v_f2_1 * (__pyx_v_c_rv[2])); + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; - /* "src/helpers/helpers.pyx":901 - * dipt[5] = f2_1 * c_rv[2] + /* "View.MemoryView":875 * - * return dipt # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_dipt)); - __pyx_r = ((PyObject *)__pyx_v_dipt); - goto __pyx_L0; + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":879 + /* "View.MemoryView":876 * - * @cython.boundscheck(False) - * def dipTen(np.ndarray[np.float64_t,ndim=1] rv, # <<<<<<<<<<<<<< - * np.float64_t r2): - * """ + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride */ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rv.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.helpers.dipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rv.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_dipt); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/helpers.pyx":904 + /* "View.MemoryView":875 * - * @cython.boundscheck(False) - * def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): # <<<<<<<<<<<<<< * - * cdef int nwat = len(py_xyz)/3 # number of water molecules + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ + goto __pyx_L19; + } -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_49NQRself(PyObject *__pyx_self, PyObject *__pyx_v_py_xyz); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_49NQRself = {"NQRself", (PyCFunction)__pyx_pw_11newanalysis_7helpers_49NQRself, METH_O, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_49NQRself(PyObject *__pyx_self, PyObject *__pyx_v_py_xyz) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("NQRself (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_xyz), __pyx_ptype_5numpy_ndarray, 1, "py_xyz", 0))) __PYX_ERR(0, 904, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_7helpers_48NQRself(__pyx_self, ((PyArrayObject *)__pyx_v_py_xyz)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_7helpers_48NQRself(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_py_xyz) { - int __pyx_v_nwat; - double *__pyx_v_xyz; - double __pyx_v_H1x; - double __pyx_v_H1y; - double __pyx_v_H1z; - double __pyx_v_H2x; - double __pyx_v_H2y; - double __pyx_v_H2z; - double __pyx_v_n2; - double __pyx_v_n3; - double __pyx_v_Exx; - double __pyx_v_Eyy; - double __pyx_v_Ezz; - int __pyx_v_i; - int __pyx_v_k; - int __pyx_v_ind; - PyArrayObject *__pyx_v_py_dipt = 0; - double *__pyx_v_dipt; - double *__pyx_v_B; - double *__pyx_v_T; - __Pyx_LocalBuf_ND __pyx_pybuffernd_py_dipt; - __Pyx_Buffer __pyx_pybuffer_py_dipt; - __Pyx_LocalBuf_ND __pyx_pybuffernd_py_xyz; - __Pyx_Buffer __pyx_pybuffer_py_xyz; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - long __pyx_t_8; - long __pyx_t_9; - long __pyx_t_10; - int __pyx_t_11; - long __pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("NQRself", 0); - __pyx_pybuffer_py_dipt.pybuffer.buf = NULL; - __pyx_pybuffer_py_dipt.refcount = 0; - __pyx_pybuffernd_py_dipt.data = NULL; - __pyx_pybuffernd_py_dipt.rcbuffer = &__pyx_pybuffer_py_dipt; - __pyx_pybuffer_py_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_py_xyz.refcount = 0; - __pyx_pybuffernd_py_xyz.data = NULL; - __pyx_pybuffernd_py_xyz.rcbuffer = &__pyx_pybuffer_py_xyz; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_py_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 904, __pyx_L1_error) + /* "View.MemoryView":878 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: + */ + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); } - __pyx_pybuffernd_py_xyz.diminfo[0].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_xyz.diminfo[0].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_py_xyz.diminfo[1].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_py_xyz.diminfo[1].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[1]; + __pyx_L19:; - /* "src/helpers/helpers.pyx":906 - * def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride * - * cdef int nwat = len(py_xyz)/3 # number of water molecules # <<<<<<<<<<<<<< - * cdef double *xyz = py_xyz.data - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_py_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 906, __pyx_L1_error) - __pyx_v_nwat = __Pyx_div_Py_ssize_t(__pyx_t_1, 3); + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":907 + /* "View.MemoryView":881 * - * cdef int nwat = len(py_xyz)/3 # number of water molecules - * cdef double *xyz = py_xyz.data # <<<<<<<<<<<<<< - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 - * cdef double Exx = -2.3067236 # -2.0486*1.126 + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ - __pyx_v_xyz = ((double *)__pyx_v_py_xyz->data); + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":909 - * cdef double *xyz = py_xyz.data - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 - * cdef double Exx = -2.3067236 # -2.0486*1.126 # <<<<<<<<<<<<<< - * cdef double Eyy = 2.0364836 # 1.8086*1.126 - * cdef double Ezz = 0.27024 # 0.2400*1.126 + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: */ - __pyx_v_Exx = -2.3067236; + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":910 - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 - * cdef double Exx = -2.3067236 # -2.0486*1.126 - * cdef double Eyy = 2.0364836 # 1.8086*1.126 # <<<<<<<<<<<<<< - * cdef double Ezz = 0.27024 # 0.2400*1.126 - * cdef int i, k, ind + /* "View.MemoryView":883 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " */ - __pyx_v_Eyy = 2.0364836; + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); - /* "src/helpers/helpers.pyx":911 - * cdef double Exx = -2.3067236 # -2.0486*1.126 - * cdef double Eyy = 2.0364836 # 1.8086*1.126 - * cdef double Ezz = 0.27024 # 0.2400*1.126 # <<<<<<<<<<<<<< - * cdef int i, k, ind - * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: */ - __pyx_v_Ezz = 0.27024; + goto __pyx_L22; + } - /* "src/helpers/helpers.pyx":913 - * cdef double Ezz = 0.27024 # 0.2400*1.126 - * cdef int i, k, ind - * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *dipt = py_dipt.data + /* "View.MemoryView":885 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: + */ + /*else*/ { + + /* "View.MemoryView":886 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim + */ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 885, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":881 * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 913, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_nwat * 6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 913, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 913, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 913, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 913, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 913, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_py_dipt = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 913, __pyx_L1_error) - } else {__pyx_pybuffernd_py_dipt.diminfo[0].strides = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_dipt.diminfo[0].shape = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.shape[0]; + goto __pyx_L21; } - } - __pyx_t_7 = 0; - __pyx_v_py_dipt = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - /* "src/helpers/helpers.pyx":914 - * cdef int i, k, ind - * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) - * cdef double *dipt = py_dipt.data # <<<<<<<<<<<<<< + /* "View.MemoryView":888 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< * - * with nogil, parallel(): + * return 0 */ - __pyx_v_dipt = ((double *)__pyx_v_py_dipt->data); + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; - /* "src/helpers/helpers.pyx":916 - * cdef double *dipt = py_dipt.data + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride * - * with nogil, parallel(): # <<<<<<<<<<<<<< - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - { - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - #ifdef _OPENMP - #pragma omp parallel private(__pyx_v_B, __pyx_v_T) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - /* Initialize private variables to invalid values */ - __pyx_v_B = ((double *)1); - __pyx_v_T = ((double *)1); + } - /* "src/helpers/helpers.pyx":917 + /* "View.MemoryView":890 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * * - * with nogil, parallel(): - * B = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< - * T = malloc(sizeof(double) * 9) - * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules */ - __pyx_v_B = ((double *)malloc(((sizeof(double)) * 9))); + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":918 - * with nogil, parallel(): - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< - * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules - * for k in range(9): + /* "View.MemoryView":793 + * + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ - __pyx_v_T = ((double *)malloc(((sizeof(double)) * 9))); - /* "src/helpers/helpers.pyx":919 - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) - * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules # <<<<<<<<<<<<<< - * for k in range(9): - * B[k] = 0.0 + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} + +/* "View.MemoryView":896 + * + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ - __pyx_t_8 = (__pyx_v_nwat * 9); - if ((9 == 0)) abort(); - { - double __pyx_parallel_temp0 = ((double)__PYX_NAN()); - double __pyx_parallel_temp1 = ((double)__PYX_NAN()); - double __pyx_parallel_temp2 = ((double)__PYX_NAN()); - double __pyx_parallel_temp3 = ((double)__PYX_NAN()); - double __pyx_parallel_temp4 = ((double)__PYX_NAN()); - double __pyx_parallel_temp5 = ((double)__PYX_NAN()); - int __pyx_parallel_temp6 = ((int)0xbad0bad0); - int __pyx_parallel_temp7 = ((int)0xbad0bad0); - int __pyx_parallel_temp8 = ((int)0xbad0bad0); - double __pyx_parallel_temp9 = ((double)__PYX_NAN()); - double __pyx_parallel_temp10 = ((double)__PYX_NAN()); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - __pyx_t_10 = (__pyx_t_8 - 0 + 9 - 9/abs(9)) / 9; - if (__pyx_t_10 > 0) - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_H1x) lastprivate(__pyx_v_H1y) lastprivate(__pyx_v_H1z) lastprivate(__pyx_v_H2x) lastprivate(__pyx_v_H2y) lastprivate(__pyx_v_H2z) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ind) lastprivate(__pyx_v_k) lastprivate(__pyx_v_n2) lastprivate(__pyx_v_n3) - #endif /* _OPENMP */ - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_i = (int)(0 + 9 * __pyx_t_9); - /* Initialize private variables to invalid values */ - __pyx_v_H1x = ((double)__PYX_NAN()); - __pyx_v_H1y = ((double)__PYX_NAN()); - __pyx_v_H1z = ((double)__PYX_NAN()); - __pyx_v_H2x = ((double)__PYX_NAN()); - __pyx_v_H2y = ((double)__PYX_NAN()); - __pyx_v_H2z = ((double)__PYX_NAN()); - __pyx_v_ind = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); - __pyx_v_n2 = ((double)__PYX_NAN()); - __pyx_v_n3 = ((double)__PYX_NAN()); - /* "src/helpers/helpers.pyx":920 - * T = malloc(sizeof(double) * 9) - * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules - * for k in range(9): # <<<<<<<<<<<<<< - * B[k] = 0.0 - * T[k] = 0.0 +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_UCS4 __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pybuffer_index", 0); + + /* "View.MemoryView":898 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp */ - for (__pyx_t_11 = 0; __pyx_t_11 < 9; __pyx_t_11+=1) { - __pyx_v_k = __pyx_t_11; + __pyx_v_suboffset = -1L; - /* "src/helpers/helpers.pyx":921 - * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules - * for k in range(9): - * B[k] = 0.0 # <<<<<<<<<<<<<< - * T[k] = 0.0 + /* "View.MemoryView":899 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp * */ - (__pyx_v_B[__pyx_v_k]) = 0.0; + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "src/helpers/helpers.pyx":922 - * for k in range(9): - * B[k] = 0.0 - * T[k] = 0.0 # <<<<<<<<<<<<<< + /* "View.MemoryView":902 + * cdef char *resultp * - * H1x = xyz[i+3]-xyz[i] + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize */ - (__pyx_v_T[__pyx_v_k]) = 0.0; - } + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":924 - * T[k] = 0.0 + /* "View.MemoryView":903 * - * H1x = xyz[i+3]-xyz[i] # <<<<<<<<<<<<<< - * H1y = xyz[i+4]-xyz[i+1] - * H1z = xyz[i+5]-xyz[i+2] + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: */ - __pyx_v_H1x = ((__pyx_v_xyz[(__pyx_v_i + 3)]) - (__pyx_v_xyz[__pyx_v_i])); + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 903, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 903, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); + + /* "View.MemoryView":904 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] + */ + __pyx_v_stride = __pyx_v_itemsize; - /* "src/helpers/helpers.pyx":925 + /* "View.MemoryView":902 + * cdef char *resultp * - * H1x = xyz[i+3]-xyz[i] - * H1y = xyz[i+4]-xyz[i+1] # <<<<<<<<<<<<<< - * H1z = xyz[i+5]-xyz[i+2] - * H2x = xyz[i+6]-xyz[i] + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize */ - __pyx_v_H1y = ((__pyx_v_xyz[(__pyx_v_i + 4)]) - (__pyx_v_xyz[(__pyx_v_i + 1)])); + goto __pyx_L3; + } - /* "src/helpers/helpers.pyx":926 - * H1x = xyz[i+3]-xyz[i] - * H1y = xyz[i+4]-xyz[i+1] - * H1z = xyz[i+5]-xyz[i+2] # <<<<<<<<<<<<<< - * H2x = xyz[i+6]-xyz[i] - * H2y = xyz[i+7]-xyz[i+1] + /* "View.MemoryView":906 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: */ - __pyx_v_H1z = ((__pyx_v_xyz[(__pyx_v_i + 5)]) - (__pyx_v_xyz[(__pyx_v_i + 2)])); + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - /* "src/helpers/helpers.pyx":927 - * H1y = xyz[i+4]-xyz[i+1] - * H1z = xyz[i+5]-xyz[i+2] - * H2x = xyz[i+6]-xyz[i] # <<<<<<<<<<<<<< - * H2y = xyz[i+7]-xyz[i+1] - * H2z = xyz[i+8]-xyz[i+2] + /* "View.MemoryView":907 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] */ - __pyx_v_H2x = ((__pyx_v_xyz[(__pyx_v_i + 6)]) - (__pyx_v_xyz[__pyx_v_i])); + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - /* "src/helpers/helpers.pyx":928 - * H1z = xyz[i+5]-xyz[i+2] - * H2x = xyz[i+6]-xyz[i] - * H2y = xyz[i+7]-xyz[i+1] # <<<<<<<<<<<<<< - * H2z = xyz[i+8]-xyz[i+2] + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] * */ - __pyx_v_H2y = ((__pyx_v_xyz[(__pyx_v_i + 7)]) - (__pyx_v_xyz[(__pyx_v_i + 1)])); + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":929 - * H2x = xyz[i+6]-xyz[i] - * H2y = xyz[i+7]-xyz[i+1] - * H2z = xyz[i+8]-xyz[i+2] # <<<<<<<<<<<<<< + /* "View.MemoryView":909 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< * - * B[3] = (H1x-H2x) + * if index < 0: */ - __pyx_v_H2z = ((__pyx_v_xyz[(__pyx_v_i + 8)]) - (__pyx_v_xyz[(__pyx_v_i + 2)])); + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); - /* "src/helpers/helpers.pyx":931 - * H2z = xyz[i+8]-xyz[i+2] + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] * - * B[3] = (H1x-H2x) # <<<<<<<<<<<<<< - * B[4] = (H1y-H2y) - * B[5] = (H1z-H2z) */ - (__pyx_v_B[3]) = (__pyx_v_H1x - __pyx_v_H2x); + } + } + __pyx_L3:; - /* "src/helpers/helpers.pyx":932 + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] * - * B[3] = (H1x-H2x) - * B[4] = (H1y-H2y) # <<<<<<<<<<<<<< - * B[5] = (H1z-H2z) - * B[6] = (H1x+H2x) + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ - (__pyx_v_B[4]) = (__pyx_v_H1y - __pyx_v_H2y); + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":933 - * B[3] = (H1x-H2x) - * B[4] = (H1y-H2y) - * B[5] = (H1z-H2z) # <<<<<<<<<<<<<< - * B[6] = (H1x+H2x) - * B[7] = (H1y+H2y) + /* "View.MemoryView":912 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" */ - (__pyx_v_B[5]) = (__pyx_v_H1z - __pyx_v_H2z); + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); - /* "src/helpers/helpers.pyx":934 - * B[4] = (H1y-H2y) - * B[5] = (H1z-H2z) - * B[6] = (H1x+H2x) # <<<<<<<<<<<<<< - * B[7] = (H1y+H2y) - * B[8] = (H1z+H2z) + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * */ - (__pyx_v_B[6]) = (__pyx_v_H1x + __pyx_v_H2x); + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/helpers.pyx":935 - * B[5] = (H1z-H2z) - * B[6] = (H1x+H2x) - * B[7] = (H1y+H2y) # <<<<<<<<<<<<<< - * B[8] = (H1z+H2z) + /* "View.MemoryView":914 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< * + * if index >= shape: */ - (__pyx_v_B[7]) = (__pyx_v_H1y + __pyx_v_H2y); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__7); + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 914, __pyx_L1_error) - /* "src/helpers/helpers.pyx":936 - * B[6] = (H1x+H2x) - * B[7] = (H1y+H2y) - * B[8] = (H1z+H2z) # <<<<<<<<<<<<<< + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 */ - (__pyx_v_B[8]) = (__pyx_v_H1z + __pyx_v_H2z); + } - /* "src/helpers/helpers.pyx":938 - * B[8] = (H1z+H2z) - * - * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 # <<<<<<<<<<<<<< - * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ - __pyx_v_n2 = pow(((((__pyx_v_B[3]) * (__pyx_v_B[3])) + ((__pyx_v_B[4]) * (__pyx_v_B[4]))) + ((__pyx_v_B[5]) * (__pyx_v_B[5]))), .5); + } - /* "src/helpers/helpers.pyx":939 + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 - * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 # <<<<<<<<<<<<<< + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * B[3] /= n2 */ - __pyx_v_n3 = pow(((((__pyx_v_B[6]) * (__pyx_v_B[6])) + ((__pyx_v_B[7]) * (__pyx_v_B[7]))) + ((__pyx_v_B[8]) * (__pyx_v_B[8]))), .5); + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/helpers.pyx":941 - * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 + /* "View.MemoryView":917 * - * B[3] /= n2 # <<<<<<<<<<<<<< - * B[4] /= n2 - * B[5] /= n2 - */ - __pyx_t_12 = 3; - if (unlikely(__pyx_v_n2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 941, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_12]) = ((__pyx_v_B[__pyx_t_12]) / __pyx_v_n2); - - /* "src/helpers/helpers.pyx":942 + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< * - * B[3] /= n2 - * B[4] /= n2 # <<<<<<<<<<<<<< - * B[5] /= n2 - * B[6] /= n3 + * resultp = bufp + index * stride */ - __pyx_t_12 = 4; - if (unlikely(__pyx_v_n2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 942, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_12]) = ((__pyx_v_B[__pyx_t_12]) / __pyx_v_n2); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__7); + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 917, __pyx_L1_error) - /* "src/helpers/helpers.pyx":943 - * B[3] /= n2 - * B[4] /= n2 - * B[5] /= n2 # <<<<<<<<<<<<<< - * B[6] /= n3 - * B[7] /= n3 + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * */ - __pyx_t_12 = 5; - if (unlikely(__pyx_v_n2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 943, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_12]) = ((__pyx_v_B[__pyx_t_12]) / __pyx_v_n2); + } - /* "src/helpers/helpers.pyx":944 - * B[4] /= n2 - * B[5] /= n2 - * B[6] /= n3 # <<<<<<<<<<<<<< - * B[7] /= n3 - * B[8] /= n3 + /* "View.MemoryView":919 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset */ - __pyx_t_12 = 6; - if (unlikely(__pyx_v_n3 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 944, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_12]) = ((__pyx_v_B[__pyx_t_12]) / __pyx_v_n3); + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - /* "src/helpers/helpers.pyx":945 - * B[5] /= n2 - * B[6] /= n3 - * B[7] /= n3 # <<<<<<<<<<<<<< - * B[8] /= n3 + /* "View.MemoryView":920 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset * */ - __pyx_t_12 = 7; - if (unlikely(__pyx_v_n3 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 945, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_12]) = ((__pyx_v_B[__pyx_t_12]) / __pyx_v_n3); + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":946 - * B[6] /= n3 - * B[7] /= n3 - * B[8] /= n3 # <<<<<<<<<<<<<< + /* "View.MemoryView":921 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< * - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + * return resultp */ - __pyx_t_12 = 8; - if (unlikely(__pyx_v_n3 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 946, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_12]) = ((__pyx_v_B[__pyx_t_12]) / __pyx_v_n3); + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); - /* "src/helpers/helpers.pyx":948 - * B[8] /= n3 + /* "View.MemoryView":920 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset * - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product # <<<<<<<<<<<<<< - * B[1] = B[5]*B[6]-B[3]*B[8] - * B[2] = B[3]*B[7]-B[4]*B[6] */ - (__pyx_v_B[0]) = (((__pyx_v_B[4]) * (__pyx_v_B[8])) - ((__pyx_v_B[5]) * (__pyx_v_B[7]))); + } - /* "src/helpers/helpers.pyx":949 + /* "View.MemoryView":923 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< * - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product - * B[1] = B[5]*B[6]-B[3]*B[8] # <<<<<<<<<<<<<< - * B[2] = B[3]*B[7]-B[4]*B[6] * */ - (__pyx_v_B[1]) = (((__pyx_v_B[5]) * (__pyx_v_B[6])) - ((__pyx_v_B[3]) * (__pyx_v_B[8]))); + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":950 - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product - * B[1] = B[5]*B[6]-B[3]*B[8] - * B[2] = B[3]*B[7]-B[4]*B[6] # <<<<<<<<<<<<<< + /* "View.MemoryView":896 * - * # B dot T + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ - (__pyx_v_B[2]) = (((__pyx_v_B[3]) * (__pyx_v_B[7])) - ((__pyx_v_B[4]) * (__pyx_v_B[6]))); - /* "src/helpers/helpers.pyx":953 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim * - * # B dot T - * T[0] = B[0]*Exx # <<<<<<<<<<<<<< - * T[1] = B[1]*Exx - * T[2] = B[2]*Exx */ - (__pyx_v_T[0]) = ((__pyx_v_B[0]) * __pyx_v_Exx); - /* "src/helpers/helpers.pyx":954 - * # B dot T - * T[0] = B[0]*Exx - * T[1] = B[1]*Exx # <<<<<<<<<<<<<< - * T[2] = B[2]*Exx - * T[3] = B[3]*Eyy - */ - (__pyx_v_T[1]) = ((__pyx_v_B[1]) * __pyx_v_Exx); +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("transpose_memslice", 1); - /* "src/helpers/helpers.pyx":955 - * T[0] = B[0]*Exx - * T[1] = B[1]*Exx - * T[2] = B[2]*Exx # <<<<<<<<<<<<<< - * T[3] = B[3]*Eyy - * T[4] = B[4]*Eyy + /* "View.MemoryView":930 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t *shape = memslice.shape */ - (__pyx_v_T[2]) = ((__pyx_v_B[2]) * __pyx_v_Exx); + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; - /* "src/helpers/helpers.pyx":956 - * T[1] = B[1]*Exx - * T[2] = B[2]*Exx - * T[3] = B[3]*Eyy # <<<<<<<<<<<<<< - * T[4] = B[4]*Eyy - * T[5] = B[5]*Eyy + /* "View.MemoryView":932 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides + * */ - (__pyx_v_T[3]) = ((__pyx_v_B[3]) * __pyx_v_Eyy); + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; - /* "src/helpers/helpers.pyx":957 - * T[2] = B[2]*Exx - * T[3] = B[3]*Eyy - * T[4] = B[4]*Eyy # <<<<<<<<<<<<<< - * T[5] = B[5]*Eyy - * T[6] = B[6]*Ezz + /* "View.MemoryView":933 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * */ - (__pyx_v_T[4]) = ((__pyx_v_B[4]) * __pyx_v_Eyy); + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; - /* "src/helpers/helpers.pyx":958 - * T[3] = B[3]*Eyy - * T[4] = B[4]*Eyy - * T[5] = B[5]*Eyy # <<<<<<<<<<<<<< - * T[6] = B[6]*Ezz - * T[7] = B[7]*Ezz + /* "View.MemoryView":937 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] */ - (__pyx_v_T[5]) = ((__pyx_v_B[5]) * __pyx_v_Eyy); + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; - /* "src/helpers/helpers.pyx":959 - * T[4] = B[4]*Eyy - * T[5] = B[5]*Eyy - * T[6] = B[6]*Ezz # <<<<<<<<<<<<<< - * T[7] = B[7]*Ezz - * T[8] = B[8]*Ezz + /* "View.MemoryView":938 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] */ - (__pyx_v_T[6]) = ((__pyx_v_B[6]) * __pyx_v_Ezz); + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); - /* "src/helpers/helpers.pyx":960 - * T[5] = B[5]*Eyy - * T[6] = B[6]*Ezz - * T[7] = B[7]*Ezz # <<<<<<<<<<<<<< - * T[8] = B[8]*Ezz + /* "View.MemoryView":939 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] * */ - (__pyx_v_T[7]) = ((__pyx_v_B[7]) * __pyx_v_Ezz); + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; - /* "src/helpers/helpers.pyx":961 - * T[6] = B[6]*Ezz - * T[7] = B[7]*Ezz - * T[8] = B[8]*Ezz # <<<<<<<<<<<<<< + /* "View.MemoryView":940 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< * - * ind = (i/9)*6 + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: */ - (__pyx_v_T[8]) = ((__pyx_v_B[8]) * __pyx_v_Ezz); + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; - /* "src/helpers/helpers.pyx":963 - * T[8] = B[8]*Ezz + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] * - * ind = (i/9)*6 # <<<<<<<<<<<<<< + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") * - * # (B dot T) dot B.T */ - __pyx_v_ind = (__Pyx_div_long(__pyx_v_i, 9) * 6); + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { - /* "src/helpers/helpers.pyx":966 + /* "View.MemoryView":943 * - * # (B dot T) dot B.T - * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B # <<<<<<<<<<<<<< - * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 - * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 - */ - (__pyx_v_dipt[__pyx_v_ind]) = ((((__pyx_v_T[0]) * (__pyx_v_B[0])) + ((__pyx_v_T[3]) * (__pyx_v_B[3]))) + ((__pyx_v_T[6]) * (__pyx_v_B[6]))); - - /* "src/helpers/helpers.pyx":967 - * # (B dot T) dot B.T - * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B - * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 # <<<<<<<<<<<<<< - * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 - * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 */ - (__pyx_v_dipt[(__pyx_v_ind + 1)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[1])) + ((__pyx_v_T[4]) * (__pyx_v_B[4]))) + ((__pyx_v_T[7]) * (__pyx_v_B[7]))); + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_kp_s_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L1_error) - /* "src/helpers/helpers.pyx":968 - * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B - * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 - * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 # <<<<<<<<<<<<<< - * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 - * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * */ - (__pyx_v_dipt[(__pyx_v_ind + 2)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[2])) + ((__pyx_v_T[5]) * (__pyx_v_B[5]))) + ((__pyx_v_T[8]) * (__pyx_v_B[8]))); + } + } - /* "src/helpers/helpers.pyx":969 - * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 - * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 - * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 # <<<<<<<<<<<<<< - * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 - * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric + /* "View.MemoryView":945 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * */ - (__pyx_v_dipt[(__pyx_v_ind + 3)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[0])) + ((__pyx_v_T[4]) * (__pyx_v_B[3]))) + ((__pyx_v_T[7]) * (__pyx_v_B[6]))); + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":970 - * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 - * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 - * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 # <<<<<<<<<<<<<< - * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric + /* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim * */ - (__pyx_v_dipt[(__pyx_v_ind + 4)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[0])) + ((__pyx_v_T[5]) * (__pyx_v_B[3]))) + ((__pyx_v_T[8]) * (__pyx_v_B[6]))); - /* "src/helpers/helpers.pyx":971 - * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 - * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 - * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} + +/* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * free(B) */ - (__pyx_v_dipt[(__pyx_v_ind + 5)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[1])) + ((__pyx_v_T[5]) * (__pyx_v_B[4]))) + ((__pyx_v_T[8]) * (__pyx_v_B[7]))); - goto __pyx_L17; - __pyx_L12_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L16; - __pyx_L16:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates2) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_H1x; - __pyx_parallel_temp1 = __pyx_v_H1y; - __pyx_parallel_temp2 = __pyx_v_H1z; - __pyx_parallel_temp3 = __pyx_v_H2x; - __pyx_parallel_temp4 = __pyx_v_H2y; - __pyx_parallel_temp5 = __pyx_v_H2z; - __pyx_parallel_temp6 = __pyx_v_i; - __pyx_parallel_temp7 = __pyx_v_ind; - __pyx_parallel_temp8 = __pyx_v_k; - __pyx_parallel_temp9 = __pyx_v_n2; - __pyx_parallel_temp10 = __pyx_v_n3; - } - __pyx_L17:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_H1x = __pyx_parallel_temp0; - __pyx_v_H1y = __pyx_parallel_temp1; - __pyx_v_H1z = __pyx_parallel_temp2; - __pyx_v_H2x = __pyx_parallel_temp3; - __pyx_v_H2y = __pyx_parallel_temp4; - __pyx_v_H2z = __pyx_parallel_temp5; - __pyx_v_i = __pyx_parallel_temp6; - __pyx_v_ind = __pyx_parallel_temp7; - __pyx_v_k = __pyx_parallel_temp8; - __pyx_v_n2 = __pyx_parallel_temp9; - __pyx_v_n3 = __pyx_parallel_temp10; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L8_error; - } - } - } - /* "src/helpers/helpers.pyx":973 - * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "View.MemoryView":964 * - * free(B) # <<<<<<<<<<<<<< - * free(T) + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< * + * cdef convert_item_to_object(self, char *itemp): */ - free(__pyx_v_B); + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); - /* "src/helpers/helpers.pyx":974 + /* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * free(B) - * free(T) # <<<<<<<<<<<<<< + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * return py_dipt */ - free(__pyx_v_T); - goto __pyx_L19; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L19; - __pyx_L19:; - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP + + /* function exit code */ + __Pyx_RefNannyFinishContext(); } -#endif /* _OPENMP */ - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/helpers/helpers.pyx":916 - * cdef double *dipt = py_dipt.data +/* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * with nogil, parallel(): # <<<<<<<<<<<<<< - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } - } - /* "src/helpers/helpers.pyx":976 - * free(T) +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":967 * - * return py_dipt # <<<<<<<<<<<<<< + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: + */ + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":968 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 968, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":967 * - * @cython.boundscheck(False) + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_py_dipt)); - __pyx_r = ((PyObject *)__pyx_v_py_dipt); - goto __pyx_L0; + } - /* "src/helpers/helpers.pyx":904 + /* "View.MemoryView":970 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): # <<<<<<<<<<<<<< + * cdef assign_item_from_object(self, char *itemp, object value): + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 970, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * cdef int nwat = len(py_xyz)/3 # number of water molecules + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.helpers.NQRself", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_dipt); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":979 +/* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) * - * @cython.boundscheck(False) - * def waterRotationMatrix(double [:,:] coor): # <<<<<<<<<<<<<< - * cdef int nwat = len(coor)/3 # number of water molecules - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_51waterRotationMatrix(PyObject *__pyx_self, PyObject *__pyx_arg_coor); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_51waterRotationMatrix = {"waterRotationMatrix", (PyCFunction)__pyx_pw_11newanalysis_7helpers_51waterRotationMatrix, METH_O, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_51waterRotationMatrix(PyObject *__pyx_self, PyObject *__pyx_arg_coor) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("waterRotationMatrix (wrapper)", 0); - assert(__pyx_arg_coor); { - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_arg_coor, PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 979, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.waterRotationMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_50waterRotationMatrix(__pyx_self, __pyx_v_coor); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_7helpers_50waterRotationMatrix(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor) { - int __pyx_v_nwat; - double __pyx_v_H1x; - double __pyx_v_H1y; - double __pyx_v_H1z; - double __pyx_v_H2x; - double __pyx_v_H2y; - double __pyx_v_H2z; - double __pyx_v_n2; - double __pyx_v_n3; - int __pyx_v_i; - int __pyx_v_k; - int __pyx_v_ind; - __Pyx_memviewslice __pyx_v_B_out = { 0, 0, { 0 }, { 0 }, { 0 } }; - double *__pyx_v_B; +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_7; - long __pyx_t_8; - long __pyx_t_9; - int __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - long __pyx_t_15; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("waterRotationMatrix", 0); - - /* "src/helpers/helpers.pyx":980 - * @cython.boundscheck(False) - * def waterRotationMatrix(double [:,:] coor): - * cdef int nwat = len(coor)/3 # number of water molecules # <<<<<<<<<<<<<< - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 - * cdef int i, k, ind - */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_coor); - __pyx_v_nwat = __Pyx_div_Py_ssize_t(__pyx_t_1, 3); + __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "src/helpers/helpers.pyx":983 - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 - * cdef int i, k, ind - * cdef double [:,:,:] B_out = np.zeros((nwat,3,3)) # rotation matrix to return from parallel code # <<<<<<<<<<<<<< + /* "View.MemoryView":973 * - * with nogil, parallel(): + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nwat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_3); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_3); - __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 983, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_B_out = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":985 - * cdef double [:,:,:] B_out = np.zeros((nwat,3,3)) # rotation matrix to return from parallel code - * - * with nogil, parallel(): # <<<<<<<<<<<<<< - * B = malloc(sizeof(double) * 9) - * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules + /* "View.MemoryView":974 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - { - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - #ifdef _OPENMP - #pragma omp parallel private(__pyx_v_B) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - /* Initialize private variables to invalid values */ - __pyx_v_B = ((double *)1); + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 974, __pyx_L1_error) - /* "src/helpers/helpers.pyx":986 + /* "View.MemoryView":973 * - * with nogil, parallel(): - * B = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< - * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules - * for k in range(9): - */ - __pyx_v_B = ((double *)malloc(((sizeof(double)) * 9))); - - /* "src/helpers/helpers.pyx":987 - * with nogil, parallel(): - * B = malloc(sizeof(double) * 9) - * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules # <<<<<<<<<<<<<< - * for k in range(9): - * B[k] = 0.0 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: */ - __pyx_t_7 = (__pyx_v_nwat * 3); - if ((3 == 0)) abort(); - { - double __pyx_parallel_temp0 = ((double)__PYX_NAN()); - double __pyx_parallel_temp1 = ((double)__PYX_NAN()); - double __pyx_parallel_temp2 = ((double)__PYX_NAN()); - double __pyx_parallel_temp3 = ((double)__PYX_NAN()); - double __pyx_parallel_temp4 = ((double)__PYX_NAN()); - double __pyx_parallel_temp5 = ((double)__PYX_NAN()); - int __pyx_parallel_temp6 = ((int)0xbad0bad0); - int __pyx_parallel_temp7 = ((int)0xbad0bad0); - int __pyx_parallel_temp8 = ((int)0xbad0bad0); - double __pyx_parallel_temp9 = ((double)__PYX_NAN()); - double __pyx_parallel_temp10 = ((double)__PYX_NAN()); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - __pyx_t_9 = (__pyx_t_7 - 0 + 3 - 3/abs(3)) / 3; - if (__pyx_t_9 > 0) - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_H1x) lastprivate(__pyx_v_H1y) lastprivate(__pyx_v_H1z) lastprivate(__pyx_v_H2x) lastprivate(__pyx_v_H2y) lastprivate(__pyx_v_H2z) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ind) lastprivate(__pyx_v_k) lastprivate(__pyx_v_n2) lastprivate(__pyx_v_n3) - #endif /* _OPENMP */ - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_i = (int)(0 + 3 * __pyx_t_8); - /* Initialize private variables to invalid values */ - __pyx_v_H1x = ((double)__PYX_NAN()); - __pyx_v_H1y = ((double)__PYX_NAN()); - __pyx_v_H1z = ((double)__PYX_NAN()); - __pyx_v_H2x = ((double)__PYX_NAN()); - __pyx_v_H2y = ((double)__PYX_NAN()); - __pyx_v_H2z = ((double)__PYX_NAN()); - __pyx_v_ind = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); - __pyx_v_n2 = ((double)__PYX_NAN()); - __pyx_v_n3 = ((double)__PYX_NAN()); + goto __pyx_L3; + } - /* "src/helpers/helpers.pyx":988 - * B = malloc(sizeof(double) * 9) - * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules - * for k in range(9): # <<<<<<<<<<<<<< - * B[k] = 0.0 + /* "View.MemoryView":976 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< * + * cdef _get_base(self): */ - for (__pyx_t_10 = 0; __pyx_t_10 < 9; __pyx_t_10+=1) { - __pyx_v_k = __pyx_t_10; + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; - /* "src/helpers/helpers.pyx":989 - * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules - * for k in range(9): - * B[k] = 0.0 # <<<<<<<<<<<<<< + /* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) * - * H1x = coor[i+1,0]-coor[i,0] # rel. coordinates of H1 with respect to O + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ - (__pyx_v_B[__pyx_v_k]) = 0.0; - } - /* "src/helpers/helpers.pyx":991 - * B[k] = 0.0 - * - * H1x = coor[i+1,0]-coor[i,0] # rel. coordinates of H1 with respect to O # <<<<<<<<<<<<<< - * H1y = coor[i+1,1]-coor[i,1] - * H1z = coor[i+1,2]-coor[i,2] - */ - __pyx_t_11 = (__pyx_v_i + 1); - __pyx_t_12 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[1]; - __pyx_t_13 = __pyx_v_i; - __pyx_t_14 = 0; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; - __pyx_v_H1x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_11 * __pyx_v_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )))); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":992 +/* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) * - * H1x = coor[i+1,0]-coor[i,0] # rel. coordinates of H1 with respect to O - * H1y = coor[i+1,1]-coor[i,1] # <<<<<<<<<<<<<< - * H1z = coor[i+1,2]-coor[i,2] + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object * */ - __pyx_t_14 = (__pyx_v_i + 1); - __pyx_t_13 = 1; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[1]; - __pyx_t_12 = __pyx_v_i; - __pyx_t_11 = 1; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; - __pyx_v_H1y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) )))); - /* "src/helpers/helpers.pyx":993 - * H1x = coor[i+1,0]-coor[i,0] # rel. coordinates of H1 with respect to O - * H1y = coor[i+1,1]-coor[i,1] - * H1z = coor[i+1,2]-coor[i,2] # <<<<<<<<<<<<<< - * - * H2x = coor[i+2,0]-coor[i,0] # rel. coordinates of H2 with respect to O - */ - __pyx_t_11 = (__pyx_v_i + 1); - __pyx_t_12 = 2; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[1]; - __pyx_t_13 = __pyx_v_i; - __pyx_t_14 = 2; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; - __pyx_v_H1z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_11 * __pyx_v_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )))); +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); - /* "src/helpers/helpers.pyx":995 - * H1z = coor[i+1,2]-coor[i,2] + /* "View.MemoryView":979 * - * H2x = coor[i+2,0]-coor[i,0] # rel. coordinates of H2 with respect to O # <<<<<<<<<<<<<< - * H2y = coor[i+2,1]-coor[i,1] - * H2z = coor[i+2,2]-coor[i,2] - */ - __pyx_t_14 = (__pyx_v_i + 2); - __pyx_t_13 = 0; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[1]; - __pyx_t_12 = __pyx_v_i; - __pyx_t_11 = 0; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; - __pyx_v_H2x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) )))); - - /* "src/helpers/helpers.pyx":996 + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< * - * H2x = coor[i+2,0]-coor[i,0] # rel. coordinates of H2 with respect to O - * H2y = coor[i+2,1]-coor[i,1] # <<<<<<<<<<<<<< - * H2z = coor[i+2,2]-coor[i,2] * */ - __pyx_t_11 = (__pyx_v_i + 2); - __pyx_t_12 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[1]; - __pyx_t_13 = __pyx_v_i; - __pyx_t_14 = 1; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; - __pyx_v_H2y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_11 * __pyx_v_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )))); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":997 - * H2x = coor[i+2,0]-coor[i,0] # rel. coordinates of H2 with respect to O - * H2y = coor[i+2,1]-coor[i,1] - * H2z = coor[i+2,2]-coor[i,2] # <<<<<<<<<<<<<< + /* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object * - * B[3] = (H1x-H2x) */ - __pyx_t_14 = (__pyx_v_i + 2); - __pyx_t_13 = 2; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[1]; - __pyx_t_12 = __pyx_v_i; - __pyx_t_11 = 2; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; - __pyx_v_H2z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) )))); - /* "src/helpers/helpers.pyx":999 - * H2z = coor[i+2,2]-coor[i,2] - * - * B[3] = (H1x-H2x) # <<<<<<<<<<<<<< - * B[4] = (H1y-H2y) - * B[5] = (H1z-H2z) + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - (__pyx_v_B[3]) = (__pyx_v_H1x - __pyx_v_H2x); - /* "src/helpers/helpers.pyx":1000 - * - * B[3] = (H1x-H2x) - * B[4] = (H1y-H2y) # <<<<<<<<<<<<<< - * B[5] = (H1z-H2z) - * B[6] = (H1x+H2x) +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - (__pyx_v_B[4]) = (__pyx_v_H1y - __pyx_v_H2y); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1001 - * B[3] = (H1x-H2x) - * B[4] = (H1y-H2y) - * B[5] = (H1z-H2z) # <<<<<<<<<<<<<< - * B[6] = (H1x+H2x) - * B[7] = (H1y+H2y) + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - (__pyx_v_B[5]) = (__pyx_v_H1z - __pyx_v_H2z); - /* "src/helpers/helpers.pyx":1002 - * B[4] = (H1y-H2y) - * B[5] = (H1z-H2z) - * B[6] = (H1x+H2x) # <<<<<<<<<<<<<< - * B[7] = (H1y+H2y) - * B[8] = (H1z+H2z) + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - (__pyx_v_B[6]) = (__pyx_v_H1x + __pyx_v_H2x); - /* "src/helpers/helpers.pyx":1003 - * B[5] = (H1z-H2z) - * B[6] = (H1x+H2x) - * B[7] = (H1y+H2y) # <<<<<<<<<<<<<< - * B[8] = (H1z+H2z) - * +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - (__pyx_v_B[7]) = (__pyx_v_H1y + __pyx_v_H2y); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1004 - * B[6] = (H1x+H2x) - * B[7] = (H1y+H2y) - * B[8] = (H1z+H2z) # <<<<<<<<<<<<<< - * - * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - (__pyx_v_B[8]) = (__pyx_v_H1z + __pyx_v_H2z); - /* "src/helpers/helpers.pyx":1006 - * B[8] = (H1z+H2z) - * - * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 # <<<<<<<<<<<<<< - * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":999 * + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ - __pyx_v_n2 = pow(((((__pyx_v_B[3]) * (__pyx_v_B[3])) + ((__pyx_v_B[4]) * (__pyx_v_B[4]))) + ((__pyx_v_B[5]) * (__pyx_v_B[5]))), .5); - /* "src/helpers/helpers.pyx":1007 +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + + /* "View.MemoryView":1007 + * cdef _memoryviewslice result * - * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 - * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 # <<<<<<<<<<<<<< + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None * - * B[3] /= n2 */ - __pyx_v_n3 = pow(((((__pyx_v_B[6]) * (__pyx_v_B[6])) + ((__pyx_v_B[7]) * (__pyx_v_B[7]))) + ((__pyx_v_B[8]) * (__pyx_v_B[8]))), .5); + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":1009 - * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 + /* "View.MemoryView":1008 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< * - * B[3] /= n2 # <<<<<<<<<<<<<< - * B[4] /= n2 - * B[5] /= n2 - */ - __pyx_t_15 = 3; - if (unlikely(__pyx_v_n2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1009, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n2); - - /* "src/helpers/helpers.pyx":1010 * - * B[3] /= n2 - * B[4] /= n2 # <<<<<<<<<<<<<< - * B[5] /= n2 - * B[6] /= n3 - */ - __pyx_t_15 = 4; - if (unlikely(__pyx_v_n2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1010, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n2); - - /* "src/helpers/helpers.pyx":1011 - * B[3] /= n2 - * B[4] /= n2 - * B[5] /= n2 # <<<<<<<<<<<<<< - * B[6] /= n3 - * B[7] /= n3 - */ - __pyx_t_15 = 5; - if (unlikely(__pyx_v_n2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1011, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n2); - - /* "src/helpers/helpers.pyx":1012 - * B[4] /= n2 - * B[5] /= n2 - * B[6] /= n3 # <<<<<<<<<<<<<< - * B[7] /= n3 - * B[8] /= n3 */ - __pyx_t_15 = 6; - if (unlikely(__pyx_v_n3 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1012, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n3); + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1013 - * B[5] /= n2 - * B[6] /= n3 - * B[7] /= n3 # <<<<<<<<<<<<<< - * B[8] /= n3 + /* "View.MemoryView":1007 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None * */ - __pyx_t_15 = 7; - if (unlikely(__pyx_v_n3 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1013, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n3); + } - /* "src/helpers/helpers.pyx":1014 - * B[6] /= n3 - * B[7] /= n3 - * B[8] /= n3 # <<<<<<<<<<<<<< + /* "View.MemoryView":1013 * - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice */ - __pyx_t_15 = 8; - if (unlikely(__pyx_v_n3 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1014, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n3); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/helpers/helpers.pyx":1016 - * B[8] /= n3 + /* "View.MemoryView":1015 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) * - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product # <<<<<<<<<<<<<< - * B[1] = B[5]*B[6]-B[3]*B[8] - * B[2] = B[3]*B[7]-B[4]*B[6] */ - (__pyx_v_B[0]) = (((__pyx_v_B[4]) * (__pyx_v_B[8])) - ((__pyx_v_B[5]) * (__pyx_v_B[7]))); + __pyx_v_result->from_slice = __pyx_v_memviewslice; - /* "src/helpers/helpers.pyx":1017 + /* "View.MemoryView":1016 * - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product - * B[1] = B[5]*B[6]-B[3]*B[8] # <<<<<<<<<<<<<< - * B[2] = B[3]*B[7]-B[4]*B[6] + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< * + * result.from_object = ( memviewslice.memview)._get_base() */ - (__pyx_v_B[1]) = (((__pyx_v_B[5]) * (__pyx_v_B[6])) - ((__pyx_v_B[3]) * (__pyx_v_B[8]))); + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - /* "src/helpers/helpers.pyx":1018 - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product - * B[1] = B[5]*B[6]-B[3]*B[8] - * B[2] = B[3]*B[7]-B[4]*B[6] # <<<<<<<<<<<<<< + /* "View.MemoryView":1018 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo * - * ind =i/3 */ - (__pyx_v_B[2]) = (((__pyx_v_B[3]) * (__pyx_v_B[7])) - ((__pyx_v_B[4]) * (__pyx_v_B[6]))); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/helpers/helpers.pyx":1020 - * B[2] = B[3]*B[7]-B[4]*B[6] + /* "View.MemoryView":1019 * - * ind =i/3 # <<<<<<<<<<<<<< + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< * - * B_out[ind,0,0] = B[0] + * result.view = memviewslice.memview.view */ - __pyx_v_ind = __Pyx_div_long(__pyx_v_i, 3); + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - /* "src/helpers/helpers.pyx":1022 - * ind =i/3 + /* "View.MemoryView":1021 + * result.typeinfo = memviewslice.memview.typeinfo * - * B_out[ind,0,0] = B[0] # <<<<<<<<<<<<<< - * B_out[ind,0,1] = B[1] - * B_out[ind,0,2] = B[2] + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim */ - __pyx_t_11 = __pyx_v_ind; - __pyx_t_12 = 0; - __pyx_t_13 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_11 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_13 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[0]); + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; - /* "src/helpers/helpers.pyx":1023 + /* "View.MemoryView":1022 * - * B_out[ind,0,0] = B[0] - * B_out[ind,0,1] = B[1] # <<<<<<<<<<<<<< - * B_out[ind,0,2] = B[2] - * B_out[ind,1,0] = B[3] + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None */ - __pyx_t_13 = __pyx_v_ind; - __pyx_t_12 = 0; - __pyx_t_11 = 1; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_13 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_11 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[1]); + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - /* "src/helpers/helpers.pyx":1024 - * B_out[ind,0,0] = B[0] - * B_out[ind,0,1] = B[1] - * B_out[ind,0,2] = B[2] # <<<<<<<<<<<<<< - * B_out[ind,1,0] = B[3] - * B_out[ind,1,1] = B[4] + /* "View.MemoryView":1023 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) */ - __pyx_t_11 = __pyx_v_ind; - __pyx_t_12 = 0; - __pyx_t_13 = 2; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_11 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_13 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[2]); + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - /* "src/helpers/helpers.pyx":1025 - * B_out[ind,0,1] = B[1] - * B_out[ind,0,2] = B[2] - * B_out[ind,1,0] = B[3] # <<<<<<<<<<<<<< - * B_out[ind,1,1] = B[4] - * B_out[ind,1,2] = B[5] + /* "View.MemoryView":1024 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * */ - __pyx_t_13 = __pyx_v_ind; - __pyx_t_12 = 1; - __pyx_t_11 = 0; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_13 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_11 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[3]); + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; - /* "src/helpers/helpers.pyx":1026 - * B_out[ind,0,2] = B[2] - * B_out[ind,1,0] = B[3] - * B_out[ind,1,1] = B[4] # <<<<<<<<<<<<<< - * B_out[ind,1,2] = B[5] - * B_out[ind,2,0] = B[6] + /* "View.MemoryView":1025 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: */ - __pyx_t_11 = __pyx_v_ind; - __pyx_t_12 = 1; - __pyx_t_13 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_11 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_13 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[4]); + Py_INCREF(Py_None); - /* "src/helpers/helpers.pyx":1027 - * B_out[ind,1,0] = B[3] - * B_out[ind,1,1] = B[4] - * B_out[ind,1,2] = B[5] # <<<<<<<<<<<<<< - * B_out[ind,2,0] = B[6] - * B_out[ind,2,1] = B[7] + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: */ - __pyx_t_13 = __pyx_v_ind; - __pyx_t_12 = 1; - __pyx_t_11 = 2; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_13 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_11 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[5]); + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":1028 - * B_out[ind,1,1] = B[4] - * B_out[ind,1,2] = B[5] - * B_out[ind,2,0] = B[6] # <<<<<<<<<<<<<< - * B_out[ind,2,1] = B[7] - * B_out[ind,2,2] = B[8] + /* "View.MemoryView":1028 + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO */ - __pyx_t_11 = __pyx_v_ind; - __pyx_t_12 = 2; - __pyx_t_13 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_11 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_13 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[6]); + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - /* "src/helpers/helpers.pyx":1029 - * B_out[ind,1,2] = B[5] - * B_out[ind,2,0] = B[6] - * B_out[ind,2,1] = B[7] # <<<<<<<<<<<<<< - * B_out[ind,2,2] = B[8] + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: */ - __pyx_t_13 = __pyx_v_ind; - __pyx_t_12 = 2; - __pyx_t_11 = 1; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_13 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_11 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[7]); + goto __pyx_L4; + } - /* "src/helpers/helpers.pyx":1030 - * B_out[ind,2,0] = B[6] - * B_out[ind,2,1] = B[7] - * B_out[ind,2,2] = B[8] # <<<<<<<<<<<<<< + /* "View.MemoryView":1030 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< * - * free(B) + * result.view.shape = result.from_slice.shape */ - __pyx_t_11 = __pyx_v_ind; - __pyx_t_12 = 2; - __pyx_t_13 = 2; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_11 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_13 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[8]); - goto __pyx_L17; - __pyx_L12_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L16; - __pyx_L16:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates3) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_H1x; - __pyx_parallel_temp1 = __pyx_v_H1y; - __pyx_parallel_temp2 = __pyx_v_H1z; - __pyx_parallel_temp3 = __pyx_v_H2x; - __pyx_parallel_temp4 = __pyx_v_H2y; - __pyx_parallel_temp5 = __pyx_v_H2z; - __pyx_parallel_temp6 = __pyx_v_i; - __pyx_parallel_temp7 = __pyx_v_ind; - __pyx_parallel_temp8 = __pyx_v_k; - __pyx_parallel_temp9 = __pyx_v_n2; - __pyx_parallel_temp10 = __pyx_v_n3; - } - __pyx_L17:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_H1x = __pyx_parallel_temp0; - __pyx_v_H1y = __pyx_parallel_temp1; - __pyx_v_H1z = __pyx_parallel_temp2; - __pyx_v_H2x = __pyx_parallel_temp3; - __pyx_v_H2y = __pyx_parallel_temp4; - __pyx_v_H2z = __pyx_parallel_temp5; - __pyx_v_i = __pyx_parallel_temp6; - __pyx_v_ind = __pyx_parallel_temp7; - __pyx_v_k = __pyx_parallel_temp8; - __pyx_v_n2 = __pyx_parallel_temp9; - __pyx_v_n3 = __pyx_parallel_temp10; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L8_error; - } - } - } + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; - /* "src/helpers/helpers.pyx":1032 - * B_out[ind,2,2] = B[8] + /* "View.MemoryView":1032 + * result.flags = PyBUF_RECORDS_RO * - * free(B) # <<<<<<<<<<<<<< + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides * - * return B_out */ - free(__pyx_v_B); - goto __pyx_L19; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L19; - __pyx_L19:; - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); - /* "src/helpers/helpers.pyx":985 - * cdef double [:,:,:] B_out = np.zeros((nwat,3,3)) # rotation matrix to return from parallel code + /* "View.MemoryView":1033 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * * - * with nogil, parallel(): # <<<<<<<<<<<<<< - * B = malloc(sizeof(double) * 9) - * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + + /* "View.MemoryView":1036 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + */ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; + + /* "View.MemoryView":1037 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + */ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); + + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break + */ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { + + /* "View.MemoryView":1039 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break + * + */ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + + /* "View.MemoryView":1040 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize + */ + goto __pyx_L6_break; + + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break + */ + } } + __pyx_L6_break:; - /* "src/helpers/helpers.pyx":1034 - * free(B) + /* "View.MemoryView":1042 + * break * - * return B_out # <<<<<<<<<<<<<< + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length + */ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + + /* "View.MemoryView":1043 * - * @cython.boundscheck(False) + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * + */ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1044 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func + */ + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } + + /* "View.MemoryView":1046 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * + */ + __pyx_v_result->to_object_func = __pyx_v_to_object_func; + + /* "View.MemoryView":1047 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result + */ + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + + /* "View.MemoryView":1049 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_B_out, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1034, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "src/helpers/helpers.pyx":979 + /* "View.MemoryView":999 * - * @cython.boundscheck(False) - * def waterRotationMatrix(double [:,:] coor): # <<<<<<<<<<<<<< - * cdef int nwat = len(coor)/3 # number of water molecules - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_AddTraceback("newanalysis.helpers.waterRotationMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_B_out, 1); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":1037 - * - * @cython.boundscheck(False) - * def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): # <<<<<<<<<<<<<< +/* "View.MemoryView":1052 * - * cdef int nwat = len(py_xyz)/3 # number of water molecules + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_53NQRselfAndB(PyObject *__pyx_self, PyObject *__pyx_v_py_xyz); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_53NQRselfAndB = {"NQRselfAndB", (PyCFunction)__pyx_pw_11newanalysis_7helpers_53NQRselfAndB, METH_O, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_53NQRselfAndB(PyObject *__pyx_self, PyObject *__pyx_v_py_xyz) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("NQRselfAndB (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_xyz), __pyx_ptype_5numpy_ndarray, 1, "py_xyz", 0))) __PYX_ERR(0, 1037, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_7helpers_52NQRselfAndB(__pyx_self, ((PyArrayObject *)__pyx_v_py_xyz)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_7helpers_52NQRselfAndB(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_py_xyz) { - int __pyx_v_nwat; - double *__pyx_v_xyz; - double __pyx_v_H1x; - double __pyx_v_H1y; - double __pyx_v_H1z; - double __pyx_v_H2x; - double __pyx_v_H2y; - double __pyx_v_H2z; - double __pyx_v_n2; - double __pyx_v_n3; - double __pyx_v_Exx; - double __pyx_v_Eyy; - double __pyx_v_Ezz; - int __pyx_v_i; - int __pyx_v_k; - int __pyx_v_ind; - PyArrayObject *__pyx_v_py_dipt = 0; - double *__pyx_v_dipt; - PyArrayObject *__pyx_v_py_B1 = 0; - double *__pyx_v_B1; - PyArrayObject *__pyx_v_py_B2 = 0; - double *__pyx_v_B2; - PyArrayObject *__pyx_v_py_B3 = 0; - double *__pyx_v_B3; - double *__pyx_v_B; - double *__pyx_v_T; - __Pyx_LocalBuf_ND __pyx_pybuffernd_py_B1; - __Pyx_Buffer __pyx_pybuffer_py_B1; - __Pyx_LocalBuf_ND __pyx_pybuffernd_py_B2; - __Pyx_Buffer __pyx_pybuffer_py_B2; - __Pyx_LocalBuf_ND __pyx_pybuffernd_py_B3; - __Pyx_Buffer __pyx_pybuffer_py_B3; - __Pyx_LocalBuf_ND __pyx_pybuffernd_py_dipt; - __Pyx_Buffer __pyx_pybuffer_py_dipt; - __Pyx_LocalBuf_ND __pyx_pybuffernd_py_xyz; - __Pyx_Buffer __pyx_pybuffer_py_xyz; - PyObject *__pyx_r = NULL; +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyArrayObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - long __pyx_t_11; - long __pyx_t_12; - long __pyx_t_13; - int __pyx_t_14; - long __pyx_t_15; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("NQRselfAndB", 0); - __pyx_pybuffer_py_dipt.pybuffer.buf = NULL; - __pyx_pybuffer_py_dipt.refcount = 0; - __pyx_pybuffernd_py_dipt.data = NULL; - __pyx_pybuffernd_py_dipt.rcbuffer = &__pyx_pybuffer_py_dipt; - __pyx_pybuffer_py_B1.pybuffer.buf = NULL; - __pyx_pybuffer_py_B1.refcount = 0; - __pyx_pybuffernd_py_B1.data = NULL; - __pyx_pybuffernd_py_B1.rcbuffer = &__pyx_pybuffer_py_B1; - __pyx_pybuffer_py_B2.pybuffer.buf = NULL; - __pyx_pybuffer_py_B2.refcount = 0; - __pyx_pybuffernd_py_B2.data = NULL; - __pyx_pybuffernd_py_B2.rcbuffer = &__pyx_pybuffer_py_B2; - __pyx_pybuffer_py_B3.pybuffer.buf = NULL; - __pyx_pybuffer_py_B3.refcount = 0; - __pyx_pybuffernd_py_B3.data = NULL; - __pyx_pybuffernd_py_B3.rcbuffer = &__pyx_pybuffer_py_B3; - __pyx_pybuffer_py_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_py_xyz.refcount = 0; - __pyx_pybuffernd_py_xyz.data = NULL; - __pyx_pybuffernd_py_xyz.rcbuffer = &__pyx_pybuffer_py_xyz; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_py_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1037, __pyx_L1_error) - } - __pyx_pybuffernd_py_xyz.diminfo[0].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_xyz.diminfo[0].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_py_xyz.diminfo[1].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_py_xyz.diminfo[1].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[1]; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - /* "src/helpers/helpers.pyx":1039 - * def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): - * - * cdef int nwat = len(py_xyz)/3 # number of water molecules # <<<<<<<<<<<<<< - * cdef double *xyz = py_xyz.data - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_py_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1039, __pyx_L1_error) - __pyx_v_nwat = __Pyx_div_Py_ssize_t(__pyx_t_1, 3); + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":1040 - * - * cdef int nwat = len(py_xyz)/3 # number of water molecules - * cdef double *xyz = py_xyz.data # <<<<<<<<<<<<<< - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 - * cdef double Exx = -2.3067236 # -2.0486*1.126 + /* "View.MemoryView":1056 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: */ - __pyx_v_xyz = ((double *)__pyx_v_py_xyz->data); + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/helpers/helpers.pyx":1042 - * cdef double *xyz = py_xyz.data - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 - * cdef double Exx = -2.3067236 # -2.0486*1.126 # <<<<<<<<<<<<<< - * cdef double Eyy = 2.0364836 # 1.8086*1.126 - * cdef double Ezz = 0.27024 # 0.2400*1.126 + /* "View.MemoryView":1057 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) */ - __pyx_v_Exx = -2.3067236; + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1043 - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 - * cdef double Exx = -2.3067236 # -2.0486*1.126 - * cdef double Eyy = 2.0364836 # 1.8086*1.126 # <<<<<<<<<<<<<< - * cdef double Ezz = 0.27024 # 0.2400*1.126 - * cdef int i, k, ind + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice */ - __pyx_v_Eyy = 2.0364836; + } - /* "src/helpers/helpers.pyx":1044 - * cdef double Exx = -2.3067236 # -2.0486*1.126 - * cdef double Eyy = 2.0364836 # 1.8086*1.126 - * cdef double Ezz = 0.27024 # 0.2400*1.126 # <<<<<<<<<<<<<< - * cdef int i, k, ind + /* "View.MemoryView":1059 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice * */ - __pyx_v_Ezz = 0.27024; + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - /* "src/helpers/helpers.pyx":1047 - * cdef int i, k, ind + /* "View.MemoryView":1060 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< * - * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *dipt = py_dipt.data - * cdef np.ndarray[np.float64_t,ndim=1] py_B1 = np.zeros(nwat*3,dtype=np.float64) + * @cname('__pyx_memoryview_slice_copy') */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1047, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1047, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_nwat * 6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1047, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1047, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1047, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1047, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1047, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 1047, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1047, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1047, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_py_dipt = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 1047, __pyx_L1_error) - } else {__pyx_pybuffernd_py_dipt.diminfo[0].strides = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_dipt.diminfo[0].shape = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.shape[0]; - } + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; } - __pyx_t_7 = 0; - __pyx_v_py_dipt = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - /* "src/helpers/helpers.pyx":1048 + /* "View.MemoryView":1052 * - * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) - * cdef double *dipt = py_dipt.data # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1] py_B1 = np.zeros(nwat*3,dtype=np.float64) - * cdef double *B1 = py_B1.data - */ - __pyx_v_dipt = ((double *)__pyx_v_py_dipt->data); - - /* "src/helpers/helpers.pyx":1049 - * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) - * cdef double *dipt = py_dipt.data - * cdef np.ndarray[np.float64_t,ndim=1] py_B1 = np.zeros(nwat*3,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *B1 = py_B1.data - * cdef np.ndarray[np.float64_t,ndim=1] py_B2 = np.zeros(nwat*3,dtype=np.float64) + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_v_nwat * 3)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1049, __pyx_L1_error) - __pyx_t_8 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_B1.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_py_B1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_B1.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 1049, __pyx_L1_error) - } else {__pyx_pybuffernd_py_B1.diminfo[0].strides = __pyx_pybuffernd_py_B1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_B1.diminfo[0].shape = __pyx_pybuffernd_py_B1.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_8 = 0; - __pyx_v_py_B1 = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1050 - * cdef double *dipt = py_dipt.data - * cdef np.ndarray[np.float64_t,ndim=1] py_B1 = np.zeros(nwat*3,dtype=np.float64) - * cdef double *B1 = py_B1.data # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1] py_B2 = np.zeros(nwat*3,dtype=np.float64) - * cdef double *B2 = py_B2.data - */ - __pyx_v_B1 = ((double *)__pyx_v_py_B1->data); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":1051 - * cdef np.ndarray[np.float64_t,ndim=1] py_B1 = np.zeros(nwat*3,dtype=np.float64) - * cdef double *B1 = py_B1.data - * cdef np.ndarray[np.float64_t,ndim=1] py_B2 = np.zeros(nwat*3,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *B2 = py_B2.data - * cdef np.ndarray[np.float64_t,ndim=1] py_B3 = np.zeros(nwat*3,dtype=np.float64) +/* "View.MemoryView":1063 + * + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_v_nwat * 3)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1051, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1051, __pyx_L1_error) - __pyx_t_9 = ((PyArrayObject *)__pyx_t_3); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_B2.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_py_B2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_B2.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 1051, __pyx_L1_error) - } else {__pyx_pybuffernd_py_B2.diminfo[0].strides = __pyx_pybuffernd_py_B2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_B2.diminfo[0].shape = __pyx_pybuffernd_py_B2.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_9 = 0; - __pyx_v_py_B2 = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; - /* "src/helpers/helpers.pyx":1052 - * cdef double *B1 = py_B1.data - * cdef np.ndarray[np.float64_t,ndim=1] py_B2 = np.zeros(nwat*3,dtype=np.float64) - * cdef double *B2 = py_B2.data # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1] py_B3 = np.zeros(nwat*3,dtype=np.float64) - * cdef double *B3 = py_B3.data - */ - __pyx_v_B2 = ((double *)__pyx_v_py_B2->data); +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; + __Pyx_RefNannyDeclarations + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("slice_copy", 0); - /* "src/helpers/helpers.pyx":1053 - * cdef np.ndarray[np.float64_t,ndim=1] py_B2 = np.zeros(nwat*3,dtype=np.float64) - * cdef double *B2 = py_B2.data - * cdef np.ndarray[np.float64_t,ndim=1] py_B3 = np.zeros(nwat*3,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef double *B3 = py_B3.data + /* "View.MemoryView":1067 + * cdef (Py_ssize_t*) shape, strides, suboffsets * + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1053, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1053, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_nwat * 3)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1053, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1053, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1053, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1053, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1053, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 1053, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1053, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1053, __pyx_L1_error) - __pyx_t_10 = ((PyArrayObject *)__pyx_t_2); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_B3.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_py_B3 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_B3.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 1053, __pyx_L1_error) - } else {__pyx_pybuffernd_py_B3.diminfo[0].strides = __pyx_pybuffernd_py_B3.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_B3.diminfo[0].shape = __pyx_pybuffernd_py_B3.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_10 = 0; - __pyx_v_py_B3 = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; - /* "src/helpers/helpers.pyx":1054 - * cdef double *B2 = py_B2.data - * cdef np.ndarray[np.float64_t,ndim=1] py_B3 = np.zeros(nwat*3,dtype=np.float64) - * cdef double *B3 = py_B3.data # <<<<<<<<<<<<<< + /* "View.MemoryView":1068 + * + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets * - * with nogil, parallel(): */ - __pyx_v_B3 = ((double *)__pyx_v_py_B3->data); + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; - /* "src/helpers/helpers.pyx":1056 - * cdef double *B3 = py_B3.data + /* "View.MemoryView":1069 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< * - * with nogil, parallel(): # <<<<<<<<<<<<<< - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) + * dst.memview = <__pyx_memoryview *> memview */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - { - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - #ifdef _OPENMP - #pragma omp parallel private(__pyx_v_B, __pyx_v_T) private(__pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - /* Initialize private variables to invalid values */ - __pyx_v_B = ((double *)1); - __pyx_v_T = ((double *)1); + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; - /* "src/helpers/helpers.pyx":1057 + /* "View.MemoryView":1071 + * suboffsets = memview.view.suboffsets + * + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf * - * with nogil, parallel(): - * B = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< - * T = malloc(sizeof(double) * 9) - * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules */ - __pyx_v_B = ((double *)malloc(((sizeof(double)) * 9))); + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); - /* "src/helpers/helpers.pyx":1058 - * with nogil, parallel(): - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< - * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules - * for k in range(9): + /* "View.MemoryView":1072 + * + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): */ - __pyx_v_T = ((double *)malloc(((sizeof(double)) * 9))); + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - /* "src/helpers/helpers.pyx":1059 - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) - * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules # <<<<<<<<<<<<<< - * for k in range(9): - * B[k] = 0.0 + /* "View.MemoryView":1074 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] */ - __pyx_t_11 = (__pyx_v_nwat * 9); - if ((9 == 0)) abort(); - { - double __pyx_parallel_temp0 = ((double)__PYX_NAN()); - double __pyx_parallel_temp1 = ((double)__PYX_NAN()); - double __pyx_parallel_temp2 = ((double)__PYX_NAN()); - double __pyx_parallel_temp3 = ((double)__PYX_NAN()); - double __pyx_parallel_temp4 = ((double)__PYX_NAN()); - double __pyx_parallel_temp5 = ((double)__PYX_NAN()); - int __pyx_parallel_temp6 = ((int)0xbad0bad0); - int __pyx_parallel_temp7 = ((int)0xbad0bad0); - int __pyx_parallel_temp8 = ((int)0xbad0bad0); - double __pyx_parallel_temp9 = ((double)__PYX_NAN()); - double __pyx_parallel_temp10 = ((double)__PYX_NAN()); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - __pyx_t_13 = (__pyx_t_11 - 0 + 9 - 9/abs(9)) / 9; - if (__pyx_t_13 > 0) - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_H1x) lastprivate(__pyx_v_H1y) lastprivate(__pyx_v_H1z) lastprivate(__pyx_v_H2x) lastprivate(__pyx_v_H2y) lastprivate(__pyx_v_H2z) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ind) lastprivate(__pyx_v_k) lastprivate(__pyx_v_n2) lastprivate(__pyx_v_n3) - #endif /* _OPENMP */ - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_i = (int)(0 + 9 * __pyx_t_12); - /* Initialize private variables to invalid values */ - __pyx_v_H1x = ((double)__PYX_NAN()); - __pyx_v_H1y = ((double)__PYX_NAN()); - __pyx_v_H1z = ((double)__PYX_NAN()); - __pyx_v_H2x = ((double)__PYX_NAN()); - __pyx_v_H2y = ((double)__PYX_NAN()); - __pyx_v_H2z = ((double)__PYX_NAN()); - __pyx_v_ind = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); - __pyx_v_n2 = ((double)__PYX_NAN()); - __pyx_v_n3 = ((double)__PYX_NAN()); + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; - /* "src/helpers/helpers.pyx":1060 - * T = malloc(sizeof(double) * 9) - * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules - * for k in range(9): # <<<<<<<<<<<<<< - * B[k] = 0.0 - * T[k] = 0.0 + /* "View.MemoryView":1075 + * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 */ - for (__pyx_t_14 = 0; __pyx_t_14 < 9; __pyx_t_14+=1) { - __pyx_v_k = __pyx_t_14; + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); - /* "src/helpers/helpers.pyx":1061 - * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules - * for k in range(9): - * B[k] = 0.0 # <<<<<<<<<<<<<< - * T[k] = 0.0 + /* "View.MemoryView":1076 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 * */ - (__pyx_v_B[__pyx_v_k]) = 0.0; + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); - /* "src/helpers/helpers.pyx":1062 - * for k in range(9): - * B[k] = 0.0 - * T[k] = 0.0 # <<<<<<<<<<<<<< + /* "View.MemoryView":1077 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< * - * H1x = xyz[i+3]-xyz[i] + * @cname('__pyx_memoryview_copy_object') */ - (__pyx_v_T[__pyx_v_k]) = 0.0; - } + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } - /* "src/helpers/helpers.pyx":1064 - * T[k] = 0.0 + /* "View.MemoryView":1063 * - * H1x = xyz[i+3]-xyz[i] # <<<<<<<<<<<<<< - * H1y = xyz[i+4]-xyz[i+1] - * H1z = xyz[i+5]-xyz[i+2] + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets */ - __pyx_v_H1x = ((__pyx_v_xyz[(__pyx_v_i + 3)]) - (__pyx_v_xyz[__pyx_v_i])); - /* "src/helpers/helpers.pyx":1065 + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "View.MemoryView":1080 * - * H1x = xyz[i+3]-xyz[i] - * H1y = xyz[i+4]-xyz[i+1] # <<<<<<<<<<<<<< - * H1z = xyz[i+5]-xyz[i+2] - * H2x = xyz[i+6]-xyz[i] + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice */ - __pyx_v_H1y = ((__pyx_v_xyz[(__pyx_v_i + 4)]) - (__pyx_v_xyz[(__pyx_v_i + 1)])); - /* "src/helpers/helpers.pyx":1066 - * H1x = xyz[i+3]-xyz[i] - * H1y = xyz[i+4]-xyz[i+1] - * H1z = xyz[i+5]-xyz[i+2] # <<<<<<<<<<<<<< - * H2x = xyz[i+6]-xyz[i] - * H2y = xyz[i+7]-xyz[i+1] - */ - __pyx_v_H1z = ((__pyx_v_xyz[(__pyx_v_i + 5)]) - (__pyx_v_xyz[(__pyx_v_i + 2)])); +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy", 0); - /* "src/helpers/helpers.pyx":1067 - * H1y = xyz[i+4]-xyz[i+1] - * H1z = xyz[i+5]-xyz[i+2] - * H2x = xyz[i+6]-xyz[i] # <<<<<<<<<<<<<< - * H2y = xyz[i+7]-xyz[i+1] - * H2z = xyz[i+8]-xyz[i+2] + /* "View.MemoryView":1083 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * */ - __pyx_v_H2x = ((__pyx_v_xyz[(__pyx_v_i + 6)]) - (__pyx_v_xyz[__pyx_v_i])); + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); - /* "src/helpers/helpers.pyx":1068 - * H1z = xyz[i+5]-xyz[i+2] - * H2x = xyz[i+6]-xyz[i] - * H2y = xyz[i+7]-xyz[i+1] # <<<<<<<<<<<<<< - * H2z = xyz[i+8]-xyz[i+2] + /* "View.MemoryView":1084 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< * + * @cname('__pyx_memoryview_copy_object_from_slice') */ - __pyx_v_H2y = ((__pyx_v_xyz[(__pyx_v_i + 7)]) - (__pyx_v_xyz[(__pyx_v_i + 1)])); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1069 - * H2x = xyz[i+6]-xyz[i] - * H2y = xyz[i+7]-xyz[i+1] - * H2z = xyz[i+8]-xyz[i+2] # <<<<<<<<<<<<<< + /* "View.MemoryView":1080 * - * B[3] = (H1x-H2x) + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice */ - __pyx_v_H2z = ((__pyx_v_xyz[(__pyx_v_i + 8)]) - (__pyx_v_xyz[(__pyx_v_i + 2)])); - /* "src/helpers/helpers.pyx":1071 - * H2z = xyz[i+8]-xyz[i+2] + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1087 * - * B[3] = (H1x-H2x) # <<<<<<<<<<<<<< - * B[4] = (H1y-H2y) - * B[5] = (H1z-H2z) + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ - (__pyx_v_B[3]) = (__pyx_v_H1x - __pyx_v_H2x); - /* "src/helpers/helpers.pyx":1072 +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * B[3] = (H1x-H2x) - * B[4] = (H1y-H2y) # <<<<<<<<<<<<<< - * B[5] = (H1z-H2z) - * B[6] = (H1x+H2x) + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - (__pyx_v_B[4]) = (__pyx_v_H1y - __pyx_v_H2y); + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":1073 - * B[3] = (H1x-H2x) - * B[4] = (H1y-H2y) - * B[5] = (H1z-H2z) # <<<<<<<<<<<<<< - * B[6] = (H1x+H2x) - * B[7] = (H1y+H2y) + /* "View.MemoryView":1095 + * + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: */ - (__pyx_v_B[5]) = (__pyx_v_H1z - __pyx_v_H2z); + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; - /* "src/helpers/helpers.pyx":1074 - * B[4] = (H1y-H2y) - * B[5] = (H1z-H2z) - * B[6] = (H1x+H2x) # <<<<<<<<<<<<<< - * B[7] = (H1y+H2y) - * B[8] = (H1z+H2z) + /* "View.MemoryView":1096 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL */ - (__pyx_v_B[6]) = (__pyx_v_H1x + __pyx_v_H2x); + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; - /* "src/helpers/helpers.pyx":1075 - * B[5] = (H1z-H2z) - * B[6] = (H1x+H2x) - * B[7] = (H1y+H2y) # <<<<<<<<<<<<<< - * B[8] = (H1z+H2z) + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - (__pyx_v_B[7]) = (__pyx_v_H1y + __pyx_v_H2y); + goto __pyx_L3; + } - /* "src/helpers/helpers.pyx":1076 - * B[6] = (H1x+H2x) - * B[7] = (H1y+H2y) - * B[8] = (H1z+H2z) # <<<<<<<<<<<<<< + /* "View.MemoryView":1098 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL * - * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 */ - (__pyx_v_B[8]) = (__pyx_v_H1z + __pyx_v_H2z); + /*else*/ { + __pyx_v_to_object_func = NULL; - /* "src/helpers/helpers.pyx":1078 - * B[8] = (H1z+H2z) + /* "View.MemoryView":1099 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< * - * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 # <<<<<<<<<<<<<< - * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + */ + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; + + /* "View.MemoryView":1101 + * to_dtype_func = NULL * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) */ - __pyx_v_n2 = pow(((((__pyx_v_B[3]) * (__pyx_v_B[3])) + ((__pyx_v_B[4]) * (__pyx_v_B[4]))) + ((__pyx_v_B[5]) * (__pyx_v_B[5]))), .5); + __Pyx_XDECREF(__pyx_r); - /* "src/helpers/helpers.pyx":1079 + /* "View.MemoryView":1103 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< * - * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 - * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 # <<<<<<<<<<<<<< * - * B[3] /= n2 */ - __pyx_v_n3 = pow(((((__pyx_v_B[6]) * (__pyx_v_B[6])) + ((__pyx_v_B[7]) * (__pyx_v_B[7]))) + ((__pyx_v_B[8]) * (__pyx_v_B[8]))), .5); + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1081 - * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 + /* "View.MemoryView":1087 * - * B[3] /= n2 # <<<<<<<<<<<<<< - * B[4] /= n2 - * B[5] /= n2 + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ - __pyx_t_15 = 3; - if (unlikely(__pyx_v_n2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1081, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n2); - /* "src/helpers/helpers.pyx":1082 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1109 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg * - * B[3] /= n2 - * B[4] /= n2 # <<<<<<<<<<<<<< - * B[5] /= n2 - * B[6] /= n3 */ - __pyx_t_15 = 4; - if (unlikely(__pyx_v_n2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1082, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n2); - /* "src/helpers/helpers.pyx":1083 - * B[3] /= n2 - * B[4] /= n2 - * B[5] /= n2 # <<<<<<<<<<<<<< - * B[6] /= n3 - * B[7] /= n3 +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1110 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') */ - __pyx_t_15 = 5; - if (unlikely(__pyx_v_n2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1083, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n2); + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1084 - * B[4] /= n2 - * B[5] /= n2 - * B[6] /= n3 # <<<<<<<<<<<<<< - * B[7] /= n3 - * B[8] /= n3 + /* "View.MemoryView":1109 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * */ - __pyx_t_15 = 6; - if (unlikely(__pyx_v_n3 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1084, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n3); - /* "src/helpers/helpers.pyx":1085 - * B[5] /= n2 - * B[6] /= n3 - * B[7] /= n3 # <<<<<<<<<<<<<< - * B[8] /= n3 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1113 * + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. */ - __pyx_t_15 = 7; - if (unlikely(__pyx_v_n3 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1085, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n3); - /* "src/helpers/helpers.pyx":1086 - * B[6] /= n3 - * B[7] /= n3 - * B[8] /= n3 # <<<<<<<<<<<<<< +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1118 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 * - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product */ - __pyx_t_15 = 8; - if (unlikely(__pyx_v_n3 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1086, __pyx_L12_error) - } - (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n3); + __pyx_v_c_stride = 0; - /* "src/helpers/helpers.pyx":1088 - * B[8] /= n3 + /* "View.MemoryView":1119 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< * - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product # <<<<<<<<<<<<<< - * B[1] = B[5]*B[6]-B[3]*B[8] - * B[2] = B[3]*B[7]-B[4]*B[6] + * for i in range(ndim - 1, -1, -1): */ - (__pyx_v_B[0]) = (((__pyx_v_B[4]) * (__pyx_v_B[8])) - ((__pyx_v_B[5]) * (__pyx_v_B[7]))); + __pyx_v_f_stride = 0; - /* "src/helpers/helpers.pyx":1089 + /* "View.MemoryView":1121 + * cdef Py_ssize_t f_stride = 0 * - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product - * B[1] = B[5]*B[6]-B[3]*B[8] # <<<<<<<<<<<<<< - * B[2] = B[3]*B[7]-B[4]*B[6] + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + */ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":1122 * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break */ - (__pyx_v_B[1]) = (((__pyx_v_B[5]) * (__pyx_v_B[6])) - ((__pyx_v_B[3]) * (__pyx_v_B[8]))); + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1090 - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product - * B[1] = B[5]*B[6]-B[3]*B[8] - * B[2] = B[3]*B[7]-B[4]*B[6] # <<<<<<<<<<<<<< + /* "View.MemoryView":1123 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break * - * # B dot T */ - (__pyx_v_B[2]) = (((__pyx_v_B[3]) * (__pyx_v_B[7])) - ((__pyx_v_B[4]) * (__pyx_v_B[6]))); + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "src/helpers/helpers.pyx":1093 + /* "View.MemoryView":1124 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< * - * # B dot T - * T[0] = B[0]*Exx # <<<<<<<<<<<<<< - * T[1] = B[1]*Exx - * T[2] = B[2]*Exx + * for i in range(ndim): */ - (__pyx_v_T[0]) = ((__pyx_v_B[0]) * __pyx_v_Exx); + goto __pyx_L4_break; - /* "src/helpers/helpers.pyx":1094 - * # B dot T - * T[0] = B[0]*Exx - * T[1] = B[1]*Exx # <<<<<<<<<<<<<< - * T[2] = B[2]*Exx - * T[3] = B[3]*Eyy + /* "View.MemoryView":1122 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break */ - (__pyx_v_T[1]) = ((__pyx_v_B[1]) * __pyx_v_Exx); + } + } + __pyx_L4_break:; - /* "src/helpers/helpers.pyx":1095 - * T[0] = B[0]*Exx - * T[1] = B[1]*Exx - * T[2] = B[2]*Exx # <<<<<<<<<<<<<< - * T[3] = B[3]*Eyy - * T[4] = B[4]*Eyy + /* "View.MemoryView":1126 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] */ - (__pyx_v_T[2]) = ((__pyx_v_B[2]) * __pyx_v_Exx); + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/helpers.pyx":1096 - * T[1] = B[1]*Exx - * T[2] = B[2]*Exx - * T[3] = B[3]*Eyy # <<<<<<<<<<<<<< - * T[4] = B[4]*Eyy - * T[5] = B[5]*Eyy + /* "View.MemoryView":1127 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break */ - (__pyx_v_T[3]) = ((__pyx_v_B[3]) * __pyx_v_Eyy); + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1097 - * T[2] = B[2]*Exx - * T[3] = B[3]*Eyy - * T[4] = B[4]*Eyy # <<<<<<<<<<<<<< - * T[5] = B[5]*Eyy - * T[6] = B[6]*Ezz + /* "View.MemoryView":1128 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * */ - (__pyx_v_T[4]) = ((__pyx_v_B[4]) * __pyx_v_Eyy); + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "src/helpers/helpers.pyx":1098 - * T[3] = B[3]*Eyy - * T[4] = B[4]*Eyy - * T[5] = B[5]*Eyy # <<<<<<<<<<<<<< - * T[6] = B[6]*Ezz - * T[7] = B[7]*Ezz + /* "View.MemoryView":1129 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): */ - (__pyx_v_T[5]) = ((__pyx_v_B[5]) * __pyx_v_Eyy); + goto __pyx_L7_break; - /* "src/helpers/helpers.pyx":1099 - * T[4] = B[4]*Eyy - * T[5] = B[5]*Eyy - * T[6] = B[6]*Ezz # <<<<<<<<<<<<<< - * T[7] = B[7]*Ezz - * T[8] = B[8]*Ezz + /* "View.MemoryView":1127 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break */ - (__pyx_v_T[6]) = ((__pyx_v_B[6]) * __pyx_v_Ezz); + } + } + __pyx_L7_break:; - /* "src/helpers/helpers.pyx":1100 - * T[5] = B[5]*Eyy - * T[6] = B[6]*Ezz - * T[7] = B[7]*Ezz # <<<<<<<<<<<<<< - * T[8] = B[8]*Ezz + /* "View.MemoryView":1131 + * break * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: */ - (__pyx_v_T[7]) = ((__pyx_v_B[7]) * __pyx_v_Ezz); + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1101 - * T[6] = B[6]*Ezz - * T[7] = B[7]*Ezz - * T[8] = B[8]*Ezz # <<<<<<<<<<<<<< + /* "View.MemoryView":1132 * - * ind = (i/9)*6 + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' */ - (__pyx_v_T[8]) = ((__pyx_v_B[8]) * __pyx_v_Ezz); + __pyx_r = 'C'; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1103 - * T[8] = B[8]*Ezz + /* "View.MemoryView":1131 + * break * - * ind = (i/9)*6 # <<<<<<<<<<<<<< + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: + */ + } + + /* "View.MemoryView":1134 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< * - * # (B dot T) dot B.T + * @cython.cdivision(True) */ - __pyx_v_ind = (__Pyx_div_long(__pyx_v_i, 9) * 6); + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } - /* "src/helpers/helpers.pyx":1106 + /* "View.MemoryView":1113 * - * # (B dot T) dot B.T - * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B # <<<<<<<<<<<<<< - * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 - * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. */ - (__pyx_v_dipt[__pyx_v_ind]) = ((((__pyx_v_T[0]) * (__pyx_v_B[0])) + ((__pyx_v_T[3]) * (__pyx_v_B[3]))) + ((__pyx_v_T[6]) * (__pyx_v_B[6]))); - /* "src/helpers/helpers.pyx":1107 - * # (B dot T) dot B.T - * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B - * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 # <<<<<<<<<<<<<< - * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 - * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1137 + * + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ - (__pyx_v_dipt[(__pyx_v_ind + 1)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[1])) + ((__pyx_v_T[4]) * (__pyx_v_B[4]))) + ((__pyx_v_T[7]) * (__pyx_v_B[7]))); - /* "src/helpers/helpers.pyx":1108 - * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B - * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 - * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 # <<<<<<<<<<<<<< - * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 - * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1144 + * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] */ - (__pyx_v_dipt[(__pyx_v_ind + 2)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[2])) + ((__pyx_v_T[5]) * (__pyx_v_B[5]))) + ((__pyx_v_T[8]) * (__pyx_v_B[8]))); + __pyx_v_src_extent = (__pyx_v_src_shape[0]); - /* "src/helpers/helpers.pyx":1109 - * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 - * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 - * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 # <<<<<<<<<<<<<< - * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 - * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric + /* "View.MemoryView":1145 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] */ - (__pyx_v_dipt[(__pyx_v_ind + 3)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[0])) + ((__pyx_v_T[4]) * (__pyx_v_B[3]))) + ((__pyx_v_T[7]) * (__pyx_v_B[6]))); + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - /* "src/helpers/helpers.pyx":1110 - * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 - * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 - * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 # <<<<<<<<<<<<<< - * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric + /* "View.MemoryView":1146 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] * */ - (__pyx_v_dipt[(__pyx_v_ind + 4)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[0])) + ((__pyx_v_T[5]) * (__pyx_v_B[3]))) + ((__pyx_v_T[8]) * (__pyx_v_B[6]))); + __pyx_v_src_stride = (__pyx_v_src_strides[0]); - /* "src/helpers/helpers.pyx":1111 - * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 - * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 - * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric # <<<<<<<<<<<<<< + /* "View.MemoryView":1147 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< * - * ind = (i/9)*3 + * if ndim == 1: */ - (__pyx_v_dipt[(__pyx_v_ind + 5)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[1])) + ((__pyx_v_T[5]) * (__pyx_v_B[4]))) + ((__pyx_v_T[8]) * (__pyx_v_B[7]))); + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); - /* "src/helpers/helpers.pyx":1113 - * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric - * - * ind = (i/9)*3 # <<<<<<<<<<<<<< + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * B1[ind] = B[0] + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): */ - __pyx_v_ind = (__Pyx_div_long(__pyx_v_i, 9) * 3); + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":1115 - * ind = (i/9)*3 + /* "View.MemoryView":1150 * - * B1[ind] = B[0] # <<<<<<<<<<<<<< - * B1[ind+1] = B[1] - * B1[ind+2] = B[2] + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - (__pyx_v_B1[__pyx_v_ind]) = (__pyx_v_B[0]); + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } - /* "src/helpers/helpers.pyx":1116 + /* "View.MemoryView":1151 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + */ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; + + /* "View.MemoryView":1150 * - * B1[ind] = B[0] - * B1[ind+1] = B[1] # <<<<<<<<<<<<<< - * B1[ind+2] = B[2] - * B2[ind] = B[3] + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - (__pyx_v_B1[(__pyx_v_ind + 1)]) = (__pyx_v_B[1]); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":1117 - * B1[ind] = B[0] - * B1[ind+1] = B[1] - * B1[ind+2] = B[2] # <<<<<<<<<<<<<< - * B2[ind] = B[3] - * B2[ind+1] = B[4] + /* "View.MemoryView":1152 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): */ - (__pyx_v_B1[(__pyx_v_ind + 2)]) = (__pyx_v_B[2]); + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); - /* "src/helpers/helpers.pyx":1118 - * B1[ind+1] = B[1] - * B1[ind+2] = B[2] - * B2[ind] = B[3] # <<<<<<<<<<<<<< - * B2[ind+1] = B[4] - * B2[ind+2] = B[5] + /* "View.MemoryView":1150 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - (__pyx_v_B2[__pyx_v_ind]) = (__pyx_v_B[3]); + goto __pyx_L4; + } - /* "src/helpers/helpers.pyx":1119 - * B1[ind+2] = B[2] - * B2[ind] = B[3] - * B2[ind+1] = B[4] # <<<<<<<<<<<<<< - * B2[ind+2] = B[5] - * B3[ind] = B[6] + /* "View.MemoryView":1154 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride */ - (__pyx_v_B2[(__pyx_v_ind + 1)]) = (__pyx_v_B[4]); + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "src/helpers/helpers.pyx":1120 - * B2[ind] = B[3] - * B2[ind+1] = B[4] - * B2[ind+2] = B[5] # <<<<<<<<<<<<<< - * B3[ind] = B[6] - * B3[ind+1] = B[7] + /* "View.MemoryView":1155 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride */ - (__pyx_v_B2[(__pyx_v_ind + 2)]) = (__pyx_v_B[5]); + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); - /* "src/helpers/helpers.pyx":1121 - * B2[ind+1] = B[4] - * B2[ind+2] = B[5] - * B3[ind] = B[6] # <<<<<<<<<<<<<< - * B3[ind+1] = B[7] - * B3[ind+2] = B[8] + /* "View.MemoryView":1156 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: */ - (__pyx_v_B3[__pyx_v_ind]) = (__pyx_v_B[6]); + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "src/helpers/helpers.pyx":1122 - * B2[ind+2] = B[5] - * B3[ind] = B[6] - * B3[ind+1] = B[7] # <<<<<<<<<<<<<< - * B3[ind+2] = B[8] - * + /* "View.MemoryView":1157 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): */ - (__pyx_v_B3[(__pyx_v_ind + 1)]) = (__pyx_v_B[7]); + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; - /* "src/helpers/helpers.pyx":1123 - * B3[ind] = B[6] - * B3[ind+1] = B[7] - * B3[ind+2] = B[8] # <<<<<<<<<<<<<< + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * free(B) + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): */ - (__pyx_v_B3[(__pyx_v_ind + 2)]) = (__pyx_v_B[8]); - goto __pyx_L17; - __pyx_L12_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L16; - __pyx_L16:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates4) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_H1x; - __pyx_parallel_temp1 = __pyx_v_H1y; - __pyx_parallel_temp2 = __pyx_v_H1z; - __pyx_parallel_temp3 = __pyx_v_H2x; - __pyx_parallel_temp4 = __pyx_v_H2y; - __pyx_parallel_temp5 = __pyx_v_H2z; - __pyx_parallel_temp6 = __pyx_v_i; - __pyx_parallel_temp7 = __pyx_v_ind; - __pyx_parallel_temp8 = __pyx_v_k; - __pyx_parallel_temp9 = __pyx_v_n2; - __pyx_parallel_temp10 = __pyx_v_n3; - } - __pyx_L17:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_H1x = __pyx_parallel_temp0; - __pyx_v_H1y = __pyx_parallel_temp1; - __pyx_v_H1z = __pyx_parallel_temp2; - __pyx_v_H2x = __pyx_parallel_temp3; - __pyx_v_H2y = __pyx_parallel_temp4; - __pyx_v_H2z = __pyx_parallel_temp5; - __pyx_v_i = __pyx_parallel_temp6; - __pyx_v_ind = __pyx_parallel_temp7; - __pyx_v_k = __pyx_parallel_temp8; - __pyx_v_n2 = __pyx_parallel_temp9; - __pyx_v_n3 = __pyx_parallel_temp10; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L8_error; - } - } - } + goto __pyx_L3; + } - /* "src/helpers/helpers.pyx":1125 - * B3[ind+2] = B[8] - * - * free(B) # <<<<<<<<<<<<<< - * free(T) - * + /* "View.MemoryView":1159 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, */ - free(__pyx_v_B); + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "src/helpers/helpers.pyx":1126 - * - * free(B) - * free(T) # <<<<<<<<<<<<<< - * - * return py_dipt,py_B1,py_B2,py_B3 + /* "View.MemoryView":1160 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, */ - free(__pyx_v_T); - goto __pyx_L19; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L19; - __pyx_L19:; - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - /* "src/helpers/helpers.pyx":1056 - * cdef double *B3 = py_B3.data + /* "View.MemoryView":1164 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride * - * with nogil, parallel(): # <<<<<<<<<<<<<< - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } - } + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "src/helpers/helpers.pyx":1128 - * free(T) - * - * return py_dipt,py_B1,py_B2,py_B3 # <<<<<<<<<<<<<< + /* "View.MemoryView":1165 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_py_dipt)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_py_dipt)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_py_dipt)); - __Pyx_INCREF(((PyObject *)__pyx_v_py_B1)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_py_B1)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_py_B1)); - __Pyx_INCREF(((PyObject *)__pyx_v_py_B2)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_py_B2)); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_py_B2)); - __Pyx_INCREF(((PyObject *)__pyx_v_py_B3)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_py_B3)); - PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_py_B3)); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; - /* "src/helpers/helpers.pyx":1037 - * - * @cython.boundscheck(False) - * def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): # <<<<<<<<<<<<<< + /* "View.MemoryView":1137 * - * cdef int nwat = len(py_xyz)/3 # number of water molecules + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B3.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.helpers.NQRselfAndB", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B1.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B2.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B3.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_py_dipt); - __Pyx_XDECREF((PyObject *)__pyx_v_py_B1); - __Pyx_XDECREF((PyObject *)__pyx_v_py_B2); - __Pyx_XDECREF((PyObject *)__pyx_v_py_B3); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "src/helpers/helpers.pyx":1131 +/* "View.MemoryView":1167 + * dst_data += dst_stride * - * @cython.boundscheck(False) - * def NQRdipTen(np.ndarray[np.float64_t,ndim=2] py_xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] py_charges, - * aufpunkt): + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_55NQRdipTen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_55NQRdipTen = {"NQRdipTen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_55NQRdipTen, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_55NQRdipTen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_py_xyz = 0; - PyArrayObject *__pyx_v_py_charges = 0; - PyObject *__pyx_v_aufpunkt = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("NQRdipTen (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_xyz,&__pyx_n_s_py_charges,&__pyx_n_s_aufpunkt,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_xyz)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("NQRdipTen", 1, 3, 3, 1); __PYX_ERR(0, 1131, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("NQRdipTen", 1, 3, 3, 2); __PYX_ERR(0, 1131, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "NQRdipTen") < 0)) __PYX_ERR(0, 1131, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_py_xyz = ((PyArrayObject *)values[0]); - __pyx_v_py_charges = ((PyArrayObject *)values[1]); - __pyx_v_aufpunkt = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("NQRdipTen", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1131, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.NQRdipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_xyz), __pyx_ptype_5numpy_ndarray, 1, "py_xyz", 0))) __PYX_ERR(0, 1131, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_charges), __pyx_ptype_5numpy_ndarray, 1, "py_charges", 0))) __PYX_ERR(0, 1132, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_7helpers_54NQRdipTen(__pyx_self, __pyx_v_py_xyz, __pyx_v_py_charges, __pyx_v_aufpunkt); +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + + /* "View.MemoryView":1170 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) + * + */ + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + + /* "View.MemoryView":1167 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + */ /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_54NQRdipTen(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_py_xyz, PyArrayObject *__pyx_v_py_charges, PyObject *__pyx_v_aufpunkt) { - int __pyx_v_n; - int __pyx_v_auf; - int __pyx_v_auf3; - int __pyx_v_auf6; - double *__pyx_v_xyz; - double *__pyx_v_charges; - double __pyx_v_x; - double __pyx_v_y; - double __pyx_v_z; - double __pyx_v_r2; - double __pyx_v_f1; - double __pyx_v_f2; - double __pyx_v_f2_x; - double __pyx_v_f2_y; - double __pyx_v_f2_z; - double __pyx_v_auf_x1; - double __pyx_v_auf_y1; - double __pyx_v_auf_z1; - double __pyx_v_auf_x2; - double __pyx_v_auf_y2; - double __pyx_v_auf_z2; - double __pyx_v_tyH; - double __pyx_v_tzH; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - PyArrayObject *__pyx_v_pyE = 0; - PyArrayObject *__pyx_v_py_dipt = 0; - double *__pyx_v_dipt; - double *__pyx_v_E; - double *__pyx_v_B; - double *__pyx_v_T; - __Pyx_LocalBuf_ND __pyx_pybuffernd_pyE; - __Pyx_Buffer __pyx_pybuffer_pyE; - __Pyx_LocalBuf_ND __pyx_pybuffernd_py_charges; - __Pyx_Buffer __pyx_pybuffer_py_charges; - __Pyx_LocalBuf_ND __pyx_pybuffernd_py_dipt; - __Pyx_Buffer __pyx_pybuffer_py_dipt; - __Pyx_LocalBuf_ND __pyx_pybuffernd_py_xyz; - __Pyx_Buffer __pyx_pybuffer_py_xyz; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations +/* "View.MemoryView":1174 + * + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + */ + +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyArrayObject *__pyx_t_8 = NULL; - PyArrayObject *__pyx_t_9 = NULL; - long __pyx_t_10; - long __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - double __pyx_t_15; - long __pyx_t_16; - int __pyx_t_17; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("NQRdipTen", 0); - __pyx_pybuffer_pyE.pybuffer.buf = NULL; - __pyx_pybuffer_pyE.refcount = 0; - __pyx_pybuffernd_pyE.data = NULL; - __pyx_pybuffernd_pyE.rcbuffer = &__pyx_pybuffer_pyE; - __pyx_pybuffer_py_dipt.pybuffer.buf = NULL; - __pyx_pybuffer_py_dipt.refcount = 0; - __pyx_pybuffernd_py_dipt.data = NULL; - __pyx_pybuffernd_py_dipt.rcbuffer = &__pyx_pybuffer_py_dipt; - __pyx_pybuffer_py_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_py_xyz.refcount = 0; - __pyx_pybuffernd_py_xyz.data = NULL; - __pyx_pybuffernd_py_xyz.rcbuffer = &__pyx_pybuffer_py_xyz; - __pyx_pybuffer_py_charges.pybuffer.buf = NULL; - __pyx_pybuffer_py_charges.refcount = 0; - __pyx_pybuffernd_py_charges.data = NULL; - __pyx_pybuffernd_py_charges.rcbuffer = &__pyx_pybuffer_py_charges; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_py_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1131, __pyx_L1_error) - } - __pyx_pybuffernd_py_xyz.diminfo[0].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_xyz.diminfo[0].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_py_xyz.diminfo[1].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_py_xyz.diminfo[1].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_charges.rcbuffer->pybuffer, (PyObject*)__pyx_v_py_charges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1131, __pyx_L1_error) - } - __pyx_pybuffernd_py_charges.diminfo[0].strides = __pyx_pybuffernd_py_charges.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_charges.diminfo[0].shape = __pyx_pybuffernd_py_charges.rcbuffer->pybuffer.shape[0]; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; - /* "src/helpers/helpers.pyx":1135 - * aufpunkt): + /* "View.MemoryView":1176 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< * - * cdef int n = 3*len(py_xyz) # <<<<<<<<<<<<<< - * cdef int auf = 3*aufpunkt # x,y,z for each atom -> *3 - * cdef int auf3 = auf+3 + * for shape in src.shape[:ndim]: */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_py_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1135, __pyx_L1_error) - __pyx_v_n = (3 * __pyx_t_1); + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; - /* "src/helpers/helpers.pyx":1136 + /* "View.MemoryView":1178 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape * - * cdef int n = 3*len(py_xyz) - * cdef int auf = 3*aufpunkt # x,y,z for each atom -> *3 # <<<<<<<<<<<<<< - * cdef int auf3 = auf+3 - * cdef int auf6 = auf+6 */ - __pyx_t_2 = __Pyx_PyInt_From_int(((int)3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_aufpunkt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_auf = __pyx_t_4; + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); - /* "src/helpers/helpers.pyx":1137 - * cdef int n = 3*len(py_xyz) - * cdef int auf = 3*aufpunkt # x,y,z for each atom -> *3 - * cdef int auf3 = auf+3 # <<<<<<<<<<<<<< - * cdef int auf6 = auf+6 - * cdef double *xyz = py_xyz.data + /* "View.MemoryView":1179 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size */ - __pyx_v_auf3 = (__pyx_v_auf + 3); + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } - /* "src/helpers/helpers.pyx":1138 - * cdef int auf = 3*aufpunkt # x,y,z for each atom -> *3 - * cdef int auf3 = auf+3 - * cdef int auf6 = auf+6 # <<<<<<<<<<<<<< - * cdef double *xyz = py_xyz.data - * cdef double *charges = py_charges.data + /* "View.MemoryView":1181 + * size *= shape + * + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') */ - __pyx_v_auf6 = (__pyx_v_auf + 6); + __pyx_r = __pyx_v_size; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1139 - * cdef int auf3 = auf+3 - * cdef int auf6 = auf+6 - * cdef double *xyz = py_xyz.data # <<<<<<<<<<<<<< - * cdef double *charges = py_charges.data - * cdef double x,y,z, r2, f1,f2, f2_x,f2_y,f2_z, auf_x1,auf_y1,auf_z1,auf_x2,auf_y2,auf_z2 + /* "View.MemoryView":1174 + * + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ - __pyx_v_xyz = ((double *)__pyx_v_py_xyz->data); - /* "src/helpers/helpers.pyx":1140 - * cdef int auf6 = auf+6 - * cdef double *xyz = py_xyz.data - * cdef double *charges = py_charges.data # <<<<<<<<<<<<<< - * cdef double x,y,z, r2, f1,f2, f2_x,f2_y,f2_z, auf_x1,auf_y1,auf_z1,auf_x2,auf_y2,auf_z2 - * cdef double tyH = 1.63 - */ - __pyx_v_charges = ((double *)__pyx_v_py_charges->data); + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "src/helpers/helpers.pyx":1142 - * cdef double *charges = py_charges.data - * cdef double x,y,z, r2, f1,f2, f2_x,f2_y,f2_z, auf_x1,auf_y1,auf_z1,auf_x2,auf_y2,auf_z2 - * cdef double tyH = 1.63 # <<<<<<<<<<<<<< - * cdef double tzH = 1.158921913 - * cdef int i, j, k +/* "View.MemoryView":1184 + * + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ - __pyx_v_tyH = 1.63; - /* "src/helpers/helpers.pyx":1143 - * cdef double x,y,z, r2, f1,f2, f2_x,f2_y,f2_z, auf_x1,auf_y1,auf_z1,auf_x2,auf_y2,auf_z2 - * cdef double tyH = 1.63 - * cdef double tzH = 1.158921913 # <<<<<<<<<<<<<< - * cdef int i, j, k - * # cdef np.ndarray[np.float64_t,ndim=1] pyB = np.zeros(9,dtype=np.float64) # transformation matrix of aufpunkt wat - */ - __pyx_v_tzH = 1.158921913; +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; - /* "src/helpers/helpers.pyx":1146 - * cdef int i, j, k - * # cdef np.ndarray[np.float64_t,ndim=1] pyB = np.zeros(9,dtype=np.float64) # transformation matrix of aufpunkt wat - * cdef np.ndarray[np.float64_t,ndim=1] pyE = np.asarray([-2.0487,1.8086,0.2400],dtype=np.float64) # EFG matrix from Boykin # <<<<<<<<<<<<<< - * # cdef np.ndarray[np.float64_t,ndim=1] pyT = np.zeros(9,dtype=np.float64) # temp matrix for mult - * #cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(15,dtype=np.float64) + /* "View.MemoryView":1193 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_float_neg_2_0487); - __Pyx_GIVEREF(__pyx_float_neg_2_0487); - PyList_SET_ITEM(__pyx_t_3, 0, __pyx_float_neg_2_0487); - __Pyx_INCREF(__pyx_float_1_8086); - __Pyx_GIVEREF(__pyx_float_1_8086); - PyList_SET_ITEM(__pyx_t_3, 1, __pyx_float_1_8086); - __Pyx_INCREF(__pyx_float_0_2400); - __Pyx_GIVEREF(__pyx_float_0_2400); - PyList_SET_ITEM(__pyx_t_3, 2, __pyx_float_0_2400); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 1146, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1146, __pyx_L1_error) - __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pyE.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_pyE = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_pyE.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 1146, __pyx_L1_error) - } else {__pyx_pybuffernd_pyE.diminfo[0].strides = __pyx_pybuffernd_pyE.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pyE.diminfo[0].shape = __pyx_pybuffernd_pyE.rcbuffer->pybuffer.shape[0]; - } - } - __pyx_t_8 = 0; - __pyx_v_pyE = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":1149 - * # cdef np.ndarray[np.float64_t,ndim=1] pyT = np.zeros(9,dtype=np.float64) # temp matrix for mult - * #cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(15,dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=2] py_dipt = np.zeros((n/3,15),dtype=np.float64) # <<<<<<<<<<<<<< + /* "View.MemoryView":1194 * - * cdef double *dipt = py_dipt.data + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_From_long(__Pyx_div_long(__pyx_v_n, 3)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); - __Pyx_INCREF(__pyx_int_15); - __Pyx_GIVEREF(__pyx_int_15); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_15); - __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 1149, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1149, __pyx_L1_error) - __pyx_t_9 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_py_dipt = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 1149, __pyx_L1_error) - } else {__pyx_pybuffernd_py_dipt.diminfo[0].strides = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_dipt.diminfo[0].shape = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_py_dipt.diminfo[1].strides = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_py_dipt.diminfo[1].shape = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.shape[1]; + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1195 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: + */ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1196 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): + */ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } - } - __pyx_t_9 = 0; - __pyx_v_py_dipt = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - /* "src/helpers/helpers.pyx":1151 - * cdef np.ndarray[np.float64_t,ndim=2] py_dipt = np.zeros((n/3,15),dtype=np.float64) + /* "View.MemoryView":1193 + * cdef int idx * - * cdef double *dipt = py_dipt.data # <<<<<<<<<<<<<< - * # cdef double *B = malloc(sizeof(double) * 9) - * # cdef double *T = malloc(sizeof(double) * 9) + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ - __pyx_v_dipt = ((double *)__pyx_v_py_dipt->data); + goto __pyx_L3; + } - /* "src/helpers/helpers.pyx":1154 - * # cdef double *B = malloc(sizeof(double) * 9) - * # cdef double *T = malloc(sizeof(double) * 9) - * cdef double *E = pyE.data # <<<<<<<<<<<<<< - * - * with nogil, parallel(): + /* "View.MemoryView":1198 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] */ - __pyx_v_E = ((double *)__pyx_v_pyE->data); + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; - /* "src/helpers/helpers.pyx":1156 - * cdef double *E = pyE.data + /* "View.MemoryView":1199 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] * - * with nogil, parallel(): # <<<<<<<<<<<<<< - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - { - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - #ifdef _OPENMP - #pragma omp parallel private(__pyx_v_B, __pyx_v_T) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_4) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - /* Initialize private variables to invalid values */ - __pyx_v_B = ((double *)1); - __pyx_v_T = ((double *)1); + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "src/helpers/helpers.pyx":1157 + /* "View.MemoryView":1200 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< * - * with nogil, parallel(): - * B = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< - * T = malloc(sizeof(double) * 9) - * for i in prange(0,n,3): # dip-dip T for to all atoms on every other molecule + * return stride */ - __pyx_v_B = ((double *)malloc(((sizeof(double)) * 9))); + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + } + __pyx_L3:; - /* "src/helpers/helpers.pyx":1158 - * with nogil, parallel(): - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< - * for i in prange(0,n,3): # dip-dip T for to all atoms on every other molecule - * j = i/3 * 15 + /* "View.MemoryView":1202 + * stride *= shape[idx] + * + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') */ - __pyx_v_T = ((double *)malloc(((sizeof(double)) * 9))); + __pyx_r = __pyx_v_stride; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1159 - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) - * for i in prange(0,n,3): # dip-dip T for to all atoms on every other molecule # <<<<<<<<<<<<<< - * j = i/3 * 15 - * for k in range(9): + /* "View.MemoryView":1184 + * + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ - __pyx_t_4 = __pyx_v_n; - if ((3 == 0)) abort(); - { - double __pyx_parallel_temp0 = ((double)__PYX_NAN()); - double __pyx_parallel_temp1 = ((double)__PYX_NAN()); - double __pyx_parallel_temp2 = ((double)__PYX_NAN()); - double __pyx_parallel_temp3 = ((double)__PYX_NAN()); - double __pyx_parallel_temp4 = ((double)__PYX_NAN()); - double __pyx_parallel_temp5 = ((double)__PYX_NAN()); - double __pyx_parallel_temp6 = ((double)__PYX_NAN()); - double __pyx_parallel_temp7 = ((double)__PYX_NAN()); - double __pyx_parallel_temp8 = ((double)__PYX_NAN()); - double __pyx_parallel_temp9 = ((double)__PYX_NAN()); - double __pyx_parallel_temp10 = ((double)__PYX_NAN()); - int __pyx_parallel_temp11 = ((int)0xbad0bad0); - int __pyx_parallel_temp12 = ((int)0xbad0bad0); - int __pyx_parallel_temp13 = ((int)0xbad0bad0); - double __pyx_parallel_temp14 = ((double)__PYX_NAN()); - double __pyx_parallel_temp15 = ((double)__PYX_NAN()); - double __pyx_parallel_temp16 = ((double)__PYX_NAN()); - double __pyx_parallel_temp17 = ((double)__PYX_NAN()); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - __pyx_t_11 = (__pyx_t_4 - 0 + 3 - 3/abs(3)) / 3; - if (__pyx_t_11 > 0) - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_auf_x1) lastprivate(__pyx_v_auf_x2) lastprivate(__pyx_v_auf_y1) lastprivate(__pyx_v_auf_y2) lastprivate(__pyx_v_auf_z1) lastprivate(__pyx_v_auf_z2) lastprivate(__pyx_v_f1) lastprivate(__pyx_v_f2) lastprivate(__pyx_v_f2_x) lastprivate(__pyx_v_f2_y) lastprivate(__pyx_v_f2_z) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_r2) lastprivate(__pyx_v_x) lastprivate(__pyx_v_y) lastprivate(__pyx_v_z) - #endif /* _OPENMP */ - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_i = (int)(0 + 3 * __pyx_t_10); - /* Initialize private variables to invalid values */ - __pyx_v_auf_x1 = ((double)__PYX_NAN()); - __pyx_v_auf_x2 = ((double)__PYX_NAN()); - __pyx_v_auf_y1 = ((double)__PYX_NAN()); - __pyx_v_auf_y2 = ((double)__PYX_NAN()); - __pyx_v_auf_z1 = ((double)__PYX_NAN()); - __pyx_v_auf_z2 = ((double)__PYX_NAN()); - __pyx_v_f1 = ((double)__PYX_NAN()); - __pyx_v_f2 = ((double)__PYX_NAN()); - __pyx_v_f2_x = ((double)__PYX_NAN()); - __pyx_v_f2_y = ((double)__PYX_NAN()); - __pyx_v_f2_z = ((double)__PYX_NAN()); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); - __pyx_v_r2 = ((double)__PYX_NAN()); - __pyx_v_x = ((double)__PYX_NAN()); - __pyx_v_y = ((double)__PYX_NAN()); - __pyx_v_z = ((double)__PYX_NAN()); - /* "src/helpers/helpers.pyx":1160 - * T = malloc(sizeof(double) * 9) - * for i in prange(0,n,3): # dip-dip T for to all atoms on every other molecule - * j = i/3 * 15 # <<<<<<<<<<<<<< - * for k in range(9): - * B[k] = 0.0 - */ - __pyx_v_j = (__Pyx_div_long(__pyx_v_i, 3) * 15); + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "src/helpers/helpers.pyx":1161 - * for i in prange(0,n,3): # dip-dip T for to all atoms on every other molecule - * j = i/3 * 15 - * for k in range(9): # <<<<<<<<<<<<<< - * B[k] = 0.0 - * T[k] = 0.0 +/* "View.MemoryView":1205 + * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ - for (__pyx_t_12 = 0; __pyx_t_12 < 9; __pyx_t_12+=1) { - __pyx_v_k = __pyx_t_12; - /* "src/helpers/helpers.pyx":1162 - * j = i/3 * 15 - * for k in range(9): - * B[k] = 0.0 # <<<<<<<<<<<<<< - * T[k] = 0.0 - * if i!=auf and i!=auf3 and i!=auf6: +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("copy_data_to_temp", 1); + + /* "View.MemoryView":1216 + * cdef void *result + * + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) + * */ - (__pyx_v_B[__pyx_v_k]) = 0.0; + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "src/helpers/helpers.pyx":1163 - * for k in range(9): - * B[k] = 0.0 - * T[k] = 0.0 # <<<<<<<<<<<<<< - * if i!=auf and i!=auf3 and i!=auf6: - * x = xyz[i] + /* "View.MemoryView":1217 + * + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) */ - (__pyx_v_T[__pyx_v_k]) = 0.0; - } + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - /* "src/helpers/helpers.pyx":1164 - * B[k] = 0.0 - * T[k] = 0.0 - * if i!=auf and i!=auf3 and i!=auf6: # <<<<<<<<<<<<<< - * x = xyz[i] - * y = xyz[i+1] + /* "View.MemoryView":1219 + * cdef size_t size = slice_get_size(src, ndim) + * + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() */ - __pyx_t_14 = ((__pyx_v_i != __pyx_v_auf) != 0); - if (__pyx_t_14) { - } else { - __pyx_t_13 = __pyx_t_14; - goto __pyx_L17_bool_binop_done; - } - __pyx_t_14 = ((__pyx_v_i != __pyx_v_auf3) != 0); - if (__pyx_t_14) { - } else { - __pyx_t_13 = __pyx_t_14; - goto __pyx_L17_bool_binop_done; - } - __pyx_t_14 = ((__pyx_v_i != __pyx_v_auf6) != 0); - __pyx_t_13 = __pyx_t_14; - __pyx_L17_bool_binop_done:; - if (__pyx_t_13) { + __pyx_v_result = malloc(__pyx_v_size); - /* "src/helpers/helpers.pyx":1165 - * T[k] = 0.0 - * if i!=auf and i!=auf3 and i!=auf6: - * x = xyz[i] # <<<<<<<<<<<<<< - * y = xyz[i+1] - * z = xyz[i+2] + /* "View.MemoryView":1220 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * */ - __pyx_v_x = (__pyx_v_xyz[__pyx_v_i]); + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1166 - * if i!=auf and i!=auf3 and i!=auf6: - * x = xyz[i] - * y = xyz[i+1] # <<<<<<<<<<<<<< - * z = xyz[i+2] - * r2 = x*x+y*y+z*z + /* "View.MemoryView":1221 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * */ - __pyx_v_y = (__pyx_v_xyz[(__pyx_v_i + 1)]); + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1167 - * x = xyz[i] - * y = xyz[i+1] - * z = xyz[i+2] # <<<<<<<<<<<<<< - * r2 = x*x+y*y+z*z - * f1 = pow(r2,-1.5) * charges[i/3] + /* "View.MemoryView":1220 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * */ - __pyx_v_z = (__pyx_v_xyz[(__pyx_v_i + 2)]); + } - /* "src/helpers/helpers.pyx":1168 - * y = xyz[i+1] - * z = xyz[i+2] - * r2 = x*x+y*y+z*z # <<<<<<<<<<<<<< - * f1 = pow(r2,-1.5) * charges[i/3] - * f2 = 3.0 * f1 / r2 + /* "View.MemoryView":1224 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): */ - __pyx_v_r2 = (((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)) + (__pyx_v_z * __pyx_v_z)); + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - /* "src/helpers/helpers.pyx":1169 - * z = xyz[i+2] - * r2 = x*x+y*y+z*z - * f1 = pow(r2,-1.5) * charges[i/3] # <<<<<<<<<<<<<< - * f2 = 3.0 * f1 / r2 - * f2_x = f2 * x + /* "View.MemoryView":1225 + * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] */ - __pyx_v_f1 = (pow(__pyx_v_r2, -1.5) * (__pyx_v_charges[__Pyx_div_long(__pyx_v_i, 3)])); + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; - /* "src/helpers/helpers.pyx":1170 - * r2 = x*x+y*y+z*z - * f1 = pow(r2,-1.5) * charges[i/3] - * f2 = 3.0 * f1 / r2 # <<<<<<<<<<<<<< - * f2_x = f2 * x - * f2_y = f2 * y + /* "View.MemoryView":1226 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 */ - __pyx_t_15 = (3.0 * __pyx_v_f1); - if (unlikely(__pyx_v_r2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1170, __pyx_L12_error) - } - __pyx_v_f2 = (__pyx_t_15 / __pyx_v_r2); + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "src/helpers/helpers.pyx":1171 - * f1 = pow(r2,-1.5) * charges[i/3] - * f2 = 3.0 * f1 / r2 - * f2_x = f2 * x # <<<<<<<<<<<<<< - * f2_y = f2 * y - * f2_z = f2 * z + /* "View.MemoryView":1227 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 + * */ - __pyx_v_f2_x = (__pyx_v_f2 * __pyx_v_x); + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - /* "src/helpers/helpers.pyx":1172 - * f2 = 3.0 * f1 / r2 - * f2_x = f2 * x - * f2_y = f2 * y # <<<<<<<<<<<<<< - * f2_z = f2 * z - * dipt[j] += f2_x * x - f1 + /* "View.MemoryView":1228 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) */ - __pyx_v_f2_y = (__pyx_v_f2 * __pyx_v_y); + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } - /* "src/helpers/helpers.pyx":1173 - * f2_x = f2 * x - * f2_y = f2 * y - * f2_z = f2 * z # <<<<<<<<<<<<<< - * dipt[j] += f2_x * x - f1 - * dipt[j+1] += f2_y * y - f1 + /* "View.MemoryView":1230 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * */ - __pyx_v_f2_z = (__pyx_v_f2 * __pyx_v_z); + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - /* "src/helpers/helpers.pyx":1174 - * f2_y = f2 * y - * f2_z = f2 * z - * dipt[j] += f2_x * x - f1 # <<<<<<<<<<<<<< - * dipt[j+1] += f2_y * y - f1 - * dipt[j+2] += f2_z * z - f1 + /* "View.MemoryView":1233 + * + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 */ - __pyx_t_12 = __pyx_v_j; - (__pyx_v_dipt[__pyx_t_12]) = ((__pyx_v_dipt[__pyx_t_12]) + ((__pyx_v_f2_x * __pyx_v_x) - __pyx_v_f1)); + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "src/helpers/helpers.pyx":1175 - * f2_z = f2 * z - * dipt[j] += f2_x * x - f1 - * dipt[j+1] += f2_y * y - f1 # <<<<<<<<<<<<<< - * dipt[j+2] += f2_z * z - f1 - * dipt[j+3] += f2_x * y + /* "View.MemoryView":1234 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * */ - __pyx_t_16 = (__pyx_v_j + 1); - (__pyx_v_dipt[__pyx_t_16]) = ((__pyx_v_dipt[__pyx_t_16]) + ((__pyx_v_f2_y * __pyx_v_y) - __pyx_v_f1)); + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1176 - * dipt[j] += f2_x * x - f1 - * dipt[j+1] += f2_y * y - f1 - * dipt[j+2] += f2_z * z - f1 # <<<<<<<<<<<<<< - * dipt[j+3] += f2_x * y - * dipt[j+4] += f2_x * z + /* "View.MemoryView":1235 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): */ - __pyx_t_16 = (__pyx_v_j + 2); - (__pyx_v_dipt[__pyx_t_16]) = ((__pyx_v_dipt[__pyx_t_16]) + ((__pyx_v_f2_z * __pyx_v_z) - __pyx_v_f1)); + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - /* "src/helpers/helpers.pyx":1177 - * dipt[j+1] += f2_y * y - f1 - * dipt[j+2] += f2_z * z - f1 - * dipt[j+3] += f2_x * y # <<<<<<<<<<<<<< - * dipt[j+4] += f2_x * z - * dipt[j+5] += f2_y * z + /* "View.MemoryView":1234 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * */ - __pyx_t_16 = (__pyx_v_j + 3); - (__pyx_v_dipt[__pyx_t_16]) = ((__pyx_v_dipt[__pyx_t_16]) + (__pyx_v_f2_x * __pyx_v_y)); + } + } - /* "src/helpers/helpers.pyx":1178 - * dipt[j+2] += f2_z * z - f1 - * dipt[j+3] += f2_x * y - * dipt[j+4] += f2_x * z # <<<<<<<<<<<<<< - * dipt[j+5] += f2_y * z - * elif i == auf: + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - __pyx_t_16 = (__pyx_v_j + 4); - (__pyx_v_dipt[__pyx_t_16]) = ((__pyx_v_dipt[__pyx_t_16]) + (__pyx_v_f2_x * __pyx_v_z)); + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1179 - * dipt[j+3] += f2_x * y - * dipt[j+4] += f2_x * z - * dipt[j+5] += f2_y * z # <<<<<<<<<<<<<< - * elif i == auf: - * auf_x1 = xyz[auf+3] + /* "View.MemoryView":1238 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) */ - __pyx_t_16 = (__pyx_v_j + 5); - (__pyx_v_dipt[__pyx_t_16]) = ((__pyx_v_dipt[__pyx_t_16]) + (__pyx_v_f2_y * __pyx_v_z)); + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - /* "src/helpers/helpers.pyx":1164 - * B[k] = 0.0 - * T[k] = 0.0 - * if i!=auf and i!=auf3 and i!=auf6: # <<<<<<<<<<<<<< - * x = xyz[i] - * y = xyz[i+1] + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - goto __pyx_L16; - } + goto __pyx_L9; + } - /* "src/helpers/helpers.pyx":1180 - * dipt[j+4] += f2_x * z - * dipt[j+5] += f2_y * z - * elif i == auf: # <<<<<<<<<<<<<< - * auf_x1 = xyz[auf+3] - * auf_y1 = xyz[auf+4] + /* "View.MemoryView":1240 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * + * return result */ - __pyx_t_13 = ((__pyx_v_i == __pyx_v_auf) != 0); - if (__pyx_t_13) { + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; - /* "src/helpers/helpers.pyx":1181 - * dipt[j+5] += f2_y * z - * elif i == auf: - * auf_x1 = xyz[auf+3] # <<<<<<<<<<<<<< - * auf_y1 = xyz[auf+4] - * auf_z1 = xyz[auf+5] + /* "View.MemoryView":1242 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * + * return result # <<<<<<<<<<<<<< + * + * */ - __pyx_v_auf_x1 = (__pyx_v_xyz[(__pyx_v_auf + 3)]); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1182 - * elif i == auf: - * auf_x1 = xyz[auf+3] - * auf_y1 = xyz[auf+4] # <<<<<<<<<<<<<< - * auf_z1 = xyz[auf+5] - * auf_x2 = xyz[auf+6] + /* "View.MemoryView":1205 + * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ - __pyx_v_auf_y1 = (__pyx_v_xyz[(__pyx_v_auf + 4)]); - /* "src/helpers/helpers.pyx":1183 - * auf_x1 = xyz[auf+3] - * auf_y1 = xyz[auf+4] - * auf_z1 = xyz[auf+5] # <<<<<<<<<<<<<< - * auf_x2 = xyz[auf+6] - * auf_y2 = xyz[auf+7] - */ - __pyx_v_auf_z1 = (__pyx_v_xyz[(__pyx_v_auf + 5)]); + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} - /* "src/helpers/helpers.pyx":1184 - * auf_y1 = xyz[auf+4] - * auf_z1 = xyz[auf+5] - * auf_x2 = xyz[auf+6] # <<<<<<<<<<<<<< - * auf_y2 = xyz[auf+7] - * auf_z2 = xyz[auf+8] +/* "View.MemoryView":1247 + * + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ - __pyx_v_auf_x2 = (__pyx_v_xyz[(__pyx_v_auf + 6)]); - /* "src/helpers/helpers.pyx":1185 - * auf_z1 = xyz[auf+5] - * auf_x2 = xyz[auf+6] - * auf_y2 = xyz[auf+7] # <<<<<<<<<<<<<< - * auf_z2 = xyz[auf+8] +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_UCS4 __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1249 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< * + * @cname('__pyx_memoryview_err_dim') */ - __pyx_v_auf_y2 = (__pyx_v_xyz[(__pyx_v_auf + 7)]); + __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 127; + __Pyx_INCREF(__pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_2 += 35; + __Pyx_GIVEREF(__pyx_kp_u_got_differing_extents_in_dimensi); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_got); + __pyx_t_2 += 6; + __Pyx_GIVEREF(__pyx_kp_u_got); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_got); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_and); + __pyx_t_2 += 5; + __Pyx_GIVEREF(__pyx_kp_u_and); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_and); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_2 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__7); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 1249, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1186 - * auf_x2 = xyz[auf+6] - * auf_y2 = xyz[auf+7] - * auf_z2 = xyz[auf+8] # <<<<<<<<<<<<<< + /* "View.MemoryView":1247 * - * B[3] = (auf_x1-auf_x2)/tyH + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ - __pyx_v_auf_z2 = (__pyx_v_xyz[(__pyx_v_auf + 8)]); - /* "src/helpers/helpers.pyx":1188 - * auf_z2 = xyz[auf+8] + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1252 + * + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * - * B[3] = (auf_x1-auf_x2)/tyH # <<<<<<<<<<<<<< - * B[4] = (auf_y1-auf_y2)/tyH - * B[5] = (auf_z1-auf_z2)/tyH */ - __pyx_t_15 = (__pyx_v_auf_x1 - __pyx_v_auf_x2); - if (unlikely(__pyx_v_tyH == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1188, __pyx_L12_error) - } - (__pyx_v_B[3]) = (__pyx_t_15 / __pyx_v_tyH); - /* "src/helpers/helpers.pyx":1189 +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1253 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< * - * B[3] = (auf_x1-auf_x2)/tyH - * B[4] = (auf_y1-auf_y2)/tyH # <<<<<<<<<<<<<< - * B[5] = (auf_z1-auf_z2)/tyH - * B[6] = (auf_x1+auf_x2)/tzH + * @cname('__pyx_memoryview_err') */ - __pyx_t_15 = (__pyx_v_auf_y1 - __pyx_v_auf_y2); - if (unlikely(__pyx_v_tyH == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1189, __pyx_L12_error) - } - (__pyx_v_B[4]) = (__pyx_t_15 / __pyx_v_tyH); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1253, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1190 - * B[3] = (auf_x1-auf_x2)/tyH - * B[4] = (auf_y1-auf_y2)/tyH - * B[5] = (auf_z1-auf_z2)/tyH # <<<<<<<<<<<<<< - * B[6] = (auf_x1+auf_x2)/tzH - * B[7] = (auf_y1+auf_y2)/tzH + /* "View.MemoryView":1252 + * + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim + * */ - __pyx_t_15 = (__pyx_v_auf_z1 - __pyx_v_auf_z2); - if (unlikely(__pyx_v_tyH == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1190, __pyx_L12_error) - } - (__pyx_v_B[5]) = (__pyx_t_15 / __pyx_v_tyH); - /* "src/helpers/helpers.pyx":1191 - * B[4] = (auf_y1-auf_y2)/tyH - * B[5] = (auf_z1-auf_z2)/tyH - * B[6] = (auf_x1+auf_x2)/tzH # <<<<<<<<<<<<<< - * B[7] = (auf_y1+auf_y2)/tzH - * B[8] = (auf_z1+auf_z2)/tzH - */ - __pyx_t_15 = (__pyx_v_auf_x1 + __pyx_v_auf_x2); - if (unlikely(__pyx_v_tzH == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1191, __pyx_L12_error) - } - (__pyx_v_B[6]) = (__pyx_t_15 / __pyx_v_tzH); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} - /* "src/helpers/helpers.pyx":1192 - * B[5] = (auf_z1-auf_z2)/tyH - * B[6] = (auf_x1+auf_x2)/tzH - * B[7] = (auf_y1+auf_y2)/tzH # <<<<<<<<<<<<<< - * B[8] = (auf_z1+auf_z2)/tzH - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product +/* "View.MemoryView":1256 + * + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg + * */ - __pyx_t_15 = (__pyx_v_auf_y1 + __pyx_v_auf_y2); - if (unlikely(__pyx_v_tzH == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1192, __pyx_L12_error) - } - (__pyx_v_B[7]) = (__pyx_t_15 / __pyx_v_tzH); - /* "src/helpers/helpers.pyx":1193 - * B[6] = (auf_x1+auf_x2)/tzH - * B[7] = (auf_y1+auf_y2)/tzH - * B[8] = (auf_z1+auf_z2)/tzH # <<<<<<<<<<<<<< - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product - * B[1] = B[5]*B[6]-B[3]*B[8] - */ - __pyx_t_15 = (__pyx_v_auf_z1 + __pyx_v_auf_z2); - if (unlikely(__pyx_v_tzH == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1193, __pyx_L12_error) - } - (__pyx_v_B[8]) = (__pyx_t_15 / __pyx_v_tzH); +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); - /* "src/helpers/helpers.pyx":1194 - * B[7] = (auf_y1+auf_y2)/tzH - * B[8] = (auf_z1+auf_z2)/tzH - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product # <<<<<<<<<<<<<< - * B[1] = B[5]*B[6]-B[3]*B[8] - * B[2] = B[3]*B[7]-B[4]*B[6] + /* "View.MemoryView":1257 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_err_no_memory') */ - (__pyx_v_B[0]) = (((__pyx_v_B[4]) * (__pyx_v_B[8])) - ((__pyx_v_B[5]) * (__pyx_v_B[7]))); + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1257, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1195 - * B[8] = (auf_z1+auf_z2)/tzH - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product - * B[1] = B[5]*B[6]-B[3]*B[8] # <<<<<<<<<<<<<< - * B[2] = B[3]*B[7]-B[4]*B[6] + /* "View.MemoryView":1256 + * + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg * */ - (__pyx_v_B[1]) = (((__pyx_v_B[5]) * (__pyx_v_B[6])) - ((__pyx_v_B[3]) * (__pyx_v_B[8]))); - /* "src/helpers/helpers.pyx":1196 - * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product - * B[1] = B[5]*B[6]-B[3]*B[8] - * B[2] = B[3]*B[7]-B[4]*B[6] # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1260 + * + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * - * T[0] = B[0]*E[0] */ - (__pyx_v_B[2]) = (((__pyx_v_B[3]) * (__pyx_v_B[7])) - ((__pyx_v_B[4]) * (__pyx_v_B[6]))); - /* "src/helpers/helpers.pyx":1198 - * B[2] = B[3]*B[7]-B[4]*B[6] +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_no_memory", 0); + + /* "View.MemoryView":1261 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * * - * T[0] = B[0]*E[0] # <<<<<<<<<<<<<< - * T[1] = B[1]*E[0] - * T[2] = B[2]*E[0] */ - (__pyx_v_T[0]) = ((__pyx_v_B[0]) * (__pyx_v_E[0])); + PyErr_NoMemory(); __PYX_ERR(1, 1261, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1199 + /* "View.MemoryView":1260 + * + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * - * T[0] = B[0]*E[0] - * T[1] = B[1]*E[0] # <<<<<<<<<<<<<< - * T[2] = B[2]*E[0] - * T[3] = B[3]*E[1] */ - (__pyx_v_T[1]) = ((__pyx_v_B[1]) * (__pyx_v_E[0])); - /* "src/helpers/helpers.pyx":1200 - * T[0] = B[0]*E[0] - * T[1] = B[1]*E[0] - * T[2] = B[2]*E[0] # <<<<<<<<<<<<<< - * T[3] = B[3]*E[1] - * T[4] = B[4]*E[1] + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1265 + * + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ - (__pyx_v_T[2]) = ((__pyx_v_B[2]) * (__pyx_v_E[0])); - /* "src/helpers/helpers.pyx":1201 - * T[1] = B[1]*E[0] - * T[2] = B[2]*E[0] - * T[3] = B[3]*E[1] # <<<<<<<<<<<<<< - * T[4] = B[4]*E[1] - * T[5] = B[5]*E[1] +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("memoryview_copy_contents", 1); + + /* "View.MemoryView":1273 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i */ - (__pyx_v_T[3]) = ((__pyx_v_B[3]) * (__pyx_v_E[1])); + __pyx_v_tmpdata = NULL; - /* "src/helpers/helpers.pyx":1202 - * T[2] = B[2]*E[0] - * T[3] = B[3]*E[1] - * T[4] = B[4]*E[1] # <<<<<<<<<<<<<< - * T[5] = B[5]*E[1] - * T[6] = B[6]*E[2] + /* "View.MemoryView":1274 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) */ - (__pyx_v_T[4]) = ((__pyx_v_B[4]) * (__pyx_v_E[1])); + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "src/helpers/helpers.pyx":1203 - * T[3] = B[3]*E[1] - * T[4] = B[4]*E[1] - * T[5] = B[5]*E[1] # <<<<<<<<<<<<<< - * T[6] = B[6]*E[2] - * T[7] = B[7]*E[2] + /* "View.MemoryView":1276 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False */ - (__pyx_v_T[5]) = ((__pyx_v_B[5]) * (__pyx_v_E[1])); + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); - /* "src/helpers/helpers.pyx":1204 - * T[4] = B[4]*E[1] - * T[5] = B[5]*E[1] - * T[6] = B[6]*E[2] # <<<<<<<<<<<<<< - * T[7] = B[7]*E[2] - * T[8] = B[8]*E[2] + /* "View.MemoryView":1277 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp */ - (__pyx_v_T[6]) = ((__pyx_v_B[6]) * (__pyx_v_E[2])); + __pyx_v_broadcasting = 0; - /* "src/helpers/helpers.pyx":1205 - * T[5] = B[5]*E[1] - * T[6] = B[6]*E[2] - * T[7] = B[7]*E[2] # <<<<<<<<<<<<<< - * T[8] = B[8]*E[2] + /* "View.MemoryView":1278 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp * */ - (__pyx_v_T[7]) = ((__pyx_v_B[7]) * (__pyx_v_E[2])); + __pyx_v_direct_copy = 0; - /* "src/helpers/helpers.pyx":1206 - * T[6] = B[6]*E[2] - * T[7] = B[7]*E[2] - * T[8] = B[8]*E[2] # <<<<<<<<<<<<<< + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp * - * dipt[j+6] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ - (__pyx_v_T[8]) = ((__pyx_v_B[8]) * (__pyx_v_E[2])); + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1208 - * T[8] = B[8]*E[2] + /* "View.MemoryView":1282 * - * dipt[j+6] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # <<<<<<<<<<<<<< - * dipt[j+7] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] - * dipt[j+8] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) */ - (__pyx_v_dipt[(__pyx_v_j + 6)]) = ((((__pyx_v_T[0]) * (__pyx_v_B[0])) + ((__pyx_v_T[3]) * (__pyx_v_B[3]))) + ((__pyx_v_T[6]) * (__pyx_v_B[6]))); + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); - /* "src/helpers/helpers.pyx":1209 + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp * - * dipt[j+6] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] - * dipt[j+7] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # <<<<<<<<<<<<<< - * dipt[j+8] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] - * dipt[j+9] = T[0]*B[1]+T[3]*B[4]+T[6]*B[7] + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ - (__pyx_v_dipt[(__pyx_v_j + 7)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[0])) + ((__pyx_v_T[4]) * (__pyx_v_B[3]))) + ((__pyx_v_T[7]) * (__pyx_v_B[6]))); + goto __pyx_L3; + } - /* "src/helpers/helpers.pyx":1210 - * dipt[j+6] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] - * dipt[j+7] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] - * dipt[j+8] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # <<<<<<<<<<<<<< - * dipt[j+9] = T[0]*B[1]+T[3]*B[4]+T[6]*B[7] - * dipt[j+10] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * */ - (__pyx_v_dipt[(__pyx_v_j + 8)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[0])) + ((__pyx_v_T[5]) * (__pyx_v_B[3]))) + ((__pyx_v_T[8]) * (__pyx_v_B[6]))); + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1211 - * dipt[j+7] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] - * dipt[j+8] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] - * dipt[j+9] = T[0]*B[1]+T[3]*B[4]+T[6]*B[7] # <<<<<<<<<<<<<< - * dipt[j+10] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] - * dipt[j+11] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] + /* "View.MemoryView":1284 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) */ - (__pyx_v_dipt[(__pyx_v_j + 9)]) = ((((__pyx_v_T[0]) * (__pyx_v_B[1])) + ((__pyx_v_T[3]) * (__pyx_v_B[4]))) + ((__pyx_v_T[6]) * (__pyx_v_B[7]))); + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - /* "src/helpers/helpers.pyx":1212 - * dipt[j+8] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] - * dipt[j+9] = T[0]*B[1]+T[3]*B[4]+T[6]*B[7] - * dipt[j+10] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # <<<<<<<<<<<<<< - * dipt[j+11] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] - * dipt[j+12] = T[0]*B[2]+T[3]*B[5]+T[6]*B[8] + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * */ - (__pyx_v_dipt[(__pyx_v_j + 10)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[1])) + ((__pyx_v_T[4]) * (__pyx_v_B[4]))) + ((__pyx_v_T[7]) * (__pyx_v_B[7]))); + } + __pyx_L3:; - /* "src/helpers/helpers.pyx":1213 - * dipt[j+9] = T[0]*B[1]+T[3]*B[4]+T[6]*B[7] - * dipt[j+10] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] - * dipt[j+11] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # <<<<<<<<<<<<<< - * dipt[j+12] = T[0]*B[2]+T[3]*B[5]+T[6]*B[8] - * dipt[j+13] = T[1]*B[2]+T[4]*B[5]+T[7]*B[8] + /* "View.MemoryView":1286 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): */ - (__pyx_v_dipt[(__pyx_v_j + 11)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[1])) + ((__pyx_v_T[5]) * (__pyx_v_B[4]))) + ((__pyx_v_T[8]) * (__pyx_v_B[7]))); + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; - /* "src/helpers/helpers.pyx":1214 - * dipt[j+10] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] - * dipt[j+11] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] - * dipt[j+12] = T[0]*B[2]+T[3]*B[5]+T[6]*B[8] # <<<<<<<<<<<<<< - * dipt[j+13] = T[1]*B[2]+T[4]*B[5]+T[7]*B[8] - * dipt[j+14] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] + /* "View.MemoryView":1288 + * cdef int ndim = max(src_ndim, dst_ndim) + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: */ - (__pyx_v_dipt[(__pyx_v_j + 12)]) = ((((__pyx_v_T[0]) * (__pyx_v_B[2])) + ((__pyx_v_T[3]) * (__pyx_v_B[5]))) + ((__pyx_v_T[6]) * (__pyx_v_B[8]))); + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/helpers.pyx":1215 - * dipt[j+11] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] - * dipt[j+12] = T[0]*B[2]+T[3]*B[5]+T[6]*B[8] - * dipt[j+13] = T[1]*B[2]+T[4]*B[5]+T[7]*B[8] # <<<<<<<<<<<<<< - * dipt[j+14] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] - * else: + /* "View.MemoryView":1289 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ - (__pyx_v_dipt[(__pyx_v_j + 13)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[2])) + ((__pyx_v_T[4]) * (__pyx_v_B[5]))) + ((__pyx_v_T[7]) * (__pyx_v_B[8]))); + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1216 - * dipt[j+12] = T[0]*B[2]+T[3]*B[5]+T[6]*B[8] - * dipt[j+13] = T[1]*B[2]+T[4]*B[5]+T[7]*B[8] - * dipt[j+14] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # <<<<<<<<<<<<<< - * else: - * continue + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 */ - (__pyx_v_dipt[(__pyx_v_j + 14)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[2])) + ((__pyx_v_T[5]) * (__pyx_v_B[5]))) + ((__pyx_v_T[8]) * (__pyx_v_B[8]))); + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1180 - * dipt[j+4] += f2_x * z - * dipt[j+5] += f2_y * z - * elif i == auf: # <<<<<<<<<<<<<< - * auf_x1 = xyz[auf+3] - * auf_y1 = xyz[auf+4] + /* "View.MemoryView":1291 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: */ - goto __pyx_L16; - } + __pyx_v_broadcasting = 1; - /* "src/helpers/helpers.pyx":1218 - * dipt[j+14] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] + /* "View.MemoryView":1292 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< * else: - * continue # <<<<<<<<<<<<<< - * free(B) - * free(T) + * _err_extents(i, dst.shape[i], src.shape[i]) */ - /*else*/ { - goto __pyx_L10_continue; - } - __pyx_L16:; - goto __pyx_L21; - __pyx_L10_continue:; - goto __pyx_L21; - __pyx_L12_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L20; - __pyx_L20:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates5) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_auf_x1; - __pyx_parallel_temp1 = __pyx_v_auf_x2; - __pyx_parallel_temp2 = __pyx_v_auf_y1; - __pyx_parallel_temp3 = __pyx_v_auf_y2; - __pyx_parallel_temp4 = __pyx_v_auf_z1; - __pyx_parallel_temp5 = __pyx_v_auf_z2; - __pyx_parallel_temp6 = __pyx_v_f1; - __pyx_parallel_temp7 = __pyx_v_f2; - __pyx_parallel_temp8 = __pyx_v_f2_x; - __pyx_parallel_temp9 = __pyx_v_f2_y; - __pyx_parallel_temp10 = __pyx_v_f2_z; - __pyx_parallel_temp11 = __pyx_v_i; - __pyx_parallel_temp12 = __pyx_v_j; - __pyx_parallel_temp13 = __pyx_v_k; - __pyx_parallel_temp14 = __pyx_v_r2; - __pyx_parallel_temp15 = __pyx_v_x; - __pyx_parallel_temp16 = __pyx_v_y; - __pyx_parallel_temp17 = __pyx_v_z; - } - __pyx_L21:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_auf_x1 = __pyx_parallel_temp0; - __pyx_v_auf_x2 = __pyx_parallel_temp1; - __pyx_v_auf_y1 = __pyx_parallel_temp2; - __pyx_v_auf_y2 = __pyx_parallel_temp3; - __pyx_v_auf_z1 = __pyx_parallel_temp4; - __pyx_v_auf_z2 = __pyx_parallel_temp5; - __pyx_v_f1 = __pyx_parallel_temp6; - __pyx_v_f2 = __pyx_parallel_temp7; - __pyx_v_f2_x = __pyx_parallel_temp8; - __pyx_v_f2_y = __pyx_parallel_temp9; - __pyx_v_f2_z = __pyx_parallel_temp10; - __pyx_v_i = __pyx_parallel_temp11; - __pyx_v_j = __pyx_parallel_temp12; - __pyx_v_k = __pyx_parallel_temp13; - __pyx_v_r2 = __pyx_parallel_temp14; - __pyx_v_x = __pyx_parallel_temp15; - __pyx_v_y = __pyx_parallel_temp16; - __pyx_v_z = __pyx_parallel_temp17; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L8_error; - } - } - } + (__pyx_v_src.strides[__pyx_v_i]) = 0; - /* "src/helpers/helpers.pyx":1219 - * else: - * continue - * free(B) # <<<<<<<<<<<<<< - * free(T) - * + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 */ - free(__pyx_v_B); + goto __pyx_L7; + } - /* "src/helpers/helpers.pyx":1220 - * continue - * free(B) - * free(T) # <<<<<<<<<<<<<< + /* "View.MemoryView":1294 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< * - * for i in range(1,n/3): + * if src.suboffsets[i] >= 0: */ - free(__pyx_v_T); - goto __pyx_L23; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L23; - __pyx_L23:; - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1294, __pyx_L1_error) } + __pyx_L7:; - /* "src/helpers/helpers.pyx":1156 - * cdef double *E = pyE.data + /* "View.MemoryView":1289 * - * with nogil, parallel(): # <<<<<<<<<<<<<< - * B = malloc(sizeof(double) * 9) - * T = malloc(sizeof(double) * 9) + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } - } + } - /* "src/helpers/helpers.pyx":1222 - * free(T) + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * for i in range(1,n/3): # <<<<<<<<<<<<<< - * for j in range(15): - * dipt[j] += dipt[i*15+j] */ - __pyx_t_11 = __Pyx_div_long(__pyx_v_n, 3); - __pyx_t_10 = __pyx_t_11; - for (__pyx_t_4 = 1; __pyx_t_4 < __pyx_t_10; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1223 + /* "View.MemoryView":1297 * - * for i in range(1,n/3): - * for j in range(15): # <<<<<<<<<<<<<< - * dipt[j] += dipt[i*15+j] + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< * + * if slices_overlap(&src, &dst, ndim, itemsize): */ - for (__pyx_t_12 = 0; __pyx_t_12 < 15; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1224 - * for i in range(1,n/3): - * for j in range(15): - * dipt[j] += dipt[i*15+j] # <<<<<<<<<<<<<< + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * return py_dipt[0] */ - __pyx_t_17 = __pyx_v_j; - (__pyx_v_dipt[__pyx_t_17]) = ((__pyx_v_dipt[__pyx_t_17]) + (__pyx_v_dipt[((__pyx_v_i * 15) + __pyx_v_j)])); } } - /* "src/helpers/helpers.pyx":1226 - * dipt[j] += dipt[i*15+j] - * - * return py_dipt[0] # <<<<<<<<<<<<<< + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< * + * if not slice_is_contig(src, order, ndim): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_py_dipt), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1131 + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) * - * @cython.boundscheck(False) - * def NQRdipTen(np.ndarray[np.float64_t,ndim=2] py_xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] py_charges, - * aufpunkt): */ + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pyE.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_charges.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.helpers.NQRdipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pyE.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_charges.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_pyE); - __Pyx_XDECREF((PyObject *)__pyx_v_py_dipt); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/helpers.pyx":1368 + /* "View.MemoryView":1302 * + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< * - * def calcOctant(np.ndarray[np.float64_t,ndim=2,mode="c"] com, # <<<<<<<<<<<<<< - * isolute, nmolecules): - * """ + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) */ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_57calcOctant(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_56calcOctant[] = "\n calcOctant(com, isolute, nmolecules)\n\n In a box, that is centered on a specific residue and rotated to its body-fixed frame, this determines in which\n octant around this molecule each other molecule is centered. For speed and memory efficiency, this information\n is encoded as follows:\n\n x y z sign as bits in a binary number (0 for negative sign, 1 for positive sign),\n 3-bit number gives 8 dec. numbers -> 8 array indices needed\n\n x y z\n 0 0 0 -> 0\n 0 0 1 -> 1\n 0 1 0 -> 2\n 0 1 1 -> 3\n 1 0 0 -> 4\n 1 0 1 -> 5\n 1 1 0 -> 6\n 1 1 1 -> 7\n\n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_57calcOctant = {"calcOctant", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_57calcOctant, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_56calcOctant}; -static PyObject *__pyx_pw_11newanalysis_7helpers_57calcOctant(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_com = 0; - PyObject *__pyx_v_isolute = 0; - PyObject *__pyx_v_nmolecules = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcOctant (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_com,&__pyx_n_s_isolute,&__pyx_n_s_nmolecules,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_com)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isolute)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcOctant", 1, 3, 3, 1); __PYX_ERR(0, 1368, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmolecules)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcOctant", 1, 3, 3, 2); __PYX_ERR(0, 1368, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcOctant") < 0)) __PYX_ERR(0, 1368, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * + */ } - __pyx_v_com = ((PyArrayObject *)values[0]); - __pyx_v_isolute = values[1]; - __pyx_v_nmolecules = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcOctant", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1368, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcOctant", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_com), __pyx_ptype_5numpy_ndarray, 1, "com", 0))) __PYX_ERR(0, 1368, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_7helpers_56calcOctant(__pyx_self, __pyx_v_com, __pyx_v_isolute, __pyx_v_nmolecules); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_pf_11newanalysis_7helpers_56calcOctant(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_com, PyObject *__pyx_v_isolute, PyObject *__pyx_v_nmolecules) { - double *__pyx_v_ccom; - int __pyx_v_nmol; - int __pyx_v_islt; - int __pyx_v_j; - PyArrayObject *__pyx_v_octants = 0; - int *__pyx_v_coct; - int __pyx_v_x; - int __pyx_v_y; - int __pyx_v_z; - __Pyx_LocalBuf_ND __pyx_pybuffernd_com; - __Pyx_Buffer __pyx_pybuffer_com; - __Pyx_LocalBuf_ND __pyx_pybuffernd_octants; - __Pyx_Buffer __pyx_pybuffer_octants; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcOctant", 0); - __pyx_pybuffer_octants.pybuffer.buf = NULL; - __pyx_pybuffer_octants.refcount = 0; - __pyx_pybuffernd_octants.data = NULL; - __pyx_pybuffernd_octants.rcbuffer = &__pyx_pybuffer_octants; - __pyx_pybuffer_com.pybuffer.buf = NULL; - __pyx_pybuffer_com.refcount = 0; - __pyx_pybuffernd_com.data = NULL; - __pyx_pybuffernd_com.rcbuffer = &__pyx_pybuffer_com; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_com.rcbuffer->pybuffer, (PyObject*)__pyx_v_com, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1368, __pyx_L1_error) - } - __pyx_pybuffernd_com.diminfo[0].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_com.diminfo[0].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_com.diminfo[1].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_com.diminfo[1].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[1]; + /* "View.MemoryView":1304 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp + * + */ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1304, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; - /* "src/helpers/helpers.pyx":1391 + /* "View.MemoryView":1305 * - * """ - * cdef double *ccom = com.data # <<<<<<<<<<<<<< - * cdef int nmol=nmolecules, islt=isolute, j - * cdef np.ndarray[np.int32_t, ndim=1] octants = np.zeros(nmol,dtype=np.int32) + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: */ - __pyx_v_ccom = ((double *)__pyx_v_com->data); + __pyx_v_src = __pyx_v_tmp; - /* "src/helpers/helpers.pyx":1392 - * """ - * cdef double *ccom = com.data - * cdef int nmol=nmolecules, islt=isolute, j # <<<<<<<<<<<<<< - * cdef np.ndarray[np.int32_t, ndim=1] octants = np.zeros(nmol,dtype=np.int32) - * cdef int* coct = octants.data + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1392, __pyx_L1_error) - __pyx_v_nmol = ((int)__pyx_t_1); - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_isolute); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1392, __pyx_L1_error) - __pyx_v_islt = ((int)__pyx_t_1); + } - /* "src/helpers/helpers.pyx":1393 - * cdef double *ccom = com.data - * cdef int nmol=nmolecules, islt=isolute, j - * cdef np.ndarray[np.int32_t, ndim=1] octants = np.zeros(nmol,dtype=np.int32) # <<<<<<<<<<<<<< - * cdef int* coct = octants.data - * cdef int x, y, z + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nmol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 1393, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1393, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_octants.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_octants = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_octants.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 1393, __pyx_L1_error) - } else {__pyx_pybuffernd_octants.diminfo[0].strides = __pyx_pybuffernd_octants.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_octants.diminfo[0].shape = __pyx_pybuffernd_octants.rcbuffer->pybuffer.shape[0]; + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { + + /* "View.MemoryView":1310 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + */ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { + + /* "View.MemoryView":1311 + * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) + */ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + + /* "View.MemoryView":1310 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + */ + goto __pyx_L12; } - } - __pyx_t_7 = 0; - __pyx_v_octants = ((PyArrayObject *)__pyx_t_6); - __pyx_t_6 = 0; - /* "src/helpers/helpers.pyx":1394 - * cdef int nmol=nmolecules, islt=isolute, j - * cdef np.ndarray[np.int32_t, ndim=1] octants = np.zeros(nmol,dtype=np.int32) - * cdef int* coct = octants.data # <<<<<<<<<<<<<< - * cdef int x, y, z + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) * */ - __pyx_v_coct = ((int *)__pyx_v_octants->data); + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1397 - * cdef int x, y, z + /* "View.MemoryView":1313 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< * - * for j in range(nmol): # <<<<<<<<<<<<<< - * if j == islt: - * continue + * if direct_copy: */ - __pyx_t_1 = __pyx_v_nmol; - __pyx_t_8 = __pyx_t_1; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_j = __pyx_t_9; + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - /* "src/helpers/helpers.pyx":1398 + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * for j in range(nmol): - * if j == islt: # <<<<<<<<<<<<<< - * continue - * x=sgn2bin(ccom[j*3])*4 */ - __pyx_t_10 = ((__pyx_v_j == __pyx_v_islt) != 0); - if (__pyx_t_10) { + } + __pyx_L12:; - /* "src/helpers/helpers.pyx":1399 - * for j in range(nmol): - * if j == islt: - * continue # <<<<<<<<<<<<<< - * x=sgn2bin(ccom[j*3])*4 - * y=sgn2bin(ccom[j*3+1])*2 + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - goto __pyx_L3_continue; + if (__pyx_v_direct_copy) { - /* "src/helpers/helpers.pyx":1398 + /* "View.MemoryView":1317 + * if direct_copy: * - * for j in range(nmol): - * if j == islt: # <<<<<<<<<<<<<< - * continue - * x=sgn2bin(ccom[j*3])*4 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + */ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1318 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + */ + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + + /* "View.MemoryView":1319 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 + */ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1320 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * + */ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1321 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ } - /* "src/helpers/helpers.pyx":1400 - * if j == islt: - * continue - * x=sgn2bin(ccom[j*3])*4 # <<<<<<<<<<<<<< - * y=sgn2bin(ccom[j*3+1])*2 - * z=sgn2bin(ccom[j*3+2]) + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * */ - __pyx_v_x = (__pyx_f_11newanalysis_7helpers_sgn2bin((__pyx_v_ccom[(__pyx_v_j * 3)])) * 4); + } - /* "src/helpers/helpers.pyx":1401 - * continue - * x=sgn2bin(ccom[j*3])*4 - * y=sgn2bin(ccom[j*3+1])*2 # <<<<<<<<<<<<<< - * z=sgn2bin(ccom[j*3+2]) - * coct[j]=x|y|z + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * */ - __pyx_v_y = (__pyx_f_11newanalysis_7helpers_sgn2bin((__pyx_v_ccom[((__pyx_v_j * 3) + 1)])) * 2); + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1402 - * x=sgn2bin(ccom[j*3])*4 - * y=sgn2bin(ccom[j*3+1])*2 - * z=sgn2bin(ccom[j*3+2]) # <<<<<<<<<<<<<< - * coct[j]=x|y|z + /* "View.MemoryView":1326 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) * */ - __pyx_v_z = __pyx_f_11newanalysis_7helpers_sgn2bin((__pyx_v_ccom[((__pyx_v_j * 3) + 2)])); + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1326, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1403 - * y=sgn2bin(ccom[j*3+1])*2 - * z=sgn2bin(ccom[j*3+2]) - * coct[j]=x|y|z # <<<<<<<<<<<<<< + /* "View.MemoryView":1327 + * + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + */ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) + + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * * - * return octants */ - (__pyx_v_coct[__pyx_v_j]) = ((__pyx_v_x | __pyx_v_y) | __pyx_v_z); - __pyx_L3_continue:; } - /* "src/helpers/helpers.pyx":1405 - * coct[j]=x|y|z + /* "View.MemoryView":1329 + * transpose_memslice(&dst) * - * return octants # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + */ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1330 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_octants)); - __pyx_r = ((PyObject *)__pyx_v_octants); - goto __pyx_L0; + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - /* "src/helpers/helpers.pyx":1368 + /* "View.MemoryView":1331 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< * + * free(tmpdata) + */ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1333 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * - * def calcOctant(np.ndarray[np.float64_t,ndim=2,mode="c"] com, # <<<<<<<<<<<<<< - * isolute, nmolecules): - * """ + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * + */ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1334 + * + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":1265 + * + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_octants.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.helpers.calcOctant", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_octants.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_octants); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "src/helpers/helpers.pyx":1408 +/* "View.MemoryView":1337 * - * @cython.boundscheck(False) - * def sumMDCage(double [:,:,:,:] mdcage_ts, # <<<<<<<<<<<<<< - * double [:,:] dip_wat, - * int nres_wat, char [:] ds, int maxshell, int rep, int frame): + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_59sumMDCage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_59sumMDCage = {"sumMDCage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_59sumMDCage, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_59sumMDCage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_mdcage_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip_wat = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_nres_wat; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell; - int __pyx_v_rep; - int __pyx_v_frame; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sumMDCage (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mdcage_ts,&__pyx_n_s_dip_wat,&__pyx_n_s_nres_wat,&__pyx_n_s_ds,&__pyx_n_s_maxshell,&__pyx_n_s_rep,&__pyx_n_s_frame,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mdcage_ts)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_wat)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 1); __PYX_ERR(0, 1408, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nres_wat)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 2); __PYX_ERR(0, 1408, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 3); __PYX_ERR(0, 1408, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 4); __PYX_ERR(0, 1408, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rep)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 5); __PYX_ERR(0, 1408, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 6); __PYX_ERR(0, 1408, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumMDCage") < 0)) __PYX_ERR(0, 1408, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - } - __pyx_v_mdcage_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mdcage_ts.memview)) __PYX_ERR(0, 1408, __pyx_L3_error) - __pyx_v_dip_wat = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_wat.memview)) __PYX_ERR(0, 1409, __pyx_L3_error) - __pyx_v_nres_wat = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nres_wat == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1410, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1410, __pyx_L3_error) - __pyx_v_maxshell = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1410, __pyx_L3_error) - __pyx_v_rep = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_rep == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1410, __pyx_L3_error) - __pyx_v_frame = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_frame == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1410, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1408, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.sumMDCage", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_58sumMDCage(__pyx_self, __pyx_v_mdcage_ts, __pyx_v_dip_wat, __pyx_v_nres_wat, __pyx_v_ds, __pyx_v_maxshell, __pyx_v_rep, __pyx_v_frame); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_7helpers_58sumMDCage(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_mdcage_ts, __Pyx_memviewslice __pyx_v_dip_wat, int __pyx_v_nres_wat, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, int __pyx_v_rep, int __pyx_v_frame) { - int __pyx_v_w; - int __pyx_v_shell; +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { int __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations + int __pyx_v_offset; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - __Pyx_RefNannySetupContext("sumMDCage", 0); - /* "src/helpers/helpers.pyx":1413 + /* "View.MemoryView":1341 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< * - * cdef int w, shell, i - * for w in range(nres_wat): # <<<<<<<<<<<<<< - * shell = ds[w]-1 - * if shell < maxshell: + * for i in range(ndim - 1, -1, -1): */ - __pyx_t_1 = __pyx_v_nres_wat; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_w = __pyx_t_3; + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - /* "src/helpers/helpers.pyx":1414 - * cdef int w, shell, i - * for w in range(nres_wat): - * shell = ds[w]-1 # <<<<<<<<<<<<<< - * if shell < maxshell: - * for i in range(3): + /* "View.MemoryView":1343 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] */ - __pyx_t_4 = __pyx_v_w; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds.shape[0]; - __pyx_v_shell = ((*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_4 * __pyx_v_ds.strides[0]) ))) - 1); + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* "src/helpers/helpers.pyx":1415 - * for w in range(nres_wat): - * shell = ds[w]-1 - * if shell < maxshell: # <<<<<<<<<<<<<< - * for i in range(3): - * mdcage_ts[rep,shell,frame,i] += dip_wat[w,i] + /* "View.MemoryView":1344 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] */ - __pyx_t_5 = ((__pyx_v_shell < __pyx_v_maxshell) != 0); - if (__pyx_t_5) { + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - /* "src/helpers/helpers.pyx":1416 - * shell = ds[w]-1 - * if shell < maxshell: - * for i in range(3): # <<<<<<<<<<<<<< - * mdcage_ts[rep,shell,frame,i] += dip_wat[w,i] - * else: + /* "View.MemoryView":1345 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * */ - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "src/helpers/helpers.pyx":1417 - * if shell < maxshell: - * for i in range(3): - * mdcage_ts[rep,shell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< - * else: - * for i in range(3): + /* "View.MemoryView":1346 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): */ - __pyx_t_4 = __pyx_v_w; - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dip_wat.shape[1]; - __pyx_t_8 = __pyx_v_rep; - __pyx_t_9 = __pyx_v_shell; - __pyx_t_10 = __pyx_v_frame; - __pyx_t_11 = __pyx_v_i; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_mdcage_ts.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mdcage_ts.shape[1]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mdcage_ts.shape[2]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_mdcage_ts.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_8 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_9 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_10 * __pyx_v_mdcage_ts.strides[2]) ) + __pyx_t_11 * __pyx_v_mdcage_ts.strides[3]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_4 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_7 * __pyx_v_dip_wat.strides[1]) ))); - } + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); + } - /* "src/helpers/helpers.pyx":1415 - * for w in range(nres_wat): - * shell = ds[w]-1 - * if shell < maxshell: # <<<<<<<<<<<<<< - * for i in range(3): - * mdcage_ts[rep,shell,frame,i] += dip_wat[w,i] + /* "View.MemoryView":1348 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] */ - goto __pyx_L5; - } + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "src/helpers/helpers.pyx":1419 - * mdcage_ts[rep,shell,frame,i] += dip_wat[w,i] - * else: - * for i in range(3): # <<<<<<<<<<<<<< - * mdcage_ts[rep,maxshell,frame,i] += dip_wat[w,i] + /* "View.MemoryView":1349 * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 */ - /*else*/ { - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; - /* "src/helpers/helpers.pyx":1420 - * else: - * for i in range(3): - * mdcage_ts[rep,maxshell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< + /* "View.MemoryView":1350 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 * - * @cython.boundscheck(False) */ - __pyx_t_7 = __pyx_v_w; - __pyx_t_4 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dip_wat.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[1]; - __pyx_t_11 = __pyx_v_rep; - __pyx_t_10 = __pyx_v_maxshell; - __pyx_t_9 = __pyx_v_frame; - __pyx_t_8 = __pyx_v_i; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_mdcage_ts.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mdcage_ts.shape[1]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mdcage_ts.shape[2]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_mdcage_ts.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_11 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_10 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_9 * __pyx_v_mdcage_ts.strides[2]) ) + __pyx_t_8 * __pyx_v_mdcage_ts.strides[3]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_7 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_4 * __pyx_v_dip_wat.strides[1]) ))); - } - } - __pyx_L5:; - } + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); - /* "src/helpers/helpers.pyx":1408 + /* "View.MemoryView":1351 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) - * def sumMDCage(double [:,:,:,:] mdcage_ts, # <<<<<<<<<<<<<< - * double [:,:] dip_wat, - * int nres_wat, char [:] ds, int maxshell, int rep, int frame): */ + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_mdcage_ts, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip_wat, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; + /* "View.MemoryView":1337 + * + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: + */ + + /* function exit code */ } -/* "src/helpers/helpers.pyx":1423 +/* "View.MemoryView":1359 * - * @cython.boundscheck(False) - * def sumMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, # <<<<<<<<<<<<<< - * char [:] ds, int maxshell, int frame): + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< * + * if dtype_is_object: */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_61sumMDCageSingle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_61sumMDCageSingle = {"sumMDCageSingle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_61sumMDCageSingle, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_61sumMDCageSingle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_mdcage_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip_wat = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell; - int __pyx_v_frame; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sumMDCageSingle (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mdcage_ts,&__pyx_n_s_dip_wat,&__pyx_n_s_ds,&__pyx_n_s_maxshell,&__pyx_n_s_frame,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mdcage_ts)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_wat)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMDCageSingle", 1, 5, 5, 1); __PYX_ERR(0, 1423, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMDCageSingle", 1, 5, 5, 2); __PYX_ERR(0, 1423, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMDCageSingle", 1, 5, 5, 3); __PYX_ERR(0, 1423, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMDCageSingle", 1, 5, 5, 4); __PYX_ERR(0, 1423, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumMDCageSingle") < 0)) __PYX_ERR(0, 1423, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - } - __pyx_v_mdcage_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mdcage_ts.memview)) __PYX_ERR(0, 1423, __pyx_L3_error) - __pyx_v_dip_wat = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_wat.memview)) __PYX_ERR(0, 1423, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1424, __pyx_L3_error) - __pyx_v_maxshell = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1424, __pyx_L3_error) - __pyx_v_frame = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_frame == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1424, __pyx_L3_error) +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { + + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + */ + if (__pyx_v_dtype_is_object) { + + /* "View.MemoryView":1362 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + */ + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + */ } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sumMDCageSingle", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1423, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.sumMDCageSingle", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_60sumMDCageSingle(__pyx_self, __pyx_v_mdcage_ts, __pyx_v_dip_wat, __pyx_v_ds, __pyx_v_maxshell, __pyx_v_frame); + + /* "View.MemoryView":1359 + * + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< + * + * if dtype_is_object: + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_60sumMDCageSingle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_mdcage_ts, __Pyx_memviewslice __pyx_v_dip_wat, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, int __pyx_v_frame) { - int __pyx_v_w; - int __pyx_v_shell; - int __pyx_v_i; - int __pyx_v_nres_wat; - PyObject *__pyx_r = NULL; +/* "View.MemoryView":1365 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + */ + +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - __Pyx_RefNannySetupContext("sumMDCageSingle", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - /* "src/helpers/helpers.pyx":1426 - * char [:] ds, int maxshell, int frame): + /* "View.MemoryView":1368 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< * - * cdef int w, shell, i, nres_wat = dip_wat.shape[0] # <<<<<<<<<<<<<< + * @cname('__pyx_memoryview_refcount_objects_in_slice') + */ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + + /* "View.MemoryView":1365 * - * for w in range(nres_wat): + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: */ - __pyx_v_nres_wat = (__pyx_v_dip_wat.shape[0]); - /* "src/helpers/helpers.pyx":1428 - * cdef int w, shell, i, nres_wat = dip_wat.shape[0] + /* function exit code */ + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif +} + +/* "View.MemoryView":1371 * - * for w in range(nres_wat): # <<<<<<<<<<<<<< - * shell = ds[w]-1 - * if shell < maxshell: + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ - __pyx_t_1 = __pyx_v_nres_wat; + +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); + + /* "View.MemoryView":1374 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * + * for i in range(shape[0]): + */ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1376 + * cdef Py_ssize_t stride = strides[0] + * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: + */ + __pyx_t_1 = (__pyx_v_shape[0]); __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_w = __pyx_t_3; + __pyx_v_i = __pyx_t_3; - /* "src/helpers/helpers.pyx":1429 + /* "View.MemoryView":1377 * - * for w in range(nres_wat): - * shell = ds[w]-1 # <<<<<<<<<<<<<< - * if shell < maxshell: - * for i in range(3): + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) */ - __pyx_t_4 = __pyx_v_w; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds.shape[0]; - __pyx_v_shell = ((*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_4 * __pyx_v_ds.strides[0]) ))) - 1); + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { - /* "src/helpers/helpers.pyx":1430 - * for w in range(nres_wat): - * shell = ds[w]-1 - * if shell < maxshell: # <<<<<<<<<<<<<< - * for i in range(3): - * mdcage_ts[shell,frame,i] += dip_wat[w,i] + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: */ - __pyx_t_5 = ((__pyx_v_shell < __pyx_v_maxshell) != 0); - if (__pyx_t_5) { + if (__pyx_v_inc) { - /* "src/helpers/helpers.pyx":1431 - * shell = ds[w]-1 - * if shell < maxshell: - * for i in range(3): # <<<<<<<<<<<<<< - * mdcage_ts[shell,frame,i] += dip_wat[w,i] - * else: + /* "View.MemoryView":1379 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) */ - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + Py_INCREF((((PyObject **)__pyx_v_data)[0])); - /* "src/helpers/helpers.pyx":1432 - * if shell < maxshell: - * for i in range(3): - * mdcage_ts[shell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: + */ + goto __pyx_L6; + } + + /* "View.MemoryView":1381 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< * else: - * for i in range(3): + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) */ - __pyx_t_4 = __pyx_v_w; - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dip_wat.shape[1]; - __pyx_t_8 = __pyx_v_shell; - __pyx_t_9 = __pyx_v_frame; - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_mdcage_ts.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mdcage_ts.shape[1]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mdcage_ts.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_8 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_9 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_10 * __pyx_v_mdcage_ts.strides[2]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_4 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_7 * __pyx_v_dip_wat.strides[1]) ))); + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); } + __pyx_L6:; - /* "src/helpers/helpers.pyx":1430 - * for w in range(nres_wat): - * shell = ds[w]-1 - * if shell < maxshell: # <<<<<<<<<<<<<< - * for i in range(3): - * mdcage_ts[shell,frame,i] += dip_wat[w,i] + /* "View.MemoryView":1377 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) */ goto __pyx_L5; } - /* "src/helpers/helpers.pyx":1434 - * mdcage_ts[shell,frame,i] += dip_wat[w,i] + /* "View.MemoryView":1383 + * Py_DECREF(( data)[0]) * else: - * for i in range(3): # <<<<<<<<<<<<<< - * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< * + * data += stride */ /*else*/ { - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; - /* "src/helpers/helpers.pyx":1435 - * else: - * for i in range(3): - * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< + /* "View.MemoryView":1385 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) */ - __pyx_t_7 = __pyx_v_w; - __pyx_t_4 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dip_wat.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[1]; - __pyx_t_10 = __pyx_v_maxshell; - __pyx_t_9 = __pyx_v_frame; - __pyx_t_8 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mdcage_ts.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mdcage_ts.shape[1]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_mdcage_ts.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_10 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_9 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_8 * __pyx_v_mdcage_ts.strides[2]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_7 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_4 * __pyx_v_dip_wat.strides[1]) ))); - } - } - __pyx_L5:; + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); } - /* "src/helpers/helpers.pyx":1423 - * - * @cython.boundscheck(False) - * def sumMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, # <<<<<<<<<<<<<< - * char [:] ds, int maxshell, int frame): + /* "View.MemoryView":1371 * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_mdcage_ts, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip_wat, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "src/helpers/helpers.pyx":1438 +/* "View.MemoryView":1391 * - * @cython.boundscheck(False) - * def calcAngularMomentum(double [:,:] coor, double [:,:] vel, double [:] masses, int natoms): # <<<<<<<<<<<<<< + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + */ + +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { + + /* "View.MemoryView":1394 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + */ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1395 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) * - * cdef np.ndarray[np.float64_t, ndim=1] L = np.zeros(3) + */ + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1396 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * + */ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1391 + * + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + */ + + /* function exit code */ +} + +/* "View.MemoryView":1400 + * + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: + */ + +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + + /* "View.MemoryView":1404 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] + * + */ + __pyx_v_stride = (__pyx_v_strides[0]); + + /* "View.MemoryView":1405 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: + */ + __pyx_v_extent = (__pyx_v_shape[0]); + + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) + */ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { + + /* "View.MemoryView":1408 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride + */ + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1409 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: + */ + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); + + /* "View.MemoryView":1410 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): + */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) + */ + goto __pyx_L3; + } + + /* "View.MemoryView":1412 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride + */ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1413 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride + * + */ + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + + /* "View.MemoryView":1414 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; + + /* "View.MemoryView":1400 + * + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: + */ + + /* function exit code */ +} + +/* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_63calcAngularMomentum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_63calcAngularMomentum = {"calcAngularMomentum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_63calcAngularMomentum, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_63calcAngularMomentum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_vel = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_masses = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_natoms; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcAngularMomentum (wrapper)", 0); + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_vel,&__pyx_n_s_masses,&__pyx_n_s_natoms,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vel)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcAngularMomentum", 1, 4, 4, 1); __PYX_ERR(0, 1438, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_masses)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcAngularMomentum", 1, 4, 4, 2); __PYX_ERR(0, 1438, __pyx_L3_error) + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_natoms)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcAngularMomentum", 1, 4, 4, 3); __PYX_ERR(0, 1438, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcAngularMomentum") < 0)) __PYX_ERR(0, 1438, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1438, __pyx_L3_error) - __pyx_v_vel = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vel.memview)) __PYX_ERR(0, 1438, __pyx_L3_error) - __pyx_v_masses = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_masses.memview)) __PYX_ERR(0, 1438, __pyx_L3_error) - __pyx_v_natoms = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_natoms == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1438, __pyx_L3_error) + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcAngularMomentum", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1438, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcAngularMomentum", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_62calcAngularMomentum(__pyx_self, __pyx_v_coor, __pyx_v_vel, __pyx_v_masses, __pyx_v_natoms); + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_62calcAngularMomentum(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_vel, __Pyx_memviewslice __pyx_v_masses, int __pyx_v_natoms) { - PyArrayObject *__pyx_v_L = 0; - double *__pyx_v_cL; - int __pyx_v_i; - __Pyx_LocalBuf_ND __pyx_pybuffernd_L; - __Pyx_Buffer __pyx_pybuffer_L; +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - long __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcAngularMomentum", 0); - __pyx_pybuffer_L.pybuffer.buf = NULL; - __pyx_pybuffer_L.refcount = 0; - __pyx_pybuffernd_L.data = NULL; - __pyx_pybuffernd_L.rcbuffer = &__pyx_pybuffer_L; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); - /* "src/helpers/helpers.pyx":1440 - * def calcAngularMomentum(double [:,:] coor, double [:,:] vel, double [:] masses, int natoms): - * - * cdef np.ndarray[np.float64_t, ndim=1] L = np.zeros(3) # <<<<<<<<<<<<<< - * cdef double *cL = L.data - * cdef int i + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1440, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + */ + } + + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1440, __pyx_L1_error) - __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); + #endif { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_L.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_L = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_L.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 1440, __pyx_L1_error) - } else {__pyx_pybuffernd_L.diminfo[0].strides = __pyx_pybuffernd_L.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_L.diminfo[0].shape = __pyx_pybuffernd_L.rcbuffer->pybuffer.shape[0]; - } + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __pyx_t_4 = 0; - __pyx_v_L = ((PyArrayObject *)__pyx_t_1); + __pyx_v___pyx_result = __pyx_t_1; __pyx_t_1 = 0; - /* "src/helpers/helpers.pyx":1441 - * - * cdef np.ndarray[np.float64_t, ndim=1] L = np.zeros(3) - * cdef double *cL = L.data # <<<<<<<<<<<<<< - * cdef int i - * - */ - __pyx_v_cL = ((double *)__pyx_v_L->data); - - /* "src/helpers/helpers.pyx":1444 - * cdef int i - * - * for i in range(natoms): # <<<<<<<<<<<<<< - * cL[0] += masses[i] * (coor[i,1] * vel[i,2] - coor[i,2] * vel[i,1]) - * cL[1] += masses[i] * (coor[i,2] * vel[i,0] - coor[i,0] * vel[i,2]) - */ - __pyx_t_5 = __pyx_v_natoms; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; - - /* "src/helpers/helpers.pyx":1445 - * - * for i in range(natoms): - * cL[0] += masses[i] * (coor[i,1] * vel[i,2] - coor[i,2] * vel[i,1]) # <<<<<<<<<<<<<< - * cL[1] += masses[i] * (coor[i,2] * vel[i,0] - coor[i,0] * vel[i,2]) - * cL[2] += masses[i] * (coor[i,0] * vel[i,1] - coor[i,1] * vel[i,0]) + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result */ - __pyx_t_8 = 0; - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_masses.shape[0]; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = 2; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_vel.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_vel.shape[1]; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 2; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = 1; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_vel.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_vel.shape[1]; - (__pyx_v_cL[__pyx_t_8]) = ((__pyx_v_cL[__pyx_t_8]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_9 * __pyx_v_masses.strides[0]) ))) * (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_12 * __pyx_v_vel.strides[0]) ) + __pyx_t_13 * __pyx_v_vel.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_16 * __pyx_v_vel.strides[0]) ) + __pyx_t_17 * __pyx_v_vel.strides[1]) ))))))); + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { - /* "src/helpers/helpers.pyx":1446 - * for i in range(natoms): - * cL[0] += masses[i] * (coor[i,1] * vel[i,2] - coor[i,2] * vel[i,1]) - * cL[1] += masses[i] * (coor[i,2] * vel[i,0] - coor[i,0] * vel[i,2]) # <<<<<<<<<<<<<< - * cL[2] += masses[i] * (coor[i,0] * vel[i,1] - coor[i,1] * vel[i,0]) - * + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): */ - __pyx_t_8 = 1; - __pyx_t_17 = __pyx_v_i; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_masses.shape[0]; - __pyx_t_16 = __pyx_v_i; - __pyx_t_15 = 2; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - __pyx_t_14 = __pyx_v_i; - __pyx_t_13 = 0; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_vel.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_vel.shape[1]; - __pyx_t_12 = __pyx_v_i; - __pyx_t_11 = 0; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; - __pyx_t_10 = __pyx_v_i; - __pyx_t_9 = 2; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_vel.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_vel.shape[1]; - (__pyx_v_cL[__pyx_t_8]) = ((__pyx_v_cL[__pyx_t_8]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_17 * __pyx_v_masses.strides[0]) ))) * (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_16 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_14 * __pyx_v_vel.strides[0]) ) + __pyx_t_13 * __pyx_v_vel.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_10 * __pyx_v_vel.strides[0]) ) + __pyx_t_9 * __pyx_v_vel.strides[1]) ))))))); + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/helpers.pyx":1447 - * cL[0] += masses[i] * (coor[i,1] * vel[i,2] - coor[i,2] * vel[i,1]) - * cL[1] += masses[i] * (coor[i,2] * vel[i,0] - coor[i,0] * vel[i,2]) - * cL[2] += masses[i] * (coor[i,0] * vel[i,1] - coor[i,1] * vel[i,0]) # <<<<<<<<<<<<<< - * - * return L + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result */ - __pyx_t_8 = 2; - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_masses.shape[0]; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = 1; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_vel.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_vel.shape[1]; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 1; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = 0; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_vel.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_vel.shape[1]; - (__pyx_v_cL[__pyx_t_8]) = ((__pyx_v_cL[__pyx_t_8]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_9 * __pyx_v_masses.strides[0]) ))) * (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_12 * __pyx_v_vel.strides[0]) ) + __pyx_t_13 * __pyx_v_vel.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_16 * __pyx_v_vel.strides[0]) ) + __pyx_t_17 * __pyx_v_vel.strides[1]) ))))))); } - /* "src/helpers/helpers.pyx":1449 - * cL[2] += masses[i] * (coor[i,0] * vel[i,1] - coor[i,1] * vel[i,0]) - * - * return L # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_L)); - __pyx_r = ((PyObject *)__pyx_v_L); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; goto __pyx_L0; - /* "src/helpers/helpers.pyx":1438 - * - * @cython.boundscheck(False) - * def calcAngularMomentum(double [:,:] coor, double [:,:] vel, double [:] masses, int natoms): # <<<<<<<<<<<<<< - * - * cdef np.ndarray[np.float64_t, ndim=1] L = np.zeros(3) + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_L.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.helpers.calcAngularMomentum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_L.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_L); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_vel, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_masses, 1); + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":1452 - * - * @cython.boundscheck(False) - * def calcInertiaTensor(double [:,:] coor, double [:] masses, int natoms): # <<<<<<<<<<<<<< - * - * cdef np.ndarray[np.float64_t, ndim=2] I = np.zeros((3,3)) +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_65calcInertiaTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_65calcInertiaTensor = {"calcInertiaTensor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_65calcInertiaTensor, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_65calcInertiaTensor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_masses = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_natoms; +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcInertiaTensor (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_masses,&__pyx_n_s_natoms,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_masses)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcInertiaTensor", 1, 3, 3, 1); __PYX_ERR(0, 1452, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_natoms)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcInertiaTensor", 1, 3, 3, 2); __PYX_ERR(0, 1452, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcInertiaTensor") < 0)) __PYX_ERR(0, 1452, __pyx_L3_error) + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 > 1); + if (__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { + + /* "(tree fragment)":14 + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1452, __pyx_L3_error) - __pyx_v_masses = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_masses.memview)) __PYX_ERR(0, 1452, __pyx_L3_error) - __pyx_v_natoms = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_natoms == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1452, __pyx_L3_error) + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) + */ } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcInertiaTensor", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1452, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcInertiaTensor", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_64calcInertiaTensor(__pyx_self, __pyx_v_coor, __pyx_v_masses, __pyx_v_natoms); + + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_64calcInertiaTensor(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_masses, int __pyx_v_natoms) { - PyArrayObject *__pyx_v_I = 0; - double *__pyx_v_cI; - int __pyx_v_i; - double __pyx_v_x; - double __pyx_v_y; - double __pyx_v_z; - __Pyx_LocalBuf_ND __pyx_pybuffernd_I; - __Pyx_Buffer __pyx_pybuffer_I; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - long __pyx_t_10; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcInertiaTensor", 0); - __pyx_pybuffer_I.pybuffer.buf = NULL; - __pyx_pybuffer_I.refcount = 0; - __pyx_pybuffernd_I.data = NULL; - __pyx_pybuffernd_I.rcbuffer = &__pyx_pybuffer_I; - - /* "src/helpers/helpers.pyx":1454 - * def calcInertiaTensor(double [:,:] coor, double [:] masses, int natoms): +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * - * cdef np.ndarray[np.float64_t, ndim=2] I = np.zeros((3,3)) # <<<<<<<<<<<<<< - * cdef double *cI = I.data - * cdef int i + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_tuple_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple_); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1454, __pyx_L1_error) - __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_I.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_I = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_I.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 1454, __pyx_L1_error) - } else {__pyx_pybuffernd_I.diminfo[0].strides = __pyx_pybuffernd_I.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_I.diminfo[0].shape = __pyx_pybuffernd_I.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_I.diminfo[1].strides = __pyx_pybuffernd_I.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_I.diminfo[1].shape = __pyx_pybuffernd_I.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_4 = 0; - __pyx_v_I = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; - /* "src/helpers/helpers.pyx":1455 +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":248 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< * - * cdef np.ndarray[np.float64_t, ndim=2] I = np.zeros((3,3)) - * cdef double *cI = I.data # <<<<<<<<<<<<<< - * cdef int i - * cdef double x, y, z + * @property */ - __pyx_v_cI = ((double *)__pyx_v_I->data); + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1459 - * cdef double x, y, z + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * - * for i in range(natoms): # <<<<<<<<<<<<<< - * x = coor[i,0] - * y = coor[i,1] + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ - __pyx_t_5 = __pyx_v_natoms; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; - /* "src/helpers/helpers.pyx":1460 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 * - * for i in range(natoms): - * x = coor[i,0] # <<<<<<<<<<<<<< - * y = coor[i,1] - * z = coor[i,2] + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ */ - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; - __pyx_v_x = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))); - /* "src/helpers/helpers.pyx":1461 - * for i in range(natoms): - * x = coor[i,0] - * y = coor[i,1] # <<<<<<<<<<<<<< - * z = coor[i,2] - * cI[0] += masses[i] * (y*y+z*z) - */ - __pyx_t_9 = __pyx_v_i; - __pyx_t_8 = 1; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[1]; - __pyx_v_y = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_8 * __pyx_v_coor.strides[1]) ))); +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); - /* "src/helpers/helpers.pyx":1462 - * x = coor[i,0] - * y = coor[i,1] - * z = coor[i,2] # <<<<<<<<<<<<<< - * cI[0] += masses[i] * (y*y+z*z) - * cI[1] -= masses[i] * x*y + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":254 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = 2; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; - __pyx_v_z = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))); + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1463 - * y = coor[i,1] - * z = coor[i,2] - * cI[0] += masses[i] * (y*y+z*z) # <<<<<<<<<<<<<< - * cI[1] -= masses[i] * x*y - * cI[2] -= masses[i] * x*z + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 + * + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ */ - __pyx_t_10 = 0; - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_masses.shape[0]; - (__pyx_v_cI[__pyx_t_10]) = ((__pyx_v_cI[__pyx_t_10]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_9 * __pyx_v_masses.strides[0]) ))) * ((__pyx_v_y * __pyx_v_y) + (__pyx_v_z * __pyx_v_z)))); - /* "src/helpers/helpers.pyx":1464 - * z = coor[i,2] - * cI[0] += masses[i] * (y*y+z*z) - * cI[1] -= masses[i] * x*y # <<<<<<<<<<<<<< - * cI[2] -= masses[i] * x*z - * cI[4] += masses[i] * (x*x+z*z) - */ - __pyx_t_10 = 1; - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_masses.shape[0]; - (__pyx_v_cI[__pyx_t_10]) = ((__pyx_v_cI[__pyx_t_10]) - (((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_9 * __pyx_v_masses.strides[0]) ))) * __pyx_v_x) * __pyx_v_y)); + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":1465 - * cI[0] += masses[i] * (y*y+z*z) - * cI[1] -= masses[i] * x*y - * cI[2] -= masses[i] * x*z # <<<<<<<<<<<<<< - * cI[4] += masses[i] * (x*x+z*z) - * cI[5] -= masses[i] * y*z +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 + * + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ */ - __pyx_t_10 = 2; - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_masses.shape[0]; - (__pyx_v_cI[__pyx_t_10]) = ((__pyx_v_cI[__pyx_t_10]) - (((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_9 * __pyx_v_masses.strides[0]) ))) * __pyx_v_x) * __pyx_v_z)); - /* "src/helpers/helpers.pyx":1466 - * cI[1] -= masses[i] * x*y - * cI[2] -= masses[i] * x*z - * cI[4] += masses[i] * (x*x+z*z) # <<<<<<<<<<<<<< - * cI[5] -= masses[i] * y*z - * cI[8] += masses[i] * (x*x+y*y) - */ - __pyx_t_10 = 4; - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_masses.shape[0]; - (__pyx_v_cI[__pyx_t_10]) = ((__pyx_v_cI[__pyx_t_10]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_9 * __pyx_v_masses.strides[0]) ))) * ((__pyx_v_x * __pyx_v_x) + (__pyx_v_z * __pyx_v_z)))); +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; - /* "src/helpers/helpers.pyx":1467 - * cI[2] -= masses[i] * x*z - * cI[4] += masses[i] * (x*x+z*z) - * cI[5] -= masses[i] * y*z # <<<<<<<<<<<<<< - * cI[8] += masses[i] * (x*x+y*y) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":260 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_10 = 5; - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_masses.shape[0]; - (__pyx_v_cI[__pyx_t_10]) = ((__pyx_v_cI[__pyx_t_10]) - (((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_9 * __pyx_v_masses.strides[0]) ))) * __pyx_v_y) * __pyx_v_z)); + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1468 - * cI[4] += masses[i] * (x*x+z*z) - * cI[5] -= masses[i] * y*z - * cI[8] += masses[i] * (x*x+y*y) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 * - * cI[3] = cI[1] + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ */ - __pyx_t_10 = 8; - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_masses.shape[0]; - (__pyx_v_cI[__pyx_t_10]) = ((__pyx_v_cI[__pyx_t_10]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_9 * __pyx_v_masses.strides[0]) ))) * ((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)))); - } - /* "src/helpers/helpers.pyx":1470 - * cI[8] += masses[i] * (x*x+y*y) + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 * - * cI[3] = cI[1] # <<<<<<<<<<<<<< - * cI[6] = cI[2] - * cI[7] = cI[5] + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - (__pyx_v_cI[3]) = (__pyx_v_cI[1]); - /* "src/helpers/helpers.pyx":1471 +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":268 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< * - * cI[3] = cI[1] - * cI[6] = cI[2] # <<<<<<<<<<<<<< - * cI[7] = cI[5] + * @property + */ + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 * + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - (__pyx_v_cI[6]) = (__pyx_v_cI[2]); - /* "src/helpers/helpers.pyx":1472 - * cI[3] = cI[1] - * cI[6] = cI[2] - * cI[7] = cI[5] # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 * - * return I + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - (__pyx_v_cI[7]) = (__pyx_v_cI[5]); - /* "src/helpers/helpers.pyx":1474 - * cI[7] = cI[5] +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":275 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< * - * return I # <<<<<<<<<<<<<< + * @property + */ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 * + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 * + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_I)); - __pyx_r = ((PyObject *)__pyx_v_I); - goto __pyx_L0; - /* "src/helpers/helpers.pyx":1452 +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":281 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def calcInertiaTensor(double [:,:] coor, double [:] masses, int natoms): # <<<<<<<<<<<<<< + * @property + */ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 * - * cdef np.ndarray[np.float64_t, ndim=2] I = np.zeros((3,3)) + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_I.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.helpers.calcInertiaTensor", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_I.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_I); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_masses, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":1478 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 * - * @cython.boundscheck(False) - * def calcResidenceTimeseries(char [:,:] ds, int nshells): # <<<<<<<<<<<<<< + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":290 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< * - * cdef int nmol = len(ds) + * ctypedef unsigned char npy_bool */ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_67calcResidenceTimeseries(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_67calcResidenceTimeseries = {"calcResidenceTimeseries", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_67calcResidenceTimeseries, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_67calcResidenceTimeseries(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_nshells; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcResidenceTimeseries (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_nshells,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcResidenceTimeseries", 1, 2, 2, 1); __PYX_ERR(0, 1478, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcResidenceTimeseries") < 0)) __PYX_ERR(0, 1478, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1478, __pyx_L3_error) - __pyx_v_nshells = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_nshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1478, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcResidenceTimeseries", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1478, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcResidenceTimeseries", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_66calcResidenceTimeseries(__pyx_self, __pyx_v_ds, __pyx_v_nshells); + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 + * + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_66calcResidenceTimeseries(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_nshells) { - int __pyx_v_nmol; - int __pyx_v_nt; - __Pyx_memviewslice __pyx_v_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_i; - int __pyx_v_j; +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcResidenceTimeseries", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "src/helpers/helpers.pyx":1480 - * def calcResidenceTimeseries(char [:,:] ds, int nshells): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":774 * - * cdef int nmol = len(ds) # <<<<<<<<<<<<<< - * cdef int nt = len(ds[0]) + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * + * cdef inline object PyArray_MultiIterNew2(a, b): */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ds); - __pyx_v_nmol = __pyx_t_1; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1481 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t * - * cdef int nmol = len(ds) - * cdef int nt = len(ds[0]) # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) * - * cdef char [:,:,:] ts = np.zeros((nshells,nmol,nt),dtype=np.int8) */ - __pyx_t_2.data = __pyx_v_ds.data; - __pyx_t_2.memview = __pyx_v_ds.memview; - __PYX_INC_MEMVIEW(&__pyx_t_2, 0); - { - Py_ssize_t __pyx_tmp_idx = 0; - Py_ssize_t __pyx_tmp_shape = __pyx_v_ds.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_ds.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -__pyx_t_2.shape[0] = __pyx_v_ds.shape[1]; -__pyx_t_2.strides[0] = __pyx_v_ds.strides[1]; - __pyx_t_2.suboffsets[0] = -1; +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ -__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - __pyx_v_nt = __pyx_t_1; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "src/helpers/helpers.pyx":1483 - * cdef int nt = len(ds[0]) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":777 * - * cdef char [:,:,:] ts = np.zeros((nshells,nmol,nt),dtype=np.int8) # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * - * cdef int i,j,ind + * cdef inline object PyArray_MultiIterNew3(a, b, c): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nmol); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_nt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6); - __pyx_t_3 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1483, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_ts = __pyx_t_8; - __pyx_t_8.memview = NULL; - __pyx_t_8.data = NULL; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1487 - * cdef int i,j,ind + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * - * with nogil, parallel(): # <<<<<<<<<<<<<< - * for i in prange(nmol): - * for j in range(nt): */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_9) - #endif /* _OPENMP */ - { - /* "src/helpers/helpers.pyx":1488 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * - * with nogil, parallel(): - * for i in prange(nmol): # <<<<<<<<<<<<<< - * for j in range(nt): - * ts[ds[i,j]-1, i, j] += 1 */ - __pyx_t_9 = __pyx_v_nmol; - if ((1 == 0)) abort(); - { - __pyx_t_11 = (__pyx_t_9 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_11 > 0) - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) - #endif /* _OPENMP */ - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_10); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); - /* "src/helpers/helpers.pyx":1489 - * with nogil, parallel(): - * for i in prange(nmol): - * for j in range(nt): # <<<<<<<<<<<<<< - * ts[ds[i,j]-1, i, j] += 1 +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":780 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __pyx_t_12 = __pyx_v_nt; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_j = __pyx_t_14; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1490 - * for i in prange(nmol): - * for j in range(nt): - * ts[ds[i,j]-1, i, j] += 1 # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * - * return np.asarray(ts) */ - __pyx_t_15 = __pyx_v_i; - __pyx_t_16 = __pyx_v_j; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_ds.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_ds.shape[1]; - __pyx_t_17 = ((*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_15 * __pyx_v_ds.strides[0]) ) + __pyx_t_16 * __pyx_v_ds.strides[1]) ))) - 1); - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_ts.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ts.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ts.shape[2]; - *((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ts.data + __pyx_t_17 * __pyx_v_ts.strides[0]) ) + __pyx_t_18 * __pyx_v_ts.strides[1]) ) + __pyx_t_19 * __pyx_v_ts.strides[2]) )) += 1; - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/helpers/helpers.pyx":1487 - * cdef int i,j,ind + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * - * with nogil, parallel(): # <<<<<<<<<<<<<< - * for i in prange(nmol): - * for j in range(nt): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - /* "src/helpers/helpers.pyx":1492 - * ts[ds[i,j]-1, i, j] += 1 +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":783 * - * return np.asarray(ts) # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ts, 3, (PyObject *(*)(char *)) __pyx_memview_get_char, (int (*)(char *, PyObject *)) __pyx_memview_set_char, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __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_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "src/helpers/helpers.pyx":1478 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) * - * @cython.boundscheck(False) - * def calcResidenceTimeseries(char [:,:] ds, int nshells): # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * - * cdef int nmol = len(ds) */ /* function exit code */ __pyx_L1_error:; - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1); - __Pyx_AddTraceback("newanalysis.helpers.calcResidenceTimeseries", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_ts, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":1495 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) * - * @cython.boundscheck(False) - * def calcAngularDisplacement(double [:,:] wts, double dt): # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * cdef int tn = wts.shape[0] */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_69calcAngularDisplacement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_69calcAngularDisplacement = {"calcAngularDisplacement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_69calcAngularDisplacement, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_69calcAngularDisplacement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_wts = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dt; +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcAngularDisplacement (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wts,&__pyx_n_s_dt,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wts)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcAngularDisplacement", 1, 2, 2, 1); __PYX_ERR(0, 1495, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcAngularDisplacement") < 0)) __PYX_ERR(0, 1495, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_wts = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_wts.memview)) __PYX_ERR(0, 1495, __pyx_L3_error) - __pyx_v_dt = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dt == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1495, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcAngularDisplacement", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1495, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcAngularDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_68calcAngularDisplacement(__pyx_self, __pyx_v_wts, __pyx_v_dt); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* function exit code */ - __Pyx_RefNannyFinishContext(); + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + */ + __Pyx_XDECREF(__pyx_r); + __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_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_68calcAngularDisplacement(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_wts, double __pyx_v_dt) { - int __pyx_v_tn; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - __Pyx_memviewslice __pyx_v_integral = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_msd = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_t_6 = NULL; - __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcAngularDisplacement", 0); + int __pyx_t_1; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - /* "src/helpers/helpers.pyx":1497 - * def calcAngularDisplacement(double [:,:] wts, double dt): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 * - * cdef int tn = wts.shape[0] # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef double [:,:] integral = np.zeros((tn,3)) + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: */ - __pyx_v_tn = (__pyx_v_wts.shape[0]); + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":1499 - * cdef int tn = wts.shape[0] - * cdef int i, j, k - * cdef double [:,:] integral = np.zeros((tn,3)) # <<<<<<<<<<<<<< - * cdef double [:,:] msd = np.zeros((tn,3)) - * cdef int [:] ctr = np.zeros(tn, dtype=np.int32) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":790 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_tn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3); - __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1499, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_integral = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); + __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1500 - * cdef int i, j, k - * cdef double [:,:] integral = np.zeros((tn,3)) - * cdef double [:,:] msd = np.zeros((tn,3)) # <<<<<<<<<<<<<< - * cdef int [:] ctr = np.zeros(tn, dtype=np.int32) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_tn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_3); - __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1500, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_msd = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; - /* "src/helpers/helpers.pyx":1501 - * cdef double [:,:] integral = np.zeros((tn,3)) - * cdef double [:,:] msd = np.zeros((tn,3)) - * cdef int [:] ctr = np.zeros(tn, dtype=np.int32) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":792 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< + * * - * # calculate integral */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_tn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 1501, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1501, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_ctr = __pyx_t_7; - __pyx_t_7.memview = NULL; - __pyx_t_7.data = NULL; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_empty_tuple); + __pyx_r = __pyx_empty_tuple; + goto __pyx_L0; + } - /* "src/helpers/helpers.pyx":1504 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * # calculate integral - * for i in range(1,tn): # <<<<<<<<<<<<<< - * for j in range(3): - * k = i-1 + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape */ - __pyx_t_8 = __pyx_v_tn; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 1; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; - /* "src/helpers/helpers.pyx":1505 - * # calculate integral - * for i in range(1,tn): - * for j in range(3): # <<<<<<<<<<<<<< - * k = i-1 - * integral[i,j] = integral[k,j] + (wts[k,j] + wts[i,j]) * 0.5 * dt - */ - for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { - __pyx_v_j = __pyx_t_11; + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/helpers.pyx":1506 - * for i in range(1,tn): - * for j in range(3): - * k = i-1 # <<<<<<<<<<<<<< - * integral[i,j] = integral[k,j] + (wts[k,j] + wts[i,j]) * 0.5 * dt +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ - __pyx_v_k = (__pyx_v_i - 1); - /* "src/helpers/helpers.pyx":1507 - * for j in range(3): - * k = i-1 - * integral[i,j] = integral[k,j] + (wts[k,j] + wts[i,j]) * 0.5 * dt # <<<<<<<<<<<<<< +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_array_base", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":968 + * + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) * - * # calculate angular displacement */ - __pyx_t_12 = __pyx_v_k; - __pyx_t_13 = __pyx_v_j; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_integral.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_integral.shape[1]; - __pyx_t_14 = __pyx_v_k; - __pyx_t_15 = __pyx_v_j; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_wts.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_wts.shape[1]; - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = __pyx_v_j; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_wts.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_wts.shape[1]; - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_integral.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_integral.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_integral.data + __pyx_t_18 * __pyx_v_integral.strides[0]) ) + __pyx_t_19 * __pyx_v_integral.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_integral.data + __pyx_t_12 * __pyx_v_integral.strides[0]) ) + __pyx_t_13 * __pyx_v_integral.strides[1]) ))) + ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_wts.data + __pyx_t_14 * __pyx_v_wts.strides[0]) ) + __pyx_t_15 * __pyx_v_wts.strides[1]) ))) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_wts.data + __pyx_t_16 * __pyx_v_wts.strides[0]) ) + __pyx_t_17 * __pyx_v_wts.strides[1]) )))) * 0.5) * __pyx_v_dt)); - } - } + Py_INCREF(__pyx_v_base); - /* "src/helpers/helpers.pyx":1510 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":969 + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< * - * # calculate angular displacement - * for i in prange(tn,nogil=True,schedule=dynamic): # <<<<<<<<<<<<<< - * for j in range(tn-i): - * for k in range(3): + * cdef inline object get_array_base(ndarray arr): */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_8 = __pyx_v_tn; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_10 = (__pyx_t_8 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_10 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_20, __pyx_t_21, __pyx_t_22) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) - #endif /* _OPENMP */ - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_9); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 969, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1511 - * # calculate angular displacement - * for i in prange(tn,nogil=True,schedule=dynamic): - * for j in range(tn-i): # <<<<<<<<<<<<<< - * for k in range(3): - * msd[i,k] += pow(integral[j,k] - integral[j+i,k], 2) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ - __pyx_t_11 = (__pyx_v_tn - __pyx_v_i); - __pyx_t_20 = __pyx_t_11; - for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { - __pyx_v_j = __pyx_t_21; - /* "src/helpers/helpers.pyx":1512 - * for i in prange(tn,nogil=True,schedule=dynamic): - * for j in range(tn-i): - * for k in range(3): # <<<<<<<<<<<<<< - * msd[i,k] += pow(integral[j,k] - integral[j+i,k], 2) - * ctr[i] += 1 - */ - for (__pyx_t_22 = 0; __pyx_t_22 < 3; __pyx_t_22+=1) { - __pyx_v_k = __pyx_t_22; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} - /* "src/helpers/helpers.pyx":1513 - * for j in range(tn-i): - * for k in range(3): - * msd[i,k] += pow(integral[j,k] - integral[j+i,k], 2) # <<<<<<<<<<<<<< - * ctr[i] += 1 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ - __pyx_t_17 = __pyx_v_j; - __pyx_t_16 = __pyx_v_k; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_integral.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_integral.shape[1]; - __pyx_t_15 = (__pyx_v_j + __pyx_v_i); - __pyx_t_14 = __pyx_v_k; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_integral.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_integral.shape[1]; - __pyx_t_13 = __pyx_v_i; - __pyx_t_12 = __pyx_v_k; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_msd.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_msd.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_msd.data + __pyx_t_13 * __pyx_v_msd.strides[0]) ) + __pyx_t_12 * __pyx_v_msd.strides[1]) )) += pow(((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_integral.data + __pyx_t_17 * __pyx_v_integral.strides[0]) ) + __pyx_t_16 * __pyx_v_integral.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_integral.data + __pyx_t_15 * __pyx_v_integral.strides[0]) ) + __pyx_t_14 * __pyx_v_integral.strides[1]) )))), 2.0); - } - /* "src/helpers/helpers.pyx":1514 - * for k in range(3): - * msd[i,k] += pow(integral[j,k] - integral[j+i,k], 2) - * ctr[i] += 1 # <<<<<<<<<<<<<< - * - * for i in range(tn): - */ - __pyx_t_14 = __pyx_v_i; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_ctr.shape[0]; - *((int *) ( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_14 * __pyx_v_ctr.strides[0]) )) += 1; - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "src/helpers/helpers.pyx":1510 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":972 * - * # calculate angular displacement - * for i in prange(tn,nogil=True,schedule=dynamic): # <<<<<<<<<<<<<< - * for j in range(tn-i): - * for k in range(3): + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L9; - } - __pyx_L9:; - } - } + __pyx_v_base = PyArray_BASE(__pyx_v_arr); - /* "src/helpers/helpers.pyx":1516 - * ctr[i] += 1 - * - * for i in range(tn): # <<<<<<<<<<<<<< - * for j in range(3): - * msd[i,j] /= ctr[i] + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base */ - __pyx_t_10 = __pyx_v_tn; - __pyx_t_9 = __pyx_t_10; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { - /* "src/helpers/helpers.pyx":1517 - * - * for i in range(tn): - * for j in range(3): # <<<<<<<<<<<<<< - * msd[i,j] /= ctr[i] + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":974 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base * */ - for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { - __pyx_v_j = __pyx_t_11; + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1518 - * for i in range(tn): - * for j in range(3): - * msd[i,j] /= ctr[i] # <<<<<<<<<<<<<< - * - * return msd + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base */ - __pyx_t_14 = __pyx_v_i; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_ctr.shape[0]; - __pyx_t_15 = __pyx_v_i; - __pyx_t_16 = __pyx_v_j; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_msd.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_msd.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_msd.data + __pyx_t_15 * __pyx_v_msd.strides[0]) ) + __pyx_t_16 * __pyx_v_msd.strides[1]) )) /= (*((int *) ( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_14 * __pyx_v_ctr.strides[0]) ))); - } } - /* "src/helpers/helpers.pyx":1520 - * msd[i,j] /= ctr[i] - * - * return msd # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":975 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * # Versions of the import_* functions which are more suitable for */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_msd, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); goto __pyx_L0; - /* "src/helpers/helpers.pyx":1495 - * - * @cython.boundscheck(False) - * def calcAngularDisplacement(double [:,:] wts, double dt): # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) * - * cdef int tn = wts.shape[0] + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __Pyx_XDECREF(__pyx_t_6); - __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); - __Pyx_AddTraceback("newanalysis.helpers.calcAngularDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_integral, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_msd, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_wts, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":1523 - * - * @cython.boundscheck(False) - * def findNearestAtom(double [:,:] coor_core, double [:,:] coor_surr, double [:] mindist, # <<<<<<<<<<<<<< - * double [:] mindist2, double [:,:] minvec, int [:] next_id): - * +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_71findNearestAtom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_71findNearestAtom = {"findNearestAtom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_71findNearestAtom, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_71findNearestAtom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor_core = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor_surr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_mindist = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_mindist2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_minvec = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_next_id = { 0, 0, { 0 }, { 0 }, { 0 } }; +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("findNearestAtom (wrapper)", 0); + __Pyx_RefNannySetupContext("import_array", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: + */ { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor_core,&__pyx_n_s_coor_surr,&__pyx_n_s_mindist,&__pyx_n_s_mindist2,&__pyx_n_s_minvec,&__pyx_n_s_next_id,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_core)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_surr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, 1); __PYX_ERR(0, 1523, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mindist)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, 2); __PYX_ERR(0, 1523, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mindist2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, 3); __PYX_ERR(0, 1523, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_minvec)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, 4); __PYX_ERR(0, 1523, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next_id)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, 5); __PYX_ERR(0, 1523, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findNearestAtom") < 0)) __PYX_ERR(0, 1523, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":981 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") + */ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 981, __pyx_L3_error) + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: + */ } - __pyx_v_coor_core = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_core.memview)) __PYX_ERR(0, 1523, __pyx_L3_error) - __pyx_v_coor_surr = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_surr.memview)) __PYX_ERR(0, 1523, __pyx_L3_error) - __pyx_v_mindist = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mindist.memview)) __PYX_ERR(0, 1523, __pyx_L3_error) - __pyx_v_mindist2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mindist2.memview)) __PYX_ERR(0, 1524, __pyx_L3_error) - __pyx_v_minvec = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_minvec.memview)) __PYX_ERR(0, 1524, __pyx_L3_error) - __pyx_v_next_id = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_next_id.memview)) __PYX_ERR(0, 1524, __pyx_L3_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":982 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.multiarray failed to import") + * + */ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 982, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: + */ + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 983, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 983, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: + */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1523, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.findNearestAtom", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_70findNearestAtom(__pyx_self, __pyx_v_coor_core, __pyx_v_coor_surr, __pyx_v_mindist, __pyx_v_mindist2, __pyx_v_minvec, __pyx_v_next_id); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() + */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_70findNearestAtom(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor_core, __Pyx_memviewslice __pyx_v_coor_surr, __Pyx_memviewslice __pyx_v_mindist, __Pyx_memviewslice __pyx_v_mindist2, __Pyx_memviewslice __pyx_v_minvec, __Pyx_memviewslice __pyx_v_next_id) { - CYTHON_UNUSED int __pyx_v_n_core; - int __pyx_v_n_surr; - int __pyx_v_i; - int __pyx_v_j; - double __pyx_v_tmp_x; - double __pyx_v_tmp_y; - double __pyx_v_tmp_z; - double __pyx_v_dist2; - PyObject *__pyx_r = NULL; +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() + */ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - __Pyx_RefNannySetupContext("findNearestAtom", 0); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); - /* "src/helpers/helpers.pyx":1526 - * double [:] mindist2, double [:,:] minvec, int [:] next_id): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * cdef int n_core = coor_core.shape[0] # <<<<<<<<<<<<<< - * cdef int n_surr = coor_surr.shape[0] - * cdef int i, j + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_v_n_core = (__pyx_v_coor_core.shape[0]); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "src/helpers/helpers.pyx":1527 - * - * cdef int n_core = coor_core.shape[0] - * cdef int n_surr = coor_surr.shape[0] # <<<<<<<<<<<<<< - * cdef int i, j + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":987 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") + */ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 987, __pyx_L3_error) + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_v_n_surr = (__pyx_v_coor_surr.shape[0]); + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "src/helpers/helpers.pyx":1532 - * cdef double tmp_x, tmp_y, tmp_z, dist2 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":988 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") * - * for i in prange(n_core, nogil=True): # <<<<<<<<<<<<<< - * for j in range(n_surr): - * tmp_x = coor_surr[j,0] - coor_core[i,0] */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_n_core; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_dist2) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_tmp_x) lastprivate(__pyx_v_tmp_y) lastprivate(__pyx_v_tmp_z) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - /* Initialize private variables to invalid values */ - __pyx_v_dist2 = ((double)__PYX_NAN()); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_tmp_x = ((double)__PYX_NAN()); - __pyx_v_tmp_y = ((double)__PYX_NAN()); - __pyx_v_tmp_z = ((double)__PYX_NAN()); + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 988, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "src/helpers/helpers.pyx":1533 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * - * for i in prange(n_core, nogil=True): - * for j in range(n_surr): # <<<<<<<<<<<<<< - * tmp_x = coor_surr[j,0] - coor_core[i,0] - * tmp_y = coor_surr[j,1] - coor_core[i,1] + * cdef inline int import_ufunc() except -1: */ - __pyx_t_4 = __pyx_v_n_surr; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_j = __pyx_t_6; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 989, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 989, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "src/helpers/helpers.pyx":1534 - * for i in prange(n_core, nogil=True): - * for j in range(n_surr): - * tmp_x = coor_surr[j,0] - coor_core[i,0] # <<<<<<<<<<<<<< - * tmp_y = coor_surr[j,1] - coor_core[i,1] - * tmp_z = coor_surr[j,2] - coor_core[i,2] + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 + * + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_7 = __pyx_v_j; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor_surr.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor_surr.shape[1]; - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = 0; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor_core.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_core.shape[1]; - __pyx_v_tmp_x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_7 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_8 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_core.data + __pyx_t_9 * __pyx_v_coor_core.strides[0]) ) + __pyx_t_10 * __pyx_v_coor_core.strides[1]) )))); + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } - /* "src/helpers/helpers.pyx":1535 - * for j in range(n_surr): - * tmp_x = coor_surr[j,0] - coor_core[i,0] - * tmp_y = coor_surr[j,1] - coor_core[i,1] # <<<<<<<<<<<<<< - * tmp_z = coor_surr[j,2] - coor_core[i,2] + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ - __pyx_t_10 = __pyx_v_j; - __pyx_t_9 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_surr.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor_surr.shape[1]; - __pyx_t_8 = __pyx_v_i; - __pyx_t_7 = 1; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor_core.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor_core.shape[1]; - __pyx_v_tmp_y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_10 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_9 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_core.data + __pyx_t_8 * __pyx_v_coor_core.strides[0]) ) + __pyx_t_7 * __pyx_v_coor_core.strides[1]) )))); - /* "src/helpers/helpers.pyx":1536 - * tmp_x = coor_surr[j,0] - coor_core[i,0] - * tmp_y = coor_surr[j,1] - coor_core[i,1] - * tmp_z = coor_surr[j,2] - coor_core[i,2] # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") * - * dist2 = tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ - __pyx_t_7 = __pyx_v_j; - __pyx_t_8 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor_surr.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor_surr.shape[1]; - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = 2; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor_core.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_core.shape[1]; - __pyx_v_tmp_z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_7 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_8 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_core.data + __pyx_t_9 * __pyx_v_coor_core.strides[0]) ) + __pyx_t_10 * __pyx_v_coor_core.strides[1]) )))); - /* "src/helpers/helpers.pyx":1538 - * tmp_z = coor_surr[j,2] - coor_core[i,2] +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * - * dist2 = tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z # <<<<<<<<<<<<<< + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":993 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") + */ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 993, __pyx_L3_error) + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * - * if dist2 < mindist2[i]: + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_v_dist2 = (((__pyx_v_tmp_x * __pyx_v_tmp_x) + (__pyx_v_tmp_y * __pyx_v_tmp_y)) + (__pyx_v_tmp_z * __pyx_v_tmp_z)); + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "src/helpers/helpers.pyx":1540 - * dist2 = tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":994 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") * - * if dist2 < mindist2[i]: # <<<<<<<<<<<<<< - * mindist2[i] = dist2 - * next_id[i] = j */ - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mindist2.shape[0]; - __pyx_t_11 = ((__pyx_v_dist2 < (*((double *) ( /* dim=0 */ (__pyx_v_mindist2.data + __pyx_t_10 * __pyx_v_mindist2.strides[0]) )))) != 0); - if (__pyx_t_11) { + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 994, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "src/helpers/helpers.pyx":1541 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":995 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * - * if dist2 < mindist2[i]: - * mindist2[i] = dist2 # <<<<<<<<<<<<<< - * next_id[i] = j * */ - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mindist2.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_mindist2.data + __pyx_t_10 * __pyx_v_mindist2.strides[0]) )) = __pyx_v_dist2; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 995, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 995, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "src/helpers/helpers.pyx":1542 - * if dist2 < mindist2[i]: - * mindist2[i] = dist2 - * next_id[i] = j # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * - * mindist[i] = sqrt(mindist2[i]) + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_next_id.shape[0]; - *((int *) ( /* dim=0 */ (__pyx_v_next_id.data + __pyx_t_10 * __pyx_v_next_id.strides[0]) )) = __pyx_v_j; + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } - /* "src/helpers/helpers.pyx":1540 - * dist2 = tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") * - * if dist2 < mindist2[i]: # <<<<<<<<<<<<<< - * mindist2[i] = dist2 - * next_id[i] = j + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ - } - } - /* "src/helpers/helpers.pyx":1544 - * next_id[i] = j + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - * mindist[i] = sqrt(mindist2[i]) # <<<<<<<<<<<<<< - * for j in range(3): - * minvec[i,j] = coor_surr[next_id[i],j] - coor_core[i,j] + * + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mindist2.shape[0]; - __pyx_t_9 = __pyx_v_i; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mindist.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_mindist.data + __pyx_t_9 * __pyx_v_mindist.strides[0]) )) = sqrt((*((double *) ( /* dim=0 */ (__pyx_v_mindist2.data + __pyx_t_10 * __pyx_v_mindist2.strides[0]) )))); - /* "src/helpers/helpers.pyx":1545 +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_timedelta64_object", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1010 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< * - * mindist[i] = sqrt(mindist2[i]) - * for j in range(3): # <<<<<<<<<<<<<< - * minvec[i,j] = coor_surr[next_id[i],j] - coor_core[i,j] * */ - for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { - __pyx_v_j = __pyx_t_4; + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1546 - * mindist[i] = sqrt(mindist2[i]) - * for j in range(3): - * minvec[i,j] = coor_surr[next_id[i],j] - coor_core[i,j] # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - * @cython.boundscheck(False) + * + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_next_id.shape[0]; - __pyx_t_9 = (*((int *) ( /* dim=0 */ (__pyx_v_next_id.data + __pyx_t_10 * __pyx_v_next_id.strides[0]) ))); - __pyx_t_8 = __pyx_v_j; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor_surr.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor_surr.shape[1]; - __pyx_t_7 = __pyx_v_i; - __pyx_t_12 = __pyx_v_j; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor_core.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor_core.shape[1]; - __pyx_t_13 = __pyx_v_i; - __pyx_t_14 = __pyx_v_j; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_minvec.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_minvec.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_minvec.data + __pyx_t_13 * __pyx_v_minvec.strides[0]) ) + __pyx_t_14 * __pyx_v_minvec.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_9 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_8 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_core.data + __pyx_t_7 * __pyx_v_coor_core.strides[0]) ) + __pyx_t_12 * __pyx_v_coor_core.strides[1]) )))); - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/helpers/helpers.pyx":1532 - * cdef double tmp_x, tmp_y, tmp_z, dist2 + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * for i in prange(n_core, nogil=True): # <<<<<<<<<<<<<< - * for j in range(n_surr): - * tmp_x = coor_surr[j,0] - coor_core[i,0] + * + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - /* "src/helpers/helpers.pyx":1523 +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_datetime64_object", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1025 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * @cython.boundscheck(False) - * def findNearestAtom(double [:,:] coor_core, double [:,:] coor_surr, double [:] mindist, # <<<<<<<<<<<<<< - * double [:] mindist2, double [:,:] minvec, int [:] next_id): * + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor_core, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor_surr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_mindist, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_mindist2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_minvec, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_next_id, 1); - __Pyx_XGIVEREF(__pyx_r); + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":1549 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object + */ + +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1035 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object + */ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1042 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. + */ + +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1049 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + */ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 + * + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "newanalysis/helpers/helpers.pyx":20 + * void GetRotation(double *R_ptr, int n, double *APoints_ptr, double *BPoints_ptr, int debug) + * + * cdef int sgn2bin(double val): # <<<<<<<<<<<<<< + * return ( 0.0 < val) + * + */ + +static int __pyx_f_11newanalysis_7helpers_sgn2bin(double __pyx_v_val) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sgn2bin", 0); + + /* "newanalysis/helpers/helpers.pyx":21 + * + * cdef int sgn2bin(double val): + * return ( 0.0 < val) # <<<<<<<<<<<<<< * * @cython.boundscheck(False) - * def checkHBond(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist): # <<<<<<<<<<<<<< - * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr + */ + __pyx_r = (((double)0.0) < __pyx_v_val); + goto __pyx_L0; + + /* "newanalysis/helpers/helpers.pyx":20 + * void GetRotation(double *R_ptr, int n, double *APoints_ptr, double *BPoints_ptr, int debug) + * + * cdef int sgn2bin(double val): # <<<<<<<<<<<<<< + * return ( 0.0 < val) + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/helpers.pyx":23 + * return ( 0.0 < val) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def SphereinCube(double A, int numpoints, double gfunc, double deltaA): + * cdef int i, j, k, sumr */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_73checkHBond(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_73checkHBond = {"checkHBond", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_73checkHBond, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_73checkHBond(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor_surr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor_oh2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_nres_surr; - double __pyx_v_maxdist; +static PyObject *__pyx_pw_11newanalysis_7helpers_1SphereinCube(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_1SphereinCube = {"SphereinCube", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_1SphereinCube, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_1SphereinCube(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + double __pyx_v_A; + int __pyx_v_numpoints; + double __pyx_v_gfunc; + double __pyx_v_deltaA; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("checkHBond (wrapper)", 0); + __Pyx_RefNannySetupContext("SphereinCube (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 23, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor_surr,&__pyx_n_s_coor_oh2,&__pyx_n_s_nres_surr,&__pyx_n_s_maxdist,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_numpoints,&__pyx_n_s_gfunc,&__pyx_n_s_deltaA,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_surr)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_A)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_oh2)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_numpoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("checkHBond", 1, 4, 4, 1); __PYX_ERR(0, 1549, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("SphereinCube", 1, 4, 4, 1); __PYX_ERR(0, 23, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nres_surr)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gfunc)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("checkHBond", 1, 4, 4, 2); __PYX_ERR(0, 1549, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("SphereinCube", 1, 4, 4, 2); __PYX_ERR(0, 23, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxdist)) != 0)) kw_args--; + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_deltaA)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("checkHBond", 1, 4, 4, 3); __PYX_ERR(0, 1549, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("SphereinCube", 1, 4, 4, 3); __PYX_ERR(0, 23, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "checkHBond") < 0)) __PYX_ERR(0, 1549, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "SphereinCube") < 0)) __PYX_ERR(0, 23, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (unlikely(__pyx_nargs != 4)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); } - __pyx_v_coor_surr = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_surr.memview)) __PYX_ERR(0, 1549, __pyx_L3_error) - __pyx_v_coor_oh2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_oh2.memview)) __PYX_ERR(0, 1549, __pyx_L3_error) - __pyx_v_nres_surr = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nres_surr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1549, __pyx_L3_error) - __pyx_v_maxdist = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_maxdist == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1549, __pyx_L3_error) + __pyx_v_A = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_A == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) + __pyx_v_numpoints = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_numpoints == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) + __pyx_v_gfunc = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_gfunc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) + __pyx_v_deltaA = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_deltaA == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("checkHBond", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1549, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("SphereinCube", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 23, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.checkHBond", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.helpers.SphereinCube", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_72checkHBond(__pyx_self, __pyx_v_coor_surr, __pyx_v_coor_oh2, __pyx_v_nres_surr, __pyx_v_maxdist); + __pyx_r = __pyx_pf_11newanalysis_7helpers_SphereinCube(__pyx_self, __pyx_v_A, __pyx_v_numpoints, __pyx_v_gfunc, __pyx_v_deltaA); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_72checkHBond(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor_surr, __Pyx_memviewslice __pyx_v_coor_oh2, int __pyx_v_nres_surr, double __pyx_v_maxdist) { - int __pyx_v_sites_per_res; - int __pyx_v_nsurr; - int __pyx_v_nwat; +static PyObject *__pyx_pf_11newanalysis_7helpers_SphereinCube(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_A, int __pyx_v_numpoints, double __pyx_v_gfunc, double __pyx_v_deltaA) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_k; - int __pyx_v_l; - int __pyx_v_idx; - int __pyx_v_idx2; - int __pyx_v_idx3; - __Pyx_memviewslice __pyx_v_hbond = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_dx2; - double __pyx_v_dy2; - double __pyx_v_dz2; - double __pyx_v_dot; - double __pyx_v_dot2; - double __pyx_v_dist; - double __pyx_v_dist2; - double __pyx_v_cosine; + int __pyx_v_sumr; + double __pyx_v_x; + double __pyx_v_y; + double __pyx_v_z; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - double __pyx_t_22; - double __pyx_t_23; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("checkHBond", 0); - - /* "src/helpers/helpers.pyx":1551 - * def checkHBond(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist): - * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr # <<<<<<<<<<<<<< - * cdef int nsurr = coor_surr.shape[0] / sites_per_res - * cdef int nwat = coor_oh2.shape[0] / 3 - */ - if (unlikely(__pyx_v_nres_surr == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1551, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nres_surr == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW((__pyx_v_coor_surr.shape[0])))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1551, __pyx_L1_error) - } - __pyx_v_sites_per_res = __Pyx_div_Py_ssize_t((__pyx_v_coor_surr.shape[0]), __pyx_v_nres_surr); - - /* "src/helpers/helpers.pyx":1552 - * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr - * cdef int nsurr = coor_surr.shape[0] / sites_per_res # <<<<<<<<<<<<<< - * cdef int nwat = coor_oh2.shape[0] / 3 - * cdef int i, j, k, l, idx, idx2, idx3 - */ - if (unlikely(__pyx_v_sites_per_res == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1552, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_sites_per_res == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW((__pyx_v_coor_surr.shape[0])))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1552, __pyx_L1_error) - } - __pyx_v_nsurr = __Pyx_div_Py_ssize_t((__pyx_v_coor_surr.shape[0]), __pyx_v_sites_per_res); - - /* "src/helpers/helpers.pyx":1553 - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr - * cdef int nsurr = coor_surr.shape[0] / sites_per_res - * cdef int nwat = coor_oh2.shape[0] / 3 # <<<<<<<<<<<<<< - * cdef int i, j, k, l, idx, idx2, idx3 - * - */ - __pyx_v_nwat = __Pyx_div_Py_ssize_t((__pyx_v_coor_oh2.shape[0]), 3); + __Pyx_RefNannySetupContext("SphereinCube", 0); - /* "src/helpers/helpers.pyx":1556 - * cdef int i, j, k, l, idx, idx2, idx3 - * - * cdef char [:] hbond = np.zeros(nwat, dtype=np.int8) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":28 + * cdef double vol,x,y,z * - * cdef double dx, dy, dz, dx2, dy2, dz2, dot, dot2, dist, dist2, cosine + * sumr=0 # <<<<<<<<<<<<<< + * for i in prange(numpoints,nogil=True): + * x=-A/2+(i+0.5)*deltaA */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nwat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1556, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1556, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_hbond = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_v_sumr = 0; - /* "src/helpers/helpers.pyx":1561 + /* "newanalysis/helpers/helpers.pyx":29 * - * # loop over water molecules - * for i in prange(nwat, nogil=True): # <<<<<<<<<<<<<< - * if hbond[i] == 0: - * # loop over h atoms + * sumr=0 + * for i in prange(numpoints,nogil=True): # <<<<<<<<<<<<<< + * x=-A/2+(i+0.5)*deltaA + * for j in range(numpoints): */ { #ifdef WITH_THREAD PyThreadState *_save; + _save = NULL; Py_UNBLOCK_THREADS __Pyx_FastGIL_Remember(); #endif /*try:*/ { - __pyx_t_7 = __pyx_v_nwat; - if ((1 == 0)) abort(); + __pyx_t_1 = __pyx_v_numpoints; { - double __pyx_parallel_temp0 = ((double)__PYX_NAN()); - double __pyx_parallel_temp1 = ((double)__PYX_NAN()); - double __pyx_parallel_temp2 = ((double)__PYX_NAN()); - double __pyx_parallel_temp3 = ((double)__PYX_NAN()); - double __pyx_parallel_temp4 = ((double)__PYX_NAN()); - double __pyx_parallel_temp5 = ((double)__PYX_NAN()); - double __pyx_parallel_temp6 = ((double)__PYX_NAN()); - double __pyx_parallel_temp7 = ((double)__PYX_NAN()); - double __pyx_parallel_temp8 = ((double)__PYX_NAN()); - double __pyx_parallel_temp9 = ((double)__PYX_NAN()); - double __pyx_parallel_temp10 = ((double)__PYX_NAN()); - int __pyx_parallel_temp11 = ((int)0xbad0bad0); - int __pyx_parallel_temp12 = ((int)0xbad0bad0); - int __pyx_parallel_temp13 = ((int)0xbad0bad0); - int __pyx_parallel_temp14 = ((int)0xbad0bad0); - int __pyx_parallel_temp15 = ((int)0xbad0bad0); - int __pyx_parallel_temp16 = ((int)0xbad0bad0); - int __pyx_parallel_temp17 = ((int)0xbad0bad0); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) #undef likely #undef unlikely #define likely(x) (x) #define unlikely(x) (x) #endif - __pyx_t_9 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_9 > 0) + __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_3 > 0) { #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #pragma omp parallel reduction(+:__pyx_v_sumr) private(__pyx_t_10, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) #endif /* _OPENMP */ { #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_cosine) lastprivate(__pyx_v_dist) lastprivate(__pyx_v_dist2) lastprivate(__pyx_v_dot) lastprivate(__pyx_v_dot2) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dx2) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dy2) lastprivate(__pyx_v_dz) lastprivate(__pyx_v_dz2) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_idx2) lastprivate(__pyx_v_idx3) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_l) + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_x) lastprivate(__pyx_v_y) lastprivate(__pyx_v_z) #endif /* _OPENMP */ - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){ - if (__pyx_parallel_why < 2) + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ { - __pyx_v_i = (int)(0 + 1 * __pyx_t_8); + __pyx_v_i = (int)(0 + 1 * __pyx_t_2); /* Initialize private variables to invalid values */ - __pyx_v_cosine = ((double)__PYX_NAN()); - __pyx_v_dist = ((double)__PYX_NAN()); - __pyx_v_dist2 = ((double)__PYX_NAN()); - __pyx_v_dot = ((double)__PYX_NAN()); - __pyx_v_dot2 = ((double)__PYX_NAN()); - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dx2 = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dy2 = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_dz2 = ((double)__PYX_NAN()); - __pyx_v_idx = ((int)0xbad0bad0); - __pyx_v_idx2 = ((int)0xbad0bad0); - __pyx_v_idx3 = ((int)0xbad0bad0); __pyx_v_j = ((int)0xbad0bad0); __pyx_v_k = ((int)0xbad0bad0); - __pyx_v_l = ((int)0xbad0bad0); + __pyx_v_x = ((double)__PYX_NAN()); + __pyx_v_y = ((double)__PYX_NAN()); + __pyx_v_z = ((double)__PYX_NAN()); - /* "src/helpers/helpers.pyx":1562 - * # loop over water molecules - * for i in prange(nwat, nogil=True): - * if hbond[i] == 0: # <<<<<<<<<<<<<< - * # loop over h atoms - * for j in range(2): + /* "newanalysis/helpers/helpers.pyx":30 + * sumr=0 + * for i in prange(numpoints,nogil=True): + * x=-A/2+(i+0.5)*deltaA # <<<<<<<<<<<<<< + * for j in range(numpoints): + * y=-A/2+(j+0.5)*deltaA */ - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_hbond.shape[0]; - __pyx_t_11 = (((*((char *) ( /* dim=0 */ (__pyx_v_hbond.data + __pyx_t_10 * __pyx_v_hbond.strides[0]) ))) == 0) != 0); - if (__pyx_t_11) { + __pyx_v_x = (((-__pyx_v_A) / 2.0) + ((__pyx_v_i + 0.5) * __pyx_v_deltaA)); - /* "src/helpers/helpers.pyx":1564 - * if hbond[i] == 0: - * # loop over h atoms - * for j in range(2): # <<<<<<<<<<<<<< - * if hbond[i] == 0: - * idx = i*3+1+j + /* "newanalysis/helpers/helpers.pyx":31 + * for i in prange(numpoints,nogil=True): + * x=-A/2+(i+0.5)*deltaA + * for j in range(numpoints): # <<<<<<<<<<<<<< + * y=-A/2+(j+0.5)*deltaA + * for k in range(numpoints): */ - for (__pyx_t_12 = 0; __pyx_t_12 < 2; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; + __pyx_t_4 = __pyx_v_numpoints; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_j = __pyx_t_6; - /* "src/helpers/helpers.pyx":1565 - * # loop over h atoms - * for j in range(2): - * if hbond[i] == 0: # <<<<<<<<<<<<<< - * idx = i*3+1+j - * idx3 = i*3 + /* "newanalysis/helpers/helpers.pyx":32 + * x=-A/2+(i+0.5)*deltaA + * for j in range(numpoints): + * y=-A/2+(j+0.5)*deltaA # <<<<<<<<<<<<<< + * for k in range(numpoints): + * z=-A/2+(k+0.5)*deltaA */ - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_hbond.shape[0]; - __pyx_t_11 = (((*((char *) ( /* dim=0 */ (__pyx_v_hbond.data + __pyx_t_10 * __pyx_v_hbond.strides[0]) ))) == 0) != 0); - if (__pyx_t_11) { + __pyx_v_y = (((-__pyx_v_A) / 2.0) + ((__pyx_v_j + 0.5) * __pyx_v_deltaA)); - /* "src/helpers/helpers.pyx":1566 - * for j in range(2): - * if hbond[i] == 0: - * idx = i*3+1+j # <<<<<<<<<<<<<< - * idx3 = i*3 - * # loop over surrounding molecules + /* "newanalysis/helpers/helpers.pyx":33 + * for j in range(numpoints): + * y=-A/2+(j+0.5)*deltaA + * for k in range(numpoints): # <<<<<<<<<<<<<< + * z=-A/2+(k+0.5)*deltaA + * */ - __pyx_v_idx = (((__pyx_v_i * 3) + 1) + __pyx_v_j); + __pyx_t_7 = __pyx_v_numpoints; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_k = __pyx_t_9; - /* "src/helpers/helpers.pyx":1567 - * if hbond[i] == 0: - * idx = i*3+1+j - * idx3 = i*3 # <<<<<<<<<<<<<< - * # loop over surrounding molecules - * for k in range(nsurr): + /* "newanalysis/helpers/helpers.pyx":34 + * y=-A/2+(j+0.5)*deltaA + * for k in range(numpoints): + * z=-A/2+(k+0.5)*deltaA # <<<<<<<<<<<<<< + * + * if x*x+y*y+z*z <= gfunc**2: */ - __pyx_v_idx3 = (__pyx_v_i * 3); + __pyx_v_z = (((-__pyx_v_A) / 2.0) + ((__pyx_v_k + 0.5) * __pyx_v_deltaA)); - /* "src/helpers/helpers.pyx":1569 - * idx3 = i*3 - * # loop over surrounding molecules - * for k in range(nsurr): # <<<<<<<<<<<<<< - * if hbond[i] == 0: - * # loop over oxygen atoms - */ - __pyx_t_13 = __pyx_v_nsurr; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_k = __pyx_t_15; - - /* "src/helpers/helpers.pyx":1570 - * # loop over surrounding molecules - * for k in range(nsurr): - * if hbond[i] == 0: # <<<<<<<<<<<<<< - * # loop over oxygen atoms - * for l in range(sites_per_res): - */ - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_hbond.shape[0]; - __pyx_t_11 = (((*((char *) ( /* dim=0 */ (__pyx_v_hbond.data + __pyx_t_10 * __pyx_v_hbond.strides[0]) ))) == 0) != 0); - if (__pyx_t_11) { - - /* "src/helpers/helpers.pyx":1572 - * if hbond[i] == 0: - * # loop over oxygen atoms - * for l in range(sites_per_res): # <<<<<<<<<<<<<< - * idx2 = k*sites_per_res+l - * dx = coor_surr[idx2,0] - coor_oh2[idx,0] - */ - __pyx_t_16 = __pyx_v_sites_per_res; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_l = __pyx_t_18; - - /* "src/helpers/helpers.pyx":1573 - * # loop over oxygen atoms - * for l in range(sites_per_res): - * idx2 = k*sites_per_res+l # <<<<<<<<<<<<<< - * dx = coor_surr[idx2,0] - coor_oh2[idx,0] - * dy = coor_surr[idx2,1] - coor_oh2[idx,1] - */ - __pyx_v_idx2 = ((__pyx_v_k * __pyx_v_sites_per_res) + __pyx_v_l); - - /* "src/helpers/helpers.pyx":1574 - * for l in range(sites_per_res): - * idx2 = k*sites_per_res+l - * dx = coor_surr[idx2,0] - coor_oh2[idx,0] # <<<<<<<<<<<<<< - * dy = coor_surr[idx2,1] - coor_oh2[idx,1] - * dz = coor_surr[idx2,2] - coor_oh2[idx,2] - */ - __pyx_t_10 = __pyx_v_idx2; - __pyx_t_19 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_surr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_surr.shape[1]; - __pyx_t_20 = __pyx_v_idx; - __pyx_t_21 = 0; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_10 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_20 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_21 * __pyx_v_coor_oh2.strides[1]) )))); - - /* "src/helpers/helpers.pyx":1575 - * idx2 = k*sites_per_res+l - * dx = coor_surr[idx2,0] - coor_oh2[idx,0] - * dy = coor_surr[idx2,1] - coor_oh2[idx,1] # <<<<<<<<<<<<<< - * dz = coor_surr[idx2,2] - coor_oh2[idx,2] - * dot = dx*dx + dy*dy + dz*dz - */ - __pyx_t_21 = __pyx_v_idx2; - __pyx_t_20 = 1; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_surr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_surr.shape[1]; - __pyx_t_19 = __pyx_v_idx; - __pyx_t_10 = 1; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_21 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_10 * __pyx_v_coor_oh2.strides[1]) )))); - - /* "src/helpers/helpers.pyx":1576 - * dx = coor_surr[idx2,0] - coor_oh2[idx,0] - * dy = coor_surr[idx2,1] - coor_oh2[idx,1] - * dz = coor_surr[idx2,2] - coor_oh2[idx,2] # <<<<<<<<<<<<<< - * dot = dx*dx + dy*dy + dz*dz - * dist = sqrt(dot) - */ - __pyx_t_10 = __pyx_v_idx2; - __pyx_t_19 = 2; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_surr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_surr.shape[1]; - __pyx_t_20 = __pyx_v_idx; - __pyx_t_21 = 2; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_10 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_20 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_21 * __pyx_v_coor_oh2.strides[1]) )))); - - /* "src/helpers/helpers.pyx":1577 - * dy = coor_surr[idx2,1] - coor_oh2[idx,1] - * dz = coor_surr[idx2,2] - coor_oh2[idx,2] - * dot = dx*dx + dy*dy + dz*dz # <<<<<<<<<<<<<< - * dist = sqrt(dot) - * if dist < maxdist: - */ - __pyx_v_dot = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); - - /* "src/helpers/helpers.pyx":1578 - * dz = coor_surr[idx2,2] - coor_oh2[idx,2] - * dot = dx*dx + dy*dy + dz*dz - * dist = sqrt(dot) # <<<<<<<<<<<<<< - * if dist < maxdist: - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] - */ - __pyx_v_dist = sqrt(__pyx_v_dot); - - /* "src/helpers/helpers.pyx":1579 - * dot = dx*dx + dy*dy + dz*dz - * dist = sqrt(dot) - * if dist < maxdist: # <<<<<<<<<<<<<< - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] - */ - __pyx_t_11 = ((__pyx_v_dist < __pyx_v_maxdist) != 0); - if (__pyx_t_11) { - - /* "src/helpers/helpers.pyx":1580 - * dist = sqrt(dot) - * if dist < maxdist: - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] # <<<<<<<<<<<<<< - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] - * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] - */ - __pyx_t_21 = __pyx_v_idx3; - __pyx_t_20 = 0; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[1]; - __pyx_t_19 = __pyx_v_idx; - __pyx_t_10 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dx2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_21 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_10 * __pyx_v_coor_oh2.strides[1]) )))); - - /* "src/helpers/helpers.pyx":1581 - * if dist < maxdist: - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] # <<<<<<<<<<<<<< - * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] - * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 - */ - __pyx_t_10 = __pyx_v_idx3; - __pyx_t_19 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[1]; - __pyx_t_20 = __pyx_v_idx; - __pyx_t_21 = 1; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dy2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_10 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_20 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_21 * __pyx_v_coor_oh2.strides[1]) )))); - - /* "src/helpers/helpers.pyx":1582 - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] - * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] # <<<<<<<<<<<<<< - * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 - * dist2 = sqrt(dot2) - */ - __pyx_t_21 = __pyx_v_idx3; - __pyx_t_20 = 2; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[1]; - __pyx_t_19 = __pyx_v_idx; - __pyx_t_10 = 2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dz2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_21 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_10 * __pyx_v_coor_oh2.strides[1]) )))); - - /* "src/helpers/helpers.pyx":1583 - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] - * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] - * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 # <<<<<<<<<<<<<< - * dist2 = sqrt(dot2) - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) - */ - __pyx_v_dot2 = (((__pyx_v_dx2 * __pyx_v_dx2) + (__pyx_v_dy2 * __pyx_v_dy2)) + (__pyx_v_dz2 * __pyx_v_dz2)); - - /* "src/helpers/helpers.pyx":1584 - * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] - * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 - * dist2 = sqrt(dot2) # <<<<<<<<<<<<<< - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) - * if cosine < -0.95: - */ - __pyx_v_dist2 = sqrt(__pyx_v_dot2); - - /* "src/helpers/helpers.pyx":1585 - * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 - * dist2 = sqrt(dot2) - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) # <<<<<<<<<<<<<< - * if cosine < -0.95: - * hbond[i] = 1 - */ - __pyx_t_22 = (((__pyx_v_dx * __pyx_v_dx2) + (__pyx_v_dy * __pyx_v_dy2)) + (__pyx_v_dz * __pyx_v_dz2)); - __pyx_t_23 = (__pyx_v_dist * __pyx_v_dist2); - if (unlikely(__pyx_t_23 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 1585, __pyx_L8_error) - } - __pyx_v_cosine = (__pyx_t_22 / __pyx_t_23); - - /* "src/helpers/helpers.pyx":1586 - * dist2 = sqrt(dot2) - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) - * if cosine < -0.95: # <<<<<<<<<<<<<< - * hbond[i] = 1 + /* "newanalysis/helpers/helpers.pyx":36 + * z=-A/2+(k+0.5)*deltaA * + * if x*x+y*y+z*z <= gfunc**2: # <<<<<<<<<<<<<< + * sumr+=1 + * return(sumr) */ - __pyx_t_11 = ((__pyx_v_cosine < -0.95) != 0); - if (__pyx_t_11) { + __pyx_t_10 = ((((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)) + (__pyx_v_z * __pyx_v_z)) <= pow(__pyx_v_gfunc, 2.0)); + if (__pyx_t_10) { - /* "src/helpers/helpers.pyx":1587 - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) - * if cosine < -0.95: - * hbond[i] = 1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":37 * - * return np.asarray(hbond) - */ - __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_hbond.shape[0]; - *((char *) ( /* dim=0 */ (__pyx_v_hbond.data + __pyx_t_10 * __pyx_v_hbond.strides[0]) )) = 1; - - /* "src/helpers/helpers.pyx":1586 - * dist2 = sqrt(dot2) - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) - * if cosine < -0.95: # <<<<<<<<<<<<<< - * hbond[i] = 1 + * if x*x+y*y+z*z <= gfunc**2: + * sumr+=1 # <<<<<<<<<<<<<< + * return(sumr) * */ - } - - /* "src/helpers/helpers.pyx":1579 - * dot = dx*dx + dy*dy + dz*dz - * dist = sqrt(dot) - * if dist < maxdist: # <<<<<<<<<<<<<< - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] - */ - } - } - - /* "src/helpers/helpers.pyx":1570 - * # loop over surrounding molecules - * for k in range(nsurr): - * if hbond[i] == 0: # <<<<<<<<<<<<<< - * # loop over oxygen atoms - * for l in range(sites_per_res): - */ - } - } + __pyx_v_sumr = (__pyx_v_sumr + 1); - /* "src/helpers/helpers.pyx":1565 - * # loop over h atoms - * for j in range(2): - * if hbond[i] == 0: # <<<<<<<<<<<<<< - * idx = i*3+1+j - * idx3 = i*3 + /* "newanalysis/helpers/helpers.pyx":36 + * z=-A/2+(k+0.5)*deltaA + * + * if x*x+y*y+z*z <= gfunc**2: # <<<<<<<<<<<<<< + * sumr+=1 + * return(sumr) */ } } - - /* "src/helpers/helpers.pyx":1562 - * # loop over water molecules - * for i in prange(nwat, nogil=True): - * if hbond[i] == 0: # <<<<<<<<<<<<<< - * # loop over h atoms - * for j in range(2): - */ } - goto __pyx_L22; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L21; - __pyx_L21:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates6) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_cosine; - __pyx_parallel_temp1 = __pyx_v_dist; - __pyx_parallel_temp2 = __pyx_v_dist2; - __pyx_parallel_temp3 = __pyx_v_dot; - __pyx_parallel_temp4 = __pyx_v_dot2; - __pyx_parallel_temp5 = __pyx_v_dx; - __pyx_parallel_temp6 = __pyx_v_dx2; - __pyx_parallel_temp7 = __pyx_v_dy; - __pyx_parallel_temp8 = __pyx_v_dy2; - __pyx_parallel_temp9 = __pyx_v_dz; - __pyx_parallel_temp10 = __pyx_v_dz2; - __pyx_parallel_temp11 = __pyx_v_i; - __pyx_parallel_temp12 = __pyx_v_idx; - __pyx_parallel_temp13 = __pyx_v_idx2; - __pyx_parallel_temp14 = __pyx_v_idx3; - __pyx_parallel_temp15 = __pyx_v_j; - __pyx_parallel_temp16 = __pyx_v_k; - __pyx_parallel_temp17 = __pyx_v_l; - } - __pyx_L22:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ } } - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_cosine = __pyx_parallel_temp0; - __pyx_v_dist = __pyx_parallel_temp1; - __pyx_v_dist2 = __pyx_parallel_temp2; - __pyx_v_dot = __pyx_parallel_temp3; - __pyx_v_dot2 = __pyx_parallel_temp4; - __pyx_v_dx = __pyx_parallel_temp5; - __pyx_v_dx2 = __pyx_parallel_temp6; - __pyx_v_dy = __pyx_parallel_temp7; - __pyx_v_dy2 = __pyx_parallel_temp8; - __pyx_v_dz = __pyx_parallel_temp9; - __pyx_v_dz2 = __pyx_parallel_temp10; - __pyx_v_i = __pyx_parallel_temp11; - __pyx_v_idx = __pyx_parallel_temp12; - __pyx_v_idx2 = __pyx_parallel_temp13; - __pyx_v_idx3 = __pyx_parallel_temp14; - __pyx_v_j = __pyx_parallel_temp15; - __pyx_v_k = __pyx_parallel_temp16; - __pyx_v_l = __pyx_parallel_temp17; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif } - goto __pyx_L4_error; - } } } #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) @@ -25677,12 +21575,12 @@ static PyObject *__pyx_pf_11newanalysis_7helpers_72checkHBond(CYTHON_UNUSED PyOb #endif } - /* "src/helpers/helpers.pyx":1561 + /* "newanalysis/helpers/helpers.pyx":29 * - * # loop over water molecules - * for i in prange(nwat, nogil=True): # <<<<<<<<<<<<<< - * if hbond[i] == 0: - * # loop over h atoms + * sumr=0 + * for i in prange(numpoints,nogil=True): # <<<<<<<<<<<<<< + * x=-A/2+(i+0.5)*deltaA + * for j in range(numpoints): */ /*finally:*/ { /*normal exit:*/{ @@ -25692,891 +21590,807 @@ static PyObject *__pyx_pf_11newanalysis_7helpers_72checkHBond(CYTHON_UNUSED PyOb #endif goto __pyx_L5; } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } __pyx_L5:; } } - /* "src/helpers/helpers.pyx":1589 - * hbond[i] = 1 - * - * return np.asarray(hbond) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":38 + * if x*x+y*y+z*z <= gfunc**2: + * sumr+=1 + * return(sumr) # <<<<<<<<<<<<<< * * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_hbond, 1, (PyObject *(*)(char *)) __pyx_memview_get_char, (int (*)(char *, PyObject *)) __pyx_memview_set_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_sumr); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_r = __pyx_t_11; + __pyx_t_11 = 0; goto __pyx_L0; - /* "src/helpers/helpers.pyx":1549 + /* "newanalysis/helpers/helpers.pyx":23 + * return ( 0.0 < val) * - * @cython.boundscheck(False) - * def checkHBond(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist): # <<<<<<<<<<<<<< - * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def SphereinCube(double A, int numpoints, double gfunc, double deltaA): + * cdef int i, j, k, sumr */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_AddTraceback("newanalysis.helpers.checkHBond", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("newanalysis.helpers.SphereinCube", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_hbond, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor_surr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor_oh2, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":1592 +/* "newanalysis/helpers/helpers.pyx":40 + * return(sumr) * - * @cython.boundscheck(False) - * def sphHarmMatrix(double [:,:] coor, np.complex128_t [:,:] y_mat, int lmax): # <<<<<<<<<<<<<< - * cdef double r, pol, azi - * cdef int nat = coor.shape[0], i, l1, m1, m1r, l2, m2, m2r + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def velcomByResidue(double [:,:] vels, double [:] masses, int nres, int [:] apr, int [:] rfa): + * """ */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_75sphHarmMatrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_75sphHarmMatrix = {"sphHarmMatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_75sphHarmMatrix, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_75sphHarmMatrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_y_mat = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_lmax; +static PyObject *__pyx_pw_11newanalysis_7helpers_3velcomByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_2velcomByResidue, "\n velcomByResidue(vels,masses,nres,atoms_per_residue)\n\n Calculates the center-of-mass velocities for a given selection.\n\n NOTE:\n Don't call this function directly, use the AtomGroup interface instead!\n E.g. for an atom selection 'sel', call \n\n velcom = sel.velcomByResidue() \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_3velcomByResidue = {"velcomByResidue", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_3velcomByResidue, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_2velcomByResidue}; +static PyObject *__pyx_pw_11newanalysis_7helpers_3velcomByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_vels = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_masses = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_nres; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sphHarmMatrix (wrapper)", 0); + __Pyx_RefNannySetupContext("velcomByResidue (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 40, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_y_mat,&__pyx_n_s_lmax,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vels,&__pyx_n_s_masses,&__pyx_n_s_nres,&__pyx_n_s_apr,&__pyx_n_s_rfa,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_vels)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y_mat)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_masses)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("sphHarmMatrix", 1, 3, 3, 1); __PYX_ERR(0, 1592, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 5, 5, 1); __PYX_ERR(0, 40, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lmax)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nres)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 5, 5, 2); __PYX_ERR(0, 40, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("sphHarmMatrix", 1, 3, 3, 2); __PYX_ERR(0, 1592, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 5, 5, 3); __PYX_ERR(0, 40, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 5, 5, 4); __PYX_ERR(0, 40, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sphHarmMatrix") < 0)) __PYX_ERR(0, 1592, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "velcomByResidue") < 0)) __PYX_ERR(0, 40, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 5)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1592, __pyx_L3_error) - __pyx_v_y_mat = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y_mat.memview)) __PYX_ERR(0, 1592, __pyx_L3_error) - __pyx_v_lmax = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_lmax == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1592, __pyx_L3_error) + __pyx_v_vels = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vels.memview)) __PYX_ERR(0, 41, __pyx_L3_error) + __pyx_v_masses = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_masses.memview)) __PYX_ERR(0, 41, __pyx_L3_error) + __pyx_v_nres = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nres == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 41, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 41, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sphHarmMatrix", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1592, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velcomByResidue", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 40, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.sphHarmMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vels, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_masses, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __Pyx_AddTraceback("newanalysis.helpers.velcomByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_74sphHarmMatrix(__pyx_self, __pyx_v_coor, __pyx_v_y_mat, __pyx_v_lmax); + __pyx_r = __pyx_pf_11newanalysis_7helpers_2velcomByResidue(__pyx_self, __pyx_v_vels, __pyx_v_masses, __pyx_v_nres, __pyx_v_apr, __pyx_v_rfa); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vels, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_masses, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_74sphHarmMatrix(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_y_mat, int __pyx_v_lmax) { - double __pyx_v_r; - double __pyx_v_pol; - double __pyx_v_azi; - int __pyx_v_nat; +static PyObject *__pyx_pf_11newanalysis_7helpers_2velcomByResidue(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_vels, __Pyx_memviewslice __pyx_v_masses, int __pyx_v_nres, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa) { + __Pyx_memviewslice __pyx_v_velcom = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_v_i; - int __pyx_v_l1; - int __pyx_v_m1; - int __pyx_v_m1r; - int __pyx_v_l2; - int __pyx_v_m2; - int __pyx_v_m2r; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_actr; + double __pyx_v_tot_mass; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_7; + int __pyx_t_8; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; Py_ssize_t __pyx_t_14; Py_ssize_t __pyx_t_15; - PyObject *__pyx_t_16 = NULL; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - double __pyx_t_19; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - int __pyx_t_22; - PyObject *__pyx_t_23 = NULL; - long __pyx_t_24; - long __pyx_t_25; - long __pyx_t_26; - long __pyx_t_27; - int __pyx_t_28; - long __pyx_t_29; - long __pyx_t_30; - int __pyx_t_31; - long __pyx_t_32; - long __pyx_t_33; - int __pyx_t_34; - PyObject *__pyx_t_35 = NULL; - int __pyx_t_36; - PyObject *__pyx_t_37 = NULL; - PyObject *__pyx_t_38 = NULL; - PyObject *__pyx_t_39 = NULL; - PyObject *__pyx_t_40 = NULL; - __pyx_t_double_complex __pyx_t_41; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sphHarmMatrix", 0); + __Pyx_RefNannySetupContext("velcomByResidue", 0); - /* "src/helpers/helpers.pyx":1594 - * def sphHarmMatrix(double [:,:] coor, np.complex128_t [:,:] y_mat, int lmax): - * cdef double r, pol, azi - * cdef int nat = coor.shape[0], i, l1, m1, m1r, l2, m2, m2r # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":54 + * """ * - * for i in range(nat): + * cdef double [:,:] velcom = np.zeros((nres,3)) # <<<<<<<<<<<<<< + * cdef int i, j, k, actr + * cdef double tot_mass */ - __pyx_v_nat = (__pyx_v_coor.shape[0]); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nres); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3)) __PYX_ERR(0, 54, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_velcom = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "src/helpers/helpers.pyx":1596 - * cdef int nat = coor.shape[0], i, l1, m1, m1r, l2, m2, m2r + /* "newanalysis/helpers/helpers.pyx":58 + * cdef double tot_mass * - * for i in range(nat): # <<<<<<<<<<<<<< - * r = sqrt(coor[i,0]*coor[i,0] + coor[i,1]*coor[i,1] + coor[i,2]*coor[i,2]) - * pol = np.arccos(coor[i,2] / r) + * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< + * tot_mass = 0.0 + * for j in range(apr[i]): */ - __pyx_t_1 = __pyx_v_nat; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_5 = __pyx_v_nres; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_8 = (__pyx_t_5 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_8 > 0) + { + #ifdef _OPENMP + #pragma omp parallel reduction(+:__pyx_v_tot_mass) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_actr) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) + #endif /* _OPENMP */ + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_7); + /* Initialize private variables to invalid values */ + __pyx_v_actr = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); - /* "src/helpers/helpers.pyx":1597 + /* "newanalysis/helpers/helpers.pyx":59 * - * for i in range(nat): - * r = sqrt(coor[i,0]*coor[i,0] + coor[i,1]*coor[i,1] + coor[i,2]*coor[i,2]) # <<<<<<<<<<<<<< - * pol = np.arccos(coor[i,2] / r) - * azi = np.arctan2(coor[i,1] , coor[i,0]) + * for i in prange(nres, nogil=True): + * tot_mass = 0.0 # <<<<<<<<<<<<<< + * for j in range(apr[i]): + * actr = rfa[i] + j */ - __pyx_t_4 = __pyx_v_i; - __pyx_t_5 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor.shape[1]; - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor.shape[1]; - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = 1; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = 2; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[1]; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 2; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - __pyx_v_r = sqrt(((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_5 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_6 * __pyx_v_coor.strides[0]) ) + __pyx_t_7 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) )))))); + __pyx_v_tot_mass = 0.0; - /* "src/helpers/helpers.pyx":1598 - * for i in range(nat): - * r = sqrt(coor[i,0]*coor[i,0] + coor[i,1]*coor[i,1] + coor[i,2]*coor[i,2]) - * pol = np.arccos(coor[i,2] / r) # <<<<<<<<<<<<<< - * azi = np.arctan2(coor[i,1] , coor[i,0]) - * + /* "newanalysis/helpers/helpers.pyx":60 + * for i in prange(nres, nogil=True): + * tot_mass = 0.0 + * for j in range(apr[i]): # <<<<<<<<<<<<<< + * actr = rfa[i] + j + * for k in range(3): */ - __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1598, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_arccos); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1598, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_15 = __pyx_v_i; - __pyx_t_14 = 2; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; - __pyx_t_19 = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) ))); - if (unlikely(__pyx_v_r == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 1598, __pyx_L1_error) - } - __pyx_t_17 = PyFloat_FromDouble((__pyx_t_19 / __pyx_v_r)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1598, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_20 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) { - __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_18); - if (likely(__pyx_t_20)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18); - __Pyx_INCREF(__pyx_t_20); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_18, function); - } - } - __pyx_t_16 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_20, __pyx_t_17) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_17); - __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1598, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_19 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1598, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_v_pol = __pyx_t_19; + __pyx_t_9 = __pyx_v_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_apr.shape[0]; + __pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_9 * __pyx_v_apr.strides[0]) ))); + __pyx_t_11 = __pyx_t_10; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; - /* "src/helpers/helpers.pyx":1599 - * r = sqrt(coor[i,0]*coor[i,0] + coor[i,1]*coor[i,1] + coor[i,2]*coor[i,2]) - * pol = np.arccos(coor[i,2] / r) - * azi = np.arctan2(coor[i,1] , coor[i,0]) # <<<<<<<<<<<<<< - * - * for l1 in range(lmax+1): + /* "newanalysis/helpers/helpers.pyx":61 + * tot_mass = 0.0 + * for j in range(apr[i]): + * actr = rfa[i] + j # <<<<<<<<<<<<<< + * for k in range(3): + * velcom[i,k] += vels[actr,k] * masses[actr] */ - __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_np); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_arctan2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 1; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - __pyx_t_18 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) )))); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_15 = __pyx_v_i; - __pyx_t_14 = 0; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; - __pyx_t_20 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )))); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_21 = NULL; - __pyx_t_22 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) { - __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_17); - if (likely(__pyx_t_21)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); - __Pyx_INCREF(__pyx_t_21); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_17, function); - __pyx_t_22 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_17)) { - PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_18, __pyx_t_20}; - __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) { - PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_18, __pyx_t_20}; - __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - } else - #endif - { - __pyx_t_23 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - if (__pyx_t_21) { - __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_21); __pyx_t_21 = NULL; - } - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_22, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_22, __pyx_t_20); - __pyx_t_18 = 0; - __pyx_t_20 = 0; - __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_23, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - } - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_19 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1599, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_v_azi = __pyx_t_19; + __pyx_t_9 = __pyx_v_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_rfa.shape[0]; + __pyx_v_actr = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_9 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_j); - /* "src/helpers/helpers.pyx":1601 - * azi = np.arctan2(coor[i,1] , coor[i,0]) - * - * for l1 in range(lmax+1): # <<<<<<<<<<<<<< - * for m1 in range(2*l1+1): - * m1r = m1 - l1 + /* "newanalysis/helpers/helpers.pyx":62 + * for j in range(apr[i]): + * actr = rfa[i] + j + * for k in range(3): # <<<<<<<<<<<<<< + * velcom[i,k] += vels[actr,k] * masses[actr] + * tot_mass += masses[actr] */ - __pyx_t_24 = (__pyx_v_lmax + 1); - __pyx_t_25 = __pyx_t_24; - for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_25; __pyx_t_22+=1) { - __pyx_v_l1 = __pyx_t_22; + for (__pyx_t_13 = 0; __pyx_t_13 < 3; __pyx_t_13+=1) { + __pyx_v_k = __pyx_t_13; - /* "src/helpers/helpers.pyx":1602 - * - * for l1 in range(lmax+1): - * for m1 in range(2*l1+1): # <<<<<<<<<<<<<< - * m1r = m1 - l1 - * for l2 in range(lmax+1): + /* "newanalysis/helpers/helpers.pyx":63 + * actr = rfa[i] + j + * for k in range(3): + * velcom[i,k] += vels[actr,k] * masses[actr] # <<<<<<<<<<<<<< + * tot_mass += masses[actr] + * for k in range(3): */ - __pyx_t_26 = ((2 * __pyx_v_l1) + 1); - __pyx_t_27 = __pyx_t_26; - for (__pyx_t_28 = 0; __pyx_t_28 < __pyx_t_27; __pyx_t_28+=1) { - __pyx_v_m1 = __pyx_t_28; + __pyx_t_9 = __pyx_v_actr; + __pyx_t_14 = __pyx_v_k; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_vels.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_vels.shape[1]; + __pyx_t_15 = __pyx_v_actr; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_masses.shape[0]; + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = __pyx_v_k; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_velcom.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_velcom.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_velcom.data + __pyx_t_16 * __pyx_v_velcom.strides[0]) ) + __pyx_t_17 * __pyx_v_velcom.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vels.data + __pyx_t_9 * __pyx_v_vels.strides[0]) ) + __pyx_t_14 * __pyx_v_vels.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_15 * __pyx_v_masses.strides[0]) )))); + } - /* "src/helpers/helpers.pyx":1603 - * for l1 in range(lmax+1): - * for m1 in range(2*l1+1): - * m1r = m1 - l1 # <<<<<<<<<<<<<< - * for l2 in range(lmax+1): - * for m2 in range(2*l2+1): + /* "newanalysis/helpers/helpers.pyx":64 + * for k in range(3): + * velcom[i,k] += vels[actr,k] * masses[actr] + * tot_mass += masses[actr] # <<<<<<<<<<<<<< + * for k in range(3): + * velcom[i,k] /= tot_mass */ - __pyx_v_m1r = (__pyx_v_m1 - __pyx_v_l1); + __pyx_t_15 = __pyx_v_actr; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_masses.shape[0]; + __pyx_v_tot_mass = (__pyx_v_tot_mass + (*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_15 * __pyx_v_masses.strides[0]) )))); + } - /* "src/helpers/helpers.pyx":1604 - * for m1 in range(2*l1+1): - * m1r = m1 - l1 - * for l2 in range(lmax+1): # <<<<<<<<<<<<<< - * for m2 in range(2*l2+1): - * m2r = m2 - l2 + /* "newanalysis/helpers/helpers.pyx":65 + * velcom[i,k] += vels[actr,k] * masses[actr] + * tot_mass += masses[actr] + * for k in range(3): # <<<<<<<<<<<<<< + * velcom[i,k] /= tot_mass + * */ - __pyx_t_29 = (__pyx_v_lmax + 1); - __pyx_t_30 = __pyx_t_29; - for (__pyx_t_31 = 0; __pyx_t_31 < __pyx_t_30; __pyx_t_31+=1) { - __pyx_v_l2 = __pyx_t_31; + for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { + __pyx_v_k = __pyx_t_10; - /* "src/helpers/helpers.pyx":1605 - * m1r = m1 - l1 - * for l2 in range(lmax+1): - * for m2 in range(2*l2+1): # <<<<<<<<<<<<<< - * m2r = m2 - l2 - * y_mat[2*l1+m1,2*l2+m2] += sph_harm(m1r,l1,azi,pol) * np.conjugate(sph_harm(m2r,l2,azi,pol)) + /* "newanalysis/helpers/helpers.pyx":66 + * tot_mass += masses[actr] + * for k in range(3): + * velcom[i,k] /= tot_mass # <<<<<<<<<<<<<< + * + * return np.asarray(velcom) */ - __pyx_t_32 = ((2 * __pyx_v_l2) + 1); - __pyx_t_33 = __pyx_t_32; - for (__pyx_t_34 = 0; __pyx_t_34 < __pyx_t_33; __pyx_t_34+=1) { - __pyx_v_m2 = __pyx_t_34; + __pyx_t_15 = __pyx_v_i; + __pyx_t_14 = __pyx_v_k; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_velcom.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_velcom.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_velcom.data + __pyx_t_15 * __pyx_v_velcom.strides[0]) ) + __pyx_t_14 * __pyx_v_velcom.strides[1]) )) /= __pyx_v_tot_mass; + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "src/helpers/helpers.pyx":1606 - * for l2 in range(lmax+1): - * for m2 in range(2*l2+1): - * m2r = m2 - l2 # <<<<<<<<<<<<<< - * y_mat[2*l1+m1,2*l2+m2] += sph_harm(m1r,l1,azi,pol) * np.conjugate(sph_harm(m2r,l2,azi,pol)) + /* "newanalysis/helpers/helpers.pyx":58 + * cdef double tot_mass * + * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< + * tot_mass = 0.0 + * for j in range(apr[i]): */ - __pyx_v_m2r = (__pyx_v_m2 - __pyx_v_l2); + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } - /* "src/helpers/helpers.pyx":1607 - * for m2 in range(2*l2+1): - * m2r = m2 - l2 - * y_mat[2*l1+m1,2*l2+m2] += sph_harm(m1r,l1,azi,pol) * np.conjugate(sph_harm(m2r,l2,azi,pol)) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":68 + * velcom[i,k] /= tot_mass + * + * return np.asarray(velcom) # <<<<<<<<<<<<<< * * @cython.boundscheck(False) */ - __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_sph_harm); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_m1r); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_l1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_18 = PyFloat_FromDouble(__pyx_v_azi); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_21 = PyFloat_FromDouble(__pyx_v_pol); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __pyx_t_35 = NULL; - __pyx_t_36 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) { - __pyx_t_35 = PyMethod_GET_SELF(__pyx_t_17); - if (likely(__pyx_t_35)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); - __Pyx_INCREF(__pyx_t_35); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_17, function); - __pyx_t_36 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_17)) { - PyObject *__pyx_temp[5] = {__pyx_t_35, __pyx_t_23, __pyx_t_20, __pyx_t_18, __pyx_t_21}; - __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_36, 4+__pyx_t_36); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_35); __pyx_t_35 = 0; - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) { - PyObject *__pyx_temp[5] = {__pyx_t_35, __pyx_t_23, __pyx_t_20, __pyx_t_18, __pyx_t_21}; - __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_36, 4+__pyx_t_36); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_35); __pyx_t_35 = 0; - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - } else - #endif - { - __pyx_t_37 = PyTuple_New(4+__pyx_t_36); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_37); - if (__pyx_t_35) { - __Pyx_GIVEREF(__pyx_t_35); PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_t_35); __pyx_t_35 = NULL; - } - __Pyx_GIVEREF(__pyx_t_23); - PyTuple_SET_ITEM(__pyx_t_37, 0+__pyx_t_36, __pyx_t_23); - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_37, 1+__pyx_t_36, __pyx_t_20); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_37, 2+__pyx_t_36, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_21); - PyTuple_SET_ITEM(__pyx_t_37, 3+__pyx_t_36, __pyx_t_21); - __pyx_t_23 = 0; - __pyx_t_20 = 0; - __pyx_t_18 = 0; - __pyx_t_21 = 0; - __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_37, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; - } - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_37, __pyx_n_s_np); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_37); - __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_37, __pyx_n_s_conjugate); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_sph_harm); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_m2r); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_l2); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __pyx_t_35 = PyFloat_FromDouble(__pyx_v_azi); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_35); - __pyx_t_38 = PyFloat_FromDouble(__pyx_v_pol); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_38); - __pyx_t_39 = NULL; - __pyx_t_36 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) { - __pyx_t_39 = PyMethod_GET_SELF(__pyx_t_18); - if (likely(__pyx_t_39)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18); - __Pyx_INCREF(__pyx_t_39); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_18, function); - __pyx_t_36 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_18)) { - PyObject *__pyx_temp[5] = {__pyx_t_39, __pyx_t_20, __pyx_t_23, __pyx_t_35, __pyx_t_38}; - __pyx_t_37 = __Pyx_PyFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_36, 4+__pyx_t_36); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_39); __pyx_t_39 = 0; - __Pyx_GOTREF(__pyx_t_37); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0; - __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_18)) { - PyObject *__pyx_temp[5] = {__pyx_t_39, __pyx_t_20, __pyx_t_23, __pyx_t_35, __pyx_t_38}; - __pyx_t_37 = __Pyx_PyCFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_36, 4+__pyx_t_36); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_39); __pyx_t_39 = 0; - __Pyx_GOTREF(__pyx_t_37); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0; - __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0; - } else - #endif - { - __pyx_t_40 = PyTuple_New(4+__pyx_t_36); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_40); - if (__pyx_t_39) { - __Pyx_GIVEREF(__pyx_t_39); PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_39); __pyx_t_39 = NULL; - } - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_40, 0+__pyx_t_36, __pyx_t_20); - __Pyx_GIVEREF(__pyx_t_23); - PyTuple_SET_ITEM(__pyx_t_40, 1+__pyx_t_36, __pyx_t_23); - __Pyx_GIVEREF(__pyx_t_35); - PyTuple_SET_ITEM(__pyx_t_40, 2+__pyx_t_36, __pyx_t_35); - __Pyx_GIVEREF(__pyx_t_38); - PyTuple_SET_ITEM(__pyx_t_40, 3+__pyx_t_36, __pyx_t_38); - __pyx_t_20 = 0; - __pyx_t_23 = 0; - __pyx_t_35 = 0; - __pyx_t_38 = 0; - __pyx_t_37 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_40, NULL); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_37); - __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; - } - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) { - __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_21); - if (likely(__pyx_t_18)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21); - __Pyx_INCREF(__pyx_t_18); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_21, function); - } - } - __pyx_t_17 = (__pyx_t_18) ? __Pyx_PyObject_Call2Args(__pyx_t_21, __pyx_t_18, __pyx_t_37) : __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_t_37); - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; - if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __pyx_t_21 = PyNumber_Multiply(__pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_41 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_21); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1607, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __pyx_t_14 = ((2 * __pyx_v_l1) + __pyx_v_m1); - __pyx_t_15 = ((2 * __pyx_v_l2) + __pyx_v_m2); - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_y_mat.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_y_mat.shape[1]; - *((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_y_mat.data + __pyx_t_14 * __pyx_v_y_mat.strides[0]) ) + __pyx_t_15 * __pyx_v_y_mat.strides[1]) )) += __pyx_t_41; - } - } - } + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_velcom, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; } } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1592 + /* "newanalysis/helpers/helpers.pyx":40 + * return(sumr) * - * @cython.boundscheck(False) - * def sphHarmMatrix(double [:,:] coor, np.complex128_t [:,:] y_mat, int lmax): # <<<<<<<<<<<<<< - * cdef double r, pol, azi - * cdef int nat = coor.shape[0], i, l1, m1, m1r, l2, m2, m2r + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def velcomByResidue(double [:,:] vels, double [:] masses, int nres, int [:] apr, int [:] rfa): + * """ */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_16); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_20); - __Pyx_XDECREF(__pyx_t_21); - __Pyx_XDECREF(__pyx_t_23); - __Pyx_XDECREF(__pyx_t_35); - __Pyx_XDECREF(__pyx_t_37); - __Pyx_XDECREF(__pyx_t_38); - __Pyx_XDECREF(__pyx_t_39); - __Pyx_XDECREF(__pyx_t_40); - __Pyx_AddTraceback("newanalysis.helpers.sphHarmMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __Pyx_AddTraceback("newanalysis.helpers.velcomByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_y_mat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_velcom, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":1610 +/* "newanalysis/helpers/helpers.pyx":70 + * return np.asarray(velcom) * - * @cython.boundscheck(False) - * def calcFourierLaplaceTransform(double [:] data_x, double [:] data_y, double w): # <<<<<<<<<<<<<< - * cdef double wt, wt1 - * cdef double dt = data_x[1] - data_x[0] + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def comByResidue(double [:,:] coor, double [:] masses, int nres, int [:] apr, int [:] rfa): + * """ */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_77calcFourierLaplaceTransform(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_77calcFourierLaplaceTransform = {"calcFourierLaplaceTransform", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_77calcFourierLaplaceTransform, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_7helpers_77calcFourierLaplaceTransform(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_data_x = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_data_y = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_w; +static PyObject *__pyx_pw_11newanalysis_7helpers_5comByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_4comByResidue, "\n comByResidue(coor,masses,nres,atoms_per_residue)\n\n Calculates the center-of-mass coordinates for a given selection.\n\n NOTE:\n Don't call this function directly, use the AtomGroup interface instead!\n E.g. for an atom selection 'sel', call \n\n com = sel.comByResidue() \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_5comByResidue = {"comByResidue", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_5comByResidue, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_4comByResidue}; +static PyObject *__pyx_pw_11newanalysis_7helpers_5comByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_masses = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_nres; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcFourierLaplaceTransform (wrapper)", 0); + __Pyx_RefNannySetupContext("comByResidue (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 70, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data_x,&__pyx_n_s_data_y,&__pyx_n_s_w,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_masses,&__pyx_n_s_nres,&__pyx_n_s_apr,&__pyx_n_s_rfa,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 0: break; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_x)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_y)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_masses)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcFourierLaplaceTransform", 1, 3, 3, 1); __PYX_ERR(0, 1610, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("comByResidue", 1, 5, 5, 1); __PYX_ERR(0, 70, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nres)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("comByResidue", 1, 5, 5, 2); __PYX_ERR(0, 70, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("comByResidue", 1, 5, 5, 3); __PYX_ERR(0, 70, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcFourierLaplaceTransform", 1, 3, 3, 2); __PYX_ERR(0, 1610, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("comByResidue", 1, 5, 5, 4); __PYX_ERR(0, 70, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcFourierLaplaceTransform") < 0)) __PYX_ERR(0, 1610, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "comByResidue") < 0)) __PYX_ERR(0, 70, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 5)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); } - __pyx_v_data_x = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data_x.memview)) __PYX_ERR(0, 1610, __pyx_L3_error) - __pyx_v_data_y = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data_y.memview)) __PYX_ERR(0, 1610, __pyx_L3_error) - __pyx_v_w = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_w == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1610, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 71, __pyx_L3_error) + __pyx_v_masses = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_masses.memview)) __PYX_ERR(0, 71, __pyx_L3_error) + __pyx_v_nres = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nres == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 71, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 71, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcFourierLaplaceTransform", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1610, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("comByResidue", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 70, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcFourierLaplaceTransform", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_masses, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __Pyx_AddTraceback("newanalysis.helpers.comByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_76calcFourierLaplaceTransform(__pyx_self, __pyx_v_data_x, __pyx_v_data_y, __pyx_v_w); + __pyx_r = __pyx_pf_11newanalysis_7helpers_4comByResidue(__pyx_self, __pyx_v_coor, __pyx_v_masses, __pyx_v_nres, __pyx_v_apr, __pyx_v_rfa); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_masses, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_76calcFourierLaplaceTransform(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_data_x, __Pyx_memviewslice __pyx_v_data_y, double __pyx_v_w) { - double __pyx_v_wt; - double __pyx_v_wt1; - double __pyx_v_dt; - double __pyx_v_laplace_re; - double __pyx_v_laplace_im; +static PyObject *__pyx_pf_11newanalysis_7helpers_4comByResidue(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_masses, int __pyx_v_nres, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa) { + __Pyx_memviewslice __pyx_v_com = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_v_i; - int __pyx_v_n; - __Pyx_memviewslice __pyx_v_transform = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_actr; + double __pyx_v_tot_mass; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_5; + __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_7; int __pyx_t_8; - int __pyx_t_9; + Py_ssize_t __pyx_t_9; int __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcFourierLaplaceTransform", 0); - - /* "src/helpers/helpers.pyx":1612 - * def calcFourierLaplaceTransform(double [:] data_x, double [:] data_y, double w): - * cdef double wt, wt1 - * cdef double dt = data_x[1] - data_x[0] # <<<<<<<<<<<<<< - * cdef double laplace_re = 0.0 - * cdef double laplace_im = 0.0 - */ - __pyx_t_1 = 1; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_data_x.shape[0]; - __pyx_t_2 = 0; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_data_x.shape[0]; - __pyx_v_dt = ((*((double *) ( /* dim=0 */ (__pyx_v_data_x.data + __pyx_t_1 * __pyx_v_data_x.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_data_x.data + __pyx_t_2 * __pyx_v_data_x.strides[0]) )))); - - /* "src/helpers/helpers.pyx":1613 - * cdef double wt, wt1 - * cdef double dt = data_x[1] - data_x[0] - * cdef double laplace_re = 0.0 # <<<<<<<<<<<<<< - * cdef double laplace_im = 0.0 - * cdef int i - */ - __pyx_v_laplace_re = 0.0; - - /* "src/helpers/helpers.pyx":1614 - * cdef double dt = data_x[1] - data_x[0] - * cdef double laplace_re = 0.0 - * cdef double laplace_im = 0.0 # <<<<<<<<<<<<<< - * cdef int i - * cdef int n = data_x.shape[0]-1 - */ - __pyx_v_laplace_im = 0.0; - - /* "src/helpers/helpers.pyx":1616 - * cdef double laplace_im = 0.0 - * cdef int i - * cdef int n = data_x.shape[0]-1 # <<<<<<<<<<<<<< - * cdef double [:,:] transform = np.zeros((n,2)) - * - */ - __pyx_v_n = ((__pyx_v_data_x.shape[0]) - 1); + __Pyx_RefNannySetupContext("comByResidue", 0); - /* "src/helpers/helpers.pyx":1617 - * cdef int i - * cdef int n = data_x.shape[0]-1 - * cdef double [:,:] transform = np.zeros((n,2)) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":84 + * """ * - * for i in prange(n, nogil=True): + * cdef double [:,:] com = np.zeros((nres,3)) # <<<<<<<<<<<<<< + * cdef int i, j, k, actr + * cdef double tot_mass */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1617, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nres); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); - __Pyx_INCREF(__pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_2); - __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3)) __PYX_ERR(0, 84, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1617, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_transform = __pyx_t_7; - __pyx_t_7.memview = NULL; - __pyx_t_7.data = NULL; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_com = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "src/helpers/helpers.pyx":1619 - * cdef double [:,:] transform = np.zeros((n,2)) + /* "newanalysis/helpers/helpers.pyx":88 + * cdef double tot_mass * - * for i in prange(n, nogil=True): # <<<<<<<<<<<<<< - * wt = w*data_x[i] - * wt1 = w*data_x[i+1] + * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< + * tot_mass = 0.0 + * for j in range(apr[i]): */ { #ifdef WITH_THREAD PyThreadState *_save; + _save = NULL; Py_UNBLOCK_THREADS __Pyx_FastGIL_Remember(); #endif /*try:*/ { - __pyx_t_8 = __pyx_v_n; - if ((1 == 0)) abort(); + __pyx_t_5 = __pyx_v_nres; { #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) #undef likely @@ -26584,78 +22398,123 @@ static PyObject *__pyx_pf_11newanalysis_7helpers_76calcFourierLaplaceTransform(C #define likely(x) (x) #define unlikely(x) (x) #endif - __pyx_t_10 = (__pyx_t_8 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_10 > 0) + __pyx_t_8 = (__pyx_t_5 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_8 > 0) { #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_1, __pyx_t_11, __pyx_t_12, __pyx_t_2) + #pragma omp parallel reduction(+:__pyx_v_tot_mass) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_9) #endif /* _OPENMP */ { #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_wt) lastprivate(__pyx_v_wt1) + #pragma omp for lastprivate(__pyx_v_actr) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) #endif /* _OPENMP */ - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){ + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ { - __pyx_v_i = (int)(0 + 1 * __pyx_t_9); + __pyx_v_i = (int)(0 + 1 * __pyx_t_7); /* Initialize private variables to invalid values */ - __pyx_v_wt = ((double)__PYX_NAN()); - __pyx_v_wt1 = ((double)__PYX_NAN()); + __pyx_v_actr = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); - /* "src/helpers/helpers.pyx":1620 - * - * for i in prange(n, nogil=True): - * wt = w*data_x[i] # <<<<<<<<<<<<<< - * wt1 = w*data_x[i+1] + /* "newanalysis/helpers/helpers.pyx":89 * + * for i in prange(nres, nogil=True): + * tot_mass = 0.0 # <<<<<<<<<<<<<< + * for j in range(apr[i]): + * actr = rfa[i] + j */ - __pyx_t_2 = __pyx_v_i; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_data_x.shape[0]; - __pyx_v_wt = (__pyx_v_w * (*((double *) ( /* dim=0 */ (__pyx_v_data_x.data + __pyx_t_2 * __pyx_v_data_x.strides[0]) )))); + __pyx_v_tot_mass = 0.0; - /* "src/helpers/helpers.pyx":1621 - * for i in prange(n, nogil=True): - * wt = w*data_x[i] - * wt1 = w*data_x[i+1] # <<<<<<<<<<<<<< - * - * transform[i,0] = (cos(wt)*data_y[i] + cos(wt1)*data_y[i+1])*0.5*dt + /* "newanalysis/helpers/helpers.pyx":90 + * for i in prange(nres, nogil=True): + * tot_mass = 0.0 + * for j in range(apr[i]): # <<<<<<<<<<<<<< + * actr = rfa[i] + j + * for k in range(3): */ - __pyx_t_2 = (__pyx_v_i + 1); - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_data_x.shape[0]; - __pyx_v_wt1 = (__pyx_v_w * (*((double *) ( /* dim=0 */ (__pyx_v_data_x.data + __pyx_t_2 * __pyx_v_data_x.strides[0]) )))); + __pyx_t_9 = __pyx_v_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_apr.shape[0]; + __pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_9 * __pyx_v_apr.strides[0]) ))); + __pyx_t_11 = __pyx_t_10; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; - /* "src/helpers/helpers.pyx":1623 - * wt1 = w*data_x[i+1] - * - * transform[i,0] = (cos(wt)*data_y[i] + cos(wt1)*data_y[i+1])*0.5*dt # <<<<<<<<<<<<<< - * transform[i,1] = (sin(wt)*data_y[i] + sin(wt1)*data_y[i+1])*0.5*dt - * + /* "newanalysis/helpers/helpers.pyx":91 + * tot_mass = 0.0 + * for j in range(apr[i]): + * actr = rfa[i] + j # <<<<<<<<<<<<<< + * for k in range(3): + * com[i,k] += coor[actr,k] * masses[actr] */ - __pyx_t_2 = __pyx_v_i; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_data_y.shape[0]; - __pyx_t_1 = (__pyx_v_i + 1); - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_data_y.shape[0]; - __pyx_t_11 = __pyx_v_i; - __pyx_t_12 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_transform.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_transform.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_transform.data + __pyx_t_11 * __pyx_v_transform.strides[0]) ) + __pyx_t_12 * __pyx_v_transform.strides[1]) )) = ((((cos(__pyx_v_wt) * (*((double *) ( /* dim=0 */ (__pyx_v_data_y.data + __pyx_t_2 * __pyx_v_data_y.strides[0]) )))) + (cos(__pyx_v_wt1) * (*((double *) ( /* dim=0 */ (__pyx_v_data_y.data + __pyx_t_1 * __pyx_v_data_y.strides[0]) ))))) * 0.5) * __pyx_v_dt); + __pyx_t_9 = __pyx_v_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_rfa.shape[0]; + __pyx_v_actr = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_9 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_j); + + /* "newanalysis/helpers/helpers.pyx":92 + * for j in range(apr[i]): + * actr = rfa[i] + j + * for k in range(3): # <<<<<<<<<<<<<< + * com[i,k] += coor[actr,k] * masses[actr] + * tot_mass += masses[actr] + */ + for (__pyx_t_13 = 0; __pyx_t_13 < 3; __pyx_t_13+=1) { + __pyx_v_k = __pyx_t_13; + + /* "newanalysis/helpers/helpers.pyx":93 + * actr = rfa[i] + j + * for k in range(3): + * com[i,k] += coor[actr,k] * masses[actr] # <<<<<<<<<<<<<< + * tot_mass += masses[actr] + * for k in range(3): + */ + __pyx_t_9 = __pyx_v_actr; + __pyx_t_14 = __pyx_v_k; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; + __pyx_t_15 = __pyx_v_actr; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_masses.shape[0]; + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = __pyx_v_k; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_com.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_com.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_16 * __pyx_v_com.strides[0]) ) + __pyx_t_17 * __pyx_v_com.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_15 * __pyx_v_masses.strides[0]) )))); + } + + /* "newanalysis/helpers/helpers.pyx":94 + * for k in range(3): + * com[i,k] += coor[actr,k] * masses[actr] + * tot_mass += masses[actr] # <<<<<<<<<<<<<< + * for k in range(3): + * com[i,k] /= tot_mass + */ + __pyx_t_15 = __pyx_v_actr; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_masses.shape[0]; + __pyx_v_tot_mass = (__pyx_v_tot_mass + (*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_15 * __pyx_v_masses.strides[0]) )))); + } - /* "src/helpers/helpers.pyx":1624 + /* "newanalysis/helpers/helpers.pyx":95 + * com[i,k] += coor[actr,k] * masses[actr] + * tot_mass += masses[actr] + * for k in range(3): # <<<<<<<<<<<<<< + * com[i,k] /= tot_mass * - * transform[i,0] = (cos(wt)*data_y[i] + cos(wt1)*data_y[i+1])*0.5*dt - * transform[i,1] = (sin(wt)*data_y[i] + sin(wt1)*data_y[i+1])*0.5*dt # <<<<<<<<<<<<<< + */ + for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { + __pyx_v_k = __pyx_t_10; + + /* "newanalysis/helpers/helpers.pyx":96 + * tot_mass += masses[actr] + * for k in range(3): + * com[i,k] /= tot_mass # <<<<<<<<<<<<<< * - * for i in range(n): + * return np.asarray(com) */ - __pyx_t_1 = __pyx_v_i; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_data_y.shape[0]; - __pyx_t_2 = (__pyx_v_i + 1); - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_data_y.shape[0]; - __pyx_t_12 = __pyx_v_i; - __pyx_t_11 = 1; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_transform.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_transform.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_transform.data + __pyx_t_12 * __pyx_v_transform.strides[0]) ) + __pyx_t_11 * __pyx_v_transform.strides[1]) )) = ((((sin(__pyx_v_wt) * (*((double *) ( /* dim=0 */ (__pyx_v_data_y.data + __pyx_t_1 * __pyx_v_data_y.strides[0]) )))) + (sin(__pyx_v_wt1) * (*((double *) ( /* dim=0 */ (__pyx_v_data_y.data + __pyx_t_2 * __pyx_v_data_y.strides[0]) ))))) * 0.5) * __pyx_v_dt); + __pyx_t_15 = __pyx_v_i; + __pyx_t_14 = __pyx_v_k; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_com.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_com.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_15 * __pyx_v_com.strides[0]) ) + __pyx_t_14 * __pyx_v_com.strides[1]) )) /= __pyx_v_tot_mass; + } } } } @@ -26669,12 +22528,12 @@ static PyObject *__pyx_pf_11newanalysis_7helpers_76calcFourierLaplaceTransform(C #endif } - /* "src/helpers/helpers.pyx":1619 - * cdef double [:,:] transform = np.zeros((n,2)) + /* "newanalysis/helpers/helpers.pyx":88 + * cdef double tot_mass * - * for i in prange(n, nogil=True): # <<<<<<<<<<<<<< - * wt = w*data_x[i] - * wt1 = w*data_x[i+1] + * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< + * tot_mass = 0.0 + * for j in range(apr[i]): */ /*finally:*/ { /*normal exit:*/{ @@ -26688,284 +22547,542 @@ static PyObject *__pyx_pf_11newanalysis_7helpers_76calcFourierLaplaceTransform(C } } - /* "src/helpers/helpers.pyx":1626 - * transform[i,1] = (sin(wt)*data_y[i] + sin(wt1)*data_y[i+1])*0.5*dt - * - * for i in range(n): # <<<<<<<<<<<<<< - * laplace_re += transform[i,0] - * laplace_im += transform[i,1] - */ - __pyx_t_10 = __pyx_v_n; - __pyx_t_9 = __pyx_t_10; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; - - /* "src/helpers/helpers.pyx":1627 - * - * for i in range(n): - * laplace_re += transform[i,0] # <<<<<<<<<<<<<< - * laplace_im += transform[i,1] - * - */ - __pyx_t_2 = __pyx_v_i; - __pyx_t_1 = 0; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_transform.shape[0]; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_transform.shape[1]; - __pyx_v_laplace_re = (__pyx_v_laplace_re + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_transform.data + __pyx_t_2 * __pyx_v_transform.strides[0]) ) + __pyx_t_1 * __pyx_v_transform.strides[1]) )))); - - /* "src/helpers/helpers.pyx":1628 - * for i in range(n): - * laplace_re += transform[i,0] - * laplace_im += transform[i,1] # <<<<<<<<<<<<<< - * - * return float(laplace_re), float(laplace_im) - */ - __pyx_t_1 = __pyx_v_i; - __pyx_t_2 = 1; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_transform.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_transform.shape[1]; - __pyx_v_laplace_im = (__pyx_v_laplace_im + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_transform.data + __pyx_t_1 * __pyx_v_transform.strides[0]) ) + __pyx_t_2 * __pyx_v_transform.strides[1]) )))); - } - - /* "src/helpers/helpers.pyx":1630 - * laplace_im += transform[i,1] + /* "newanalysis/helpers/helpers.pyx":98 + * com[i,k] /= tot_mass * - * return float(laplace_re), float(laplace_im) # <<<<<<<<<<<<<< + * return np.asarray(com) # <<<<<<<<<<<<<< * * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_laplace_re); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1630, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyFloat_FromDouble(__pyx_v_laplace_im); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1630, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1630, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __pyx_t_3 = 0; - __pyx_t_5 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_com, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "src/helpers/helpers.pyx":1610 + /* "newanalysis/helpers/helpers.pyx":70 + * return np.asarray(velcom) * - * @cython.boundscheck(False) - * def calcFourierLaplaceTransform(double [:] data_x, double [:] data_y, double w): # <<<<<<<<<<<<<< - * cdef double wt, wt1 - * cdef double dt = data_x[1] - data_x[0] + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def comByResidue(double [:,:] coor, double [:] masses, int nres, int [:] apr, int [:] rfa): + * """ */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); - __Pyx_AddTraceback("newanalysis.helpers.calcFourierLaplaceTransform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __Pyx_AddTraceback("newanalysis.helpers.comByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_transform, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_data_x, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_data_y, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_com, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":1633 +/* "newanalysis/helpers/helpers.pyx":100 + * return np.asarray(com) * - * @cython.boundscheck(False) - * def calcRotationMatrix(double [:,:] coorA, double [:,:] coorB): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipByResidue(double [:,:] coor, double [:] charges, double [:] masses, int nres, int [:] apr, int [:] rfa, double [:,:] com): * """ - * calcRotationMatrix(coor,coorA,coorB) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_79calcRotationMatrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_78calcRotationMatrix[] = "\n calcRotationMatrix(coor,coorA,coorB)\n\n Applies the Berthold-Horn-algorithm to a set of coordinates xyz, inplace.\n\n Args:\n coor .. coordinates of all atoms\n coorA .. template coordinates\n coorB .. corresponding coordinates of the current frame\n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_79calcRotationMatrix = {"calcRotationMatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_79calcRotationMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_78calcRotationMatrix}; -static PyObject *__pyx_pw_11newanalysis_7helpers_79calcRotationMatrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coorA = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coorB = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw_11newanalysis_7helpers_7dipByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_6dipByResidue, "\n dipByResidue(coor,charges,masses,nresidues,atoms_per_residue,com)\n\n Calculates the molecular dipole moments, each referenced to the respective center of mass, \n for a given selection.\n\n NOTE:\n Don't call this function directly, use the AtomGroup interface instead!\n E.g. for an atom selection 'sel', call \n\n dip = sel.dipByResidue() \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_7dipByResidue = {"dipByResidue", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_7dipByResidue, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_6dipByResidue}; +static PyObject *__pyx_pw_11newanalysis_7helpers_7dipByResidue(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + CYTHON_UNUSED __Pyx_memviewslice __pyx_v_masses = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_nres; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_com = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcRotationMatrix (wrapper)", 0); + __Pyx_RefNannySetupContext("dipByResidue (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 100, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coorA,&__pyx_n_s_coorB,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_masses,&__pyx_n_s_nres,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_com,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coorA)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coorB)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 1); __PYX_ERR(0, 100, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_masses)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 2); __PYX_ERR(0, 100, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nres)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 3); __PYX_ERR(0, 100, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 4); __PYX_ERR(0, 100, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 5); __PYX_ERR(0, 100, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_com)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcRotationMatrix", 1, 2, 2, 1); __PYX_ERR(0, 1633, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, 6); __PYX_ERR(0, 100, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcRotationMatrix") < 0)) __PYX_ERR(0, 1633, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dipByResidue") < 0)) __PYX_ERR(0, 100, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 7)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); } - __pyx_v_coorA = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorA.memview)) __PYX_ERR(0, 1633, __pyx_L3_error) - __pyx_v_coorB = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorB.memview)) __PYX_ERR(0, 1633, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 101, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 101, __pyx_L3_error) + __pyx_v_masses = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_masses.memview)) __PYX_ERR(0, 101, __pyx_L3_error) + __pyx_v_nres = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nres == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 101, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 101, __pyx_L3_error) + __pyx_v_com = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_com.memview)) __PYX_ERR(0, 101, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcRotationMatrix", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1633, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("dipByResidue", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 100, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.calcRotationMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_masses, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_com, 1); + __Pyx_AddTraceback("newanalysis.helpers.dipByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_78calcRotationMatrix(__pyx_self, __pyx_v_coorA, __pyx_v_coorB); + __pyx_r = __pyx_pf_11newanalysis_7helpers_6dipByResidue(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_masses, __pyx_v_nres, __pyx_v_apr, __pyx_v_rfa, __pyx_v_com); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_masses, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_com, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_78calcRotationMatrix(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coorA, __Pyx_memviewslice __pyx_v_coorB) { - __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pf_11newanalysis_7helpers_6dipByResidue(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_masses, int __pyx_v_nres, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, __Pyx_memviewslice __pyx_v_com) { + __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_actr; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_7; + int __pyx_t_8; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - PyObject *__pyx_t_11 = NULL; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcRotationMatrix", 0); + __Pyx_RefNannySetupContext("dipByResidue", 0); - /* "src/helpers/helpers.pyx":1644 - * coorB .. corresponding coordinates of the current frame + /* "newanalysis/helpers/helpers.pyx":114 + * dip = sel.dipByResidue() * """ - * cdef double [:,:] R = np.zeros((3,3)) # <<<<<<<<<<<<<< + * cdef double [:,:] dip = np.zeros((nres,3)) # <<<<<<<<<<<<<< + * cdef int i, j, k, actr * - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1644, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1644, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nres); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3)) __PYX_ERR(0, 114, __pyx_L1_error); + __pyx_t_2 = 0; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_tuple_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple_); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1644, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 1644, __pyx_L1_error) + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_R = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v_dip = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "src/helpers/helpers.pyx":1646 - * cdef double [:,:] R = np.zeros((3,3)) + /* "newanalysis/helpers/helpers.pyx":117 + * cdef int i, j, k, actr * - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) # <<<<<<<<<<<<<< + * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< + * for j in range(apr[i]): + * actr = rfa[i] + j + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_5 = __pyx_v_nres; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_8 = (__pyx_t_5 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_8 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_actr) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) + #endif /* _OPENMP */ + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_7); + /* Initialize private variables to invalid values */ + __pyx_v_actr = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); + + /* "newanalysis/helpers/helpers.pyx":118 * - * return np.asarray(R) + * for i in prange(nres, nogil=True): + * for j in range(apr[i]): # <<<<<<<<<<<<<< + * actr = rfa[i] + j + * for k in range(3): */ - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_R.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[1]; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coorA.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coorA.shape[1]; - __pyx_t_9 = 0; - __pyx_t_10 = 0; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coorB.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coorB.shape[1]; - GetRotation((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_5 * __pyx_v_R.strides[0]) ) + __pyx_t_6 * __pyx_v_R.strides[1]) )))), (__pyx_v_coorA.shape[0]), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorA.data + __pyx_t_7 * __pyx_v_coorA.strides[0]) ) + __pyx_t_8 * __pyx_v_coorA.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorB.data + __pyx_t_9 * __pyx_v_coorB.strides[0]) ) + __pyx_t_10 * __pyx_v_coorB.strides[1]) )))), 0); + __pyx_t_9 = __pyx_v_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_apr.shape[0]; + __pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_9 * __pyx_v_apr.strides[0]) ))); + __pyx_t_11 = __pyx_t_10; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; - /* "src/helpers/helpers.pyx":1648 - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) + /* "newanalysis/helpers/helpers.pyx":119 + * for i in prange(nres, nogil=True): + * for j in range(apr[i]): + * actr = rfa[i] + j # <<<<<<<<<<<<<< + * for k in range(3): + * dip[i,k] += (coor[actr,k] - com[i,k]) * charges[actr] + */ + __pyx_t_9 = __pyx_v_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_rfa.shape[0]; + __pyx_v_actr = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_9 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_j); + + /* "newanalysis/helpers/helpers.pyx":120 + * for j in range(apr[i]): + * actr = rfa[i] + j + * for k in range(3): # <<<<<<<<<<<<<< + * dip[i,k] += (coor[actr,k] - com[i,k]) * charges[actr] * - * return np.asarray(R) # <<<<<<<<<<<<<< + */ + for (__pyx_t_13 = 0; __pyx_t_13 < 3; __pyx_t_13+=1) { + __pyx_v_k = __pyx_t_13; + + /* "newanalysis/helpers/helpers.pyx":121 + * actr = rfa[i] + j + * for k in range(3): + * dip[i,k] += (coor[actr,k] - com[i,k]) * charges[actr] # <<<<<<<<<<<<<< + * + * return np.asarray(dip) + */ + __pyx_t_9 = __pyx_v_actr; + __pyx_t_14 = __pyx_v_k; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = __pyx_v_k; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_com.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_com.shape[1]; + __pyx_t_17 = __pyx_v_actr; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_charges.shape[0]; + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = __pyx_v_k; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_dip.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_dip.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_18 * __pyx_v_dip.strides[0]) ) + __pyx_t_19 * __pyx_v_dip.strides[1]) )) += (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_15 * __pyx_v_com.strides[0]) ) + __pyx_t_16 * __pyx_v_com.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_17 * __pyx_v_charges.strides[0]) )))); + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/helpers.pyx":117 + * cdef int i, j, k, actr + * + * for i in prange(nres, nogil=True): # <<<<<<<<<<<<<< + * for j in range(apr[i]): + * actr = rfa[i] + j + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "newanalysis/helpers/helpers.pyx":123 + * dip[i,k] += (coor[actr,k] - com[i,k]) * charges[actr] + * + * return np.asarray(dip) # <<<<<<<<<<<<<< * * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1648, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1648, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_R, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1648, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dip, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_11); + __pyx_t_2 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_8 = 1; } } - __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1648, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "src/helpers/helpers.pyx":1633 + /* "newanalysis/helpers/helpers.pyx":100 + * return np.asarray(com) * - * @cython.boundscheck(False) - * def calcRotationMatrix(double [:,:] coorA, double [:,:] coorB): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipByResidue(double [:,:] coor, double [:] charges, double [:] masses, int nres, int [:] apr, int [:] rfa, double [:,:] com): * """ - * calcRotationMatrix(coor,coorA,coorB) */ /* function exit code */ @@ -26973,14540 +23090,25131 @@ static PyObject *__pyx_pf_11newanalysis_7helpers_78calcRotationMatrix(CYTHON_UNU __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("newanalysis.helpers.calcRotationMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __Pyx_AddTraceback("newanalysis.helpers.dipByResidue", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_R, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coorA, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coorB, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/helpers.pyx":1651 +/* "newanalysis/helpers/helpers.pyx":125 + * return np.asarray(dip) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipoleMomentNeutralSelection(double [:,:] coor, double [:] charges): * - * @cython.boundscheck(False) - * def applyRotationMatrix(double [:,:] coor, double [:,:] R): # <<<<<<<<<<<<<< - * """ - * calcRotationMatrix(coor,coorA,coorB) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_7helpers_81applyRotationMatrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_7helpers_80applyRotationMatrix[] = "\n calcRotationMatrix(coor,coorA,coorB)\n\n Applies the Berthold-Horn-algorithm to a set of coordinates xyz, inplace.\n\n Args:\n coor .. coordinates of all atoms\n coorA .. template coordinates\n coorB .. corresponding coordinates of the current frame\n "; -static PyMethodDef __pyx_mdef_11newanalysis_7helpers_81applyRotationMatrix = {"applyRotationMatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_7helpers_81applyRotationMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_80applyRotationMatrix}; -static PyObject *__pyx_pw_11newanalysis_7helpers_81applyRotationMatrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_11newanalysis_7helpers_9dipoleMomentNeutralSelection(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_9dipoleMomentNeutralSelection = {"dipoleMomentNeutralSelection", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_9dipoleMomentNeutralSelection, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_9dipoleMomentNeutralSelection(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("applyRotationMatrix (wrapper)", 0); + __Pyx_RefNannySetupContext("dipoleMomentNeutralSelection (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 125, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_R,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_R)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("applyRotationMatrix", 1, 2, 2, 1); __PYX_ERR(0, 1651, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("dipoleMomentNeutralSelection", 1, 2, 2, 1); __PYX_ERR(0, 125, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "applyRotationMatrix") < 0)) __PYX_ERR(0, 1651, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dipoleMomentNeutralSelection") < 0)) __PYX_ERR(0, 125, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1651, __pyx_L3_error) - __pyx_v_R = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_R.memview)) __PYX_ERR(0, 1651, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 126, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 126, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("applyRotationMatrix", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1651, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("dipoleMomentNeutralSelection", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 125, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.helpers.applyRotationMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __Pyx_AddTraceback("newanalysis.helpers.dipoleMomentNeutralSelection", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_7helpers_80applyRotationMatrix(__pyx_self, __pyx_v_coor, __pyx_v_R); + __pyx_r = __pyx_pf_11newanalysis_7helpers_8dipoleMomentNeutralSelection(__pyx_self, __pyx_v_coor, __pyx_v_charges); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_7helpers_80applyRotationMatrix(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_R) { - CYTHON_UNUSED int __pyx_v_N; - double __pyx_v_tmpx; - double __pyx_v_tmpy; - double __pyx_v_tmpz; +static PyObject *__pyx_pf_11newanalysis_7helpers_8dipoleMomentNeutralSelection(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges) { + __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_v_i; + int __pyx_v_natoms; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_6; + int __pyx_t_7; Py_ssize_t __pyx_t_8; Py_ssize_t __pyx_t_9; Py_ssize_t __pyx_t_10; Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - __Pyx_RefNannySetupContext("applyRotationMatrix", 0); - - /* "src/helpers/helpers.pyx":1662 - * coorB .. corresponding coordinates of the current frame - * """ - * cdef int N = coor.shape[0] # <<<<<<<<<<<<<< - * cdef double tmpx, tmpy, tmpz - * cdef int i - */ - __pyx_v_N = (__pyx_v_coor.shape[0]); + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dipoleMomentNeutralSelection", 0); - /* "src/helpers/helpers.pyx":1666 - * cdef int i + /* "newanalysis/helpers/helpers.pyx":128 + * def dipoleMomentNeutralSelection(double [:,:] coor, double [:] charges): + * + * cdef double [:] dip = np.zeros(3) # <<<<<<<<<<<<<< + * cdef int i, natoms = coor.shape[0] * - * for i in prange(N, nogil=True): # <<<<<<<<<<<<<< - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #endif { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_N; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_tmpx) lastprivate(__pyx_v_tmpy) lastprivate(__pyx_v_tmpz) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - /* Initialize private variables to invalid values */ - __pyx_v_tmpx = ((double)__PYX_NAN()); - __pyx_v_tmpy = ((double)__PYX_NAN()); - __pyx_v_tmpz = ((double)__PYX_NAN()); + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_dip = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "src/helpers/helpers.pyx":1667 + /* "newanalysis/helpers/helpers.pyx":129 * - * for i in prange(N, nogil=True): - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] # <<<<<<<<<<<<<< - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * cdef double [:] dip = np.zeros(3) + * cdef int i, natoms = coor.shape[0] # <<<<<<<<<<<<<< + * + * for i in range(natoms): */ - __pyx_t_4 = 0; - __pyx_t_5 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_R.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_R.shape[1]; - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor.shape[1]; - __pyx_t_8 = 0; - __pyx_t_9 = 1; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_R.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[1]; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; - __pyx_t_12 = 0; - __pyx_t_13 = 2; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_R.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_R.shape[1]; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 2; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - __pyx_v_tmpx = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_4 * __pyx_v_R.strides[0]) ) + __pyx_t_5 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_6 * __pyx_v_coor.strides[0]) ) + __pyx_t_7 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_8 * __pyx_v_R.strides[0]) ) + __pyx_t_9 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_12 * __pyx_v_R.strides[0]) ) + __pyx_t_13 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) ))))); + __pyx_v_natoms = (__pyx_v_coor.shape[0]); - /* "src/helpers/helpers.pyx":1668 - * for i in prange(N, nogil=True): - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] # <<<<<<<<<<<<<< - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx + /* "newanalysis/helpers/helpers.pyx":131 + * cdef int i, natoms = coor.shape[0] + * + * for i in range(natoms): # <<<<<<<<<<<<<< + * dip[0] += coor[i,0] * charges[i] + * dip[1] += coor[i,1] * charges[i] */ - __pyx_t_15 = 1; - __pyx_t_14 = 0; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_R.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_R.shape[1]; - __pyx_t_13 = __pyx_v_i; - __pyx_t_12 = 0; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[1]; - __pyx_t_11 = 1; - __pyx_t_10 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_R.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_R.shape[1]; - __pyx_t_9 = __pyx_v_i; - __pyx_t_8 = 1; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[1]; - __pyx_t_7 = 1; - __pyx_t_6 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[1]; - __pyx_t_5 = __pyx_v_i; - __pyx_t_4 = 2; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_v_tmpy = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_15 * __pyx_v_R.strides[0]) ) + __pyx_t_14 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_11 * __pyx_v_R.strides[0]) ) + __pyx_t_10 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_8 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_7 * __pyx_v_R.strides[0]) ) + __pyx_t_6 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_5 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) ))))); + __pyx_t_4 = __pyx_v_natoms; + __pyx_t_6 = __pyx_t_4; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "src/helpers/helpers.pyx":1669 - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] # <<<<<<<<<<<<<< - * coor[i,0] = tmpx - * coor[i,1] = tmpy + /* "newanalysis/helpers/helpers.pyx":132 + * + * for i in range(natoms): + * dip[0] += coor[i,0] * charges[i] # <<<<<<<<<<<<<< + * dip[1] += coor[i,1] * charges[i] + * dip[2] += coor[i,2] * charges[i] */ - __pyx_t_4 = 2; - __pyx_t_5 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_R.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_R.shape[1]; - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor.shape[1]; - __pyx_t_8 = 2; - __pyx_t_9 = 1; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_R.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[1]; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; - __pyx_t_12 = 2; - __pyx_t_13 = 2; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_R.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_R.shape[1]; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 2; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - __pyx_v_tmpz = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_4 * __pyx_v_R.strides[0]) ) + __pyx_t_5 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_6 * __pyx_v_coor.strides[0]) ) + __pyx_t_7 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_8 * __pyx_v_R.strides[0]) ) + __pyx_t_9 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_12 * __pyx_v_R.strides[0]) ) + __pyx_t_13 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) ))))); + __pyx_t_8 = __pyx_v_i; + __pyx_t_9 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_charges.shape[0]; + __pyx_t_11 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dip.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_11 * __pyx_v_dip.strides[0]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_10 * __pyx_v_charges.strides[0]) )))); - /* "src/helpers/helpers.pyx":1670 - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx # <<<<<<<<<<<<<< - * coor[i,1] = tmpy - * coor[i,2] = tmpz + /* "newanalysis/helpers/helpers.pyx":133 + * for i in range(natoms): + * dip[0] += coor[i,0] * charges[i] + * dip[1] += coor[i,1] * charges[i] # <<<<<<<<<<<<<< + * dip[2] += coor[i,2] * charges[i] + * */ - __pyx_t_15 = __pyx_v_i; - __pyx_t_14 = 0; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpx; + __pyx_t_10 = __pyx_v_i; + __pyx_t_9 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; + __pyx_t_8 = __pyx_v_i; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_charges.shape[0]; + __pyx_t_11 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dip.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_11 * __pyx_v_dip.strides[0]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_8 * __pyx_v_charges.strides[0]) )))); - /* "src/helpers/helpers.pyx":1671 - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx - * coor[i,1] = tmpy # <<<<<<<<<<<<<< - * coor[i,2] = tmpz + /* "newanalysis/helpers/helpers.pyx":134 + * dip[0] += coor[i,0] * charges[i] + * dip[1] += coor[i,1] * charges[i] + * dip[2] += coor[i,2] * charges[i] # <<<<<<<<<<<<<< + * + * return np.asarray(dip) */ - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 1; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpy; + __pyx_t_8 = __pyx_v_i; + __pyx_t_9 = 2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_charges.shape[0]; + __pyx_t_11 = 2; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dip.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_11 * __pyx_v_dip.strides[0]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_10 * __pyx_v_charges.strides[0]) )))); + } - /* "src/helpers/helpers.pyx":1672 - * coor[i,0] = tmpx - * coor[i,1] = tmpy - * coor[i,2] = tmpz # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":136 + * dip[2] += coor[i,2] * charges[i] + * + * return np.asarray(dip) # <<<<<<<<<<<<<< + * + * */ - __pyx_t_15 = __pyx_v_i; - __pyx_t_14 = 2; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpz; - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - - /* "src/helpers/helpers.pyx":1666 - * cdef int i - * - * for i in prange(N, nogil=True): # <<<<<<<<<<<<<< - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dip, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/helpers.pyx":1651 + /* "newanalysis/helpers/helpers.pyx":125 + * return np.asarray(dip) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipoleMomentNeutralSelection(double [:,:] coor, double [:] charges): * - * @cython.boundscheck(False) - * def applyRotationMatrix(double [:,:] coor, double [:,:] R): # <<<<<<<<<<<<<< - * """ - * calcRotationMatrix(coor,coorA,coorB) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_R, 1); + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("newanalysis.helpers.dipoleMomentNeutralSelection", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t +/* "newanalysis/helpers/helpers.pyx":139 * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def collectiveDipoleMomentWaterShells(double [:,:] coor, double [:] charges, int [:] ds, int nshells): * */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_11collectiveDipoleMomentWaterShells(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_11collectiveDipoleMomentWaterShells = {"collectiveDipoleMomentWaterShells", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_11collectiveDipoleMomentWaterShells, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_11collectiveDipoleMomentWaterShells(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_nshells; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":735 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew2(a, b): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("collectiveDipoleMomentWaterShells (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 139, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_ds,&__pyx_n_s_nshells,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("collectiveDipoleMomentWaterShells", 1, 4, 4, 1); __PYX_ERR(0, 139, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("collectiveDipoleMomentWaterShells", 1, 4, 4, 2); __PYX_ERR(0, 139, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("collectiveDipoleMomentWaterShells", 1, 4, 4, 3); __PYX_ERR(0, 139, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "collectiveDipoleMomentWaterShells") < 0)) __PYX_ERR(0, 139, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 140, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 140, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 140, __pyx_L3_error) + __pyx_v_nshells = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("collectiveDipoleMomentWaterShells", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 139, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.helpers.collectiveDipoleMomentWaterShells", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_10collectiveDipoleMomentWaterShells(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_ds, __pyx_v_nshells); /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { +static PyObject *__pyx_pf_11newanalysis_7helpers_10collectiveDipoleMomentWaterShells(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_nshells) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_shell; + CYTHON_UNUSED int __pyx_v_natoms; + int __pyx_v_nmol; + __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + Py_ssize_t __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + __Pyx_RefNannySetupContext("collectiveDipoleMomentWaterShells", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":738 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":143 * - * cdef inline object PyArray_MultiIterNew3(a, b, c): + * cdef int i,j,shell + * cdef int natoms = coor.shape[0] # <<<<<<<<<<<<<< + * cdef int nmol = len(ds) + * cdef double [:,:] dip = np.zeros((nshells,3)) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_natoms = (__pyx_v_coor.shape[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) + /* "newanalysis/helpers/helpers.pyx":144 + * cdef int i,j,shell + * cdef int natoms = coor.shape[0] + * cdef int nmol = len(ds) # <<<<<<<<<<<<<< + * cdef double [:,:] dip = np.zeros((nshells,3)) * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) + */ + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ds); + __pyx_v_nmol = __pyx_t_1; + + /* "newanalysis/helpers/helpers.pyx":145 + * cdef int natoms = coor.shape[0] + * cdef int nmol = len(ds) + * cdef double [:,:] dip = np.zeros((nshells,3)) # <<<<<<<<<<<<<< * + * for shell in prange(nshells,nogil=True): */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_3)) __PYX_ERR(0, 145, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_dip = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":147 + * cdef double [:,:] dip = np.zeros((nshells,3)) + * + * for shell in prange(nshells,nogil=True): # <<<<<<<<<<<<<< + * for i in range(nmol): + * if ds[i] == shell+1: + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_6 = __pyx_v_nshells; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_9 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_9 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) firstprivate(__pyx_v_shell) lastprivate(__pyx_v_shell) + #endif /* _OPENMP */ + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){ + { + __pyx_v_shell = (int)(0 + 1 * __pyx_t_8); + /* Initialize private variables to invalid values */ + __pyx_v_i = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) + /* "newanalysis/helpers/helpers.pyx":148 * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) + * for shell in prange(nshells,nogil=True): + * for i in range(nmol): # <<<<<<<<<<<<<< + * if ds[i] == shell+1: + * for j in range(3): + */ + __pyx_t_10 = __pyx_v_nmol; + __pyx_t_11 = __pyx_t_10; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_i = __pyx_t_12; + + /* "newanalysis/helpers/helpers.pyx":149 + * for shell in prange(nshells,nogil=True): + * for i in range(nmol): + * if ds[i] == shell+1: # <<<<<<<<<<<<<< + * for j in range(3): + * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] + */ + __pyx_t_13 = __pyx_v_i; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_ds.shape[0]; + __pyx_t_14 = ((*((int *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_13 * __pyx_v_ds.strides[0]) ))) == (__pyx_v_shell + 1)); + if (__pyx_t_14) { + + /* "newanalysis/helpers/helpers.pyx":150 + * for i in range(nmol): + * if ds[i] == shell+1: + * for j in range(3): # <<<<<<<<<<<<<< + * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] + * dip[shell,1] += coor[i*3+j,1] * charges[i*3+j] + */ + for (__pyx_t_15 = 0; __pyx_t_15 < 3; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; + + /* "newanalysis/helpers/helpers.pyx":151 + * if ds[i] == shell+1: + * for j in range(3): + * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] # <<<<<<<<<<<<<< + * dip[shell,1] += coor[i*3+j,1] * charges[i*3+j] + * dip[shell,2] += coor[i*3+j,2] * charges[i*3+j] + */ + __pyx_t_13 = ((__pyx_v_i * 3) + __pyx_v_j); + __pyx_t_16 = 0; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + __pyx_t_17 = ((__pyx_v_i * 3) + __pyx_v_j); + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_charges.shape[0]; + __pyx_t_18 = __pyx_v_shell; + __pyx_t_19 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_dip.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_dip.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_18 * __pyx_v_dip.strides[0]) ) + __pyx_t_19 * __pyx_v_dip.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_17 * __pyx_v_charges.strides[0]) )))); + + /* "newanalysis/helpers/helpers.pyx":152 + * for j in range(3): + * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] + * dip[shell,1] += coor[i*3+j,1] * charges[i*3+j] # <<<<<<<<<<<<<< + * dip[shell,2] += coor[i*3+j,2] * charges[i*3+j] + * return np.asarray(dip) + */ + __pyx_t_17 = ((__pyx_v_i * 3) + __pyx_v_j); + __pyx_t_16 = 1; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + __pyx_t_13 = ((__pyx_v_i * 3) + __pyx_v_j); + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_charges.shape[0]; + __pyx_t_19 = __pyx_v_shell; + __pyx_t_18 = 1; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_dip.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_dip.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_19 * __pyx_v_dip.strides[0]) ) + __pyx_t_18 * __pyx_v_dip.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_13 * __pyx_v_charges.strides[0]) )))); + + /* "newanalysis/helpers/helpers.pyx":153 + * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] + * dip[shell,1] += coor[i*3+j,1] * charges[i*3+j] + * dip[shell,2] += coor[i*3+j,2] * charges[i*3+j] # <<<<<<<<<<<<<< + * return np.asarray(dip) * */ + __pyx_t_13 = ((__pyx_v_i * 3) + __pyx_v_j); + __pyx_t_16 = 2; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + __pyx_t_17 = ((__pyx_v_i * 3) + __pyx_v_j); + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_charges.shape[0]; + __pyx_t_18 = __pyx_v_shell; + __pyx_t_19 = 2; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_dip.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_dip.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_18 * __pyx_v_dip.strides[0]) ) + __pyx_t_19 * __pyx_v_dip.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_17 * __pyx_v_charges.strides[0]) )))); + } + + /* "newanalysis/helpers/helpers.pyx":149 + * for shell in prange(nshells,nogil=True): + * for i in range(nmol): + * if ds[i] == shell+1: # <<<<<<<<<<<<<< + * for j in range(3): + * dip[shell,0] += coor[i*3+j,0] * charges[i*3+j] + */ + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + /* "newanalysis/helpers/helpers.pyx":147 + * cdef double [:,:] dip = np.zeros((nshells,3)) + * + * for shell in prange(nshells,nogil=True): # <<<<<<<<<<<<<< + * for i in range(nmol): + * if ds[i] == shell+1: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":741 + /* "newanalysis/helpers/helpers.pyx":154 + * dip[shell,1] += coor[i*3+j,1] * charges[i*3+j] + * dip[shell,2] += coor[i*3+j,2] * charges[i*3+j] + * return np.asarray(dip) # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 741, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_dip, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) + /* "newanalysis/helpers/helpers.pyx":139 * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def collectiveDipoleMomentWaterShells(double [:,:] coor, double [:] charges, int [:] ds, int nshells): * */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_AddTraceback("newanalysis.helpers.collectiveDipoleMomentWaterShells", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) +/* "newanalysis/helpers/helpers.pyx":158 * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicCurrent(double [:,:] vel, double [:] charges, double [:,:] result, int ctr): + * cdef int i, natoms=len(vel) */ -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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_13atomicCurrent(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_13atomicCurrent = {"atomicCurrent", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_13atomicCurrent, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_13atomicCurrent(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_vel = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_ctr; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":744 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 744, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("atomicCurrent (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 158, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vel,&__pyx_n_s_charges,&__pyx_n_s_result,&__pyx_n_s_ctr,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_vel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("atomicCurrent", 1, 4, 4, 1); __PYX_ERR(0, 158, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("atomicCurrent", 1, 4, 4, 2); __PYX_ERR(0, 158, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ctr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("atomicCurrent", 1, 4, 4, 3); __PYX_ERR(0, 158, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "atomicCurrent") < 0)) __PYX_ERR(0, 158, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_vel = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vel.memview)) __PYX_ERR(0, 159, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 159, __pyx_L3_error) + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 159, __pyx_L3_error) + __pyx_v_ctr = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_ctr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("atomicCurrent", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 158, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vel, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __Pyx_AddTraceback("newanalysis.helpers.atomicCurrent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_12atomicCurrent(__pyx_self, __pyx_v_vel, __pyx_v_charges, __pyx_v_result, __pyx_v_ctr); /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vel, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - -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) { +static PyObject *__pyx_pf_11newanalysis_7helpers_12atomicCurrent(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_vel, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_result, int __pyx_v_ctr) { + int __pyx_v_i; + int __pyx_v_natoms; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + __Pyx_RefNannySetupContext("atomicCurrent", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":747 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":160 + * @cython.boundscheck(False) + * def atomicCurrent(double [:,:] vel, double [:] charges, double [:,:] result, int ctr): + * cdef int i, natoms=len(vel) # <<<<<<<<<<<<<< * - * cdef inline tuple PyDataType_SHAPE(dtype d): + * for i in range(natoms): */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_vel); + __pyx_v_natoms = __pyx_t_1; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) + /* "newanalysis/helpers/helpers.pyx":162 + * cdef int i, natoms=len(vel) * + * for i in range(natoms): # <<<<<<<<<<<<<< + * result[ctr,0] += vel[i,0] * charges[i] + * result[ctr,1] += vel[i,1] * charges[i] */ + __pyx_t_2 = __pyx_v_natoms; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) + /* "newanalysis/helpers/helpers.pyx":163 * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + * for i in range(natoms): + * result[ctr,0] += vel[i,0] * charges[i] # <<<<<<<<<<<<<< + * result[ctr,1] += vel[i,1] * charges[i] + * result[ctr,2] += vel[i,2] * charges[i] */ + __pyx_t_5 = __pyx_v_i; + __pyx_t_6 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_vel.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_vel.shape[1]; + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_charges.shape[0]; + __pyx_t_8 = __pyx_v_ctr; + __pyx_t_9 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_result.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_result.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_8 * __pyx_v_result.strides[0]) ) + __pyx_t_9 * __pyx_v_result.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_5 * __pyx_v_vel.strides[0]) ) + __pyx_t_6 * __pyx_v_vel.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_7 * __pyx_v_charges.strides[0]) )))); -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 + /* "newanalysis/helpers/helpers.pyx":164 + * for i in range(natoms): + * result[ctr,0] += vel[i,0] * charges[i] + * result[ctr,1] += vel[i,1] * charges[i] # <<<<<<<<<<<<<< + * result[ctr,2] += vel[i,2] * charges[i] * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: */ - __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); - if (__pyx_t_1) { - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":751 - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape # <<<<<<<<<<<<<< - * else: - * return () - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); - __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); - goto __pyx_L0; + __pyx_t_7 = __pyx_v_i; + __pyx_t_6 = 1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_vel.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_vel.shape[1]; + __pyx_t_5 = __pyx_v_i; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_charges.shape[0]; + __pyx_t_9 = __pyx_v_ctr; + __pyx_t_8 = 1; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_result.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_result.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_9 * __pyx_v_result.strides[0]) ) + __pyx_t_8 * __pyx_v_result.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_7 * __pyx_v_vel.strides[0]) ) + __pyx_t_6 * __pyx_v_vel.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_5 * __pyx_v_charges.strides[0]) )))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 + /* "newanalysis/helpers/helpers.pyx":165 + * result[ctr,0] += vel[i,0] * charges[i] + * result[ctr,1] += vel[i,1] * charges[i] + * result[ctr,2] += vel[i,2] * charges[i] # <<<<<<<<<<<<<< * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: + * @cython.boundscheck(False) */ + __pyx_t_5 = __pyx_v_i; + __pyx_t_6 = 2; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_vel.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_vel.shape[1]; + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_charges.shape[0]; + __pyx_t_8 = __pyx_v_ctr; + __pyx_t_9 = 2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_result.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_result.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_8 * __pyx_v_result.strides[0]) ) + __pyx_t_9 * __pyx_v_result.strides[1]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_5 * __pyx_v_vel.strides[0]) ) + __pyx_t_6 * __pyx_v_vel.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_7 * __pyx_v_charges.strides[0]) )))); } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":753 - * return d.subarray.shape - * else: - * return () # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":158 * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_empty_tuple); - __pyx_r = __pyx_empty_tuple; - goto __pyx_L0; - } - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicCurrent(double [:,:] vel, double [:] charges, double [:,:] result, int ctr): + * cdef int i, natoms=len(vel) */ /* function exit code */ - __pyx_L0:; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 +/* "newanalysis/helpers/helpers.pyx":167 + * result[ctr,2] += vel[i,2] * charges[i] * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def centerOrientBox(double [:,:] com, double [:,:] coor, double boxl, int isolute, + * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): */ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_15centerOrientBox(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_14centerOrientBox, "\n centerOrientBox(com, xyz, boxlength, isolute, atoms_per_residue, residue_first_atom, coorA, coorB)\n\n Centers the box to the center of mass of a given molecule and rotates the box so that two sets of coordinates\n are as identical as possible.\n\n Args:\n com .. centers of mass of all molecules in the box\n xyz .. coordinates of all atoms\n boxlength .. edge length of the cubic box\n isolute .. index of the solute / center molecule (count starts with 0)\n atoms_per_residue .. array showing how many atoms each residue contains\n residue_first_atom .. index of the first atom of each residue\n coorA .. template coordinates\n coorB .. corresponding coordinates of the current frame\n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_15centerOrientBox = {"centerOrientBox", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_15centerOrientBox, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_14centerOrientBox}; +static PyObject *__pyx_pw_11newanalysis_7helpers_15centerOrientBox(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_com = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxl; + int __pyx_v_isolute; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coorA = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coorB = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_array_base", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":929 - * - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< - * PyArray_SetBaseObject(arr, base) - * - */ - Py_INCREF(__pyx_v_base); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":930 - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) - */ + __Pyx_RefNannySetupContext("centerOrientBox (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 167, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_com,&__pyx_n_s_coor,&__pyx_n_s_boxl,&__pyx_n_s_isolute,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_coorA,&__pyx_n_s_coorB,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_com)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 1); __PYX_ERR(0, 167, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 2); __PYX_ERR(0, 167, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 3); __PYX_ERR(0, 167, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 4); __PYX_ERR(0, 167, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 5); __PYX_ERR(0, 167, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coorA)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 6); __PYX_ERR(0, 167, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coorB)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, 7); __PYX_ERR(0, 167, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "centerOrientBox") < 0)) __PYX_ERR(0, 167, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 8)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + } + __pyx_v_com = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_com.memview)) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_isolute = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 169, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 169, __pyx_L3_error) + __pyx_v_coorA = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorA.memview)) __PYX_ERR(0, 169, __pyx_L3_error) + __pyx_v_coorB = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorB.memview)) __PYX_ERR(0, 169, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("centerOrientBox", 1, 8, 8, __pyx_nargs); __PYX_ERR(0, 167, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_com, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorA, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorB, 1); + __Pyx_AddTraceback("newanalysis.helpers.centerOrientBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_14centerOrientBox(__pyx_self, __pyx_v_com, __pyx_v_coor, __pyx_v_boxl, __pyx_v_isolute, __pyx_v_apr, __pyx_v_rfa, __pyx_v_coorA, __pyx_v_coorB); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_com, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorA, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorB, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_v_base; +static PyObject *__pyx_pf_11newanalysis_7helpers_14centerOrientBox(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_com, __Pyx_memviewslice __pyx_v_coor, double __pyx_v_boxl, int __pyx_v_isolute, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, __Pyx_memviewslice __pyx_v_coorA, __Pyx_memviewslice __pyx_v_coorB) { + double __pyx_v_shift[3]; + double __pyx_v_comslt[3]; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_nmol; + __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_tmpx; + double __pyx_v_tmpy; + double __pyx_v_tmpz; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + double __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("centerOrientBox", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":933 - * - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< - * if base is NULL: - * return None + /* "newanalysis/helpers/helpers.pyx":188 + * cdef double[3] shift + * cdef double[3] comslt + * cdef int i, j, k, nmol = com.shape[0] # <<<<<<<<<<<<<< + * cdef double [:,:] R = np.zeros((3,3)) + * cdef double tmpx, tmpy, tmpz */ - __pyx_v_base = PyArray_BASE(__pyx_v_arr); + __pyx_v_nmol = (__pyx_v_com.shape[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base + /* "newanalysis/helpers/helpers.pyx":189 + * cdef double[3] comslt + * cdef int i, j, k, nmol = com.shape[0] + * cdef double [:,:] R = np.zeros((3,3)) # <<<<<<<<<<<<<< + * cdef double tmpx, tmpy, tmpz + * */ - __pyx_t_1 = ((__pyx_v_base == NULL) != 0); - if (__pyx_t_1) { + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_tuple__11}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_R = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":935 - * base = PyArray_BASE(arr) - * if base is NULL: - * return None # <<<<<<<<<<<<<< - * return base + /* "newanalysis/helpers/helpers.pyx":192 + * cdef double tmpx, tmpy, tmpz + * + * for j in range(3): # <<<<<<<<<<<<<< + * comslt[j] = com[isolute,j] * */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { + __pyx_v_j = __pyx_t_4; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base + /* "newanalysis/helpers/helpers.pyx":193 + * + * for j in range(3): + * comslt[j] = com[isolute,j] # <<<<<<<<<<<<<< + * + * for i in range(nmol): */ + __pyx_t_6 = __pyx_v_isolute; + __pyx_t_7 = __pyx_v_j; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_com.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_com.shape[1]; + (__pyx_v_comslt[__pyx_v_j]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_6 * __pyx_v_com.strides[0]) ) + __pyx_t_7 * __pyx_v_com.strides[1]) ))); } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":936 - * if base is NULL: - * return None - * return base # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":195 + * comslt[j] = com[isolute,j] * - * # Versions of the import_* functions which are more suitable for + * for i in range(nmol): # <<<<<<<<<<<<<< + * for j in range(3): + * com[i,j] -= comslt[j] */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_base)); - __pyx_r = ((PyObject *)__pyx_v_base); - goto __pyx_L0; + __pyx_t_4 = __pyx_v_nmol; + __pyx_t_8 = __pyx_t_4; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) + /* "newanalysis/helpers/helpers.pyx":196 * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() + * for i in range(nmol): + * for j in range(3): # <<<<<<<<<<<<<< + * com[i,j] -= comslt[j] + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) */ + for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { + __pyx_v_j = __pyx_t_10; -static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_array", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "newanalysis/helpers/helpers.pyx":197 + * for i in range(nmol): + * for j in range(3): + * com[i,j] -= comslt[j] # <<<<<<<<<<<<<< + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) + * com[i,j] -= shift[j] */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + __pyx_t_7 = __pyx_v_i; + __pyx_t_6 = __pyx_v_j; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_com.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_com.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_7 * __pyx_v_com.strides[0]) ) + __pyx_t_6 * __pyx_v_com.strides[1]) )) -= (__pyx_v_comslt[__pyx_v_j]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":942 - * cdef inline int import_array() except -1: - * try: - * __pyx_import_array() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") + /* "newanalysis/helpers/helpers.pyx":198 + * for j in range(3): + * com[i,j] -= comslt[j] + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) # <<<<<<<<<<<<<< + * com[i,j] -= shift[j] + * */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 942, __pyx_L3_error) + __pyx_t_6 = __pyx_v_i; + __pyx_t_7 = __pyx_v_j; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_com.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_com.shape[1]; + __pyx_t_11 = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_6 * __pyx_v_com.strides[0]) ) + __pyx_t_7 * __pyx_v_com.strides[1]) ))); + if (unlikely(__pyx_v_boxl == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 198, __pyx_L1_error) + } + (__pyx_v_shift[__pyx_v_j]) = (__pyx_v_boxl * floor(((__pyx_t_11 / __pyx_v_boxl) + 0.5))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "newanalysis/helpers/helpers.pyx":199 + * com[i,j] -= comslt[j] + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) + * com[i,j] -= shift[j] # <<<<<<<<<<<<<< + * + * for k in range(rfa[i], rfa[i] + apr[i]): */ + __pyx_t_7 = __pyx_v_i; + __pyx_t_6 = __pyx_v_j; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_com.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_com.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_7 * __pyx_v_com.strides[0]) ) + __pyx_t_6 * __pyx_v_com.strides[1]) )) -= (__pyx_v_shift[__pyx_v_j]); } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":943 - * try: - * __pyx_import_array() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.multiarray failed to import") + /* "newanalysis/helpers/helpers.pyx":201 + * com[i,j] -= shift[j] * + * for k in range(rfa[i], rfa[i] + apr[i]): # <<<<<<<<<<<<<< + * for j in range(3): + * coor[k,j] -= comslt[j] - shift[j] */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 943, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __pyx_v_i; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rfa.shape[0]; + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_apr.shape[0]; + __pyx_t_10 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_6 * __pyx_v_rfa.strides[0]) ))) + (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_7 * __pyx_v_apr.strides[0]) )))); + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_rfa.shape[0]; + __pyx_t_12 = __pyx_t_10; + for (__pyx_t_13 = (*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_7 * __pyx_v_rfa.strides[0]) ))); __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_k = __pyx_t_13; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":202 + * + * for k in range(rfa[i], rfa[i] + apr[i]): + * for j in range(3): # <<<<<<<<<<<<<< + * coor[k,j] -= comslt[j] - shift[j] * - * cdef inline int import_umath() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 944, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 944, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + for (__pyx_t_14 = 0; __pyx_t_14 < 3; __pyx_t_14+=1) { + __pyx_v_j = __pyx_t_14; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "newanalysis/helpers/helpers.pyx":203 + * for k in range(rfa[i], rfa[i] + apr[i]): + * for j in range(3): + * coor[k,j] -= comslt[j] - shift[j] # <<<<<<<<<<<<<< + * + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + __pyx_t_6 = __pyx_v_k; + __pyx_t_15 = __pyx_v_j; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_6 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) )) -= ((__pyx_v_comslt[__pyx_v_j]) - (__pyx_v_shift[__pyx_v_j])); + } + } } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() + /* "newanalysis/helpers/helpers.pyx":205 + * coor[k,j] -= comslt[j] - shift[j] + * + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) # <<<<<<<<<<<<<< + * + * for i in prange(coor.shape[0], nogil=True): */ + __pyx_t_7 = 0; + __pyx_t_15 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_R.shape[1]; + __pyx_t_6 = 0; + __pyx_t_16 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coorA.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coorA.shape[1]; + __pyx_t_17 = 0; + __pyx_t_18 = 0; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coorB.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coorB.shape[1]; + GetRotation((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_7 * __pyx_v_R.strides[0]) ) + __pyx_t_15 * __pyx_v_R.strides[1]) )))), (__pyx_v_coorA.shape[0]), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorA.data + __pyx_t_6 * __pyx_v_coorA.strides[0]) ) + __pyx_t_16 * __pyx_v_coorA.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorB.data + __pyx_t_17 * __pyx_v_coorB.strides[0]) ) + __pyx_t_18 * __pyx_v_coorB.strides[1]) )))), 0); - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") + /* "newanalysis/helpers/helpers.pyx":207 + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + if (unlikely(!__pyx_v_coor.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("coor"); __PYX_ERR(0, 207, __pyx_L14_error) } + __pyx_t_19 = (__pyx_v_coor.shape[0]); + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_21 = (__pyx_t_19 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_21 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_6, __pyx_t_7) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_tmpx) lastprivate(__pyx_v_tmpy) lastprivate(__pyx_v_tmpz) + #endif /* _OPENMP */ + for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_21; __pyx_t_20++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_20); + /* Initialize private variables to invalid values */ + __pyx_v_tmpx = ((double)__PYX_NAN()); + __pyx_v_tmpy = ((double)__PYX_NAN()); + __pyx_v_tmpz = ((double)__PYX_NAN()); -static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_umath", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "newanalysis/helpers/helpers.pyx":208 * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * for i in prange(coor.shape[0], nogil=True): + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] # <<<<<<<<<<<<<< + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + __pyx_t_18 = 0; + __pyx_t_17 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_R.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[1]; + __pyx_t_16 = __pyx_v_i; + __pyx_t_6 = 0; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[1]; + __pyx_t_15 = 0; + __pyx_t_7 = 1; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_R.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[1]; + __pyx_t_22 = __pyx_v_i; + __pyx_t_23 = 1; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_coor.shape[1]; + __pyx_t_24 = 0; + __pyx_t_25 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_R.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_R.shape[1]; + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = 2; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; + __pyx_v_tmpx = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_18 * __pyx_v_R.strides[0]) ) + __pyx_t_17 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_16 * __pyx_v_coor.strides[0]) ) + __pyx_t_6 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_15 * __pyx_v_R.strides[0]) ) + __pyx_t_7 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_22 * __pyx_v_coor.strides[0]) ) + __pyx_t_23 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_24 * __pyx_v_R.strides[0]) ) + __pyx_t_25 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) ))))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":948 - * cdef inline int import_umath() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") + /* "newanalysis/helpers/helpers.pyx":209 + * for i in prange(coor.shape[0], nogil=True): + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] # <<<<<<<<<<<<<< + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 948, __pyx_L3_error) + __pyx_t_27 = 1; + __pyx_t_26 = 0; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_R.shape[0]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_R.shape[1]; + __pyx_t_25 = __pyx_v_i; + __pyx_t_24 = 0; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_coor.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_coor.shape[1]; + __pyx_t_23 = 1; + __pyx_t_22 = 1; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_R.shape[0]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_R.shape[1]; + __pyx_t_7 = __pyx_v_i; + __pyx_t_15 = 1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; + __pyx_t_6 = 1; + __pyx_t_16 = 2; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_R.shape[1]; + __pyx_t_17 = __pyx_v_i; + __pyx_t_18 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_v_tmpy = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_27 * __pyx_v_R.strides[0]) ) + __pyx_t_26 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_25 * __pyx_v_coor.strides[0]) ) + __pyx_t_24 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_23 * __pyx_v_R.strides[0]) ) + __pyx_t_22 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_7 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_6 * __pyx_v_R.strides[0]) ) + __pyx_t_16 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 - * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + /* "newanalysis/helpers/helpers.pyx":210 + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] # <<<<<<<<<<<<<< + * coor[i,0] = tmpx + * coor[i,1] = tmpy */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + __pyx_t_18 = 2; + __pyx_t_17 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_R.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[1]; + __pyx_t_16 = __pyx_v_i; + __pyx_t_6 = 0; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[1]; + __pyx_t_15 = 2; + __pyx_t_7 = 1; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_R.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[1]; + __pyx_t_22 = __pyx_v_i; + __pyx_t_23 = 1; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_coor.shape[1]; + __pyx_t_24 = 2; + __pyx_t_25 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_R.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_R.shape[1]; + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = 2; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; + __pyx_v_tmpz = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_18 * __pyx_v_R.strides[0]) ) + __pyx_t_17 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_16 * __pyx_v_coor.strides[0]) ) + __pyx_t_6 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_15 * __pyx_v_R.strides[0]) ) + __pyx_t_7 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_22 * __pyx_v_coor.strides[0]) ) + __pyx_t_23 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_24 * __pyx_v_R.strides[0]) ) + __pyx_t_25 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) ))))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":949 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") + /* "newanalysis/helpers/helpers.pyx":211 + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx # <<<<<<<<<<<<<< + * coor[i,1] = tmpy + * coor[i,2] = tmpz + */ + __pyx_t_27 = __pyx_v_i; + __pyx_t_26 = 0; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[0]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_27 * __pyx_v_coor.strides[0]) ) + __pyx_t_26 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpx; + + /* "newanalysis/helpers/helpers.pyx":212 + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx + * coor[i,1] = tmpy # <<<<<<<<<<<<<< + * coor[i,2] = tmpz * */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 949, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = 1; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpy; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":213 + * coor[i,0] = tmpx + * coor[i,1] = tmpy + * coor[i,2] = tmpz # <<<<<<<<<<<<<< * - * cdef inline int import_ufunc() except -1: + * @cython.boundscheck(False) */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 950, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 950, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + __pyx_t_27 = __pyx_v_i; + __pyx_t_26 = 2; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[0]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_27 * __pyx_v_coor.strides[0]) ) + __pyx_t_26 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpz; + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "newanalysis/helpers/helpers.pyx":207 + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L15; + } + __pyx_L14_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L15:; + } } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") + /* "newanalysis/helpers/helpers.pyx":167 + * result[ctr,2] += vel[i,2] * charges[i] * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def centerOrientBox(double [:,:] com, double [:,:] coor, double boxl, int isolute, + * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_AddTraceback("newanalysis.helpers.centerOrientBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_R, 1); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") - * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - -static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_ufunc", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":954 - * cdef inline int import_ufunc() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") - */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 954, __pyx_L3_error) - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":955 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") - * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 955, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":956 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - * - * cdef extern from *: - */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 956, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 956, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") - * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 - * - * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` - */ - -static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_timedelta64_object", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":978 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 - * - * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * - * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` - */ - -static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_datetime64_object", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":993 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * - * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 - * - * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object - */ - -static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { - npy_datetime __pyx_r; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1003 - * also needed. That can be found using `get_datetime64_unit`. - * """ - * return (obj).obval # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 - * - * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 - * - * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object - */ - -static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { - npy_timedelta __pyx_r; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1010 - * returns the int64 value underlying scalar numpy timedelta64 object - * """ - * return (obj).obval # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 - * - * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 - * - * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. - */ - -static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { - NPY_DATETIMEUNIT __pyx_r; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1017 - * returns the unit part of the dtype for a numpy datetime64 object. - * """ - * return (obj).obmeta.base # <<<<<<<<<<<<<< - */ - __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 - * - * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. - */ - - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): +/* "newanalysis/helpers/helpers.pyx":215 + * coor[i,2] = tmpz * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def centerToPointOrientBox(double [:,:] com, double [:,:] coor, double [:] center, double boxl, + * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): */ /* Python wrapper */ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_shape = 0; - Py_ssize_t __pyx_v_itemsize; - PyObject *__pyx_v_format = 0; - PyObject *__pyx_v_mode = 0; - int __pyx_v_allocate_buffer; +static PyObject *__pyx_pw_11newanalysis_7helpers_17centerToPointOrientBox(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_16centerToPointOrientBox, "\n centerOrientToPointBox(com, xyz, center, boxlength, atoms_per_residue, residue_first_atom, coorA, coorB)\n\n Centers the box to the center of mass of a given molecule and rotates the box so that two sets of coordinates\n are as identical as possible.\n\n Args:\n com .. centers of mass of all molecules in the box\n xyz .. coordinates of all atoms\n boxlength .. edge length of the cubic box\n atoms_per_residue .. array showing how many atoms each residue contains\n residue_first_atom .. index of the first atom of each residue\n coorA .. template coordinates\n coorB .. corresponding coordinates of the current frame\n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_17centerToPointOrientBox = {"centerToPointOrientBox", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_17centerToPointOrientBox, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_16centerToPointOrientBox}; +static PyObject *__pyx_pw_11newanalysis_7helpers_17centerToPointOrientBox(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_com = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_center = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxl; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coorA = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coorB = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + __Pyx_RefNannySetupContext("centerToPointOrientBox (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 215, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; - PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_n_s_c); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_com,&__pyx_n_s_coor,&__pyx_n_s_center,&__pyx_n_s_boxl,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_coorA,&__pyx_n_s_coorB,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_com)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 123, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 1); __PYX_ERR(0, 215, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_center)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 123, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 2); __PYX_ERR(0, 215, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode); - if (value) { values[3] = value; kw_args--; } + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 3); __PYX_ERR(0, 215, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer); - if (value) { values[4] = value; kw_args--; } + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 4); __PYX_ERR(0, 215, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 5); __PYX_ERR(0, 215, __pyx_L3_error) } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 123, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coorA)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 6); __PYX_ERR(0, 215, __pyx_L3_error) + } CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coorB)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, 7); __PYX_ERR(0, 215, __pyx_L3_error) + } } - } - __pyx_v_shape = ((PyObject*)values[0]); - __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_v_format = values[2]; - __pyx_v_mode = values[3]; - if (values[4]) { - __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 124, __pyx_L3_error) + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "centerToPointOrientBox") < 0)) __PYX_ERR(0, 215, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 8)) { + goto __pyx_L5_argtuple_error; } else { - - /* "View.MemoryView":124 - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, - * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< - * - * cdef int idx - */ - __pyx_v_allocate_buffer = ((int)1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); } + __pyx_v_com = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_com.memview)) __PYX_ERR(0, 216, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 216, __pyx_L3_error) + __pyx_v_center = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_center.memview)) __PYX_ERR(0, 216, __pyx_L3_error) + __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 217, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 217, __pyx_L3_error) + __pyx_v_coorA = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorA.memview)) __PYX_ERR(0, 217, __pyx_L3_error) + __pyx_v_coorB = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorB.memview)) __PYX_ERR(0, 217, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 123, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("centerToPointOrientBox", 1, 8, 8, __pyx_nargs); __PYX_ERR(0, 215, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_com, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_center, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorA, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorB, 1); + __Pyx_AddTraceback("newanalysis.helpers.centerToPointOrientBox", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return -1; + return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 123, __pyx_L1_error) - if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 123, __pyx_L1_error) - } - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); - - /* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * - */ + __pyx_r = __pyx_pf_11newanalysis_7helpers_16centerToPointOrientBox(__pyx_self, __pyx_v_com, __pyx_v_coor, __pyx_v_center, __pyx_v_boxl, __pyx_v_apr, __pyx_v_rfa, __pyx_v_coorA, __pyx_v_coorB); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_com, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_center, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorA, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorB, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { - int __pyx_v_idx; - Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_dim; - PyObject **__pyx_v_p; - char __pyx_v_order; - int __pyx_r; +static PyObject *__pyx_pf_11newanalysis_7helpers_16centerToPointOrientBox(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_com, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_center, double __pyx_v_boxl, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, __Pyx_memviewslice __pyx_v_coorA, __Pyx_memviewslice __pyx_v_coorB) { + double __pyx_v_shift[3]; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_nmol; + __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_tmpx; + double __pyx_v_tmpy; + double __pyx_v_tmpz; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_6; + int __pyx_t_7; int __pyx_t_8; Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; + Py_ssize_t __pyx_t_10; Py_ssize_t __pyx_t_11; + double __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_format); + __Pyx_RefNannySetupContext("centerToPointOrientBox", 0); - /* "View.MemoryView":130 - * cdef PyObject **p - * - * self.ndim = len(shape) # <<<<<<<<<<<<<< - * self.itemsize = itemsize - * + /* "newanalysis/helpers/helpers.pyx":234 + * """ + * cdef double[3] shift + * cdef int i, j, k, nmol = com.shape[0] # <<<<<<<<<<<<<< + * cdef double [:,:] R = np.zeros((3,3)) + * cdef double tmpx, tmpy, tmpz */ - if (unlikely(__pyx_v_shape == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 130, __pyx_L1_error) - } - __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 130, __pyx_L1_error) - __pyx_v_self->ndim = ((int)__pyx_t_1); + __pyx_v_nmol = (__pyx_v_com.shape[0]); - /* "View.MemoryView":131 - * - * self.ndim = len(shape) - * self.itemsize = itemsize # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":235 + * cdef double[3] shift + * cdef int i, j, k, nmol = com.shape[0] + * cdef double [:,:] R = np.zeros((3,3)) # <<<<<<<<<<<<<< + * cdef double tmpx, tmpy, tmpz * - * if not self.ndim: */ - __pyx_v_self->itemsize = __pyx_v_itemsize; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_tuple__11}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_R = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":133 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") + /* "newanalysis/helpers/helpers.pyx":238 + * cdef double tmpx, tmpy, tmpz * + * for i in range(nmol): # <<<<<<<<<<<<<< + * for j in range(3): + * com[i,j] -= center[j] */ - __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_4 = __pyx_v_nmol; + __pyx_t_6 = __pyx_t_4; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "View.MemoryView":134 + /* "newanalysis/helpers/helpers.pyx":239 * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< - * - * if itemsize <= 0: + * for i in range(nmol): + * for j in range(3): # <<<<<<<<<<<<<< + * com[i,j] -= center[j] + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 134, __pyx_L1_error) + for (__pyx_t_8 = 0; __pyx_t_8 < 3; __pyx_t_8+=1) { + __pyx_v_j = __pyx_t_8; - /* "View.MemoryView":133 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") - * + /* "newanalysis/helpers/helpers.pyx":240 + * for i in range(nmol): + * for j in range(3): + * com[i,j] -= center[j] # <<<<<<<<<<<<<< + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) + * com[i,j] -= shift[j] */ - } + __pyx_t_9 = __pyx_v_j; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_center.shape[0]; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = __pyx_v_j; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_com.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_com.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_10 * __pyx_v_com.strides[0]) ) + __pyx_t_11 * __pyx_v_com.strides[1]) )) -= (*((double *) ( /* dim=0 */ (__pyx_v_center.data + __pyx_t_9 * __pyx_v_center.strides[0]) ))); - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") + /* "newanalysis/helpers/helpers.pyx":241 + * for j in range(3): + * com[i,j] -= center[j] + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) # <<<<<<<<<<<<<< + * com[i,j] -= shift[j] * */ - __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":137 - * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< - * - * if not isinstance(format, bytes): - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 137, __pyx_L1_error) - - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") - * - */ - } - - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") - * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - */ - __pyx_t_2 = PyBytes_Check(__pyx_v_format); - __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_4) { + __pyx_t_9 = __pyx_v_i; + __pyx_t_11 = __pyx_v_j; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_com.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_com.shape[1]; + __pyx_t_12 = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_9 * __pyx_v_com.strides[0]) ) + __pyx_t_11 * __pyx_v_com.strides[1]) ))); + if (unlikely(__pyx_v_boxl == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 241, __pyx_L1_error) + } + (__pyx_v_shift[__pyx_v_j]) = (__pyx_v_boxl * floor(((__pyx_t_12 / __pyx_v_boxl) + 0.5))); - /* "View.MemoryView":140 + /* "newanalysis/helpers/helpers.pyx":242 + * com[i,j] -= center[j] + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) + * com[i,j] -= shift[j] # <<<<<<<<<<<<<< * - * if not isinstance(format, bytes): - * format = format.encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format # keep a reference to the byte string - * self.format = self._format + * for k in range(rfa[i], rfa[i] + apr[i]): */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } + __pyx_t_11 = __pyx_v_i; + __pyx_t_9 = __pyx_v_j; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_com.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_com.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_com.data + __pyx_t_11 * __pyx_v_com.strides[0]) ) + __pyx_t_9 * __pyx_v_com.strides[1]) )) -= (__pyx_v_shift[__pyx_v_j]); } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); - __pyx_t_3 = 0; - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") + /* "newanalysis/helpers/helpers.pyx":244 + * com[i,j] -= shift[j] * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string + * for k in range(rfa[i], rfa[i] + apr[i]): # <<<<<<<<<<<<<< + * for j in range(3): + * coor[k,j] -= center[j] - shift[j] */ - } + __pyx_t_9 = __pyx_v_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_rfa.shape[0]; + __pyx_t_11 = __pyx_v_i; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_apr.shape[0]; + __pyx_t_8 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_9 * __pyx_v_rfa.strides[0]) ))) + (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_11 * __pyx_v_apr.strides[0]) )))); + __pyx_t_11 = __pyx_v_i; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_rfa.shape[0]; + __pyx_t_13 = __pyx_t_8; + for (__pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_11 * __pyx_v_rfa.strides[0]) ))); __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_k = __pyx_t_14; - /* "View.MemoryView":141 - * if not isinstance(format, bytes): - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< - * self.format = self._format + /* "newanalysis/helpers/helpers.pyx":245 + * + * for k in range(rfa[i], rfa[i] + apr[i]): + * for j in range(3): # <<<<<<<<<<<<<< + * coor[k,j] -= center[j] - shift[j] * */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 141, __pyx_L1_error) - __pyx_t_3 = __pyx_v_format; - __Pyx_INCREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->_format); - __Pyx_DECREF(__pyx_v_self->_format); - __pyx_v_self->_format = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + for (__pyx_t_15 = 0; __pyx_t_15 < 3; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; - /* "View.MemoryView":142 - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - * self.format = self._format # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":246 + * for k in range(rfa[i], rfa[i] + apr[i]): + * for j in range(3): + * coor[k,j] -= center[j] - shift[j] # <<<<<<<<<<<<<< * + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) */ - if (unlikely(__pyx_v_self->_format == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(2, 142, __pyx_L1_error) + __pyx_t_9 = __pyx_v_j; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_center.shape[0]; + __pyx_t_10 = __pyx_v_k; + __pyx_t_16 = __pyx_v_j; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) )) -= ((*((double *) ( /* dim=0 */ (__pyx_v_center.data + __pyx_t_9 * __pyx_v_center.strides[0]) ))) - (__pyx_v_shift[__pyx_v_j])); + } + } } - __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 142, __pyx_L1_error) - __pyx_v_self->format = __pyx_t_7; - /* "View.MemoryView":145 - * + /* "newanalysis/helpers/helpers.pyx":248 + * coor[k,j] -= center[j] - shift[j] * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< - * self._strides = self._shape + self.ndim + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) # <<<<<<<<<<<<<< * + * for i in prange(coor.shape[0], nogil=True): */ - __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + __pyx_t_11 = 0; + __pyx_t_9 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_R.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[1]; + __pyx_t_16 = 0; + __pyx_t_10 = 0; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coorA.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coorA.shape[1]; + __pyx_t_17 = 0; + __pyx_t_18 = 0; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coorB.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coorB.shape[1]; + GetRotation((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_11 * __pyx_v_R.strides[0]) ) + __pyx_t_9 * __pyx_v_R.strides[1]) )))), (__pyx_v_coorA.shape[0]), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorA.data + __pyx_t_16 * __pyx_v_coorA.strides[0]) ) + __pyx_t_10 * __pyx_v_coorA.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorB.data + __pyx_t_17 * __pyx_v_coorB.strides[0]) ) + __pyx_t_18 * __pyx_v_coorB.strides[1]) )))), 0); - /* "View.MemoryView":146 - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) - * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":250 + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) * - * if not self._shape: + * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] */ - __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + if (unlikely(!__pyx_v_coor.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("coor"); __PYX_ERR(0, 250, __pyx_L12_error) } + __pyx_t_19 = (__pyx_v_coor.shape[0]); + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_21 = (__pyx_t_19 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_21 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_tmpx) lastprivate(__pyx_v_tmpy) lastprivate(__pyx_v_tmpz) + #endif /* _OPENMP */ + for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_21; __pyx_t_20++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_20); + /* Initialize private variables to invalid values */ + __pyx_v_tmpx = ((double)__PYX_NAN()); + __pyx_v_tmpy = ((double)__PYX_NAN()); + __pyx_v_tmpz = ((double)__PYX_NAN()); - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") + /* "newanalysis/helpers/helpers.pyx":251 * + * for i in prange(coor.shape[0], nogil=True): + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] # <<<<<<<<<<<<<< + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] */ - __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_18 = 0; + __pyx_t_17 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_R.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[1]; + __pyx_t_10 = __pyx_v_i; + __pyx_t_16 = 0; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + __pyx_t_9 = 0; + __pyx_t_11 = 1; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_R.shape[1]; + __pyx_t_22 = __pyx_v_i; + __pyx_t_23 = 1; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_coor.shape[1]; + __pyx_t_24 = 0; + __pyx_t_25 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_R.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_R.shape[1]; + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = 2; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; + __pyx_v_tmpx = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_18 * __pyx_v_R.strides[0]) ) + __pyx_t_17 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_9 * __pyx_v_R.strides[0]) ) + __pyx_t_11 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_22 * __pyx_v_coor.strides[0]) ) + __pyx_t_23 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_24 * __pyx_v_R.strides[0]) ) + __pyx_t_25 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) ))))); - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/helpers.pyx":252 + * for i in prange(coor.shape[0], nogil=True): + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] # <<<<<<<<<<<<<< + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 149, __pyx_L1_error) + __pyx_t_27 = 1; + __pyx_t_26 = 0; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_R.shape[0]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_R.shape[1]; + __pyx_t_25 = __pyx_v_i; + __pyx_t_24 = 0; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_coor.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_coor.shape[1]; + __pyx_t_23 = 1; + __pyx_t_22 = 1; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_R.shape[0]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_R.shape[1]; + __pyx_t_11 = __pyx_v_i; + __pyx_t_9 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; + __pyx_t_16 = 1; + __pyx_t_10 = 2; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_R.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_R.shape[1]; + __pyx_t_17 = __pyx_v_i; + __pyx_t_18 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_v_tmpy = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_27 * __pyx_v_R.strides[0]) ) + __pyx_t_26 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_25 * __pyx_v_coor.strides[0]) ) + __pyx_t_24 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_23 * __pyx_v_R.strides[0]) ) + __pyx_t_22 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_11 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_16 * __pyx_v_R.strides[0]) ) + __pyx_t_10 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))))); - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") - * + /* "newanalysis/helpers/helpers.pyx":253 + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] # <<<<<<<<<<<<<< + * coor[i,0] = tmpx + * coor[i,1] = tmpy */ - } + __pyx_t_18 = 2; + __pyx_t_17 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_R.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[1]; + __pyx_t_10 = __pyx_v_i; + __pyx_t_16 = 0; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + __pyx_t_9 = 2; + __pyx_t_11 = 1; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_R.shape[1]; + __pyx_t_22 = __pyx_v_i; + __pyx_t_23 = 1; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_coor.shape[1]; + __pyx_t_24 = 2; + __pyx_t_25 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_R.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_R.shape[1]; + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = 2; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; + __pyx_v_tmpz = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_18 * __pyx_v_R.strides[0]) ) + __pyx_t_17 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_9 * __pyx_v_R.strides[0]) ) + __pyx_t_11 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_22 * __pyx_v_coor.strides[0]) ) + __pyx_t_23 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_24 * __pyx_v_R.strides[0]) ) + __pyx_t_25 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) ))))); - /* "View.MemoryView":152 - * - * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) + /* "newanalysis/helpers/helpers.pyx":254 + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx # <<<<<<<<<<<<<< + * coor[i,1] = tmpy + * coor[i,2] = tmpz */ - __pyx_t_8 = 0; - __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; - for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 152, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_9; - __pyx_v_idx = __pyx_t_8; - __pyx_t_8 = (__pyx_t_8 + 1); + __pyx_t_27 = __pyx_v_i; + __pyx_t_26 = 0; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[0]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_27 * __pyx_v_coor.strides[0]) ) + __pyx_t_26 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpx; - /* "View.MemoryView":153 + /* "newanalysis/helpers/helpers.pyx":255 + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx + * coor[i,1] = tmpy # <<<<<<<<<<<<<< + * coor[i,2] = tmpz * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim */ - __pyx_t_4 = ((__pyx_v_dim <= 0) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = 1; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_26 * __pyx_v_coor.strides[0]) ) + __pyx_t_27 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpy; - /* "View.MemoryView":154 - * for idx, dim in enumerate(shape): - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<< - * self._shape[idx] = dim + /* "newanalysis/helpers/helpers.pyx":256 + * coor[i,0] = tmpx + * coor[i,1] = tmpy + * coor[i,2] = tmpz # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 154, __pyx_L1_error) + __pyx_t_27 = __pyx_v_i; + __pyx_t_26 = 2; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coor.shape[0]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_27 * __pyx_v_coor.strides[0]) ) + __pyx_t_26 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpz; + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":153 + /* "newanalysis/helpers/helpers.pyx":250 + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim + * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] */ - } + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L13; + } + __pyx_L12_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L13:; + } + } - /* "View.MemoryView":155 - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":215 + * coor[i,2] = tmpz * - * cdef char order + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def centerToPointOrientBox(double [:,:] com, double [:,:] coor, double [:] center, double boxl, + * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): */ - (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - /* "View.MemoryView":152 - * - * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_AddTraceback("newanalysis.helpers.centerToPointOrientBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_R, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":158 +/* "newanalysis/helpers/helpers.pyx":258 + * coor[i,2] = tmpz * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 158, __pyx_L1_error) - if (__pyx_t_4) { - - /* "View.MemoryView":159 - * cdef char order - * if mode == 'fortran': - * order = b'F' # <<<<<<<<<<<<<< - * self.mode = u'fortran' - * elif mode == 'c': + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol): + * """ */ - __pyx_v_order = 'F'; - /* "View.MemoryView":160 - * if mode == 'fortran': - * order = b'F' - * self.mode = u'fortran' # <<<<<<<<<<<<<< - * elif mode == 'c': - * order = b'C' - */ - __Pyx_INCREF(__pyx_n_u_fortran); - __Pyx_GIVEREF(__pyx_n_u_fortran); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_fortran; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_19calcEnergyAA(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_18calcEnergyAA, "\n energy = calcEnergyAA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules)\n\n Calculates the solvation energy of a solute in any solvent for a specific coordinate set.\n \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_19calcEnergyAA = {"calcEnergyAA", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_19calcEnergyAA, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_18calcEnergyAA}; +static PyObject *__pyx_pw_11newanalysis_7helpers_19calcEnergyAA(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_isolute; + int __pyx_v_nmol; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcEnergyAA (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 258, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, 1); __PYX_ERR(0, 258, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, 2); __PYX_ERR(0, 258, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, 3); __PYX_ERR(0, 258, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, 4); __PYX_ERR(0, 258, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, 5); __PYX_ERR(0, 258, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcEnergyAA") < 0)) __PYX_ERR(0, 258, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 6)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 259, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 259, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 259, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 259, __pyx_L3_error) + __pyx_v_isolute = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error) + __pyx_v_nmol = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcEnergyAA", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 258, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAA", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_18calcEnergyAA(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol); - /* "View.MemoryView":158 - * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - goto __pyx_L10; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 161, __pyx_L1_error) - if (likely(__pyx_t_4)) { - - /* "View.MemoryView":162 - * self.mode = u'fortran' - * elif mode == 'c': - * order = b'C' # <<<<<<<<<<<<<< - * self.mode = u'c' - * else: - */ - __pyx_v_order = 'C'; - - /* "View.MemoryView":163 - * elif mode == 'c': - * order = b'C' - * self.mode = u'c' # <<<<<<<<<<<<<< - * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) - */ - __Pyx_INCREF(__pyx_n_u_c); - __Pyx_GIVEREF(__pyx_n_u_c); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_c; - - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - goto __pyx_L10; - } +static PyObject *__pyx_pf_11newanalysis_7helpers_18calcEnergyAA(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_idx; + int __pyx_v_idx2; + __Pyx_memviewslice __pyx_v_epa = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_r; + double __pyx_v_energy; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + double __pyx_t_20; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcEnergyAA", 0); - /* "View.MemoryView":165 - * self.mode = u'c' - * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":267 + * """ + * cdef int i, j, k, idx, idx2 + * cdef double [:] epa = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, r * - * self.len = fill_contig_strides_array(self._shape, self._strides, */ - /*else*/ { - __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 165, __pyx_L1_error) } - __pyx_L10:; + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_epa = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":167 - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) + /* "newanalysis/helpers/helpers.pyx":270 + * cdef double dx, dy, dz, r * - * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<< - * itemsize, self.ndim, order) + * energy = 0.0 # <<<<<<<<<<<<<< * + * # loop over solute atoms */ - __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + __pyx_v_energy = 0.0; - /* "View.MemoryView":170 - * itemsize, self.ndim, order) - * - * self.free_data = allocate_buffer # <<<<<<<<<<<<<< - * self.dtype_is_object = format == b'O' - * if allocate_buffer: + /* "newanalysis/helpers/helpers.pyx":274 + * # loop over solute atoms + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * idx = rfa[isolute] + i + * # loop over solvent molecules */ - __pyx_v_self->free_data = __pyx_v_allocate_buffer; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_8 = __pyx_t_6; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "View.MemoryView":171 - * - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< - * if allocate_buffer: - * + /* "newanalysis/helpers/helpers.pyx":275 + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): + * idx = rfa[isolute] + i # <<<<<<<<<<<<<< + * # loop over solvent molecules + * for j in range(nmol): */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 171, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 171, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_self->dtype_is_object = __pyx_t_4; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/helpers.pyx":277 + * idx = rfa[isolute] + i + * # loop over solvent molecules + * for j in range(nmol): # <<<<<<<<<<<<<< + * if j == isolute: + * continue */ - __pyx_t_4 = (__pyx_v_allocate_buffer != 0); - if (__pyx_t_4) { + __pyx_t_10 = __pyx_v_nmol; + __pyx_t_11 = __pyx_t_10; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; - /* "View.MemoryView":175 - * - * - * self.data = malloc(self.len) # <<<<<<<<<<<<<< - * if not self.data: - * raise MemoryError("unable to allocate array data.") + /* "newanalysis/helpers/helpers.pyx":278 + * # loop over solvent molecules + * for j in range(nmol): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ - __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + __pyx_t_13 = (__pyx_v_j == __pyx_v_isolute); + if (__pyx_t_13) { - /* "View.MemoryView":176 - * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") - * + /* "newanalysis/helpers/helpers.pyx":279 + * for j in range(nmol): + * if j == isolute: + * continue # <<<<<<<<<<<<<< + * for k in range(apr[j]): + * idx2 = rfa[j] + k */ - __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0); - if (unlikely(__pyx_t_4)) { + goto __pyx_L5_continue; - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< - * - * if self.dtype_is_object: + /* "newanalysis/helpers/helpers.pyx":278 + * # loop over solvent molecules + * for j in range(nmol): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 177, __pyx_L1_error) + } - /* "View.MemoryView":176 - * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") - * + /* "newanalysis/helpers/helpers.pyx":280 + * if j == isolute: + * continue + * for k in range(apr[j]): # <<<<<<<<<<<<<< + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] */ - } + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_k = __pyx_t_16; - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") - * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): + /* "newanalysis/helpers/helpers.pyx":281 + * continue + * for k in range(apr[j]): + * idx2 = rfa[j] + k # <<<<<<<<<<<<<< + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] */ - __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_4) { + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); - /* "View.MemoryView":180 - * - * if self.dtype_is_object: - * p = self.data # <<<<<<<<<<<<<< - * for i in range(self.len / itemsize): - * p[i] = Py_None + /* "newanalysis/helpers/helpers.pyx":282 + * for k in range(apr[j]): + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] */ - __pyx_v_p = ((PyObject **)__pyx_v_self->data); + __pyx_t_4 = __pyx_v_idx; + __pyx_t_17 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[1]; + __pyx_t_18 = __pyx_v_idx2; + __pyx_t_19 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_17 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":181 - * if self.dtype_is_object: - * p = self.data - * for i in range(self.len / itemsize): # <<<<<<<<<<<<<< - * p[i] = Py_None - * Py_INCREF(Py_None) + /* "newanalysis/helpers/helpers.pyx":283 + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize); - __pyx_t_9 = __pyx_t_1; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + __pyx_t_19 = __pyx_v_idx; + __pyx_t_18 = 1; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_17 = __pyx_v_idx2; + __pyx_t_4 = 1; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":284 + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< + * r = sqrt(dx*dx + dy*dy + dz*dz) + * epa[i] += charges[idx] * charges[idx2] / r + */ + __pyx_t_4 = __pyx_v_idx; + __pyx_t_17 = 2; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[1]; + __pyx_t_18 = __pyx_v_idx2; + __pyx_t_19 = 2; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_17 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":182 - * p = self.data - * for i in range(self.len / itemsize): - * p[i] = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "newanalysis/helpers/helpers.pyx":285 + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< + * epa[i] += charges[idx] * charges[idx2] / r * */ - (__pyx_v_p[__pyx_v_i]) = Py_None; + __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* "View.MemoryView":183 - * for i in range(self.len / itemsize): - * p[i] = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":286 + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) + * epa[i] += charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< * - * @cname('getbuffer') + * for i in range(apr[isolute]): */ - Py_INCREF(Py_None); + __pyx_t_19 = __pyx_v_idx; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; + __pyx_t_18 = __pyx_v_idx2; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_charges.shape[0]; + __pyx_t_20 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_18 * __pyx_v_charges.strides[0]) )))); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 286, __pyx_L1_error) + } + __pyx_t_18 = __pyx_v_i; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_epa.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_18 * __pyx_v_epa.strides[0]) )) += (__pyx_t_20 / __pyx_v_r); } + __pyx_L5_continue:; + } + } - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") + /* "newanalysis/helpers/helpers.pyx":288 + * epa[i] += charges[idx] * charges[idx2] / r + * + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * energy += epa[i] * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): */ - } + __pyx_t_18 = __pyx_v_isolute; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_18 * __pyx_v_apr.strides[0]) ))); + __pyx_t_8 = __pyx_t_6; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":289 * + * for i in range(apr[isolute]): + * energy += epa[i] # <<<<<<<<<<<<<< * + * return energy * 1390.02 */ + __pyx_t_18 = __pyx_v_i; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_epa.shape[0]; + __pyx_v_energy = (__pyx_v_energy + (*((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_18 * __pyx_v_epa.strides[0]) )))); } - /* "View.MemoryView":123 - * cdef bint dtype_is_object + /* "newanalysis/helpers/helpers.pyx":291 + * energy += epa[i] * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): + * return energy * 1390.02 # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_energy * 1390.02)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "newanalysis/helpers/helpers.pyx":258 + * coor[i,2] = tmpz * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol): + * """ */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAA", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_format); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_epa, 1); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":186 +/* "newanalysis/helpers/helpers.pyx":293 + * return energy * 1390.02 * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyMuA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double [:] mu_solute): + * """ */ /* Python wrapper */ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; +static PyObject *__pyx_pw_11newanalysis_7helpers_21calcEnergyMuA(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_20calcEnergyMuA, "\n energy = calcEnergyMuA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,mu_solute)\n\n Calculates the solvation energy of a solute in any solvent for a specific coordinate set.\n \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_21calcEnergyMuA = {"calcEnergyMuA", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_21calcEnergyMuA, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_20calcEnergyMuA}; +static PyObject *__pyx_pw_11newanalysis_7helpers_21calcEnergyMuA(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_isolute; + int __pyx_v_nmol; + __Pyx_memviewslice __pyx_v_mu_solute = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannySetupContext("calcEnergyMuA (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 293, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_mu_solute,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 1); __PYX_ERR(0, 293, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 2); __PYX_ERR(0, 293, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 3); __PYX_ERR(0, 293, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 4); __PYX_ERR(0, 293, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 5); __PYX_ERR(0, 293, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mu_solute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, 6); __PYX_ERR(0, 293, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcEnergyMuA") < 0)) __PYX_ERR(0, 293, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 7)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 294, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 294, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 294, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 294, __pyx_L3_error) + __pyx_v_isolute = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L3_error) + __pyx_v_nmol = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L3_error) + __pyx_v_mu_solute = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mu_solute.memview)) __PYX_ERR(0, 294, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcEnergyMuA", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 293, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mu_solute, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyMuA", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_20calcEnergyMuA(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_mu_solute); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mu_solute, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_bufmode; - int __pyx_r; +static PyObject *__pyx_pf_11newanalysis_7helpers_20calcEnergyMuA(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, __Pyx_memviewslice __pyx_v_mu_solute) { + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_idx2; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_r; + double __pyx_v_energy; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; + int __pyx_t_3; + int __pyx_t_4; Py_ssize_t __pyx_t_5; int __pyx_t_6; - Py_ssize_t *__pyx_t_7; + int __pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + double __pyx_t_12; + double __pyx_t_13; + PyObject *__pyx_t_14 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); + __Pyx_RefNannySetupContext("calcEnergyMuA", 0); - /* "View.MemoryView":187 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 # <<<<<<<<<<<<<< - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + /* "newanalysis/helpers/helpers.pyx":304 + * cdef double dx, dy, dz, r, energy + * + * energy = 0.0 # <<<<<<<<<<<<<< + * + * # loop over solvent molecules */ - __pyx_v_bufmode = -1; + __pyx_v_energy = 0.0; - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": + /* "newanalysis/helpers/helpers.pyx":307 + * + * # loop over solvent molecules + * for j in range(nmol): # <<<<<<<<<<<<<< + * if j == isolute: + * continue */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 188, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_1 = __pyx_v_nmol; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_j = __pyx_t_3; - /* "View.MemoryView":189 - * cdef int bufmode = -1 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + /* "newanalysis/helpers/helpers.pyx":308 + * # loop over solvent molecules + * for j in range(nmol): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ - __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + __pyx_t_4 = (__pyx_v_j == __pyx_v_isolute); + if (__pyx_t_4) { - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": + /* "newanalysis/helpers/helpers.pyx":309 + * for j in range(nmol): + * if j == isolute: + * continue # <<<<<<<<<<<<<< + * for k in range(apr[j]): + * idx2 = rfa[j] + k */ - goto __pyx_L3; - } + goto __pyx_L3_continue; - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): + /* "newanalysis/helpers/helpers.pyx":308 + * # loop over solvent molecules + * for j in range(nmol): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 190, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + } - /* "View.MemoryView":191 - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") + /* "newanalysis/helpers/helpers.pyx":310 + * if j == isolute: + * continue + * for k in range(apr[j]): # <<<<<<<<<<<<<< + * idx2 = rfa[j] + k + * dx = coor[idx2,0] */ - __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + __pyx_t_5 = __pyx_v_j; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_5 * __pyx_v_apr.strides[0]) ))); + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_k = __pyx_t_8; - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - */ - } - __pyx_L3:; - - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - */ - __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 193, __pyx_L1_error) - - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - */ - } - - /* "View.MemoryView":194 - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data # <<<<<<<<<<<<<< - * info.len = self.len - * info.ndim = self.ndim - */ - __pyx_t_4 = __pyx_v_self->data; - __pyx_v_info->buf = __pyx_t_4; - - /* "View.MemoryView":195 - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - * info.len = self.len # <<<<<<<<<<<<<< - * info.ndim = self.ndim - * info.shape = self._shape - */ - __pyx_t_5 = __pyx_v_self->len; - __pyx_v_info->len = __pyx_t_5; - - /* "View.MemoryView":196 - * info.buf = self.data - * info.len = self.len - * info.ndim = self.ndim # <<<<<<<<<<<<<< - * info.shape = self._shape - * info.strides = self._strides - */ - __pyx_t_6 = __pyx_v_self->ndim; - __pyx_v_info->ndim = __pyx_t_6; - - /* "View.MemoryView":197 - * info.len = self.len - * info.ndim = self.ndim - * info.shape = self._shape # <<<<<<<<<<<<<< - * info.strides = self._strides - * info.suboffsets = NULL - */ - __pyx_t_7 = __pyx_v_self->_shape; - __pyx_v_info->shape = __pyx_t_7; - - /* "View.MemoryView":198 - * info.ndim = self.ndim - * info.shape = self._shape - * info.strides = self._strides # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = self.itemsize - */ - __pyx_t_7 = __pyx_v_self->_strides; - __pyx_v_info->strides = __pyx_t_7; - - /* "View.MemoryView":199 - * info.shape = self._shape - * info.strides = self._strides - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = self.itemsize - * info.readonly = 0 + /* "newanalysis/helpers/helpers.pyx":311 + * continue + * for k in range(apr[j]): + * idx2 = rfa[j] + k # <<<<<<<<<<<<<< + * dx = coor[idx2,0] + * dy = coor[idx2,1] */ - __pyx_v_info->suboffsets = NULL; + __pyx_t_5 = __pyx_v_j; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_rfa.shape[0]; + __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_5 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); - /* "View.MemoryView":200 - * info.strides = self._strides - * info.suboffsets = NULL - * info.itemsize = self.itemsize # <<<<<<<<<<<<<< - * info.readonly = 0 - * + /* "newanalysis/helpers/helpers.pyx":312 + * for k in range(apr[j]): + * idx2 = rfa[j] + k + * dx = coor[idx2,0] # <<<<<<<<<<<<<< + * dy = coor[idx2,1] + * dz = coor[idx2,2] */ - __pyx_t_5 = __pyx_v_self->itemsize; - __pyx_v_info->itemsize = __pyx_t_5; + __pyx_t_5 = __pyx_v_idx2; + __pyx_t_9 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; + __pyx_v_dx = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_5 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))); - /* "View.MemoryView":201 - * info.suboffsets = NULL - * info.itemsize = self.itemsize - * info.readonly = 0 # <<<<<<<<<<<<<< - * - * if flags & PyBUF_FORMAT: + /* "newanalysis/helpers/helpers.pyx":313 + * idx2 = rfa[j] + k + * dx = coor[idx2,0] + * dy = coor[idx2,1] # <<<<<<<<<<<<<< + * dz = coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) */ - __pyx_v_info->readonly = 0; + __pyx_t_9 = __pyx_v_idx2; + __pyx_t_5 = 1; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor.shape[1]; + __pyx_v_dy = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_5 * __pyx_v_coor.strides[1]) ))); - /* "View.MemoryView":203 - * info.readonly = 0 + /* "newanalysis/helpers/helpers.pyx":314 + * dx = coor[idx2,0] + * dy = coor[idx2,1] + * dz = coor[idx2,2] # <<<<<<<<<<<<<< + * r = sqrt(dx*dx + dy*dy + dz*dz) * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format - * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + __pyx_t_5 = __pyx_v_idx2; + __pyx_t_9 = 2; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; + __pyx_v_dz = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_5 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))); - /* "View.MemoryView":204 + /* "newanalysis/helpers/helpers.pyx":315 + * dy = coor[idx2,1] + * dz = coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< * - * if flags & PyBUF_FORMAT: - * info.format = self.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL + * energy+=charges[idx2]*(mu_solute[0]*dx+mu_solute[1]*dy+mu_solute[2]*dz)/(r*r*r) */ - __pyx_t_4 = __pyx_v_self->format; - __pyx_v_info->format = __pyx_t_4; + __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* "View.MemoryView":203 - * info.readonly = 0 + /* "newanalysis/helpers/helpers.pyx":317 + * r = sqrt(dx*dx + dy*dy + dz*dz) * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format - * else: - */ - goto __pyx_L5; - } - - /* "View.MemoryView":206 - * info.format = self.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< + * energy+=charges[idx2]*(mu_solute[0]*dx+mu_solute[1]*dy+mu_solute[2]*dz)/(r*r*r) # <<<<<<<<<<<<<< * - * info.obj = self + * return energy * 1390.02 */ - /*else*/ { - __pyx_v_info->format = NULL; + __pyx_t_9 = __pyx_v_idx2; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_charges.shape[0]; + __pyx_t_5 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_mu_solute.shape[0]; + __pyx_t_10 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mu_solute.shape[0]; + __pyx_t_11 = 2; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_mu_solute.shape[0]; + __pyx_t_12 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_9 * __pyx_v_charges.strides[0]) ))) * ((((*((double *) ( /* dim=0 */ (__pyx_v_mu_solute.data + __pyx_t_5 * __pyx_v_mu_solute.strides[0]) ))) * __pyx_v_dx) + ((*((double *) ( /* dim=0 */ (__pyx_v_mu_solute.data + __pyx_t_10 * __pyx_v_mu_solute.strides[0]) ))) * __pyx_v_dy)) + ((*((double *) ( /* dim=0 */ (__pyx_v_mu_solute.data + __pyx_t_11 * __pyx_v_mu_solute.strides[0]) ))) * __pyx_v_dz))); + __pyx_t_13 = ((__pyx_v_r * __pyx_v_r) * __pyx_v_r); + if (unlikely(__pyx_t_13 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 317, __pyx_L1_error) + } + __pyx_v_energy = (__pyx_v_energy + (__pyx_t_12 / __pyx_t_13)); + } + __pyx_L3_continue:; } - __pyx_L5:; - /* "View.MemoryView":208 - * info.format = NULL + /* "newanalysis/helpers/helpers.pyx":319 + * energy+=charges[idx2]*(mu_solute[0]*dx+mu_solute[1]*dy+mu_solute[2]*dz)/(r*r*r) * - * info.obj = self # <<<<<<<<<<<<<< + * return energy * 1390.02 # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + * @cython.boundscheck(False) */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + __Pyx_XDECREF(__pyx_r); + __pyx_t_14 = PyFloat_FromDouble((__pyx_v_energy * 1390.02)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_r = __pyx_t_14; + __pyx_t_14 = 0; + goto __pyx_L0; - /* "View.MemoryView":186 + /* "newanalysis/helpers/helpers.pyx":293 + * return energy * 1390.02 * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyMuA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double [:] mu_solute): + * """ */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyMuA", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") +/* "newanalysis/helpers/helpers.pyx":321 + * return energy * 1390.02 * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAApermind(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude): + * """ */ /* Python wrapper */ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_11newanalysis_7helpers_23calcEnergyAApermind(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_22calcEnergyAApermind, "\n energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list)\n\n Calculates the permanent and induced part of the solvation energy of a solute in any solvent for a specific coordinate set.\n \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_23calcEnergyAApermind = {"calcEnergyAApermind", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_23calcEnergyAApermind, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_22calcEnergyAApermind}; +static PyObject *__pyx_pw_11newanalysis_7helpers_23calcEnergyAApermind(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coms = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_isolute; + int __pyx_v_first; + int __pyx_v_last; + __Pyx_memviewslice __pyx_v_drude = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("calcEnergyAApermind (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 321, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_coms,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_first,&__pyx_n_s_last,&__pyx_n_s_drude,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 1); __PYX_ERR(0, 321, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 2); __PYX_ERR(0, 321, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 3); __PYX_ERR(0, 321, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 4); __PYX_ERR(0, 321, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 5); __PYX_ERR(0, 321, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_first)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 6); __PYX_ERR(0, 321, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_last)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 7); __PYX_ERR(0, 321, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_drude)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, 8); __PYX_ERR(0, 321, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcEnergyAApermind") < 0)) __PYX_ERR(0, 321, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 9)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 322, __pyx_L3_error) + __pyx_v_coms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms.memview)) __PYX_ERR(0, 322, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 322, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 322, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 322, __pyx_L3_error) + __pyx_v_isolute = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L3_error) + __pyx_v_first = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_first == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L3_error) + __pyx_v_last = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_last == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L3_error) + __pyx_v_drude = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_drude.memview)) __PYX_ERR(0, 322, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermind", 1, 9, 9, __pyx_nargs); __PYX_ERR(0, 321, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_drude, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAApermind", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_22calcEnergyAApermind(__pyx_self, __pyx_v_coor, __pyx_v_coms, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_first, __pyx_v_last, __pyx_v_drude); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_drude, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { +static PyObject *__pyx_pf_11newanalysis_7helpers_22calcEnergyAApermind(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coms, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_first, int __pyx_v_last, __Pyx_memviewslice __pyx_v_drude) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_idx; + int __pyx_v_idx2; + __Pyx_memviewslice __pyx_v_epa_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_epa_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_r; + double __pyx_v_qq; + double __pyx_v_energy_perm; + double __pyx_v_energy_ind; + double __pyx_v_qq_diff; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__", 0); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + long __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + double __pyx_t_20; + int __pyx_t_21; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcEnergyAApermind", 0); - /* "View.MemoryView":213 - * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: + /* "newanalysis/helpers/helpers.pyx":330 + * """ + * cdef int i, j, k, idx, idx2, histo_error + * cdef double [:] epa_ind = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< + * cdef double [:] epa_perm = np.zeros(apr[isolute]) + * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, qq_diff */ - __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0); - if (__pyx_t_1) { + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_epa_ind = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":214 - * def __dealloc__(array self): - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) # <<<<<<<<<<<<<< - * elif self.free_data: - * if self.dtype_is_object: + /* "newanalysis/helpers/helpers.pyx":331 + * cdef int i, j, k, idx, idx2, histo_error + * cdef double [:] epa_ind = np.zeros(apr[isolute]) + * cdef double [:] epa_perm = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, qq_diff + * */ - __pyx_v_self->callback_free_data(__pyx_v_self->data); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_3 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_epa_perm = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":213 + /* "newanalysis/helpers/helpers.pyx":334 + * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, qq_diff + * + * energy_perm = 0.0 # <<<<<<<<<<<<<< + * energy_ind = 0.0 * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: */ - goto __pyx_L3; - } + __pyx_v_energy_perm = 0.0; - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, + /* "newanalysis/helpers/helpers.pyx":335 + * + * energy_perm = 0.0 + * energy_ind = 0.0 # <<<<<<<<<<<<<< + * + * # loop over solute atoms */ - __pyx_t_1 = (__pyx_v_self->free_data != 0); - if (__pyx_t_1) { + __pyx_v_energy_ind = 0.0; - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) + /* "newanalysis/helpers/helpers.pyx":339 + * # loop over solute atoms + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * idx = rfa[isolute] + i + * # loop over solvent molecules */ - __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_1) { + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_8 = __pyx_t_6; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "View.MemoryView":217 - * elif self.free_data: - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< - * self._strides, self.ndim, False) - * free(self.data) + /* "newanalysis/helpers/helpers.pyx":340 + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): + * idx = rfa[isolute] + i # <<<<<<<<<<<<<< + * # loop over solvent molecules + * for j in range(first,last+1): */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) + /* "newanalysis/helpers/helpers.pyx":342 + * idx = rfa[isolute] + i + * # loop over solvent molecules + * for j in range(first,last+1): # <<<<<<<<<<<<<< + * if j == isolute: + * continue */ - } + __pyx_t_10 = (__pyx_v_last + 1); + __pyx_t_11 = __pyx_t_10; + for (__pyx_t_12 = __pyx_v_first; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; - /* "View.MemoryView":219 - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) - * free(self.data) # <<<<<<<<<<<<<< - * PyObject_Free(self._shape) - * + /* "newanalysis/helpers/helpers.pyx":343 + * # loop over solvent molecules + * for j in range(first,last+1): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ - free(__pyx_v_self->data); + __pyx_t_13 = (__pyx_v_j == __pyx_v_isolute); + if (__pyx_t_13) { - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, + /* "newanalysis/helpers/helpers.pyx":344 + * for j in range(first,last+1): + * if j == isolute: + * continue # <<<<<<<<<<<<<< + * for k in range(apr[j]): + * idx2 = rfa[j] + k */ - } - __pyx_L3:; + goto __pyx_L5_continue; - /* "View.MemoryView":220 - * self._strides, self.ndim, False) - * free(self.data) - * PyObject_Free(self._shape) # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/helpers.pyx":343 + * # loop over solvent molecules + * for j in range(first,last+1): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ - PyObject_Free(__pyx_v_self->_shape); + } - /* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") - * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) + /* "newanalysis/helpers/helpers.pyx":345 + * if j == isolute: + * continue + * for k in range(apr[j]): # <<<<<<<<<<<<<< + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] */ + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_k = __pyx_t_16; - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":223 - * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() - * + /* "newanalysis/helpers/helpers.pyx":346 + * continue + * for k in range(apr[j]): + * idx2 = rfa[j] + k # <<<<<<<<<<<<<< + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] */ + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":224 - * @property - * def memview(self): - * return self.get_memview() # <<<<<<<<<<<<<< - * - * @cname('get_memview') + /* "newanalysis/helpers/helpers.pyx":347 + * for k in range(apr[j]): + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_4 = __pyx_v_idx; + __pyx_t_17 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[1]; + __pyx_t_18 = __pyx_v_idx2; + __pyx_t_19 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_17 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":223 - * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() - * + /* "newanalysis/helpers/helpers.pyx":348 + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) */ + __pyx_t_19 = __pyx_v_idx; + __pyx_t_18 = 1; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_17 = __pyx_v_idx2; + __pyx_t_4 = 1; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":349 + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< + * r = sqrt(dx*dx + dy*dy + dz*dz) + * qq = charges[idx] * charges[idx2] / r + */ + __pyx_t_4 = __pyx_v_idx; + __pyx_t_17 = 2; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[1]; + __pyx_t_18 = __pyx_v_idx2; + __pyx_t_19 = 2; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_17 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )))); -/* "View.MemoryView":227 + /* "newanalysis/helpers/helpers.pyx":350 + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< + * qq = charges[idx] * charges[idx2] / r * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) */ + __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_memview", 0); - - /* "View.MemoryView":228 - * @cname('get_memview') - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< - * return memoryview(self, flags, self.dtype_is_object) + /* "newanalysis/helpers/helpers.pyx":351 + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) + * qq = charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< * + * if drude[k]==1: */ - __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + __pyx_t_19 = __pyx_v_idx; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; + __pyx_t_18 = __pyx_v_idx2; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_charges.shape[0]; + __pyx_t_20 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_18 * __pyx_v_charges.strides[0]) )))); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 351, __pyx_L1_error) + } + __pyx_v_qq = (__pyx_t_20 / __pyx_v_r); - /* "View.MemoryView":229 - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":353 + * qq = charges[idx] * charges[idx2] / r * - * def __len__(self): + * if drude[k]==1: # <<<<<<<<<<<<<< + * epa_ind[i]+=qq + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_18 = __pyx_v_k; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_drude.shape[0]; + __pyx_t_13 = ((*((double *) ( /* dim=0 */ (__pyx_v_drude.data + __pyx_t_18 * __pyx_v_drude.strides[0]) ))) == 1.0); + if (__pyx_t_13) { - /* "View.MemoryView":227 + /* "newanalysis/helpers/helpers.pyx":354 * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) + * if drude[k]==1: + * epa_ind[i]+=qq # <<<<<<<<<<<<<< + * else: + * epa_perm[i]+=qq */ + __pyx_t_18 = __pyx_v_i; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_epa_ind.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_epa_ind.data + __pyx_t_18 * __pyx_v_epa_ind.strides[0]) )) += __pyx_v_qq; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] + /* "newanalysis/helpers/helpers.pyx":353 + * qq = charges[idx] * charges[idx2] / r * + * if drude[k]==1: # <<<<<<<<<<<<<< + * epa_ind[i]+=qq + * else: */ + goto __pyx_L10; + } -/* Python wrapper */ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":356 + * epa_ind[i]+=qq + * else: + * epa_perm[i]+=qq # <<<<<<<<<<<<<< + * if k_shape[0]); - goto __pyx_L0; + __pyx_t_18 = __pyx_v_idx; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_charges.shape[0]; + __pyx_t_19 = (__pyx_v_idx2 + 1); + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; + __pyx_t_20 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_18 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) )))); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 358, __pyx_L1_error) + } + __pyx_v_qq_diff = (__pyx_t_20 / __pyx_v_r); - /* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] + /* "newanalysis/helpers/helpers.pyx":359 + * if k 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcEnergyAAhisto") < 0)) __PYX_ERR(0, 368, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 12)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 369, __pyx_L3_error) + __pyx_v_coms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms.memview)) __PYX_ERR(0, 369, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 369, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 369, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 369, __pyx_L3_error) + __pyx_v_isolute = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error) + __pyx_v_nmol = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error) + __pyx_v_histo_min = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_histo_min == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error) + __pyx_v_histo_max = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_histo_max == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error) + __pyx_v_histo_bins = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_histo_bins == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error) + __pyx_v_trehalose = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[10], PyBUF_WRITABLE); if (unlikely(!__pyx_v_trehalose.memview)) __PYX_ERR(0, 369, __pyx_L3_error) + __pyx_v_oxyquinol = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[11], PyBUF_WRITABLE); if (unlikely(!__pyx_v_oxyquinol.memview)) __PYX_ERR(0, 369, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto", 1, 12, 12, __pyx_nargs); __PYX_ERR(0, 368, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_trehalose, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_oxyquinol, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAAhisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_24calcEnergyAAhisto(__pyx_self, __pyx_v_coor, __pyx_v_coms, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_bins, __pyx_v_trehalose, __pyx_v_oxyquinol); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_trehalose, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_oxyquinol, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { +static PyObject *__pyx_pf_11newanalysis_7helpers_24calcEnergyAAhisto(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_coms, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, double __pyx_v_histo_min, double __pyx_v_histo_max, int __pyx_v_histo_bins, __Pyx_memviewslice __pyx_v_trehalose, __Pyx_memviewslice __pyx_v_oxyquinol) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_idx; + int __pyx_v_idx2; + int __pyx_v_histo_error; + __Pyx_memviewslice __pyx_v_epa = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histo = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_count = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_store = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_r; + double __pyx_v_rtre; + double __pyx_v_tmp; + double __pyx_v_tmp_ener; + double __pyx_v_histo_width; + __Pyx_memviewslice __pyx_v_squared_r_tre = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_squared_r_oxy = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_energy; + double __pyx_v_roxy; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_t_8 = NULL; + __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; + Py_ssize_t __pyx_t_35; + Py_ssize_t __pyx_t_36; + int __pyx_t_37; + double __pyx_t_38; + PyObject *__pyx_t_39 = NULL; + PyObject *__pyx_t_40 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("calcEnergyAAhisto", 0); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/helpers.pyx":377 + * """ + * cdef int i, j, k, idx, idx2, histo_error + * cdef double [:] epa = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< + * cdef double [:,:] histo=np.zeros((histo_bins,histo_bins)) + * cdef double [:,:] count=np.zeros((histo_bins,histo_bins)) */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_v_epa = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/helpers/helpers.pyx":378 + * cdef int i, j, k, idx, idx2, histo_error + * cdef double [:] epa = np.zeros(apr[isolute]) + * cdef double [:,:] histo=np.zeros((histo_bins,histo_bins)) # <<<<<<<<<<<<<< + * cdef double [:,:] count=np.zeros((histo_bins,histo_bins)) + * cdef double [:] store=np.zeros(nmol) */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 378, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_histo = __pyx_t_9; + __pyx_t_9.memview = NULL; + __pyx_t_9.data = NULL; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/helpers.pyx":379 + * cdef double [:] epa = np.zeros(apr[isolute]) + * cdef double [:,:] histo=np.zeros((histo_bins,histo_bins)) + * cdef double [:,:] count=np.zeros((histo_bins,histo_bins)) # <<<<<<<<<<<<<< + * cdef double [:] store=np.zeros(nmol) + * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5)) __PYX_ERR(0, 379, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_count = __pyx_t_9; + __pyx_t_9.memview = NULL; + __pyx_t_9.data = NULL; -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":380 + * cdef double [:,:] histo=np.zeros((histo_bins,histo_bins)) + * cdef double [:,:] count=np.zeros((histo_bins,histo_bins)) + * cdef double [:] store=np.zeros(nmol) # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width + * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_nmol); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_v_store = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/helpers.pyx":382 + * cdef double [:] store=np.zeros(nmol) + * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width + * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) # <<<<<<<<<<<<<< + * cdef double [:] squared_r_oxy = np.zeros(oxyquinol.shape[0]) + * */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_trehalose.shape[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_squared_r_tre = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":245 + /* "newanalysis/helpers/helpers.pyx":383 + * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width + * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) + * cdef double [:] squared_r_oxy = np.zeros(oxyquinol.shape[0]) # <<<<<<<<<<<<<< * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + * energy = 0.0 */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyInt_FromSsize_t((__pyx_v_oxyquinol.shape[0])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_squared_r_oxy = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; -static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) { - struct __pyx_array_obj *__pyx_v_result = 0; - struct __pyx_array_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("array_cwrapper", 0); - - /* "View.MemoryView":249 - * cdef array result + /* "newanalysis/helpers/helpers.pyx":385 + * cdef double [:] squared_r_oxy = np.zeros(oxyquinol.shape[0]) * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: + * energy = 0.0 # <<<<<<<<<<<<<< + * histo_error=0 + * histo_width=(histo_max-histo_min)/histo_bins */ - __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); - if (__pyx_t_1) { + __pyx_v_energy = 0.0; - /* "View.MemoryView":250 + /* "newanalysis/helpers/helpers.pyx":386 + * + * energy = 0.0 + * histo_error=0 # <<<<<<<<<<<<<< + * histo_width=(histo_max-histo_min)/histo_bins * - * if buf == NULL: - * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<< - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_histo_error = 0; - /* "View.MemoryView":249 - * cdef array result + /* "newanalysis/helpers/helpers.pyx":387 + * energy = 0.0 + * histo_error=0 + * histo_width=(histo_max-histo_min)/histo_bins # <<<<<<<<<<<<<< * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: + * # loop over solute atoms */ - goto __pyx_L3; + __pyx_t_10 = (__pyx_v_histo_max - __pyx_v_histo_min); + if (unlikely(__pyx_v_histo_bins == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 387, __pyx_L1_error) } + __pyx_v_histo_width = (__pyx_t_10 / ((double)__pyx_v_histo_bins)); - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf + /* "newanalysis/helpers/helpers.pyx":391 + * # loop over solute atoms + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * idx = rfa[isolute] + i + * # loop over solvent molecules */ - /*else*/ { - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_3 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_11 = __pyx_t_6; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_i = __pyx_t_12; - /* "View.MemoryView":253 - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) # <<<<<<<<<<<<<< - * result.data = buf + /* "newanalysis/helpers/helpers.pyx":392 + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): + * idx = rfa[isolute] + i # <<<<<<<<<<<<<< + * # loop over solvent molecules * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 253, __pyx_L1_error) - - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf - */ - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); - /* "View.MemoryView":254 - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) - * result.data = buf # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":395 + * # loop over solvent molecules * - * return result + * for j in range(nmol): # <<<<<<<<<<<<<< + * if j == isolute: + * continue */ - __pyx_v_result->data = __pyx_v_buf; - } - __pyx_L3:; + __pyx_t_13 = __pyx_v_nmol; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; - /* "View.MemoryView":256 - * result.data = buf - * - * return result # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":396 * + * for j in range(nmol): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * tmp_ener=0.0 */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = __pyx_v_result; - goto __pyx_L0; + __pyx_t_16 = (__pyx_v_j == __pyx_v_isolute); + if (__pyx_t_16) { - /* "View.MemoryView":245 - * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + /* "newanalysis/helpers/helpers.pyx":397 + * for j in range(nmol): + * if j == isolute: + * continue # <<<<<<<<<<<<<< + * tmp_ener=0.0 + * for k in range(apr[j]): */ + goto __pyx_L5_continue; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): + /* "newanalysis/helpers/helpers.pyx":396 + * + * for j in range(nmol): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * tmp_ener=0.0 */ - -/* Python wrapper */ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 282, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_name = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 282, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); + /* "newanalysis/helpers/helpers.pyx":398 + * if j == isolute: + * continue + * tmp_ener=0.0 # <<<<<<<<<<<<<< + * for k in range(apr[j]): + * idx2 = rfa[j] + k + */ + __pyx_v_tmp_ener = 0.0; - /* "View.MemoryView":283 - * cdef object name - * def __init__(self, name): - * self.name = name # <<<<<<<<<<<<<< - * def __repr__(self): - * return self.name + /* "newanalysis/helpers/helpers.pyx":399 + * continue + * tmp_ener=0.0 + * for k in range(apr[j]): # <<<<<<<<<<<<<< + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] */ - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __Pyx_GOTREF(__pyx_v_self->name); - __Pyx_DECREF(__pyx_v_self->name); - __pyx_v_self->name = __pyx_v_name; + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_17 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_k = __pyx_t_19; - /* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): + /* "newanalysis/helpers/helpers.pyx":400 + * tmp_ener=0.0 + * for k in range(apr[j]): + * idx2 = rfa[j] + k # <<<<<<<<<<<<<< + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] */ + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":401 + * for k in range(apr[j]): + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] + */ + __pyx_t_4 = __pyx_v_idx; + __pyx_t_20 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_t_21 = __pyx_v_idx2; + __pyx_t_22 = 0; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor.shape[0]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_21 * __pyx_v_coor.strides[0]) ) + __pyx_t_22 * __pyx_v_coor.strides[1]) )))); -/* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * + /* "newanalysis/helpers/helpers.pyx":402 + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) */ + __pyx_t_22 = __pyx_v_idx; + __pyx_t_21 = 1; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor.shape[1]; + __pyx_t_20 = __pyx_v_idx2; + __pyx_t_4 = 1; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_22 * __pyx_v_coor.strides[0]) ) + __pyx_t_21 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); -/* Python wrapper */ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + /* "newanalysis/helpers/helpers.pyx":403 + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< + * r = sqrt(dx*dx + dy*dy + dz*dz) + * tmp=charges[idx] * charges[idx2] / r + */ + __pyx_t_4 = __pyx_v_idx; + __pyx_t_20 = 2; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_t_21 = __pyx_v_idx2; + __pyx_t_22 = 2; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor.shape[0]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_coor.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_21 * __pyx_v_coor.strides[0]) ) + __pyx_t_22 * __pyx_v_coor.strides[1]) )))); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":404 + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< + * tmp=charges[idx] * charges[idx2] / r + * tmp_ener+=tmp + */ + __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__", 0); + /* "newanalysis/helpers/helpers.pyx":405 + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) + * tmp=charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< + * tmp_ener+=tmp + * epa[i] += tmp + */ + __pyx_t_22 = __pyx_v_idx; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_charges.shape[0]; + __pyx_t_21 = __pyx_v_idx2; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_charges.shape[0]; + __pyx_t_10 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_22 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_21 * __pyx_v_charges.strides[0]) )))); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 405, __pyx_L1_error) + } + __pyx_v_tmp = (__pyx_t_10 / __pyx_v_r); - /* "View.MemoryView":285 - * self.name = name - * def __repr__(self): - * return self.name # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":406 + * r = sqrt(dx*dx + dy*dy + dz*dz) + * tmp=charges[idx] * charges[idx2] / r + * tmp_ener+=tmp # <<<<<<<<<<<<<< + * epa[i] += tmp * - * cdef generic = Enum("") */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->name); - __pyx_r = __pyx_v_self->name; - goto __pyx_L0; + __pyx_v_tmp_ener = (__pyx_v_tmp_ener + __pyx_v_tmp); - /* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name + /* "newanalysis/helpers/helpers.pyx":407 + * tmp=charges[idx] * charges[idx2] / r + * tmp_ener+=tmp + * epa[i] += tmp # <<<<<<<<<<<<<< * + * store[j]+=tmp_ener */ + __pyx_t_21 = __pyx_v_i; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_epa.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_21 * __pyx_v_epa.strides[0]) )) += __pyx_v_tmp; + } - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "newanalysis/helpers/helpers.pyx":409 + * epa[i] += tmp + * + * store[j]+=tmp_ener # <<<<<<<<<<<<<< + * + * */ + __pyx_t_21 = __pyx_v_j; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_store.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_store.data + __pyx_t_21 * __pyx_v_store.strides[0]) )) += __pyx_v_tmp_ener; + __pyx_L5_continue:; + } + } -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self.name,) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: + /* "newanalysis/helpers/helpers.pyx":412 + * + * + * for j in range(nmol): # <<<<<<<<<<<<<< + * if j==isolute: + * continue */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_self->name); - __Pyx_GIVEREF(__pyx_v_self->name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); - __pyx_v_state = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_6 = __pyx_v_nmol; + __pyx_t_11 = __pyx_t_6; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) + /* "newanalysis/helpers/helpers.pyx":413 + * + * for j in range(nmol): + * if j==isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(trehalose.shape[0]): */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v__dict = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_16 = (__pyx_v_j == __pyx_v_isolute); + if (__pyx_t_16) { - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* "newanalysis/helpers/helpers.pyx":414 + * for j in range(nmol): + * if j==isolute: + * continue # <<<<<<<<<<<<<< + * for k in range(trehalose.shape[0]): + * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 */ - __pyx_t_2 = (__pyx_v__dict != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + goto __pyx_L10_continue; - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: + /* "newanalysis/helpers/helpers.pyx":413 + * + * for j in range(nmol): + * if j==isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(trehalose.shape[0]): */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); - __pyx_t_4 = 0; + } - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self.name is not None + /* "newanalysis/helpers/helpers.pyx":415 + * if j==isolute: + * continue + * for k in range(trehalose.shape[0]): # <<<<<<<<<<<<<< + * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 + * if k>=1: */ - __pyx_v_use_setstate = 1; + __pyx_t_23 = (__pyx_v_trehalose.shape[0]); + __pyx_t_24 = __pyx_t_23; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_24; __pyx_t_13+=1) { + __pyx_v_k = __pyx_t_13; - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* "newanalysis/helpers/helpers.pyx":416 + * continue + * for k in range(trehalose.shape[0]): + * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 # <<<<<<<<<<<<<< + * if k>=1: + * if squared_r_tre[k]=1: # <<<<<<<<<<<<<< + * if squared_r_tre[k]name != Py_None); - __pyx_v_use_setstate = __pyx_t_3; - } - __pyx_L3:; + __pyx_t_16 = (__pyx_v_k >= 1); + if (__pyx_t_16) { - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: + /* "newanalysis/helpers/helpers.pyx":418 + * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 + * if k>=1: + * if squared_r_tre[k]=1: + * if squared_r_tre[k]=1: + * if squared_r_tre[k]=1: # <<<<<<<<<<<<<< + * if squared_r_tre[k]=1: */ + __pyx_t_23 = (__pyx_v_oxyquinol.shape[0]); + __pyx_t_24 = __pyx_t_23; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_24; __pyx_t_13+=1) { + __pyx_v_k = __pyx_t_13; -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + /* "newanalysis/helpers/helpers.pyx":423 + * rtre=sqrt(squared_r_tre[k]) + * for k in range(oxyquinol.shape[0]): + * squared_r_oxy[k]=(coor[oxyquinol[k],0]-coms[j,0])**2+(coor[oxyquinol[k],1]-coms[j,1])**2+(coor[oxyquinol[k],2]-coms[j,2])**2 # <<<<<<<<<<<<<< + * if k>=1: + * if squared_r_oxy[k]=1: # <<<<<<<<<<<<<< + * if squared_r_oxy[k]= 1); + if (__pyx_t_16) { -static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + /* "newanalysis/helpers/helpers.pyx":425 + * squared_r_oxy[k]=(coor[oxyquinol[k],0]-coms[j,0])**2+(coor[oxyquinol[k],1]-coms[j,1])**2+(coor[oxyquinol[k],2]-coms[j,2])**2 + * if k>=1: + * if squared_r_oxy[k]=1: + * if squared_r_oxy[k]tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_22 = __pyx_v_k; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_squared_r_oxy.shape[0]; + __pyx_v_roxy = sqrt((*((double *) ( /* dim=0 */ (__pyx_v_squared_r_oxy.data + __pyx_t_22 * __pyx_v_squared_r_oxy.strides[0]) )))); - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) + /* "newanalysis/helpers/helpers.pyx":425 + * squared_r_oxy[k]=(coor[oxyquinol[k],0]-coms[j,0])**2+(coor[oxyquinol[k],1]-coms[j,1])**2+(coor[oxyquinol[k],2]-coms[j,2])**2 + * if k>=1: + * if squared_r_oxy[k]=1: # <<<<<<<<<<<<<< + * if squared_r_oxy[k] memory + * if rtre < histo_min or roxy < histo_min: */ + /*else*/ { + __pyx_t_22 = __pyx_v_k; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_squared_r_oxy.shape[0]; + __pyx_v_roxy = sqrt((*((double *) ( /* dim=0 */ (__pyx_v_squared_r_oxy.data + __pyx_t_22 * __pyx_v_squared_r_oxy.strides[0]) )))); + } + __pyx_L19:; + } -static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) { - Py_intptr_t __pyx_v_aligned_p; - size_t __pyx_v_offset; - void *__pyx_r; - int __pyx_t_1; - - /* "View.MemoryView":301 - * cdef void *align_pointer(void *memory, size_t alignment) nogil: - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<< - * cdef size_t offset + /* "newanalysis/helpers/helpers.pyx":430 + * roxy=sqrt(squared_r_oxy[k]) * + * if rtre < histo_min or roxy < histo_min: # <<<<<<<<<<<<<< + * histo_error=1 + * elif rtre >= histo_max or roxy>=histo_max: */ - __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory); + __pyx_t_37 = (__pyx_v_rtre < __pyx_v_histo_min); + if (!__pyx_t_37) { + } else { + __pyx_t_16 = __pyx_t_37; + goto __pyx_L22_bool_binop_done; + } + __pyx_t_37 = (__pyx_v_roxy < __pyx_v_histo_min); + __pyx_t_16 = __pyx_t_37; + __pyx_L22_bool_binop_done:; + if (__pyx_t_16) { - /* "View.MemoryView":305 + /* "newanalysis/helpers/helpers.pyx":431 * - * with cython.cdivision(True): - * offset = aligned_p % alignment # <<<<<<<<<<<<<< + * if rtre < histo_min or roxy < histo_min: + * histo_error=1 # <<<<<<<<<<<<<< + * elif rtre >= histo_max or roxy>=histo_max: + * histo_error=2 + */ + __pyx_v_histo_error = 1; + + /* "newanalysis/helpers/helpers.pyx":430 + * roxy=sqrt(squared_r_oxy[k]) * - * if offset > 0: + * if rtre < histo_min or roxy < histo_min: # <<<<<<<<<<<<<< + * histo_error=1 + * elif rtre >= histo_max or roxy>=histo_max: + */ + goto __pyx_L21; + } + + /* "newanalysis/helpers/helpers.pyx":432 + * if rtre < histo_min or roxy < histo_min: + * histo_error=1 + * elif rtre >= histo_max or roxy>=histo_max: # <<<<<<<<<<<<<< + * histo_error=2 + * else: */ - __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment); + __pyx_t_37 = (__pyx_v_rtre >= __pyx_v_histo_max); + if (!__pyx_t_37) { + } else { + __pyx_t_16 = __pyx_t_37; + goto __pyx_L24_bool_binop_done; + } + __pyx_t_37 = (__pyx_v_roxy >= __pyx_v_histo_max); + __pyx_t_16 = __pyx_t_37; + __pyx_L24_bool_binop_done:; + if (__pyx_t_16) { - /* "View.MemoryView":307 - * offset = aligned_p % alignment + /* "newanalysis/helpers/helpers.pyx":433 + * histo_error=1 + * elif rtre >= histo_max or roxy>=histo_max: + * histo_error=2 # <<<<<<<<<<<<<< + * else: + * histo[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=store[j] + */ + __pyx_v_histo_error = 2; + + /* "newanalysis/helpers/helpers.pyx":432 + * if rtre < histo_min or roxy < histo_min: + * histo_error=1 + * elif rtre >= histo_max or roxy>=histo_max: # <<<<<<<<<<<<<< + * histo_error=2 + * else: + */ + goto __pyx_L21; + } + + /* "newanalysis/helpers/helpers.pyx":435 + * histo_error=2 + * else: + * histo[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=store[j] # <<<<<<<<<<<<<< + * count[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=1 * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset + */ + /*else*/ { + __pyx_t_22 = __pyx_v_j; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_store.shape[0]; + __pyx_t_10 = (__pyx_v_rtre - __pyx_v_histo_min); + if (unlikely(__pyx_v_histo_width == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 435, __pyx_L1_error) + } + __pyx_t_38 = (__pyx_v_roxy - __pyx_v_histo_min); + if (unlikely(__pyx_v_histo_width == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 435, __pyx_L1_error) + } + __pyx_t_20 = ((Py_ssize_t)(__pyx_t_10 / __pyx_v_histo_width)); + __pyx_t_25 = ((Py_ssize_t)(__pyx_t_38 / __pyx_v_histo_width)); + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_histo.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_histo.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histo.data + __pyx_t_20 * __pyx_v_histo.strides[0]) ) + __pyx_t_25 * __pyx_v_histo.strides[1]) )) += (*((double *) ( /* dim=0 */ (__pyx_v_store.data + __pyx_t_22 * __pyx_v_store.strides[0]) ))); + + /* "newanalysis/helpers/helpers.pyx":436 + * else: + * histo[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=store[j] + * count[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=1 # <<<<<<<<<<<<<< * + * for i in range(apr[isolute]): */ - __pyx_t_1 = ((__pyx_v_offset > 0) != 0); - if (__pyx_t_1) { + __pyx_t_38 = (__pyx_v_rtre - __pyx_v_histo_min); + if (unlikely(__pyx_v_histo_width == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 436, __pyx_L1_error) + } + __pyx_t_10 = (__pyx_v_roxy - __pyx_v_histo_min); + if (unlikely(__pyx_v_histo_width == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 436, __pyx_L1_error) + } + __pyx_t_22 = ((Py_ssize_t)(__pyx_t_38 / __pyx_v_histo_width)); + __pyx_t_25 = ((Py_ssize_t)(__pyx_t_10 / __pyx_v_histo_width)); + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_count.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_count.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_count.data + __pyx_t_22 * __pyx_v_count.strides[0]) ) + __pyx_t_25 * __pyx_v_count.strides[1]) )) += 1.0; + } + __pyx_L21:; + __pyx_L10_continue:; + } - /* "View.MemoryView":308 + /* "newanalysis/helpers/helpers.pyx":438 + * count[int((rtre-histo_min)/histo_width),int((roxy-histo_min)/histo_width)]+=1 * - * if offset > 0: - * aligned_p += alignment - offset # <<<<<<<<<<<<<< + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * energy += epa[i] * - * return aligned_p */ - __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset)); + __pyx_t_25 = __pyx_v_isolute; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_25 * __pyx_v_apr.strides[0]) ))); + __pyx_t_11 = __pyx_t_6; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_i = __pyx_t_12; - /* "View.MemoryView":307 - * offset = aligned_p % alignment + /* "newanalysis/helpers/helpers.pyx":439 * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset + * for i in range(apr[isolute]): + * energy += epa[i] # <<<<<<<<<<<<<< * + * return energy * 1390.02, np.asarray(histo)[:,:] * 1390.02 , histo_error, np.asarray(count)[:,:] */ + __pyx_t_25 = __pyx_v_i; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_epa.shape[0]; + __pyx_v_energy = (__pyx_v_energy + (*((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_25 * __pyx_v_epa.strides[0]) )))); } - /* "View.MemoryView":310 - * aligned_p += alignment - offset - * - * return aligned_p # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":441 + * energy += epa[i] * + * return energy * 1390.02, np.asarray(histo)[:,:] * 1390.02 , histo_error, np.asarray(count)[:,:] # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_r = ((void *)__pyx_v_aligned_p); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_energy * 1390.02)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_histo, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_8}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_tuple__12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_float_1390_02); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_histo_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_39 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_39)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_39); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_count, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_40 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_39))) { + __pyx_t_40 = PyMethod_GET_SELF(__pyx_t_39); + if (likely(__pyx_t_40)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_39); + __Pyx_INCREF(__pyx_t_40); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_39, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_40, __pyx_t_2}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_39, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_40); __pyx_t_40 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_39); __pyx_t_39 = 0; + } + __pyx_t_39 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_tuple__12); if (unlikely(!__pyx_t_39)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_39); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_39); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_39)) __PYX_ERR(0, 441, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_39 = 0; + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; goto __pyx_L0; - /* "View.MemoryView":299 + /* "newanalysis/helpers/helpers.pyx":368 + * return energy_perm * 1390.02 , energy_ind * 1390.02 * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAAhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose, int[:] oxyquinol): + * """ */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_XDECREF(__pyx_t_8); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1); + __Pyx_XDECREF(__pyx_t_39); + __Pyx_XDECREF(__pyx_t_40); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAAhisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_epa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histo, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_count, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_store, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_squared_r_tre, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_squared_r_oxy, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo +/* "newanalysis/helpers/helpers.pyx":443 + * return energy * 1390.02, np.asarray(histo)[:,:] * 1390.02 , histo_error, np.asarray(count)[:,:] * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAAhisto1(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose): + * """ */ /* Python wrapper */ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_obj = 0; - int __pyx_v_flags; - int __pyx_v_dtype_is_object; +static PyObject *__pyx_pw_11newanalysis_7helpers_27calcEnergyAAhisto1(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_26calcEnergyAAhisto1, "\n energy = calcEnergyAAhisto(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, min_histo, max_histo, bins_hist,array indices)\n\n Calculates the solvation energy of a solute in any solvent for a specific coordinate set.\n \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_27calcEnergyAAhisto1 = {"calcEnergyAAhisto1", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_27calcEnergyAAhisto1, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_26calcEnergyAAhisto1}; +static PyObject *__pyx_pw_11newanalysis_7helpers_27calcEnergyAAhisto1(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coms = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_isolute; + int __pyx_v_nmol; + double __pyx_v_histo_min; + double __pyx_v_histo_max; + int __pyx_v_histo_bins; + __Pyx_memviewslice __pyx_v_trehalose = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + __Pyx_RefNannySetupContext("calcEnergyAAhisto1 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 443, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_coms,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_histo_bins,&__pyx_n_s_trehalose,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + CYTHON_FALLTHROUGH; + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 346, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 1); __PYX_ERR(0, 443, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object); - if (value) { values[2] = value; kw_args--; } + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 2); __PYX_ERR(0, 443, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 3); __PYX_ERR(0, 443, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 4); __PYX_ERR(0, 443, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 5); __PYX_ERR(0, 443, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 6); __PYX_ERR(0, 443, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_min)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 7); __PYX_ERR(0, 443, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_max)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 8); __PYX_ERR(0, 443, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (likely((values[9] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_bins)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[9]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 9); __PYX_ERR(0, 443, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 10: + if (likely((values[10] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_trehalose)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[10]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, 10); __PYX_ERR(0, 443, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 346, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcEnergyAAhisto1") < 0)) __PYX_ERR(0, 443, __pyx_L3_error) } - } - __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) - if (values[2]) { - __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) + } else if (unlikely(__pyx_nargs != 11)) { + goto __pyx_L5_argtuple_error; } else { - __pyx_v_dtype_is_object = ((int)0); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 444, __pyx_L3_error) + __pyx_v_coms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms.memview)) __PYX_ERR(0, 444, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 444, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 444, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 444, __pyx_L3_error) + __pyx_v_isolute = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L3_error) + __pyx_v_nmol = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L3_error) + __pyx_v_histo_min = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_histo_min == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L3_error) + __pyx_v_histo_max = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_histo_max == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L3_error) + __pyx_v_histo_bins = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_histo_bins == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L3_error) + __pyx_v_trehalose = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[10], PyBUF_WRITABLE); if (unlikely(!__pyx_v_trehalose.memview)) __PYX_ERR(0, 444, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 346, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calcEnergyAAhisto1", 1, 11, 11, __pyx_nargs); __PYX_ERR(0, 443, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_trehalose, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAAhisto1", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return -1; + return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + __pyx_r = __pyx_pf_11newanalysis_7helpers_26calcEnergyAAhisto1(__pyx_self, __pyx_v_coor, __pyx_v_coms, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_bins, __pyx_v_trehalose); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_trehalose, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; +static PyObject *__pyx_pf_11newanalysis_7helpers_26calcEnergyAAhisto1(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_coms, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, double __pyx_v_histo_min, double __pyx_v_histo_max, int __pyx_v_histo_bins, __Pyx_memviewslice __pyx_v_trehalose) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_idx; + int __pyx_v_idx2; + int __pyx_v_histo_error; + __Pyx_memviewslice __pyx_v_epa = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histo = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_count = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_store = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_r; + double __pyx_v_rtre; + double __pyx_v_tmp; + double __pyx_v_tmp_ener; + double __pyx_v_histo_width; + __Pyx_memviewslice __pyx_v_squared_r_tre = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_energy; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; + PyObject *__pyx_t_35 = NULL; + PyObject *__pyx_t_36 = NULL; + PyObject *__pyx_t_37 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_RefNannySetupContext("calcEnergyAAhisto1", 0); - /* "View.MemoryView":347 - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj # <<<<<<<<<<<<<< - * self.flags = flags - * if type(self) is memoryview or obj is not None: + /* "newanalysis/helpers/helpers.pyx":452 + * """ + * cdef int i, j, k, idx, idx2, histo_error + * cdef double [:] epa = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< + * cdef double [:] histo=np.zeros((histo_bins)) + * cdef double [:] count=np.zeros((histo_bins)) */ - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - __Pyx_GOTREF(__pyx_v_self->obj); - __Pyx_DECREF(__pyx_v_self->obj); - __pyx_v_self->obj = __pyx_v_obj; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_epa = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":348 - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj - * self.flags = flags # <<<<<<<<<<<<<< - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) + /* "newanalysis/helpers/helpers.pyx":453 + * cdef int i, j, k, idx, idx2, histo_error + * cdef double [:] epa = np.zeros(apr[isolute]) + * cdef double [:] histo=np.zeros((histo_bins)) # <<<<<<<<<<<<<< + * cdef double [:] count=np.zeros((histo_bins)) + * cdef double [:] store=np.zeros(nmol) */ - __pyx_v_self->flags = __pyx_v_flags; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_histo = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: + /* "newanalysis/helpers/helpers.pyx":454 + * cdef double [:] epa = np.zeros(apr[isolute]) + * cdef double [:] histo=np.zeros((histo_bins)) + * cdef double [:] count=np.zeros((histo_bins)) # <<<<<<<<<<<<<< + * cdef double [:] store=np.zeros(nmol) + * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width */ - __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } } - __pyx_t_3 = (__pyx_v_obj != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_count = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":350 - * self.flags = flags - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None + /* "newanalysis/helpers/helpers.pyx":455 + * cdef double [:] histo=np.zeros((histo_bins)) + * cdef double [:] count=np.zeros((histo_bins)) + * cdef double [:] store=np.zeros(nmol) # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width + * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) */ - __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 350, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nmol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 455, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_store = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) + /* "newanalysis/helpers/helpers.pyx":457 + * cdef double [:] store=np.zeros(nmol) + * cdef double dx, dy, dz, r, rtre, tmp, tmp_ener, histo_width + * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) # <<<<<<<<<<<<<< + * + * energy = 0.0 */ - __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); - if (__pyx_t_1) { + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_trehalose.shape[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 457, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_squared_r_tre = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":352 - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "newanalysis/helpers/helpers.pyx":459 + * cdef double [:] squared_r_tre = np.zeros(trehalose.shape[0]) * + * energy = 0.0 # <<<<<<<<<<<<<< + * histo_error=0 + * histo_width=(histo_max-histo_min)/histo_bins */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + __pyx_v_energy = 0.0; - /* "View.MemoryView":353 - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":460 + * + * energy = 0.0 + * histo_error=0 # <<<<<<<<<<<<<< + * histo_width=(histo_max-histo_min)/histo_bins * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): */ - Py_INCREF(Py_None); + __pyx_v_histo_error = 0; - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) + /* "newanalysis/helpers/helpers.pyx":461 + * energy = 0.0 + * histo_error=0 + * histo_width=(histo_max-histo_min)/histo_bins # <<<<<<<<<<<<<< + * + * # loop over solute atoms */ - } + __pyx_t_8 = (__pyx_v_histo_max - __pyx_v_histo_min); + if (unlikely(__pyx_v_histo_bins == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 461, __pyx_L1_error) + } + __pyx_v_histo_width = (__pyx_t_8 / ((double)__pyx_v_histo_bins)); - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: + /* "newanalysis/helpers/helpers.pyx":465 + * # loop over solute atoms + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * idx = rfa[isolute] + i + * # loop over solvent molecules */ - } + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_9 = __pyx_t_6; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; - /* "View.MemoryView":355 - * Py_INCREF(Py_None) + /* "newanalysis/helpers/helpers.pyx":466 + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): + * idx = rfa[isolute] + i # <<<<<<<<<<<<<< + * # loop over solvent molecules * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: */ - __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0); - if (__pyx_t_1) { + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 + /* "newanalysis/helpers/helpers.pyx":469 + * # loop over solvent molecules + * + * for j in range(nmol): # <<<<<<<<<<<<<< + * if j == isolute: + * continue */ - __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0); - if (__pyx_t_1) { + __pyx_t_11 = __pyx_v_nmol; + __pyx_t_12 = __pyx_t_11; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_j = __pyx_t_13; - /* "View.MemoryView":358 - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: + /* "newanalysis/helpers/helpers.pyx":470 + * + * for j in range(nmol): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * tmp_ener=0.0 */ - __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_14 = (__pyx_v_j == __pyx_v_isolute); + if (__pyx_t_14) { - /* "View.MemoryView":359 - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() + /* "newanalysis/helpers/helpers.pyx":471 + * for j in range(nmol): + * if j == isolute: + * continue # <<<<<<<<<<<<<< + * tmp_ener=0.0 + * for k in range(apr[j]): */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + goto __pyx_L5_continue; - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 + /* "newanalysis/helpers/helpers.pyx":470 + * + * for j in range(nmol): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * tmp_ener=0.0 */ - } + } - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: + /* "newanalysis/helpers/helpers.pyx":472 + * if j == isolute: + * continue + * tmp_ener=0.0 # <<<<<<<<<<<<<< + * for k in range(apr[j]): + * idx2 = rfa[j] + k */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (__pyx_t_1) { + __pyx_v_tmp_ener = 0.0; - /* "View.MemoryView":361 - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< - * if self.lock is NULL: - * raise MemoryError + /* "newanalysis/helpers/helpers.pyx":473 + * continue + * tmp_ener=0.0 + * for k in range(apr[j]): # <<<<<<<<<<<<<< + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] */ - __pyx_v_self->lock = PyThread_allocate_lock(); + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_k = __pyx_t_17; - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * + /* "newanalysis/helpers/helpers.pyx":474 + * tmp_ener=0.0 + * for k in range(apr[j]): + * idx2 = rfa[j] + k # <<<<<<<<<<<<<< + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); - /* "View.MemoryView":363 - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * - * if flags & PyBUF_FORMAT: + /* "newanalysis/helpers/helpers.pyx":475 + * for k in range(apr[j]): + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] */ - PyErr_NoMemory(); __PYX_ERR(2, 363, __pyx_L1_error) + __pyx_t_4 = __pyx_v_idx; + __pyx_t_18 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_19 = __pyx_v_idx2; + __pyx_t_20 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * + /* "newanalysis/helpers/helpers.pyx":476 + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) */ - } + __pyx_t_20 = __pyx_v_idx; + __pyx_t_19 = 1; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + __pyx_t_18 = __pyx_v_idx2; + __pyx_t_4 = 1; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: + /* "newanalysis/helpers/helpers.pyx":477 + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< + * r = sqrt(dx*dx + dy*dy + dz*dz) + * tmp=charges[idx] * charges[idx2] / r */ - } + __pyx_t_4 = __pyx_v_idx; + __pyx_t_18 = 2; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_19 = __pyx_v_idx2; + __pyx_t_20 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":355 - * Py_INCREF(Py_None) - * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: + /* "newanalysis/helpers/helpers.pyx":478 + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< + * tmp=charges[idx] * charges[idx2] / r + * tmp_ener+=tmp */ - } + __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* "View.MemoryView":365 - * raise MemoryError - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: + /* "newanalysis/helpers/helpers.pyx":479 + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) + * tmp=charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< + * tmp_ener+=tmp + * epa[i] += tmp */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + __pyx_t_20 = __pyx_v_idx; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges.shape[0]; + __pyx_t_19 = __pyx_v_idx2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; + __pyx_t_8 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_20 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) )))); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 479, __pyx_L1_error) + } + __pyx_v_tmp = (__pyx_t_8 / __pyx_v_r); - /* "View.MemoryView":366 - * - * if flags & PyBUF_FORMAT: - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< - * else: - * self.dtype_is_object = dtype_is_object - */ - __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L12_bool_binop_done; - } - __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L12_bool_binop_done:; - __pyx_v_self->dtype_is_object = __pyx_t_1; - - /* "View.MemoryView":365 - * raise MemoryError - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - */ - goto __pyx_L11; - } - - /* "View.MemoryView":368 - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< - * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( - */ - /*else*/ { - __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; - } - __pyx_L11:; - - /* "View.MemoryView":370 - * self.dtype_is_object = dtype_is_object - * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<< - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL - */ - __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int)))); - - /* "View.MemoryView":372 - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL # <<<<<<<<<<<<<< - * - * def __dealloc__(memoryview self): - */ - __pyx_v_self->typeinfo = NULL; - - /* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo + /* "newanalysis/helpers/helpers.pyx":480 + * r = sqrt(dx*dx + dy*dy + dz*dz) + * tmp=charges[idx] * charges[idx2] / r + * tmp_ener+=tmp # <<<<<<<<<<<<<< + * epa[i] += tmp * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags */ + __pyx_v_tmp_ener = (__pyx_v_tmp_ener + __pyx_v_tmp); - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":374 - * self.typeinfo = NULL + /* "newanalysis/helpers/helpers.pyx":481 + * tmp=charges[idx] * charges[idx2] / r + * tmp_ener+=tmp + * epa[i] += tmp # <<<<<<<<<<<<<< * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) + * store[j]+=tmp_ener */ + __pyx_t_19 = __pyx_v_i; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_19 * __pyx_v_epa.strides[0]) )) += __pyx_v_tmp; + } -/* Python wrapper */ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { - int __pyx_v_i; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyThread_type_lock __pyx_t_6; - PyThread_type_lock __pyx_t_7; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":375 + /* "newanalysis/helpers/helpers.pyx":483 + * epa[i] += tmp * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - */ - __pyx_t_1 = (__pyx_v_self->obj != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":376 - * def __dealloc__(memoryview self): - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< - * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * store[j]+=tmp_ener # <<<<<<<<<<<<<< * - */ - __Pyx_ReleaseBuffer((&__pyx_v_self->view)); - - /* "View.MemoryView":375 * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - goto __pyx_L3; + __pyx_t_19 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_store.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_store.data + __pyx_t_19 * __pyx_v_store.strides[0]) )) += __pyx_v_tmp_ener; + __pyx_L5_continue:; + } } - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< - * - * (<__pyx_buffer *> &self.view).obj = NULL - */ - __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":379 - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - * - * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< - * Py_DECREF(Py_None) - * - */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; - - /* "View.MemoryView":380 + /* "newanalysis/helpers/helpers.pyx":486 * - * (<__pyx_buffer *> &self.view).obj = NULL - * Py_DECREF(Py_None) # <<<<<<<<<<<<<< * - * cdef int i + * for j in range(nmol): # <<<<<<<<<<<<<< + * if j==isolute: + * continue */ - Py_DECREF(Py_None); + __pyx_t_6 = __pyx_v_nmol; + __pyx_t_9 = __pyx_t_6; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_j = __pyx_t_10; - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":487 * - * (<__pyx_buffer *> &self.view).obj = NULL + * for j in range(nmol): + * if j==isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(trehalose.shape[0]): */ - } - __pyx_L3:; + __pyx_t_14 = (__pyx_v_j == __pyx_v_isolute); + if (__pyx_t_14) { - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: + /* "newanalysis/helpers/helpers.pyx":488 + * for j in range(nmol): + * if j==isolute: + * continue # <<<<<<<<<<<<<< + * for k in range(trehalose.shape[0]): + * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 */ - __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0); - if (__pyx_t_2) { + goto __pyx_L10_continue; - /* "View.MemoryView":385 - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 + /* "newanalysis/helpers/helpers.pyx":487 + * + * for j in range(nmol): + * if j==isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(trehalose.shape[0]): */ - __pyx_t_3 = __pyx_memoryview_thread_locks_used; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; + } - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: + /* "newanalysis/helpers/helpers.pyx":489 + * if j==isolute: + * continue + * for k in range(trehalose.shape[0]): # <<<<<<<<<<<<<< + * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 + * if k>=1: */ - __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0); - if (__pyx_t_2) { + __pyx_t_21 = (__pyx_v_trehalose.shape[0]); + __pyx_t_22 = __pyx_t_21; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_22; __pyx_t_11+=1) { + __pyx_v_k = __pyx_t_11; - /* "View.MemoryView":387 - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + /* "newanalysis/helpers/helpers.pyx":490 + * continue + * for k in range(trehalose.shape[0]): + * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 # <<<<<<<<<<<<<< + * if k>=1: + * if squared_r_tre[k]=1: # <<<<<<<<<<<<<< + * if squared_r_tre[k]= 1); + if (__pyx_t_14) { - /* "View.MemoryView":390 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< - * break + /* "newanalysis/helpers/helpers.pyx":492 + * squared_r_tre[k]=(coor[trehalose[k],0]-coms[j,0])**2+(coor[trehalose[k],1]-coms[j,1])**2+(coor[trehalose[k],2]-coms[j,2])**2 + * if k>=1: + * if squared_r_tre[k]=1: + * if squared_r_tre[k]=1: + * if squared_r_tre[k]=1: # <<<<<<<<<<<<<< + * if squared_r_tre[k]= histo_max: */ - PyThread_free_lock(__pyx_v_self->lock); - } - __pyx_L6_break:; + __pyx_t_14 = (__pyx_v_rtre < __pyx_v_histo_min); + if (__pyx_t_14) { - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: + /* "newanalysis/helpers/helpers.pyx":498 + * + * if rtre < histo_min: + * histo_error=1 # <<<<<<<<<<<<<< + * elif rtre >= histo_max: + * histo_error=2 */ - } + __pyx_v_histo_error = 1; - /* "View.MemoryView":374 - * self.typeinfo = NULL + /* "newanalysis/helpers/helpers.pyx":497 + * rtre=sqrt(squared_r_tre[k]) * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) + * if rtre < histo_min: # <<<<<<<<<<<<<< + * histo_error=1 + * elif rtre >= histo_max: */ + goto __pyx_L17; + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} + /* "newanalysis/helpers/helpers.pyx":499 + * if rtre < histo_min: + * histo_error=1 + * elif rtre >= histo_max: # <<<<<<<<<<<<<< + * histo_error=2 + * else: + */ + __pyx_t_14 = (__pyx_v_rtre >= __pyx_v_histo_max); + if (__pyx_t_14) { -/* "View.MemoryView":395 - * PyThread_free_lock(self.lock) - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf + /* "newanalysis/helpers/helpers.pyx":500 + * histo_error=1 + * elif rtre >= histo_max: + * histo_error=2 # <<<<<<<<<<<<<< + * else: + * histo[int((rtre-histo_min)/histo_width)]+=store[j] */ + __pyx_v_histo_error = 2; -static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - Py_ssize_t __pyx_v_dim; - char *__pyx_v_itemp; - PyObject *__pyx_v_idx = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - char *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_item_pointer", 0); + /* "newanalysis/helpers/helpers.pyx":499 + * if rtre < histo_min: + * histo_error=1 + * elif rtre >= histo_max: # <<<<<<<<<<<<<< + * histo_error=2 + * else: + */ + goto __pyx_L17; + } - /* "View.MemoryView":397 - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":502 + * histo_error=2 + * else: + * histo[int((rtre-histo_min)/histo_width)]+=store[j] # <<<<<<<<<<<<<< + * count[int((rtre-histo_min)/histo_width)]+=1 * - * for dim, idx in enumerate(index): */ - __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + /*else*/ { + __pyx_t_33 = __pyx_v_j; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_store.shape[0]; + __pyx_t_8 = (__pyx_v_rtre - __pyx_v_histo_min); + if (unlikely(__pyx_v_histo_width == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 502, __pyx_L1_error) + } + __pyx_t_32 = ((Py_ssize_t)(__pyx_t_8 / __pyx_v_histo_width)); + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_histo.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_histo.data + __pyx_t_32 * __pyx_v_histo.strides[0]) )) += (*((double *) ( /* dim=0 */ (__pyx_v_store.data + __pyx_t_33 * __pyx_v_store.strides[0]) ))); - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) + /* "newanalysis/helpers/helpers.pyx":503 + * else: + * histo[int((rtre-histo_min)/histo_width)]+=store[j] + * count[int((rtre-histo_min)/histo_width)]+=1 # <<<<<<<<<<<<<< * + * for i in range(apr[isolute]): */ - __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { - __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 399, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 399, __pyx_L1_error) - } - break; + __pyx_t_8 = (__pyx_v_rtre - __pyx_v_histo_min); + if (unlikely(__pyx_v_histo_width == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 503, __pyx_L1_error) } - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_33 = ((Py_ssize_t)(__pyx_t_8 / __pyx_v_histo_width)); + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_count.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_count.data + __pyx_t_33 * __pyx_v_count.strides[0]) )) += 1.0; } - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_1; - __pyx_t_1 = (__pyx_t_1 + 1); + __pyx_L17:; + __pyx_L10_continue:; + } - /* "View.MemoryView":400 + /* "newanalysis/helpers/helpers.pyx":505 + * count[int((rtre-histo_min)/histo_width)]+=1 * - * for dim, idx in enumerate(index): - * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * energy += epa[i] * - * return itemp */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_7; + __pyx_t_33 = __pyx_v_isolute; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_33 * __pyx_v_apr.strides[0]) ))); + __pyx_t_9 = __pyx_t_6; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf + /* "newanalysis/helpers/helpers.pyx":506 * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * for i in range(apr[isolute]): + * energy += epa[i] # <<<<<<<<<<<<<< * + * return energy * 1390.02, np.asarray(histo)[:] * 1390.02 , histo_error, np.asarray(count)[:] */ + __pyx_t_33 = __pyx_v_i; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_epa.shape[0]; + __pyx_v_energy = (__pyx_v_energy + (*((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_33 * __pyx_v_epa.strides[0]) )))); } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":402 - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - * return itemp # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":508 + * energy += epa[i] * + * return energy * 1390.02, np.asarray(histo)[:] * 1390.02 , histo_error, np.asarray(count)[:] # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_r = __pyx_v_itemp; - goto __pyx_L0; - - /* "View.MemoryView":395 - * PyThread_free_lock(self.lock) - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_energy * 1390.02)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_histo, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_35 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_35 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_35)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_35); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_35, __pyx_t_2}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_35); __pyx_t_35 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_float_1390_02); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_histo_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_35, __pyx_n_s_np); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_35); + __pyx_t_36 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_asarray); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_36); + __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0; + __pyx_t_35 = __pyx_memoryview_fromslice(__pyx_v_count, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_35); + __pyx_t_37 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_36))) { + __pyx_t_37 = PyMethod_GET_SELF(__pyx_t_36); + if (likely(__pyx_t_37)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_36); + __Pyx_INCREF(__pyx_t_37); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_36, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_37, __pyx_t_35}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_36, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_37); __pyx_t_37 = 0; + __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0; + } + __pyx_t_36 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1); if (unlikely(!__pyx_t_36)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_36); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_36); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_36)) __PYX_ERR(0, 508, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_36 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "newanalysis/helpers/helpers.pyx":443 + * return energy * 1390.02, np.asarray(histo)[:,:] * 1390.02 , histo_error, np.asarray(count)[:,:] + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAAhisto1(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose): + * """ */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_XDECREF(__pyx_t_35); + __Pyx_XDECREF(__pyx_t_36); + __Pyx_XDECREF(__pyx_t_37); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAAhisto1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_epa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histo, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_count, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_store, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_squared_r_tre, 1); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":405 - * +/* "newanalysis/helpers/helpers.pyx":510 + * return energy * 1390.02, np.asarray(histo)[:] * 1390.02 , histo_error, np.asarray(count)[:] * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAApermindhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude,double histo_min, double histo_max, int histo_bins,): + * """ */ /* Python wrapper */ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { +static PyObject *__pyx_pw_11newanalysis_7helpers_29calcEnergyAApermindhisto(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_28calcEnergyAApermindhisto, "\n energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list, min_histo, max_histo, bins_histo)\n\n Calculates the permanent and induced part of the solvation energy of a solute in any solvent for a specific coordinate set.\n \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_29calcEnergyAApermindhisto = {"calcEnergyAApermindhisto", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_29calcEnergyAApermindhisto, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_28calcEnergyAApermindhisto}; +static PyObject *__pyx_pw_11newanalysis_7helpers_29calcEnergyAApermindhisto(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coms = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_isolute; + int __pyx_v_first; + int __pyx_v_last; + __Pyx_memviewslice __pyx_v_drude = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_histo_min; + double __pyx_v_histo_max; + int __pyx_v_histo_bins; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + __Pyx_RefNannySetupContext("calcEnergyAApermindhisto (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 510, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_coms,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_first,&__pyx_n_s_last,&__pyx_n_s_drude,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_histo_bins,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + CYTHON_FALLTHROUGH; + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 1); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 2); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 3); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 4); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 5); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_first)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 6); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_last)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 7); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_drude)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 8); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (likely((values[9] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_min)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[9]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 9); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 10: + if (likely((values[10] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_max)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[10]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 10); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 11: + if (likely((values[11] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_bins)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[11]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, 11); __PYX_ERR(0, 510, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcEnergyAApermindhisto") < 0)) __PYX_ERR(0, 510, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 12)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_coms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms.memview)) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_isolute = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_first = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_first == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_last = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_last == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_drude = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_drude.memview)) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_histo_min = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_histo_min == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_histo_max = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_histo_max == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_histo_bins = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_histo_bins == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcEnergyAApermindhisto", 1, 12, 12, __pyx_nargs); __PYX_ERR(0, 510, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_drude, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAApermindhisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_28calcEnergyAApermindhisto(__pyx_self, __pyx_v_coor, __pyx_v_coms, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_first, __pyx_v_last, __pyx_v_drude, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_histo_bins); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_drude, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_indices = NULL; - char *__pyx_v_itemp; +static PyObject *__pyx_pf_11newanalysis_7helpers_28calcEnergyAApermindhisto(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_coms, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_first, int __pyx_v_last, __Pyx_memviewslice __pyx_v_drude, double __pyx_v_histo_min, double __pyx_v_histo_max, int __pyx_v_histo_bins) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_idx; + int __pyx_v_idx2; + int __pyx_v_histo_error; + __Pyx_memviewslice __pyx_v_epa_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_epa_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histo_perm = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histo_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_r; + double __pyx_v_qq; + double __pyx_v_energy_perm; + double __pyx_v_energy_ind; + double __pyx_v_histo_width; + double __pyx_v_tmp_perm; + double __pyx_v_tmp_ind; + double __pyx_v_qq_diff; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_4; PyObject *__pyx_t_5 = NULL; - char *__pyx_t_6; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + long __pyx_t_11; + long __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + int __pyx_t_21; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + PyObject *__pyx_t_30 = NULL; + PyObject *__pyx_t_31 = NULL; + PyObject *__pyx_t_32 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "View.MemoryView":406 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __Pyx_RefNannySetupContext("calcEnergyAApermindhisto", 0); - /* "View.MemoryView":407 - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: - * return self # <<<<<<<<<<<<<< - * - * have_slices, indices = _unellipsify(index, self.view.ndim) + /* "newanalysis/helpers/helpers.pyx":519 + * """ + * cdef int i, j, k, idx, idx2, histo_error + * cdef double [:] epa_ind = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< + * cdef double [:] epa_perm = np.zeros(apr[isolute]) + * cdef double [:] histo_perm=np.zeros(histo_bins), histo_ind=np.zeros(histo_bins) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_epa_ind = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":406 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * + /* "newanalysis/helpers/helpers.pyx":520 + * cdef int i, j, k, idx, idx2, histo_error + * cdef double [:] epa_ind = np.zeros(apr[isolute]) + * cdef double [:] epa_perm = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< + * cdef double [:] histo_perm=np.zeros(histo_bins), histo_ind=np.zeros(histo_bins) + * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, histo_width, tmp_perm, tmp_ind, qq_diff */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_3 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_epa_perm = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":409 - * return self - * - * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":521 + * cdef double [:] epa_ind = np.zeros(apr[isolute]) + * cdef double [:] epa_perm = np.zeros(apr[isolute]) + * cdef double [:] histo_perm=np.zeros(histo_bins), histo_ind=np.zeros(histo_bins) # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, histo_width, tmp_perm, tmp_ind, qq_diff * - * cdef char *itemp */ - __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (likely(__pyx_t_3 != Py_None)) { - PyObject* sequence = __pyx_t_3; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 409, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 409, __pyx_L1_error) } - __pyx_v_have_slices = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_v_indices = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_histo_perm = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_histo_bins); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 521, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_histo_ind = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":412 + /* "newanalysis/helpers/helpers.pyx":524 + * cdef double dx, dy, dz, r, qq, energy_perm, energy_ind, histo_width, tmp_perm, tmp_ind, qq_diff * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: - */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 412, __pyx_L1_error) - if (__pyx_t_2) { - - /* "View.MemoryView":413 - * cdef char *itemp - * if have_slices: - * return memview_slice(self, indices) # <<<<<<<<<<<<<< - * else: - * itemp = self.get_item_pointer(indices) + * energy_perm = 0.0 # <<<<<<<<<<<<<< + * energy_ind = 0.0 + * histo_error=0 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_v_energy_perm = 0.0; - /* "View.MemoryView":412 + /* "newanalysis/helpers/helpers.pyx":525 * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: + * energy_perm = 0.0 + * energy_ind = 0.0 # <<<<<<<<<<<<<< + * histo_error=0 + * histo_width=(histo_max-histo_min)/histo_bins */ - } + __pyx_v_energy_ind = 0.0; - /* "View.MemoryView":415 - * return memview_slice(self, indices) - * else: - * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< - * return self.convert_item_to_object(itemp) + /* "newanalysis/helpers/helpers.pyx":526 + * energy_perm = 0.0 + * energy_ind = 0.0 + * histo_error=0 # <<<<<<<<<<<<<< + * histo_width=(histo_max-histo_min)/histo_bins * */ - /*else*/ { - __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 415, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_6; + __pyx_v_histo_error = 0; - /* "View.MemoryView":416 - * else: - * itemp = self.get_item_pointer(indices) - * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":527 + * energy_ind = 0.0 + * histo_error=0 + * histo_width=(histo_max-histo_min)/histo_bins # <<<<<<<<<<<<<< * - * def __setitem__(memoryview self, object index, object value): + * # loop over solute atoms */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_8 = (__pyx_v_histo_max - __pyx_v_histo_min); + if (unlikely(__pyx_v_histo_bins == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 527, __pyx_L1_error) } + __pyx_v_histo_width = (__pyx_t_8 / ((double)__pyx_v_histo_bins)); - /* "View.MemoryView":405 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self + /* "newanalysis/helpers/helpers.pyx":531 + * # loop over solute atoms + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * idx = rfa[isolute] + i + * # loop over solvent molecules */ + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_9 = __pyx_t_6; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_indices); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) - * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + /* "newanalysis/helpers/helpers.pyx":532 + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): + * idx = rfa[isolute] + i # <<<<<<<<<<<<<< + * # loop over solvent molecules + * for j in range(first,last+1): */ + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); -/* Python wrapper */ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_obj = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - __Pyx_INCREF(__pyx_v_index); + /* "newanalysis/helpers/helpers.pyx":534 + * idx = rfa[isolute] + i + * # loop over solvent molecules + * for j in range(first,last+1): # <<<<<<<<<<<<<< + * if j == isolute: + * continue + */ + __pyx_t_11 = (__pyx_v_last + 1); + __pyx_t_12 = __pyx_t_11; + for (__pyx_t_13 = __pyx_v_first; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_j = __pyx_t_13; - /* "View.MemoryView":419 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") - * + /* "newanalysis/helpers/helpers.pyx":535 + * # loop over solvent molecules + * for j in range(first,last+1): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * tmp_perm=0.0 */ - __pyx_t_1 = (__pyx_v_self->view.readonly != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_14 = (__pyx_v_j == __pyx_v_isolute); + if (__pyx_t_14) { - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< - * - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "newanalysis/helpers/helpers.pyx":536 + * for j in range(first,last+1): + * if j == isolute: + * continue # <<<<<<<<<<<<<< + * tmp_perm=0.0 + * tmp_ind=0.0 */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 420, __pyx_L1_error) + goto __pyx_L5_continue; - /* "View.MemoryView":419 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") - * + /* "newanalysis/helpers/helpers.pyx":535 + * # loop over solvent molecules + * for j in range(first,last+1): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * tmp_perm=0.0 */ - } + } - /* "View.MemoryView":422 - * raise TypeError("Cannot assign to read-only memoryview") - * - * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< - * - * if have_slices: + /* "newanalysis/helpers/helpers.pyx":537 + * if j == isolute: + * continue + * tmp_perm=0.0 # <<<<<<<<<<<<<< + * tmp_ind=0.0 + * for k in range(apr[j]): */ - __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(__pyx_t_2 != Py_None)) { - PyObject* sequence = __pyx_t_2; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 422, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 422, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_tmp_perm = 0.0; - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) - * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: + /* "newanalysis/helpers/helpers.pyx":538 + * continue + * tmp_perm=0.0 + * tmp_ind=0.0 # <<<<<<<<<<<<<< + * for k in range(apr[j]): + * idx2 = rfa[j] + k */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_v_tmp_ind = 0.0; - /* "View.MemoryView":425 - * - * if have_slices: - * obj = self.is_slice(value) # <<<<<<<<<<<<<< - * if obj: - * self.setitem_slice_assignment(self[index], obj) + /* "newanalysis/helpers/helpers.pyx":539 + * tmp_perm=0.0 + * tmp_ind=0.0 + * for k in range(apr[j]): # <<<<<<<<<<<<<< + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_obj = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_k = __pyx_t_17; - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: + /* "newanalysis/helpers/helpers.pyx":540 + * tmp_ind=0.0 + * for k in range(apr[j]): + * idx2 = rfa[j] + k # <<<<<<<<<<<<<< + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 426, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); - /* "View.MemoryView":427 - * obj = self.is_slice(value) - * if obj: - * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< - * else: - * self.setitem_slice_assign_scalar(self[index], value) + /* "newanalysis/helpers/helpers.pyx":541 + * for k in range(apr[j]): + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] */ - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __pyx_v_idx; + __pyx_t_18 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_19 = __pyx_v_idx2; + __pyx_t_20 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: + /* "newanalysis/helpers/helpers.pyx":542 + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) */ - goto __pyx_L5; - } + __pyx_t_20 = __pyx_v_idx; + __pyx_t_19 = 1; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + __pyx_t_18 = __pyx_v_idx2; + __pyx_t_4 = 1; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":429 - * self.setitem_slice_assignment(self[index], obj) - * else: - * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< - * else: - * self.setitem_indexed(index, value) + /* "newanalysis/helpers/helpers.pyx":543 + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< + * r = sqrt(dx*dx + dy*dy + dz*dz) + * qq = charges[idx] * charges[idx2] / r */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 429, __pyx_L1_error) - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L5:; + __pyx_t_4 = __pyx_v_idx; + __pyx_t_18 = 2; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_19 = __pyx_v_idx2; + __pyx_t_20 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "newanalysis/helpers/helpers.pyx":544 + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< + * qq = charges[idx] * charges[idx2] / r * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: */ - goto __pyx_L4; - } + __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* "View.MemoryView":431 - * self.setitem_slice_assign_scalar(self[index], value) - * else: - * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":545 + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) + * qq = charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< * - * cdef is_slice(self, obj): + * if drude[k]==1: */ - /*else*/ { - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L4:; + __pyx_t_20 = __pyx_v_idx; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges.shape[0]; + __pyx_t_19 = __pyx_v_idx2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; + __pyx_t_8 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_20 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) )))); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 545, __pyx_L1_error) + } + __pyx_v_qq = (__pyx_t_8 / __pyx_v_r); - /* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) + /* "newanalysis/helpers/helpers.pyx":547 + * qq = charges[idx] * charges[idx2] / r * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + * if drude[k]==1: # <<<<<<<<<<<<<< + * epa_ind[i]+=qq + * tmp_ind +=qq */ + __pyx_t_19 = __pyx_v_k; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_drude.shape[0]; + __pyx_t_14 = ((*((double *) ( /* dim=0 */ (__pyx_v_drude.data + __pyx_t_19 * __pyx_v_drude.strides[0]) ))) == 1.0); + if (__pyx_t_14) { - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":433 - * self.setitem_indexed(index, value) + /* "newanalysis/helpers/helpers.pyx":548 * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + * if drude[k]==1: + * epa_ind[i]+=qq # <<<<<<<<<<<<<< + * tmp_ind +=qq + * else: */ + __pyx_t_19 = __pyx_v_i; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa_ind.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_epa_ind.data + __pyx_t_19 * __pyx_v_epa_ind.strides[0]) )) += __pyx_v_qq; -static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_slice", 0); - __Pyx_INCREF(__pyx_v_obj); + /* "newanalysis/helpers/helpers.pyx":549 + * if drude[k]==1: + * epa_ind[i]+=qq + * tmp_ind +=qq # <<<<<<<<<<<<<< + * else: + * epa_perm[i]+=qq + */ + __pyx_v_tmp_ind = (__pyx_v_tmp_ind + __pyx_v_qq); - /* "View.MemoryView":434 + /* "newanalysis/helpers/helpers.pyx":547 + * qq = charges[idx] * charges[idx2] / r * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * if drude[k]==1: # <<<<<<<<<<<<<< + * epa_ind[i]+=qq + * tmp_ind +=qq */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + goto __pyx_L10; + } - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) + /* "newanalysis/helpers/helpers.pyx":551 + * tmp_ind +=qq + * else: + * epa_perm[i]+=qq # <<<<<<<<<<<<<< + * tmp_perm +=qq + * if kflags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_v_tmp_perm = (__pyx_v_tmp_perm + __pyx_v_qq); - /* "View.MemoryView":437 - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * except TypeError: - * return None + /* "newanalysis/helpers/helpers.pyx":553 + * epa_perm[i]+=qq + * tmp_perm +=qq + * if kdtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 437, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_19 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_apr.shape[0]; + __pyx_t_21 = (__pyx_v_k < ((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_19 * __pyx_v_apr.strides[0]) ))) - 1)); + if (__pyx_t_21) { + } else { + __pyx_t_14 = __pyx_t_21; + goto __pyx_L12_bool_binop_done; + } + __pyx_t_19 = (__pyx_v_k + 1); + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_drude.shape[0]; + __pyx_t_21 = ((*((double *) ( /* dim=0 */ (__pyx_v_drude.data + __pyx_t_19 * __pyx_v_drude.strides[0]) ))) == 1.0); + __pyx_t_14 = __pyx_t_21; + __pyx_L12_bool_binop_done:; + if (__pyx_t_14) { - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: + /* "newanalysis/helpers/helpers.pyx":554 + * tmp_perm +=qq + * if k= histo_max: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_obj); - __pyx_r = __pyx_v_obj; - goto __pyx_L0; + __pyx_t_14 = (__pyx_v_r < __pyx_v_histo_min); + if (__pyx_t_14) { - /* "View.MemoryView":433 - * self.setitem_indexed(index, value) + /* "newanalysis/helpers/helpers.pyx":562 + * r=sqrt(coms[j,0]*coms[j,0]+coms[j,1]*coms[j,1]+coms[j,2]*coms[j,2]) + * if r < histo_min: + * histo_error=1 # <<<<<<<<<<<<<< + * elif r >= histo_max: + * histo_error=2 + */ + __pyx_v_histo_error = 1; + + /* "newanalysis/helpers/helpers.pyx":561 * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + * r=sqrt(coms[j,0]*coms[j,0]+coms[j,1]*coms[j,1]+coms[j,2]*coms[j,2]) + * if r < histo_min: # <<<<<<<<<<<<<< + * histo_error=1 + * elif r >= histo_max: */ + goto __pyx_L14; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":563 + * if r < histo_min: + * histo_error=1 + * elif r >= histo_max: # <<<<<<<<<<<<<< + * histo_error=2 + * else: + */ + __pyx_t_14 = (__pyx_v_r >= __pyx_v_histo_max); + if (__pyx_t_14) { -/* "View.MemoryView":443 - * return obj + /* "newanalysis/helpers/helpers.pyx":564 + * histo_error=1 + * elif r >= histo_max: + * histo_error=2 # <<<<<<<<<<<<<< + * else: + * histo_perm[int((r-histo_min)/histo_width)]+=tmp_perm + */ + __pyx_v_histo_error = 2; + + /* "newanalysis/helpers/helpers.pyx":563 + * if r < histo_min: + * histo_error=1 + * elif r >= histo_max: # <<<<<<<<<<<<<< + * histo_error=2 + * else: + */ + goto __pyx_L14; + } + + /* "newanalysis/helpers/helpers.pyx":566 + * histo_error=2 + * else: + * histo_perm[int((r-histo_min)/histo_width)]+=tmp_perm # <<<<<<<<<<<<<< + * histo_ind[int((r-histo_min)/histo_width)] +=tmp_ind * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice */ + /*else*/ { + __pyx_t_8 = (__pyx_v_r - __pyx_v_histo_min); + if (unlikely(__pyx_v_histo_width == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 566, __pyx_L1_error) + } + __pyx_t_29 = ((Py_ssize_t)(__pyx_t_8 / __pyx_v_histo_width)); + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_histo_perm.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_histo_perm.data + __pyx_t_29 * __pyx_v_histo_perm.strides[0]) )) += __pyx_v_tmp_perm; -static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { - __Pyx_memviewslice __pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_src_slice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - __Pyx_memviewslice *__pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + /* "newanalysis/helpers/helpers.pyx":567 + * else: + * histo_perm[int((r-histo_min)/histo_width)]+=tmp_perm + * histo_ind[int((r-histo_min)/histo_width)] +=tmp_ind # <<<<<<<<<<<<<< + * + * for i in range(apr[isolute]): + */ + __pyx_t_8 = (__pyx_v_r - __pyx_v_histo_min); + if (unlikely(__pyx_v_histo_width == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 567, __pyx_L1_error) + } + __pyx_t_29 = ((Py_ssize_t)(__pyx_t_8 / __pyx_v_histo_width)); + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_histo_ind.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_histo_ind.data + __pyx_t_29 * __pyx_v_histo_ind.strides[0]) )) += __pyx_v_tmp_ind; + } + __pyx_L14:; + __pyx_L5_continue:; + } + } - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice + /* "newanalysis/helpers/helpers.pyx":569 + * histo_ind[int((r-histo_min)/histo_width)] +=tmp_ind * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * energy_perm += epa_perm[i] + * energy_ind += epa_ind[i] */ - if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 447, __pyx_L1_error) - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 447, __pyx_L1_error) + __pyx_t_29 = __pyx_v_isolute; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_29 * __pyx_v_apr.strides[0]) ))); + __pyx_t_9 = __pyx_t_6; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; - /* "View.MemoryView":448 + /* "newanalysis/helpers/helpers.pyx":570 * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<< - * src.ndim, dst.ndim, self.dtype_is_object) + * for i in range(apr[isolute]): + * energy_perm += epa_perm[i] # <<<<<<<<<<<<<< + * energy_ind += epa_ind[i] * */ - if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 448, __pyx_L1_error) - __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 448, __pyx_L1_error) + __pyx_t_29 = __pyx_v_i; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_epa_perm.shape[0]; + __pyx_v_energy_perm = (__pyx_v_energy_perm + (*((double *) ( /* dim=0 */ (__pyx_v_epa_perm.data + __pyx_t_29 * __pyx_v_epa_perm.strides[0]) )))); - /* "View.MemoryView":449 - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":571 + * for i in range(apr[isolute]): + * energy_perm += epa_perm[i] + * energy_ind += epa_ind[i] # <<<<<<<<<<<<<< * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * return energy_perm * 1390.02 , energy_ind * 1390.02, np.asarray(histo_perm)[:] * 1390.02, np.asarray(histo_ind)[:] * 1390.02 , histo_error */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_29 = __pyx_v_i; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_epa_ind.shape[0]; + __pyx_v_energy_ind = (__pyx_v_energy_ind + (*((double *) ( /* dim=0 */ (__pyx_v_epa_ind.data + __pyx_t_29 * __pyx_v_epa_ind.strides[0]) )))); + } - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice + /* "newanalysis/helpers/helpers.pyx":573 + * energy_ind += epa_ind[i] + * + * return energy_perm * 1390.02 , energy_ind * 1390.02, np.asarray(histo_perm)[:] * 1390.02, np.asarray(histo_ind)[:] * 1390.02 , histo_error # <<<<<<<<<<<<<< * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) + * @cython.boundscheck(False) */ - __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 447, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_energy_perm * 1390.02)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyFloat_FromDouble((__pyx_v_energy_ind * 1390.02)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_histo_perm, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_31 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_30))) { + __pyx_t_31 = PyMethod_GET_SELF(__pyx_t_30); + if (likely(__pyx_t_31)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_30); + __Pyx_INCREF(__pyx_t_31); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_30, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_31, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_30, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; + } + __pyx_t_30 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_30, __pyx_float_1390_02); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_31 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_31); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_histo_ind, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_32 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_31))) { + __pyx_t_32 = PyMethod_GET_SELF(__pyx_t_31); + if (likely(__pyx_t_32)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_31); + __Pyx_INCREF(__pyx_t_32); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_31, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_32, __pyx_t_5}; + __pyx_t_30 = __Pyx_PyObject_FastCall(__pyx_t_31, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_32); __pyx_t_32 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0; + } + __pyx_t_31 = __Pyx_PyObject_GetSlice(__pyx_t_30, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_31); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; + __pyx_t_30 = PyNumber_Multiply(__pyx_t_31, __pyx_float_1390_02); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0; + __pyx_t_31 = __Pyx_PyInt_From_int(__pyx_v_histo_error); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_31); + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_30); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_30)) __PYX_ERR(0, 573, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_31); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_31)) __PYX_ERR(0, 573, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_30 = 0; + __pyx_t_31 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "View.MemoryView":443 - * return obj + /* "newanalysis/helpers/helpers.pyx":510 + * return energy * 1390.02, np.asarray(histo)[:] * 1390.02 , histo_error, np.asarray(count)[:] * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAApermindhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude,double histo_min, double histo_max, int histo_bins,): + * """ */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_5); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_XDECREF(__pyx_t_30); + __Pyx_XDECREF(__pyx_t_31); + __Pyx_XDECREF(__pyx_t_32); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAApermindhisto", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_epa_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_epa_perm, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histo_perm, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histo_ind, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) +/* "newanalysis/helpers/helpers.pyx":575 + * return energy_perm * 1390.02 , energy_ind * 1390.02, np.asarray(histo_perm)[:] * 1390.02, np.asarray(histo_ind)[:] * 1390.02 , histo_error * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAtomic(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): + * """ */ -static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { - int __pyx_v_array[0x80]; - void *__pyx_v_tmp; - void *__pyx_v_item; - __Pyx_memviewslice *__pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_tmp_slice; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_31calcEnergyAtomic(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_30calcEnergyAtomic, "\n energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules)\n\n Calculates the atom-resolved solvation energy of a solute in any solvent for a specific coordinate set.\n \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_31calcEnergyAtomic = {"calcEnergyAtomic", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_31calcEnergyAtomic, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_30calcEnergyAtomic}; +static PyObject *__pyx_pw_11newanalysis_7helpers_31calcEnergyAtomic(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_isolute; + int __pyx_v_nmol; + int __pyx_v_exclude_begin; + int __pyx_v_exclude_end; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcEnergyAtomic (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 575, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_exclude_begin,&__pyx_n_s_exclude_end,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 575, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 575, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, 1); __PYX_ERR(0, 575, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 575, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, 2); __PYX_ERR(0, 575, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 575, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, 3); __PYX_ERR(0, 575, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 575, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, 4); __PYX_ERR(0, 575, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 575, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, 5); __PYX_ERR(0, 575, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exclude_begin); + if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 575, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exclude_end); + if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 575, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcEnergyAtomic") < 0)) __PYX_ERR(0, 575, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 576, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 576, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 576, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 576, __pyx_L3_error) + __pyx_v_isolute = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L3_error) + __pyx_v_nmol = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L3_error) + if (values[6]) { + __pyx_v_exclude_begin = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_exclude_begin == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L3_error) + } else { + __pyx_v_exclude_begin = ((int)((int)-1)); + } + if (values[7]) { + __pyx_v_exclude_end = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_exclude_end == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L3_error) + } else { + __pyx_v_exclude_end = ((int)((int)-1)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomic", 0, 6, 8, __pyx_nargs); __PYX_ERR(0, 575, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_30calcEnergyAtomic(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_exclude_begin, __pyx_v_exclude_end); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_7helpers_30calcEnergyAtomic(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, int __pyx_v_exclude_begin, int __pyx_v_exclude_end) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_idx; + int __pyx_v_idx2; + __Pyx_memviewslice __pyx_v_epa = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_r; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - char const *__pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + double __pyx_t_21; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); + __Pyx_RefNannySetupContext("calcEnergyAtomic", 0); - /* "View.MemoryView":453 - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - * cdef int array[128] - * cdef void *tmp = NULL # <<<<<<<<<<<<<< - * cdef void *item + /* "newanalysis/helpers/helpers.pyx":584 + * """ + * cdef int i, j, k, idx, idx2 + * cdef double [:] epa = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, r * */ - __pyx_v_tmp = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_epa = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":458 - * cdef __Pyx_memviewslice *dst_slice - * cdef __Pyx_memviewslice tmp_slice - * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< - * - * if self.view.itemsize > sizeof(array): - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 458, __pyx_L1_error) - __pyx_v_dst_slice = __pyx_t_1; - - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) - * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: + /* "newanalysis/helpers/helpers.pyx":589 + * # loop over solute atoms + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * idx = rfa[isolute] + i + * # loop over solvent molecules */ - __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); - if (__pyx_t_2) { + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_8 = __pyx_t_6; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "View.MemoryView":461 - * - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< - * if tmp == NULL: - * raise MemoryError + /* "newanalysis/helpers/helpers.pyx":590 + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): + * idx = rfa[isolute] + i # <<<<<<<<<<<<<< + * # loop over solvent molecules + * for j in range(nmol): */ - __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp + /* "newanalysis/helpers/helpers.pyx":592 + * idx = rfa[isolute] + i + * # loop over solvent molecules + * for j in range(nmol): # <<<<<<<<<<<<<< + * if j == isolute or (j >= exclude_begin and j < exclude_end): + * continue */ - __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_10 = __pyx_v_nmol; + __pyx_t_11 = __pyx_t_10; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; - /* "View.MemoryView":463 - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * item = tmp - * else: + /* "newanalysis/helpers/helpers.pyx":593 + * # loop over solvent molecules + * for j in range(nmol): + * if j == isolute or (j >= exclude_begin and j < exclude_end): # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ - PyErr_NoMemory(); __PYX_ERR(2, 463, __pyx_L1_error) + __pyx_t_14 = (__pyx_v_j == __pyx_v_isolute); + if (!__pyx_t_14) { + } else { + __pyx_t_13 = __pyx_t_14; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_14 = (__pyx_v_j >= __pyx_v_exclude_begin); + if (__pyx_t_14) { + } else { + __pyx_t_13 = __pyx_t_14; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_14 = (__pyx_v_j < __pyx_v_exclude_end); + __pyx_t_13 = __pyx_t_14; + __pyx_L8_bool_binop_done:; + if (__pyx_t_13) { - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp + /* "newanalysis/helpers/helpers.pyx":594 + * for j in range(nmol): + * if j == isolute or (j >= exclude_begin and j < exclude_end): + * continue # <<<<<<<<<<<<<< + * for k in range(apr[j]): + * idx2 = rfa[j] + k */ - } + goto __pyx_L5_continue; - /* "View.MemoryView":464 - * if tmp == NULL: - * raise MemoryError - * item = tmp # <<<<<<<<<<<<<< - * else: - * item = array + /* "newanalysis/helpers/helpers.pyx":593 + * # loop over solvent molecules + * for j in range(nmol): + * if j == isolute or (j >= exclude_begin and j < exclude_end): # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ - __pyx_v_item = __pyx_v_tmp; + } - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) - * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: + /* "newanalysis/helpers/helpers.pyx":595 + * if j == isolute or (j >= exclude_begin and j < exclude_end): + * continue + * for k in range(apr[j]): # <<<<<<<<<<<<<< + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] */ - goto __pyx_L3; - } + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_k = __pyx_t_17; - /* "View.MemoryView":466 - * item = tmp - * else: - * item = array # <<<<<<<<<<<<<< - * - * try: + /* "newanalysis/helpers/helpers.pyx":596 + * continue + * for k in range(apr[j]): + * idx2 = rfa[j] + k # <<<<<<<<<<<<<< + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] */ - /*else*/ { - __pyx_v_item = ((void *)__pyx_v_array); - } - __pyx_L3:; + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); - /* "View.MemoryView":468 - * item = array - * - * try: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * ( item)[0] = value + /* "newanalysis/helpers/helpers.pyx":597 + * for k in range(apr[j]): + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] */ - /*try:*/ { + __pyx_t_4 = __pyx_v_idx; + __pyx_t_18 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_19 = __pyx_v_idx2; + __pyx_t_20 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":469 - * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: + /* "newanalysis/helpers/helpers.pyx":598 + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) */ - __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_2) { + __pyx_t_20 = __pyx_v_idx; + __pyx_t_19 = 1; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + __pyx_t_18 = __pyx_v_idx2; + __pyx_t_4 = 1; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":470 - * try: - * if self.dtype_is_object: - * ( item)[0] = value # <<<<<<<<<<<<<< - * else: - * self.assign_item_from_object( item, value) + /* "newanalysis/helpers/helpers.pyx":599 + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< + * r = sqrt(dx*dx + dy*dy + dz*dz) + * epa[i] += charges[idx] * charges[idx2] / r */ - (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + __pyx_t_4 = __pyx_v_idx; + __pyx_t_18 = 2; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_19 = __pyx_v_idx2; + __pyx_t_20 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":469 + /* "newanalysis/helpers/helpers.pyx":600 + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< + * epa[i] += charges[idx] * charges[idx2] / r * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: */ - goto __pyx_L8; - } + __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* "View.MemoryView":472 - * ( item)[0] = value - * else: - * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":601 + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) + * epa[i] += charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< * + * return np.asarray(epa)[:] * 1390.02 */ - /*else*/ { - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 472, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_20 = __pyx_v_idx; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges.shape[0]; + __pyx_t_19 = __pyx_v_idx2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; + __pyx_t_21 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_20 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) )))); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 601, __pyx_L1_error) + } + __pyx_t_19 = __pyx_v_i; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_19 * __pyx_v_epa.strides[0]) )) += (__pyx_t_21 / __pyx_v_r); + } + __pyx_L5_continue:; } - __pyx_L8:; - - /* "View.MemoryView":476 - * - * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - */ - __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":477 - * - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) - */ - __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 477, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } - /* "View.MemoryView":476 + /* "newanalysis/helpers/helpers.pyx":603 + * epa[i] += charges[idx] * charges[idx2] / r * + * return np.asarray(epa)[:] * 1390.02 # <<<<<<<<<<<<<< * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * @cython.boundscheck(False) */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_epa, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; } - - /* "View.MemoryView":478 - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< - * item, self.dtype_is_object) - * finally: - */ - __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); } - - /* "View.MemoryView":481 - * item, self.dtype_is_object) - * finally: - * PyMem_Free(tmp) # <<<<<<<<<<<<<< - * - * cdef setitem_indexed(self, index, value): - */ - /*finally:*/ { - /*normal exit:*/{ - PyMem_Free(__pyx_v_tmp); - goto __pyx_L7; - } - __pyx_L6_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; - { - PyMem_Free(__pyx_v_tmp); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; - goto __pyx_L1_error; - } - __pyx_L7:; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } + __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_float_1390_02); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) + /* "newanalysis/helpers/helpers.pyx":575 + * return energy_perm * 1390.02 , energy_ind * 1390.02, np.asarray(histo_perm)[:] * 1390.02, np.asarray(histo_ind)[:] * 1390.02 , histo_error * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAtomic(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): + * """ */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_5); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_epa, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":483 - * PyMem_Free(tmp) +/* "newanalysis/helpers/helpers.pyx":605 + * return np.asarray(epa)[:] * 1390.02 * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyDouble(double [:,:] coor, double [:] charges1, int [:] apr, int [:] rfa, int isolute, int nmol, int start, int end): + * """ */ -static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_33calcEnergyDouble(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_32calcEnergyDouble, "\n energy = calcEnergyDouble(xyz, charges_1, charges_2, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,start_res,end_res)\n\n Calculates the atom-resolved solvation energy of a solute in any solvent for a specific coordinate set \n \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_33calcEnergyDouble = {"calcEnergyDouble", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_33calcEnergyDouble, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_32calcEnergyDouble}; +static PyObject *__pyx_pw_11newanalysis_7helpers_33calcEnergyDouble(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_isolute; + int __pyx_v_nmol; + int __pyx_v_start; + int __pyx_v_end; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_indexed", 0); - - /* "View.MemoryView":484 - * - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< - * self.assign_item_from_object(itemp, value) - * - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 484, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_1; - - /* "View.MemoryView":485 - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< - * - * cdef convert_item_to_object(self, char *itemp): - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 485, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":483 - * PyMem_Free(tmp) - * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) - */ + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcEnergyDouble (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 605, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges1,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_start,&__pyx_n_s_end,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 605, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 605, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 1); __PYX_ERR(0, 605, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 605, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 2); __PYX_ERR(0, 605, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 605, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 3); __PYX_ERR(0, 605, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 605, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 4); __PYX_ERR(0, 605, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 605, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 5); __PYX_ERR(0, 605, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 605, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 6); __PYX_ERR(0, 605, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_end)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 605, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, 7); __PYX_ERR(0, 605, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcEnergyDouble") < 0)) __PYX_ERR(0, 605, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 8)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 606, __pyx_L3_error) + __pyx_v_charges1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges1.memview)) __PYX_ERR(0, 606, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 606, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 606, __pyx_L3_error) + __pyx_v_isolute = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 606, __pyx_L3_error) + __pyx_v_nmol = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 606, __pyx_L3_error) + __pyx_v_start = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 606, __pyx_L3_error) + __pyx_v_end = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 606, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcEnergyDouble", 1, 8, 8, __pyx_nargs); __PYX_ERR(0, 605, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyDouble", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_32calcEnergyDouble(__pyx_self, __pyx_v_coor, __pyx_v_charges1, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_start, __pyx_v_end); /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - -static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_v_struct = NULL; - PyObject *__pyx_v_bytesitem = 0; - PyObject *__pyx_v_result = NULL; +static PyObject *__pyx_pf_11newanalysis_7helpers_32calcEnergyDouble(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges1, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, int __pyx_v_start, int __pyx_v_end) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_idx; + int __pyx_v_idx2; + __Pyx_memviewslice __pyx_v_epa1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_r; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_4; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - size_t __pyx_t_10; + int __pyx_t_9; + int __pyx_t_10; int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + double __pyx_t_21; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); + __Pyx_RefNannySetupContext("calcEnergyDouble", 0); - /* "View.MemoryView":490 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef bytes bytesitem + /* "newanalysis/helpers/helpers.pyx":614 + * """ + * cdef int i, j, k, idx, idx2 + * cdef double [:] epa1 = np.zeros(apr[isolute]) # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, r * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_epa1 = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":493 - * cdef bytes bytesitem - * - * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< - * try: - * result = struct.unpack(self.view.format, bytesitem) + /* "newanalysis/helpers/helpers.pyx":619 + * # loop over solute atoms + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * idx = rfa[isolute] + i + * if charges1[idx]==0: */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_8 = __pyx_t_6; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "View.MemoryView":494 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + /* "newanalysis/helpers/helpers.pyx":620 + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): + * idx = rfa[isolute] + i # <<<<<<<<<<<<<< + * if charges1[idx]==0: + * continue */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); - /* "View.MemoryView":495 - * bytesitem = itemp[:self.view.itemsize] - * try: - * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< - * except struct.error: - * raise ValueError("Unable to convert item to object") + /* "newanalysis/helpers/helpers.pyx":621 + * for i in range(apr[isolute]): + * idx = rfa[isolute] + i + * if charges1[idx]==0: # <<<<<<<<<<<<<< + * continue + * # loop over solvent molecules */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); - __Pyx_INCREF(__pyx_v_bytesitem); - __Pyx_GIVEREF(__pyx_v_bytesitem); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_4 = __pyx_v_idx; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_charges1.shape[0]; + __pyx_t_10 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges1.data + __pyx_t_4 * __pyx_v_charges1.strides[0]) ))) == 0.0); + if (__pyx_t_10) { - /* "View.MemoryView":494 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + /* "newanalysis/helpers/helpers.pyx":622 + * idx = rfa[isolute] + i + * if charges1[idx]==0: + * continue # <<<<<<<<<<<<<< + * # loop over solvent molecules + * for j in range(nmol): + */ + goto __pyx_L3_continue; + + /* "newanalysis/helpers/helpers.pyx":621 + * for i in range(apr[isolute]): + * idx = rfa[isolute] + i + * if charges1[idx]==0: # <<<<<<<<<<<<<< + * continue + * # loop over solvent molecules */ } - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result + /* "newanalysis/helpers/helpers.pyx":624 + * continue + * # loop over solvent molecules + * for j in range(nmol): # <<<<<<<<<<<<<< + * if j == isolute or j < start or j > end: + * continue */ - /*else:*/ { - __pyx_t_10 = strlen(__pyx_v_self->view.format); - __pyx_t_11 = ((__pyx_t_10 == 1) != 0); - if (__pyx_t_11) { + __pyx_t_11 = __pyx_v_nmol; + __pyx_t_12 = __pyx_t_11; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_j = __pyx_t_13; - /* "View.MemoryView":500 - * else: - * if len(self.view.format) == 1: - * return result[0] # <<<<<<<<<<<<<< - * return result - * + /* "newanalysis/helpers/helpers.pyx":625 + * # loop over solvent molecules + * for j in range(nmol): + * if j == isolute or j < start or j > end: # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L6_except_return; + __pyx_t_14 = (__pyx_v_j == __pyx_v_isolute); + if (!__pyx_t_14) { + } else { + __pyx_t_10 = __pyx_t_14; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_14 = (__pyx_v_j < __pyx_v_start); + if (!__pyx_t_14) { + } else { + __pyx_t_10 = __pyx_t_14; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_14 = (__pyx_v_j > __pyx_v_end); + __pyx_t_10 = __pyx_t_14; + __pyx_L9_bool_binop_done:; + if (__pyx_t_10) { - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result + /* "newanalysis/helpers/helpers.pyx":626 + * for j in range(nmol): + * if j == isolute or j < start or j > end: + * continue # <<<<<<<<<<<<<< + * for k in range(apr[j]): + * idx2 = rfa[j] + k + */ + goto __pyx_L6_continue; + + /* "newanalysis/helpers/helpers.pyx":625 + * # loop over solvent molecules + * for j in range(nmol): + * if j == isolute or j < start or j > end: # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ } - /* "View.MemoryView":501 - * if len(self.view.format) == 1: - * return result[0] - * return result # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): + /* "newanalysis/helpers/helpers.pyx":627 + * if j == isolute or j < start or j > end: + * continue + * for k in range(apr[j]): # <<<<<<<<<<<<<< + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L6_except_return; - } - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_k = __pyx_t_17; - /* "View.MemoryView":496 - * try: - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: # <<<<<<<<<<<<<< - * raise ValueError("Unable to convert item to object") - * else: + /* "newanalysis/helpers/helpers.pyx":628 + * continue + * for k in range(apr[j]): + * idx2 = rfa[j] + k # <<<<<<<<<<<<<< + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9); - __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0; - if (__pyx_t_8) { - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: + /* "newanalysis/helpers/helpers.pyx":629 + * for k in range(apr[j]): + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 497, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(2, 497, __pyx_L5_except_error) + __pyx_t_4 = __pyx_v_idx; + __pyx_t_18 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_19 = __pyx_v_idx2; + __pyx_t_20 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":630 + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) + */ + __pyx_t_20 = __pyx_v_idx; + __pyx_t_19 = 1; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + __pyx_t_18 = __pyx_v_idx2; + __pyx_t_4 = 1; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":631 + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< + * r = sqrt(dx*dx + dy*dy + dz*dz) + * epa1[i] += charges1[idx] * charges1[idx2] / r + */ + __pyx_t_4 = __pyx_v_idx; + __pyx_t_18 = 2; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_19 = __pyx_v_idx2; + __pyx_t_20 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":632 + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< + * epa1[i] += charges1[idx] * charges1[idx2] / r + * + */ + __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + + /* "newanalysis/helpers/helpers.pyx":633 + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) + * epa1[i] += charges1[idx] * charges1[idx2] / r # <<<<<<<<<<<<<< + * + * return np.asarray(epa1)[:] * 1390.02 + */ + __pyx_t_20 = __pyx_v_idx; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges1.shape[0]; + __pyx_t_19 = __pyx_v_idx2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges1.shape[0]; + __pyx_t_21 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges1.data + __pyx_t_20 * __pyx_v_charges1.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges1.data + __pyx_t_19 * __pyx_v_charges1.strides[0]) )))); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 633, __pyx_L1_error) + } + __pyx_t_19 = __pyx_v_i; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa1.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_epa1.data + __pyx_t_19 * __pyx_v_epa1.strides[0]) )) += (__pyx_t_21 / __pyx_v_r); + } + __pyx_L6_continue:; } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + __pyx_L3_continue:; + } - /* "View.MemoryView":494 + /* "newanalysis/helpers/helpers.pyx":635 + * epa1[i] += charges1[idx] * charges1[idx2] / r * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + * return np.asarray(epa1)[:] * 1390.02 # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L6_except_return:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_epa1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } + __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, NULL, NULL, &__pyx_slice__5, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_float_1390_02); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) + /* "newanalysis/helpers/helpers.pyx":605 + * return np.asarray(epa)[:] * 1390.02 * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyDouble(double [:,:] coor, double [:] charges1, int [:] apr, int [:] rfa, int isolute, int nmol, int start, int end): + * """ */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyDouble", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesitem); - __Pyx_XDECREF(__pyx_v_result); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_epa1, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":503 - * return result +/* "newanalysis/helpers/helpers.pyx":637 + * return np.asarray(epa1)[:] * 1390.02 * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipDipEnergyAtomic(double [:,:] coms, double [:,:] dipol, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): + * """ */ -static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_v_struct = NULL; - char __pyx_v_c; - PyObject *__pyx_v_bytesvalue = 0; - Py_ssize_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - char *__pyx_t_11; - char *__pyx_t_12; - char *__pyx_t_13; - char *__pyx_t_14; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_35calcDipDipEnergyAtomic(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_34calcDipDipEnergyAtomic, "\n energy = calcDipDipEnergyAtomic(coms, dipol, resnum_solute, nmolecules)\n\n Calculates the atom-resolved solvation dipol-dipol energy of a solute in any solvent for a specific coordinate set.\n \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_35calcDipDipEnergyAtomic = {"calcDipDipEnergyAtomic", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_35calcDipDipEnergyAtomic, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_34calcDipDipEnergyAtomic}; +static PyObject *__pyx_pw_11newanalysis_7helpers_35calcDipDipEnergyAtomic(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coms = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dipol = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_isolute; + int __pyx_v_nmol; + int __pyx_v_exclude_begin; + int __pyx_v_exclude_end; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); - - /* "View.MemoryView":506 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef char c - * cdef bytes bytesvalue - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":511 - * cdef Py_ssize_t i - * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: - */ - __pyx_t_2 = PyTuple_Check(__pyx_v_value); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "View.MemoryView":512 - * - * if isinstance(value, tuple): - * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< - * else: - * bytesvalue = struct.pack(self.view.format, value) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - - /* "View.MemoryView":511 - * cdef Py_ssize_t i - * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":514 - * bytesvalue = struct.pack(self.view.format, *value) - * else: - * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< - * - * for i, c in enumerate(bytesvalue): - */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_7 = 1; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDipDipEnergyAtomic (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 637, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coms,&__pyx_n_s_dipol,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_exclude_begin,&__pyx_n_s_exclude_end,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coms)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 637, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dipol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 637, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipDipEnergyAtomic", 0, 4, 6, 1); __PYX_ERR(0, 637, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 637, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipDipEnergyAtomic", 0, 4, 6, 2); __PYX_ERR(0, 637, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 637, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipDipEnergyAtomic", 0, 4, 6, 3); __PYX_ERR(0, 637, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exclude_begin); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 637, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exclude_end); + if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 637, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDipDipEnergyAtomic") < 0)) __PYX_ERR(0, 637, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_coms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coms.memview)) __PYX_ERR(0, 638, __pyx_L3_error) + __pyx_v_dipol = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dipol.memview)) __PYX_ERR(0, 638, __pyx_L3_error) + __pyx_v_isolute = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L3_error) + __pyx_v_nmol = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L3_error) + if (values[4]) { + __pyx_v_exclude_begin = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_exclude_begin == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L3_error) + } else { + __pyx_v_exclude_begin = ((int)((int)-1)); + } + if (values[5]) { + __pyx_v_exclude_end = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_exclude_end == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 638, __pyx_L3_error) + } else { + __pyx_v_exclude_end = ((int)((int)-1)); } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 514, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - } - __pyx_L3:; - - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c - * - */ - __pyx_t_9 = 0; - if (unlikely(__pyx_v_bytesvalue == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(2, 516, __pyx_L1_error) } - __Pyx_INCREF(__pyx_v_bytesvalue); - __pyx_t_10 = __pyx_v_bytesvalue; - __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10); - __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10)); - for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { - __pyx_t_11 = __pyx_t_14; - __pyx_v_c = (__pyx_t_11[0]); - - /* "View.MemoryView":517 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< - * - * @cname('getbuffer') - */ - __pyx_v_i = __pyx_t_9; - - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c - * - */ - __pyx_t_9 = (__pyx_t_9 + 1); - - /* "View.MemoryView":517 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< - * - * @cname('getbuffer') - */ - (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDipDipEnergyAtomic", 0, 4, 6, __pyx_nargs); __PYX_ERR(0, 637, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "View.MemoryView":503 - * return result - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesvalue); - __Pyx_XGIVEREF(__pyx_r); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dipol, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcDipDipEnergyAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":520 - * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") - */ - -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_34calcDipDipEnergyAtomic(__pyx_self, __pyx_v_coms, __pyx_v_dipol, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_exclude_begin, __pyx_v_exclude_end); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dipol, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; +static PyObject *__pyx_pf_11newanalysis_7helpers_34calcDipDipEnergyAtomic(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coms, __Pyx_memviewslice __pyx_v_dipol, int __pyx_v_isolute, int __pyx_v_nmol, int __pyx_v_exclude_begin, int __pyx_v_exclude_end) { + int __pyx_v_i; + double __pyx_v_edip; + double __pyx_v_r; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - char *__pyx_t_5; - void *__pyx_t_6; - int __pyx_t_7; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + double __pyx_t_18; + double __pyx_t_19; + double __pyx_t_20; + Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + PyObject *__pyx_t_33 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * - */ - __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_self->view.readonly != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __Pyx_RefNannySetupContext("calcDipDipEnergyAtomic", 0); - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":649 * - * if flags & PyBUF_ND: + * # loop over solvent molecules + * for i in range(nmol): # <<<<<<<<<<<<<< + * if i == isolute or (i >= exclude_begin and i < exclude_end): + * continue */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 522, __pyx_L1_error) + __pyx_t_1 = __pyx_v_nmol; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * + /* "newanalysis/helpers/helpers.pyx":650 + * # loop over solvent molecules + * for i in range(nmol): + * if i == isolute or (i >= exclude_begin and i < exclude_end): # <<<<<<<<<<<<<< + * continue + * r=sqrt(coms[i,0]*coms[i,0]+coms[i,1]*coms[i,1]+coms[i,2]*coms[i,2]) */ - } + __pyx_t_5 = (__pyx_v_i == __pyx_v_isolute); + if (!__pyx_t_5) { + } else { + __pyx_t_4 = __pyx_t_5; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_i >= __pyx_v_exclude_begin); + if (__pyx_t_5) { + } else { + __pyx_t_4 = __pyx_t_5; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_5 = (__pyx_v_i < __pyx_v_exclude_end); + __pyx_t_4 = __pyx_t_5; + __pyx_L6_bool_binop_done:; + if (__pyx_t_4) { - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: + /* "newanalysis/helpers/helpers.pyx":651 + * for i in range(nmol): + * if i == isolute or (i >= exclude_begin and i < exclude_end): + * continue # <<<<<<<<<<<<<< + * r=sqrt(coms[i,0]*coms[i,0]+coms[i,1]*coms[i,1]+coms[i,2]*coms[i,2]) + * edip+=(dipol[0,0]*dipol[i,0]+dipol[0,1]*dipol[i,1]+dipol[0,2]*dipol[i,2])/(r*r*r)-3/(r*r*r*r*r)*(dipol[0,0]*coms[i,0]+dipol[0,1]*coms[i,1]+dipol[0,2]*coms[i,2])*(dipol[i,0]*coms[i,0]+dipol[i,1]*coms[i,1]+dipol[i,2]*coms[i,2]) */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); - if (__pyx_t_1) { + goto __pyx_L3_continue; - /* "View.MemoryView":525 - * - * if flags & PyBUF_ND: - * info.shape = self.view.shape # <<<<<<<<<<<<<< - * else: - * info.shape = NULL + /* "newanalysis/helpers/helpers.pyx":650 + * # loop over solvent molecules + * for i in range(nmol): + * if i == isolute or (i >= exclude_begin and i < exclude_end): # <<<<<<<<<<<<<< + * continue + * r=sqrt(coms[i,0]*coms[i,0]+coms[i,1]*coms[i,1]+coms[i,2]*coms[i,2]) */ - __pyx_t_4 = __pyx_v_self->view.shape; - __pyx_v_info->shape = __pyx_t_4; + } - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "newanalysis/helpers/helpers.pyx":652 + * if i == isolute or (i >= exclude_begin and i < exclude_end): + * continue + * r=sqrt(coms[i,0]*coms[i,0]+coms[i,1]*coms[i,1]+coms[i,2]*coms[i,2]) # <<<<<<<<<<<<<< + * edip+=(dipol[0,0]*dipol[i,0]+dipol[0,1]*dipol[i,1]+dipol[0,2]*dipol[i,2])/(r*r*r)-3/(r*r*r*r*r)*(dipol[0,0]*coms[i,0]+dipol[0,1]*coms[i,1]+dipol[0,2]*coms[i,2])*(dipol[i,0]*coms[i,0]+dipol[i,1]*coms[i,1]+dipol[i,2]*coms[i,2]) * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: */ - goto __pyx_L6; - } + __pyx_t_6 = __pyx_v_i; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coms.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coms.shape[1]; + __pyx_t_8 = __pyx_v_i; + __pyx_t_9 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coms.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coms.shape[1]; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coms.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coms.shape[1]; + __pyx_t_12 = __pyx_v_i; + __pyx_t_13 = 1; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coms.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coms.shape[1]; + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = 2; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coms.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coms.shape[1]; + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = 2; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms.shape[1]; + __pyx_v_r = sqrt(((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_6 * __pyx_v_coms.strides[0]) ) + __pyx_t_7 * __pyx_v_coms.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_8 * __pyx_v_coms.strides[0]) ) + __pyx_t_9 * __pyx_v_coms.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_10 * __pyx_v_coms.strides[0]) ) + __pyx_t_11 * __pyx_v_coms.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_12 * __pyx_v_coms.strides[0]) ) + __pyx_t_13 * __pyx_v_coms.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_14 * __pyx_v_coms.strides[0]) ) + __pyx_t_15 * __pyx_v_coms.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_16 * __pyx_v_coms.strides[0]) ) + __pyx_t_17 * __pyx_v_coms.strides[1]) )))))); - /* "View.MemoryView":527 - * info.shape = self.view.shape - * else: - * info.shape = NULL # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":653 + * continue + * r=sqrt(coms[i,0]*coms[i,0]+coms[i,1]*coms[i,1]+coms[i,2]*coms[i,2]) + * edip+=(dipol[0,0]*dipol[i,0]+dipol[0,1]*dipol[i,1]+dipol[0,2]*dipol[i,2])/(r*r*r)-3/(r*r*r*r*r)*(dipol[0,0]*coms[i,0]+dipol[0,1]*coms[i,1]+dipol[0,2]*coms[i,2])*(dipol[i,0]*coms[i,0]+dipol[i,1]*coms[i,1]+dipol[i,2]*coms[i,2]) # <<<<<<<<<<<<<< * - * if flags & PyBUF_STRIDES: + * return edip * 1390.02 */ - /*else*/ { - __pyx_v_info->shape = NULL; + __pyx_t_17 = 0; + __pyx_t_16 = 0; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_dipol.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_dipol.shape[1]; + __pyx_t_15 = __pyx_v_i; + __pyx_t_14 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_dipol.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_dipol.shape[1]; + __pyx_t_13 = 0; + __pyx_t_12 = 1; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_dipol.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_dipol.shape[1]; + __pyx_t_11 = __pyx_v_i; + __pyx_t_10 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dipol.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_dipol.shape[1]; + __pyx_t_9 = 0; + __pyx_t_8 = 2; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_dipol.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dipol.shape[1]; + __pyx_t_7 = __pyx_v_i; + __pyx_t_6 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipol.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dipol.shape[1]; + __pyx_t_18 = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_17 * __pyx_v_dipol.strides[0]) ) + __pyx_t_16 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_15 * __pyx_v_dipol.strides[0]) ) + __pyx_t_14 * __pyx_v_dipol.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_13 * __pyx_v_dipol.strides[0]) ) + __pyx_t_12 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_11 * __pyx_v_dipol.strides[0]) ) + __pyx_t_10 * __pyx_v_dipol.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_9 * __pyx_v_dipol.strides[0]) ) + __pyx_t_8 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_7 * __pyx_v_dipol.strides[0]) ) + __pyx_t_6 * __pyx_v_dipol.strides[1]) ))))); + __pyx_t_19 = ((__pyx_v_r * __pyx_v_r) * __pyx_v_r); + if (unlikely(__pyx_t_19 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 653, __pyx_L1_error) + } + __pyx_t_20 = ((((__pyx_v_r * __pyx_v_r) * __pyx_v_r) * __pyx_v_r) * __pyx_v_r); + if (unlikely(__pyx_t_20 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 653, __pyx_L1_error) + } + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dipol.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipol.shape[1]; + __pyx_t_8 = __pyx_v_i; + __pyx_t_9 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coms.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coms.shape[1]; + __pyx_t_10 = 0; + __pyx_t_11 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_dipol.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dipol.shape[1]; + __pyx_t_12 = __pyx_v_i; + __pyx_t_13 = 1; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coms.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coms.shape[1]; + __pyx_t_14 = 0; + __pyx_t_15 = 2; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_dipol.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_dipol.shape[1]; + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = 2; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coms.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coms.shape[1]; + __pyx_t_21 = __pyx_v_i; + __pyx_t_22 = 0; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_dipol.shape[0]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_dipol.shape[1]; + __pyx_t_23 = __pyx_v_i; + __pyx_t_24 = 0; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_coms.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_coms.shape[1]; + __pyx_t_25 = __pyx_v_i; + __pyx_t_26 = 1; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_dipol.shape[0]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_dipol.shape[1]; + __pyx_t_27 = __pyx_v_i; + __pyx_t_28 = 1; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_coms.shape[0]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_coms.shape[1]; + __pyx_t_29 = __pyx_v_i; + __pyx_t_30 = 2; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_dipol.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_dipol.shape[1]; + __pyx_t_31 = __pyx_v_i; + __pyx_t_32 = 2; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_coms.shape[0]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_coms.shape[1]; + __pyx_v_edip = (__pyx_v_edip + ((__pyx_t_18 / __pyx_t_19) - (((3.0 / __pyx_t_20) * ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_6 * __pyx_v_dipol.strides[0]) ) + __pyx_t_7 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_8 * __pyx_v_coms.strides[0]) ) + __pyx_t_9 * __pyx_v_coms.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_10 * __pyx_v_dipol.strides[0]) ) + __pyx_t_11 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_12 * __pyx_v_coms.strides[0]) ) + __pyx_t_13 * __pyx_v_coms.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_14 * __pyx_v_dipol.strides[0]) ) + __pyx_t_15 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_16 * __pyx_v_coms.strides[0]) ) + __pyx_t_17 * __pyx_v_coms.strides[1]) )))))) * ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_21 * __pyx_v_dipol.strides[0]) ) + __pyx_t_22 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_23 * __pyx_v_coms.strides[0]) ) + __pyx_t_24 * __pyx_v_coms.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_25 * __pyx_v_dipol.strides[0]) ) + __pyx_t_26 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_27 * __pyx_v_coms.strides[0]) ) + __pyx_t_28 * __pyx_v_coms.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipol.data + __pyx_t_29 * __pyx_v_dipol.strides[0]) ) + __pyx_t_30 * __pyx_v_dipol.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coms.data + __pyx_t_31 * __pyx_v_coms.strides[0]) ) + __pyx_t_32 * __pyx_v_coms.strides[1]) )))))))); + __pyx_L3_continue:; } - __pyx_L6:; - /* "View.MemoryView":529 - * info.shape = NULL + /* "newanalysis/helpers/helpers.pyx":655 + * edip+=(dipol[0,0]*dipol[i,0]+dipol[0,1]*dipol[i,1]+dipol[0,2]*dipol[i,2])/(r*r*r)-3/(r*r*r*r*r)*(dipol[0,0]*coms[i,0]+dipol[0,1]*coms[i,1]+dipol[0,2]*coms[i,2])*(dipol[i,0]*coms[i,0]+dipol[i,1]*coms[i,1]+dipol[i,2]*coms[i,2]) * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":530 + * return edip * 1390.02 # <<<<<<<<<<<<<< * - * if flags & PyBUF_STRIDES: - * info.strides = self.view.strides # <<<<<<<<<<<<<< - * else: - * info.strides = NULL - */ - __pyx_t_4 = __pyx_v_self->view.strides; - __pyx_v_info->strides = __pyx_t_4; - - /* "View.MemoryView":529 - * info.shape = NULL * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: */ - goto __pyx_L7; - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_33 = PyFloat_FromDouble((__pyx_v_edip * 1390.02)); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_33); + __pyx_r = __pyx_t_33; + __pyx_t_33 = 0; + goto __pyx_L0; - /* "View.MemoryView":532 - * info.strides = self.view.strides - * else: - * info.strides = NULL # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":637 + * return np.asarray(epa1)[:] * 1390.02 * - * if flags & PyBUF_INDIRECT: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipDipEnergyAtomic(double [:,:] coms, double [:,:] dipol, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): + * """ */ - /*else*/ { - __pyx_v_info->strides = NULL; - } - __pyx_L7:; - /* "View.MemoryView":534 - * info.strides = NULL - * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_33); + __Pyx_AddTraceback("newanalysis.helpers.calcDipDipEnergyAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":535 +/* "newanalysis/helpers/helpers.pyx":658 * - * if flags & PyBUF_INDIRECT: - * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< - * else: - * info.suboffsets = NULL - */ - __pyx_t_4 = __pyx_v_self->view.suboffsets; - __pyx_v_info->suboffsets = __pyx_t_4; - - /* "View.MemoryView":534 - * info.strides = NULL * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAtomicVoro(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, char [:] ds, int maxshell): + * """ */ - goto __pyx_L8; - } - /* "View.MemoryView":537 - * info.suboffsets = self.view.suboffsets - * else: - * info.suboffsets = NULL # <<<<<<<<<<<<<< +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_37calcEnergyAtomicVoro(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_36calcEnergyAtomicVoro, "\n energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, delaunay_shell)\n\n Calculates the atom+shell-resolved solvation energy of a solute in any solvent for a specific coordinate set.\n \n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_37calcEnergyAtomicVoro = {"calcEnergyAtomicVoro", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_37calcEnergyAtomicVoro, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_36calcEnergyAtomicVoro}; +static PyObject *__pyx_pw_11newanalysis_7helpers_37calcEnergyAtomicVoro(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_apr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_rfa = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_isolute; + int __pyx_v_nmol; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcEnergyAtomicVoro (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 658, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_charges,&__pyx_n_s_apr,&__pyx_n_s_rfa,&__pyx_n_s_isolute,&__pyx_n_s_nmol,&__pyx_n_s_ds,&__pyx_n_s_maxshell,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 1); __PYX_ERR(0, 658, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 2); __PYX_ERR(0, 658, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 3); __PYX_ERR(0, 658, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 4); __PYX_ERR(0, 658, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 5); __PYX_ERR(0, 658, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 6); __PYX_ERR(0, 658, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, 7); __PYX_ERR(0, 658, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcEnergyAtomicVoro") < 0)) __PYX_ERR(0, 658, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 8)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 659, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 659, __pyx_L3_error) + __pyx_v_apr = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_apr.memview)) __PYX_ERR(0, 659, __pyx_L3_error) + __pyx_v_rfa = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rfa.memview)) __PYX_ERR(0, 659, __pyx_L3_error) + __pyx_v_isolute = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_isolute == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 659, __pyx_L3_error) + __pyx_v_nmol = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 659, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 659, __pyx_L3_error) + __pyx_v_maxshell = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 659, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcEnergyAtomicVoro", 1, 8, 8, __pyx_nargs); __PYX_ERR(0, 658, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAtomicVoro", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_36calcEnergyAtomicVoro(__pyx_self, __pyx_v_coor, __pyx_v_charges, __pyx_v_apr, __pyx_v_rfa, __pyx_v_isolute, __pyx_v_nmol, __pyx_v_ds, __pyx_v_maxshell); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_apr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rfa, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_7helpers_36calcEnergyAtomicVoro(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_apr, __Pyx_memviewslice __pyx_v_rfa, int __pyx_v_isolute, int __pyx_v_nmol, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_idx; + int __pyx_v_idx2; + __Pyx_memviewslice __pyx_v_epa = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_r; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + double __pyx_t_21; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcEnergyAtomicVoro", 0); + + /* "newanalysis/helpers/helpers.pyx":667 + * """ + * cdef int i, j, k, idx, idx2 + * cdef double [:,:] epa = np.zeros((apr[isolute],maxshell+1)) # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, r * - * if flags & PyBUF_FORMAT: */ - /*else*/ { - __pyx_v_info->suboffsets = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_2 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_v_maxshell + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5)) __PYX_ERR(0, 667, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_7 = 1; + } } - __pyx_L8:; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_epa = __pyx_t_8; + __pyx_t_8.memview = NULL; + __pyx_t_8.data = NULL; - /* "View.MemoryView":539 - * info.suboffsets = NULL - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: + /* "newanalysis/helpers/helpers.pyx":672 + * # loop over solute atoms + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): # <<<<<<<<<<<<<< + * idx = rfa[isolute] + i + * # loop over solvent molecules */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_7 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_9 = __pyx_t_7; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; - /* "View.MemoryView":540 - * - * if flags & PyBUF_FORMAT: - * info.format = self.view.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL + /* "newanalysis/helpers/helpers.pyx":673 + * # for i in prange(apr[isolute], nogil=True): + * for i in range(apr[isolute]): + * idx = rfa[isolute] + i # <<<<<<<<<<<<<< + * # loop over solvent molecules + * for j in range(nmol): */ - __pyx_t_5 = __pyx_v_self->view.format; - __pyx_v_info->format = __pyx_t_5; + __pyx_t_4 = __pyx_v_isolute; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_i); - /* "View.MemoryView":539 - * info.suboffsets = NULL - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: + /* "newanalysis/helpers/helpers.pyx":675 + * idx = rfa[isolute] + i + * # loop over solvent molecules + * for j in range(nmol): # <<<<<<<<<<<<<< + * if j == isolute: + * continue */ - goto __pyx_L9; - } + __pyx_t_11 = __pyx_v_nmol; + __pyx_t_12 = __pyx_t_11; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_j = __pyx_t_13; - /* "View.MemoryView":542 - * info.format = self.view.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< - * - * info.buf = self.view.buf + /* "newanalysis/helpers/helpers.pyx":676 + * # loop over solvent molecules + * for j in range(nmol): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ - /*else*/ { - __pyx_v_info->format = NULL; - } - __pyx_L9:; + __pyx_t_14 = (__pyx_v_j == __pyx_v_isolute); + if (__pyx_t_14) { - /* "View.MemoryView":544 - * info.format = NULL - * - * info.buf = self.view.buf # <<<<<<<<<<<<<< - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize + /* "newanalysis/helpers/helpers.pyx":677 + * for j in range(nmol): + * if j == isolute: + * continue # <<<<<<<<<<<<<< + * for k in range(apr[j]): + * idx2 = rfa[j] + k */ - __pyx_t_6 = __pyx_v_self->view.buf; - __pyx_v_info->buf = __pyx_t_6; + goto __pyx_L5_continue; - /* "View.MemoryView":545 - * - * info.buf = self.view.buf - * info.ndim = self.view.ndim # <<<<<<<<<<<<<< - * info.itemsize = self.view.itemsize - * info.len = self.view.len + /* "newanalysis/helpers/helpers.pyx":676 + * # loop over solvent molecules + * for j in range(nmol): + * if j == isolute: # <<<<<<<<<<<<<< + * continue + * for k in range(apr[j]): */ - __pyx_t_7 = __pyx_v_self->view.ndim; - __pyx_v_info->ndim = __pyx_t_7; + } - /* "View.MemoryView":546 - * info.buf = self.view.buf - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< - * info.len = self.view.len - * info.readonly = self.view.readonly + /* "newanalysis/helpers/helpers.pyx":678 + * if j == isolute: + * continue + * for k in range(apr[j]): # <<<<<<<<<<<<<< + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] */ - __pyx_t_8 = __pyx_v_self->view.itemsize; - __pyx_v_info->itemsize = __pyx_t_8; + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_apr.shape[0]; + __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_apr.data + __pyx_t_4 * __pyx_v_apr.strides[0]) ))); + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_k = __pyx_t_17; - /* "View.MemoryView":547 - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - * info.len = self.view.len # <<<<<<<<<<<<<< - * info.readonly = self.view.readonly - * info.obj = self + /* "newanalysis/helpers/helpers.pyx":679 + * continue + * for k in range(apr[j]): + * idx2 = rfa[j] + k # <<<<<<<<<<<<<< + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] */ - __pyx_t_8 = __pyx_v_self->view.len; - __pyx_v_info->len = __pyx_t_8; + __pyx_t_4 = __pyx_v_j; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_rfa.shape[0]; + __pyx_v_idx2 = ((*((int *) ( /* dim=0 */ (__pyx_v_rfa.data + __pyx_t_4 * __pyx_v_rfa.strides[0]) ))) + __pyx_v_k); - /* "View.MemoryView":548 - * info.itemsize = self.view.itemsize - * info.len = self.view.len - * info.readonly = self.view.readonly # <<<<<<<<<<<<<< - * info.obj = self + /* "newanalysis/helpers/helpers.pyx":680 + * for k in range(apr[j]): + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] # <<<<<<<<<<<<<< + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] + */ + __pyx_t_4 = __pyx_v_idx; + __pyx_t_18 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_19 = __pyx_v_idx2; + __pyx_t_20 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":681 + * idx2 = rfa[j] + k + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] # <<<<<<<<<<<<<< + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) + */ + __pyx_t_20 = __pyx_v_idx; + __pyx_t_19 = 1; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + __pyx_t_18 = __pyx_v_idx2; + __pyx_t_4 = 1; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":682 + * dx = coor[idx,0] - coor[idx2,0] + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] # <<<<<<<<<<<<<< + * r = sqrt(dx*dx + dy*dy + dz*dz) + * if ds[j-1] > maxshell: + */ + __pyx_t_4 = __pyx_v_idx; + __pyx_t_18 = 2; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; + __pyx_t_19 = __pyx_v_idx2; + __pyx_t_20 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":683 + * dy = coor[idx,1] - coor[idx2,1] + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) # <<<<<<<<<<<<<< + * if ds[j-1] > maxshell: + * epa[i,maxshell] += charges[idx] * charges[idx2] / r + */ + __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); + + /* "newanalysis/helpers/helpers.pyx":684 + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) + * if ds[j-1] > maxshell: # <<<<<<<<<<<<<< + * epa[i,maxshell] += charges[idx] * charges[idx2] / r + * else: + */ + __pyx_t_20 = (__pyx_v_j - 1); + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds.shape[0]; + __pyx_t_14 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_20 * __pyx_v_ds.strides[0]) ))) > __pyx_v_maxshell); + if (__pyx_t_14) { + + /* "newanalysis/helpers/helpers.pyx":685 + * r = sqrt(dx*dx + dy*dy + dz*dz) + * if ds[j-1] > maxshell: + * epa[i,maxshell] += charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< + * else: + * epa[i,ds[j-1]-1] += charges[idx] * charges[idx2] / r + */ + __pyx_t_20 = __pyx_v_idx; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges.shape[0]; + __pyx_t_19 = __pyx_v_idx2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; + __pyx_t_21 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_20 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) )))); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 685, __pyx_L1_error) + } + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = __pyx_v_maxshell; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_epa.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_epa.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_19 * __pyx_v_epa.strides[0]) ) + __pyx_t_20 * __pyx_v_epa.strides[1]) )) += (__pyx_t_21 / __pyx_v_r); + + /* "newanalysis/helpers/helpers.pyx":684 + * dz = coor[idx,2] - coor[idx2,2] + * r = sqrt(dx*dx + dy*dy + dz*dz) + * if ds[j-1] > maxshell: # <<<<<<<<<<<<<< + * epa[i,maxshell] += charges[idx] * charges[idx2] / r + * else: + */ + goto __pyx_L10; + } + + /* "newanalysis/helpers/helpers.pyx":687 + * epa[i,maxshell] += charges[idx] * charges[idx2] / r + * else: + * epa[i,ds[j-1]-1] += charges[idx] * charges[idx2] / r # <<<<<<<<<<<<<< * + * return np.asarray(epa)[:,:] * 1390.02 */ - __pyx_t_1 = __pyx_v_self->view.readonly; - __pyx_v_info->readonly = __pyx_t_1; + /*else*/ { + __pyx_t_20 = __pyx_v_idx; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_charges.shape[0]; + __pyx_t_19 = __pyx_v_idx2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_charges.shape[0]; + __pyx_t_21 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_20 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_19 * __pyx_v_charges.strides[0]) )))); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 687, __pyx_L1_error) + } + __pyx_t_19 = (__pyx_v_j - 1); + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds.shape[0]; + __pyx_t_20 = __pyx_v_i; + __pyx_t_18 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_19 * __pyx_v_ds.strides[0]) ))) - 1); + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_epa.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_epa.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_epa.data + __pyx_t_20 * __pyx_v_epa.strides[0]) ) + __pyx_t_18 * __pyx_v_epa.strides[1]) )) += (__pyx_t_21 / __pyx_v_r); + } + __pyx_L10:; + } + __pyx_L5_continue:; + } + } - /* "View.MemoryView":549 - * info.len = self.view.len - * info.readonly = self.view.readonly - * info.obj = self # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":689 + * epa[i,ds[j-1]-1] += charges[idx] * charges[idx2] / r + * + * return np.asarray(epa)[:,:] * 1390.02 # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") + * @cython.boundscheck(False) */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_epa, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_tuple__12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_float_1390_02); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":520 + /* "newanalysis/helpers/helpers.pyx":658 * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAtomicVoro(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, char [:] ds, int maxshell): + * """ */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAtomicVoro", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_epa, 1); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":555 +/* "newanalysis/helpers/helpers.pyx":691 + * return np.asarray(epa)[:,:] * 1390.02 * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAASep(np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, + * np.ndarray[np.float64_t,ndim=1] charges, */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; +static PyObject *__pyx_pw_11newanalysis_7helpers_39calcEnergyAASep(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_38calcEnergyAASep, "\n Calculates the solvation energy of a solute in an ionic liquid for a given frame.\n\n The data is returned in three decompositions:\n -) Voronoi shell-resolved\n\n -) x/y/z axis-resolved\n\n -) octant-resolved for the first shell\n\n :Example:\n\n energy, energy_xyz, energy_octant = calcEnergyAA(xyz, charges, atoms_per_residue, residue_first_atom, ds, octants, isolute, nmolecules, cat_first, cat_last, an_first, an_last, octants=None)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_39calcEnergyAASep = {"calcEnergyAASep", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_39calcEnergyAASep, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_38calcEnergyAASep}; +static PyObject *__pyx_pw_11newanalysis_7helpers_39calcEnergyAASep(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_xyz = 0; + PyArrayObject *__pyx_v_charges = 0; + PyArrayObject *__pyx_v_atoms_per_residue = 0; + PyArrayObject *__pyx_v_residue_first_atom = 0; + PyArrayObject *__pyx_v_ds = 0; + PyObject *__pyx_v_isolute = 0; + PyObject *__pyx_v_nmolecules = 0; + PyObject *__pyx_v_cat_first = 0; + PyObject *__pyx_v_cat_last = 0; + PyObject *__pyx_v_an_first = 0; + PyObject *__pyx_v_an_last = 0; + PyArrayObject *__pyx_v_octants = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":556 - * @property - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< - * transpose_memslice(&result.from_slice) - * return result - */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 556, __pyx_L1_error) - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "View.MemoryView":557 - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 557, __pyx_L1_error) + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcEnergyAASep (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 691, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_charges,&__pyx_n_s_atoms_per_residue,&__pyx_n_s_residue_first_atom,&__pyx_n_s_ds,&__pyx_n_s_isolute,&__pyx_n_s_nmolecules,&__pyx_n_s_cat_first,&__pyx_n_s_cat_last,&__pyx_n_s_an_first,&__pyx_n_s_an_last,&__pyx_n_s_octants,0}; - /* "View.MemoryView":558 - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - * return result # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/helpers.pyx":698 + * np.ndarray[np.int32_t,ndim=2,mode="c"] ds, + * isolute, nmolecules, cat_first, cat_last, an_first, an_last, + * np.ndarray[np.int32_t, ndim=1] octants=None): # <<<<<<<<<<<<<< + * """ + * Calculates the solvation energy of a solute in an ionic liquid for a given frame. */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + values[11] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((PyArrayObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + CYTHON_FALLTHROUGH; + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 1); __PYX_ERR(0, 691, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_atoms_per_residue)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 2); __PYX_ERR(0, 691, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_residue_first_atom)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 3); __PYX_ERR(0, 691, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 4); __PYX_ERR(0, 691, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 5); __PYX_ERR(0, 691, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmolecules)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 6); __PYX_ERR(0, 691, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cat_first)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 7); __PYX_ERR(0, 691, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cat_last)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 8); __PYX_ERR(0, 691, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (likely((values[9] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_an_first)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[9]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 9); __PYX_ERR(0, 691, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 10: + if (likely((values[10] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_an_last)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[10]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, 10); __PYX_ERR(0, 691, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 11: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_octants); + if (value) { values[11] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcEnergyAASep") < 0)) __PYX_ERR(0, 691, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_xyz = ((PyArrayObject *)values[0]); + __pyx_v_charges = ((PyArrayObject *)values[1]); + __pyx_v_atoms_per_residue = ((PyArrayObject *)values[2]); + __pyx_v_residue_first_atom = ((PyArrayObject *)values[3]); + __pyx_v_ds = ((PyArrayObject *)values[4]); + __pyx_v_isolute = values[5]; + __pyx_v_nmolecules = values[6]; + __pyx_v_cat_first = values[7]; + __pyx_v_cat_last = values[8]; + __pyx_v_an_first = values[9]; + __pyx_v_an_last = values[10]; + __pyx_v_octants = ((PyArrayObject *)values[11]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcEnergyAASep", 0, 11, 12, __pyx_nargs); __PYX_ERR(0, 691, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAASep", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 692, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_charges), __pyx_ptype_5numpy_ndarray, 1, "charges", 0))) __PYX_ERR(0, 693, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_atoms_per_residue), __pyx_ptype_5numpy_ndarray, 1, "atoms_per_residue", 0))) __PYX_ERR(0, 694, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_residue_first_atom), __pyx_ptype_5numpy_ndarray, 1, "residue_first_atom", 0))) __PYX_ERR(0, 695, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ds), __pyx_ptype_5numpy_ndarray, 1, "ds", 0))) __PYX_ERR(0, 696, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_octants), __pyx_ptype_5numpy_ndarray, 1, "octants", 0))) __PYX_ERR(0, 698, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_7helpers_38calcEnergyAASep(__pyx_self, __pyx_v_xyz, __pyx_v_charges, __pyx_v_atoms_per_residue, __pyx_v_residue_first_atom, __pyx_v_ds, __pyx_v_isolute, __pyx_v_nmolecules, __pyx_v_cat_first, __pyx_v_cat_last, __pyx_v_an_first, __pyx_v_an_last, __pyx_v_octants); - /* "View.MemoryView":555 + /* "newanalysis/helpers/helpers.pyx":691 + * return np.asarray(epa)[:,:] * 1390.02 * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAASep(np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, + * np.ndarray[np.float64_t,ndim=1] charges, */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { +static PyObject *__pyx_pf_11newanalysis_7helpers_38calcEnergyAASep(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_charges, PyArrayObject *__pyx_v_atoms_per_residue, PyArrayObject *__pyx_v_residue_first_atom, PyArrayObject *__pyx_v_ds, PyObject *__pyx_v_isolute, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_cat_first, PyObject *__pyx_v_cat_last, PyObject *__pyx_v_an_first, PyObject *__pyx_v_an_last, PyArrayObject *__pyx_v_octants) { + double *__pyx_v_cxyz; + double *__pyx_v_q; + int *__pyx_v_apr; + int *__pyx_v_rfa; + int *__pyx_v_coct; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_idx; + int __pyx_v_idx2; + int __pyx_v_idx3; + int __pyx_v_nmol; + int __pyx_v_islt; + PyArrayObject *__pyx_v_energy_per_atom = 0; + double *__pyx_v_epa; + PyArrayObject *__pyx_v_energy_xyz_per_atom = 0; + double *__pyx_v_epa_xyz; + PyArrayObject *__pyx_v_energy_octant_per_atom = 0; + double *__pyx_v_epa_oct; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_r; + double __pyx_v_qqr; + int __pyx_v_c1; + int __pyx_v_c2; + int __pyx_v_a1; + int __pyx_v_a2; + int *__pyx_v_cds; + PyArrayObject *__pyx_v_energy = 0; + PyArrayObject *__pyx_v_energy_xyz = 0; + PyArrayObject *__pyx_v_energy_octant = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_atoms_per_residue; + __Pyx_Buffer __pyx_pybuffer_atoms_per_residue; + __Pyx_LocalBuf_ND __pyx_pybuffernd_charges; + __Pyx_Buffer __pyx_pybuffer_charges; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ds; + __Pyx_Buffer __pyx_pybuffer_ds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_energy; + __Pyx_Buffer __pyx_pybuffer_energy; + __Pyx_LocalBuf_ND __pyx_pybuffernd_energy_octant; + __Pyx_Buffer __pyx_pybuffer_energy_octant; + __Pyx_LocalBuf_ND __pyx_pybuffernd_energy_octant_per_atom; + __Pyx_Buffer __pyx_pybuffer_energy_octant_per_atom; + __Pyx_LocalBuf_ND __pyx_pybuffernd_energy_per_atom; + __Pyx_Buffer __pyx_pybuffer_energy_per_atom; + __Pyx_LocalBuf_ND __pyx_pybuffernd_energy_xyz; + __Pyx_Buffer __pyx_pybuffer_energy_xyz; + __Pyx_LocalBuf_ND __pyx_pybuffernd_energy_xyz_per_atom; + __Pyx_Buffer __pyx_pybuffer_energy_xyz_per_atom; + __Pyx_LocalBuf_ND __pyx_pybuffernd_octants; + __Pyx_Buffer __pyx_pybuffer_octants; + __Pyx_LocalBuf_ND __pyx_pybuffernd_residue_first_atom; + __Pyx_Buffer __pyx_pybuffer_residue_first_atom; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; + __Pyx_Buffer __pyx_pybuffer_xyz; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + PyArrayObject *__pyx_t_14 = NULL; + int __pyx_t_15; + int __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + double __pyx_t_23; + long __pyx_t_24; + double __pyx_t_25; + int __pyx_t_26; + Py_ssize_t __pyx_t_27; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcEnergyAASep", 0); + __pyx_pybuffer_energy_per_atom.pybuffer.buf = NULL; + __pyx_pybuffer_energy_per_atom.refcount = 0; + __pyx_pybuffernd_energy_per_atom.data = NULL; + __pyx_pybuffernd_energy_per_atom.rcbuffer = &__pyx_pybuffer_energy_per_atom; + __pyx_pybuffer_energy_xyz_per_atom.pybuffer.buf = NULL; + __pyx_pybuffer_energy_xyz_per_atom.refcount = 0; + __pyx_pybuffernd_energy_xyz_per_atom.data = NULL; + __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer = &__pyx_pybuffer_energy_xyz_per_atom; + __pyx_pybuffer_energy_octant_per_atom.pybuffer.buf = NULL; + __pyx_pybuffer_energy_octant_per_atom.refcount = 0; + __pyx_pybuffernd_energy_octant_per_atom.data = NULL; + __pyx_pybuffernd_energy_octant_per_atom.rcbuffer = &__pyx_pybuffer_energy_octant_per_atom; + __pyx_pybuffer_energy.pybuffer.buf = NULL; + __pyx_pybuffer_energy.refcount = 0; + __pyx_pybuffernd_energy.data = NULL; + __pyx_pybuffernd_energy.rcbuffer = &__pyx_pybuffer_energy; + __pyx_pybuffer_energy_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_energy_xyz.refcount = 0; + __pyx_pybuffernd_energy_xyz.data = NULL; + __pyx_pybuffernd_energy_xyz.rcbuffer = &__pyx_pybuffer_energy_xyz; + __pyx_pybuffer_energy_octant.pybuffer.buf = NULL; + __pyx_pybuffer_energy_octant.refcount = 0; + __pyx_pybuffernd_energy_octant.data = NULL; + __pyx_pybuffernd_energy_octant.rcbuffer = &__pyx_pybuffer_energy_octant; + __pyx_pybuffer_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_xyz.refcount = 0; + __pyx_pybuffernd_xyz.data = NULL; + __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; + __pyx_pybuffer_charges.pybuffer.buf = NULL; + __pyx_pybuffer_charges.refcount = 0; + __pyx_pybuffernd_charges.data = NULL; + __pyx_pybuffernd_charges.rcbuffer = &__pyx_pybuffer_charges; + __pyx_pybuffer_atoms_per_residue.pybuffer.buf = NULL; + __pyx_pybuffer_atoms_per_residue.refcount = 0; + __pyx_pybuffernd_atoms_per_residue.data = NULL; + __pyx_pybuffernd_atoms_per_residue.rcbuffer = &__pyx_pybuffer_atoms_per_residue; + __pyx_pybuffer_residue_first_atom.pybuffer.buf = NULL; + __pyx_pybuffer_residue_first_atom.refcount = 0; + __pyx_pybuffernd_residue_first_atom.data = NULL; + __pyx_pybuffernd_residue_first_atom.rcbuffer = &__pyx_pybuffer_residue_first_atom; + __pyx_pybuffer_ds.pybuffer.buf = NULL; + __pyx_pybuffer_ds.refcount = 0; + __pyx_pybuffernd_ds.data = NULL; + __pyx_pybuffernd_ds.rcbuffer = &__pyx_pybuffer_ds; + __pyx_pybuffer_octants.pybuffer.buf = NULL; + __pyx_pybuffer_octants.refcount = 0; + __pyx_pybuffernd_octants.data = NULL; + __pyx_pybuffernd_octants.rcbuffer = &__pyx_pybuffer_octants; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 691, __pyx_L1_error) + } + __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_charges.rcbuffer->pybuffer, (PyObject*)__pyx_v_charges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 691, __pyx_L1_error) + } + __pyx_pybuffernd_charges.diminfo[0].strides = __pyx_pybuffernd_charges.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_charges.diminfo[0].shape = __pyx_pybuffernd_charges.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer, (PyObject*)__pyx_v_atoms_per_residue, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 691, __pyx_L1_error) + } + __pyx_pybuffernd_atoms_per_residue.diminfo[0].strides = __pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_atoms_per_residue.diminfo[0].shape = __pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer, (PyObject*)__pyx_v_residue_first_atom, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 691, __pyx_L1_error) + } + __pyx_pybuffernd_residue_first_atom.diminfo[0].strides = __pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_residue_first_atom.diminfo[0].shape = __pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ds.rcbuffer->pybuffer, (PyObject*)__pyx_v_ds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 691, __pyx_L1_error) + } + __pyx_pybuffernd_ds.diminfo[0].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ds.diminfo[0].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ds.diminfo[1].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ds.diminfo[1].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_octants.rcbuffer->pybuffer, (PyObject*)__pyx_v_octants, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 691, __pyx_L1_error) + } + __pyx_pybuffernd_octants.diminfo[0].strides = __pyx_pybuffernd_octants.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_octants.diminfo[0].shape = __pyx_pybuffernd_octants.rcbuffer->pybuffer.shape[0]; - /* "View.MemoryView":562 - * @property - * def base(self): - * return self.obj # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":716 + * """ * - * @property + * cdef double *cxyz = xyz.data # <<<<<<<<<<<<<< + * cdef double *q = charges.data + * cdef int* apr = atoms_per_residue.data */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->obj); - __pyx_r = __pyx_v_self->obj; - goto __pyx_L0; + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 716, __pyx_L1_error) + __pyx_v_cxyz = ((double *)__pyx_t_1); - /* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj + /* "newanalysis/helpers/helpers.pyx":717 * + * cdef double *cxyz = xyz.data + * cdef double *q = charges.data # <<<<<<<<<<<<<< + * cdef int* apr = atoms_per_residue.data + * cdef int* rfa = residue_first_atom.data */ + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_charges)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 717, __pyx_L1_error) + __pyx_v_q = ((double *)__pyx_t_1); - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":718 + * cdef double *cxyz = xyz.data + * cdef double *q = charges.data + * cdef int* apr = atoms_per_residue.data # <<<<<<<<<<<<<< + * cdef int* rfa = residue_first_atom.data + * cdef int* coct = NULL + */ + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_atoms_per_residue)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 718, __pyx_L1_error) + __pyx_v_apr = ((int *)__pyx_t_1); -/* "View.MemoryView":565 - * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - * + /* "newanalysis/helpers/helpers.pyx":719 + * cdef double *q = charges.data + * cdef int* apr = atoms_per_residue.data + * cdef int* rfa = residue_first_atom.data # <<<<<<<<<<<<<< + * cdef int* coct = NULL + * if octants!=None: */ + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_residue_first_atom)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 719, __pyx_L1_error) + __pyx_v_rfa = ((int *)__pyx_t_1); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "newanalysis/helpers/helpers.pyx":720 + * cdef int* apr = atoms_per_residue.data + * cdef int* rfa = residue_first_atom.data + * cdef int* coct = NULL # <<<<<<<<<<<<<< + * if octants!=None: + * coct = octants.data + */ + __pyx_v_coct = NULL; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":721 + * cdef int* rfa = residue_first_atom.data + * cdef int* coct = NULL + * if octants!=None: # <<<<<<<<<<<<<< + * coct = octants.data + * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute + */ + __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_octants), Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 721, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_length; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/helpers/helpers.pyx":722 + * cdef int* coct = NULL + * if octants!=None: + * coct = octants.data # <<<<<<<<<<<<<< + * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute + * cdef np.ndarray[np.float64_t,ndim=2] energy_per_atom = np.zeros((apr[islt],8),dtype=np.float64) + */ + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_octants)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 722, __pyx_L1_error) + __pyx_v_coct = ((int *)__pyx_t_1); - /* "View.MemoryView":566 - * @property - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/helpers.pyx":721 + * cdef int* rfa = residue_first_atom.data + * cdef int* coct = NULL + * if octants!=None: # <<<<<<<<<<<<<< + * coct = octants.data + * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_length = (__pyx_t_2[0]); - __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - /* "View.MemoryView":565 - * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - * + /* "newanalysis/helpers/helpers.pyx":723 + * if octants!=None: + * coct = octants.data + * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2] energy_per_atom = np.zeros((apr[islt],8),dtype=np.float64) + * cdef double* epa = energy_per_atom.data */ + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_v_nmol = ((int)__pyx_t_4); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_isolute); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_v_islt = ((int)__pyx_t_4); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":569 - * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: - * + /* "newanalysis/helpers/helpers.pyx":724 + * coct = octants.data + * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute + * cdef np.ndarray[np.float64_t,ndim=2] energy_per_atom = np.zeros((apr[islt],8),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double* epa = energy_per_atom.data + * cdef np.ndarray[np.float64_t,ndim=2] energy_xyz_per_atom = np.zeros((apr[islt],3),dtype=np.float64) */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_apr[__pyx_v_islt])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_8); + __Pyx_GIVEREF(__pyx_int_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_8)) __PYX_ERR(0, 724, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6)) __PYX_ERR(0, 724, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 724, __pyx_L1_error) + __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_energy_per_atom = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 724, __pyx_L1_error) + } else {__pyx_pybuffernd_energy_per_atom.diminfo[0].strides = __pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy_per_atom.diminfo[0].shape = __pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_energy_per_atom.diminfo[1].strides = __pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_energy_per_atom.diminfo[1].shape = __pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_9 = 0; + __pyx_v_energy_per_atom = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_stride; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< - * - * raise ValueError("Buffer view does not expose strides") + /* "newanalysis/helpers/helpers.pyx":725 + * cdef int i, j, k, idx, idx2, idx3, nmol=nmolecules, islt=isolute + * cdef np.ndarray[np.float64_t,ndim=2] energy_per_atom = np.zeros((apr[islt],8),dtype=np.float64) + * cdef double* epa = energy_per_atom.data # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2] energy_xyz_per_atom = np.zeros((apr[islt],3),dtype=np.float64) + * cdef double* epa_xyz = energy_xyz_per_atom.data */ - __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_energy_per_atom)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 725, __pyx_L1_error) + __pyx_v_epa = ((double *)__pyx_t_1); - /* "View.MemoryView":572 - * if self.view.strides == NULL: - * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + /* "newanalysis/helpers/helpers.pyx":726 + * cdef np.ndarray[np.float64_t,ndim=2] energy_per_atom = np.zeros((apr[islt],8),dtype=np.float64) + * cdef double* epa = energy_per_atom.data + * cdef np.ndarray[np.float64_t,ndim=2] energy_xyz_per_atom = np.zeros((apr[islt],3),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double* epa_xyz = energy_xyz_per_atom.data + * cdef np.ndarray[np.float64_t,ndim=2] energy_octant_per_atom = np.zeros((apr[islt],8),dtype=np.float64) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 572, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_int((__pyx_v_apr[__pyx_v_islt])); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8)) __PYX_ERR(0, 726, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_3)) __PYX_ERR(0, 726, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 726, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 726, __pyx_L1_error) + __pyx_t_10 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_energy_xyz_per_atom = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 726, __pyx_L1_error) + } else {__pyx_pybuffernd_energy_xyz_per_atom.diminfo[0].strides = __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy_xyz_per_atom.diminfo[0].shape = __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_energy_xyz_per_atom.diminfo[1].strides = __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_energy_xyz_per_atom.diminfo[1].shape = __pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_10 = 0; + __pyx_v_energy_xyz_per_atom = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< - * - * raise ValueError("Buffer view does not expose strides") + /* "newanalysis/helpers/helpers.pyx":727 + * cdef double* epa = energy_per_atom.data + * cdef np.ndarray[np.float64_t,ndim=2] energy_xyz_per_atom = np.zeros((apr[islt],3),dtype=np.float64) + * cdef double* epa_xyz = energy_xyz_per_atom.data # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2] energy_octant_per_atom = np.zeros((apr[islt],8),dtype=np.float64) + * cdef double* epa_oct = energy_octant_per_atom.data */ - } + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_energy_xyz_per_atom)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 727, __pyx_L1_error) + __pyx_v_epa_xyz = ((double *)__pyx_t_1); - /* "View.MemoryView":574 - * raise ValueError("Buffer view does not expose strides") - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/helpers.pyx":728 + * cdef np.ndarray[np.float64_t,ndim=2] energy_xyz_per_atom = np.zeros((apr[islt],3),dtype=np.float64) + * cdef double* epa_xyz = energy_xyz_per_atom.data + * cdef np.ndarray[np.float64_t,ndim=2] energy_octant_per_atom = np.zeros((apr[islt],8),dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double* epa_oct = energy_octant_per_atom.data + * cdef double dx, dy, dz, r, qqr */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 728, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_v_stride = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyInt_From_int((__pyx_v_apr[__pyx_v_islt])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7)) __PYX_ERR(0, 728, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_8); + __Pyx_GIVEREF(__pyx_int_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_int_8)) __PYX_ERR(0, 728, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8)) __PYX_ERR(0, 728, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 728, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 728, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 728, __pyx_L1_error) + __pyx_t_11 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_energy_octant_per_atom = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 728, __pyx_L1_error) + } else {__pyx_pybuffernd_energy_octant_per_atom.diminfo[0].strides = __pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy_octant_per_atom.diminfo[0].shape = __pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_energy_octant_per_atom.diminfo[1].strides = __pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_energy_octant_per_atom.diminfo[1].shape = __pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_11 = 0; + __pyx_v_energy_octant_per_atom = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; - /* "View.MemoryView":569 - * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: - * + /* "newanalysis/helpers/helpers.pyx":729 + * cdef double* epa_xyz = energy_xyz_per_atom.data + * cdef np.ndarray[np.float64_t,ndim=2] energy_octant_per_atom = np.zeros((apr[islt],8),dtype=np.float64) + * cdef double* epa_oct = energy_octant_per_atom.data # <<<<<<<<<<<<<< + * cdef double dx, dy, dz, r, qqr + * cdef int x, y, z, idx4, c1=cat_first, c2=cat_last, a1=an_first, a2=an_last */ + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_energy_octant_per_atom)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 729, __pyx_L1_error) + __pyx_v_epa_oct = ((double *)__pyx_t_1); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":577 - * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + /* "newanalysis/helpers/helpers.pyx":731 + * cdef double* epa_oct = energy_octant_per_atom.data + * cdef double dx, dy, dz, r, qqr + * cdef int x, y, z, idx4, c1=cat_first, c2=cat_last, a1=an_first, a2=an_last # <<<<<<<<<<<<<< + * cdef int *cds = ds.data + * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) */ + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_cat_first); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 731, __pyx_L1_error) + __pyx_v_c1 = __pyx_t_4; + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_cat_last); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 731, __pyx_L1_error) + __pyx_v_c2 = __pyx_t_4; + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_an_first); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 731, __pyx_L1_error) + __pyx_v_a1 = __pyx_t_4; + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_an_last); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 731, __pyx_L1_error) + __pyx_v_a2 = __pyx_t_4; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - Py_ssize_t *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim - * + /* "newanalysis/helpers/helpers.pyx":732 + * cdef double dx, dy, dz, r, qqr + * cdef int x, y, z, idx4, c1=cat_first, c2=cat_last, a1=an_first, a2=an_last + * cdef int *cds = ds.data # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) */ - __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ds)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 732, __pyx_L1_error) + __pyx_v_cds = ((int *)__pyx_t_1); - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + /* "newanalysis/helpers/helpers.pyx":733 + * cdef int x, y, z, idx4, c1=cat_first, c2=cat_last, a1=an_first, a2=an_last + * cdef int *cds = ds.data + * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=1] energy_octant = np.zeros(8,dtype=np.float64) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__20, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__13, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 733, __pyx_L1_error) + __pyx_t_12 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_energy = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 733, __pyx_L1_error) + } else {__pyx_pybuffernd_energy.diminfo[0].strides = __pyx_pybuffernd_energy.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy.diminfo[0].shape = __pyx_pybuffernd_energy.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_12 = 0; + __pyx_v_energy = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim + /* "newanalysis/helpers/helpers.pyx":734 + * cdef int *cds = ds.data + * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] energy_octant = np.zeros(8,dtype=np.float64) * */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 734, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 734, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 734, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 734, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__14, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 734, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 734, __pyx_L1_error) + __pyx_t_13 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_energy_xyz = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 734, __pyx_L1_error) + } else {__pyx_pybuffernd_energy_xyz.diminfo[0].strides = __pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy_xyz.diminfo[0].shape = __pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer.shape[0]; + } } + __pyx_t_13 = 0; + __pyx_v_energy_xyz = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":581 - * return (-1,) * self.view.ndim - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":735 + * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=1] energy_octant = np.zeros(8,dtype=np.float64) # <<<<<<<<<<<<<< * - * @property + * # for i in prange(apr[islt],nogil=True): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); - for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) { - __pyx_t_4 = __pyx_t_6; - __pyx_v_suboffset = (__pyx_t_4[0]); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__13, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 735, __pyx_L1_error) + __pyx_t_14 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_energy_octant.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_energy_octant = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_energy_octant.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 735, __pyx_L1_error) + } else {__pyx_pybuffernd_energy_octant.diminfo[0].strides = __pyx_pybuffernd_energy_octant.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_energy_octant.diminfo[0].shape = __pyx_pybuffernd_energy_octant.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_14 = 0; + __pyx_v_energy_octant = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; - /* "View.MemoryView":577 + /* "newanalysis/helpers/helpers.pyx":738 * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + * # for i in prange(apr[islt],nogil=True): + * for i in range(apr[islt]): # <<<<<<<<<<<<<< + * idx=rfa[islt]+i + * # cations */ + __pyx_t_4 = (__pyx_v_apr[__pyx_v_islt]); + __pyx_t_15 = __pyx_t_4; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_i = __pyx_t_16; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":584 - * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim - * + /* "newanalysis/helpers/helpers.pyx":739 + * # for i in prange(apr[islt],nogil=True): + * for i in range(apr[islt]): + * idx=rfa[islt]+i # <<<<<<<<<<<<<< + * # cations + * for j in range(c1,c2+1): */ + __pyx_v_idx = ((__pyx_v_rfa[__pyx_v_islt]) + __pyx_v_i); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "newanalysis/helpers/helpers.pyx":741 + * idx=rfa[islt]+i + * # cations + * for j in range(c1,c2+1): # <<<<<<<<<<<<<< + * idx3=cds[islt*nmol+j]-1 + * for k in range(apr[j]): + */ + __pyx_t_17 = (__pyx_v_c2 + 1); + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = __pyx_v_c1; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":742 + * # cations + * for j in range(c1,c2+1): + * idx3=cds[islt*nmol+j]-1 # <<<<<<<<<<<<<< + * for k in range(apr[j]): + * idx2=rfa[j]+k + */ + __pyx_v_idx3 = ((__pyx_v_cds[((__pyx_v_islt * __pyx_v_nmol) + __pyx_v_j)]) - 1); -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/helpers/helpers.pyx":743 + * for j in range(c1,c2+1): + * idx3=cds[islt*nmol+j]-1 + * for k in range(apr[j]): # <<<<<<<<<<<<<< + * idx2=rfa[j]+k + * dx=cxyz[idx*3]-cxyz[idx2*3] + */ + __pyx_t_20 = (__pyx_v_apr[__pyx_v_j]); + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_k = __pyx_t_22; - /* "View.MemoryView":585 - * @property - * def ndim(self): - * return self.view.ndim # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/helpers.pyx":744 + * idx3=cds[islt*nmol+j]-1 + * for k in range(apr[j]): + * idx2=rfa[j]+k # <<<<<<<<<<<<<< + * dx=cxyz[idx*3]-cxyz[idx2*3] + * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 585, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_idx2 = ((__pyx_v_rfa[__pyx_v_j]) + __pyx_v_k); - /* "View.MemoryView":584 - * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim - * + /* "newanalysis/helpers/helpers.pyx":745 + * for k in range(apr[j]): + * idx2=rfa[j]+k + * dx=cxyz[idx*3]-cxyz[idx2*3] # <<<<<<<<<<<<<< + * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] + * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] */ + __pyx_v_dx = ((__pyx_v_cxyz[(__pyx_v_idx * 3)]) - (__pyx_v_cxyz[(__pyx_v_idx2 * 3)])); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":746 + * idx2=rfa[j]+k + * dx=cxyz[idx*3]-cxyz[idx2*3] + * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] # <<<<<<<<<<<<<< + * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] + * r=sqrt(dx*dx+dy*dy+dz*dz) + */ + __pyx_v_dy = ((__pyx_v_cxyz[((__pyx_v_idx * 3) + 1)]) - (__pyx_v_cxyz[((__pyx_v_idx2 * 3) + 1)])); -/* "View.MemoryView":588 - * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize - * + /* "newanalysis/helpers/helpers.pyx":747 + * dx=cxyz[idx*3]-cxyz[idx2*3] + * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] + * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] # <<<<<<<<<<<<<< + * r=sqrt(dx*dx+dy*dy+dz*dz) + * qqr=q[idx]*q[idx2]/r */ + __pyx_v_dz = ((__pyx_v_cxyz[((__pyx_v_idx * 3) + 2)]) - (__pyx_v_cxyz[((__pyx_v_idx2 * 3) + 2)])); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "newanalysis/helpers/helpers.pyx":748 + * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] + * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] + * r=sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< + * qqr=q[idx]*q[idx2]/r + * epa[i*8+idx3]+=qqr + */ + __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":749 + * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] + * r=sqrt(dx*dx+dy*dy+dz*dz) + * qqr=q[idx]*q[idx2]/r # <<<<<<<<<<<<<< + * epa[i*8+idx3]+=qqr + * epa_xyz[i*3]+=qqr*dx*dx/(r*r) + */ + __pyx_t_23 = ((__pyx_v_q[__pyx_v_idx]) * (__pyx_v_q[__pyx_v_idx2])); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 749, __pyx_L1_error) + } + __pyx_v_qqr = (__pyx_t_23 / __pyx_v_r); -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/helpers/helpers.pyx":750 + * r=sqrt(dx*dx+dy*dy+dz*dz) + * qqr=q[idx]*q[idx2]/r + * epa[i*8+idx3]+=qqr # <<<<<<<<<<<<<< + * epa_xyz[i*3]+=qqr*dx*dx/(r*r) + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) + */ + __pyx_t_24 = ((__pyx_v_i * 8) + __pyx_v_idx3); + (__pyx_v_epa[__pyx_t_24]) = ((__pyx_v_epa[__pyx_t_24]) + __pyx_v_qqr); - /* "View.MemoryView":589 - * @property - * def itemsize(self): - * return self.view.itemsize # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/helpers.pyx":751 + * qqr=q[idx]*q[idx2]/r + * epa[i*8+idx3]+=qqr + * epa_xyz[i*3]+=qqr*dx*dx/(r*r) # <<<<<<<<<<<<<< + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_24 = (__pyx_v_i * 3); + __pyx_t_23 = ((__pyx_v_qqr * __pyx_v_dx) * __pyx_v_dx); + __pyx_t_25 = (__pyx_v_r * __pyx_v_r); + if (unlikely(__pyx_t_25 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 751, __pyx_L1_error) + } + (__pyx_v_epa_xyz[__pyx_t_24]) = ((__pyx_v_epa_xyz[__pyx_t_24]) + (__pyx_t_23 / __pyx_t_25)); - /* "View.MemoryView":588 - * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize - * + /* "newanalysis/helpers/helpers.pyx":752 + * epa[i*8+idx3]+=qqr + * epa_xyz[i*3]+=qqr*dx*dx/(r*r) + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) # <<<<<<<<<<<<<< + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) + * if idx3 == 0 and coct != NULL: */ + __pyx_t_24 = ((__pyx_v_i * 3) + 1); + __pyx_t_25 = ((__pyx_v_qqr * __pyx_v_dy) * __pyx_v_dy); + __pyx_t_23 = (__pyx_v_r * __pyx_v_r); + if (unlikely(__pyx_t_23 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 752, __pyx_L1_error) + } + (__pyx_v_epa_xyz[__pyx_t_24]) = ((__pyx_v_epa_xyz[__pyx_t_24]) + (__pyx_t_25 / __pyx_t_23)); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":592 - * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize - * + /* "newanalysis/helpers/helpers.pyx":753 + * epa_xyz[i*3]+=qqr*dx*dx/(r*r) + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) # <<<<<<<<<<<<<< + * if idx3 == 0 and coct != NULL: + * epa_oct[i*8+coct[j]]+=qqr */ + __pyx_t_24 = ((__pyx_v_i * 3) + 2); + __pyx_t_23 = ((__pyx_v_qqr * __pyx_v_dz) * __pyx_v_dz); + __pyx_t_25 = (__pyx_v_r * __pyx_v_r); + if (unlikely(__pyx_t_25 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 753, __pyx_L1_error) + } + (__pyx_v_epa_xyz[__pyx_t_24]) = ((__pyx_v_epa_xyz[__pyx_t_24]) + (__pyx_t_23 / __pyx_t_25)); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":593 - * @property - * def nbytes(self): - * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":754 + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) + * if idx3 == 0 and coct != NULL: # <<<<<<<<<<<<<< + * epa_oct[i*8+coct[j]]+=qqr * - * @property */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_26 = (__pyx_v_idx3 == 0); + if (__pyx_t_26) { + } else { + __pyx_t_3 = __pyx_t_26; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_26 = (__pyx_v_coct != NULL); + __pyx_t_3 = __pyx_t_26; + __pyx_L11_bool_binop_done:; + if (__pyx_t_3) { - /* "View.MemoryView":592 - * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize + /* "newanalysis/helpers/helpers.pyx":755 + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) + * if idx3 == 0 and coct != NULL: + * epa_oct[i*8+coct[j]]+=qqr # <<<<<<<<<<<<<< * + * # anions */ + __pyx_t_24 = ((__pyx_v_i * 8) + (__pyx_v_coct[__pyx_v_j])); + (__pyx_v_epa_oct[__pyx_t_24]) = ((__pyx_v_epa_oct[__pyx_t_24]) + __pyx_v_qqr); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":596 + /* "newanalysis/helpers/helpers.pyx":754 + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) + * if idx3 == 0 and coct != NULL: # <<<<<<<<<<<<<< + * epa_oct[i*8+coct[j]]+=qqr * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 */ + } + } + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 + /* "newanalysis/helpers/helpers.pyx":758 * + * # anions + * for j in range(a1,a2+1): # <<<<<<<<<<<<<< + * idx3=cds[islt*nmol+j]-1 + * for k in range(apr[j]): */ - __pyx_t_1 = (__pyx_v_self->_size == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_17 = (__pyx_v_a2 + 1); + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = __pyx_v_a1; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; - /* "View.MemoryView":598 - * def size(self): - * if self._size is None: - * result = 1 # <<<<<<<<<<<<<< - * - * for length in self.view.shape[:self.view.ndim]: + /* "newanalysis/helpers/helpers.pyx":759 + * # anions + * for j in range(a1,a2+1): + * idx3=cds[islt*nmol+j]-1 # <<<<<<<<<<<<<< + * for k in range(apr[j]): + * idx2=rfa[j]+k */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_result = __pyx_int_1; + __pyx_v_idx3 = ((__pyx_v_cds[((__pyx_v_islt * __pyx_v_nmol) + __pyx_v_j)]) - 1); - /* "View.MemoryView":600 - * result = 1 - * - * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< - * result *= length - * + /* "newanalysis/helpers/helpers.pyx":760 + * for j in range(a1,a2+1): + * idx3=cds[islt*nmol+j]-1 + * for k in range(apr[j]): # <<<<<<<<<<<<<< + * idx2=rfa[j]+k + * dx=cxyz[idx*3]-cxyz[idx2*3] */ - __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_20 = (__pyx_v_apr[__pyx_v_j]); + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_k = __pyx_t_22; - /* "View.MemoryView":601 - * - * for length in self.view.shape[:self.view.ndim]: - * result *= length # <<<<<<<<<<<<<< - * - * self._size = result + /* "newanalysis/helpers/helpers.pyx":761 + * idx3=cds[islt*nmol+j]-1 + * for k in range(apr[j]): + * idx2=rfa[j]+k # <<<<<<<<<<<<<< + * dx=cxyz[idx*3]-cxyz[idx2*3] + * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] */ - __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 601, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6); - __pyx_t_6 = 0; - } + __pyx_v_idx2 = ((__pyx_v_rfa[__pyx_v_j]) + __pyx_v_k); - /* "View.MemoryView":603 - * result *= length - * - * self._size = result # <<<<<<<<<<<<<< - * - * return self._size + /* "newanalysis/helpers/helpers.pyx":762 + * for k in range(apr[j]): + * idx2=rfa[j]+k + * dx=cxyz[idx*3]-cxyz[idx2*3] # <<<<<<<<<<<<<< + * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] + * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] */ - __Pyx_INCREF(__pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - __Pyx_GOTREF(__pyx_v_self->_size); - __Pyx_DECREF(__pyx_v_self->_size); - __pyx_v_self->_size = __pyx_v_result; + __pyx_v_dx = ((__pyx_v_cxyz[(__pyx_v_idx * 3)]) - (__pyx_v_cxyz[(__pyx_v_idx2 * 3)])); - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 - * + /* "newanalysis/helpers/helpers.pyx":763 + * idx2=rfa[j]+k + * dx=cxyz[idx*3]-cxyz[idx2*3] + * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] # <<<<<<<<<<<<<< + * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] + * r=sqrt(dx*dx+dy*dy+dz*dz) */ - } + __pyx_v_dy = ((__pyx_v_cxyz[((__pyx_v_idx * 3) + 1)]) - (__pyx_v_cxyz[((__pyx_v_idx2 * 3) + 1)])); - /* "View.MemoryView":605 - * self._size = result - * - * return self._size # <<<<<<<<<<<<<< - * - * def __len__(self): + /* "newanalysis/helpers/helpers.pyx":764 + * dx=cxyz[idx*3]-cxyz[idx2*3] + * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] + * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] # <<<<<<<<<<<<<< + * r=sqrt(dx*dx+dy*dy+dz*dz) + * qqr=q[idx]*q[idx2]/r */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_size); - __pyx_r = __pyx_v_self->_size; - goto __pyx_L0; + __pyx_v_dz = ((__pyx_v_cxyz[((__pyx_v_idx * 3) + 2)]) - (__pyx_v_cxyz[((__pyx_v_idx2 * 3) + 2)])); - /* "View.MemoryView":596 - * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 + /* "newanalysis/helpers/helpers.pyx":765 + * dy=cxyz[idx*3+1]-cxyz[idx2*3+1] + * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] + * r=sqrt(dx*dx+dy*dy+dz*dz) # <<<<<<<<<<<<<< + * qqr=q[idx]*q[idx2]/r + * epa[i*8+4+idx3]+=qqr */ + __pyx_v_r = sqrt((((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz))); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":766 + * dz=cxyz[idx*3+2]-cxyz[idx2*3+2] + * r=sqrt(dx*dx+dy*dy+dz*dz) + * qqr=q[idx]*q[idx2]/r # <<<<<<<<<<<<<< + * epa[i*8+4+idx3]+=qqr + * epa_xyz[i*3]+=qqr*dx*dx/(r*r) + */ + __pyx_t_25 = ((__pyx_v_q[__pyx_v_idx]) * (__pyx_v_q[__pyx_v_idx2])); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 766, __pyx_L1_error) + } + __pyx_v_qqr = (__pyx_t_25 / __pyx_v_r); -/* "View.MemoryView":607 - * return self._size - * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + /* "newanalysis/helpers/helpers.pyx":767 + * r=sqrt(dx*dx+dy*dy+dz*dz) + * qqr=q[idx]*q[idx2]/r + * epa[i*8+4+idx3]+=qqr # <<<<<<<<<<<<<< + * epa_xyz[i*3]+=qqr*dx*dx/(r*r) + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) */ + __pyx_t_24 = (((__pyx_v_i * 8) + 4) + __pyx_v_idx3); + (__pyx_v_epa[__pyx_t_24]) = ((__pyx_v_epa[__pyx_t_24]) + __pyx_v_qqr); -/* Python wrapper */ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "newanalysis/helpers/helpers.pyx":768 + * qqr=q[idx]*q[idx2]/r + * epa[i*8+4+idx3]+=qqr + * epa_xyz[i*3]+=qqr*dx*dx/(r*r) # <<<<<<<<<<<<<< + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) + */ + __pyx_t_24 = (__pyx_v_i * 3); + __pyx_t_25 = ((__pyx_v_qqr * __pyx_v_dx) * __pyx_v_dx); + __pyx_t_23 = (__pyx_v_r * __pyx_v_r); + if (unlikely(__pyx_t_23 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 768, __pyx_L1_error) + } + (__pyx_v_epa_xyz[__pyx_t_24]) = ((__pyx_v_epa_xyz[__pyx_t_24]) + (__pyx_t_25 / __pyx_t_23)); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":769 + * epa[i*8+4+idx3]+=qqr + * epa_xyz[i*3]+=qqr*dx*dx/(r*r) + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) # <<<<<<<<<<<<<< + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) + * if idx3 == 0 and coct != NULL: + */ + __pyx_t_24 = ((__pyx_v_i * 3) + 1); + __pyx_t_23 = ((__pyx_v_qqr * __pyx_v_dy) * __pyx_v_dy); + __pyx_t_25 = (__pyx_v_r * __pyx_v_r); + if (unlikely(__pyx_t_25 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 769, __pyx_L1_error) + } + (__pyx_v_epa_xyz[__pyx_t_24]) = ((__pyx_v_epa_xyz[__pyx_t_24]) + (__pyx_t_23 / __pyx_t_25)); -static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__len__", 0); + /* "newanalysis/helpers/helpers.pyx":770 + * epa_xyz[i*3]+=qqr*dx*dx/(r*r) + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) # <<<<<<<<<<<<<< + * if idx3 == 0 and coct != NULL: + * epa_oct[i*8+coct[j]]+=qqr + */ + __pyx_t_24 = ((__pyx_v_i * 3) + 2); + __pyx_t_25 = ((__pyx_v_qqr * __pyx_v_dz) * __pyx_v_dz); + __pyx_t_23 = (__pyx_v_r * __pyx_v_r); + if (unlikely(__pyx_t_23 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 770, __pyx_L1_error) + } + (__pyx_v_epa_xyz[__pyx_t_24]) = ((__pyx_v_epa_xyz[__pyx_t_24]) + (__pyx_t_25 / __pyx_t_23)); - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] + /* "newanalysis/helpers/helpers.pyx":771 + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) + * if idx3 == 0 and coct != NULL: # <<<<<<<<<<<<<< + * epa_oct[i*8+coct[j]]+=qqr * */ - __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); - if (__pyx_t_1) { + __pyx_t_26 = (__pyx_v_idx3 == 0); + if (__pyx_t_26) { + } else { + __pyx_t_3 = __pyx_t_26; + goto __pyx_L18_bool_binop_done; + } + __pyx_t_26 = (__pyx_v_coct != NULL); + __pyx_t_3 = __pyx_t_26; + __pyx_L18_bool_binop_done:; + if (__pyx_t_3) { - /* "View.MemoryView":609 - * def __len__(self): - * if self.view.ndim >= 1: - * return self.view.shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":772 + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) + * if idx3 == 0 and coct != NULL: + * epa_oct[i*8+coct[j]]+=qqr # <<<<<<<<<<<<<< * - * return 0 + * for i in range(apr[islt]): */ - __pyx_r = (__pyx_v_self->view.shape[0]); - goto __pyx_L0; + __pyx_t_24 = ((__pyx_v_i * 8) + (__pyx_v_coct[__pyx_v_j])); + (__pyx_v_epa_oct[__pyx_t_24]) = ((__pyx_v_epa_oct[__pyx_t_24]) + __pyx_v_qqr); - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] + /* "newanalysis/helpers/helpers.pyx":771 + * epa_xyz[i*3+1]+=qqr*dy*dy/(r*r) + * epa_xyz[i*3+2]+=qqr*dz*dz/(r*r) + * if idx3 == 0 and coct != NULL: # <<<<<<<<<<<<<< + * epa_oct[i*8+coct[j]]+=qqr * */ + } + } + } } - /* "View.MemoryView":611 - * return self.view.shape[0] - * - * return 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":774 + * epa_oct[i*8+coct[j]]+=qqr * - * def __repr__(self): + * for i in range(apr[islt]): # <<<<<<<<<<<<<< + * for j in range(8): + * energy[j]+=epa[i*8+j] */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_4 = (__pyx_v_apr[__pyx_v_islt]); + __pyx_t_15 = __pyx_t_4; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_i = __pyx_t_16; - /* "View.MemoryView":607 - * return self._size + /* "newanalysis/helpers/helpers.pyx":775 * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + * for i in range(apr[islt]): + * for j in range(8): # <<<<<<<<<<<<<< + * energy[j]+=epa[i*8+j] + * energy_octant[j]+=epa_oct[i*8+j] */ + for (__pyx_t_19 = 0; __pyx_t_19 < 8; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":613 - * return 0 - * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) + /* "newanalysis/helpers/helpers.pyx":776 + * for i in range(apr[islt]): + * for j in range(8): + * energy[j]+=epa[i*8+j] # <<<<<<<<<<<<<< + * energy_octant[j]+=epa_oct[i*8+j] + * for j in range(3): */ + __pyx_t_27 = __pyx_v_j; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_pybuffernd_energy.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_energy.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_energy.diminfo[0].strides) += (__pyx_v_epa[((__pyx_v_i * 8) + __pyx_v_j)]); -/* Python wrapper */ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__repr__", 0); + /* "newanalysis/helpers/helpers.pyx":777 + * for j in range(8): + * energy[j]+=epa[i*8+j] + * energy_octant[j]+=epa_oct[i*8+j] # <<<<<<<<<<<<<< + * for j in range(3): + * energy_xyz[j]+=epa_xyz[i*3+j] + */ + __pyx_t_27 = __pyx_v_j; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_pybuffernd_energy_octant.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_energy_octant.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_energy_octant.diminfo[0].strides) += (__pyx_v_epa_oct[((__pyx_v_i * 8) + __pyx_v_j)]); + } - /* "View.MemoryView":614 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) + /* "newanalysis/helpers/helpers.pyx":778 + * energy[j]+=epa[i*8+j] + * energy_octant[j]+=epa_oct[i*8+j] + * for j in range(3): # <<<<<<<<<<<<<< + * energy_xyz[j]+=epa_xyz[i*3+j] * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (__pyx_t_19 = 0; __pyx_t_19 < 3; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; - /* "View.MemoryView":615 - * def __repr__(self): - * return "" % (self.base.__class__.__name__, - * id(self)) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":779 + * energy_octant[j]+=epa_oct[i*8+j] + * for j in range(3): + * energy_xyz[j]+=epa_xyz[i*3+j] # <<<<<<<<<<<<<< * - * def __str__(self): + * return energy*1390.02, energy_xyz*1390.02, energy_octant*1390.02 */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_27 = __pyx_v_j; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_pybuffernd_energy_xyz.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_energy_xyz.diminfo[0].strides) += (__pyx_v_epa_xyz[((__pyx_v_i * 3) + __pyx_v_j)]); + } + } - /* "View.MemoryView":614 + /* "newanalysis/helpers/helpers.pyx":781 + * energy_xyz[j]+=epa_xyz[i*3+j] * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) + * return energy*1390.02, energy_xyz*1390.02, energy_octant*1390.02 # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_8 = PyNumber_Multiply(((PyObject *)__pyx_v_energy), __pyx_float_1390_02); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyNumber_Multiply(((PyObject *)__pyx_v_energy_xyz), __pyx_float_1390_02); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_v_energy_octant), __pyx_float_1390_02); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 781, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8)) __PYX_ERR(0, 781, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 781, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2)) __PYX_ERR(0, 781, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_7 = 0; __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; - /* "View.MemoryView":613 - * return 0 + /* "newanalysis/helpers/helpers.pyx":691 + * return np.asarray(epa)[:,:] * 1390.02 * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAASep(np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, + * np.ndarray[np.float64_t,ndim=1] charges, */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_charges.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_octant.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_octants.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.helpers.calcEnergyAASep", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_charges.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_octant.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_octant_per_atom.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_per_atom.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_xyz.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_energy_xyz_per_atom.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_octants.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_energy_per_atom); + __Pyx_XDECREF((PyObject *)__pyx_v_energy_xyz_per_atom); + __Pyx_XDECREF((PyObject *)__pyx_v_energy_octant_per_atom); + __Pyx_XDECREF((PyObject *)__pyx_v_energy); + __Pyx_XDECREF((PyObject *)__pyx_v_energy_xyz); + __Pyx_XDECREF((PyObject *)__pyx_v_energy_octant); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":617 - * id(self)) +/* "newanalysis/helpers/helpers.pyx":783 + * return energy*1390.02, energy_xyz*1390.02, energy_octant*1390.02 * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findDS(char [:,:,:] ds, double [:,:] cn, int n1, int n2, int shell, int t): * */ /* Python wrapper */ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_11newanalysis_7helpers_41findDS(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_41findDS = {"findDS", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_41findDS, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_41findDS(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_cn = { 0, 0, { 0 }, { 0 }, { 0 } }; + CYTHON_UNUSED int __pyx_v_n1; + int __pyx_v_n2; + int __pyx_v_shell; + int __pyx_v_t; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("findDS (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 783, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_cn,&__pyx_n_s_n1,&__pyx_n_s_n2,&__pyx_n_s_shell,&__pyx_n_s_t,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cn)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, 1); __PYX_ERR(0, 783, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, 2); __PYX_ERR(0, 783, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, 3); __PYX_ERR(0, 783, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, 4); __PYX_ERR(0, 783, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_t)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, 5); __PYX_ERR(0, 783, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "findDS") < 0)) __PYX_ERR(0, 783, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 6)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + } + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 784, __pyx_L3_error) + __pyx_v_cn = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cn.memview)) __PYX_ERR(0, 784, __pyx_L3_error) + __pyx_v_n1 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L3_error) + __pyx_v_n2 = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_n2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L3_error) + __pyx_v_shell = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_shell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L3_error) + __pyx_v_t = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_t == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("findDS", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 783, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_cn, 1); + __Pyx_AddTraceback("newanalysis.helpers.findDS", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_40findDS(__pyx_self, __pyx_v_ds, __pyx_v_cn, __pyx_v_n1, __pyx_v_n2, __pyx_v_shell, __pyx_v_t); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_cn, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { +static PyObject *__pyx_pf_11newanalysis_7helpers_40findDS(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_cn, CYTHON_UNUSED int __pyx_v_n1, int __pyx_v_n2, int __pyx_v_shell, int __pyx_v_t) { + int __pyx_v_i; + int __pyx_v_j; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + __Pyx_RefNannySetupContext("findDS", 0); - /* "View.MemoryView":618 - * - * def __str__(self): - * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":788 + * cdef int i, j * + * for i in prange(n1, nogil=True): # <<<<<<<<<<<<<< + * for j in range(n2): + * if ds[t, i, j] == shell: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_1 = __pyx_v_n1; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_3 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) + #endif /* _OPENMP */ + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_2); + /* Initialize private variables to invalid values */ + __pyx_v_j = ((int)0xbad0bad0); - /* "View.MemoryView":617 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + /* "newanalysis/helpers/helpers.pyx":789 * + * for i in prange(n1, nogil=True): + * for j in range(n2): # <<<<<<<<<<<<<< + * if ds[t, i, j] == shell: + * cn[t, i] += 1.0 */ + __pyx_t_4 = __pyx_v_n2; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_j = __pyx_t_6; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":790 + * for i in prange(n1, nogil=True): + * for j in range(n2): + * if ds[t, i, j] == shell: # <<<<<<<<<<<<<< + * cn[t, i] += 1.0 + * + */ + __pyx_t_7 = __pyx_v_t; + __pyx_t_8 = __pyx_v_i; + __pyx_t_9 = __pyx_v_j; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_ds.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_ds.shape[1]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_ds.shape[2]; + __pyx_t_10 = ((*((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_7 * __pyx_v_ds.strides[0]) ) + __pyx_t_8 * __pyx_v_ds.strides[1]) ) + __pyx_t_9 * __pyx_v_ds.strides[2]) ))) == __pyx_v_shell); + if (__pyx_t_10) { -/* "View.MemoryView":621 + /* "newanalysis/helpers/helpers.pyx":791 + * for j in range(n2): + * if ds[t, i, j] == shell: + * cn[t, i] += 1.0 # <<<<<<<<<<<<<< * * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp */ + __pyx_t_9 = __pyx_v_t; + __pyx_t_8 = __pyx_v_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_cn.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_cn.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cn.data + __pyx_t_9 * __pyx_v_cn.strides[0]) ) + __pyx_t_8 * __pyx_v_cn.strides[1]) )) += 1.0; -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_c_contig", 0); - - /* "View.MemoryView":624 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "newanalysis/helpers/helpers.pyx":790 + * for i in prange(n1, nogil=True): + * for j in range(n2): + * if ds[t, i, j] == shell: # <<<<<<<<<<<<<< + * cn[t, i] += 1.0 * */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 624, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":625 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":788 + * cdef int i, j * - * def is_f_contig(self): + * for i in prange(n1, nogil=True): # <<<<<<<<<<<<<< + * for j in range(n2): + * if ds[t, i, j] == shell: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } - /* "View.MemoryView":621 + /* "newanalysis/helpers/helpers.pyx":783 + * return energy*1390.02, energy_xyz*1390.02, energy_octant*1390.02 * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findDS(char [:,:,:] ds, double [:,:] cn, int n1, int n2, int shell, int t): * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) +/* "newanalysis/helpers/helpers.pyx":794 * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTenCorrel(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, + * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, */ /* Python wrapper */ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_11newanalysis_7helpers_43dipTenCorrel(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_43dipTenCorrel = {"dipTenCorrel", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_43dipTenCorrel, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_43dipTenCorrel(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_coo_center = 0; + PyArrayObject *__pyx_v_coo_H = 0; + __Pyx_memviewslice __pyx_v_H_indices = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyArrayObject *__pyx_v_dipT0 = 0; + PyArrayObject *__pyx_v_corrsubmean = 0; + __pyx_t_5numpy_int32_t __pyx_v_timectr; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("dipTenCorrel (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 794, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coo_center,&__pyx_n_s_coo_H,&__pyx_n_s_H_indices,&__pyx_n_s_dipT0,&__pyx_n_s_corrsubmean,&__pyx_n_s_timectr,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coo_center)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 794, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coo_H)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 794, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, 1); __PYX_ERR(0, 794, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_H_indices)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 794, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, 2); __PYX_ERR(0, 794, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dipT0)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 794, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, 3); __PYX_ERR(0, 794, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_corrsubmean)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 794, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, 4); __PYX_ERR(0, 794, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timectr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 794, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, 5); __PYX_ERR(0, 794, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dipTenCorrel") < 0)) __PYX_ERR(0, 794, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 6)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + } + __pyx_v_coo_center = ((PyArrayObject *)values[0]); + __pyx_v_coo_H = ((PyArrayObject *)values[1]); + __pyx_v_H_indices = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_H_indices.memview)) __PYX_ERR(0, 797, __pyx_L3_error) + __pyx_v_dipT0 = ((PyArrayObject *)values[3]); + __pyx_v_corrsubmean = ((PyArrayObject *)values[4]); + __pyx_v_timectr = __Pyx_PyInt_As_npy_int32(values[5]); if (unlikely((__pyx_v_timectr == ((npy_int32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 800, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dipTenCorrel", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 794, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_H_indices, 1); + __Pyx_AddTraceback("newanalysis.helpers.dipTenCorrel", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coo_center), __pyx_ptype_5numpy_ndarray, 1, "coo_center", 0))) __PYX_ERR(0, 795, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coo_H), __pyx_ptype_5numpy_ndarray, 1, "coo_H", 0))) __PYX_ERR(0, 796, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dipT0), __pyx_ptype_5numpy_ndarray, 1, "dipT0", 0))) __PYX_ERR(0, 798, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_corrsubmean), __pyx_ptype_5numpy_ndarray, 1, "corrsubmean", 0))) __PYX_ERR(0, 799, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_7helpers_42dipTenCorrel(__pyx_self, __pyx_v_coo_center, __pyx_v_coo_H, __pyx_v_H_indices, __pyx_v_dipT0, __pyx_v_corrsubmean, __pyx_v_timectr); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_H_indices, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; +static PyObject *__pyx_pf_11newanalysis_7helpers_42dipTenCorrel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coo_center, PyArrayObject *__pyx_v_coo_H, __Pyx_memviewslice __pyx_v_H_indices, PyArrayObject *__pyx_v_dipT0, PyArrayObject *__pyx_v_corrsubmean, __pyx_t_5numpy_int32_t __pyx_v_timectr) { + int __pyx_v_i; + int __pyx_v_center; + int __pyx_v_H_shell; + int __pyx_v_ctr; + CYTHON_UNUSED int __pyx_v_len_center; + int __pyx_v_len_H; + double __pyx_v_rvec0; + double __pyx_v_rvec1; + double __pyx_v_rvec2; + double __pyx_v_dipTt0; + double __pyx_v_dipTt1; + double __pyx_v_dipTt2; + double __pyx_v_dipTt3; + double __pyx_v_dipTt4; + double __pyx_v_dipTt5; + double __pyx_v_r2; + double __pyx_v_f1; + double __pyx_v_f2; + double __pyx_v_f2_0; + double __pyx_v_f2_1; + double __pyx_v_f2_2; + double *__pyx_v_centers; + double *__pyx_v_hs; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coo_H; + __Pyx_Buffer __pyx_pybuffer_coo_H; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coo_center; + __Pyx_Buffer __pyx_pybuffer_coo_center; + __Pyx_LocalBuf_ND __pyx_pybuffernd_corrsubmean; + __Pyx_Buffer __pyx_pybuffer_corrsubmean; + __Pyx_LocalBuf_ND __pyx_pybuffernd_dipT0; + __Pyx_Buffer __pyx_pybuffer_dipT0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_1; + char *__pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + int __pyx_t_11; + double __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_f_contig", 0); + __Pyx_RefNannySetupContext("dipTenCorrel", 0); + __pyx_pybuffer_coo_center.pybuffer.buf = NULL; + __pyx_pybuffer_coo_center.refcount = 0; + __pyx_pybuffernd_coo_center.data = NULL; + __pyx_pybuffernd_coo_center.rcbuffer = &__pyx_pybuffer_coo_center; + __pyx_pybuffer_coo_H.pybuffer.buf = NULL; + __pyx_pybuffer_coo_H.refcount = 0; + __pyx_pybuffernd_coo_H.data = NULL; + __pyx_pybuffernd_coo_H.rcbuffer = &__pyx_pybuffer_coo_H; + __pyx_pybuffer_dipT0.pybuffer.buf = NULL; + __pyx_pybuffer_dipT0.refcount = 0; + __pyx_pybuffernd_dipT0.data = NULL; + __pyx_pybuffernd_dipT0.rcbuffer = &__pyx_pybuffer_dipT0; + __pyx_pybuffer_corrsubmean.pybuffer.buf = NULL; + __pyx_pybuffer_corrsubmean.refcount = 0; + __pyx_pybuffernd_corrsubmean.data = NULL; + __pyx_pybuffernd_corrsubmean.rcbuffer = &__pyx_pybuffer_corrsubmean; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_coo_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 794, __pyx_L1_error) + } + __pyx_pybuffernd_coo_center.diminfo[0].strides = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coo_center.diminfo[0].shape = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coo_center.diminfo[1].strides = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coo_center.diminfo[1].shape = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer, (PyObject*)__pyx_v_coo_H, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 794, __pyx_L1_error) + } + __pyx_pybuffernd_coo_H.diminfo[0].strides = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coo_H.diminfo[0].shape = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coo_H.diminfo[1].strides = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coo_H.diminfo[1].shape = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer, (PyObject*)__pyx_v_dipT0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 794, __pyx_L1_error) + } + __pyx_pybuffernd_dipT0.diminfo[0].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dipT0.diminfo[0].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dipT0.diminfo[1].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dipT0.diminfo[1].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_dipT0.diminfo[2].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_dipT0.diminfo[2].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[2]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer, (PyObject*)__pyx_v_corrsubmean, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 794, __pyx_L1_error) + } + __pyx_pybuffernd_corrsubmean.diminfo[0].strides = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corrsubmean.diminfo[0].shape = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_corrsubmean.diminfo[1].strides = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_corrsubmean.diminfo[1].shape = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_corrsubmean.diminfo[2].strides = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_corrsubmean.diminfo[2].shape = __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.shape[2]; - /* "View.MemoryView":630 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "newanalysis/helpers/helpers.pyx":803 * + * cdef int i, center, H_shell, ctr + * cdef int len_center = len(coo_center) # <<<<<<<<<<<<<< + * cdef int len_H = len(coo_H) + * cdef double rvec0, rvec1, rvec2 */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 630, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coo_center)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 803, __pyx_L1_error) + __pyx_v_len_center = __pyx_t_1; - /* "View.MemoryView":631 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< - * - * def copy(self): + /* "newanalysis/helpers/helpers.pyx":804 + * cdef int i, center, H_shell, ctr + * cdef int len_center = len(coo_center) + * cdef int len_H = len(coo_H) # <<<<<<<<<<<<<< + * cdef double rvec0, rvec1, rvec2 + * cdef double dipTt0, dipTt1, dipTt2, dipTt3, dipTt4, dipTt5 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coo_H)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 804, __pyx_L1_error) + __pyx_v_len_H = __pyx_t_1; - /* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "newanalysis/helpers/helpers.pyx":808 + * cdef double dipTt0, dipTt1, dipTt2, dipTt3, dipTt4, dipTt5 + * cdef double r2, f1, f2, f2_0, f2_1, f2_2 + * cdef double *centers = coo_center.data # <<<<<<<<<<<<<< + * cdef double *hs = coo_H.data * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp */ + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coo_center)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 808, __pyx_L1_error) + __pyx_v_centers = ((double *)__pyx_t_2); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "newanalysis/helpers/helpers.pyx":809 + * cdef double r2, f1, f2, f2_0, f2_1, f2_2 + * cdef double *centers = coo_center.data + * cdef double *hs = coo_H.data # <<<<<<<<<<<<<< * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * for center in prange(len_center,nogil=True): */ + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coo_H)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 809, __pyx_L1_error) + __pyx_v_hs = ((double *)__pyx_t_2); -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_mslice; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy", 0); - - /* "View.MemoryView":635 - * def copy(self): - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":811 + * cdef double *hs = coo_H.data * - * slice_copy(self, &mslice) + * for center in prange(len_center,nogil=True): # <<<<<<<<<<<<<< + * ctr = 0 + * for i in range(len_H): */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_3 = __pyx_v_len_center; + { + int __pyx_parallel_temp0 = ((int)0xbad0bad0); + int __pyx_parallel_temp1 = ((int)0xbad0bad0); + int __pyx_parallel_temp2 = ((int)0xbad0bad0); + double __pyx_parallel_temp3 = ((double)__PYX_NAN()); + double __pyx_parallel_temp4 = ((double)__PYX_NAN()); + double __pyx_parallel_temp5 = ((double)__PYX_NAN()); + double __pyx_parallel_temp6 = ((double)__PYX_NAN()); + double __pyx_parallel_temp7 = ((double)__PYX_NAN()); + double __pyx_parallel_temp8 = ((double)__PYX_NAN()); + double __pyx_parallel_temp9 = ((double)__PYX_NAN()); + double __pyx_parallel_temp10 = ((double)__PYX_NAN()); + double __pyx_parallel_temp11 = ((double)__PYX_NAN()); + double __pyx_parallel_temp12 = ((double)__PYX_NAN()); + double __pyx_parallel_temp13 = ((double)__PYX_NAN()); + int __pyx_parallel_temp14 = ((int)0xbad0bad0); + double __pyx_parallel_temp15 = ((double)__PYX_NAN()); + double __pyx_parallel_temp16 = ((double)__PYX_NAN()); + double __pyx_parallel_temp17 = ((double)__PYX_NAN()); + double __pyx_parallel_temp18 = ((double)__PYX_NAN()); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_5 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_5 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33, __pyx_t_34, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_H_shell) firstprivate(__pyx_v_center) lastprivate(__pyx_v_center) lastprivate(__pyx_v_ctr) lastprivate(__pyx_v_dipTt0) lastprivate(__pyx_v_dipTt1) lastprivate(__pyx_v_dipTt2) lastprivate(__pyx_v_dipTt3) lastprivate(__pyx_v_dipTt4) lastprivate(__pyx_v_dipTt5) lastprivate(__pyx_v_f1) lastprivate(__pyx_v_f2) lastprivate(__pyx_v_f2_0) lastprivate(__pyx_v_f2_1) lastprivate(__pyx_v_f2_2) lastprivate(__pyx_v_i) lastprivate(__pyx_v_r2) lastprivate(__pyx_v_rvec0) lastprivate(__pyx_v_rvec1) lastprivate(__pyx_v_rvec2) + #endif /* _OPENMP */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_center = (int)(0 + 1 * __pyx_t_4); + /* Initialize private variables to invalid values */ + __pyx_v_H_shell = ((int)0xbad0bad0); + __pyx_v_ctr = ((int)0xbad0bad0); + __pyx_v_dipTt0 = ((double)__PYX_NAN()); + __pyx_v_dipTt1 = ((double)__PYX_NAN()); + __pyx_v_dipTt2 = ((double)__PYX_NAN()); + __pyx_v_dipTt3 = ((double)__PYX_NAN()); + __pyx_v_dipTt4 = ((double)__PYX_NAN()); + __pyx_v_dipTt5 = ((double)__PYX_NAN()); + __pyx_v_f1 = ((double)__PYX_NAN()); + __pyx_v_f2 = ((double)__PYX_NAN()); + __pyx_v_f2_0 = ((double)__PYX_NAN()); + __pyx_v_f2_1 = ((double)__PYX_NAN()); + __pyx_v_f2_2 = ((double)__PYX_NAN()); + __pyx_v_i = ((int)0xbad0bad0); + __pyx_v_r2 = ((double)__PYX_NAN()); + __pyx_v_rvec0 = ((double)__PYX_NAN()); + __pyx_v_rvec1 = ((double)__PYX_NAN()); + __pyx_v_rvec2 = ((double)__PYX_NAN()); - /* "View.MemoryView":637 - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + /* "newanalysis/helpers/helpers.pyx":812 * - * slice_copy(self, &mslice) # <<<<<<<<<<<<<< - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, - * self.view.itemsize, + * for center in prange(len_center,nogil=True): + * ctr = 0 # <<<<<<<<<<<<<< + * for i in range(len_H): + * if H_indices[center,i] > 0: */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + __pyx_v_ctr = 0; - /* "View.MemoryView":638 - * - * slice_copy(self, &mslice) - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_C_CONTIGUOUS, + /* "newanalysis/helpers/helpers.pyx":813 + * for center in prange(len_center,nogil=True): + * ctr = 0 + * for i in range(len_H): # <<<<<<<<<<<<<< + * if H_indices[center,i] > 0: + * H_shell = H_indices[center,i] */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 638, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __pyx_t_6 = __pyx_v_len_H; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "View.MemoryView":643 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< - * - * def copy_fortran(self): + /* "newanalysis/helpers/helpers.pyx":814 + * ctr = 0 + * for i in range(len_H): + * if H_indices[center,i] > 0: # <<<<<<<<<<<<<< + * H_shell = H_indices[center,i] + * rvec0 = hs[3*i] - centers[3*center] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_9 = __pyx_v_center; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_H_indices.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_H_indices.shape[1]; + __pyx_t_11 = ((*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_H_indices.data + __pyx_t_9 * __pyx_v_H_indices.strides[0]) ) + __pyx_t_10 * __pyx_v_H_indices.strides[1]) ))) > 0); + if (__pyx_t_11) { - /* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) - * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + /* "newanalysis/helpers/helpers.pyx":815 + * for i in range(len_H): + * if H_indices[center,i] > 0: + * H_shell = H_indices[center,i] # <<<<<<<<<<<<<< + * rvec0 = hs[3*i] - centers[3*center] + * rvec1 = hs[3*i+1] - centers[3*center+1] */ + __pyx_t_10 = __pyx_v_center; + __pyx_t_9 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_H_indices.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_H_indices.shape[1]; + __pyx_v_H_shell = (*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_H_indices.data + __pyx_t_10 * __pyx_v_H_indices.strides[0]) ) + __pyx_t_9 * __pyx_v_H_indices.strides[1]) ))); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) - * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + /* "newanalysis/helpers/helpers.pyx":816 + * if H_indices[center,i] > 0: + * H_shell = H_indices[center,i] + * rvec0 = hs[3*i] - centers[3*center] # <<<<<<<<<<<<<< + * rvec1 = hs[3*i+1] - centers[3*center+1] + * rvec2 = hs[3*i+2] - centers[3*center+2] */ + __pyx_v_rvec0 = ((__pyx_v_hs[(3 * __pyx_v_i)]) - (__pyx_v_centers[(3 * __pyx_v_center)])); -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":817 + * H_shell = H_indices[center,i] + * rvec0 = hs[3*i] - centers[3*center] + * rvec1 = hs[3*i+1] - centers[3*center+1] # <<<<<<<<<<<<<< + * rvec2 = hs[3*i+2] - centers[3*center+2] + * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 + */ + __pyx_v_rvec1 = ((__pyx_v_hs[((3 * __pyx_v_i) + 1)]) - (__pyx_v_centers[((3 * __pyx_v_center) + 1)])); -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy_fortran", 0); + /* "newanalysis/helpers/helpers.pyx":818 + * rvec0 = hs[3*i] - centers[3*center] + * rvec1 = hs[3*i+1] - centers[3*center+1] + * rvec2 = hs[3*i+2] - centers[3*center+2] # <<<<<<<<<<<<<< + * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 + * f1 = pow(r2,-1.5) + */ + __pyx_v_rvec2 = ((__pyx_v_hs[((3 * __pyx_v_i) + 2)]) - (__pyx_v_centers[((3 * __pyx_v_center) + 2)])); - /* "View.MemoryView":647 - * def copy_fortran(self): - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< - * - * slice_copy(self, &src) + /* "newanalysis/helpers/helpers.pyx":819 + * rvec1 = hs[3*i+1] - centers[3*center+1] + * rvec2 = hs[3*i+2] - centers[3*center+2] + * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 # <<<<<<<<<<<<<< + * f1 = pow(r2,-1.5) + * f2 = 3.0 * f1 / r2 */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + __pyx_v_r2 = (((__pyx_v_rvec0 * __pyx_v_rvec0) + (__pyx_v_rvec1 * __pyx_v_rvec1)) + (__pyx_v_rvec2 * __pyx_v_rvec2)); - /* "View.MemoryView":649 - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS - * - * slice_copy(self, &src) # <<<<<<<<<<<<<< - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, - * self.view.itemsize, + /* "newanalysis/helpers/helpers.pyx":820 + * rvec2 = hs[3*i+2] - centers[3*center+2] + * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 + * f1 = pow(r2,-1.5) # <<<<<<<<<<<<<< + * f2 = 3.0 * f1 / r2 + * f2_0 = f2 * rvec0 */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + __pyx_v_f1 = pow(__pyx_v_r2, -1.5); - /* "View.MemoryView":650 - * - * slice_copy(self, &src) - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_F_CONTIGUOUS, + /* "newanalysis/helpers/helpers.pyx":821 + * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 + * f1 = pow(r2,-1.5) + * f2 = 3.0 * f1 / r2 # <<<<<<<<<<<<<< + * f2_0 = f2 * rvec0 + * f2_1 = f2 * rvec1 */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 650, __pyx_L1_error) - __pyx_v_dst = __pyx_t_1; + __pyx_t_12 = (3.0 * __pyx_v_f1); + if (unlikely(__pyx_v_r2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 821, __pyx_L8_error) + } + __pyx_v_f2 = (__pyx_t_12 / __pyx_v_r2); - /* "View.MemoryView":655 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/helpers.pyx":822 + * f1 = pow(r2,-1.5) + * f2 = 3.0 * f1 / r2 + * f2_0 = f2 * rvec0 # <<<<<<<<<<<<<< + * f2_1 = f2 * rvec1 + * f2_2 = f2 * rvec2 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_v_f2_0 = (__pyx_v_f2 * __pyx_v_rvec0); - /* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) + /* "newanalysis/helpers/helpers.pyx":823 + * f2 = 3.0 * f1 / r2 + * f2_0 = f2 * rvec0 + * f2_1 = f2 * rvec1 # <<<<<<<<<<<<<< + * f2_2 = f2 * rvec2 * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ + __pyx_v_f2_1 = (__pyx_v_f2 * __pyx_v_rvec1); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/helpers/helpers.pyx":824 + * f2_0 = f2 * rvec0 + * f2_1 = f2 * rvec1 + * f2_2 = f2 * rvec2 # <<<<<<<<<<<<<< + * + * dipTt0 = (f2_0 * rvec0 - f1) */ + __pyx_v_f2_2 = (__pyx_v_f2 * __pyx_v_rvec2); -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/helpers.pyx":826 + * f2_2 = f2 * rvec2 + * + * dipTt0 = (f2_0 * rvec0 - f1) # <<<<<<<<<<<<<< + * dipTt1 = (f2_1 * rvec1 - f1) + * dipTt2 = (f2_2 * rvec2 - f1) */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_v_dipTt0 = ((__pyx_v_f2_0 * __pyx_v_rvec0) - __pyx_v_f1); - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/helpers/helpers.pyx":827 + * + * dipTt0 = (f2_0 * rvec0 - f1) + * dipTt1 = (f2_1 * rvec1 - f1) # <<<<<<<<<<<<<< + * dipTt2 = (f2_2 * rvec2 - f1) + * dipTt3 = (f2_0 * rvec1) */ + __pyx_v_dipTt1 = ((__pyx_v_f2_1 * __pyx_v_rvec1) - __pyx_v_f1); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/helpers.pyx":828 + * dipTt0 = (f2_0 * rvec0 - f1) + * dipTt1 = (f2_1 * rvec1 - f1) + * dipTt2 = (f2_2 * rvec2 - f1) # <<<<<<<<<<<<<< + * dipTt3 = (f2_0 * rvec1) + * dipTt4 = (f2_0 * rvec2) */ + __pyx_v_dipTt2 = ((__pyx_v_f2_2 * __pyx_v_rvec2) - __pyx_v_f1); -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":829 + * dipTt1 = (f2_1 * rvec1 - f1) + * dipTt2 = (f2_2 * rvec2 - f1) + * dipTt3 = (f2_0 * rvec1) # <<<<<<<<<<<<<< + * dipTt4 = (f2_0 * rvec2) + * dipTt5 = (f2_1 * rvec2) */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_v_dipTt3 = (__pyx_v_f2_0 * __pyx_v_rvec1); - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/helpers.pyx":830 + * dipTt2 = (f2_2 * rvec2 - f1) + * dipTt3 = (f2_0 * rvec1) + * dipTt4 = (f2_0 * rvec2) # <<<<<<<<<<<<<< + * dipTt5 = (f2_1 * rvec2) + * */ + __pyx_v_dipTt4 = (__pyx_v_f2_0 * __pyx_v_rvec2); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":659 + /* "newanalysis/helpers/helpers.pyx":831 + * dipTt3 = (f2_0 * rvec1) + * dipTt4 = (f2_0 * rvec2) + * dipTt5 = (f2_1 * rvec2) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo + * corrsubmean[center,H_shell,timectr] = corrsubmean[center,H_shell,timectr] + dipT0[center,ctr,0] * dipTt0 + dipT0[center,ctr,1] * dipTt1 + dipT0[center,ctr,2] * dipTt2 + dipT0[center,ctr,3] * dipTt3 + dipT0[center,ctr,4] * dipTt4 + dipT0[center,ctr,5] * dipTt5 */ + __pyx_v_dipTt5 = (__pyx_v_f2_1 * __pyx_v_rvec2); -static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { - struct __pyx_memoryview_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - - /* "View.MemoryView":660 - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< - * result.typeinfo = typeinfo - * return result + /* "newanalysis/helpers/helpers.pyx":833 + * dipTt5 = (f2_1 * rvec2) + * + * corrsubmean[center,H_shell,timectr] = corrsubmean[center,H_shell,timectr] + dipT0[center,ctr,0] * dipTt0 + dipT0[center,ctr,1] * dipTt1 + dipT0[center,ctr,2] * dipTt2 + dipT0[center,ctr,3] * dipTt3 + dipT0[center,ctr,4] * dipTt4 + dipT0[center,ctr,5] * dipTt5 # <<<<<<<<<<<<<< + * + * ctr = ctr + 1 */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_o); - __Pyx_GIVEREF(__pyx_v_o); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":661 - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo # <<<<<<<<<<<<<< - * return result + __pyx_t_9 = __pyx_v_center; + __pyx_t_10 = __pyx_v_H_shell; + __pyx_t_13 = __pyx_v_timectr; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_pybuffernd_corrsubmean.diminfo[0].shape; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_corrsubmean.diminfo[1].shape; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_corrsubmean.diminfo[2].shape; + __pyx_t_14 = __pyx_v_center; + __pyx_t_15 = __pyx_v_ctr; + __pyx_t_16 = 0; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + __pyx_t_17 = __pyx_v_center; + __pyx_t_18 = __pyx_v_ctr; + __pyx_t_19 = 1; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + __pyx_t_20 = __pyx_v_center; + __pyx_t_21 = __pyx_v_ctr; + __pyx_t_22 = 2; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + __pyx_t_23 = __pyx_v_center; + __pyx_t_24 = __pyx_v_ctr; + __pyx_t_25 = 3; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + __pyx_t_26 = __pyx_v_center; + __pyx_t_27 = __pyx_v_ctr; + __pyx_t_28 = 4; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + __pyx_t_29 = __pyx_v_center; + __pyx_t_30 = __pyx_v_ctr; + __pyx_t_31 = 5; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + __pyx_t_32 = __pyx_v_center; + __pyx_t_33 = __pyx_v_H_shell; + __pyx_t_34 = __pyx_v_timectr; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_pybuffernd_corrsubmean.diminfo[0].shape; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_pybuffernd_corrsubmean.diminfo[1].shape; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_pybuffernd_corrsubmean.diminfo[2].shape; + *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_corrsubmean.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_corrsubmean.diminfo[1].strides, __pyx_t_34, __pyx_pybuffernd_corrsubmean.diminfo[2].strides) = (((((((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_corrsubmean.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_corrsubmean.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_corrsubmean.diminfo[2].strides)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt0)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt1)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt2)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt3)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_28, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt4)) + ((*__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_31, __pyx_pybuffernd_dipT0.diminfo[2].strides)) * __pyx_v_dipTt5)); + + /* "newanalysis/helpers/helpers.pyx":835 + * corrsubmean[center,H_shell,timectr] = corrsubmean[center,H_shell,timectr] + dipT0[center,ctr,0] * dipTt0 + dipT0[center,ctr,1] * dipTt1 + dipT0[center,ctr,2] * dipTt2 + dipT0[center,ctr,3] * dipTt3 + dipT0[center,ctr,4] * dipTt4 + dipT0[center,ctr,5] * dipTt5 + * + * ctr = ctr + 1 # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_v_result->typeinfo = __pyx_v_typeinfo; + __pyx_v_ctr = (__pyx_v_ctr + 1); - /* "View.MemoryView":662 - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - * return result # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":814 + * ctr = 0 + * for i in range(len_H): + * if H_indices[center,i] > 0: # <<<<<<<<<<<<<< + * H_shell = H_indices[center,i] + * rvec0 = hs[3*i] - centers[3*center] + */ + } + } + goto __pyx_L14; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L13; + __pyx_L13:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates0) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_H_shell; + __pyx_parallel_temp1 = __pyx_v_center; + __pyx_parallel_temp2 = __pyx_v_ctr; + __pyx_parallel_temp3 = __pyx_v_dipTt0; + __pyx_parallel_temp4 = __pyx_v_dipTt1; + __pyx_parallel_temp5 = __pyx_v_dipTt2; + __pyx_parallel_temp6 = __pyx_v_dipTt3; + __pyx_parallel_temp7 = __pyx_v_dipTt4; + __pyx_parallel_temp8 = __pyx_v_dipTt5; + __pyx_parallel_temp9 = __pyx_v_f1; + __pyx_parallel_temp10 = __pyx_v_f2; + __pyx_parallel_temp11 = __pyx_v_f2_0; + __pyx_parallel_temp12 = __pyx_v_f2_1; + __pyx_parallel_temp13 = __pyx_v_f2_2; + __pyx_parallel_temp14 = __pyx_v_i; + __pyx_parallel_temp15 = __pyx_v_r2; + __pyx_parallel_temp16 = __pyx_v_rvec0; + __pyx_parallel_temp17 = __pyx_v_rvec1; + __pyx_parallel_temp18 = __pyx_v_rvec2; + } + __pyx_L14:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP +} +#endif /* _OPENMP */ + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_H_shell = __pyx_parallel_temp0; + __pyx_v_center = __pyx_parallel_temp1; + __pyx_v_ctr = __pyx_parallel_temp2; + __pyx_v_dipTt0 = __pyx_parallel_temp3; + __pyx_v_dipTt1 = __pyx_parallel_temp4; + __pyx_v_dipTt2 = __pyx_parallel_temp5; + __pyx_v_dipTt3 = __pyx_parallel_temp6; + __pyx_v_dipTt4 = __pyx_parallel_temp7; + __pyx_v_dipTt5 = __pyx_parallel_temp8; + __pyx_v_f1 = __pyx_parallel_temp9; + __pyx_v_f2 = __pyx_parallel_temp10; + __pyx_v_f2_0 = __pyx_parallel_temp11; + __pyx_v_f2_1 = __pyx_parallel_temp12; + __pyx_v_f2_2 = __pyx_parallel_temp13; + __pyx_v_i = __pyx_parallel_temp14; + __pyx_v_r2 = __pyx_parallel_temp15; + __pyx_v_rvec0 = __pyx_parallel_temp16; + __pyx_v_rvec1 = __pyx_parallel_temp17; + __pyx_v_rvec2 = __pyx_parallel_temp18; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/helpers.pyx":811 + * cdef double *hs = coo_H.data * - * @cname('__pyx_memoryview_check') + * for center in prange(len_center,nogil=True): # <<<<<<<<<<<<<< + * ctr = 0 + * for i in range(len_H): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; + } + } - /* "View.MemoryView":659 + /* "newanalysis/helpers/helpers.pyx":794 * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTenCorrel(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, + * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.helpers.dipTenCorrel", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corrsubmean.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer); + __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) +/* "newanalysis/helpers/helpers.pyx":837 + * ctr = ctr + 1 * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTenInit(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, + * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, */ -static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { - int __pyx_r; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_45dipTenInit(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_45dipTenInit = {"dipTenInit", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_45dipTenInit, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_45dipTenInit(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_coo_center = 0; + PyArrayObject *__pyx_v_coo_H = 0; + __Pyx_memviewslice __pyx_v_H_indices = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyArrayObject *__pyx_v_dipT0 = 0; + __pyx_t_5numpy_float64_t __pyx_v_nshells2; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("memoryview_check", 0); - - /* "View.MemoryView":666 - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): - * return isinstance(o, memoryview) # <<<<<<<<<<<<<< - * - * cdef tuple _unellipsify(object index, int ndim): - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); - __pyx_r = __pyx_t_1; - goto __pyx_L0; - - /* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) - * - */ + __Pyx_RefNannySetupContext("dipTenInit (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 837, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coo_center,&__pyx_n_s_coo_H,&__pyx_n_s_H_indices,&__pyx_n_s_dipT0,&__pyx_n_s_nshells2,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coo_center)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 837, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coo_H)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 837, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipTenInit", 1, 5, 5, 1); __PYX_ERR(0, 837, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_H_indices)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 837, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipTenInit", 1, 5, 5, 2); __PYX_ERR(0, 837, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dipT0)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 837, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipTenInit", 1, 5, 5, 3); __PYX_ERR(0, 837, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 837, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipTenInit", 1, 5, 5, 4); __PYX_ERR(0, 837, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dipTenInit") < 0)) __PYX_ERR(0, 837, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 5)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + } + __pyx_v_coo_center = ((PyArrayObject *)values[0]); + __pyx_v_coo_H = ((PyArrayObject *)values[1]); + __pyx_v_H_indices = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_H_indices.memview)) __PYX_ERR(0, 840, __pyx_L3_error) + __pyx_v_dipT0 = ((PyArrayObject *)values[3]); + __pyx_v_nshells2 = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_nshells2 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 842, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dipTenInit", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 837, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_H_indices, 1); + __Pyx_AddTraceback("newanalysis.helpers.dipTenInit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coo_center), __pyx_ptype_5numpy_ndarray, 1, "coo_center", 0))) __PYX_ERR(0, 838, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coo_H), __pyx_ptype_5numpy_ndarray, 1, "coo_H", 0))) __PYX_ERR(0, 839, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dipT0), __pyx_ptype_5numpy_ndarray, 1, "dipT0", 0))) __PYX_ERR(0, 841, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_7helpers_44dipTenInit(__pyx_self, __pyx_v_coo_center, __pyx_v_coo_H, __pyx_v_H_indices, __pyx_v_dipT0, __pyx_v_nshells2); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_H_indices, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":668 - * return isinstance(o, memoryview) - * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with - */ - -static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { - PyObject *__pyx_v_tup = NULL; - PyObject *__pyx_v_result = NULL; - int __pyx_v_have_slices; - int __pyx_v_seen_ellipsis; - CYTHON_UNUSED PyObject *__pyx_v_idx = NULL; - PyObject *__pyx_v_item = NULL; - Py_ssize_t __pyx_v_nslices; +static PyObject *__pyx_pf_11newanalysis_7helpers_44dipTenInit(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coo_center, PyArrayObject *__pyx_v_coo_H, __Pyx_memviewslice __pyx_v_H_indices, PyArrayObject *__pyx_v_dipT0, __pyx_t_5numpy_float64_t __pyx_v_nshells2) { + int __pyx_v_i; + int __pyx_v_center; + int __pyx_v_ctr; + CYTHON_UNUSED int __pyx_v_len_center; + int __pyx_v_len_H; + double __pyx_v_rvec0; + double __pyx_v_rvec1; + double __pyx_v_rvec2; + double __pyx_v_r2; + double __pyx_v_f1; + double __pyx_v_f2; + double __pyx_v_f2_0; + double __pyx_v_f2_1; + double __pyx_v_f2_2; + double *__pyx_v_centers; + double *__pyx_v_hs; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coo_H; + __Pyx_Buffer __pyx_pybuffer_coo_H; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coo_center; + __Pyx_Buffer __pyx_pybuffer_coo_center; + __Pyx_LocalBuf_ND __pyx_pybuffernd_dipT0; + __Pyx_Buffer __pyx_pybuffer_dipT0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_1; + char *__pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; int __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + double __pyx_t_12; + Py_ssize_t __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_unellipsify", 0); + __Pyx_RefNannySetupContext("dipTenInit", 0); + __pyx_pybuffer_coo_center.pybuffer.buf = NULL; + __pyx_pybuffer_coo_center.refcount = 0; + __pyx_pybuffernd_coo_center.data = NULL; + __pyx_pybuffernd_coo_center.rcbuffer = &__pyx_pybuffer_coo_center; + __pyx_pybuffer_coo_H.pybuffer.buf = NULL; + __pyx_pybuffer_coo_H.refcount = 0; + __pyx_pybuffernd_coo_H.data = NULL; + __pyx_pybuffernd_coo_H.rcbuffer = &__pyx_pybuffer_coo_H; + __pyx_pybuffer_dipT0.pybuffer.buf = NULL; + __pyx_pybuffer_dipT0.refcount = 0; + __pyx_pybuffernd_dipT0.data = NULL; + __pyx_pybuffernd_dipT0.rcbuffer = &__pyx_pybuffer_dipT0; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_coo_center, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 837, __pyx_L1_error) + } + __pyx_pybuffernd_coo_center.diminfo[0].strides = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coo_center.diminfo[0].shape = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coo_center.diminfo[1].strides = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coo_center.diminfo[1].shape = __pyx_pybuffernd_coo_center.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer, (PyObject*)__pyx_v_coo_H, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 837, __pyx_L1_error) + } + __pyx_pybuffernd_coo_H.diminfo[0].strides = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coo_H.diminfo[0].shape = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coo_H.diminfo[1].strides = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coo_H.diminfo[1].shape = __pyx_pybuffernd_coo_H.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer, (PyObject*)__pyx_v_dipT0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 837, __pyx_L1_error) + } + __pyx_pybuffernd_dipT0.diminfo[0].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dipT0.diminfo[0].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dipT0.diminfo[1].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dipT0.diminfo[1].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_dipT0.diminfo[2].strides = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_dipT0.diminfo[2].shape = __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.shape[2]; - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: + /* "newanalysis/helpers/helpers.pyx":844 + * np.float64_t nshells2): + * cdef int i, center, ctr + * cdef int len_center = len(coo_center) # <<<<<<<<<<<<<< + * cdef int len_H = len(coo_H) + * cdef double rvec0, rvec1, rvec2 */ - __pyx_t_1 = PyTuple_Check(__pyx_v_index); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coo_center)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 844, __pyx_L1_error) + __pyx_v_len_center = __pyx_t_1; - /* "View.MemoryView":674 - * """ - * if not isinstance(index, tuple): - * tup = (index,) # <<<<<<<<<<<<<< - * else: - * tup = index + /* "newanalysis/helpers/helpers.pyx":845 + * cdef int i, center, ctr + * cdef int len_center = len(coo_center) + * cdef int len_H = len(coo_H) # <<<<<<<<<<<<<< + * cdef double rvec0, rvec1, rvec2 + * cdef double dipTt0, dipTt1, dipTt2, dipTt3, dipTt4, dipTt5 */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 674, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); - __pyx_v_tup = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_coo_H)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 845, __pyx_L1_error) + __pyx_v_len_H = __pyx_t_1; - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: + /* "newanalysis/helpers/helpers.pyx":849 + * cdef double dipTt0, dipTt1, dipTt2, dipTt3, dipTt4, dipTt5 + * cdef double r2, f1, f2, f2_0, f2_1, f2_2 + * cdef double *centers = coo_center.data # <<<<<<<<<<<<<< + * cdef double *hs = coo_H.data + * */ - goto __pyx_L3; - } + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coo_center)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 849, __pyx_L1_error) + __pyx_v_centers = ((double *)__pyx_t_2); - /* "View.MemoryView":676 - * tup = (index,) - * else: - * tup = index # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":850 + * cdef double r2, f1, f2, f2_0, f2_1, f2_2 + * cdef double *centers = coo_center.data + * cdef double *hs = coo_H.data # <<<<<<<<<<<<<< * - * result = [] + * for center in prange(len_center,nogil=True): */ - /*else*/ { - __Pyx_INCREF(__pyx_v_index); - __pyx_v_tup = __pyx_v_index; - } - __pyx_L3:; + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_coo_H)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 850, __pyx_L1_error) + __pyx_v_hs = ((double *)__pyx_t_2); - /* "View.MemoryView":678 - * tup = index + /* "newanalysis/helpers/helpers.pyx":852 + * cdef double *hs = coo_H.data * - * result = [] # <<<<<<<<<<<<<< - * have_slices = False - * seen_ellipsis = False + * for center in prange(len_center,nogil=True): # <<<<<<<<<<<<<< + * ctr = 0 + * for i in range(len_H): */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 678, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_result = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_3 = __pyx_v_len_center; + { + int __pyx_parallel_temp0 = ((int)0xbad0bad0); + int __pyx_parallel_temp1 = ((int)0xbad0bad0); + double __pyx_parallel_temp2 = ((double)__PYX_NAN()); + double __pyx_parallel_temp3 = ((double)__PYX_NAN()); + double __pyx_parallel_temp4 = ((double)__PYX_NAN()); + double __pyx_parallel_temp5 = ((double)__PYX_NAN()); + double __pyx_parallel_temp6 = ((double)__PYX_NAN()); + int __pyx_parallel_temp7 = ((int)0xbad0bad0); + double __pyx_parallel_temp8 = ((double)__PYX_NAN()); + double __pyx_parallel_temp9 = ((double)__PYX_NAN()); + double __pyx_parallel_temp10 = ((double)__PYX_NAN()); + double __pyx_parallel_temp11 = ((double)__PYX_NAN()); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_5 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_5 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_center) lastprivate(__pyx_v_center) lastprivate(__pyx_v_ctr) lastprivate(__pyx_v_f1) lastprivate(__pyx_v_f2) lastprivate(__pyx_v_f2_0) lastprivate(__pyx_v_f2_1) lastprivate(__pyx_v_f2_2) lastprivate(__pyx_v_i) lastprivate(__pyx_v_r2) lastprivate(__pyx_v_rvec0) lastprivate(__pyx_v_rvec1) lastprivate(__pyx_v_rvec2) + #endif /* _OPENMP */ + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_center = (int)(0 + 1 * __pyx_t_4); + /* Initialize private variables to invalid values */ + __pyx_v_ctr = ((int)0xbad0bad0); + __pyx_v_f1 = ((double)__PYX_NAN()); + __pyx_v_f2 = ((double)__PYX_NAN()); + __pyx_v_f2_0 = ((double)__PYX_NAN()); + __pyx_v_f2_1 = ((double)__PYX_NAN()); + __pyx_v_f2_2 = ((double)__PYX_NAN()); + __pyx_v_i = ((int)0xbad0bad0); + __pyx_v_r2 = ((double)__PYX_NAN()); + __pyx_v_rvec0 = ((double)__PYX_NAN()); + __pyx_v_rvec1 = ((double)__PYX_NAN()); + __pyx_v_rvec2 = ((double)__PYX_NAN()); - /* "View.MemoryView":679 + /* "newanalysis/helpers/helpers.pyx":853 * - * result = [] - * have_slices = False # <<<<<<<<<<<<<< - * seen_ellipsis = False - * for idx, item in enumerate(tup): + * for center in prange(len_center,nogil=True): + * ctr = 0 # <<<<<<<<<<<<<< + * for i in range(len_H): + * rvec0 = hs[3*i] - centers[3*center] */ - __pyx_v_have_slices = 0; + __pyx_v_ctr = 0; - /* "View.MemoryView":680 - * result = [] - * have_slices = False - * seen_ellipsis = False # <<<<<<<<<<<<<< - * for idx, item in enumerate(tup): - * if item is Ellipsis: + /* "newanalysis/helpers/helpers.pyx":854 + * for center in prange(len_center,nogil=True): + * ctr = 0 + * for i in range(len_H): # <<<<<<<<<<<<<< + * rvec0 = hs[3*i] - centers[3*center] + * rvec1 = hs[3*i+1] - centers[3*center+1] */ - __pyx_v_seen_ellipsis = 0; + __pyx_t_6 = __pyx_v_len_H; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: + /* "newanalysis/helpers/helpers.pyx":855 + * ctr = 0 + * for i in range(len_H): + * rvec0 = hs[3*i] - centers[3*center] # <<<<<<<<<<<<<< + * rvec1 = hs[3*i+1] - centers[3*center+1] + * rvec2 = hs[3*i+2] - centers[3*center+2] */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_3 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) { - __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 681, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } - } else { - __pyx_t_7 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_7)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 681, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_rvec0 = ((__pyx_v_hs[(3 * __pyx_v_i)]) - (__pyx_v_centers[(3 * __pyx_v_center)])); - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) + /* "newanalysis/helpers/helpers.pyx":856 + * for i in range(len_H): + * rvec0 = hs[3*i] - centers[3*center] + * rvec1 = hs[3*i+1] - centers[3*center+1] # <<<<<<<<<<<<<< + * rvec2 = hs[3*i+2] - centers[3*center+2] + * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 */ - __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_v_rvec1 = ((__pyx_v_hs[((3 * __pyx_v_i) + 1)]) - (__pyx_v_centers[((3 * __pyx_v_center) + 1)])); - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True + /* "newanalysis/helpers/helpers.pyx":857 + * rvec0 = hs[3*i] - centers[3*center] + * rvec1 = hs[3*i+1] - centers[3*center+1] + * rvec2 = hs[3*i+2] - centers[3*center+2] # <<<<<<<<<<<<<< + * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 + * */ - __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0); - if (__pyx_t_1) { + __pyx_v_rvec2 = ((__pyx_v_hs[((3 * __pyx_v_i) + 2)]) - (__pyx_v_centers[((3 * __pyx_v_center) + 2)])); - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: + /* "newanalysis/helpers/helpers.pyx":858 + * rvec1 = hs[3*i+1] - centers[3*center+1] + * rvec2 = hs[3*i+2] - centers[3*center+2] + * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 # <<<<<<<<<<<<<< + * + * if r2 <= nshells2: */ - __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__2); - __Pyx_GIVEREF(__pyx_slice__2); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__2); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_r2 = (((__pyx_v_rvec0 * __pyx_v_rvec0) + (__pyx_v_rvec1 * __pyx_v_rvec1)) + (__pyx_v_rvec2 * __pyx_v_rvec2)); - /* "View.MemoryView":685 - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True # <<<<<<<<<<<<<< - * else: - * result.append(slice(None)) + /* "newanalysis/helpers/helpers.pyx":860 + * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 + * + * if r2 <= nshells2: # <<<<<<<<<<<<<< + * H_indices[center,i] = int(floor(r2**0.5)) + * f1 = pow(r2,-1.5) */ - __pyx_v_seen_ellipsis = 1; + __pyx_t_9 = (__pyx_v_r2 <= __pyx_v_nshells2); + if (__pyx_t_9) { - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True + /* "newanalysis/helpers/helpers.pyx":861 + * + * if r2 <= nshells2: + * H_indices[center,i] = int(floor(r2**0.5)) # <<<<<<<<<<<<<< + * f1 = pow(r2,-1.5) + * f2 = 3.0 * f1 / r2 */ - goto __pyx_L7; - } + __pyx_t_10 = __pyx_v_center; + __pyx_t_11 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_H_indices.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_H_indices.shape[1]; + *((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_H_indices.data + __pyx_t_10 * __pyx_v_H_indices.strides[0]) ) + __pyx_t_11 * __pyx_v_H_indices.strides[1]) )) = ((char)floor(pow(__pyx_v_r2, 0.5))); - /* "View.MemoryView":687 - * seen_ellipsis = True - * else: - * result.append(slice(None)) # <<<<<<<<<<<<<< - * have_slices = True - * else: + /* "newanalysis/helpers/helpers.pyx":862 + * if r2 <= nshells2: + * H_indices[center,i] = int(floor(r2**0.5)) + * f1 = pow(r2,-1.5) # <<<<<<<<<<<<<< + * f2 = 3.0 * f1 / r2 + * f2_0 = f2 * rvec0 */ - /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 687, __pyx_L1_error) - } - __pyx_L7:; + __pyx_v_f1 = pow(__pyx_v_r2, -1.5); - /* "View.MemoryView":688 - * else: - * result.append(slice(None)) - * have_slices = True # <<<<<<<<<<<<<< - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): + /* "newanalysis/helpers/helpers.pyx":863 + * H_indices[center,i] = int(floor(r2**0.5)) + * f1 = pow(r2,-1.5) + * f2 = 3.0 * f1 / r2 # <<<<<<<<<<<<<< + * f2_0 = f2 * rvec0 + * f2_1 = f2 * rvec1 */ - __pyx_v_have_slices = 1; + __pyx_t_12 = (3.0 * __pyx_v_f1); + if (unlikely(__pyx_v_r2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 863, __pyx_L8_error) + } + __pyx_v_f2 = (__pyx_t_12 / __pyx_v_r2); - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) + /* "newanalysis/helpers/helpers.pyx":864 + * f1 = pow(r2,-1.5) + * f2 = 3.0 * f1 / r2 + * f2_0 = f2 * rvec0 # <<<<<<<<<<<<<< + * f2_1 = f2 * rvec1 + * f2_2 = f2 * rvec2 */ - goto __pyx_L6; - } + __pyx_v_f2_0 = (__pyx_v_f2 * __pyx_v_rvec0); - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) + /* "newanalysis/helpers/helpers.pyx":865 + * f2 = 3.0 * f1 / r2 + * f2_0 = f2 * rvec0 + * f2_1 = f2 * rvec1 # <<<<<<<<<<<<<< + * f2_2 = f2 * rvec2 * */ - /*else*/ { - __pyx_t_2 = PySlice_Check(__pyx_v_item); - __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0); - __pyx_t_1 = __pyx_t_10; - __pyx_L9_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_v_f2_1 = (__pyx_v_f2 * __pyx_v_rvec1); - /* "View.MemoryView":691 - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): - * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":866 + * f2_0 = f2 * rvec0 + * f2_1 = f2 * rvec1 + * f2_2 = f2 * rvec2 # <<<<<<<<<<<<<< * - * have_slices = have_slices or isinstance(item, slice) + * dipT0[center,ctr,0] = (f2_0 * rvec0 - f1) /6 # /6 for averaging the elements in the correlation */ - __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(2, 691, __pyx_L1_error) + __pyx_v_f2_2 = (__pyx_v_f2 * __pyx_v_rvec2); - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) + /* "newanalysis/helpers/helpers.pyx":868 + * f2_2 = f2 * rvec2 * + * dipT0[center,ctr,0] = (f2_0 * rvec0 - f1) /6 # /6 for averaging the elements in the correlation # <<<<<<<<<<<<<< + * dipT0[center,ctr,1] = (f2_1 * rvec1 - f1) /6 + * dipT0[center,ctr,2] = (f2_2 * rvec2 - f1) /6 */ - } + __pyx_t_11 = __pyx_v_center; + __pyx_t_10 = __pyx_v_ctr; + __pyx_t_13 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_dipT0.diminfo[2].strides) = (((__pyx_v_f2_0 * __pyx_v_rvec0) - __pyx_v_f1) / 6.0); - /* "View.MemoryView":693 - * raise TypeError("Cannot index with type '%s'" % type(item)) - * - * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< - * result.append(item) + /* "newanalysis/helpers/helpers.pyx":869 * + * dipT0[center,ctr,0] = (f2_0 * rvec0 - f1) /6 # /6 for averaging the elements in the correlation + * dipT0[center,ctr,1] = (f2_1 * rvec1 - f1) /6 # <<<<<<<<<<<<<< + * dipT0[center,ctr,2] = (f2_2 * rvec2 - f1) /6 + * dipT0[center,ctr,3] = (f2_0 * rvec1) /3 # *2 because off-diag element are taken twice, when summing over all elements in the correlation */ - __pyx_t_10 = (__pyx_v_have_slices != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = PySlice_Check(__pyx_v_item); - __pyx_t_2 = (__pyx_t_10 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L11_bool_binop_done:; - __pyx_v_have_slices = __pyx_t_1; + __pyx_t_13 = __pyx_v_center; + __pyx_t_10 = __pyx_v_ctr; + __pyx_t_11 = 1; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_dipT0.diminfo[2].strides) = (((__pyx_v_f2_1 * __pyx_v_rvec1) - __pyx_v_f1) / 6.0); - /* "View.MemoryView":694 - * - * have_slices = have_slices or isinstance(item, slice) - * result.append(item) # <<<<<<<<<<<<<< - * - * nslices = ndim - len(result) + /* "newanalysis/helpers/helpers.pyx":870 + * dipT0[center,ctr,0] = (f2_0 * rvec0 - f1) /6 # /6 for averaging the elements in the correlation + * dipT0[center,ctr,1] = (f2_1 * rvec1 - f1) /6 + * dipT0[center,ctr,2] = (f2_2 * rvec2 - f1) /6 # <<<<<<<<<<<<<< + * dipT0[center,ctr,3] = (f2_0 * rvec1) /3 # *2 because off-diag element are taken twice, when summing over all elements in the correlation + * dipT0[center,ctr,4] = (f2_0 * rvec2) /3 */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 694, __pyx_L1_error) - } - __pyx_L6:; + __pyx_t_11 = __pyx_v_center; + __pyx_t_10 = __pyx_v_ctr; + __pyx_t_13 = 2; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_dipT0.diminfo[2].strides) = (((__pyx_v_f2_2 * __pyx_v_rvec2) - __pyx_v_f1) / 6.0); - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: + /* "newanalysis/helpers/helpers.pyx":871 + * dipT0[center,ctr,1] = (f2_1 * rvec1 - f1) /6 + * dipT0[center,ctr,2] = (f2_2 * rvec2 - f1) /6 + * dipT0[center,ctr,3] = (f2_0 * rvec1) /3 # *2 because off-diag element are taken twice, when summing over all elements in the correlation # <<<<<<<<<<<<<< + * dipT0[center,ctr,4] = (f2_0 * rvec2) /3 + * dipT0[center,ctr,5] = (f2_1 * rvec2) /3 */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = __pyx_v_center; + __pyx_t_10 = __pyx_v_ctr; + __pyx_t_11 = 3; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_dipT0.diminfo[2].strides) = ((__pyx_v_f2_0 * __pyx_v_rvec1) / 3.0); - /* "View.MemoryView":696 - * result.append(item) + /* "newanalysis/helpers/helpers.pyx":872 + * dipT0[center,ctr,2] = (f2_2 * rvec2 - f1) /6 + * dipT0[center,ctr,3] = (f2_0 * rvec1) /3 # *2 because off-diag element are taken twice, when summing over all elements in the correlation + * dipT0[center,ctr,4] = (f2_0 * rvec2) /3 # <<<<<<<<<<<<<< + * dipT0[center,ctr,5] = (f2_1 * rvec2) /3 * - * nslices = ndim - len(result) # <<<<<<<<<<<<<< - * if nslices: - * result.extend([slice(None)] * nslices) */ - __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 696, __pyx_L1_error) - __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); + __pyx_t_11 = __pyx_v_center; + __pyx_t_10 = __pyx_v_ctr; + __pyx_t_13 = 4; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_dipT0.diminfo[2].strides) = ((__pyx_v_f2_0 * __pyx_v_rvec2) / 3.0); - /* "View.MemoryView":697 - * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) + /* "newanalysis/helpers/helpers.pyx":873 + * dipT0[center,ctr,3] = (f2_0 * rvec1) /3 # *2 because off-diag element are taken twice, when summing over all elements in the correlation + * dipT0[center,ctr,4] = (f2_0 * rvec2) /3 + * dipT0[center,ctr,5] = (f2_1 * rvec2) /3 # <<<<<<<<<<<<<< * + * ctr = ctr + 1 */ - __pyx_t_1 = (__pyx_v_nslices != 0); - if (__pyx_t_1) { + __pyx_t_13 = __pyx_v_center; + __pyx_t_10 = __pyx_v_ctr; + __pyx_t_11 = 5; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_dipT0.diminfo[0].shape; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_dipT0.diminfo[1].shape; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_dipT0.diminfo[2].shape; + *__Pyx_BufPtrCContig3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipT0.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_dipT0.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_dipT0.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_dipT0.diminfo[2].strides) = ((__pyx_v_f2_1 * __pyx_v_rvec2) / 3.0); - /* "View.MemoryView":698 - * nslices = ndim - len(result) - * if nslices: - * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":875 + * dipT0[center,ctr,5] = (f2_1 * rvec2) /3 * - * return have_slices or nslices, tuple(result) - */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__2); - __Pyx_GIVEREF(__pyx_slice__2); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__2); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "View.MemoryView":697 + * ctr = ctr + 1 # <<<<<<<<<<<<<< * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) * */ - } + __pyx_v_ctr = (__pyx_v_ctr + 1); - /* "View.MemoryView":700 - * result.extend([slice(None)] * nslices) + /* "newanalysis/helpers/helpers.pyx":860 + * r2 = rvec0*rvec0+rvec1*rvec1+rvec2*rvec2 * - * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * if r2 <= nshells2: # <<<<<<<<<<<<<< + * H_indices[center,i] = int(floor(r2**0.5)) + * f1 = pow(r2,-1.5) + */ + } + } + goto __pyx_L14; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L13; + __pyx_L13:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates1) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_center; + __pyx_parallel_temp1 = __pyx_v_ctr; + __pyx_parallel_temp2 = __pyx_v_f1; + __pyx_parallel_temp3 = __pyx_v_f2; + __pyx_parallel_temp4 = __pyx_v_f2_0; + __pyx_parallel_temp5 = __pyx_v_f2_1; + __pyx_parallel_temp6 = __pyx_v_f2_2; + __pyx_parallel_temp7 = __pyx_v_i; + __pyx_parallel_temp8 = __pyx_v_r2; + __pyx_parallel_temp9 = __pyx_v_rvec0; + __pyx_parallel_temp10 = __pyx_v_rvec1; + __pyx_parallel_temp11 = __pyx_v_rvec2; + } + __pyx_L14:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP +} +#endif /* _OPENMP */ + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_center = __pyx_parallel_temp0; + __pyx_v_ctr = __pyx_parallel_temp1; + __pyx_v_f1 = __pyx_parallel_temp2; + __pyx_v_f2 = __pyx_parallel_temp3; + __pyx_v_f2_0 = __pyx_parallel_temp4; + __pyx_v_f2_1 = __pyx_parallel_temp5; + __pyx_v_f2_2 = __pyx_parallel_temp6; + __pyx_v_i = __pyx_parallel_temp7; + __pyx_v_r2 = __pyx_parallel_temp8; + __pyx_v_rvec0 = __pyx_parallel_temp9; + __pyx_v_rvec1 = __pyx_parallel_temp10; + __pyx_v_rvec2 = __pyx_parallel_temp11; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/helpers.pyx":852 + * cdef double *hs = coo_H.data * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): + * for center in prange(len_center,nogil=True): # <<<<<<<<<<<<<< + * ctr = 0 + * for i in range(len_H): */ - __Pyx_XDECREF(__pyx_r); - if (!__pyx_v_have_slices) { - } else { - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L14_bool_binop_done; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; + } } - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_L14_bool_binop_done:; - __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject*)__pyx_t_11); - __pyx_t_11 = 0; - goto __pyx_L0; - /* "View.MemoryView":668 - * return isinstance(o, memoryview) + /* "newanalysis/helpers/helpers.pyx":837 + * ctr = ctr + 1 * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTenInit(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, + * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.helpers.dipTenInit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tup); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_XDECREF(__pyx_v_item); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_H.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coo_center.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipT0.rcbuffer->pybuffer); + __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) +/* "newanalysis/helpers/helpers.pyx":878 * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTen(np.ndarray[np.float64_t,ndim=1] rv, + * np.float64_t r2): */ -static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_47dipTen(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_46dipTen, "\n dipTen(coo1,coo2) -> returns dip tensor\n Calculates the dipole T-tensor (see Daniel's NMR code).\n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_47dipTen = {"dipTen", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_47dipTen, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_46dipTen}; +static PyObject *__pyx_pw_11newanalysis_7helpers_47dipTen(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_rv = 0; + __pyx_t_5numpy_float64_t __pyx_v_r2; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - - /* "View.MemoryView":703 - * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") - */ - __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); - for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { - __pyx_t_1 = __pyx_t_3; - __pyx_v_suboffset = (__pyx_t_1[0]); - - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") - * - */ - __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0); - if (unlikely(__pyx_t_4)) { - - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(2, 705, __pyx_L1_error) - - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") - * - */ + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dipTen (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 878, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rv,&__pyx_n_s_r2,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rv)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 878, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_r2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 878, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipTen", 1, 2, 2, 1); __PYX_ERR(0, 878, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dipTen") < 0)) __PYX_ERR(0, 878, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } + __pyx_v_rv = ((PyArrayObject *)values[0]); + __pyx_v_r2 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_r2 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L3_error) } - - /* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) - * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - */ + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dipTen", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 878, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.helpers.dipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rv), __pyx_ptype_5numpy_ndarray, 1, "rv", 0))) __PYX_ERR(0, 879, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_7helpers_46dipTen(__pyx_self, __pyx_v_rv, __pyx_v_r2); /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":712 - * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step - */ - -static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { - int __pyx_v_new_ndim; - int __pyx_v_suboffset_dim; - int __pyx_v_dim; - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - __Pyx_memviewslice *__pyx_v_p_src; - struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; - __Pyx_memviewslice *__pyx_v_p_dst; - int *__pyx_v_p_suboffset_dim; - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - int __pyx_v_have_start; - int __pyx_v_have_stop; - int __pyx_v_have_step; - PyObject *__pyx_v_index = NULL; - struct __pyx_memoryview_obj *__pyx_r = NULL; +static PyObject *__pyx_pf_11newanalysis_7helpers_46dipTen(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_rv, __pyx_t_5numpy_float64_t __pyx_v_r2) { + double *__pyx_v_c_rv; + PyArrayObject *__pyx_v_dipt = 0; + double __pyx_v_f1; + double __pyx_v_f2; + double __pyx_v_f2_0; + double __pyx_v_f2_1; + double __pyx_v_f2_2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_dipt; + __Pyx_Buffer __pyx_pybuffer_dipt; + __Pyx_LocalBuf_ND __pyx_pybuffernd_rv; + __Pyx_Buffer __pyx_pybuffer_rv; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - struct __pyx_memoryview_obj *__pyx_t_4; - char *__pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + double __pyx_t_7; + Py_ssize_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memview_slice", 0); - - /* "View.MemoryView":713 - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): - * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< - * cdef bint negative_step - * cdef __Pyx_memviewslice src, dst - */ - __pyx_v_new_ndim = 0; - __pyx_v_suboffset_dim = -1; + __Pyx_RefNannySetupContext("dipTen", 0); + __pyx_pybuffer_dipt.pybuffer.buf = NULL; + __pyx_pybuffer_dipt.refcount = 0; + __pyx_pybuffernd_dipt.data = NULL; + __pyx_pybuffernd_dipt.rcbuffer = &__pyx_pybuffer_dipt; + __pyx_pybuffer_rv.pybuffer.buf = NULL; + __pyx_pybuffer_rv.refcount = 0; + __pyx_pybuffernd_rv.data = NULL; + __pyx_pybuffernd_rv.rcbuffer = &__pyx_pybuffer_rv; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rv.rcbuffer->pybuffer, (PyObject*)__pyx_v_rv, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 878, __pyx_L1_error) + } + __pyx_pybuffernd_rv.diminfo[0].strides = __pyx_pybuffernd_rv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rv.diminfo[0].shape = __pyx_pybuffernd_rv.rcbuffer->pybuffer.shape[0]; - /* "View.MemoryView":720 - * - * - * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":885 + * Calculates the dipole T-tensor (see Daniel's NMR code). + * """ + * cdef double* c_rv = rv.data # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] dipt = np.empty(6,dtype=np.float64) * - * cdef _memoryviewslice memviewsliceobj */ - (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_rv)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L1_error) + __pyx_v_c_rv = ((double *)__pyx_t_1); - /* "View.MemoryView":724 - * cdef _memoryviewslice memviewsliceobj - * - * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":886 + * """ + * cdef double* c_rv = rv.data + * cdef np.ndarray[np.float64_t,ndim=1] dipt = np.empty(6,dtype=np.float64) # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): + * cdef double f1 = pow(r2,-1.5) */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { - PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(2, 724, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__15, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 886, __pyx_L1_error) + __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dipt.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_dipt = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 886, __pyx_L1_error) + } else {__pyx_pybuffernd_dipt.diminfo[0].strides = __pyx_pybuffernd_dipt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dipt.diminfo[0].shape = __pyx_pybuffernd_dipt.rcbuffer->pybuffer.shape[0]; } } - #endif + __pyx_t_6 = 0; + __pyx_v_dipt = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 + /* "newanalysis/helpers/helpers.pyx":888 + * cdef np.ndarray[np.float64_t,ndim=1] dipt = np.empty(6,dtype=np.float64) * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice + * cdef double f1 = pow(r2,-1.5) # <<<<<<<<<<<<<< + * cdef double f2 = 3.0 * f1 / r2 + * cdef double f2_0 = f2 * c_rv[0] */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_v_f1 = pow(__pyx_v_r2, -1.5); - /* "View.MemoryView":727 + /* "newanalysis/helpers/helpers.pyx":889 * - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview # <<<<<<<<<<<<<< - * p_src = &memviewsliceobj.from_slice - * else: + * cdef double f1 = pow(r2,-1.5) + * cdef double f2 = 3.0 * f1 / r2 # <<<<<<<<<<<<<< + * cdef double f2_0 = f2 * c_rv[0] + * cdef double f2_1 = f2 * c_rv[1] */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 727, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_7 = (3.0 * __pyx_v_f1); + if (unlikely(__pyx_v_r2 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 889, __pyx_L1_error) + } + __pyx_v_f2 = (((__pyx_t_5numpy_float64_t)__pyx_t_7) / __pyx_v_r2); - /* "View.MemoryView":728 - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, &src) + /* "newanalysis/helpers/helpers.pyx":890 + * cdef double f1 = pow(r2,-1.5) + * cdef double f2 = 3.0 * f1 / r2 + * cdef double f2_0 = f2 * c_rv[0] # <<<<<<<<<<<<<< + * cdef double f2_1 = f2 * c_rv[1] + * cdef double f2_2 = f2 * c_rv[2] */ - __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + __pyx_v_f2_0 = (__pyx_v_f2 * (__pyx_v_c_rv[0])); - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 + /* "newanalysis/helpers/helpers.pyx":891 + * cdef double f2 = 3.0 * f1 / r2 + * cdef double f2_0 = f2 * c_rv[0] + * cdef double f2_1 = f2 * c_rv[1] # <<<<<<<<<<<<<< + * cdef double f2_2 = f2 * c_rv[2] * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice */ - goto __pyx_L3; - } + __pyx_v_f2_1 = (__pyx_v_f2 * (__pyx_v_c_rv[1])); - /* "View.MemoryView":730 - * p_src = &memviewsliceobj.from_slice - * else: - * slice_copy(memview, &src) # <<<<<<<<<<<<<< - * p_src = &src + /* "newanalysis/helpers/helpers.pyx":892 + * cdef double f2_0 = f2 * c_rv[0] + * cdef double f2_1 = f2 * c_rv[1] + * cdef double f2_2 = f2 * c_rv[2] # <<<<<<<<<<<<<< * + * dipt[0] = f2_0 * c_rv[0] - f1 */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + __pyx_v_f2_2 = (__pyx_v_f2 * (__pyx_v_c_rv[2])); - /* "View.MemoryView":731 - * else: - * slice_copy(memview, &src) - * p_src = &src # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":894 + * cdef double f2_2 = f2 * c_rv[2] * + * dipt[0] = f2_0 * c_rv[0] - f1 # <<<<<<<<<<<<<< + * dipt[1] = f2_1 * c_rv[1] - f1 + * dipt[2] = f2_2 * c_rv[2] - f1 */ - __pyx_v_p_src = (&__pyx_v_src); - } - __pyx_L3:; + __pyx_t_8 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_dipt.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dipt.diminfo[0].strides) = ((__pyx_v_f2_0 * (__pyx_v_c_rv[0])) - __pyx_v_f1); - /* "View.MemoryView":737 - * - * - * dst.memview = p_src.memview # <<<<<<<<<<<<<< - * dst.data = p_src.data + /* "newanalysis/helpers/helpers.pyx":895 * + * dipt[0] = f2_0 * c_rv[0] - f1 + * dipt[1] = f2_1 * c_rv[1] - f1 # <<<<<<<<<<<<<< + * dipt[2] = f2_2 * c_rv[2] - f1 + * dipt[3] = f2_0 * c_rv[1] */ - __pyx_t_4 = __pyx_v_p_src->memview; - __pyx_v_dst.memview = __pyx_t_4; + __pyx_t_8 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_dipt.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dipt.diminfo[0].strides) = ((__pyx_v_f2_1 * (__pyx_v_c_rv[1])) - __pyx_v_f1); - /* "View.MemoryView":738 - * - * dst.memview = p_src.memview - * dst.data = p_src.data # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":896 + * dipt[0] = f2_0 * c_rv[0] - f1 + * dipt[1] = f2_1 * c_rv[1] - f1 + * dipt[2] = f2_2 * c_rv[2] - f1 # <<<<<<<<<<<<<< + * dipt[3] = f2_0 * c_rv[1] + * dipt[4] = f2_0 * c_rv[2] + */ + __pyx_t_8 = 2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_dipt.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dipt.diminfo[0].strides) = ((__pyx_v_f2_2 * (__pyx_v_c_rv[2])) - __pyx_v_f1); + + /* "newanalysis/helpers/helpers.pyx":897 + * dipt[1] = f2_1 * c_rv[1] - f1 + * dipt[2] = f2_2 * c_rv[2] - f1 + * dipt[3] = f2_0 * c_rv[1] # <<<<<<<<<<<<<< + * dipt[4] = f2_0 * c_rv[2] + * dipt[5] = f2_1 * c_rv[2] + */ + __pyx_t_8 = 3; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_dipt.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dipt.diminfo[0].strides) = (__pyx_v_f2_0 * (__pyx_v_c_rv[1])); + + /* "newanalysis/helpers/helpers.pyx":898 + * dipt[2] = f2_2 * c_rv[2] - f1 + * dipt[3] = f2_0 * c_rv[1] + * dipt[4] = f2_0 * c_rv[2] # <<<<<<<<<<<<<< + * dipt[5] = f2_1 * c_rv[2] * + */ + __pyx_t_8 = 4; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_dipt.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dipt.diminfo[0].strides) = (__pyx_v_f2_0 * (__pyx_v_c_rv[2])); + + /* "newanalysis/helpers/helpers.pyx":899 + * dipt[3] = f2_0 * c_rv[1] + * dipt[4] = f2_0 * c_rv[2] + * dipt[5] = f2_1 * c_rv[2] # <<<<<<<<<<<<<< * + * return dipt */ - __pyx_t_5 = __pyx_v_p_src->data; - __pyx_v_dst.data = __pyx_t_5; + __pyx_t_8 = 5; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_dipt.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dipt.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dipt.diminfo[0].strides) = (__pyx_v_f2_1 * (__pyx_v_c_rv[2])); - /* "View.MemoryView":743 + /* "newanalysis/helpers/helpers.pyx":901 + * dipt[5] = f2_1 * c_rv[2] * + * return dipt # <<<<<<<<<<<<<< * - * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< - * cdef int *p_suboffset_dim = &suboffset_dim - * cdef Py_ssize_t start, stop, step + * @cython.boundscheck(False) */ - __pyx_v_p_dst = (&__pyx_v_dst); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_dipt); + __pyx_r = ((PyObject *)__pyx_v_dipt); + goto __pyx_L0; - /* "View.MemoryView":744 + /* "newanalysis/helpers/helpers.pyx":878 * - * cdef __Pyx_memviewslice *p_dst = &dst - * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< - * cdef Py_ssize_t start, stop, step - * cdef bint have_start, have_stop, have_step + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTen(np.ndarray[np.float64_t,ndim=1] rv, + * np.float64_t r2): */ - __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rv.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.helpers.dipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dipt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rv.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_dipt); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/helpers.pyx":903 + * return dipt + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( */ - __pyx_t_6 = 0; - if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 748, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_49NQRself(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_49NQRself = {"NQRself", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_49NQRself, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_49NQRself(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_py_xyz = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("NQRself (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 903, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_xyz,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } else { - __pyx_t_9 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_9)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 748, __pyx_L1_error) + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_py_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } - break; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 903, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } - __Pyx_GOTREF(__pyx_t_9); + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "NQRself") < 0)) __PYX_ERR(0, 903, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_v_dim = __pyx_t_6; - __pyx_t_6 = (__pyx_t_6 + 1); + __pyx_v_py_xyz = ((PyArrayObject *)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("NQRself", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 903, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.helpers.NQRself", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_xyz), __pyx_ptype_5numpy_ndarray, 1, "py_xyz", 0))) __PYX_ERR(0, 904, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_7helpers_48NQRself(__pyx_self, __pyx_v_py_xyz); - /* "View.MemoryView":749 - * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - */ - __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0); - if (__pyx_t_2) { + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":753 - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<< - * 0, 0, 0, # have_{start,stop,step} - * False) - */ - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 753, __pyx_L1_error) +static PyObject *__pyx_pf_11newanalysis_7helpers_48NQRself(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_py_xyz) { + int __pyx_v_nwat; + double *__pyx_v_xyz; + double __pyx_v_H1x; + double __pyx_v_H1y; + double __pyx_v_H1z; + double __pyx_v_H2x; + double __pyx_v_H2y; + double __pyx_v_H2z; + double __pyx_v_n2; + double __pyx_v_n3; + double __pyx_v_Exx; + double __pyx_v_Eyy; + double __pyx_v_Ezz; + int __pyx_v_i; + int __pyx_v_k; + int __pyx_v_ind; + PyArrayObject *__pyx_v_py_dipt = 0; + double *__pyx_v_dipt; + double *__pyx_v_B; + double *__pyx_v_T; + __Pyx_LocalBuf_ND __pyx_pybuffernd_py_dipt; + __Pyx_Buffer __pyx_pybuffer_py_dipt; + __Pyx_LocalBuf_ND __pyx_pybuffernd_py_xyz; + __Pyx_Buffer __pyx_pybuffer_py_xyz; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + char *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + long __pyx_t_9; + long __pyx_t_10; + long __pyx_t_11; + int __pyx_t_12; + long __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("NQRself", 0); + __pyx_pybuffer_py_dipt.pybuffer.buf = NULL; + __pyx_pybuffer_py_dipt.refcount = 0; + __pyx_pybuffernd_py_dipt.data = NULL; + __pyx_pybuffernd_py_dipt.rcbuffer = &__pyx_pybuffer_py_dipt; + __pyx_pybuffer_py_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_py_xyz.refcount = 0; + __pyx_pybuffernd_py_xyz.data = NULL; + __pyx_pybuffernd_py_xyz.rcbuffer = &__pyx_pybuffer_py_xyz; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_py_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 903, __pyx_L1_error) + } + __pyx_pybuffernd_py_xyz.diminfo[0].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_xyz.diminfo[0].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_py_xyz.diminfo[1].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_py_xyz.diminfo[1].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[1]; - /* "View.MemoryView":750 - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + /* "newanalysis/helpers/helpers.pyx":906 + * def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): + * + * cdef int nwat = len(py_xyz)//3 # number of water molecules # <<<<<<<<<<<<<< + * cdef double *xyz = py_xyz.data + * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 750, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_py_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 906, __pyx_L1_error) + __pyx_v_nwat = __Pyx_div_Py_ssize_t(__pyx_t_1, 3); - /* "View.MemoryView":749 + /* "newanalysis/helpers/helpers.pyx":907 * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * cdef int nwat = len(py_xyz)//3 # number of water molecules + * cdef double *xyz = py_xyz.data # <<<<<<<<<<<<<< + * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * cdef double Exx = -2.3067236 # -2.0486*1.126 */ - goto __pyx_L6; - } + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_py_xyz)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 907, __pyx_L1_error) + __pyx_v_xyz = ((double *)__pyx_t_2); - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 + /* "newanalysis/helpers/helpers.pyx":909 + * cdef double *xyz = py_xyz.data + * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * cdef double Exx = -2.3067236 # -2.0486*1.126 # <<<<<<<<<<<<<< + * cdef double Eyy = 2.0364836 # 1.8086*1.126 + * cdef double Ezz = 0.27024 # 0.2400*1.126 */ - __pyx_t_2 = (__pyx_v_index == Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_v_Exx = -2.3067236; - /* "View.MemoryView":757 - * False) - * elif index is None: - * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 + /* "newanalysis/helpers/helpers.pyx":910 + * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * cdef double Exx = -2.3067236 # -2.0486*1.126 + * cdef double Eyy = 2.0364836 # 1.8086*1.126 # <<<<<<<<<<<<<< + * cdef double Ezz = 0.27024 # 0.2400*1.126 + * cdef int i, k, ind */ - (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + __pyx_v_Eyy = 2.0364836; - /* "View.MemoryView":758 - * elif index is None: - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 + /* "newanalysis/helpers/helpers.pyx":911 + * cdef double Exx = -2.3067236 # -2.0486*1.126 + * cdef double Eyy = 2.0364836 # 1.8086*1.126 + * cdef double Ezz = 0.27024 # 0.2400*1.126 # <<<<<<<<<<<<<< + * cdef int i, k, ind + * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) */ - (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + __pyx_v_Ezz = 0.27024; - /* "View.MemoryView":759 - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< - * new_ndim += 1 - * else: + /* "newanalysis/helpers/helpers.pyx":913 + * cdef double Ezz = 0.27024 # 0.2400*1.126 + * cdef int i, k, ind + * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *dipt = py_dipt.data + * */ - (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 913, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 913, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_nwat * 6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 913, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 913, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 913, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 913, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 913, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 913, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 913, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 913, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_py_dipt = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 913, __pyx_L1_error) + } else {__pyx_pybuffernd_py_dipt.diminfo[0].strides = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_dipt.diminfo[0].shape = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_8 = 0; + __pyx_v_py_dipt = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":760 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 # <<<<<<<<<<<<<< - * else: - * start = index.start or 0 - */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - */ - goto __pyx_L6; - } - - /* "View.MemoryView":762 - * new_ndim += 1 - * else: - * start = index.start or 0 # <<<<<<<<<<<<<< - * stop = index.stop or 0 - * step = index.step or 0 - */ - /*else*/ { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L7_bool_binop_done:; - __pyx_v_start = __pyx_t_10; - - /* "View.MemoryView":763 - * else: - * start = index.start or 0 - * stop = index.stop or 0 # <<<<<<<<<<<<<< - * step = index.step or 0 + /* "newanalysis/helpers/helpers.pyx":914 + * cdef int i, k, ind + * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) + * cdef double *dipt = py_dipt.data # <<<<<<<<<<<<<< * + * with nogil, parallel(): */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 763, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 763, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 763, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L9_bool_binop_done:; - __pyx_v_stop = __pyx_t_10; + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_py_dipt)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 914, __pyx_L1_error) + __pyx_v_dipt = ((double *)__pyx_t_2); - /* "View.MemoryView":764 - * start = index.start or 0 - * stop = index.stop or 0 - * step = index.step or 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":916 + * cdef double *dipt = py_dipt.data * - * have_start = index.start is not None + * with nogil, parallel(): # <<<<<<<<<<<<<< + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 764, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 764, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L11_bool_binop_done:; - __pyx_v_step = __pyx_t_10; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + { + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + #ifdef _OPENMP + #pragma omp parallel private(__pyx_v_B, __pyx_v_T) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + /* Initialize private variables to invalid values */ + __pyx_v_B = ((double *)1); + __pyx_v_T = ((double *)1); - /* "View.MemoryView":766 - * step = index.step or 0 + /* "newanalysis/helpers/helpers.pyx":917 * - * have_start = index.start is not None # <<<<<<<<<<<<<< - * have_stop = index.stop is not None - * have_step = index.step is not None + * with nogil, parallel(): + * B = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< + * T = malloc(sizeof(double) * 9) + * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_start = __pyx_t_1; + __pyx_v_B = ((double *)malloc(((sizeof(double)) * 9))); - /* "View.MemoryView":767 - * - * have_start = index.start is not None - * have_stop = index.stop is not None # <<<<<<<<<<<<<< - * have_step = index.step is not None - * + /* "newanalysis/helpers/helpers.pyx":918 + * with nogil, parallel(): + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< + * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules + * for k in range(9): */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 767, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_stop = __pyx_t_1; + __pyx_v_T = ((double *)malloc(((sizeof(double)) * 9))); - /* "View.MemoryView":768 - * have_start = index.start is not None - * have_stop = index.stop is not None - * have_step = index.step is not None # <<<<<<<<<<<<<< - * - * slice_memviewslice( + /* "newanalysis/helpers/helpers.pyx":919 + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) + * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules # <<<<<<<<<<<<<< + * for k in range(9): + * B[k] = 0.0 */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_step = __pyx_t_1; + __pyx_t_9 = (__pyx_v_nwat * 9); + { + double __pyx_parallel_temp0 = ((double)__PYX_NAN()); + double __pyx_parallel_temp1 = ((double)__PYX_NAN()); + double __pyx_parallel_temp2 = ((double)__PYX_NAN()); + double __pyx_parallel_temp3 = ((double)__PYX_NAN()); + double __pyx_parallel_temp4 = ((double)__PYX_NAN()); + double __pyx_parallel_temp5 = ((double)__PYX_NAN()); + int __pyx_parallel_temp6 = ((int)0xbad0bad0); + int __pyx_parallel_temp7 = ((int)0xbad0bad0); + int __pyx_parallel_temp8 = ((int)0xbad0bad0); + double __pyx_parallel_temp9 = ((double)__PYX_NAN()); + double __pyx_parallel_temp10 = ((double)__PYX_NAN()); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + __pyx_t_11 = (__pyx_t_9 - 0 + 9 - 9/abs(9)) / 9; + if (__pyx_t_11 > 0) + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_H1x) lastprivate(__pyx_v_H1y) lastprivate(__pyx_v_H1z) lastprivate(__pyx_v_H2x) lastprivate(__pyx_v_H2y) lastprivate(__pyx_v_H2z) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ind) lastprivate(__pyx_v_k) lastprivate(__pyx_v_n2) lastprivate(__pyx_v_n3) + #endif /* _OPENMP */ + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_i = (int)(0 + 9 * __pyx_t_10); + /* Initialize private variables to invalid values */ + __pyx_v_H1x = ((double)__PYX_NAN()); + __pyx_v_H1y = ((double)__PYX_NAN()); + __pyx_v_H1z = ((double)__PYX_NAN()); + __pyx_v_H2x = ((double)__PYX_NAN()); + __pyx_v_H2y = ((double)__PYX_NAN()); + __pyx_v_H2z = ((double)__PYX_NAN()); + __pyx_v_ind = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); + __pyx_v_n2 = ((double)__PYX_NAN()); + __pyx_v_n3 = ((double)__PYX_NAN()); - /* "View.MemoryView":770 - * have_step = index.step is not None - * - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + /* "newanalysis/helpers/helpers.pyx":920 + * T = malloc(sizeof(double) * 9) + * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules + * for k in range(9): # <<<<<<<<<<<<<< + * B[k] = 0.0 + * T[k] = 0.0 */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 770, __pyx_L1_error) + for (__pyx_t_12 = 0; __pyx_t_12 < 9; __pyx_t_12+=1) { + __pyx_v_k = __pyx_t_12; - /* "View.MemoryView":776 - * have_start, have_stop, have_step, - * True) - * new_ndim += 1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":921 + * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules + * for k in range(9): + * B[k] = 0.0 # <<<<<<<<<<<<<< + * T[k] = 0.0 * - * if isinstance(memview, _memoryviewslice): */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - } - __pyx_L6:; + (__pyx_v_B[__pyx_v_k]) = 0.0; - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step + /* "newanalysis/helpers/helpers.pyx":922 + * for k in range(9): + * B[k] = 0.0 + * T[k] = 0.0 # <<<<<<<<<<<<<< * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( + * H1x = xyz[i+3]-xyz[i] */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + (__pyx_v_T[__pyx_v_k]) = 0.0; + } - /* "View.MemoryView":778 - * new_ndim += 1 + /* "newanalysis/helpers/helpers.pyx":924 + * T[k] = 0.0 * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, + * H1x = xyz[i+3]-xyz[i] # <<<<<<<<<<<<<< + * H1y = xyz[i+4]-xyz[i+1] + * H1z = xyz[i+5]-xyz[i+2] */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_v_H1x = ((__pyx_v_xyz[(__pyx_v_i + 3)]) - (__pyx_v_xyz[__pyx_v_i])); - /* "View.MemoryView":779 + /* "newanalysis/helpers/helpers.pyx":925 * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, + * H1x = xyz[i+3]-xyz[i] + * H1y = xyz[i+4]-xyz[i+1] # <<<<<<<<<<<<<< + * H1z = xyz[i+5]-xyz[i+2] + * H2x = xyz[i+6]-xyz[i] */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_v_H1y = ((__pyx_v_xyz[(__pyx_v_i + 4)]) - (__pyx_v_xyz[(__pyx_v_i + 1)])); - /* "View.MemoryView":780 - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< - * memviewsliceobj.to_dtype_func, - * memview.dtype_is_object) + /* "newanalysis/helpers/helpers.pyx":926 + * H1x = xyz[i+3]-xyz[i] + * H1y = xyz[i+4]-xyz[i+1] + * H1z = xyz[i+5]-xyz[i+2] # <<<<<<<<<<<<<< + * H2x = xyz[i+6]-xyz[i] + * H2y = xyz[i+7]-xyz[i+1] */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 780, __pyx_L1_error) } + __pyx_v_H1z = ((__pyx_v_xyz[(__pyx_v_i + 5)]) - (__pyx_v_xyz[(__pyx_v_i + 2)])); - /* "View.MemoryView":781 - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * else: + /* "newanalysis/helpers/helpers.pyx":927 + * H1y = xyz[i+4]-xyz[i+1] + * H1z = xyz[i+5]-xyz[i+2] + * H2x = xyz[i+6]-xyz[i] # <<<<<<<<<<<<<< + * H2y = xyz[i+7]-xyz[i+1] + * H2z = xyz[i+8]-xyz[i+2] */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 781, __pyx_L1_error) } + __pyx_v_H2x = ((__pyx_v_xyz[(__pyx_v_i + 6)]) - (__pyx_v_xyz[__pyx_v_i])); - /* "View.MemoryView":779 + /* "newanalysis/helpers/helpers.pyx":928 + * H1z = xyz[i+5]-xyz[i+2] + * H2x = xyz[i+6]-xyz[i] + * H2y = xyz[i+7]-xyz[i+1] # <<<<<<<<<<<<<< + * H2z = xyz[i+8]-xyz[i+2] * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 779, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 779, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_v_H2y = ((__pyx_v_xyz[(__pyx_v_i + 7)]) - (__pyx_v_xyz[(__pyx_v_i + 1)])); - /* "View.MemoryView":778 - * new_ndim += 1 + /* "newanalysis/helpers/helpers.pyx":929 + * H2x = xyz[i+6]-xyz[i] + * H2y = xyz[i+7]-xyz[i+1] + * H2z = xyz[i+8]-xyz[i+2] # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, + * B[3] = (H1x-H2x) */ - } + __pyx_v_H2z = ((__pyx_v_xyz[(__pyx_v_i + 8)]) - (__pyx_v_xyz[(__pyx_v_i + 2)])); - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) + /* "newanalysis/helpers/helpers.pyx":931 + * H2z = xyz[i+8]-xyz[i+2] * + * B[3] = (H1x-H2x) # <<<<<<<<<<<<<< + * B[4] = (H1y-H2y) + * B[5] = (H1z-H2z) */ - /*else*/ { - __Pyx_XDECREF(((PyObject *)__pyx_r)); + (__pyx_v_B[3]) = (__pyx_v_H1x - __pyx_v_H2x); - /* "View.MemoryView":785 - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, - * memview.dtype_is_object) # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":932 * + * B[3] = (H1x-H2x) + * B[4] = (H1y-H2y) # <<<<<<<<<<<<<< + * B[5] = (H1z-H2z) + * B[6] = (H1x+H2x) */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + (__pyx_v_B[4]) = (__pyx_v_H1y - __pyx_v_H2y); - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * + /* "newanalysis/helpers/helpers.pyx":933 + * B[3] = (H1x-H2x) + * B[4] = (H1y-H2y) + * B[5] = (H1z-H2z) # <<<<<<<<<<<<<< + * B[6] = (H1x+H2x) + * B[7] = (H1y+H2y) */ - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 784, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - } + (__pyx_v_B[5]) = (__pyx_v_H1z - __pyx_v_H2z); - /* "View.MemoryView":712 - * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step + /* "newanalysis/helpers/helpers.pyx":934 + * B[4] = (H1y-H2y) + * B[5] = (H1z-H2z) + * B[6] = (H1x+H2x) # <<<<<<<<<<<<<< + * B[7] = (H1y+H2y) + * B[8] = (H1z+H2z) */ + (__pyx_v_B[6]) = (__pyx_v_H1x + __pyx_v_H2x); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":809 + /* "newanalysis/helpers/helpers.pyx":935 + * B[5] = (H1z-H2z) + * B[6] = (H1x+H2x) + * B[7] = (H1y+H2y) # <<<<<<<<<<<<<< + * B[8] = (H1z+H2z) * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ + (__pyx_v_B[7]) = (__pyx_v_H1y + __pyx_v_H2y); -static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { - Py_ssize_t __pyx_v_new_shape; - int __pyx_v_negative_step; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; + /* "newanalysis/helpers/helpers.pyx":936 + * B[6] = (H1x+H2x) + * B[7] = (H1y+H2y) + * B[8] = (H1z+H2z) # <<<<<<<<<<<<<< + * + * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 + */ + (__pyx_v_B[8]) = (__pyx_v_H1z + __pyx_v_H2z); - /* "View.MemoryView":829 - * cdef bint negative_step + /* "newanalysis/helpers/helpers.pyx":938 + * B[8] = (H1z+H2z) * - * if not is_slice: # <<<<<<<<<<<<<< + * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 # <<<<<<<<<<<<<< + * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 * - * if start < 0: */ - __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_1) { + __pyx_v_n2 = pow(((((__pyx_v_B[3]) * (__pyx_v_B[3])) + ((__pyx_v_B[4]) * (__pyx_v_B[4]))) + ((__pyx_v_B[5]) * (__pyx_v_B[5]))), .5); - /* "View.MemoryView":831 - * if not is_slice: + /* "newanalysis/helpers/helpers.pyx":939 * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: + * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 + * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 # <<<<<<<<<<<<<< + * + * B[3] /= n2 */ - __pyx_t_1 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_1) { + __pyx_v_n3 = pow(((((__pyx_v_B[6]) * (__pyx_v_B[6])) + ((__pyx_v_B[7]) * (__pyx_v_B[7]))) + ((__pyx_v_B[8]) * (__pyx_v_B[8]))), .5); - /* "View.MemoryView":832 + /* "newanalysis/helpers/helpers.pyx":941 + * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 * - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) + * B[3] /= n2 # <<<<<<<<<<<<<< + * B[4] /= n2 + * B[5] /= n2 */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + __pyx_t_13 = 3; + if (unlikely(__pyx_v_n2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 941, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_13]) = ((__pyx_v_B[__pyx_t_13]) / __pyx_v_n2); - /* "View.MemoryView":831 - * if not is_slice: + /* "newanalysis/helpers/helpers.pyx":942 * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: + * B[3] /= n2 + * B[4] /= n2 # <<<<<<<<<<<<<< + * B[5] /= n2 + * B[6] /= n3 */ - } + __pyx_t_13 = 4; + if (unlikely(__pyx_v_n2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 942, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_13]) = ((__pyx_v_B[__pyx_t_13]) / __pyx_v_n2); - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - * else: + /* "newanalysis/helpers/helpers.pyx":943 + * B[3] /= n2 + * B[4] /= n2 + * B[5] /= n2 # <<<<<<<<<<<<<< + * B[6] /= n3 + * B[7] /= n3 */ - __pyx_t_1 = (0 <= __pyx_v_start); - if (__pyx_t_1) { - __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); - } - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_13 = 5; + if (unlikely(__pyx_v_n2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 943, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_13]) = ((__pyx_v_B[__pyx_t_13]) / __pyx_v_n2); - /* "View.MemoryView":834 - * start += shape - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< - * else: - * + /* "newanalysis/helpers/helpers.pyx":944 + * B[4] /= n2 + * B[5] /= n2 + * B[6] /= n3 # <<<<<<<<<<<<<< + * B[7] /= n3 + * B[8] /= n3 */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 834, __pyx_L1_error) + __pyx_t_13 = 6; + if (unlikely(__pyx_v_n3 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 944, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_13]) = ((__pyx_v_B[__pyx_t_13]) / __pyx_v_n3); - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - * else: + /* "newanalysis/helpers/helpers.pyx":945 + * B[5] /= n2 + * B[6] /= n3 + * B[7] /= n3 # <<<<<<<<<<<<<< + * B[8] /= n3 + * */ - } + __pyx_t_13 = 7; + if (unlikely(__pyx_v_n3 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 945, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_13]) = ((__pyx_v_B[__pyx_t_13]) / __pyx_v_n3); - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":946 + * B[6] /= n3 + * B[7] /= n3 + * B[8] /= n3 # <<<<<<<<<<<<<< * - * if start < 0: + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product */ - goto __pyx_L3; - } + __pyx_t_13 = 8; + if (unlikely(__pyx_v_n3 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 946, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_13]) = ((__pyx_v_B[__pyx_t_13]) / __pyx_v_n3); - /* "View.MemoryView":837 - * else: - * - * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":948 + * B[8] /= n3 * - * if have_step and step == 0: + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product # <<<<<<<<<<<<<< + * B[1] = B[5]*B[6]-B[3]*B[8] + * B[2] = B[3]*B[7]-B[4]*B[6] */ - /*else*/ { - __pyx_t_1 = ((__pyx_v_have_step != 0) != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_1 = ((__pyx_v_step < 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L6_bool_binop_done:; - __pyx_v_negative_step = __pyx_t_2; + (__pyx_v_B[0]) = (((__pyx_v_B[4]) * (__pyx_v_B[8])) - ((__pyx_v_B[5]) * (__pyx_v_B[7]))); - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 + /* "newanalysis/helpers/helpers.pyx":949 * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + * B[1] = B[5]*B[6]-B[3]*B[8] # <<<<<<<<<<<<<< + * B[2] = B[3]*B[7]-B[4]*B[6] * */ - __pyx_t_1 = (__pyx_v_have_step != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_1 = ((__pyx_v_step == 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L9_bool_binop_done:; - if (__pyx_t_2) { + (__pyx_v_B[1]) = (((__pyx_v_B[5]) * (__pyx_v_B[6])) - ((__pyx_v_B[3]) * (__pyx_v_B[8]))); - /* "View.MemoryView":840 - * - * if have_step and step == 0: - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":950 + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + * B[1] = B[5]*B[6]-B[3]*B[8] + * B[2] = B[3]*B[7]-B[4]*B[6] # <<<<<<<<<<<<<< * + * # B dot T */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 840, __pyx_L1_error) + (__pyx_v_B[2]) = (((__pyx_v_B[3]) * (__pyx_v_B[7])) - ((__pyx_v_B[4]) * (__pyx_v_B[6]))); - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 - * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + /* "newanalysis/helpers/helpers.pyx":953 * + * # B dot T + * T[0] = B[0]*Exx # <<<<<<<<<<<<<< + * T[1] = B[1]*Exx + * T[2] = B[2]*Exx */ - } + (__pyx_v_T[0]) = ((__pyx_v_B[0]) * __pyx_v_Exx); - /* "View.MemoryView":843 - * - * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape + /* "newanalysis/helpers/helpers.pyx":954 + * # B dot T + * T[0] = B[0]*Exx + * T[1] = B[1]*Exx # <<<<<<<<<<<<<< + * T[2] = B[2]*Exx + * T[3] = B[3]*Eyy */ - __pyx_t_2 = (__pyx_v_have_start != 0); - if (__pyx_t_2) { + (__pyx_v_T[1]) = ((__pyx_v_B[1]) * __pyx_v_Exx); - /* "View.MemoryView":844 - * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: + /* "newanalysis/helpers/helpers.pyx":955 + * T[0] = B[0]*Exx + * T[1] = B[1]*Exx + * T[2] = B[2]*Exx # <<<<<<<<<<<<<< + * T[3] = B[3]*Eyy + * T[4] = B[4]*Eyy */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { + (__pyx_v_T[2]) = ((__pyx_v_B[2]) * __pyx_v_Exx); - /* "View.MemoryView":845 - * if have_start: - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if start < 0: - * start = 0 + /* "newanalysis/helpers/helpers.pyx":956 + * T[1] = B[1]*Exx + * T[2] = B[2]*Exx + * T[3] = B[3]*Eyy # <<<<<<<<<<<<<< + * T[4] = B[4]*Eyy + * T[5] = B[5]*Eyy */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + (__pyx_v_T[3]) = ((__pyx_v_B[3]) * __pyx_v_Eyy); - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "newanalysis/helpers/helpers.pyx":957 + * T[2] = B[2]*Exx + * T[3] = B[3]*Eyy + * T[4] = B[4]*Eyy # <<<<<<<<<<<<<< + * T[5] = B[5]*Eyy + * T[6] = B[6]*Ezz */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { + (__pyx_v_T[4]) = ((__pyx_v_B[4]) * __pyx_v_Eyy); - /* "View.MemoryView":847 - * start += shape - * if start < 0: - * start = 0 # <<<<<<<<<<<<<< - * elif start >= shape: - * if negative_step: + /* "newanalysis/helpers/helpers.pyx":958 + * T[3] = B[3]*Eyy + * T[4] = B[4]*Eyy + * T[5] = B[5]*Eyy # <<<<<<<<<<<<<< + * T[6] = B[6]*Ezz + * T[7] = B[7]*Ezz */ - __pyx_v_start = 0; + (__pyx_v_T[5]) = ((__pyx_v_B[5]) * __pyx_v_Eyy); - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "newanalysis/helpers/helpers.pyx":959 + * T[4] = B[4]*Eyy + * T[5] = B[5]*Eyy + * T[6] = B[6]*Ezz # <<<<<<<<<<<<<< + * T[7] = B[7]*Ezz + * T[8] = B[8]*Ezz */ - } + (__pyx_v_T[6]) = ((__pyx_v_B[6]) * __pyx_v_Ezz); - /* "View.MemoryView":844 + /* "newanalysis/helpers/helpers.pyx":960 + * T[5] = B[5]*Eyy + * T[6] = B[6]*Ezz + * T[7] = B[7]*Ezz # <<<<<<<<<<<<<< + * T[8] = B[8]*Ezz * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: */ - goto __pyx_L12; - } + (__pyx_v_T[7]) = ((__pyx_v_B[7]) * __pyx_v_Ezz); - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 + /* "newanalysis/helpers/helpers.pyx":961 + * T[6] = B[6]*Ezz + * T[7] = B[7]*Ezz + * T[8] = B[8]*Ezz # <<<<<<<<<<<<<< + * + * ind = (i//9)*6 */ - __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0); - if (__pyx_t_2) { + (__pyx_v_T[8]) = ((__pyx_v_B[8]) * __pyx_v_Ezz); - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/helpers.pyx":963 + * T[8] = B[8]*Ezz + * + * ind = (i//9)*6 # <<<<<<<<<<<<<< + * + * # (B dot T) dot B.T */ - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + __pyx_v_ind = (__Pyx_div_long(__pyx_v_i, 9) * 6); - /* "View.MemoryView":850 - * elif start >= shape: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = shape + /* "newanalysis/helpers/helpers.pyx":966 + * + * # (B dot T) dot B.T + * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B # <<<<<<<<<<<<<< + * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 + * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 */ - __pyx_v_start = (__pyx_v_shape - 1); + (__pyx_v_dipt[__pyx_v_ind]) = ((((__pyx_v_T[0]) * (__pyx_v_B[0])) + ((__pyx_v_T[3]) * (__pyx_v_B[3]))) + ((__pyx_v_T[6]) * (__pyx_v_B[6]))); - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/helpers.pyx":967 + * # (B dot T) dot B.T + * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B + * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 # <<<<<<<<<<<<<< + * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 + * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 */ - goto __pyx_L14; - } + (__pyx_v_dipt[(__pyx_v_ind + 1)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[1])) + ((__pyx_v_T[4]) * (__pyx_v_B[4]))) + ((__pyx_v_T[7]) * (__pyx_v_B[7]))); - /* "View.MemoryView":852 - * start = shape - 1 - * else: - * start = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: + /* "newanalysis/helpers/helpers.pyx":968 + * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B + * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 + * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 # <<<<<<<<<<<<<< + * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 + * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 */ - /*else*/ { - __pyx_v_start = __pyx_v_shape; - } - __pyx_L14:; + (__pyx_v_dipt[(__pyx_v_ind + 2)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[2])) + ((__pyx_v_T[5]) * (__pyx_v_B[5]))) + ((__pyx_v_T[8]) * (__pyx_v_B[8]))); - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 + /* "newanalysis/helpers/helpers.pyx":969 + * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 + * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 + * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 # <<<<<<<<<<<<<< + * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 + * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric */ - } - __pyx_L12:; + (__pyx_v_dipt[(__pyx_v_ind + 3)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[0])) + ((__pyx_v_T[4]) * (__pyx_v_B[3]))) + ((__pyx_v_T[7]) * (__pyx_v_B[6]))); - /* "View.MemoryView":843 - * + /* "newanalysis/helpers/helpers.pyx":970 + * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 + * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 + * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 # <<<<<<<<<<<<<< + * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape */ - goto __pyx_L11; - } + (__pyx_v_dipt[(__pyx_v_ind + 4)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[0])) + ((__pyx_v_T[5]) * (__pyx_v_B[3]))) + ((__pyx_v_T[8]) * (__pyx_v_B[6]))); - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/helpers.pyx":971 + * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 + * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 + * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric # <<<<<<<<<<<<<< + * + * free(B) */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + (__pyx_v_dipt[(__pyx_v_ind + 5)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[1])) + ((__pyx_v_T[5]) * (__pyx_v_B[4]))) + ((__pyx_v_T[8]) * (__pyx_v_B[7]))); + goto __pyx_L17; + __pyx_L12_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L16; + __pyx_L16:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates2) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_H1x; + __pyx_parallel_temp1 = __pyx_v_H1y; + __pyx_parallel_temp2 = __pyx_v_H1z; + __pyx_parallel_temp3 = __pyx_v_H2x; + __pyx_parallel_temp4 = __pyx_v_H2y; + __pyx_parallel_temp5 = __pyx_v_H2z; + __pyx_parallel_temp6 = __pyx_v_i; + __pyx_parallel_temp7 = __pyx_v_ind; + __pyx_parallel_temp8 = __pyx_v_k; + __pyx_parallel_temp9 = __pyx_v_n2; + __pyx_parallel_temp10 = __pyx_v_n3; + } + __pyx_L17:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_H1x = __pyx_parallel_temp0; + __pyx_v_H1y = __pyx_parallel_temp1; + __pyx_v_H1z = __pyx_parallel_temp2; + __pyx_v_H2x = __pyx_parallel_temp3; + __pyx_v_H2y = __pyx_parallel_temp4; + __pyx_v_H2z = __pyx_parallel_temp5; + __pyx_v_i = __pyx_parallel_temp6; + __pyx_v_ind = __pyx_parallel_temp7; + __pyx_v_k = __pyx_parallel_temp8; + __pyx_v_n2 = __pyx_parallel_temp9; + __pyx_v_n3 = __pyx_parallel_temp10; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L8_error; + } + } + } - /* "View.MemoryView":855 - * else: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = 0 + /* "newanalysis/helpers/helpers.pyx":973 + * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric + * + * free(B) # <<<<<<<<<<<<<< + * free(T) + * */ - __pyx_v_start = (__pyx_v_shape - 1); + free(__pyx_v_B); - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/helpers.pyx":974 + * + * free(B) + * free(T) # <<<<<<<<<<<<<< + * + * return py_dipt */ - goto __pyx_L15; + free(__pyx_v_T); + goto __pyx_L19; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L19; + __pyx_L19:; + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP +} +#endif /* _OPENMP */ + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif } - /* "View.MemoryView":857 - * start = shape - 1 - * else: - * start = 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":916 + * cdef double *dipt = py_dipt.data * - * if have_stop: + * with nogil, parallel(): # <<<<<<<<<<<<<< + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) */ - /*else*/ { - __pyx_v_start = 0; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; } - __pyx_L15:; - } - __pyx_L11:; + } - /* "View.MemoryView":859 - * start = 0 + /* "newanalysis/helpers/helpers.pyx":976 + * free(T) * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape - */ - __pyx_t_2 = (__pyx_v_have_stop != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":860 + * return py_dipt # <<<<<<<<<<<<<< * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: + * @cython.boundscheck(False) */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_py_dipt); + __pyx_r = ((PyObject *)__pyx_v_py_dipt); + goto __pyx_L0; - /* "View.MemoryView":861 - * if have_stop: - * if stop < 0: - * stop += shape # <<<<<<<<<<<<<< - * if stop < 0: - * stop = 0 + /* "newanalysis/helpers/helpers.pyx":903 + * return dipt + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): + * */ - __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: - */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.helpers.NQRself", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_py_dipt); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":863 - * stop += shape - * if stop < 0: - * stop = 0 # <<<<<<<<<<<<<< - * elif stop > shape: - * stop = shape +/* "newanalysis/helpers/helpers.pyx":978 + * return py_dipt + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def waterRotationMatrix(double [:,:] coor): + * cdef int nwat = len(coor)//3 # number of water molecules */ - __pyx_v_stop = 0; - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: - */ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_51waterRotationMatrix(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_51waterRotationMatrix = {"waterRotationMatrix", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_51waterRotationMatrix, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_51waterRotationMatrix(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("waterRotationMatrix (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 978, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } - - /* "View.MemoryView":860 - * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: - */ - goto __pyx_L17; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 978, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } - - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: - */ - __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":865 - * stop = 0 - * elif stop > shape: - * stop = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: - */ - __pyx_v_stop = __pyx_v_shape; - - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: - */ + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "waterRotationMatrix") < 0)) __PYX_ERR(0, 978, __pyx_L3_error) } - __pyx_L17:; - - /* "View.MemoryView":859 - * start = 0 - * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape - */ - goto __pyx_L16; + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 979, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("waterRotationMatrix", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 978, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __Pyx_AddTraceback("newanalysis.helpers.waterRotationMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_50waterRotationMatrix(__pyx_self, __pyx_v_coor); - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":868 - * else: - * if negative_step: - * stop = -1 # <<<<<<<<<<<<<< - * else: - * stop = shape - */ - __pyx_v_stop = -1L; +static PyObject *__pyx_pf_11newanalysis_7helpers_50waterRotationMatrix(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor) { + int __pyx_v_nwat; + double __pyx_v_H1x; + double __pyx_v_H1y; + double __pyx_v_H1z; + double __pyx_v_H2x; + double __pyx_v_H2y; + double __pyx_v_H2z; + double __pyx_v_n2; + double __pyx_v_n3; + int __pyx_v_i; + int __pyx_v_k; + int __pyx_v_ind; + __Pyx_memviewslice __pyx_v_B_out = { 0, 0, { 0 }, { 0 }, { 0 } }; + double *__pyx_v_B; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_8; + long __pyx_t_9; + long __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + long __pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("waterRotationMatrix", 0); - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: + /* "newanalysis/helpers/helpers.pyx":980 + * @cython.boundscheck(False) + * def waterRotationMatrix(double [:,:] coor): + * cdef int nwat = len(coor)//3 # number of water molecules # <<<<<<<<<<<<<< + * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * cdef int i, k, ind */ - goto __pyx_L19; - } + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_coor); + __pyx_v_nwat = __Pyx_div_Py_ssize_t(__pyx_t_1, 3); - /* "View.MemoryView":870 - * stop = -1 - * else: - * stop = shape # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":983 + * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * cdef int i, k, ind + * cdef double [:,:,:] B_out = np.zeros((nwat,3,3)) # rotation matrix to return from parallel code # <<<<<<<<<<<<<< * - * if not have_step: + * with nogil, parallel(): */ - /*else*/ { - __pyx_v_stop = __pyx_v_shape; - } - __pyx_L19:; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nwat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 983, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_3)) __PYX_ERR(0, 983, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_3)) __PYX_ERR(0, 983, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } - __pyx_L16:; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 983, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_B_out = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":872 - * stop = shape - * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 + /* "newanalysis/helpers/helpers.pyx":985 + * cdef double [:,:,:] B_out = np.zeros((nwat,3,3)) # rotation matrix to return from parallel code * + * with nogil, parallel(): # <<<<<<<<<<<<<< + * B = malloc(sizeof(double) * 9) + * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules */ - __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0); - if (__pyx_t_2) { + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + { + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + #ifdef _OPENMP + #pragma omp parallel private(__pyx_v_B) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_6, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + /* Initialize private variables to invalid values */ + __pyx_v_B = ((double *)1); - /* "View.MemoryView":873 - * - * if not have_step: - * step = 1 # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":986 * + * with nogil, parallel(): + * B = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< + * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules + * for k in range(9): */ - __pyx_v_step = 1; + __pyx_v_B = ((double *)malloc(((sizeof(double)) * 9))); - /* "View.MemoryView":872 - * stop = shape - * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 - * + /* "newanalysis/helpers/helpers.pyx":987 + * with nogil, parallel(): + * B = malloc(sizeof(double) * 9) + * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules # <<<<<<<<<<<<<< + * for k in range(9): + * B[k] = 0.0 */ - } + __pyx_t_8 = (__pyx_v_nwat * 3); + { + double __pyx_parallel_temp0 = ((double)__PYX_NAN()); + double __pyx_parallel_temp1 = ((double)__PYX_NAN()); + double __pyx_parallel_temp2 = ((double)__PYX_NAN()); + double __pyx_parallel_temp3 = ((double)__PYX_NAN()); + double __pyx_parallel_temp4 = ((double)__PYX_NAN()); + double __pyx_parallel_temp5 = ((double)__PYX_NAN()); + int __pyx_parallel_temp6 = ((int)0xbad0bad0); + int __pyx_parallel_temp7 = ((int)0xbad0bad0); + int __pyx_parallel_temp8 = ((int)0xbad0bad0); + double __pyx_parallel_temp9 = ((double)__PYX_NAN()); + double __pyx_parallel_temp10 = ((double)__PYX_NAN()); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + __pyx_t_10 = (__pyx_t_8 - 0 + 3 - 3/abs(3)) / 3; + if (__pyx_t_10 > 0) + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_H1x) lastprivate(__pyx_v_H1y) lastprivate(__pyx_v_H1z) lastprivate(__pyx_v_H2x) lastprivate(__pyx_v_H2y) lastprivate(__pyx_v_H2z) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ind) lastprivate(__pyx_v_k) lastprivate(__pyx_v_n2) lastprivate(__pyx_v_n3) + #endif /* _OPENMP */ + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_i = (int)(0 + 3 * __pyx_t_9); + /* Initialize private variables to invalid values */ + __pyx_v_H1x = ((double)__PYX_NAN()); + __pyx_v_H1y = ((double)__PYX_NAN()); + __pyx_v_H1z = ((double)__PYX_NAN()); + __pyx_v_H2x = ((double)__PYX_NAN()); + __pyx_v_H2y = ((double)__PYX_NAN()); + __pyx_v_H2z = ((double)__PYX_NAN()); + __pyx_v_ind = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); + __pyx_v_n2 = ((double)__PYX_NAN()); + __pyx_v_n3 = ((double)__PYX_NAN()); - /* "View.MemoryView":877 - * - * with cython.cdivision(True): - * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":988 + * B = malloc(sizeof(double) * 9) + * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules + * for k in range(9): # <<<<<<<<<<<<<< + * B[k] = 0.0 * - * if (stop - start) - step * new_shape: */ - __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + for (__pyx_t_6 = 0; __pyx_t_6 < 9; __pyx_t_6+=1) { + __pyx_v_k = __pyx_t_6; - /* "View.MemoryView":879 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 + /* "newanalysis/helpers/helpers.pyx":989 + * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules + * for k in range(9): + * B[k] = 0.0 # <<<<<<<<<<<<<< * + * H1x = coor[i+1,0]-coor[i,0] # rel. coordinates of H1 with respect to O */ - __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); - if (__pyx_t_2) { + (__pyx_v_B[__pyx_v_k]) = 0.0; + } - /* "View.MemoryView":880 - * - * if (stop - start) - step * new_shape: - * new_shape += 1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":991 + * B[k] = 0.0 * - * if new_shape < 0: + * H1x = coor[i+1,0]-coor[i,0] # rel. coordinates of H1 with respect to O # <<<<<<<<<<<<<< + * H1y = coor[i+1,1]-coor[i,1] + * H1z = coor[i+1,2]-coor[i,2] */ - __pyx_v_new_shape = (__pyx_v_new_shape + 1); + __pyx_t_11 = (__pyx_v_i + 1); + __pyx_t_12 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[1]; + __pyx_t_13 = __pyx_v_i; + __pyx_t_14 = 0; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; + __pyx_v_H1x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_11 * __pyx_v_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":879 - * new_shape = (stop - start) // step + /* "newanalysis/helpers/helpers.pyx":992 * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 + * H1x = coor[i+1,0]-coor[i,0] # rel. coordinates of H1 with respect to O + * H1y = coor[i+1,1]-coor[i,1] # <<<<<<<<<<<<<< + * H1z = coor[i+1,2]-coor[i,2] * */ - } + __pyx_t_14 = (__pyx_v_i + 1); + __pyx_t_13 = 1; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[1]; + __pyx_t_12 = __pyx_v_i; + __pyx_t_11 = 1; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; + __pyx_v_H1y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":882 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 + /* "newanalysis/helpers/helpers.pyx":993 + * H1x = coor[i+1,0]-coor[i,0] # rel. coordinates of H1 with respect to O + * H1y = coor[i+1,1]-coor[i,1] + * H1z = coor[i+1,2]-coor[i,2] # <<<<<<<<<<<<<< * + * H2x = coor[i+2,0]-coor[i,0] # rel. coordinates of H2 with respect to O */ - __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0); - if (__pyx_t_2) { + __pyx_t_11 = (__pyx_v_i + 1); + __pyx_t_12 = 2; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[1]; + __pyx_t_13 = __pyx_v_i; + __pyx_t_14 = 2; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; + __pyx_v_H1z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_11 * __pyx_v_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":883 - * - * if new_shape < 0: - * new_shape = 0 # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":995 + * H1z = coor[i+1,2]-coor[i,2] * + * H2x = coor[i+2,0]-coor[i,0] # rel. coordinates of H2 with respect to O # <<<<<<<<<<<<<< + * H2y = coor[i+2,1]-coor[i,1] + * H2z = coor[i+2,2]-coor[i,2] */ - __pyx_v_new_shape = 0; + __pyx_t_14 = (__pyx_v_i + 2); + __pyx_t_13 = 0; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[1]; + __pyx_t_12 = __pyx_v_i; + __pyx_t_11 = 0; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; + __pyx_v_H2x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":882 - * new_shape += 1 + /* "newanalysis/helpers/helpers.pyx":996 * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 + * H2x = coor[i+2,0]-coor[i,0] # rel. coordinates of H2 with respect to O + * H2y = coor[i+2,1]-coor[i,1] # <<<<<<<<<<<<<< + * H2z = coor[i+2,2]-coor[i,2] * */ - } + __pyx_t_11 = (__pyx_v_i + 2); + __pyx_t_12 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[1]; + __pyx_t_13 = __pyx_v_i; + __pyx_t_14 = 1; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; + __pyx_v_H2y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_11 * __pyx_v_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":886 - * + /* "newanalysis/helpers/helpers.pyx":997 + * H2x = coor[i+2,0]-coor[i,0] # rel. coordinates of H2 with respect to O + * H2y = coor[i+2,1]-coor[i,1] + * H2z = coor[i+2,2]-coor[i,2] # <<<<<<<<<<<<<< * - * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset + * B[3] = (H1x-H2x) */ - (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); + __pyx_t_14 = (__pyx_v_i + 2); + __pyx_t_13 = 2; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[1]; + __pyx_t_12 = __pyx_v_i; + __pyx_t_11 = 2; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; + __pyx_v_H2z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) )))); - /* "View.MemoryView":887 - * - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< - * dst.suboffsets[new_ndim] = suboffset + /* "newanalysis/helpers/helpers.pyx":999 + * H2z = coor[i+2,2]-coor[i,2] * + * B[3] = (H1x-H2x) # <<<<<<<<<<<<<< + * B[4] = (H1y-H2y) + * B[5] = (H1z-H2z) */ - (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + (__pyx_v_B[3]) = (__pyx_v_H1x - __pyx_v_H2x); - /* "View.MemoryView":888 - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":1000 * + * B[3] = (H1x-H2x) + * B[4] = (H1y-H2y) # <<<<<<<<<<<<<< + * B[5] = (H1z-H2z) + * B[6] = (H1x+H2x) */ - (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; - } - __pyx_L3:; + (__pyx_v_B[4]) = (__pyx_v_H1y - __pyx_v_H2y); - /* "View.MemoryView":891 - * + /* "newanalysis/helpers/helpers.pyx":1001 + * B[3] = (H1x-H2x) + * B[4] = (H1y-H2y) + * B[5] = (H1z-H2z) # <<<<<<<<<<<<<< + * B[6] = (H1x+H2x) + * B[7] = (H1y+H2y) + */ + (__pyx_v_B[5]) = (__pyx_v_H1z - __pyx_v_H2z); + + /* "newanalysis/helpers/helpers.pyx":1002 + * B[4] = (H1y-H2y) + * B[5] = (H1z-H2z) + * B[6] = (H1x+H2x) # <<<<<<<<<<<<<< + * B[7] = (H1y+H2y) + * B[8] = (H1z+H2z) + */ + (__pyx_v_B[6]) = (__pyx_v_H1x + __pyx_v_H2x); + + /* "newanalysis/helpers/helpers.pyx":1003 + * B[5] = (H1z-H2z) + * B[6] = (H1x+H2x) + * B[7] = (H1y+H2y) # <<<<<<<<<<<<<< + * B[8] = (H1z+H2z) * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: */ - __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0); - if (__pyx_t_2) { + (__pyx_v_B[7]) = (__pyx_v_H1y + __pyx_v_H2y); - /* "View.MemoryView":892 + /* "newanalysis/helpers/helpers.pyx":1004 + * B[6] = (H1x+H2x) + * B[7] = (H1y+H2y) + * B[8] = (H1z+H2z) # <<<<<<<<<<<<<< * - * if suboffset_dim[0] < 0: - * dst.data += start * stride # <<<<<<<<<<<<<< - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride + * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 */ - __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + (__pyx_v_B[8]) = (__pyx_v_H1z + __pyx_v_H2z); - /* "View.MemoryView":891 + /* "newanalysis/helpers/helpers.pyx":1006 + * B[8] = (H1z+H2z) * + * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 # <<<<<<<<<<<<<< + * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: */ - goto __pyx_L23; - } + __pyx_v_n2 = pow(((((__pyx_v_B[3]) * (__pyx_v_B[3])) + ((__pyx_v_B[4]) * (__pyx_v_B[4]))) + ((__pyx_v_B[5]) * (__pyx_v_B[5]))), .5); - /* "View.MemoryView":894 - * dst.data += start * stride - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1007 * - * if suboffset >= 0: + * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 + * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 # <<<<<<<<<<<<<< + * + * B[3] /= n2 */ - /*else*/ { - __pyx_t_3 = (__pyx_v_suboffset_dim[0]); - (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); - } - __pyx_L23:; + __pyx_v_n3 = pow(((((__pyx_v_B[6]) * (__pyx_v_B[6])) + ((__pyx_v_B[7]) * (__pyx_v_B[7]))) + ((__pyx_v_B[8]) * (__pyx_v_B[8]))), .5); - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride + /* "newanalysis/helpers/helpers.pyx":1009 + * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: + * B[3] /= n2 # <<<<<<<<<<<<<< + * B[4] /= n2 + * B[5] /= n2 */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { + __pyx_t_15 = 3; + if (unlikely(__pyx_v_n2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1009, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n2); - /* "View.MemoryView":897 + /* "newanalysis/helpers/helpers.pyx":1010 * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset + * B[3] /= n2 + * B[4] /= n2 # <<<<<<<<<<<<<< + * B[5] /= n2 + * B[6] /= n3 */ - __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_15 = 4; + if (unlikely(__pyx_v_n2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1010, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n2); - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: + /* "newanalysis/helpers/helpers.pyx":1011 + * B[3] /= n2 + * B[4] /= n2 + * B[5] /= n2 # <<<<<<<<<<<<<< + * B[6] /= n3 + * B[7] /= n3 */ - __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":899 - * if not is_slice: - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - */ - __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); - - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: - */ - goto __pyx_L26; - } - - /* "View.MemoryView":901 - * dst.data = ( dst.data)[0] + suboffset - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< - * "must be indexed and not sliced", dim) - * else: - */ - /*else*/ { + __pyx_t_15 = 5; + if (unlikely(__pyx_v_n2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1011, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n2); - /* "View.MemoryView":902 - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< - * else: - * suboffset_dim[0] = new_ndim + /* "newanalysis/helpers/helpers.pyx":1012 + * B[4] /= n2 + * B[5] /= n2 + * B[6] /= n3 # <<<<<<<<<<<<<< + * B[7] /= n3 + * B[8] /= n3 */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 901, __pyx_L1_error) - } - __pyx_L26:; + __pyx_t_15 = 6; + if (unlikely(__pyx_v_n3 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1012, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n3); - /* "View.MemoryView":897 + /* "newanalysis/helpers/helpers.pyx":1013 + * B[5] /= n2 + * B[6] /= n3 + * B[7] /= n3 # <<<<<<<<<<<<<< + * B[8] /= n3 * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset */ - goto __pyx_L25; - } + __pyx_t_15 = 7; + if (unlikely(__pyx_v_n3 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1013, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n3); - /* "View.MemoryView":904 - * "must be indexed and not sliced", dim) - * else: - * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1014 + * B[6] /= n3 + * B[7] /= n3 + * B[8] /= n3 # <<<<<<<<<<<<<< * - * return 0 + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product */ - /*else*/ { - (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; - } - __pyx_L25:; + __pyx_t_15 = 8; + if (unlikely(__pyx_v_n3 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1014, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_15]) = ((__pyx_v_B[__pyx_t_15]) / __pyx_v_n3); - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride + /* "newanalysis/helpers/helpers.pyx":1016 + * B[8] /= n3 * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product # <<<<<<<<<<<<<< + * B[1] = B[5]*B[6]-B[3]*B[8] + * B[2] = B[3]*B[7]-B[4]*B[6] */ - } + (__pyx_v_B[0]) = (((__pyx_v_B[4]) * (__pyx_v_B[8])) - ((__pyx_v_B[5]) * (__pyx_v_B[7]))); - /* "View.MemoryView":906 - * suboffset_dim[0] = new_ndim - * - * return 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1017 * + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + * B[1] = B[5]*B[6]-B[3]*B[8] # <<<<<<<<<<<<<< + * B[2] = B[3]*B[7]-B[4]*B[6] * */ - __pyx_r = 0; - goto __pyx_L0; + (__pyx_v_B[1]) = (((__pyx_v_B[5]) * (__pyx_v_B[6])) - ((__pyx_v_B[3]) * (__pyx_v_B[8]))); - /* "View.MemoryView":809 + /* "newanalysis/helpers/helpers.pyx":1018 + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + * B[1] = B[5]*B[6]-B[3]*B[8] + * B[2] = B[3]*B[7]-B[4]*B[6] # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + * ind =i//3 */ + (__pyx_v_B[2]) = (((__pyx_v_B[3]) * (__pyx_v_B[7])) - ((__pyx_v_B[4]) * (__pyx_v_B[6]))); - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = -1; - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":912 + /* "newanalysis/helpers/helpers.pyx":1020 + * B[2] = B[3]*B[7]-B[4]*B[6] * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - */ - -static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_suboffset; - Py_ssize_t __pyx_v_itemsize; - char *__pyx_v_resultp; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pybuffer_index", 0); - - /* "View.MemoryView":914 - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< - * cdef Py_ssize_t itemsize = view.itemsize - * cdef char *resultp - */ - __pyx_v_suboffset = -1L; - - /* "View.MemoryView":915 - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< - * cdef char *resultp + * ind =i//3 # <<<<<<<<<<<<<< * + * B_out[ind,0,0] = B[0] */ - __pyx_t_1 = __pyx_v_view->itemsize; - __pyx_v_itemsize = __pyx_t_1; + __pyx_v_ind = __Pyx_div_long(__pyx_v_i, 3); - /* "View.MemoryView":918 - * cdef char *resultp + /* "newanalysis/helpers/helpers.pyx":1022 + * ind =i//3 * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + * B_out[ind,0,0] = B[0] # <<<<<<<<<<<<<< + * B_out[ind,0,1] = B[1] + * B_out[ind,0,2] = B[2] */ - __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0); - if (__pyx_t_2) { + __pyx_t_11 = __pyx_v_ind; + __pyx_t_12 = 0; + __pyx_t_13 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_11 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_13 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[0]); - /* "View.MemoryView":919 + /* "newanalysis/helpers/helpers.pyx":1023 * - * if view.ndim == 0: - * shape = view.len / itemsize # <<<<<<<<<<<<<< - * stride = itemsize - * else: - */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); - - /* "View.MemoryView":920 - * if view.ndim == 0: - * shape = view.len / itemsize - * stride = itemsize # <<<<<<<<<<<<<< - * else: - * shape = view.shape[dim] + * B_out[ind,0,0] = B[0] + * B_out[ind,0,1] = B[1] # <<<<<<<<<<<<<< + * B_out[ind,0,2] = B[2] + * B_out[ind,1,0] = B[3] */ - __pyx_v_stride = __pyx_v_itemsize; + __pyx_t_13 = __pyx_v_ind; + __pyx_t_12 = 0; + __pyx_t_11 = 1; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_13 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_11 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[1]); - /* "View.MemoryView":918 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + /* "newanalysis/helpers/helpers.pyx":1024 + * B_out[ind,0,0] = B[0] + * B_out[ind,0,1] = B[1] + * B_out[ind,0,2] = B[2] # <<<<<<<<<<<<<< + * B_out[ind,1,0] = B[3] + * B_out[ind,1,1] = B[4] */ - goto __pyx_L3; - } + __pyx_t_11 = __pyx_v_ind; + __pyx_t_12 = 0; + __pyx_t_13 = 2; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_11 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_13 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[2]); - /* "View.MemoryView":922 - * stride = itemsize - * else: - * shape = view.shape[dim] # <<<<<<<<<<<<<< - * stride = view.strides[dim] - * if view.suboffsets != NULL: + /* "newanalysis/helpers/helpers.pyx":1025 + * B_out[ind,0,1] = B[1] + * B_out[ind,0,2] = B[2] + * B_out[ind,1,0] = B[3] # <<<<<<<<<<<<<< + * B_out[ind,1,1] = B[4] + * B_out[ind,1,2] = B[5] */ - /*else*/ { - __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + __pyx_t_13 = __pyx_v_ind; + __pyx_t_12 = 1; + __pyx_t_11 = 0; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_13 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_11 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[3]); - /* "View.MemoryView":923 - * else: - * shape = view.shape[dim] - * stride = view.strides[dim] # <<<<<<<<<<<<<< - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] + /* "newanalysis/helpers/helpers.pyx":1026 + * B_out[ind,0,2] = B[2] + * B_out[ind,1,0] = B[3] + * B_out[ind,1,1] = B[4] # <<<<<<<<<<<<<< + * B_out[ind,1,2] = B[5] + * B_out[ind,2,0] = B[6] */ - __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + __pyx_t_11 = __pyx_v_ind; + __pyx_t_12 = 1; + __pyx_t_13 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_11 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_13 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[4]); - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * + /* "newanalysis/helpers/helpers.pyx":1027 + * B_out[ind,1,0] = B[3] + * B_out[ind,1,1] = B[4] + * B_out[ind,1,2] = B[5] # <<<<<<<<<<<<<< + * B_out[ind,2,0] = B[6] + * B_out[ind,2,1] = B[7] */ - __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0); - if (__pyx_t_2) { + __pyx_t_13 = __pyx_v_ind; + __pyx_t_12 = 1; + __pyx_t_11 = 2; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_13 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_11 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[5]); - /* "View.MemoryView":925 - * stride = view.strides[dim] - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< - * - * if index < 0: + /* "newanalysis/helpers/helpers.pyx":1028 + * B_out[ind,1,1] = B[4] + * B_out[ind,1,2] = B[5] + * B_out[ind,2,0] = B[6] # <<<<<<<<<<<<<< + * B_out[ind,2,1] = B[7] + * B_out[ind,2,2] = B[8] */ - __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + __pyx_t_11 = __pyx_v_ind; + __pyx_t_12 = 2; + __pyx_t_13 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_11 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_13 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[6]); - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] + /* "newanalysis/helpers/helpers.pyx":1029 + * B_out[ind,1,2] = B[5] + * B_out[ind,2,0] = B[6] + * B_out[ind,2,1] = B[7] # <<<<<<<<<<<<<< + * B_out[ind,2,2] = B[8] * */ - } - } - __pyx_L3:; + __pyx_t_13 = __pyx_v_ind; + __pyx_t_12 = 2; + __pyx_t_11 = 1; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_13 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_11 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[7]); - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] + /* "newanalysis/helpers/helpers.pyx":1030 + * B_out[ind,2,0] = B[6] + * B_out[ind,2,1] = B[7] + * B_out[ind,2,2] = B[8] # <<<<<<<<<<<<<< * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: + * free(B) */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (__pyx_t_2) { + __pyx_t_11 = __pyx_v_ind; + __pyx_t_12 = 2; + __pyx_t_13 = 2; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_B_out.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_B_out.shape[1]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_B_out.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_B_out.data + __pyx_t_11 * __pyx_v_B_out.strides[0]) ) + __pyx_t_12 * __pyx_v_B_out.strides[1]) ) + __pyx_t_13 * __pyx_v_B_out.strides[2]) )) = (__pyx_v_B[8]); + goto __pyx_L17; + __pyx_L12_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L16; + __pyx_L16:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates3) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_H1x; + __pyx_parallel_temp1 = __pyx_v_H1y; + __pyx_parallel_temp2 = __pyx_v_H1z; + __pyx_parallel_temp3 = __pyx_v_H2x; + __pyx_parallel_temp4 = __pyx_v_H2y; + __pyx_parallel_temp5 = __pyx_v_H2z; + __pyx_parallel_temp6 = __pyx_v_i; + __pyx_parallel_temp7 = __pyx_v_ind; + __pyx_parallel_temp8 = __pyx_v_k; + __pyx_parallel_temp9 = __pyx_v_n2; + __pyx_parallel_temp10 = __pyx_v_n3; + } + __pyx_L17:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_H1x = __pyx_parallel_temp0; + __pyx_v_H1y = __pyx_parallel_temp1; + __pyx_v_H1z = __pyx_parallel_temp2; + __pyx_v_H2x = __pyx_parallel_temp3; + __pyx_v_H2y = __pyx_parallel_temp4; + __pyx_v_H2z = __pyx_parallel_temp5; + __pyx_v_i = __pyx_parallel_temp6; + __pyx_v_ind = __pyx_parallel_temp7; + __pyx_v_k = __pyx_parallel_temp8; + __pyx_v_n2 = __pyx_parallel_temp9; + __pyx_v_n3 = __pyx_parallel_temp10; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L8_error; + } + } + } - /* "View.MemoryView":928 + /* "newanalysis/helpers/helpers.pyx":1032 + * B_out[ind,2,2] = B[8] * - * if index < 0: - * index += view.shape[dim] # <<<<<<<<<<<<<< - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - */ - __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); - - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + * free(B) # <<<<<<<<<<<<<< * + * return B_out */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (unlikely(__pyx_t_2)) { + free(__pyx_v_B); + goto __pyx_L19; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L19; + __pyx_L19:; + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP +} +#endif /* _OPENMP */ + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":930 - * index += view.shape[dim] - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< - * - * if index >= shape: - */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 930, __pyx_L1_error) - - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - */ - } - - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] - * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: - */ - } - - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - */ - __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":933 - * - * if index >= shape: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< - * - * resultp = bufp + index * stride - */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 933, __pyx_L1_error) - - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - */ - } - - /* "View.MemoryView":935 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * resultp = bufp + index * stride # <<<<<<<<<<<<<< - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset - */ - __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - - /* "View.MemoryView":936 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset - * - */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":937 - * resultp = bufp + index * stride - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< - * - * return resultp - */ - __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); - - /* "View.MemoryView":936 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset + /* "newanalysis/helpers/helpers.pyx":985 + * cdef double [:,:,:] B_out = np.zeros((nwat,3,3)) # rotation matrix to return from parallel code * + * with nogil, parallel(): # <<<<<<<<<<<<<< + * B = malloc(sizeof(double) * 9) + * for i in prange(0,nwat*3,3): # loop over all coordinates of atoms of water molecules */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; + } } - /* "View.MemoryView":939 - * resultp = ( resultp)[0] + suboffset - * - * return resultp # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1034 + * free(B) * + * return B_out # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_r = __pyx_v_resultp; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_B_out, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1034, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":912 + /* "newanalysis/helpers/helpers.pyx":978 + * return py_dipt * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def waterRotationMatrix(double [:,:] coor): + * cdef int nwat = len(coor)//3 # number of water molecules */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_AddTraceback("newanalysis.helpers.waterRotationMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_B_out, 1); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":945 +/* "newanalysis/helpers/helpers.pyx":1036 + * return B_out * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): * */ -static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { - int __pyx_v_ndim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_r; - int __pyx_t_1; - Py_ssize_t *__pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_53NQRselfAndB(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_53NQRselfAndB = {"NQRselfAndB", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_53NQRselfAndB, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_53NQRselfAndB(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_py_xyz = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("NQRselfAndB (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1036, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_xyz,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_py_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1036, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "NQRselfAndB") < 0)) __PYX_ERR(0, 1036, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_py_xyz = ((PyArrayObject *)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("NQRselfAndB", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1036, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.helpers.NQRselfAndB", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_xyz), __pyx_ptype_5numpy_ndarray, 1, "py_xyz", 0))) __PYX_ERR(0, 1037, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_7helpers_52NQRselfAndB(__pyx_self, __pyx_v_py_xyz); - /* "View.MemoryView":946 - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: - * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< - * - * cdef Py_ssize_t *shape = memslice.shape - */ - __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; - __pyx_v_ndim = __pyx_t_1; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":948 - * cdef int ndim = memslice.memview.view.ndim - * - * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< - * cdef Py_ssize_t *strides = memslice.strides - * - */ - __pyx_t_2 = __pyx_v_memslice->shape; - __pyx_v_shape = __pyx_t_2; +static PyObject *__pyx_pf_11newanalysis_7helpers_52NQRselfAndB(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_py_xyz) { + int __pyx_v_nwat; + double *__pyx_v_xyz; + double __pyx_v_H1x; + double __pyx_v_H1y; + double __pyx_v_H1z; + double __pyx_v_H2x; + double __pyx_v_H2y; + double __pyx_v_H2z; + double __pyx_v_n2; + double __pyx_v_n3; + double __pyx_v_Exx; + double __pyx_v_Eyy; + double __pyx_v_Ezz; + int __pyx_v_i; + int __pyx_v_k; + int __pyx_v_ind; + PyArrayObject *__pyx_v_py_dipt = 0; + double *__pyx_v_dipt; + PyArrayObject *__pyx_v_py_B1 = 0; + double *__pyx_v_B1; + PyArrayObject *__pyx_v_py_B2 = 0; + double *__pyx_v_B2; + PyArrayObject *__pyx_v_py_B3 = 0; + double *__pyx_v_B3; + double *__pyx_v_B; + double *__pyx_v_T; + __Pyx_LocalBuf_ND __pyx_pybuffernd_py_B1; + __Pyx_Buffer __pyx_pybuffer_py_B1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_py_B2; + __Pyx_Buffer __pyx_pybuffer_py_B2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_py_B3; + __Pyx_Buffer __pyx_pybuffer_py_B3; + __Pyx_LocalBuf_ND __pyx_pybuffernd_py_dipt; + __Pyx_Buffer __pyx_pybuffer_py_dipt; + __Pyx_LocalBuf_ND __pyx_pybuffernd_py_xyz; + __Pyx_Buffer __pyx_pybuffer_py_xyz; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + char *__pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + int __pyx_t_15; + long __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("NQRselfAndB", 0); + __pyx_pybuffer_py_dipt.pybuffer.buf = NULL; + __pyx_pybuffer_py_dipt.refcount = 0; + __pyx_pybuffernd_py_dipt.data = NULL; + __pyx_pybuffernd_py_dipt.rcbuffer = &__pyx_pybuffer_py_dipt; + __pyx_pybuffer_py_B1.pybuffer.buf = NULL; + __pyx_pybuffer_py_B1.refcount = 0; + __pyx_pybuffernd_py_B1.data = NULL; + __pyx_pybuffernd_py_B1.rcbuffer = &__pyx_pybuffer_py_B1; + __pyx_pybuffer_py_B2.pybuffer.buf = NULL; + __pyx_pybuffer_py_B2.refcount = 0; + __pyx_pybuffernd_py_B2.data = NULL; + __pyx_pybuffernd_py_B2.rcbuffer = &__pyx_pybuffer_py_B2; + __pyx_pybuffer_py_B3.pybuffer.buf = NULL; + __pyx_pybuffer_py_B3.refcount = 0; + __pyx_pybuffernd_py_B3.data = NULL; + __pyx_pybuffernd_py_B3.rcbuffer = &__pyx_pybuffer_py_B3; + __pyx_pybuffer_py_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_py_xyz.refcount = 0; + __pyx_pybuffernd_py_xyz.data = NULL; + __pyx_pybuffernd_py_xyz.rcbuffer = &__pyx_pybuffer_py_xyz; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_py_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1036, __pyx_L1_error) + } + __pyx_pybuffernd_py_xyz.diminfo[0].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_xyz.diminfo[0].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_py_xyz.diminfo[1].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_py_xyz.diminfo[1].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[1]; - /* "View.MemoryView":949 - * - * cdef Py_ssize_t *shape = memslice.shape - * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":1039 + * def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): * + * cdef int nwat = len(py_xyz)//3 # number of water molecules # <<<<<<<<<<<<<< + * cdef double *xyz = py_xyz.data + * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 */ - __pyx_t_2 = __pyx_v_memslice->strides; - __pyx_v_strides = __pyx_t_2; + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_py_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1039, __pyx_L1_error) + __pyx_v_nwat = __Pyx_div_Py_ssize_t(__pyx_t_1, 3); - /* "View.MemoryView":953 + /* "newanalysis/helpers/helpers.pyx":1040 * - * cdef int i, j - * for i in range(ndim / 2): # <<<<<<<<<<<<<< - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] + * cdef int nwat = len(py_xyz)//3 # number of water molecules + * cdef double *xyz = py_xyz.data # <<<<<<<<<<<<<< + * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * cdef double Exx = -2.3067236 # -2.0486*1.126 */ - __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_py_xyz)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1040, __pyx_L1_error) + __pyx_v_xyz = ((double *)__pyx_t_2); - /* "View.MemoryView":954 - * cdef int i, j - * for i in range(ndim / 2): - * j = ndim - 1 - i # <<<<<<<<<<<<<< - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] + /* "newanalysis/helpers/helpers.pyx":1042 + * cdef double *xyz = py_xyz.data + * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * cdef double Exx = -2.3067236 # -2.0486*1.126 # <<<<<<<<<<<<<< + * cdef double Eyy = 2.0364836 # 1.8086*1.126 + * cdef double Ezz = 0.27024 # 0.2400*1.126 */ - __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + __pyx_v_Exx = -2.3067236; - /* "View.MemoryView":955 - * for i in range(ndim / 2): - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< - * shape[i], shape[j] = shape[j], shape[i] - * + /* "newanalysis/helpers/helpers.pyx":1043 + * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * cdef double Exx = -2.3067236 # -2.0486*1.126 + * cdef double Eyy = 2.0364836 # 1.8086*1.126 # <<<<<<<<<<<<<< + * cdef double Ezz = 0.27024 # 0.2400*1.126 + * cdef int i, k, ind */ - __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); - __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); - (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; - (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + __pyx_v_Eyy = 2.0364836; - /* "View.MemoryView":956 - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1044 + * cdef double Exx = -2.3067236 # -2.0486*1.126 + * cdef double Eyy = 2.0364836 # 1.8086*1.126 + * cdef double Ezz = 0.27024 # 0.2400*1.126 # <<<<<<<<<<<<<< + * cdef int i, k, ind * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: */ - __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); - __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); - (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; - (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + __pyx_v_Ezz = 0.27024; - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") + /* "newanalysis/helpers/helpers.pyx":1047 + * cdef int i, k, ind * + * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *dipt = py_dipt.data + * cdef np.ndarray[np.float64_t,ndim=1] py_B1 = np.zeros(nwat*3,dtype=np.float64) */ - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_nwat * 6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 1047, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 1047, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1047, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_py_dipt = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1047, __pyx_L1_error) + } else {__pyx_pybuffernd_py_dipt.diminfo[0].strides = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_dipt.diminfo[0].shape = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.shape[0]; } - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0); - __pyx_t_7 = __pyx_t_8; - __pyx_L6_bool_binop_done:; - if (__pyx_t_7) { + } + __pyx_t_8 = 0; + __pyx_v_py_dipt = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":959 - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1048 * - * return 1 + * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) + * cdef double *dipt = py_dipt.data # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] py_B1 = np.zeros(nwat*3,dtype=np.float64) + * cdef double *B1 = py_B1.data */ - __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 959, __pyx_L1_error) + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_py_dipt)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1048, __pyx_L1_error) + __pyx_v_dipt = ((double *)__pyx_t_2); - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") - * + /* "newanalysis/helpers/helpers.pyx":1049 + * cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(nwat*6,dtype=np.float64) + * cdef double *dipt = py_dipt.data + * cdef np.ndarray[np.float64_t,ndim=1] py_B1 = np.zeros(nwat*3,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *B1 = py_B1.data + * cdef np.ndarray[np.float64_t,ndim=1] py_B2 = np.zeros(nwat*3,dtype=np.float64) */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyInt_From_long((__pyx_v_nwat * 3)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7)) __PYX_ERR(0, 1049, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1049, __pyx_L1_error) + __pyx_t_9 = ((PyArrayObject *)__pyx_t_6); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_B1.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_py_B1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_B1.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1049, __pyx_L1_error) + } else {__pyx_pybuffernd_py_B1.diminfo[0].strides = __pyx_pybuffernd_py_B1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_B1.diminfo[0].shape = __pyx_pybuffernd_py_B1.rcbuffer->pybuffer.shape[0]; } } + __pyx_t_9 = 0; + __pyx_v_py_B1 = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; - /* "View.MemoryView":961 - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") - * - * return 1 # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/helpers.pyx":1050 + * cdef double *dipt = py_dipt.data + * cdef np.ndarray[np.float64_t,ndim=1] py_B1 = np.zeros(nwat*3,dtype=np.float64) + * cdef double *B1 = py_B1.data # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] py_B2 = np.zeros(nwat*3,dtype=np.float64) + * cdef double *B2 = py_B2.data */ - __pyx_r = 1; - goto __pyx_L0; + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_py_B1)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1050, __pyx_L1_error) + __pyx_v_B1 = ((double *)__pyx_t_2); - /* "View.MemoryView":945 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim - * + /* "newanalysis/helpers/helpers.pyx":1051 + * cdef np.ndarray[np.float64_t,ndim=1] py_B1 = np.zeros(nwat*3,dtype=np.float64) + * cdef double *B1 = py_B1.data + * cdef np.ndarray[np.float64_t,ndim=1] py_B2 = np.zeros(nwat*3,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *B2 = py_B2.data + * cdef np.ndarray[np.float64_t,ndim=1] py_B3 = np.zeros(nwat*3,dtype=np.float64) */ - - /* function exit code */ - __pyx_L1_error:; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_v_nwat * 3)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 1051, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1051, __pyx_L1_error) + __pyx_t_10 = ((PyArrayObject *)__pyx_t_4); { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_B2.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_py_B2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_B2.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1051, __pyx_L1_error) + } else {__pyx_pybuffernd_py_B2.diminfo[0].strides = __pyx_pybuffernd_py_B2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_B2.diminfo[0].shape = __pyx_pybuffernd_py_B2.rcbuffer->pybuffer.shape[0]; + } } - __pyx_r = 0; - __pyx_L0:; - return __pyx_r; -} + __pyx_t_10 = 0; + __pyx_v_py_B2 = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; -/* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * + /* "newanalysis/helpers/helpers.pyx":1052 + * cdef double *B1 = py_B1.data + * cdef np.ndarray[np.float64_t,ndim=1] py_B2 = np.zeros(nwat*3,dtype=np.float64) + * cdef double *B2 = py_B2.data # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] py_B3 = np.zeros(nwat*3,dtype=np.float64) + * cdef double *B3 = py_B3.data */ + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_py_B2)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1052, __pyx_L1_error) + __pyx_v_B2 = ((double *)__pyx_t_2); -/* Python wrapper */ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":979 - * - * def __dealloc__(self): - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1053 + * cdef np.ndarray[np.float64_t,ndim=1] py_B2 = np.zeros(nwat*3,dtype=np.float64) + * cdef double *B2 = py_B2.data + * cdef np.ndarray[np.float64_t,ndim=1] py_B3 = np.zeros(nwat*3,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef double *B3 = py_B3.data * - * cdef convert_item_to_object(self, char *itemp): */ - __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); - - /* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_nwat * 3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4)) __PYX_ERR(0, 1053, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 1053, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1053, __pyx_L1_error) + __pyx_t_11 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_B3.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_py_B3 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_B3.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1053, __pyx_L1_error) + } else {__pyx_pybuffernd_py_B3.diminfo[0].strides = __pyx_pybuffernd_py_B3.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_B3.diminfo[0].shape = __pyx_pybuffernd_py_B3.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_11 = 0; + __pyx_v_py_B3 = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "newanalysis/helpers/helpers.pyx":1054 + * cdef double *B2 = py_B2.data + * cdef np.ndarray[np.float64_t,ndim=1] py_B3 = np.zeros(nwat*3,dtype=np.float64) + * cdef double *B3 = py_B3.data # <<<<<<<<<<<<<< * + * with nogil, parallel(): */ + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_py_B3)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1054, __pyx_L1_error) + __pyx_v_B3 = ((double *)__pyx_t_2); - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + /* "newanalysis/helpers/helpers.pyx":1056 + * cdef double *B3 = py_B3.data * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) + * with nogil, parallel(): # <<<<<<<<<<<<<< + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + { + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + #ifdef _OPENMP + #pragma omp parallel private(__pyx_v_B, __pyx_v_T) private(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + /* Initialize private variables to invalid values */ + __pyx_v_B = ((double *)1); + __pyx_v_T = ((double *)1); -static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":982 + /* "newanalysis/helpers/helpers.pyx":1057 * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: + * with nogil, parallel(): + * B = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< + * T = malloc(sizeof(double) * 9) + * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules */ - __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0); - if (__pyx_t_1) { + __pyx_v_B = ((double *)malloc(((sizeof(double)) * 9))); - /* "View.MemoryView":983 - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) # <<<<<<<<<<<<<< - * else: - * return memoryview.convert_item_to_object(self, itemp) + /* "newanalysis/helpers/helpers.pyx":1058 + * with nogil, parallel(): + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< + * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules + * for k in range(9): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_v_T = ((double *)malloc(((sizeof(double)) * 9))); - /* "View.MemoryView":982 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: + /* "newanalysis/helpers/helpers.pyx":1059 + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) + * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules # <<<<<<<<<<<<<< + * for k in range(9): + * B[k] = 0.0 */ - } + __pyx_t_12 = (__pyx_v_nwat * 9); + { + double __pyx_parallel_temp0 = ((double)__PYX_NAN()); + double __pyx_parallel_temp1 = ((double)__PYX_NAN()); + double __pyx_parallel_temp2 = ((double)__PYX_NAN()); + double __pyx_parallel_temp3 = ((double)__PYX_NAN()); + double __pyx_parallel_temp4 = ((double)__PYX_NAN()); + double __pyx_parallel_temp5 = ((double)__PYX_NAN()); + int __pyx_parallel_temp6 = ((int)0xbad0bad0); + int __pyx_parallel_temp7 = ((int)0xbad0bad0); + int __pyx_parallel_temp8 = ((int)0xbad0bad0); + double __pyx_parallel_temp9 = ((double)__PYX_NAN()); + double __pyx_parallel_temp10 = ((double)__PYX_NAN()); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + __pyx_t_14 = (__pyx_t_12 - 0 + 9 - 9/abs(9)) / 9; + if (__pyx_t_14 > 0) + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_H1x) lastprivate(__pyx_v_H1y) lastprivate(__pyx_v_H1z) lastprivate(__pyx_v_H2x) lastprivate(__pyx_v_H2y) lastprivate(__pyx_v_H2z) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ind) lastprivate(__pyx_v_k) lastprivate(__pyx_v_n2) lastprivate(__pyx_v_n3) + #endif /* _OPENMP */ + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_i = (int)(0 + 9 * __pyx_t_13); + /* Initialize private variables to invalid values */ + __pyx_v_H1x = ((double)__PYX_NAN()); + __pyx_v_H1y = ((double)__PYX_NAN()); + __pyx_v_H1z = ((double)__PYX_NAN()); + __pyx_v_H2x = ((double)__PYX_NAN()); + __pyx_v_H2y = ((double)__PYX_NAN()); + __pyx_v_H2z = ((double)__PYX_NAN()); + __pyx_v_ind = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); + __pyx_v_n2 = ((double)__PYX_NAN()); + __pyx_v_n3 = ((double)__PYX_NAN()); - /* "View.MemoryView":985 - * return self.to_object_func(itemp) - * else: - * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): + /* "newanalysis/helpers/helpers.pyx":1060 + * T = malloc(sizeof(double) * 9) + * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules + * for k in range(9): # <<<<<<<<<<<<<< + * B[k] = 0.0 + * T[k] = 0.0 */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 985, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } + for (__pyx_t_15 = 0; __pyx_t_15 < 9; __pyx_t_15+=1) { + __pyx_v_k = __pyx_t_15; - /* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + /* "newanalysis/helpers/helpers.pyx":1061 + * for i in prange(0,nwat*9,9): # loop over all coordinates of atoms of water molecules + * for k in range(9): + * B[k] = 0.0 # <<<<<<<<<<<<<< + * T[k] = 0.0 * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) */ + (__pyx_v_B[__pyx_v_k]) = 0.0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) + /* "newanalysis/helpers/helpers.pyx":1062 + * for k in range(9): + * B[k] = 0.0 + * T[k] = 0.0 # <<<<<<<<<<<<<< * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + * H1x = xyz[i+3]-xyz[i] */ + (__pyx_v_T[__pyx_v_k]) = 0.0; + } -static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); - - /* "View.MemoryView":988 + /* "newanalysis/helpers/helpers.pyx":1064 + * T[k] = 0.0 * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: - */ - __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":989 - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< - * else: - * memoryview.assign_item_from_object(self, itemp, value) + * H1x = xyz[i+3]-xyz[i] # <<<<<<<<<<<<<< + * H1y = xyz[i+4]-xyz[i+1] + * H1z = xyz[i+5]-xyz[i+2] */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 989, __pyx_L1_error) + __pyx_v_H1x = ((__pyx_v_xyz[(__pyx_v_i + 3)]) - (__pyx_v_xyz[__pyx_v_i])); - /* "View.MemoryView":988 + /* "newanalysis/helpers/helpers.pyx":1065 * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: + * H1x = xyz[i+3]-xyz[i] + * H1y = xyz[i+4]-xyz[i+1] # <<<<<<<<<<<<<< + * H1z = xyz[i+5]-xyz[i+2] + * H2x = xyz[i+6]-xyz[i] */ - goto __pyx_L3; - } + __pyx_v_H1y = ((__pyx_v_xyz[(__pyx_v_i + 4)]) - (__pyx_v_xyz[(__pyx_v_i + 1)])); - /* "View.MemoryView":991 - * self.to_dtype_func(itemp, value) - * else: - * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< - * - * @property + /* "newanalysis/helpers/helpers.pyx":1066 + * H1x = xyz[i+3]-xyz[i] + * H1y = xyz[i+4]-xyz[i+1] + * H1z = xyz[i+5]-xyz[i+2] # <<<<<<<<<<<<<< + * H2x = xyz[i+6]-xyz[i] + * H2y = xyz[i+7]-xyz[i+1] */ - /*else*/ { - __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 991, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L3:; + __pyx_v_H1z = ((__pyx_v_xyz[(__pyx_v_i + 5)]) - (__pyx_v_xyz[(__pyx_v_i + 2)])); - /* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + /* "newanalysis/helpers/helpers.pyx":1067 + * H1y = xyz[i+4]-xyz[i+1] + * H1z = xyz[i+5]-xyz[i+2] + * H2x = xyz[i+6]-xyz[i] # <<<<<<<<<<<<<< + * H2y = xyz[i+7]-xyz[i+1] + * H2z = xyz[i+8]-xyz[i+2] */ + __pyx_v_H2x = ((__pyx_v_xyz[(__pyx_v_i + 6)]) - (__pyx_v_xyz[__pyx_v_i])); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":994 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object + /* "newanalysis/helpers/helpers.pyx":1068 + * H1z = xyz[i+5]-xyz[i+2] + * H2x = xyz[i+6]-xyz[i] + * H2y = xyz[i+7]-xyz[i+1] # <<<<<<<<<<<<<< + * H2z = xyz[i+8]-xyz[i+2] * */ + __pyx_v_H2y = ((__pyx_v_xyz[(__pyx_v_i + 7)]) - (__pyx_v_xyz[(__pyx_v_i + 1)])); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":995 - * @property - * def base(self): - * return self.from_object # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1069 + * H2x = xyz[i+6]-xyz[i] + * H2y = xyz[i+7]-xyz[i+1] + * H2z = xyz[i+8]-xyz[i+2] # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") + * B[3] = (H1x-H2x) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->from_object); - __pyx_r = __pyx_v_self->from_object; - goto __pyx_L0; + __pyx_v_H2z = ((__pyx_v_xyz[(__pyx_v_i + 8)]) - (__pyx_v_xyz[(__pyx_v_i + 2)])); - /* "View.MemoryView":994 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object + /* "newanalysis/helpers/helpers.pyx":1071 + * H2z = xyz[i+8]-xyz[i+2] * + * B[3] = (H1x-H2x) # <<<<<<<<<<<<<< + * B[4] = (H1y-H2y) + * B[5] = (H1z-H2z) */ + (__pyx_v_B[3]) = (__pyx_v_H1x - __pyx_v_H2x); - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/helpers/helpers.pyx":1072 + * + * B[3] = (H1x-H2x) + * B[4] = (H1y-H2y) # <<<<<<<<<<<<<< + * B[5] = (H1z-H2z) + * B[6] = (H1x+H2x) */ + (__pyx_v_B[4]) = (__pyx_v_H1y - __pyx_v_H2y); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/helpers.pyx":1073 + * B[3] = (H1x-H2x) + * B[4] = (H1y-H2y) + * B[5] = (H1z-H2z) # <<<<<<<<<<<<<< + * B[6] = (H1x+H2x) + * B[7] = (H1y+H2y) */ + (__pyx_v_B[5]) = (__pyx_v_H1z - __pyx_v_H2z); -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1074 + * B[4] = (H1y-H2y) + * B[5] = (H1z-H2z) + * B[6] = (H1x+H2x) # <<<<<<<<<<<<<< + * B[7] = (H1y+H2y) + * B[8] = (H1z+H2z) */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + (__pyx_v_B[6]) = (__pyx_v_H1x + __pyx_v_H2x); - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/helpers.pyx":1075 + * B[5] = (H1z-H2z) + * B[6] = (H1x+H2x) + * B[7] = (H1y+H2y) # <<<<<<<<<<<<<< + * B[8] = (H1z+H2z) + * */ + (__pyx_v_B[7]) = (__pyx_v_H1y + __pyx_v_H2y); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1001 + /* "newanalysis/helpers/helpers.pyx":1076 + * B[6] = (H1x+H2x) + * B[7] = (H1y+H2y) + * B[8] = (H1z+H2z) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), + * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 */ + (__pyx_v_B[8]) = (__pyx_v_H1z + __pyx_v_H2z); -static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_TypeInfo *__pyx_t_4; - Py_buffer __pyx_t_5; - Py_ssize_t *__pyx_t_6; - Py_ssize_t *__pyx_t_7; - Py_ssize_t *__pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - - /* "View.MemoryView":1009 - * cdef _memoryviewslice result + /* "newanalysis/helpers/helpers.pyx":1078 + * B[8] = (H1z+H2z) * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None + * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 # <<<<<<<<<<<<<< + * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 * */ - __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0); - if (__pyx_t_1) { + __pyx_v_n2 = pow(((((__pyx_v_B[3]) * (__pyx_v_B[3])) + ((__pyx_v_B[4]) * (__pyx_v_B[4]))) + ((__pyx_v_B[5]) * (__pyx_v_B[5]))), .5); - /* "View.MemoryView":1010 - * - * if memviewslice.memview == Py_None: - * return None # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1079 * + * n2 = (B[3]*B[3]+B[4]*B[4]+B[5]*B[5])**.5 # normalization Bvec_2 + * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 # <<<<<<<<<<<<<< * + * B[3] /= n2 */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_v_n3 = pow(((((__pyx_v_B[6]) * (__pyx_v_B[6])) + ((__pyx_v_B[7]) * (__pyx_v_B[7]))) + ((__pyx_v_B[8]) * (__pyx_v_B[8]))), .5); - /* "View.MemoryView":1009 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None + /* "newanalysis/helpers/helpers.pyx":1081 + * n3 = (B[6]*B[6]+B[7]*B[7]+B[8]*B[8])**.5 # normalization Bvec_3 * + * B[3] /= n2 # <<<<<<<<<<<<<< + * B[4] /= n2 + * B[5] /= n2 */ - } + __pyx_t_16 = 3; + if (unlikely(__pyx_v_n2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1081, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_16]) = ((__pyx_v_B[__pyx_t_16]) / __pyx_v_n2); - /* "View.MemoryView":1015 - * + /* "newanalysis/helpers/helpers.pyx":1082 * - * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<< - * - * result.from_slice = memviewslice + * B[3] /= n2 + * B[4] /= n2 # <<<<<<<<<<<<<< + * B[5] /= n2 + * B[6] /= n3 */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_16 = 4; + if (unlikely(__pyx_v_n2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1082, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_16]) = ((__pyx_v_B[__pyx_t_16]) / __pyx_v_n2); - /* "View.MemoryView":1017 - * result = _memoryviewslice(None, 0, dtype_is_object) - * - * result.from_slice = memviewslice # <<<<<<<<<<<<<< - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * + /* "newanalysis/helpers/helpers.pyx":1083 + * B[3] /= n2 + * B[4] /= n2 + * B[5] /= n2 # <<<<<<<<<<<<<< + * B[6] /= n3 + * B[7] /= n3 */ - __pyx_v_result->from_slice = __pyx_v_memviewslice; + __pyx_t_16 = 5; + if (unlikely(__pyx_v_n2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1083, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_16]) = ((__pyx_v_B[__pyx_t_16]) / __pyx_v_n2); - /* "View.MemoryView":1018 - * - * result.from_slice = memviewslice - * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< - * - * result.from_object = ( memviewslice.memview).base + /* "newanalysis/helpers/helpers.pyx":1084 + * B[4] /= n2 + * B[5] /= n2 + * B[6] /= n3 # <<<<<<<<<<<<<< + * B[7] /= n3 + * B[8] /= n3 */ - __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + __pyx_t_16 = 6; + if (unlikely(__pyx_v_n3 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1084, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_16]) = ((__pyx_v_B[__pyx_t_16]) / __pyx_v_n3); - /* "View.MemoryView":1020 - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - * result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<< - * result.typeinfo = memviewslice.memview.typeinfo + /* "newanalysis/helpers/helpers.pyx":1085 + * B[5] /= n2 + * B[6] /= n3 + * B[7] /= n3 # <<<<<<<<<<<<<< + * B[8] /= n3 * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_result->from_object); - __Pyx_DECREF(__pyx_v_result->from_object); - __pyx_v_result->from_object = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_16 = 7; + if (unlikely(__pyx_v_n3 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1085, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_16]) = ((__pyx_v_B[__pyx_t_16]) / __pyx_v_n3); - /* "View.MemoryView":1021 - * - * result.from_object = ( memviewslice.memview).base - * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1086 + * B[6] /= n3 + * B[7] /= n3 + * B[8] /= n3 # <<<<<<<<<<<<<< * - * result.view = memviewslice.memview.view + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product */ - __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; - __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + __pyx_t_16 = 8; + if (unlikely(__pyx_v_n3 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1086, __pyx_L12_error) + } + (__pyx_v_B[__pyx_t_16]) = ((__pyx_v_B[__pyx_t_16]) / __pyx_v_n3); - /* "View.MemoryView":1023 - * result.typeinfo = memviewslice.memview.typeinfo + /* "newanalysis/helpers/helpers.pyx":1088 + * B[8] /= n3 * - * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< - * result.view.buf = memviewslice.data - * result.view.ndim = ndim + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product # <<<<<<<<<<<<<< + * B[1] = B[5]*B[6]-B[3]*B[8] + * B[2] = B[3]*B[7]-B[4]*B[6] */ - __pyx_t_5 = __pyx_v_memviewslice.memview->view; - __pyx_v_result->__pyx_base.view = __pyx_t_5; + (__pyx_v_B[0]) = (((__pyx_v_B[4]) * (__pyx_v_B[8])) - ((__pyx_v_B[5]) * (__pyx_v_B[7]))); - /* "View.MemoryView":1024 + /* "newanalysis/helpers/helpers.pyx":1089 * - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - */ - __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - - /* "View.MemoryView":1025 - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data - * result.view.ndim = ndim # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) - */ - __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - - /* "View.MemoryView":1026 - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + * B[1] = B[5]*B[6]-B[3]*B[8] # <<<<<<<<<<<<<< + * B[2] = B[3]*B[7]-B[4]*B[6] * */ - ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + (__pyx_v_B[1]) = (((__pyx_v_B[5]) * (__pyx_v_B[6])) - ((__pyx_v_B[3]) * (__pyx_v_B[8]))); - /* "View.MemoryView":1027 - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1090 + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + * B[1] = B[5]*B[6]-B[3]*B[8] + * B[2] = B[3]*B[7]-B[4]*B[6] # <<<<<<<<<<<<<< * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * # B dot T */ - Py_INCREF(Py_None); + (__pyx_v_B[2]) = (((__pyx_v_B[3]) * (__pyx_v_B[7])) - ((__pyx_v_B[4]) * (__pyx_v_B[6]))); - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) + /* "newanalysis/helpers/helpers.pyx":1093 * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: + * # B dot T + * T[0] = B[0]*Exx # <<<<<<<<<<<<<< + * T[1] = B[1]*Exx + * T[2] = B[2]*Exx */ - __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_1) { + (__pyx_v_T[0]) = ((__pyx_v_B[0]) * __pyx_v_Exx); - /* "View.MemoryView":1030 - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: - * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< - * else: - * result.flags = PyBUF_RECORDS_RO + /* "newanalysis/helpers/helpers.pyx":1094 + * # B dot T + * T[0] = B[0]*Exx + * T[1] = B[1]*Exx # <<<<<<<<<<<<<< + * T[2] = B[2]*Exx + * T[3] = B[3]*Eyy */ - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + (__pyx_v_T[1]) = ((__pyx_v_B[1]) * __pyx_v_Exx); - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: + /* "newanalysis/helpers/helpers.pyx":1095 + * T[0] = B[0]*Exx + * T[1] = B[1]*Exx + * T[2] = B[2]*Exx # <<<<<<<<<<<<<< + * T[3] = B[3]*Eyy + * T[4] = B[4]*Eyy */ - goto __pyx_L4; - } + (__pyx_v_T[2]) = ((__pyx_v_B[2]) * __pyx_v_Exx); - /* "View.MemoryView":1032 - * result.flags = PyBUF_RECORDS - * else: - * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< - * - * result.view.shape = result.from_slice.shape + /* "newanalysis/helpers/helpers.pyx":1096 + * T[1] = B[1]*Exx + * T[2] = B[2]*Exx + * T[3] = B[3]*Eyy # <<<<<<<<<<<<<< + * T[4] = B[4]*Eyy + * T[5] = B[5]*Eyy */ - /*else*/ { - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; - } - __pyx_L4:; + (__pyx_v_T[3]) = ((__pyx_v_B[3]) * __pyx_v_Eyy); - /* "View.MemoryView":1034 - * result.flags = PyBUF_RECORDS_RO - * - * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< - * result.view.strides = result.from_slice.strides - * + /* "newanalysis/helpers/helpers.pyx":1097 + * T[2] = B[2]*Exx + * T[3] = B[3]*Eyy + * T[4] = B[4]*Eyy # <<<<<<<<<<<<<< + * T[5] = B[5]*Eyy + * T[6] = B[6]*Ezz */ - __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + (__pyx_v_T[4]) = ((__pyx_v_B[4]) * __pyx_v_Eyy); - /* "View.MemoryView":1035 - * - * result.view.shape = result.from_slice.shape - * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/helpers.pyx":1098 + * T[3] = B[3]*Eyy + * T[4] = B[4]*Eyy + * T[5] = B[5]*Eyy # <<<<<<<<<<<<<< + * T[6] = B[6]*Ezz + * T[7] = B[7]*Ezz */ - __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + (__pyx_v_T[5]) = ((__pyx_v_B[5]) * __pyx_v_Eyy); - /* "View.MemoryView":1038 - * - * - * result.view.suboffsets = NULL # <<<<<<<<<<<<<< - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: + /* "newanalysis/helpers/helpers.pyx":1099 + * T[4] = B[4]*Eyy + * T[5] = B[5]*Eyy + * T[6] = B[6]*Ezz # <<<<<<<<<<<<<< + * T[7] = B[7]*Ezz + * T[8] = B[8]*Ezz */ - __pyx_v_result->__pyx_base.view.suboffsets = NULL; + (__pyx_v_T[6]) = ((__pyx_v_B[6]) * __pyx_v_Ezz); - /* "View.MemoryView":1039 + /* "newanalysis/helpers/helpers.pyx":1100 + * T[5] = B[5]*Eyy + * T[6] = B[6]*Ezz + * T[7] = B[7]*Ezz # <<<<<<<<<<<<<< + * T[8] = B[8]*Ezz * - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - */ - __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_v_suboffset = (__pyx_t_6[0]); - - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break */ - __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_1) { + (__pyx_v_T[7]) = ((__pyx_v_B[7]) * __pyx_v_Ezz); - /* "View.MemoryView":1041 - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< - * break + /* "newanalysis/helpers/helpers.pyx":1101 + * T[6] = B[6]*Ezz + * T[7] = B[7]*Ezz + * T[8] = B[8]*Ezz # <<<<<<<<<<<<<< * + * ind = (i//9)*6 */ - __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); + (__pyx_v_T[8]) = ((__pyx_v_B[8]) * __pyx_v_Ezz); - /* "View.MemoryView":1042 - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - * break # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1103 + * T[8] = B[8]*Ezz * - * result.view.len = result.view.itemsize + * ind = (i//9)*6 # <<<<<<<<<<<<<< + * + * # (B dot T) dot B.T */ - goto __pyx_L6_break; + __pyx_v_ind = (__Pyx_div_long(__pyx_v_i, 9) * 6); - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break + /* "newanalysis/helpers/helpers.pyx":1106 + * + * # (B dot T) dot B.T + * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B # <<<<<<<<<<<<<< + * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 + * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 */ - } - } - __pyx_L6_break:; + (__pyx_v_dipt[__pyx_v_ind]) = ((((__pyx_v_T[0]) * (__pyx_v_B[0])) + ((__pyx_v_T[3]) * (__pyx_v_B[3]))) + ((__pyx_v_T[6]) * (__pyx_v_B[6]))); - /* "View.MemoryView":1044 - * break - * - * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< - * for length in result.view.shape[:ndim]: - * result.view.len *= length + /* "newanalysis/helpers/helpers.pyx":1107 + * # (B dot T) dot B.T + * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B + * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 # <<<<<<<<<<<<<< + * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 + * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 */ - __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + (__pyx_v_dipt[(__pyx_v_ind + 1)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[1])) + ((__pyx_v_T[4]) * (__pyx_v_B[4]))) + ((__pyx_v_T[7]) * (__pyx_v_B[7]))); - /* "View.MemoryView":1045 - * - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< - * result.view.len *= length - * + /* "newanalysis/helpers/helpers.pyx":1108 + * dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B + * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 + * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 # <<<<<<<<<<<<<< + * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 + * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 */ - __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1045, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); - __pyx_t_2 = 0; + (__pyx_v_dipt[(__pyx_v_ind + 2)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[2])) + ((__pyx_v_T[5]) * (__pyx_v_B[5]))) + ((__pyx_v_T[8]) * (__pyx_v_B[8]))); - /* "View.MemoryView":1046 - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: - * result.view.len *= length # <<<<<<<<<<<<<< - * - * result.to_object_func = to_object_func + /* "newanalysis/helpers/helpers.pyx":1109 + * dipt[ind+1] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # 22 + * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 + * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 # <<<<<<<<<<<<<< + * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 + * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - } + (__pyx_v_dipt[(__pyx_v_ind + 3)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[0])) + ((__pyx_v_T[4]) * (__pyx_v_B[3]))) + ((__pyx_v_T[7]) * (__pyx_v_B[6]))); - /* "View.MemoryView":1048 - * result.view.len *= length - * - * result.to_object_func = to_object_func # <<<<<<<<<<<<<< - * result.to_dtype_func = to_dtype_func + /* "newanalysis/helpers/helpers.pyx":1110 + * dipt[ind+2] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # 33 + * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 + * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 # <<<<<<<<<<<<<< + * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric * */ - __pyx_v_result->to_object_func = __pyx_v_to_object_func; + (__pyx_v_dipt[(__pyx_v_ind + 4)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[0])) + ((__pyx_v_T[5]) * (__pyx_v_B[3]))) + ((__pyx_v_T[8]) * (__pyx_v_B[6]))); - /* "View.MemoryView":1049 - * - * result.to_object_func = to_object_func - * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1111 + * dipt[ind+3] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # 21 + * dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 + * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric # <<<<<<<<<<<<<< * - * return result + * ind = (i//9)*3 */ - __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + (__pyx_v_dipt[(__pyx_v_ind + 5)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[1])) + ((__pyx_v_T[5]) * (__pyx_v_B[4]))) + ((__pyx_v_T[8]) * (__pyx_v_B[7]))); - /* "View.MemoryView":1051 - * result.to_dtype_func = to_dtype_func + /* "newanalysis/helpers/helpers.pyx":1113 + * dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric * - * return result # <<<<<<<<<<<<<< + * ind = (i//9)*3 # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_get_slice_from_memoryview') + * B1[ind] = B[0] */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + __pyx_v_ind = (__Pyx_div_long(__pyx_v_i, 9) * 3); - /* "View.MemoryView":1001 + /* "newanalysis/helpers/helpers.pyx":1115 + * ind = (i//9)*3 * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), + * B1[ind] = B[0] # <<<<<<<<<<<<<< + * B1[ind+1] = B[1] + * B1[ind+2] = B[2] */ + (__pyx_v_B1[__pyx_v_ind]) = (__pyx_v_B[0]); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1054 + /* "newanalysis/helpers/helpers.pyx":1116 * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj + * B1[ind] = B[0] + * B1[ind+1] = B[1] # <<<<<<<<<<<<<< + * B1[ind+2] = B[2] + * B2[ind] = B[3] */ + (__pyx_v_B1[(__pyx_v_ind + 1)]) = (__pyx_v_B[1]); -static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { - struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; - __Pyx_memviewslice *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "newanalysis/helpers/helpers.pyx":1117 + * B1[ind] = B[0] + * B1[ind+1] = B[1] + * B1[ind+2] = B[2] # <<<<<<<<<<<<<< + * B2[ind] = B[3] + * B2[ind+1] = B[4] */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + (__pyx_v_B1[(__pyx_v_ind + 2)]) = (__pyx_v_B[2]); - /* "View.MemoryView":1058 - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): - * obj = memview # <<<<<<<<<<<<<< - * return &obj.from_slice - * else: + /* "newanalysis/helpers/helpers.pyx":1118 + * B1[ind+1] = B[1] + * B1[ind+2] = B[2] + * B2[ind] = B[3] # <<<<<<<<<<<<<< + * B2[ind+1] = B[4] + * B2[ind+2] = B[5] */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1058, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + (__pyx_v_B2[__pyx_v_ind]) = (__pyx_v_B[3]); - /* "View.MemoryView":1059 - * if isinstance(memview, _memoryviewslice): - * obj = memview - * return &obj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, mslice) + /* "newanalysis/helpers/helpers.pyx":1119 + * B1[ind+2] = B[2] + * B2[ind] = B[3] + * B2[ind+1] = B[4] # <<<<<<<<<<<<<< + * B2[ind+2] = B[5] + * B3[ind] = B[6] */ - __pyx_r = (&__pyx_v_obj->from_slice); - goto __pyx_L0; + (__pyx_v_B2[(__pyx_v_ind + 1)]) = (__pyx_v_B[4]); - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "newanalysis/helpers/helpers.pyx":1120 + * B2[ind] = B[3] + * B2[ind+1] = B[4] + * B2[ind+2] = B[5] # <<<<<<<<<<<<<< + * B3[ind] = B[6] + * B3[ind+1] = B[7] */ - } + (__pyx_v_B2[(__pyx_v_ind + 2)]) = (__pyx_v_B[5]); - /* "View.MemoryView":1061 - * return &obj.from_slice - * else: - * slice_copy(memview, mslice) # <<<<<<<<<<<<<< - * return mslice - * + /* "newanalysis/helpers/helpers.pyx":1121 + * B2[ind+1] = B[4] + * B2[ind+2] = B[5] + * B3[ind] = B[6] # <<<<<<<<<<<<<< + * B3[ind+1] = B[7] + * B3[ind+2] = B[8] */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + (__pyx_v_B3[__pyx_v_ind]) = (__pyx_v_B[6]); - /* "View.MemoryView":1062 - * else: - * slice_copy(memview, mslice) - * return mslice # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1122 + * B2[ind+2] = B[5] + * B3[ind] = B[6] + * B3[ind+1] = B[7] # <<<<<<<<<<<<<< + * B3[ind+2] = B[8] * - * @cname('__pyx_memoryview_slice_copy') */ - __pyx_r = __pyx_v_mslice; - goto __pyx_L0; - } + (__pyx_v_B3[(__pyx_v_ind + 1)]) = (__pyx_v_B[7]); - /* "View.MemoryView":1054 + /* "newanalysis/helpers/helpers.pyx":1123 + * B3[ind] = B[6] + * B3[ind+1] = B[7] + * B3[ind+2] = B[8] # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj + * free(B) */ + (__pyx_v_B3[(__pyx_v_ind + 2)]) = (__pyx_v_B[8]); + goto __pyx_L17; + __pyx_L12_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L16; + __pyx_L16:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates4) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_H1x; + __pyx_parallel_temp1 = __pyx_v_H1y; + __pyx_parallel_temp2 = __pyx_v_H1z; + __pyx_parallel_temp3 = __pyx_v_H2x; + __pyx_parallel_temp4 = __pyx_v_H2y; + __pyx_parallel_temp5 = __pyx_v_H2z; + __pyx_parallel_temp6 = __pyx_v_i; + __pyx_parallel_temp7 = __pyx_v_ind; + __pyx_parallel_temp8 = __pyx_v_k; + __pyx_parallel_temp9 = __pyx_v_n2; + __pyx_parallel_temp10 = __pyx_v_n3; + } + __pyx_L17:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_H1x = __pyx_parallel_temp0; + __pyx_v_H1y = __pyx_parallel_temp1; + __pyx_v_H1z = __pyx_parallel_temp2; + __pyx_v_H2x = __pyx_parallel_temp3; + __pyx_v_H2y = __pyx_parallel_temp4; + __pyx_v_H2z = __pyx_parallel_temp5; + __pyx_v_i = __pyx_parallel_temp6; + __pyx_v_ind = __pyx_parallel_temp7; + __pyx_v_k = __pyx_parallel_temp8; + __pyx_v_n2 = __pyx_parallel_temp9; + __pyx_v_n3 = __pyx_parallel_temp10; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L8_error; + } + } + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_obj); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1065 - * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets - */ - -static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { - int __pyx_v_dim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - Py_ssize_t *__pyx_v_suboffsets; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("slice_copy", 0); - - /* "View.MemoryView":1069 - * cdef (Py_ssize_t*) shape, strides, suboffsets - * - * shape = memview.view.shape # <<<<<<<<<<<<<< - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets - */ - __pyx_t_1 = __pyx_v_memview->view.shape; - __pyx_v_shape = __pyx_t_1; - - /* "View.MemoryView":1070 - * - * shape = memview.view.shape - * strides = memview.view.strides # <<<<<<<<<<<<<< - * suboffsets = memview.view.suboffsets - * - */ - __pyx_t_1 = __pyx_v_memview->view.strides; - __pyx_v_strides = __pyx_t_1; - - /* "View.MemoryView":1071 - * shape = memview.view.shape - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< - * - * dst.memview = <__pyx_memoryview *> memview - */ - __pyx_t_1 = __pyx_v_memview->view.suboffsets; - __pyx_v_suboffsets = __pyx_t_1; - - /* "View.MemoryView":1073 - * suboffsets = memview.view.suboffsets - * - * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< - * dst.data = memview.view.buf - * - */ - __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); - - /* "View.MemoryView":1074 - * - * dst.memview = <__pyx_memoryview *> memview - * dst.data = memview.view.buf # <<<<<<<<<<<<<< - * - * for dim in range(memview.view.ndim): - */ - __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - - /* "View.MemoryView":1076 - * dst.data = memview.view.buf - * - * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - */ - __pyx_t_2 = __pyx_v_memview->view.ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_dim = __pyx_t_4; - - /* "View.MemoryView":1077 + /* "newanalysis/helpers/helpers.pyx":1125 + * B3[ind+2] = B[8] * - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 - */ - (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); - - /* "View.MemoryView":1078 - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * free(B) # <<<<<<<<<<<<<< + * free(T) * */ - (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + free(__pyx_v_B); - /* "View.MemoryView":1079 - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1126 * - * @cname('__pyx_memoryview_copy_object') - */ - if ((__pyx_v_suboffsets != 0)) { - __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); - } else { - __pyx_t_5 = -1L; - } - (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; - } - - /* "View.MemoryView":1065 + * free(B) + * free(T) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets + * return py_dipt,py_B1,py_B2,py_B3 */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); + free(__pyx_v_T); + goto __pyx_L19; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L19; + __pyx_L19:; + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP } +#endif /* _OPENMP */ + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } -/* "View.MemoryView":1082 + /* "newanalysis/helpers/helpers.pyx":1056 + * cdef double *B3 = py_B3.data * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice + * with nogil, parallel(): # <<<<<<<<<<<<<< + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; + } + } -static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { - __Pyx_memviewslice __pyx_v_memviewslice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy", 0); - - /* "View.MemoryView":1085 - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< - * return memoryview_copy_from_slice(memview, &memviewslice) + /* "newanalysis/helpers/helpers.pyx":1128 + * free(T) * - */ - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); - - /* "View.MemoryView":1086 - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) - * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * return py_dipt,py_B1,py_B2,py_B3 # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_copy_object_from_slice') + * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1086, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF((PyObject *)__pyx_v_py_dipt); + __Pyx_GIVEREF((PyObject *)__pyx_v_py_dipt); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_py_dipt))) __PYX_ERR(0, 1128, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_py_B1); + __Pyx_GIVEREF((PyObject *)__pyx_v_py_B1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_py_B1))) __PYX_ERR(0, 1128, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_py_B2); + __Pyx_GIVEREF((PyObject *)__pyx_v_py_B2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_py_B2))) __PYX_ERR(0, 1128, __pyx_L1_error); + __Pyx_INCREF((PyObject *)__pyx_v_py_B3); + __Pyx_GIVEREF((PyObject *)__pyx_v_py_B3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_py_B3))) __PYX_ERR(0, 1128, __pyx_L1_error); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "View.MemoryView":1082 + /* "newanalysis/helpers/helpers.pyx":1036 + * return B_out + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.helpers.NQRselfAndB", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_B3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_py_dipt); + __Pyx_XDECREF((PyObject *)__pyx_v_py_B1); + __Pyx_XDECREF((PyObject *)__pyx_v_py_B2); + __Pyx_XDECREF((PyObject *)__pyx_v_py_B3); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1089 +/* "newanalysis/helpers/helpers.pyx":1130 + * return py_dipt,py_B1,py_B2,py_B3 * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRdipTen(np.ndarray[np.float64_t,ndim=2] py_xyz, + * np.ndarray[np.float64_t,ndim=1] py_charges, */ -static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { - PyObject *(*__pyx_v_to_object_func)(char *); - int (*__pyx_v_to_dtype_func)(char *, PyObject *); - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *(*__pyx_t_3)(char *); - int (*__pyx_t_4)(char *, PyObject *); - PyObject *__pyx_t_5 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_55NQRdipTen(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_55NQRdipTen = {"NQRdipTen", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_55NQRdipTen, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_55NQRdipTen(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_py_xyz = 0; + PyArrayObject *__pyx_v_py_charges = 0; + PyObject *__pyx_v_aufpunkt = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1097 - * - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - */ - __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; - __pyx_v_to_object_func = __pyx_t_3; - - /* "View.MemoryView":1098 - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< - * else: - * to_object_func = NULL - */ - __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; - __pyx_v_to_dtype_func = __pyx_t_4; - - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - */ - goto __pyx_L3; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("NQRdipTen (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1130, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_xyz,&__pyx_n_s_py_charges,&__pyx_n_s_aufpunkt,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_py_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1130, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_py_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1130, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("NQRdipTen", 1, 3, 3, 1); __PYX_ERR(0, 1130, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1130, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("NQRdipTen", 1, 3, 3, 2); __PYX_ERR(0, 1130, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "NQRdipTen") < 0)) __PYX_ERR(0, 1130, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_py_xyz = ((PyArrayObject *)values[0]); + __pyx_v_py_charges = ((PyArrayObject *)values[1]); + __pyx_v_aufpunkt = values[2]; } - - /* "View.MemoryView":1100 - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - * to_object_func = NULL # <<<<<<<<<<<<<< - * to_dtype_func = NULL - * - */ - /*else*/ { - __pyx_v_to_object_func = NULL; - - /* "View.MemoryView":1101 - * else: - * to_object_func = NULL - * to_dtype_func = NULL # <<<<<<<<<<<<<< - * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - */ - __pyx_v_to_dtype_func = NULL; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("NQRdipTen", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1130, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_L3:; - - /* "View.MemoryView":1103 - * to_dtype_func = NULL - * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< - * to_object_func, to_dtype_func, - * memview.dtype_is_object) - */ - __Pyx_XDECREF(__pyx_r); - - /* "View.MemoryView":1105 - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - * to_object_func, to_dtype_func, - * memview.dtype_is_object) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "View.MemoryView":1089 - * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. - */ + __Pyx_AddTraceback("newanalysis.helpers.NQRdipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_xyz), __pyx_ptype_5numpy_ndarray, 1, "py_xyz", 0))) __PYX_ERR(0, 1131, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_charges), __pyx_ptype_5numpy_ndarray, 1, "py_charges", 0))) __PYX_ERR(0, 1132, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_7helpers_54NQRdipTen(__pyx_self, __pyx_v_py_xyz, __pyx_v_py_charges, __pyx_v_aufpunkt); /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1111 - * - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg - */ - -static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { - Py_ssize_t __pyx_r; - int __pyx_t_1; - - /* "View.MemoryView":1112 - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: - */ - __pyx_t_1 = ((__pyx_v_arg < 0) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1113 - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: - * return -arg # <<<<<<<<<<<<<< - * else: - * return arg - */ - __pyx_r = (-__pyx_v_arg); - goto __pyx_L0; - - /* "View.MemoryView":1112 - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: - */ +static PyObject *__pyx_pf_11newanalysis_7helpers_54NQRdipTen(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_py_xyz, PyArrayObject *__pyx_v_py_charges, PyObject *__pyx_v_aufpunkt) { + int __pyx_v_n; + int __pyx_v_auf; + int __pyx_v_auf3; + int __pyx_v_auf6; + double *__pyx_v_xyz; + double *__pyx_v_charges; + double __pyx_v_x; + double __pyx_v_y; + double __pyx_v_z; + double __pyx_v_r2; + double __pyx_v_f1; + double __pyx_v_f2; + double __pyx_v_f2_x; + double __pyx_v_f2_y; + double __pyx_v_f2_z; + double __pyx_v_auf_x1; + double __pyx_v_auf_y1; + double __pyx_v_auf_z1; + double __pyx_v_auf_x2; + double __pyx_v_auf_y2; + double __pyx_v_auf_z2; + double __pyx_v_tyH; + double __pyx_v_tzH; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + PyArrayObject *__pyx_v_pyE = 0; + PyArrayObject *__pyx_v_py_dipt = 0; + double *__pyx_v_dipt; + double *__pyx_v_E; + double *__pyx_v_B; + double *__pyx_v_T; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pyE; + __Pyx_Buffer __pyx_pybuffer_pyE; + __Pyx_LocalBuf_ND __pyx_pybuffernd_py_charges; + __Pyx_Buffer __pyx_pybuffer_py_charges; + __Pyx_LocalBuf_ND __pyx_pybuffernd_py_dipt; + __Pyx_Buffer __pyx_pybuffer_py_dipt; + __Pyx_LocalBuf_ND __pyx_pybuffernd_py_xyz; + __Pyx_Buffer __pyx_pybuffer_py_xyz; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + char *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + long __pyx_t_11; + long __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + double __pyx_t_16; + long __pyx_t_17; + int __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("NQRdipTen", 0); + __pyx_pybuffer_pyE.pybuffer.buf = NULL; + __pyx_pybuffer_pyE.refcount = 0; + __pyx_pybuffernd_pyE.data = NULL; + __pyx_pybuffernd_pyE.rcbuffer = &__pyx_pybuffer_pyE; + __pyx_pybuffer_py_dipt.pybuffer.buf = NULL; + __pyx_pybuffer_py_dipt.refcount = 0; + __pyx_pybuffernd_py_dipt.data = NULL; + __pyx_pybuffernd_py_dipt.rcbuffer = &__pyx_pybuffer_py_dipt; + __pyx_pybuffer_py_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_py_xyz.refcount = 0; + __pyx_pybuffernd_py_xyz.data = NULL; + __pyx_pybuffernd_py_xyz.rcbuffer = &__pyx_pybuffer_py_xyz; + __pyx_pybuffer_py_charges.pybuffer.buf = NULL; + __pyx_pybuffer_py_charges.refcount = 0; + __pyx_pybuffernd_py_charges.data = NULL; + __pyx_pybuffernd_py_charges.rcbuffer = &__pyx_pybuffer_py_charges; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_py_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1130, __pyx_L1_error) } - - /* "View.MemoryView":1115 - * return -arg - * else: - * return arg # <<<<<<<<<<<<<< - * - * @cname('__pyx_get_best_slice_order') - */ - /*else*/ { - __pyx_r = __pyx_v_arg; - goto __pyx_L0; + __pyx_pybuffernd_py_xyz.diminfo[0].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_xyz.diminfo[0].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_py_xyz.diminfo[1].strides = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_py_xyz.diminfo[1].shape = __pyx_pybuffernd_py_xyz.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_charges.rcbuffer->pybuffer, (PyObject*)__pyx_v_py_charges, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1130, __pyx_L1_error) } + __pyx_pybuffernd_py_charges.diminfo[0].strides = __pyx_pybuffernd_py_charges.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_charges.diminfo[0].shape = __pyx_pybuffernd_py_charges.rcbuffer->pybuffer.shape[0]; - /* "View.MemoryView":1111 - * + /* "newanalysis/helpers/helpers.pyx":1135 + * aufpunkt): * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg + * cdef int n = 3*len(py_xyz) # <<<<<<<<<<<<<< + * cdef int auf = 3*aufpunkt # x,y,z for each atom -> *3 + * cdef int auf3 = auf+3 */ + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_py_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1135, __pyx_L1_error) + __pyx_v_n = (3 * __pyx_t_1); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1118 + /* "newanalysis/helpers/helpers.pyx":1136 * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. + * cdef int n = 3*len(py_xyz) + * cdef int auf = 3*aufpunkt # x,y,z for each atom -> *3 # <<<<<<<<<<<<<< + * cdef int auf3 = auf+3 + * cdef int auf6 = auf+6 */ + __pyx_t_2 = __Pyx_PyInt_From_int(((int)3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_aufpunkt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1136, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_auf = __pyx_t_4; -static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { - int __pyx_v_i; - Py_ssize_t __pyx_v_c_stride; - Py_ssize_t __pyx_v_f_stride; - char __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; + /* "newanalysis/helpers/helpers.pyx":1137 + * cdef int n = 3*len(py_xyz) + * cdef int auf = 3*aufpunkt # x,y,z for each atom -> *3 + * cdef int auf3 = auf+3 # <<<<<<<<<<<<<< + * cdef int auf6 = auf+6 + * cdef double *xyz = py_xyz.data + */ + __pyx_v_auf3 = (__pyx_v_auf + 3); - /* "View.MemoryView":1123 - * """ - * cdef int i - * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< - * cdef Py_ssize_t f_stride = 0 - * + /* "newanalysis/helpers/helpers.pyx":1138 + * cdef int auf = 3*aufpunkt # x,y,z for each atom -> *3 + * cdef int auf3 = auf+3 + * cdef int auf6 = auf+6 # <<<<<<<<<<<<<< + * cdef double *xyz = py_xyz.data + * cdef double *charges = py_charges.data */ - __pyx_v_c_stride = 0; + __pyx_v_auf6 = (__pyx_v_auf + 6); - /* "View.MemoryView":1124 - * cdef int i - * cdef Py_ssize_t c_stride = 0 - * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): + /* "newanalysis/helpers/helpers.pyx":1139 + * cdef int auf3 = auf+3 + * cdef int auf6 = auf+6 + * cdef double *xyz = py_xyz.data # <<<<<<<<<<<<<< + * cdef double *charges = py_charges.data + * cdef double x,y,z, r2, f1,f2, f2_x,f2_y,f2_z, auf_x1,auf_y1,auf_z1,auf_x2,auf_y2,auf_z2 */ - __pyx_v_f_stride = 0; + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_py_xyz)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1139, __pyx_L1_error) + __pyx_v_xyz = ((double *)__pyx_t_5); - /* "View.MemoryView":1126 - * cdef Py_ssize_t f_stride = 0 - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] + /* "newanalysis/helpers/helpers.pyx":1140 + * cdef int auf6 = auf+6 + * cdef double *xyz = py_xyz.data + * cdef double *charges = py_charges.data # <<<<<<<<<<<<<< + * cdef double x,y,z, r2, f1,f2, f2_x,f2_y,f2_z, auf_x1,auf_y1,auf_z1,auf_x2,auf_y2,auf_z2 + * cdef double tyH = 1.63 */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_py_charges)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1140, __pyx_L1_error) + __pyx_v_charges = ((double *)__pyx_t_5); - /* "View.MemoryView":1127 - * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break + /* "newanalysis/helpers/helpers.pyx":1142 + * cdef double *charges = py_charges.data + * cdef double x,y,z, r2, f1,f2, f2_x,f2_y,f2_z, auf_x1,auf_y1,auf_z1,auf_x2,auf_y2,auf_z2 + * cdef double tyH = 1.63 # <<<<<<<<<<<<<< + * cdef double tzH = 1.158921913 + * cdef int i, j, k */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { + __pyx_v_tyH = 1.63; - /* "View.MemoryView":1128 - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * + /* "newanalysis/helpers/helpers.pyx":1143 + * cdef double x,y,z, r2, f1,f2, f2_x,f2_y,f2_z, auf_x1,auf_y1,auf_z1,auf_x2,auf_y2,auf_z2 + * cdef double tyH = 1.63 + * cdef double tzH = 1.158921913 # <<<<<<<<<<<<<< + * cdef int i, j, k + * # cdef np.ndarray[np.float64_t,ndim=1] pyB = np.zeros(9,dtype=np.float64) # transformation matrix of aufpunkt wat */ - __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + __pyx_v_tzH = 1.158921913; - /* "View.MemoryView":1129 - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< - * - * for i in range(ndim): + /* "newanalysis/helpers/helpers.pyx":1146 + * cdef int i, j, k + * # cdef np.ndarray[np.float64_t,ndim=1] pyB = np.zeros(9,dtype=np.float64) # transformation matrix of aufpunkt wat + * cdef np.ndarray[np.float64_t,ndim=1] pyE = np.asarray([-2.0487,1.8086,0.2400],dtype=np.float64) # EFG matrix from Boykin # <<<<<<<<<<<<<< + * # cdef np.ndarray[np.float64_t,ndim=1] pyT = np.zeros(9,dtype=np.float64) # temp matrix for mult + * #cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(15,dtype=np.float64) */ - goto __pyx_L4_break; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_float_neg_2_0487); + __Pyx_GIVEREF(__pyx_float_neg_2_0487); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_float_neg_2_0487)) __PYX_ERR(0, 1146, __pyx_L1_error); + __Pyx_INCREF(__pyx_float_1_8086); + __Pyx_GIVEREF(__pyx_float_1_8086); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_float_1_8086)) __PYX_ERR(0, 1146, __pyx_L1_error); + __Pyx_INCREF(__pyx_float_0_2400); + __Pyx_GIVEREF(__pyx_float_0_2400); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_float_0_2400)) __PYX_ERR(0, 1146, __pyx_L1_error); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3)) __PYX_ERR(0, 1146, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 1146, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1146, __pyx_L1_error) + __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pyE.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_pyE = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_pyE.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1146, __pyx_L1_error) + } else {__pyx_pybuffernd_pyE.diminfo[0].strides = __pyx_pybuffernd_pyE.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pyE.diminfo[0].shape = __pyx_pybuffernd_pyE.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_9 = 0; + __pyx_v_pyE = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; - /* "View.MemoryView":1127 + /* "newanalysis/helpers/helpers.pyx":1149 + * # cdef np.ndarray[np.float64_t,ndim=1] pyT = np.zeros(9,dtype=np.float64) # temp matrix for mult + * #cdef np.ndarray[np.float64_t,ndim=1] py_dipt = np.zeros(15,dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=2] py_dipt = np.zeros((n/3,15),dtype=np.float64) # <<<<<<<<<<<<<< * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break + * cdef double *dipt = py_dipt.data */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyFloat_FromDouble((((double)__pyx_v_n) / 3.0)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_15); + __Pyx_GIVEREF(__pyx_int_15); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_15)) __PYX_ERR(0, 1149, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6)) __PYX_ERR(0, 1149, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 1149, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1149, __pyx_L1_error) + __pyx_t_10 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_py_dipt = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1149, __pyx_L1_error) + } else {__pyx_pybuffernd_py_dipt.diminfo[0].strides = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_py_dipt.diminfo[0].shape = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_py_dipt.diminfo[1].strides = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_py_dipt.diminfo[1].shape = __pyx_pybuffernd_py_dipt.rcbuffer->pybuffer.shape[1]; } } - __pyx_L4_break:; + __pyx_t_10 = 0; + __pyx_v_py_dipt = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":1131 - * break + /* "newanalysis/helpers/helpers.pyx":1151 + * cdef np.ndarray[np.float64_t,ndim=2] py_dipt = np.zeros((n/3,15),dtype=np.float64) * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] + * cdef double *dipt = py_dipt.data # <<<<<<<<<<<<<< + * # cdef double *B = malloc(sizeof(double) * 9) + * # cdef double *T = malloc(sizeof(double) * 9) */ - __pyx_t_1 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_1; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_py_dipt)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1151, __pyx_L1_error) + __pyx_v_dipt = ((double *)__pyx_t_5); - /* "View.MemoryView":1132 + /* "newanalysis/helpers/helpers.pyx":1154 + * # cdef double *B = malloc(sizeof(double) * 9) + * # cdef double *T = malloc(sizeof(double) * 9) + * cdef double *E = pyE.data # <<<<<<<<<<<<<< * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break + * with nogil, parallel(): */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_pyE)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1154, __pyx_L1_error) + __pyx_v_E = ((double *)__pyx_t_5); - /* "View.MemoryView":1133 - * for i in range(ndim): - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break + /* "newanalysis/helpers/helpers.pyx":1156 + * cdef double *E = pyE.data * + * with nogil, parallel(): # <<<<<<<<<<<<<< + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) */ - __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + { + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + #ifdef _OPENMP + #pragma omp parallel private(__pyx_v_B, __pyx_v_T) private(__pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_4) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + /* Initialize private variables to invalid values */ + __pyx_v_B = ((double *)1); + __pyx_v_T = ((double *)1); - /* "View.MemoryView":1134 - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1157 * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * with nogil, parallel(): + * B = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< + * T = malloc(sizeof(double) * 9) + * for i in prange(0,n,3): # dip-dip T for to all atoms on every other molecule */ - goto __pyx_L7_break; + __pyx_v_B = ((double *)malloc(((sizeof(double)) * 9))); - /* "View.MemoryView":1132 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break + /* "newanalysis/helpers/helpers.pyx":1158 + * with nogil, parallel(): + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) # <<<<<<<<<<<<<< + * for i in prange(0,n,3): # dip-dip T for to all atoms on every other molecule + * j = i//3 * 15 */ - } - } - __pyx_L7_break:; + __pyx_v_T = ((double *)malloc(((sizeof(double)) * 9))); - /* "View.MemoryView":1136 - * break - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: + /* "newanalysis/helpers/helpers.pyx":1159 + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) + * for i in prange(0,n,3): # dip-dip T for to all atoms on every other molecule # <<<<<<<<<<<<<< + * j = i//3 * 15 + * for k in range(9): */ - __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0); - if (__pyx_t_2) { + __pyx_t_4 = __pyx_v_n; + { + double __pyx_parallel_temp0 = ((double)__PYX_NAN()); + double __pyx_parallel_temp1 = ((double)__PYX_NAN()); + double __pyx_parallel_temp2 = ((double)__PYX_NAN()); + double __pyx_parallel_temp3 = ((double)__PYX_NAN()); + double __pyx_parallel_temp4 = ((double)__PYX_NAN()); + double __pyx_parallel_temp5 = ((double)__PYX_NAN()); + double __pyx_parallel_temp6 = ((double)__PYX_NAN()); + double __pyx_parallel_temp7 = ((double)__PYX_NAN()); + double __pyx_parallel_temp8 = ((double)__PYX_NAN()); + double __pyx_parallel_temp9 = ((double)__PYX_NAN()); + double __pyx_parallel_temp10 = ((double)__PYX_NAN()); + int __pyx_parallel_temp11 = ((int)0xbad0bad0); + int __pyx_parallel_temp12 = ((int)0xbad0bad0); + int __pyx_parallel_temp13 = ((int)0xbad0bad0); + double __pyx_parallel_temp14 = ((double)__PYX_NAN()); + double __pyx_parallel_temp15 = ((double)__PYX_NAN()); + double __pyx_parallel_temp16 = ((double)__PYX_NAN()); + double __pyx_parallel_temp17 = ((double)__PYX_NAN()); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + __pyx_t_12 = (__pyx_t_4 - 0 + 3 - 3/abs(3)) / 3; + if (__pyx_t_12 > 0) + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_auf_x1) lastprivate(__pyx_v_auf_x2) lastprivate(__pyx_v_auf_y1) lastprivate(__pyx_v_auf_y2) lastprivate(__pyx_v_auf_z1) lastprivate(__pyx_v_auf_z2) lastprivate(__pyx_v_f1) lastprivate(__pyx_v_f2) lastprivate(__pyx_v_f2_x) lastprivate(__pyx_v_f2_y) lastprivate(__pyx_v_f2_z) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_r2) lastprivate(__pyx_v_x) lastprivate(__pyx_v_y) lastprivate(__pyx_v_z) + #endif /* _OPENMP */ + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_i = (int)(0 + 3 * __pyx_t_11); + /* Initialize private variables to invalid values */ + __pyx_v_auf_x1 = ((double)__PYX_NAN()); + __pyx_v_auf_x2 = ((double)__PYX_NAN()); + __pyx_v_auf_y1 = ((double)__PYX_NAN()); + __pyx_v_auf_y2 = ((double)__PYX_NAN()); + __pyx_v_auf_z1 = ((double)__PYX_NAN()); + __pyx_v_auf_z2 = ((double)__PYX_NAN()); + __pyx_v_f1 = ((double)__PYX_NAN()); + __pyx_v_f2 = ((double)__PYX_NAN()); + __pyx_v_f2_x = ((double)__PYX_NAN()); + __pyx_v_f2_y = ((double)__PYX_NAN()); + __pyx_v_f2_z = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); + __pyx_v_r2 = ((double)__PYX_NAN()); + __pyx_v_x = ((double)__PYX_NAN()); + __pyx_v_y = ((double)__PYX_NAN()); + __pyx_v_z = ((double)__PYX_NAN()); - /* "View.MemoryView":1137 - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - * return 'C' # <<<<<<<<<<<<<< - * else: - * return 'F' + /* "newanalysis/helpers/helpers.pyx":1160 + * T = malloc(sizeof(double) * 9) + * for i in prange(0,n,3): # dip-dip T for to all atoms on every other molecule + * j = i//3 * 15 # <<<<<<<<<<<<<< + * for k in range(9): + * B[k] = 0.0 */ - __pyx_r = 'C'; - goto __pyx_L0; + __pyx_v_j = (__Pyx_div_long(__pyx_v_i, 3) * 15); - /* "View.MemoryView":1136 - * break - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: + /* "newanalysis/helpers/helpers.pyx":1161 + * for i in prange(0,n,3): # dip-dip T for to all atoms on every other molecule + * j = i//3 * 15 + * for k in range(9): # <<<<<<<<<<<<<< + * B[k] = 0.0 + * T[k] = 0.0 */ - } + for (__pyx_t_13 = 0; __pyx_t_13 < 9; __pyx_t_13+=1) { + __pyx_v_k = __pyx_t_13; - /* "View.MemoryView":1139 - * return 'C' - * else: - * return 'F' # <<<<<<<<<<<<<< - * - * @cython.cdivision(True) + /* "newanalysis/helpers/helpers.pyx":1162 + * j = i//3 * 15 + * for k in range(9): + * B[k] = 0.0 # <<<<<<<<<<<<<< + * T[k] = 0.0 + * if i!=auf and i!=auf3 and i!=auf6: */ - /*else*/ { - __pyx_r = 'F'; - goto __pyx_L0; - } + (__pyx_v_B[__pyx_v_k]) = 0.0; - /* "View.MemoryView":1118 - * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. + /* "newanalysis/helpers/helpers.pyx":1163 + * for k in range(9): + * B[k] = 0.0 + * T[k] = 0.0 # <<<<<<<<<<<<<< + * if i!=auf and i!=auf3 and i!=auf6: + * x = xyz[i] */ + (__pyx_v_T[__pyx_v_k]) = 0.0; + } - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} + /* "newanalysis/helpers/helpers.pyx":1164 + * B[k] = 0.0 + * T[k] = 0.0 + * if i!=auf and i!=auf3 and i!=auf6: # <<<<<<<<<<<<<< + * x = xyz[i] + * y = xyz[i+1] + */ + __pyx_t_15 = (__pyx_v_i != __pyx_v_auf); + if (__pyx_t_15) { + } else { + __pyx_t_14 = __pyx_t_15; + goto __pyx_L17_bool_binop_done; + } + __pyx_t_15 = (__pyx_v_i != __pyx_v_auf3); + if (__pyx_t_15) { + } else { + __pyx_t_14 = __pyx_t_15; + goto __pyx_L17_bool_binop_done; + } + __pyx_t_15 = (__pyx_v_i != __pyx_v_auf6); + __pyx_t_14 = __pyx_t_15; + __pyx_L17_bool_binop_done:; + if (__pyx_t_14) { -/* "View.MemoryView":1142 - * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + /* "newanalysis/helpers/helpers.pyx":1165 + * T[k] = 0.0 + * if i!=auf and i!=auf3 and i!=auf6: + * x = xyz[i] # <<<<<<<<<<<<<< + * y = xyz[i+1] + * z = xyz[i+2] */ + __pyx_v_x = (__pyx_v_xyz[__pyx_v_i]); -static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; - Py_ssize_t __pyx_v_dst_extent; - Py_ssize_t __pyx_v_src_stride; - Py_ssize_t __pyx_v_dst_stride; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; + /* "newanalysis/helpers/helpers.pyx":1166 + * if i!=auf and i!=auf3 and i!=auf6: + * x = xyz[i] + * y = xyz[i+1] # <<<<<<<<<<<<<< + * z = xyz[i+2] + * r2 = x*x+y*y+z*z + */ + __pyx_v_y = (__pyx_v_xyz[(__pyx_v_i + 1)]); - /* "View.MemoryView":1149 - * - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] + /* "newanalysis/helpers/helpers.pyx":1167 + * x = xyz[i] + * y = xyz[i+1] + * z = xyz[i+2] # <<<<<<<<<<<<<< + * r2 = x*x+y*y+z*z + * f1 = pow(r2,-1.5) * charges[i//3] */ - __pyx_v_src_extent = (__pyx_v_src_shape[0]); + __pyx_v_z = (__pyx_v_xyz[(__pyx_v_i + 2)]); - /* "View.MemoryView":1150 - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] + /* "newanalysis/helpers/helpers.pyx":1168 + * y = xyz[i+1] + * z = xyz[i+2] + * r2 = x*x+y*y+z*z # <<<<<<<<<<<<<< + * f1 = pow(r2,-1.5) * charges[i//3] + * f2 = 3.0 * f1 / r2 */ - __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + __pyx_v_r2 = (((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)) + (__pyx_v_z * __pyx_v_z)); - /* "View.MemoryView":1151 - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_stride = dst_strides[0] - * + /* "newanalysis/helpers/helpers.pyx":1169 + * z = xyz[i+2] + * r2 = x*x+y*y+z*z + * f1 = pow(r2,-1.5) * charges[i//3] # <<<<<<<<<<<<<< + * f2 = 3.0 * f1 / r2 + * f2_x = f2 * x */ - __pyx_v_src_stride = (__pyx_v_src_strides[0]); + __pyx_v_f1 = (pow(__pyx_v_r2, -1.5) * (__pyx_v_charges[__Pyx_div_long(__pyx_v_i, 3)])); - /* "View.MemoryView":1152 - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: + /* "newanalysis/helpers/helpers.pyx":1170 + * r2 = x*x+y*y+z*z + * f1 = pow(r2,-1.5) * charges[i//3] + * f2 = 3.0 * f1 / r2 # <<<<<<<<<<<<<< + * f2_x = f2 * x + * f2_y = f2 * y */ - __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + __pyx_t_16 = (3.0 * __pyx_v_f1); + if (unlikely(__pyx_v_r2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1170, __pyx_L12_error) + } + __pyx_v_f2 = (__pyx_t_16 / __pyx_v_r2); - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): + /* "newanalysis/helpers/helpers.pyx":1171 + * f1 = pow(r2,-1.5) * charges[i//3] + * f2 = 3.0 * f1 / r2 + * f2_x = f2 * x # <<<<<<<<<<<<<< + * f2_y = f2 * y + * f2_z = f2 * z */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { + __pyx_v_f2_x = (__pyx_v_f2 * __pyx_v_x); - /* "View.MemoryView":1155 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + /* "newanalysis/helpers/helpers.pyx":1172 + * f2 = 3.0 * f1 / r2 + * f2_x = f2 * x + * f2_y = f2 * y # <<<<<<<<<<<<<< + * f2_z = f2 * z + * dipt[j] += f2_x * x - f1 */ - __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } + __pyx_v_f2_y = (__pyx_v_f2 * __pyx_v_y); - /* "View.MemoryView":1156 - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: + /* "newanalysis/helpers/helpers.pyx":1173 + * f2_x = f2 * x + * f2_y = f2 * y + * f2_z = f2 * z # <<<<<<<<<<<<<< + * dipt[j] += f2_x * x - f1 + * dipt[j+1] += f2_y * y - f1 */ - __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); - if (__pyx_t_2) { - __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); - } - __pyx_t_3 = (__pyx_t_2 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L5_bool_binop_done:; + __pyx_v_f2_z = (__pyx_v_f2 * __pyx_v_z); - /* "View.MemoryView":1155 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + /* "newanalysis/helpers/helpers.pyx":1174 + * f2_y = f2 * y + * f2_z = f2 * z + * dipt[j] += f2_x * x - f1 # <<<<<<<<<<<<<< + * dipt[j+1] += f2_y * y - f1 + * dipt[j+2] += f2_z * z - f1 */ - if (__pyx_t_1) { + __pyx_t_13 = __pyx_v_j; + (__pyx_v_dipt[__pyx_t_13]) = ((__pyx_v_dipt[__pyx_t_13]) + ((__pyx_v_f2_x * __pyx_v_x) - __pyx_v_f1)); - /* "View.MemoryView":1157 - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): + /* "newanalysis/helpers/helpers.pyx":1175 + * f2_z = f2 * z + * dipt[j] += f2_x * x - f1 + * dipt[j+1] += f2_y * y - f1 # <<<<<<<<<<<<<< + * dipt[j+2] += f2_z * z - f1 + * dipt[j+3] += f2_x * y */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + __pyx_t_17 = (__pyx_v_j + 1); + (__pyx_v_dipt[__pyx_t_17]) = ((__pyx_v_dipt[__pyx_t_17]) + ((__pyx_v_f2_y * __pyx_v_y) - __pyx_v_f1)); - /* "View.MemoryView":1155 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + /* "newanalysis/helpers/helpers.pyx":1176 + * dipt[j] += f2_x * x - f1 + * dipt[j+1] += f2_y * y - f1 + * dipt[j+2] += f2_z * z - f1 # <<<<<<<<<<<<<< + * dipt[j+3] += f2_x * y + * dipt[j+4] += f2_x * z */ - goto __pyx_L4; - } + __pyx_t_17 = (__pyx_v_j + 2); + (__pyx_v_dipt[__pyx_t_17]) = ((__pyx_v_dipt[__pyx_t_17]) + ((__pyx_v_f2_z * __pyx_v_z) - __pyx_v_f1)); - /* "View.MemoryView":1159 - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride + /* "newanalysis/helpers/helpers.pyx":1177 + * dipt[j+1] += f2_y * y - f1 + * dipt[j+2] += f2_z * z - f1 + * dipt[j+3] += f2_x * y # <<<<<<<<<<<<<< + * dipt[j+4] += f2_x * z + * dipt[j+5] += f2_y * z */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_17 = (__pyx_v_j + 3); + (__pyx_v_dipt[__pyx_t_17]) = ((__pyx_v_dipt[__pyx_t_17]) + (__pyx_v_f2_x * __pyx_v_y)); - /* "View.MemoryView":1160 - * else: - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< - * src_data += src_stride - * dst_data += dst_stride + /* "newanalysis/helpers/helpers.pyx":1178 + * dipt[j+2] += f2_z * z - f1 + * dipt[j+3] += f2_x * y + * dipt[j+4] += f2_x * z # <<<<<<<<<<<<<< + * dipt[j+5] += f2_y * z + * elif i == auf: */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + __pyx_t_17 = (__pyx_v_j + 4); + (__pyx_v_dipt[__pyx_t_17]) = ((__pyx_v_dipt[__pyx_t_17]) + (__pyx_v_f2_x * __pyx_v_z)); - /* "View.MemoryView":1161 - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * else: + /* "newanalysis/helpers/helpers.pyx":1179 + * dipt[j+3] += f2_x * y + * dipt[j+4] += f2_x * z + * dipt[j+5] += f2_y * z # <<<<<<<<<<<<<< + * elif i == auf: + * auf_x1 = xyz[auf+3] */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + __pyx_t_17 = (__pyx_v_j + 5); + (__pyx_v_dipt[__pyx_t_17]) = ((__pyx_v_dipt[__pyx_t_17]) + (__pyx_v_f2_y * __pyx_v_z)); - /* "View.MemoryView":1162 - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): + /* "newanalysis/helpers/helpers.pyx":1164 + * B[k] = 0.0 + * T[k] = 0.0 + * if i!=auf and i!=auf3 and i!=auf6: # <<<<<<<<<<<<<< + * x = xyz[i] + * y = xyz[i+1] */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } - } - __pyx_L4:; + goto __pyx_L16; + } - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): + /* "newanalysis/helpers/helpers.pyx":1180 + * dipt[j+4] += f2_x * z + * dipt[j+5] += f2_y * z + * elif i == auf: # <<<<<<<<<<<<<< + * auf_x1 = xyz[auf+3] + * auf_y1 = xyz[auf+4] */ - goto __pyx_L3; - } + __pyx_t_14 = (__pyx_v_i == __pyx_v_auf); + if (__pyx_t_14) { - /* "View.MemoryView":1164 - * dst_data += dst_stride - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * _copy_strided_to_strided(src_data, src_strides + 1, - * dst_data, dst_strides + 1, + /* "newanalysis/helpers/helpers.pyx":1181 + * dipt[j+5] += f2_y * z + * elif i == auf: + * auf_x1 = xyz[auf+3] # <<<<<<<<<<<<<< + * auf_y1 = xyz[auf+4] + * auf_z1 = xyz[auf+5] */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_v_auf_x1 = (__pyx_v_xyz[(__pyx_v_auf + 3)]); - /* "View.MemoryView":1165 - * else: - * for i in range(dst_extent): - * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< - * dst_data, dst_strides + 1, - * src_shape + 1, dst_shape + 1, + /* "newanalysis/helpers/helpers.pyx":1182 + * elif i == auf: + * auf_x1 = xyz[auf+3] + * auf_y1 = xyz[auf+4] # <<<<<<<<<<<<<< + * auf_z1 = xyz[auf+5] + * auf_x2 = xyz[auf+6] */ - _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + __pyx_v_auf_y1 = (__pyx_v_xyz[(__pyx_v_auf + 4)]); - /* "View.MemoryView":1169 - * src_shape + 1, dst_shape + 1, - * ndim - 1, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * + /* "newanalysis/helpers/helpers.pyx":1183 + * auf_x1 = xyz[auf+3] + * auf_y1 = xyz[auf+4] + * auf_z1 = xyz[auf+5] # <<<<<<<<<<<<<< + * auf_x2 = xyz[auf+6] + * auf_y2 = xyz[auf+7] */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + __pyx_v_auf_z1 = (__pyx_v_xyz[(__pyx_v_auf + 5)]); - /* "View.MemoryView":1170 - * ndim - 1, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, + /* "newanalysis/helpers/helpers.pyx":1184 + * auf_y1 = xyz[auf+4] + * auf_z1 = xyz[auf+5] + * auf_x2 = xyz[auf+6] # <<<<<<<<<<<<<< + * auf_y2 = xyz[auf+7] + * auf_z2 = xyz[auf+8] */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } - } - __pyx_L3:; + __pyx_v_auf_x2 = (__pyx_v_xyz[(__pyx_v_auf + 6)]); - /* "View.MemoryView":1142 + /* "newanalysis/helpers/helpers.pyx":1185 + * auf_z1 = xyz[auf+5] + * auf_x2 = xyz[auf+6] + * auf_y2 = xyz[auf+7] # <<<<<<<<<<<<<< + * auf_z2 = xyz[auf+8] * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ + __pyx_v_auf_y2 = (__pyx_v_xyz[(__pyx_v_auf + 7)]); - /* function exit code */ -} - -/* "View.MemoryView":1172 - * dst_data += dst_stride + /* "newanalysis/helpers/helpers.pyx":1186 + * auf_x2 = xyz[auf+6] + * auf_y2 = xyz[auf+7] + * auf_z2 = xyz[auf+8] # <<<<<<<<<<<<<< * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + * B[3] = (auf_x1-auf_x2)/tyH */ + __pyx_v_auf_z2 = (__pyx_v_xyz[(__pyx_v_auf + 8)]); -static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - - /* "View.MemoryView":1175 - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: - * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< - * src.shape, dst.shape, ndim, itemsize) + /* "newanalysis/helpers/helpers.pyx":1188 + * auf_z2 = xyz[auf+8] * + * B[3] = (auf_x1-auf_x2)/tyH # <<<<<<<<<<<<<< + * B[4] = (auf_y1-auf_y2)/tyH + * B[5] = (auf_z1-auf_z2)/tyH */ - _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + __pyx_t_16 = (__pyx_v_auf_x1 - __pyx_v_auf_x2); + if (unlikely(__pyx_v_tyH == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1188, __pyx_L12_error) + } + (__pyx_v_B[3]) = (__pyx_t_16 / __pyx_v_tyH); - /* "View.MemoryView":1172 - * dst_data += dst_stride + /* "newanalysis/helpers/helpers.pyx":1189 * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + * B[3] = (auf_x1-auf_x2)/tyH + * B[4] = (auf_y1-auf_y2)/tyH # <<<<<<<<<<<<<< + * B[5] = (auf_z1-auf_z2)/tyH + * B[6] = (auf_x1+auf_x2)/tzH */ + __pyx_t_16 = (__pyx_v_auf_y1 - __pyx_v_auf_y2); + if (unlikely(__pyx_v_tyH == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1189, __pyx_L12_error) + } + (__pyx_v_B[4]) = (__pyx_t_16 / __pyx_v_tyH); - /* function exit code */ -} + /* "newanalysis/helpers/helpers.pyx":1190 + * B[3] = (auf_x1-auf_x2)/tyH + * B[4] = (auf_y1-auf_y2)/tyH + * B[5] = (auf_z1-auf_z2)/tyH # <<<<<<<<<<<<<< + * B[6] = (auf_x1+auf_x2)/tzH + * B[7] = (auf_y1+auf_y2)/tzH + */ + __pyx_t_16 = (__pyx_v_auf_z1 - __pyx_v_auf_z2); + if (unlikely(__pyx_v_tyH == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1190, __pyx_L12_error) + } + (__pyx_v_B[5]) = (__pyx_t_16 / __pyx_v_tyH); -/* "View.MemoryView":1179 - * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + /* "newanalysis/helpers/helpers.pyx":1191 + * B[4] = (auf_y1-auf_y2)/tyH + * B[5] = (auf_z1-auf_z2)/tyH + * B[6] = (auf_x1+auf_x2)/tzH # <<<<<<<<<<<<<< + * B[7] = (auf_y1+auf_y2)/tzH + * B[8] = (auf_z1+auf_z2)/tzH */ + __pyx_t_16 = (__pyx_v_auf_x1 + __pyx_v_auf_x2); + if (unlikely(__pyx_v_tzH == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1191, __pyx_L12_error) + } + (__pyx_v_B[6]) = (__pyx_t_16 / __pyx_v_tzH); -static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_size; - Py_ssize_t __pyx_r; - Py_ssize_t __pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; + /* "newanalysis/helpers/helpers.pyx":1192 + * B[5] = (auf_z1-auf_z2)/tyH + * B[6] = (auf_x1+auf_x2)/tzH + * B[7] = (auf_y1+auf_y2)/tzH # <<<<<<<<<<<<<< + * B[8] = (auf_z1+auf_z2)/tzH + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + */ + __pyx_t_16 = (__pyx_v_auf_y1 + __pyx_v_auf_y2); + if (unlikely(__pyx_v_tzH == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1192, __pyx_L12_error) + } + (__pyx_v_B[7]) = (__pyx_t_16 / __pyx_v_tzH); - /* "View.MemoryView":1181 - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< - * - * for shape in src.shape[:ndim]: + /* "newanalysis/helpers/helpers.pyx":1193 + * B[6] = (auf_x1+auf_x2)/tzH + * B[7] = (auf_y1+auf_y2)/tzH + * B[8] = (auf_z1+auf_z2)/tzH # <<<<<<<<<<<<<< + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + * B[1] = B[5]*B[6]-B[3]*B[8] */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_size = __pyx_t_1; + __pyx_t_16 = (__pyx_v_auf_z1 + __pyx_v_auf_z2); + if (unlikely(__pyx_v_tzH == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1193, __pyx_L12_error) + } + (__pyx_v_B[8]) = (__pyx_t_16 / __pyx_v_tzH); - /* "View.MemoryView":1183 - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - * - * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< - * size *= shape - * + /* "newanalysis/helpers/helpers.pyx":1194 + * B[7] = (auf_y1+auf_y2)/tzH + * B[8] = (auf_z1+auf_z2)/tzH + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product # <<<<<<<<<<<<<< + * B[1] = B[5]*B[6]-B[3]*B[8] + * B[2] = B[3]*B[7]-B[4]*B[6] */ - __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); - for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_shape = (__pyx_t_2[0]); + (__pyx_v_B[0]) = (((__pyx_v_B[4]) * (__pyx_v_B[8])) - ((__pyx_v_B[5]) * (__pyx_v_B[7]))); - /* "View.MemoryView":1184 - * - * for shape in src.shape[:ndim]: - * size *= shape # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1195 + * B[8] = (auf_z1+auf_z2)/tzH + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + * B[1] = B[5]*B[6]-B[3]*B[8] # <<<<<<<<<<<<<< + * B[2] = B[3]*B[7]-B[4]*B[6] * - * return size */ - __pyx_v_size = (__pyx_v_size * __pyx_v_shape); - } + (__pyx_v_B[1]) = (((__pyx_v_B[5]) * (__pyx_v_B[6])) - ((__pyx_v_B[3]) * (__pyx_v_B[8]))); - /* "View.MemoryView":1186 - * size *= shape - * - * return size # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1196 + * B[0] = B[4]*B[8]-B[5]*B[7] # (Bvec_1,Bvec_2,Bvec_3) are orthonormal -> vector product + * B[1] = B[5]*B[6]-B[3]*B[8] + * B[2] = B[3]*B[7]-B[4]*B[6] # <<<<<<<<<<<<<< * - * @cname('__pyx_fill_contig_strides_array') + * T[0] = B[0]*E[0] */ - __pyx_r = __pyx_v_size; - goto __pyx_L0; + (__pyx_v_B[2]) = (((__pyx_v_B[3]) * (__pyx_v_B[7])) - ((__pyx_v_B[4]) * (__pyx_v_B[6]))); - /* "View.MemoryView":1179 + /* "newanalysis/helpers/helpers.pyx":1198 + * B[2] = B[3]*B[7]-B[4]*B[6] * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * T[0] = B[0]*E[0] # <<<<<<<<<<<<<< + * T[1] = B[1]*E[0] + * T[2] = B[2]*E[0] */ + (__pyx_v_T[0]) = ((__pyx_v_B[0]) * (__pyx_v_E[0])); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1189 + /* "newanalysis/helpers/helpers.pyx":1199 * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + * T[0] = B[0]*E[0] + * T[1] = B[1]*E[0] # <<<<<<<<<<<<<< + * T[2] = B[2]*E[0] + * T[3] = B[3]*E[1] */ + (__pyx_v_T[1]) = ((__pyx_v_B[1]) * (__pyx_v_E[0])); -static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { - int __pyx_v_idx; - Py_ssize_t __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; + /* "newanalysis/helpers/helpers.pyx":1200 + * T[0] = B[0]*E[0] + * T[1] = B[1]*E[0] + * T[2] = B[2]*E[0] # <<<<<<<<<<<<<< + * T[3] = B[3]*E[1] + * T[4] = B[4]*E[1] + */ + (__pyx_v_T[2]) = ((__pyx_v_B[2]) * (__pyx_v_E[0])); - /* "View.MemoryView":1198 - * cdef int idx - * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride + /* "newanalysis/helpers/helpers.pyx":1201 + * T[1] = B[1]*E[0] + * T[2] = B[2]*E[0] + * T[3] = B[3]*E[1] # <<<<<<<<<<<<<< + * T[4] = B[4]*E[1] + * T[5] = B[5]*E[1] */ - __pyx_t_1 = ((__pyx_v_order == 'F') != 0); - if (__pyx_t_1) { + (__pyx_v_T[3]) = ((__pyx_v_B[3]) * (__pyx_v_E[1])); - /* "View.MemoryView":1199 - * - * if order == 'F': - * for idx in range(ndim): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] + /* "newanalysis/helpers/helpers.pyx":1202 + * T[2] = B[2]*E[0] + * T[3] = B[3]*E[1] + * T[4] = B[4]*E[1] # <<<<<<<<<<<<<< + * T[5] = B[5]*E[1] + * T[6] = B[6]*E[2] */ - __pyx_t_2 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_idx = __pyx_t_4; + (__pyx_v_T[4]) = ((__pyx_v_B[4]) * (__pyx_v_E[1])); - /* "View.MemoryView":1200 - * if order == 'F': - * for idx in range(ndim): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * else: + /* "newanalysis/helpers/helpers.pyx":1203 + * T[3] = B[3]*E[1] + * T[4] = B[4]*E[1] + * T[5] = B[5]*E[1] # <<<<<<<<<<<<<< + * T[6] = B[6]*E[2] + * T[7] = B[7]*E[2] */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + (__pyx_v_T[5]) = ((__pyx_v_B[5]) * (__pyx_v_E[1])); - /* "View.MemoryView":1201 - * for idx in range(ndim): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * else: - * for idx in range(ndim - 1, -1, -1): + /* "newanalysis/helpers/helpers.pyx":1204 + * T[4] = B[4]*E[1] + * T[5] = B[5]*E[1] + * T[6] = B[6]*E[2] # <<<<<<<<<<<<<< + * T[7] = B[7]*E[2] + * T[8] = B[8]*E[2] */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } + (__pyx_v_T[6]) = ((__pyx_v_B[6]) * (__pyx_v_E[2])); - /* "View.MemoryView":1198 - * cdef int idx + /* "newanalysis/helpers/helpers.pyx":1205 + * T[5] = B[5]*E[1] + * T[6] = B[6]*E[2] + * T[7] = B[7]*E[2] # <<<<<<<<<<<<<< + * T[8] = B[8]*E[2] * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride */ - goto __pyx_L3; - } + (__pyx_v_T[7]) = ((__pyx_v_B[7]) * (__pyx_v_E[2])); - /* "View.MemoryView":1203 - * stride *= shape[idx] - * else: - * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] - */ - /*else*/ { - for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { - __pyx_v_idx = __pyx_t_2; - - /* "View.MemoryView":1204 - * else: - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] + /* "newanalysis/helpers/helpers.pyx":1206 + * T[6] = B[6]*E[2] + * T[7] = B[7]*E[2] + * T[8] = B[8]*E[2] # <<<<<<<<<<<<<< * + * dipt[j+6] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + (__pyx_v_T[8]) = ((__pyx_v_B[8]) * (__pyx_v_E[2])); - /* "View.MemoryView":1205 - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1208 + * T[8] = B[8]*E[2] * - * return stride + * dipt[j+6] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # <<<<<<<<<<<<<< + * dipt[j+7] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] + * dipt[j+8] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } - } - __pyx_L3:; + (__pyx_v_dipt[(__pyx_v_j + 6)]) = ((((__pyx_v_T[0]) * (__pyx_v_B[0])) + ((__pyx_v_T[3]) * (__pyx_v_B[3]))) + ((__pyx_v_T[6]) * (__pyx_v_B[6]))); - /* "View.MemoryView":1207 - * stride *= shape[idx] - * - * return stride # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1209 * - * @cname('__pyx_memoryview_copy_data_to_temp') + * dipt[j+6] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] + * dipt[j+7] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] # <<<<<<<<<<<<<< + * dipt[j+8] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] + * dipt[j+9] = T[0]*B[1]+T[3]*B[4]+T[6]*B[7] */ - __pyx_r = __pyx_v_stride; - goto __pyx_L0; + (__pyx_v_dipt[(__pyx_v_j + 7)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[0])) + ((__pyx_v_T[4]) * (__pyx_v_B[3]))) + ((__pyx_v_T[7]) * (__pyx_v_B[6]))); - /* "View.MemoryView":1189 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + /* "newanalysis/helpers/helpers.pyx":1210 + * dipt[j+6] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] + * dipt[j+7] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] + * dipt[j+8] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # <<<<<<<<<<<<<< + * dipt[j+9] = T[0]*B[1]+T[3]*B[4]+T[6]*B[7] + * dipt[j+10] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] */ + (__pyx_v_dipt[(__pyx_v_j + 8)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[0])) + ((__pyx_v_T[5]) * (__pyx_v_B[3]))) + ((__pyx_v_T[8]) * (__pyx_v_B[6]))); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1210 - * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + /* "newanalysis/helpers/helpers.pyx":1211 + * dipt[j+7] = T[1]*B[0]+T[4]*B[3]+T[7]*B[6] + * dipt[j+8] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] + * dipt[j+9] = T[0]*B[1]+T[3]*B[4]+T[6]*B[7] # <<<<<<<<<<<<<< + * dipt[j+10] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] + * dipt[j+11] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] */ + (__pyx_v_dipt[(__pyx_v_j + 9)]) = ((((__pyx_v_T[0]) * (__pyx_v_B[1])) + ((__pyx_v_T[3]) * (__pyx_v_B[4]))) + ((__pyx_v_T[6]) * (__pyx_v_B[7]))); -static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { - int __pyx_v_i; - void *__pyx_v_result; - size_t __pyx_v_itemsize; - size_t __pyx_v_size; - void *__pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - struct __pyx_memoryview_obj *__pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - - /* "View.MemoryView":1221 - * cdef void *result - * - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef size_t size = slice_get_size(src, ndim) - * + /* "newanalysis/helpers/helpers.pyx":1212 + * dipt[j+8] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] + * dipt[j+9] = T[0]*B[1]+T[3]*B[4]+T[6]*B[7] + * dipt[j+10] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] # <<<<<<<<<<<<<< + * dipt[j+11] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] + * dipt[j+12] = T[0]*B[2]+T[3]*B[5]+T[6]*B[8] */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; + (__pyx_v_dipt[(__pyx_v_j + 10)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[1])) + ((__pyx_v_T[4]) * (__pyx_v_B[4]))) + ((__pyx_v_T[7]) * (__pyx_v_B[7]))); - /* "View.MemoryView":1222 - * - * cdef size_t itemsize = src.memview.view.itemsize - * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< - * - * result = malloc(size) + /* "newanalysis/helpers/helpers.pyx":1213 + * dipt[j+9] = T[0]*B[1]+T[3]*B[4]+T[6]*B[7] + * dipt[j+10] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] + * dipt[j+11] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # <<<<<<<<<<<<<< + * dipt[j+12] = T[0]*B[2]+T[3]*B[5]+T[6]*B[8] + * dipt[j+13] = T[1]*B[2]+T[4]*B[5]+T[7]*B[8] */ - __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + (__pyx_v_dipt[(__pyx_v_j + 11)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[1])) + ((__pyx_v_T[5]) * (__pyx_v_B[4]))) + ((__pyx_v_T[8]) * (__pyx_v_B[7]))); - /* "View.MemoryView":1224 - * cdef size_t size = slice_get_size(src, ndim) - * - * result = malloc(size) # <<<<<<<<<<<<<< - * if not result: - * _err(MemoryError, NULL) + /* "newanalysis/helpers/helpers.pyx":1214 + * dipt[j+10] = T[1]*B[1]+T[4]*B[4]+T[7]*B[7] + * dipt[j+11] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] + * dipt[j+12] = T[0]*B[2]+T[3]*B[5]+T[6]*B[8] # <<<<<<<<<<<<<< + * dipt[j+13] = T[1]*B[2]+T[4]*B[5]+T[7]*B[8] + * dipt[j+14] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] */ - __pyx_v_result = malloc(__pyx_v_size); + (__pyx_v_dipt[(__pyx_v_j + 12)]) = ((((__pyx_v_T[0]) * (__pyx_v_B[2])) + ((__pyx_v_T[3]) * (__pyx_v_B[5]))) + ((__pyx_v_T[6]) * (__pyx_v_B[8]))); - /* "View.MemoryView":1225 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) - * + /* "newanalysis/helpers/helpers.pyx":1215 + * dipt[j+11] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] + * dipt[j+12] = T[0]*B[2]+T[3]*B[5]+T[6]*B[8] + * dipt[j+13] = T[1]*B[2]+T[4]*B[5]+T[7]*B[8] # <<<<<<<<<<<<<< + * dipt[j+14] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] + * else: */ - __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0); - if (__pyx_t_2) { + (__pyx_v_dipt[(__pyx_v_j + 13)]) = ((((__pyx_v_T[1]) * (__pyx_v_B[2])) + ((__pyx_v_T[4]) * (__pyx_v_B[5]))) + ((__pyx_v_T[7]) * (__pyx_v_B[8]))); - /* "View.MemoryView":1226 - * result = malloc(size) - * if not result: - * _err(MemoryError, NULL) # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/helpers.pyx":1216 + * dipt[j+12] = T[0]*B[2]+T[3]*B[5]+T[6]*B[8] + * dipt[j+13] = T[1]*B[2]+T[4]*B[5]+T[7]*B[8] + * dipt[j+14] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] # <<<<<<<<<<<<<< + * else: + * continue */ - __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1226, __pyx_L1_error) + (__pyx_v_dipt[(__pyx_v_j + 14)]) = ((((__pyx_v_T[2]) * (__pyx_v_B[2])) + ((__pyx_v_T[5]) * (__pyx_v_B[5]))) + ((__pyx_v_T[8]) * (__pyx_v_B[8]))); - /* "View.MemoryView":1225 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) - * + /* "newanalysis/helpers/helpers.pyx":1180 + * dipt[j+4] += f2_x * z + * dipt[j+5] += f2_y * z + * elif i == auf: # <<<<<<<<<<<<<< + * auf_x1 = xyz[auf+3] + * auf_y1 = xyz[auf+4] */ - } + goto __pyx_L16; + } - /* "View.MemoryView":1229 - * - * - * tmpslice.data = result # <<<<<<<<<<<<<< - * tmpslice.memview = src.memview - * for i in range(ndim): + /* "newanalysis/helpers/helpers.pyx":1218 + * dipt[j+14] = T[2]*B[2]+T[5]*B[5]+T[8]*B[8] + * else: + * continue # <<<<<<<<<<<<<< + * free(B) + * free(T) */ - __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + /*else*/ { + goto __pyx_L10_continue; + } + __pyx_L16:; + goto __pyx_L21; + __pyx_L10_continue:; + goto __pyx_L21; + __pyx_L12_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L20; + __pyx_L20:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates5) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_auf_x1; + __pyx_parallel_temp1 = __pyx_v_auf_x2; + __pyx_parallel_temp2 = __pyx_v_auf_y1; + __pyx_parallel_temp3 = __pyx_v_auf_y2; + __pyx_parallel_temp4 = __pyx_v_auf_z1; + __pyx_parallel_temp5 = __pyx_v_auf_z2; + __pyx_parallel_temp6 = __pyx_v_f1; + __pyx_parallel_temp7 = __pyx_v_f2; + __pyx_parallel_temp8 = __pyx_v_f2_x; + __pyx_parallel_temp9 = __pyx_v_f2_y; + __pyx_parallel_temp10 = __pyx_v_f2_z; + __pyx_parallel_temp11 = __pyx_v_i; + __pyx_parallel_temp12 = __pyx_v_j; + __pyx_parallel_temp13 = __pyx_v_k; + __pyx_parallel_temp14 = __pyx_v_r2; + __pyx_parallel_temp15 = __pyx_v_x; + __pyx_parallel_temp16 = __pyx_v_y; + __pyx_parallel_temp17 = __pyx_v_z; + } + __pyx_L21:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_auf_x1 = __pyx_parallel_temp0; + __pyx_v_auf_x2 = __pyx_parallel_temp1; + __pyx_v_auf_y1 = __pyx_parallel_temp2; + __pyx_v_auf_y2 = __pyx_parallel_temp3; + __pyx_v_auf_z1 = __pyx_parallel_temp4; + __pyx_v_auf_z2 = __pyx_parallel_temp5; + __pyx_v_f1 = __pyx_parallel_temp6; + __pyx_v_f2 = __pyx_parallel_temp7; + __pyx_v_f2_x = __pyx_parallel_temp8; + __pyx_v_f2_y = __pyx_parallel_temp9; + __pyx_v_f2_z = __pyx_parallel_temp10; + __pyx_v_i = __pyx_parallel_temp11; + __pyx_v_j = __pyx_parallel_temp12; + __pyx_v_k = __pyx_parallel_temp13; + __pyx_v_r2 = __pyx_parallel_temp14; + __pyx_v_x = __pyx_parallel_temp15; + __pyx_v_y = __pyx_parallel_temp16; + __pyx_v_z = __pyx_parallel_temp17; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L8_error; + } + } + } - /* "View.MemoryView":1230 + /* "newanalysis/helpers/helpers.pyx":1219 + * else: + * continue + * free(B) # <<<<<<<<<<<<<< + * free(T) * - * tmpslice.data = result - * tmpslice.memview = src.memview # <<<<<<<<<<<<<< - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - */ - __pyx_t_4 = __pyx_v_src->memview; - __pyx_v_tmpslice->memview = __pyx_t_4; - - /* "View.MemoryView":1231 - * tmpslice.data = result - * tmpslice.memview = src.memview - * for i in range(ndim): # <<<<<<<<<<<<<< - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + free(__pyx_v_B); - /* "View.MemoryView":1232 - * tmpslice.memview = src.memview - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< - * tmpslice.suboffsets[i] = -1 + /* "newanalysis/helpers/helpers.pyx":1220 + * continue + * free(B) + * free(T) # <<<<<<<<<<<<<< * + * for i in range(1,n//3): */ - (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + free(__pyx_v_T); + goto __pyx_L23; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L23; + __pyx_L23:; + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP +} +#endif /* _OPENMP */ + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":1233 - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1156 + * cdef double *E = pyE.data * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, + * with nogil, parallel(): # <<<<<<<<<<<<<< + * B = malloc(sizeof(double) * 9) + * T = malloc(sizeof(double) * 9) */ - (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; + } } - /* "View.MemoryView":1235 - * tmpslice.suboffsets[i] = -1 - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< - * ndim, order) - * - */ - (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - - /* "View.MemoryView":1239 - * + /* "newanalysis/helpers/helpers.pyx":1222 + * free(T) * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 + * for i in range(1,n//3): # <<<<<<<<<<<<<< + * for j in range(15): + * dipt[j] += dipt[i*15+j] */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_12 = __Pyx_div_long(__pyx_v_n, 3); + __pyx_t_11 = __pyx_t_12; + for (__pyx_t_4 = 1; __pyx_t_4 < __pyx_t_11; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 + /* "newanalysis/helpers/helpers.pyx":1223 * - */ - __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1241 - * for i in range(ndim): - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * for i in range(1,n//3): + * for j in range(15): # <<<<<<<<<<<<<< + * dipt[j] += dipt[i*15+j] * - * if slice_is_contig(src[0], order, ndim): */ - (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + for (__pyx_t_13 = 0; __pyx_t_13 < 15; __pyx_t_13+=1) { + __pyx_v_j = __pyx_t_13; - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 + /* "newanalysis/helpers/helpers.pyx":1224 + * for i in range(1,n//3): + * for j in range(15): + * dipt[j] += dipt[i*15+j] # <<<<<<<<<<<<<< * + * return py_dipt[0] */ + __pyx_t_18 = __pyx_v_j; + (__pyx_v_dipt[__pyx_t_18]) = ((__pyx_v_dipt[__pyx_t_18]) + (__pyx_v_dipt[((__pyx_v_i * 15) + __pyx_v_j)])); } } - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: - */ - __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1244 - * - * if slice_is_contig(src[0], order, ndim): - * memcpy(result, src.data, size) # <<<<<<<<<<<<<< - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) - */ - (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: - */ - goto __pyx_L9; - } - - /* "View.MemoryView":1246 - * memcpy(result, src.data, size) - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< - * - * return result - */ - /*else*/ { - copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); - } - __pyx_L9:; - - /* "View.MemoryView":1248 - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + /* "newanalysis/helpers/helpers.pyx":1226 + * dipt[j] += dipt[i*15+j] * - * return result # <<<<<<<<<<<<<< + * return py_dipt[0] # <<<<<<<<<<<<<< * * */ - __pyx_r = __pyx_v_result; + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_py_dipt), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; goto __pyx_L0; - /* "View.MemoryView":1210 + /* "newanalysis/helpers/helpers.pyx":1130 + * return py_dipt,py_B1,py_B2,py_B3 * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRdipTen(np.ndarray[np.float64_t,ndim=2] py_xyz, + * np.ndarray[np.float64_t,ndim=1] py_charges, */ /* function exit code */ __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pyE.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_charges.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.helpers.NQRdipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pyE.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_charges.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_dipt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_py_xyz.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_pyE); + __Pyx_XDECREF((PyObject *)__pyx_v_py_dipt); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1253 +/* "newanalysis/helpers/helpers.pyx":1368 * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % - */ - -static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_extents", 0); - - /* "View.MemoryView":1256 - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % - * (i, extent1, extent2)) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err_dim') - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - - /* "View.MemoryView":1255 - * cdef int _err_extents(int i, Py_ssize_t extent1, - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<< - * (i, extent1, extent2)) - * - */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 1255, __pyx_L1_error) - - /* "View.MemoryView":1253 * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + * def calcOctant(np.ndarray[np.float64_t,ndim=2,mode="c"] com, # <<<<<<<<<<<<<< + * isolute, nmolecules): + * """ */ - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_57calcOctant(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_56calcOctant, "\n calcOctant(com, isolute, nmolecules)\n\n In a box, that is centered on a specific residue and rotated to its body-fixed frame, this determines in which\n octant around this molecule each other molecule is centered. For speed and memory efficiency, this information\n is encoded as follows:\n\n x y z sign as bits in a binary number (0 for negative sign, 1 for positive sign),\n 3-bit number gives 8 dec. numbers -> 8 array indices needed\n\n x y z\n 0 0 0 -> 0\n 0 0 1 -> 1\n 0 1 0 -> 2\n 0 1 1 -> 3\n 1 0 0 -> 4\n 1 0 1 -> 5\n 1 1 0 -> 6\n 1 1 1 -> 7\n\n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_57calcOctant = {"calcOctant", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_57calcOctant, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_56calcOctant}; +static PyObject *__pyx_pw_11newanalysis_7helpers_57calcOctant(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_com = 0; + PyObject *__pyx_v_isolute = 0; + PyObject *__pyx_v_nmolecules = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif - return __pyx_r; -} - -/* "View.MemoryView":1259 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) - * - */ - -static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcOctant (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1368, __pyx_L3_error) #endif - __Pyx_RefNannySetupContext("_err_dim", 0); - __Pyx_INCREF(__pyx_v_error); - - /* "View.MemoryView":1260 - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: - * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err') - */ - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_v_error); - __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_com,&__pyx_n_s_isolute,&__pyx_n_s_nmolecules,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_com)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1368, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_isolute)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1368, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcOctant", 1, 3, 3, 1); __PYX_ERR(0, 1368, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmolecules)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1368, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcOctant", 1, 3, 3, 2); __PYX_ERR(0, 1368, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcOctant") < 0)) __PYX_ERR(0, 1368, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } + __pyx_v_com = ((PyArrayObject *)values[0]); + __pyx_v_isolute = values[1]; + __pyx_v_nmolecules = values[2]; } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 1260, __pyx_L1_error) - - /* "View.MemoryView":1259 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) - * - */ + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcOctant", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1368, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.helpers.calcOctant", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_com), __pyx_ptype_5numpy_ndarray, 1, "com", 0))) __PYX_ERR(0, 1368, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_7helpers_56calcOctant(__pyx_self, __pyx_v_com, __pyx_v_isolute, __pyx_v_nmolecules); /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif return __pyx_r; } -/* "View.MemoryView":1263 - * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) - */ - -static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { - int __pyx_r; +static PyObject *__pyx_pf_11newanalysis_7helpers_56calcOctant(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_com, PyObject *__pyx_v_isolute, PyObject *__pyx_v_nmolecules) { + double *__pyx_v_ccom; + int __pyx_v_nmol; + int __pyx_v_islt; + int __pyx_v_j; + PyArrayObject *__pyx_v_octants = 0; + int *__pyx_v_coct; + int __pyx_v_x; + int __pyx_v_y; + int __pyx_v_z; + __Pyx_LocalBuf_ND __pyx_pybuffernd_com; + __Pyx_Buffer __pyx_pybuffer_com; + __Pyx_LocalBuf_ND __pyx_pybuffernd_octants; + __Pyx_Buffer __pyx_pybuffer_octants; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + char *__pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err", 0); - __Pyx_INCREF(__pyx_v_error); + __Pyx_RefNannySetupContext("calcOctant", 0); + __pyx_pybuffer_octants.pybuffer.buf = NULL; + __pyx_pybuffer_octants.refcount = 0; + __pyx_pybuffernd_octants.data = NULL; + __pyx_pybuffernd_octants.rcbuffer = &__pyx_pybuffer_octants; + __pyx_pybuffer_com.pybuffer.buf = NULL; + __pyx_pybuffer_com.refcount = 0; + __pyx_pybuffernd_com.data = NULL; + __pyx_pybuffernd_com.rcbuffer = &__pyx_pybuffer_com; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_com.rcbuffer->pybuffer, (PyObject*)__pyx_v_com, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1368, __pyx_L1_error) + } + __pyx_pybuffernd_com.diminfo[0].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_com.diminfo[0].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_com.diminfo[1].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_com.diminfo[1].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[1]; - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: + /* "newanalysis/helpers/helpers.pyx":1391 + * + * """ + * cdef double *ccom = com.data # <<<<<<<<<<<<<< + * cdef int nmol=nmolecules, islt=isolute, j + * cdef np.ndarray[np.int32_t, ndim=1] octants = np.zeros(nmol,dtype=np.int32) */ - __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_com)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1391, __pyx_L1_error) + __pyx_v_ccom = ((double *)__pyx_t_1); - /* "View.MemoryView":1265 - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: - * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< - * else: - * raise error + /* "newanalysis/helpers/helpers.pyx":1392 + * """ + * cdef double *ccom = com.data + * cdef int nmol=nmolecules, islt=isolute, j # <<<<<<<<<<<<<< + * cdef np.ndarray[np.int32_t, ndim=1] octants = np.zeros(nmol,dtype=np.int32) + * cdef int* coct = octants.data */ - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_error); - __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 1265, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1392, __pyx_L1_error) + __pyx_v_nmol = ((int)__pyx_t_2); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_isolute); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1392, __pyx_L1_error) + __pyx_v_islt = ((int)__pyx_t_2); - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: + /* "newanalysis/helpers/helpers.pyx":1393 + * cdef double *ccom = com.data + * cdef int nmol=nmolecules, islt=isolute, j + * cdef np.ndarray[np.int32_t, ndim=1] octants = np.zeros(nmol,dtype=np.int32) # <<<<<<<<<<<<<< + * cdef int* coct = octants.data + * cdef int x, y, z */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nmol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 1393, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1393, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_octants.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_octants = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_octants.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1393, __pyx_L1_error) + } else {__pyx_pybuffernd_octants.diminfo[0].strides = __pyx_pybuffernd_octants.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_octants.diminfo[0].shape = __pyx_pybuffernd_octants.rcbuffer->pybuffer.shape[0]; + } } + __pyx_t_8 = 0; + __pyx_v_octants = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; - /* "View.MemoryView":1267 - * raise error(msg.decode('ascii')) - * else: - * raise error # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1394 + * cdef int nmol=nmolecules, islt=isolute, j + * cdef np.ndarray[np.int32_t, ndim=1] octants = np.zeros(nmol,dtype=np.int32) + * cdef int* coct = octants.data # <<<<<<<<<<<<<< + * cdef int x, y, z * - * @cname('__pyx_memoryview_copy_contents') */ - /*else*/ { - __Pyx_Raise(__pyx_v_error, 0, 0, 0); - __PYX_ERR(2, 1267, __pyx_L1_error) - } + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_octants)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1394, __pyx_L1_error) + __pyx_v_coct = ((int *)__pyx_t_1); - /* "View.MemoryView":1263 + /* "newanalysis/helpers/helpers.pyx":1397 + * cdef int x, y, z * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) + * for j in range(nmol): # <<<<<<<<<<<<<< + * if j == islt: + * continue */ + __pyx_t_2 = __pyx_v_nmol; + __pyx_t_9 = __pyx_t_2; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_j = __pyx_t_10; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "View.MemoryView":1270 + /* "newanalysis/helpers/helpers.pyx":1398 * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ - -static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { - void *__pyx_v_tmpdata; - size_t __pyx_v_itemsize; - int __pyx_v_i; - char __pyx_v_order; - int __pyx_v_broadcasting; - int __pyx_v_direct_copy; - __Pyx_memviewslice __pyx_v_tmp; - int __pyx_v_ndim; - int __pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - void *__pyx_t_7; - int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - - /* "View.MemoryView":1278 - * Check for overlapping memory and verify the shapes. - * """ - * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - */ - __pyx_v_tmpdata = NULL; - - /* "View.MemoryView":1279 - * """ - * cdef void *tmpdata = NULL - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - */ - __pyx_t_1 = __pyx_v_src.memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":1281 - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< - * cdef bint broadcasting = False - * cdef bint direct_copy = False + * for j in range(nmol): + * if j == islt: # <<<<<<<<<<<<<< + * continue + * x=sgn2bin(ccom[j*3])*4 */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + __pyx_t_11 = (__pyx_v_j == __pyx_v_islt); + if (__pyx_t_11) { - /* "View.MemoryView":1282 - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False # <<<<<<<<<<<<<< - * cdef bint direct_copy = False - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/helpers.pyx":1399 + * for j in range(nmol): + * if j == islt: + * continue # <<<<<<<<<<<<<< + * x=sgn2bin(ccom[j*3])*4 + * y=sgn2bin(ccom[j*3+1])*2 */ - __pyx_v_broadcasting = 0; + goto __pyx_L3_continue; - /* "View.MemoryView":1283 - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False - * cdef bint direct_copy = False # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/helpers.pyx":1398 * + * for j in range(nmol): + * if j == islt: # <<<<<<<<<<<<<< + * continue + * x=sgn2bin(ccom[j*3])*4 */ - __pyx_v_direct_copy = 0; + } - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp - * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: + /* "newanalysis/helpers/helpers.pyx":1400 + * if j == islt: + * continue + * x=sgn2bin(ccom[j*3])*4 # <<<<<<<<<<<<<< + * y=sgn2bin(ccom[j*3+1])*2 + * z=sgn2bin(ccom[j*3+2]) */ - __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_12 = __pyx_f_11newanalysis_7helpers_sgn2bin((__pyx_v_ccom[(__pyx_v_j * 3)])); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1400, __pyx_L1_error) + __pyx_v_x = (__pyx_t_12 * 4); - /* "View.MemoryView":1287 - * - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) + /* "newanalysis/helpers/helpers.pyx":1401 + * continue + * x=sgn2bin(ccom[j*3])*4 + * y=sgn2bin(ccom[j*3+1])*2 # <<<<<<<<<<<<<< + * z=sgn2bin(ccom[j*3+2]) + * coct[j]=x|y|z */ - __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + __pyx_t_12 = __pyx_f_11newanalysis_7helpers_sgn2bin((__pyx_v_ccom[((__pyx_v_j * 3) + 1)])); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1401, __pyx_L1_error) + __pyx_v_y = (__pyx_t_12 * 2); - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/helpers.pyx":1402 + * x=sgn2bin(ccom[j*3])*4 + * y=sgn2bin(ccom[j*3+1])*2 + * z=sgn2bin(ccom[j*3+2]) # <<<<<<<<<<<<<< + * coct[j]=x|y|z * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: */ - goto __pyx_L3; - } + __pyx_t_12 = __pyx_f_11newanalysis_7helpers_sgn2bin((__pyx_v_ccom[((__pyx_v_j * 3) + 2)])); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1402, __pyx_L1_error) + __pyx_v_z = __pyx_t_12; - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) + /* "newanalysis/helpers/helpers.pyx":1403 + * y=sgn2bin(ccom[j*3+1])*2 + * z=sgn2bin(ccom[j*3+2]) + * coct[j]=x|y|z # <<<<<<<<<<<<<< * + * return octants */ - __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0); - if (__pyx_t_2) { + (__pyx_v_coct[__pyx_v_j]) = ((__pyx_v_x | __pyx_v_y) | __pyx_v_z); + __pyx_L3_continue:; + } - /* "View.MemoryView":1289 - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1405 + * coct[j]=x|y|z * - * cdef int ndim = max(src_ndim, dst_ndim) - */ - __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) + * return octants # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - } - __pyx_L3:; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_octants); + __pyx_r = ((PyObject *)__pyx_v_octants); + goto __pyx_L0; - /* "View.MemoryView":1291 - * broadcast_leading(&dst, dst_ndim, src_ndim) + /* "newanalysis/helpers/helpers.pyx":1368 * - * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< * - * for i in range(ndim): + * def calcOctant(np.ndarray[np.float64_t,ndim=2,mode="c"] com, # <<<<<<<<<<<<<< + * isolute, nmolecules): + * """ */ - __pyx_t_3 = __pyx_v_dst_ndim; - __pyx_t_4 = __pyx_v_src_ndim; - if (((__pyx_t_3 > __pyx_t_4) != 0)) { - __pyx_t_5 = __pyx_t_3; - } else { - __pyx_t_5 = __pyx_t_4; - } - __pyx_v_ndim = __pyx_t_5; - /* "View.MemoryView":1293 - * cdef int ndim = max(src_ndim, dst_ndim) - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - */ - __pyx_t_5 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_5; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_octants.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.helpers.calcOctant", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_octants.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_octants); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1294 +/* "newanalysis/helpers/helpers.pyx":1407 + * return octants * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMDCage(double [:,:,:,:] mdcage_ts, + * double [:,:] dip_wat, */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_59sumMDCage(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_59sumMDCage = {"sumMDCage", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_59sumMDCage, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_59sumMDCage(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_mdcage_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip_wat = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_nres_wat; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell; + int __pyx_v_rep; + int __pyx_v_frame; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sumMDCage (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1407, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mdcage_ts,&__pyx_n_s_dip_wat,&__pyx_n_s_nres_wat,&__pyx_n_s_ds,&__pyx_n_s_maxshell,&__pyx_n_s_rep,&__pyx_n_s_frame,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mdcage_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1407, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_wat)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1407, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 1); __PYX_ERR(0, 1407, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nres_wat)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1407, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 2); __PYX_ERR(0, 1407, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1407, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 3); __PYX_ERR(0, 1407, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1407, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 4); __PYX_ERR(0, 1407, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rep)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1407, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 5); __PYX_ERR(0, 1407, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frame)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1407, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, 6); __PYX_ERR(0, 1407, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sumMDCage") < 0)) __PYX_ERR(0, 1407, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 7)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + } + __pyx_v_mdcage_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mdcage_ts.memview)) __PYX_ERR(0, 1408, __pyx_L3_error) + __pyx_v_dip_wat = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_wat.memview)) __PYX_ERR(0, 1409, __pyx_L3_error) + __pyx_v_nres_wat = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nres_wat == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1410, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1410, __pyx_L3_error) + __pyx_v_maxshell = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1410, __pyx_L3_error) + __pyx_v_rep = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_rep == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1410, __pyx_L3_error) + __pyx_v_frame = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_frame == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1410, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sumMDCage", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 1407, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mdcage_ts, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_wat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.helpers.sumMDCage", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_58sumMDCage(__pyx_self, __pyx_v_mdcage_ts, __pyx_v_dip_wat, __pyx_v_nres_wat, __pyx_v_ds, __pyx_v_maxshell, __pyx_v_rep, __pyx_v_frame); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mdcage_ts, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_wat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_7helpers_58sumMDCage(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_mdcage_ts, __Pyx_memviewslice __pyx_v_dip_wat, int __pyx_v_nres_wat, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, int __pyx_v_rep, int __pyx_v_frame) { + int __pyx_v_w; + int __pyx_v_shell; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + __Pyx_RefNannySetupContext("sumMDCage", 0); + + /* "newanalysis/helpers/helpers.pyx":1413 + * + * cdef int w, shell, i + * for w in range(nres_wat): # <<<<<<<<<<<<<< + * shell = ds[w]-1 + * if shell < maxshell: */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __pyx_v_nres_wat; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_w = __pyx_t_3; - /* "View.MemoryView":1296 - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - * broadcasting = True # <<<<<<<<<<<<<< - * src.strides[i] = 0 - * else: + /* "newanalysis/helpers/helpers.pyx":1414 + * cdef int w, shell, i + * for w in range(nres_wat): + * shell = ds[w]-1 # <<<<<<<<<<<<<< + * if shell < maxshell: + * for i in range(3): */ - __pyx_v_broadcasting = 1; + __pyx_t_4 = __pyx_v_w; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds.shape[0]; + __pyx_v_shell = ((*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_4 * __pyx_v_ds.strides[0]) ))) - 1); - /* "View.MemoryView":1297 - * if src.shape[i] == 1: - * broadcasting = True - * src.strides[i] = 0 # <<<<<<<<<<<<<< - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) + /* "newanalysis/helpers/helpers.pyx":1415 + * for w in range(nres_wat): + * shell = ds[w]-1 + * if shell < maxshell: # <<<<<<<<<<<<<< + * for i in range(3): + * mdcage_ts[rep,shell,frame,i] += dip_wat[w,i] */ - (__pyx_v_src.strides[__pyx_v_i]) = 0; + __pyx_t_5 = (__pyx_v_shell < __pyx_v_maxshell); + if (__pyx_t_5) { - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/helpers/helpers.pyx":1416 + * shell = ds[w]-1 + * if shell < maxshell: + * for i in range(3): # <<<<<<<<<<<<<< + * mdcage_ts[rep,shell,frame,i] += dip_wat[w,i] + * else: */ - goto __pyx_L7; - } + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1299 - * src.strides[i] = 0 - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< - * - * if src.suboffsets[i] >= 0: + /* "newanalysis/helpers/helpers.pyx":1417 + * if shell < maxshell: + * for i in range(3): + * mdcage_ts[rep,shell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< + * else: + * for i in range(3): */ - /*else*/ { - __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1299, __pyx_L1_error) + __pyx_t_4 = __pyx_v_w; + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dip_wat.shape[1]; + __pyx_t_8 = __pyx_v_rep; + __pyx_t_9 = __pyx_v_shell; + __pyx_t_10 = __pyx_v_frame; + __pyx_t_11 = __pyx_v_i; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_mdcage_ts.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mdcage_ts.shape[1]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mdcage_ts.shape[2]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_mdcage_ts.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_8 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_9 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_10 * __pyx_v_mdcage_ts.strides[2]) ) + __pyx_t_11 * __pyx_v_mdcage_ts.strides[3]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_4 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_7 * __pyx_v_dip_wat.strides[1]) ))); } - __pyx_L7:; - /* "View.MemoryView":1294 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + /* "newanalysis/helpers/helpers.pyx":1415 + * for w in range(nres_wat): + * shell = ds[w]-1 + * if shell < maxshell: # <<<<<<<<<<<<<< + * for i in range(3): + * mdcage_ts[rep,shell,frame,i] += dip_wat[w,i] */ + goto __pyx_L5; } - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - */ - __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1302 - * - * if src.suboffsets[i] >= 0: - * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1419 + * mdcage_ts[rep,shell,frame,i] += dip_wat[w,i] + * else: + * for i in range(3): # <<<<<<<<<<<<<< + * mdcage_ts[rep,maxshell,frame,i] += dip_wat[w,i] * - * if slices_overlap(&src, &dst, ndim, itemsize): */ - __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1302, __pyx_L1_error) + /*else*/ { + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) + /* "newanalysis/helpers/helpers.pyx":1420 + * else: + * for i in range(3): + * mdcage_ts[rep,maxshell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ + __pyx_t_7 = __pyx_v_w; + __pyx_t_4 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dip_wat.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[1]; + __pyx_t_11 = __pyx_v_rep; + __pyx_t_10 = __pyx_v_maxshell; + __pyx_t_9 = __pyx_v_frame; + __pyx_t_8 = __pyx_v_i; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_mdcage_ts.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mdcage_ts.shape[1]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mdcage_ts.shape[2]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_mdcage_ts.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_11 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_10 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_9 * __pyx_v_mdcage_ts.strides[2]) ) + __pyx_t_8 * __pyx_v_mdcage_ts.strides[3]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_7 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_4 * __pyx_v_dip_wat.strides[1]) ))); + } } + __pyx_L5:; } - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1407 + * return octants * - * if not slice_is_contig(src, order, ndim): + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMDCage(double [:,:,:,:] mdcage_ts, + * double [:,:] dip_wat, */ - __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * - */ - __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0); - if (__pyx_t_2) { + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1307 - * - * if not slice_is_contig(src, order, ndim): - * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< +/* "newanalysis/helpers/helpers.pyx":1422 + * mdcage_ts[rep,maxshell,frame,i] += dip_wat[w,i] * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, + * char [:] ds, int maxshell, int frame): */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * - */ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_61sumMDCageSingle(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_61sumMDCageSingle = {"sumMDCageSingle", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_61sumMDCageSingle, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_61sumMDCageSingle(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_mdcage_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip_wat = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell; + int __pyx_v_frame; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sumMDCageSingle (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1422, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mdcage_ts,&__pyx_n_s_dip_wat,&__pyx_n_s_ds,&__pyx_n_s_maxshell,&__pyx_n_s_frame,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mdcage_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1422, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_wat)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1422, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMDCageSingle", 1, 5, 5, 1); __PYX_ERR(0, 1422, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1422, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMDCageSingle", 1, 5, 5, 2); __PYX_ERR(0, 1422, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1422, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMDCageSingle", 1, 5, 5, 3); __PYX_ERR(0, 1422, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frame)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1422, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMDCageSingle", 1, 5, 5, 4); __PYX_ERR(0, 1422, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sumMDCageSingle") < 0)) __PYX_ERR(0, 1422, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 5)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + } + __pyx_v_mdcage_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mdcage_ts.memview)) __PYX_ERR(0, 1423, __pyx_L3_error) + __pyx_v_dip_wat = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_wat.memview)) __PYX_ERR(0, 1423, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1424, __pyx_L3_error) + __pyx_v_maxshell = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1424, __pyx_L3_error) + __pyx_v_frame = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_frame == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1424, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sumMDCageSingle", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1422, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mdcage_ts, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_wat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.helpers.sumMDCageSingle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_60sumMDCageSingle(__pyx_self, __pyx_v_mdcage_ts, __pyx_v_dip_wat, __pyx_v_ds, __pyx_v_maxshell, __pyx_v_frame); - /* "View.MemoryView":1309 - * order = get_best_order(&dst, ndim) - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< - * src = tmp - * - */ - __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1309, __pyx_L1_error) - __pyx_v_tmpdata = __pyx_t_7; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mdcage_ts, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_wat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1310 +static PyObject *__pyx_pf_11newanalysis_7helpers_60sumMDCageSingle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_mdcage_ts, __Pyx_memviewslice __pyx_v_dip_wat, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, int __pyx_v_frame) { + int __pyx_v_w; + int __pyx_v_shell; + int __pyx_v_i; + int __pyx_v_nres_wat; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + __Pyx_RefNannySetupContext("sumMDCageSingle", 0); + + /* "newanalysis/helpers/helpers.pyx":1426 + * char [:] ds, int maxshell, int frame): * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) - * src = tmp # <<<<<<<<<<<<<< + * cdef int w, shell, i, nres_wat = dip_wat.shape[0] # <<<<<<<<<<<<<< * - * if not broadcasting: + * for w in range(nres_wat): */ - __pyx_v_src = __pyx_v_tmp; + __pyx_v_nres_wat = (__pyx_v_dip_wat.shape[0]); - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1428 + * cdef int w, shell, i, nres_wat = dip_wat.shape[0] * - * if not slice_is_contig(src, order, ndim): + * for w in range(nres_wat): # <<<<<<<<<<<<<< + * shell = ds[w]-1 + * if shell < maxshell: */ - } + __pyx_t_1 = __pyx_v_nres_wat; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_w = __pyx_t_3; - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":1429 * + * for w in range(nres_wat): + * shell = ds[w]-1 # <<<<<<<<<<<<<< + * if shell < maxshell: + * for i in range(3): */ - __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_4 = __pyx_v_w; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds.shape[0]; + __pyx_v_shell = ((*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_4 * __pyx_v_ds.strides[0]) ))) - 1); - /* "View.MemoryView":1315 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + /* "newanalysis/helpers/helpers.pyx":1430 + * for w in range(nres_wat): + * shell = ds[w]-1 + * if shell < maxshell: # <<<<<<<<<<<<<< + * for i in range(3): + * mdcage_ts[shell,frame,i] += dip_wat[w,i] */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_5 = (__pyx_v_shell < __pyx_v_maxshell); + if (__pyx_t_5) { - /* "View.MemoryView":1316 - * - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/helpers/helpers.pyx":1431 + * shell = ds[w]-1 + * if shell < maxshell: + * for i in range(3): # <<<<<<<<<<<<<< + * mdcage_ts[shell,frame,i] += dip_wat[w,i] + * else: */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1315 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + /* "newanalysis/helpers/helpers.pyx":1432 + * if shell < maxshell: + * for i in range(3): + * mdcage_ts[shell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< + * else: + * for i in range(3): */ - goto __pyx_L12; - } + __pyx_t_4 = __pyx_v_w; + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dip_wat.shape[1]; + __pyx_t_8 = __pyx_v_shell; + __pyx_t_9 = __pyx_v_frame; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_mdcage_ts.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mdcage_ts.shape[1]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mdcage_ts.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_8 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_9 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_10 * __pyx_v_mdcage_ts.strides[2]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_4 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_7 * __pyx_v_dip_wat.strides[1]) ))); + } - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) - * + /* "newanalysis/helpers/helpers.pyx":1430 + * for w in range(nres_wat): + * shell = ds[w]-1 + * if shell < maxshell: # <<<<<<<<<<<<<< + * for i in range(3): + * mdcage_ts[shell,frame,i] += dip_wat[w,i] */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + goto __pyx_L5; + } - /* "View.MemoryView":1318 - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1434 + * mdcage_ts[shell,frame,i] += dip_wat[w,i] + * else: + * for i in range(3): # <<<<<<<<<<<<<< + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] * - * if direct_copy: */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + /*else*/ { + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/helpers/helpers.pyx":1435 + * else: + * for i in range(3): + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - } - __pyx_L12:; - - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - */ - __pyx_t_2 = (__pyx_v_direct_copy != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1322 - * if direct_copy: - * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + __pyx_t_7 = __pyx_v_w; + __pyx_t_4 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dip_wat.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[1]; + __pyx_t_10 = __pyx_v_maxshell; + __pyx_t_9 = __pyx_v_frame; + __pyx_t_8 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mdcage_ts.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mdcage_ts.shape[1]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_mdcage_ts.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_10 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_9 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_8 * __pyx_v_mdcage_ts.strides[2]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_7 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_4 * __pyx_v_dip_wat.strides[1]) ))); + } + } + __pyx_L5:; + } - /* "View.MemoryView":1323 + /* "newanalysis/helpers/helpers.pyx":1422 + * mdcage_ts[rep,maxshell,frame,i] += dip_wat[w,i] * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, + * char [:] ds, int maxshell, int frame): */ - (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - /* "View.MemoryView":1324 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * free(tmpdata) - * return 0 - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1325 - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 +/* "newanalysis/helpers/helpers.pyx":1437 + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] * - */ - free(__pyx_v_tmpdata); - - /* "View.MemoryView":1326 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularMomentum(double [:,:] coor, double [:,:] vel, double [:] masses, int natoms): * - * if order == 'F' == get_best_order(&dst, ndim): */ - __pyx_r = 0; - goto __pyx_L0; - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - */ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_63calcAngularMomentum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_63calcAngularMomentum = {"calcAngularMomentum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_63calcAngularMomentum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_63calcAngularMomentum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_vel = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_masses = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_natoms; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcAngularMomentum (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1437, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_vel,&__pyx_n_s_masses,&__pyx_n_s_natoms,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1437, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_vel)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1437, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcAngularMomentum", 1, 4, 4, 1); __PYX_ERR(0, 1437, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_masses)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1437, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcAngularMomentum", 1, 4, 4, 2); __PYX_ERR(0, 1437, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_natoms)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1437, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcAngularMomentum", 1, 4, 4, 3); __PYX_ERR(0, 1437, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcAngularMomentum") < 0)) __PYX_ERR(0, 1437, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1438, __pyx_L3_error) + __pyx_v_vel = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vel.memview)) __PYX_ERR(0, 1438, __pyx_L3_error) + __pyx_v_masses = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_masses.memview)) __PYX_ERR(0, 1438, __pyx_L3_error) + __pyx_v_natoms = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_natoms == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1438, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcAngularMomentum", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1437, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } - - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * - * - */ } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vel, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_masses, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcAngularMomentum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_62calcAngularMomentum(__pyx_self, __pyx_v_coor, __pyx_v_vel, __pyx_v_masses, __pyx_v_natoms); - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = (__pyx_v_order == 'F'); - if (__pyx_t_2) { - __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vel, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_masses, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_t_8 = (__pyx_t_2 != 0); - if (__pyx_t_8) { + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1331 - * - * - * transpose_memslice(&src) # <<<<<<<<<<<<<< - * transpose_memslice(&dst) - * - */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1331, __pyx_L1_error) +static PyObject *__pyx_pf_11newanalysis_7helpers_62calcAngularMomentum(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_vel, __Pyx_memviewslice __pyx_v_masses, int __pyx_v_natoms) { + PyArrayObject *__pyx_v_L = 0; + double *__pyx_v_cL; + int __pyx_v_i; + __Pyx_LocalBuf_ND __pyx_pybuffernd_L; + __Pyx_Buffer __pyx_pybuffer_L; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyArrayObject *__pyx_t_5 = NULL; + char *__pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + long __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcAngularMomentum", 0); + __pyx_pybuffer_L.pybuffer.buf = NULL; + __pyx_pybuffer_L.refcount = 0; + __pyx_pybuffernd_L.data = NULL; + __pyx_pybuffernd_L.rcbuffer = &__pyx_pybuffer_L; - /* "View.MemoryView":1332 - * - * transpose_memslice(&src) - * transpose_memslice(&dst) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1440 + * def calcAngularMomentum(double [:,:] coor, double [:,:] vel, double [:] masses, int natoms): * - * refcount_copying(&dst, dtype_is_object, ndim, False) + * cdef np.ndarray[np.float64_t, ndim=1] L = np.zeros(3) # <<<<<<<<<<<<<< + * cdef double *cL = L.data + * cdef int i */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1332, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1440, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_L.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_L = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_L.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1440, __pyx_L1_error) + } else {__pyx_pybuffernd_L.diminfo[0].strides = __pyx_pybuffernd_L.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_L.diminfo[0].shape = __pyx_pybuffernd_L.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __pyx_v_L = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1441 * + * cdef np.ndarray[np.float64_t, ndim=1] L = np.zeros(3) + * cdef double *cL = L.data # <<<<<<<<<<<<<< + * cdef int i * */ - } + __pyx_t_6 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_L)); if (unlikely(__pyx_t_6 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1441, __pyx_L1_error) + __pyx_v_cL = ((double *)__pyx_t_6); - /* "View.MemoryView":1334 - * transpose_memslice(&dst) + /* "newanalysis/helpers/helpers.pyx":1444 + * cdef int i * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) + * for i in range(natoms): # <<<<<<<<<<<<<< + * cL[0] += masses[i] * (coor[i,1] * vel[i,2] - coor[i,2] * vel[i,1]) + * cL[1] += masses[i] * (coor[i,2] * vel[i,0] - coor[i,0] * vel[i,2]) */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + __pyx_t_4 = __pyx_v_natoms; + __pyx_t_7 = __pyx_t_4; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "View.MemoryView":1335 - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) + /* "newanalysis/helpers/helpers.pyx":1445 * + * for i in range(natoms): + * cL[0] += masses[i] * (coor[i,1] * vel[i,2] - coor[i,2] * vel[i,1]) # <<<<<<<<<<<<<< + * cL[1] += masses[i] * (coor[i,2] * vel[i,0] - coor[i,0] * vel[i,2]) + * cL[2] += masses[i] * (coor[i,0] * vel[i,1] - coor[i,1] * vel[i,0]) */ - copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + __pyx_t_9 = 0; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_masses.shape[0]; + __pyx_t_11 = __pyx_v_i; + __pyx_t_12 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[1]; + __pyx_t_13 = __pyx_v_i; + __pyx_t_14 = 2; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_vel.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_vel.shape[1]; + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = 2; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + __pyx_t_17 = __pyx_v_i; + __pyx_t_18 = 1; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_vel.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_vel.shape[1]; + (__pyx_v_cL[__pyx_t_9]) = ((__pyx_v_cL[__pyx_t_9]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_10 * __pyx_v_masses.strides[0]) ))) * (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_11 * __pyx_v_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_13 * __pyx_v_vel.strides[0]) ) + __pyx_t_14 * __pyx_v_vel.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_17 * __pyx_v_vel.strides[0]) ) + __pyx_t_18 * __pyx_v_vel.strides[1]) ))))))); - /* "View.MemoryView":1336 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1446 + * for i in range(natoms): + * cL[0] += masses[i] * (coor[i,1] * vel[i,2] - coor[i,2] * vel[i,1]) + * cL[1] += masses[i] * (coor[i,2] * vel[i,0] - coor[i,0] * vel[i,2]) # <<<<<<<<<<<<<< + * cL[2] += masses[i] * (coor[i,0] * vel[i,1] - coor[i,1] * vel[i,0]) * - * free(tmpdata) */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + __pyx_t_9 = 1; + __pyx_t_18 = __pyx_v_i; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_masses.shape[0]; + __pyx_t_17 = __pyx_v_i; + __pyx_t_16 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + __pyx_t_15 = __pyx_v_i; + __pyx_t_14 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vel.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_vel.shape[1]; + __pyx_t_13 = __pyx_v_i; + __pyx_t_12 = 0; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[1]; + __pyx_t_11 = __pyx_v_i; + __pyx_t_10 = 2; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_vel.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_vel.shape[1]; + (__pyx_v_cL[__pyx_t_9]) = ((__pyx_v_cL[__pyx_t_9]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_18 * __pyx_v_masses.strides[0]) ))) * (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_15 * __pyx_v_vel.strides[0]) ) + __pyx_t_14 * __pyx_v_vel.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_11 * __pyx_v_vel.strides[0]) ) + __pyx_t_10 * __pyx_v_vel.strides[1]) ))))))); - /* "View.MemoryView":1338 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 + /* "newanalysis/helpers/helpers.pyx":1447 + * cL[0] += masses[i] * (coor[i,1] * vel[i,2] - coor[i,2] * vel[i,1]) + * cL[1] += masses[i] * (coor[i,2] * vel[i,0] - coor[i,0] * vel[i,2]) + * cL[2] += masses[i] * (coor[i,0] * vel[i,1] - coor[i,1] * vel[i,0]) # <<<<<<<<<<<<<< * + * return L */ - free(__pyx_v_tmpdata); + __pyx_t_9 = 2; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_masses.shape[0]; + __pyx_t_11 = __pyx_v_i; + __pyx_t_12 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[1]; + __pyx_t_13 = __pyx_v_i; + __pyx_t_14 = 1; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_vel.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_vel.shape[1]; + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = 1; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + __pyx_t_17 = __pyx_v_i; + __pyx_t_18 = 0; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_vel.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_vel.shape[1]; + (__pyx_v_cL[__pyx_t_9]) = ((__pyx_v_cL[__pyx_t_9]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_10 * __pyx_v_masses.strides[0]) ))) * (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_11 * __pyx_v_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_13 * __pyx_v_vel.strides[0]) ) + __pyx_t_14 * __pyx_v_vel.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel.data + __pyx_t_17 * __pyx_v_vel.strides[0]) ) + __pyx_t_18 * __pyx_v_vel.strides[1]) ))))))); + } - /* "View.MemoryView":1339 + /* "newanalysis/helpers/helpers.pyx":1449 + * cL[2] += masses[i] * (coor[i,0] * vel[i,1] - coor[i,1] * vel[i,0]) * - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< + * return L # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_broadcast_leading') + * @cython.boundscheck(False) */ - __pyx_r = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_L); + __pyx_r = ((PyObject *)__pyx_v_L); goto __pyx_L0; - /* "View.MemoryView":1270 + /* "newanalysis/helpers/helpers.pyx":1437 + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularMomentum(double [:,:] coor, double [:,:] vel, double [:] masses, int natoms): * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, */ /* function exit code */ __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_L.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.helpers.calcAngularMomentum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_L.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_L); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1342 +/* "newanalysis/helpers/helpers.pyx":1451 + * return L + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcInertiaTensor(double [:,:] coor, double [:] masses, int natoms): * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: */ -static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_65calcInertiaTensor(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_65calcInertiaTensor = {"calcInertiaTensor", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_65calcInertiaTensor, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_65calcInertiaTensor(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_masses = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_natoms; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcInertiaTensor (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1451, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_masses,&__pyx_n_s_natoms,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1451, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_masses)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1451, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcInertiaTensor", 1, 3, 3, 1); __PYX_ERR(0, 1451, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_natoms)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1451, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcInertiaTensor", 1, 3, 3, 2); __PYX_ERR(0, 1451, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcInertiaTensor") < 0)) __PYX_ERR(0, 1451, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1452, __pyx_L3_error) + __pyx_v_masses = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_masses.memview)) __PYX_ERR(0, 1452, __pyx_L3_error) + __pyx_v_natoms = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_natoms == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1452, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcInertiaTensor", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1451, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_masses, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcInertiaTensor", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_64calcInertiaTensor(__pyx_self, __pyx_v_coor, __pyx_v_masses, __pyx_v_natoms); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_masses, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_7helpers_64calcInertiaTensor(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_masses, int __pyx_v_natoms) { + PyArrayObject *__pyx_v_I = 0; + double *__pyx_v_cI; int __pyx_v_i; - int __pyx_v_offset; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; + double __pyx_v_x; + double __pyx_v_y; + double __pyx_v_z; + __Pyx_LocalBuf_ND __pyx_pybuffernd_I; + __Pyx_Buffer __pyx_pybuffer_I; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyArrayObject *__pyx_t_5 = NULL; + char *__pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + long __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcInertiaTensor", 0); + __pyx_pybuffer_I.pybuffer.buf = NULL; + __pyx_pybuffer_I.refcount = 0; + __pyx_pybuffernd_I.data = NULL; + __pyx_pybuffernd_I.rcbuffer = &__pyx_pybuffer_I; - /* "View.MemoryView":1346 - * int ndim_other) nogil: - * cdef int i - * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1454 + * def calcInertiaTensor(double [:,:] coor, double [:] masses, int natoms): * - * for i in range(ndim - 1, -1, -1): + * cdef np.ndarray[np.float64_t, ndim=2] I = np.zeros((3,3)) # <<<<<<<<<<<<<< + * cdef double *cI = I.data + * cdef int i */ - __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_tuple__11}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1454, __pyx_L1_error) + __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_I.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_I = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_I.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 1454, __pyx_L1_error) + } else {__pyx_pybuffernd_I.diminfo[0].strides = __pyx_pybuffernd_I.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_I.diminfo[0].shape = __pyx_pybuffernd_I.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_I.diminfo[1].strides = __pyx_pybuffernd_I.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_I.diminfo[1].shape = __pyx_pybuffernd_I.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_5 = 0; + __pyx_v_I = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":1348 - * cdef int offset = ndim_other - ndim + /* "newanalysis/helpers/helpers.pyx":1455 * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] + * cdef np.ndarray[np.float64_t, ndim=2] I = np.zeros((3,3)) + * cdef double *cI = I.data # <<<<<<<<<<<<<< + * cdef int i + * cdef double x, y, z */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_6 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_I)); if (unlikely(__pyx_t_6 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 1455, __pyx_L1_error) + __pyx_v_cI = ((double *)__pyx_t_6); - /* "View.MemoryView":1349 + /* "newanalysis/helpers/helpers.pyx":1459 + * cdef double x, y, z * - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * for i in range(natoms): # <<<<<<<<<<<<<< + * x = coor[i,0] + * y = coor[i,1] */ - (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + __pyx_t_4 = __pyx_v_natoms; + __pyx_t_7 = __pyx_t_4; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "View.MemoryView":1350 - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + /* "newanalysis/helpers/helpers.pyx":1460 * + * for i in range(natoms): + * x = coor[i,0] # <<<<<<<<<<<<<< + * y = coor[i,1] + * z = coor[i,2] */ - (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1351 - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< - * - * for i in range(offset): - */ - (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); - } - - /* "View.MemoryView":1353 - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - * - * for i in range(offset): # <<<<<<<<<<<<<< - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - */ - __pyx_t_1 = __pyx_v_offset; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[1]; + __pyx_v_x = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_10 * __pyx_v_coor.strides[1]) ))); - /* "View.MemoryView":1354 - * - * for i in range(offset): - * mslice.shape[i] = 1 # <<<<<<<<<<<<<< - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 + /* "newanalysis/helpers/helpers.pyx":1461 + * for i in range(natoms): + * x = coor[i,0] + * y = coor[i,1] # <<<<<<<<<<<<<< + * z = coor[i,2] + * cI[0] += masses[i] * (y*y+z*z) */ - (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + __pyx_t_10 = __pyx_v_i; + __pyx_t_9 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; + __pyx_v_y = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))); - /* "View.MemoryView":1355 - * for i in range(offset): - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< - * mslice.suboffsets[i] = -1 - * + /* "newanalysis/helpers/helpers.pyx":1462 + * x = coor[i,0] + * y = coor[i,1] + * z = coor[i,2] # <<<<<<<<<<<<<< + * cI[0] += masses[i] * (y*y+z*z) + * cI[1] -= masses[i] * x*y */ - (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = 2; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[1]; + __pyx_v_z = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_10 * __pyx_v_coor.strides[1]) ))); - /* "View.MemoryView":1356 - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/helpers.pyx":1463 + * y = coor[i,1] + * z = coor[i,2] + * cI[0] += masses[i] * (y*y+z*z) # <<<<<<<<<<<<<< + * cI[1] -= masses[i] * x*y + * cI[2] -= masses[i] * x*z */ - (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; - } + __pyx_t_11 = 0; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_masses.shape[0]; + (__pyx_v_cI[__pyx_t_11]) = ((__pyx_v_cI[__pyx_t_11]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_10 * __pyx_v_masses.strides[0]) ))) * ((__pyx_v_y * __pyx_v_y) + (__pyx_v_z * __pyx_v_z)))); - /* "View.MemoryView":1342 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: + /* "newanalysis/helpers/helpers.pyx":1464 + * z = coor[i,2] + * cI[0] += masses[i] * (y*y+z*z) + * cI[1] -= masses[i] * x*y # <<<<<<<<<<<<<< + * cI[2] -= masses[i] * x*z + * cI[4] += masses[i] * (x*x+z*z) */ + __pyx_t_11 = 1; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_masses.shape[0]; + (__pyx_v_cI[__pyx_t_11]) = ((__pyx_v_cI[__pyx_t_11]) - (((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_10 * __pyx_v_masses.strides[0]) ))) * __pyx_v_x) * __pyx_v_y)); - /* function exit code */ -} - -/* "View.MemoryView":1364 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: - * + /* "newanalysis/helpers/helpers.pyx":1465 + * cI[0] += masses[i] * (y*y+z*z) + * cI[1] -= masses[i] * x*y + * cI[2] -= masses[i] * x*z # <<<<<<<<<<<<<< + * cI[4] += masses[i] * (x*x+z*z) + * cI[5] -= masses[i] * y*z */ + __pyx_t_11 = 2; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_masses.shape[0]; + (__pyx_v_cI[__pyx_t_11]) = ((__pyx_v_cI[__pyx_t_11]) - (((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_10 * __pyx_v_masses.strides[0]) ))) * __pyx_v_x) * __pyx_v_z)); -static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - int __pyx_t_1; - - /* "View.MemoryView":1368 - * - * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) + /* "newanalysis/helpers/helpers.pyx":1466 + * cI[1] -= masses[i] * x*y + * cI[2] -= masses[i] * x*z + * cI[4] += masses[i] * (x*x+z*z) # <<<<<<<<<<<<<< + * cI[5] -= masses[i] * y*z + * cI[8] += masses[i] * (x*x+y*y) */ - __pyx_t_1 = (__pyx_v_dtype_is_object != 0); - if (__pyx_t_1) { + __pyx_t_11 = 4; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_masses.shape[0]; + (__pyx_v_cI[__pyx_t_11]) = ((__pyx_v_cI[__pyx_t_11]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_10 * __pyx_v_masses.strides[0]) ))) * ((__pyx_v_x * __pyx_v_x) + (__pyx_v_z * __pyx_v_z)))); - /* "View.MemoryView":1369 - * - * if dtype_is_object: - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< - * dst.strides, ndim, inc) + /* "newanalysis/helpers/helpers.pyx":1467 + * cI[2] -= masses[i] * x*z + * cI[4] += masses[i] * (x*x+z*z) + * cI[5] -= masses[i] * y*z # <<<<<<<<<<<<<< + * cI[8] += masses[i] * (x*x+y*y) * */ - __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + __pyx_t_11 = 5; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_masses.shape[0]; + (__pyx_v_cI[__pyx_t_11]) = ((__pyx_v_cI[__pyx_t_11]) - (((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_10 * __pyx_v_masses.strides[0]) ))) * __pyx_v_y) * __pyx_v_z)); - /* "View.MemoryView":1368 - * + /* "newanalysis/helpers/helpers.pyx":1468 + * cI[4] += masses[i] * (x*x+z*z) + * cI[5] -= masses[i] * y*z + * cI[8] += masses[i] * (x*x+y*y) # <<<<<<<<<<<<<< * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) + * cI[3] = cI[1] */ + __pyx_t_11 = 8; + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_masses.shape[0]; + (__pyx_v_cI[__pyx_t_11]) = ((__pyx_v_cI[__pyx_t_11]) + ((*((double *) ( /* dim=0 */ (__pyx_v_masses.data + __pyx_t_10 * __pyx_v_masses.strides[0]) ))) * ((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)))); } - /* "View.MemoryView":1364 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: - * - */ - - /* function exit code */ -} - -/* "View.MemoryView":1373 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - */ - -static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - __Pyx_RefNannyDeclarations - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - - /* "View.MemoryView":1376 - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - - /* "View.MemoryView":1373 + /* "newanalysis/helpers/helpers.pyx":1470 + * cI[8] += masses[i] * (x*x+y*y) * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: + * cI[3] = cI[1] # <<<<<<<<<<<<<< + * cI[6] = cI[2] + * cI[7] = cI[5] */ + (__pyx_v_cI[3]) = (__pyx_v_cI[1]); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif -} - -/* "View.MemoryView":1379 + /* "newanalysis/helpers/helpers.pyx":1471 * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i - */ - -static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - - /* "View.MemoryView":1383 - * cdef Py_ssize_t i + * cI[3] = cI[1] + * cI[6] = cI[2] # <<<<<<<<<<<<<< + * cI[7] = cI[5] * - * for i in range(shape[0]): # <<<<<<<<<<<<<< - * if ndim == 1: - * if inc: */ - __pyx_t_1 = (__pyx_v_shape[0]); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + (__pyx_v_cI[6]) = (__pyx_v_cI[2]); - /* "View.MemoryView":1384 + /* "newanalysis/helpers/helpers.pyx":1472 + * cI[3] = cI[1] + * cI[6] = cI[2] + * cI[7] = cI[5] # <<<<<<<<<<<<<< * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) - */ - __pyx_t_4 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: - */ - __pyx_t_4 = (__pyx_v_inc != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":1386 - * if ndim == 1: - * if inc: - * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * Py_DECREF(( data)[0]) - */ - Py_INCREF((((PyObject **)__pyx_v_data)[0])); - - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: - */ - goto __pyx_L6; - } - - /* "View.MemoryView":1388 - * Py_INCREF(( data)[0]) - * else: - * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, + * return I */ - /*else*/ { - Py_DECREF((((PyObject **)__pyx_v_data)[0])); - } - __pyx_L6:; + (__pyx_v_cI[7]) = (__pyx_v_cI[5]); - /* "View.MemoryView":1384 + /* "newanalysis/helpers/helpers.pyx":1474 + * cI[7] = cI[5] * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) - */ - goto __pyx_L5; - } - - /* "View.MemoryView":1390 - * Py_DECREF(( data)[0]) - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, inc) + * return I # <<<<<<<<<<<<<< * - */ - /*else*/ { - - /* "View.MemoryView":1391 - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, - * ndim - 1, inc) # <<<<<<<<<<<<<< * - * data += strides[0] */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); - } - __pyx_L5:; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_I); + __pyx_r = ((PyObject *)__pyx_v_I); + goto __pyx_L0; - /* "View.MemoryView":1393 - * ndim - 1, inc) - * - * data += strides[0] # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":1451 + * return L * - */ - __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0])); - } - - /* "View.MemoryView":1379 + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcInertiaTensor(double [:,:] coor, double [:] masses, int natoms): * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_I.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.helpers.calcInertiaTensor", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_I.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_I); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1399 - * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - */ - -static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - - /* "View.MemoryView":1402 - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1403 - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) - */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - - /* "View.MemoryView":1405 - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * - * - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - - /* "View.MemoryView":1399 - * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1409 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: - */ - -static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_extent; - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - - /* "View.MemoryView":1413 - * size_t itemsize, void *item) nogil: - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t extent = shape[0] - * - */ - __pyx_v_stride = (__pyx_v_strides[0]); - - /* "View.MemoryView":1414 - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] - * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: - */ - __pyx_v_extent = (__pyx_v_shape[0]); - - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) - */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1417 - * - * if ndim == 1: - * for i in range(extent): # <<<<<<<<<<<<<< - * memcpy(data, item, itemsize) - * data += stride - */ - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1418 - * if ndim == 1: - * for i in range(extent): - * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< - * data += stride - * else: - */ - (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - - /* "View.MemoryView":1419 - * for i in range(extent): - * memcpy(data, item, itemsize) - * data += stride # <<<<<<<<<<<<<< - * else: - * for i in range(extent): - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1421 - * data += stride - * else: - * for i in range(extent): # <<<<<<<<<<<<<< - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - */ - /*else*/ { - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1422 - * else: - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, itemsize, item) - * data += stride - */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - - /* "View.MemoryView":1424 - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - * data += stride # <<<<<<<<<<<<<< +/* "newanalysis/helpers/helpers.pyx":1477 * * - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - } - __pyx_L3:; - - /* "View.MemoryView":1409 + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcResidenceTimeseries(char [:,:] ds, int nshells): * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: - */ - - /* function exit code */ -} - -/* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; +static PyObject *__pyx_pw_11newanalysis_7helpers_67calcResidenceTimeseries(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_67calcResidenceTimeseries = {"calcResidenceTimeseries", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_67calcResidenceTimeseries, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_67calcResidenceTimeseries(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_nshells; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + __Pyx_RefNannySetupContext("calcResidenceTimeseries (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1477, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_nshells,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1477, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error) + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1477, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calcResidenceTimeseries", 1, 2, 2, 1); __PYX_ERR(0, 1477, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcResidenceTimeseries") < 0)) __PYX_ERR(0, 1477, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error) - __pyx_v___pyx_state = values[2]; + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1478, __pyx_L3_error) + __pyx_v_nshells = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_nshells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1478, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calcResidenceTimeseries", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1477, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcResidenceTimeseries", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + __pyx_r = __pyx_pf_11newanalysis_7helpers_66calcResidenceTimeseries(__pyx_self, __pyx_v_ds, __pyx_v_nshells); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; +static PyObject *__pyx_pf_11newanalysis_7helpers_66calcResidenceTimeseries(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_nshells) { + int __pyx_v_nmol; + int __pyx_v_nt; + __Pyx_memviewslice __pyx_v_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_i; + int __pyx_v_j; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; + Py_ssize_t __pyx_t_1; + __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + __Pyx_RefNannySetupContext("calcResidenceTimeseries", 0); - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) + /* "newanalysis/helpers/helpers.pyx":1480 + * def calcResidenceTimeseries(char [:,:] ds, int nshells): + * + * cdef int nmol = len(ds) # <<<<<<<<<<<<<< + * cdef int nt = len(ds[0]) + * */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__26, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ds); + __pyx_v_nmol = __pyx_t_1; - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); - __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + /* "newanalysis/helpers/helpers.pyx":1481 + * + * cdef int nmol = len(ds) + * cdef int nt = len(ds[0]) # <<<<<<<<<<<<<< + * + * cdef char [:,:,:] ts = np.zeros((nshells,nmol,nt),dtype=np.int8) + */ + __pyx_t_2.data = __pyx_v_ds.data; + __pyx_t_2.memview = __pyx_v_ds.memview; + __PYX_INC_MEMVIEW(&__pyx_t_2, 1); + { + Py_ssize_t __pyx_tmp_idx = 0; + Py_ssize_t __pyx_tmp_shape = __pyx_v_ds.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_ds.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "(tree fragment)":6 - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: +__pyx_t_2.shape[0] = __pyx_v_ds.shape[1]; +__pyx_t_2.strides[0] = __pyx_v_ds.strides[1]; + __pyx_t_2.suboffsets[0] = -1; + +__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL; + __pyx_v_nt = __pyx_t_1; + + /* "newanalysis/helpers/helpers.pyx":1483 + * cdef int nt = len(ds[0]) + * + * cdef char [:,:,:] ts = np.zeros((nshells,nmol,nt),dtype=np.int8) # <<<<<<<<<<<<<< + * + * cdef int i,j,ind */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_v___pyx_PickleError); - __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 6, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nshells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nmol); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_nt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5)) __PYX_ERR(0, 1483, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6)) __PYX_ERR(0, 1483, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7)) __PYX_ERR(0, 1483, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1483, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_ts = __pyx_t_8; + __pyx_t_8.memview = NULL; + __pyx_t_8.data = NULL; - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) + /* "newanalysis/helpers/helpers.pyx":1487 + * cdef int i,j,ind + * + * with nogil, parallel(): # <<<<<<<<<<<<<< + * for i in prange(nmol): + * for j in range(nt): */ - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_9) + #endif /* _OPENMP */ + { - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + /* "newanalysis/helpers/helpers.pyx":1488 + * + * with nogil, parallel(): + * for i in prange(nmol): # <<<<<<<<<<<<<< + * for j in range(nt): + * ts[ds[i,j]-1, i, j] += 1 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_9 = __pyx_v_nmol; + { + __pyx_t_11 = (__pyx_t_9 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_11 > 0) + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) + #endif /* _OPENMP */ + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_10); + /* Initialize private variables to invalid values */ + __pyx_v_j = ((int)0xbad0bad0); - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "newanalysis/helpers/helpers.pyx":1489 + * with nogil, parallel(): + * for i in prange(nmol): + * for j in range(nt): # <<<<<<<<<<<<<< + * ts[ds[i,j]-1, i, j] += 1 + * */ - __pyx_t_3 = (__pyx_v___pyx_state != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { + __pyx_t_12 = __pyx_v_nt; + __pyx_t_13 = __pyx_t_12; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_j = __pyx_t_14; - /* "(tree fragment)":9 - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + /* "newanalysis/helpers/helpers.pyx":1490 + * for i in prange(nmol): + * for j in range(nt): + * ts[ds[i,j]-1, i, j] += 1 # <<<<<<<<<<<<<< + * + * return np.asarray(ts) */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_t_4 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = __pyx_v_j; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_ds.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_ds.shape[1]; + __pyx_t_17 = ((*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_15 * __pyx_v_ds.strides[0]) ) + __pyx_t_16 * __pyx_v_ds.strides[1]) ))) - 1); + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_ts.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ts.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ts.shape[2]; + *((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ts.data + __pyx_t_17 * __pyx_v_ts.strides[0]) ) + __pyx_t_18 * __pyx_v_ts.strides[1]) ) + __pyx_t_19 * __pyx_v_ts.strides[2]) )) += 1; + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "newanalysis/helpers/helpers.pyx":1487 + * cdef int i,j,ind + * + * with nogil, parallel(): # <<<<<<<<<<<<<< + * for i in prange(nmol): + * for j in range(nt): */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } } - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] + /* "newanalysis/helpers/helpers.pyx":1492 + * ts[ds[i,j]-1, i, j] += 1 + * + * return np.asarray(ts) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ts, 3, (PyObject *(*)(char *)) __pyx_memview_get_char, (int (*)(char *, PyObject *)) __pyx_memview_set_char, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_11 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "newanalysis/helpers/helpers.pyx":1477 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcResidenceTimeseries(char [:,:] ds, int nshells): + * */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_7); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcResidenceTimeseries", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ts, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): +/* "newanalysis/helpers/helpers.pyx":1494 + * return np.asarray(ts) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularDisplacement(double [:,:] wts, double dt): + * */ -static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_69calcAngularDisplacement(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_69calcAngularDisplacement = {"calcAngularDisplacement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_69calcAngularDisplacement, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_69calcAngularDisplacement(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_wts = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dt; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcAngularDisplacement (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1494, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wts,&__pyx_n_s_dt,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_wts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1494, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1494, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcAngularDisplacement", 1, 2, 2, 1); __PYX_ERR(0, 1494, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcAngularDisplacement") < 0)) __PYX_ERR(0, 1494, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_wts = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_wts.memview)) __PYX_ERR(0, 1495, __pyx_L3_error) + __pyx_v_dt = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dt == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1495, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcAngularDisplacement", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1494, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_wts, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcAngularDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_68calcAngularDisplacement(__pyx_self, __pyx_v_wts, __pyx_v_dt); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_wts, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_7helpers_68calcAngularDisplacement(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_wts, double __pyx_v_dt) { + int __pyx_v_tn; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + __Pyx_memviewslice __pyx_v_integral = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_msd = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; + __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + __Pyx_RefNannySetupContext("calcAngularDisplacement", 0); - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) + /* "newanalysis/helpers/helpers.pyx":1497 + * def calcAngularDisplacement(double [:,:] wts, double dt): + * + * cdef int tn = wts.shape[0] # <<<<<<<<<<<<<< + * cdef int i, j, k + * cdef double [:,:] integral = np.zeros((tn,3)) */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->name); - __Pyx_DECREF(__pyx_v___pyx_result->name); - __pyx_v___pyx_result->name = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_tn = (__pyx_v_wts.shape[0]); - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) + /* "newanalysis/helpers/helpers.pyx":1499 + * cdef int tn = wts.shape[0] + * cdef int i, j, k + * cdef double [:,:] integral = np.zeros((tn,3)) # <<<<<<<<<<<<<< + * cdef double [:,:] msd = np.zeros((tn,3)) + * cdef int [:] ctr = np.zeros(tn, dtype=np.int32) */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 13, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_tn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 1499, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3)) __PYX_ERR(0, 1499, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_4 = ((__pyx_t_3 > 1) != 0); - if (__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1499, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_integral = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "(tree fragment)":14 - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":1500 + * cdef int i, j, k + * cdef double [:,:] integral = np.zeros((tn,3)) + * cdef double [:,:] msd = np.zeros((tn,3)) # <<<<<<<<<<<<<< + * cdef int [:] ctr = np.zeros(tn, dtype=np.int32) + * */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 14, __pyx_L1_error) - } - __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_tn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(0, 1500, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_3)) __PYX_ERR(0, 1500, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_5 = 1; } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error) + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1500, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1500, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_msd = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) + /* "newanalysis/helpers/helpers.pyx":1501 + * cdef double [:,:] integral = np.zeros((tn,3)) + * cdef double [:,:] msd = np.zeros((tn,3)) + * cdef int [:] ctr = np.zeros(tn, dtype=np.int32) # <<<<<<<<<<<<<< + * + * # calculate integral + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_tn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 1501, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1501, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_ctr = __pyx_t_8; + __pyx_t_8.memview = NULL; + __pyx_t_8.data = NULL; + + /* "newanalysis/helpers/helpers.pyx":1504 + * + * # calculate integral + * for i in range(1,tn): # <<<<<<<<<<<<<< + * for j in range(3): + * k = i-1 + */ + __pyx_t_5 = __pyx_v_tn; + __pyx_t_9 = __pyx_t_5; + for (__pyx_t_10 = 1; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; + + /* "newanalysis/helpers/helpers.pyx":1505 + * # calculate integral + * for i in range(1,tn): + * for j in range(3): # <<<<<<<<<<<<<< + * k = i-1 + * integral[i,j] = integral[k,j] + (wts[k,j] + wts[i,j]) * 0.5 * dt + */ + for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { + __pyx_v_j = __pyx_t_11; + + /* "newanalysis/helpers/helpers.pyx":1506 + * for i in range(1,tn): + * for j in range(3): + * k = i-1 # <<<<<<<<<<<<<< + * integral[i,j] = integral[k,j] + (wts[k,j] + wts[i,j]) * 0.5 * dt + * + */ + __pyx_v_k = (__pyx_v_i - 1); + + /* "newanalysis/helpers/helpers.pyx":1507 + * for j in range(3): + * k = i-1 + * integral[i,j] = integral[k,j] + (wts[k,j] + wts[i,j]) * 0.5 * dt # <<<<<<<<<<<<<< + * + * # calculate angular displacement */ + __pyx_t_12 = __pyx_v_k; + __pyx_t_13 = __pyx_v_j; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_integral.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_integral.shape[1]; + __pyx_t_14 = __pyx_v_k; + __pyx_t_15 = __pyx_v_j; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_wts.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_wts.shape[1]; + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = __pyx_v_j; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_wts.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_wts.shape[1]; + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_integral.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_integral.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_integral.data + __pyx_t_18 * __pyx_v_integral.strides[0]) ) + __pyx_t_19 * __pyx_v_integral.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_integral.data + __pyx_t_12 * __pyx_v_integral.strides[0]) ) + __pyx_t_13 * __pyx_v_integral.strides[1]) ))) + ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_wts.data + __pyx_t_14 * __pyx_v_wts.strides[0]) ) + __pyx_t_15 * __pyx_v_wts.strides[1]) ))) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_wts.data + __pyx_t_16 * __pyx_v_wts.strides[0]) ) + __pyx_t_17 * __pyx_v_wts.strides[1]) )))) * 0.5) * __pyx_v_dt)); + } } - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + /* "newanalysis/helpers/helpers.pyx":1510 + * + * # calculate angular displacement + * for i in prange(tn,nogil=True,schedule=dynamic): # <<<<<<<<<<<<<< + * for j in range(tn-i): + * for k in range(3): */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_5 = __pyx_v_tn; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_10 = (__pyx_t_5 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_10 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_20, __pyx_t_21, __pyx_t_22) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) + #endif /* _OPENMP */ + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_9); + /* Initialize private variables to invalid values */ + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "newanalysis/helpers/helpers.pyx":1511 + * # calculate angular displacement + * for i in prange(tn,nogil=True,schedule=dynamic): + * for j in range(tn-i): # <<<<<<<<<<<<<< + * for k in range(3): + * msd[i,k] += pow(integral[j,k] - integral[j+i,k], 2) + */ + __pyx_t_11 = (__pyx_v_tn - __pyx_v_i); + __pyx_t_20 = __pyx_t_11; + for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { + __pyx_v_j = __pyx_t_21; + + /* "newanalysis/helpers/helpers.pyx":1512 + * for i in prange(tn,nogil=True,schedule=dynamic): + * for j in range(tn-i): + * for k in range(3): # <<<<<<<<<<<<<< + * msd[i,k] += pow(integral[j,k] - integral[j+i,k], 2) + * ctr[i] += 1 + */ + for (__pyx_t_22 = 0; __pyx_t_22 < 3; __pyx_t_22+=1) { + __pyx_v_k = __pyx_t_22; + + /* "newanalysis/helpers/helpers.pyx":1513 + * for j in range(tn-i): + * for k in range(3): + * msd[i,k] += pow(integral[j,k] - integral[j+i,k], 2) # <<<<<<<<<<<<<< + * ctr[i] += 1 + * + */ + __pyx_t_17 = __pyx_v_j; + __pyx_t_16 = __pyx_v_k; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_integral.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_integral.shape[1]; + __pyx_t_15 = (__pyx_v_j + __pyx_v_i); + __pyx_t_14 = __pyx_v_k; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_integral.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_integral.shape[1]; + __pyx_t_13 = __pyx_v_i; + __pyx_t_12 = __pyx_v_k; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_msd.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_msd.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_msd.data + __pyx_t_13 * __pyx_v_msd.strides[0]) ) + __pyx_t_12 * __pyx_v_msd.strides[1]) )) += pow(((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_integral.data + __pyx_t_17 * __pyx_v_integral.strides[0]) ) + __pyx_t_16 * __pyx_v_integral.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_integral.data + __pyx_t_15 * __pyx_v_integral.strides[0]) ) + __pyx_t_14 * __pyx_v_integral.strides[1]) )))), 2.0); + } + + /* "newanalysis/helpers/helpers.pyx":1514 + * for k in range(3): + * msd[i,k] += pow(integral[j,k] - integral[j+i,k], 2) + * ctr[i] += 1 # <<<<<<<<<<<<<< + * + * for i in range(tn): + */ + __pyx_t_14 = __pyx_v_i; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_ctr.shape[0]; + *((int *) ( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_14 * __pyx_v_ctr.strides[0]) )) += 1; + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/helpers.pyx":1510 + * + * # calculate angular displacement + * for i in prange(tn,nogil=True,schedule=dynamic): # <<<<<<<<<<<<<< + * for j in range(tn-i): + * for k in range(3): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L9; + } + __pyx_L9:; + } + } + + /* "newanalysis/helpers/helpers.pyx":1516 + * ctr[i] += 1 + * + * for i in range(tn): # <<<<<<<<<<<<<< + * for j in range(3): + * msd[i,j] /= ctr[i] + */ + __pyx_t_10 = __pyx_v_tn; + __pyx_t_9 = __pyx_t_10; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_9; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "newanalysis/helpers/helpers.pyx":1517 + * + * for i in range(tn): + * for j in range(3): # <<<<<<<<<<<<<< + * msd[i,j] /= ctr[i] + * + */ + for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { + __pyx_v_j = __pyx_t_11; + + /* "newanalysis/helpers/helpers.pyx":1518 + * for i in range(tn): + * for j in range(3): + * msd[i,j] /= ctr[i] # <<<<<<<<<<<<<< + * + * return msd + */ + __pyx_t_14 = __pyx_v_i; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_ctr.shape[0]; + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = __pyx_v_j; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_msd.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_msd.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_msd.data + __pyx_t_15 * __pyx_v_msd.strides[0]) ) + __pyx_t_16 * __pyx_v_msd.strides[1]) )) /= (*((int *) ( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_14 * __pyx_v_ctr.strides[0]) ))); + } + } + + /* "newanalysis/helpers/helpers.pyx":1520 + * msd[i,j] /= ctr[i] + * + * return msd # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_msd, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; goto __pyx_L0; + + /* "newanalysis/helpers/helpers.pyx":1494 + * return np.asarray(ts) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularDisplacement(double [:,:] wts, double dt): + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcAngularDisplacement", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_integral, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_msd, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ctr, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_vtabstruct_array __pyx_vtable_array; -static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_array_obj *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_array_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_array; - p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} +/* "newanalysis/helpers/helpers.pyx":1522 + * return msd + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findNearestAtom(double [:,:] coor_core, double [:,:] coor_surr, double [:] mindist, + * double [:] mindist2, double [:,:] minvec, int [:] next_id): + */ -static void __pyx_tp_dealloc_array(PyObject *o) { - struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_71findNearestAtom(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_71findNearestAtom = {"findNearestAtom", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_71findNearestAtom, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_71findNearestAtom(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor_core = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor_surr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_mindist = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_mindist2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_minvec = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_next_id = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("findNearestAtom (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1522, __pyx_L3_error) + #endif #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_array___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->mode); - Py_CLEAR(p->_format); - (*Py_TYPE(o)->tp_free)(o); -} -static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_array___setitem__(o, i, v); + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor_core,&__pyx_n_s_coor_surr,&__pyx_n_s_mindist,&__pyx_n_s_mindist2,&__pyx_n_s_minvec,&__pyx_n_s_next_id,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_core)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1522, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_surr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1522, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, 1); __PYX_ERR(0, 1522, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mindist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1522, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, 2); __PYX_ERR(0, 1522, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mindist2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1522, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, 3); __PYX_ERR(0, 1522, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_minvec)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1522, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, 4); __PYX_ERR(0, 1522, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_next_id)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1522, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, 5); __PYX_ERR(0, 1522, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "findNearestAtom") < 0)) __PYX_ERR(0, 1522, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 6)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + } + __pyx_v_coor_core = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_core.memview)) __PYX_ERR(0, 1523, __pyx_L3_error) + __pyx_v_coor_surr = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_surr.memview)) __PYX_ERR(0, 1523, __pyx_L3_error) + __pyx_v_mindist = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mindist.memview)) __PYX_ERR(0, 1523, __pyx_L3_error) + __pyx_v_mindist2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mindist2.memview)) __PYX_ERR(0, 1524, __pyx_L3_error) + __pyx_v_minvec = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_minvec.memview)) __PYX_ERR(0, 1524, __pyx_L3_error) + __pyx_v_next_id = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_next_id.memview)) __PYX_ERR(0, 1524, __pyx_L3_error) } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); - return -1; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("findNearestAtom", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 1522, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } -} + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_core, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_surr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mindist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mindist2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_minvec, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_next_id, 1); + __Pyx_AddTraceback("newanalysis.helpers.findNearestAtom", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_70findNearestAtom(__pyx_self, __pyx_v_coor_core, __pyx_v_coor_surr, __pyx_v_mindist, __pyx_v_mindist2, __pyx_v_minvec, __pyx_v_next_id); -static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { - PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n); - if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - v = __pyx_array___getattr__(o, n); + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_core, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_surr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mindist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mindist2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_minvec, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_next_id, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - return v; -} - -static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyMethodDef __pyx_methods_array[] = { - {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_array[] = { - {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_array = { - __pyx_array___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_array, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; +static PyObject *__pyx_pf_11newanalysis_7helpers_70findNearestAtom(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor_core, __Pyx_memviewslice __pyx_v_coor_surr, __Pyx_memviewslice __pyx_v_mindist, __Pyx_memviewslice __pyx_v_mindist2, __Pyx_memviewslice __pyx_v_minvec, __Pyx_memviewslice __pyx_v_next_id) { + CYTHON_UNUSED int __pyx_v_n_core; + int __pyx_v_n_surr; + int __pyx_v_i; + int __pyx_v_j; + double __pyx_v_tmp_x; + double __pyx_v_tmp_y; + double __pyx_v_tmp_z; + double __pyx_v_dist2; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + int __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + __Pyx_RefNannySetupContext("findNearestAtom", 0); -static PyMappingMethods __pyx_tp_as_mapping_array = { - __pyx_array___len__, /*mp_length*/ - __pyx_array___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ -}; + /* "newanalysis/helpers/helpers.pyx":1526 + * double [:] mindist2, double [:,:] minvec, int [:] next_id): + * + * cdef int n_core = coor_core.shape[0] # <<<<<<<<<<<<<< + * cdef int n_surr = coor_surr.shape[0] + * cdef int i, j + */ + __pyx_v_n_core = (__pyx_v_coor_core.shape[0]); -static PyBufferProcs __pyx_tp_as_buffer_array = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_array_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; + /* "newanalysis/helpers/helpers.pyx":1527 + * + * cdef int n_core = coor_core.shape[0] + * cdef int n_surr = coor_surr.shape[0] # <<<<<<<<<<<<<< + * cdef int i, j + * + */ + __pyx_v_n_surr = (__pyx_v_coor_surr.shape[0]); -static PyTypeObject __pyx_type___pyx_array = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.helpers.array", /*tp_name*/ - sizeof(struct __pyx_array_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_array, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ + /* "newanalysis/helpers/helpers.pyx":1532 + * cdef double tmp_x, tmp_y, tmp_z, dist2 + * + * for i in prange(n_core, nogil=True): # <<<<<<<<<<<<<< + * for j in range(n_surr): + * tmp_x = coor_surr[j,0] - coor_core[i,0] + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_1 = __pyx_v_n_core; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_3 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_dist2) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_tmp_x) lastprivate(__pyx_v_tmp_y) lastprivate(__pyx_v_tmp_z) + #endif /* _OPENMP */ + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_2); + /* Initialize private variables to invalid values */ + __pyx_v_dist2 = ((double)__PYX_NAN()); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_tmp_x = ((double)__PYX_NAN()); + __pyx_v_tmp_y = ((double)__PYX_NAN()); + __pyx_v_tmp_z = ((double)__PYX_NAN()); + + /* "newanalysis/helpers/helpers.pyx":1533 + * + * for i in prange(n_core, nogil=True): + * for j in range(n_surr): # <<<<<<<<<<<<<< + * tmp_x = coor_surr[j,0] - coor_core[i,0] + * tmp_y = coor_surr[j,1] - coor_core[i,1] + */ + __pyx_t_4 = __pyx_v_n_surr; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_j = __pyx_t_6; + + /* "newanalysis/helpers/helpers.pyx":1534 + * for i in prange(n_core, nogil=True): + * for j in range(n_surr): + * tmp_x = coor_surr[j,0] - coor_core[i,0] # <<<<<<<<<<<<<< + * tmp_y = coor_surr[j,1] - coor_core[i,1] + * tmp_z = coor_surr[j,2] - coor_core[i,2] + */ + __pyx_t_7 = __pyx_v_j; + __pyx_t_8 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor_surr.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor_surr.shape[1]; + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor_core.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_core.shape[1]; + __pyx_v_tmp_x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_7 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_8 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_core.data + __pyx_t_9 * __pyx_v_coor_core.strides[0]) ) + __pyx_t_10 * __pyx_v_coor_core.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":1535 + * for j in range(n_surr): + * tmp_x = coor_surr[j,0] - coor_core[i,0] + * tmp_y = coor_surr[j,1] - coor_core[i,1] # <<<<<<<<<<<<<< + * tmp_z = coor_surr[j,2] - coor_core[i,2] + * + */ + __pyx_t_10 = __pyx_v_j; + __pyx_t_9 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_surr.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor_surr.shape[1]; + __pyx_t_8 = __pyx_v_i; + __pyx_t_7 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor_core.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor_core.shape[1]; + __pyx_v_tmp_y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_10 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_9 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_core.data + __pyx_t_8 * __pyx_v_coor_core.strides[0]) ) + __pyx_t_7 * __pyx_v_coor_core.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":1536 + * tmp_x = coor_surr[j,0] - coor_core[i,0] + * tmp_y = coor_surr[j,1] - coor_core[i,1] + * tmp_z = coor_surr[j,2] - coor_core[i,2] # <<<<<<<<<<<<<< + * + * dist2 = tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z + */ + __pyx_t_7 = __pyx_v_j; + __pyx_t_8 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor_surr.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor_surr.shape[1]; + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = 2; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor_core.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_core.shape[1]; + __pyx_v_tmp_z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_7 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_8 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_core.data + __pyx_t_9 * __pyx_v_coor_core.strides[0]) ) + __pyx_t_10 * __pyx_v_coor_core.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":1538 + * tmp_z = coor_surr[j,2] - coor_core[i,2] + * + * dist2 = tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z # <<<<<<<<<<<<<< + * + * if dist2 < mindist2[i]: + */ + __pyx_v_dist2 = (((__pyx_v_tmp_x * __pyx_v_tmp_x) + (__pyx_v_tmp_y * __pyx_v_tmp_y)) + (__pyx_v_tmp_z * __pyx_v_tmp_z)); + + /* "newanalysis/helpers/helpers.pyx":1540 + * dist2 = tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z + * + * if dist2 < mindist2[i]: # <<<<<<<<<<<<<< + * mindist2[i] = dist2 + * next_id[i] = j + */ + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mindist2.shape[0]; + __pyx_t_11 = (__pyx_v_dist2 < (*((double *) ( /* dim=0 */ (__pyx_v_mindist2.data + __pyx_t_10 * __pyx_v_mindist2.strides[0]) )))); + if (__pyx_t_11) { + + /* "newanalysis/helpers/helpers.pyx":1541 + * + * if dist2 < mindist2[i]: + * mindist2[i] = dist2 # <<<<<<<<<<<<<< + * next_id[i] = j + * + */ + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mindist2.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_mindist2.data + __pyx_t_10 * __pyx_v_mindist2.strides[0]) )) = __pyx_v_dist2; + + /* "newanalysis/helpers/helpers.pyx":1542 + * if dist2 < mindist2[i]: + * mindist2[i] = dist2 + * next_id[i] = j # <<<<<<<<<<<<<< + * + * mindist[i] = sqrt(mindist2[i]) + */ + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_next_id.shape[0]; + *((int *) ( /* dim=0 */ (__pyx_v_next_id.data + __pyx_t_10 * __pyx_v_next_id.strides[0]) )) = __pyx_v_j; + + /* "newanalysis/helpers/helpers.pyx":1540 + * dist2 = tmp_x*tmp_x + tmp_y*tmp_y + tmp_z*tmp_z + * + * if dist2 < mindist2[i]: # <<<<<<<<<<<<<< + * mindist2[i] = dist2 + * next_id[i] = j + */ + } + } + + /* "newanalysis/helpers/helpers.pyx":1544 + * next_id[i] = j + * + * mindist[i] = sqrt(mindist2[i]) # <<<<<<<<<<<<<< + * for j in range(3): + * minvec[i,j] = coor_surr[next_id[i],j] - coor_core[i,j] + */ + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mindist2.shape[0]; + __pyx_t_9 = __pyx_v_i; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mindist.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_mindist.data + __pyx_t_9 * __pyx_v_mindist.strides[0]) )) = sqrt((*((double *) ( /* dim=0 */ (__pyx_v_mindist2.data + __pyx_t_10 * __pyx_v_mindist2.strides[0]) )))); + + /* "newanalysis/helpers/helpers.pyx":1545 + * + * mindist[i] = sqrt(mindist2[i]) + * for j in range(3): # <<<<<<<<<<<<<< + * minvec[i,j] = coor_surr[next_id[i],j] - coor_core[i,j] + * + */ + for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { + __pyx_v_j = __pyx_t_4; + + /* "newanalysis/helpers/helpers.pyx":1546 + * mindist[i] = sqrt(mindist2[i]) + * for j in range(3): + * minvec[i,j] = coor_surr[next_id[i],j] - coor_core[i,j] # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_next_id.shape[0]; + __pyx_t_9 = (*((int *) ( /* dim=0 */ (__pyx_v_next_id.data + __pyx_t_10 * __pyx_v_next_id.strides[0]) ))); + __pyx_t_8 = __pyx_v_j; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor_surr.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor_surr.shape[1]; + __pyx_t_7 = __pyx_v_i; + __pyx_t_12 = __pyx_v_j; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor_core.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor_core.shape[1]; + __pyx_t_13 = __pyx_v_i; + __pyx_t_14 = __pyx_v_j; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_minvec.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_minvec.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_minvec.data + __pyx_t_13 * __pyx_v_minvec.strides[0]) ) + __pyx_t_14 * __pyx_v_minvec.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_9 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_8 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_core.data + __pyx_t_7 * __pyx_v_coor_core.strides[0]) ) + __pyx_t_12 * __pyx_v_coor_core.strides[1]) )))); + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/helpers.pyx":1532 + * cdef double tmp_x, tmp_y, tmp_z, dist2 + * + * for i in prange(n_core, nogil=True): # <<<<<<<<<<<<<< + * for j in range(n_surr): + * tmp_x = coor_surr[j,0] - coor_core[i,0] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "newanalysis/helpers/helpers.pyx":1522 + * return msd + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findNearestAtom(double [:,:] coor_core, double [:,:] coor_surr, double [:] mindist, + * double [:] mindist2, double [:,:] minvec, int [:] next_id): + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/helpers.pyx":1548 + * minvec[i,j] = coor_surr[next_id[i],j] - coor_core[i,j] + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def checkHBond(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist): + * # this function is designed only for water hydrogen bonds! + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_73checkHBond(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_73checkHBond = {"checkHBond", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_73checkHBond, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_73checkHBond(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor_surr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor_oh2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_nres_surr; + double __pyx_v_maxdist; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("checkHBond (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1548, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor_surr,&__pyx_n_s_coor_oh2,&__pyx_n_s_nres_surr,&__pyx_n_s_maxdist,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_surr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1548, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_oh2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1548, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("checkHBond", 1, 4, 4, 1); __PYX_ERR(0, 1548, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nres_surr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1548, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("checkHBond", 1, 4, 4, 2); __PYX_ERR(0, 1548, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxdist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1548, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("checkHBond", 1, 4, 4, 3); __PYX_ERR(0, 1548, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "checkHBond") < 0)) __PYX_ERR(0, 1548, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_coor_surr = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_surr.memview)) __PYX_ERR(0, 1549, __pyx_L3_error) + __pyx_v_coor_oh2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_oh2.memview)) __PYX_ERR(0, 1549, __pyx_L3_error) + __pyx_v_nres_surr = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nres_surr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1549, __pyx_L3_error) + __pyx_v_maxdist = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_maxdist == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1549, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("checkHBond", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1548, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_surr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_oh2, 1); + __Pyx_AddTraceback("newanalysis.helpers.checkHBond", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_72checkHBond(__pyx_self, __pyx_v_coor_surr, __pyx_v_coor_oh2, __pyx_v_nres_surr, __pyx_v_maxdist); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_surr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_oh2, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_7helpers_72checkHBond(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor_surr, __Pyx_memviewslice __pyx_v_coor_oh2, int __pyx_v_nres_surr, double __pyx_v_maxdist) { + int __pyx_v_sites_per_res; + int __pyx_v_nsurr; + int __pyx_v_nwat; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_l; + int __pyx_v_idx; + int __pyx_v_idx2; + int __pyx_v_idx3; + __Pyx_memviewslice __pyx_v_hbond = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_dx2; + double __pyx_v_dy2; + double __pyx_v_dz2; + double __pyx_v_dot; + double __pyx_v_dot2; + double __pyx_v_dist; + double __pyx_v_dist2; + double __pyx_v_cosine; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + Py_ssize_t __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + double __pyx_t_22; + double __pyx_t_23; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("checkHBond", 0); + + /* "newanalysis/helpers/helpers.pyx":1551 + * def checkHBond(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist): + * # this function is designed only for water hydrogen bonds! + * cdef int sites_per_res = coor_surr.shape[0] // nres_surr # <<<<<<<<<<<<<< + * cdef int nsurr = coor_surr.shape[0] // sites_per_res + * cdef int nwat = coor_oh2.shape[0] // 3 + */ + if (unlikely(__pyx_v_nres_surr == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 1551, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nres_surr == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW((__pyx_v_coor_surr.shape[0])))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 1551, __pyx_L1_error) + } + __pyx_v_sites_per_res = __Pyx_div_Py_ssize_t((__pyx_v_coor_surr.shape[0]), __pyx_v_nres_surr); + + /* "newanalysis/helpers/helpers.pyx":1552 + * # this function is designed only for water hydrogen bonds! + * cdef int sites_per_res = coor_surr.shape[0] // nres_surr + * cdef int nsurr = coor_surr.shape[0] // sites_per_res # <<<<<<<<<<<<<< + * cdef int nwat = coor_oh2.shape[0] // 3 + * cdef int i, j, k, l, idx, idx2, idx3 + */ + if (unlikely(__pyx_v_sites_per_res == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 1552, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_sites_per_res == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW((__pyx_v_coor_surr.shape[0])))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 1552, __pyx_L1_error) + } + __pyx_v_nsurr = __Pyx_div_Py_ssize_t((__pyx_v_coor_surr.shape[0]), __pyx_v_sites_per_res); + + /* "newanalysis/helpers/helpers.pyx":1553 + * cdef int sites_per_res = coor_surr.shape[0] // nres_surr + * cdef int nsurr = coor_surr.shape[0] // sites_per_res + * cdef int nwat = coor_oh2.shape[0] // 3 # <<<<<<<<<<<<<< + * cdef int i, j, k, l, idx, idx2, idx3 + * + */ + __pyx_v_nwat = __Pyx_div_Py_ssize_t((__pyx_v_coor_oh2.shape[0]), 3); + + /* "newanalysis/helpers/helpers.pyx":1556 + * cdef int i, j, k, l, idx, idx2, idx3 + * + * cdef char [:] hbond = np.zeros(nwat, dtype=np.int8) # <<<<<<<<<<<<<< + * + * cdef double dx, dy, dz, dx2, dy2, dz2, dot, dot2, dist, dist2, cosine + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nwat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1556, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1556, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_hbond = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; + + /* "newanalysis/helpers/helpers.pyx":1561 + * + * # loop over water molecules + * for i in prange(nwat, nogil=True): # <<<<<<<<<<<<<< + * if hbond[i] == 0: + * # loop over h atoms + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_7 = __pyx_v_nwat; + { + double __pyx_parallel_temp0 = ((double)__PYX_NAN()); + double __pyx_parallel_temp1 = ((double)__PYX_NAN()); + double __pyx_parallel_temp2 = ((double)__PYX_NAN()); + double __pyx_parallel_temp3 = ((double)__PYX_NAN()); + double __pyx_parallel_temp4 = ((double)__PYX_NAN()); + double __pyx_parallel_temp5 = ((double)__PYX_NAN()); + double __pyx_parallel_temp6 = ((double)__PYX_NAN()); + double __pyx_parallel_temp7 = ((double)__PYX_NAN()); + double __pyx_parallel_temp8 = ((double)__PYX_NAN()); + double __pyx_parallel_temp9 = ((double)__PYX_NAN()); + double __pyx_parallel_temp10 = ((double)__PYX_NAN()); + int __pyx_parallel_temp11 = ((int)0xbad0bad0); + int __pyx_parallel_temp12 = ((int)0xbad0bad0); + int __pyx_parallel_temp13 = ((int)0xbad0bad0); + int __pyx_parallel_temp14 = ((int)0xbad0bad0); + int __pyx_parallel_temp15 = ((int)0xbad0bad0); + int __pyx_parallel_temp16 = ((int)0xbad0bad0); + int __pyx_parallel_temp17 = ((int)0xbad0bad0); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_9 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_9 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_cosine) lastprivate(__pyx_v_dist) lastprivate(__pyx_v_dist2) lastprivate(__pyx_v_dot) lastprivate(__pyx_v_dot2) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dx2) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dy2) lastprivate(__pyx_v_dz) lastprivate(__pyx_v_dz2) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_idx2) lastprivate(__pyx_v_idx3) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_l) + #endif /* _OPENMP */ + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_8); + /* Initialize private variables to invalid values */ + __pyx_v_cosine = ((double)__PYX_NAN()); + __pyx_v_dist = ((double)__PYX_NAN()); + __pyx_v_dist2 = ((double)__PYX_NAN()); + __pyx_v_dot = ((double)__PYX_NAN()); + __pyx_v_dot2 = ((double)__PYX_NAN()); + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dx2 = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dy2 = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_dz2 = ((double)__PYX_NAN()); + __pyx_v_idx = ((int)0xbad0bad0); + __pyx_v_idx2 = ((int)0xbad0bad0); + __pyx_v_idx3 = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); + __pyx_v_l = ((int)0xbad0bad0); + + /* "newanalysis/helpers/helpers.pyx":1562 + * # loop over water molecules + * for i in prange(nwat, nogil=True): + * if hbond[i] == 0: # <<<<<<<<<<<<<< + * # loop over h atoms + * for j in range(2): + */ + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_hbond.shape[0]; + __pyx_t_11 = ((*((char *) ( /* dim=0 */ (__pyx_v_hbond.data + __pyx_t_10 * __pyx_v_hbond.strides[0]) ))) == 0); + if (__pyx_t_11) { + + /* "newanalysis/helpers/helpers.pyx":1564 + * if hbond[i] == 0: + * # loop over h atoms + * for j in range(2): # <<<<<<<<<<<<<< + * if hbond[i] == 0: + * idx = i*3+1+j + */ + for (__pyx_t_12 = 0; __pyx_t_12 < 2; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; + + /* "newanalysis/helpers/helpers.pyx":1565 + * # loop over h atoms + * for j in range(2): + * if hbond[i] == 0: # <<<<<<<<<<<<<< + * idx = i*3+1+j + * idx3 = i*3 + */ + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_hbond.shape[0]; + __pyx_t_11 = ((*((char *) ( /* dim=0 */ (__pyx_v_hbond.data + __pyx_t_10 * __pyx_v_hbond.strides[0]) ))) == 0); + if (__pyx_t_11) { + + /* "newanalysis/helpers/helpers.pyx":1566 + * for j in range(2): + * if hbond[i] == 0: + * idx = i*3+1+j # <<<<<<<<<<<<<< + * idx3 = i*3 + * # loop over surrounding molecules + */ + __pyx_v_idx = (((__pyx_v_i * 3) + 1) + __pyx_v_j); + + /* "newanalysis/helpers/helpers.pyx":1567 + * if hbond[i] == 0: + * idx = i*3+1+j + * idx3 = i*3 # <<<<<<<<<<<<<< + * # loop over surrounding molecules + * for k in range(nsurr): + */ + __pyx_v_idx3 = (__pyx_v_i * 3); + + /* "newanalysis/helpers/helpers.pyx":1569 + * idx3 = i*3 + * # loop over surrounding molecules + * for k in range(nsurr): # <<<<<<<<<<<<<< + * if hbond[i] == 0: + * # loop over oxygen atoms + */ + __pyx_t_13 = __pyx_v_nsurr; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_k = __pyx_t_15; + + /* "newanalysis/helpers/helpers.pyx":1570 + * # loop over surrounding molecules + * for k in range(nsurr): + * if hbond[i] == 0: # <<<<<<<<<<<<<< + * # loop over oxygen atoms + * for l in range(sites_per_res): + */ + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_hbond.shape[0]; + __pyx_t_11 = ((*((char *) ( /* dim=0 */ (__pyx_v_hbond.data + __pyx_t_10 * __pyx_v_hbond.strides[0]) ))) == 0); + if (__pyx_t_11) { + + /* "newanalysis/helpers/helpers.pyx":1572 + * if hbond[i] == 0: + * # loop over oxygen atoms + * for l in range(sites_per_res): # <<<<<<<<<<<<<< + * idx2 = k*sites_per_res+l + * dx = coor_surr[idx2,0] - coor_oh2[idx,0] + */ + __pyx_t_16 = __pyx_v_sites_per_res; + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_l = __pyx_t_18; + + /* "newanalysis/helpers/helpers.pyx":1573 + * # loop over oxygen atoms + * for l in range(sites_per_res): + * idx2 = k*sites_per_res+l # <<<<<<<<<<<<<< + * dx = coor_surr[idx2,0] - coor_oh2[idx,0] + * dy = coor_surr[idx2,1] - coor_oh2[idx,1] + */ + __pyx_v_idx2 = ((__pyx_v_k * __pyx_v_sites_per_res) + __pyx_v_l); + + /* "newanalysis/helpers/helpers.pyx":1574 + * for l in range(sites_per_res): + * idx2 = k*sites_per_res+l + * dx = coor_surr[idx2,0] - coor_oh2[idx,0] # <<<<<<<<<<<<<< + * dy = coor_surr[idx2,1] - coor_oh2[idx,1] + * dz = coor_surr[idx2,2] - coor_oh2[idx,2] + */ + __pyx_t_10 = __pyx_v_idx2; + __pyx_t_19 = 0; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_surr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_surr.shape[1]; + __pyx_t_20 = __pyx_v_idx; + __pyx_t_21 = 0; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_10 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_20 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_21 * __pyx_v_coor_oh2.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":1575 + * idx2 = k*sites_per_res+l + * dx = coor_surr[idx2,0] - coor_oh2[idx,0] + * dy = coor_surr[idx2,1] - coor_oh2[idx,1] # <<<<<<<<<<<<<< + * dz = coor_surr[idx2,2] - coor_oh2[idx,2] + * dot = dx*dx + dy*dy + dz*dz + */ + __pyx_t_21 = __pyx_v_idx2; + __pyx_t_20 = 1; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_surr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_surr.shape[1]; + __pyx_t_19 = __pyx_v_idx; + __pyx_t_10 = 1; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_21 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_10 * __pyx_v_coor_oh2.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":1576 + * dx = coor_surr[idx2,0] - coor_oh2[idx,0] + * dy = coor_surr[idx2,1] - coor_oh2[idx,1] + * dz = coor_surr[idx2,2] - coor_oh2[idx,2] # <<<<<<<<<<<<<< + * dot = dx*dx + dy*dy + dz*dz + * dist = sqrt(dot) + */ + __pyx_t_10 = __pyx_v_idx2; + __pyx_t_19 = 2; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_surr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_surr.shape[1]; + __pyx_t_20 = __pyx_v_idx; + __pyx_t_21 = 2; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_10 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_20 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_21 * __pyx_v_coor_oh2.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":1577 + * dy = coor_surr[idx2,1] - coor_oh2[idx,1] + * dz = coor_surr[idx2,2] - coor_oh2[idx,2] + * dot = dx*dx + dy*dy + dz*dz # <<<<<<<<<<<<<< + * dist = sqrt(dot) + * if dist < maxdist: + */ + __pyx_v_dot = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); + + /* "newanalysis/helpers/helpers.pyx":1578 + * dz = coor_surr[idx2,2] - coor_oh2[idx,2] + * dot = dx*dx + dy*dy + dz*dz + * dist = sqrt(dot) # <<<<<<<<<<<<<< + * if dist < maxdist: + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] + */ + __pyx_v_dist = sqrt(__pyx_v_dot); + + /* "newanalysis/helpers/helpers.pyx":1579 + * dot = dx*dx + dy*dy + dz*dz + * dist = sqrt(dot) + * if dist < maxdist: # <<<<<<<<<<<<<< + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] + */ + __pyx_t_11 = (__pyx_v_dist < __pyx_v_maxdist); + if (__pyx_t_11) { + + /* "newanalysis/helpers/helpers.pyx":1580 + * dist = sqrt(dot) + * if dist < maxdist: + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] # <<<<<<<<<<<<<< + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] + * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] + */ + __pyx_t_21 = __pyx_v_idx3; + __pyx_t_20 = 0; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[1]; + __pyx_t_19 = __pyx_v_idx; + __pyx_t_10 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dx2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_21 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_10 * __pyx_v_coor_oh2.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":1581 + * if dist < maxdist: + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] # <<<<<<<<<<<<<< + * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] + * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 + */ + __pyx_t_10 = __pyx_v_idx3; + __pyx_t_19 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[1]; + __pyx_t_20 = __pyx_v_idx; + __pyx_t_21 = 1; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dy2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_10 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_20 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_21 * __pyx_v_coor_oh2.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":1582 + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] + * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] # <<<<<<<<<<<<<< + * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 + * dist2 = sqrt(dot2) + */ + __pyx_t_21 = __pyx_v_idx3; + __pyx_t_20 = 2; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[1]; + __pyx_t_19 = __pyx_v_idx; + __pyx_t_10 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dz2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_21 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_10 * __pyx_v_coor_oh2.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":1583 + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] + * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] + * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 # <<<<<<<<<<<<<< + * dist2 = sqrt(dot2) + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) + */ + __pyx_v_dot2 = (((__pyx_v_dx2 * __pyx_v_dx2) + (__pyx_v_dy2 * __pyx_v_dy2)) + (__pyx_v_dz2 * __pyx_v_dz2)); + + /* "newanalysis/helpers/helpers.pyx":1584 + * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] + * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 + * dist2 = sqrt(dot2) # <<<<<<<<<<<<<< + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) + * if cosine < -0.95: + */ + __pyx_v_dist2 = sqrt(__pyx_v_dot2); + + /* "newanalysis/helpers/helpers.pyx":1585 + * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 + * dist2 = sqrt(dot2) + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) # <<<<<<<<<<<<<< + * if cosine < -0.95: + * hbond[i] = 1 + */ + __pyx_t_22 = (((__pyx_v_dx * __pyx_v_dx2) + (__pyx_v_dy * __pyx_v_dy2)) + (__pyx_v_dz * __pyx_v_dz2)); + __pyx_t_23 = (__pyx_v_dist * __pyx_v_dist2); + if (unlikely(__pyx_t_23 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 1585, __pyx_L8_error) + } + __pyx_v_cosine = (__pyx_t_22 / __pyx_t_23); + + /* "newanalysis/helpers/helpers.pyx":1586 + * dist2 = sqrt(dot2) + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) + * if cosine < -0.95: # <<<<<<<<<<<<<< + * hbond[i] = 1 + * + */ + __pyx_t_11 = (__pyx_v_cosine < -0.95); + if (__pyx_t_11) { + + /* "newanalysis/helpers/helpers.pyx":1587 + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) + * if cosine < -0.95: + * hbond[i] = 1 # <<<<<<<<<<<<<< + * + * return np.asarray(hbond) + */ + __pyx_t_10 = __pyx_v_i; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_hbond.shape[0]; + *((char *) ( /* dim=0 */ (__pyx_v_hbond.data + __pyx_t_10 * __pyx_v_hbond.strides[0]) )) = 1; + + /* "newanalysis/helpers/helpers.pyx":1586 + * dist2 = sqrt(dot2) + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) + * if cosine < -0.95: # <<<<<<<<<<<<<< + * hbond[i] = 1 + * + */ + } + + /* "newanalysis/helpers/helpers.pyx":1579 + * dot = dx*dx + dy*dy + dz*dz + * dist = sqrt(dot) + * if dist < maxdist: # <<<<<<<<<<<<<< + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] + */ + } + } + + /* "newanalysis/helpers/helpers.pyx":1570 + * # loop over surrounding molecules + * for k in range(nsurr): + * if hbond[i] == 0: # <<<<<<<<<<<<<< + * # loop over oxygen atoms + * for l in range(sites_per_res): + */ + } + } + + /* "newanalysis/helpers/helpers.pyx":1565 + * # loop over h atoms + * for j in range(2): + * if hbond[i] == 0: # <<<<<<<<<<<<<< + * idx = i*3+1+j + * idx3 = i*3 + */ + } + } + + /* "newanalysis/helpers/helpers.pyx":1562 + * # loop over water molecules + * for i in prange(nwat, nogil=True): + * if hbond[i] == 0: # <<<<<<<<<<<<<< + * # loop over h atoms + * for j in range(2): + */ + } + goto __pyx_L22; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L21; + __pyx_L21:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates6) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_cosine; + __pyx_parallel_temp1 = __pyx_v_dist; + __pyx_parallel_temp2 = __pyx_v_dist2; + __pyx_parallel_temp3 = __pyx_v_dot; + __pyx_parallel_temp4 = __pyx_v_dot2; + __pyx_parallel_temp5 = __pyx_v_dx; + __pyx_parallel_temp6 = __pyx_v_dx2; + __pyx_parallel_temp7 = __pyx_v_dy; + __pyx_parallel_temp8 = __pyx_v_dy2; + __pyx_parallel_temp9 = __pyx_v_dz; + __pyx_parallel_temp10 = __pyx_v_dz2; + __pyx_parallel_temp11 = __pyx_v_i; + __pyx_parallel_temp12 = __pyx_v_idx; + __pyx_parallel_temp13 = __pyx_v_idx2; + __pyx_parallel_temp14 = __pyx_v_idx3; + __pyx_parallel_temp15 = __pyx_v_j; + __pyx_parallel_temp16 = __pyx_v_k; + __pyx_parallel_temp17 = __pyx_v_l; + } + __pyx_L22:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP +} +#endif /* _OPENMP */ + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_cosine = __pyx_parallel_temp0; + __pyx_v_dist = __pyx_parallel_temp1; + __pyx_v_dist2 = __pyx_parallel_temp2; + __pyx_v_dot = __pyx_parallel_temp3; + __pyx_v_dot2 = __pyx_parallel_temp4; + __pyx_v_dx = __pyx_parallel_temp5; + __pyx_v_dx2 = __pyx_parallel_temp6; + __pyx_v_dy = __pyx_parallel_temp7; + __pyx_v_dy2 = __pyx_parallel_temp8; + __pyx_v_dz = __pyx_parallel_temp9; + __pyx_v_dz2 = __pyx_parallel_temp10; + __pyx_v_i = __pyx_parallel_temp11; + __pyx_v_idx = __pyx_parallel_temp12; + __pyx_v_idx2 = __pyx_parallel_temp13; + __pyx_v_idx3 = __pyx_parallel_temp14; + __pyx_v_j = __pyx_parallel_temp15; + __pyx_v_k = __pyx_parallel_temp16; + __pyx_v_l = __pyx_parallel_temp17; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/helpers.pyx":1561 + * + * # loop over water molecules + * for i in prange(nwat, nogil=True): # <<<<<<<<<<<<<< + * if hbond[i] == 0: + * # loop over h atoms + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; + } + } + + /* "newanalysis/helpers/helpers.pyx":1589 + * hbond[i] = 1 + * + * return np.asarray(hbond) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_hbond, 1, (PyObject *(*)(char *)) __pyx_memview_get_char, (int (*)(char *, PyObject *)) __pyx_memview_set_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "newanalysis/helpers/helpers.pyx":1548 + * minvec[i,j] = coor_surr[next_id[i],j] - coor_core[i,j] + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def checkHBond(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist): + * # this function is designed only for water hydrogen bonds! + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __Pyx_AddTraceback("newanalysis.helpers.checkHBond", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_hbond, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/helpers.pyx":1591 + * return np.asarray(hbond) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sphHarmMatrix(double [:,:] coor, np.complex128_t [:,:] y_mat, int lmax): + * cdef double r, pol, azi + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_75sphHarmMatrix(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_75sphHarmMatrix = {"sphHarmMatrix", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_75sphHarmMatrix, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_75sphHarmMatrix(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_y_mat = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_lmax; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sphHarmMatrix (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1591, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_y_mat,&__pyx_n_s_lmax,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1591, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_y_mat)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1591, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sphHarmMatrix", 1, 3, 3, 1); __PYX_ERR(0, 1591, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lmax)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1591, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sphHarmMatrix", 1, 3, 3, 2); __PYX_ERR(0, 1591, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sphHarmMatrix") < 0)) __PYX_ERR(0, 1591, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1592, __pyx_L3_error) + __pyx_v_y_mat = __Pyx_PyObject_to_MemoryviewSlice_dsds___pyx_t_double_complex(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_y_mat.memview)) __PYX_ERR(0, 1592, __pyx_L3_error) + __pyx_v_lmax = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_lmax == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1592, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sphHarmMatrix", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1591, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_y_mat, 1); + __Pyx_AddTraceback("newanalysis.helpers.sphHarmMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_74sphHarmMatrix(__pyx_self, __pyx_v_coor, __pyx_v_y_mat, __pyx_v_lmax); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_y_mat, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_7helpers_74sphHarmMatrix(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_y_mat, int __pyx_v_lmax) { + double __pyx_v_r; + double __pyx_v_pol; + double __pyx_v_azi; + int __pyx_v_nat; + int __pyx_v_i; + int __pyx_v_l1; + int __pyx_v_m1; + int __pyx_v_m1r; + int __pyx_v_l2; + int __pyx_v_m2; + int __pyx_v_m2r; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + double __pyx_t_19; + PyObject *__pyx_t_20 = NULL; + int __pyx_t_21; + PyObject *__pyx_t_22 = NULL; + long __pyx_t_23; + long __pyx_t_24; + long __pyx_t_25; + long __pyx_t_26; + int __pyx_t_27; + long __pyx_t_28; + long __pyx_t_29; + int __pyx_t_30; + long __pyx_t_31; + long __pyx_t_32; + int __pyx_t_33; + PyObject *__pyx_t_34 = NULL; + PyObject *__pyx_t_35 = NULL; + int __pyx_t_36; + PyObject *__pyx_t_37 = NULL; + PyObject *__pyx_t_38 = NULL; + PyObject *__pyx_t_39 = NULL; + __pyx_t_double_complex __pyx_t_40; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sphHarmMatrix", 0); + + /* "newanalysis/helpers/helpers.pyx":1594 + * def sphHarmMatrix(double [:,:] coor, np.complex128_t [:,:] y_mat, int lmax): + * cdef double r, pol, azi + * cdef int nat = coor.shape[0], i, l1, m1, m1r, l2, m2, m2r # <<<<<<<<<<<<<< + * + * for i in range(nat): + */ + __pyx_v_nat = (__pyx_v_coor.shape[0]); + + /* "newanalysis/helpers/helpers.pyx":1596 + * cdef int nat = coor.shape[0], i, l1, m1, m1r, l2, m2, m2r + * + * for i in range(nat): # <<<<<<<<<<<<<< + * r = sqrt(coor[i,0]*coor[i,0] + coor[i,1]*coor[i,1] + coor[i,2]*coor[i,2]) + * pol = np.arccos(coor[i,2] / r) + */ + __pyx_t_1 = __pyx_v_nat; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "newanalysis/helpers/helpers.pyx":1597 + * + * for i in range(nat): + * r = sqrt(coor[i,0]*coor[i,0] + coor[i,1]*coor[i,1] + coor[i,2]*coor[i,2]) # <<<<<<<<<<<<<< + * pol = np.arccos(coor[i,2] / r) + * azi = np.arctan2(coor[i,1] , coor[i,0]) + */ + __pyx_t_4 = __pyx_v_i; + __pyx_t_5 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[0]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor.shape[1]; + __pyx_t_6 = __pyx_v_i; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor.shape[1]; + __pyx_t_8 = __pyx_v_i; + __pyx_t_9 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; + __pyx_t_12 = __pyx_v_i; + __pyx_t_13 = 2; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[1]; + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = 2; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; + __pyx_v_r = sqrt(((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_4 * __pyx_v_coor.strides[0]) ) + __pyx_t_5 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_6 * __pyx_v_coor.strides[0]) ) + __pyx_t_7 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) )))))); + + /* "newanalysis/helpers/helpers.pyx":1598 + * for i in range(nat): + * r = sqrt(coor[i,0]*coor[i,0] + coor[i,1]*coor[i,1] + coor[i,2]*coor[i,2]) + * pol = np.arccos(coor[i,2] / r) # <<<<<<<<<<<<<< + * azi = np.arctan2(coor[i,1] , coor[i,0]) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_arccos); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_15 = __pyx_v_i; + __pyx_t_14 = 2; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; + __pyx_t_19 = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) ))); + if (unlikely(__pyx_v_r == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 1598, __pyx_L1_error) + } + __pyx_t_17 = PyFloat_FromDouble((__pyx_t_19 / __pyx_v_r)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_20 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_18))) { + __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_18); + if (likely(__pyx_t_20)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18); + __Pyx_INCREF(__pyx_t_20); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_18, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_20, __pyx_t_17}; + __pyx_t_16 = __Pyx_PyObject_FastCall(__pyx_t_18, __pyx_callargs+1-__pyx_t_21, 1+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } + __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_19 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1598, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_v_pol = __pyx_t_19; + + /* "newanalysis/helpers/helpers.pyx":1599 + * r = sqrt(coor[i,0]*coor[i,0] + coor[i,1]*coor[i,1] + coor[i,2]*coor[i,2]) + * pol = np.arccos(coor[i,2] / r) + * azi = np.arctan2(coor[i,1] , coor[i,0]) # <<<<<<<<<<<<<< + * + * for l1 in range(lmax+1): + */ + __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_np); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_arctan2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = 1; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; + __pyx_t_18 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) )))); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_15 = __pyx_v_i; + __pyx_t_14 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; + __pyx_t_20 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )))); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_22 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_17))) { + __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_17); + if (likely(__pyx_t_22)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); + __Pyx_INCREF(__pyx_t_22); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_17, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_22, __pyx_t_18, __pyx_t_20}; + __pyx_t_16 = __Pyx_PyObject_FastCall(__pyx_t_17, __pyx_callargs+1-__pyx_t_21, 2+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } + __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_19 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1599, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_v_azi = __pyx_t_19; + + /* "newanalysis/helpers/helpers.pyx":1601 + * azi = np.arctan2(coor[i,1] , coor[i,0]) + * + * for l1 in range(lmax+1): # <<<<<<<<<<<<<< + * for m1 in range(2*l1+1): + * m1r = m1 - l1 + */ + __pyx_t_23 = (__pyx_v_lmax + 1); + __pyx_t_24 = __pyx_t_23; + for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_24; __pyx_t_21+=1) { + __pyx_v_l1 = __pyx_t_21; + + /* "newanalysis/helpers/helpers.pyx":1602 + * + * for l1 in range(lmax+1): + * for m1 in range(2*l1+1): # <<<<<<<<<<<<<< + * m1r = m1 - l1 + * for l2 in range(lmax+1): + */ + __pyx_t_25 = ((2 * __pyx_v_l1) + 1); + __pyx_t_26 = __pyx_t_25; + for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) { + __pyx_v_m1 = __pyx_t_27; + + /* "newanalysis/helpers/helpers.pyx":1603 + * for l1 in range(lmax+1): + * for m1 in range(2*l1+1): + * m1r = m1 - l1 # <<<<<<<<<<<<<< + * for l2 in range(lmax+1): + * for m2 in range(2*l2+1): + */ + __pyx_v_m1r = (__pyx_v_m1 - __pyx_v_l1); + + /* "newanalysis/helpers/helpers.pyx":1604 + * for m1 in range(2*l1+1): + * m1r = m1 - l1 + * for l2 in range(lmax+1): # <<<<<<<<<<<<<< + * for m2 in range(2*l2+1): + * m2r = m2 - l2 + */ + __pyx_t_28 = (__pyx_v_lmax + 1); + __pyx_t_29 = __pyx_t_28; + for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) { + __pyx_v_l2 = __pyx_t_30; + + /* "newanalysis/helpers/helpers.pyx":1605 + * m1r = m1 - l1 + * for l2 in range(lmax+1): + * for m2 in range(2*l2+1): # <<<<<<<<<<<<<< + * m2r = m2 - l2 + * y_mat[2*l1+m1,2*l2+m2] += sph_harm(m1r,l1,azi,pol) * np.conjugate(sph_harm(m2r,l2,azi,pol)) + */ + __pyx_t_31 = ((2 * __pyx_v_l2) + 1); + __pyx_t_32 = __pyx_t_31; + for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) { + __pyx_v_m2 = __pyx_t_33; + + /* "newanalysis/helpers/helpers.pyx":1606 + * for l2 in range(lmax+1): + * for m2 in range(2*l2+1): + * m2r = m2 - l2 # <<<<<<<<<<<<<< + * y_mat[2*l1+m1,2*l2+m2] += sph_harm(m1r,l1,azi,pol) * np.conjugate(sph_harm(m2r,l2,azi,pol)) + * + */ + __pyx_v_m2r = (__pyx_v_m2 - __pyx_v_l2); + + /* "newanalysis/helpers/helpers.pyx":1607 + * for m2 in range(2*l2+1): + * m2r = m2 - l2 + * y_mat[2*l1+m1,2*l2+m2] += sph_harm(m1r,l1,azi,pol) * np.conjugate(sph_harm(m2r,l2,azi,pol)) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_sph_harm); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_m1r); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_l1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_22 = PyFloat_FromDouble(__pyx_v_azi); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_34 = PyFloat_FromDouble(__pyx_v_pol); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_34); + __pyx_t_35 = NULL; + __pyx_t_36 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_17))) { + __pyx_t_35 = PyMethod_GET_SELF(__pyx_t_17); + if (likely(__pyx_t_35)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); + __Pyx_INCREF(__pyx_t_35); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_17, function); + __pyx_t_36 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[5] = {__pyx_t_35, __pyx_t_20, __pyx_t_18, __pyx_t_22, __pyx_t_34}; + __pyx_t_16 = __Pyx_PyObject_FastCall(__pyx_t_17, __pyx_callargs+1-__pyx_t_36, 4+__pyx_t_36); + __Pyx_XDECREF(__pyx_t_35); __pyx_t_35 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } + __Pyx_GetModuleGlobalName(__pyx_t_34, __pyx_n_s_np); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_34); + __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_t_34, __pyx_n_s_conjugate); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_sph_harm); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_m2r); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_35 = __Pyx_PyInt_From_int(__pyx_v_l2); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_35); + __pyx_t_37 = PyFloat_FromDouble(__pyx_v_azi); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_37); + __pyx_t_38 = PyFloat_FromDouble(__pyx_v_pol); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_38); + __pyx_t_39 = NULL; + __pyx_t_36 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_18))) { + __pyx_t_39 = PyMethod_GET_SELF(__pyx_t_18); + if (likely(__pyx_t_39)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18); + __Pyx_INCREF(__pyx_t_39); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_18, function); + __pyx_t_36 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[5] = {__pyx_t_39, __pyx_t_20, __pyx_t_35, __pyx_t_37, __pyx_t_38}; + __pyx_t_34 = __Pyx_PyObject_FastCall(__pyx_t_18, __pyx_callargs+1-__pyx_t_36, 4+__pyx_t_36); + __Pyx_XDECREF(__pyx_t_39); __pyx_t_39 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0; + __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; + __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0; + if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_34); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } + __pyx_t_18 = NULL; + __pyx_t_36 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_22))) { + __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_22); + if (likely(__pyx_t_18)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22); + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_22, function); + __pyx_t_36 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_18, __pyx_t_34}; + __pyx_t_17 = __Pyx_PyObject_FastCall(__pyx_t_22, __pyx_callargs+1-__pyx_t_36, 1+__pyx_t_36); + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0; + if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + } + __pyx_t_22 = PyNumber_Multiply(__pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_40 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_22); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1607, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __pyx_t_14 = ((2 * __pyx_v_l1) + __pyx_v_m1); + __pyx_t_15 = ((2 * __pyx_v_l2) + __pyx_v_m2); + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_y_mat.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_y_mat.shape[1]; + *((__pyx_t_double_complex *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_y_mat.data + __pyx_t_14 * __pyx_v_y_mat.strides[0]) ) + __pyx_t_15 * __pyx_v_y_mat.strides[1]) )) += __pyx_t_40; + } + } + } + } + } + + /* "newanalysis/helpers/helpers.pyx":1591 + * return np.asarray(hbond) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sphHarmMatrix(double [:,:] coor, np.complex128_t [:,:] y_mat, int lmax): + * cdef double r, pol, azi + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_XDECREF(__pyx_t_34); + __Pyx_XDECREF(__pyx_t_35); + __Pyx_XDECREF(__pyx_t_37); + __Pyx_XDECREF(__pyx_t_38); + __Pyx_XDECREF(__pyx_t_39); + __Pyx_AddTraceback("newanalysis.helpers.sphHarmMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/helpers.pyx":1609 + * y_mat[2*l1+m1,2*l2+m2] += sph_harm(m1r,l1,azi,pol) * np.conjugate(sph_harm(m2r,l2,azi,pol)) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcFourierLaplaceTransform(double [:] data_x, double [:] data_y, double w): + * cdef double wt, wt1 + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_77calcFourierLaplaceTransform(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_77calcFourierLaplaceTransform = {"calcFourierLaplaceTransform", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_77calcFourierLaplaceTransform, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_7helpers_77calcFourierLaplaceTransform(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_data_x = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_data_y = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_w; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcFourierLaplaceTransform (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1609, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data_x,&__pyx_n_s_data_y,&__pyx_n_s_w,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data_x)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data_y)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcFourierLaplaceTransform", 1, 3, 3, 1); __PYX_ERR(0, 1609, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_w)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcFourierLaplaceTransform", 1, 3, 3, 2); __PYX_ERR(0, 1609, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcFourierLaplaceTransform") < 0)) __PYX_ERR(0, 1609, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_data_x = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data_x.memview)) __PYX_ERR(0, 1610, __pyx_L3_error) + __pyx_v_data_y = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data_y.memview)) __PYX_ERR(0, 1610, __pyx_L3_error) + __pyx_v_w = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_w == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1610, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcFourierLaplaceTransform", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1609, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_data_x, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_data_y, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcFourierLaplaceTransform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_76calcFourierLaplaceTransform(__pyx_self, __pyx_v_data_x, __pyx_v_data_y, __pyx_v_w); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_data_x, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_data_y, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_7helpers_76calcFourierLaplaceTransform(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_data_x, __Pyx_memviewslice __pyx_v_data_y, double __pyx_v_w) { + double __pyx_v_wt; + double __pyx_v_wt1; + double __pyx_v_dt; + double __pyx_v_laplace_re; + double __pyx_v_laplace_im; + int __pyx_v_i; + int __pyx_v_n; + __Pyx_memviewslice __pyx_v_transform = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcFourierLaplaceTransform", 0); + + /* "newanalysis/helpers/helpers.pyx":1612 + * def calcFourierLaplaceTransform(double [:] data_x, double [:] data_y, double w): + * cdef double wt, wt1 + * cdef double dt = data_x[1] - data_x[0] # <<<<<<<<<<<<<< + * cdef double laplace_re = 0.0 + * cdef double laplace_im = 0.0 + */ + __pyx_t_1 = 1; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_data_x.shape[0]; + __pyx_t_2 = 0; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_data_x.shape[0]; + __pyx_v_dt = ((*((double *) ( /* dim=0 */ (__pyx_v_data_x.data + __pyx_t_1 * __pyx_v_data_x.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_data_x.data + __pyx_t_2 * __pyx_v_data_x.strides[0]) )))); + + /* "newanalysis/helpers/helpers.pyx":1613 + * cdef double wt, wt1 + * cdef double dt = data_x[1] - data_x[0] + * cdef double laplace_re = 0.0 # <<<<<<<<<<<<<< + * cdef double laplace_im = 0.0 + * cdef int i + */ + __pyx_v_laplace_re = 0.0; + + /* "newanalysis/helpers/helpers.pyx":1614 + * cdef double dt = data_x[1] - data_x[0] + * cdef double laplace_re = 0.0 + * cdef double laplace_im = 0.0 # <<<<<<<<<<<<<< + * cdef int i + * cdef int n = data_x.shape[0]-1 + */ + __pyx_v_laplace_im = 0.0; + + /* "newanalysis/helpers/helpers.pyx":1616 + * cdef double laplace_im = 0.0 + * cdef int i + * cdef int n = data_x.shape[0]-1 # <<<<<<<<<<<<<< + * cdef double [:,:] transform = np.zeros((n,2)) + * + */ + __pyx_v_n = ((__pyx_v_data_x.shape[0]) - 1); + + /* "newanalysis/helpers/helpers.pyx":1617 + * cdef int i + * cdef int n = data_x.shape[0]-1 + * cdef double [:,:] transform = np.zeros((n,2)) # <<<<<<<<<<<<<< + * + * for i in prange(n, nogil=True): + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4)) __PYX_ERR(0, 1617, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_2)) __PYX_ERR(0, 1617, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1617, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_transform = __pyx_t_8; + __pyx_t_8.memview = NULL; + __pyx_t_8.data = NULL; + + /* "newanalysis/helpers/helpers.pyx":1619 + * cdef double [:,:] transform = np.zeros((n,2)) + * + * for i in prange(n, nogil=True): # <<<<<<<<<<<<<< + * wt = w*data_x[i] + * wt1 = w*data_x[i+1] + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_7 = __pyx_v_n; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_10 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_10 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_1, __pyx_t_11, __pyx_t_12, __pyx_t_2) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_wt) lastprivate(__pyx_v_wt1) + #endif /* _OPENMP */ + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_9); + /* Initialize private variables to invalid values */ + __pyx_v_wt = ((double)__PYX_NAN()); + __pyx_v_wt1 = ((double)__PYX_NAN()); + + /* "newanalysis/helpers/helpers.pyx":1620 + * + * for i in prange(n, nogil=True): + * wt = w*data_x[i] # <<<<<<<<<<<<<< + * wt1 = w*data_x[i+1] + * + */ + __pyx_t_2 = __pyx_v_i; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_data_x.shape[0]; + __pyx_v_wt = (__pyx_v_w * (*((double *) ( /* dim=0 */ (__pyx_v_data_x.data + __pyx_t_2 * __pyx_v_data_x.strides[0]) )))); + + /* "newanalysis/helpers/helpers.pyx":1621 + * for i in prange(n, nogil=True): + * wt = w*data_x[i] + * wt1 = w*data_x[i+1] # <<<<<<<<<<<<<< + * + * transform[i,0] = (cos(wt)*data_y[i] + cos(wt1)*data_y[i+1])*0.5*dt + */ + __pyx_t_2 = (__pyx_v_i + 1); + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_data_x.shape[0]; + __pyx_v_wt1 = (__pyx_v_w * (*((double *) ( /* dim=0 */ (__pyx_v_data_x.data + __pyx_t_2 * __pyx_v_data_x.strides[0]) )))); + + /* "newanalysis/helpers/helpers.pyx":1623 + * wt1 = w*data_x[i+1] + * + * transform[i,0] = (cos(wt)*data_y[i] + cos(wt1)*data_y[i+1])*0.5*dt # <<<<<<<<<<<<<< + * transform[i,1] = (sin(wt)*data_y[i] + sin(wt1)*data_y[i+1])*0.5*dt + * + */ + __pyx_t_2 = __pyx_v_i; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_data_y.shape[0]; + __pyx_t_1 = (__pyx_v_i + 1); + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_data_y.shape[0]; + __pyx_t_11 = __pyx_v_i; + __pyx_t_12 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_transform.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_transform.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_transform.data + __pyx_t_11 * __pyx_v_transform.strides[0]) ) + __pyx_t_12 * __pyx_v_transform.strides[1]) )) = ((((cos(__pyx_v_wt) * (*((double *) ( /* dim=0 */ (__pyx_v_data_y.data + __pyx_t_2 * __pyx_v_data_y.strides[0]) )))) + (cos(__pyx_v_wt1) * (*((double *) ( /* dim=0 */ (__pyx_v_data_y.data + __pyx_t_1 * __pyx_v_data_y.strides[0]) ))))) * 0.5) * __pyx_v_dt); + + /* "newanalysis/helpers/helpers.pyx":1624 + * + * transform[i,0] = (cos(wt)*data_y[i] + cos(wt1)*data_y[i+1])*0.5*dt + * transform[i,1] = (sin(wt)*data_y[i] + sin(wt1)*data_y[i+1])*0.5*dt # <<<<<<<<<<<<<< + * + * for i in range(n): + */ + __pyx_t_1 = __pyx_v_i; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_data_y.shape[0]; + __pyx_t_2 = (__pyx_v_i + 1); + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_data_y.shape[0]; + __pyx_t_12 = __pyx_v_i; + __pyx_t_11 = 1; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_transform.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_transform.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_transform.data + __pyx_t_12 * __pyx_v_transform.strides[0]) ) + __pyx_t_11 * __pyx_v_transform.strides[1]) )) = ((((sin(__pyx_v_wt) * (*((double *) ( /* dim=0 */ (__pyx_v_data_y.data + __pyx_t_1 * __pyx_v_data_y.strides[0]) )))) + (sin(__pyx_v_wt1) * (*((double *) ( /* dim=0 */ (__pyx_v_data_y.data + __pyx_t_2 * __pyx_v_data_y.strides[0]) ))))) * 0.5) * __pyx_v_dt); + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/helpers.pyx":1619 + * cdef double [:,:] transform = np.zeros((n,2)) + * + * for i in prange(n, nogil=True): # <<<<<<<<<<<<<< + * wt = w*data_x[i] + * wt1 = w*data_x[i+1] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "newanalysis/helpers/helpers.pyx":1626 + * transform[i,1] = (sin(wt)*data_y[i] + sin(wt1)*data_y[i+1])*0.5*dt + * + * for i in range(n): # <<<<<<<<<<<<<< + * laplace_re += transform[i,0] + * laplace_im += transform[i,1] + */ + __pyx_t_10 = __pyx_v_n; + __pyx_t_9 = __pyx_t_10; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_9; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "newanalysis/helpers/helpers.pyx":1627 + * + * for i in range(n): + * laplace_re += transform[i,0] # <<<<<<<<<<<<<< + * laplace_im += transform[i,1] + * + */ + __pyx_t_2 = __pyx_v_i; + __pyx_t_1 = 0; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_transform.shape[0]; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_transform.shape[1]; + __pyx_v_laplace_re = (__pyx_v_laplace_re + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_transform.data + __pyx_t_2 * __pyx_v_transform.strides[0]) ) + __pyx_t_1 * __pyx_v_transform.strides[1]) )))); + + /* "newanalysis/helpers/helpers.pyx":1628 + * for i in range(n): + * laplace_re += transform[i,0] + * laplace_im += transform[i,1] # <<<<<<<<<<<<<< + * + * return float(laplace_re), float(laplace_im) + */ + __pyx_t_1 = __pyx_v_i; + __pyx_t_2 = 1; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_transform.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_transform.shape[1]; + __pyx_v_laplace_im = (__pyx_v_laplace_im + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_transform.data + __pyx_t_1 * __pyx_v_transform.strides[0]) ) + __pyx_t_2 * __pyx_v_transform.strides[1]) )))); + } + + /* "newanalysis/helpers/helpers.pyx":1630 + * laplace_im += transform[i,1] + * + * return float(laplace_re), float(laplace_im) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_laplace_re); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_laplace_im); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3)) __PYX_ERR(0, 1630, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5)) __PYX_ERR(0, 1630, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "newanalysis/helpers/helpers.pyx":1609 + * y_mat[2*l1+m1,2*l2+m2] += sph_harm(m1r,l1,azi,pol) * np.conjugate(sph_harm(m2r,l2,azi,pol)) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcFourierLaplaceTransform(double [:] data_x, double [:] data_y, double w): + * cdef double wt, wt1 + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcFourierLaplaceTransform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_transform, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/helpers.pyx":1632 + * return float(laplace_re), float(laplace_im) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcRotationMatrix(double [:,:] coorA, double [:,:] coorB): + * """ + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_79calcRotationMatrix(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_78calcRotationMatrix, "\n calcRotationMatrix(coor,coorA,coorB)\n\n Applies the Berthold-Horn-algorithm to a set of coordinates xyz, inplace.\n\n Args:\n coor .. coordinates of all atoms\n coorA .. template coordinates\n coorB .. corresponding coordinates of the current frame\n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_79calcRotationMatrix = {"calcRotationMatrix", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_79calcRotationMatrix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_78calcRotationMatrix}; +static PyObject *__pyx_pw_11newanalysis_7helpers_79calcRotationMatrix(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coorA = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coorB = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcRotationMatrix (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1632, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coorA,&__pyx_n_s_coorB,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coorA)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1632, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coorB)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1632, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcRotationMatrix", 1, 2, 2, 1); __PYX_ERR(0, 1632, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcRotationMatrix") < 0)) __PYX_ERR(0, 1632, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_coorA = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorA.memview)) __PYX_ERR(0, 1633, __pyx_L3_error) + __pyx_v_coorB = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorB.memview)) __PYX_ERR(0, 1633, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcRotationMatrix", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1632, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorA, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorB, 1); + __Pyx_AddTraceback("newanalysis.helpers.calcRotationMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_78calcRotationMatrix(__pyx_self, __pyx_v_coorA, __pyx_v_coorB); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorA, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorB, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_7helpers_78calcRotationMatrix(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coorA, __Pyx_memviewslice __pyx_v_coorB) { + __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcRotationMatrix", 0); + + /* "newanalysis/helpers/helpers.pyx":1644 + * coorB .. corresponding coordinates of the current frame + * """ + * cdef double [:,:] R = np.zeros((3,3)) # <<<<<<<<<<<<<< + * + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_tuple__11}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1644, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_R = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; + + /* "newanalysis/helpers/helpers.pyx":1646 + * cdef double [:,:] R = np.zeros((3,3)) + * + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) # <<<<<<<<<<<<<< + * + * return np.asarray(R) + */ + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[1]; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coorA.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coorA.shape[1]; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coorB.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coorB.shape[1]; + GetRotation((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_6 * __pyx_v_R.strides[0]) ) + __pyx_t_7 * __pyx_v_R.strides[1]) )))), (__pyx_v_coorA.shape[0]), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorA.data + __pyx_t_8 * __pyx_v_coorA.strides[0]) ) + __pyx_t_9 * __pyx_v_coorA.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorB.data + __pyx_t_10 * __pyx_v_coorB.strides[0]) ) + __pyx_t_11 * __pyx_v_coorB.strides[1]) )))), 0); + + /* "newanalysis/helpers/helpers.pyx":1648 + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) + * + * return np.asarray(R) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_R, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "newanalysis/helpers/helpers.pyx":1632 + * return float(laplace_re), float(laplace_im) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcRotationMatrix(double [:,:] coorA, double [:,:] coorB): + * """ + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("newanalysis.helpers.calcRotationMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_R, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/helpers.pyx":1650 + * return np.asarray(R) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def applyRotationMatrix(double [:,:] coor, double [:,:] R): + * """ + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_7helpers_81applyRotationMatrix(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_7helpers_80applyRotationMatrix, "\n calcRotationMatrix(coor,coorA,coorB)\n\n Applies the Berthold-Horn-algorithm to a set of coordinates xyz, inplace.\n\n Args:\n coor .. coordinates of all atoms\n coorA .. template coordinates\n coorB .. corresponding coordinates of the current frame\n "); +static PyMethodDef __pyx_mdef_11newanalysis_7helpers_81applyRotationMatrix = {"applyRotationMatrix", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_7helpers_81applyRotationMatrix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_7helpers_80applyRotationMatrix}; +static PyObject *__pyx_pw_11newanalysis_7helpers_81applyRotationMatrix(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("applyRotationMatrix (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1650, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_R,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1650, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_R)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1650, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("applyRotationMatrix", 1, 2, 2, 1); __PYX_ERR(0, 1650, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "applyRotationMatrix") < 0)) __PYX_ERR(0, 1650, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1651, __pyx_L3_error) + __pyx_v_R = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_R.memview)) __PYX_ERR(0, 1651, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("applyRotationMatrix", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1650, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_R, 1); + __Pyx_AddTraceback("newanalysis.helpers.applyRotationMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_7helpers_80applyRotationMatrix(__pyx_self, __pyx_v_coor, __pyx_v_R); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_R, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_7helpers_80applyRotationMatrix(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_R) { + CYTHON_UNUSED int __pyx_v_N; + double __pyx_v_tmpx; + double __pyx_v_tmpy; + double __pyx_v_tmpz; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + __Pyx_RefNannySetupContext("applyRotationMatrix", 0); + + /* "newanalysis/helpers/helpers.pyx":1662 + * coorB .. corresponding coordinates of the current frame + * """ + * cdef int N = coor.shape[0] # <<<<<<<<<<<<<< + * cdef double tmpx, tmpy, tmpz + * cdef int i + */ + __pyx_v_N = (__pyx_v_coor.shape[0]); + + /* "newanalysis/helpers/helpers.pyx":1666 + * cdef int i + * + * for i in prange(N, nogil=True): # <<<<<<<<<<<<<< + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_1 = __pyx_v_N; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_3 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_tmpx) lastprivate(__pyx_v_tmpy) lastprivate(__pyx_v_tmpz) + #endif /* _OPENMP */ + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_2); + /* Initialize private variables to invalid values */ + __pyx_v_tmpx = ((double)__PYX_NAN()); + __pyx_v_tmpy = ((double)__PYX_NAN()); + __pyx_v_tmpz = ((double)__PYX_NAN()); + + /* "newanalysis/helpers/helpers.pyx":1667 + * + * for i in prange(N, nogil=True): + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] # <<<<<<<<<<<<<< + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + */ + __pyx_t_4 = 0; + __pyx_t_5 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_R.shape[0]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_R.shape[1]; + __pyx_t_6 = __pyx_v_i; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor.shape[1]; + __pyx_t_8 = 0; + __pyx_t_9 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_R.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[1]; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; + __pyx_t_12 = 0; + __pyx_t_13 = 2; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_R.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_R.shape[1]; + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = 2; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; + __pyx_v_tmpx = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_4 * __pyx_v_R.strides[0]) ) + __pyx_t_5 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_6 * __pyx_v_coor.strides[0]) ) + __pyx_t_7 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_8 * __pyx_v_R.strides[0]) ) + __pyx_t_9 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_12 * __pyx_v_R.strides[0]) ) + __pyx_t_13 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) ))))); + + /* "newanalysis/helpers/helpers.pyx":1668 + * for i in prange(N, nogil=True): + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] # <<<<<<<<<<<<<< + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx + */ + __pyx_t_15 = 1; + __pyx_t_14 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_R.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_R.shape[1]; + __pyx_t_13 = __pyx_v_i; + __pyx_t_12 = 0; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[1]; + __pyx_t_11 = 1; + __pyx_t_10 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_R.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_R.shape[1]; + __pyx_t_9 = __pyx_v_i; + __pyx_t_8 = 1; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[1]; + __pyx_t_7 = 1; + __pyx_t_6 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[1]; + __pyx_t_5 = __pyx_v_i; + __pyx_t_4 = 2; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; + __pyx_v_tmpy = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_15 * __pyx_v_R.strides[0]) ) + __pyx_t_14 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_13 * __pyx_v_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_11 * __pyx_v_R.strides[0]) ) + __pyx_t_10 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_8 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_7 * __pyx_v_R.strides[0]) ) + __pyx_t_6 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_5 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) ))))); + + /* "newanalysis/helpers/helpers.pyx":1669 + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] # <<<<<<<<<<<<<< + * coor[i,0] = tmpx + * coor[i,1] = tmpy + */ + __pyx_t_4 = 2; + __pyx_t_5 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_R.shape[0]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_R.shape[1]; + __pyx_t_6 = __pyx_v_i; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor.shape[1]; + __pyx_t_8 = 2; + __pyx_t_9 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_R.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[1]; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; + __pyx_t_12 = 2; + __pyx_t_13 = 2; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_R.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_R.shape[1]; + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = 2; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; + __pyx_v_tmpz = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_4 * __pyx_v_R.strides[0]) ) + __pyx_t_5 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_6 * __pyx_v_coor.strides[0]) ) + __pyx_t_7 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_8 * __pyx_v_R.strides[0]) ) + __pyx_t_9 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_12 * __pyx_v_R.strides[0]) ) + __pyx_t_13 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) ))))); + + /* "newanalysis/helpers/helpers.pyx":1670 + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx # <<<<<<<<<<<<<< + * coor[i,1] = tmpy + * coor[i,2] = tmpz + */ + __pyx_t_15 = __pyx_v_i; + __pyx_t_14 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpx; + + /* "newanalysis/helpers/helpers.pyx":1671 + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx + * coor[i,1] = tmpy # <<<<<<<<<<<<<< + * coor[i,2] = tmpz + */ + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = 1; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpy; + + /* "newanalysis/helpers/helpers.pyx":1672 + * coor[i,0] = tmpx + * coor[i,1] = tmpy + * coor[i,2] = tmpz # <<<<<<<<<<<<<< + */ + __pyx_t_15 = __pyx_v_i; + __pyx_t_14 = 2; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_14 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpz; + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/helpers.pyx":1666 + * cdef int i + * + * for i in prange(N, nogil=True): # <<<<<<<<<<<<<< + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } + + /* "newanalysis/helpers/helpers.pyx":1650 + * return np.asarray(R) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def applyRotationMatrix(double [:,:] coor, double [:,:] R): + * """ + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} +static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "newanalysis.helpers.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.helpers.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ #endif 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -41526,7 +48234,7 @@ static PyTypeObject __pyx_type___pyx_array = { __pyx_tp_getattro_array, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ @@ -41541,7 +48249,9 @@ static PyTypeObject __pyx_type___pyx_array = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_array, /*tp_new*/ @@ -41555,28 +48265,41 @@ static PyTypeObject __pyx_type___pyx_array = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_MemviewEnum_obj *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_MemviewEnum_obj *)o); p->name = Py_None; Py_INCREF(Py_None); return o; @@ -41585,13 +48308,22 @@ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, C static void __pyx_tp_dealloc_Enum(PyObject *o) { struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); Py_CLEAR(p->name); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { @@ -41612,15 +48344,39 @@ static int __pyx_tp_clear_Enum(PyObject *o) { return 0; } +static PyObject *__pyx_specialmethod___pyx_MemviewEnum___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_MemviewEnum___repr__(self); +} + static PyMethodDef __pyx_methods_Enum[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0}, + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_MemviewEnum___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "newanalysis.helpers.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_MemviewEnum_slots, +}; +#else static PyTypeObject __pyx_type___pyx_MemviewEnum = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.helpers.Enum", /*tp_name*/ + "newanalysis.helpers.""Enum", /*tp_name*/ sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_Enum, /*tp_dealloc*/ @@ -41663,7 +48419,9 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif __pyx_MemviewEnum___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_Enum, /*tp_new*/ @@ -41677,29 +48435,42 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_memoryview_obj *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_memoryview_obj *)o); p->__pyx_vtab = __pyx_vtabptr_memoryview; p->obj = Py_None; Py_INCREF(Py_None); @@ -41716,8 +48487,10 @@ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject static void __pyx_tp_dealloc_memoryview(PyObject *o) { struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -41732,7 +48505,14 @@ static void __pyx_tp_dealloc_memoryview(PyObject *o) { Py_CLEAR(p->obj); Py_CLEAR(p->_size); Py_CLEAR(p->_array_interface); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { @@ -41781,8 +48561,11 @@ static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject return __pyx_memoryview___setitem__(o, i, v); } else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); return -1; } } @@ -41823,13 +48606,18 @@ static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); } +static PyObject *__pyx_specialmethod___pyx_memoryview___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_memoryview___repr__(self); +} + static PyMethodDef __pyx_methods_memoryview[] = { - {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0}, - {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0}, - {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0}, - {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0}, + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_memoryview___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"is_c_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -41845,6 +48633,53 @@ static struct PyGetSetDef __pyx_getsets_memoryview[] = { {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "newanalysis.helpers.memoryview", + sizeof(struct __pyx_memoryview_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_memoryview_slots, +}; +#else static PySequenceMethods __pyx_tp_as_sequence_memoryview = { __pyx_memoryview___len__, /*sq_length*/ @@ -41884,7 +48719,7 @@ static PyBufferProcs __pyx_tp_as_buffer_memoryview = { static PyTypeObject __pyx_type___pyx_memoryview = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.helpers.memoryview", /*tp_name*/ + "newanalysis.helpers.""memoryview", /*tp_name*/ sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ @@ -41927,7 +48762,9 @@ static PyTypeObject __pyx_type___pyx_memoryview = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_memoryview, /*tp_new*/ @@ -41941,18 +48778,26 @@ static PyTypeObject __pyx_type___pyx_memoryview = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { @@ -41961,6 +48806,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO if (unlikely(!o)) return 0; p = ((struct __pyx_memoryviewslice_obj *)o); p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + new((void*)&(p->from_slice)) __Pyx_memviewslice(); p->from_object = Py_None; Py_INCREF(Py_None); p->from_slice.memview = NULL; return o; @@ -41969,8 +48815,10 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -41982,6 +48830,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } + __Pyx_call_destructor(p->from_slice); Py_CLEAR(p->from_object); PyObject_GC_Track(o); __pyx_tp_dealloc_memoryview(o); @@ -42004,28 +48853,37 @@ static int __pyx_tp_clear__memoryviewslice(PyObject *o) { tmp = ((PyObject*)p->from_object); p->from_object = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - __PYX_XDEC_MEMVIEW(&p->from_slice, 1); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); return 0; } -static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o); -} - static PyMethodDef __pyx_methods__memoryviewslice[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; - -static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = { - {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "newanalysis.helpers._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, }; +#else static PyTypeObject __pyx_type___pyx_memoryviewslice = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.helpers._memoryviewslice", /*tp_name*/ + "newanalysis.helpers.""_memoryviewslice", /*tp_name*/ sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ @@ -42043,7 +48901,7 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif - #if CYTHON_COMPILING_IN_PYPY + #if CYTHON_COMPILING_IN_PYPY || 0 __pyx_memoryview___repr__, /*tp_repr*/ #else 0, /*tp_repr*/ @@ -42053,7 +48911,7 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY + #if CYTHON_COMPILING_IN_PYPY || 0 __pyx_memoryview___str__, /*tp_str*/ #else 0, /*tp_str*/ @@ -42061,8 +48919,8 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Internal class for passing memoryview slices to Python", /*tp_doc*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ __pyx_tp_clear__memoryviewslice, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -42071,12 +48929,14 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_iternext*/ __pyx_methods__memoryviewslice, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets__memoryviewslice, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new__memoryviewslice, /*tp_new*/ @@ -42090,54 +48950,30 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_helpers(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_helpers}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "helpers", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE @@ -42147,1033 +48983,1021 @@ static struct PyModuleDef __pyx_moduledef = { #define CYTHON_SMALL_CODE #endif #endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1}, - {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, - {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1}, - {&__pyx_n_s_B1, __pyx_k_B1, sizeof(__pyx_k_B1), 0, 0, 1, 1}, - {&__pyx_n_s_B2, __pyx_k_B2, sizeof(__pyx_k_B2), 0, 0, 1, 1}, - {&__pyx_n_s_B3, __pyx_k_B3, sizeof(__pyx_k_B3), 0, 0, 1, 1}, - {&__pyx_n_s_B_out, __pyx_k_B_out, sizeof(__pyx_k_B_out), 0, 0, 1, 1}, - {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, - {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0}, - {&__pyx_n_s_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 0, 1, 1}, - {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, - {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, - {&__pyx_n_s_Exx, __pyx_k_Exx, sizeof(__pyx_k_Exx), 0, 0, 1, 1}, - {&__pyx_n_s_Eyy, __pyx_k_Eyy, sizeof(__pyx_k_Eyy), 0, 0, 1, 1}, - {&__pyx_n_s_Ezz, __pyx_k_Ezz, sizeof(__pyx_k_Ezz), 0, 0, 1, 1}, - {&__pyx_n_s_H1x, __pyx_k_H1x, sizeof(__pyx_k_H1x), 0, 0, 1, 1}, - {&__pyx_n_s_H1y, __pyx_k_H1y, sizeof(__pyx_k_H1y), 0, 0, 1, 1}, - {&__pyx_n_s_H1z, __pyx_k_H1z, sizeof(__pyx_k_H1z), 0, 0, 1, 1}, - {&__pyx_n_s_H2x, __pyx_k_H2x, sizeof(__pyx_k_H2x), 0, 0, 1, 1}, - {&__pyx_n_s_H2y, __pyx_k_H2y, sizeof(__pyx_k_H2y), 0, 0, 1, 1}, - {&__pyx_n_s_H2z, __pyx_k_H2z, sizeof(__pyx_k_H2z), 0, 0, 1, 1}, - {&__pyx_n_s_H_indices, __pyx_k_H_indices, sizeof(__pyx_k_H_indices), 0, 0, 1, 1}, - {&__pyx_n_s_H_shell, __pyx_k_H_shell, sizeof(__pyx_k_H_shell), 0, 0, 1, 1}, - {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1}, - {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, - {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0}, - {&__pyx_n_s_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 1, 1}, - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, - {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, - {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, - {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1}, - {&__pyx_n_s_NQRdipTen, __pyx_k_NQRdipTen, sizeof(__pyx_k_NQRdipTen), 0, 0, 1, 1}, - {&__pyx_n_s_NQRself, __pyx_k_NQRself, sizeof(__pyx_k_NQRself), 0, 0, 1, 1}, - {&__pyx_n_s_NQRselfAndB, __pyx_k_NQRselfAndB, sizeof(__pyx_k_NQRselfAndB), 0, 0, 1, 1}, - {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, - {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, - {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 0, 1, 1}, - {&__pyx_n_s_SphereinCube, __pyx_k_SphereinCube, sizeof(__pyx_k_SphereinCube), 0, 0, 1, 1}, - {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, - {&__pyx_n_s_a1, __pyx_k_a1, sizeof(__pyx_k_a1), 0, 0, 1, 1}, - {&__pyx_n_s_a2, __pyx_k_a2, sizeof(__pyx_k_a2), 0, 0, 1, 1}, - {&__pyx_n_s_actr, __pyx_k_actr, sizeof(__pyx_k_actr), 0, 0, 1, 1}, - {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, - {&__pyx_n_s_an_first, __pyx_k_an_first, sizeof(__pyx_k_an_first), 0, 0, 1, 1}, - {&__pyx_n_s_an_last, __pyx_k_an_last, sizeof(__pyx_k_an_last), 0, 0, 1, 1}, - {&__pyx_n_s_applyRotationMatrix, __pyx_k_applyRotationMatrix, sizeof(__pyx_k_applyRotationMatrix), 0, 0, 1, 1}, - {&__pyx_n_s_apr, __pyx_k_apr, sizeof(__pyx_k_apr), 0, 0, 1, 1}, - {&__pyx_n_s_arccos, __pyx_k_arccos, sizeof(__pyx_k_arccos), 0, 0, 1, 1}, - {&__pyx_n_s_arctan2, __pyx_k_arctan2, sizeof(__pyx_k_arctan2), 0, 0, 1, 1}, - {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, - {&__pyx_n_s_atomicCurrent, __pyx_k_atomicCurrent, sizeof(__pyx_k_atomicCurrent), 0, 0, 1, 1}, - {&__pyx_n_s_atoms_per_residue, __pyx_k_atoms_per_residue, sizeof(__pyx_k_atoms_per_residue), 0, 0, 1, 1}, - {&__pyx_n_s_auf, __pyx_k_auf, sizeof(__pyx_k_auf), 0, 0, 1, 1}, - {&__pyx_n_s_auf3, __pyx_k_auf3, sizeof(__pyx_k_auf3), 0, 0, 1, 1}, - {&__pyx_n_s_auf6, __pyx_k_auf6, sizeof(__pyx_k_auf6), 0, 0, 1, 1}, - {&__pyx_n_s_auf_x1, __pyx_k_auf_x1, sizeof(__pyx_k_auf_x1), 0, 0, 1, 1}, - {&__pyx_n_s_auf_x2, __pyx_k_auf_x2, sizeof(__pyx_k_auf_x2), 0, 0, 1, 1}, - {&__pyx_n_s_auf_y1, __pyx_k_auf_y1, sizeof(__pyx_k_auf_y1), 0, 0, 1, 1}, - {&__pyx_n_s_auf_y2, __pyx_k_auf_y2, sizeof(__pyx_k_auf_y2), 0, 0, 1, 1}, - {&__pyx_n_s_auf_z1, __pyx_k_auf_z1, sizeof(__pyx_k_auf_z1), 0, 0, 1, 1}, - {&__pyx_n_s_auf_z2, __pyx_k_auf_z2, sizeof(__pyx_k_auf_z2), 0, 0, 1, 1}, - {&__pyx_n_s_aufpunkt, __pyx_k_aufpunkt, sizeof(__pyx_k_aufpunkt), 0, 0, 1, 1}, - {&__pyx_n_s_azi, __pyx_k_azi, sizeof(__pyx_k_azi), 0, 0, 1, 1}, - {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, - {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, - {&__pyx_n_s_c1, __pyx_k_c1, sizeof(__pyx_k_c1), 0, 0, 1, 1}, - {&__pyx_n_s_c2, __pyx_k_c2, sizeof(__pyx_k_c2), 0, 0, 1, 1}, - {&__pyx_n_s_cI, __pyx_k_cI, sizeof(__pyx_k_cI), 0, 0, 1, 1}, - {&__pyx_n_s_cL, __pyx_k_cL, sizeof(__pyx_k_cL), 0, 0, 1, 1}, - {&__pyx_n_s_c_rv, __pyx_k_c_rv, sizeof(__pyx_k_c_rv), 0, 0, 1, 1}, - {&__pyx_n_s_calcAngularDisplacement, __pyx_k_calcAngularDisplacement, sizeof(__pyx_k_calcAngularDisplacement), 0, 0, 1, 1}, - {&__pyx_n_s_calcAngularMomentum, __pyx_k_calcAngularMomentum, sizeof(__pyx_k_calcAngularMomentum), 0, 0, 1, 1}, - {&__pyx_n_s_calcDipDipEnergyAtomic, __pyx_k_calcDipDipEnergyAtomic, sizeof(__pyx_k_calcDipDipEnergyAtomic), 0, 0, 1, 1}, - {&__pyx_n_s_calcEnergyAA, __pyx_k_calcEnergyAA, sizeof(__pyx_k_calcEnergyAA), 0, 0, 1, 1}, - {&__pyx_n_s_calcEnergyAASep, __pyx_k_calcEnergyAASep, sizeof(__pyx_k_calcEnergyAASep), 0, 0, 1, 1}, - {&__pyx_n_s_calcEnergyAAhisto, __pyx_k_calcEnergyAAhisto, sizeof(__pyx_k_calcEnergyAAhisto), 0, 0, 1, 1}, - {&__pyx_n_s_calcEnergyAAhisto1, __pyx_k_calcEnergyAAhisto1, sizeof(__pyx_k_calcEnergyAAhisto1), 0, 0, 1, 1}, - {&__pyx_n_s_calcEnergyAApermind, __pyx_k_calcEnergyAApermind, sizeof(__pyx_k_calcEnergyAApermind), 0, 0, 1, 1}, - {&__pyx_n_s_calcEnergyAApermindhisto, __pyx_k_calcEnergyAApermindhisto, sizeof(__pyx_k_calcEnergyAApermindhisto), 0, 0, 1, 1}, - {&__pyx_n_s_calcEnergyAtomic, __pyx_k_calcEnergyAtomic, sizeof(__pyx_k_calcEnergyAtomic), 0, 0, 1, 1}, - {&__pyx_n_s_calcEnergyAtomicVoro, __pyx_k_calcEnergyAtomicVoro, sizeof(__pyx_k_calcEnergyAtomicVoro), 0, 0, 1, 1}, - {&__pyx_n_s_calcEnergyDouble, __pyx_k_calcEnergyDouble, sizeof(__pyx_k_calcEnergyDouble), 0, 0, 1, 1}, - {&__pyx_n_s_calcEnergyMuA, __pyx_k_calcEnergyMuA, sizeof(__pyx_k_calcEnergyMuA), 0, 0, 1, 1}, - {&__pyx_n_s_calcFourierLaplaceTransform, __pyx_k_calcFourierLaplaceTransform, sizeof(__pyx_k_calcFourierLaplaceTransform), 0, 0, 1, 1}, - {&__pyx_n_s_calcInertiaTensor, __pyx_k_calcInertiaTensor, sizeof(__pyx_k_calcInertiaTensor), 0, 0, 1, 1}, - {&__pyx_n_s_calcOctant, __pyx_k_calcOctant, sizeof(__pyx_k_calcOctant), 0, 0, 1, 1}, - {&__pyx_n_s_calcResidenceTimeseries, __pyx_k_calcResidenceTimeseries, sizeof(__pyx_k_calcResidenceTimeseries), 0, 0, 1, 1}, - {&__pyx_n_s_calcRotationMatrix, __pyx_k_calcRotationMatrix, sizeof(__pyx_k_calcRotationMatrix), 0, 0, 1, 1}, - {&__pyx_n_s_cat_first, __pyx_k_cat_first, sizeof(__pyx_k_cat_first), 0, 0, 1, 1}, - {&__pyx_n_s_cat_last, __pyx_k_cat_last, sizeof(__pyx_k_cat_last), 0, 0, 1, 1}, - {&__pyx_n_s_ccom, __pyx_k_ccom, sizeof(__pyx_k_ccom), 0, 0, 1, 1}, - {&__pyx_n_s_cds, __pyx_k_cds, sizeof(__pyx_k_cds), 0, 0, 1, 1}, - {&__pyx_n_s_center, __pyx_k_center, sizeof(__pyx_k_center), 0, 0, 1, 1}, - {&__pyx_n_s_centerOrientBox, __pyx_k_centerOrientBox, sizeof(__pyx_k_centerOrientBox), 0, 0, 1, 1}, - {&__pyx_n_s_centerToPointOrientBox, __pyx_k_centerToPointOrientBox, sizeof(__pyx_k_centerToPointOrientBox), 0, 0, 1, 1}, - {&__pyx_n_s_centers, __pyx_k_centers, sizeof(__pyx_k_centers), 0, 0, 1, 1}, - {&__pyx_n_s_charges, __pyx_k_charges, sizeof(__pyx_k_charges), 0, 0, 1, 1}, - {&__pyx_n_s_charges1, __pyx_k_charges1, sizeof(__pyx_k_charges1), 0, 0, 1, 1}, - {&__pyx_n_s_checkHBond, __pyx_k_checkHBond, sizeof(__pyx_k_checkHBond), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_cn, __pyx_k_cn, sizeof(__pyx_k_cn), 0, 0, 1, 1}, - {&__pyx_n_s_coct, __pyx_k_coct, sizeof(__pyx_k_coct), 0, 0, 1, 1}, - {&__pyx_n_s_collectiveDipoleMomentWaterShell, __pyx_k_collectiveDipoleMomentWaterShell, sizeof(__pyx_k_collectiveDipoleMomentWaterShell), 0, 0, 1, 1}, - {&__pyx_n_s_com, __pyx_k_com, sizeof(__pyx_k_com), 0, 0, 1, 1}, - {&__pyx_n_s_comByResidue, __pyx_k_comByResidue, sizeof(__pyx_k_comByResidue), 0, 0, 1, 1}, - {&__pyx_n_s_coms, __pyx_k_coms, sizeof(__pyx_k_coms), 0, 0, 1, 1}, - {&__pyx_n_s_comslt, __pyx_k_comslt, sizeof(__pyx_k_comslt), 0, 0, 1, 1}, - {&__pyx_n_s_conjugate, __pyx_k_conjugate, sizeof(__pyx_k_conjugate), 0, 0, 1, 1}, - {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, - {&__pyx_n_s_coo_H, __pyx_k_coo_H, sizeof(__pyx_k_coo_H), 0, 0, 1, 1}, - {&__pyx_n_s_coo_center, __pyx_k_coo_center, sizeof(__pyx_k_coo_center), 0, 0, 1, 1}, - {&__pyx_n_s_coor, __pyx_k_coor, sizeof(__pyx_k_coor), 0, 0, 1, 1}, - {&__pyx_n_s_coorA, __pyx_k_coorA, sizeof(__pyx_k_coorA), 0, 0, 1, 1}, - {&__pyx_n_s_coorB, __pyx_k_coorB, sizeof(__pyx_k_coorB), 0, 0, 1, 1}, - {&__pyx_n_s_coor_core, __pyx_k_coor_core, sizeof(__pyx_k_coor_core), 0, 0, 1, 1}, - {&__pyx_n_s_coor_oh2, __pyx_k_coor_oh2, sizeof(__pyx_k_coor_oh2), 0, 0, 1, 1}, - {&__pyx_n_s_coor_surr, __pyx_k_coor_surr, sizeof(__pyx_k_coor_surr), 0, 0, 1, 1}, - {&__pyx_n_s_corrsubmean, __pyx_k_corrsubmean, sizeof(__pyx_k_corrsubmean), 0, 0, 1, 1}, - {&__pyx_n_s_cosine, __pyx_k_cosine, sizeof(__pyx_k_cosine), 0, 0, 1, 1}, - {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, - {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, - {&__pyx_n_s_cxyz, __pyx_k_cxyz, sizeof(__pyx_k_cxyz), 0, 0, 1, 1}, - {&__pyx_n_s_data_x, __pyx_k_data_x, sizeof(__pyx_k_data_x), 0, 0, 1, 1}, - {&__pyx_n_s_data_y, __pyx_k_data_y, sizeof(__pyx_k_data_y), 0, 0, 1, 1}, - {&__pyx_n_s_deltaA, __pyx_k_deltaA, sizeof(__pyx_k_deltaA), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_n_s_dip, __pyx_k_dip, sizeof(__pyx_k_dip), 0, 0, 1, 1}, - {&__pyx_n_s_dipByResidue, __pyx_k_dipByResidue, sizeof(__pyx_k_dipByResidue), 0, 0, 1, 1}, - {&__pyx_n_s_dipT0, __pyx_k_dipT0, sizeof(__pyx_k_dipT0), 0, 0, 1, 1}, - {&__pyx_n_s_dipTen, __pyx_k_dipTen, sizeof(__pyx_k_dipTen), 0, 0, 1, 1}, - {&__pyx_n_s_dipTenCorrel, __pyx_k_dipTenCorrel, sizeof(__pyx_k_dipTenCorrel), 0, 0, 1, 1}, - {&__pyx_n_s_dipTenInit, __pyx_k_dipTenInit, sizeof(__pyx_k_dipTenInit), 0, 0, 1, 1}, - {&__pyx_n_s_dipTt0, __pyx_k_dipTt0, sizeof(__pyx_k_dipTt0), 0, 0, 1, 1}, - {&__pyx_n_s_dipTt1, __pyx_k_dipTt1, sizeof(__pyx_k_dipTt1), 0, 0, 1, 1}, - {&__pyx_n_s_dipTt2, __pyx_k_dipTt2, sizeof(__pyx_k_dipTt2), 0, 0, 1, 1}, - {&__pyx_n_s_dipTt3, __pyx_k_dipTt3, sizeof(__pyx_k_dipTt3), 0, 0, 1, 1}, - {&__pyx_n_s_dipTt4, __pyx_k_dipTt4, sizeof(__pyx_k_dipTt4), 0, 0, 1, 1}, - {&__pyx_n_s_dipTt5, __pyx_k_dipTt5, sizeof(__pyx_k_dipTt5), 0, 0, 1, 1}, - {&__pyx_n_s_dip_wat, __pyx_k_dip_wat, sizeof(__pyx_k_dip_wat), 0, 0, 1, 1}, - {&__pyx_n_s_dipol, __pyx_k_dipol, sizeof(__pyx_k_dipol), 0, 0, 1, 1}, - {&__pyx_n_s_dipoleMomentNeutralSelection, __pyx_k_dipoleMomentNeutralSelection, sizeof(__pyx_k_dipoleMomentNeutralSelection), 0, 0, 1, 1}, - {&__pyx_n_s_dipt, __pyx_k_dipt, sizeof(__pyx_k_dipt), 0, 0, 1, 1}, - {&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1}, - {&__pyx_n_s_dist2, __pyx_k_dist2, sizeof(__pyx_k_dist2), 0, 0, 1, 1}, - {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1}, - {&__pyx_n_s_dot2, __pyx_k_dot2, sizeof(__pyx_k_dot2), 0, 0, 1, 1}, - {&__pyx_n_s_drude, __pyx_k_drude, sizeof(__pyx_k_drude), 0, 0, 1, 1}, - {&__pyx_n_s_ds, __pyx_k_ds, sizeof(__pyx_k_ds), 0, 0, 1, 1}, - {&__pyx_n_s_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, - {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1}, - {&__pyx_n_s_dx2, __pyx_k_dx2, sizeof(__pyx_k_dx2), 0, 0, 1, 1}, - {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1}, - {&__pyx_n_s_dy2, __pyx_k_dy2, sizeof(__pyx_k_dy2), 0, 0, 1, 1}, - {&__pyx_n_s_dz, __pyx_k_dz, sizeof(__pyx_k_dz), 0, 0, 1, 1}, - {&__pyx_n_s_dz2, __pyx_k_dz2, sizeof(__pyx_k_dz2), 0, 0, 1, 1}, - {&__pyx_n_s_edip, __pyx_k_edip, sizeof(__pyx_k_edip), 0, 0, 1, 1}, - {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, - {&__pyx_n_s_energy, __pyx_k_energy, sizeof(__pyx_k_energy), 0, 0, 1, 1}, - {&__pyx_n_s_energy_ind, __pyx_k_energy_ind, sizeof(__pyx_k_energy_ind), 0, 0, 1, 1}, - {&__pyx_n_s_energy_octant, __pyx_k_energy_octant, sizeof(__pyx_k_energy_octant), 0, 0, 1, 1}, - {&__pyx_n_s_energy_octant_per_atom, __pyx_k_energy_octant_per_atom, sizeof(__pyx_k_energy_octant_per_atom), 0, 0, 1, 1}, - {&__pyx_n_s_energy_per_atom, __pyx_k_energy_per_atom, sizeof(__pyx_k_energy_per_atom), 0, 0, 1, 1}, - {&__pyx_n_s_energy_perm, __pyx_k_energy_perm, sizeof(__pyx_k_energy_perm), 0, 0, 1, 1}, - {&__pyx_n_s_energy_xyz, __pyx_k_energy_xyz, sizeof(__pyx_k_energy_xyz), 0, 0, 1, 1}, - {&__pyx_n_s_energy_xyz_per_atom, __pyx_k_energy_xyz_per_atom, sizeof(__pyx_k_energy_xyz_per_atom), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_epa, __pyx_k_epa, sizeof(__pyx_k_epa), 0, 0, 1, 1}, - {&__pyx_n_s_epa1, __pyx_k_epa1, sizeof(__pyx_k_epa1), 0, 0, 1, 1}, - {&__pyx_n_s_epa_ind, __pyx_k_epa_ind, sizeof(__pyx_k_epa_ind), 0, 0, 1, 1}, - {&__pyx_n_s_epa_oct, __pyx_k_epa_oct, sizeof(__pyx_k_epa_oct), 0, 0, 1, 1}, - {&__pyx_n_s_epa_perm, __pyx_k_epa_perm, sizeof(__pyx_k_epa_perm), 0, 0, 1, 1}, - {&__pyx_n_s_epa_xyz, __pyx_k_epa_xyz, sizeof(__pyx_k_epa_xyz), 0, 0, 1, 1}, - {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, - {&__pyx_n_s_exclude_begin, __pyx_k_exclude_begin, sizeof(__pyx_k_exclude_begin), 0, 0, 1, 1}, - {&__pyx_n_s_exclude_end, __pyx_k_exclude_end, sizeof(__pyx_k_exclude_end), 0, 0, 1, 1}, - {&__pyx_n_s_f1, __pyx_k_f1, sizeof(__pyx_k_f1), 0, 0, 1, 1}, - {&__pyx_n_s_f2, __pyx_k_f2, sizeof(__pyx_k_f2), 0, 0, 1, 1}, - {&__pyx_n_s_f2_0, __pyx_k_f2_0, sizeof(__pyx_k_f2_0), 0, 0, 1, 1}, - {&__pyx_n_s_f2_1, __pyx_k_f2_1, sizeof(__pyx_k_f2_1), 0, 0, 1, 1}, - {&__pyx_n_s_f2_2, __pyx_k_f2_2, sizeof(__pyx_k_f2_2), 0, 0, 1, 1}, - {&__pyx_n_s_f2_x, __pyx_k_f2_x, sizeof(__pyx_k_f2_x), 0, 0, 1, 1}, - {&__pyx_n_s_f2_y, __pyx_k_f2_y, sizeof(__pyx_k_f2_y), 0, 0, 1, 1}, - {&__pyx_n_s_f2_z, __pyx_k_f2_z, sizeof(__pyx_k_f2_z), 0, 0, 1, 1}, - {&__pyx_n_s_findDS, __pyx_k_findDS, sizeof(__pyx_k_findDS), 0, 0, 1, 1}, - {&__pyx_n_s_findNearestAtom, __pyx_k_findNearestAtom, sizeof(__pyx_k_findNearestAtom), 0, 0, 1, 1}, - {&__pyx_n_s_first, __pyx_k_first, sizeof(__pyx_k_first), 0, 0, 1, 1}, - {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, - {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, - {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, - {&__pyx_n_s_frame, __pyx_k_frame, sizeof(__pyx_k_frame), 0, 0, 1, 1}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_n_s_gfunc, __pyx_k_gfunc, sizeof(__pyx_k_gfunc), 0, 0, 1, 1}, - {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0}, - {&__pyx_n_s_hbond, __pyx_k_hbond, sizeof(__pyx_k_hbond), 0, 0, 1, 1}, - {&__pyx_n_s_histo, __pyx_k_histo, sizeof(__pyx_k_histo), 0, 0, 1, 1}, - {&__pyx_n_s_histo_bins, __pyx_k_histo_bins, sizeof(__pyx_k_histo_bins), 0, 0, 1, 1}, - {&__pyx_n_s_histo_error, __pyx_k_histo_error, sizeof(__pyx_k_histo_error), 0, 0, 1, 1}, - {&__pyx_n_s_histo_ind, __pyx_k_histo_ind, sizeof(__pyx_k_histo_ind), 0, 0, 1, 1}, - {&__pyx_n_s_histo_max, __pyx_k_histo_max, sizeof(__pyx_k_histo_max), 0, 0, 1, 1}, - {&__pyx_n_s_histo_min, __pyx_k_histo_min, sizeof(__pyx_k_histo_min), 0, 0, 1, 1}, - {&__pyx_n_s_histo_perm, __pyx_k_histo_perm, sizeof(__pyx_k_histo_perm), 0, 0, 1, 1}, - {&__pyx_n_s_histo_width, __pyx_k_histo_width, sizeof(__pyx_k_histo_width), 0, 0, 1, 1}, - {&__pyx_n_s_hs, __pyx_k_hs, sizeof(__pyx_k_hs), 0, 0, 1, 1}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1}, - {&__pyx_n_s_idx2, __pyx_k_idx2, sizeof(__pyx_k_idx2), 0, 0, 1, 1}, - {&__pyx_n_s_idx3, __pyx_k_idx3, sizeof(__pyx_k_idx3), 0, 0, 1, 1}, - {&__pyx_n_s_idx4, __pyx_k_idx4, sizeof(__pyx_k_idx4), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_ind, __pyx_k_ind, sizeof(__pyx_k_ind), 0, 0, 1, 1}, - {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, - {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1}, - {&__pyx_n_s_integral, __pyx_k_integral, sizeof(__pyx_k_integral), 0, 0, 1, 1}, - {&__pyx_n_s_islt, __pyx_k_islt, sizeof(__pyx_k_islt), 0, 0, 1, 1}, - {&__pyx_n_s_isolute, __pyx_k_isolute, sizeof(__pyx_k_isolute), 0, 0, 1, 1}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, - {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, - {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, - {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, - {&__pyx_n_s_l1, __pyx_k_l1, sizeof(__pyx_k_l1), 0, 0, 1, 1}, - {&__pyx_n_s_l2, __pyx_k_l2, sizeof(__pyx_k_l2), 0, 0, 1, 1}, - {&__pyx_n_s_laplace_im, __pyx_k_laplace_im, sizeof(__pyx_k_laplace_im), 0, 0, 1, 1}, - {&__pyx_n_s_laplace_re, __pyx_k_laplace_re, sizeof(__pyx_k_laplace_re), 0, 0, 1, 1}, - {&__pyx_n_s_last, __pyx_k_last, sizeof(__pyx_k_last), 0, 0, 1, 1}, - {&__pyx_n_s_len_H, __pyx_k_len_H, sizeof(__pyx_k_len_H), 0, 0, 1, 1}, - {&__pyx_n_s_len_center, __pyx_k_len_center, sizeof(__pyx_k_len_center), 0, 0, 1, 1}, - {&__pyx_n_s_lmax, __pyx_k_lmax, sizeof(__pyx_k_lmax), 0, 0, 1, 1}, - {&__pyx_n_s_m1, __pyx_k_m1, sizeof(__pyx_k_m1), 0, 0, 1, 1}, - {&__pyx_n_s_m1r, __pyx_k_m1r, sizeof(__pyx_k_m1r), 0, 0, 1, 1}, - {&__pyx_n_s_m2, __pyx_k_m2, sizeof(__pyx_k_m2), 0, 0, 1, 1}, - {&__pyx_n_s_m2r, __pyx_k_m2r, sizeof(__pyx_k_m2r), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_masses, __pyx_k_masses, sizeof(__pyx_k_masses), 0, 0, 1, 1}, - {&__pyx_n_s_maxdist, __pyx_k_maxdist, sizeof(__pyx_k_maxdist), 0, 0, 1, 1}, - {&__pyx_n_s_maxshell, __pyx_k_maxshell, sizeof(__pyx_k_maxshell), 0, 0, 1, 1}, - {&__pyx_n_s_mdcage_ts, __pyx_k_mdcage_ts, sizeof(__pyx_k_mdcage_ts), 0, 0, 1, 1}, - {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, - {&__pyx_n_s_mindist, __pyx_k_mindist, sizeof(__pyx_k_mindist), 0, 0, 1, 1}, - {&__pyx_n_s_mindist2, __pyx_k_mindist2, sizeof(__pyx_k_mindist2), 0, 0, 1, 1}, - {&__pyx_n_s_minvec, __pyx_k_minvec, sizeof(__pyx_k_minvec), 0, 0, 1, 1}, - {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, - {&__pyx_n_s_msd, __pyx_k_msd, sizeof(__pyx_k_msd), 0, 0, 1, 1}, - {&__pyx_n_s_mu_solute, __pyx_k_mu_solute, sizeof(__pyx_k_mu_solute), 0, 0, 1, 1}, - {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, - {&__pyx_n_s_n1, __pyx_k_n1, sizeof(__pyx_k_n1), 0, 0, 1, 1}, - {&__pyx_n_s_n2, __pyx_k_n2, sizeof(__pyx_k_n2), 0, 0, 1, 1}, - {&__pyx_n_s_n3, __pyx_k_n3, sizeof(__pyx_k_n3), 0, 0, 1, 1}, - {&__pyx_n_s_n_core, __pyx_k_n_core, sizeof(__pyx_k_n_core), 0, 0, 1, 1}, - {&__pyx_n_s_n_surr, __pyx_k_n_surr, sizeof(__pyx_k_n_surr), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_nat, __pyx_k_nat, sizeof(__pyx_k_nat), 0, 0, 1, 1}, - {&__pyx_n_s_natoms, __pyx_k_natoms, sizeof(__pyx_k_natoms), 0, 0, 1, 1}, - {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, - {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, - {&__pyx_n_s_newanalysis_helpers, __pyx_k_newanalysis_helpers, sizeof(__pyx_k_newanalysis_helpers), 0, 0, 1, 1}, - {&__pyx_n_s_next_id, __pyx_k_next_id, sizeof(__pyx_k_next_id), 0, 0, 1, 1}, - {&__pyx_n_s_nmol, __pyx_k_nmol, sizeof(__pyx_k_nmol), 0, 0, 1, 1}, - {&__pyx_n_s_nmolecules, __pyx_k_nmolecules, sizeof(__pyx_k_nmolecules), 0, 0, 1, 1}, - {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, - {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, - {&__pyx_n_s_nres, __pyx_k_nres, sizeof(__pyx_k_nres), 0, 0, 1, 1}, - {&__pyx_n_s_nres_surr, __pyx_k_nres_surr, sizeof(__pyx_k_nres_surr), 0, 0, 1, 1}, - {&__pyx_n_s_nres_wat, __pyx_k_nres_wat, sizeof(__pyx_k_nres_wat), 0, 0, 1, 1}, - {&__pyx_n_s_nshells, __pyx_k_nshells, sizeof(__pyx_k_nshells), 0, 0, 1, 1}, - {&__pyx_n_s_nshells2, __pyx_k_nshells2, sizeof(__pyx_k_nshells2), 0, 0, 1, 1}, - {&__pyx_n_s_nsurr, __pyx_k_nsurr, sizeof(__pyx_k_nsurr), 0, 0, 1, 1}, - {&__pyx_n_s_nt, __pyx_k_nt, sizeof(__pyx_k_nt), 0, 0, 1, 1}, - {&__pyx_n_s_numpoints, __pyx_k_numpoints, sizeof(__pyx_k_numpoints), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, - {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, - {&__pyx_n_s_nwat, __pyx_k_nwat, sizeof(__pyx_k_nwat), 0, 0, 1, 1}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_octants, __pyx_k_octants, sizeof(__pyx_k_octants), 0, 0, 1, 1}, - {&__pyx_n_s_oxyquinol, __pyx_k_oxyquinol, sizeof(__pyx_k_oxyquinol), 0, 0, 1, 1}, - {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_n_s_pol, __pyx_k_pol, sizeof(__pyx_k_pol), 0, 0, 1, 1}, - {&__pyx_n_s_pyE, __pyx_k_pyE, sizeof(__pyx_k_pyE), 0, 0, 1, 1}, - {&__pyx_n_s_py_B1, __pyx_k_py_B1, sizeof(__pyx_k_py_B1), 0, 0, 1, 1}, - {&__pyx_n_s_py_B2, __pyx_k_py_B2, sizeof(__pyx_k_py_B2), 0, 0, 1, 1}, - {&__pyx_n_s_py_B3, __pyx_k_py_B3, sizeof(__pyx_k_py_B3), 0, 0, 1, 1}, - {&__pyx_n_s_py_charges, __pyx_k_py_charges, sizeof(__pyx_k_py_charges), 0, 0, 1, 1}, - {&__pyx_n_s_py_dipt, __pyx_k_py_dipt, sizeof(__pyx_k_py_dipt), 0, 0, 1, 1}, - {&__pyx_n_s_py_xyz, __pyx_k_py_xyz, sizeof(__pyx_k_py_xyz), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1}, - {&__pyx_n_s_qq, __pyx_k_qq, sizeof(__pyx_k_qq), 0, 0, 1, 1}, - {&__pyx_n_s_qq_diff, __pyx_k_qq_diff, sizeof(__pyx_k_qq_diff), 0, 0, 1, 1}, - {&__pyx_n_s_qqr, __pyx_k_qqr, sizeof(__pyx_k_qqr), 0, 0, 1, 1}, - {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1}, - {&__pyx_n_s_r2, __pyx_k_r2, sizeof(__pyx_k_r2), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_rep, __pyx_k_rep, sizeof(__pyx_k_rep), 0, 0, 1, 1}, - {&__pyx_n_s_residue_first_atom, __pyx_k_residue_first_atom, sizeof(__pyx_k_residue_first_atom), 0, 0, 1, 1}, - {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, - {&__pyx_n_s_rfa, __pyx_k_rfa, sizeof(__pyx_k_rfa), 0, 0, 1, 1}, - {&__pyx_n_s_roxy, __pyx_k_roxy, sizeof(__pyx_k_roxy), 0, 0, 1, 1}, - {&__pyx_n_s_rtre, __pyx_k_rtre, sizeof(__pyx_k_rtre), 0, 0, 1, 1}, - {&__pyx_n_s_rv, __pyx_k_rv, sizeof(__pyx_k_rv), 0, 0, 1, 1}, - {&__pyx_n_s_rvec0, __pyx_k_rvec0, sizeof(__pyx_k_rvec0), 0, 0, 1, 1}, - {&__pyx_n_s_rvec1, __pyx_k_rvec1, sizeof(__pyx_k_rvec1), 0, 0, 1, 1}, - {&__pyx_n_s_rvec2, __pyx_k_rvec2, sizeof(__pyx_k_rvec2), 0, 0, 1, 1}, - {&__pyx_n_s_scipy_special, __pyx_k_scipy_special, sizeof(__pyx_k_scipy_special), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, - {&__pyx_n_s_shell, __pyx_k_shell, sizeof(__pyx_k_shell), 0, 0, 1, 1}, - {&__pyx_n_s_shift, __pyx_k_shift, sizeof(__pyx_k_shift), 0, 0, 1, 1}, - {&__pyx_n_s_sites_per_res, __pyx_k_sites_per_res, sizeof(__pyx_k_sites_per_res), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_sphHarmMatrix, __pyx_k_sphHarmMatrix, sizeof(__pyx_k_sphHarmMatrix), 0, 0, 1, 1}, - {&__pyx_n_s_sph_harm, __pyx_k_sph_harm, sizeof(__pyx_k_sph_harm), 0, 0, 1, 1}, - {&__pyx_n_s_squared_r_oxy, __pyx_k_squared_r_oxy, sizeof(__pyx_k_squared_r_oxy), 0, 0, 1, 1}, - {&__pyx_n_s_squared_r_tre, __pyx_k_squared_r_tre, sizeof(__pyx_k_squared_r_tre), 0, 0, 1, 1}, - {&__pyx_kp_s_src_helpers_helpers_pyx, __pyx_k_src_helpers_helpers_pyx, sizeof(__pyx_k_src_helpers_helpers_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_n_s_store, __pyx_k_store, sizeof(__pyx_k_store), 0, 0, 1, 1}, - {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_n_s_sumMDCage, __pyx_k_sumMDCage, sizeof(__pyx_k_sumMDCage), 0, 0, 1, 1}, - {&__pyx_n_s_sumMDCageSingle, __pyx_k_sumMDCageSingle, sizeof(__pyx_k_sumMDCageSingle), 0, 0, 1, 1}, - {&__pyx_n_s_sumr, __pyx_k_sumr, sizeof(__pyx_k_sumr), 0, 0, 1, 1}, - {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_timectr, __pyx_k_timectr, sizeof(__pyx_k_timectr), 0, 0, 1, 1}, - {&__pyx_n_s_tmp, __pyx_k_tmp, sizeof(__pyx_k_tmp), 0, 0, 1, 1}, - {&__pyx_n_s_tmp_ener, __pyx_k_tmp_ener, sizeof(__pyx_k_tmp_ener), 0, 0, 1, 1}, - {&__pyx_n_s_tmp_ind, __pyx_k_tmp_ind, sizeof(__pyx_k_tmp_ind), 0, 0, 1, 1}, - {&__pyx_n_s_tmp_perm, __pyx_k_tmp_perm, sizeof(__pyx_k_tmp_perm), 0, 0, 1, 1}, - {&__pyx_n_s_tmp_x, __pyx_k_tmp_x, sizeof(__pyx_k_tmp_x), 0, 0, 1, 1}, - {&__pyx_n_s_tmp_y, __pyx_k_tmp_y, sizeof(__pyx_k_tmp_y), 0, 0, 1, 1}, - {&__pyx_n_s_tmp_z, __pyx_k_tmp_z, sizeof(__pyx_k_tmp_z), 0, 0, 1, 1}, - {&__pyx_n_s_tmpx, __pyx_k_tmpx, sizeof(__pyx_k_tmpx), 0, 0, 1, 1}, - {&__pyx_n_s_tmpy, __pyx_k_tmpy, sizeof(__pyx_k_tmpy), 0, 0, 1, 1}, - {&__pyx_n_s_tmpz, __pyx_k_tmpz, sizeof(__pyx_k_tmpz), 0, 0, 1, 1}, - {&__pyx_n_s_tn, __pyx_k_tn, sizeof(__pyx_k_tn), 0, 0, 1, 1}, - {&__pyx_n_s_tot_mass, __pyx_k_tot_mass, sizeof(__pyx_k_tot_mass), 0, 0, 1, 1}, - {&__pyx_n_s_transform, __pyx_k_transform, sizeof(__pyx_k_transform), 0, 0, 1, 1}, - {&__pyx_n_s_trehalose, __pyx_k_trehalose, sizeof(__pyx_k_trehalose), 0, 0, 1, 1}, - {&__pyx_n_s_ts, __pyx_k_ts, sizeof(__pyx_k_ts), 0, 0, 1, 1}, - {&__pyx_n_s_tyH, __pyx_k_tyH, sizeof(__pyx_k_tyH), 0, 0, 1, 1}, - {&__pyx_n_s_tzH, __pyx_k_tzH, sizeof(__pyx_k_tzH), 0, 0, 1, 1}, - {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, - {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, - {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {&__pyx_n_s_vel, __pyx_k_vel, sizeof(__pyx_k_vel), 0, 0, 1, 1}, - {&__pyx_n_s_velcom, __pyx_k_velcom, sizeof(__pyx_k_velcom), 0, 0, 1, 1}, - {&__pyx_n_s_velcomByResidue, __pyx_k_velcomByResidue, sizeof(__pyx_k_velcomByResidue), 0, 0, 1, 1}, - {&__pyx_n_s_vels, __pyx_k_vels, sizeof(__pyx_k_vels), 0, 0, 1, 1}, - {&__pyx_n_s_vol, __pyx_k_vol, sizeof(__pyx_k_vol), 0, 0, 1, 1}, - {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, - {&__pyx_n_s_waterRotationMatrix, __pyx_k_waterRotationMatrix, sizeof(__pyx_k_waterRotationMatrix), 0, 0, 1, 1}, - {&__pyx_n_s_wt, __pyx_k_wt, sizeof(__pyx_k_wt), 0, 0, 1, 1}, - {&__pyx_n_s_wt1, __pyx_k_wt1, sizeof(__pyx_k_wt1), 0, 0, 1, 1}, - {&__pyx_n_s_wts, __pyx_k_wts, sizeof(__pyx_k_wts), 0, 0, 1, 1}, - {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, - {&__pyx_n_s_xyz, __pyx_k_xyz, sizeof(__pyx_k_xyz), 0, 0, 1, 1}, - {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1}, - {&__pyx_n_s_y_mat, __pyx_k_y_mat, sizeof(__pyx_k_y_mat), 0, 0, 1, 1}, - {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1}, - {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1}, + {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, + {&__pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_k_All_dimensions_preceding_dimensi, sizeof(__pyx_k_All_dimensions_preceding_dimensi), 0, 0, 1, 0}, + {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, + {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1}, + {&__pyx_n_s_B1, __pyx_k_B1, sizeof(__pyx_k_B1), 0, 0, 1, 1}, + {&__pyx_n_s_B2, __pyx_k_B2, sizeof(__pyx_k_B2), 0, 0, 1, 1}, + {&__pyx_n_s_B3, __pyx_k_B3, sizeof(__pyx_k_B3), 0, 0, 1, 1}, + {&__pyx_n_s_B_out, __pyx_k_B_out, sizeof(__pyx_k_B_out), 0, 0, 1, 1}, + {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, + {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, + {&__pyx_kp_u_Cannot_index_with_type, __pyx_k_Cannot_index_with_type, sizeof(__pyx_k_Cannot_index_with_type), 0, 1, 0, 0}, + {&__pyx_kp_s_Cannot_transpose_memoryview_with, __pyx_k_Cannot_transpose_memoryview_with, sizeof(__pyx_k_Cannot_transpose_memoryview_with), 0, 0, 1, 0}, + {&__pyx_kp_s_Dimension_d_is_not_direct, __pyx_k_Dimension_d_is_not_direct, sizeof(__pyx_k_Dimension_d_is_not_direct), 0, 0, 1, 0}, + {&__pyx_n_s_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 0, 1, 1}, + {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, + {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, + {&__pyx_n_s_Exx, __pyx_k_Exx, sizeof(__pyx_k_Exx), 0, 0, 1, 1}, + {&__pyx_n_s_Eyy, __pyx_k_Eyy, sizeof(__pyx_k_Eyy), 0, 0, 1, 1}, + {&__pyx_n_s_Ezz, __pyx_k_Ezz, sizeof(__pyx_k_Ezz), 0, 0, 1, 1}, + {&__pyx_n_s_H1x, __pyx_k_H1x, sizeof(__pyx_k_H1x), 0, 0, 1, 1}, + {&__pyx_n_s_H1y, __pyx_k_H1y, sizeof(__pyx_k_H1y), 0, 0, 1, 1}, + {&__pyx_n_s_H1z, __pyx_k_H1z, sizeof(__pyx_k_H1z), 0, 0, 1, 1}, + {&__pyx_n_s_H2x, __pyx_k_H2x, sizeof(__pyx_k_H2x), 0, 0, 1, 1}, + {&__pyx_n_s_H2y, __pyx_k_H2y, sizeof(__pyx_k_H2y), 0, 0, 1, 1}, + {&__pyx_n_s_H2z, __pyx_k_H2z, sizeof(__pyx_k_H2z), 0, 0, 1, 1}, + {&__pyx_n_s_H_indices, __pyx_k_H_indices, sizeof(__pyx_k_H_indices), 0, 0, 1, 1}, + {&__pyx_n_s_H_shell, __pyx_k_H_shell, sizeof(__pyx_k_H_shell), 0, 0, 1, 1}, + {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1}, + {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_k_Index_out_of_bounds_axis_d, sizeof(__pyx_k_Index_out_of_bounds_axis_d), 0, 0, 1, 0}, + {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, + {&__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 1, 0, 0}, + {&__pyx_kp_u_Invalid_shape_in_axis, __pyx_k_Invalid_shape_in_axis, sizeof(__pyx_k_Invalid_shape_in_axis), 0, 1, 0, 0}, + {&__pyx_n_s_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 1, 1}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, + {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, + {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1}, + {&__pyx_n_s_NQRdipTen, __pyx_k_NQRdipTen, sizeof(__pyx_k_NQRdipTen), 0, 0, 1, 1}, + {&__pyx_n_s_NQRself, __pyx_k_NQRself, sizeof(__pyx_k_NQRself), 0, 0, 1, 1}, + {&__pyx_n_s_NQRselfAndB, __pyx_k_NQRselfAndB, sizeof(__pyx_k_NQRselfAndB), 0, 0, 1, 1}, + {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, + {&__pyx_kp_u_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 1, 0, 0}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 0, 1, 1}, + {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1}, + {&__pyx_n_s_SphereinCube, __pyx_k_SphereinCube, sizeof(__pyx_k_SphereinCube), 0, 0, 1, 1}, + {&__pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_k_Step_may_not_be_zero_axis_d, sizeof(__pyx_k_Step_may_not_be_zero_axis_d), 0, 0, 1, 0}, + {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, + {&__pyx_n_s__109, __pyx_k__109, sizeof(__pyx_k__109), 0, 0, 1, 1}, + {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, + {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, + {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, + {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, + {&__pyx_n_s_a1, __pyx_k_a1, sizeof(__pyx_k_a1), 0, 0, 1, 1}, + {&__pyx_n_s_a2, __pyx_k_a2, sizeof(__pyx_k_a2), 0, 0, 1, 1}, + {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, + {&__pyx_n_s_actr, __pyx_k_actr, sizeof(__pyx_k_actr), 0, 0, 1, 1}, + {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_an_first, __pyx_k_an_first, sizeof(__pyx_k_an_first), 0, 0, 1, 1}, + {&__pyx_n_s_an_last, __pyx_k_an_last, sizeof(__pyx_k_an_last), 0, 0, 1, 1}, + {&__pyx_kp_u_and, __pyx_k_and, sizeof(__pyx_k_and), 0, 1, 0, 0}, + {&__pyx_n_s_applyRotationMatrix, __pyx_k_applyRotationMatrix, sizeof(__pyx_k_applyRotationMatrix), 0, 0, 1, 1}, + {&__pyx_n_s_apr, __pyx_k_apr, sizeof(__pyx_k_apr), 0, 0, 1, 1}, + {&__pyx_n_s_arccos, __pyx_k_arccos, sizeof(__pyx_k_arccos), 0, 0, 1, 1}, + {&__pyx_n_s_arctan2, __pyx_k_arctan2, sizeof(__pyx_k_arctan2), 0, 0, 1, 1}, + {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_atomicCurrent, __pyx_k_atomicCurrent, sizeof(__pyx_k_atomicCurrent), 0, 0, 1, 1}, + {&__pyx_n_s_atoms_per_residue, __pyx_k_atoms_per_residue, sizeof(__pyx_k_atoms_per_residue), 0, 0, 1, 1}, + {&__pyx_n_s_auf, __pyx_k_auf, sizeof(__pyx_k_auf), 0, 0, 1, 1}, + {&__pyx_n_s_auf3, __pyx_k_auf3, sizeof(__pyx_k_auf3), 0, 0, 1, 1}, + {&__pyx_n_s_auf6, __pyx_k_auf6, sizeof(__pyx_k_auf6), 0, 0, 1, 1}, + {&__pyx_n_s_auf_x1, __pyx_k_auf_x1, sizeof(__pyx_k_auf_x1), 0, 0, 1, 1}, + {&__pyx_n_s_auf_x2, __pyx_k_auf_x2, sizeof(__pyx_k_auf_x2), 0, 0, 1, 1}, + {&__pyx_n_s_auf_y1, __pyx_k_auf_y1, sizeof(__pyx_k_auf_y1), 0, 0, 1, 1}, + {&__pyx_n_s_auf_y2, __pyx_k_auf_y2, sizeof(__pyx_k_auf_y2), 0, 0, 1, 1}, + {&__pyx_n_s_auf_z1, __pyx_k_auf_z1, sizeof(__pyx_k_auf_z1), 0, 0, 1, 1}, + {&__pyx_n_s_auf_z2, __pyx_k_auf_z2, sizeof(__pyx_k_auf_z2), 0, 0, 1, 1}, + {&__pyx_n_s_aufpunkt, __pyx_k_aufpunkt, sizeof(__pyx_k_aufpunkt), 0, 0, 1, 1}, + {&__pyx_n_s_azi, __pyx_k_azi, sizeof(__pyx_k_azi), 0, 0, 1, 1}, + {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, + {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, + {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, + {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, + {&__pyx_n_s_c1, __pyx_k_c1, sizeof(__pyx_k_c1), 0, 0, 1, 1}, + {&__pyx_n_s_c2, __pyx_k_c2, sizeof(__pyx_k_c2), 0, 0, 1, 1}, + {&__pyx_n_s_cI, __pyx_k_cI, sizeof(__pyx_k_cI), 0, 0, 1, 1}, + {&__pyx_n_s_cL, __pyx_k_cL, sizeof(__pyx_k_cL), 0, 0, 1, 1}, + {&__pyx_n_s_c_rv, __pyx_k_c_rv, sizeof(__pyx_k_c_rv), 0, 0, 1, 1}, + {&__pyx_n_s_calcAngularDisplacement, __pyx_k_calcAngularDisplacement, sizeof(__pyx_k_calcAngularDisplacement), 0, 0, 1, 1}, + {&__pyx_n_s_calcAngularMomentum, __pyx_k_calcAngularMomentum, sizeof(__pyx_k_calcAngularMomentum), 0, 0, 1, 1}, + {&__pyx_n_s_calcDipDipEnergyAtomic, __pyx_k_calcDipDipEnergyAtomic, sizeof(__pyx_k_calcDipDipEnergyAtomic), 0, 0, 1, 1}, + {&__pyx_n_s_calcEnergyAA, __pyx_k_calcEnergyAA, sizeof(__pyx_k_calcEnergyAA), 0, 0, 1, 1}, + {&__pyx_n_s_calcEnergyAASep, __pyx_k_calcEnergyAASep, sizeof(__pyx_k_calcEnergyAASep), 0, 0, 1, 1}, + {&__pyx_n_s_calcEnergyAAhisto, __pyx_k_calcEnergyAAhisto, sizeof(__pyx_k_calcEnergyAAhisto), 0, 0, 1, 1}, + {&__pyx_n_s_calcEnergyAAhisto1, __pyx_k_calcEnergyAAhisto1, sizeof(__pyx_k_calcEnergyAAhisto1), 0, 0, 1, 1}, + {&__pyx_n_s_calcEnergyAApermind, __pyx_k_calcEnergyAApermind, sizeof(__pyx_k_calcEnergyAApermind), 0, 0, 1, 1}, + {&__pyx_n_s_calcEnergyAApermindhisto, __pyx_k_calcEnergyAApermindhisto, sizeof(__pyx_k_calcEnergyAApermindhisto), 0, 0, 1, 1}, + {&__pyx_n_s_calcEnergyAtomic, __pyx_k_calcEnergyAtomic, sizeof(__pyx_k_calcEnergyAtomic), 0, 0, 1, 1}, + {&__pyx_n_s_calcEnergyAtomicVoro, __pyx_k_calcEnergyAtomicVoro, sizeof(__pyx_k_calcEnergyAtomicVoro), 0, 0, 1, 1}, + {&__pyx_n_s_calcEnergyDouble, __pyx_k_calcEnergyDouble, sizeof(__pyx_k_calcEnergyDouble), 0, 0, 1, 1}, + {&__pyx_n_s_calcEnergyMuA, __pyx_k_calcEnergyMuA, sizeof(__pyx_k_calcEnergyMuA), 0, 0, 1, 1}, + {&__pyx_n_s_calcFourierLaplaceTransform, __pyx_k_calcFourierLaplaceTransform, sizeof(__pyx_k_calcFourierLaplaceTransform), 0, 0, 1, 1}, + {&__pyx_n_s_calcInertiaTensor, __pyx_k_calcInertiaTensor, sizeof(__pyx_k_calcInertiaTensor), 0, 0, 1, 1}, + {&__pyx_n_s_calcOctant, __pyx_k_calcOctant, sizeof(__pyx_k_calcOctant), 0, 0, 1, 1}, + {&__pyx_n_s_calcResidenceTimeseries, __pyx_k_calcResidenceTimeseries, sizeof(__pyx_k_calcResidenceTimeseries), 0, 0, 1, 1}, + {&__pyx_n_s_calcRotationMatrix, __pyx_k_calcRotationMatrix, sizeof(__pyx_k_calcRotationMatrix), 0, 0, 1, 1}, + {&__pyx_n_s_cat_first, __pyx_k_cat_first, sizeof(__pyx_k_cat_first), 0, 0, 1, 1}, + {&__pyx_n_s_cat_last, __pyx_k_cat_last, sizeof(__pyx_k_cat_last), 0, 0, 1, 1}, + {&__pyx_n_s_ccom, __pyx_k_ccom, sizeof(__pyx_k_ccom), 0, 0, 1, 1}, + {&__pyx_n_s_cds, __pyx_k_cds, sizeof(__pyx_k_cds), 0, 0, 1, 1}, + {&__pyx_n_s_center, __pyx_k_center, sizeof(__pyx_k_center), 0, 0, 1, 1}, + {&__pyx_n_s_centerOrientBox, __pyx_k_centerOrientBox, sizeof(__pyx_k_centerOrientBox), 0, 0, 1, 1}, + {&__pyx_n_s_centerToPointOrientBox, __pyx_k_centerToPointOrientBox, sizeof(__pyx_k_centerToPointOrientBox), 0, 0, 1, 1}, + {&__pyx_n_s_centers, __pyx_k_centers, sizeof(__pyx_k_centers), 0, 0, 1, 1}, + {&__pyx_n_s_charges, __pyx_k_charges, sizeof(__pyx_k_charges), 0, 0, 1, 1}, + {&__pyx_n_s_charges1, __pyx_k_charges1, sizeof(__pyx_k_charges1), 0, 0, 1, 1}, + {&__pyx_n_s_checkHBond, __pyx_k_checkHBond, sizeof(__pyx_k_checkHBond), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_cn, __pyx_k_cn, sizeof(__pyx_k_cn), 0, 0, 1, 1}, + {&__pyx_n_s_coct, __pyx_k_coct, sizeof(__pyx_k_coct), 0, 0, 1, 1}, + {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, + {&__pyx_kp_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 0}, + {&__pyx_n_s_collectiveDipoleMomentWaterShell, __pyx_k_collectiveDipoleMomentWaterShell, sizeof(__pyx_k_collectiveDipoleMomentWaterShell), 0, 0, 1, 1}, + {&__pyx_n_s_com, __pyx_k_com, sizeof(__pyx_k_com), 0, 0, 1, 1}, + {&__pyx_n_s_comByResidue, __pyx_k_comByResidue, sizeof(__pyx_k_comByResidue), 0, 0, 1, 1}, + {&__pyx_n_s_coms, __pyx_k_coms, sizeof(__pyx_k_coms), 0, 0, 1, 1}, + {&__pyx_n_s_comslt, __pyx_k_comslt, sizeof(__pyx_k_comslt), 0, 0, 1, 1}, + {&__pyx_n_s_conjugate, __pyx_k_conjugate, sizeof(__pyx_k_conjugate), 0, 0, 1, 1}, + {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, + {&__pyx_n_s_coo_H, __pyx_k_coo_H, sizeof(__pyx_k_coo_H), 0, 0, 1, 1}, + {&__pyx_n_s_coo_center, __pyx_k_coo_center, sizeof(__pyx_k_coo_center), 0, 0, 1, 1}, + {&__pyx_n_s_coor, __pyx_k_coor, sizeof(__pyx_k_coor), 0, 0, 1, 1}, + {&__pyx_n_s_coorA, __pyx_k_coorA, sizeof(__pyx_k_coorA), 0, 0, 1, 1}, + {&__pyx_n_s_coorB, __pyx_k_coorB, sizeof(__pyx_k_coorB), 0, 0, 1, 1}, + {&__pyx_n_s_coor_core, __pyx_k_coor_core, sizeof(__pyx_k_coor_core), 0, 0, 1, 1}, + {&__pyx_n_s_coor_oh2, __pyx_k_coor_oh2, sizeof(__pyx_k_coor_oh2), 0, 0, 1, 1}, + {&__pyx_n_s_coor_surr, __pyx_k_coor_surr, sizeof(__pyx_k_coor_surr), 0, 0, 1, 1}, + {&__pyx_n_s_corrsubmean, __pyx_k_corrsubmean, sizeof(__pyx_k_corrsubmean), 0, 0, 1, 1}, + {&__pyx_n_s_cosine, __pyx_k_cosine, sizeof(__pyx_k_cosine), 0, 0, 1, 1}, + {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, + {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, + {&__pyx_n_s_cxyz, __pyx_k_cxyz, sizeof(__pyx_k_cxyz), 0, 0, 1, 1}, + {&__pyx_n_s_data_x, __pyx_k_data_x, sizeof(__pyx_k_data_x), 0, 0, 1, 1}, + {&__pyx_n_s_data_y, __pyx_k_data_y, sizeof(__pyx_k_data_y), 0, 0, 1, 1}, + {&__pyx_n_s_deltaA, __pyx_k_deltaA, sizeof(__pyx_k_deltaA), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_n_s_dip, __pyx_k_dip, sizeof(__pyx_k_dip), 0, 0, 1, 1}, + {&__pyx_n_s_dipByResidue, __pyx_k_dipByResidue, sizeof(__pyx_k_dipByResidue), 0, 0, 1, 1}, + {&__pyx_n_s_dipT0, __pyx_k_dipT0, sizeof(__pyx_k_dipT0), 0, 0, 1, 1}, + {&__pyx_n_s_dipTen, __pyx_k_dipTen, sizeof(__pyx_k_dipTen), 0, 0, 1, 1}, + {&__pyx_n_s_dipTenCorrel, __pyx_k_dipTenCorrel, sizeof(__pyx_k_dipTenCorrel), 0, 0, 1, 1}, + {&__pyx_n_s_dipTenInit, __pyx_k_dipTenInit, sizeof(__pyx_k_dipTenInit), 0, 0, 1, 1}, + {&__pyx_n_s_dipTt0, __pyx_k_dipTt0, sizeof(__pyx_k_dipTt0), 0, 0, 1, 1}, + {&__pyx_n_s_dipTt1, __pyx_k_dipTt1, sizeof(__pyx_k_dipTt1), 0, 0, 1, 1}, + {&__pyx_n_s_dipTt2, __pyx_k_dipTt2, sizeof(__pyx_k_dipTt2), 0, 0, 1, 1}, + {&__pyx_n_s_dipTt3, __pyx_k_dipTt3, sizeof(__pyx_k_dipTt3), 0, 0, 1, 1}, + {&__pyx_n_s_dipTt4, __pyx_k_dipTt4, sizeof(__pyx_k_dipTt4), 0, 0, 1, 1}, + {&__pyx_n_s_dipTt5, __pyx_k_dipTt5, sizeof(__pyx_k_dipTt5), 0, 0, 1, 1}, + {&__pyx_n_s_dip_wat, __pyx_k_dip_wat, sizeof(__pyx_k_dip_wat), 0, 0, 1, 1}, + {&__pyx_n_s_dipol, __pyx_k_dipol, sizeof(__pyx_k_dipol), 0, 0, 1, 1}, + {&__pyx_n_s_dipoleMomentNeutralSelection, __pyx_k_dipoleMomentNeutralSelection, sizeof(__pyx_k_dipoleMomentNeutralSelection), 0, 0, 1, 1}, + {&__pyx_n_s_dipt, __pyx_k_dipt, sizeof(__pyx_k_dipt), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1}, + {&__pyx_n_s_dist2, __pyx_k_dist2, sizeof(__pyx_k_dist2), 0, 0, 1, 1}, + {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1}, + {&__pyx_n_s_dot2, __pyx_k_dot2, sizeof(__pyx_k_dot2), 0, 0, 1, 1}, + {&__pyx_n_s_drude, __pyx_k_drude, sizeof(__pyx_k_drude), 0, 0, 1, 1}, + {&__pyx_n_s_ds, __pyx_k_ds, sizeof(__pyx_k_ds), 0, 0, 1, 1}, + {&__pyx_n_s_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, + {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1}, + {&__pyx_n_s_dx2, __pyx_k_dx2, sizeof(__pyx_k_dx2), 0, 0, 1, 1}, + {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1}, + {&__pyx_n_s_dy2, __pyx_k_dy2, sizeof(__pyx_k_dy2), 0, 0, 1, 1}, + {&__pyx_n_s_dz, __pyx_k_dz, sizeof(__pyx_k_dz), 0, 0, 1, 1}, + {&__pyx_n_s_dz2, __pyx_k_dz2, sizeof(__pyx_k_dz2), 0, 0, 1, 1}, + {&__pyx_n_s_edip, __pyx_k_edip, sizeof(__pyx_k_edip), 0, 0, 1, 1}, + {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, + {&__pyx_n_s_energy, __pyx_k_energy, sizeof(__pyx_k_energy), 0, 0, 1, 1}, + {&__pyx_n_s_energy_ind, __pyx_k_energy_ind, sizeof(__pyx_k_energy_ind), 0, 0, 1, 1}, + {&__pyx_n_s_energy_octant, __pyx_k_energy_octant, sizeof(__pyx_k_energy_octant), 0, 0, 1, 1}, + {&__pyx_n_s_energy_octant_per_atom, __pyx_k_energy_octant_per_atom, sizeof(__pyx_k_energy_octant_per_atom), 0, 0, 1, 1}, + {&__pyx_n_s_energy_per_atom, __pyx_k_energy_per_atom, sizeof(__pyx_k_energy_per_atom), 0, 0, 1, 1}, + {&__pyx_n_s_energy_perm, __pyx_k_energy_perm, sizeof(__pyx_k_energy_perm), 0, 0, 1, 1}, + {&__pyx_n_s_energy_xyz, __pyx_k_energy_xyz, sizeof(__pyx_k_energy_xyz), 0, 0, 1, 1}, + {&__pyx_n_s_energy_xyz_per_atom, __pyx_k_energy_xyz_per_atom, sizeof(__pyx_k_energy_xyz_per_atom), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_epa, __pyx_k_epa, sizeof(__pyx_k_epa), 0, 0, 1, 1}, + {&__pyx_n_s_epa1, __pyx_k_epa1, sizeof(__pyx_k_epa1), 0, 0, 1, 1}, + {&__pyx_n_s_epa_ind, __pyx_k_epa_ind, sizeof(__pyx_k_epa_ind), 0, 0, 1, 1}, + {&__pyx_n_s_epa_oct, __pyx_k_epa_oct, sizeof(__pyx_k_epa_oct), 0, 0, 1, 1}, + {&__pyx_n_s_epa_perm, __pyx_k_epa_perm, sizeof(__pyx_k_epa_perm), 0, 0, 1, 1}, + {&__pyx_n_s_epa_xyz, __pyx_k_epa_xyz, sizeof(__pyx_k_epa_xyz), 0, 0, 1, 1}, + {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, + {&__pyx_n_s_exclude_begin, __pyx_k_exclude_begin, sizeof(__pyx_k_exclude_begin), 0, 0, 1, 1}, + {&__pyx_n_s_exclude_end, __pyx_k_exclude_end, sizeof(__pyx_k_exclude_end), 0, 0, 1, 1}, + {&__pyx_n_s_f1, __pyx_k_f1, sizeof(__pyx_k_f1), 0, 0, 1, 1}, + {&__pyx_n_s_f2, __pyx_k_f2, sizeof(__pyx_k_f2), 0, 0, 1, 1}, + {&__pyx_n_s_f2_0, __pyx_k_f2_0, sizeof(__pyx_k_f2_0), 0, 0, 1, 1}, + {&__pyx_n_s_f2_1, __pyx_k_f2_1, sizeof(__pyx_k_f2_1), 0, 0, 1, 1}, + {&__pyx_n_s_f2_2, __pyx_k_f2_2, sizeof(__pyx_k_f2_2), 0, 0, 1, 1}, + {&__pyx_n_s_f2_x, __pyx_k_f2_x, sizeof(__pyx_k_f2_x), 0, 0, 1, 1}, + {&__pyx_n_s_f2_y, __pyx_k_f2_y, sizeof(__pyx_k_f2_y), 0, 0, 1, 1}, + {&__pyx_n_s_f2_z, __pyx_k_f2_z, sizeof(__pyx_k_f2_z), 0, 0, 1, 1}, + {&__pyx_n_s_findDS, __pyx_k_findDS, sizeof(__pyx_k_findDS), 0, 0, 1, 1}, + {&__pyx_n_s_findNearestAtom, __pyx_k_findNearestAtom, sizeof(__pyx_k_findNearestAtom), 0, 0, 1, 1}, + {&__pyx_n_s_first, __pyx_k_first, sizeof(__pyx_k_first), 0, 0, 1, 1}, + {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, + {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, + {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, + {&__pyx_n_s_frame, __pyx_k_frame, sizeof(__pyx_k_frame), 0, 0, 1, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_n_s_gfunc, __pyx_k_gfunc, sizeof(__pyx_k_gfunc), 0, 0, 1, 1}, + {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0}, + {&__pyx_kp_u_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 1, 0, 0}, + {&__pyx_n_s_hbond, __pyx_k_hbond, sizeof(__pyx_k_hbond), 0, 0, 1, 1}, + {&__pyx_n_s_histo, __pyx_k_histo, sizeof(__pyx_k_histo), 0, 0, 1, 1}, + {&__pyx_n_s_histo_bins, __pyx_k_histo_bins, sizeof(__pyx_k_histo_bins), 0, 0, 1, 1}, + {&__pyx_n_s_histo_error, __pyx_k_histo_error, sizeof(__pyx_k_histo_error), 0, 0, 1, 1}, + {&__pyx_n_s_histo_ind, __pyx_k_histo_ind, sizeof(__pyx_k_histo_ind), 0, 0, 1, 1}, + {&__pyx_n_s_histo_max, __pyx_k_histo_max, sizeof(__pyx_k_histo_max), 0, 0, 1, 1}, + {&__pyx_n_s_histo_min, __pyx_k_histo_min, sizeof(__pyx_k_histo_min), 0, 0, 1, 1}, + {&__pyx_n_s_histo_perm, __pyx_k_histo_perm, sizeof(__pyx_k_histo_perm), 0, 0, 1, 1}, + {&__pyx_n_s_histo_width, __pyx_k_histo_width, sizeof(__pyx_k_histo_width), 0, 0, 1, 1}, + {&__pyx_n_s_hs, __pyx_k_hs, sizeof(__pyx_k_hs), 0, 0, 1, 1}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1}, + {&__pyx_n_s_idx2, __pyx_k_idx2, sizeof(__pyx_k_idx2), 0, 0, 1, 1}, + {&__pyx_n_s_idx3, __pyx_k_idx3, sizeof(__pyx_k_idx3), 0, 0, 1, 1}, + {&__pyx_n_s_idx4, __pyx_k_idx4, sizeof(__pyx_k_idx4), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_ind, __pyx_k_ind, sizeof(__pyx_k_ind), 0, 0, 1, 1}, + {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, + {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1}, + {&__pyx_n_s_integral, __pyx_k_integral, sizeof(__pyx_k_integral), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_islt, __pyx_k_islt, sizeof(__pyx_k_islt), 0, 0, 1, 1}, + {&__pyx_n_s_isolute, __pyx_k_isolute, sizeof(__pyx_k_isolute), 0, 0, 1, 1}, + {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, + {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, + {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, + {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, + {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, + {&__pyx_n_s_l1, __pyx_k_l1, sizeof(__pyx_k_l1), 0, 0, 1, 1}, + {&__pyx_n_s_l2, __pyx_k_l2, sizeof(__pyx_k_l2), 0, 0, 1, 1}, + {&__pyx_n_s_laplace_im, __pyx_k_laplace_im, sizeof(__pyx_k_laplace_im), 0, 0, 1, 1}, + {&__pyx_n_s_laplace_re, __pyx_k_laplace_re, sizeof(__pyx_k_laplace_re), 0, 0, 1, 1}, + {&__pyx_n_s_last, __pyx_k_last, sizeof(__pyx_k_last), 0, 0, 1, 1}, + {&__pyx_n_s_len_H, __pyx_k_len_H, sizeof(__pyx_k_len_H), 0, 0, 1, 1}, + {&__pyx_n_s_len_center, __pyx_k_len_center, sizeof(__pyx_k_len_center), 0, 0, 1, 1}, + {&__pyx_n_s_lmax, __pyx_k_lmax, sizeof(__pyx_k_lmax), 0, 0, 1, 1}, + {&__pyx_n_s_m1, __pyx_k_m1, sizeof(__pyx_k_m1), 0, 0, 1, 1}, + {&__pyx_n_s_m1r, __pyx_k_m1r, sizeof(__pyx_k_m1r), 0, 0, 1, 1}, + {&__pyx_n_s_m2, __pyx_k_m2, sizeof(__pyx_k_m2), 0, 0, 1, 1}, + {&__pyx_n_s_m2r, __pyx_k_m2r, sizeof(__pyx_k_m2r), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_masses, __pyx_k_masses, sizeof(__pyx_k_masses), 0, 0, 1, 1}, + {&__pyx_n_s_maxdist, __pyx_k_maxdist, sizeof(__pyx_k_maxdist), 0, 0, 1, 1}, + {&__pyx_n_s_maxshell, __pyx_k_maxshell, sizeof(__pyx_k_maxshell), 0, 0, 1, 1}, + {&__pyx_n_s_mdcage_ts, __pyx_k_mdcage_ts, sizeof(__pyx_k_mdcage_ts), 0, 0, 1, 1}, + {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, + {&__pyx_n_s_mindist, __pyx_k_mindist, sizeof(__pyx_k_mindist), 0, 0, 1, 1}, + {&__pyx_n_s_mindist2, __pyx_k_mindist2, sizeof(__pyx_k_mindist2), 0, 0, 1, 1}, + {&__pyx_n_s_minvec, __pyx_k_minvec, sizeof(__pyx_k_minvec), 0, 0, 1, 1}, + {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_msd, __pyx_k_msd, sizeof(__pyx_k_msd), 0, 0, 1, 1}, + {&__pyx_n_s_mu_solute, __pyx_k_mu_solute, sizeof(__pyx_k_mu_solute), 0, 0, 1, 1}, + {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, + {&__pyx_n_s_n1, __pyx_k_n1, sizeof(__pyx_k_n1), 0, 0, 1, 1}, + {&__pyx_n_s_n2, __pyx_k_n2, sizeof(__pyx_k_n2), 0, 0, 1, 1}, + {&__pyx_n_s_n3, __pyx_k_n3, sizeof(__pyx_k_n3), 0, 0, 1, 1}, + {&__pyx_n_s_n_core, __pyx_k_n_core, sizeof(__pyx_k_n_core), 0, 0, 1, 1}, + {&__pyx_n_s_n_surr, __pyx_k_n_surr, sizeof(__pyx_k_n_surr), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_s_nat, __pyx_k_nat, sizeof(__pyx_k_nat), 0, 0, 1, 1}, + {&__pyx_n_s_natoms, __pyx_k_natoms, sizeof(__pyx_k_natoms), 0, 0, 1, 1}, + {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_n_s_newanalysis_helpers, __pyx_k_newanalysis_helpers, sizeof(__pyx_k_newanalysis_helpers), 0, 0, 1, 1}, + {&__pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_k_newanalysis_helpers_helpers_pyx, sizeof(__pyx_k_newanalysis_helpers_helpers_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_next_id, __pyx_k_next_id, sizeof(__pyx_k_next_id), 0, 0, 1, 1}, + {&__pyx_n_s_nmol, __pyx_k_nmol, sizeof(__pyx_k_nmol), 0, 0, 1, 1}, + {&__pyx_n_s_nmolecules, __pyx_k_nmolecules, sizeof(__pyx_k_nmolecules), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, + {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_nres, __pyx_k_nres, sizeof(__pyx_k_nres), 0, 0, 1, 1}, + {&__pyx_n_s_nres_surr, __pyx_k_nres_surr, sizeof(__pyx_k_nres_surr), 0, 0, 1, 1}, + {&__pyx_n_s_nres_wat, __pyx_k_nres_wat, sizeof(__pyx_k_nres_wat), 0, 0, 1, 1}, + {&__pyx_n_s_nshells, __pyx_k_nshells, sizeof(__pyx_k_nshells), 0, 0, 1, 1}, + {&__pyx_n_s_nshells2, __pyx_k_nshells2, sizeof(__pyx_k_nshells2), 0, 0, 1, 1}, + {&__pyx_n_s_nsurr, __pyx_k_nsurr, sizeof(__pyx_k_nsurr), 0, 0, 1, 1}, + {&__pyx_n_s_nt, __pyx_k_nt, sizeof(__pyx_k_nt), 0, 0, 1, 1}, + {&__pyx_n_s_numpoints, __pyx_k_numpoints, sizeof(__pyx_k_numpoints), 0, 0, 1, 1}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, + {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, + {&__pyx_n_s_nwat, __pyx_k_nwat, sizeof(__pyx_k_nwat), 0, 0, 1, 1}, + {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, + {&__pyx_n_s_octants, __pyx_k_octants, sizeof(__pyx_k_octants), 0, 0, 1, 1}, + {&__pyx_n_s_oxyquinol, __pyx_k_oxyquinol, sizeof(__pyx_k_oxyquinol), 0, 0, 1, 1}, + {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_pol, __pyx_k_pol, sizeof(__pyx_k_pol), 0, 0, 1, 1}, + {&__pyx_n_s_pyE, __pyx_k_pyE, sizeof(__pyx_k_pyE), 0, 0, 1, 1}, + {&__pyx_n_s_py_B1, __pyx_k_py_B1, sizeof(__pyx_k_py_B1), 0, 0, 1, 1}, + {&__pyx_n_s_py_B2, __pyx_k_py_B2, sizeof(__pyx_k_py_B2), 0, 0, 1, 1}, + {&__pyx_n_s_py_B3, __pyx_k_py_B3, sizeof(__pyx_k_py_B3), 0, 0, 1, 1}, + {&__pyx_n_s_py_charges, __pyx_k_py_charges, sizeof(__pyx_k_py_charges), 0, 0, 1, 1}, + {&__pyx_n_s_py_dipt, __pyx_k_py_dipt, sizeof(__pyx_k_py_dipt), 0, 0, 1, 1}, + {&__pyx_n_s_py_xyz, __pyx_k_py_xyz, sizeof(__pyx_k_py_xyz), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1}, + {&__pyx_n_s_qq, __pyx_k_qq, sizeof(__pyx_k_qq), 0, 0, 1, 1}, + {&__pyx_n_s_qq_diff, __pyx_k_qq_diff, sizeof(__pyx_k_qq_diff), 0, 0, 1, 1}, + {&__pyx_n_s_qqr, __pyx_k_qqr, sizeof(__pyx_k_qqr), 0, 0, 1, 1}, + {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1}, + {&__pyx_n_s_r2, __pyx_k_r2, sizeof(__pyx_k_r2), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1}, + {&__pyx_n_s_rep, __pyx_k_rep, sizeof(__pyx_k_rep), 0, 0, 1, 1}, + {&__pyx_n_s_residue_first_atom, __pyx_k_residue_first_atom, sizeof(__pyx_k_residue_first_atom), 0, 0, 1, 1}, + {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, + {&__pyx_n_s_rfa, __pyx_k_rfa, sizeof(__pyx_k_rfa), 0, 0, 1, 1}, + {&__pyx_n_s_roxy, __pyx_k_roxy, sizeof(__pyx_k_roxy), 0, 0, 1, 1}, + {&__pyx_n_s_rtre, __pyx_k_rtre, sizeof(__pyx_k_rtre), 0, 0, 1, 1}, + {&__pyx_n_s_rv, __pyx_k_rv, sizeof(__pyx_k_rv), 0, 0, 1, 1}, + {&__pyx_n_s_rvec0, __pyx_k_rvec0, sizeof(__pyx_k_rvec0), 0, 0, 1, 1}, + {&__pyx_n_s_rvec1, __pyx_k_rvec1, sizeof(__pyx_k_rvec1), 0, 0, 1, 1}, + {&__pyx_n_s_rvec2, __pyx_k_rvec2, sizeof(__pyx_k_rvec2), 0, 0, 1, 1}, + {&__pyx_n_s_scipy_special, __pyx_k_scipy_special, sizeof(__pyx_k_scipy_special), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_shell, __pyx_k_shell, sizeof(__pyx_k_shell), 0, 0, 1, 1}, + {&__pyx_n_s_shift, __pyx_k_shift, sizeof(__pyx_k_shift), 0, 0, 1, 1}, + {&__pyx_n_s_sites_per_res, __pyx_k_sites_per_res, sizeof(__pyx_k_sites_per_res), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_sphHarmMatrix, __pyx_k_sphHarmMatrix, sizeof(__pyx_k_sphHarmMatrix), 0, 0, 1, 1}, + {&__pyx_n_s_sph_harm, __pyx_k_sph_harm, sizeof(__pyx_k_sph_harm), 0, 0, 1, 1}, + {&__pyx_n_s_squared_r_oxy, __pyx_k_squared_r_oxy, sizeof(__pyx_k_squared_r_oxy), 0, 0, 1, 1}, + {&__pyx_n_s_squared_r_tre, __pyx_k_squared_r_tre, sizeof(__pyx_k_squared_r_tre), 0, 0, 1, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, + {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, + {&__pyx_n_s_store, __pyx_k_store, sizeof(__pyx_k_store), 0, 0, 1, 1}, + {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_n_s_sumMDCage, __pyx_k_sumMDCage, sizeof(__pyx_k_sumMDCage), 0, 0, 1, 1}, + {&__pyx_n_s_sumMDCageSingle, __pyx_k_sumMDCageSingle, sizeof(__pyx_k_sumMDCageSingle), 0, 0, 1, 1}, + {&__pyx_n_s_sumr, __pyx_k_sumr, sizeof(__pyx_k_sumr), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_timectr, __pyx_k_timectr, sizeof(__pyx_k_timectr), 0, 0, 1, 1}, + {&__pyx_n_s_tmp, __pyx_k_tmp, sizeof(__pyx_k_tmp), 0, 0, 1, 1}, + {&__pyx_n_s_tmp_ener, __pyx_k_tmp_ener, sizeof(__pyx_k_tmp_ener), 0, 0, 1, 1}, + {&__pyx_n_s_tmp_ind, __pyx_k_tmp_ind, sizeof(__pyx_k_tmp_ind), 0, 0, 1, 1}, + {&__pyx_n_s_tmp_perm, __pyx_k_tmp_perm, sizeof(__pyx_k_tmp_perm), 0, 0, 1, 1}, + {&__pyx_n_s_tmp_x, __pyx_k_tmp_x, sizeof(__pyx_k_tmp_x), 0, 0, 1, 1}, + {&__pyx_n_s_tmp_y, __pyx_k_tmp_y, sizeof(__pyx_k_tmp_y), 0, 0, 1, 1}, + {&__pyx_n_s_tmp_z, __pyx_k_tmp_z, sizeof(__pyx_k_tmp_z), 0, 0, 1, 1}, + {&__pyx_n_s_tmpx, __pyx_k_tmpx, sizeof(__pyx_k_tmpx), 0, 0, 1, 1}, + {&__pyx_n_s_tmpy, __pyx_k_tmpy, sizeof(__pyx_k_tmpy), 0, 0, 1, 1}, + {&__pyx_n_s_tmpz, __pyx_k_tmpz, sizeof(__pyx_k_tmpz), 0, 0, 1, 1}, + {&__pyx_n_s_tn, __pyx_k_tn, sizeof(__pyx_k_tn), 0, 0, 1, 1}, + {&__pyx_n_s_tot_mass, __pyx_k_tot_mass, sizeof(__pyx_k_tot_mass), 0, 0, 1, 1}, + {&__pyx_n_s_transform, __pyx_k_transform, sizeof(__pyx_k_transform), 0, 0, 1, 1}, + {&__pyx_n_s_trehalose, __pyx_k_trehalose, sizeof(__pyx_k_trehalose), 0, 0, 1, 1}, + {&__pyx_n_s_ts, __pyx_k_ts, sizeof(__pyx_k_ts), 0, 0, 1, 1}, + {&__pyx_n_s_tyH, __pyx_k_tyH, sizeof(__pyx_k_tyH), 0, 0, 1, 1}, + {&__pyx_n_s_tzH, __pyx_k_tzH, sizeof(__pyx_k_tzH), 0, 0, 1, 1}, + {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, + {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, + {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_vel, __pyx_k_vel, sizeof(__pyx_k_vel), 0, 0, 1, 1}, + {&__pyx_n_s_velcom, __pyx_k_velcom, sizeof(__pyx_k_velcom), 0, 0, 1, 1}, + {&__pyx_n_s_velcomByResidue, __pyx_k_velcomByResidue, sizeof(__pyx_k_velcomByResidue), 0, 0, 1, 1}, + {&__pyx_n_s_vels, __pyx_k_vels, sizeof(__pyx_k_vels), 0, 0, 1, 1}, + {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, + {&__pyx_n_s_vol, __pyx_k_vol, sizeof(__pyx_k_vol), 0, 0, 1, 1}, + {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, + {&__pyx_n_s_waterRotationMatrix, __pyx_k_waterRotationMatrix, sizeof(__pyx_k_waterRotationMatrix), 0, 0, 1, 1}, + {&__pyx_n_s_wt, __pyx_k_wt, sizeof(__pyx_k_wt), 0, 0, 1, 1}, + {&__pyx_n_s_wt1, __pyx_k_wt1, sizeof(__pyx_k_wt1), 0, 0, 1, 1}, + {&__pyx_n_s_wts, __pyx_k_wts, sizeof(__pyx_k_wts), 0, 0, 1, 1}, + {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, + {&__pyx_n_s_xyz, __pyx_k_xyz, sizeof(__pyx_k_xyz), 0, 0, 1, 1}, + {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1}, + {&__pyx_n_s_y_mat, __pyx_k_y_mat, sizeof(__pyx_k_y_mat), 0, 0, 1, 1}, + {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1}, + {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 31, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 944, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 134, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 149, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 152, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error) - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 406, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 615, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 834, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 100, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 141, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 156, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 159, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 373, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 408, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 618, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 914, __pyx_L1_error) + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 983, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } +/* #### Code section: cached_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "src/helpers/helpers.pyx":189 - * cdef double[3] comslt - * cdef int i, j, k, nmol = com.shape[0] - * cdef double [:,:] R = np.zeros((3,3)) # <<<<<<<<<<<<<< - * cdef double tmpx, tmpy, tmpz - * - */ - __pyx_tuple_ = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - - /* "src/helpers/helpers.pyx":441 - * energy += epa[i] - * - * return energy * 1390.02, np.asarray(histo)[:,:] * 1390.02 , histo_error, np.asarray(count)[:,:] # <<<<<<<<<<<<<< + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - */ - __pyx_slice__2 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__2); - __Pyx_GIVEREF(__pyx_slice__2); - __pyx_tuple__3 = PyTuple_Pack(2, __pyx_slice__2, __pyx_slice__2); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - - /* "src/helpers/helpers.pyx":733 - * cdef int x, y, z, idx4, c1=cat_first, c2=cat_last, a1=an_first, a2=an_last - * cdef int *cds = ds.data - * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=1] energy_octant = np.zeros(8,dtype=np.float64) + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_int_8); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 733, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_New(1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 582, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_tuple__4, 0, __pyx_int_neg_1)) __PYX_ERR(1, 582, __pyx_L1_error); __Pyx_GIVEREF(__pyx_tuple__4); - /* "src/helpers/helpers.pyx":734 - * cdef int *cds = ds.data - * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) - * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=1] energy_octant = np.zeros(8,dtype=np.float64) + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); - /* "src/helpers/helpers.pyx":886 - * """ - * cdef double* c_rv = rv.data - * cdef np.ndarray[np.float64_t,ndim=1] dipt = np.empty(6,dtype=np.float64) # <<<<<<<<<<<<<< - * - * cdef double f1 = pow(r2,-1.5) + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_int_6); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 886, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_tuple__8 = PyTuple_Pack(3, __pyx_int_136983863, __pyx_int_112105877, __pyx_int_184977713); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 * __pyx_import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 944, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 950, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "View.MemoryView":134 - * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< - * - * if itemsize <= 0: - */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - - /* "View.MemoryView":137 - * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< - * - * if not isinstance(format, bytes): - */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 137, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 989, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/helpers.pyx":189 + * cdef double[3] comslt + * cdef int i, j, k, nmol = com.shape[0] + * cdef double [:,:] R = np.zeros((3,3)) # <<<<<<<<<<<<<< + * cdef double tmpx, tmpy, tmpz * */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 149, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":441 + * energy += epa[i] * - * if self.dtype_is_object: + * return energy * 1390.02, np.asarray(histo)[:,:] * 1390.02 , histo_error, np.asarray(count)[:,:] # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 177, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(2, __pyx_slice__5, __pyx_slice__5); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len + /* "newanalysis/helpers/helpers.pyx":733 + * cdef int x, y, z, idx4, c1=cat_first, c2=cat_last, a1=an_first, a2=an_last + * cdef int *cds = ds.data + * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=1] energy_octant = np.zeros(8,dtype=np.float64) */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 193, __pyx_L1_error) + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_int_8); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 733, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/helpers.pyx":734 + * cdef int *cds = ds.data + * cdef np.ndarray[np.float64_t,ndim=1] energy = np.zeros(8,dtype=np.float64) + * cdef np.ndarray[np.float64_t,ndim=1] energy_xyz = np.zeros(3,dtype=np.float64) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=1] energy_octant = np.zeros(8,dtype=np.float64) + * */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 734, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/helpers.pyx":886 + * """ + * cdef double* c_rv = rv.data + * cdef np.ndarray[np.float64_t,ndim=1] dipt = np.empty(6,dtype=np.float64) # <<<<<<<<<<<<<< + * + * cdef double f1 = pow(r2,-1.5) */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_int_6); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 886, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< - * - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 420, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_sys); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16); - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 497, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_collections_abc); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: * - * if flags & PyBUF_ND: */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 522, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_collections); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); - /* "View.MemoryView":572 - * if self.view.strides == NULL: - * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< + /* "View.MemoryView":309 + * return self.name * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 309, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_tuple__20 = PyTuple_New(1); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 579, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_INCREF(__pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__20, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_tuple__20); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * */ - __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 314, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 705, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 315, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(1, 1, __pyx_L1_error) - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_tuple__26 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - - /* "src/helpers/helpers.pyx":24 + /* "newanalysis/helpers/helpers.pyx":23 + * return ( 0.0 < val) * - * @cython.boundscheck(False) - * def SphereinCube(double A, int numpoints, double gfunc, double deltaA): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def SphereinCube(double A, int numpoints, double gfunc, double deltaA): * cdef int i, j, k, sumr - * cdef double vol,x,y,z */ - __pyx_tuple__27 = PyTuple_Pack(12, __pyx_n_s_A, __pyx_n_s_numpoints, __pyx_n_s_gfunc, __pyx_n_s_deltaA, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_sumr, __pyx_n_s_vol, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_SphereinCube, 24, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(12, __pyx_n_s_A, __pyx_n_s_numpoints, __pyx_n_s_gfunc, __pyx_n_s_deltaA, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_sumr, __pyx_n_s_vol, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_SphereinCube, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 23, __pyx_L1_error) - /* "src/helpers/helpers.pyx":41 + /* "newanalysis/helpers/helpers.pyx":40 + * return(sumr) * - * @cython.boundscheck(False) - * def velcomByResidue(double [:,:] vels, double [:] masses, int nres, int [:] apr, int [:] rfa): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def velcomByResidue(double [:,:] vels, double [:] masses, int nres, int [:] apr, int [:] rfa): * """ - * velcomByResidue(vels,masses,nres,atoms_per_residue) */ - __pyx_tuple__29 = PyTuple_Pack(11, __pyx_n_s_vels, __pyx_n_s_masses, __pyx_n_s_nres, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_velcom, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_actr, __pyx_n_s_tot_mass); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_velcomByResidue, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(11, __pyx_n_s_vels, __pyx_n_s_masses, __pyx_n_s_nres, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_velcom, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_actr, __pyx_n_s_tot_mass); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_velcomByResidue, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 40, __pyx_L1_error) - /* "src/helpers/helpers.pyx":71 + /* "newanalysis/helpers/helpers.pyx":70 + * return np.asarray(velcom) * - * @cython.boundscheck(False) - * def comByResidue(double [:,:] coor, double [:] masses, int nres, int [:] apr, int [:] rfa): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def comByResidue(double [:,:] coor, double [:] masses, int nres, int [:] apr, int [:] rfa): * """ - * comByResidue(coor,masses,nres,atoms_per_residue) */ - __pyx_tuple__31 = PyTuple_Pack(11, __pyx_n_s_coor, __pyx_n_s_masses, __pyx_n_s_nres, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_com, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_actr, __pyx_n_s_tot_mass); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_comByResidue, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(11, __pyx_n_s_coor, __pyx_n_s_masses, __pyx_n_s_nres, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_com, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_actr, __pyx_n_s_tot_mass); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_comByResidue, 70, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 70, __pyx_L1_error) - /* "src/helpers/helpers.pyx":101 + /* "newanalysis/helpers/helpers.pyx":100 + * return np.asarray(com) * - * @cython.boundscheck(False) - * def dipByResidue(double [:,:] coor, double [:] charges, double [:] masses, int nres, int [:] apr, int [:] rfa, double [:,:] com): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipByResidue(double [:,:] coor, double [:] charges, double [:] masses, int nres, int [:] apr, int [:] rfa, double [:,:] com): * """ - * dipByResidue(coor,charges,masses,nresidues,atoms_per_residue,com) */ - __pyx_tuple__33 = PyTuple_Pack(12, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_masses, __pyx_n_s_nres, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_com, __pyx_n_s_dip, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_actr); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_dipByResidue, 101, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_tuple__32 = PyTuple_Pack(12, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_masses, __pyx_n_s_nres, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_com, __pyx_n_s_dip, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_actr); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_dipByResidue, 100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 100, __pyx_L1_error) - /* "src/helpers/helpers.pyx":126 + /* "newanalysis/helpers/helpers.pyx":125 + * return np.asarray(dip) * - * @cython.boundscheck(False) - * def dipoleMomentNeutralSelection(double [:,:] coor, double [:] charges): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipoleMomentNeutralSelection(double [:,:] coor, double [:] charges): * - * cdef double [:] dip = np.zeros(3) */ - __pyx_tuple__35 = PyTuple_Pack(5, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_dip, __pyx_n_s_i, __pyx_n_s_natoms); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_dipoleMomentNeutralSelection, 126, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(5, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_dip, __pyx_n_s_i, __pyx_n_s_natoms); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_dipoleMomentNeutralSelection, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 125, __pyx_L1_error) - /* "src/helpers/helpers.pyx":140 + /* "newanalysis/helpers/helpers.pyx":139 * - * @cython.boundscheck(False) - * def collectiveDipoleMomentWaterShells(double [:,:] coor, double [:] charges, int [:] ds, int nshells): # <<<<<<<<<<<<<< * - * cdef int i,j,shell + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def collectiveDipoleMomentWaterShells(double [:,:] coor, double [:] charges, int [:] ds, int nshells): + * */ - __pyx_tuple__37 = PyTuple_Pack(10, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_shell, __pyx_n_s_natoms, __pyx_n_s_nmol, __pyx_n_s_dip); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_collectiveDipoleMomentWaterShell, 140, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_tuple__36 = PyTuple_Pack(10, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_shell, __pyx_n_s_natoms, __pyx_n_s_nmol, __pyx_n_s_dip); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_collectiveDipoleMomentWaterShell, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 139, __pyx_L1_error) - /* "src/helpers/helpers.pyx":159 + /* "newanalysis/helpers/helpers.pyx":158 * - * @cython.boundscheck(False) - * def atomicCurrent(double [:,:] vel, double [:] charges, double [:,:] result, int ctr): # <<<<<<<<<<<<<< - * cdef int i, natoms=len(vel) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicCurrent(double [:,:] vel, double [:] charges, double [:,:] result, int ctr): + * cdef int i, natoms=len(vel) */ - __pyx_tuple__39 = PyTuple_Pack(6, __pyx_n_s_vel, __pyx_n_s_charges, __pyx_n_s_result, __pyx_n_s_ctr, __pyx_n_s_i, __pyx_n_s_natoms); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_atomicCurrent, 159, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_tuple__38 = PyTuple_Pack(6, __pyx_n_s_vel, __pyx_n_s_charges, __pyx_n_s_result, __pyx_n_s_ctr, __pyx_n_s_i, __pyx_n_s_natoms); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_atomicCurrent, 158, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 158, __pyx_L1_error) - /* "src/helpers/helpers.pyx":168 + /* "newanalysis/helpers/helpers.pyx":167 + * result[ctr,2] += vel[i,2] * charges[i] * - * @cython.boundscheck(False) - * def centerOrientBox(double [:,:] com, double [:,:] coor, double boxl, int isolute, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def centerOrientBox(double [:,:] com, double [:,:] coor, double boxl, int isolute, * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): - * """ */ - __pyx_tuple__41 = PyTuple_Pack(18, __pyx_n_s_com, __pyx_n_s_coor, __pyx_n_s_boxl, __pyx_n_s_isolute, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_coorA, __pyx_n_s_coorB, __pyx_n_s_shift, __pyx_n_s_comslt, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_nmol, __pyx_n_s_R, __pyx_n_s_tmpx, __pyx_n_s_tmpy, __pyx_n_s_tmpz); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(8, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_centerOrientBox, 168, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_tuple__40 = PyTuple_Pack(18, __pyx_n_s_com, __pyx_n_s_coor, __pyx_n_s_boxl, __pyx_n_s_isolute, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_coorA, __pyx_n_s_coorB, __pyx_n_s_shift, __pyx_n_s_comslt, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_nmol, __pyx_n_s_R, __pyx_n_s_tmpx, __pyx_n_s_tmpy, __pyx_n_s_tmpz); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_centerOrientBox, 167, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 167, __pyx_L1_error) - /* "src/helpers/helpers.pyx":216 + /* "newanalysis/helpers/helpers.pyx":215 + * coor[i,2] = tmpz * - * @cython.boundscheck(False) - * def centerToPointOrientBox(double [:,:] com, double [:,:] coor, double [:] center, double boxl, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def centerToPointOrientBox(double [:,:] com, double [:,:] coor, double [:] center, double boxl, * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): - * """ */ - __pyx_tuple__43 = PyTuple_Pack(17, __pyx_n_s_com, __pyx_n_s_coor, __pyx_n_s_center, __pyx_n_s_boxl, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_coorA, __pyx_n_s_coorB, __pyx_n_s_shift, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_nmol, __pyx_n_s_R, __pyx_n_s_tmpx, __pyx_n_s_tmpy, __pyx_n_s_tmpz); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(8, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_centerToPointOrientBox, 216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_tuple__42 = PyTuple_Pack(17, __pyx_n_s_com, __pyx_n_s_coor, __pyx_n_s_center, __pyx_n_s_boxl, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_coorA, __pyx_n_s_coorB, __pyx_n_s_shift, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_nmol, __pyx_n_s_R, __pyx_n_s_tmpx, __pyx_n_s_tmpy, __pyx_n_s_tmpz); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_centerToPointOrientBox, 215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 215, __pyx_L1_error) - /* "src/helpers/helpers.pyx":259 + /* "newanalysis/helpers/helpers.pyx":258 + * coor[i,2] = tmpz * - * @cython.boundscheck(False) - * def calcEnergyAA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol): * """ - * energy = calcEnergyAA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules) */ - __pyx_tuple__45 = PyTuple_Pack(17, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_epa, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_energy); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); - __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(6, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcEnergyAA, 259, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(17, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_epa, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_energy); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcEnergyAA, 258, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 258, __pyx_L1_error) - /* "src/helpers/helpers.pyx":294 + /* "newanalysis/helpers/helpers.pyx":293 + * return energy * 1390.02 * - * @cython.boundscheck(False) - * def calcEnergyMuA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double [:] mu_solute): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyMuA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double [:] mu_solute): * """ - * energy = calcEnergyMuA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,mu_solute) */ - __pyx_tuple__47 = PyTuple_Pack(15, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_mu_solute, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx2, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_energy); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__47); - __Pyx_GIVEREF(__pyx_tuple__47); - __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(7, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcEnergyMuA, 294, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 294, __pyx_L1_error) + __pyx_tuple__46 = PyTuple_Pack(15, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_mu_solute, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx2, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_energy); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcEnergyMuA, 293, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 293, __pyx_L1_error) - /* "src/helpers/helpers.pyx":322 + /* "newanalysis/helpers/helpers.pyx":321 + * return energy * 1390.02 * - * @cython.boundscheck(False) - * def calcEnergyAApermind(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAApermind(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude): * """ - * energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list) */ - __pyx_tuple__49 = PyTuple_Pack(25, __pyx_n_s_coor, __pyx_n_s_coms, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_first, __pyx_n_s_last, __pyx_n_s_drude, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_histo_error, __pyx_n_s_epa_ind, __pyx_n_s_epa_perm, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_qq, __pyx_n_s_energy_perm, __pyx_n_s_energy_ind, __pyx_n_s_qq_diff); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 322, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__49); - __Pyx_GIVEREF(__pyx_tuple__49); - __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(9, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcEnergyAApermind, 322, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 322, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(25, __pyx_n_s_coor, __pyx_n_s_coms, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_first, __pyx_n_s_last, __pyx_n_s_drude, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_histo_error, __pyx_n_s_epa_ind, __pyx_n_s_epa_perm, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_qq, __pyx_n_s_energy_perm, __pyx_n_s_energy_ind, __pyx_n_s_qq_diff); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcEnergyAApermind, 321, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 321, __pyx_L1_error) - /* "src/helpers/helpers.pyx":369 + /* "newanalysis/helpers/helpers.pyx":368 + * return energy_perm * 1390.02 , energy_ind * 1390.02 * - * @cython.boundscheck(False) - * def calcEnergyAAhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose, int[:] oxyquinol): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAAhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose, int[:] oxyquinol): * """ - * energy = calcEnergyAAhisto(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, min_histo, max_histo, bins_hist,array indices, array indices 2) */ - __pyx_tuple__51 = PyTuple_Pack(34, __pyx_n_s_coor, __pyx_n_s_coms, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_bins, __pyx_n_s_trehalose, __pyx_n_s_oxyquinol, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_histo_error, __pyx_n_s_epa, __pyx_n_s_histo, __pyx_n_s_count, __pyx_n_s_store, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_rtre, __pyx_n_s_tmp, __pyx_n_s_tmp_ener, __pyx_n_s_histo_width, __pyx_n_s_squared_r_tre, __pyx_n_s_squared_r_oxy, __pyx_n_s_energy, __pyx_n_s_roxy); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__51); - __Pyx_GIVEREF(__pyx_tuple__51); - __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(12, 0, 34, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcEnergyAAhisto, 369, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 369, __pyx_L1_error) + __pyx_tuple__50 = PyTuple_Pack(34, __pyx_n_s_coor, __pyx_n_s_coms, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_bins, __pyx_n_s_trehalose, __pyx_n_s_oxyquinol, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_histo_error, __pyx_n_s_epa, __pyx_n_s_histo, __pyx_n_s_count, __pyx_n_s_store, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_rtre, __pyx_n_s_tmp, __pyx_n_s_tmp_ener, __pyx_n_s_histo_width, __pyx_n_s_squared_r_tre, __pyx_n_s_squared_r_oxy, __pyx_n_s_energy, __pyx_n_s_roxy); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(12, 0, 0, 34, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcEnergyAAhisto, 368, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 368, __pyx_L1_error) - /* "src/helpers/helpers.pyx":444 + /* "newanalysis/helpers/helpers.pyx":443 + * return energy * 1390.02, np.asarray(histo)[:,:] * 1390.02 , histo_error, np.asarray(count)[:,:] * - * @cython.boundscheck(False) - * def calcEnergyAAhisto1(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAAhisto1(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose): * """ - * energy = calcEnergyAAhisto(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, min_histo, max_histo, bins_hist,array indices) */ - __pyx_tuple__53 = PyTuple_Pack(31, __pyx_n_s_coor, __pyx_n_s_coms, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_bins, __pyx_n_s_trehalose, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_histo_error, __pyx_n_s_epa, __pyx_n_s_histo, __pyx_n_s_count, __pyx_n_s_store, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_rtre, __pyx_n_s_tmp, __pyx_n_s_tmp_ener, __pyx_n_s_histo_width, __pyx_n_s_squared_r_tre, __pyx_n_s_energy); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__53); - __Pyx_GIVEREF(__pyx_tuple__53); - __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(11, 0, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcEnergyAAhisto1, 444, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 444, __pyx_L1_error) + __pyx_tuple__52 = PyTuple_Pack(31, __pyx_n_s_coor, __pyx_n_s_coms, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_bins, __pyx_n_s_trehalose, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_histo_error, __pyx_n_s_epa, __pyx_n_s_histo, __pyx_n_s_count, __pyx_n_s_store, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_rtre, __pyx_n_s_tmp, __pyx_n_s_tmp_ener, __pyx_n_s_histo_width, __pyx_n_s_squared_r_tre, __pyx_n_s_energy); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(11, 0, 0, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcEnergyAAhisto1, 443, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 443, __pyx_L1_error) - /* "src/helpers/helpers.pyx":511 + /* "newanalysis/helpers/helpers.pyx":510 + * return energy * 1390.02, np.asarray(histo)[:] * 1390.02 , histo_error, np.asarray(count)[:] * - * @cython.boundscheck(False) - * def calcEnergyAApermindhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude,double histo_min, double histo_max, int histo_bins,): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAApermindhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude,double histo_min, double histo_max, int histo_bins,): * """ - * energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list, min_histo, max_histo, bins_histo) */ - __pyx_tuple__55 = PyTuple_Pack(33, __pyx_n_s_coor, __pyx_n_s_coms, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_first, __pyx_n_s_last, __pyx_n_s_drude, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_bins, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_histo_error, __pyx_n_s_epa_ind, __pyx_n_s_epa_perm, __pyx_n_s_histo_perm, __pyx_n_s_histo_ind, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_qq, __pyx_n_s_energy_perm, __pyx_n_s_energy_ind, __pyx_n_s_histo_width, __pyx_n_s_tmp_perm, __pyx_n_s_tmp_ind, __pyx_n_s_qq_diff); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__55); - __Pyx_GIVEREF(__pyx_tuple__55); - __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(12, 0, 33, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcEnergyAApermindhisto, 511, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 511, __pyx_L1_error) + __pyx_tuple__54 = PyTuple_Pack(33, __pyx_n_s_coor, __pyx_n_s_coms, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_first, __pyx_n_s_last, __pyx_n_s_drude, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_histo_bins, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_histo_error, __pyx_n_s_epa_ind, __pyx_n_s_epa_perm, __pyx_n_s_histo_perm, __pyx_n_s_histo_ind, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_qq, __pyx_n_s_energy_perm, __pyx_n_s_energy_ind, __pyx_n_s_histo_width, __pyx_n_s_tmp_perm, __pyx_n_s_tmp_ind, __pyx_n_s_qq_diff); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 510, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(12, 0, 0, 33, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcEnergyAApermindhisto, 510, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 510, __pyx_L1_error) - /* "src/helpers/helpers.pyx":576 + /* "newanalysis/helpers/helpers.pyx":575 + * return energy_perm * 1390.02 , energy_ind * 1390.02, np.asarray(histo_perm)[:] * 1390.02, np.asarray(histo_ind)[:] * 1390.02 , histo_error * - * @cython.boundscheck(False) - * def calcEnergyAtomic(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAtomic(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): * """ - * energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules) */ - __pyx_tuple__57 = PyTuple_Pack(18, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_exclude_begin, __pyx_n_s_exclude_end, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_epa, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__57); - __Pyx_GIVEREF(__pyx_tuple__57); - __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(8, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcEnergyAtomic, 576, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 576, __pyx_L1_error) + __pyx_tuple__56 = PyTuple_Pack(18, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_exclude_begin, __pyx_n_s_exclude_end, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_epa, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); + __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcEnergyAtomic, 575, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 575, __pyx_L1_error) - /* "src/helpers/helpers.pyx":606 + /* "newanalysis/helpers/helpers.pyx":605 + * return np.asarray(epa)[:] * 1390.02 * - * @cython.boundscheck(False) - * def calcEnergyDouble(double [:,:] coor, double [:] charges1, int [:] apr, int [:] rfa, int isolute, int nmol, int start, int end): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyDouble(double [:,:] coor, double [:] charges1, int [:] apr, int [:] rfa, int isolute, int nmol, int start, int end): * """ - * energy = calcEnergyDouble(xyz, charges_1, charges_2, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,start_res,end_res) */ - __pyx_tuple__59 = PyTuple_Pack(18, __pyx_n_s_coor, __pyx_n_s_charges1, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_epa1, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 606, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__59); - __Pyx_GIVEREF(__pyx_tuple__59); - __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(8, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcEnergyDouble, 606, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 606, __pyx_L1_error) + __pyx_tuple__58 = PyTuple_Pack(18, __pyx_n_s_coor, __pyx_n_s_charges1, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_epa1, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__58); + __Pyx_GIVEREF(__pyx_tuple__58); + __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcEnergyDouble, 605, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 605, __pyx_L1_error) - /* "src/helpers/helpers.pyx":638 + /* "newanalysis/helpers/helpers.pyx":637 + * return np.asarray(epa1)[:] * 1390.02 * - * @cython.boundscheck(False) - * def calcDipDipEnergyAtomic(double [:,:] coms, double [:,:] dipol, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipDipEnergyAtomic(double [:,:] coms, double [:,:] dipol, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): * """ - * energy = calcDipDipEnergyAtomic(coms, dipol, resnum_solute, nmolecules) */ - __pyx_tuple__61 = PyTuple_Pack(9, __pyx_n_s_coms, __pyx_n_s_dipol, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_exclude_begin, __pyx_n_s_exclude_end, __pyx_n_s_i, __pyx_n_s_edip, __pyx_n_s_r); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__61); - __Pyx_GIVEREF(__pyx_tuple__61); - __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(6, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcDipDipEnergyAtomic, 638, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 638, __pyx_L1_error) + __pyx_tuple__60 = PyTuple_Pack(9, __pyx_n_s_coms, __pyx_n_s_dipol, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_exclude_begin, __pyx_n_s_exclude_end, __pyx_n_s_i, __pyx_n_s_edip, __pyx_n_s_r); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__60); + __Pyx_GIVEREF(__pyx_tuple__60); + __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcDipDipEnergyAtomic, 637, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 637, __pyx_L1_error) - /* "src/helpers/helpers.pyx":659 + /* "newanalysis/helpers/helpers.pyx":658 * - * @cython.boundscheck(False) - * def calcEnergyAtomicVoro(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, char [:] ds, int maxshell): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAtomicVoro(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, char [:] ds, int maxshell): * """ - * energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, delaunay_shell) */ - __pyx_tuple__63 = PyTuple_Pack(18, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_epa, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__63); - __Pyx_GIVEREF(__pyx_tuple__63); - __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(8, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcEnergyAtomicVoro, 659, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 659, __pyx_L1_error) + __pyx_tuple__62 = PyTuple_Pack(18, __pyx_n_s_coor, __pyx_n_s_charges, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_isolute, __pyx_n_s_nmol, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_epa, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__62); + __Pyx_GIVEREF(__pyx_tuple__62); + __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcEnergyAtomicVoro, 658, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 658, __pyx_L1_error) - /* "src/helpers/helpers.pyx":692 + /* "newanalysis/helpers/helpers.pyx":691 + * return np.asarray(epa)[:,:] * 1390.02 * - * @cython.boundscheck(False) - * def calcEnergyAASep(np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAASep(np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, * np.ndarray[np.float64_t,ndim=1] charges, - * np.ndarray[np.int32_t,ndim=1,mode="c"] atoms_per_residue, */ - __pyx_tuple__65 = PyTuple_Pack(48, __pyx_n_s_xyz, __pyx_n_s_charges, __pyx_n_s_atoms_per_residue, __pyx_n_s_residue_first_atom, __pyx_n_s_ds, __pyx_n_s_isolute, __pyx_n_s_nmolecules, __pyx_n_s_cat_first, __pyx_n_s_cat_last, __pyx_n_s_an_first, __pyx_n_s_an_last, __pyx_n_s_octants, __pyx_n_s_cxyz, __pyx_n_s_q, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_coct, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_idx3, __pyx_n_s_nmol, __pyx_n_s_islt, __pyx_n_s_energy_per_atom, __pyx_n_s_epa, __pyx_n_s_energy_xyz_per_atom, __pyx_n_s_epa_xyz, __pyx_n_s_energy_octant_per_atom, __pyx_n_s_epa_oct, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_qqr, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z, __pyx_n_s_idx4, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_a1, __pyx_n_s_a2, __pyx_n_s_cds, __pyx_n_s_energy, __pyx_n_s_energy_xyz, __pyx_n_s_energy_octant); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__65); - __Pyx_GIVEREF(__pyx_tuple__65); - __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(12, 0, 48, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcEnergyAASep, 692, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 692, __pyx_L1_error) + __pyx_tuple__64 = PyTuple_Pack(48, __pyx_n_s_xyz, __pyx_n_s_charges, __pyx_n_s_atoms_per_residue, __pyx_n_s_residue_first_atom, __pyx_n_s_ds, __pyx_n_s_isolute, __pyx_n_s_nmolecules, __pyx_n_s_cat_first, __pyx_n_s_cat_last, __pyx_n_s_an_first, __pyx_n_s_an_last, __pyx_n_s_octants, __pyx_n_s_cxyz, __pyx_n_s_q, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_coct, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_idx3, __pyx_n_s_nmol, __pyx_n_s_islt, __pyx_n_s_energy_per_atom, __pyx_n_s_epa, __pyx_n_s_energy_xyz_per_atom, __pyx_n_s_epa_xyz, __pyx_n_s_energy_octant_per_atom, __pyx_n_s_epa_oct, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_r, __pyx_n_s_qqr, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z, __pyx_n_s_idx4, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_a1, __pyx_n_s_a2, __pyx_n_s_cds, __pyx_n_s_energy, __pyx_n_s_energy_xyz, __pyx_n_s_energy_octant); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 691, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__64); + __Pyx_GIVEREF(__pyx_tuple__64); + __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(12, 0, 0, 48, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcEnergyAASep, 691, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 691, __pyx_L1_error) + __pyx_tuple__66 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 691, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__66); + __Pyx_GIVEREF(__pyx_tuple__66); - /* "src/helpers/helpers.pyx":784 + /* "newanalysis/helpers/helpers.pyx":783 + * return energy*1390.02, energy_xyz*1390.02, energy_octant*1390.02 * - * @cython.boundscheck(False) - * def findDS(char [:,:,:] ds, double [:,:] cn, int n1, int n2, int shell, int t): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findDS(char [:,:,:] ds, double [:,:] cn, int n1, int n2, int shell, int t): * - * cdef int i, j */ - __pyx_tuple__67 = PyTuple_Pack(8, __pyx_n_s_ds, __pyx_n_s_cn, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_shell, __pyx_n_s_t, __pyx_n_s_i, __pyx_n_s_j); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 784, __pyx_L1_error) + __pyx_tuple__67 = PyTuple_Pack(8, __pyx_n_s_ds, __pyx_n_s_cn, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_shell, __pyx_n_s_t, __pyx_n_s_i, __pyx_n_s_j); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 783, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__67); __Pyx_GIVEREF(__pyx_tuple__67); - __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(6, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_findDS, 784, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 784, __pyx_L1_error) + __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_findDS, 783, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 783, __pyx_L1_error) - /* "src/helpers/helpers.pyx":795 + /* "newanalysis/helpers/helpers.pyx":794 * - * @cython.boundscheck(False) - * def dipTenCorrel(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTenCorrel(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, - * char [:,:] H_indices, */ - __pyx_tuple__69 = PyTuple_Pack(29, __pyx_n_s_coo_center, __pyx_n_s_coo_H, __pyx_n_s_H_indices, __pyx_n_s_dipT0, __pyx_n_s_corrsubmean, __pyx_n_s_timectr, __pyx_n_s_i, __pyx_n_s_center, __pyx_n_s_H_shell, __pyx_n_s_ctr, __pyx_n_s_len_center, __pyx_n_s_len_H, __pyx_n_s_rvec0, __pyx_n_s_rvec1, __pyx_n_s_rvec2, __pyx_n_s_dipTt0, __pyx_n_s_dipTt1, __pyx_n_s_dipTt2, __pyx_n_s_dipTt3, __pyx_n_s_dipTt4, __pyx_n_s_dipTt5, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_f2_0, __pyx_n_s_f2_1, __pyx_n_s_f2_2, __pyx_n_s_centers, __pyx_n_s_hs); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 795, __pyx_L1_error) + __pyx_tuple__69 = PyTuple_Pack(29, __pyx_n_s_coo_center, __pyx_n_s_coo_H, __pyx_n_s_H_indices, __pyx_n_s_dipT0, __pyx_n_s_corrsubmean, __pyx_n_s_timectr, __pyx_n_s_i, __pyx_n_s_center, __pyx_n_s_H_shell, __pyx_n_s_ctr, __pyx_n_s_len_center, __pyx_n_s_len_H, __pyx_n_s_rvec0, __pyx_n_s_rvec1, __pyx_n_s_rvec2, __pyx_n_s_dipTt0, __pyx_n_s_dipTt1, __pyx_n_s_dipTt2, __pyx_n_s_dipTt3, __pyx_n_s_dipTt4, __pyx_n_s_dipTt5, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_f2_0, __pyx_n_s_f2_1, __pyx_n_s_f2_2, __pyx_n_s_centers, __pyx_n_s_hs); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 794, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__69); __Pyx_GIVEREF(__pyx_tuple__69); - __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(6, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_dipTenCorrel, 795, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 795, __pyx_L1_error) + __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_dipTenCorrel, 794, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 794, __pyx_L1_error) - /* "src/helpers/helpers.pyx":838 + /* "newanalysis/helpers/helpers.pyx":837 + * ctr = ctr + 1 * - * @cython.boundscheck(False) - * def dipTenInit(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTenInit(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, - * char [:,:] H_indices, */ - __pyx_tuple__71 = PyTuple_Pack(27, __pyx_n_s_coo_center, __pyx_n_s_coo_H, __pyx_n_s_H_indices, __pyx_n_s_dipT0, __pyx_n_s_nshells2, __pyx_n_s_i, __pyx_n_s_center, __pyx_n_s_ctr, __pyx_n_s_len_center, __pyx_n_s_len_H, __pyx_n_s_rvec0, __pyx_n_s_rvec1, __pyx_n_s_rvec2, __pyx_n_s_dipTt0, __pyx_n_s_dipTt1, __pyx_n_s_dipTt2, __pyx_n_s_dipTt3, __pyx_n_s_dipTt4, __pyx_n_s_dipTt5, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_f2_0, __pyx_n_s_f2_1, __pyx_n_s_f2_2, __pyx_n_s_centers, __pyx_n_s_hs); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 838, __pyx_L1_error) + __pyx_tuple__71 = PyTuple_Pack(27, __pyx_n_s_coo_center, __pyx_n_s_coo_H, __pyx_n_s_H_indices, __pyx_n_s_dipT0, __pyx_n_s_nshells2, __pyx_n_s_i, __pyx_n_s_center, __pyx_n_s_ctr, __pyx_n_s_len_center, __pyx_n_s_len_H, __pyx_n_s_rvec0, __pyx_n_s_rvec1, __pyx_n_s_rvec2, __pyx_n_s_dipTt0, __pyx_n_s_dipTt1, __pyx_n_s_dipTt2, __pyx_n_s_dipTt3, __pyx_n_s_dipTt4, __pyx_n_s_dipTt5, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_f2_0, __pyx_n_s_f2_1, __pyx_n_s_f2_2, __pyx_n_s_centers, __pyx_n_s_hs); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 837, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__71); __Pyx_GIVEREF(__pyx_tuple__71); - __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(5, 0, 27, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_dipTenInit, 838, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 838, __pyx_L1_error) + __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 27, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_dipTenInit, 837, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 837, __pyx_L1_error) - /* "src/helpers/helpers.pyx":879 + /* "newanalysis/helpers/helpers.pyx":878 * - * @cython.boundscheck(False) - * def dipTen(np.ndarray[np.float64_t,ndim=1] rv, # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTen(np.ndarray[np.float64_t,ndim=1] rv, * np.float64_t r2): - * """ */ - __pyx_tuple__73 = PyTuple_Pack(9, __pyx_n_s_rv, __pyx_n_s_r2, __pyx_n_s_c_rv, __pyx_n_s_dipt, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_f2_0, __pyx_n_s_f2_1, __pyx_n_s_f2_2); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 879, __pyx_L1_error) + __pyx_tuple__73 = PyTuple_Pack(9, __pyx_n_s_rv, __pyx_n_s_r2, __pyx_n_s_c_rv, __pyx_n_s_dipt, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_f2_0, __pyx_n_s_f2_1, __pyx_n_s_f2_2); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__73); __Pyx_GIVEREF(__pyx_tuple__73); - __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_dipTen, 879, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 879, __pyx_L1_error) + __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_dipTen, 878, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 878, __pyx_L1_error) - /* "src/helpers/helpers.pyx":904 + /* "newanalysis/helpers/helpers.pyx":903 + * return dipt * - * @cython.boundscheck(False) - * def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): * - * cdef int nwat = len(py_xyz)/3 # number of water molecules */ - __pyx_tuple__75 = PyTuple_Pack(21, __pyx_n_s_py_xyz, __pyx_n_s_nwat, __pyx_n_s_xyz, __pyx_n_s_H1x, __pyx_n_s_H1y, __pyx_n_s_H1z, __pyx_n_s_H2x, __pyx_n_s_H2y, __pyx_n_s_H2z, __pyx_n_s_n2, __pyx_n_s_n3, __pyx_n_s_Exx, __pyx_n_s_Eyy, __pyx_n_s_Ezz, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_ind, __pyx_n_s_py_dipt, __pyx_n_s_dipt, __pyx_n_s_B, __pyx_n_s_T); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 904, __pyx_L1_error) + __pyx_tuple__75 = PyTuple_Pack(21, __pyx_n_s_py_xyz, __pyx_n_s_nwat, __pyx_n_s_xyz, __pyx_n_s_H1x, __pyx_n_s_H1y, __pyx_n_s_H1z, __pyx_n_s_H2x, __pyx_n_s_H2y, __pyx_n_s_H2z, __pyx_n_s_n2, __pyx_n_s_n3, __pyx_n_s_Exx, __pyx_n_s_Eyy, __pyx_n_s_Ezz, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_ind, __pyx_n_s_py_dipt, __pyx_n_s_dipt, __pyx_n_s_B, __pyx_n_s_T); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 903, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__75); __Pyx_GIVEREF(__pyx_tuple__75); - __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_NQRself, 904, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 904, __pyx_L1_error) + __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_NQRself, 903, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 903, __pyx_L1_error) - /* "src/helpers/helpers.pyx":979 + /* "newanalysis/helpers/helpers.pyx":978 + * return py_dipt * - * @cython.boundscheck(False) - * def waterRotationMatrix(double [:,:] coor): # <<<<<<<<<<<<<< - * cdef int nwat = len(coor)/3 # number of water molecules - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def waterRotationMatrix(double [:,:] coor): + * cdef int nwat = len(coor)//3 # number of water molecules */ - __pyx_tuple__77 = PyTuple_Pack(16, __pyx_n_s_coor, __pyx_n_s_coor, __pyx_n_s_nwat, __pyx_n_s_H1x, __pyx_n_s_H1y, __pyx_n_s_H1z, __pyx_n_s_H2x, __pyx_n_s_H2y, __pyx_n_s_H2z, __pyx_n_s_n2, __pyx_n_s_n3, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_ind, __pyx_n_s_B_out, __pyx_n_s_B); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 979, __pyx_L1_error) + __pyx_tuple__77 = PyTuple_Pack(15, __pyx_n_s_coor, __pyx_n_s_nwat, __pyx_n_s_H1x, __pyx_n_s_H1y, __pyx_n_s_H1z, __pyx_n_s_H2x, __pyx_n_s_H2y, __pyx_n_s_H2z, __pyx_n_s_n2, __pyx_n_s_n3, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_ind, __pyx_n_s_B_out, __pyx_n_s_B); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 978, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__77); __Pyx_GIVEREF(__pyx_tuple__77); - __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(1, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_waterRotationMatrix, 979, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 979, __pyx_L1_error) + __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_waterRotationMatrix, 978, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 978, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1037 + /* "newanalysis/helpers/helpers.pyx":1036 + * return B_out * - * @cython.boundscheck(False) - * def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): * - * cdef int nwat = len(py_xyz)/3 # number of water molecules */ - __pyx_tuple__79 = PyTuple_Pack(27, __pyx_n_s_py_xyz, __pyx_n_s_nwat, __pyx_n_s_xyz, __pyx_n_s_H1x, __pyx_n_s_H1y, __pyx_n_s_H1z, __pyx_n_s_H2x, __pyx_n_s_H2y, __pyx_n_s_H2z, __pyx_n_s_n2, __pyx_n_s_n3, __pyx_n_s_Exx, __pyx_n_s_Eyy, __pyx_n_s_Ezz, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_ind, __pyx_n_s_py_dipt, __pyx_n_s_dipt, __pyx_n_s_py_B1, __pyx_n_s_B1, __pyx_n_s_py_B2, __pyx_n_s_B2, __pyx_n_s_py_B3, __pyx_n_s_B3, __pyx_n_s_B, __pyx_n_s_T); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 1037, __pyx_L1_error) + __pyx_tuple__79 = PyTuple_Pack(27, __pyx_n_s_py_xyz, __pyx_n_s_nwat, __pyx_n_s_xyz, __pyx_n_s_H1x, __pyx_n_s_H1y, __pyx_n_s_H1z, __pyx_n_s_H2x, __pyx_n_s_H2y, __pyx_n_s_H2z, __pyx_n_s_n2, __pyx_n_s_n3, __pyx_n_s_Exx, __pyx_n_s_Eyy, __pyx_n_s_Ezz, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_ind, __pyx_n_s_py_dipt, __pyx_n_s_dipt, __pyx_n_s_py_B1, __pyx_n_s_B1, __pyx_n_s_py_B2, __pyx_n_s_B2, __pyx_n_s_py_B3, __pyx_n_s_B3, __pyx_n_s_B, __pyx_n_s_T); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 1036, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__79); __Pyx_GIVEREF(__pyx_tuple__79); - __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 27, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_NQRselfAndB, 1037, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 1037, __pyx_L1_error) + __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 27, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_NQRselfAndB, 1036, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 1036, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1131 + /* "newanalysis/helpers/helpers.pyx":1130 + * return py_dipt,py_B1,py_B2,py_B3 * - * @cython.boundscheck(False) - * def NQRdipTen(np.ndarray[np.float64_t,ndim=2] py_xyz, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRdipTen(np.ndarray[np.float64_t,ndim=2] py_xyz, * np.ndarray[np.float64_t,ndim=1] py_charges, - * aufpunkt): */ - __pyx_tuple__81 = PyTuple_Pack(35, __pyx_n_s_py_xyz, __pyx_n_s_py_charges, __pyx_n_s_aufpunkt, __pyx_n_s_n, __pyx_n_s_auf, __pyx_n_s_auf3, __pyx_n_s_auf6, __pyx_n_s_xyz, __pyx_n_s_charges, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_f2_x, __pyx_n_s_f2_y, __pyx_n_s_f2_z, __pyx_n_s_auf_x1, __pyx_n_s_auf_y1, __pyx_n_s_auf_z1, __pyx_n_s_auf_x2, __pyx_n_s_auf_y2, __pyx_n_s_auf_z2, __pyx_n_s_tyH, __pyx_n_s_tzH, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_pyE, __pyx_n_s_py_dipt, __pyx_n_s_dipt, __pyx_n_s_E, __pyx_n_s_B, __pyx_n_s_T); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 1131, __pyx_L1_error) + __pyx_tuple__81 = PyTuple_Pack(35, __pyx_n_s_py_xyz, __pyx_n_s_py_charges, __pyx_n_s_aufpunkt, __pyx_n_s_n, __pyx_n_s_auf, __pyx_n_s_auf3, __pyx_n_s_auf6, __pyx_n_s_xyz, __pyx_n_s_charges, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_f2_x, __pyx_n_s_f2_y, __pyx_n_s_f2_z, __pyx_n_s_auf_x1, __pyx_n_s_auf_y1, __pyx_n_s_auf_z1, __pyx_n_s_auf_x2, __pyx_n_s_auf_y2, __pyx_n_s_auf_z2, __pyx_n_s_tyH, __pyx_n_s_tzH, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_pyE, __pyx_n_s_py_dipt, __pyx_n_s_dipt, __pyx_n_s_E, __pyx_n_s_B, __pyx_n_s_T); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 1130, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__81); __Pyx_GIVEREF(__pyx_tuple__81); - __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(3, 0, 35, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_NQRdipTen, 1131, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 1131, __pyx_L1_error) + __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 35, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_NQRdipTen, 1130, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 1130, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1368 + /* "newanalysis/helpers/helpers.pyx":1368 * * * def calcOctant(np.ndarray[np.float64_t,ndim=2,mode="c"] com, # <<<<<<<<<<<<<< @@ -43183,233 +50007,161 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __pyx_tuple__83 = PyTuple_Pack(12, __pyx_n_s_com, __pyx_n_s_isolute, __pyx_n_s_nmolecules, __pyx_n_s_ccom, __pyx_n_s_nmol, __pyx_n_s_islt, __pyx_n_s_j, __pyx_n_s_octants, __pyx_n_s_coct, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 1368, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__83); __Pyx_GIVEREF(__pyx_tuple__83); - __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcOctant, 1368, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 1368, __pyx_L1_error) + __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcOctant, 1368, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 1368, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1408 + /* "newanalysis/helpers/helpers.pyx":1407 + * return octants * - * @cython.boundscheck(False) - * def sumMDCage(double [:,:,:,:] mdcage_ts, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMDCage(double [:,:,:,:] mdcage_ts, * double [:,:] dip_wat, - * int nres_wat, char [:] ds, int maxshell, int rep, int frame): */ - __pyx_tuple__85 = PyTuple_Pack(10, __pyx_n_s_mdcage_ts, __pyx_n_s_dip_wat, __pyx_n_s_nres_wat, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_rep, __pyx_n_s_frame, __pyx_n_s_w, __pyx_n_s_shell, __pyx_n_s_i); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 1408, __pyx_L1_error) + __pyx_tuple__85 = PyTuple_Pack(10, __pyx_n_s_mdcage_ts, __pyx_n_s_dip_wat, __pyx_n_s_nres_wat, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_rep, __pyx_n_s_frame, __pyx_n_s_w, __pyx_n_s_shell, __pyx_n_s_i); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 1407, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__85); __Pyx_GIVEREF(__pyx_tuple__85); - __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_sumMDCage, 1408, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 1408, __pyx_L1_error) + __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_sumMDCage, 1407, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 1407, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1423 + /* "newanalysis/helpers/helpers.pyx":1422 + * mdcage_ts[rep,maxshell,frame,i] += dip_wat[w,i] * - * @cython.boundscheck(False) - * def sumMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, * char [:] ds, int maxshell, int frame): - * */ - __pyx_tuple__87 = PyTuple_Pack(9, __pyx_n_s_mdcage_ts, __pyx_n_s_dip_wat, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_frame, __pyx_n_s_w, __pyx_n_s_shell, __pyx_n_s_i, __pyx_n_s_nres_wat); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 1423, __pyx_L1_error) + __pyx_tuple__87 = PyTuple_Pack(9, __pyx_n_s_mdcage_ts, __pyx_n_s_dip_wat, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_frame, __pyx_n_s_w, __pyx_n_s_shell, __pyx_n_s_i, __pyx_n_s_nres_wat); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 1422, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__87); __Pyx_GIVEREF(__pyx_tuple__87); - __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(5, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_sumMDCageSingle, 1423, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) __PYX_ERR(0, 1423, __pyx_L1_error) + __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_sumMDCageSingle, 1422, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) __PYX_ERR(0, 1422, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1438 + /* "newanalysis/helpers/helpers.pyx":1437 + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] * - * @cython.boundscheck(False) - * def calcAngularMomentum(double [:,:] coor, double [:,:] vel, double [:] masses, int natoms): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularMomentum(double [:,:] coor, double [:,:] vel, double [:] masses, int natoms): * - * cdef np.ndarray[np.float64_t, ndim=1] L = np.zeros(3) */ - __pyx_tuple__89 = PyTuple_Pack(7, __pyx_n_s_coor, __pyx_n_s_vel, __pyx_n_s_masses, __pyx_n_s_natoms, __pyx_n_s_L, __pyx_n_s_cL, __pyx_n_s_i); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 1438, __pyx_L1_error) + __pyx_tuple__89 = PyTuple_Pack(7, __pyx_n_s_coor, __pyx_n_s_vel, __pyx_n_s_masses, __pyx_n_s_natoms, __pyx_n_s_L, __pyx_n_s_cL, __pyx_n_s_i); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 1437, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__89); __Pyx_GIVEREF(__pyx_tuple__89); - __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcAngularMomentum, 1438, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(0, 1438, __pyx_L1_error) + __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcAngularMomentum, 1437, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(0, 1437, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1452 + /* "newanalysis/helpers/helpers.pyx":1451 + * return L * - * @cython.boundscheck(False) - * def calcInertiaTensor(double [:,:] coor, double [:] masses, int natoms): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcInertiaTensor(double [:,:] coor, double [:] masses, int natoms): * - * cdef np.ndarray[np.float64_t, ndim=2] I = np.zeros((3,3)) */ - __pyx_tuple__91 = PyTuple_Pack(9, __pyx_n_s_coor, __pyx_n_s_masses, __pyx_n_s_natoms, __pyx_n_s_I, __pyx_n_s_cI, __pyx_n_s_i, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 1452, __pyx_L1_error) + __pyx_tuple__91 = PyTuple_Pack(9, __pyx_n_s_coor, __pyx_n_s_masses, __pyx_n_s_natoms, __pyx_n_s_I, __pyx_n_s_cI, __pyx_n_s_i, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 1451, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__91); __Pyx_GIVEREF(__pyx_tuple__91); - __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcInertiaTensor, 1452, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) __PYX_ERR(0, 1452, __pyx_L1_error) + __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcInertiaTensor, 1451, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) __PYX_ERR(0, 1451, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1478 + /* "newanalysis/helpers/helpers.pyx":1477 * - * @cython.boundscheck(False) - * def calcResidenceTimeseries(char [:,:] ds, int nshells): # <<<<<<<<<<<<<< * - * cdef int nmol = len(ds) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcResidenceTimeseries(char [:,:] ds, int nshells): + * */ - __pyx_tuple__93 = PyTuple_Pack(8, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_nmol, __pyx_n_s_nt, __pyx_n_s_ts, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_ind); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 1478, __pyx_L1_error) + __pyx_tuple__93 = PyTuple_Pack(8, __pyx_n_s_ds, __pyx_n_s_nshells, __pyx_n_s_nmol, __pyx_n_s_nt, __pyx_n_s_ts, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_ind); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 1477, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__93); __Pyx_GIVEREF(__pyx_tuple__93); - __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcResidenceTimeseries, 1478, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) __PYX_ERR(0, 1478, __pyx_L1_error) + __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcResidenceTimeseries, 1477, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) __PYX_ERR(0, 1477, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1495 + /* "newanalysis/helpers/helpers.pyx":1494 + * return np.asarray(ts) * - * @cython.boundscheck(False) - * def calcAngularDisplacement(double [:,:] wts, double dt): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularDisplacement(double [:,:] wts, double dt): * - * cdef int tn = wts.shape[0] */ - __pyx_tuple__95 = PyTuple_Pack(9, __pyx_n_s_wts, __pyx_n_s_dt, __pyx_n_s_tn, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_integral, __pyx_n_s_msd, __pyx_n_s_ctr); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 1495, __pyx_L1_error) + __pyx_tuple__95 = PyTuple_Pack(9, __pyx_n_s_wts, __pyx_n_s_dt, __pyx_n_s_tn, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_integral, __pyx_n_s_msd, __pyx_n_s_ctr); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 1494, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__95); __Pyx_GIVEREF(__pyx_tuple__95); - __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcAngularDisplacement, 1495, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) __PYX_ERR(0, 1495, __pyx_L1_error) + __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcAngularDisplacement, 1494, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) __PYX_ERR(0, 1494, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1523 + /* "newanalysis/helpers/helpers.pyx":1522 + * return msd * - * @cython.boundscheck(False) - * def findNearestAtom(double [:,:] coor_core, double [:,:] coor_surr, double [:] mindist, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findNearestAtom(double [:,:] coor_core, double [:,:] coor_surr, double [:] mindist, * double [:] mindist2, double [:,:] minvec, int [:] next_id): - * */ - __pyx_tuple__97 = PyTuple_Pack(14, __pyx_n_s_coor_core, __pyx_n_s_coor_surr, __pyx_n_s_mindist, __pyx_n_s_mindist2, __pyx_n_s_minvec, __pyx_n_s_next_id, __pyx_n_s_n_core, __pyx_n_s_n_surr, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_tmp_x, __pyx_n_s_tmp_y, __pyx_n_s_tmp_z, __pyx_n_s_dist2); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 1523, __pyx_L1_error) + __pyx_tuple__97 = PyTuple_Pack(14, __pyx_n_s_coor_core, __pyx_n_s_coor_surr, __pyx_n_s_mindist, __pyx_n_s_mindist2, __pyx_n_s_minvec, __pyx_n_s_next_id, __pyx_n_s_n_core, __pyx_n_s_n_surr, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_tmp_x, __pyx_n_s_tmp_y, __pyx_n_s_tmp_z, __pyx_n_s_dist2); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 1522, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__97); __Pyx_GIVEREF(__pyx_tuple__97); - __pyx_codeobj__98 = (PyObject*)__Pyx_PyCode_New(6, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_findNearestAtom, 1523, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__98)) __PYX_ERR(0, 1523, __pyx_L1_error) + __pyx_codeobj__98 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_findNearestAtom, 1522, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__98)) __PYX_ERR(0, 1522, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1549 + /* "newanalysis/helpers/helpers.pyx":1548 + * minvec[i,j] = coor_surr[next_id[i],j] - coor_core[i,j] * - * @cython.boundscheck(False) - * def checkHBond(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def checkHBond(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist): * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr */ - __pyx_tuple__99 = PyTuple_Pack(26, __pyx_n_s_coor_surr, __pyx_n_s_coor_oh2, __pyx_n_s_nres_surr, __pyx_n_s_maxdist, __pyx_n_s_sites_per_res, __pyx_n_s_nsurr, __pyx_n_s_nwat, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_idx3, __pyx_n_s_hbond, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_dx2, __pyx_n_s_dy2, __pyx_n_s_dz2, __pyx_n_s_dot, __pyx_n_s_dot2, __pyx_n_s_dist, __pyx_n_s_dist2, __pyx_n_s_cosine); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 1549, __pyx_L1_error) + __pyx_tuple__99 = PyTuple_Pack(26, __pyx_n_s_coor_surr, __pyx_n_s_coor_oh2, __pyx_n_s_nres_surr, __pyx_n_s_maxdist, __pyx_n_s_sites_per_res, __pyx_n_s_nsurr, __pyx_n_s_nwat, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_idx3, __pyx_n_s_hbond, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_dx2, __pyx_n_s_dy2, __pyx_n_s_dz2, __pyx_n_s_dot, __pyx_n_s_dot2, __pyx_n_s_dist, __pyx_n_s_dist2, __pyx_n_s_cosine); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 1548, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__99); __Pyx_GIVEREF(__pyx_tuple__99); - __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(4, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_checkHBond, 1549, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(0, 1549, __pyx_L1_error) + __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_checkHBond, 1548, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(0, 1548, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1592 + /* "newanalysis/helpers/helpers.pyx":1591 + * return np.asarray(hbond) * - * @cython.boundscheck(False) - * def sphHarmMatrix(double [:,:] coor, np.complex128_t [:,:] y_mat, int lmax): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sphHarmMatrix(double [:,:] coor, np.complex128_t [:,:] y_mat, int lmax): * cdef double r, pol, azi - * cdef int nat = coor.shape[0], i, l1, m1, m1r, l2, m2, m2r */ - __pyx_tuple__101 = PyTuple_Pack(14, __pyx_n_s_coor, __pyx_n_s_y_mat, __pyx_n_s_lmax, __pyx_n_s_r, __pyx_n_s_pol, __pyx_n_s_azi, __pyx_n_s_nat, __pyx_n_s_i, __pyx_n_s_l1, __pyx_n_s_m1, __pyx_n_s_m1r, __pyx_n_s_l2, __pyx_n_s_m2, __pyx_n_s_m2r); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 1592, __pyx_L1_error) + __pyx_tuple__101 = PyTuple_Pack(14, __pyx_n_s_coor, __pyx_n_s_y_mat, __pyx_n_s_lmax, __pyx_n_s_r, __pyx_n_s_pol, __pyx_n_s_azi, __pyx_n_s_nat, __pyx_n_s_i, __pyx_n_s_l1, __pyx_n_s_m1, __pyx_n_s_m1r, __pyx_n_s_l2, __pyx_n_s_m2, __pyx_n_s_m2r); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 1591, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__101); __Pyx_GIVEREF(__pyx_tuple__101); - __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(3, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_sphHarmMatrix, 1592, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 1592, __pyx_L1_error) + __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_sphHarmMatrix, 1591, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 1591, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1610 + /* "newanalysis/helpers/helpers.pyx":1609 + * y_mat[2*l1+m1,2*l2+m2] += sph_harm(m1r,l1,azi,pol) * np.conjugate(sph_harm(m2r,l2,azi,pol)) * - * @cython.boundscheck(False) - * def calcFourierLaplaceTransform(double [:] data_x, double [:] data_y, double w): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcFourierLaplaceTransform(double [:] data_x, double [:] data_y, double w): * cdef double wt, wt1 - * cdef double dt = data_x[1] - data_x[0] */ - __pyx_tuple__103 = PyTuple_Pack(11, __pyx_n_s_data_x, __pyx_n_s_data_y, __pyx_n_s_w, __pyx_n_s_wt, __pyx_n_s_wt1, __pyx_n_s_dt, __pyx_n_s_laplace_re, __pyx_n_s_laplace_im, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_transform); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 1610, __pyx_L1_error) + __pyx_tuple__103 = PyTuple_Pack(11, __pyx_n_s_data_x, __pyx_n_s_data_y, __pyx_n_s_w, __pyx_n_s_wt, __pyx_n_s_wt1, __pyx_n_s_dt, __pyx_n_s_laplace_re, __pyx_n_s_laplace_im, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_transform); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 1609, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__103); __Pyx_GIVEREF(__pyx_tuple__103); - __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcFourierLaplaceTransform, 1610, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) __PYX_ERR(0, 1610, __pyx_L1_error) + __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcFourierLaplaceTransform, 1609, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) __PYX_ERR(0, 1609, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1633 + /* "newanalysis/helpers/helpers.pyx":1632 + * return float(laplace_re), float(laplace_im) * - * @cython.boundscheck(False) - * def calcRotationMatrix(double [:,:] coorA, double [:,:] coorB): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcRotationMatrix(double [:,:] coorA, double [:,:] coorB): * """ - * calcRotationMatrix(coor,coorA,coorB) */ - __pyx_tuple__105 = PyTuple_Pack(3, __pyx_n_s_coorA, __pyx_n_s_coorB, __pyx_n_s_R); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 1633, __pyx_L1_error) + __pyx_tuple__105 = PyTuple_Pack(3, __pyx_n_s_coorA, __pyx_n_s_coorB, __pyx_n_s_R); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 1632, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__105); __Pyx_GIVEREF(__pyx_tuple__105); - __pyx_codeobj__106 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_calcRotationMatrix, 1633, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__106)) __PYX_ERR(0, 1633, __pyx_L1_error) + __pyx_codeobj__106 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_calcRotationMatrix, 1632, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__106)) __PYX_ERR(0, 1632, __pyx_L1_error) - /* "src/helpers/helpers.pyx":1651 + /* "newanalysis/helpers/helpers.pyx":1650 + * return np.asarray(R) * - * @cython.boundscheck(False) - * def applyRotationMatrix(double [:,:] coor, double [:,:] R): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def applyRotationMatrix(double [:,:] coor, double [:,:] R): * """ - * calcRotationMatrix(coor,coorA,coorB) */ - __pyx_tuple__107 = PyTuple_Pack(7, __pyx_n_s_coor, __pyx_n_s_R, __pyx_n_s_N, __pyx_n_s_tmpx, __pyx_n_s_tmpy, __pyx_n_s_tmpz, __pyx_n_s_i); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 1651, __pyx_L1_error) + __pyx_tuple__107 = PyTuple_Pack(7, __pyx_n_s_coor, __pyx_n_s_R, __pyx_n_s_N, __pyx_n_s_tmpx, __pyx_n_s_tmpy, __pyx_n_s_tmpz, __pyx_n_s_i); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 1650, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__107); __Pyx_GIVEREF(__pyx_tuple__107); - __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_helpers_pyx, __pyx_n_s_applyRotationMatrix, 1651, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) __PYX_ERR(0, 1651, __pyx_L1_error) - - /* "View.MemoryView":287 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") - */ - __pyx_tuple__109 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__109); - __Pyx_GIVEREF(__pyx_tuple__109); - - /* "View.MemoryView":288 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_tuple__110 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__110); - __Pyx_GIVEREF(__pyx_tuple__110); - - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__111 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__111)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__111); - __Pyx_GIVEREF(__pyx_tuple__111); - - /* "View.MemoryView":292 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_tuple__112 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__112); - __Pyx_GIVEREF(__pyx_tuple__112); - - /* "View.MemoryView":293 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__113 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__113)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__113); - __Pyx_GIVEREF(__pyx_tuple__113); - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_tuple__114 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__114); - __Pyx_GIVEREF(__pyx_tuple__114); - __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(2, 1, __pyx_L1_error) + __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_helpers_pyx, __pyx_n_s_applyRotationMatrix, 1650, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) __PYX_ERR(0, 1650, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } +/* #### Code section: init_constants ### */ -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - /* InitThreads.init */ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 -PyEval_InitThreads(); -#endif - -if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error) +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_float_0_2400 = PyFloat_FromDouble(0.2400); if (unlikely(!__pyx_float_0_2400)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_float_1_8086 = PyFloat_FromDouble(1.8086); if (unlikely(!__pyx_float_1_8086)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_float_1390_02 = PyFloat_FromDouble(1390.02); if (unlikely(!__pyx_float_1390_02)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -43429,6 +50181,38 @@ if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_L1_error:; return -1; } +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 0)); else + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* NumpyImportArray.init */ + /* + * Cython has automatically inserted a call to _import_array since + * you didn't include one when you cimported numpy. To disable this + * add the line + * numpy._import_array + */ +#ifdef NPY_FEATURE_VERSION +#ifndef NO_IMPORT_ARRAY +if (unlikely(_import_array() == -1)) { + PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import " + "(auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; " + "use 'numpy._import_array' to disable if you are certain you don't need it)."); +} +#endif +#endif + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_module ### */ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ @@ -43442,6 +50226,7 @@ static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ + __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); generic = Py_None; Py_INCREF(Py_None); strided = Py_None; Py_INCREF(Py_None); indirect = Py_None; Py_INCREF(Py_None); @@ -43469,6 +50254,7 @@ static int __Pyx_modinit_function_export_code(void) { static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -43476,22 +50262,61 @@ static int __Pyx_modinit_type_init_code(void) { /*--- Type init code ---*/ __pyx_vtabptr_array = &__pyx_vtable_array; __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; - if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_array.tp_print = 0; + #if CYTHON_USE_TYPE_SPECS + __pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_array_type)) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_array_type->tp_base->tp_as_buffer && __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." #endif - if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #else __pyx_array_type = &__pyx_type___pyx_array; - if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_MemviewEnum.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_array_type->tp_print = 0; + #endif + if (__Pyx_SetVtable(__pyx_array_type, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_MemviewEnum_type)) __PYX_ERR(1, 302, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #else __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_MemviewEnum_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_MemviewEnum_type->tp_dictoffset && __pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_MemviewEnum_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; @@ -43500,34 +50325,85 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; - if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryview.tp_print = 0; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_memoryview_type)) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #else __pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryview_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryview_type->tp_dictoffset && __pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryview_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_memoryview_type, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; - __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; - if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryviewslice.tp_print = 0; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_memoryviewslice_type)) __PYX_ERR(1, 952, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #else + __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryviewslice_type->tp_base = __pyx_memoryview_type; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr; + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryviewslice_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryviewslice_type->tp_dictoffset && __pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryviewslice_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + if (__Pyx_SetVtable(__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } @@ -43542,62 +50418,33 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_2(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyTypeObject), + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), #else - sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyHeapTypeObject), + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyHeapTypeObject), #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT(PyArray_Descr), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 199, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 222, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayMultiIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 226, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error) - __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 770, __pyx_L1_error) - __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 772, __pyx_L1_error) - __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 774, __pyx_L1_error) - __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 776, __pyx_L1_error) - __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 778, __pyx_L1_error) - __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 780, __pyx_L1_error) - __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 782, __pyx_L1_error) - __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 784, __pyx_L1_error) - __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 786, __pyx_L1_error) - __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 788, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT(PyUFuncObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 826, __pyx_L1_error) + __pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArray_Descr),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 202, __pyx_L1_error) + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 225, __pyx_L1_error) + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayMultiIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 229, __pyx_L1_error) + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 238, __pyx_L1_error) + __pyx_ptype_5numpy_generic = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 809, __pyx_L1_error) + __pyx_ptype_5numpy_number = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 811, __pyx_L1_error) + __pyx_ptype_5numpy_integer = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 813, __pyx_L1_error) + __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 815, __pyx_L1_error) + __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 817, __pyx_L1_error) + __pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 819, __pyx_L1_error) + __pyx_ptype_5numpy_floating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 821, __pyx_L1_error) + __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 823, __pyx_L1_error) + __pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_ptype_5numpy_character = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyUFuncObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 865, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -43624,6 +50471,55 @@ static int __Pyx_modinit_function_import_code(void) { } +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_helpers(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_helpers}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "helpers", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #elif PY_MAJOR_VERSION < 3 @@ -43674,12 +50570,21 @@ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { } return 0; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else result = PyDict_SetItemString(moddict, to_name, value); +#endif } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -43689,8 +50594,9 @@ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject } return result; } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) @@ -43700,8 +50606,12 @@ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNU module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; +#endif if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; @@ -43717,9 +50627,18 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_helpers(PyObject *__pyx_pyinit_mod #endif #endif { + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - static PyThread_type_lock __pyx_t_3[8]; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + static PyThread_type_lock __pyx_t_8[8]; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -43733,6 +50652,35 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_helpers(PyObject *__pyx_pyinit_mod #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("helpers", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to helpers pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { @@ -43751,48 +50699,31 @@ if (!__Pyx_RefNanny) { __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("helpers", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -43804,7 +50735,7 @@ if (!__Pyx_RefNanny) { { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "newanalysis.helpers")) { - if (unlikely(PyDict_SetItemString(modules, "newanalysis.helpers", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((PyDict_SetItemString(modules, "newanalysis.helpers", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif @@ -43816,8 +50747,8 @@ if (!__Pyx_RefNanny) { (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_variable_import_code(); (void)__Pyx_modinit_function_import_code(); /*--- Execution code ---*/ @@ -43825,705 +50756,1121 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "src/helpers/helpers.pyx":4 + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_version_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__11, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + goto __pyx_L8; + } + + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":104 + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None + */ + /*except:*/ { + __Pyx_AddTraceback("View.MemoryView", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(1, 104, __pyx_L4_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_7); + + /* "View.MemoryView":106 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * + */ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L3_exception_handled; + } + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + __pyx_L4_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":242 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":243 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L16_try_end; + __pyx_L11_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":244 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L12_exception_handled; + } + __pyx_L12_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L16_try_end:; + } + + /* "View.MemoryView":309 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":323 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), + */ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":324 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), + */ + __pyx_t_8[0] = PyThread_allocate_lock(); + __pyx_t_8[1] = PyThread_allocate_lock(); + __pyx_t_8[2] = PyThread_allocate_lock(); + __pyx_t_8[3] = PyThread_allocate_lock(); + __pyx_t_8[4] = PyThread_allocate_lock(); + __pyx_t_8[5] = PyThread_allocate_lock(); + __pyx_t_8[6] = PyThread_allocate_lock(); + __pyx_t_8[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_8, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":983 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); + + /* "View.MemoryView":984 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); + + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L22_try_end; + __pyx_L17_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":985 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L18_exception_handled; + } + __pyx_L18_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L22_try_end:; + } + + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 989, __pyx_L23_error) + if (__pyx_t_6) { + + /* "View.MemoryView":993 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_memoryviewslice_type)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":994 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_array_type)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + } + + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L28_try_end; + __pyx_L23_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":995 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L24_exception_handled; + } + __pyx_L24_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L28_try_end:; + } + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/helpers.pyx":4 * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 * * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_7) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/helpers.pyx":7 + /* "newanalysis/helpers/helpers.pyx":7 * cimport numpy as np * * from scipy.special import sph_harm # <<<<<<<<<<<<<< * * from cython.parallel cimport prange, parallel */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_n_s_sph_harm); __Pyx_GIVEREF(__pyx_n_s_sph_harm); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_sph_harm); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_scipy_special, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_sph_harm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sph_harm, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_PyList_SET_ITEM(__pyx_t_7, 0, __pyx_n_s_sph_harm)) __PYX_ERR(0, 7, __pyx_L1_error); + __pyx_t_4 = __Pyx_Import(__pyx_n_s_scipy_special, __pyx_t_7, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_sph_harm); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sph_harm, __pyx_t_7) < 0) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":24 + /* "newanalysis/helpers/helpers.pyx":23 + * return ( 0.0 < val) * - * @cython.boundscheck(False) - * def SphereinCube(double A, int numpoints, double gfunc, double deltaA): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def SphereinCube(double A, int numpoints, double gfunc, double deltaA): * cdef int i, j, k, sumr - * cdef double vol,x,y,z */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_1SphereinCube, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_SphereinCube, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_1SphereinCube, 0, __pyx_n_s_SphereinCube, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_SphereinCube, __pyx_t_4) < 0) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":41 + /* "newanalysis/helpers/helpers.pyx":40 + * return(sumr) * - * @cython.boundscheck(False) - * def velcomByResidue(double [:,:] vels, double [:] masses, int nres, int [:] apr, int [:] rfa): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def velcomByResidue(double [:,:] vels, double [:] masses, int nres, int [:] apr, int [:] rfa): * """ - * velcomByResidue(vels,masses,nres,atoms_per_residue) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_3velcomByResidue, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_velcomByResidue, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_3velcomByResidue, 0, __pyx_n_s_velcomByResidue, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_velcomByResidue, __pyx_t_4) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":71 + /* "newanalysis/helpers/helpers.pyx":70 + * return np.asarray(velcom) * - * @cython.boundscheck(False) - * def comByResidue(double [:,:] coor, double [:] masses, int nres, int [:] apr, int [:] rfa): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def comByResidue(double [:,:] coor, double [:] masses, int nres, int [:] apr, int [:] rfa): * """ - * comByResidue(coor,masses,nres,atoms_per_residue) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_5comByResidue, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_comByResidue, __pyx_t_2) < 0) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_5comByResidue, 0, __pyx_n_s_comByResidue, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_comByResidue, __pyx_t_4) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":101 + /* "newanalysis/helpers/helpers.pyx":100 + * return np.asarray(com) * - * @cython.boundscheck(False) - * def dipByResidue(double [:,:] coor, double [:] charges, double [:] masses, int nres, int [:] apr, int [:] rfa, double [:,:] com): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipByResidue(double [:,:] coor, double [:] charges, double [:] masses, int nres, int [:] apr, int [:] rfa, double [:,:] com): * """ - * dipByResidue(coor,charges,masses,nresidues,atoms_per_residue,com) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_7dipByResidue, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipByResidue, __pyx_t_2) < 0) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_7dipByResidue, 0, __pyx_n_s_dipByResidue, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipByResidue, __pyx_t_4) < 0) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":126 + /* "newanalysis/helpers/helpers.pyx":125 + * return np.asarray(dip) * - * @cython.boundscheck(False) - * def dipoleMomentNeutralSelection(double [:,:] coor, double [:] charges): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipoleMomentNeutralSelection(double [:,:] coor, double [:] charges): * - * cdef double [:] dip = np.zeros(3) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_9dipoleMomentNeutralSelection, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipoleMomentNeutralSelection, __pyx_t_2) < 0) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_9dipoleMomentNeutralSelection, 0, __pyx_n_s_dipoleMomentNeutralSelection, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipoleMomentNeutralSelection, __pyx_t_4) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":140 + /* "newanalysis/helpers/helpers.pyx":139 * - * @cython.boundscheck(False) - * def collectiveDipoleMomentWaterShells(double [:,:] coor, double [:] charges, int [:] ds, int nshells): # <<<<<<<<<<<<<< * - * cdef int i,j,shell + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def collectiveDipoleMomentWaterShells(double [:,:] coor, double [:] charges, int [:] ds, int nshells): + * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_11collectiveDipoleMomentWaterShells, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_collectiveDipoleMomentWaterShell, __pyx_t_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_11collectiveDipoleMomentWaterShells, 0, __pyx_n_s_collectiveDipoleMomentWaterShell, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_collectiveDipoleMomentWaterShell, __pyx_t_4) < 0) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":159 + /* "newanalysis/helpers/helpers.pyx":158 * - * @cython.boundscheck(False) - * def atomicCurrent(double [:,:] vel, double [:] charges, double [:,:] result, int ctr): # <<<<<<<<<<<<<< - * cdef int i, natoms=len(vel) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicCurrent(double [:,:] vel, double [:] charges, double [:,:] result, int ctr): + * cdef int i, natoms=len(vel) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_13atomicCurrent, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_atomicCurrent, __pyx_t_2) < 0) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_13atomicCurrent, 0, __pyx_n_s_atomicCurrent, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_atomicCurrent, __pyx_t_4) < 0) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":168 + /* "newanalysis/helpers/helpers.pyx":167 + * result[ctr,2] += vel[i,2] * charges[i] * - * @cython.boundscheck(False) - * def centerOrientBox(double [:,:] com, double [:,:] coor, double boxl, int isolute, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def centerOrientBox(double [:,:] com, double [:,:] coor, double boxl, int isolute, * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): - * """ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_15centerOrientBox, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_centerOrientBox, __pyx_t_2) < 0) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_15centerOrientBox, 0, __pyx_n_s_centerOrientBox, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_centerOrientBox, __pyx_t_4) < 0) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":216 + /* "newanalysis/helpers/helpers.pyx":215 + * coor[i,2] = tmpz * - * @cython.boundscheck(False) - * def centerToPointOrientBox(double [:,:] com, double [:,:] coor, double [:] center, double boxl, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def centerToPointOrientBox(double [:,:] com, double [:,:] coor, double [:] center, double boxl, * int [:] apr, int [:] rfa, double [:,:] coorA, double [:,:] coorB): - * """ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_17centerToPointOrientBox, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_centerToPointOrientBox, __pyx_t_2) < 0) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_17centerToPointOrientBox, 0, __pyx_n_s_centerToPointOrientBox, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_centerToPointOrientBox, __pyx_t_4) < 0) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":259 + /* "newanalysis/helpers/helpers.pyx":258 + * coor[i,2] = tmpz * - * @cython.boundscheck(False) - * def calcEnergyAA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol): * """ - * energy = calcEnergyAA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_19calcEnergyAA, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAA, __pyx_t_2) < 0) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_19calcEnergyAA, 0, __pyx_n_s_calcEnergyAA, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAA, __pyx_t_4) < 0) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":294 + /* "newanalysis/helpers/helpers.pyx":293 + * return energy * 1390.02 * - * @cython.boundscheck(False) - * def calcEnergyMuA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double [:] mu_solute): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyMuA(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double [:] mu_solute): * """ - * energy = calcEnergyMuA(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,mu_solute) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_21calcEnergyMuA, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyMuA, __pyx_t_2) < 0) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_21calcEnergyMuA, 0, __pyx_n_s_calcEnergyMuA, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyMuA, __pyx_t_4) < 0) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":322 + /* "newanalysis/helpers/helpers.pyx":321 + * return energy * 1390.02 * - * @cython.boundscheck(False) - * def calcEnergyAApermind(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAApermind(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude): * """ - * energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_23calcEnergyAApermind, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 322, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAApermind, __pyx_t_2) < 0) __PYX_ERR(0, 322, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_23calcEnergyAApermind, 0, __pyx_n_s_calcEnergyAApermind, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAApermind, __pyx_t_4) < 0) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":369 + /* "newanalysis/helpers/helpers.pyx":368 + * return energy_perm * 1390.02 , energy_ind * 1390.02 * - * @cython.boundscheck(False) - * def calcEnergyAAhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose, int[:] oxyquinol): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAAhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose, int[:] oxyquinol): * """ - * energy = calcEnergyAAhisto(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, min_histo, max_histo, bins_hist,array indices, array indices 2) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_25calcEnergyAAhisto, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAAhisto, __pyx_t_2) < 0) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_25calcEnergyAAhisto, 0, __pyx_n_s_calcEnergyAAhisto, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAAhisto, __pyx_t_4) < 0) __PYX_ERR(0, 368, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":444 + /* "newanalysis/helpers/helpers.pyx":443 + * return energy * 1390.02, np.asarray(histo)[:,:] * 1390.02 , histo_error, np.asarray(count)[:,:] * - * @cython.boundscheck(False) - * def calcEnergyAAhisto1(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAAhisto1(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, double histo_min, double histo_max, int histo_bins, int[:] trehalose): * """ - * energy = calcEnergyAAhisto(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, min_histo, max_histo, bins_hist,array indices) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_27calcEnergyAAhisto1, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAAhisto1, __pyx_t_2) < 0) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_27calcEnergyAAhisto1, 0, __pyx_n_s_calcEnergyAAhisto1, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAAhisto1, __pyx_t_4) < 0) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":511 + /* "newanalysis/helpers/helpers.pyx":510 + * return energy * 1390.02, np.asarray(histo)[:] * 1390.02 , histo_error, np.asarray(count)[:] * - * @cython.boundscheck(False) - * def calcEnergyAApermindhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude,double histo_min, double histo_max, int histo_bins,): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAApermindhisto(double [:,:] coor, double[:,:] coms, double [:] charges, int [:] apr, int [:] rfa, int isolute, int first, int last, double[:] drude,double histo_min, double histo_max, int histo_bins,): * """ - * energy = calcEnergyAA(xyz, coms, charges, atoms_per_residue, residue_first_atom, resnum_solute, resnum_from, resnum_to, drude_list, min_histo, max_histo, bins_histo) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_29calcEnergyAApermindhisto, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAApermindhisto, __pyx_t_2) < 0) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_29calcEnergyAApermindhisto, 0, __pyx_n_s_calcEnergyAApermindhisto, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 510, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAApermindhisto, __pyx_t_4) < 0) __PYX_ERR(0, 510, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/helpers.pyx":576 + /* "newanalysis/helpers/helpers.pyx":576 * * @cython.boundscheck(False) * def calcEnergyAtomic(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): # <<<<<<<<<<<<<< * """ * energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_31calcEnergyAtomic, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAtomic, __pyx_t_2) < 0) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)-1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyInt_From_int(((int)-1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* "src/helpers/helpers.pyx":606 + /* "newanalysis/helpers/helpers.pyx":575 + * return energy_perm * 1390.02 , energy_ind * 1390.02, np.asarray(histo_perm)[:] * 1390.02, np.asarray(histo_ind)[:] * 1390.02 , histo_error * - * @cython.boundscheck(False) - * def calcEnergyDouble(double [:,:] coor, double [:] charges1, int [:] apr, int [:] rfa, int isolute, int nmol, int start, int end): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAtomic(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): * """ - * energy = calcEnergyDouble(xyz, charges_1, charges_2, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules,start_res,end_res) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_33calcEnergyDouble, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyDouble, __pyx_t_2) < 0) __PYX_ERR(0, 606, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4)) __PYX_ERR(0, 575, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 575, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_31calcEnergyAtomic, 0, __pyx_n_s_calcEnergyAtomic, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAtomic, __pyx_t_7) < 0) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/helpers.pyx":605 + * return np.asarray(epa)[:] * 1390.02 + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyDouble(double [:,:] coor, double [:] charges1, int [:] apr, int [:] rfa, int isolute, int nmol, int start, int end): + * """ + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_33calcEnergyDouble, 0, __pyx_n_s_calcEnergyDouble, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyDouble, __pyx_t_7) < 0) __PYX_ERR(0, 605, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/helpers.pyx":638 + /* "newanalysis/helpers/helpers.pyx":638 * * @cython.boundscheck(False) * def calcDipDipEnergyAtomic(double [:,:] coms, double [:,:] dipol, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): # <<<<<<<<<<<<<< * """ * energy = calcDipDipEnergyAtomic(coms, dipol, resnum_solute, nmolecules) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_35calcDipDipEnergyAtomic, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipDipEnergyAtomic, __pyx_t_2) < 0) __PYX_ERR(0, 638, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyInt_From_int(((int)-1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyInt_From_int(((int)-1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + + /* "newanalysis/helpers/helpers.pyx":637 + * return np.asarray(epa1)[:] * 1390.02 + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipDipEnergyAtomic(double [:,:] coms, double [:,:] dipol, int isolute, int nmol, int exclude_begin=-1, int exclude_end=-1): + * """ + */ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7)) __PYX_ERR(0, 637, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5)) __PYX_ERR(0, 637, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_35calcDipDipEnergyAtomic, 0, __pyx_n_s_calcDipDipEnergyAtomic, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipDipEnergyAtomic, __pyx_t_5) < 0) __PYX_ERR(0, 637, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":659 + /* "newanalysis/helpers/helpers.pyx":658 * - * @cython.boundscheck(False) - * def calcEnergyAtomicVoro(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, char [:] ds, int maxshell): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAtomicVoro(double [:,:] coor, double [:] charges, int [:] apr, int [:] rfa, int isolute, int nmol, char [:] ds, int maxshell): * """ - * energy = calcEnergyAtomic(xyz, charges, atoms_per_residue, residue_first_atom, resnum_solute, nmolecules, delaunay_shell) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_37calcEnergyAtomicVoro, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAtomicVoro, __pyx_t_2) < 0) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_37calcEnergyAtomicVoro, 0, __pyx_n_s_calcEnergyAtomicVoro, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAtomicVoro, __pyx_t_5) < 0) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":692 + /* "newanalysis/helpers/helpers.pyx":691 + * return np.asarray(epa)[:,:] * 1390.02 * - * @cython.boundscheck(False) - * def calcEnergyAASep(np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcEnergyAASep(np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, * np.ndarray[np.float64_t,ndim=1] charges, - * np.ndarray[np.int32_t,ndim=1,mode="c"] atoms_per_residue, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_39calcEnergyAASep, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAASep, __pyx_t_2) < 0) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_39calcEnergyAASep, 0, __pyx_n_s_calcEnergyAASep, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 691, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__66); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcEnergyAASep, __pyx_t_5) < 0) __PYX_ERR(0, 691, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":784 + /* "newanalysis/helpers/helpers.pyx":783 + * return energy*1390.02, energy_xyz*1390.02, energy_octant*1390.02 * - * @cython.boundscheck(False) - * def findDS(char [:,:,:] ds, double [:,:] cn, int n1, int n2, int shell, int t): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findDS(char [:,:,:] ds, double [:,:] cn, int n1, int n2, int shell, int t): * - * cdef int i, j */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_41findDS, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_findDS, __pyx_t_2) < 0) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_41findDS, 0, __pyx_n_s_findDS, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_findDS, __pyx_t_5) < 0) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":795 + /* "newanalysis/helpers/helpers.pyx":794 * - * @cython.boundscheck(False) - * def dipTenCorrel(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTenCorrel(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, - * char [:,:] H_indices, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_43dipTenCorrel, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 795, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipTenCorrel, __pyx_t_2) < 0) __PYX_ERR(0, 795, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_43dipTenCorrel, 0, __pyx_n_s_dipTenCorrel, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 794, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipTenCorrel, __pyx_t_5) < 0) __PYX_ERR(0, 794, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":838 + /* "newanalysis/helpers/helpers.pyx":837 + * ctr = ctr + 1 * - * @cython.boundscheck(False) - * def dipTenInit(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTenInit(np.ndarray[np.float64_t,ndim=2,mode='c'] coo_center, * np.ndarray[np.float64_t,ndim=2,mode='c'] coo_H, - * char [:,:] H_indices, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_45dipTenInit, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipTenInit, __pyx_t_2) < 0) __PYX_ERR(0, 838, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_45dipTenInit, 0, __pyx_n_s_dipTenInit, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipTenInit, __pyx_t_5) < 0) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":879 + /* "newanalysis/helpers/helpers.pyx":878 * - * @cython.boundscheck(False) - * def dipTen(np.ndarray[np.float64_t,ndim=1] rv, # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTen(np.ndarray[np.float64_t,ndim=1] rv, * np.float64_t r2): - * """ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_47dipTen, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 879, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipTen, __pyx_t_2) < 0) __PYX_ERR(0, 879, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_47dipTen, 0, __pyx_n_s_dipTen, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 878, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipTen, __pyx_t_5) < 0) __PYX_ERR(0, 878, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":904 + /* "newanalysis/helpers/helpers.pyx":903 + * return dipt * - * @cython.boundscheck(False) - * def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): * - * cdef int nwat = len(py_xyz)/3 # number of water molecules */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_49NQRself, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_NQRself, __pyx_t_2) < 0) __PYX_ERR(0, 904, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_49NQRself, 0, __pyx_n_s_NQRself, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NQRself, __pyx_t_5) < 0) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":979 + /* "newanalysis/helpers/helpers.pyx":978 + * return py_dipt * - * @cython.boundscheck(False) - * def waterRotationMatrix(double [:,:] coor): # <<<<<<<<<<<<<< - * cdef int nwat = len(coor)/3 # number of water molecules - * cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def waterRotationMatrix(double [:,:] coor): + * cdef int nwat = len(coor)//3 # number of water molecules */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_51waterRotationMatrix, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 979, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_waterRotationMatrix, __pyx_t_2) < 0) __PYX_ERR(0, 979, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_51waterRotationMatrix, 0, __pyx_n_s_waterRotationMatrix, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 978, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_waterRotationMatrix, __pyx_t_5) < 0) __PYX_ERR(0, 978, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1037 + /* "newanalysis/helpers/helpers.pyx":1036 + * return B_out * - * @cython.boundscheck(False) - * def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): * - * cdef int nwat = len(py_xyz)/3 # number of water molecules */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_53NQRselfAndB, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1037, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_NQRselfAndB, __pyx_t_2) < 0) __PYX_ERR(0, 1037, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_53NQRselfAndB, 0, __pyx_n_s_NQRselfAndB, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1036, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NQRselfAndB, __pyx_t_5) < 0) __PYX_ERR(0, 1036, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1131 + /* "newanalysis/helpers/helpers.pyx":1130 + * return py_dipt,py_B1,py_B2,py_B3 * - * @cython.boundscheck(False) - * def NQRdipTen(np.ndarray[np.float64_t,ndim=2] py_xyz, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def NQRdipTen(np.ndarray[np.float64_t,ndim=2] py_xyz, * np.ndarray[np.float64_t,ndim=1] py_charges, - * aufpunkt): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_55NQRdipTen, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_NQRdipTen, __pyx_t_2) < 0) __PYX_ERR(0, 1131, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_55NQRdipTen, 0, __pyx_n_s_NQRdipTen, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NQRdipTen, __pyx_t_5) < 0) __PYX_ERR(0, 1130, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1368 + /* "newanalysis/helpers/helpers.pyx":1368 * * * def calcOctant(np.ndarray[np.float64_t,ndim=2,mode="c"] com, # <<<<<<<<<<<<<< * isolute, nmolecules): * """ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_57calcOctant, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcOctant, __pyx_t_2) < 0) __PYX_ERR(0, 1368, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_57calcOctant, 0, __pyx_n_s_calcOctant, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1368, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcOctant, __pyx_t_5) < 0) __PYX_ERR(0, 1368, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1408 + /* "newanalysis/helpers/helpers.pyx":1407 + * return octants * - * @cython.boundscheck(False) - * def sumMDCage(double [:,:,:,:] mdcage_ts, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMDCage(double [:,:,:,:] mdcage_ts, * double [:,:] dip_wat, - * int nres_wat, char [:] ds, int maxshell, int rep, int frame): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_59sumMDCage, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1408, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sumMDCage, __pyx_t_2) < 0) __PYX_ERR(0, 1408, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_59sumMDCage, 0, __pyx_n_s_sumMDCage, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sumMDCage, __pyx_t_5) < 0) __PYX_ERR(0, 1407, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1423 + /* "newanalysis/helpers/helpers.pyx":1422 + * mdcage_ts[rep,maxshell,frame,i] += dip_wat[w,i] * - * @cython.boundscheck(False) - * def sumMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, * char [:] ds, int maxshell, int frame): - * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_61sumMDCageSingle, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1423, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sumMDCageSingle, __pyx_t_2) < 0) __PYX_ERR(0, 1423, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_61sumMDCageSingle, 0, __pyx_n_s_sumMDCageSingle, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__88)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1422, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sumMDCageSingle, __pyx_t_5) < 0) __PYX_ERR(0, 1422, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1438 + /* "newanalysis/helpers/helpers.pyx":1437 + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] * - * @cython.boundscheck(False) - * def calcAngularMomentum(double [:,:] coor, double [:,:] vel, double [:] masses, int natoms): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularMomentum(double [:,:] coor, double [:,:] vel, double [:] masses, int natoms): * - * cdef np.ndarray[np.float64_t, ndim=1] L = np.zeros(3) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_63calcAngularMomentum, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcAngularMomentum, __pyx_t_2) < 0) __PYX_ERR(0, 1438, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_63calcAngularMomentum, 0, __pyx_n_s_calcAngularMomentum, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__90)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcAngularMomentum, __pyx_t_5) < 0) __PYX_ERR(0, 1437, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1452 + /* "newanalysis/helpers/helpers.pyx":1451 + * return L * - * @cython.boundscheck(False) - * def calcInertiaTensor(double [:,:] coor, double [:] masses, int natoms): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcInertiaTensor(double [:,:] coor, double [:] masses, int natoms): * - * cdef np.ndarray[np.float64_t, ndim=2] I = np.zeros((3,3)) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_65calcInertiaTensor, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcInertiaTensor, __pyx_t_2) < 0) __PYX_ERR(0, 1452, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_65calcInertiaTensor, 0, __pyx_n_s_calcInertiaTensor, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__92)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcInertiaTensor, __pyx_t_5) < 0) __PYX_ERR(0, 1451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1478 + /* "newanalysis/helpers/helpers.pyx":1477 * - * @cython.boundscheck(False) - * def calcResidenceTimeseries(char [:,:] ds, int nshells): # <<<<<<<<<<<<<< * - * cdef int nmol = len(ds) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcResidenceTimeseries(char [:,:] ds, int nshells): + * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_67calcResidenceTimeseries, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcResidenceTimeseries, __pyx_t_2) < 0) __PYX_ERR(0, 1478, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_67calcResidenceTimeseries, 0, __pyx_n_s_calcResidenceTimeseries, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__94)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1477, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcResidenceTimeseries, __pyx_t_5) < 0) __PYX_ERR(0, 1477, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1495 + /* "newanalysis/helpers/helpers.pyx":1494 + * return np.asarray(ts) * - * @cython.boundscheck(False) - * def calcAngularDisplacement(double [:,:] wts, double dt): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcAngularDisplacement(double [:,:] wts, double dt): * - * cdef int tn = wts.shape[0] */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_69calcAngularDisplacement, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcAngularDisplacement, __pyx_t_2) < 0) __PYX_ERR(0, 1495, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_69calcAngularDisplacement, 0, __pyx_n_s_calcAngularDisplacement, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__96)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1494, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcAngularDisplacement, __pyx_t_5) < 0) __PYX_ERR(0, 1494, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1523 + /* "newanalysis/helpers/helpers.pyx":1522 + * return msd * - * @cython.boundscheck(False) - * def findNearestAtom(double [:,:] coor_core, double [:,:] coor_surr, double [:] mindist, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findNearestAtom(double [:,:] coor_core, double [:,:] coor_surr, double [:] mindist, * double [:] mindist2, double [:,:] minvec, int [:] next_id): - * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_71findNearestAtom, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1523, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_findNearestAtom, __pyx_t_2) < 0) __PYX_ERR(0, 1523, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_71findNearestAtom, 0, __pyx_n_s_findNearestAtom, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__98)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1522, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_findNearestAtom, __pyx_t_5) < 0) __PYX_ERR(0, 1522, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1549 + /* "newanalysis/helpers/helpers.pyx":1548 + * minvec[i,j] = coor_surr[next_id[i],j] - coor_core[i,j] * - * @cython.boundscheck(False) - * def checkHBond(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def checkHBond(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist): * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_73checkHBond, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1549, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_checkHBond, __pyx_t_2) < 0) __PYX_ERR(0, 1549, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_73checkHBond, 0, __pyx_n_s_checkHBond, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__100)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1548, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_checkHBond, __pyx_t_5) < 0) __PYX_ERR(0, 1548, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1592 + /* "newanalysis/helpers/helpers.pyx":1591 + * return np.asarray(hbond) * - * @cython.boundscheck(False) - * def sphHarmMatrix(double [:,:] coor, np.complex128_t [:,:] y_mat, int lmax): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sphHarmMatrix(double [:,:] coor, np.complex128_t [:,:] y_mat, int lmax): * cdef double r, pol, azi - * cdef int nat = coor.shape[0], i, l1, m1, m1r, l2, m2, m2r */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_75sphHarmMatrix, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1592, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sphHarmMatrix, __pyx_t_2) < 0) __PYX_ERR(0, 1592, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_75sphHarmMatrix, 0, __pyx_n_s_sphHarmMatrix, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sphHarmMatrix, __pyx_t_5) < 0) __PYX_ERR(0, 1591, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1610 + /* "newanalysis/helpers/helpers.pyx":1609 + * y_mat[2*l1+m1,2*l2+m2] += sph_harm(m1r,l1,azi,pol) * np.conjugate(sph_harm(m2r,l2,azi,pol)) * - * @cython.boundscheck(False) - * def calcFourierLaplaceTransform(double [:] data_x, double [:] data_y, double w): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcFourierLaplaceTransform(double [:] data_x, double [:] data_y, double w): * cdef double wt, wt1 - * cdef double dt = data_x[1] - data_x[0] */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_77calcFourierLaplaceTransform, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1610, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcFourierLaplaceTransform, __pyx_t_2) < 0) __PYX_ERR(0, 1610, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_77calcFourierLaplaceTransform, 0, __pyx_n_s_calcFourierLaplaceTransform, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__104)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcFourierLaplaceTransform, __pyx_t_5) < 0) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1633 + /* "newanalysis/helpers/helpers.pyx":1632 + * return float(laplace_re), float(laplace_im) * - * @cython.boundscheck(False) - * def calcRotationMatrix(double [:,:] coorA, double [:,:] coorB): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcRotationMatrix(double [:,:] coorA, double [:,:] coorB): * """ - * calcRotationMatrix(coor,coorA,coorB) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_79calcRotationMatrix, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcRotationMatrix, __pyx_t_2) < 0) __PYX_ERR(0, 1633, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_79calcRotationMatrix, 0, __pyx_n_s_calcRotationMatrix, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__106)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcRotationMatrix, __pyx_t_5) < 0) __PYX_ERR(0, 1632, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1651 + /* "newanalysis/helpers/helpers.pyx":1650 + * return np.asarray(R) * - * @cython.boundscheck(False) - * def applyRotationMatrix(double [:,:] coor, double [:,:] R): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def applyRotationMatrix(double [:,:] coor, double [:,:] R): * """ - * calcRotationMatrix(coor,coorA,coorB) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_7helpers_81applyRotationMatrix, NULL, __pyx_n_s_newanalysis_helpers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_applyRotationMatrix, __pyx_t_2) < 0) __PYX_ERR(0, 1651, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_7helpers_81applyRotationMatrix, 0, __pyx_n_s_applyRotationMatrix, NULL, __pyx_n_s_newanalysis_helpers, __pyx_d, ((PyObject *)__pyx_codeobj__108)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_applyRotationMatrix, __pyx_t_5) < 0) __PYX_ERR(0, 1650, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/helpers.pyx":1 + /* "newanalysis/helpers/helpers.pyx":1 * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 * */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":210 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * def __dealloc__(array self): - */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyType_Modified(__pyx_array_type); - - /* "View.MemoryView":287 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__109, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(generic); - __Pyx_DECREF_SET(generic, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":288 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__110, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(strided); - __Pyx_DECREF_SET(strided, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__111, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(indirect); - __Pyx_DECREF_SET(indirect, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":292 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__112, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(contiguous); - __Pyx_DECREF_SET(contiguous, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":293 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__113, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF(indirect_contiguous); - __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":317 - * - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ - * PyThread_allocate_lock(), - */ - __pyx_memoryview_thread_locks_used = 0; - - /* "View.MemoryView":318 - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< - * PyThread_allocate_lock(), - * PyThread_allocate_lock(), - */ - __pyx_t_3[0] = PyThread_allocate_lock(); - __pyx_t_3[1] = PyThread_allocate_lock(); - __pyx_t_3[2] = PyThread_allocate_lock(); - __pyx_t_3[3] = PyThread_allocate_lock(); - __pyx_t_3[4] = PyThread_allocate_lock(); - __pyx_t_3[5] = PyThread_allocate_lock(); - __pyx_t_3[6] = PyThread_allocate_lock(); - __pyx_t_3[7] = PyThread_allocate_lock(); - memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_3, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); - - /* "View.MemoryView":551 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyType_Modified(__pyx_memoryview_type); - - /* "View.MemoryView":997 - * return self.from_object - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyType_Modified(__pyx_memoryviewslice_type); - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - */ + __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_5) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); if (__pyx_m) { - if (__pyx_d) { + if (__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init newanalysis.helpers", __pyx_clineno, __pyx_lineno, __pyx_filename); } + #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init newanalysis.helpers"); } @@ -44537,6 +51884,22 @@ if (!__Pyx_RefNanny) { return; #endif } +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ @@ -44556,6 +51919,106 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + /* PyObjectGetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { @@ -44566,23 +52029,252 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif - return PyObject_GetAttr(obj, attr_name); + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif } -#endif -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; } - return result; + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) } +#endif /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( @@ -44627,6 +52319,7 @@ static void __Pyx_RaiseDoubleKeywordsError( /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, + PyObject *const *kwvalues, PyObject **argnames[], PyObject *kwds2, PyObject *values[], @@ -44637,13 +52330,54 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); // transfer ownership of value to values + Py_DECREF(key); +#endif + key = NULL; + value = NULL; continue; } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_Check(key))) { @@ -44651,6 +52385,9 @@ static int __Pyx_ParseOptionalKeywords( if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif break; } name++; @@ -44671,14 +52408,18 @@ static int __Pyx_ParseOptionalKeywords( #endif if (likely(PyUnicode_Check(key))) { while (*name) { - int cmp = (**name == key) ? 0 : + int cmp = ( #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif - PyUnicode_Compare(**name, key); + PyUnicode_Compare(**name, key) + ); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif break; } name++; @@ -44705,6 +52446,8 @@ static int __Pyx_ParseOptionalKeywords( goto invalid_keyword; } } + Py_XDECREF(key); + Py_XDECREF(value); return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); @@ -44714,104 +52457,211 @@ static int __Pyx_ParseOptionalKeywords( "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: - PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else + PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: + Py_XDECREF(key); + Py_XDECREF(value); return -1; } -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; } -#endif -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } #endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} #else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; } - PyErr_Clear(); + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); #endif - return __Pyx_GetBuiltinName(name); -} - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); } +bad: + Py_XDECREF(owned_instance); + return; } #endif /* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; @@ -44840,7 +52690,6 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args --tstate->recursion_depth; return result; } -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); @@ -44856,7 +52705,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { return NULL; } if ( @@ -44927,7 +52776,6 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, return result; } #endif -#endif /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON @@ -44949,35 +52797,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg } #endif -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { @@ -44998,198 +52817,433 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject } #endif -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); return result; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) +#else + if (PyCFunction_Check(func)) #endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + } + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } + } + } #endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); } } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + #if CYTHON_VECTORCALL + #if Py_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); + } + #endif + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); } -#endif -/* MemviewSliceInit */ +/* RaiseUnexpectedTypeError */ static int -__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference) +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) { - __Pyx_RefNannyDeclarations - int i, retval=-1; - Py_buffer *buf = &memview->view; - __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (unlikely(memviewslice->memview || memviewslice->data)) { - PyErr_SetString(PyExc_ValueError, - "memviewslice is already initialized!"); - goto fail; - } - if (buf->strides) { - for (i = 0; i < ndim; i++) { - memviewslice->strides[i] = buf->strides[i]; + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* CIntToDigits */ +static const char DIGIT_PAIRS_10[2*10*10+1] = { + "00010203040506070809" + "10111213141516171819" + "20212223242526272829" + "30313233343536373839" + "40414243444546474849" + "50515253545556575859" + "60616263646566676869" + "70717273747576777879" + "80818283848586878889" + "90919293949596979899" +}; +static const char DIGIT_PAIRS_8[2*8*8+1] = { + "0001020304050607" + "1011121314151617" + "2021222324252627" + "3031323334353637" + "4041424344454647" + "5051525354555657" + "6061626364656667" + "7071727374757677" +}; +static const char DIGITS_HEX[2*16+1] = { + "0123456789abcdef" + "0123456789ABCDEF" +}; + +/* BuildPyUnicode */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char) { + PyObject *uval; + Py_ssize_t uoffset = ulength - clength; +#if CYTHON_USE_UNICODE_INTERNALS + Py_ssize_t i; +#if CYTHON_PEP393_ENABLED + void *udata; + uval = PyUnicode_New(ulength, 127); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_DATA(uval); +#else + Py_UNICODE *udata; + uval = PyUnicode_FromUnicode(NULL, ulength); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_AS_UNICODE(uval); +#endif + if (uoffset > 0) { + i = 0; + if (prepend_sign) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); + i++; } - } else { - Py_ssize_t stride = buf->itemsize; - for (i = ndim - 1; i >= 0; i--) { - memviewslice->strides[i] = stride; - stride *= buf->shape[i]; + for (; i < uoffset; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); } } - for (i = 0; i < ndim; i++) { - memviewslice->shape[i] = buf->shape[i]; - if (buf->suboffsets) { - memviewslice->suboffsets[i] = buf->suboffsets[i]; - } else { - memviewslice->suboffsets[i] = -1; - } + for (i=0; i < clength; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); } - memviewslice->memview = memview; - memviewslice->data = (char *)buf->buf; - if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { - Py_INCREF(memview); +#else + { + PyObject *sign = NULL, *padding = NULL; + uval = NULL; + if (uoffset > 0) { + prepend_sign = !!prepend_sign; + if (uoffset > prepend_sign) { + padding = PyUnicode_FromOrdinal(padding_char); + if (likely(padding) && uoffset > prepend_sign + 1) { + PyObject *tmp; + PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign); + if (unlikely(!repeat)) goto done_or_error; + tmp = PyNumber_Multiply(padding, repeat); + Py_DECREF(repeat); + Py_DECREF(padding); + padding = tmp; + } + if (unlikely(!padding)) goto done_or_error; + } + if (prepend_sign) { + sign = PyUnicode_FromOrdinal('-'); + if (unlikely(!sign)) goto done_or_error; + } + } + uval = PyUnicode_DecodeASCII(chars, clength, NULL); + if (likely(uval) && padding) { + PyObject *tmp = PyNumber_Add(padding, uval); + Py_DECREF(uval); + uval = tmp; + } + if (likely(uval) && sign) { + PyObject *tmp = PyNumber_Add(sign, uval); + Py_DECREF(uval); + uval = tmp; + } +done_or_error: + Py_XDECREF(padding); + Py_XDECREF(sign); } - retval = 0; - goto no_fail; -fail: - memviewslice->memview = 0; - memviewslice->data = 0; - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; +#endif + return uval; } -#ifndef Py_NO_RETURN -#define Py_NO_RETURN + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(int)*3+2]; + char *dpos, *end = digits + sizeof(int)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + int remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" #endif -static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { - va_list vargs; - char msg[200]; -#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) - va_start(vargs, fmt); -#else - va_start(vargs); + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop #endif - vsnprintf(msg, 200, fmt, vargs); - va_end(vargs); - Py_FatalError(msg); -} -static CYTHON_INLINE int -__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)++; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE int -__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)--; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE void -__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) -{ - int first_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) - return; - if (unlikely(__pyx_get_slice_count(memview) < 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - first_time = __pyx_add_acquisition_count(memview) == 0; - if (unlikely(first_time)) { - if (have_gil) { - Py_INCREF((PyObject *) memview); + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (int) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (int) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (int) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_INCREF((PyObject *) memview); - PyGILState_Release(_gilstate); + prepend_sign = 1; } + ++ulength; } -} -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, - int have_gil, int lineno) { - int last_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) { - memslice->memview = NULL; - return; + if (width > ulength) { + ulength = width; } - if (unlikely(__pyx_get_slice_count(memview) <= 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - last_time = __pyx_sub_acquisition_count(memview) == 1; - memslice->data = NULL; - if (unlikely(last_time)) { - if (have_gil) { - Py_CLEAR(memslice->memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_CLEAR(memslice->memview); - PyGILState_Release(_gilstate); - } - } else { - memslice->memview = NULL; + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); } -/* None */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (Py_ssize_t) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (Py_ssize_t) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (Py_ssize_t) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + CYTHON_MAYBE_UNUSED_VAR(max_char); +#if CYTHON_PEP393_ENABLED + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); +#else + result_uval = PyUnicode_FromUnicode(NULL, result_ulength); + if (unlikely(!result_uval)) return NULL; + result_ukind = sizeof(Py_UNICODE); + kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; + result_udata = PyUnicode_AS_UNICODE(result_uval); +#endif + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); + if (unlikely(__Pyx_PyUnicode_READY(uval))) + goto bad; + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030D0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif + } + char_pos += ulength; + } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; +#else + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + CYTHON_UNUSED_VAR(value_count); + return PyUnicode_Join(__pyx_empty_unicode, value_tuple); +#endif } -/* None */ -static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname) { - #ifdef WITH_THREAD - PyGILState_STATE gilstate = PyGILState_Ensure(); - #endif - __Pyx_RaiseUnboundLocalError(varname); - #ifdef WITH_THREAD - PyGILState_Release(gilstate); - #endif +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); } /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; - if (!j) return NULL; + if (unlikely(!j)) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; @@ -45250,10 +53304,18 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return r; } } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); if (likely(l >= 0)) { i += l; } else { @@ -45262,7 +53324,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, PyErr_Clear(); } } - return m->sq_item(o, i); + return sm->sq_item(o, i); } } #else @@ -45273,1724 +53335,2078 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + /* ObjectGetItem */ #if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { PyObject *runerr = NULL; Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } key_value = __Pyx_PyIndex_AsSsize_t(index); if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); } if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (meth) { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); return NULL; } -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); } - return __Pyx_PyObject_GetIndex(obj, key); + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); } #endif -/* SliceObject */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, - Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { -#if CYTHON_USE_TYPE_SLOTS - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + Py_ssize_t kwsize; +#if CYTHON_ASSUME_SAFE_MACROS + kwsize = PyTuple_GET_SIZE(kw); +#else + kwsize = PyTuple_Size(kw); + if (kwsize < 0) return 0; +#endif + if (unlikely(kwsize == 0)) + return 1; + if (!kw_allowed) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, 0); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + goto invalid_keyword; } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < kwsize; pos++) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; - } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - goto bad; - PyErr_Clear(); - } +#endif + return 1; + } + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +/* GetAttr3 */ +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyString_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); } - return ms->sq_slice(obj, cstart, cstop); + return r; } #endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_subscript)) + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +} + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); #endif - { - PyObject* result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; - } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; - } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; - } -#if CYTHON_USE_TYPE_SLOTS - result = mp->mp_subscript(obj, py_slice); + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) #else - result = PyObject_GetItem(obj, py_slice); +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #endif - if (!_py_slice) { - Py_DECREF(py_slice); - } +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { return result; } - PyErr_Format(PyExc_TypeError, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); -bad: - return NULL; +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); } -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetName(type); PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); return 0; } -/* IsLittleEndian */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) +/* GetTopmostException */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { - union { - uint32_t u32; - uint8_t u8[4]; - } S; - S.u32 = 0x01020304; - return S.u8[0] == 4; + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; } +#endif -/* BufferFormatCheck */ -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type) { - stack[0].field = &ctx->root; - stack[0].parent_offset = 0; - ctx->root.type = type; - ctx->root.name = "buffer dtype"; - ctx->root.offset = 0; - ctx->head = stack; - ctx->head->field = &ctx->root; - ctx->fmt_offset = 0; - ctx->head->parent_offset = 0; - ctx->new_packmode = '@'; - ctx->enc_packmode = '@'; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->is_complex = 0; - ctx->is_valid_array = 0; - ctx->struct_alignment = 0; - while (type->typegroup == 'S') { - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = 0; - type = type->fields->type; - } -} -static int __Pyx_BufFmt_ParseNumber(const char** ts) { - int count; - const char* t = *ts; - if (*t < '0' || *t > '9') { - return -1; +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; } else { - count = *t++ - '0'; - while (*t >= '0' && *t <= '9') { - count *= 10; - count += *t++ - '0'; - } + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); } - *ts = t; - return count; + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif } -static int __Pyx_BufFmt_ExpectNumber(const char **ts) { - int number = __Pyx_BufFmt_ParseNumber(ts); - if (number == -1) - PyErr_Format(PyExc_ValueError,\ - "Does not understand character buffer dtype format string ('%c')", **ts); - return number; +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif } -static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - PyErr_Format(PyExc_ValueError, - "Unexpected format string character: '%c'", ch); +#endif + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif + } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; } -static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { - switch (ch) { - case '?': return "'bool'"; - case 'c': return "'char'"; - case 'b': return "'signed char'"; - case 'B': return "'unsigned char'"; - case 'h': return "'short'"; - case 'H': return "'unsigned short'"; - case 'i': return "'int'"; - case 'I': return "'unsigned int'"; - case 'l': return "'long'"; - case 'L': return "'unsigned long'"; - case 'q': return "'long long'"; - case 'Q': return "'unsigned long long'"; - case 'f': return (is_complex ? "'complex float'" : "'float'"); - case 'd': return (is_complex ? "'complex double'" : "'double'"); - case 'g': return (is_complex ? "'complex long double'" : "'long double'"); - case 'T': return "a struct"; - case 'O': return "Python object"; - case 'P': return "a pointer"; - case 's': case 'p': return "a string"; - case 0: return "end"; - default: return "unparseable format string"; - } + +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif + } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; } -static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return 2; - case 'i': case 'I': case 'l': case 'L': return 4; - case 'q': case 'Q': return 8; - case 'f': return (is_complex ? 8 : 4); - case 'd': return (is_complex ? 16 : 8); - case 'g': { - PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); - return 0; +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) + goto bad; + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) + goto bad; + from_list = empty_list; } - case 'O': case 'P': return sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + #endif + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif + } } -} -static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(short); - case 'i': case 'I': return sizeof(int); - case 'l': case 'L': return sizeof(long); - #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(PY_LONG_LONG); +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); #endif - case 'f': return sizeof(float) * (is_complex ? 2 : 1); - case 'd': return sizeof(double) * (is_complex ? 2 : 1); - case 'g': return sizeof(long double) * (is_complex ? 2 : 1); - case 'O': case 'P': return sizeof(void*); - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + return module; +} + +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); } - } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); + } + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; } -typedef struct { char c; short x; } __Pyx_st_short; -typedef struct { char c; int x; } __Pyx_st_int; -typedef struct { char c; long x; } __Pyx_st_long; -typedef struct { char c; float x; } __Pyx_st_float; -typedef struct { char c; double x; } __Pyx_st_double; -typedef struct { char c; long double x; } __Pyx_st_longdouble; -typedef struct { char c; void *x; } __Pyx_st_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); #endif - case 'f': return sizeof(__Pyx_st_float) - sizeof(float); - case 'd': return sizeof(__Pyx_st_double) - sizeof(double); - case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } + return imported_module; } -/* These are for computing the padding at the end of the struct to align - on the first member of the struct. This will probably the same as above, - but we don't have any guarantees. - */ -typedef struct { short x; char c; } __Pyx_pad_short; -typedef struct { int x; char c; } __Pyx_pad_int; -typedef struct { long x; char c; } __Pyx_pad_long; -typedef struct { float x; char c; } __Pyx_pad_float; -typedef struct { double x; char c; } __Pyx_pad_double; -typedef struct { long double x; char c; } __Pyx_pad_longdouble; -typedef struct { void *x; char c; } __Pyx_pad_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif -static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); #endif - case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); - case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); - case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; } -} -static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { - switch (ch) { - case 'c': - return 'H'; - case 'b': case 'h': case 'i': - case 'l': case 'q': case 's': case 'p': - return 'I'; - case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': - return 'U'; - case 'f': case 'd': case 'g': - return (is_complex ? 'C' : 'R'); - case 'O': - return 'O'; - case 'P': - return 'P'; - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); } - } + return module; } -static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { - if (ctx->head == NULL || ctx->head->field == &ctx->root) { - const char* expected; - const char* quote; - if (ctx->head == NULL) { - expected = "end"; - quote = ""; - } else { - expected = ctx->head->field->type->name; - quote = "'"; +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__3; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; } - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected %s%s%s but got %s", - quote, expected, quote, - __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); - } else { - __Pyx_StructField* field = ctx->head->field; - __Pyx_StructField* parent = (ctx->head - 1)->field; - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", - field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), - parent->type->name, field->name); - } -} -static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { - char group; - size_t size, offset, arraysize = 1; - if (ctx->enc_type == 0) return 0; - if (ctx->head->field->type->arraysize[0]) { - int i, ndim = 0; - if (ctx->enc_type == 's' || ctx->enc_type == 'p') { - ctx->is_valid_array = ctx->head->field->type->ndim == 1; - ndim = 1; - if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { - PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %zu", - ctx->head->field->type->arraysize[0], ctx->enc_count); - return -1; + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); } + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); } - if (!ctx->is_valid_array) { - PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", - ctx->head->field->type->ndim, ndim); - return -1; - } - for (i = 0; i < ctx->head->field->type->ndim; i++) { - arraysize *= ctx->head->field->type->arraysize[i]; - } - ctx->is_valid_array = 0; - ctx->enc_count = 1; - } - group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); - do { - __Pyx_StructField* field = ctx->head->field; - __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { - size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); - } else { - size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); - } - if (ctx->enc_packmode == '@') { - size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - size_t align_mod_offset; - if (align_at == 0) return -1; - align_mod_offset = ctx->fmt_offset % align_at; - if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; - if (ctx->struct_alignment == 0) - ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, - ctx->is_complex); +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); +} + +/* ssize_strlen */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; } - if (type->size != size || type->typegroup != group) { - if (type->typegroup == 'C' && type->fields != NULL) { - size_t parent_offset = ctx->head->parent_offset + field->offset; - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = parent_offset; - continue; - } - if ((type->typegroup == 'H' || group == 'H') && type->size == size) { - } else { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } + return (Py_ssize_t) len; +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; } - offset = ctx->head->parent_offset + field->offset; - if (ctx->fmt_offset != offset) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", - (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); - return -1; + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; } - ctx->fmt_offset += size; - if (arraysize) - ctx->fmt_offset += (arraysize - 1) * size; - --ctx->enc_count; - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; } - break; - } - ctx->head->field = ++field; - if (field->type == NULL) { - --ctx->head; - field = ctx->head->field; - continue; - } else if (field->type->typegroup == 'S') { - size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; - field = field->type->fields; - ++ctx->head; - ctx->head->field = field; - ctx->head->parent_offset = parent_offset; - break; - } else { - break; - } + return 0; } - } while (ctx->enc_count); - ctx->enc_type = 0; - ctx->is_complex = 0; - return 0; + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); } -static PyObject * -__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) -{ - const char *ts = *tsp; - int i = 0, number, ndim; - ++ts; - if (ctx->new_count != 1) { - PyErr_SetString(PyExc_ValueError, - "Cannot handle repeated arrays in format string"); - return NULL; +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ndim = ctx->head->field->type->ndim; - while (*ts && *ts != ')') { - switch (*ts) { - case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; - default: break; + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; } - number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) - return PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %d", - ctx->head->field->type->arraysize[i], number); - if (*ts != ',' && *ts != ')') - return PyErr_Format(PyExc_ValueError, - "Expected a comma in format string, got '%c'", *ts); - if (*ts == ',') ts++; - i++; } - if (i != ndim) - return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", - ctx->head->field->type->ndim, i); - if (!*ts) { - PyErr_SetString(PyExc_ValueError, - "Unexpected end of format string, expected ')'"); - return NULL; + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } - ctx->is_valid_array = 1; - ctx->new_count = 1; - *tsp = ++ts; - return Py_None; } -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { - int got_Z = 0; - while (1) { - switch(*ts) { - case 0: - if (ctx->enc_type != 0 && ctx->head == NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - if (ctx->head != NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - return ts; - case ' ': - case '\r': - case '\n': - ++ts; - break; - case '<': - if (!__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '=': - case '@': - case '^': - ctx->new_packmode = *ts++; - break; - case 'T': - { - const char* ts_after_sub; - size_t i, struct_count = ctx->new_count; - size_t struct_alignment = ctx->struct_alignment; - ctx->new_count = 1; - ++ts; - if (*ts != '{') { - PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - ctx->enc_count = 0; - ctx->struct_alignment = 0; - ++ts; - ts_after_sub = ts; - for (i = 0; i != struct_count; ++i) { - ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); - if (!ts_after_sub) return NULL; - } - ts = ts_after_sub; - if (struct_alignment) ctx->struct_alignment = struct_alignment; - } - break; - case '}': - { - size_t alignment = ctx->struct_alignment; - ++ts; - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - if (alignment && ctx->fmt_offset % alignment) { - ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); - } - } - return ts; - case 'x': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->fmt_offset += ctx->new_count; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->enc_packmode = ctx->new_packmode; - ++ts; - break; - case 'Z': - got_Z = 1; - ++ts; - if (*ts != 'f' && *ts != 'd' && *ts != 'g') { - __Pyx_BufFmt_RaiseUnexpectedChar('Z'); - return NULL; - } - CYTHON_FALLTHROUGH; - case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': - case 'l': case 'L': case 'q': case 'Q': - case 'f': case 'd': case 'g': - case 'O': case 'p': - if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && - (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { - ctx->enc_count += ctx->new_count; - ctx->new_count = 1; - got_Z = 0; - ++ts; - break; - } - CYTHON_FALLTHROUGH; - case 's': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_count = ctx->new_count; - ctx->enc_packmode = ctx->new_packmode; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; - ++ts; - ctx->new_count = 1; - got_Z = 0; - break; - case ':': - ++ts; - while(*ts != ':') ++ts; - ++ts; - break; - case '(': - if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; - break; - default: - { - int number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - ctx->new_count = (size_t)number; +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; ibuf == NULL)) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); + return 0; } -static void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { + if (likely(err == exc_type)) return 1; + if (likely(PyExceptionClass_Check(err))) { + if (likely(PyExceptionClass_Check(exc_type))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); + } else if (likely(PyTuple_Check(exc_type))) { + return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); + } else { + } + } + return PyErr_GivenExceptionMatches(err, exc_type); } -static int __Pyx__GetBufferAndValidate( - Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, - int nd, int cast, __Pyx_BufFmt_StackElem* stack) -{ - buf->buf = NULL; - if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { - __Pyx_ZeroBuffer(buf); - return -1; - } - if (unlikely(buf->ndim != nd)) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - nd, buf->ndim); - goto fail; - } - if (!cast) { - __Pyx_BufFmt_Context ctx; - __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; - } - if (unlikely((size_t)buf->itemsize != dtype->size)) { - PyErr_Format(PyExc_ValueError, - "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", - buf->itemsize, (buf->itemsize > 1) ? "s" : "", - dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); - goto fail; - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_SafeReleaseBuffer(buf); - return -1; +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { + assert(PyExceptionClass_Check(exc_type1)); + assert(PyExceptionClass_Check(exc_type2)); + if (likely(err == exc_type1 || err == exc_type2)) return 1; + if (likely(PyExceptionClass_Check(err))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); + } + return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); } +#endif -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; +/* PySequenceMultiply */ +static PyObject* __Pyx_PySequence_Multiply_Generic(PyObject *seq, Py_ssize_t mul) { + PyObject *result, *pymul = PyInt_FromSsize_t(mul); + if (unlikely(!pymul)) + return NULL; + result = PyNumber_Multiply(seq, pymul); + Py_DECREF(pymul); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul) { +#if CYTHON_USE_TYPE_SLOTS + PyTypeObject *type = Py_TYPE(seq); + if (likely(type->tp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); } - if (likely(__Pyx_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; } -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; } +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) +#else + if (is_list || PySequence_Check(o)) +#endif + { + return PySequence_SetItem(o, i, v); + } #endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +} -/* DivInt[Py_ssize_t] */ - static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { - Py_ssize_t q = a / b; - Py_ssize_t r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; +/* RaiseUnboundLocalError */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } /* DivInt[long] */ - static CYTHON_INLINE long __Pyx_div_long(long a, long b) { +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { long q = a / b; long r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } -/* GetTopmostException */ - #if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); } - return exc_info; + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; } -#endif -/* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); +/* HasAttr */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_GetAttr(o, n); + if (!r) { + PyErr_Clear(); + return 0; + } else { + Py_DECREF(r); + return 1; + } } -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; + +/* RaiseUnboundMemoryviewSliceNogil */ +static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname) { + #ifdef WITH_THREAD + PyGILState_STATE gilstate = PyGILState_Ensure(); + #endif + __Pyx_RaiseUnboundLocalError(varname); + #ifdef WITH_THREAD + PyGILState_Release(gilstate); #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); } -#endif -/* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; itp_as_sequence; + if (likely(ms && ms->sq_slice)) { + if (!has_cstart) { + if (_py_start && (*_py_start != Py_None)) { + cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); + if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstart = 0; + } + if (!has_cstop) { + if (_py_stop && (*_py_stop != Py_None)) { + cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); + if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstop = PY_SSIZE_T_MAX; + } + if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { + Py_ssize_t l = ms->sq_length(obj); + if (likely(l >= 0)) { + if (cstop < 0) { + cstop += l; + if (cstop < 0) cstop = 0; + } + if (cstart < 0) { + cstart += l; + if (cstart < 0) cstart = 0; + } + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + goto bad; + PyErr_Clear(); + } + } + return ms->sq_slice(obj, cstart, cstop); } +#else + CYTHON_UNUSED_VAR(wraparound); #endif - for (i=0; itp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#else + CYTHON_UNUSED_VAR(wraparound); +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyInt_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyInt_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_USE_TYPE_SLOTS + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; } - return 0; + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); +bad: + return NULL; } -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { - PyObject *exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + +/* IsLittleEndian */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) +{ + union { + uint32_t u32; + uint8_t u8[4]; + } S; + S.u32 = 0x01020304; + return S.u8[0] == 4; } -#endif -/* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +/* BufferFormatCheck */ +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t <= '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case '?': return "'bool'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparsable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif -{ - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); #endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if CYTHON_USE_EXC_INFO_STACK - { - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); -#endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; } - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); + } +} +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } + expected = ctx->head->field->type->name; + quote = "'"; } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } } -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#endif + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } -#endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; + } + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; + break; + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } } -#endif + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; } - -/* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; +static int +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number, ndim; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return -1; } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return -1; + ndim = ctx->head->field->type->ndim; + while (*ts && *ts != ')') { + switch (*ts) { + case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; + default: break; + } + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return -1; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) + } + if (*ts != ',' && *ts != ')') { + PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); + } + if (*ts == ',') ts++; + i++; } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; + if (i != ndim) { + PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + return -1; + } + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return -1; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return 0; +} +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case '\r': + case '\n': + ++ts; + break; + case '<': + if (!__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; } -#if CYTHON_USE_UNICODE_INTERNALS + break; + case '}': { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; - #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } } -#endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); + CYTHON_FALLTHROUGH; + case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 'p': + if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && + (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { + ctx->enc_count += ctx->new_count; + ctx->new_count = 1; + got_Z = 0; + ++ts; + break; } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - -/* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) -#else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); -#endif - return PyObject_GetAttr(o, n); -} - -/* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; + CYTHON_FALLTHROUGH; + case 's': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (__pyx_buffmt_parse_array(ctx, &ts) < 0) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - } - if (unlikely(stop <= start)) - return __Pyx_NewRef(__pyx_empty_unicode); - length = stop - start; - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); } + } } -/* GetAttr3 */ - static PyObject *__Pyx_GetAttr3Default(PyObject *d) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(d); - return d; +/* BufferGetAndValidate */ + static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (unlikely(info->buf == NULL)) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); } -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r = __Pyx_GetAttr(o, n); - return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +static void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; } - -/* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static int __Pyx__GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + buf->buf = NULL; + if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { + __Pyx_ZeroBuffer(buf); + return -1; + } + if (unlikely(buf->ndim != nd)) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if (unlikely((size_t)buf->itemsize != dtype->size)) { PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_SafeReleaseBuffer(buf); + return -1; } -/* SwapException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = *type; - exc_info->exc_value = *value; - exc_info->exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} +/* PyObject_GenericGetAttrNoDict */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; + __Pyx_DECREF_TypeName(type_name); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); } -bad: + Py_INCREF(descr); #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - return __Pyx_InBases(a, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; + { + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; } } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } - return res; + return descr; } #endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; itp_dictoffset)) { + return PyObject_GenericGetAttr(obj, attr_name); } - return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); + return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); } #endif -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; +/* FixUpExtensionType */ + #if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; #endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + changed = 1; + } #endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + Py_DECREF(descr); + changed = 1; + } #endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); } + memb++; } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); + if (changed) + PyType_Modified(type); } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); +#endif + return 0; } #endif -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); +/* PyObjectCallNoArg */ + static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod */ + static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) #else - "cannot import name %S", name); + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) #endif +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } } - return value; -} - -/* HasAttr */ - static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { - PyObject *r; - if (unlikely(!__Pyx_PyBaseString_Check(n))) { - PyErr_SetString(PyExc_TypeError, - "hasattr(): attribute name must be string"); - return -1; + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); } - r = __Pyx_GetAttr(o, n); - if (unlikely(!r)) { - PyErr_Clear(); + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; return 0; - } else { - Py_DECREF(r); + } + type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); +#endif + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; return 1; } +#endif + *method = attr; + return 0; } -/* PyObject_GenericGetAttrNoDict */ - #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); +/* PyObjectCallMethod0 */ + static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +} + +/* ValidateBasesTuple */ + #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_MACROS + n = PyTuple_GET_SIZE(bases); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); + n = PyTuple_Size(bases); + if (n < 0) return -1; #endif - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { - PyObject *descr; - PyTypeObject *tp = Py_TYPE(obj); - if (unlikely(!PyString_Check(attr_name))) { - return PyObject_GenericGetAttr(obj, attr_name); - } - assert(!tp->tp_dictoffset); - descr = _PyType_Lookup(tp, attr_name); - if (unlikely(!descr)) { - return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); - } - Py_INCREF(descr); - #if PY_MAJOR_VERSION < 3 - if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) - #endif + for (i = 1; i < n; i++) { - descrgetfunc f = Py_TYPE(descr)->tp_descr_get; - if (unlikely(f)) { - PyObject *res = f(descr, obj, (PyObject *)tp); - Py_DECREF(descr); - return res; +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#if !CYTHON_USE_TYPE_SLOTS + if (dictoffset == 0) { + PyErr_Format(PyExc_TypeError, + "extension type '%s.200s': " + "unable to validate whether bases have a __dict__ " + "when CYTHON_USE_TYPE_SLOTS is off " + "(likely because you are building in the limited API). " + "Therefore, all extension types with multiple bases " + "must add 'cdef dict __dict__' in this compilation mode", + type_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#else + if (dictoffset == 0 && b->tp_dictoffset) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; } +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif } - return descr; + return 0; } #endif -/* PyObject_GenericGetAttr */ - #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { - if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { - return PyObject_GenericGetAttr(obj, attr_name); +/* PyType_Ready */ + static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif } - return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); -} #endif + return r; +#endif +} /* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 + static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) #else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) #endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) goto bad; Py_DECREF(ob); return 0; @@ -46999,33 +55415,85 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam return -1; } -/* PyObjectGetAttrStrNoError */ - static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } +/* GetVTable */ + static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); #endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i; + void** base_vtables; + __Pyx_TypeName tp_base_name; + __Pyx_TypeName base_name; + void* unknown = (void*)-1; + PyObject* bases = type->tp_bases; + int base_depth = 0; + { + PyTypeObject* base = type->tp_base; + while (base) { + base_depth += 1; + base = base->tp_base; + } + } + base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; + for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { + void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); + if (base_vtable != NULL) { + int j; + PyTypeObject* base = type->tp_base; + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = base->tp_base; + } + } } - return result; + PyErr_Clear(); + free(base_vtables); + return 0; +bad: + tp_base_name = __Pyx_PyType_GetName(type->tp_base); + base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); + free(base_vtables); + return -1; } +#endif /* SetupReduce */ - static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { @@ -47091,7 +55559,7 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } else if (reduce == object_reduce || PyErr_Occurred()) { goto __PYX_BAD; } - setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); @@ -47107,8 +55575,13 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } goto __PYX_GOOD; __PYX_BAD: - if (!PyErr_Occurred()) - PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } ret = -1; __PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP @@ -47124,18 +55597,19 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { Py_XDECREF(setstate_cython); return ret; } +#endif /* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size) + #ifndef __PYX_HAVE_RT_ImportType_3_0_2 +#define __PYX_HAVE_RT_ImportType_3_0_2 +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; Py_ssize_t itemsize; -#ifdef Py_LIMITED_API +#if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; PyObject *py_itemsize; #endif @@ -47148,7 +55622,7 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, module_name, class_name); goto bad; } -#ifndef Py_LIMITED_API +#if !CYTHON_COMPILING_IN_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; itemsize = ((PyTypeObject *)result)->tp_itemsize; #else @@ -47180,17 +55654,18 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_2 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_2 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -47204,14 +55679,1181 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, } #endif +/* FetchSharedCythonModule */ + static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; +} + +/* FetchCommonType */ + static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { + goto bad; + } + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; +done: + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#endif + +/* PyVectorcallFastCallDict */ + #if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared */ + static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) +{ + CYTHON_UNUSED_VAR(closure); + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#elif PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_name, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_dict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); + } +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + CYTHON_UNUSED_VAR(args); +#if PY_MAJOR_VERSION >= 3 + Py_INCREF(m->func_qualname); + return m->func_qualname; +#else + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults_size = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyObject *py_name = NULL; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); +#endif + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); +#endif + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", + py_name); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); +#endif + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_MACROS + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(!argc) < 0) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); +#else + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); +#endif + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL + 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_PyMethod_New, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, +#endif +}; +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + m->defaults_size = size; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ + static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -47225,7 +56867,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -47247,7 +56889,8 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -47325,17 +56968,99 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + PyErr_Clear(); + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #endif +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + py_funcname = PyUnicode_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -47370,6 +57095,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -47432,13 +57158,19 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + __Pyx_TypeName obj_type_name; if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags); - PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' does not have the buffer interface", + obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { @@ -47513,19 +57245,6 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, return (start1 < end2) && (start2 < end1); } -/* Capsule */ - static CYTHON_INLINE PyObject * -__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) -{ - PyObject *cobj; -#if PY_VERSION_HEX >= 0x02070000 - cobj = PyCapsule_New(p, sig, NULL); -#else - cobj = PyCObject_FromVoidPtr(p, NULL); -#endif - return cobj; -} - /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) @@ -47644,8 +57363,9 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) return 0; } static int -__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec) +__pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec) { + CYTHON_UNUSED_VAR(ndim); if (spec & __Pyx_MEMVIEW_DIRECT) { if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { PyErr_Format(PyExc_ValueError, @@ -47983,7 +57703,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) { double value = __pyx_PyFloat_AsDouble(obj); - if ((value == (double)-1) && PyErr_Occurred()) + if (unlikely((value == (double)-1) && PyErr_Occurred())) return 0; *(double *) itemp = value; return 1; @@ -47995,52 +57715,26 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o } static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) { int value = __Pyx_PyInt_As_int(obj); - if ((value == (int)-1) && PyErr_Occurred()) + if (unlikely((value == (int)-1) && PyErr_Occurred())) return 0; *(int *) itemp = value; return 1; } -/* MemviewDtypeToObject */ - static CYTHON_INLINE PyObject *__pyx_memview_get_char(const char *itemp) { - return (PyObject *) __Pyx_PyInt_From_char(*(char *) itemp); -} -static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj) { - char value = __Pyx_PyInt_As_char(obj); - if ((value == (char)-1) && PyErr_Occurred()) - return 0; - *(char *) itemp = value; - return 1; -} - -/* FromPy */ - static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject* o) { - Py_complex cval; -#if !CYTHON_COMPILING_IN_PYPY - if (PyComplex_CheckExact(o)) - cval = ((PyComplexObject *)o)->cval; - else -#endif - cval = PyComplex_AsCComplex(o); - return __pyx_t_double_complex_from_parts( - (double)cval.real, - (double)cval.imag); -} - /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return ::std::complex< float >(x, y); + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); } #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; z.real = x; z.imag = y; return z; @@ -48048,90 +57742,90 @@ static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else - static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } #if 1 - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { if (b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); - } else if (fabsf(b.real) >= fabsf(b.imag)) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { if (b.real == 0 && b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { - float r = b.imag / b.real; - float s = (float)(1.0) / (b.real + b.imag * r); - return __pyx_t_float_complex_from_parts( + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { - float r = b.real / b.imag; - float s = (float)(1.0) / (b.imag + b.real * r); - return __pyx_t_float_complex_from_parts( + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } } #else - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { if (b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); } else { - float denom = b.real * b.real + b.imag * b.imag; - return __pyx_t_float_complex_from_parts( + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( (a.real * b.real + a.imag * b.imag) / denom, (a.imag * b.real - a.real * b.imag) / denom); } } #endif - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } - static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 - static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrtf(z.real*z.real + z.imag*z.imag); + return sqrt(z.real*z.real + z.imag*z.imag); #else - return hypotf(z.real, z.imag); + return hypot(z.real, z.imag); #endif } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float r, lnr, theta, z_r, z_theta; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { - float denom = a.real * a.real + a.imag * a.imag; + double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; @@ -48144,20 +57838,20 @@ static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj case 1: return a; case 2: - return __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_double(a, a); case 3: - z = __Pyx_c_prod_float(a, a); - return __Pyx_c_prod_float(z, a); + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); case 4: - z = __Pyx_c_prod_float(a, a); - return __Pyx_c_prod_float(z, z); + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } else if ((b.imag == 0) && (a.real >= 0)) { - z.real = powf(a.real, b.real); + z.real = pow(a.real, b.real); z.imag = 0; return z; } else if (a.real > 0) { @@ -48165,36 +57859,62 @@ static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj theta = 0; } else { r = -a.real; - theta = atan2f(0.0, -1.0); + theta = atan2(0.0, -1.0); } } else { - r = __Pyx_c_abs_float(a); - theta = atan2f(a.imag, a.real); + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); } - lnr = logf(r); - z_r = expf(lnr * b.real - theta * b.imag); + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cosf(z_theta); - z.imag = z_r * sinf(z_theta); + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); return z; } #endif #endif +/* MemviewDtypeToObject */ + static CYTHON_INLINE PyObject *__pyx_memview_get_char(const char *itemp) { + return (PyObject *) __Pyx_PyInt_From_char(*(char *) itemp); +} +static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj) { + char value = __Pyx_PyInt_As_char(obj); + if (unlikely((value == (char)-1) && PyErr_Occurred())) + return 0; + *(char *) itemp = value; + return 1; +} + +/* FromPy */ + static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject* o) { + Py_complex cval; +#if !CYTHON_COMPILING_IN_PYPY + if (PyComplex_CheckExact(o)) + cval = ((PyComplexObject *)o)->cval; + else +#endif + cval = PyComplex_AsCComplex(o); + return __pyx_t_double_complex_from_parts( + (double)cval.real, + (double)cval.imag); +} + /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return ::std::complex< double >(x, y); + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); } #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; z.real = x; z.imag = y; return z; @@ -48202,90 +57922,90 @@ static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else - static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } #if 1 - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { if (b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); - } else if (fabs(b.real) >= fabs(b.imag)) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { if (b.real == 0 && b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { - double r = b.imag / b.real; - double s = (double)(1.0) / (b.real + b.imag * r); - return __pyx_t_double_complex_from_parts( + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { - double r = b.real / b.imag; - double s = (double)(1.0) / (b.imag + b.real * r); - return __pyx_t_double_complex_from_parts( + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } } #else - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { if (b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); } else { - double denom = b.real * b.real + b.imag * b.imag; - return __pyx_t_double_complex_from_parts( + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( (a.real * b.real + a.imag * b.imag) / denom, (a.imag * b.real - a.real * b.imag) / denom); } } #endif - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } - static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 - static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrt(z.real*z.real + z.imag*z.imag); + return sqrtf(z.real*z.real + z.imag*z.imag); #else - return hypot(z.real, z.imag); + return hypotf(z.real, z.imag); #endif } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double r, lnr, theta, z_r, z_theta; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { - double denom = a.real * a.real + a.imag * a.imag; + float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; @@ -48298,20 +58018,20 @@ static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj case 1: return a; case 2: - return __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_float(a, a); case 3: - z = __Pyx_c_prod_double(a, a); - return __Pyx_c_prod_double(z, a); + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); case 4: - z = __Pyx_c_prod_double(a, a); - return __Pyx_c_prod_double(z, z); + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } else if ((b.imag == 0) && (a.real >= 0)) { - z.real = pow(a.real, b.real); + z.real = powf(a.real, b.real); z.imag = 0; return z; } else if (a.real > 0) { @@ -48319,17 +58039,17 @@ static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj theta = 0; } else { r = -a.real; - theta = atan2(0.0, -1.0); + theta = atan2f(0.0, -1.0); } } else { - r = __Pyx_c_abs_double(a); - theta = atan2(a.imag, a.real); + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); } - lnr = log(r); - z_r = exp(lnr * b.real - theta * b.imag); + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cos(z_theta); - z.imag = z_r * sin(z_theta); + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); return z; } #endif @@ -48402,6 +58122,141 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return new_mvs; } +/* MemviewSliceInit */ + static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF(memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} +#ifndef Py_NO_RETURN +#define Py_NO_RETURN +#endif +static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -48415,7 +58270,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -48429,40 +58284,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -48475,109 +58335,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -48598,6 +58530,68 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (int) -1; } +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif + } +} + /* CIntFromPy */ static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -48611,7 +58605,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(npy_int32) < sizeof(long)) { + if ((sizeof(npy_int32) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(npy_int32, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -48625,40 +58619,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (npy_int32) 0; - case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, digits[0]) - case 2: - if (8 * sizeof(npy_int32) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(npy_int32) >= 2 * PyLong_SHIFT) { - return (npy_int32) (((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(npy_int32, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(npy_int32) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(npy_int32) >= 2 * PyLong_SHIFT)) { + return (npy_int32) (((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(npy_int32) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(npy_int32) >= 3 * PyLong_SHIFT) { - return (npy_int32) (((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])); + break; + case 3: + if ((8 * sizeof(npy_int32) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(npy_int32) >= 3 * PyLong_SHIFT)) { + return (npy_int32) (((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(npy_int32) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(npy_int32) >= 4 * PyLong_SHIFT) { - return (npy_int32) (((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])); + break; + case 4: + if ((8 * sizeof(npy_int32) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(npy_int32) >= 4 * PyLong_SHIFT)) { + return (npy_int32) (((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -48671,109 +58670,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(npy_int32) <= sizeof(unsigned long)) { + if ((sizeof(npy_int32) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(npy_int32, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(npy_int32) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(npy_int32) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(npy_int32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (npy_int32) 0; - case -1: __PYX_VERIFY_RETURN_INT(npy_int32, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, +digits[0]) - case -2: - if (8 * sizeof(npy_int32) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) { - return (npy_int32) (((npy_int32)-1)*(((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(npy_int32, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(npy_int32) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT)) { + return (npy_int32) (((npy_int32)-1)*(((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(npy_int32) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) { - return (npy_int32) ((((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + break; + case 2: + if ((8 * sizeof(npy_int32) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT)) { + return (npy_int32) ((((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) { - return (npy_int32) (((npy_int32)-1)*(((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + break; + case -3: + if ((8 * sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT)) { + return (npy_int32) (((npy_int32)-1)*(((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(npy_int32) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) { - return (npy_int32) ((((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + break; + case 3: + if ((8 * sizeof(npy_int32) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT)) { + return (npy_int32) ((((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) { - return (npy_int32) (((npy_int32)-1)*(((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + break; + case -4: + if ((8 * sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(npy_int32, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT)) { + return (npy_int32) (((npy_int32)-1)*(((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(npy_int32) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) { - return (npy_int32) ((((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + break; + case 4: + if ((8 * sizeof(npy_int32) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT)) { + return (npy_int32) ((((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(npy_int32) <= sizeof(long)) { + if ((sizeof(npy_int32) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(npy_int32, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(npy_int32) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(npy_int32) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(npy_int32, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else npy_int32 val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (npy_int32) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (npy_int32) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (npy_int32) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (npy_int32) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (npy_int32) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(npy_int32) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((npy_int32) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(npy_int32) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((npy_int32) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((npy_int32) 1) << (sizeof(npy_int32) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (npy_int32) -1; } } else { @@ -48794,44 +58865,6 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (npy_int32) -1; } -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -48865,8 +58898,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } @@ -48883,7 +58940,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(char) < sizeof(long)) { + if ((sizeof(char) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -48897,40 +58954,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { - return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { - return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { - return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -48943,109 +59005,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(char) <= sizeof(unsigned long)) { + if ((sizeof(char) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) - case -2: - if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(char) <= sizeof(long)) { + if ((sizeof(char) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (char) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (char) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (char) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (char) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (char) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (char) -1; } } else { @@ -49099,8 +59233,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(char), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(char)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } @@ -49117,7 +59275,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -49131,40 +59289,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -49177,109 +59340,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -49300,6 +59535,22 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (long) -1; } +/* FormatTypeName */ + #if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name_2); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__109); + } + return name; +} +#endif + /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[5]; @@ -49330,7 +59581,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, rtversion[i] = rt_from_call[i]; } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -49339,9 +59590,31 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + #if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -49349,23 +59622,11 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -49427,7 +59688,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -49456,22 +59717,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -49537,13 +59802,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -49611,4 +59874,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/newanalysis/helpers/helpers.pyx b/newanalysis/helpers/helpers.pyx index 7b83ec8..e85e9c4 100644 --- a/newanalysis/helpers/helpers.pyx +++ b/newanalysis/helpers/helpers.pyx @@ -903,7 +903,7 @@ def dipTen(np.ndarray[np.float64_t,ndim=1] rv, @cython.boundscheck(False) def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): - cdef int nwat = len(py_xyz)/3 # number of water molecules + cdef int nwat = len(py_xyz)//3 # number of water molecules cdef double *xyz = py_xyz.data cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 cdef double Exx = -2.3067236 # -2.0486*1.126 @@ -960,7 +960,7 @@ def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): T[7] = B[7]*Ezz T[8] = B[8]*Ezz - ind = (i/9)*6 + ind = (i//9)*6 # (B dot T) dot B.T dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B @@ -977,7 +977,7 @@ def NQRself(np.ndarray[np.float64_t,ndim=2] py_xyz): @cython.boundscheck(False) def waterRotationMatrix(double [:,:] coor): - cdef int nwat = len(coor)/3 # number of water molecules + cdef int nwat = len(coor)//3 # number of water molecules cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 cdef int i, k, ind cdef double [:,:,:] B_out = np.zeros((nwat,3,3)) # rotation matrix to return from parallel code @@ -1017,7 +1017,7 @@ def waterRotationMatrix(double [:,:] coor): B[1] = B[5]*B[6]-B[3]*B[8] B[2] = B[3]*B[7]-B[4]*B[6] - ind =i/3 + ind =i//3 B_out[ind,0,0] = B[0] B_out[ind,0,1] = B[1] @@ -1036,7 +1036,7 @@ def waterRotationMatrix(double [:,:] coor): @cython.boundscheck(False) def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): - cdef int nwat = len(py_xyz)/3 # number of water molecules + cdef int nwat = len(py_xyz)//3 # number of water molecules cdef double *xyz = py_xyz.data cdef double H1x,H1y,H1z,H2x,H2y,H2z,n2,n3 cdef double Exx = -2.3067236 # -2.0486*1.126 @@ -1100,7 +1100,7 @@ def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): T[7] = B[7]*Ezz T[8] = B[8]*Ezz - ind = (i/9)*6 + ind = (i//9)*6 # (B dot T) dot B.T dipt[ind] = T[0]*B[0]+T[3]*B[3]+T[6]*B[6] # 11 .... here B.T is taken directly from B @@ -1110,7 +1110,7 @@ def NQRselfAndB(np.ndarray[np.float64_t,ndim=2] py_xyz): dipt[ind+4] = T[2]*B[0]+T[5]*B[3]+T[8]*B[6] # 31 dipt[ind+5] = T[2]*B[1]+T[5]*B[4]+T[8]*B[7] # 32 .... matrix is symmetric - ind = (i/9)*3 + ind = (i//9)*3 B1[ind] = B[0] B1[ind+1] = B[1] @@ -1157,7 +1157,7 @@ def NQRdipTen(np.ndarray[np.float64_t,ndim=2] py_xyz, B = malloc(sizeof(double) * 9) T = malloc(sizeof(double) * 9) for i in prange(0,n,3): # dip-dip T for to all atoms on every other molecule - j = i/3 * 15 + j = i//3 * 15 for k in range(9): B[k] = 0.0 T[k] = 0.0 @@ -1166,7 +1166,7 @@ def NQRdipTen(np.ndarray[np.float64_t,ndim=2] py_xyz, y = xyz[i+1] z = xyz[i+2] r2 = x*x+y*y+z*z - f1 = pow(r2,-1.5) * charges[i/3] + f1 = pow(r2,-1.5) * charges[i//3] f2 = 3.0 * f1 / r2 f2_x = f2 * x f2_y = f2 * y @@ -1219,7 +1219,7 @@ def NQRdipTen(np.ndarray[np.float64_t,ndim=2] py_xyz, free(B) free(T) - for i in range(1,n/3): + for i in range(1,n//3): for j in range(15): dipt[j] += dipt[i*15+j] @@ -1548,9 +1548,9 @@ def findNearestAtom(double [:,:] coor_core, double [:,:] coor_surr, double [:] m @cython.boundscheck(False) def checkHBond(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist): # this function is designed only for water hydrogen bonds! - cdef int sites_per_res = coor_surr.shape[0] / nres_surr - cdef int nsurr = coor_surr.shape[0] / sites_per_res - cdef int nwat = coor_oh2.shape[0] / 3 + cdef int sites_per_res = coor_surr.shape[0] // nres_surr + cdef int nsurr = coor_surr.shape[0] // sites_per_res + cdef int nwat = coor_oh2.shape[0] // 3 cdef int i, j, k, l, idx, idx2, idx3 cdef char [:] hbond = np.zeros(nwat, dtype=np.int8) diff --git a/newanalysis/helpers/miscellaneous.cpp b/newanalysis/helpers/miscellaneous.cpp index 10aace2..8e3b069 100644 --- a/newanalysis/helpers/miscellaneous.cpp +++ b/newanalysis/helpers/miscellaneous.cpp @@ -1,22 +1,71 @@ -/* Generated by Cython 0.29.34 */ +/* Generated by Cython 3.0.2 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayscalars.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ufuncobject.h", + "newanalysis/helpers/miscellaneous_implementation.h" + ], + "extra_compile_args": [ + "-fopenmp" + ], + "extra_link_args": [ + "-fopenmp" + ], + "include_dirs": [ + "newanalysis/helpers", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include" + ], + "language": "c++", + "name": "newanalysis.miscellaneous", + "sources": [ + "newanalysis/helpers/miscellaneous.pyx", + "newanalysis/helpers/miscellaneous_implementation.cpp" + ] + }, + "module_name": "newanalysis.miscellaneous" +} +END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. +#else +#if CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" #else -#define CYTHON_ABI "0_29_34" -#define CYTHON_HEX_VERSION 0x001D22F0 -#define CYTHON_FUTURE_DIVISION 0 +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_2" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030002F0 +#define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -35,9 +84,7 @@ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -45,13 +92,19 @@ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -76,10 +129,19 @@ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS @@ -89,44 +151,121 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK @@ -136,8 +275,9 @@ #endif #elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 @@ -181,16 +321,17 @@ #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -199,11 +340,8 @@ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5) + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 @@ -226,29 +364,47 @@ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) + #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) #endif - #if PY_VERSION_HEX >= 0x030B00A4 + #if PY_VERSION_HEX < 0x030700A3 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 @@ -257,6 +413,10 @@ #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -285,6 +445,17 @@ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -298,13 +469,16 @@ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -312,28 +486,59 @@ # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -343,13 +548,26 @@ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." @@ -373,91 +591,151 @@ class __Pyx_FakeReference { T *operator->() { return ptr; } T *operator&() { return ptr; } operator T&() { return *ptr; } - template bool operator ==(U other) { return *ptr == other; } - template bool operator !=(U other) { return *ptr != other; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } private: T *ptr; }; -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + PyObject *version_info; // borrowed + PyObject *py_minor_version = NULL; + long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; - } - end: - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(call_result); - Py_XDECREF(empty); + #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 + minor_version = 11; // we don't yet need to distinguish between versions > 11 + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + Py_XDECREF(py_minor_version); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here + if (!empty_bytes) return NULL; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -471,6 +749,12 @@ class __Pyx_FakeReference { #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -485,30 +769,53 @@ class __Pyx_FakeReference { #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -517,6 +824,22 @@ class __Pyx_FakeReference { #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -547,6 +870,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -559,12 +904,69 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) +#else + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) @@ -575,10 +977,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else @@ -596,11 +998,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -611,14 +1013,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -647,8 +1055,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -658,15 +1072,33 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif #if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -678,6 +1110,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -695,11 +1130,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -744,12 +1174,17 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" #endif #define __PYX_HAVE__newanalysis__miscellaneous @@ -757,19 +1192,18 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + #include "numpy/arrayobject.h" #include "numpy/ndarrayobject.h" #include "numpy/ndarraytypes.h" #include "numpy/arrayscalars.h" #include "numpy/ufuncobject.h" - - /* NumPy API declarations from "numpy/__init__.pxd" */ - #include #include "miscellaneous_implementation.h" #include "pythread.h" #include -#include "pystate.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -838,9 +1272,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -848,11 +1282,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -878,7 +1323,52 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -900,7 +1390,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -965,23 +1455,19 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; /* Header.proto */ #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__)) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 @@ -999,13 +1485,20 @@ static const char *__pyx_filename; #define _Complex_I 1.0fj #endif +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { - "src/helpers/miscellaneous.pyx", - "__init__.pxd", - "stringsource", + "newanalysis/helpers/miscellaneous.pyx", + "", + "__init__.cython-30.pxd", "type.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + /* NoFastGil.proto */ #define __Pyx_PyGILState_Ensure PyGILState_Ensure #define __Pyx_PyGILState_Release PyGILState_Release @@ -1013,21 +1506,40 @@ static const char *__pyx_f[] = { #define __Pyx_FastGIL_Forget() #define __Pyx_FastGilFuncInit() -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif - -/* MemviewSliceStruct.proto */ -struct __pyx_memoryview_obj; +/* BufferFormatStructs.proto */ +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { - struct __pyx_memoryview_obj *memview; - char *data; - Py_ssize_t shape[8]; - Py_ssize_t strides[8]; - Py_ssize_t suboffsets[8]; -} __Pyx_memviewslice; -#define __Pyx_MemoryView_Len(m) (m.shape[0]) + const char* name; + struct __Pyx_StructField_* fields; + size_t size; + size_t arraysize[8]; + int ndim; + char typegroup; + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; /* Atomics.proto */ #include @@ -1036,7 +1548,44 @@ typedef struct { #endif #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS #define __pyx_atomic_int_type int -#if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_incr_aligned(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_incr_aligned(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1) @@ -1044,10 +1593,11 @@ typedef struct { #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif -#elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL +#elif CYTHON_ATOMICS && defined(_MSC_VER) #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type long + #define __pyx_nonatomic_int_type long #pragma intrinsic (_InterlockedExchangeAdd) #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1) @@ -1061,7 +1611,6 @@ typedef struct { #warning "Not using atomics" #endif #endif -typedef volatile __pyx_atomic_int_type __pyx_atomic_int; #if CYTHON_ATOMICS #define __pyx_add_acquisition_count(memview)\ __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview)) @@ -1074,44 +1623,20 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) #endif -/* BufferFormatStructs.proto */ -#define IS_UNSIGNED(type) (((type) -1) > 0) -struct __Pyx_StructField_; -#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) -typedef struct { - const char* name; - struct __Pyx_StructField_* fields; - size_t size; - size_t arraysize[8]; - int ndim; - char typegroup; - char is_unsigned; - int flags; -} __Pyx_TypeInfo; -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - size_t new_count, enc_count; - size_t struct_alignment; - int is_complex; - char enc_type; - char new_packmode; - char enc_packmode; - char is_valid_array; -} __Pyx_BufFmt_Context; + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +/* #### Code section: numeric_typedefs ### */ -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":689 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":730 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -1120,7 +1645,7 @@ typedef struct { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":690 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":731 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -1129,7 +1654,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":691 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":732 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -1138,7 +1663,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":692 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":733 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -1147,7 +1672,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":696 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":737 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -1156,7 +1681,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":697 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":738 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -1165,7 +1690,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":698 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":739 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -1174,7 +1699,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":699 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":740 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -1183,7 +1708,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":703 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":744 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -1192,7 +1717,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":704 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":745 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -1201,61 +1726,43 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":713 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":754 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t + * */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":714 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":755 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":715 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":717 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":757 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t + * */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":718 - * - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":758 * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":719 * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":721 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":760 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1264,7 +1771,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":722 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":761 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1273,7 +1780,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":724 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":763 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1282,7 +1789,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":725 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":764 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1291,7 +1798,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":726 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":765 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1299,30 +1806,32 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* #### Code section: complex_type_declarations ### */ /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus - typedef ::std::complex< float > __pyx_t_float_complex; + typedef ::std::complex< double > __pyx_t_double_complex; #else - typedef float _Complex __pyx_t_float_complex; + typedef double _Complex __pyx_t_double_complex; #endif #else - typedef struct { float real, imag; } __pyx_t_float_complex; + typedef struct { double real, imag; } __pyx_t_double_complex; #endif -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus - typedef ::std::complex< double > __pyx_t_double_complex; + typedef ::std::complex< float > __pyx_t_float_complex; #else - typedef double _Complex __pyx_t_double_complex; + typedef float _Complex __pyx_t_float_complex; #endif #else - typedef struct { double real, imag; } __pyx_t_double_complex; + typedef struct { float real, imag; } __pyx_t_float_complex; #endif -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_array_obj; @@ -1330,7 +1839,7 @@ struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":728 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":767 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1339,7 +1848,7 @@ struct __pyx_memoryviewslice_obj; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":729 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":768 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1348,7 +1857,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":730 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":769 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1357,7 +1866,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":732 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":771 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1366,8 +1875,8 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1391,7 +1900,7 @@ struct __pyx_array_obj { }; -/* "View.MemoryView":280 +/* "View.MemoryView":302 * * @cname('__pyx_MemviewEnum') * cdef class Enum(object): # <<<<<<<<<<<<<< @@ -1404,10 +1913,10 @@ struct __pyx_MemviewEnum_obj { }; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1418,8 +1927,7 @@ struct __pyx_memoryview_obj { PyObject *_size; PyObject *_array_interface; PyThread_type_lock lock; - __pyx_atomic_int acquisition_count[2]; - __pyx_atomic_int *acquisition_count_aligned_p; + __pyx_atomic_int_type acquisition_count; Py_buffer view; int flags; int dtype_is_object; @@ -1427,8 +1935,8 @@ struct __pyx_memoryview_obj { }; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1444,8 +1952,8 @@ struct __pyx_memoryviewslice_obj { -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1458,10 +1966,10 @@ struct __pyx_vtabstruct_array { static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1474,12 +1982,13 @@ struct __pyx_vtabstruct_memoryview { PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); }; static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1490,6 +1999,7 @@ struct __pyx_vtabstruct__memoryviewslice { struct __pyx_vtabstruct_memoryview __pyx_base; }; static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1498,11 +2008,11 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1512,28 +2022,40 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1544,6 +2066,10 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1555,98 +2081,30 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* DivInt[Py_ssize_t].proto */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); - -/* UnaryNegOverflows.proto */ -#define UNARY_NEG_WOULD_OVERFLOW(x)\ - (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) - -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) do {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() #endif /* PyErrFetchRestore.proto */ @@ -1658,7 +2116,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) @@ -1674,118 +2132,206 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#else + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) +#endif +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) + #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) +#else + #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op + #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs + #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS + #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) + #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) #else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) #endif +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, + const char* function_name); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif -#if CYTHON_FAST_PYCALL - static size_t __pyx_pyframe_localsplus_offset = 0; +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL +#endif +#endif #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* MemviewSliceInit.proto */ -#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d -#define __Pyx_MEMVIEW_DIRECT 1 -#define __Pyx_MEMVIEW_PTR 2 -#define __Pyx_MEMVIEW_FULL 4 -#define __Pyx_MEMVIEW_CONTIG 8 -#define __Pyx_MEMVIEW_STRIDED 16 -#define __Pyx_MEMVIEW_FOLLOW 32 -#define __Pyx_IS_C_CONTIG 1 -#define __Pyx_IS_F_CONTIG 2 -static int __Pyx_init_memviewslice( - struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference); -static CYTHON_INLINE int __pyx_add_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p) -#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview)) -#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) -#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__) -static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); -/* BufferIndexError.proto */ -static void __Pyx_RaiseBufferIndexError(int axis); +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); -/* PyObjectSetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); -#else -#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) -#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC #endif -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +/* BuildPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char); + +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); + +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); + +/* JoinPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); + +/* StrEquals.proto */ +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals #else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals #endif -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +/* PyObjectFormatSimple.proto */ +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#elif PY_MAJOR_VERSION < 3 + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\ + PyObject_Format(s, f)) +#elif CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ + likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ + PyObject_Format(s, f)) #else -#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) #endif -/* SetItemInt.proto */ -#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) -static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, - int is_list, int wraparound, int boundscheck); +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ @@ -1809,43 +2355,121 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ } +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); #else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif -/* PyObjectGetMethod.proto */ -static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif -/* PyObjectCallMethod1.proto */ -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (1) +#elif CYTHON_COMPILING_IN_LIMITED_API || (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000) + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif -/* append.proto */ -static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -/* DivInt[long].proto */ -static CYTHON_INLINE long __Pyx_div_long(long, long); +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -/* DivInt[int].proto */ -static CYTHON_INLINE int __Pyx_div_int(int, int); +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -/* PyIntCompare.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif @@ -1860,14 +2484,6 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) @@ -1876,78 +2492,6 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); - -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ -/* GetAttr.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); - -/* ObjectGetItem.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); -#else -#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) -#endif - -/* decode_c_string_utf16.proto */ -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 0; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = -1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} - -/* decode_c_string.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); - -/* GetAttr3.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) @@ -1959,20 +2503,33 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* ssize_strlen.proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); + /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { @@ -1990,22 +2547,26 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); -/* None.proto */ +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck); + +/* RaiseUnboundLocalError.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); +/* DivInt[long].proto */ +static CYTHON_INLINE long __Pyx_div_long(long, long); + /* PySequenceContains.proto */ static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { int result = PySequence_Contains(seq, item); @@ -2018,67 +2579,220 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* HasAttr.proto */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); -/* PyObject_GenericGetAttrNoDict.proto */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); +/* BufferIndexError.proto */ +static void __Pyx_RaiseBufferIndexError(int axis); + +/* PyObjectSetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); #else -#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr +#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) #endif -/* PyObject_GenericGetAttr.proto */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); +/* PyIntBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); #else -#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr +#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) #endif -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); - -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); - -/* SetupReduce.proto */ -static int __Pyx_setup_reduce(PyObject* type_obj); +/* PyIntBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) +#endif + +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +/* PyObjectCall2Args.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod1.proto */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +/* append.proto */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); + +/* PyIntFromDouble.proto */ +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value); +#else +#define __Pyx_PyInt_FromDouble(value) PyLong_FromDouble(value) +#endif + +/* PyIntCompare.proto */ +static CYTHON_INLINE int __Pyx_PyInt_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* PyObject_GenericGetAttrNoDict.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr +#endif + +/* PyObject_GenericGetAttr.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr +#endif + +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type); +#endif + +/* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce(PyObject* type_obj); +#endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -#if __STDC_VERSION__ >= 201112L +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_2 +#define __PYX_HAVE_RT_ImportType_proto_3_0_2 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif -#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT(s) alignof(s) +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +enum __Pyx_ImportType_CheckSize_3_0_2 { + __Pyx_ImportType_CheckSize_Error_3_0_2 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_2 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_2 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size); #endif +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + /* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + typesModule = PyImport_ImportModule("types"); + if (!typesModule) return NULL; + methodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + if (!methodType) return NULL; + result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); + Py_DECREF(methodType); + return result; +} +#elif PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif /* CythonFunctionShared.proto */ -#define __Pyx_CyFunction_USED 1 +#define __Pyx_CyFunction_USED #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 PyCFunctionObject func; -#if PY_VERSION_HEX < 0x030500A0 +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_weakreflist; #endif PyObject *func_dict; @@ -2088,7 +2802,9 @@ typedef struct { PyObject *func_globals; PyObject *func_code; PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_classobj; +#endif void *defaults; int defaults_pyobjects; size_t defaults_size; // used by FusedFunction for copying defaults @@ -2097,14 +2813,17 @@ typedef struct { PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; + PyObject *func_is_coroutine; } __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *self, + PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, size_t size, int pyobjects); @@ -2114,7 +2833,18 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); -static int __pyx_CyFunction_init(void); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif /* CythonFunction.proto */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, @@ -2137,6 +2867,16 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); +/* PyObjectLookupSpecial.proto */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0) +#define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1) +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error); +#else +#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n) +#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) +#endif + /* Py3ClassCreate.proto */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc); @@ -2151,6 +2891,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -2164,6 +2905,7 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -2200,14 +2942,6 @@ static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, __Pyx_memviewslice *slice2, int ndim, size_t itemsize); -/* Capsule.proto */ -static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); - -/* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - /* IsLittleEndian.proto */ static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); @@ -2263,13 +2997,6 @@ static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp); static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj); -/* Print.proto */ -static int __Pyx_Print(PyObject*, PyObject *, int); -#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 -static PyObject* __pyx_print = 0; -static PyObject* __pyx_print_kwargs = 0; -#endif - /* RealImag.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -2293,45 +3020,7 @@ static PyObject* __pyx_print_kwargs = 0; #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX - #define __Pyx_c_eq_float(a, b) ((a)==(b)) - #define __Pyx_c_sum_float(a, b) ((a)+(b)) - #define __Pyx_c_diff_float(a, b) ((a)-(b)) - #define __Pyx_c_prod_float(a, b) ((a)*(b)) - #define __Pyx_c_quot_float(a, b) ((a)/(b)) - #define __Pyx_c_neg_float(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zero_float(z) ((z)==(float)0) - #define __Pyx_c_conj_float(z) (::std::conj(z)) - #if 1 - #define __Pyx_c_abs_float(z) (::std::abs(z)) - #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) - #endif - #else - #define __Pyx_c_is_zero_float(z) ((z)==0) - #define __Pyx_c_conj_float(z) (conjf(z)) - #if 1 - #define __Pyx_c_abs_float(z) (cabsf(z)) - #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) - #endif - #endif -#else - static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); - #if 1 - static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); - #endif -#endif - -/* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_double(a, b) ((a)==(b)) #define __Pyx_c_sum_double(a, b) ((a)+(b)) #define __Pyx_c_diff_double(a, b) ((a)-(b)) @@ -2368,6 +3057,44 @@ static PyObject* __pyx_print_kwargs = 0; #endif #endif +/* Arithmetic.proto */ +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) + #define __Pyx_c_eq_float(a, b) ((a)==(b)) + #define __Pyx_c_sum_float(a, b) ((a)+(b)) + #define __Pyx_c_diff_float(a, b) ((a)-(b)) + #define __Pyx_c_prod_float(a, b) ((a)*(b)) + #define __Pyx_c_quot_float(a, b) ((a)/(b)) + #define __Pyx_c_neg_float(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero_float(z) ((z)==(float)0) + #define __Pyx_c_conj_float(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs_float(z) (::std::abs(z)) + #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero_float(z) ((z)==0) + #define __Pyx_c_conj_float(z) (conjf(z)) + #if 1 + #define __Pyx_c_abs_float(z) (cabsf(z)) + #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + /* MemviewSliceCopyTemplate.proto */ static __Pyx_memviewslice __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, @@ -2375,30 +3102,69 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, size_t sizeof_dtype, int contig_flag, int dtype_is_object); -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); +/* MemviewSliceInit.proto */ +#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); /* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); + /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); -/* PrintOne.proto */ -static int __Pyx_PrintOne(PyObject* stream, PyObject *o); +/* None.proto */ +#include /* CIntFromPy.proto */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ @@ -2407,58 +3173,46 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ -/* Module declarations from 'cpython.buffer' */ - -/* Module declarations from 'libc.string' */ +/* Module declarations from "libc.string" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "libc.stdio" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "cpython.type" */ -/* Module declarations from 'cpython' */ +/* Module declarations from "cpython" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.object" */ -/* Module declarations from 'cpython.ref' */ +/* Module declarations from "cpython.ref" */ -/* Module declarations from 'cpython.mem' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'numpy' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_generic = 0; -static PyTypeObject *__pyx_ptype_5numpy_number = 0; -static PyTypeObject *__pyx_ptype_5numpy_integer = 0; -static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_inexact = 0; -static PyTypeObject *__pyx_ptype_5numpy_floating = 0; -static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0; -static PyTypeObject *__pyx_ptype_5numpy_flexible = 0; -static PyTypeObject *__pyx_ptype_5numpy_character = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +/* Module declarations from "cython.view" */ -/* Module declarations from 'cython.view' */ +/* Module declarations from "cython.dataclasses" */ -/* Module declarations from 'cython' */ +/* Module declarations from "cython" */ -/* Module declarations from 'libc.math' */ +/* Module declarations from "libc.math" */ -/* Module declarations from 'newanalysis.miscellaneous' */ -static PyTypeObject *__pyx_array_type = 0; -static PyTypeObject *__pyx_MemviewEnum_type = 0; -static PyTypeObject *__pyx_memoryview_type = 0; -static PyTypeObject *__pyx_memoryviewslice_type = 0; +/* Module declarations from "newanalysis.miscellaneous" */ +static PyObject *__pyx_collections_abc_Sequence = 0; static PyObject *generic = 0; static PyObject *strided = 0; static PyObject *indirect = 0; @@ -2466,12 +3220,12 @@ static PyObject *contiguous = 0; static PyObject *indirect_contiguous = 0; static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ -static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ static PyObject *_unellipsify(PyObject *, int); /*proto*/ -static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ @@ -2489,8 +3243,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /* static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ -static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/ -static int __pyx_memoryview_err(PyObject *, char *); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ @@ -2499,23 +3254,31 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_char = { "char", NULL, sizeof(char), { 0 }, 0, 'H', IS_UNSIGNED(char), 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_char = { "char", NULL, sizeof(char), { 0 }, 0, 'H', __PYX_IS_UNSIGNED(char), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, __PYX_IS_UNSIGNED(int) ? 'U' : 'I', __PYX_IS_UNSIGNED(int), 0 }; +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "newanalysis.miscellaneous" extern int __pyx_module_is_main_newanalysis__miscellaneous; int __pyx_module_is_main_newanalysis__miscellaneous = 0; -/* Implementation of 'newanalysis.miscellaneous' */ +/* Implementation of "newanalysis.miscellaneous" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_ImportError; +static PyObject *__pyx_builtin_print; +static PyObject *__pyx_builtin___import__; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_AssertionError; static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_ImportError; +/* #### Code section: string_decls ### */ +static const char __pyx_k_[] = ": "; static const char __pyx_k_D[] = "D"; static const char __pyx_k_O[] = "O"; static const char __pyx_k_a[] = "a"; @@ -2529,6 +3292,10 @@ static const char __pyx_k_n[] = "n"; static const char __pyx_k_p[] = "p"; static const char __pyx_k_w[] = "w"; static const char __pyx_k_x[] = "x"; +static const char __pyx_k__2[] = "."; +static const char __pyx_k__3[] = "*"; +static const char __pyx_k__6[] = "'"; +static const char __pyx_k__7[] = ")"; static const char __pyx_k_cl[] = "cl"; static const char __pyx_k_ds[] = "ds"; static const char __pyx_k_dt[] = "dt"; @@ -2537,6 +3304,7 @@ static const char __pyx_k_dy[] = "dy"; static const char __pyx_k_dz[] = "dz"; static const char __pyx_k_f1[] = "f1"; static const char __pyx_k_f2[] = "f2"; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_np[] = "np"; static const char __pyx_k_p1[] = "p1"; @@ -2553,6 +3321,8 @@ static const char __pyx_k_t6[] = "t6"; static const char __pyx_k_D_x[] = "D_x"; static const char __pyx_k_D_y[] = "D_y"; static const char __pyx_k_D_z[] = "D_z"; +static const char __pyx_k_abc[] = "abc"; +static const char __pyx_k_and[] = " and "; static const char __pyx_k_bin[] = "bin"; static const char __pyx_k_ctr[] = "ctr"; static const char __pyx_k_dip[] = "dip"; @@ -2566,11 +3336,12 @@ static const char __pyx_k_ds5[] = "ds5"; static const char __pyx_k_dx2[] = "dx2"; static const char __pyx_k_dy2[] = "dy2"; static const char __pyx_k_dz2[] = "dz2"; -static const char __pyx_k_end[] = "end"; static const char __pyx_k_f2c[] = "f2c"; +static const char __pyx_k_got[] = " (got "; static const char __pyx_k_idx[] = "idx"; +static const char __pyx_k_int[] = "int"; static const char __pyx_k_mol[] = "mol"; -static const char __pyx_k_new[] = "new"; +static const char __pyx_k_new[] = "__new__"; static const char __pyx_k_obj[] = "obj"; static const char __pyx_k_p1l[] = "p1l"; static const char __pyx_k_p2l[] = "p2l"; @@ -2578,8 +3349,10 @@ static const char __pyx_k_r_0[] = "r_0"; static const char __pyx_k_ref[] = "ref"; static const char __pyx_k_res[] = "res"; static const char __pyx_k_run[] = "run"; +static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_vec[] = "vec"; static const char __pyx_k_wat[] = "wat"; +static const char __pyx_k__155[] = "?"; static const char __pyx_k_atom[] = "atom"; static const char __pyx_k_base[] = "base"; static const char __pyx_k_bin1[] = "bin1"; @@ -2596,7 +3369,6 @@ static const char __pyx_k_dict[] = "__dict__"; static const char __pyx_k_dipt[] = "dipt"; static const char __pyx_k_dist[] = "dist"; static const char __pyx_k_dot2[] = "dot2"; -static const char __pyx_k_file[] = "file"; static const char __pyx_k_idx2[] = "idx2"; static const char __pyx_k_idx3[] = "idx3"; static const char __pyx_k_init[] = "__init__"; @@ -2617,6 +3389,7 @@ static const char __pyx_k_self[] = "self"; static const char __pyx_k_sign[] = "sign"; static const char __pyx_k_size[] = "size"; static const char __pyx_k_sort[] = "sort"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_sqrt[] = "sqrt"; static const char __pyx_k_step[] = "step"; static const char __pyx_k_stop[] = "stop"; @@ -2640,7 +3413,7 @@ static const char __pyx_k_hbond[] = "hbond"; static const char __pyx_k_index[] = "index"; static const char __pyx_k_int32[] = "int32"; static const char __pyx_k_maxdt[] = "maxdt"; -static const char __pyx_k_new_2[] = "__new__"; +static const char __pyx_k_new_2[] = "new"; static const char __pyx_k_nsurr[] = "nsurr"; static const char __pyx_k_numpy[] = "numpy"; static const char __pyx_k_order[] = "order"; @@ -2651,6 +3424,7 @@ static const char __pyx_k_rotTs[] = "rotTs"; static const char __pyx_k_shape[] = "shape"; static const char __pyx_k_shell[] = "shell"; static const char __pyx_k_start[] = "start"; +static const char __pyx_k_super[] = "super"; static const char __pyx_k_zeros[] = "zeros"; static const char __pyx_k_append[] = "append"; static const char __pyx_k_coor_i[] = "coor_i"; @@ -2664,6 +3438,7 @@ static const char __pyx_k_dist_2[] = "dist_2"; static const char __pyx_k_dist_3[] = "dist_3"; static const char __pyx_k_ds_idx[] = "ds_idx"; static const char __pyx_k_emim_h[] = "emim_h"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_import[] = "__import__"; @@ -2676,6 +3451,7 @@ static const char __pyx_k_point1[] = "point1"; static const char __pyx_k_point2[] = "point2"; static const char __pyx_k_reduce[] = "__reduce__"; static const char __pyx_k_result[] = "result"; +static const char __pyx_k_return[] = "return"; static const char __pyx_k_shell1[] = "shell1"; static const char __pyx_k_shell2[] = "shell2"; static const char __pyx_k_shell3[] = "shell3"; @@ -2694,6 +3470,7 @@ static const char __pyx_k_dataset[] = "dataset"; static const char __pyx_k_dip_res[] = "dip_res"; static const char __pyx_k_dip_wat[] = "dip_wat"; static const char __pyx_k_dipoles[] = "dipoles"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_dist_sq[] = "dist_sq"; static const char __pyx_k_distvec[] = "distvec"; static const char __pyx_k_ds1_idx[] = "ds1_idx"; @@ -2715,6 +3492,7 @@ static const char __pyx_k_selfobj[] = "selfobj"; static const char __pyx_k_shelldt[] = "shelldt"; static const char __pyx_k_vel_ind[] = "vel_ind"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; +static const char __pyx_k_Sequence[] = "Sequence"; static const char __pyx_k_apr_pair[] = "apr_pair"; static const char __pyx_k_aufpunkt[] = "aufpunkt"; static const char __pyx_k_bin_dist[] = "bin_dist"; @@ -2741,8 +3519,10 @@ static const char __pyx_k_pairlist[] = "pairlist"; static const char __pyx_k_particle[] = "particle"; static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_qualname[] = "__qualname__"; +static const char __pyx_k_register[] = "register"; static const char __pyx_k_selfcorr[] = "selfcorr"; static const char __pyx_k_selflist[] = "selflist"; +static const char __pyx_k_set_name[] = "__set_name__"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_shell_01[] = "shell_01"; static const char __pyx_k_shell_02[] = "shell_02"; @@ -2766,6 +3546,7 @@ static const char __pyx_k_enumerate[] = "enumerate"; static const char __pyx_k_histo_max[] = "histo_max"; static const char __pyx_k_histo_min[] = "histo_min"; static const char __pyx_k_histogram[] = "histogram"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_kronecker[] = "kronecker"; static const char __pyx_k_maxshell1[] = "maxshell1"; static const char __pyx_k_maxshell2[] = "maxshell2"; @@ -2801,6 +3582,7 @@ static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_PickleError[] = "PickleError"; static const char __pyx_k_cardinality[] = "cardinality"; +static const char __pyx_k_collections[] = "collections"; static const char __pyx_k_countHBonds[] = "countHBonds"; static const char __pyx_k_dip_outside[] = "dip_outside"; static const char __pyx_k_dipt_0_self[] = "dipt_0_self"; @@ -2815,6 +3597,8 @@ static const char __pyx_k_atomicIndDip[] = "atomicIndDip"; static const char __pyx_k_deriveIndDip[] = "deriveIndDip"; static const char __pyx_k_getBestIndex[] = "getBestIndex"; static const char __pyx_k_getBondTable[] = "getBondTable"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; static const char __pyx_k_max_distance[] = "max_distance"; static const char __pyx_k_n_iterations[] = "n_iterations"; static const char __pyx_k_n_particles1[] = "n_particles1"; @@ -2824,13 +3608,16 @@ static const char __pyx_k_pair_1_par_2[] = "pair_1_par_2"; static const char __pyx_k_pair_2_par_1[] = "pair_2_par_1"; static const char __pyx_k_pair_2_par_2[] = "pair_2_par_2"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; -static const char __pyx_k_stringsource[] = "stringsource"; +static const char __pyx_k_stringsource[] = ""; static const char __pyx_k_sumUpByShell[] = "sumUpByShell"; +static const char __pyx_k_version_info[] = "version_info"; +static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_closest_shell[] = "closest_shell"; static const char __pyx_k_coor_surround[] = "coor_surround"; -static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; +static const char __pyx_k_init_subclass[] = "__init_subclass__"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_sites_per_res[] = "sites_per_res"; +static const char __pyx_k_AssertionError[] = "AssertionError"; static const char __pyx_k_atomic_dipoles[] = "atomic_dipoles"; static const char __pyx_k_aufpunkt_dipol[] = "aufpunkt_dipol"; static const char __pyx_k_delauny_matrix[] = "delauny_matrix"; @@ -2844,6 +3631,7 @@ static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; static const char __pyx_k_aufpunkt_dipole[] = "aufpunkt_dipole"; static const char __pyx_k_both_directions[] = "both_directions"; +static const char __pyx_k_collections_abc[] = "collections.abc"; static const char __pyx_k_countMultiShell[] = "countMultiShell"; static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; static const char __pyx_k_n_ind_particles[] = "n_ind_particles"; @@ -2872,6 +3660,7 @@ static const char __pyx_k_number_of_shells2[] = "number_of_shells2"; static const char __pyx_k_pairobject___init[] = "pairobject.__init__"; static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; static const char __pyx_k_selfobject___init[] = "selfobject.__init__"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_correlation_length[] = "correlation_length"; static const char __pyx_k_minDistTesselation[] = "minDistTesselation"; @@ -2892,10 +3681,12 @@ static const char __pyx_k_number_of_datapoints[] = "number_of_datapoints"; static const char __pyx_k_strided_and_indirect[] = ""; static const char __pyx_k_sumMultiMDCageSingle[] = "sumMultiMDCageSingle"; static const char __pyx_k_timeseries_shellwise[] = "timeseries_shellwise"; +static const char __pyx_k_Invalid_shape_in_axis[] = "Invalid shape in axis "; static const char __pyx_k_contiguous_and_direct[] = ""; static const char __pyx_k_correlateSingleVector[] = "correlateSingleVector"; static const char __pyx_k_structureFactorCharge[] = "structureFactorCharge"; static const char __pyx_k_structureFactorDipTen[] = "structureFactorDipTen"; +static const char __pyx_k_Cannot_index_with_type[] = "Cannot index with type '"; static const char __pyx_k_MemoryView_of_r_object[] = ""; static const char __pyx_k_derived_atomic_dipoles[] = "derived_atomic_dipoles"; static const char __pyx_k_multiVecShellCorrelate[] = "multiVecShellCorrelate"; @@ -2905,43 +3696,45 @@ static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_n_s_ASCII); + Py_CLEAR(clear_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_CLEAR(clear_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_CLEAR(clear_module_state->__pyx_kp_s_Correlation_length_must_not_be_l); + Py_CLEAR(clear_module_state->__pyx_n_s_D); + Py_CLEAR(clear_module_state->__pyx_n_s_D_x); + Py_CLEAR(clear_module_state->__pyx_n_s_D_y); + Py_CLEAR(clear_module_state->__pyx_n_s_D_z); + Py_CLEAR(clear_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_CLEAR(clear_module_state->__pyx_n_s_Ellipsis); + Py_CLEAR(clear_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_CLEAR(clear_module_state->__pyx_n_s_ImportError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_CLEAR(clear_module_state->__pyx_n_s_IndexError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_CLEAR(clear_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_CLEAR(clear_module_state->__pyx_kp_s_Number_of_starting_points_too_hi); + Py_CLEAR(clear_module_state->__pyx_n_b_O); + Py_CLEAR(clear_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_Sequence); + Py_CLEAR(clear_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); + Py_CLEAR(clear_module_state->__pyx_n_s_View_MemoryView); + Py_CLEAR(clear_module_state->__pyx_kp_s_Warning_number_of_frames_correla); + Py_CLEAR(clear_module_state->__pyx_n_s__155); + Py_CLEAR(clear_module_state->__pyx_kp_u__2); + Py_CLEAR(clear_module_state->__pyx_n_s__3); + Py_CLEAR(clear_module_state->__pyx_kp_u__6); + Py_CLEAR(clear_module_state->__pyx_kp_u__7); + Py_CLEAR(clear_module_state->__pyx_n_s_a); + Py_CLEAR(clear_module_state->__pyx_n_s_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_accumulateNMShellwiseGFunction); + Py_CLEAR(clear_module_state->__pyx_n_s_accumulateShellwiseGFunction); + Py_CLEAR(clear_module_state->__pyx_n_s_allocate_buffer); + Py_CLEAR(clear_module_state->__pyx_n_s_alpha); + Py_CLEAR(clear_module_state->__pyx_kp_u_and); + Py_CLEAR(clear_module_state->__pyx_n_s_antagonist); + Py_CLEAR(clear_module_state->__pyx_n_s_append); + Py_CLEAR(clear_module_state->__pyx_n_s_apr_emim_h); + Py_CLEAR(clear_module_state->__pyx_n_s_apr_pair); + Py_CLEAR(clear_module_state->__pyx_n_s_asarray); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_atom); + Py_CLEAR(clear_module_state->__pyx_n_s_atomicIndDip); + Py_CLEAR(clear_module_state->__pyx_n_s_atomicIndDipPerAtom); + Py_CLEAR(clear_module_state->__pyx_n_s_atomic_dipoles); + Py_CLEAR(clear_module_state->__pyx_n_s_aufpunkt); + Py_CLEAR(clear_module_state->__pyx_n_s_aufpunkt_dipol); + Py_CLEAR(clear_module_state->__pyx_n_s_aufpunkt_dipole); + Py_CLEAR(clear_module_state->__pyx_n_s_aufpunkte); + Py_CLEAR(clear_module_state->__pyx_n_s_b); + Py_CLEAR(clear_module_state->__pyx_n_s_base); + Py_CLEAR(clear_module_state->__pyx_n_s_best_index); + Py_CLEAR(clear_module_state->__pyx_n_s_bin); + Py_CLEAR(clear_module_state->__pyx_n_s_bin1); + Py_CLEAR(clear_module_state->__pyx_n_s_bin2); + Py_CLEAR(clear_module_state->__pyx_n_s_bin_dist); + Py_CLEAR(clear_module_state->__pyx_n_s_bin_width); + Py_CLEAR(clear_module_state->__pyx_n_s_bins); + Py_CLEAR(clear_module_state->__pyx_n_s_binwidth); + Py_CLEAR(clear_module_state->__pyx_n_s_blen2); + Py_CLEAR(clear_module_state->__pyx_n_s_bond_table); + Py_CLEAR(clear_module_state->__pyx_n_s_both_directions); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl); + Py_CLEAR(clear_module_state->__pyx_n_s_boxlength); + Py_CLEAR(clear_module_state->__pyx_n_s_c); + Py_CLEAR(clear_module_state->__pyx_n_u_c); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDipTenCollective); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDipTenCollective1NShellwiseC); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDipTenCollective1NShellwiseS); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDipTenCollectiveCross); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDipTenCollectiveNNShellwise); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDipTenCollectiveNNShellwiseC); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDipTenCollectiveNNShellwiseS); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDipTenCollectivePerAtom); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDipTenCollectiveShellwise); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDipTenCollectiveVennShellwis); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDistanceDelauny); + Py_CLEAR(clear_module_state->__pyx_n_s_calcDistanceDelaunyMindist); + Py_CLEAR(clear_module_state->__pyx_n_s_cardinality); + Py_CLEAR(clear_module_state->__pyx_n_s_charges); + Py_CLEAR(clear_module_state->__pyx_n_s_cl); + Py_CLEAR(clear_module_state->__pyx_n_s_cl_self); + Py_CLEAR(clear_module_state->__pyx_n_s_class); + Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_closest_shell); + Py_CLEAR(clear_module_state->__pyx_n_s_collections); + Py_CLEAR(clear_module_state->__pyx_kp_s_collections_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_collectiveDipolesCutoff); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_CLEAR(clear_module_state->__pyx_n_s_coo1); + Py_CLEAR(clear_module_state->__pyx_n_s_coo2); + Py_CLEAR(clear_module_state->__pyx_n_s_coor); + Py_CLEAR(clear_module_state->__pyx_n_s_coor1); + Py_CLEAR(clear_module_state->__pyx_n_s_coor2); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_core); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_i); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_j); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_oh2); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_res); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_surr); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_surround); + Py_CLEAR(clear_module_state->__pyx_n_s_coors); + Py_CLEAR(clear_module_state->__pyx_n_s_coors_ind); + Py_CLEAR(clear_module_state->__pyx_n_s_copy); + Py_CLEAR(clear_module_state->__pyx_n_s_corr); + Py_CLEAR(clear_module_state->__pyx_n_s_correlateMultiVector); + Py_CLEAR(clear_module_state->__pyx_n_s_correlateMultiVectorShellwise); + Py_CLEAR(clear_module_state->__pyx_n_s_correlateMultiVectorVennShellwis); + Py_CLEAR(clear_module_state->__pyx_n_s_correlateSingleParticleMuShellwi); + Py_CLEAR(clear_module_state->__pyx_n_s_correlateSingleParticleMuVennShe); + Py_CLEAR(clear_module_state->__pyx_n_s_correlateSingleVector); + Py_CLEAR(clear_module_state->__pyx_n_s_correlation_length); + Py_CLEAR(clear_module_state->__pyx_n_s_cos_angle); + Py_CLEAR(clear_module_state->__pyx_n_s_cos_segs); + Py_CLEAR(clear_module_state->__pyx_n_s_cosine); + Py_CLEAR(clear_module_state->__pyx_n_s_count); + Py_CLEAR(clear_module_state->__pyx_n_s_countHBonds); + Py_CLEAR(clear_module_state->__pyx_n_s_countMultiShell); + Py_CLEAR(clear_module_state->__pyx_n_s_countVennShellOccupation); + Py_CLEAR(clear_module_state->__pyx_n_s_counter); + Py_CLEAR(clear_module_state->__pyx_n_s_crossCorrelateMultiVector); + Py_CLEAR(clear_module_state->__pyx_n_s_crossCorrelateSingleVector); + Py_CLEAR(clear_module_state->__pyx_n_s_crosscorr); + Py_CLEAR(clear_module_state->__pyx_n_s_crossctr); + Py_CLEAR(clear_module_state->__pyx_n_s_ctr); + Py_CLEAR(clear_module_state->__pyx_n_s_cutoff); + Py_CLEAR(clear_module_state->__pyx_n_s_data); + Py_CLEAR(clear_module_state->__pyx_n_s_dataset); + Py_CLEAR(clear_module_state->__pyx_n_s_dataset1); + Py_CLEAR(clear_module_state->__pyx_n_s_dataset2); + Py_CLEAR(clear_module_state->__pyx_n_s_delauny_matrix); + Py_CLEAR(clear_module_state->__pyx_n_s_deriveIndDip); + Py_CLEAR(clear_module_state->__pyx_n_s_deriveIndDipPerAtom); + Py_CLEAR(clear_module_state->__pyx_n_s_derived_atomic_dipoles); + Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_n_s_dip); + Py_CLEAR(clear_module_state->__pyx_n_s_dipTen); + Py_CLEAR(clear_module_state->__pyx_n_s_dip_inside); + Py_CLEAR(clear_module_state->__pyx_n_s_dip_outside); + Py_CLEAR(clear_module_state->__pyx_n_s_dip_res); + Py_CLEAR(clear_module_state->__pyx_n_s_dip_shell); + Py_CLEAR(clear_module_state->__pyx_n_s_dip_wat); + Py_CLEAR(clear_module_state->__pyx_n_s_dipoles); + Py_CLEAR(clear_module_state->__pyx_n_s_dipt); + Py_CLEAR(clear_module_state->__pyx_n_s_dipt_0); + Py_CLEAR(clear_module_state->__pyx_n_s_dipt_0_self); + Py_CLEAR(clear_module_state->__pyx_n_s_dipt_t); + Py_CLEAR(clear_module_state->__pyx_n_s_dipt_t_self); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_dist); + Py_CLEAR(clear_module_state->__pyx_n_s_dist1); + Py_CLEAR(clear_module_state->__pyx_n_s_dist2); + Py_CLEAR(clear_module_state->__pyx_n_s_dist_2); + Py_CLEAR(clear_module_state->__pyx_n_s_dist_3); + Py_CLEAR(clear_module_state->__pyx_n_s_dist_sq); + Py_CLEAR(clear_module_state->__pyx_n_s_distance); + Py_CLEAR(clear_module_state->__pyx_n_s_distances); + Py_CLEAR(clear_module_state->__pyx_n_s_distances_copy); + Py_CLEAR(clear_module_state->__pyx_n_s_distvec); + Py_CLEAR(clear_module_state->__pyx_n_s_doc); + Py_CLEAR(clear_module_state->__pyx_n_s_dot); + Py_CLEAR(clear_module_state->__pyx_n_s_dot2); + Py_CLEAR(clear_module_state->__pyx_n_s_ds); + Py_CLEAR(clear_module_state->__pyx_n_s_ds1); + Py_CLEAR(clear_module_state->__pyx_n_s_ds1_idx); + Py_CLEAR(clear_module_state->__pyx_n_s_ds2); + Py_CLEAR(clear_module_state->__pyx_n_s_ds2_idx); + Py_CLEAR(clear_module_state->__pyx_n_s_ds3); + Py_CLEAR(clear_module_state->__pyx_n_s_ds4); + Py_CLEAR(clear_module_state->__pyx_n_s_ds5); + Py_CLEAR(clear_module_state->__pyx_n_s_ds_idx); + Py_CLEAR(clear_module_state->__pyx_n_s_dt); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype_is_object); + Py_CLEAR(clear_module_state->__pyx_n_s_dx); + Py_CLEAR(clear_module_state->__pyx_n_s_dx2); + Py_CLEAR(clear_module_state->__pyx_n_s_dy); + Py_CLEAR(clear_module_state->__pyx_n_s_dy2); + Py_CLEAR(clear_module_state->__pyx_n_s_dz); + Py_CLEAR(clear_module_state->__pyx_n_s_dz2); + Py_CLEAR(clear_module_state->__pyx_n_s_emim_h); + Py_CLEAR(clear_module_state->__pyx_n_s_empty); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_energy1); + Py_CLEAR(clear_module_state->__pyx_n_s_energy2); + Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); + Py_CLEAR(clear_module_state->__pyx_n_s_error); + Py_CLEAR(clear_module_state->__pyx_n_s_f1); + Py_CLEAR(clear_module_state->__pyx_n_s_f2); + Py_CLEAR(clear_module_state->__pyx_n_s_f2c); + Py_CLEAR(clear_module_state->__pyx_n_s_flags); + Py_CLEAR(clear_module_state->__pyx_n_s_float64); + Py_CLEAR(clear_module_state->__pyx_n_s_format); + Py_CLEAR(clear_module_state->__pyx_n_s_fortran); + Py_CLEAR(clear_module_state->__pyx_n_u_fortran); + Py_CLEAR(clear_module_state->__pyx_n_s_frame); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_getBestIndex); + Py_CLEAR(clear_module_state->__pyx_n_s_getBestIndices); + Py_CLEAR(clear_module_state->__pyx_n_s_getBondTable); + Py_CLEAR(clear_module_state->__pyx_n_s_getPolarizabilityMatrix); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_kp_u_got); + Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_hbond); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_max); + Py_CLEAR(clear_module_state->__pyx_n_s_histo_min); + Py_CLEAR(clear_module_state->__pyx_n_s_histogram); + Py_CLEAR(clear_module_state->__pyx_n_s_histograms); + Py_CLEAR(clear_module_state->__pyx_n_s_i); + Py_CLEAR(clear_module_state->__pyx_n_s_id); + Py_CLEAR(clear_module_state->__pyx_n_s_idx); + Py_CLEAR(clear_module_state->__pyx_n_s_idx2); + Py_CLEAR(clear_module_state->__pyx_n_s_idx3); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_index); + Py_CLEAR(clear_module_state->__pyx_n_s_init); + Py_CLEAR(clear_module_state->__pyx_n_s_init_subclass); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_int); + Py_CLEAR(clear_module_state->__pyx_n_s_int32); + Py_CLEAR(clear_module_state->__pyx_n_s_inv_atom_polarizabilities); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_itemsize); + Py_CLEAR(clear_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_CLEAR(clear_module_state->__pyx_n_s_j); + Py_CLEAR(clear_module_state->__pyx_n_s_k); + Py_CLEAR(clear_module_state->__pyx_n_s_kind); + Py_CLEAR(clear_module_state->__pyx_n_s_kronecker); + Py_CLEAR(clear_module_state->__pyx_n_s_l); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_matrix); + Py_CLEAR(clear_module_state->__pyx_n_s_max_distance); + Py_CLEAR(clear_module_state->__pyx_n_s_maxdist); + Py_CLEAR(clear_module_state->__pyx_n_s_maxdt); + Py_CLEAR(clear_module_state->__pyx_n_s_maxshell); + Py_CLEAR(clear_module_state->__pyx_n_s_maxshell1); + Py_CLEAR(clear_module_state->__pyx_n_s_maxshell2); + Py_CLEAR(clear_module_state->__pyx_n_s_mdcage_timeseries); + Py_CLEAR(clear_module_state->__pyx_n_s_mdcage_ts); + Py_CLEAR(clear_module_state->__pyx_n_s_memview); + Py_CLEAR(clear_module_state->__pyx_n_s_mergesort); + Py_CLEAR(clear_module_state->__pyx_n_s_metaclass); + Py_CLEAR(clear_module_state->__pyx_n_s_minDistTesselation); + Py_CLEAR(clear_module_state->__pyx_n_s_min_dist); + Py_CLEAR(clear_module_state->__pyx_n_s_mode); + Py_CLEAR(clear_module_state->__pyx_n_s_module); + Py_CLEAR(clear_module_state->__pyx_n_s_mol); + Py_CLEAR(clear_module_state->__pyx_n_s_multiVecShellCorrelate); + Py_CLEAR(clear_module_state->__pyx_n_s_multiVecVennShellCorrelate); + Py_CLEAR(clear_module_state->__pyx_n_s_n); + Py_CLEAR(clear_module_state->__pyx_n_s_n_atoms); + Py_CLEAR(clear_module_state->__pyx_n_s_n_aufpunkte); + Py_CLEAR(clear_module_state->__pyx_n_s_n_frames); + Py_CLEAR(clear_module_state->__pyx_n_s_n_ind_particles); + Py_CLEAR(clear_module_state->__pyx_n_s_n_iterations); + Py_CLEAR(clear_module_state->__pyx_n_s_n_pairs_h); + Py_CLEAR(clear_module_state->__pyx_n_s_n_particle_core); + Py_CLEAR(clear_module_state->__pyx_n_s_n_particle_surround); + Py_CLEAR(clear_module_state->__pyx_n_s_n_particles); + Py_CLEAR(clear_module_state->__pyx_n_s_n_particles1); + Py_CLEAR(clear_module_state->__pyx_n_s_n_particles2); + Py_CLEAR(clear_module_state->__pyx_n_s_n_particles_all); + Py_CLEAR(clear_module_state->__pyx_n_s_n_particles_ind); + Py_CLEAR(clear_module_state->__pyx_n_s_n_particles_tot); + Py_CLEAR(clear_module_state->__pyx_n_s_n_res_emim); + Py_CLEAR(clear_module_state->__pyx_n_s_n_self_pairs_h); + Py_CLEAR(clear_module_state->__pyx_n_s_n_shells); + Py_CLEAR(clear_module_state->__pyx_n_s_n_shells1); + Py_CLEAR(clear_module_state->__pyx_n_s_n_shells2); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_name_2); + Py_CLEAR(clear_module_state->__pyx_n_s_ndim); + Py_CLEAR(clear_module_state->__pyx_n_s_new); + Py_CLEAR(clear_module_state->__pyx_n_s_new_2); + Py_CLEAR(clear_module_state->__pyx_kp_s_newanalysis_helpers_miscellaneou); + Py_CLEAR(clear_module_state->__pyx_n_s_newanalysis_miscellaneous); + Py_CLEAR(clear_module_state->__pyx_n_s_nmol); + Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_CLEAR(clear_module_state->__pyx_n_s_noe_task); + Py_CLEAR(clear_module_state->__pyx_n_s_noe_task___init); + Py_CLEAR(clear_module_state->__pyx_n_s_noe_task_pairiter); + Py_CLEAR(clear_module_state->__pyx_n_s_norm); + Py_CLEAR(clear_module_state->__pyx_n_s_np); + Py_CLEAR(clear_module_state->__pyx_n_s_nres_surr); + Py_CLEAR(clear_module_state->__pyx_n_s_nres_wat); + Py_CLEAR(clear_module_state->__pyx_n_s_nshells); + Py_CLEAR(clear_module_state->__pyx_n_s_nshells1); + Py_CLEAR(clear_module_state->__pyx_n_s_nshells2); + Py_CLEAR(clear_module_state->__pyx_n_s_nsurr); + Py_CLEAR(clear_module_state->__pyx_n_s_number_aufpunkte); + Py_CLEAR(clear_module_state->__pyx_n_s_number_of_datapoints); + Py_CLEAR(clear_module_state->__pyx_n_s_number_of_frames); + Py_CLEAR(clear_module_state->__pyx_n_s_number_of_frames1); + Py_CLEAR(clear_module_state->__pyx_n_s_number_of_frames2); + Py_CLEAR(clear_module_state->__pyx_n_s_number_of_particles); + Py_CLEAR(clear_module_state->__pyx_n_s_number_of_shells); + Py_CLEAR(clear_module_state->__pyx_n_s_number_of_shells1); + Py_CLEAR(clear_module_state->__pyx_n_s_number_of_shells2); + Py_CLEAR(clear_module_state->__pyx_n_s_number_of_startingpoints); + Py_CLEAR(clear_module_state->__pyx_n_s_numpy); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_CLEAR(clear_module_state->__pyx_n_s_nwat); + Py_CLEAR(clear_module_state->__pyx_n_s_obj); + Py_CLEAR(clear_module_state->__pyx_n_s_order); + Py_CLEAR(clear_module_state->__pyx_n_s_p); + Py_CLEAR(clear_module_state->__pyx_n_s_p1); + Py_CLEAR(clear_module_state->__pyx_n_s_p1_coor); + Py_CLEAR(clear_module_state->__pyx_n_s_p1l); + Py_CLEAR(clear_module_state->__pyx_n_s_p2); + Py_CLEAR(clear_module_state->__pyx_n_s_p2_coor); + Py_CLEAR(clear_module_state->__pyx_n_s_p2l); + Py_CLEAR(clear_module_state->__pyx_n_s_p_coor); + Py_CLEAR(clear_module_state->__pyx_n_s_pack); + Py_CLEAR(clear_module_state->__pyx_n_s_pair); + Py_CLEAR(clear_module_state->__pyx_n_s_pair_1_par_1); + Py_CLEAR(clear_module_state->__pyx_n_s_pair_1_par_2); + Py_CLEAR(clear_module_state->__pyx_n_s_pair_2_par_1); + Py_CLEAR(clear_module_state->__pyx_n_s_pair_2_par_2); + Py_CLEAR(clear_module_state->__pyx_n_s_pairiter); + Py_CLEAR(clear_module_state->__pyx_n_s_pairlist); + Py_CLEAR(clear_module_state->__pyx_n_s_pairobject); + Py_CLEAR(clear_module_state->__pyx_n_s_pairobject___init); + Py_CLEAR(clear_module_state->__pyx_n_s_particle); + Py_CLEAR(clear_module_state->__pyx_n_s_particle1); + Py_CLEAR(clear_module_state->__pyx_n_s_particle2); + Py_CLEAR(clear_module_state->__pyx_n_s_particle_first); + Py_CLEAR(clear_module_state->__pyx_n_s_particles); + Py_CLEAR(clear_module_state->__pyx_n_s_pickle); + Py_CLEAR(clear_module_state->__pyx_n_s_pl); + Py_CLEAR(clear_module_state->__pyx_n_s_point); + Py_CLEAR(clear_module_state->__pyx_n_s_point1); + Py_CLEAR(clear_module_state->__pyx_n_s_point2); + Py_CLEAR(clear_module_state->__pyx_n_s_prepare); + Py_CLEAR(clear_module_state->__pyx_n_s_prev_atomic_dipoles); + Py_CLEAR(clear_module_state->__pyx_n_s_print); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); + Py_CLEAR(clear_module_state->__pyx_n_s_qualname); + Py_CLEAR(clear_module_state->__pyx_n_s_r2); + Py_CLEAR(clear_module_state->__pyx_n_s_r_0); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_ref); + Py_CLEAR(clear_module_state->__pyx_n_s_register); + Py_CLEAR(clear_module_state->__pyx_n_s_res); + Py_CLEAR(clear_module_state->__pyx_n_s_res1); + Py_CLEAR(clear_module_state->__pyx_n_s_res2); + Py_CLEAR(clear_module_state->__pyx_n_s_result); + Py_CLEAR(clear_module_state->__pyx_n_s_results); + Py_CLEAR(clear_module_state->__pyx_n_s_return); + Py_CLEAR(clear_module_state->__pyx_n_s_rotTs); + Py_CLEAR(clear_module_state->__pyx_n_s_rotationMatrixMultiShellCorrelat); + Py_CLEAR(clear_module_state->__pyx_n_s_rotationMatrixVennShellCorrelate); + Py_CLEAR(clear_module_state->__pyx_n_s_run); + Py_CLEAR(clear_module_state->__pyx_n_s_rv); + Py_CLEAR(clear_module_state->__pyx_n_s_segments_per_angstroem); + Py_CLEAR(clear_module_state->__pyx_n_s_segments_per_pi); + Py_CLEAR(clear_module_state->__pyx_n_s_segs); + Py_CLEAR(clear_module_state->__pyx_n_s_segs_per_angstroem); + Py_CLEAR(clear_module_state->__pyx_n_s_self); + Py_CLEAR(clear_module_state->__pyx_kp_s_self_too_sparse); + Py_CLEAR(clear_module_state->__pyx_n_s_selfcorr); + Py_CLEAR(clear_module_state->__pyx_n_s_selfctr); + Py_CLEAR(clear_module_state->__pyx_n_s_selflist); + Py_CLEAR(clear_module_state->__pyx_n_s_selfobj); + Py_CLEAR(clear_module_state->__pyx_n_s_selfobject); + Py_CLEAR(clear_module_state->__pyx_n_s_selfobject___init); + Py_CLEAR(clear_module_state->__pyx_n_s_set_name); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_shape); + Py_CLEAR(clear_module_state->__pyx_n_s_shell); + Py_CLEAR(clear_module_state->__pyx_n_s_shell1); + Py_CLEAR(clear_module_state->__pyx_n_s_shell2); + Py_CLEAR(clear_module_state->__pyx_n_s_shell3); + Py_CLEAR(clear_module_state->__pyx_n_s_shell4); + Py_CLEAR(clear_module_state->__pyx_n_s_shell5); + Py_CLEAR(clear_module_state->__pyx_n_s_shellHistograms); + Py_CLEAR(clear_module_state->__pyx_n_s_shell_01); + Py_CLEAR(clear_module_state->__pyx_n_s_shell_02); + Py_CLEAR(clear_module_state->__pyx_n_s_shell_03); + Py_CLEAR(clear_module_state->__pyx_n_s_shell_04); + Py_CLEAR(clear_module_state->__pyx_n_s_shell_05); + Py_CLEAR(clear_module_state->__pyx_n_s_shelldt); + Py_CLEAR(clear_module_state->__pyx_n_s_shelldt1); + Py_CLEAR(clear_module_state->__pyx_n_s_shelldt2); + Py_CLEAR(clear_module_state->__pyx_n_s_shells); + Py_CLEAR(clear_module_state->__pyx_n_s_shellstart); + Py_CLEAR(clear_module_state->__pyx_n_s_shellstart1); + Py_CLEAR(clear_module_state->__pyx_n_s_shellstart2); + Py_CLEAR(clear_module_state->__pyx_n_s_sign); + Py_CLEAR(clear_module_state->__pyx_n_s_sites_per_res); + Py_CLEAR(clear_module_state->__pyx_n_s_size); + Py_CLEAR(clear_module_state->__pyx_n_s_sort); + Py_CLEAR(clear_module_state->__pyx_n_s_sortCollectiveDipNNShells); + Py_CLEAR(clear_module_state->__pyx_n_s_sortCollectiveDipNNShellsInt); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_sqrt); + Py_CLEAR(clear_module_state->__pyx_n_s_start); + Py_CLEAR(clear_module_state->__pyx_n_s_startingpoints); + Py_CLEAR(clear_module_state->__pyx_n_s_startskip); + Py_CLEAR(clear_module_state->__pyx_n_s_step); + Py_CLEAR(clear_module_state->__pyx_n_s_stop); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_struct); + Py_CLEAR(clear_module_state->__pyx_n_s_structureFactorCharge); + Py_CLEAR(clear_module_state->__pyx_n_s_structureFactorDipTen); + Py_CLEAR(clear_module_state->__pyx_n_s_sub_correlation); + Py_CLEAR(clear_module_state->__pyx_n_s_sumMultiMDCageSingle); + Py_CLEAR(clear_module_state->__pyx_n_s_sumUpByShell); + Py_CLEAR(clear_module_state->__pyx_n_s_sumVennMDCageSingle); + Py_CLEAR(clear_module_state->__pyx_n_s_super); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_t1); + Py_CLEAR(clear_module_state->__pyx_n_s_t2); + Py_CLEAR(clear_module_state->__pyx_n_s_t3); + Py_CLEAR(clear_module_state->__pyx_n_s_t4); + Py_CLEAR(clear_module_state->__pyx_n_s_t5); + Py_CLEAR(clear_module_state->__pyx_n_s_t6); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_testParallelism); + Py_CLEAR(clear_module_state->__pyx_n_s_timeseries); + Py_CLEAR(clear_module_state->__pyx_n_s_timeseries1); + Py_CLEAR(clear_module_state->__pyx_n_s_timeseries2); + Py_CLEAR(clear_module_state->__pyx_n_s_timeseries_shellwise); + Py_CLEAR(clear_module_state->__pyx_kp_s_tot_too_sparse); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_CLEAR(clear_module_state->__pyx_n_s_unfold); + Py_CLEAR(clear_module_state->__pyx_n_s_unpack); + Py_CLEAR(clear_module_state->__pyx_n_s_update); + Py_CLEAR(clear_module_state->__pyx_n_s_vanHoveMultiVector); + Py_CLEAR(clear_module_state->__pyx_n_s_vanHoveSingleVector); + Py_CLEAR(clear_module_state->__pyx_n_s_vec); + Py_CLEAR(clear_module_state->__pyx_n_s_vel_ind); + Py_CLEAR(clear_module_state->__pyx_n_s_version_info); + Py_CLEAR(clear_module_state->__pyx_n_s_w); + Py_CLEAR(clear_module_state->__pyx_n_s_wat); + Py_CLEAR(clear_module_state->__pyx_n_s_writeKirkwoodHistogram); + Py_CLEAR(clear_module_state->__pyx_n_s_writeKirkwoodHistogram2D); + Py_CLEAR(clear_module_state->__pyx_n_s_writeKirkwoodHistogramShellwise); + Py_CLEAR(clear_module_state->__pyx_n_s_writeMrHistogram); + Py_CLEAR(clear_module_state->__pyx_n_s_x); + Py_CLEAR(clear_module_state->__pyx_n_s_zeros); + Py_CLEAR(clear_module_state->__pyx_float__5); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_2); + Py_CLEAR(clear_module_state->__pyx_int_3); + Py_CLEAR(clear_module_state->__pyx_int_4); + Py_CLEAR(clear_module_state->__pyx_int_5); + Py_CLEAR(clear_module_state->__pyx_int_6); + Py_CLEAR(clear_module_state->__pyx_int_12); + Py_CLEAR(clear_module_state->__pyx_int_112105877); + Py_CLEAR(clear_module_state->__pyx_int_136983863); + Py_CLEAR(clear_module_state->__pyx_int_184977713); + Py_CLEAR(clear_module_state->__pyx_int_neg_1); + Py_CLEAR(clear_module_state->__pyx_slice__5); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_tuple__9); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__14); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__16); + Py_CLEAR(clear_module_state->__pyx_tuple__17); + Py_CLEAR(clear_module_state->__pyx_tuple__18); + Py_CLEAR(clear_module_state->__pyx_tuple__19); + Py_CLEAR(clear_module_state->__pyx_tuple__20); + Py_CLEAR(clear_module_state->__pyx_tuple__21); + Py_CLEAR(clear_module_state->__pyx_tuple__22); + Py_CLEAR(clear_module_state->__pyx_tuple__23); + Py_CLEAR(clear_module_state->__pyx_tuple__24); + Py_CLEAR(clear_module_state->__pyx_tuple__25); + Py_CLEAR(clear_module_state->__pyx_tuple__26); + Py_CLEAR(clear_module_state->__pyx_tuple__27); + Py_CLEAR(clear_module_state->__pyx_tuple__29); + Py_CLEAR(clear_module_state->__pyx_tuple__31); + Py_CLEAR(clear_module_state->__pyx_tuple__33); + Py_CLEAR(clear_module_state->__pyx_tuple__35); + Py_CLEAR(clear_module_state->__pyx_tuple__37); + Py_CLEAR(clear_module_state->__pyx_tuple__39); + Py_CLEAR(clear_module_state->__pyx_tuple__41); + Py_CLEAR(clear_module_state->__pyx_tuple__43); + Py_CLEAR(clear_module_state->__pyx_tuple__45); + Py_CLEAR(clear_module_state->__pyx_tuple__47); + Py_CLEAR(clear_module_state->__pyx_tuple__49); + Py_CLEAR(clear_module_state->__pyx_tuple__51); + Py_CLEAR(clear_module_state->__pyx_tuple__53); + Py_CLEAR(clear_module_state->__pyx_tuple__55); + Py_CLEAR(clear_module_state->__pyx_tuple__57); + Py_CLEAR(clear_module_state->__pyx_tuple__59); + Py_CLEAR(clear_module_state->__pyx_tuple__61); + Py_CLEAR(clear_module_state->__pyx_tuple__63); + Py_CLEAR(clear_module_state->__pyx_tuple__65); + Py_CLEAR(clear_module_state->__pyx_tuple__67); + Py_CLEAR(clear_module_state->__pyx_tuple__69); + Py_CLEAR(clear_module_state->__pyx_tuple__71); + Py_CLEAR(clear_module_state->__pyx_tuple__73); + Py_CLEAR(clear_module_state->__pyx_tuple__75); + Py_CLEAR(clear_module_state->__pyx_tuple__77); + Py_CLEAR(clear_module_state->__pyx_tuple__79); + Py_CLEAR(clear_module_state->__pyx_tuple__81); + Py_CLEAR(clear_module_state->__pyx_tuple__83); + Py_CLEAR(clear_module_state->__pyx_tuple__85); + Py_CLEAR(clear_module_state->__pyx_tuple__87); + Py_CLEAR(clear_module_state->__pyx_tuple__89); + Py_CLEAR(clear_module_state->__pyx_tuple__91); + Py_CLEAR(clear_module_state->__pyx_tuple__93); + Py_CLEAR(clear_module_state->__pyx_tuple__95); + Py_CLEAR(clear_module_state->__pyx_tuple__97); + Py_CLEAR(clear_module_state->__pyx_tuple__99); + Py_CLEAR(clear_module_state->__pyx_tuple__101); + Py_CLEAR(clear_module_state->__pyx_tuple__103); + Py_CLEAR(clear_module_state->__pyx_tuple__105); + Py_CLEAR(clear_module_state->__pyx_tuple__107); + Py_CLEAR(clear_module_state->__pyx_tuple__109); + Py_CLEAR(clear_module_state->__pyx_tuple__111); + Py_CLEAR(clear_module_state->__pyx_tuple__113); + Py_CLEAR(clear_module_state->__pyx_tuple__115); + Py_CLEAR(clear_module_state->__pyx_tuple__117); + Py_CLEAR(clear_module_state->__pyx_tuple__119); + Py_CLEAR(clear_module_state->__pyx_tuple__121); + Py_CLEAR(clear_module_state->__pyx_tuple__123); + Py_CLEAR(clear_module_state->__pyx_tuple__125); + Py_CLEAR(clear_module_state->__pyx_tuple__128); + Py_CLEAR(clear_module_state->__pyx_tuple__130); + Py_CLEAR(clear_module_state->__pyx_tuple__132); + Py_CLEAR(clear_module_state->__pyx_tuple__134); + Py_CLEAR(clear_module_state->__pyx_tuple__136); + Py_CLEAR(clear_module_state->__pyx_tuple__138); + Py_CLEAR(clear_module_state->__pyx_tuple__141); + Py_CLEAR(clear_module_state->__pyx_tuple__143); + Py_CLEAR(clear_module_state->__pyx_tuple__145); + Py_CLEAR(clear_module_state->__pyx_tuple__147); + Py_CLEAR(clear_module_state->__pyx_tuple__149); + Py_CLEAR(clear_module_state->__pyx_tuple__151); + Py_CLEAR(clear_module_state->__pyx_tuple__153); + Py_CLEAR(clear_module_state->__pyx_codeobj__28); + Py_CLEAR(clear_module_state->__pyx_codeobj__30); + Py_CLEAR(clear_module_state->__pyx_codeobj__32); + Py_CLEAR(clear_module_state->__pyx_codeobj__34); + Py_CLEAR(clear_module_state->__pyx_codeobj__36); + Py_CLEAR(clear_module_state->__pyx_codeobj__38); + Py_CLEAR(clear_module_state->__pyx_codeobj__40); + Py_CLEAR(clear_module_state->__pyx_codeobj__42); + Py_CLEAR(clear_module_state->__pyx_codeobj__44); + Py_CLEAR(clear_module_state->__pyx_codeobj__46); + Py_CLEAR(clear_module_state->__pyx_codeobj__48); + Py_CLEAR(clear_module_state->__pyx_codeobj__50); + Py_CLEAR(clear_module_state->__pyx_codeobj__52); + Py_CLEAR(clear_module_state->__pyx_codeobj__54); + Py_CLEAR(clear_module_state->__pyx_codeobj__56); + Py_CLEAR(clear_module_state->__pyx_codeobj__58); + Py_CLEAR(clear_module_state->__pyx_codeobj__60); + Py_CLEAR(clear_module_state->__pyx_codeobj__62); + Py_CLEAR(clear_module_state->__pyx_codeobj__64); + Py_CLEAR(clear_module_state->__pyx_codeobj__66); + Py_CLEAR(clear_module_state->__pyx_codeobj__68); + Py_CLEAR(clear_module_state->__pyx_codeobj__70); + Py_CLEAR(clear_module_state->__pyx_codeobj__72); + Py_CLEAR(clear_module_state->__pyx_codeobj__74); + Py_CLEAR(clear_module_state->__pyx_codeobj__76); + Py_CLEAR(clear_module_state->__pyx_codeobj__78); + Py_CLEAR(clear_module_state->__pyx_codeobj__80); + Py_CLEAR(clear_module_state->__pyx_codeobj__82); + Py_CLEAR(clear_module_state->__pyx_codeobj__84); + Py_CLEAR(clear_module_state->__pyx_codeobj__86); + Py_CLEAR(clear_module_state->__pyx_codeobj__88); + Py_CLEAR(clear_module_state->__pyx_codeobj__90); + Py_CLEAR(clear_module_state->__pyx_codeobj__92); + Py_CLEAR(clear_module_state->__pyx_codeobj__94); + Py_CLEAR(clear_module_state->__pyx_codeobj__96); + Py_CLEAR(clear_module_state->__pyx_codeobj__98); + Py_CLEAR(clear_module_state->__pyx_codeobj__100); + Py_CLEAR(clear_module_state->__pyx_codeobj__102); + Py_CLEAR(clear_module_state->__pyx_codeobj__104); + Py_CLEAR(clear_module_state->__pyx_codeobj__106); + Py_CLEAR(clear_module_state->__pyx_codeobj__108); + Py_CLEAR(clear_module_state->__pyx_codeobj__110); + Py_CLEAR(clear_module_state->__pyx_codeobj__112); + Py_CLEAR(clear_module_state->__pyx_codeobj__114); + Py_CLEAR(clear_module_state->__pyx_codeobj__116); + Py_CLEAR(clear_module_state->__pyx_codeobj__118); + Py_CLEAR(clear_module_state->__pyx_codeobj__120); + Py_CLEAR(clear_module_state->__pyx_codeobj__122); + Py_CLEAR(clear_module_state->__pyx_codeobj__124); + Py_CLEAR(clear_module_state->__pyx_codeobj__126); + Py_CLEAR(clear_module_state->__pyx_codeobj__127); + Py_CLEAR(clear_module_state->__pyx_codeobj__129); + Py_CLEAR(clear_module_state->__pyx_codeobj__131); + Py_CLEAR(clear_module_state->__pyx_codeobj__133); + Py_CLEAR(clear_module_state->__pyx_codeobj__135); + Py_CLEAR(clear_module_state->__pyx_codeobj__137); + Py_CLEAR(clear_module_state->__pyx_codeobj__139); + Py_CLEAR(clear_module_state->__pyx_codeobj__140); + Py_CLEAR(clear_module_state->__pyx_codeobj__142); + Py_CLEAR(clear_module_state->__pyx_codeobj__144); + Py_CLEAR(clear_module_state->__pyx_codeobj__146); + Py_CLEAR(clear_module_state->__pyx_codeobj__148); + Py_CLEAR(clear_module_state->__pyx_codeobj__150); + Py_CLEAR(clear_module_state->__pyx_codeobj__152); + Py_CLEAR(clear_module_state->__pyx_codeobj__154); + return 0; } - -/* "src/helpers/miscellaneous.pyx":74 +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_n_s_ASCII); + Py_VISIT(traverse_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_VISIT(traverse_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_VISIT(traverse_module_state->__pyx_kp_s_Correlation_length_must_not_be_l); + Py_VISIT(traverse_module_state->__pyx_n_s_D); + Py_VISIT(traverse_module_state->__pyx_n_s_D_x); + Py_VISIT(traverse_module_state->__pyx_n_s_D_y); + Py_VISIT(traverse_module_state->__pyx_n_s_D_z); + Py_VISIT(traverse_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_VISIT(traverse_module_state->__pyx_n_s_Ellipsis); + Py_VISIT(traverse_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_VISIT(traverse_module_state->__pyx_n_s_ImportError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_VISIT(traverse_module_state->__pyx_n_s_IndexError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_VISIT(traverse_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_VISIT(traverse_module_state->__pyx_kp_s_Number_of_starting_points_too_hi); + Py_VISIT(traverse_module_state->__pyx_n_b_O); + Py_VISIT(traverse_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_Sequence); + Py_VISIT(traverse_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); + Py_VISIT(traverse_module_state->__pyx_n_s_View_MemoryView); + Py_VISIT(traverse_module_state->__pyx_kp_s_Warning_number_of_frames_correla); + Py_VISIT(traverse_module_state->__pyx_n_s__155); + Py_VISIT(traverse_module_state->__pyx_kp_u__2); + Py_VISIT(traverse_module_state->__pyx_n_s__3); + Py_VISIT(traverse_module_state->__pyx_kp_u__6); + Py_VISIT(traverse_module_state->__pyx_kp_u__7); + Py_VISIT(traverse_module_state->__pyx_n_s_a); + Py_VISIT(traverse_module_state->__pyx_n_s_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_accumulateNMShellwiseGFunction); + Py_VISIT(traverse_module_state->__pyx_n_s_accumulateShellwiseGFunction); + Py_VISIT(traverse_module_state->__pyx_n_s_allocate_buffer); + Py_VISIT(traverse_module_state->__pyx_n_s_alpha); + Py_VISIT(traverse_module_state->__pyx_kp_u_and); + Py_VISIT(traverse_module_state->__pyx_n_s_antagonist); + Py_VISIT(traverse_module_state->__pyx_n_s_append); + Py_VISIT(traverse_module_state->__pyx_n_s_apr_emim_h); + Py_VISIT(traverse_module_state->__pyx_n_s_apr_pair); + Py_VISIT(traverse_module_state->__pyx_n_s_asarray); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_atom); + Py_VISIT(traverse_module_state->__pyx_n_s_atomicIndDip); + Py_VISIT(traverse_module_state->__pyx_n_s_atomicIndDipPerAtom); + Py_VISIT(traverse_module_state->__pyx_n_s_atomic_dipoles); + Py_VISIT(traverse_module_state->__pyx_n_s_aufpunkt); + Py_VISIT(traverse_module_state->__pyx_n_s_aufpunkt_dipol); + Py_VISIT(traverse_module_state->__pyx_n_s_aufpunkt_dipole); + Py_VISIT(traverse_module_state->__pyx_n_s_aufpunkte); + Py_VISIT(traverse_module_state->__pyx_n_s_b); + Py_VISIT(traverse_module_state->__pyx_n_s_base); + Py_VISIT(traverse_module_state->__pyx_n_s_best_index); + Py_VISIT(traverse_module_state->__pyx_n_s_bin); + Py_VISIT(traverse_module_state->__pyx_n_s_bin1); + Py_VISIT(traverse_module_state->__pyx_n_s_bin2); + Py_VISIT(traverse_module_state->__pyx_n_s_bin_dist); + Py_VISIT(traverse_module_state->__pyx_n_s_bin_width); + Py_VISIT(traverse_module_state->__pyx_n_s_bins); + Py_VISIT(traverse_module_state->__pyx_n_s_binwidth); + Py_VISIT(traverse_module_state->__pyx_n_s_blen2); + Py_VISIT(traverse_module_state->__pyx_n_s_bond_table); + Py_VISIT(traverse_module_state->__pyx_n_s_both_directions); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl); + Py_VISIT(traverse_module_state->__pyx_n_s_boxlength); + Py_VISIT(traverse_module_state->__pyx_n_s_c); + Py_VISIT(traverse_module_state->__pyx_n_u_c); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDipTenCollective); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDipTenCollective1NShellwiseC); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDipTenCollective1NShellwiseS); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDipTenCollectiveCross); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDipTenCollectiveNNShellwise); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDipTenCollectiveNNShellwiseC); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDipTenCollectiveNNShellwiseS); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDipTenCollectivePerAtom); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDipTenCollectiveShellwise); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDipTenCollectiveVennShellwis); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDistanceDelauny); + Py_VISIT(traverse_module_state->__pyx_n_s_calcDistanceDelaunyMindist); + Py_VISIT(traverse_module_state->__pyx_n_s_cardinality); + Py_VISIT(traverse_module_state->__pyx_n_s_charges); + Py_VISIT(traverse_module_state->__pyx_n_s_cl); + Py_VISIT(traverse_module_state->__pyx_n_s_cl_self); + Py_VISIT(traverse_module_state->__pyx_n_s_class); + Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_closest_shell); + Py_VISIT(traverse_module_state->__pyx_n_s_collections); + Py_VISIT(traverse_module_state->__pyx_kp_s_collections_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_collectiveDipolesCutoff); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_VISIT(traverse_module_state->__pyx_n_s_coo1); + Py_VISIT(traverse_module_state->__pyx_n_s_coo2); + Py_VISIT(traverse_module_state->__pyx_n_s_coor); + Py_VISIT(traverse_module_state->__pyx_n_s_coor1); + Py_VISIT(traverse_module_state->__pyx_n_s_coor2); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_core); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_i); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_j); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_oh2); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_res); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_surr); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_surround); + Py_VISIT(traverse_module_state->__pyx_n_s_coors); + Py_VISIT(traverse_module_state->__pyx_n_s_coors_ind); + Py_VISIT(traverse_module_state->__pyx_n_s_copy); + Py_VISIT(traverse_module_state->__pyx_n_s_corr); + Py_VISIT(traverse_module_state->__pyx_n_s_correlateMultiVector); + Py_VISIT(traverse_module_state->__pyx_n_s_correlateMultiVectorShellwise); + Py_VISIT(traverse_module_state->__pyx_n_s_correlateMultiVectorVennShellwis); + Py_VISIT(traverse_module_state->__pyx_n_s_correlateSingleParticleMuShellwi); + Py_VISIT(traverse_module_state->__pyx_n_s_correlateSingleParticleMuVennShe); + Py_VISIT(traverse_module_state->__pyx_n_s_correlateSingleVector); + Py_VISIT(traverse_module_state->__pyx_n_s_correlation_length); + Py_VISIT(traverse_module_state->__pyx_n_s_cos_angle); + Py_VISIT(traverse_module_state->__pyx_n_s_cos_segs); + Py_VISIT(traverse_module_state->__pyx_n_s_cosine); + Py_VISIT(traverse_module_state->__pyx_n_s_count); + Py_VISIT(traverse_module_state->__pyx_n_s_countHBonds); + Py_VISIT(traverse_module_state->__pyx_n_s_countMultiShell); + Py_VISIT(traverse_module_state->__pyx_n_s_countVennShellOccupation); + Py_VISIT(traverse_module_state->__pyx_n_s_counter); + Py_VISIT(traverse_module_state->__pyx_n_s_crossCorrelateMultiVector); + Py_VISIT(traverse_module_state->__pyx_n_s_crossCorrelateSingleVector); + Py_VISIT(traverse_module_state->__pyx_n_s_crosscorr); + Py_VISIT(traverse_module_state->__pyx_n_s_crossctr); + Py_VISIT(traverse_module_state->__pyx_n_s_ctr); + Py_VISIT(traverse_module_state->__pyx_n_s_cutoff); + Py_VISIT(traverse_module_state->__pyx_n_s_data); + Py_VISIT(traverse_module_state->__pyx_n_s_dataset); + Py_VISIT(traverse_module_state->__pyx_n_s_dataset1); + Py_VISIT(traverse_module_state->__pyx_n_s_dataset2); + Py_VISIT(traverse_module_state->__pyx_n_s_delauny_matrix); + Py_VISIT(traverse_module_state->__pyx_n_s_deriveIndDip); + Py_VISIT(traverse_module_state->__pyx_n_s_deriveIndDipPerAtom); + Py_VISIT(traverse_module_state->__pyx_n_s_derived_atomic_dipoles); + Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_n_s_dip); + Py_VISIT(traverse_module_state->__pyx_n_s_dipTen); + Py_VISIT(traverse_module_state->__pyx_n_s_dip_inside); + Py_VISIT(traverse_module_state->__pyx_n_s_dip_outside); + Py_VISIT(traverse_module_state->__pyx_n_s_dip_res); + Py_VISIT(traverse_module_state->__pyx_n_s_dip_shell); + Py_VISIT(traverse_module_state->__pyx_n_s_dip_wat); + Py_VISIT(traverse_module_state->__pyx_n_s_dipoles); + Py_VISIT(traverse_module_state->__pyx_n_s_dipt); + Py_VISIT(traverse_module_state->__pyx_n_s_dipt_0); + Py_VISIT(traverse_module_state->__pyx_n_s_dipt_0_self); + Py_VISIT(traverse_module_state->__pyx_n_s_dipt_t); + Py_VISIT(traverse_module_state->__pyx_n_s_dipt_t_self); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_dist); + Py_VISIT(traverse_module_state->__pyx_n_s_dist1); + Py_VISIT(traverse_module_state->__pyx_n_s_dist2); + Py_VISIT(traverse_module_state->__pyx_n_s_dist_2); + Py_VISIT(traverse_module_state->__pyx_n_s_dist_3); + Py_VISIT(traverse_module_state->__pyx_n_s_dist_sq); + Py_VISIT(traverse_module_state->__pyx_n_s_distance); + Py_VISIT(traverse_module_state->__pyx_n_s_distances); + Py_VISIT(traverse_module_state->__pyx_n_s_distances_copy); + Py_VISIT(traverse_module_state->__pyx_n_s_distvec); + Py_VISIT(traverse_module_state->__pyx_n_s_doc); + Py_VISIT(traverse_module_state->__pyx_n_s_dot); + Py_VISIT(traverse_module_state->__pyx_n_s_dot2); + Py_VISIT(traverse_module_state->__pyx_n_s_ds); + Py_VISIT(traverse_module_state->__pyx_n_s_ds1); + Py_VISIT(traverse_module_state->__pyx_n_s_ds1_idx); + Py_VISIT(traverse_module_state->__pyx_n_s_ds2); + Py_VISIT(traverse_module_state->__pyx_n_s_ds2_idx); + Py_VISIT(traverse_module_state->__pyx_n_s_ds3); + Py_VISIT(traverse_module_state->__pyx_n_s_ds4); + Py_VISIT(traverse_module_state->__pyx_n_s_ds5); + Py_VISIT(traverse_module_state->__pyx_n_s_ds_idx); + Py_VISIT(traverse_module_state->__pyx_n_s_dt); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype_is_object); + Py_VISIT(traverse_module_state->__pyx_n_s_dx); + Py_VISIT(traverse_module_state->__pyx_n_s_dx2); + Py_VISIT(traverse_module_state->__pyx_n_s_dy); + Py_VISIT(traverse_module_state->__pyx_n_s_dy2); + Py_VISIT(traverse_module_state->__pyx_n_s_dz); + Py_VISIT(traverse_module_state->__pyx_n_s_dz2); + Py_VISIT(traverse_module_state->__pyx_n_s_emim_h); + Py_VISIT(traverse_module_state->__pyx_n_s_empty); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_energy1); + Py_VISIT(traverse_module_state->__pyx_n_s_energy2); + Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); + Py_VISIT(traverse_module_state->__pyx_n_s_error); + Py_VISIT(traverse_module_state->__pyx_n_s_f1); + Py_VISIT(traverse_module_state->__pyx_n_s_f2); + Py_VISIT(traverse_module_state->__pyx_n_s_f2c); + Py_VISIT(traverse_module_state->__pyx_n_s_flags); + Py_VISIT(traverse_module_state->__pyx_n_s_float64); + Py_VISIT(traverse_module_state->__pyx_n_s_format); + Py_VISIT(traverse_module_state->__pyx_n_s_fortran); + Py_VISIT(traverse_module_state->__pyx_n_u_fortran); + Py_VISIT(traverse_module_state->__pyx_n_s_frame); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_getBestIndex); + Py_VISIT(traverse_module_state->__pyx_n_s_getBestIndices); + Py_VISIT(traverse_module_state->__pyx_n_s_getBondTable); + Py_VISIT(traverse_module_state->__pyx_n_s_getPolarizabilityMatrix); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_kp_u_got); + Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_hbond); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_max); + Py_VISIT(traverse_module_state->__pyx_n_s_histo_min); + Py_VISIT(traverse_module_state->__pyx_n_s_histogram); + Py_VISIT(traverse_module_state->__pyx_n_s_histograms); + Py_VISIT(traverse_module_state->__pyx_n_s_i); + Py_VISIT(traverse_module_state->__pyx_n_s_id); + Py_VISIT(traverse_module_state->__pyx_n_s_idx); + Py_VISIT(traverse_module_state->__pyx_n_s_idx2); + Py_VISIT(traverse_module_state->__pyx_n_s_idx3); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_index); + Py_VISIT(traverse_module_state->__pyx_n_s_init); + Py_VISIT(traverse_module_state->__pyx_n_s_init_subclass); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_int); + Py_VISIT(traverse_module_state->__pyx_n_s_int32); + Py_VISIT(traverse_module_state->__pyx_n_s_inv_atom_polarizabilities); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_itemsize); + Py_VISIT(traverse_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_VISIT(traverse_module_state->__pyx_n_s_j); + Py_VISIT(traverse_module_state->__pyx_n_s_k); + Py_VISIT(traverse_module_state->__pyx_n_s_kind); + Py_VISIT(traverse_module_state->__pyx_n_s_kronecker); + Py_VISIT(traverse_module_state->__pyx_n_s_l); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_matrix); + Py_VISIT(traverse_module_state->__pyx_n_s_max_distance); + Py_VISIT(traverse_module_state->__pyx_n_s_maxdist); + Py_VISIT(traverse_module_state->__pyx_n_s_maxdt); + Py_VISIT(traverse_module_state->__pyx_n_s_maxshell); + Py_VISIT(traverse_module_state->__pyx_n_s_maxshell1); + Py_VISIT(traverse_module_state->__pyx_n_s_maxshell2); + Py_VISIT(traverse_module_state->__pyx_n_s_mdcage_timeseries); + Py_VISIT(traverse_module_state->__pyx_n_s_mdcage_ts); + Py_VISIT(traverse_module_state->__pyx_n_s_memview); + Py_VISIT(traverse_module_state->__pyx_n_s_mergesort); + Py_VISIT(traverse_module_state->__pyx_n_s_metaclass); + Py_VISIT(traverse_module_state->__pyx_n_s_minDistTesselation); + Py_VISIT(traverse_module_state->__pyx_n_s_min_dist); + Py_VISIT(traverse_module_state->__pyx_n_s_mode); + Py_VISIT(traverse_module_state->__pyx_n_s_module); + Py_VISIT(traverse_module_state->__pyx_n_s_mol); + Py_VISIT(traverse_module_state->__pyx_n_s_multiVecShellCorrelate); + Py_VISIT(traverse_module_state->__pyx_n_s_multiVecVennShellCorrelate); + Py_VISIT(traverse_module_state->__pyx_n_s_n); + Py_VISIT(traverse_module_state->__pyx_n_s_n_atoms); + Py_VISIT(traverse_module_state->__pyx_n_s_n_aufpunkte); + Py_VISIT(traverse_module_state->__pyx_n_s_n_frames); + Py_VISIT(traverse_module_state->__pyx_n_s_n_ind_particles); + Py_VISIT(traverse_module_state->__pyx_n_s_n_iterations); + Py_VISIT(traverse_module_state->__pyx_n_s_n_pairs_h); + Py_VISIT(traverse_module_state->__pyx_n_s_n_particle_core); + Py_VISIT(traverse_module_state->__pyx_n_s_n_particle_surround); + Py_VISIT(traverse_module_state->__pyx_n_s_n_particles); + Py_VISIT(traverse_module_state->__pyx_n_s_n_particles1); + Py_VISIT(traverse_module_state->__pyx_n_s_n_particles2); + Py_VISIT(traverse_module_state->__pyx_n_s_n_particles_all); + Py_VISIT(traverse_module_state->__pyx_n_s_n_particles_ind); + Py_VISIT(traverse_module_state->__pyx_n_s_n_particles_tot); + Py_VISIT(traverse_module_state->__pyx_n_s_n_res_emim); + Py_VISIT(traverse_module_state->__pyx_n_s_n_self_pairs_h); + Py_VISIT(traverse_module_state->__pyx_n_s_n_shells); + Py_VISIT(traverse_module_state->__pyx_n_s_n_shells1); + Py_VISIT(traverse_module_state->__pyx_n_s_n_shells2); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_name_2); + Py_VISIT(traverse_module_state->__pyx_n_s_ndim); + Py_VISIT(traverse_module_state->__pyx_n_s_new); + Py_VISIT(traverse_module_state->__pyx_n_s_new_2); + Py_VISIT(traverse_module_state->__pyx_kp_s_newanalysis_helpers_miscellaneou); + Py_VISIT(traverse_module_state->__pyx_n_s_newanalysis_miscellaneous); + Py_VISIT(traverse_module_state->__pyx_n_s_nmol); + Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_VISIT(traverse_module_state->__pyx_n_s_noe_task); + Py_VISIT(traverse_module_state->__pyx_n_s_noe_task___init); + Py_VISIT(traverse_module_state->__pyx_n_s_noe_task_pairiter); + Py_VISIT(traverse_module_state->__pyx_n_s_norm); + Py_VISIT(traverse_module_state->__pyx_n_s_np); + Py_VISIT(traverse_module_state->__pyx_n_s_nres_surr); + Py_VISIT(traverse_module_state->__pyx_n_s_nres_wat); + Py_VISIT(traverse_module_state->__pyx_n_s_nshells); + Py_VISIT(traverse_module_state->__pyx_n_s_nshells1); + Py_VISIT(traverse_module_state->__pyx_n_s_nshells2); + Py_VISIT(traverse_module_state->__pyx_n_s_nsurr); + Py_VISIT(traverse_module_state->__pyx_n_s_number_aufpunkte); + Py_VISIT(traverse_module_state->__pyx_n_s_number_of_datapoints); + Py_VISIT(traverse_module_state->__pyx_n_s_number_of_frames); + Py_VISIT(traverse_module_state->__pyx_n_s_number_of_frames1); + Py_VISIT(traverse_module_state->__pyx_n_s_number_of_frames2); + Py_VISIT(traverse_module_state->__pyx_n_s_number_of_particles); + Py_VISIT(traverse_module_state->__pyx_n_s_number_of_shells); + Py_VISIT(traverse_module_state->__pyx_n_s_number_of_shells1); + Py_VISIT(traverse_module_state->__pyx_n_s_number_of_shells2); + Py_VISIT(traverse_module_state->__pyx_n_s_number_of_startingpoints); + Py_VISIT(traverse_module_state->__pyx_n_s_numpy); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_VISIT(traverse_module_state->__pyx_n_s_nwat); + Py_VISIT(traverse_module_state->__pyx_n_s_obj); + Py_VISIT(traverse_module_state->__pyx_n_s_order); + Py_VISIT(traverse_module_state->__pyx_n_s_p); + Py_VISIT(traverse_module_state->__pyx_n_s_p1); + Py_VISIT(traverse_module_state->__pyx_n_s_p1_coor); + Py_VISIT(traverse_module_state->__pyx_n_s_p1l); + Py_VISIT(traverse_module_state->__pyx_n_s_p2); + Py_VISIT(traverse_module_state->__pyx_n_s_p2_coor); + Py_VISIT(traverse_module_state->__pyx_n_s_p2l); + Py_VISIT(traverse_module_state->__pyx_n_s_p_coor); + Py_VISIT(traverse_module_state->__pyx_n_s_pack); + Py_VISIT(traverse_module_state->__pyx_n_s_pair); + Py_VISIT(traverse_module_state->__pyx_n_s_pair_1_par_1); + Py_VISIT(traverse_module_state->__pyx_n_s_pair_1_par_2); + Py_VISIT(traverse_module_state->__pyx_n_s_pair_2_par_1); + Py_VISIT(traverse_module_state->__pyx_n_s_pair_2_par_2); + Py_VISIT(traverse_module_state->__pyx_n_s_pairiter); + Py_VISIT(traverse_module_state->__pyx_n_s_pairlist); + Py_VISIT(traverse_module_state->__pyx_n_s_pairobject); + Py_VISIT(traverse_module_state->__pyx_n_s_pairobject___init); + Py_VISIT(traverse_module_state->__pyx_n_s_particle); + Py_VISIT(traverse_module_state->__pyx_n_s_particle1); + Py_VISIT(traverse_module_state->__pyx_n_s_particle2); + Py_VISIT(traverse_module_state->__pyx_n_s_particle_first); + Py_VISIT(traverse_module_state->__pyx_n_s_particles); + Py_VISIT(traverse_module_state->__pyx_n_s_pickle); + Py_VISIT(traverse_module_state->__pyx_n_s_pl); + Py_VISIT(traverse_module_state->__pyx_n_s_point); + Py_VISIT(traverse_module_state->__pyx_n_s_point1); + Py_VISIT(traverse_module_state->__pyx_n_s_point2); + Py_VISIT(traverse_module_state->__pyx_n_s_prepare); + Py_VISIT(traverse_module_state->__pyx_n_s_prev_atomic_dipoles); + Py_VISIT(traverse_module_state->__pyx_n_s_print); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); + Py_VISIT(traverse_module_state->__pyx_n_s_qualname); + Py_VISIT(traverse_module_state->__pyx_n_s_r2); + Py_VISIT(traverse_module_state->__pyx_n_s_r_0); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_ref); + Py_VISIT(traverse_module_state->__pyx_n_s_register); + Py_VISIT(traverse_module_state->__pyx_n_s_res); + Py_VISIT(traverse_module_state->__pyx_n_s_res1); + Py_VISIT(traverse_module_state->__pyx_n_s_res2); + Py_VISIT(traverse_module_state->__pyx_n_s_result); + Py_VISIT(traverse_module_state->__pyx_n_s_results); + Py_VISIT(traverse_module_state->__pyx_n_s_return); + Py_VISIT(traverse_module_state->__pyx_n_s_rotTs); + Py_VISIT(traverse_module_state->__pyx_n_s_rotationMatrixMultiShellCorrelat); + Py_VISIT(traverse_module_state->__pyx_n_s_rotationMatrixVennShellCorrelate); + Py_VISIT(traverse_module_state->__pyx_n_s_run); + Py_VISIT(traverse_module_state->__pyx_n_s_rv); + Py_VISIT(traverse_module_state->__pyx_n_s_segments_per_angstroem); + Py_VISIT(traverse_module_state->__pyx_n_s_segments_per_pi); + Py_VISIT(traverse_module_state->__pyx_n_s_segs); + Py_VISIT(traverse_module_state->__pyx_n_s_segs_per_angstroem); + Py_VISIT(traverse_module_state->__pyx_n_s_self); + Py_VISIT(traverse_module_state->__pyx_kp_s_self_too_sparse); + Py_VISIT(traverse_module_state->__pyx_n_s_selfcorr); + Py_VISIT(traverse_module_state->__pyx_n_s_selfctr); + Py_VISIT(traverse_module_state->__pyx_n_s_selflist); + Py_VISIT(traverse_module_state->__pyx_n_s_selfobj); + Py_VISIT(traverse_module_state->__pyx_n_s_selfobject); + Py_VISIT(traverse_module_state->__pyx_n_s_selfobject___init); + Py_VISIT(traverse_module_state->__pyx_n_s_set_name); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_shape); + Py_VISIT(traverse_module_state->__pyx_n_s_shell); + Py_VISIT(traverse_module_state->__pyx_n_s_shell1); + Py_VISIT(traverse_module_state->__pyx_n_s_shell2); + Py_VISIT(traverse_module_state->__pyx_n_s_shell3); + Py_VISIT(traverse_module_state->__pyx_n_s_shell4); + Py_VISIT(traverse_module_state->__pyx_n_s_shell5); + Py_VISIT(traverse_module_state->__pyx_n_s_shellHistograms); + Py_VISIT(traverse_module_state->__pyx_n_s_shell_01); + Py_VISIT(traverse_module_state->__pyx_n_s_shell_02); + Py_VISIT(traverse_module_state->__pyx_n_s_shell_03); + Py_VISIT(traverse_module_state->__pyx_n_s_shell_04); + Py_VISIT(traverse_module_state->__pyx_n_s_shell_05); + Py_VISIT(traverse_module_state->__pyx_n_s_shelldt); + Py_VISIT(traverse_module_state->__pyx_n_s_shelldt1); + Py_VISIT(traverse_module_state->__pyx_n_s_shelldt2); + Py_VISIT(traverse_module_state->__pyx_n_s_shells); + Py_VISIT(traverse_module_state->__pyx_n_s_shellstart); + Py_VISIT(traverse_module_state->__pyx_n_s_shellstart1); + Py_VISIT(traverse_module_state->__pyx_n_s_shellstart2); + Py_VISIT(traverse_module_state->__pyx_n_s_sign); + Py_VISIT(traverse_module_state->__pyx_n_s_sites_per_res); + Py_VISIT(traverse_module_state->__pyx_n_s_size); + Py_VISIT(traverse_module_state->__pyx_n_s_sort); + Py_VISIT(traverse_module_state->__pyx_n_s_sortCollectiveDipNNShells); + Py_VISIT(traverse_module_state->__pyx_n_s_sortCollectiveDipNNShellsInt); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_sqrt); + Py_VISIT(traverse_module_state->__pyx_n_s_start); + Py_VISIT(traverse_module_state->__pyx_n_s_startingpoints); + Py_VISIT(traverse_module_state->__pyx_n_s_startskip); + Py_VISIT(traverse_module_state->__pyx_n_s_step); + Py_VISIT(traverse_module_state->__pyx_n_s_stop); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_struct); + Py_VISIT(traverse_module_state->__pyx_n_s_structureFactorCharge); + Py_VISIT(traverse_module_state->__pyx_n_s_structureFactorDipTen); + Py_VISIT(traverse_module_state->__pyx_n_s_sub_correlation); + Py_VISIT(traverse_module_state->__pyx_n_s_sumMultiMDCageSingle); + Py_VISIT(traverse_module_state->__pyx_n_s_sumUpByShell); + Py_VISIT(traverse_module_state->__pyx_n_s_sumVennMDCageSingle); + Py_VISIT(traverse_module_state->__pyx_n_s_super); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_t1); + Py_VISIT(traverse_module_state->__pyx_n_s_t2); + Py_VISIT(traverse_module_state->__pyx_n_s_t3); + Py_VISIT(traverse_module_state->__pyx_n_s_t4); + Py_VISIT(traverse_module_state->__pyx_n_s_t5); + Py_VISIT(traverse_module_state->__pyx_n_s_t6); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_testParallelism); + Py_VISIT(traverse_module_state->__pyx_n_s_timeseries); + Py_VISIT(traverse_module_state->__pyx_n_s_timeseries1); + Py_VISIT(traverse_module_state->__pyx_n_s_timeseries2); + Py_VISIT(traverse_module_state->__pyx_n_s_timeseries_shellwise); + Py_VISIT(traverse_module_state->__pyx_kp_s_tot_too_sparse); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_VISIT(traverse_module_state->__pyx_n_s_unfold); + Py_VISIT(traverse_module_state->__pyx_n_s_unpack); + Py_VISIT(traverse_module_state->__pyx_n_s_update); + Py_VISIT(traverse_module_state->__pyx_n_s_vanHoveMultiVector); + Py_VISIT(traverse_module_state->__pyx_n_s_vanHoveSingleVector); + Py_VISIT(traverse_module_state->__pyx_n_s_vec); + Py_VISIT(traverse_module_state->__pyx_n_s_vel_ind); + Py_VISIT(traverse_module_state->__pyx_n_s_version_info); + Py_VISIT(traverse_module_state->__pyx_n_s_w); + Py_VISIT(traverse_module_state->__pyx_n_s_wat); + Py_VISIT(traverse_module_state->__pyx_n_s_writeKirkwoodHistogram); + Py_VISIT(traverse_module_state->__pyx_n_s_writeKirkwoodHistogram2D); + Py_VISIT(traverse_module_state->__pyx_n_s_writeKirkwoodHistogramShellwise); + Py_VISIT(traverse_module_state->__pyx_n_s_writeMrHistogram); + Py_VISIT(traverse_module_state->__pyx_n_s_x); + Py_VISIT(traverse_module_state->__pyx_n_s_zeros); + Py_VISIT(traverse_module_state->__pyx_float__5); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_2); + Py_VISIT(traverse_module_state->__pyx_int_3); + Py_VISIT(traverse_module_state->__pyx_int_4); + Py_VISIT(traverse_module_state->__pyx_int_5); + Py_VISIT(traverse_module_state->__pyx_int_6); + Py_VISIT(traverse_module_state->__pyx_int_12); + Py_VISIT(traverse_module_state->__pyx_int_112105877); + Py_VISIT(traverse_module_state->__pyx_int_136983863); + Py_VISIT(traverse_module_state->__pyx_int_184977713); + Py_VISIT(traverse_module_state->__pyx_int_neg_1); + Py_VISIT(traverse_module_state->__pyx_slice__5); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_tuple__9); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__14); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__16); + Py_VISIT(traverse_module_state->__pyx_tuple__17); + Py_VISIT(traverse_module_state->__pyx_tuple__18); + Py_VISIT(traverse_module_state->__pyx_tuple__19); + Py_VISIT(traverse_module_state->__pyx_tuple__20); + Py_VISIT(traverse_module_state->__pyx_tuple__21); + Py_VISIT(traverse_module_state->__pyx_tuple__22); + Py_VISIT(traverse_module_state->__pyx_tuple__23); + Py_VISIT(traverse_module_state->__pyx_tuple__24); + Py_VISIT(traverse_module_state->__pyx_tuple__25); + Py_VISIT(traverse_module_state->__pyx_tuple__26); + Py_VISIT(traverse_module_state->__pyx_tuple__27); + Py_VISIT(traverse_module_state->__pyx_tuple__29); + Py_VISIT(traverse_module_state->__pyx_tuple__31); + Py_VISIT(traverse_module_state->__pyx_tuple__33); + Py_VISIT(traverse_module_state->__pyx_tuple__35); + Py_VISIT(traverse_module_state->__pyx_tuple__37); + Py_VISIT(traverse_module_state->__pyx_tuple__39); + Py_VISIT(traverse_module_state->__pyx_tuple__41); + Py_VISIT(traverse_module_state->__pyx_tuple__43); + Py_VISIT(traverse_module_state->__pyx_tuple__45); + Py_VISIT(traverse_module_state->__pyx_tuple__47); + Py_VISIT(traverse_module_state->__pyx_tuple__49); + Py_VISIT(traverse_module_state->__pyx_tuple__51); + Py_VISIT(traverse_module_state->__pyx_tuple__53); + Py_VISIT(traverse_module_state->__pyx_tuple__55); + Py_VISIT(traverse_module_state->__pyx_tuple__57); + Py_VISIT(traverse_module_state->__pyx_tuple__59); + Py_VISIT(traverse_module_state->__pyx_tuple__61); + Py_VISIT(traverse_module_state->__pyx_tuple__63); + Py_VISIT(traverse_module_state->__pyx_tuple__65); + Py_VISIT(traverse_module_state->__pyx_tuple__67); + Py_VISIT(traverse_module_state->__pyx_tuple__69); + Py_VISIT(traverse_module_state->__pyx_tuple__71); + Py_VISIT(traverse_module_state->__pyx_tuple__73); + Py_VISIT(traverse_module_state->__pyx_tuple__75); + Py_VISIT(traverse_module_state->__pyx_tuple__77); + Py_VISIT(traverse_module_state->__pyx_tuple__79); + Py_VISIT(traverse_module_state->__pyx_tuple__81); + Py_VISIT(traverse_module_state->__pyx_tuple__83); + Py_VISIT(traverse_module_state->__pyx_tuple__85); + Py_VISIT(traverse_module_state->__pyx_tuple__87); + Py_VISIT(traverse_module_state->__pyx_tuple__89); + Py_VISIT(traverse_module_state->__pyx_tuple__91); + Py_VISIT(traverse_module_state->__pyx_tuple__93); + Py_VISIT(traverse_module_state->__pyx_tuple__95); + Py_VISIT(traverse_module_state->__pyx_tuple__97); + Py_VISIT(traverse_module_state->__pyx_tuple__99); + Py_VISIT(traverse_module_state->__pyx_tuple__101); + Py_VISIT(traverse_module_state->__pyx_tuple__103); + Py_VISIT(traverse_module_state->__pyx_tuple__105); + Py_VISIT(traverse_module_state->__pyx_tuple__107); + Py_VISIT(traverse_module_state->__pyx_tuple__109); + Py_VISIT(traverse_module_state->__pyx_tuple__111); + Py_VISIT(traverse_module_state->__pyx_tuple__113); + Py_VISIT(traverse_module_state->__pyx_tuple__115); + Py_VISIT(traverse_module_state->__pyx_tuple__117); + Py_VISIT(traverse_module_state->__pyx_tuple__119); + Py_VISIT(traverse_module_state->__pyx_tuple__121); + Py_VISIT(traverse_module_state->__pyx_tuple__123); + Py_VISIT(traverse_module_state->__pyx_tuple__125); + Py_VISIT(traverse_module_state->__pyx_tuple__128); + Py_VISIT(traverse_module_state->__pyx_tuple__130); + Py_VISIT(traverse_module_state->__pyx_tuple__132); + Py_VISIT(traverse_module_state->__pyx_tuple__134); + Py_VISIT(traverse_module_state->__pyx_tuple__136); + Py_VISIT(traverse_module_state->__pyx_tuple__138); + Py_VISIT(traverse_module_state->__pyx_tuple__141); + Py_VISIT(traverse_module_state->__pyx_tuple__143); + Py_VISIT(traverse_module_state->__pyx_tuple__145); + Py_VISIT(traverse_module_state->__pyx_tuple__147); + Py_VISIT(traverse_module_state->__pyx_tuple__149); + Py_VISIT(traverse_module_state->__pyx_tuple__151); + Py_VISIT(traverse_module_state->__pyx_tuple__153); + Py_VISIT(traverse_module_state->__pyx_codeobj__28); + Py_VISIT(traverse_module_state->__pyx_codeobj__30); + Py_VISIT(traverse_module_state->__pyx_codeobj__32); + Py_VISIT(traverse_module_state->__pyx_codeobj__34); + Py_VISIT(traverse_module_state->__pyx_codeobj__36); + Py_VISIT(traverse_module_state->__pyx_codeobj__38); + Py_VISIT(traverse_module_state->__pyx_codeobj__40); + Py_VISIT(traverse_module_state->__pyx_codeobj__42); + Py_VISIT(traverse_module_state->__pyx_codeobj__44); + Py_VISIT(traverse_module_state->__pyx_codeobj__46); + Py_VISIT(traverse_module_state->__pyx_codeobj__48); + Py_VISIT(traverse_module_state->__pyx_codeobj__50); + Py_VISIT(traverse_module_state->__pyx_codeobj__52); + Py_VISIT(traverse_module_state->__pyx_codeobj__54); + Py_VISIT(traverse_module_state->__pyx_codeobj__56); + Py_VISIT(traverse_module_state->__pyx_codeobj__58); + Py_VISIT(traverse_module_state->__pyx_codeobj__60); + Py_VISIT(traverse_module_state->__pyx_codeobj__62); + Py_VISIT(traverse_module_state->__pyx_codeobj__64); + Py_VISIT(traverse_module_state->__pyx_codeobj__66); + Py_VISIT(traverse_module_state->__pyx_codeobj__68); + Py_VISIT(traverse_module_state->__pyx_codeobj__70); + Py_VISIT(traverse_module_state->__pyx_codeobj__72); + Py_VISIT(traverse_module_state->__pyx_codeobj__74); + Py_VISIT(traverse_module_state->__pyx_codeobj__76); + Py_VISIT(traverse_module_state->__pyx_codeobj__78); + Py_VISIT(traverse_module_state->__pyx_codeobj__80); + Py_VISIT(traverse_module_state->__pyx_codeobj__82); + Py_VISIT(traverse_module_state->__pyx_codeobj__84); + Py_VISIT(traverse_module_state->__pyx_codeobj__86); + Py_VISIT(traverse_module_state->__pyx_codeobj__88); + Py_VISIT(traverse_module_state->__pyx_codeobj__90); + Py_VISIT(traverse_module_state->__pyx_codeobj__92); + Py_VISIT(traverse_module_state->__pyx_codeobj__94); + Py_VISIT(traverse_module_state->__pyx_codeobj__96); + Py_VISIT(traverse_module_state->__pyx_codeobj__98); + Py_VISIT(traverse_module_state->__pyx_codeobj__100); + Py_VISIT(traverse_module_state->__pyx_codeobj__102); + Py_VISIT(traverse_module_state->__pyx_codeobj__104); + Py_VISIT(traverse_module_state->__pyx_codeobj__106); + Py_VISIT(traverse_module_state->__pyx_codeobj__108); + Py_VISIT(traverse_module_state->__pyx_codeobj__110); + Py_VISIT(traverse_module_state->__pyx_codeobj__112); + Py_VISIT(traverse_module_state->__pyx_codeobj__114); + Py_VISIT(traverse_module_state->__pyx_codeobj__116); + Py_VISIT(traverse_module_state->__pyx_codeobj__118); + Py_VISIT(traverse_module_state->__pyx_codeobj__120); + Py_VISIT(traverse_module_state->__pyx_codeobj__122); + Py_VISIT(traverse_module_state->__pyx_codeobj__124); + Py_VISIT(traverse_module_state->__pyx_codeobj__126); + Py_VISIT(traverse_module_state->__pyx_codeobj__127); + Py_VISIT(traverse_module_state->__pyx_codeobj__129); + Py_VISIT(traverse_module_state->__pyx_codeobj__131); + Py_VISIT(traverse_module_state->__pyx_codeobj__133); + Py_VISIT(traverse_module_state->__pyx_codeobj__135); + Py_VISIT(traverse_module_state->__pyx_codeobj__137); + Py_VISIT(traverse_module_state->__pyx_codeobj__139); + Py_VISIT(traverse_module_state->__pyx_codeobj__140); + Py_VISIT(traverse_module_state->__pyx_codeobj__142); + Py_VISIT(traverse_module_state->__pyx_codeobj__144); + Py_VISIT(traverse_module_state->__pyx_codeobj__146); + Py_VISIT(traverse_module_state->__pyx_codeobj__148); + Py_VISIT(traverse_module_state->__pyx_codeobj__150); + Py_VISIT(traverse_module_state->__pyx_codeobj__152); + Py_VISIT(traverse_module_state->__pyx_codeobj__154); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_5numpy_dtype __pyx_mstate_global->__pyx_ptype_5numpy_dtype +#define __pyx_ptype_5numpy_flatiter __pyx_mstate_global->__pyx_ptype_5numpy_flatiter +#define __pyx_ptype_5numpy_broadcast __pyx_mstate_global->__pyx_ptype_5numpy_broadcast +#define __pyx_ptype_5numpy_ndarray __pyx_mstate_global->__pyx_ptype_5numpy_ndarray +#define __pyx_ptype_5numpy_generic __pyx_mstate_global->__pyx_ptype_5numpy_generic +#define __pyx_ptype_5numpy_number __pyx_mstate_global->__pyx_ptype_5numpy_number +#define __pyx_ptype_5numpy_integer __pyx_mstate_global->__pyx_ptype_5numpy_integer +#define __pyx_ptype_5numpy_signedinteger __pyx_mstate_global->__pyx_ptype_5numpy_signedinteger +#define __pyx_ptype_5numpy_unsignedinteger __pyx_mstate_global->__pyx_ptype_5numpy_unsignedinteger +#define __pyx_ptype_5numpy_inexact __pyx_mstate_global->__pyx_ptype_5numpy_inexact +#define __pyx_ptype_5numpy_floating __pyx_mstate_global->__pyx_ptype_5numpy_floating +#define __pyx_ptype_5numpy_complexfloating __pyx_mstate_global->__pyx_ptype_5numpy_complexfloating +#define __pyx_ptype_5numpy_flexible __pyx_mstate_global->__pyx_ptype_5numpy_flexible +#define __pyx_ptype_5numpy_character __pyx_mstate_global->__pyx_ptype_5numpy_character +#define __pyx_ptype_5numpy_ufunc __pyx_mstate_global->__pyx_ptype_5numpy_ufunc +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type___pyx_array __pyx_mstate_global->__pyx_type___pyx_array +#define __pyx_type___pyx_MemviewEnum __pyx_mstate_global->__pyx_type___pyx_MemviewEnum +#define __pyx_type___pyx_memoryview __pyx_mstate_global->__pyx_type___pyx_memoryview +#define __pyx_type___pyx_memoryviewslice __pyx_mstate_global->__pyx_type___pyx_memoryviewslice +#endif +#define __pyx_array_type __pyx_mstate_global->__pyx_array_type +#define __pyx_MemviewEnum_type __pyx_mstate_global->__pyx_MemviewEnum_type +#define __pyx_memoryview_type __pyx_mstate_global->__pyx_memoryview_type +#define __pyx_memoryviewslice_type __pyx_mstate_global->__pyx_memoryviewslice_type +#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_n_s_ASCII __pyx_mstate_global->__pyx_n_s_ASCII +#define __pyx_kp_s_All_dimensions_preceding_dimensi __pyx_mstate_global->__pyx_kp_s_All_dimensions_preceding_dimensi +#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError +#define __pyx_kp_s_Buffer_view_does_not_expose_stri __pyx_mstate_global->__pyx_kp_s_Buffer_view_does_not_expose_stri +#define __pyx_kp_s_Can_only_create_a_buffer_that_is __pyx_mstate_global->__pyx_kp_s_Can_only_create_a_buffer_that_is +#define __pyx_kp_s_Cannot_assign_to_read_only_memor __pyx_mstate_global->__pyx_kp_s_Cannot_assign_to_read_only_memor +#define __pyx_kp_s_Cannot_create_writable_memory_vi __pyx_mstate_global->__pyx_kp_s_Cannot_create_writable_memory_vi +#define __pyx_kp_u_Cannot_index_with_type __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type +#define __pyx_kp_s_Cannot_transpose_memoryview_with __pyx_mstate_global->__pyx_kp_s_Cannot_transpose_memoryview_with +#define __pyx_kp_s_Correlation_length_must_not_be_l __pyx_mstate_global->__pyx_kp_s_Correlation_length_must_not_be_l +#define __pyx_n_s_D __pyx_mstate_global->__pyx_n_s_D +#define __pyx_n_s_D_x __pyx_mstate_global->__pyx_n_s_D_x +#define __pyx_n_s_D_y __pyx_mstate_global->__pyx_n_s_D_y +#define __pyx_n_s_D_z __pyx_mstate_global->__pyx_n_s_D_z +#define __pyx_kp_s_Dimension_d_is_not_direct __pyx_mstate_global->__pyx_kp_s_Dimension_d_is_not_direct +#define __pyx_n_s_Ellipsis __pyx_mstate_global->__pyx_n_s_Ellipsis +#define __pyx_kp_s_Empty_shape_tuple_for_cython_arr __pyx_mstate_global->__pyx_kp_s_Empty_shape_tuple_for_cython_arr +#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError +#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 +#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError +#define __pyx_kp_s_Index_out_of_bounds_axis_d __pyx_mstate_global->__pyx_kp_s_Index_out_of_bounds_axis_d +#define __pyx_kp_s_Indirect_dimensions_not_supporte __pyx_mstate_global->__pyx_kp_s_Indirect_dimensions_not_supporte +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis +#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError +#define __pyx_kp_s_MemoryView_of_r_at_0x_x __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_at_0x_x +#define __pyx_kp_s_MemoryView_of_r_object __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_object +#define __pyx_kp_s_Number_of_starting_points_too_hi __pyx_mstate_global->__pyx_kp_s_Number_of_starting_points_too_hi +#define __pyx_n_b_O __pyx_mstate_global->__pyx_n_b_O +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a +#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError +#define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence +#define __pyx_kp_s_Step_may_not_be_zero_axis_d __pyx_mstate_global->__pyx_kp_s_Step_may_not_be_zero_axis_d +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_kp_s_Unable_to_convert_item_to_object __pyx_mstate_global->__pyx_kp_s_Unable_to_convert_item_to_object +#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError +#define __pyx_n_s_View_MemoryView __pyx_mstate_global->__pyx_n_s_View_MemoryView +#define __pyx_kp_s_Warning_number_of_frames_correla __pyx_mstate_global->__pyx_kp_s_Warning_number_of_frames_correla +#define __pyx_n_s__155 __pyx_mstate_global->__pyx_n_s__155 +#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 +#define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3 +#define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6 +#define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7 +#define __pyx_n_s_a __pyx_mstate_global->__pyx_n_s_a +#define __pyx_n_s_abc __pyx_mstate_global->__pyx_n_s_abc +#define __pyx_n_s_accumulateNMShellwiseGFunction __pyx_mstate_global->__pyx_n_s_accumulateNMShellwiseGFunction +#define __pyx_n_s_accumulateShellwiseGFunction __pyx_mstate_global->__pyx_n_s_accumulateShellwiseGFunction +#define __pyx_n_s_allocate_buffer __pyx_mstate_global->__pyx_n_s_allocate_buffer +#define __pyx_n_s_alpha __pyx_mstate_global->__pyx_n_s_alpha +#define __pyx_kp_u_and __pyx_mstate_global->__pyx_kp_u_and +#define __pyx_n_s_antagonist __pyx_mstate_global->__pyx_n_s_antagonist +#define __pyx_n_s_append __pyx_mstate_global->__pyx_n_s_append +#define __pyx_n_s_apr_emim_h __pyx_mstate_global->__pyx_n_s_apr_emim_h +#define __pyx_n_s_apr_pair __pyx_mstate_global->__pyx_n_s_apr_pair +#define __pyx_n_s_asarray __pyx_mstate_global->__pyx_n_s_asarray +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_atom __pyx_mstate_global->__pyx_n_s_atom +#define __pyx_n_s_atomicIndDip __pyx_mstate_global->__pyx_n_s_atomicIndDip +#define __pyx_n_s_atomicIndDipPerAtom __pyx_mstate_global->__pyx_n_s_atomicIndDipPerAtom +#define __pyx_n_s_atomic_dipoles __pyx_mstate_global->__pyx_n_s_atomic_dipoles +#define __pyx_n_s_aufpunkt __pyx_mstate_global->__pyx_n_s_aufpunkt +#define __pyx_n_s_aufpunkt_dipol __pyx_mstate_global->__pyx_n_s_aufpunkt_dipol +#define __pyx_n_s_aufpunkt_dipole __pyx_mstate_global->__pyx_n_s_aufpunkt_dipole +#define __pyx_n_s_aufpunkte __pyx_mstate_global->__pyx_n_s_aufpunkte +#define __pyx_n_s_b __pyx_mstate_global->__pyx_n_s_b +#define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base +#define __pyx_n_s_best_index __pyx_mstate_global->__pyx_n_s_best_index +#define __pyx_n_s_bin __pyx_mstate_global->__pyx_n_s_bin +#define __pyx_n_s_bin1 __pyx_mstate_global->__pyx_n_s_bin1 +#define __pyx_n_s_bin2 __pyx_mstate_global->__pyx_n_s_bin2 +#define __pyx_n_s_bin_dist __pyx_mstate_global->__pyx_n_s_bin_dist +#define __pyx_n_s_bin_width __pyx_mstate_global->__pyx_n_s_bin_width +#define __pyx_n_s_bins __pyx_mstate_global->__pyx_n_s_bins +#define __pyx_n_s_binwidth __pyx_mstate_global->__pyx_n_s_binwidth +#define __pyx_n_s_blen2 __pyx_mstate_global->__pyx_n_s_blen2 +#define __pyx_n_s_bond_table __pyx_mstate_global->__pyx_n_s_bond_table +#define __pyx_n_s_both_directions __pyx_mstate_global->__pyx_n_s_both_directions +#define __pyx_n_s_boxl __pyx_mstate_global->__pyx_n_s_boxl +#define __pyx_n_s_boxlength __pyx_mstate_global->__pyx_n_s_boxlength +#define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c +#define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c +#define __pyx_n_s_calcDipTenCollective __pyx_mstate_global->__pyx_n_s_calcDipTenCollective +#define __pyx_n_s_calcDipTenCollective1NShellwiseC __pyx_mstate_global->__pyx_n_s_calcDipTenCollective1NShellwiseC +#define __pyx_n_s_calcDipTenCollective1NShellwiseS __pyx_mstate_global->__pyx_n_s_calcDipTenCollective1NShellwiseS +#define __pyx_n_s_calcDipTenCollectiveCross __pyx_mstate_global->__pyx_n_s_calcDipTenCollectiveCross +#define __pyx_n_s_calcDipTenCollectiveNNShellwise __pyx_mstate_global->__pyx_n_s_calcDipTenCollectiveNNShellwise +#define __pyx_n_s_calcDipTenCollectiveNNShellwiseC __pyx_mstate_global->__pyx_n_s_calcDipTenCollectiveNNShellwiseC +#define __pyx_n_s_calcDipTenCollectiveNNShellwiseS __pyx_mstate_global->__pyx_n_s_calcDipTenCollectiveNNShellwiseS +#define __pyx_n_s_calcDipTenCollectivePerAtom __pyx_mstate_global->__pyx_n_s_calcDipTenCollectivePerAtom +#define __pyx_n_s_calcDipTenCollectiveShellwise __pyx_mstate_global->__pyx_n_s_calcDipTenCollectiveShellwise +#define __pyx_n_s_calcDipTenCollectiveVennShellwis __pyx_mstate_global->__pyx_n_s_calcDipTenCollectiveVennShellwis +#define __pyx_n_s_calcDistanceDelauny __pyx_mstate_global->__pyx_n_s_calcDistanceDelauny +#define __pyx_n_s_calcDistanceDelaunyMindist __pyx_mstate_global->__pyx_n_s_calcDistanceDelaunyMindist +#define __pyx_n_s_cardinality __pyx_mstate_global->__pyx_n_s_cardinality +#define __pyx_n_s_charges __pyx_mstate_global->__pyx_n_s_charges +#define __pyx_n_s_cl __pyx_mstate_global->__pyx_n_s_cl +#define __pyx_n_s_cl_self __pyx_mstate_global->__pyx_n_s_cl_self +#define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class +#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_closest_shell __pyx_mstate_global->__pyx_n_s_closest_shell +#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections +#define __pyx_kp_s_collections_abc __pyx_mstate_global->__pyx_kp_s_collections_abc +#define __pyx_n_s_collectiveDipolesCutoff __pyx_mstate_global->__pyx_n_s_collectiveDipolesCutoff +#define __pyx_kp_s_contiguous_and_direct __pyx_mstate_global->__pyx_kp_s_contiguous_and_direct +#define __pyx_kp_s_contiguous_and_indirect __pyx_mstate_global->__pyx_kp_s_contiguous_and_indirect +#define __pyx_n_s_coo1 __pyx_mstate_global->__pyx_n_s_coo1 +#define __pyx_n_s_coo2 __pyx_mstate_global->__pyx_n_s_coo2 +#define __pyx_n_s_coor __pyx_mstate_global->__pyx_n_s_coor +#define __pyx_n_s_coor1 __pyx_mstate_global->__pyx_n_s_coor1 +#define __pyx_n_s_coor2 __pyx_mstate_global->__pyx_n_s_coor2 +#define __pyx_n_s_coor_core __pyx_mstate_global->__pyx_n_s_coor_core +#define __pyx_n_s_coor_i __pyx_mstate_global->__pyx_n_s_coor_i +#define __pyx_n_s_coor_j __pyx_mstate_global->__pyx_n_s_coor_j +#define __pyx_n_s_coor_oh2 __pyx_mstate_global->__pyx_n_s_coor_oh2 +#define __pyx_n_s_coor_res __pyx_mstate_global->__pyx_n_s_coor_res +#define __pyx_n_s_coor_surr __pyx_mstate_global->__pyx_n_s_coor_surr +#define __pyx_n_s_coor_surround __pyx_mstate_global->__pyx_n_s_coor_surround +#define __pyx_n_s_coors __pyx_mstate_global->__pyx_n_s_coors +#define __pyx_n_s_coors_ind __pyx_mstate_global->__pyx_n_s_coors_ind +#define __pyx_n_s_copy __pyx_mstate_global->__pyx_n_s_copy +#define __pyx_n_s_corr __pyx_mstate_global->__pyx_n_s_corr +#define __pyx_n_s_correlateMultiVector __pyx_mstate_global->__pyx_n_s_correlateMultiVector +#define __pyx_n_s_correlateMultiVectorShellwise __pyx_mstate_global->__pyx_n_s_correlateMultiVectorShellwise +#define __pyx_n_s_correlateMultiVectorVennShellwis __pyx_mstate_global->__pyx_n_s_correlateMultiVectorVennShellwis +#define __pyx_n_s_correlateSingleParticleMuShellwi __pyx_mstate_global->__pyx_n_s_correlateSingleParticleMuShellwi +#define __pyx_n_s_correlateSingleParticleMuVennShe __pyx_mstate_global->__pyx_n_s_correlateSingleParticleMuVennShe +#define __pyx_n_s_correlateSingleVector __pyx_mstate_global->__pyx_n_s_correlateSingleVector +#define __pyx_n_s_correlation_length __pyx_mstate_global->__pyx_n_s_correlation_length +#define __pyx_n_s_cos_angle __pyx_mstate_global->__pyx_n_s_cos_angle +#define __pyx_n_s_cos_segs __pyx_mstate_global->__pyx_n_s_cos_segs +#define __pyx_n_s_cosine __pyx_mstate_global->__pyx_n_s_cosine +#define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count +#define __pyx_n_s_countHBonds __pyx_mstate_global->__pyx_n_s_countHBonds +#define __pyx_n_s_countMultiShell __pyx_mstate_global->__pyx_n_s_countMultiShell +#define __pyx_n_s_countVennShellOccupation __pyx_mstate_global->__pyx_n_s_countVennShellOccupation +#define __pyx_n_s_counter __pyx_mstate_global->__pyx_n_s_counter +#define __pyx_n_s_crossCorrelateMultiVector __pyx_mstate_global->__pyx_n_s_crossCorrelateMultiVector +#define __pyx_n_s_crossCorrelateSingleVector __pyx_mstate_global->__pyx_n_s_crossCorrelateSingleVector +#define __pyx_n_s_crosscorr __pyx_mstate_global->__pyx_n_s_crosscorr +#define __pyx_n_s_crossctr __pyx_mstate_global->__pyx_n_s_crossctr +#define __pyx_n_s_ctr __pyx_mstate_global->__pyx_n_s_ctr +#define __pyx_n_s_cutoff __pyx_mstate_global->__pyx_n_s_cutoff +#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data +#define __pyx_n_s_dataset __pyx_mstate_global->__pyx_n_s_dataset +#define __pyx_n_s_dataset1 __pyx_mstate_global->__pyx_n_s_dataset1 +#define __pyx_n_s_dataset2 __pyx_mstate_global->__pyx_n_s_dataset2 +#define __pyx_n_s_delauny_matrix __pyx_mstate_global->__pyx_n_s_delauny_matrix +#define __pyx_n_s_deriveIndDip __pyx_mstate_global->__pyx_n_s_deriveIndDip +#define __pyx_n_s_deriveIndDipPerAtom __pyx_mstate_global->__pyx_n_s_deriveIndDipPerAtom +#define __pyx_n_s_derived_atomic_dipoles __pyx_mstate_global->__pyx_n_s_derived_atomic_dipoles +#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_n_s_dip __pyx_mstate_global->__pyx_n_s_dip +#define __pyx_n_s_dipTen __pyx_mstate_global->__pyx_n_s_dipTen +#define __pyx_n_s_dip_inside __pyx_mstate_global->__pyx_n_s_dip_inside +#define __pyx_n_s_dip_outside __pyx_mstate_global->__pyx_n_s_dip_outside +#define __pyx_n_s_dip_res __pyx_mstate_global->__pyx_n_s_dip_res +#define __pyx_n_s_dip_shell __pyx_mstate_global->__pyx_n_s_dip_shell +#define __pyx_n_s_dip_wat __pyx_mstate_global->__pyx_n_s_dip_wat +#define __pyx_n_s_dipoles __pyx_mstate_global->__pyx_n_s_dipoles +#define __pyx_n_s_dipt __pyx_mstate_global->__pyx_n_s_dipt +#define __pyx_n_s_dipt_0 __pyx_mstate_global->__pyx_n_s_dipt_0 +#define __pyx_n_s_dipt_0_self __pyx_mstate_global->__pyx_n_s_dipt_0_self +#define __pyx_n_s_dipt_t __pyx_mstate_global->__pyx_n_s_dipt_t +#define __pyx_n_s_dipt_t_self __pyx_mstate_global->__pyx_n_s_dipt_t_self +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_dist __pyx_mstate_global->__pyx_n_s_dist +#define __pyx_n_s_dist1 __pyx_mstate_global->__pyx_n_s_dist1 +#define __pyx_n_s_dist2 __pyx_mstate_global->__pyx_n_s_dist2 +#define __pyx_n_s_dist_2 __pyx_mstate_global->__pyx_n_s_dist_2 +#define __pyx_n_s_dist_3 __pyx_mstate_global->__pyx_n_s_dist_3 +#define __pyx_n_s_dist_sq __pyx_mstate_global->__pyx_n_s_dist_sq +#define __pyx_n_s_distance __pyx_mstate_global->__pyx_n_s_distance +#define __pyx_n_s_distances __pyx_mstate_global->__pyx_n_s_distances +#define __pyx_n_s_distances_copy __pyx_mstate_global->__pyx_n_s_distances_copy +#define __pyx_n_s_distvec __pyx_mstate_global->__pyx_n_s_distvec +#define __pyx_n_s_doc __pyx_mstate_global->__pyx_n_s_doc +#define __pyx_n_s_dot __pyx_mstate_global->__pyx_n_s_dot +#define __pyx_n_s_dot2 __pyx_mstate_global->__pyx_n_s_dot2 +#define __pyx_n_s_ds __pyx_mstate_global->__pyx_n_s_ds +#define __pyx_n_s_ds1 __pyx_mstate_global->__pyx_n_s_ds1 +#define __pyx_n_s_ds1_idx __pyx_mstate_global->__pyx_n_s_ds1_idx +#define __pyx_n_s_ds2 __pyx_mstate_global->__pyx_n_s_ds2 +#define __pyx_n_s_ds2_idx __pyx_mstate_global->__pyx_n_s_ds2_idx +#define __pyx_n_s_ds3 __pyx_mstate_global->__pyx_n_s_ds3 +#define __pyx_n_s_ds4 __pyx_mstate_global->__pyx_n_s_ds4 +#define __pyx_n_s_ds5 __pyx_mstate_global->__pyx_n_s_ds5 +#define __pyx_n_s_ds_idx __pyx_mstate_global->__pyx_n_s_ds_idx +#define __pyx_n_s_dt __pyx_mstate_global->__pyx_n_s_dt +#define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype +#define __pyx_n_s_dtype_is_object __pyx_mstate_global->__pyx_n_s_dtype_is_object +#define __pyx_n_s_dx __pyx_mstate_global->__pyx_n_s_dx +#define __pyx_n_s_dx2 __pyx_mstate_global->__pyx_n_s_dx2 +#define __pyx_n_s_dy __pyx_mstate_global->__pyx_n_s_dy +#define __pyx_n_s_dy2 __pyx_mstate_global->__pyx_n_s_dy2 +#define __pyx_n_s_dz __pyx_mstate_global->__pyx_n_s_dz +#define __pyx_n_s_dz2 __pyx_mstate_global->__pyx_n_s_dz2 +#define __pyx_n_s_emim_h __pyx_mstate_global->__pyx_n_s_emim_h +#define __pyx_n_s_empty __pyx_mstate_global->__pyx_n_s_empty +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_energy1 __pyx_mstate_global->__pyx_n_s_energy1 +#define __pyx_n_s_energy2 __pyx_mstate_global->__pyx_n_s_energy2 +#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate +#define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error +#define __pyx_n_s_f1 __pyx_mstate_global->__pyx_n_s_f1 +#define __pyx_n_s_f2 __pyx_mstate_global->__pyx_n_s_f2 +#define __pyx_n_s_f2c __pyx_mstate_global->__pyx_n_s_f2c +#define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags +#define __pyx_n_s_float64 __pyx_mstate_global->__pyx_n_s_float64 +#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format +#define __pyx_n_s_fortran __pyx_mstate_global->__pyx_n_s_fortran +#define __pyx_n_u_fortran __pyx_mstate_global->__pyx_n_u_fortran +#define __pyx_n_s_frame __pyx_mstate_global->__pyx_n_s_frame +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_getBestIndex __pyx_mstate_global->__pyx_n_s_getBestIndex +#define __pyx_n_s_getBestIndices __pyx_mstate_global->__pyx_n_s_getBestIndices +#define __pyx_n_s_getBondTable __pyx_mstate_global->__pyx_n_s_getBondTable +#define __pyx_n_s_getPolarizabilityMatrix __pyx_mstate_global->__pyx_n_s_getPolarizabilityMatrix +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi +#define __pyx_n_s_hbond __pyx_mstate_global->__pyx_n_s_hbond +#define __pyx_n_s_histo_max __pyx_mstate_global->__pyx_n_s_histo_max +#define __pyx_n_s_histo_min __pyx_mstate_global->__pyx_n_s_histo_min +#define __pyx_n_s_histogram __pyx_mstate_global->__pyx_n_s_histogram +#define __pyx_n_s_histograms __pyx_mstate_global->__pyx_n_s_histograms +#define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i +#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id +#define __pyx_n_s_idx __pyx_mstate_global->__pyx_n_s_idx +#define __pyx_n_s_idx2 __pyx_mstate_global->__pyx_n_s_idx2 +#define __pyx_n_s_idx3 __pyx_mstate_global->__pyx_n_s_idx3 +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index +#define __pyx_n_s_init __pyx_mstate_global->__pyx_n_s_init +#define __pyx_n_s_init_subclass __pyx_mstate_global->__pyx_n_s_init_subclass +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_int __pyx_mstate_global->__pyx_n_s_int +#define __pyx_n_s_int32 __pyx_mstate_global->__pyx_n_s_int32 +#define __pyx_n_s_inv_atom_polarizabilities __pyx_mstate_global->__pyx_n_s_inv_atom_polarizabilities +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_itemsize __pyx_mstate_global->__pyx_n_s_itemsize +#define __pyx_kp_s_itemsize_0_for_cython_array __pyx_mstate_global->__pyx_kp_s_itemsize_0_for_cython_array +#define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j +#define __pyx_n_s_k __pyx_mstate_global->__pyx_n_s_k +#define __pyx_n_s_kind __pyx_mstate_global->__pyx_n_s_kind +#define __pyx_n_s_kronecker __pyx_mstate_global->__pyx_n_s_kronecker +#define __pyx_n_s_l __pyx_mstate_global->__pyx_n_s_l +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_matrix __pyx_mstate_global->__pyx_n_s_matrix +#define __pyx_n_s_max_distance __pyx_mstate_global->__pyx_n_s_max_distance +#define __pyx_n_s_maxdist __pyx_mstate_global->__pyx_n_s_maxdist +#define __pyx_n_s_maxdt __pyx_mstate_global->__pyx_n_s_maxdt +#define __pyx_n_s_maxshell __pyx_mstate_global->__pyx_n_s_maxshell +#define __pyx_n_s_maxshell1 __pyx_mstate_global->__pyx_n_s_maxshell1 +#define __pyx_n_s_maxshell2 __pyx_mstate_global->__pyx_n_s_maxshell2 +#define __pyx_n_s_mdcage_timeseries __pyx_mstate_global->__pyx_n_s_mdcage_timeseries +#define __pyx_n_s_mdcage_ts __pyx_mstate_global->__pyx_n_s_mdcage_ts +#define __pyx_n_s_memview __pyx_mstate_global->__pyx_n_s_memview +#define __pyx_n_s_mergesort __pyx_mstate_global->__pyx_n_s_mergesort +#define __pyx_n_s_metaclass __pyx_mstate_global->__pyx_n_s_metaclass +#define __pyx_n_s_minDistTesselation __pyx_mstate_global->__pyx_n_s_minDistTesselation +#define __pyx_n_s_min_dist __pyx_mstate_global->__pyx_n_s_min_dist +#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode +#define __pyx_n_s_module __pyx_mstate_global->__pyx_n_s_module +#define __pyx_n_s_mol __pyx_mstate_global->__pyx_n_s_mol +#define __pyx_n_s_multiVecShellCorrelate __pyx_mstate_global->__pyx_n_s_multiVecShellCorrelate +#define __pyx_n_s_multiVecVennShellCorrelate __pyx_mstate_global->__pyx_n_s_multiVecVennShellCorrelate +#define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n +#define __pyx_n_s_n_atoms __pyx_mstate_global->__pyx_n_s_n_atoms +#define __pyx_n_s_n_aufpunkte __pyx_mstate_global->__pyx_n_s_n_aufpunkte +#define __pyx_n_s_n_frames __pyx_mstate_global->__pyx_n_s_n_frames +#define __pyx_n_s_n_ind_particles __pyx_mstate_global->__pyx_n_s_n_ind_particles +#define __pyx_n_s_n_iterations __pyx_mstate_global->__pyx_n_s_n_iterations +#define __pyx_n_s_n_pairs_h __pyx_mstate_global->__pyx_n_s_n_pairs_h +#define __pyx_n_s_n_particle_core __pyx_mstate_global->__pyx_n_s_n_particle_core +#define __pyx_n_s_n_particle_surround __pyx_mstate_global->__pyx_n_s_n_particle_surround +#define __pyx_n_s_n_particles __pyx_mstate_global->__pyx_n_s_n_particles +#define __pyx_n_s_n_particles1 __pyx_mstate_global->__pyx_n_s_n_particles1 +#define __pyx_n_s_n_particles2 __pyx_mstate_global->__pyx_n_s_n_particles2 +#define __pyx_n_s_n_particles_all __pyx_mstate_global->__pyx_n_s_n_particles_all +#define __pyx_n_s_n_particles_ind __pyx_mstate_global->__pyx_n_s_n_particles_ind +#define __pyx_n_s_n_particles_tot __pyx_mstate_global->__pyx_n_s_n_particles_tot +#define __pyx_n_s_n_res_emim __pyx_mstate_global->__pyx_n_s_n_res_emim +#define __pyx_n_s_n_self_pairs_h __pyx_mstate_global->__pyx_n_s_n_self_pairs_h +#define __pyx_n_s_n_shells __pyx_mstate_global->__pyx_n_s_n_shells +#define __pyx_n_s_n_shells1 __pyx_mstate_global->__pyx_n_s_n_shells1 +#define __pyx_n_s_n_shells2 __pyx_mstate_global->__pyx_n_s_n_shells2 +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 +#define __pyx_n_s_ndim __pyx_mstate_global->__pyx_n_s_ndim +#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new +#define __pyx_n_s_new_2 __pyx_mstate_global->__pyx_n_s_new_2 +#define __pyx_kp_s_newanalysis_helpers_miscellaneou __pyx_mstate_global->__pyx_kp_s_newanalysis_helpers_miscellaneou +#define __pyx_n_s_newanalysis_miscellaneous __pyx_mstate_global->__pyx_n_s_newanalysis_miscellaneous +#define __pyx_n_s_nmol __pyx_mstate_global->__pyx_n_s_nmol +#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non +#define __pyx_n_s_noe_task __pyx_mstate_global->__pyx_n_s_noe_task +#define __pyx_n_s_noe_task___init __pyx_mstate_global->__pyx_n_s_noe_task___init +#define __pyx_n_s_noe_task_pairiter __pyx_mstate_global->__pyx_n_s_noe_task_pairiter +#define __pyx_n_s_norm __pyx_mstate_global->__pyx_n_s_norm +#define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np +#define __pyx_n_s_nres_surr __pyx_mstate_global->__pyx_n_s_nres_surr +#define __pyx_n_s_nres_wat __pyx_mstate_global->__pyx_n_s_nres_wat +#define __pyx_n_s_nshells __pyx_mstate_global->__pyx_n_s_nshells +#define __pyx_n_s_nshells1 __pyx_mstate_global->__pyx_n_s_nshells1 +#define __pyx_n_s_nshells2 __pyx_mstate_global->__pyx_n_s_nshells2 +#define __pyx_n_s_nsurr __pyx_mstate_global->__pyx_n_s_nsurr +#define __pyx_n_s_number_aufpunkte __pyx_mstate_global->__pyx_n_s_number_aufpunkte +#define __pyx_n_s_number_of_datapoints __pyx_mstate_global->__pyx_n_s_number_of_datapoints +#define __pyx_n_s_number_of_frames __pyx_mstate_global->__pyx_n_s_number_of_frames +#define __pyx_n_s_number_of_frames1 __pyx_mstate_global->__pyx_n_s_number_of_frames1 +#define __pyx_n_s_number_of_frames2 __pyx_mstate_global->__pyx_n_s_number_of_frames2 +#define __pyx_n_s_number_of_particles __pyx_mstate_global->__pyx_n_s_number_of_particles +#define __pyx_n_s_number_of_shells __pyx_mstate_global->__pyx_n_s_number_of_shells +#define __pyx_n_s_number_of_shells1 __pyx_mstate_global->__pyx_n_s_number_of_shells1 +#define __pyx_n_s_number_of_shells2 __pyx_mstate_global->__pyx_n_s_number_of_shells2 +#define __pyx_n_s_number_of_startingpoints __pyx_mstate_global->__pyx_n_s_number_of_startingpoints +#define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy +#define __pyx_kp_s_numpy_core_multiarray_failed_to __pyx_mstate_global->__pyx_kp_s_numpy_core_multiarray_failed_to +#define __pyx_kp_s_numpy_core_umath_failed_to_impor __pyx_mstate_global->__pyx_kp_s_numpy_core_umath_failed_to_impor +#define __pyx_n_s_nwat __pyx_mstate_global->__pyx_n_s_nwat +#define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj +#define __pyx_n_s_order __pyx_mstate_global->__pyx_n_s_order +#define __pyx_n_s_p __pyx_mstate_global->__pyx_n_s_p +#define __pyx_n_s_p1 __pyx_mstate_global->__pyx_n_s_p1 +#define __pyx_n_s_p1_coor __pyx_mstate_global->__pyx_n_s_p1_coor +#define __pyx_n_s_p1l __pyx_mstate_global->__pyx_n_s_p1l +#define __pyx_n_s_p2 __pyx_mstate_global->__pyx_n_s_p2 +#define __pyx_n_s_p2_coor __pyx_mstate_global->__pyx_n_s_p2_coor +#define __pyx_n_s_p2l __pyx_mstate_global->__pyx_n_s_p2l +#define __pyx_n_s_p_coor __pyx_mstate_global->__pyx_n_s_p_coor +#define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack +#define __pyx_n_s_pair __pyx_mstate_global->__pyx_n_s_pair +#define __pyx_n_s_pair_1_par_1 __pyx_mstate_global->__pyx_n_s_pair_1_par_1 +#define __pyx_n_s_pair_1_par_2 __pyx_mstate_global->__pyx_n_s_pair_1_par_2 +#define __pyx_n_s_pair_2_par_1 __pyx_mstate_global->__pyx_n_s_pair_2_par_1 +#define __pyx_n_s_pair_2_par_2 __pyx_mstate_global->__pyx_n_s_pair_2_par_2 +#define __pyx_n_s_pairiter __pyx_mstate_global->__pyx_n_s_pairiter +#define __pyx_n_s_pairlist __pyx_mstate_global->__pyx_n_s_pairlist +#define __pyx_n_s_pairobject __pyx_mstate_global->__pyx_n_s_pairobject +#define __pyx_n_s_pairobject___init __pyx_mstate_global->__pyx_n_s_pairobject___init +#define __pyx_n_s_particle __pyx_mstate_global->__pyx_n_s_particle +#define __pyx_n_s_particle1 __pyx_mstate_global->__pyx_n_s_particle1 +#define __pyx_n_s_particle2 __pyx_mstate_global->__pyx_n_s_particle2 +#define __pyx_n_s_particle_first __pyx_mstate_global->__pyx_n_s_particle_first +#define __pyx_n_s_particles __pyx_mstate_global->__pyx_n_s_particles +#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle +#define __pyx_n_s_pl __pyx_mstate_global->__pyx_n_s_pl +#define __pyx_n_s_point __pyx_mstate_global->__pyx_n_s_point +#define __pyx_n_s_point1 __pyx_mstate_global->__pyx_n_s_point1 +#define __pyx_n_s_point2 __pyx_mstate_global->__pyx_n_s_point2 +#define __pyx_n_s_prepare __pyx_mstate_global->__pyx_n_s_prepare +#define __pyx_n_s_prev_atomic_dipoles __pyx_mstate_global->__pyx_n_s_prev_atomic_dipoles +#define __pyx_n_s_print __pyx_mstate_global->__pyx_n_s_print +#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError +#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum +#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type +#define __pyx_n_s_pyx_unpickle_Enum __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Enum +#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable +#define __pyx_n_s_qualname __pyx_mstate_global->__pyx_n_s_qualname +#define __pyx_n_s_r2 __pyx_mstate_global->__pyx_n_s_r2 +#define __pyx_n_s_r_0 __pyx_mstate_global->__pyx_n_s_r_0 +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce +#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython +#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_ref __pyx_mstate_global->__pyx_n_s_ref +#define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register +#define __pyx_n_s_res __pyx_mstate_global->__pyx_n_s_res +#define __pyx_n_s_res1 __pyx_mstate_global->__pyx_n_s_res1 +#define __pyx_n_s_res2 __pyx_mstate_global->__pyx_n_s_res2 +#define __pyx_n_s_result __pyx_mstate_global->__pyx_n_s_result +#define __pyx_n_s_results __pyx_mstate_global->__pyx_n_s_results +#define __pyx_n_s_return __pyx_mstate_global->__pyx_n_s_return +#define __pyx_n_s_rotTs __pyx_mstate_global->__pyx_n_s_rotTs +#define __pyx_n_s_rotationMatrixMultiShellCorrelat __pyx_mstate_global->__pyx_n_s_rotationMatrixMultiShellCorrelat +#define __pyx_n_s_rotationMatrixVennShellCorrelate __pyx_mstate_global->__pyx_n_s_rotationMatrixVennShellCorrelate +#define __pyx_n_s_run __pyx_mstate_global->__pyx_n_s_run +#define __pyx_n_s_rv __pyx_mstate_global->__pyx_n_s_rv +#define __pyx_n_s_segments_per_angstroem __pyx_mstate_global->__pyx_n_s_segments_per_angstroem +#define __pyx_n_s_segments_per_pi __pyx_mstate_global->__pyx_n_s_segments_per_pi +#define __pyx_n_s_segs __pyx_mstate_global->__pyx_n_s_segs +#define __pyx_n_s_segs_per_angstroem __pyx_mstate_global->__pyx_n_s_segs_per_angstroem +#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self +#define __pyx_kp_s_self_too_sparse __pyx_mstate_global->__pyx_kp_s_self_too_sparse +#define __pyx_n_s_selfcorr __pyx_mstate_global->__pyx_n_s_selfcorr +#define __pyx_n_s_selfctr __pyx_mstate_global->__pyx_n_s_selfctr +#define __pyx_n_s_selflist __pyx_mstate_global->__pyx_n_s_selflist +#define __pyx_n_s_selfobj __pyx_mstate_global->__pyx_n_s_selfobj +#define __pyx_n_s_selfobject __pyx_mstate_global->__pyx_n_s_selfobject +#define __pyx_n_s_selfobject___init __pyx_mstate_global->__pyx_n_s_selfobject___init +#define __pyx_n_s_set_name __pyx_mstate_global->__pyx_n_s_set_name +#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate +#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython +#define __pyx_n_s_shape __pyx_mstate_global->__pyx_n_s_shape +#define __pyx_n_s_shell __pyx_mstate_global->__pyx_n_s_shell +#define __pyx_n_s_shell1 __pyx_mstate_global->__pyx_n_s_shell1 +#define __pyx_n_s_shell2 __pyx_mstate_global->__pyx_n_s_shell2 +#define __pyx_n_s_shell3 __pyx_mstate_global->__pyx_n_s_shell3 +#define __pyx_n_s_shell4 __pyx_mstate_global->__pyx_n_s_shell4 +#define __pyx_n_s_shell5 __pyx_mstate_global->__pyx_n_s_shell5 +#define __pyx_n_s_shellHistograms __pyx_mstate_global->__pyx_n_s_shellHistograms +#define __pyx_n_s_shell_01 __pyx_mstate_global->__pyx_n_s_shell_01 +#define __pyx_n_s_shell_02 __pyx_mstate_global->__pyx_n_s_shell_02 +#define __pyx_n_s_shell_03 __pyx_mstate_global->__pyx_n_s_shell_03 +#define __pyx_n_s_shell_04 __pyx_mstate_global->__pyx_n_s_shell_04 +#define __pyx_n_s_shell_05 __pyx_mstate_global->__pyx_n_s_shell_05 +#define __pyx_n_s_shelldt __pyx_mstate_global->__pyx_n_s_shelldt +#define __pyx_n_s_shelldt1 __pyx_mstate_global->__pyx_n_s_shelldt1 +#define __pyx_n_s_shelldt2 __pyx_mstate_global->__pyx_n_s_shelldt2 +#define __pyx_n_s_shells __pyx_mstate_global->__pyx_n_s_shells +#define __pyx_n_s_shellstart __pyx_mstate_global->__pyx_n_s_shellstart +#define __pyx_n_s_shellstart1 __pyx_mstate_global->__pyx_n_s_shellstart1 +#define __pyx_n_s_shellstart2 __pyx_mstate_global->__pyx_n_s_shellstart2 +#define __pyx_n_s_sign __pyx_mstate_global->__pyx_n_s_sign +#define __pyx_n_s_sites_per_res __pyx_mstate_global->__pyx_n_s_sites_per_res +#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size +#define __pyx_n_s_sort __pyx_mstate_global->__pyx_n_s_sort +#define __pyx_n_s_sortCollectiveDipNNShells __pyx_mstate_global->__pyx_n_s_sortCollectiveDipNNShells +#define __pyx_n_s_sortCollectiveDipNNShellsInt __pyx_mstate_global->__pyx_n_s_sortCollectiveDipNNShellsInt +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_sqrt __pyx_mstate_global->__pyx_n_s_sqrt +#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start +#define __pyx_n_s_startingpoints __pyx_mstate_global->__pyx_n_s_startingpoints +#define __pyx_n_s_startskip __pyx_mstate_global->__pyx_n_s_startskip +#define __pyx_n_s_step __pyx_mstate_global->__pyx_n_s_step +#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop +#define __pyx_kp_s_strided_and_direct __pyx_mstate_global->__pyx_kp_s_strided_and_direct +#define __pyx_kp_s_strided_and_direct_or_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_direct_or_indirect +#define __pyx_kp_s_strided_and_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_indirect +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct +#define __pyx_n_s_structureFactorCharge __pyx_mstate_global->__pyx_n_s_structureFactorCharge +#define __pyx_n_s_structureFactorDipTen __pyx_mstate_global->__pyx_n_s_structureFactorDipTen +#define __pyx_n_s_sub_correlation __pyx_mstate_global->__pyx_n_s_sub_correlation +#define __pyx_n_s_sumMultiMDCageSingle __pyx_mstate_global->__pyx_n_s_sumMultiMDCageSingle +#define __pyx_n_s_sumUpByShell __pyx_mstate_global->__pyx_n_s_sumUpByShell +#define __pyx_n_s_sumVennMDCageSingle __pyx_mstate_global->__pyx_n_s_sumVennMDCageSingle +#define __pyx_n_s_super __pyx_mstate_global->__pyx_n_s_super +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_t1 __pyx_mstate_global->__pyx_n_s_t1 +#define __pyx_n_s_t2 __pyx_mstate_global->__pyx_n_s_t2 +#define __pyx_n_s_t3 __pyx_mstate_global->__pyx_n_s_t3 +#define __pyx_n_s_t4 __pyx_mstate_global->__pyx_n_s_t4 +#define __pyx_n_s_t5 __pyx_mstate_global->__pyx_n_s_t5 +#define __pyx_n_s_t6 __pyx_mstate_global->__pyx_n_s_t6 +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_testParallelism __pyx_mstate_global->__pyx_n_s_testParallelism +#define __pyx_n_s_timeseries __pyx_mstate_global->__pyx_n_s_timeseries +#define __pyx_n_s_timeseries1 __pyx_mstate_global->__pyx_n_s_timeseries1 +#define __pyx_n_s_timeseries2 __pyx_mstate_global->__pyx_n_s_timeseries2 +#define __pyx_n_s_timeseries_shellwise __pyx_mstate_global->__pyx_n_s_timeseries_shellwise +#define __pyx_kp_s_tot_too_sparse __pyx_mstate_global->__pyx_kp_s_tot_too_sparse +#define __pyx_kp_s_unable_to_allocate_array_data __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_array_data +#define __pyx_kp_s_unable_to_allocate_shape_and_str __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_shape_and_str +#define __pyx_n_s_unfold __pyx_mstate_global->__pyx_n_s_unfold +#define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack +#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update +#define __pyx_n_s_vanHoveMultiVector __pyx_mstate_global->__pyx_n_s_vanHoveMultiVector +#define __pyx_n_s_vanHoveSingleVector __pyx_mstate_global->__pyx_n_s_vanHoveSingleVector +#define __pyx_n_s_vec __pyx_mstate_global->__pyx_n_s_vec +#define __pyx_n_s_vel_ind __pyx_mstate_global->__pyx_n_s_vel_ind +#define __pyx_n_s_version_info __pyx_mstate_global->__pyx_n_s_version_info +#define __pyx_n_s_w __pyx_mstate_global->__pyx_n_s_w +#define __pyx_n_s_wat __pyx_mstate_global->__pyx_n_s_wat +#define __pyx_n_s_writeKirkwoodHistogram __pyx_mstate_global->__pyx_n_s_writeKirkwoodHistogram +#define __pyx_n_s_writeKirkwoodHistogram2D __pyx_mstate_global->__pyx_n_s_writeKirkwoodHistogram2D +#define __pyx_n_s_writeKirkwoodHistogramShellwise __pyx_mstate_global->__pyx_n_s_writeKirkwoodHistogramShellwise +#define __pyx_n_s_writeMrHistogram __pyx_mstate_global->__pyx_n_s_writeMrHistogram +#define __pyx_n_s_x __pyx_mstate_global->__pyx_n_s_x +#define __pyx_n_s_zeros __pyx_mstate_global->__pyx_n_s_zeros +#define __pyx_float__5 __pyx_mstate_global->__pyx_float__5 +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_2 __pyx_mstate_global->__pyx_int_2 +#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3 +#define __pyx_int_4 __pyx_mstate_global->__pyx_int_4 +#define __pyx_int_5 __pyx_mstate_global->__pyx_int_5 +#define __pyx_int_6 __pyx_mstate_global->__pyx_int_6 +#define __pyx_int_12 __pyx_mstate_global->__pyx_int_12 +#define __pyx_int_112105877 __pyx_mstate_global->__pyx_int_112105877 +#define __pyx_int_136983863 __pyx_mstate_global->__pyx_int_136983863 +#define __pyx_int_184977713 __pyx_mstate_global->__pyx_int_184977713 +#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 +#define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 +#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 +#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 +#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 +#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 +#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 +#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23 +#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24 +#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25 +#define __pyx_tuple__26 __pyx_mstate_global->__pyx_tuple__26 +#define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27 +#define __pyx_tuple__29 __pyx_mstate_global->__pyx_tuple__29 +#define __pyx_tuple__31 __pyx_mstate_global->__pyx_tuple__31 +#define __pyx_tuple__33 __pyx_mstate_global->__pyx_tuple__33 +#define __pyx_tuple__35 __pyx_mstate_global->__pyx_tuple__35 +#define __pyx_tuple__37 __pyx_mstate_global->__pyx_tuple__37 +#define __pyx_tuple__39 __pyx_mstate_global->__pyx_tuple__39 +#define __pyx_tuple__41 __pyx_mstate_global->__pyx_tuple__41 +#define __pyx_tuple__43 __pyx_mstate_global->__pyx_tuple__43 +#define __pyx_tuple__45 __pyx_mstate_global->__pyx_tuple__45 +#define __pyx_tuple__47 __pyx_mstate_global->__pyx_tuple__47 +#define __pyx_tuple__49 __pyx_mstate_global->__pyx_tuple__49 +#define __pyx_tuple__51 __pyx_mstate_global->__pyx_tuple__51 +#define __pyx_tuple__53 __pyx_mstate_global->__pyx_tuple__53 +#define __pyx_tuple__55 __pyx_mstate_global->__pyx_tuple__55 +#define __pyx_tuple__57 __pyx_mstate_global->__pyx_tuple__57 +#define __pyx_tuple__59 __pyx_mstate_global->__pyx_tuple__59 +#define __pyx_tuple__61 __pyx_mstate_global->__pyx_tuple__61 +#define __pyx_tuple__63 __pyx_mstate_global->__pyx_tuple__63 +#define __pyx_tuple__65 __pyx_mstate_global->__pyx_tuple__65 +#define __pyx_tuple__67 __pyx_mstate_global->__pyx_tuple__67 +#define __pyx_tuple__69 __pyx_mstate_global->__pyx_tuple__69 +#define __pyx_tuple__71 __pyx_mstate_global->__pyx_tuple__71 +#define __pyx_tuple__73 __pyx_mstate_global->__pyx_tuple__73 +#define __pyx_tuple__75 __pyx_mstate_global->__pyx_tuple__75 +#define __pyx_tuple__77 __pyx_mstate_global->__pyx_tuple__77 +#define __pyx_tuple__79 __pyx_mstate_global->__pyx_tuple__79 +#define __pyx_tuple__81 __pyx_mstate_global->__pyx_tuple__81 +#define __pyx_tuple__83 __pyx_mstate_global->__pyx_tuple__83 +#define __pyx_tuple__85 __pyx_mstate_global->__pyx_tuple__85 +#define __pyx_tuple__87 __pyx_mstate_global->__pyx_tuple__87 +#define __pyx_tuple__89 __pyx_mstate_global->__pyx_tuple__89 +#define __pyx_tuple__91 __pyx_mstate_global->__pyx_tuple__91 +#define __pyx_tuple__93 __pyx_mstate_global->__pyx_tuple__93 +#define __pyx_tuple__95 __pyx_mstate_global->__pyx_tuple__95 +#define __pyx_tuple__97 __pyx_mstate_global->__pyx_tuple__97 +#define __pyx_tuple__99 __pyx_mstate_global->__pyx_tuple__99 +#define __pyx_tuple__101 __pyx_mstate_global->__pyx_tuple__101 +#define __pyx_tuple__103 __pyx_mstate_global->__pyx_tuple__103 +#define __pyx_tuple__105 __pyx_mstate_global->__pyx_tuple__105 +#define __pyx_tuple__107 __pyx_mstate_global->__pyx_tuple__107 +#define __pyx_tuple__109 __pyx_mstate_global->__pyx_tuple__109 +#define __pyx_tuple__111 __pyx_mstate_global->__pyx_tuple__111 +#define __pyx_tuple__113 __pyx_mstate_global->__pyx_tuple__113 +#define __pyx_tuple__115 __pyx_mstate_global->__pyx_tuple__115 +#define __pyx_tuple__117 __pyx_mstate_global->__pyx_tuple__117 +#define __pyx_tuple__119 __pyx_mstate_global->__pyx_tuple__119 +#define __pyx_tuple__121 __pyx_mstate_global->__pyx_tuple__121 +#define __pyx_tuple__123 __pyx_mstate_global->__pyx_tuple__123 +#define __pyx_tuple__125 __pyx_mstate_global->__pyx_tuple__125 +#define __pyx_tuple__128 __pyx_mstate_global->__pyx_tuple__128 +#define __pyx_tuple__130 __pyx_mstate_global->__pyx_tuple__130 +#define __pyx_tuple__132 __pyx_mstate_global->__pyx_tuple__132 +#define __pyx_tuple__134 __pyx_mstate_global->__pyx_tuple__134 +#define __pyx_tuple__136 __pyx_mstate_global->__pyx_tuple__136 +#define __pyx_tuple__138 __pyx_mstate_global->__pyx_tuple__138 +#define __pyx_tuple__141 __pyx_mstate_global->__pyx_tuple__141 +#define __pyx_tuple__143 __pyx_mstate_global->__pyx_tuple__143 +#define __pyx_tuple__145 __pyx_mstate_global->__pyx_tuple__145 +#define __pyx_tuple__147 __pyx_mstate_global->__pyx_tuple__147 +#define __pyx_tuple__149 __pyx_mstate_global->__pyx_tuple__149 +#define __pyx_tuple__151 __pyx_mstate_global->__pyx_tuple__151 +#define __pyx_tuple__153 __pyx_mstate_global->__pyx_tuple__153 +#define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28 +#define __pyx_codeobj__30 __pyx_mstate_global->__pyx_codeobj__30 +#define __pyx_codeobj__32 __pyx_mstate_global->__pyx_codeobj__32 +#define __pyx_codeobj__34 __pyx_mstate_global->__pyx_codeobj__34 +#define __pyx_codeobj__36 __pyx_mstate_global->__pyx_codeobj__36 +#define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38 +#define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40 +#define __pyx_codeobj__42 __pyx_mstate_global->__pyx_codeobj__42 +#define __pyx_codeobj__44 __pyx_mstate_global->__pyx_codeobj__44 +#define __pyx_codeobj__46 __pyx_mstate_global->__pyx_codeobj__46 +#define __pyx_codeobj__48 __pyx_mstate_global->__pyx_codeobj__48 +#define __pyx_codeobj__50 __pyx_mstate_global->__pyx_codeobj__50 +#define __pyx_codeobj__52 __pyx_mstate_global->__pyx_codeobj__52 +#define __pyx_codeobj__54 __pyx_mstate_global->__pyx_codeobj__54 +#define __pyx_codeobj__56 __pyx_mstate_global->__pyx_codeobj__56 +#define __pyx_codeobj__58 __pyx_mstate_global->__pyx_codeobj__58 +#define __pyx_codeobj__60 __pyx_mstate_global->__pyx_codeobj__60 +#define __pyx_codeobj__62 __pyx_mstate_global->__pyx_codeobj__62 +#define __pyx_codeobj__64 __pyx_mstate_global->__pyx_codeobj__64 +#define __pyx_codeobj__66 __pyx_mstate_global->__pyx_codeobj__66 +#define __pyx_codeobj__68 __pyx_mstate_global->__pyx_codeobj__68 +#define __pyx_codeobj__70 __pyx_mstate_global->__pyx_codeobj__70 +#define __pyx_codeobj__72 __pyx_mstate_global->__pyx_codeobj__72 +#define __pyx_codeobj__74 __pyx_mstate_global->__pyx_codeobj__74 +#define __pyx_codeobj__76 __pyx_mstate_global->__pyx_codeobj__76 +#define __pyx_codeobj__78 __pyx_mstate_global->__pyx_codeobj__78 +#define __pyx_codeobj__80 __pyx_mstate_global->__pyx_codeobj__80 +#define __pyx_codeobj__82 __pyx_mstate_global->__pyx_codeobj__82 +#define __pyx_codeobj__84 __pyx_mstate_global->__pyx_codeobj__84 +#define __pyx_codeobj__86 __pyx_mstate_global->__pyx_codeobj__86 +#define __pyx_codeobj__88 __pyx_mstate_global->__pyx_codeobj__88 +#define __pyx_codeobj__90 __pyx_mstate_global->__pyx_codeobj__90 +#define __pyx_codeobj__92 __pyx_mstate_global->__pyx_codeobj__92 +#define __pyx_codeobj__94 __pyx_mstate_global->__pyx_codeobj__94 +#define __pyx_codeobj__96 __pyx_mstate_global->__pyx_codeobj__96 +#define __pyx_codeobj__98 __pyx_mstate_global->__pyx_codeobj__98 +#define __pyx_codeobj__100 __pyx_mstate_global->__pyx_codeobj__100 +#define __pyx_codeobj__102 __pyx_mstate_global->__pyx_codeobj__102 +#define __pyx_codeobj__104 __pyx_mstate_global->__pyx_codeobj__104 +#define __pyx_codeobj__106 __pyx_mstate_global->__pyx_codeobj__106 +#define __pyx_codeobj__108 __pyx_mstate_global->__pyx_codeobj__108 +#define __pyx_codeobj__110 __pyx_mstate_global->__pyx_codeobj__110 +#define __pyx_codeobj__112 __pyx_mstate_global->__pyx_codeobj__112 +#define __pyx_codeobj__114 __pyx_mstate_global->__pyx_codeobj__114 +#define __pyx_codeobj__116 __pyx_mstate_global->__pyx_codeobj__116 +#define __pyx_codeobj__118 __pyx_mstate_global->__pyx_codeobj__118 +#define __pyx_codeobj__120 __pyx_mstate_global->__pyx_codeobj__120 +#define __pyx_codeobj__122 __pyx_mstate_global->__pyx_codeobj__122 +#define __pyx_codeobj__124 __pyx_mstate_global->__pyx_codeobj__124 +#define __pyx_codeobj__126 __pyx_mstate_global->__pyx_codeobj__126 +#define __pyx_codeobj__127 __pyx_mstate_global->__pyx_codeobj__127 +#define __pyx_codeobj__129 __pyx_mstate_global->__pyx_codeobj__129 +#define __pyx_codeobj__131 __pyx_mstate_global->__pyx_codeobj__131 +#define __pyx_codeobj__133 __pyx_mstate_global->__pyx_codeobj__133 +#define __pyx_codeobj__135 __pyx_mstate_global->__pyx_codeobj__135 +#define __pyx_codeobj__137 __pyx_mstate_global->__pyx_codeobj__137 +#define __pyx_codeobj__139 __pyx_mstate_global->__pyx_codeobj__139 +#define __pyx_codeobj__140 __pyx_mstate_global->__pyx_codeobj__140 +#define __pyx_codeobj__142 __pyx_mstate_global->__pyx_codeobj__142 +#define __pyx_codeobj__144 __pyx_mstate_global->__pyx_codeobj__144 +#define __pyx_codeobj__146 __pyx_mstate_global->__pyx_codeobj__146 +#define __pyx_codeobj__148 __pyx_mstate_global->__pyx_codeobj__148 +#define __pyx_codeobj__150 __pyx_mstate_global->__pyx_codeobj__150 +#define __pyx_codeobj__152 __pyx_mstate_global->__pyx_codeobj__152 +#define __pyx_codeobj__154 __pyx_mstate_global->__pyx_codeobj__154 +/* #### Code section: module_code ### */ + +/* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): * - * @cython.boundscheck(False) - * def countHBonds(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist, double cos_angle=-0.95): # <<<<<<<<<<<<<< - * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_3countHBonds(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_3countHBonds = {"countHBonds", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_3countHBonds, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_3countHBonds(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor_surr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor_oh2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_nres_surr; - double __pyx_v_maxdist; - double __pyx_v_cos_angle; +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("countHBonds (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 131, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor_surr,&__pyx_n_s_coor_oh2,&__pyx_n_s_nres_surr,&__pyx_n_s_maxdist,&__pyx_n_s_cos_angle,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; + values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_n_s_c)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_surr)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shape)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_oh2)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_itemsize)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("countHBonds", 0, 4, 5, 1); __PYX_ERR(0, 74, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nres_surr)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_format)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("countHBonds", 0, 4, 5, 2); __PYX_ERR(0, 74, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxdist)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("countHBonds", 0, 4, 5, 3); __PYX_ERR(0, 74, __pyx_L3_error) + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode); + if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cos_angle); - if (value) { values[4] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_allocate_buffer); + if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "countHBonds") < 0)) __PYX_ERR(0, 74, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 131, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } - __pyx_v_coor_surr = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_surr.memview)) __PYX_ERR(0, 74, __pyx_L3_error) - __pyx_v_coor_oh2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_oh2.memview)) __PYX_ERR(0, 74, __pyx_L3_error) - __pyx_v_nres_surr = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nres_surr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) - __pyx_v_maxdist = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_maxdist == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; if (values[4]) { - __pyx_v_cos_angle = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_cos_angle == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 132, __pyx_L3_error) } else { - __pyx_v_cos_angle = ((double)-0.95); + + /* "View.MemoryView":132 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx + */ + __pyx_v_allocate_buffer = ((int)1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("countHBonds", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 74, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 131, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.countHBonds", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_2countHBonds(__pyx_self, __pyx_v_coor_surr, __pyx_v_coor_oh2, __pyx_v_nres_surr, __pyx_v_maxdist, __pyx_v_cos_angle); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 131, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 131, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * + */ /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_2countHBonds(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor_surr, __Pyx_memviewslice __pyx_v_coor_oh2, int __pyx_v_nres_surr, double __pyx_v_maxdist, double __pyx_v_cos_angle) { - int __pyx_v_sites_per_res; - int __pyx_v_nsurr; - int __pyx_v_nwat; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_l; +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { int __pyx_v_idx; - int __pyx_v_idx2; - int __pyx_v_idx3; - __Pyx_memviewslice __pyx_v_hbond = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_dx; - double __pyx_v_dy; - double __pyx_v_dz; - double __pyx_v_dx2; - double __pyx_v_dy2; - double __pyx_v_dz2; - double __pyx_v_dot; - double __pyx_v_dot2; - double __pyx_v_dist; - double __pyx_v_dist2; - double __pyx_v_cosine; - PyObject *__pyx_r = NULL; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_t_6 = NULL; int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - int __pyx_t_21; - double __pyx_t_22; - double __pyx_t_23; + char *__pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_UCS4 __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("countHBonds", 0); + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); - /* "src/helpers/miscellaneous.pyx":76 - * def countHBonds(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist, double cos_angle=-0.95): - * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr # <<<<<<<<<<<<<< - * cdef int nsurr = coor_surr.shape[0] / sites_per_res - * cdef int nwat = coor_oh2.shape[0] / 3 + /* "View.MemoryView":137 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * */ - if (unlikely(__pyx_v_nres_surr == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 76, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nres_surr == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW((__pyx_v_coor_surr.shape[0])))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 76, __pyx_L1_error) + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 137, __pyx_L1_error) } - __pyx_v_sites_per_res = __Pyx_div_Py_ssize_t((__pyx_v_coor_surr.shape[0]), __pyx_v_nres_surr); + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 137, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); - /* "src/helpers/miscellaneous.pyx":77 - * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr - * cdef int nsurr = coor_surr.shape[0] / sites_per_res # <<<<<<<<<<<<<< - * cdef int nwat = coor_oh2.shape[0] / 3 - * cdef int i, j, k, l, idx, idx2, idx3 + /* "View.MemoryView":138 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: */ - if (unlikely(__pyx_v_sites_per_res == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 77, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_sites_per_res == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW((__pyx_v_coor_surr.shape[0])))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 77, __pyx_L1_error) - } - __pyx_v_nsurr = __Pyx_div_Py_ssize_t((__pyx_v_coor_surr.shape[0]), __pyx_v_sites_per_res); + __pyx_v_self->itemsize = __pyx_v_itemsize; - /* "src/helpers/miscellaneous.pyx":78 - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr - * cdef int nsurr = coor_surr.shape[0] / sites_per_res - * cdef int nwat = coor_oh2.shape[0] / 3 # <<<<<<<<<<<<<< - * cdef int i, j, k, l, idx, idx2, idx3 + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" * */ - __pyx_v_nwat = __Pyx_div_Py_ssize_t((__pyx_v_coor_oh2.shape[0]), 3); + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/miscellaneous.pyx":81 - * cdef int i, j, k, l, idx, idx2, idx3 + /* "View.MemoryView":141 * - * cdef int [:] hbond = np.zeros(nwat, dtype=np.int32) # <<<<<<<<<<<<<< + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< * - * cdef double dx, dy, dz, dx2, dy2, dz2, dot, dot2, dist, dist2, cosine + * if itemsize <= 0: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nwat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_hbond = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 141, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":86 + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" * - * # loop over water molecules - * for i in prange(nwat, nogil=True): # <<<<<<<<<<<<<< - * # loop over h atoms - * for j in range(2): */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_7 = __pyx_v_nwat; - if ((1 == 0)) abort(); - { - double __pyx_parallel_temp0 = ((double)__PYX_NAN()); - double __pyx_parallel_temp1 = ((double)__PYX_NAN()); - double __pyx_parallel_temp2 = ((double)__PYX_NAN()); - double __pyx_parallel_temp3 = ((double)__PYX_NAN()); - double __pyx_parallel_temp4 = ((double)__PYX_NAN()); - double __pyx_parallel_temp5 = ((double)__PYX_NAN()); - double __pyx_parallel_temp6 = ((double)__PYX_NAN()); - double __pyx_parallel_temp7 = ((double)__PYX_NAN()); - double __pyx_parallel_temp8 = ((double)__PYX_NAN()); - double __pyx_parallel_temp9 = ((double)__PYX_NAN()); - double __pyx_parallel_temp10 = ((double)__PYX_NAN()); - int __pyx_parallel_temp11 = ((int)0xbad0bad0); - int __pyx_parallel_temp12 = ((int)0xbad0bad0); - int __pyx_parallel_temp13 = ((int)0xbad0bad0); - int __pyx_parallel_temp14 = ((int)0xbad0bad0); - int __pyx_parallel_temp15 = ((int)0xbad0bad0); - int __pyx_parallel_temp16 = ((int)0xbad0bad0); - int __pyx_parallel_temp17 = ((int)0xbad0bad0); - const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; - PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; - int __pyx_parallel_why; - __pyx_parallel_why = 0; - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_9 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_9 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - Py_BEGIN_ALLOW_THREADS - #endif /* _OPENMP */ - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_cosine) lastprivate(__pyx_v_dist) lastprivate(__pyx_v_dist2) lastprivate(__pyx_v_dot) lastprivate(__pyx_v_dot2) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dx2) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dy2) lastprivate(__pyx_v_dz) lastprivate(__pyx_v_dz2) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_idx2) lastprivate(__pyx_v_idx3) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_l) - #endif /* _OPENMP */ - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){ - if (__pyx_parallel_why < 2) - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_8); - /* Initialize private variables to invalid values */ - __pyx_v_cosine = ((double)__PYX_NAN()); - __pyx_v_dist = ((double)__PYX_NAN()); - __pyx_v_dist2 = ((double)__PYX_NAN()); - __pyx_v_dot = ((double)__PYX_NAN()); - __pyx_v_dot2 = ((double)__PYX_NAN()); - __pyx_v_dx = ((double)__PYX_NAN()); - __pyx_v_dx2 = ((double)__PYX_NAN()); - __pyx_v_dy = ((double)__PYX_NAN()); - __pyx_v_dy2 = ((double)__PYX_NAN()); - __pyx_v_dz = ((double)__PYX_NAN()); - __pyx_v_dz2 = ((double)__PYX_NAN()); - __pyx_v_idx = ((int)0xbad0bad0); - __pyx_v_idx2 = ((int)0xbad0bad0); - __pyx_v_idx3 = ((int)0xbad0bad0); - __pyx_v_j = ((int)0xbad0bad0); - __pyx_v_k = ((int)0xbad0bad0); - __pyx_v_l = ((int)0xbad0bad0); + } - /* "src/helpers/miscellaneous.pyx":88 - * for i in prange(nwat, nogil=True): - * # loop over h atoms - * for j in range(2): # <<<<<<<<<<<<<< - * idx = i*3+1+j - * idx3 = i*3 + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * */ - for (__pyx_t_10 = 0; __pyx_t_10 < 2; __pyx_t_10+=1) { - __pyx_v_j = __pyx_t_10; + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/miscellaneous.pyx":89 - * # loop over h atoms - * for j in range(2): - * idx = i*3+1+j # <<<<<<<<<<<<<< - * idx3 = i*3 - * # loop over surrounding molecules + /* "View.MemoryView":144 + * + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): */ - __pyx_v_idx = (((__pyx_v_i * 3) + 1) + __pyx_v_j); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 144, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":90 - * for j in range(2): - * idx = i*3+1+j - * idx3 = i*3 # <<<<<<<<<<<<<< - * # loop over surrounding molecules - * for k in range(nsurr): + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * */ - __pyx_v_idx3 = (__pyx_v_i * 3); + } - /* "src/helpers/miscellaneous.pyx":92 - * idx3 = i*3 - * # loop over surrounding molecules - * for k in range(nsurr): # <<<<<<<<<<<<<< - * # loop over oxygen atoms - * for l in range(sites_per_res): + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - __pyx_t_11 = __pyx_v_nsurr; - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_k = __pyx_t_13; + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { - /* "src/helpers/miscellaneous.pyx":94 - * for k in range(nsurr): - * # loop over oxygen atoms - * for l in range(sites_per_res): # <<<<<<<<<<<<<< - * idx2 = k*sites_per_res+l - * dx = coor_surr[idx2,0] - coor_oh2[idx,0] + /* "View.MemoryView":147 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format */ - __pyx_t_14 = __pyx_v_sites_per_res; - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { - __pyx_v_l = __pyx_t_16; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":95 - * # loop over oxygen atoms - * for l in range(sites_per_res): - * idx2 = k*sites_per_res+l # <<<<<<<<<<<<<< - * dx = coor_surr[idx2,0] - coor_oh2[idx,0] - * dy = coor_surr[idx2,1] - coor_oh2[idx,1] + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - __pyx_v_idx2 = ((__pyx_v_k * __pyx_v_sites_per_res) + __pyx_v_l); + } - /* "src/helpers/miscellaneous.pyx":96 - * for l in range(sites_per_res): - * idx2 = k*sites_per_res+l - * dx = coor_surr[idx2,0] - coor_oh2[idx,0] # <<<<<<<<<<<<<< - * dy = coor_surr[idx2,1] - coor_oh2[idx,1] - * dz = coor_surr[idx2,2] - coor_oh2[idx,2] + /* "View.MemoryView":148 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * */ - __pyx_t_17 = __pyx_v_idx2; - __pyx_t_18 = 0; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_surr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_surr.shape[1]; - __pyx_t_19 = __pyx_v_idx; - __pyx_t_20 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_17 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_18 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_oh2.strides[1]) )))); + if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_format))) __PYX_ERR(1, 148, __pyx_L1_error) + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":97 - * idx2 = k*sites_per_res+l - * dx = coor_surr[idx2,0] - coor_oh2[idx,0] - * dy = coor_surr[idx2,1] - coor_oh2[idx,1] # <<<<<<<<<<<<<< - * dz = coor_surr[idx2,2] - coor_oh2[idx,2] - * dot = dx*dx + dy*dy + dz*dz + /* "View.MemoryView":149 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * */ - __pyx_t_20 = __pyx_v_idx2; - __pyx_t_19 = 1; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_surr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_surr.shape[1]; - __pyx_t_18 = __pyx_v_idx; - __pyx_t_17 = 1; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_20 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_18 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_17 * __pyx_v_coor_oh2.strides[1]) )))); + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 149, __pyx_L1_error) + } + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 149, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_8; - /* "src/helpers/miscellaneous.pyx":98 - * dx = coor_surr[idx2,0] - coor_oh2[idx,0] - * dy = coor_surr[idx2,1] - coor_oh2[idx,1] - * dz = coor_surr[idx2,2] - coor_oh2[idx,2] # <<<<<<<<<<<<<< - * dot = dx*dx + dy*dy + dz*dz - * dist = sqrt(dot) + /* "View.MemoryView":152 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * */ - __pyx_t_17 = __pyx_v_idx2; - __pyx_t_18 = 2; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_surr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_surr.shape[1]; - __pyx_t_19 = __pyx_v_idx; - __pyx_t_20 = 2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_17 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_18 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_oh2.strides[1]) )))); + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - /* "src/helpers/miscellaneous.pyx":99 - * dy = coor_surr[idx2,1] - coor_oh2[idx,1] - * dz = coor_surr[idx2,2] - coor_oh2[idx,2] - * dot = dx*dx + dy*dy + dz*dz # <<<<<<<<<<<<<< - * dist = sqrt(dot) - * if dist < maxdist: + /* "View.MemoryView":153 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: */ - __pyx_v_dot = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - /* "src/helpers/miscellaneous.pyx":100 - * dz = coor_surr[idx2,2] - coor_oh2[idx,2] - * dot = dx*dx + dy*dy + dz*dz - * dist = sqrt(dot) # <<<<<<<<<<<<<< - * if dist < maxdist: - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * */ - __pyx_v_dist = sqrt(__pyx_v_dot); + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { - /* "src/helpers/miscellaneous.pyx":101 - * dot = dx*dx + dy*dy + dz*dz - * dist = sqrt(dot) - * if dist < maxdist: # <<<<<<<<<<<<<< - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] + /* "View.MemoryView":156 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * */ - __pyx_t_21 = ((__pyx_v_dist < __pyx_v_maxdist) != 0); - if (__pyx_t_21) { + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 156, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":102 - * dist = sqrt(dot) - * if dist < maxdist: - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] # <<<<<<<<<<<<<< - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] - * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * */ - __pyx_t_20 = __pyx_v_idx3; - __pyx_t_19 = 0; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[1]; - __pyx_t_18 = __pyx_v_idx; - __pyx_t_17 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dx2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_20 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_18 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_17 * __pyx_v_coor_oh2.strides[1]) )))); + } - /* "src/helpers/miscellaneous.pyx":103 - * if dist < maxdist: - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] # <<<<<<<<<<<<<< - * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] - * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 + /* "View.MemoryView":159 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." */ - __pyx_t_17 = __pyx_v_idx3; - __pyx_t_18 = 1; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_oh2.shape[1]; - __pyx_t_19 = __pyx_v_idx; - __pyx_t_20 = 1; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dy2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_17 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_18 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_oh2.strides[1]) )))); + __pyx_t_7 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(1, 159, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_7; + __pyx_t_7 = (__pyx_t_7 + 1); - /* "src/helpers/miscellaneous.pyx":104 - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] - * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] # <<<<<<<<<<<<<< - * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 - * dist2 = sqrt(dot2) + /* "View.MemoryView":160 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim */ - __pyx_t_20 = __pyx_v_idx3; - __pyx_t_19 = 2; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[1]; - __pyx_t_18 = __pyx_v_idx; - __pyx_t_17 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_oh2.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_oh2.shape[1]; - __pyx_v_dz2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_20 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_18 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_17 * __pyx_v_coor_oh2.strides[1]) )))); + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { - /* "src/helpers/miscellaneous.pyx":105 - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] - * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] - * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 # <<<<<<<<<<<<<< - * dist2 = sqrt(dot2) - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) + /* "View.MemoryView":161 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim + * */ - __pyx_v_dot2 = (((__pyx_v_dx2 * __pyx_v_dx2) + (__pyx_v_dy2 * __pyx_v_dy2)) + (__pyx_v_dz2 * __pyx_v_dz2)); + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = 0; + __pyx_t_10 = 127; + __Pyx_INCREF(__pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_9 += 22; + __Pyx_GIVEREF(__pyx_kp_u_Invalid_shape_in_axis); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u_); + __pyx_t_9 += 2; + __Pyx_GIVEREF(__pyx_kp_u_); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_); + __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u__2); + __pyx_t_9 += 1; + __Pyx_GIVEREF(__pyx_kp_u__2); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2); + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 161, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":106 - * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] - * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 - * dist2 = sqrt(dot2) # <<<<<<<<<<<<<< - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) - * if cosine < cos_angle: + /* "View.MemoryView":160 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim */ - __pyx_v_dist2 = sqrt(__pyx_v_dot2); + } - /* "src/helpers/miscellaneous.pyx":107 - * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 - * dist2 = sqrt(dot2) - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) # <<<<<<<<<<<<<< - * if cosine < cos_angle: - * hbond[i] += 1 + /* "View.MemoryView":162 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order */ - __pyx_t_22 = (((__pyx_v_dx * __pyx_v_dx2) + (__pyx_v_dy * __pyx_v_dy2)) + (__pyx_v_dz * __pyx_v_dz2)); - __pyx_t_23 = (__pyx_v_dist * __pyx_v_dist2); - if (unlikely(__pyx_t_23 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - __PYX_ERR(0, 107, __pyx_L8_error) - } - __pyx_v_cosine = (__pyx_t_22 / __pyx_t_23); + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - /* "src/helpers/miscellaneous.pyx":108 - * dist2 = sqrt(dot2) - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) - * if cosine < cos_angle: # <<<<<<<<<<<<<< - * hbond[i] += 1 + /* "View.MemoryView":159 * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." */ - __pyx_t_21 = ((__pyx_v_cosine < __pyx_v_cos_angle) != 0); - if (__pyx_t_21) { + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":109 - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) - * if cosine < cos_angle: - * hbond[i] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":165 * - * return np.asarray(hbond) + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' */ - __pyx_t_17 = __pyx_v_i; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_hbond.shape[0]; - *((int *) ( /* dim=0 */ (__pyx_v_hbond.data + __pyx_t_17 * __pyx_v_hbond.strides[0]) )) += 1; + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 165, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/helpers/miscellaneous.pyx":108 - * dist2 = sqrt(dot2) - * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) - * if cosine < cos_angle: # <<<<<<<<<<<<<< - * hbond[i] += 1 - * + /* "View.MemoryView":166 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': */ - } + __pyx_v_order = 'C'; - /* "src/helpers/miscellaneous.pyx":101 - * dot = dx*dx + dy*dy + dz*dz - * dist = sqrt(dot) - * if dist < maxdist: # <<<<<<<<<<<<<< - * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] - * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] + /* "View.MemoryView":167 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' */ - } - } - } - } - goto __pyx_L19; - __pyx_L8_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_exc_type) - #endif /* _OPENMP */ - if (!__pyx_parallel_exc_type) { - __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); - __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; - __Pyx_GOTREF(__pyx_parallel_exc_type); - } - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_parallel_why = 4; - goto __pyx_L18; - __pyx_L18:; - #ifdef _OPENMP - #pragma omp critical(__pyx_parallel_lastprivates7) - #endif /* _OPENMP */ - { - __pyx_parallel_temp0 = __pyx_v_cosine; - __pyx_parallel_temp1 = __pyx_v_dist; - __pyx_parallel_temp2 = __pyx_v_dist2; - __pyx_parallel_temp3 = __pyx_v_dot; - __pyx_parallel_temp4 = __pyx_v_dot2; - __pyx_parallel_temp5 = __pyx_v_dx; - __pyx_parallel_temp6 = __pyx_v_dx2; - __pyx_parallel_temp7 = __pyx_v_dy; - __pyx_parallel_temp8 = __pyx_v_dy2; - __pyx_parallel_temp9 = __pyx_v_dz; - __pyx_parallel_temp10 = __pyx_v_dz2; - __pyx_parallel_temp11 = __pyx_v_i; - __pyx_parallel_temp12 = __pyx_v_idx; - __pyx_parallel_temp13 = __pyx_v_idx2; - __pyx_parallel_temp14 = __pyx_v_idx3; - __pyx_parallel_temp15 = __pyx_v_j; - __pyx_parallel_temp16 = __pyx_v_k; - __pyx_parallel_temp17 = __pyx_v_l; - } - __pyx_L19:; - #ifdef _OPENMP - #pragma omp flush(__pyx_parallel_why) - #endif /* _OPENMP */ - } - } - #ifdef _OPENMP - Py_END_ALLOW_THREADS - #else -{ -#ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - #endif /* _OPENMP */ - /* Clean up any temporaries */ - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - #ifndef _OPENMP -} -#endif /* _OPENMP */ - } - } - if (__pyx_parallel_exc_type) { - /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ - __pyx_parallel_why = 4; - } - if (__pyx_parallel_why) { - __pyx_v_cosine = __pyx_parallel_temp0; - __pyx_v_dist = __pyx_parallel_temp1; - __pyx_v_dist2 = __pyx_parallel_temp2; - __pyx_v_dot = __pyx_parallel_temp3; - __pyx_v_dot2 = __pyx_parallel_temp4; - __pyx_v_dx = __pyx_parallel_temp5; - __pyx_v_dx2 = __pyx_parallel_temp6; - __pyx_v_dy = __pyx_parallel_temp7; - __pyx_v_dy2 = __pyx_parallel_temp8; - __pyx_v_dz = __pyx_parallel_temp9; - __pyx_v_dz2 = __pyx_parallel_temp10; - __pyx_v_i = __pyx_parallel_temp11; - __pyx_v_idx = __pyx_parallel_temp12; - __pyx_v_idx2 = __pyx_parallel_temp13; - __pyx_v_idx3 = __pyx_parallel_temp14; - __pyx_v_j = __pyx_parallel_temp15; - __pyx_v_k = __pyx_parallel_temp16; - __pyx_v_l = __pyx_parallel_temp17; - switch (__pyx_parallel_why) { - case 4: - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_GIVEREF(__pyx_parallel_exc_type); - __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); - __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - goto __pyx_L4_error; - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __Pyx_INCREF(__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_c; - /* "src/helpers/miscellaneous.pyx":86 + /* "View.MemoryView":165 * - * # loop over water molecules - * for i in prange(nwat, nogil=True): # <<<<<<<<<<<<<< - * # loop over h atoms - * for j in range(2): + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } + goto __pyx_L11; } - /* "src/helpers/miscellaneous.pyx":111 - * hbond[i] += 1 - * - * return np.asarray(hbond) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_hbond, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 168, __pyx_L1_error) + if (likely(__pyx_t_3)) { - /* "src/helpers/miscellaneous.pyx":74 - * - * @cython.boundscheck(False) - * def countHBonds(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist, double cos_angle=-0.95): # <<<<<<<<<<<<<< - * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr + /* "View.MemoryView":169 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: */ + __pyx_v_order = 'F'; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); + /* "View.MemoryView":170 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + */ + __Pyx_INCREF(__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_fortran; + + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' + */ + goto __pyx_L11; + } + + /* "View.MemoryView":172 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 172, __pyx_L1_error) + } + __pyx_L11:; + + /* "View.MemoryView":174 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer + */ + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + + /* "View.MemoryView":176 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * + */ + __pyx_v_self->free_data = __pyx_v_allocate_buffer; + + /* "View.MemoryView":177 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: + */ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 177, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; + + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * + */ + if (__pyx_v_allocate_buffer) { + + /* "View.MemoryView":180 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') + */ + __pyx_t_7 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 180, __pyx_L1_error) + + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * + */ + } + + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_AddTraceback("newanalysis.miscellaneous.countHBonds", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_hbond, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor_surr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor_oh2, 1); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_format); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":114 +/* "View.MemoryView":182 + * _allocate_buffer(self) * - * @cython.boundscheck(False) - * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): # <<<<<<<<<<<<<< - * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_5structureFactorDipTen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_5structureFactorDipTen = {"structureFactorDipTen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_5structureFactorDipTen, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_5structureFactorDipTen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_bin_dist; - int __pyx_v_segs; - double __pyx_v_boxlength; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("structureFactorDipTen (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coors,&__pyx_n_s_histogram,&__pyx_n_s_bin_dist,&__pyx_n_s_segs,&__pyx_n_s_boxlength,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coors)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histogram)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("structureFactorDipTen", 1, 5, 5, 1); __PYX_ERR(0, 114, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bin_dist)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("structureFactorDipTen", 1, 5, 5, 2); __PYX_ERR(0, 114, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_segs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("structureFactorDipTen", 1, 5, 5, 3); __PYX_ERR(0, 114, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("structureFactorDipTen", 1, 5, 5, 4); __PYX_ERR(0, 114, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "structureFactorDipTen") < 0)) __PYX_ERR(0, 114, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - } - __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 114, __pyx_L3_error) - __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 114, __pyx_L3_error) - __pyx_v_bin_dist = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_bin_dist == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L3_error) - __pyx_v_segs = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_segs == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L3_error) - __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("structureFactorDipTen", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 114, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.structureFactorDipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_4structureFactorDipTen(__pyx_self, __pyx_v_coors, __pyx_v_histogram, __pyx_v_bin_dist, __pyx_v_segs, __pyx_v_boxlength); + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_4structureFactorDipTen(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coors, __Pyx_memviewslice __pyx_v_histogram, int __pyx_v_bin_dist, int __pyx_v_segs, double __pyx_v_boxlength) { - int __pyx_v_n_particles; - int __pyx_v_pair_1_par_1; - int __pyx_v_pair_1_par_2; - int __pyx_v_pair_2_par_1; - int __pyx_v_pair_2_par_2; - double __pyx_v_D_x; - double __pyx_v_D_y; - double __pyx_v_D_z; - double __pyx_v_dist1; - double __pyx_v_dist2; - int __pyx_v_bin1; - int __pyx_v_bin2; - double __pyx_v_blen2; - PyObject *__pyx_r = NULL; +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; __Pyx_RefNannyDeclarations - long __pyx_t_1; - long __pyx_t_2; - int __pyx_t_3; + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - double __pyx_t_16; - long __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - int __pyx_t_23; + Py_ssize_t *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("structureFactorDipTen", 0); + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); - /* "src/helpers/miscellaneous.pyx":115 - * @cython.boundscheck(False) - * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): - * cdef int n_particles = coors.shape[0] # <<<<<<<<<<<<<< - * cdef int pair_1_par_1 = 0 - * cdef int pair_1_par_2 = 0 + /* "View.MemoryView":184 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": */ - __pyx_v_n_particles = (__pyx_v_coors.shape[0]); + __pyx_v_bufmode = -1; - /* "src/helpers/miscellaneous.pyx":116 - * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): - * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 # <<<<<<<<<<<<<< - * cdef int pair_1_par_2 = 0 - * cdef int pair_2_par_1 = 0 + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __pyx_v_pair_1_par_1 = 0; + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":117 - * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 - * cdef int pair_1_par_2 = 0 # <<<<<<<<<<<<<< - * cdef int pair_2_par_1 = 0 - * cdef int pair_2_par_2 = 0 + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": */ - __pyx_v_pair_1_par_2 = 0; + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":118 - * cdef int pair_1_par_1 = 0 - * cdef int pair_1_par_2 = 0 - * cdef int pair_2_par_1 = 0 # <<<<<<<<<<<<<< - * cdef int pair_2_par_2 = 0 - * cdef double D_x, D_y, D_z + /* "View.MemoryView":187 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __pyx_v_pair_2_par_1 = 0; + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - /* "src/helpers/miscellaneous.pyx":119 - * cdef int pair_1_par_2 = 0 - * cdef int pair_2_par_1 = 0 - * cdef int pair_2_par_2 = 0 # <<<<<<<<<<<<<< - * cdef double D_x, D_y, D_z - * cdef double dist1, dist2 + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": */ - __pyx_v_pair_2_par_2 = 0; + goto __pyx_L4; + } - /* "src/helpers/miscellaneous.pyx":123 - * cdef double dist1, dist2 - * cdef int bin1, bin2 - * cdef double blen2 = boxlength / 2.0 # <<<<<<<<<<<<<< - * - * for pair_1_par_1 in range(0, n_particles-1): + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): */ - __pyx_v_blen2 = (__pyx_v_boxlength / 2.0); + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 188, __pyx_L1_error) + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":125 - * cdef double blen2 = boxlength / 2.0 - * - * for pair_1_par_1 in range(0, n_particles-1): # <<<<<<<<<<<<<< - * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): - * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] + /* "View.MemoryView":189 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." */ - __pyx_t_1 = (__pyx_v_n_particles - 1); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_pair_1_par_1 = __pyx_t_3; + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - /* "src/helpers/miscellaneous.pyx":126 - * - * for pair_1_par_1 in range(0, n_particles-1): - * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): # <<<<<<<<<<<<<< - * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] - * if(D_x > blen2) : D_x -= boxlength + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): */ - __pyx_t_4 = __pyx_v_n_particles; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = (__pyx_v_pair_1_par_1 + 1); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_pair_1_par_2 = __pyx_t_6; + } + __pyx_L4:; - /* "src/helpers/miscellaneous.pyx":127 - * for pair_1_par_1 in range(0, n_particles-1): - * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): - * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] # <<<<<<<<<<<<<< - * if(D_x > blen2) : D_x -= boxlength - * elif(D_x < -blen2) : D_x += boxlength + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data */ - __pyx_t_7 = __pyx_v_pair_1_par_1; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; - __pyx_t_9 = __pyx_v_pair_1_par_2; - __pyx_t_10 = 0; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; - __pyx_v_D_x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) )))); + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/miscellaneous.pyx":128 - * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): - * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] - * if(D_x > blen2) : D_x -= boxlength # <<<<<<<<<<<<<< - * elif(D_x < -blen2) : D_x += boxlength - * + /* "View.MemoryView":191 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len */ - __pyx_t_11 = ((__pyx_v_D_x > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_x = (__pyx_v_D_x - __pyx_v_boxlength); - goto __pyx_L7; - } + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 191, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":129 - * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] - * if(D_x > blen2) : D_x -= boxlength - * elif(D_x < -blen2) : D_x += boxlength # <<<<<<<<<<<<<< - * - * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data */ - __pyx_t_11 = ((__pyx_v_D_x < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_x = (__pyx_v_D_x + __pyx_v_boxlength); - } - __pyx_L7:; + } - /* "src/helpers/miscellaneous.pyx":131 - * elif(D_x < -blen2) : D_x += boxlength - * - * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] # <<<<<<<<<<<<<< - * if(D_y > blen2) : D_y -= boxlength - * elif(D_y < -blen2) : D_y += boxlength + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __pyx_t_10 = __pyx_v_pair_1_par_1; - __pyx_t_9 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; - __pyx_t_8 = __pyx_v_pair_1_par_2; - __pyx_t_7 = 1; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; - __pyx_v_D_y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_10 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); + } - /* "src/helpers/miscellaneous.pyx":132 - * - * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] - * if(D_y > blen2) : D_y -= boxlength # <<<<<<<<<<<<<< - * elif(D_y < -blen2) : D_y += boxlength + /* "View.MemoryView":192 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len * */ - __pyx_t_11 = ((__pyx_v_D_y > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_y = (__pyx_v_D_y - __pyx_v_boxlength); - goto __pyx_L8; - } + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; - /* "src/helpers/miscellaneous.pyx":133 - * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] - * if(D_y > blen2) : D_y -= boxlength - * elif(D_y < -blen2) : D_y += boxlength # <<<<<<<<<<<<<< + /* "View.MemoryView":193 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< * - * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] + * if flags & PyBUF_STRIDES: */ - __pyx_t_11 = ((__pyx_v_D_y < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_y = (__pyx_v_D_y + __pyx_v_boxlength); - } - __pyx_L8:; + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":135 - * elif(D_y < -blen2) : D_y += boxlength + /* "View.MemoryView":195 + * info.len = self.len * - * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] # <<<<<<<<<<<<<< - * if(D_z > blen2) : D_z -= boxlength - * elif(D_z < -blen2) : D_z += boxlength + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape */ - __pyx_t_7 = __pyx_v_pair_1_par_1; - __pyx_t_8 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; - __pyx_t_9 = __pyx_v_pair_1_par_2; - __pyx_t_10 = 2; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; - __pyx_v_D_z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) )))); + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":136 - * - * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] - * if(D_z > blen2) : D_z -= boxlength # <<<<<<<<<<<<<< - * elif(D_z < -blen2) : D_z += boxlength + /* "View.MemoryView":196 * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides */ - __pyx_t_11 = ((__pyx_v_D_z > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_z = (__pyx_v_D_z - __pyx_v_boxlength); - goto __pyx_L9; - } + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; - /* "src/helpers/miscellaneous.pyx":137 - * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] - * if(D_z > blen2) : D_z -= boxlength - * elif(D_z < -blen2) : D_z += boxlength # <<<<<<<<<<<<<< - * - * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) + /* "View.MemoryView":197 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: */ - __pyx_t_11 = ((__pyx_v_D_z < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_z = (__pyx_v_D_z + __pyx_v_boxlength); - } - __pyx_L9:; + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; - /* "src/helpers/miscellaneous.pyx":139 - * elif(D_z < -blen2) : D_z += boxlength - * - * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) # <<<<<<<<<<<<<< - * - * for pair_2_par_1 in range(0, n_particles-1): + /* "View.MemoryView":198 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 */ - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyFloat_FromDouble((((__pyx_v_D_x * __pyx_v_D_x) + (__pyx_v_D_y * __pyx_v_D_y)) + (__pyx_v_D_z * __pyx_v_D_z))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_15 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); - } - } - __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13); - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_v_dist1 = __pyx_t_16; + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; - /* "src/helpers/miscellaneous.pyx":141 - * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) + /* "View.MemoryView":195 + * info.len = self.len * - * for pair_2_par_1 in range(0, n_particles-1): # <<<<<<<<<<<<<< - * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): - * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape */ - __pyx_t_17 = (__pyx_v_n_particles - 1); - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_pair_2_par_1 = __pyx_t_19; + goto __pyx_L6; + } - /* "src/helpers/miscellaneous.pyx":142 - * - * for pair_2_par_1 in range(0, n_particles-1): - * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): # <<<<<<<<<<<<<< - * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue - * + /* "View.MemoryView":200 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL */ - __pyx_t_20 = __pyx_v_n_particles; - __pyx_t_21 = __pyx_t_20; - for (__pyx_t_22 = (__pyx_v_pair_2_par_1 + 1); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { - __pyx_v_pair_2_par_2 = __pyx_t_22; + /*else*/ { + __pyx_v_info->ndim = 1; - /* "src/helpers/miscellaneous.pyx":143 - * for pair_2_par_1 in range(0, n_particles-1): - * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): - * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue # <<<<<<<<<<<<<< + /* "View.MemoryView":201 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL * - * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] */ - __pyx_t_23 = ((__pyx_v_pair_1_par_1 == __pyx_v_pair_2_par_1) != 0); - if (__pyx_t_23) { - } else { - __pyx_t_11 = __pyx_t_23; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_23 = ((__pyx_v_pair_1_par_2 == __pyx_v_pair_2_par_2) != 0); - __pyx_t_11 = __pyx_t_23; - __pyx_L15_bool_binop_done:; - if (__pyx_t_11) { - goto __pyx_L12_continue; - } + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; + } + __pyx_v_info->shape = __pyx_t_5; - /* "src/helpers/miscellaneous.pyx":145 - * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue + /* "View.MemoryView":202 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< * - * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] # <<<<<<<<<<<<<< - * if(D_x > blen2) : D_x -= boxlength - * elif(D_x < -blen2) : D_x += boxlength + * info.suboffsets = NULL */ - __pyx_t_10 = __pyx_v_pair_2_par_1; - __pyx_t_9 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; - __pyx_t_8 = __pyx_v_pair_2_par_2; - __pyx_t_7 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; - __pyx_v_D_x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_10 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); + __pyx_v_info->strides = NULL; + } + __pyx_L6:; - /* "src/helpers/miscellaneous.pyx":146 - * - * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] - * if(D_x > blen2) : D_x -= boxlength # <<<<<<<<<<<<<< - * elif(D_x < -blen2) : D_x += boxlength + /* "View.MemoryView":204 + * info.strides = NULL * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 */ - __pyx_t_11 = ((__pyx_v_D_x > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_x = (__pyx_v_D_x - __pyx_v_boxlength); - goto __pyx_L17; - } + __pyx_v_info->suboffsets = NULL; - /* "src/helpers/miscellaneous.pyx":147 - * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] - * if(D_x > blen2) : D_x -= boxlength - * elif(D_x < -blen2) : D_x += boxlength # <<<<<<<<<<<<<< + /* "View.MemoryView":205 * - * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL */ - __pyx_t_11 = ((__pyx_v_D_x < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_x = (__pyx_v_D_x + __pyx_v_boxlength); - } - __pyx_L17:; + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":149 - * elif(D_x < -blen2) : D_x += boxlength - * - * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] # <<<<<<<<<<<<<< - * if(D_y > blen2) : D_y -= boxlength - * elif(D_y < -blen2) : D_y += boxlength - */ - __pyx_t_7 = __pyx_v_pair_2_par_1; - __pyx_t_8 = 1; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; - __pyx_t_9 = __pyx_v_pair_2_par_2; - __pyx_t_10 = 1; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; - __pyx_v_D_y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) )))); + /* "View.MemoryView":206 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self + */ + __pyx_v_info->readonly = 0; - /* "src/helpers/miscellaneous.pyx":150 - * - * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] - * if(D_y > blen2) : D_y -= boxlength # <<<<<<<<<<<<<< - * elif(D_y < -blen2) : D_y += boxlength + /* "View.MemoryView":207 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self * */ - __pyx_t_11 = ((__pyx_v_D_y > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_y = (__pyx_v_D_y - __pyx_v_boxlength); - goto __pyx_L18; - } + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; + } + __pyx_v_info->format = __pyx_t_2; - /* "src/helpers/miscellaneous.pyx":151 - * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] - * if(D_y > blen2) : D_y -= boxlength - * elif(D_y < -blen2) : D_y += boxlength # <<<<<<<<<<<<<< + /* "View.MemoryView":208 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< * - * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] + * def __dealloc__(array self): */ - __pyx_t_11 = ((__pyx_v_D_y < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_y = (__pyx_v_D_y + __pyx_v_boxlength); - } - __pyx_L18:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "src/helpers/miscellaneous.pyx":153 - * elif(D_y < -blen2) : D_y += boxlength + /* "View.MemoryView":182 + * _allocate_buffer(self) * - * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] # <<<<<<<<<<<<<< - * if(D_z > blen2) : D_z -= boxlength - * elif(D_z < -blen2) : D_z += boxlength + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ - __pyx_t_10 = __pyx_v_pair_2_par_1; - __pyx_t_9 = 2; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; - __pyx_t_8 = __pyx_v_pair_2_par_2; - __pyx_t_7 = 2; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; - __pyx_v_D_z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_10 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":154 - * - * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] - * if(D_z > blen2) : D_z -= boxlength # <<<<<<<<<<<<<< - * elif(D_z < -blen2) : D_z += boxlength + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":210 + * info.obj = self * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ - __pyx_t_11 = ((__pyx_v_D_z > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_z = (__pyx_v_D_z - __pyx_v_boxlength); - goto __pyx_L19; - } - /* "src/helpers/miscellaneous.pyx":155 - * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] - * if(D_z > blen2) : D_z -= boxlength - * elif(D_z < -blen2) : D_z += boxlength # <<<<<<<<<<<<<< +/* Python wrapper */ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "View.MemoryView":211 * - * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - __pyx_t_11 = ((__pyx_v_D_z < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_z = (__pyx_v_D_z + __pyx_v_boxlength); - } - __pyx_L19:; + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":157 - * elif(D_z < -blen2) : D_z += boxlength - * - * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) # <<<<<<<<<<<<<< - * - * bin1 = int(segs * dist1) + /* "View.MemoryView":212 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyFloat_FromDouble((((__pyx_v_D_x * __pyx_v_D_x) + (__pyx_v_D_y * __pyx_v_D_y)) + (__pyx_v_D_z * __pyx_v_D_z))); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); - } - } - __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_15, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_14); - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_v_dist2 = __pyx_t_16; + __pyx_v_self->callback_free_data(__pyx_v_self->data); - /* "src/helpers/miscellaneous.pyx":159 - * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) - * - * bin1 = int(segs * dist1) # <<<<<<<<<<<<<< - * bin2 = int(segs * dist2) + /* "View.MemoryView":211 * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - __pyx_v_bin1 = ((int)(__pyx_v_segs * __pyx_v_dist1)); + goto __pyx_L3; + } - /* "src/helpers/miscellaneous.pyx":160 - * - * bin1 = int(segs * dist1) - * bin2 = int(segs * dist2) # <<<<<<<<<<<<<< - * - * if (bin1 < bin_dist) and (bin2 < bin_dist): + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) */ - __pyx_v_bin2 = ((int)(__pyx_v_segs * __pyx_v_dist2)); + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":162 - * bin2 = int(segs * dist2) - * - * if (bin1 < bin_dist) and (bin2 < bin_dist): # <<<<<<<<<<<<<< - * histogram[bin1, bin2] += (pow(dist1, -3) * pow(dist2, -3)) - * histogram[bin2, bin2] += histogram[bin1, bin2] + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) */ - __pyx_t_23 = ((__pyx_v_bin1 < __pyx_v_bin_dist) != 0); - if (__pyx_t_23) { - } else { - __pyx_t_11 = __pyx_t_23; - goto __pyx_L21_bool_binop_done; - } - __pyx_t_23 = ((__pyx_v_bin2 < __pyx_v_bin_dist) != 0); - __pyx_t_11 = __pyx_t_23; - __pyx_L21_bool_binop_done:; - if (__pyx_t_11) { + if (__pyx_v_self->dtype_is_object) { - /* "src/helpers/miscellaneous.pyx":163 - * - * if (bin1 < bin_dist) and (bin2 < bin_dist): - * histogram[bin1, bin2] += (pow(dist1, -3) * pow(dist2, -3)) # <<<<<<<<<<<<<< - * histogram[bin2, bin2] += histogram[bin1, bin2] - * + /* "View.MemoryView":215 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) */ - __pyx_t_7 = __pyx_v_bin1; - __pyx_t_8 = __pyx_v_bin2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_7 * __pyx_v_histogram.strides[0]) ) + __pyx_t_8 * __pyx_v_histogram.strides[1]) )) += (pow(__pyx_v_dist1, -3.0) * pow(__pyx_v_dist2, -3.0)); + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); - /* "src/helpers/miscellaneous.pyx":164 - * if (bin1 < bin_dist) and (bin2 < bin_dist): - * histogram[bin1, bin2] += (pow(dist1, -3) * pow(dist2, -3)) - * histogram[bin2, bin2] += histogram[bin1, bin2] # <<<<<<<<<<<<<< - * - * + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) */ - __pyx_t_8 = __pyx_v_bin1; - __pyx_t_7 = __pyx_v_bin2; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[1]; - __pyx_t_9 = __pyx_v_bin2; - __pyx_t_10 = __pyx_v_bin2; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_histogram.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_histogram.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_9 * __pyx_v_histogram.strides[0]) ) + __pyx_t_10 * __pyx_v_histogram.strides[1]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_8 * __pyx_v_histogram.strides[0]) ) + __pyx_t_7 * __pyx_v_histogram.strides[1]) ))); + } - /* "src/helpers/miscellaneous.pyx":162 - * bin2 = int(segs * dist2) + /* "View.MemoryView":216 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) * - * if (bin1 < bin_dist) and (bin2 < bin_dist): # <<<<<<<<<<<<<< - * histogram[bin1, bin2] += (pow(dist1, -3) * pow(dist2, -3)) - * histogram[bin2, bin2] += histogram[bin1, bin2] */ - } - __pyx_L12_continue:; - } - } - } + free(__pyx_v_self->data); + + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + */ } + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":114 + /* "View.MemoryView":217 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): # <<<<<<<<<<<<<< - * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 + * @property + */ + PyObject_Free(__pyx_v_self->_shape); + + /* "View.MemoryView":210 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_AddTraceback("newanalysis.miscellaneous.structureFactorDipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_coors, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histogram, 1); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":168 +/* "View.MemoryView":219 + * PyObject_Free(self._shape) * - * @cython.boundscheck(False) - * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): # <<<<<<<<<<<<<< - * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_7structureFactorCharge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_7structureFactorCharge = {"structureFactorCharge", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_7structureFactorCharge, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_7structureFactorCharge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_bin_dist; - int __pyx_v_segs; - double __pyx_v_boxlength; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("structureFactorCharge (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coors,&__pyx_n_s_charges,&__pyx_n_s_histogram,&__pyx_n_s_bin_dist,&__pyx_n_s_segs,&__pyx_n_s_boxlength,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coors)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, 1); __PYX_ERR(0, 168, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histogram)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, 2); __PYX_ERR(0, 168, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bin_dist)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, 3); __PYX_ERR(0, 168, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_segs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, 4); __PYX_ERR(0, 168, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, 5); __PYX_ERR(0, 168, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "structureFactorCharge") < 0)) __PYX_ERR(0, 168, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - } - __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_v_bin_dist = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_bin_dist == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_v_segs = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_segs == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.structureFactorCharge", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_6structureFactorCharge(__pyx_self, __pyx_v_coors, __pyx_v_charges, __pyx_v_histogram, __pyx_v_bin_dist, __pyx_v_segs, __pyx_v_boxlength); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_6structureFactorCharge(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coors, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_histogram, int __pyx_v_bin_dist, int __pyx_v_segs, double __pyx_v_boxlength) { - int __pyx_v_n_particles; - int __pyx_v_pair_1_par_1; - int __pyx_v_pair_1_par_2; - int __pyx_v_pair_2_par_1; - int __pyx_v_pair_2_par_2; - double __pyx_v_D_x; - double __pyx_v_D_y; - double __pyx_v_D_z; - double __pyx_v_dist1; - double __pyx_v_dist2; - double __pyx_v_energy1; - double __pyx_v_energy2; - int __pyx_v_bin1; - int __pyx_v_bin2; - double __pyx_v_blen2; +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - long __pyx_t_1; - long __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - double __pyx_t_16; - long __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - int __pyx_t_23; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("structureFactorCharge", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/miscellaneous.pyx":169 - * @cython.boundscheck(False) - * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): - * cdef int n_particles = coors.shape[0] # <<<<<<<<<<<<<< - * cdef int pair_1_par_1 = 0 - * cdef int pair_1_par_2 = 0 + /* "View.MemoryView":221 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< + * + * @cname('get_memview') */ - __pyx_v_n_particles = (__pyx_v_coors.shape[0]); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":170 - * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): - * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 # <<<<<<<<<<<<<< - * cdef int pair_1_par_2 = 0 - * cdef int pair_2_par_1 = 0 + /* "View.MemoryView":219 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() */ - __pyx_v_pair_1_par_1 = 0; - /* "src/helpers/miscellaneous.pyx":171 - * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 - * cdef int pair_1_par_2 = 0 # <<<<<<<<<<<<<< - * cdef int pair_2_par_1 = 0 - * cdef int pair_2_par_2 = 0 - */ - __pyx_v_pair_1_par_2 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":172 - * cdef int pair_1_par_1 = 0 - * cdef int pair_1_par_2 = 0 - * cdef int pair_2_par_1 = 0 # <<<<<<<<<<<<<< - * cdef int pair_2_par_2 = 0 - * cdef double D_x, D_y, D_z +/* "View.MemoryView":224 + * + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) */ - __pyx_v_pair_2_par_1 = 0; - /* "src/helpers/miscellaneous.pyx":173 - * cdef int pair_1_par_2 = 0 - * cdef int pair_2_par_1 = 0 - * cdef int pair_2_par_2 = 0 # <<<<<<<<<<<<<< - * cdef double D_x, D_y, D_z - * cdef double dist1, dist2 - */ - __pyx_v_pair_2_par_2 = 0; +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); - /* "src/helpers/miscellaneous.pyx":178 - * cdef double energy1, energy2 - * cdef int bin1, bin2 - * cdef double blen2 = boxlength / 2.0 # <<<<<<<<<<<<<< + /* "View.MemoryView":225 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) * - * for pair_1_par_1 in range(0, n_particles-1): */ - __pyx_v_blen2 = (__pyx_v_boxlength / 2.0); + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); - /* "src/helpers/miscellaneous.pyx":180 - * cdef double blen2 = boxlength / 2.0 + /* "View.MemoryView":226 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< * - * for pair_1_par_1 in range(0, n_particles-1): # <<<<<<<<<<<<<< - * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): - * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] + * def __len__(self): */ - __pyx_t_1 = (__pyx_v_n_particles - 1); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_pair_1_par_1 = __pyx_t_3; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":181 + /* "View.MemoryView":224 * - * for pair_1_par_1 in range(0, n_particles-1): - * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): # <<<<<<<<<<<<<< - * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] - * if(D_x > blen2) : D_x -= boxlength + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) */ - __pyx_t_4 = __pyx_v_n_particles; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = (__pyx_v_pair_1_par_1 + 1); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_pair_1_par_2 = __pyx_t_6; - /* "src/helpers/miscellaneous.pyx":182 - * for pair_1_par_1 in range(0, n_particles-1): - * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): - * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] # <<<<<<<<<<<<<< - * if(D_x > blen2) : D_x -= boxlength - * elif(D_x < -blen2) : D_x += boxlength - */ - __pyx_t_7 = __pyx_v_pair_1_par_1; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; - __pyx_t_9 = __pyx_v_pair_1_par_2; - __pyx_t_10 = 0; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; - __pyx_v_D_x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) )))); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":183 - * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): - * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] - * if(D_x > blen2) : D_x -= boxlength # <<<<<<<<<<<<<< - * elif(D_x < -blen2) : D_x += boxlength +/* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) * - */ - __pyx_t_11 = ((__pyx_v_D_x > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_x = (__pyx_v_D_x - __pyx_v_boxlength); - goto __pyx_L7; - } - - /* "src/helpers/miscellaneous.pyx":184 - * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] - * if(D_x > blen2) : D_x -= boxlength - * elif(D_x < -blen2) : D_x += boxlength # <<<<<<<<<<<<<< + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * - * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] */ - __pyx_t_11 = ((__pyx_v_D_x < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_x = (__pyx_v_D_x + __pyx_v_boxlength); - } - __pyx_L7:; - /* "src/helpers/miscellaneous.pyx":186 - * elif(D_x < -blen2) : D_x += boxlength - * - * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] # <<<<<<<<<<<<<< - * if(D_y > blen2) : D_y -= boxlength - * elif(D_y < -blen2) : D_y += boxlength - */ - __pyx_t_10 = __pyx_v_pair_1_par_1; - __pyx_t_9 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; - __pyx_t_8 = __pyx_v_pair_1_par_2; - __pyx_t_7 = 1; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; - __pyx_v_D_y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_10 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); +/* Python wrapper */ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); - /* "src/helpers/miscellaneous.pyx":187 - * - * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] - * if(D_y > blen2) : D_y -= boxlength # <<<<<<<<<<<<<< - * elif(D_y < -blen2) : D_y += boxlength - * - */ - __pyx_t_11 = ((__pyx_v_D_y > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_y = (__pyx_v_D_y - __pyx_v_boxlength); - goto __pyx_L8; - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":188 - * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] - * if(D_y > blen2) : D_y -= boxlength - * elif(D_y < -blen2) : D_y += boxlength # <<<<<<<<<<<<<< - * - * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] - */ - __pyx_t_11 = ((__pyx_v_D_y < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_y = (__pyx_v_D_y + __pyx_v_boxlength); - } - __pyx_L8:; +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__", 0); - /* "src/helpers/miscellaneous.pyx":190 - * elif(D_y < -blen2) : D_y += boxlength + /* "View.MemoryView":229 * - * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] # <<<<<<<<<<<<<< - * if(D_z > blen2) : D_z -= boxlength - * elif(D_z < -blen2) : D_z += boxlength + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< + * + * def __getattr__(self, attr): */ - __pyx_t_7 = __pyx_v_pair_1_par_1; - __pyx_t_8 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; - __pyx_t_9 = __pyx_v_pair_1_par_2; - __pyx_t_10 = 2; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; - __pyx_v_D_z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) )))); + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":191 + /* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) * - * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] - * if(D_z > blen2) : D_z -= boxlength # <<<<<<<<<<<<<< - * elif(D_z < -blen2) : D_z += boxlength + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * */ - __pyx_t_11 = ((__pyx_v_D_z > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_z = (__pyx_v_D_z - __pyx_v_boxlength); - goto __pyx_L9; - } - /* "src/helpers/miscellaneous.pyx":192 - * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] - * if(D_z > blen2) : D_z -= boxlength - * elif(D_z < -blen2) : D_z += boxlength # <<<<<<<<<<<<<< - * - * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) - */ - __pyx_t_11 = ((__pyx_v_D_z < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_z = (__pyx_v_D_z + __pyx_v_boxlength); - } - __pyx_L9:; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":194 - * elif(D_z < -blen2) : D_z += boxlength +/* "View.MemoryView":231 + * return self._shape[0] * - * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) # <<<<<<<<<<<<<< - * energy1 = charges[pair_1_par_1] * charges[pair_1_par_2] / dist1 + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * */ - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyFloat_FromDouble((((__pyx_v_D_x * __pyx_v_D_x) + (__pyx_v_D_y * __pyx_v_D_y)) + (__pyx_v_D_z * __pyx_v_D_z))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_15 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); - } - } - __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13); - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_v_dist1 = __pyx_t_16; - /* "src/helpers/miscellaneous.pyx":195 - * - * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) - * energy1 = charges[pair_1_par_1] * charges[pair_1_par_2] / dist1 # <<<<<<<<<<<<<< - * - * for pair_2_par_1 in range(0, n_particles-1): - */ - __pyx_t_10 = __pyx_v_pair_1_par_1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_charges.shape[0]; - __pyx_t_9 = __pyx_v_pair_1_par_2; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_charges.shape[0]; - __pyx_t_16 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_10 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_9 * __pyx_v_charges.strides[0]) )))); - if (unlikely(__pyx_v_dist1 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 195, __pyx_L1_error) - } - __pyx_v_energy1 = (__pyx_t_16 / __pyx_v_dist1); +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); - /* "src/helpers/miscellaneous.pyx":197 - * energy1 = charges[pair_1_par_1] * charges[pair_1_par_2] / dist1 - * - * for pair_2_par_1 in range(0, n_particles-1): # <<<<<<<<<<<<<< - * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): - * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue - */ - __pyx_t_17 = (__pyx_v_n_particles - 1); - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_pair_2_par_1 = __pyx_t_19; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); - /* "src/helpers/miscellaneous.pyx":198 + /* "View.MemoryView":232 * - * for pair_2_par_1 in range(0, n_particles-1): - * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): # <<<<<<<<<<<<<< - * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< * + * def __getitem__(self, item): */ - __pyx_t_20 = __pyx_v_n_particles; - __pyx_t_21 = __pyx_t_20; - for (__pyx_t_22 = (__pyx_v_pair_2_par_1 + 1); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { - __pyx_v_pair_2_par_2 = __pyx_t_22; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":199 - * for pair_2_par_1 in range(0, n_particles-1): - * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): - * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue # <<<<<<<<<<<<<< + /* "View.MemoryView":231 + * return self._shape[0] * - * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] - */ - __pyx_t_23 = ((__pyx_v_pair_1_par_1 == __pyx_v_pair_2_par_1) != 0); - if (__pyx_t_23) { - } else { - __pyx_t_11 = __pyx_t_23; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_23 = ((__pyx_v_pair_1_par_2 == __pyx_v_pair_2_par_2) != 0); - __pyx_t_11 = __pyx_t_23; - __pyx_L15_bool_binop_done:; - if (__pyx_t_11) { - goto __pyx_L12_continue; - } - - /* "src/helpers/miscellaneous.pyx":201 - * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * - * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] # <<<<<<<<<<<<<< - * if(D_x > blen2) : D_x -= boxlength - * elif(D_x < -blen2) : D_x += boxlength */ - __pyx_t_9 = __pyx_v_pair_2_par_1; - __pyx_t_10 = 0; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; - __pyx_t_8 = __pyx_v_pair_2_par_2; - __pyx_t_7 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; - __pyx_v_D_x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":202 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":234 + * return getattr(self.memview, attr) * - * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] - * if(D_x > blen2) : D_x -= boxlength # <<<<<<<<<<<<<< - * elif(D_x < -blen2) : D_x += boxlength + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] * */ - __pyx_t_11 = ((__pyx_v_D_x > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_x = (__pyx_v_D_x - __pyx_v_boxlength); - goto __pyx_L17; - } - /* "src/helpers/miscellaneous.pyx":203 - * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] - * if(D_x > blen2) : D_x -= boxlength - * elif(D_x < -blen2) : D_x += boxlength # <<<<<<<<<<<<<< - * - * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] - */ - __pyx_t_11 = ((__pyx_v_D_x < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_x = (__pyx_v_D_x + __pyx_v_boxlength); - } - __pyx_L17:; +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); - /* "src/helpers/miscellaneous.pyx":205 - * elif(D_x < -blen2) : D_x += boxlength - * - * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] # <<<<<<<<<<<<<< - * if(D_y > blen2) : D_y -= boxlength - * elif(D_y < -blen2) : D_y += boxlength - */ - __pyx_t_7 = __pyx_v_pair_2_par_1; - __pyx_t_8 = 1; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; - __pyx_t_10 = __pyx_v_pair_2_par_2; - __pyx_t_9 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; - __pyx_v_D_y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_10 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) )))); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":206 - * - * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] - * if(D_y > blen2) : D_y -= boxlength # <<<<<<<<<<<<<< - * elif(D_y < -blen2) : D_y += boxlength - * - */ - __pyx_t_11 = ((__pyx_v_D_y > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_y = (__pyx_v_D_y - __pyx_v_boxlength); - goto __pyx_L18; - } +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "src/helpers/miscellaneous.pyx":207 - * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] - * if(D_y > blen2) : D_y -= boxlength - * elif(D_y < -blen2) : D_y += boxlength # <<<<<<<<<<<<<< + /* "View.MemoryView":235 * - * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] - */ - __pyx_t_11 = ((__pyx_v_D_y < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_y = (__pyx_v_D_y + __pyx_v_boxlength); - } - __pyx_L18:; - - /* "src/helpers/miscellaneous.pyx":209 - * elif(D_y < -blen2) : D_y += boxlength + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< * - * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] # <<<<<<<<<<<<<< - * if(D_z > blen2) : D_z -= boxlength - * elif(D_z < -blen2) : D_z += boxlength + * def __setitem__(self, item, value): */ - __pyx_t_9 = __pyx_v_pair_2_par_1; - __pyx_t_10 = 2; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; - __pyx_t_8 = __pyx_v_pair_2_par_2; - __pyx_t_7 = 2; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; - __pyx_v_D_z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":210 + /* "View.MemoryView":234 + * return getattr(self.memview, attr) * - * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] - * if(D_z > blen2) : D_z -= boxlength # <<<<<<<<<<<<<< - * elif(D_z < -blen2) : D_z += boxlength + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] * */ - __pyx_t_11 = ((__pyx_v_D_z > __pyx_v_blen2) != 0); - if (__pyx_t_11) { - __pyx_v_D_z = (__pyx_v_D_z - __pyx_v_boxlength); - goto __pyx_L19; - } - /* "src/helpers/miscellaneous.pyx":211 - * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] - * if(D_z > blen2) : D_z -= boxlength - * elif(D_z < -blen2) : D_z += boxlength # <<<<<<<<<<<<<< - * - * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) - */ - __pyx_t_11 = ((__pyx_v_D_z < (-__pyx_v_blen2)) != 0); - if (__pyx_t_11) { - __pyx_v_D_z = (__pyx_v_D_z + __pyx_v_boxlength); - } - __pyx_L19:; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":213 - * elif(D_z < -blen2) : D_z += boxlength +/* "View.MemoryView":237 + * return self.memview[item] * - * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) # <<<<<<<<<<<<<< - * energy2 = charges[pair_2_par_1] * charges[pair_2_par_2] / dist1 + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value * */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyFloat_FromDouble((((__pyx_v_D_x * __pyx_v_D_x) + (__pyx_v_D_y * __pyx_v_D_y)) + (__pyx_v_D_z * __pyx_v_D_z))); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); - } - } - __pyx_t_12 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_15, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_14); - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_v_dist2 = __pyx_t_16; - /* "src/helpers/miscellaneous.pyx":214 - * - * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) - * energy2 = charges[pair_2_par_1] * charges[pair_2_par_2] / dist1 # <<<<<<<<<<<<<< - * - * bin1 = int(segs * dist1) - */ - __pyx_t_7 = __pyx_v_pair_2_par_1; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_charges.shape[0]; - __pyx_t_8 = __pyx_v_pair_2_par_2; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_charges.shape[0]; - __pyx_t_16 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_7 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_8 * __pyx_v_charges.strides[0]) )))); - if (unlikely(__pyx_v_dist1 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 214, __pyx_L1_error) - } - __pyx_v_energy2 = (__pyx_t_16 / __pyx_v_dist1); +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); - /* "src/helpers/miscellaneous.pyx":216 - * energy2 = charges[pair_2_par_1] * charges[pair_2_par_2] / dist1 - * - * bin1 = int(segs * dist1) # <<<<<<<<<<<<<< - * bin2 = int(segs * dist2) - * - */ - __pyx_v_bin1 = ((int)(__pyx_v_segs * __pyx_v_dist1)); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":217 - * - * bin1 = int(segs * dist1) - * bin2 = int(segs * dist2) # <<<<<<<<<<<<<< - * - * if (bin1 < bin_dist) and (bin2 < bin_dist): - */ - __pyx_v_bin2 = ((int)(__pyx_v_segs * __pyx_v_dist2)); +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); - /* "src/helpers/miscellaneous.pyx":219 - * bin2 = int(segs * dist2) + /* "View.MemoryView":238 * - * if (bin1 < bin_dist) and (bin2 < bin_dist): # <<<<<<<<<<<<<< - * histogram[bin1, bin2] += energy1 * energy2 - * histogram[bin2, bin2] += histogram[bin1, bin2] - */ - __pyx_t_23 = ((__pyx_v_bin1 < __pyx_v_bin_dist) != 0); - if (__pyx_t_23) { - } else { - __pyx_t_11 = __pyx_t_23; - goto __pyx_L21_bool_binop_done; - } - __pyx_t_23 = ((__pyx_v_bin2 < __pyx_v_bin_dist) != 0); - __pyx_t_11 = __pyx_t_23; - __pyx_L21_bool_binop_done:; - if (__pyx_t_11) { - - /* "src/helpers/miscellaneous.pyx":220 + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< * - * if (bin1 < bin_dist) and (bin2 < bin_dist): - * histogram[bin1, bin2] += energy1 * energy2 # <<<<<<<<<<<<<< - * histogram[bin2, bin2] += histogram[bin1, bin2] * */ - __pyx_t_8 = __pyx_v_bin1; - __pyx_t_7 = __pyx_v_bin2; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_8 * __pyx_v_histogram.strides[0]) ) + __pyx_t_7 * __pyx_v_histogram.strides[1]) )) += (__pyx_v_energy1 * __pyx_v_energy2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":221 - * if (bin1 < bin_dist) and (bin2 < bin_dist): - * histogram[bin1, bin2] += energy1 * energy2 - * histogram[bin2, bin2] += histogram[bin1, bin2] # <<<<<<<<<<<<<< + /* "View.MemoryView":237 + * return self.memview[item] * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value * - */ - __pyx_t_7 = __pyx_v_bin1; - __pyx_t_8 = __pyx_v_bin2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[1]; - __pyx_t_10 = __pyx_v_bin2; - __pyx_t_9 = __pyx_v_bin2; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_histogram.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_histogram.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_10 * __pyx_v_histogram.strides[0]) ) + __pyx_t_9 * __pyx_v_histogram.strides[1]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_7 * __pyx_v_histogram.strides[0]) ) + __pyx_t_8 * __pyx_v_histogram.strides[1]) ))); - - /* "src/helpers/miscellaneous.pyx":219 - * bin2 = int(segs * dist2) - * - * if (bin1 < bin_dist) and (bin2 < bin_dist): # <<<<<<<<<<<<<< - * histogram[bin1, bin2] += energy1 * energy2 - * histogram[bin2, bin2] += histogram[bin1, bin2] - */ - } - __pyx_L12_continue:; - } - } - } - } - - /* "src/helpers/miscellaneous.pyx":168 - * - * @cython.boundscheck(False) - * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): # <<<<<<<<<<<<<< - * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_AddTraceback("newanalysis.miscellaneous.structureFactorCharge", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_coors, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histogram, 1); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":226 - * #Version1: Just one distance per targeted (water) molecule - * @cython.boundscheck(False) - * def accumulateShellwiseGFunction(double [:,:] aufpunkte, double [:,:] coor, char [:] dataset, double[:,:] histogram, double[:] norm, int maxshell, double histo_min, double histo_max, double boxlength): # <<<<<<<<<<<<<< - * ''' - * aufpunkte ... (n_aufpunkte, 3) +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_9accumulateShellwiseGFunction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_8accumulateShellwiseGFunction[] = "\n aufpunkte ... (n_aufpunkte, 3)\n coor ... (n_particles, 3)\n dataset ... (n_particles)\n histogram ... (number_of_shells, number_of_datapoints)\n norm ... (number_of_shells)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_9accumulateShellwiseGFunction = {"accumulateShellwiseGFunction", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_9accumulateShellwiseGFunction, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_8accumulateShellwiseGFunction}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_9accumulateShellwiseGFunction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_aufpunkte = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_norm = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell; - double __pyx_v_histo_min; - double __pyx_v_histo_max; - double __pyx_v_boxlength; +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("accumulateShellwiseGFunction (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkte,&__pyx_n_s_coor,&__pyx_n_s_dataset,&__pyx_n_s_histogram,&__pyx_n_s_norm,&__pyx_n_s_maxshell,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_boxlength,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkte)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 1); __PYX_ERR(0, 226, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 2); __PYX_ERR(0, 226, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histogram)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 3); __PYX_ERR(0, 226, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_norm)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 4); __PYX_ERR(0, 226, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 5); __PYX_ERR(0, 226, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_min)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 6); __PYX_ERR(0, 226, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histo_max)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 7); __PYX_ERR(0, 226, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 8); __PYX_ERR(0, 226, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "accumulateShellwiseGFunction") < 0)) __PYX_ERR(0, 226, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - } - __pyx_v_aufpunkte = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkte.memview)) __PYX_ERR(0, 226, __pyx_L3_error) - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 226, __pyx_L3_error) - __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 226, __pyx_L3_error) - __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 226, __pyx_L3_error) - __pyx_v_norm = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_norm.memview)) __PYX_ERR(0, 226, __pyx_L3_error) - __pyx_v_maxshell = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L3_error) - __pyx_v_histo_min = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_histo_min == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L3_error) - __pyx_v_histo_max = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_histo_max == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L3_error) - __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L3_error) - } + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 226, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.accumulateShellwiseGFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_8accumulateShellwiseGFunction(__pyx_self, __pyx_v_aufpunkte, __pyx_v_coor, __pyx_v_dataset, __pyx_v_histogram, __pyx_v_norm, __pyx_v_maxshell, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_boxlength); + __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_8accumulateShellwiseGFunction(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkte, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dataset, __Pyx_memviewslice __pyx_v_histogram, __Pyx_memviewslice __pyx_v_norm, int __pyx_v_maxshell, double __pyx_v_histo_min, double __pyx_v_histo_max, double __pyx_v_boxlength) { - int __pyx_v_n_aufpunkte; - int __pyx_v_n_particles; - int __pyx_v_number_of_datapoints; +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - __Pyx_RefNannySetupContext("accumulateShellwiseGFunction", 0); - - /* "src/helpers/miscellaneous.pyx":235 - * ''' - * - * cdef int n_aufpunkte = aufpunkte.shape[0] # <<<<<<<<<<<<<< - * cdef int n_particles = coor.shape[0] - * cdef int number_of_datapoints = histogram.shape[1] - */ - __pyx_v_n_aufpunkte = (__pyx_v_aufpunkte.shape[0]); - - /* "src/helpers/miscellaneous.pyx":236 - * - * cdef int n_aufpunkte = aufpunkte.shape[0] - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< - * cdef int number_of_datapoints = histogram.shape[1] - * - */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - - /* "src/helpers/miscellaneous.pyx":237 - * cdef int n_aufpunkte = aufpunkte.shape[0] - * cdef int n_particles = coor.shape[0] - * cdef int number_of_datapoints = histogram.shape[1] # <<<<<<<<<<<<<< - * - * calc_accumulate_shellwise_g_function(&aufpunkte[0,0], &coor[0,0], &dataset[0], &histogram[0,0], &norm[0], n_aufpunkte, n_particles, number_of_datapoints, maxshell, histo_min, histo_max, boxlength) - */ - __pyx_v_number_of_datapoints = (__pyx_v_histogram.shape[1]); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "src/helpers/miscellaneous.pyx":239 - * cdef int number_of_datapoints = histogram.shape[1] - * - * calc_accumulate_shellwise_g_function(&aufpunkte[0,0], &coor[0,0], &dataset[0], &histogram[0,0], &norm[0], n_aufpunkte, n_particles, number_of_datapoints, maxshell, histo_min, histo_max, boxlength) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_aufpunkte.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_aufpunkte.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_t_5 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dataset.shape[0]; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_histogram.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[1]; - __pyx_t_8 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_norm.shape[0]; - calc_accumulate_shellwise_g_function((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_aufpunkte.data + __pyx_t_1 * __pyx_v_aufpunkte.strides[0]) ) + __pyx_t_2 * __pyx_v_aufpunkte.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_3 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))), (&(*((char *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_5 * __pyx_v_dataset.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_6 * __pyx_v_histogram.strides[0]) ) + __pyx_t_7 * __pyx_v_histogram.strides[1]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_norm.data + __pyx_t_8 * __pyx_v_norm.strides[0]) )))), __pyx_v_n_aufpunkte, __pyx_v_n_particles, __pyx_v_number_of_datapoints, __pyx_v_maxshell, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_boxlength); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":226 - * #Version1: Just one distance per targeted (water) molecule - * @cython.boundscheck(False) - * def accumulateShellwiseGFunction(double [:,:] aufpunkte, double [:,:] coor, char [:] dataset, double[:,:] histogram, double[:] norm, int maxshell, double histo_min, double histo_max, double boxlength): # <<<<<<<<<<<<<< - * ''' - * aufpunkte ... (n_aufpunkte, 3) + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkte, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histogram, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_norm, 1); + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":242 - * - * @cython.boundscheck(False) - * def accumulateNMShellwiseGFunction(double [:,:] coor1, double [:,:] coor2, int[:,:] dataset, double[:,:] histogram, int particle_first, int n_particles, int max_distance, int segments_per_angstroem): # <<<<<<<<<<<<<< - * cdef int particle1, particle2, point1, point2, shell, bin_dist - * cdef int maxshell = histogram.shape[1] +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_11accumulateNMShellwiseGFunction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_11accumulateNMShellwiseGFunction = {"accumulateNMShellwiseGFunction", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_11accumulateNMShellwiseGFunction, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_11accumulateNMShellwiseGFunction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_particle_first; - int __pyx_v_n_particles; - int __pyx_v_max_distance; - int __pyx_v_segments_per_angstroem; +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("accumulateNMShellwiseGFunction (wrapper)", 0); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_dataset,&__pyx_n_s_histogram,&__pyx_n_s_particle_first,&__pyx_n_s_n_particles,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor1)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 1); __PYX_ERR(0, 242, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 2); __PYX_ERR(0, 242, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histogram)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 3); __PYX_ERR(0, 242, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_particle_first)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 4); __PYX_ERR(0, 242, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_particles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 5); __PYX_ERR(0, 242, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_distance)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 6); __PYX_ERR(0, 242, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_segments_per_angstroem)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 7); __PYX_ERR(0, 242, __pyx_L3_error) + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "accumulateNMShellwiseGFunction") < 0)) __PYX_ERR(0, 242, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 242, __pyx_L3_error) - __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 242, __pyx_L3_error) - __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 242, __pyx_L3_error) - __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 242, __pyx_L3_error) - __pyx_v_particle_first = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_particle_first == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) - __pyx_v_n_particles = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_n_particles == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) - __pyx_v_max_distance = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_max_distance == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) - __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 242, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.accumulateNMShellwiseGFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_10accumulateNMShellwiseGFunction(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_dataset, __pyx_v_histogram, __pyx_v_particle_first, __pyx_v_n_particles, __pyx_v_max_distance, __pyx_v_segments_per_angstroem); + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_10accumulateNMShellwiseGFunction(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coor1, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coor2, __Pyx_memviewslice __pyx_v_dataset, __Pyx_memviewslice __pyx_v_histogram, int __pyx_v_particle_first, int __pyx_v_n_particles, int __pyx_v_max_distance, int __pyx_v_segments_per_angstroem) { - int __pyx_v_particle1; - int __pyx_v_particle2; - int __pyx_v_point1; - int __pyx_v_point2; - int __pyx_v_shell; - int __pyx_v_bin_dist; - int __pyx_v_maxshell; - double __pyx_v_dist; +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * + * + */ + +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - __Pyx_RefNannySetupContext("accumulateNMShellwiseGFunction", 0); + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_allocate_buffer", 0); - /* "src/helpers/miscellaneous.pyx":244 - * def accumulateNMShellwiseGFunction(double [:,:] coor1, double [:,:] coor2, int[:,:] dataset, double[:,:] histogram, int particle_first, int n_particles, int max_distance, int segments_per_angstroem): - * cdef int particle1, particle2, point1, point2, shell, bin_dist - * cdef int maxshell = histogram.shape[1] # <<<<<<<<<<<<<< - * cdef double dist + /* "View.MemoryView":254 + * cdef PyObject **p * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: */ - __pyx_v_maxshell = (__pyx_v_histogram.shape[1]); + __pyx_v_self->free_data = 1; - /* "src/helpers/miscellaneous.pyx":247 - * cdef double dist + /* "View.MemoryView":255 * - * for particle1 in range(n_particles): # <<<<<<<<<<<<<< - * for particle2 in range(particle1+1, n_particles): - * point1 = particle_first + particle1 + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." */ - __pyx_t_1 = __pyx_v_n_particles; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_particle1 = __pyx_t_3; + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); - /* "src/helpers/miscellaneous.pyx":248 + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." * - * for particle1 in range(n_particles): - * for particle2 in range(particle1+1, n_particles): # <<<<<<<<<<<<<< - * point1 = particle_first + particle1 - * point2 = particle_first + particle2 */ - __pyx_t_4 = __pyx_v_n_particles; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = (__pyx_v_particle1 + 1); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_particle2 = __pyx_t_6; + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/miscellaneous.pyx":249 - * for particle1 in range(n_particles): - * for particle2 in range(particle1+1, n_particles): - * point1 = particle_first + particle1 # <<<<<<<<<<<<<< - * point2 = particle_first + particle2 + /* "View.MemoryView":257 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< * + * if self.dtype_is_object: */ - __pyx_v_point1 = (__pyx_v_particle_first + __pyx_v_particle1); + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 257, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":250 - * for particle2 in range(particle1+1, n_particles): - * point1 = particle_first + particle1 - * point2 = particle_first + particle2 # <<<<<<<<<<<<<< + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." * - * shell = dataset[point1, point2] */ - __pyx_v_point2 = (__pyx_v_particle_first + __pyx_v_particle2); + } - /* "src/helpers/miscellaneous.pyx":252 - * point2 = particle_first + particle2 + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." * - * shell = dataset[point1, point2] # <<<<<<<<<<<<<< - * if(shell >= maxshell): shell = maxshell-1 - * dist = 0 + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - __pyx_t_7 = __pyx_v_point1; - __pyx_t_8 = __pyx_v_point2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dataset.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dataset.shape[1]; - __pyx_v_shell = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_7 * __pyx_v_dataset.strides[0]) ) + __pyx_t_8 * __pyx_v_dataset.strides[1]) ))); + if (__pyx_v_self->dtype_is_object) { - /* "src/helpers/miscellaneous.pyx":253 + /* "View.MemoryView":260 * - * shell = dataset[point1, point2] - * if(shell >= maxshell): shell = maxshell-1 # <<<<<<<<<<<<<< - * dist = 0 - * bin_dist = int(dist*segments_per_angstroem) + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None */ - __pyx_t_9 = ((__pyx_v_shell >= __pyx_v_maxshell) != 0); - if (__pyx_t_9) { - __pyx_v_shell = (__pyx_v_maxshell - 1); - } + __pyx_v_p = ((PyObject **)__pyx_v_self->data); - /* "src/helpers/miscellaneous.pyx":254 - * shell = dataset[point1, point2] - * if(shell >= maxshell): shell = maxshell-1 - * dist = 0 # <<<<<<<<<<<<<< - * bin_dist = int(dist*segments_per_angstroem) - * if(bin_dist < max_distance*segments_per_angstroem): + /* "View.MemoryView":261 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) */ - __pyx_v_dist = 0.0; + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/miscellaneous.pyx":255 - * if(shell >= maxshell): shell = maxshell-1 - * dist = 0 - * bin_dist = int(dist*segments_per_angstroem) # <<<<<<<<<<<<<< - * if(bin_dist < max_distance*segments_per_angstroem): - * histogram[shell, bin_dist] += 1 + /* "View.MemoryView":262 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 */ - __pyx_v_bin_dist = ((int)(__pyx_v_dist * __pyx_v_segments_per_angstroem)); + (__pyx_v_p[__pyx_v_i]) = Py_None; - /* "src/helpers/miscellaneous.pyx":256 - * dist = 0 - * bin_dist = int(dist*segments_per_angstroem) - * if(bin_dist < max_distance*segments_per_angstroem): # <<<<<<<<<<<<<< - * histogram[shell, bin_dist] += 1 + /* "View.MemoryView":263 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 * */ - __pyx_t_9 = ((__pyx_v_bin_dist < (__pyx_v_max_distance * __pyx_v_segments_per_angstroem)) != 0); - if (__pyx_t_9) { + Py_INCREF(Py_None); + } - /* "src/helpers/miscellaneous.pyx":257 - * bin_dist = int(dist*segments_per_angstroem) - * if(bin_dist < max_distance*segments_per_angstroem): - * histogram[shell, bin_dist] += 1 # <<<<<<<<<<<<<< - * + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - __pyx_t_8 = __pyx_v_shell; - __pyx_t_7 = __pyx_v_bin_dist; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_8 * __pyx_v_histogram.strides[0]) ) + __pyx_t_7 * __pyx_v_histogram.strides[1]) )) += 1.0; + } - /* "src/helpers/miscellaneous.pyx":256 - * dist = 0 - * bin_dist = int(dist*segments_per_angstroem) - * if(bin_dist < max_distance*segments_per_angstroem): # <<<<<<<<<<<<<< - * histogram[shell, bin_dist] += 1 + /* "View.MemoryView":264 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * * */ - } - } - } + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":242 + /* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) - * def accumulateNMShellwiseGFunction(double [:,:] coor1, double [:,:] coor2, int[:,:] dataset, double[:,:] histogram, int particle_first, int n_particles, int max_distance, int segments_per_angstroem): # <<<<<<<<<<<<<< - * cdef int particle1, particle2, point1, point2, shell, bin_dist - * cdef int maxshell = histogram.shape[1] */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histogram, 1); - __Pyx_XGIVEREF(__pyx_r); + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":260 +/* "View.MemoryView":268 * - * - * def sumUpByShell(double [:,:,:] timeseries, double [:,:,:] timeseries_shellwise, char[:,:] ds): # <<<<<<<<<<<<<< - * """ - * timeseries ... (n_frames, n_particles, 3) + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_13sumUpByShell(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_12sumUpByShell[] = "\n timeseries ... (n_frames, n_particles, 3)\n timeseries_shellwise ... (n_shells, n_frames, 3)\n ds ... (n_frames, n_particles)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_13sumUpByShell = {"sumUpByShell", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_13sumUpByShell, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_12sumUpByShell}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_13sumUpByShell(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_timeseries_shellwise = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sumUpByShell (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_timeseries_shellwise,&__pyx_n_s_ds,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries_shellwise)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumUpByShell", 1, 3, 3, 1); __PYX_ERR(0, 260, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumUpByShell", 1, 3, 3, 2); __PYX_ERR(0, 260, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumUpByShell") < 0)) __PYX_ERR(0, 260, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 260, __pyx_L3_error) - __pyx_v_timeseries_shellwise = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries_shellwise.memview)) __PYX_ERR(0, 260, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 260, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sumUpByShell", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 260, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.sumUpByShell", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_12sumUpByShell(__pyx_self, __pyx_v_timeseries, __pyx_v_timeseries_shellwise, __pyx_v_ds); + __Pyx_RefNannySetupContext("array_cwrapper", 0); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_12sumUpByShell(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_timeseries_shellwise, __Pyx_memviewslice __pyx_v_ds) { - int __pyx_v_n_frames; - int __pyx_v_n_particles; - int __pyx_v_n_shells; - int __pyx_v_particle; - int __pyx_v_shell; - int __pyx_v_frame; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sumUpByShell", 0); - - /* "src/helpers/miscellaneous.pyx":268 - * #BeyondShellPolicy = drop_particle + /* "View.MemoryView":270 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< * - * cdef int n_frames = timeseries.shape[0] # <<<<<<<<<<<<<< - * cdef int n_particles = timeseries.shape[1] - * cdef int n_shells = timeseries_shellwise.shape[0] + * if buf is NULL: */ - __pyx_v_n_frames = (__pyx_v_timeseries.shape[0]); + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_n_s_fortran); + __pyx_t_1 = __pyx_n_s_fortran; + } else { + __Pyx_INCREF(__pyx_n_s_c); + __pyx_t_1 = __pyx_n_s_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":269 + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. * - * cdef int n_frames = timeseries.shape[0] - * cdef int n_particles = timeseries.shape[1] # <<<<<<<<<<<<<< - * cdef int n_shells = timeseries_shellwise.shape[0] - * cdef int particle, shell, frame + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - __pyx_v_n_particles = (__pyx_v_timeseries.shape[1]); + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":270 - * cdef int n_frames = timeseries.shape[0] - * cdef int n_particles = timeseries.shape[1] - * cdef int n_shells = timeseries_shellwise.shape[0] # <<<<<<<<<<<<<< - * cdef int particle, shell, frame + /* "View.MemoryView":273 * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) */ - __pyx_v_n_shells = (__pyx_v_timeseries_shellwise.shape[0]); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/miscellaneous.pyx":273 - * cdef int particle, shell, frame + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. * - * for frame in range(n_frames): # <<<<<<<<<<<<<< - * for particle in range(n_particles): - * shell = ds[frame, particle] - 1 + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - __pyx_t_1 = __pyx_v_n_frames; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_frame = __pyx_t_3; + goto __pyx_L3; + } - /* "src/helpers/miscellaneous.pyx":274 + /* "View.MemoryView":275 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf * - * for frame in range(n_frames): - * for particle in range(n_particles): # <<<<<<<<<<<<<< - * shell = ds[frame, particle] - 1 - * if shell < n_shells: - */ - __pyx_t_4 = __pyx_v_n_particles; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_particle = __pyx_t_6; - - /* "src/helpers/miscellaneous.pyx":275 - * for frame in range(n_frames): - * for particle in range(n_particles): - * shell = ds[frame, particle] - 1 # <<<<<<<<<<<<<< - * if shell < n_shells: - * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] - */ - __pyx_t_7 = __pyx_v_frame; - __pyx_t_8 = __pyx_v_particle; - __pyx_t_9 = -1; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_v_ds.shape[0]; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_7 >= __pyx_v_ds.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_ds.shape[1]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_8 >= __pyx_v_ds.shape[1])) __pyx_t_9 = 1; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 275, __pyx_L1_error) - } - __pyx_v_shell = ((*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_7 * __pyx_v_ds.strides[0]) ) + __pyx_t_8 * __pyx_v_ds.strides[1]) ))) - 1); - - /* "src/helpers/miscellaneous.pyx":276 - * for particle in range(n_particles): - * shell = ds[frame, particle] - 1 - * if shell < n_shells: # <<<<<<<<<<<<<< - * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] - * timeseries_shellwise[shell, frame, 1] += timeseries[frame, particle, 1] - */ - __pyx_t_10 = ((__pyx_v_shell < __pyx_v_n_shells) != 0); - if (__pyx_t_10) { - - /* "src/helpers/miscellaneous.pyx":277 - * shell = ds[frame, particle] - 1 - * if shell < n_shells: - * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] # <<<<<<<<<<<<<< - * timeseries_shellwise[shell, frame, 1] += timeseries[frame, particle, 1] - * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] */ - __pyx_t_8 = __pyx_v_frame; - __pyx_t_7 = __pyx_v_particle; - __pyx_t_11 = 0; - __pyx_t_9 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_timeseries.shape[0]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_v_timeseries.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_v_timeseries.shape[1]; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_7 >= __pyx_v_timeseries.shape[1])) __pyx_t_9 = 1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_v_timeseries.shape[2]; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 2; - } else if (unlikely(__pyx_t_11 >= __pyx_v_timeseries.shape[2])) __pyx_t_9 = 2; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 277, __pyx_L1_error) - } - __pyx_t_12 = __pyx_v_shell; - __pyx_t_13 = __pyx_v_frame; - __pyx_t_14 = 0; - __pyx_t_9 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_v_timeseries_shellwise.shape[0]; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_v_timeseries_shellwise.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_v_timeseries_shellwise.shape[1]; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_13 >= __pyx_v_timeseries_shellwise.shape[1])) __pyx_t_9 = 1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_v_timeseries_shellwise.shape[2]; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 2; - } else if (unlikely(__pyx_t_14 >= __pyx_v_timeseries_shellwise.shape[2])) __pyx_t_9 = 2; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 277, __pyx_L1_error) - } - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries_shellwise.data + __pyx_t_12 * __pyx_v_timeseries_shellwise.strides[0]) ) + __pyx_t_13 * __pyx_v_timeseries_shellwise.strides[1]) ) + __pyx_t_14 * __pyx_v_timeseries_shellwise.strides[2]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_8 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_7 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_11 * __pyx_v_timeseries.strides[2]) ))); + /*else*/ { + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode)) __PYX_ERR(1, 275, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 275, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/miscellaneous.pyx":278 - * if shell < n_shells: - * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] - * timeseries_shellwise[shell, frame, 1] += timeseries[frame, particle, 1] # <<<<<<<<<<<<<< - * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] + /* "View.MemoryView":276 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< * + * return result */ - __pyx_t_11 = __pyx_v_frame; - __pyx_t_7 = __pyx_v_particle; - __pyx_t_8 = 1; - __pyx_t_9 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_v_timeseries.shape[0]; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_v_timeseries.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_v_timeseries.shape[1]; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_7 >= __pyx_v_timeseries.shape[1])) __pyx_t_9 = 1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_timeseries.shape[2]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 2; - } else if (unlikely(__pyx_t_8 >= __pyx_v_timeseries.shape[2])) __pyx_t_9 = 2; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 278, __pyx_L1_error) - } - __pyx_t_14 = __pyx_v_shell; - __pyx_t_13 = __pyx_v_frame; - __pyx_t_12 = 1; - __pyx_t_9 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_v_timeseries_shellwise.shape[0]; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_v_timeseries_shellwise.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_v_timeseries_shellwise.shape[1]; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_13 >= __pyx_v_timeseries_shellwise.shape[1])) __pyx_t_9 = 1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_v_timeseries_shellwise.shape[2]; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 2; - } else if (unlikely(__pyx_t_12 >= __pyx_v_timeseries_shellwise.shape[2])) __pyx_t_9 = 2; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 278, __pyx_L1_error) - } - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries_shellwise.data + __pyx_t_14 * __pyx_v_timeseries_shellwise.strides[0]) ) + __pyx_t_13 * __pyx_v_timeseries_shellwise.strides[1]) ) + __pyx_t_12 * __pyx_v_timeseries_shellwise.strides[2]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_11 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_7 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_8 * __pyx_v_timeseries.strides[2]) ))); + __pyx_v_result->data = __pyx_v_buf; + } + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":279 - * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] - * timeseries_shellwise[shell, frame, 1] += timeseries[frame, particle, 1] - * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] # <<<<<<<<<<<<<< + /* "View.MemoryView":278 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * * - * def countVennShellOccupation(double[:,:] data, int n_particles, char[:] ds1, char[:] ds2): - */ - __pyx_t_8 = __pyx_v_frame; - __pyx_t_7 = __pyx_v_particle; - __pyx_t_11 = 2; - __pyx_t_9 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_timeseries.shape[0]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_v_timeseries.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_v_timeseries.shape[1]; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_7 >= __pyx_v_timeseries.shape[1])) __pyx_t_9 = 1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_v_timeseries.shape[2]; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 2; - } else if (unlikely(__pyx_t_11 >= __pyx_v_timeseries.shape[2])) __pyx_t_9 = 2; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 279, __pyx_L1_error) - } - __pyx_t_12 = __pyx_v_shell; - __pyx_t_13 = __pyx_v_frame; - __pyx_t_14 = 2; - __pyx_t_9 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_v_timeseries_shellwise.shape[0]; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_v_timeseries_shellwise.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_v_timeseries_shellwise.shape[1]; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_13 >= __pyx_v_timeseries_shellwise.shape[1])) __pyx_t_9 = 1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_v_timeseries_shellwise.shape[2]; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 2; - } else if (unlikely(__pyx_t_14 >= __pyx_v_timeseries_shellwise.shape[2])) __pyx_t_9 = 2; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 279, __pyx_L1_error) - } - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries_shellwise.data + __pyx_t_12 * __pyx_v_timeseries_shellwise.strides[0]) ) + __pyx_t_13 * __pyx_v_timeseries_shellwise.strides[1]) ) + __pyx_t_14 * __pyx_v_timeseries_shellwise.strides[2]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_8 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_7 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_11 * __pyx_v_timeseries.strides[2]) ))); - - /* "src/helpers/miscellaneous.pyx":276 - * for particle in range(n_particles): - * shell = ds[frame, particle] - 1 - * if shell < n_shells: # <<<<<<<<<<<<<< - * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] - * timeseries_shellwise[shell, frame, 1] += timeseries[frame, particle, 1] */ - } - } - } + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":260 - * + /* "View.MemoryView":268 * - * def sumUpByShell(double [:,:,:] timeseries, double [:,:,:] timeseries_shellwise, char[:,:] ds): # <<<<<<<<<<<<<< - * """ - * timeseries ... (n_frames, n_particles, 3) + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.sumUpByShell", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries_shellwise, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":281 - * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] - * - * def countVennShellOccupation(double[:,:] data, int n_particles, char[:] ds1, char[:] ds2): # <<<<<<<<<<<<<< - * ''' - * data ... (n_shells1, n_shells2) +/* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_15countVennShellOccupation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_14countVennShellOccupation[] = "\n data ... (n_shells1, n_shells2)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_15countVennShellOccupation = {"countVennShellOccupation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_15countVennShellOccupation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_14countVennShellOccupation}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_15countVennShellOccupation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_n_particles; - __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("countVennShellOccupation (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 304, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_n_particles,&__pyx_n_s_ds1,&__pyx_n_s_ds2,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_particles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("countVennShellOccupation", 1, 4, 4, 1); __PYX_ERR(0, 281, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("countVennShellOccupation", 1, 4, 4, 2); __PYX_ERR(0, 281, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("countVennShellOccupation", 1, 4, 4, 3); __PYX_ERR(0, 281, __pyx_L3_error) + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "countVennShellOccupation") < 0)) __PYX_ERR(0, 281, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 304, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } - __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 281, __pyx_L3_error) - __pyx_v_n_particles = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n_particles == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 281, __pyx_L3_error) - __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 281, __pyx_L3_error) - __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 281, __pyx_L3_error) + __pyx_v_name = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("countVennShellOccupation", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 281, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 304, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.countVennShellOccupation", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_14countVennShellOccupation(__pyx_self, __pyx_v_data, __pyx_v_n_particles, __pyx_v_ds1, __pyx_v_ds2); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_14countVennShellOccupation(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_data, int __pyx_v_n_particles, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2) { - int __pyx_v_n_shells1; - int __pyx_v_n_shells2; - int __pyx_v_wat; - int __pyx_v_shell1; - int __pyx_v_shell2; - PyObject *__pyx_r = NULL; +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("countVennShellOccupation", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "src/helpers/miscellaneous.pyx":286 - * ''' - * - * cdef int n_shells1 = data.shape[0] # <<<<<<<<<<<<<< - * cdef int n_shells2 = data.shape[1] - * cdef int wat, shell1, shell2 + /* "View.MemoryView":305 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name */ - __pyx_v_n_shells1 = (__pyx_v_data.shape[0]); + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; - /* "src/helpers/miscellaneous.pyx":287 - * - * cdef int n_shells1 = data.shape[0] - * cdef int n_shells2 = data.shape[1] # <<<<<<<<<<<<<< - * cdef int wat, shell1, shell2 - * + /* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ - __pyx_v_n_shells2 = (__pyx_v_data.shape[1]); - /* "src/helpers/miscellaneous.pyx":290 - * cdef int wat, shell1, shell2 - * - * for wat in range(n_particles): # <<<<<<<<<<<<<< - * shell1 = ds1[wat] - 1 - * shell2 = ds2[wat] - 1 - */ - __pyx_t_1 = __pyx_v_n_particles; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_wat = __pyx_t_3; + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":291 - * - * for wat in range(n_particles): - * shell1 = ds1[wat] - 1 # <<<<<<<<<<<<<< - * shell2 = ds2[wat] - 1 +/* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name * */ - __pyx_t_4 = __pyx_v_wat; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_ds1.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_ds1.shape[0])) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - __PYX_ERR(0, 291, __pyx_L1_error) - } - __pyx_v_shell1 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_4 * __pyx_v_ds1.strides[0]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":292 - * for wat in range(n_particles): - * shell1 = ds1[wat] - 1 - * shell2 = ds2[wat] - 1 # <<<<<<<<<<<<<< - * - * if shell1 >= n_shells1 : shell1 = n_shells1 - 1 - */ - __pyx_t_4 = __pyx_v_wat; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_ds2.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_ds2.shape[0])) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - __PYX_ERR(0, 292, __pyx_L1_error) - } - __pyx_v_shell2 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_4 * __pyx_v_ds2.strides[0]) ))) - 1); +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - /* "src/helpers/miscellaneous.pyx":294 - * shell2 = ds2[wat] - 1 - * - * if shell1 >= n_shells1 : shell1 = n_shells1 - 1 # <<<<<<<<<<<<<< - * if shell2 >= n_shells2 : shell2 = n_shells2 - 1 + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "View.MemoryView":307 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< * + * cdef generic = Enum("") */ - __pyx_t_6 = ((__pyx_v_shell1 >= __pyx_v_n_shells1) != 0); - if (__pyx_t_6) { - __pyx_v_shell1 = (__pyx_v_n_shells1 - 1); - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":295 - * - * if shell1 >= n_shells1 : shell1 = n_shells1 - 1 - * if shell2 >= n_shells2 : shell2 = n_shells2 - 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name * - * data[shell1, shell2] += 1 */ - __pyx_t_6 = ((__pyx_v_shell2 >= __pyx_v_n_shells2) != 0); - if (__pyx_t_6) { - __pyx_v_shell2 = (__pyx_v_n_shells2 - 1); - } - /* "src/helpers/miscellaneous.pyx":297 - * if shell2 >= n_shells2 : shell2 = n_shells2 - 1 - * - * data[shell1, shell2] += 1 # <<<<<<<<<<<<<< - * - * def countMultiShell(double[:,:] data, char[:] ds1, char[:] ds2, char[:] ds3, char[:] ds4, char[:] ds5): + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - __pyx_t_4 = __pyx_v_shell1; - __pyx_t_7 = __pyx_v_shell2; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_data.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_data.shape[0])) __pyx_t_5 = 0; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_v_data.shape[1]; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1; - } else if (unlikely(__pyx_t_7 >= __pyx_v_data.shape[1])) __pyx_t_5 = 1; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - __PYX_ERR(0, 297, __pyx_L1_error) + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) + */ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True + */ + __pyx_t_2 = (__pyx_v__dict != Py_None); + if (__pyx_t_2) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.name is not None + */ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True + */ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = self.name is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + */ + /*else*/ { + __pyx_t_2 = (__pyx_v_self->name != Py_None); + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + */ + if (__pyx_v_use_setstate) { + + /* "(tree fragment)":13 + * use_setstate = self.name is not None + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + */ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 16, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_4 * __pyx_v_data.strides[0]) ) + __pyx_t_7 * __pyx_v_data.strides[1]) )) += 1.0; } + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state); - /* "src/helpers/miscellaneous.pyx":281 - * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] - * - * def countVennShellOccupation(double[:,:] data, int n_particles, char[:] ds1, char[:] ds2): # <<<<<<<<<<<<<< - * ''' - * data ... (n_shells1, n_shells2) + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.countVennShellOccupation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_data, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds2, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":299 - * data[shell1, shell2] += 1 +/* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo * - * def countMultiShell(double[:,:] data, char[:] ds1, char[:] ds2, char[:] ds3, char[:] ds4, char[:] ds5): # <<<<<<<<<<<<<< - * ''' - * data ... (nshells, max_cardinality {==5}) + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_17countMultiShell(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_16countMultiShell[] = "\n data ... (nshells, max_cardinality {==5})\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_17countMultiShell = {"countMultiShell", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_17countMultiShell, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_16countMultiShell}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_17countMultiShell(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds3 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds5 = { 0, 0, { 0 }, { 0 }, { 0 } }; +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("countMultiShell (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 349, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_ds3,&__pyx_n_s_ds4,&__pyx_n_s_ds5,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, 1); __PYX_ERR(0, 299, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, 2); __PYX_ERR(0, 299, __pyx_L3_error) + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds3)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, 3); __PYX_ERR(0, 299, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds4)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, 4); __PYX_ERR(0, 299, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 349, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds5)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, 5); __PYX_ERR(0, 299, __pyx_L3_error) + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype_is_object); + if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "countMultiShell") < 0)) __PYX_ERR(0, 299, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 349, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); } - __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 299, __pyx_L3_error) - __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 299, __pyx_L3_error) - __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 299, __pyx_L3_error) - __pyx_v_ds3 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds3.memview)) __PYX_ERR(0, 299, __pyx_L3_error) - __pyx_v_ds4 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds4.memview)) __PYX_ERR(0, 299, __pyx_L3_error) - __pyx_v_ds5 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds5.memview)) __PYX_ERR(0, 299, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 299, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 349, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.countMultiShell", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_16countMultiShell(__pyx_self, __pyx_v_data, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_ds3, __pyx_v_ds4, __pyx_v_ds5); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_16countMultiShell(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, __Pyx_memviewslice __pyx_v_ds3, __Pyx_memviewslice __pyx_v_ds4, __Pyx_memviewslice __pyx_v_ds5) { - int __pyx_v_n_shells; - int __pyx_v_n_particles; - int __pyx_v_shell_01; - int __pyx_v_shell_02; - int __pyx_v_shell_03; - int __pyx_v_shell_04; - int __pyx_v_shell_05; - int __pyx_v_closest_shell; - int __pyx_v_cardinality; - int __pyx_v_wat; - PyObject *__pyx_r = NULL; +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("countMultiShell", 0); + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "src/helpers/miscellaneous.pyx":304 - * ''' + /* "View.MemoryView":350 * - * cdef int n_shells = data.shape[0] # <<<<<<<<<<<<<< - * cdef int n_particles = ds1.shape[0] - * cdef int shell_01, shell_02, shell_03, shell_04, shell_05, closest_shell, cardinality + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: */ - __pyx_v_n_shells = (__pyx_v_data.shape[0]); + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; - /* "src/helpers/miscellaneous.pyx":305 - * - * cdef int n_shells = data.shape[0] - * cdef int n_particles = ds1.shape[0] # <<<<<<<<<<<<<< - * cdef int shell_01, shell_02, shell_03, shell_04, shell_05, closest_shell, cardinality - * cdef int wat + /* "View.MemoryView":351 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) */ - __pyx_v_n_particles = (__pyx_v_ds1.shape[0]); + __pyx_v_self->flags = __pyx_v_flags; - /* "src/helpers/miscellaneous.pyx":309 - * cdef int wat - * - * for wat in range(n_particles): # <<<<<<<<<<<<<< - * shell_01 = ds1[wat] - 1 - * shell_02 = ds2[wat] - 1 + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ - __pyx_t_1 = __pyx_v_n_particles; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_wat = __pyx_t_3; + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":310 - * - * for wat in range(n_particles): - * shell_01 = ds1[wat] - 1 # <<<<<<<<<<<<<< - * shell_02 = ds2[wat] - 1 - * shell_03 = ds3[wat] - 1 + /* "View.MemoryView":353 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None */ - __pyx_t_4 = __pyx_v_wat; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_ds1.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_ds1.shape[0])) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - __PYX_ERR(0, 310, __pyx_L1_error) - } - __pyx_v_shell_01 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_4 * __pyx_v_ds1.strides[0]) ))) - 1); + __pyx_t_3 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 353, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":311 - * for wat in range(n_particles): - * shell_01 = ds1[wat] - 1 - * shell_02 = ds2[wat] - 1 # <<<<<<<<<<<<<< - * shell_03 = ds3[wat] - 1 - * shell_04 = ds4[wat] - 1 + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) */ - __pyx_t_4 = __pyx_v_wat; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_ds2.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_ds2.shape[0])) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - __PYX_ERR(0, 311, __pyx_L1_error) - } - __pyx_v_shell_02 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_4 * __pyx_v_ds2.strides[0]) ))) - 1); + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":312 - * shell_01 = ds1[wat] - 1 - * shell_02 = ds2[wat] - 1 - * shell_03 = ds3[wat] - 1 # <<<<<<<<<<<<<< - * shell_04 = ds4[wat] - 1 - * shell_05 = ds5[wat] - 1 + /* "View.MemoryView":355 + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * */ - __pyx_t_4 = __pyx_v_wat; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_ds3.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_ds3.shape[0])) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - __PYX_ERR(0, 312, __pyx_L1_error) - } - __pyx_v_shell_03 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds3.data + __pyx_t_4 * __pyx_v_ds3.strides[0]) ))) - 1); + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - /* "src/helpers/miscellaneous.pyx":313 - * shell_02 = ds2[wat] - 1 - * shell_03 = ds3[wat] - 1 - * shell_04 = ds4[wat] - 1 # <<<<<<<<<<<<<< - * shell_05 = ds5[wat] - 1 + /* "View.MemoryView":356 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): */ - __pyx_t_4 = __pyx_v_wat; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_ds4.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_ds4.shape[0])) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - __PYX_ERR(0, 313, __pyx_L1_error) - } - __pyx_v_shell_04 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds4.data + __pyx_t_4 * __pyx_v_ds4.strides[0]) ))) - 1); + Py_INCREF(Py_None); - /* "src/helpers/miscellaneous.pyx":314 - * shell_03 = ds3[wat] - 1 - * shell_04 = ds4[wat] - 1 - * shell_05 = ds5[wat] - 1 # <<<<<<<<<<<<<< - * - * if shell_01 >= n_shells: shell_01 = n_shells-1 + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) */ - __pyx_t_4 = __pyx_v_wat; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_ds5.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_ds5.shape[0])) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - __PYX_ERR(0, 314, __pyx_L1_error) } - __pyx_v_shell_05 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds5.data + __pyx_t_4 * __pyx_v_ds5.strides[0]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":316 - * shell_05 = ds5[wat] - 1 - * - * if shell_01 >= n_shells: shell_01 = n_shells-1 # <<<<<<<<<<<<<< - * if shell_02 >= n_shells: shell_02 = n_shells-1 - * if shell_03 >= n_shells: shell_03 = n_shells-1 + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ - __pyx_t_6 = ((__pyx_v_shell_01 >= __pyx_v_n_shells) != 0); - if (__pyx_t_6) { - __pyx_v_shell_01 = (__pyx_v_n_shells - 1); - } + } - /* "src/helpers/miscellaneous.pyx":317 + /* "View.MemoryView":358 + * Py_INCREF(Py_None) * - * if shell_01 >= n_shells: shell_01 = n_shells-1 - * if shell_02 >= n_shells: shell_02 = n_shells-1 # <<<<<<<<<<<<<< - * if shell_03 >= n_shells: shell_03 = n_shells-1 - * if shell_04 >= n_shells: shell_04 = n_shells-1 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: */ - __pyx_t_6 = ((__pyx_v_shell_02 >= __pyx_v_n_shells) != 0); - if (__pyx_t_6) { - __pyx_v_shell_02 = (__pyx_v_n_shells - 1); - } + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":318 - * if shell_01 >= n_shells: shell_01 = n_shells-1 - * if shell_02 >= n_shells: shell_02 = n_shells-1 - * if shell_03 >= n_shells: shell_03 = n_shells-1 # <<<<<<<<<<<<<< - * if shell_04 >= n_shells: shell_04 = n_shells-1 - * if shell_05 >= n_shells: shell_05 = n_shells-1 + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 */ - __pyx_t_6 = ((__pyx_v_shell_03 >= __pyx_v_n_shells) != 0); - if (__pyx_t_6) { - __pyx_v_shell_03 = (__pyx_v_n_shells - 1); - } + __pyx_t_1 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":319 - * if shell_02 >= n_shells: shell_02 = n_shells-1 - * if shell_03 >= n_shells: shell_03 = n_shells-1 - * if shell_04 >= n_shells: shell_04 = n_shells-1 # <<<<<<<<<<<<<< - * if shell_05 >= n_shells: shell_05 = n_shells-1 - * + /* "View.MemoryView":361 + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + */ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + + /* "View.MemoryView":362 + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + */ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); + + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 */ - __pyx_t_6 = ((__pyx_v_shell_04 >= __pyx_v_n_shells) != 0); - if (__pyx_t_6) { - __pyx_v_shell_04 = (__pyx_v_n_shells - 1); } - /* "src/helpers/miscellaneous.pyx":320 - * if shell_03 >= n_shells: shell_03 = n_shells-1 - * if shell_04 >= n_shells: shell_04 = n_shells-1 - * if shell_05 >= n_shells: shell_05 = n_shells-1 # <<<<<<<<<<<<<< + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + */ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":364 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError + */ + __pyx_v_self->lock = PyThread_allocate_lock(); + + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError * - * closest_shell = min(shell_01, shell_02, shell_03, shell_04, shell_05) */ - __pyx_t_6 = ((__pyx_v_shell_05 >= __pyx_v_n_shells) != 0); - if (__pyx_t_6) { - __pyx_v_shell_05 = (__pyx_v_n_shells - 1); - } + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/miscellaneous.pyx":322 - * if shell_05 >= n_shells: shell_05 = n_shells-1 + /* "View.MemoryView":366 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< * - * closest_shell = min(shell_01, shell_02, shell_03, shell_04, shell_05) # <<<<<<<<<<<<<< + * if flags & PyBUF_FORMAT: + */ + PyErr_NoMemory(); __PYX_ERR(1, 366, __pyx_L1_error) + + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError * - * cardinality = 0 */ - __pyx_t_5 = __pyx_v_shell_02; - __pyx_t_7 = __pyx_v_shell_03; - __pyx_t_8 = __pyx_v_shell_04; - __pyx_t_9 = __pyx_v_shell_05; - __pyx_t_10 = __pyx_v_shell_01; - if (((__pyx_t_5 < __pyx_t_10) != 0)) { - __pyx_t_11 = __pyx_t_5; - } else { - __pyx_t_11 = __pyx_t_10; - } - __pyx_t_10 = __pyx_t_11; - if (((__pyx_t_7 < __pyx_t_10) != 0)) { - __pyx_t_11 = __pyx_t_7; - } else { - __pyx_t_11 = __pyx_t_10; - } - __pyx_t_10 = __pyx_t_11; - if (((__pyx_t_8 < __pyx_t_10) != 0)) { - __pyx_t_11 = __pyx_t_8; - } else { - __pyx_t_11 = __pyx_t_10; - } - __pyx_t_10 = __pyx_t_11; - if (((__pyx_t_9 < __pyx_t_10) != 0)) { - __pyx_t_11 = __pyx_t_9; - } else { - __pyx_t_11 = __pyx_t_10; + } + + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + */ } - __pyx_v_closest_shell = __pyx_t_11; - /* "src/helpers/miscellaneous.pyx":324 - * closest_shell = min(shell_01, shell_02, shell_03, shell_04, shell_05) + /* "View.MemoryView":358 + * Py_INCREF(Py_None) * - * cardinality = 0 # <<<<<<<<<<<<<< - * if(shell_01 == closest_shell): cardinality += 1 - * if(shell_02 == closest_shell): cardinality += 1 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: */ - __pyx_v_cardinality = 0; + } - /* "src/helpers/miscellaneous.pyx":325 + /* "View.MemoryView":368 + * raise MemoryError * - * cardinality = 0 - * if(shell_01 == closest_shell): cardinality += 1 # <<<<<<<<<<<<<< - * if(shell_02 == closest_shell): cardinality += 1 - * if(shell_03 == closest_shell): cardinality += 1 + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: */ - __pyx_t_6 = ((__pyx_v_shell_01 == __pyx_v_closest_shell) != 0); - if (__pyx_t_6) { - __pyx_v_cardinality = (__pyx_v_cardinality + 1); - } + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":326 - * cardinality = 0 - * if(shell_01 == closest_shell): cardinality += 1 - * if(shell_02 == closest_shell): cardinality += 1 # <<<<<<<<<<<<<< - * if(shell_03 == closest_shell): cardinality += 1 - * if(shell_04 == closest_shell): cardinality += 1 + /* "View.MemoryView":369 + * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object */ - __pyx_t_6 = ((__pyx_v_shell_02 == __pyx_v_closest_shell) != 0); - if (__pyx_t_6) { - __pyx_v_cardinality = (__pyx_v_cardinality + 1); + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L12_bool_binop_done; } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L12_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":327 - * if(shell_01 == closest_shell): cardinality += 1 - * if(shell_02 == closest_shell): cardinality += 1 - * if(shell_03 == closest_shell): cardinality += 1 # <<<<<<<<<<<<<< - * if(shell_04 == closest_shell): cardinality += 1 - * if(shell_05 == closest_shell): cardinality += 1 + /* "View.MemoryView":368 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: */ - __pyx_t_6 = ((__pyx_v_shell_03 == __pyx_v_closest_shell) != 0); - if (__pyx_t_6) { - __pyx_v_cardinality = (__pyx_v_cardinality + 1); - } + goto __pyx_L11; + } - /* "src/helpers/miscellaneous.pyx":328 - * if(shell_02 == closest_shell): cardinality += 1 - * if(shell_03 == closest_shell): cardinality += 1 - * if(shell_04 == closest_shell): cardinality += 1 # <<<<<<<<<<<<<< - * if(shell_05 == closest_shell): cardinality += 1 + /* "View.MemoryView":371 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 */ - __pyx_t_6 = ((__pyx_v_shell_04 == __pyx_v_closest_shell) != 0); - if (__pyx_t_6) { - __pyx_v_cardinality = (__pyx_v_cardinality + 1); - } + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L11:; - /* "src/helpers/miscellaneous.pyx":329 - * if(shell_03 == closest_shell): cardinality += 1 - * if(shell_04 == closest_shell): cardinality += 1 - * if(shell_05 == closest_shell): cardinality += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":373 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL * - * data[closest_shell, cardinality-1] += 1 */ - __pyx_t_6 = ((__pyx_v_shell_05 == __pyx_v_closest_shell) != 0); - if (__pyx_t_6) { - __pyx_v_cardinality = (__pyx_v_cardinality + 1); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 373, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 373, __pyx_L1_error) } + } + #else + if ((1)); else __PYX_ERR(1, 373, __pyx_L1_error) + #endif - /* "src/helpers/miscellaneous.pyx":331 - * if(shell_05 == closest_shell): cardinality += 1 + /* "View.MemoryView":374 * - * data[closest_shell, cardinality-1] += 1 # <<<<<<<<<<<<<< + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< * - * ''' + * def __dealloc__(memoryview self): */ - __pyx_t_4 = __pyx_v_closest_shell; - __pyx_t_12 = (__pyx_v_cardinality - 1); - __pyx_t_11 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_data.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_11 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_data.shape[0])) __pyx_t_11 = 0; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_v_data.shape[1]; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 1; - } else if (unlikely(__pyx_t_12 >= __pyx_v_data.shape[1])) __pyx_t_11 = 1; - if (unlikely(__pyx_t_11 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_11); - __PYX_ERR(0, 331, __pyx_L1_error) - } - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_4 * __pyx_v_data.strides[0]) ) + __pyx_t_12 * __pyx_v_data.strides[1]) )) += 1.0; - } + __pyx_v_self->typeinfo = NULL; - /* "src/helpers/miscellaneous.pyx":299 - * data[shell1, shell2] += 1 + /* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo * - * def countMultiShell(double[:,:] data, char[:] ds1, char[:] ds2, char[:] ds3, char[:] ds4, char[:] ds5): # <<<<<<<<<<<<<< - * ''' - * data ... (nshells, max_cardinality {==5}) + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.countMultiShell", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_data, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds3, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds4, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds5, 1); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":353 +/* "View.MemoryView":376 + * self.typeinfo = NULL * - * @cython.boundscheck(False) - * def atomicIndDip(double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): # <<<<<<<<<<<<<< - * """ - * coors ... (N_all, 3) + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_19atomicIndDip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_18atomicIndDip[] = "\n coors ... (N_all, 3)\n charges ... (N_all)\n alpha ... (N_ind)\n coors_ind ... (N_ind, 3)\n atomic_dipoles ... (N_ind, 3)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_19atomicIndDip = {"atomicIndDip", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_19atomicIndDip, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_18atomicIndDip}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_19atomicIndDip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coors_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_prev_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxlength; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("atomicIndDip (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coors,&__pyx_n_s_charges,&__pyx_n_s_alpha,&__pyx_n_s_coors_ind,&__pyx_n_s_prev_atomic_dipoles,&__pyx_n_s_atomic_dipoles,&__pyx_n_s_boxlength,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coors)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 1); __PYX_ERR(0, 353, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 2); __PYX_ERR(0, 353, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coors_ind)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 3); __PYX_ERR(0, 353, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prev_atomic_dipoles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 4); __PYX_ERR(0, 353, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_atomic_dipoles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 5); __PYX_ERR(0, 353, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 6); __PYX_ERR(0, 353, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atomicIndDip") < 0)) __PYX_ERR(0, 353, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - } - __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 353, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 353, __pyx_L3_error) - __pyx_v_alpha = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_alpha.memview)) __PYX_ERR(0, 353, __pyx_L3_error) - __pyx_v_coors_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors_ind.memview)) __PYX_ERR(0, 353, __pyx_L3_error) - __pyx_v_prev_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_prev_atomic_dipoles.memview)) __PYX_ERR(0, 353, __pyx_L3_error) - __pyx_v_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_atomic_dipoles.memview)) __PYX_ERR(0, 353, __pyx_L3_error) - __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 353, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 353, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.atomicIndDip", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_18atomicIndDip(__pyx_self, __pyx_v_coors, __pyx_v_charges, __pyx_v_alpha, __pyx_v_coors_ind, __pyx_v_prev_atomic_dipoles, __pyx_v_atomic_dipoles, __pyx_v_boxlength); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_18atomicIndDip(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coors, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_alpha, __Pyx_memviewslice __pyx_v_coors_ind, __Pyx_memviewslice __pyx_v_prev_atomic_dipoles, __Pyx_memviewslice __pyx_v_atomic_dipoles, double __pyx_v_boxlength) { - int __pyx_v_n_particles_all; - int __pyx_v_n_particles_ind; - PyObject *__pyx_r = NULL; +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - __Pyx_RefNannySetupContext("atomicIndDip", 0); + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "src/helpers/miscellaneous.pyx":362 - * """ + /* "View.MemoryView":377 * - * cdef int n_particles_all = coors.shape[0] # <<<<<<<<<<<<<< - * cdef int n_particles_ind = atomic_dipoles.shape[0] - * # cdef int atom, dim, atom1, atom2, iteration, i, j + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - __pyx_v_n_particles_all = (__pyx_v_coors.shape[0]); + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":363 + /* "View.MemoryView":378 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: * - * cdef int n_particles_all = coors.shape[0] - * cdef int n_particles_ind = atomic_dipoles.shape[0] # <<<<<<<<<<<<<< - * # cdef int atom, dim, atom1, atom2, iteration, i, j - * # cdef double [:,:] e_0 = np.zeros((n_particles_ind, 3), dtype='float64') */ - __pyx_v_n_particles_ind = (__pyx_v_atomic_dipoles.shape[0]); + __Pyx_ReleaseBuffer((&__pyx_v_self->view)); - /* "src/helpers/miscellaneous.pyx":370 - * # cdef double [:,:] dip_ten = np.zeros((3,3), dtype='float64') - * - * atomic_ind_dip(&coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) # <<<<<<<<<<<<<< + /* "View.MemoryView":377 * - * """ + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coors.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coors.shape[1]; - __pyx_t_3 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_charges.shape[0]; - __pyx_t_4 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_alpha.shape[0]; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coors_ind.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coors_ind.shape[1]; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_prev_atomic_dipoles.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_prev_atomic_dipoles.shape[1]; - __pyx_t_9 = 0; - __pyx_t_10 = 0; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_atomic_dipoles.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_atomic_dipoles.shape[1]; - atomic_ind_dip((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_1 * __pyx_v_coors.strides[0]) ) + __pyx_t_2 * __pyx_v_coors.strides[1]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_3 * __pyx_v_charges.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_4 * __pyx_v_alpha.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors_ind.data + __pyx_t_5 * __pyx_v_coors_ind.strides[0]) ) + __pyx_t_6 * __pyx_v_coors_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_prev_atomic_dipoles.data + __pyx_t_7 * __pyx_v_prev_atomic_dipoles.strides[0]) ) + __pyx_t_8 * __pyx_v_prev_atomic_dipoles.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_atomic_dipoles.data + __pyx_t_9 * __pyx_v_atomic_dipoles.strides[0]) ) + __pyx_t_10 * __pyx_v_atomic_dipoles.strides[1]) )))), __pyx_v_n_particles_all, __pyx_v_n_particles_ind, __pyx_v_boxlength); + goto __pyx_L3; + } - /* "src/helpers/miscellaneous.pyx":353 + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def atomicIndDip(double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): # <<<<<<<<<<<<<< - * """ - * coors ... (N_all, 3) + * (<__pyx_buffer *> &self.view).obj = NULL */ + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coors, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_alpha, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coors_ind, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_prev_atomic_dipoles, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_atomic_dipoles, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":381 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * + */ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; -/* "src/helpers/miscellaneous.pyx":427 + /* "View.MemoryView":382 * - * @cython.boundscheck(False) - * def atomicIndDipPerAtom(int idx, double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): # <<<<<<<<<<<<<< - * """ - * coors ... (N_all, 3) + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i */ + Py_DECREF(Py_None); -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_21atomicIndDipPerAtom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_20atomicIndDipPerAtom[] = "\n coors ... (N_all, 3)\n charges ... (N_all)\n alpha ... (N_ind)\n coors_ind ... (N_ind, 3)\n atomic_dipoles ... (N_ind, 3)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_21atomicIndDipPerAtom = {"atomicIndDipPerAtom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_21atomicIndDipPerAtom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_20atomicIndDipPerAtom}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_21atomicIndDipPerAtom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_idx; - __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coors_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_prev_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxlength; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("atomicIndDipPerAtom (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_coors,&__pyx_n_s_charges,&__pyx_n_s_alpha,&__pyx_n_s_coors_ind,&__pyx_n_s_prev_atomic_dipoles,&__pyx_n_s_atomic_dipoles,&__pyx_n_s_boxlength,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coors)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 1); __PYX_ERR(0, 427, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_charges)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 2); __PYX_ERR(0, 427, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 3); __PYX_ERR(0, 427, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coors_ind)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 4); __PYX_ERR(0, 427, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prev_atomic_dipoles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 5); __PYX_ERR(0, 427, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_atomic_dipoles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 6); __PYX_ERR(0, 427, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 7); __PYX_ERR(0, 427, __pyx_L3_error) + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL + */ + } + __pyx_L3:; + + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + */ + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":387 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + */ + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + */ + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { + + /* "View.MemoryView":389 + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + */ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + */ + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { + + /* "View.MemoryView":392 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: + */ + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + + /* "View.MemoryView":391 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break + */ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; + + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + */ } + + /* "View.MemoryView":393 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) + */ + goto __pyx_L6_break; + + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + */ } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atomicIndDipPerAtom") < 0)) __PYX_ERR(0, 427, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } - __pyx_v_idx = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L3_error) - __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 427, __pyx_L3_error) - __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 427, __pyx_L3_error) - __pyx_v_alpha = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_alpha.memview)) __PYX_ERR(0, 427, __pyx_L3_error) - __pyx_v_coors_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors_ind.memview)) __PYX_ERR(0, 427, __pyx_L3_error) - __pyx_v_prev_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_prev_atomic_dipoles.memview)) __PYX_ERR(0, 427, __pyx_L3_error) - __pyx_v_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_atomic_dipoles.memview)) __PYX_ERR(0, 427, __pyx_L3_error) - __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L3_error) + /*else*/ { + + /* "View.MemoryView":395 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + */ + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; + + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + */ } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 427, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.atomicIndDipPerAtom", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_20atomicIndDipPerAtom(__pyx_self, __pyx_v_idx, __pyx_v_coors, __pyx_v_charges, __pyx_v_alpha, __pyx_v_coors_ind, __pyx_v_prev_atomic_dipoles, __pyx_v_atomic_dipoles, __pyx_v_boxlength); + + /* "View.MemoryView":376 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + */ /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_20atomicIndDipPerAtom(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_idx, __Pyx_memviewslice __pyx_v_coors, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_alpha, __Pyx_memviewslice __pyx_v_coors_ind, __Pyx_memviewslice __pyx_v_prev_atomic_dipoles, __Pyx_memviewslice __pyx_v_atomic_dipoles, double __pyx_v_boxlength) { - int __pyx_v_n_particles_all; - int __pyx_v_n_particles_ind; - PyObject *__pyx_r = NULL; +/* "View.MemoryView":397 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf + */ + +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_2 = NULL; Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - __Pyx_RefNannySetupContext("atomicIndDipPerAtom", 0); + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); - /* "src/helpers/miscellaneous.pyx":436 - * """ + /* "View.MemoryView":399 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< * - * cdef int n_particles_all = coors.shape[0] # <<<<<<<<<<<<<< - * cdef int n_particles_ind = atomic_dipoles.shape[0] + * for dim, idx in enumerate(index): + */ + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * */ - __pyx_v_n_particles_all = (__pyx_v_coors.shape[0]); + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 401, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 401, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); - /* "src/helpers/miscellaneous.pyx":437 + /* "View.MemoryView":402 * - * cdef int n_particles_all = coors.shape[0] - * cdef int n_particles_ind = atomic_dipoles.shape[0] # <<<<<<<<<<<<<< + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< * - * atomic_ind_dip_per_atom(idx, &coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) + * return itemp */ - __pyx_v_n_particles_ind = (__pyx_v_atomic_dipoles.shape[0]); + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; - /* "src/helpers/miscellaneous.pyx":439 - * cdef int n_particles_ind = atomic_dipoles.shape[0] + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf * - * atomic_ind_dip_per_atom(idx, &coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) # <<<<<<<<<<<<<< + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * - * def kronecker(int a, int b) -> int: */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coors.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coors.shape[1]; - __pyx_t_3 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_charges.shape[0]; - __pyx_t_4 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_alpha.shape[0]; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coors_ind.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coors_ind.shape[1]; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_prev_atomic_dipoles.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_prev_atomic_dipoles.shape[1]; - __pyx_t_9 = 0; - __pyx_t_10 = 0; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_atomic_dipoles.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_atomic_dipoles.shape[1]; - atomic_ind_dip_per_atom(__pyx_v_idx, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_1 * __pyx_v_coors.strides[0]) ) + __pyx_t_2 * __pyx_v_coors.strides[1]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_3 * __pyx_v_charges.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_4 * __pyx_v_alpha.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors_ind.data + __pyx_t_5 * __pyx_v_coors_ind.strides[0]) ) + __pyx_t_6 * __pyx_v_coors_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_prev_atomic_dipoles.data + __pyx_t_7 * __pyx_v_prev_atomic_dipoles.strides[0]) ) + __pyx_t_8 * __pyx_v_prev_atomic_dipoles.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_atomic_dipoles.data + __pyx_t_9 * __pyx_v_atomic_dipoles.strides[0]) ) + __pyx_t_10 * __pyx_v_atomic_dipoles.strides[1]) )))), __pyx_v_n_particles_all, __pyx_v_n_particles_ind, __pyx_v_boxlength); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/miscellaneous.pyx":427 + /* "View.MemoryView":404 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * - * @cython.boundscheck(False) - * def atomicIndDipPerAtom(int idx, double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): # <<<<<<<<<<<<<< - * """ - * coors ... (N_all, 3) + * return itemp # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_itemp; + goto __pyx_L0; + + /* "View.MemoryView":397 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coors, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_charges, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_alpha, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coors_ind, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_prev_atomic_dipoles, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_atomic_dipoles, 1); - __Pyx_XGIVEREF(__pyx_r); + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_idx); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":441 - * atomic_ind_dip_per_atom(idx, &coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) +/* "View.MemoryView":407 * - * def kronecker(int a, int b) -> int: # <<<<<<<<<<<<<< - * if (a == b): return 1 - * return 0 + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_23kronecker(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_23kronecker = {"kronecker", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_23kronecker, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_23kronecker(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_a; - int __pyx_v_b; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("kronecker (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("kronecker", 1, 2, 2, 1); __PYX_ERR(0, 441, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "kronecker") < 0)) __PYX_ERR(0, 441, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) - __pyx_v_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("kronecker", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 441, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.kronecker", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_22kronecker(__pyx_self, __pyx_v_a, __pyx_v_b); + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_22kronecker(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_a, int __pyx_v_b) { +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("kronecker", 0); + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "src/helpers/miscellaneous.pyx":442 + /* "View.MemoryView":408 * - * def kronecker(int a, int b) -> int: - * if (a == b): return 1 # <<<<<<<<<<<<<< - * return 0 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self * */ - __pyx_t_1 = ((__pyx_v_a == __pyx_v_b) != 0); + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); if (__pyx_t_1) { + + /* "View.MemoryView":409 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) + */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_1); - __pyx_r = __pyx_int_1; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; + + /* "View.MemoryView":408 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * + */ } - /* "src/helpers/miscellaneous.pyx":443 - * def kronecker(int a, int b) -> int: - * if (a == b): return 1 - * return 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":411 + * return self * + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * + * cdef char *itemp */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_0); - __pyx_r = __pyx_int_0; - goto __pyx_L0; + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 411, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 411, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":441 - * atomic_ind_dip_per_atom(idx, &coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) + /* "View.MemoryView":414 * - * def kronecker(int a, int b) -> int: # <<<<<<<<<<<<<< - * if (a == b): return 1 - * return 0 + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 414, __pyx_L1_error) + if (__pyx_t_1) { - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":415 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; -/* "src/helpers/miscellaneous.pyx":447 + /* "View.MemoryView":414 * - * @cython.boundscheck(False) - * def deriveIndDip(double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): # <<<<<<<<<<<<<< - * """ - * coors_ind ... (N_ind, 3) + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: */ + } -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_25deriveIndDip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_24deriveIndDip[] = "\n coors_ind ... (N_ind, 3)\n vel_ind ... (N_ind, 3)\n atomic_dipoles ... (N_ind, 3)\n derived_atomic_dipoles ... (N_ind, 3)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_25deriveIndDip = {"deriveIndDip", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_25deriveIndDip, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_24deriveIndDip}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_25deriveIndDip(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coors_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_vel_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_derived_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxlength; - CYTHON_UNUSED int __pyx_v_new; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("deriveIndDip (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coors_ind,&__pyx_n_s_vel_ind,&__pyx_n_s_atomic_dipoles,&__pyx_n_s_derived_atomic_dipoles,&__pyx_n_s_boxlength,&__pyx_n_s_new,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coors_ind)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vel_ind)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("deriveIndDip", 0, 5, 6, 1); __PYX_ERR(0, 447, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_atomic_dipoles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("deriveIndDip", 0, 5, 6, 2); __PYX_ERR(0, 447, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_derived_atomic_dipoles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("deriveIndDip", 0, 5, 6, 3); __PYX_ERR(0, 447, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("deriveIndDip", 0, 5, 6, 4); __PYX_ERR(0, 447, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_new); - if (value) { values[5] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "deriveIndDip") < 0)) __PYX_ERR(0, 447, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_coors_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors_ind.memview)) __PYX_ERR(0, 447, __pyx_L3_error) - __pyx_v_vel_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vel_ind.memview)) __PYX_ERR(0, 447, __pyx_L3_error) - __pyx_v_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_atomic_dipoles.memview)) __PYX_ERR(0, 447, __pyx_L3_error) - __pyx_v_derived_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_derived_atomic_dipoles.memview)) __PYX_ERR(0, 447, __pyx_L3_error) - __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 447, __pyx_L3_error) - if (values[5]) { - __pyx_v_new = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_new == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 447, __pyx_L3_error) - } else { - __pyx_v_new = ((int)0); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("deriveIndDip", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 447, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.deriveIndDip", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_24deriveIndDip(__pyx_self, __pyx_v_coors_ind, __pyx_v_vel_ind, __pyx_v_atomic_dipoles, __pyx_v_derived_atomic_dipoles, __pyx_v_boxlength, __pyx_v_new); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_24deriveIndDip(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coors_ind, __Pyx_memviewslice __pyx_v_vel_ind, __Pyx_memviewslice __pyx_v_atomic_dipoles, __Pyx_memviewslice __pyx_v_derived_atomic_dipoles, double __pyx_v_boxlength, CYTHON_UNUSED int __pyx_v_new) { - int __pyx_v_n_ind_particles; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - __Pyx_RefNannySetupContext("deriveIndDip", 0); - - /* "src/helpers/miscellaneous.pyx":455 - * """ + /* "View.MemoryView":417 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) * - * cdef int n_ind_particles = coors_ind.shape[0] # <<<<<<<<<<<<<< - * #cdef double [:,:,:] dip_ten = np.zeros((3,3,3), dtype = 'float64') - * #cdef int atom1, atom2, dim1, dim2, dim3 */ - __pyx_v_n_ind_particles = (__pyx_v_coors_ind.shape[0]); + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((char *)NULL))) __PYX_ERR(1, 417, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; - /* "src/helpers/miscellaneous.pyx":463 - * #cdef double [:] t_mu = np.zeros(3, dtype = 'float64') + /* "View.MemoryView":418 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< * - * derive_ind_dip(&coors_ind[0,0], &vel_ind[0,0], &atomic_dipoles[0,0], &derived_atomic_dipoles[0,0], n_ind_particles, boxlength) # <<<<<<<<<<<<<< - * """ - * else: + * def __setitem__(memoryview self, object index, object value): */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coors_ind.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coors_ind.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_vel_ind.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_vel_ind.shape[1]; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_atomic_dipoles.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_atomic_dipoles.shape[1]; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_derived_atomic_dipoles.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_derived_atomic_dipoles.shape[1]; - derive_ind_dip((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors_ind.data + __pyx_t_1 * __pyx_v_coors_ind.strides[0]) ) + __pyx_t_2 * __pyx_v_coors_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel_ind.data + __pyx_t_3 * __pyx_v_vel_ind.strides[0]) ) + __pyx_t_4 * __pyx_v_vel_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_atomic_dipoles.data + __pyx_t_5 * __pyx_v_atomic_dipoles.strides[0]) ) + __pyx_t_6 * __pyx_v_atomic_dipoles.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_derived_atomic_dipoles.data + __pyx_t_7 * __pyx_v_derived_atomic_dipoles.strides[0]) ) + __pyx_t_8 * __pyx_v_derived_atomic_dipoles.strides[1]) )))), __pyx_v_n_ind_particles, __pyx_v_boxlength); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } - /* "src/helpers/miscellaneous.pyx":447 + /* "View.MemoryView":407 * - * @cython.boundscheck(False) - * def deriveIndDip(double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): # <<<<<<<<<<<<<< - * """ - * coors_ind ... (N_ind, 3) + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coors_ind, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_vel_ind, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_atomic_dipoles, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_derived_atomic_dipoles, 1); + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":511 +/* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) * - * @cython.boundscheck(False) - * def deriveIndDipPerAtom(int idx, double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): # <<<<<<<<<<<<<< - * """ - * coors_ind ... (N_ind, 3) + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_27deriveIndDipPerAtom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_26deriveIndDipPerAtom[] = "\n coors_ind ... (N_ind, 3)\n vel_ind ... (N_ind, 3)\n atomic_dipoles ... (N_ind, 3)\n derived_atomic_dipoles ... (N_ind, 3)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_27deriveIndDipPerAtom = {"deriveIndDipPerAtom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_27deriveIndDipPerAtom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_26deriveIndDipPerAtom}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_27deriveIndDipPerAtom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_idx; - __Pyx_memviewslice __pyx_v_coors_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_vel_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_derived_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxlength; - CYTHON_UNUSED int __pyx_v_new; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("deriveIndDipPerAtom (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_coors_ind,&__pyx_n_s_vel_ind,&__pyx_n_s_atomic_dipoles,&__pyx_n_s_derived_atomic_dipoles,&__pyx_n_s_boxlength,&__pyx_n_s_new,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coors_ind)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, 1); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vel_ind)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, 2); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_atomic_dipoles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, 3); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_derived_atomic_dipoles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, 4); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, 5); __PYX_ERR(0, 511, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_new); - if (value) { values[6] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "deriveIndDipPerAtom") < 0)) __PYX_ERR(0, 511, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_idx = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_coors_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors_ind.memview)) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_vel_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vel_ind.memview)) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_atomic_dipoles.memview)) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_derived_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_derived_atomic_dipoles.memview)) __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) - if (values[6]) { - __pyx_v_new = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_new == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) - } else { - __pyx_v_new = ((int)0); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 511, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.deriveIndDipPerAtom", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_26deriveIndDipPerAtom(__pyx_self, __pyx_v_idx, __pyx_v_coors_ind, __pyx_v_vel_ind, __pyx_v_atomic_dipoles, __pyx_v_derived_atomic_dipoles, __pyx_v_boxlength, __pyx_v_new); + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_26deriveIndDipPerAtom(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_idx, __Pyx_memviewslice __pyx_v_coors_ind, __Pyx_memviewslice __pyx_v_vel_ind, __Pyx_memviewslice __pyx_v_atomic_dipoles, __Pyx_memviewslice __pyx_v_derived_atomic_dipoles, double __pyx_v_boxlength, CYTHON_UNUSED int __pyx_v_new) { - int __pyx_v_n_ind_particles; - PyObject *__pyx_r = NULL; +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - __Pyx_RefNannySetupContext("deriveIndDipPerAtom", 0); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); - /* "src/helpers/miscellaneous.pyx":519 - * """ + /* "View.MemoryView":421 * - * cdef int n_ind_particles = coors_ind.shape[0] # <<<<<<<<<<<<<< + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * - * derive_ind_dip_per_atom(idx, &coors_ind[0,0], &vel_ind[0,0], &atomic_dipoles[0,0], &derived_atomic_dipoles[0,0], n_ind_particles, boxlength) */ - __pyx_v_n_ind_particles = (__pyx_v_coors_ind.shape[0]); + if (unlikely(__pyx_v_self->view.readonly)) { - /* "src/helpers/miscellaneous.pyx":521 - * cdef int n_ind_particles = coors_ind.shape[0] + /* "View.MemoryView":422 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< * - * derive_ind_dip_per_atom(idx, &coors_ind[0,0], &vel_ind[0,0], &atomic_dipoles[0,0], &derived_atomic_dipoles[0,0], n_ind_particles, boxlength) # <<<<<<<<<<<<<< + * have_slices, index = _unellipsify(index, self.view.ndim) + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 422, __pyx_L1_error) + + /* "View.MemoryView":421 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * - * ###BEGIN DANIEL NOE HELPERS */ - __pyx_t_1 = 0; + } + + /* "View.MemoryView":424 + * raise TypeError, "Cannot assign to read-only memoryview" + * + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: + */ + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 424, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 424, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coors_ind.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coors_ind.shape[1]; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_vel_ind.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_vel_ind.shape[1]; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_atomic_dipoles.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_atomic_dipoles.shape[1]; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_derived_atomic_dipoles.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_derived_atomic_dipoles.shape[1]; - derive_ind_dip_per_atom(__pyx_v_idx, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors_ind.data + __pyx_t_1 * __pyx_v_coors_ind.strides[0]) ) + __pyx_t_2 * __pyx_v_coors_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel_ind.data + __pyx_t_3 * __pyx_v_vel_ind.strides[0]) ) + __pyx_t_4 * __pyx_v_vel_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_atomic_dipoles.data + __pyx_t_5 * __pyx_v_atomic_dipoles.strides[0]) ) + __pyx_t_6 * __pyx_v_atomic_dipoles.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_derived_atomic_dipoles.data + __pyx_t_7 * __pyx_v_derived_atomic_dipoles.strides[0]) ) + __pyx_t_8 * __pyx_v_derived_atomic_dipoles.strides[1]) )))), __pyx_v_n_ind_particles, __pyx_v_boxlength); - /* "src/helpers/miscellaneous.pyx":511 + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) * - * @cython.boundscheck(False) - * def deriveIndDipPerAtom(int idx, double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): # <<<<<<<<<<<<<< - * """ - * coors_ind ... (N_ind, 3) + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 426, __pyx_L1_error) + if (__pyx_t_4) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coors_ind, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_vel_ind, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_atomic_dipoles, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_derived_atomic_dipoles, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":427 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj: + * self.setitem_slice_assignment(self[index], obj) + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; -/* "src/helpers/miscellaneous.pyx":525 - * ###BEGIN DANIEL NOE HELPERS - * @cython.boundscheck(False) - * def norm(double[:] x): # <<<<<<<<<<<<<< - * cdef double res = np.dot(x,x)**.5 - * return res + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 428, __pyx_L1_error) + if (__pyx_t_4) { -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_29norm(PyObject *__pyx_self, PyObject *__pyx_arg_x); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_29norm = {"norm", (PyCFunction)__pyx_pw_11newanalysis_13miscellaneous_29norm, METH_O, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_29norm(PyObject *__pyx_self, PyObject *__pyx_arg_x) { - __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("norm (wrapper)", 0); - assert(__pyx_arg_x); { - __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_arg_x, PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 525, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.norm", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_28norm(__pyx_self, __pyx_v_x); + /* "View.MemoryView":429 + * obj = self.is_slice(value) + * if obj: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) + */ + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: + */ + goto __pyx_L5; + } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_28norm(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_x) { - double __pyx_v_res; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - double __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("norm", 0); + /* "View.MemoryView":431 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) + */ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 431, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; - /* "src/helpers/miscellaneous.pyx":526 - * @cython.boundscheck(False) - * def norm(double[:] x): - * cdef double res = np.dot(x,x)**.5 # <<<<<<<<<<<<<< - * return res + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_2, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_2, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L4; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Power(__pyx_t_1, __pyx_float__5, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_res = __pyx_t_8; - /* "src/helpers/miscellaneous.pyx":527 - * def norm(double[:] x): - * cdef double res = np.dot(x,x)**.5 - * return res # <<<<<<<<<<<<<< + /* "View.MemoryView":433 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * cdef is_slice(self, obj): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_res); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 527, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; - /* "src/helpers/miscellaneous.pyx":525 - * ###BEGIN DANIEL NOE HELPERS - * @cython.boundscheck(False) - * def norm(double[:] x): # <<<<<<<<<<<<<< - * cdef double res = np.dot(x,x)**.5 - * return res + /* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("newanalysis.miscellaneous.norm", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_x, 1); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":530 +/* "View.MemoryView":435 + * self.setitem_indexed(index, value) * - * @cython.boundscheck(False) - * def unfold(double[:] ref, double[:] new, double[:] run, double boxl): # <<<<<<<<<<<<<< - * cdef int i - * cdef double D + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_31unfold(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_31unfold = {"unfold", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_31unfold, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_31unfold(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_ref = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_new = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_run = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxl; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("unfold (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ref,&__pyx_n_s_new,&__pyx_n_s_run,&__pyx_n_s_boxl,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ref)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_new)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("unfold", 1, 4, 4, 1); __PYX_ERR(0, 530, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_run)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("unfold", 1, 4, 4, 2); __PYX_ERR(0, 530, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("unfold", 1, 4, 4, 3); __PYX_ERR(0, 530, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unfold") < 0)) __PYX_ERR(0, 530, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_ref = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ref.memview)) __PYX_ERR(0, 530, __pyx_L3_error) - __pyx_v_new = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_new.memview)) __PYX_ERR(0, 530, __pyx_L3_error) - __pyx_v_run = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_run.memview)) __PYX_ERR(0, 530, __pyx_L3_error) - __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 530, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("unfold", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 530, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.unfold", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_30unfold(__pyx_self, __pyx_v_ref, __pyx_v_new, __pyx_v_run, __pyx_v_boxl); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_30unfold(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ref, __Pyx_memviewslice __pyx_v_new, __Pyx_memviewslice __pyx_v_run, double __pyx_v_boxl) { - int __pyx_v_i; - double __pyx_v_D; +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - double __pyx_t_10; + int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("unfold", 0); + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); - /* "src/helpers/miscellaneous.pyx":534 - * cdef double D + /* "View.MemoryView":436 * - * for i in range(3): # <<<<<<<<<<<<<< - * D=(new[i]-ref[i]) - * if abs(D)>(boxl/2): + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":535 - * - * for i in range(3): - * D=(new[i]-ref[i]) # <<<<<<<<<<<<<< - * if abs(D)>(boxl/2): - * D-=np.sign(D)*boxl + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ - __pyx_t_2 = __pyx_v_i; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_new.shape[0]; - __pyx_t_3 = __pyx_v_i; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_ref.shape[0]; - __pyx_v_D = ((*((double *) ( /* dim=0 */ (__pyx_v_new.data + __pyx_t_2 * __pyx_v_new.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_ref.data + __pyx_t_3 * __pyx_v_ref.strides[0]) )))); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { - /* "src/helpers/miscellaneous.pyx":536 - * for i in range(3): - * D=(new[i]-ref[i]) - * if abs(D)>(boxl/2): # <<<<<<<<<<<<<< - * D-=np.sign(D)*boxl - * run[i]+=D + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: */ - __pyx_t_4 = ((fabs(__pyx_v_D) > (__pyx_v_boxl / 2.0)) != 0); - if (__pyx_t_4) { + __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); - /* "src/helpers/miscellaneous.pyx":537 - * D=(new[i]-ref[i]) - * if abs(D)>(boxl/2): - * D-=np.sign(D)*boxl # <<<<<<<<<<<<<< - * run[i]+=D - * return run + /* "View.MemoryView":439 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None + */ + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: + */ + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ - __pyx_t_5 = PyFloat_FromDouble(__pyx_v_D); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sign); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyFloat_FromDouble(__pyx_v_D); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } } - __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyFloat_FromDouble(__pyx_v_boxl); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_InPlaceSubtract(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_D = __pyx_t_10; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/helpers/miscellaneous.pyx":536 - * for i in range(3): - * D=(new[i]-ref[i]) - * if abs(D)>(boxl/2): # <<<<<<<<<<<<<< - * D-=np.sign(D)*boxl - * run[i]+=D + /* "View.MemoryView":440 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None + * + */ + __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); + if (__pyx_t_9) { + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 440, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + + /* "View.MemoryView":441 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< + * + * return obj */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + */ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; } - /* "src/helpers/miscellaneous.pyx":538 - * if abs(D)>(boxl/2): - * D-=np.sign(D)*boxl - * run[i]+=D # <<<<<<<<<<<<<< - * return run + /* "View.MemoryView":436 * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - __pyx_t_3 = __pyx_v_i; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_run.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_run.data + __pyx_t_3 * __pyx_v_run.strides[0]) )) += __pyx_v_D; } - /* "src/helpers/miscellaneous.pyx":539 - * D-=np.sign(D)*boxl - * run[i]+=D - * return run # <<<<<<<<<<<<<< + /* "View.MemoryView":443 + * return None * + * return obj # <<<<<<<<<<<<<< * + * cdef setitem_slice_assignment(self, dst, src): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_run, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 539, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_r = __pyx_t_8; - __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":530 + /* "View.MemoryView":435 + * self.setitem_indexed(index, value) * - * @cython.boundscheck(False) - * def unfold(double[:] ref, double[:] new, double[:] run, double boxl): # <<<<<<<<<<<<<< - * cdef int i - * cdef double D + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("newanalysis.miscellaneous.unfold", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_ref, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_new, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_run, 1); + __Pyx_XDECREF(__pyx_v_obj); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":543 +/* "View.MemoryView":445 + * return obj * - * @cython.boundscheck(False) - * def min_dist(double[:] res1, double[:] res2, double boxl): # <<<<<<<<<<<<<< - * cdef int i - * cdef double D + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_33min_dist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_33min_dist = {"min_dist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_33min_dist, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_33min_dist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_res1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_res2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxl; +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("min_dist (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_res1,&__pyx_n_s_res2,&__pyx_n_s_boxl,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_res1)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_res2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("min_dist", 1, 3, 3, 1); __PYX_ERR(0, 543, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("min_dist", 1, 3, 3, 2); __PYX_ERR(0, 543, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "min_dist") < 0)) __PYX_ERR(0, 543, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_res1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_res1.memview)) __PYX_ERR(0, 543, __pyx_L3_error) - __pyx_v_res2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_res2.memview)) __PYX_ERR(0, 543, __pyx_L3_error) - __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("min_dist", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 543, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.min_dist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_32min_dist(__pyx_self, __pyx_v_res1, __pyx_v_res2, __pyx_v_boxl); + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + + /* "View.MemoryView":448 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + */ + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); + + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + */ + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":451 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 451, __pyx_L1_error) + + /* "View.MemoryView":445 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_32min_dist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_res1, __Pyx_memviewslice __pyx_v_res2, double __pyx_v_boxl) { - int __pyx_v_i; - double __pyx_v_D; - __Pyx_memviewslice __pyx_v_vec = { 0, 0, { 0 }, { 0 }, { 0 } }; +/* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL + */ + +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[0x80]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_4; int __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; - double __pyx_t_10; - Py_ssize_t __pyx_t_11; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("min_dist", 0); + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - /* "src/helpers/miscellaneous.pyx":546 - * cdef int i - * cdef double D - * cdef double [:] vec = np.zeros(3) # <<<<<<<<<<<<<< + /* "View.MemoryView":455 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item * - * for i in range(3): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_vec = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v_tmp = NULL; - /* "src/helpers/miscellaneous.pyx":548 - * cdef double [:] vec = np.zeros(3) + /* "View.MemoryView":460 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< * - * for i in range(3): # <<<<<<<<<<<<<< - * D=(res2[i]-res1[i]) - * if abs(D)>(boxl/2): + * if self.view.itemsize > sizeof(array): */ - for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 460, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":549 + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) * - * for i in range(3): - * D=(res2[i]-res1[i]) # <<<<<<<<<<<<<< - * if abs(D)>(boxl/2): - * res2[i]-=np.sign(D)*boxl + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ - __pyx_t_6 = __pyx_v_i; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_res2.shape[0]; - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_res1.shape[0]; - __pyx_v_D = ((*((double *) ( /* dim=0 */ (__pyx_v_res2.data + __pyx_t_6 * __pyx_v_res2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_res1.data + __pyx_t_7 * __pyx_v_res1.strides[0]) )))); + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":550 - * for i in range(3): - * D=(res2[i]-res1[i]) - * if abs(D)>(boxl/2): # <<<<<<<<<<<<<< - * res2[i]-=np.sign(D)*boxl + /* "View.MemoryView":463 * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError */ - __pyx_t_8 = ((fabs(__pyx_v_D) > (__pyx_v_boxl / 2.0)) != 0); - if (__pyx_t_8) { + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - /* "src/helpers/miscellaneous.pyx":551 - * D=(res2[i]-res1[i]) - * if abs(D)>(boxl/2): - * res2[i]-=np.sign(D)*boxl # <<<<<<<<<<<<<< - * - * vec[0] = res2[0] - res1[0] + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sign); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_D); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_9, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_boxl); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 551, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_res2.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_res2.data + __pyx_t_7 * __pyx_v_res2.strides[0]) )) -= __pyx_t_10; + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/miscellaneous.pyx":550 - * for i in range(3): - * D=(res2[i]-res1[i]) - * if abs(D)>(boxl/2): # <<<<<<<<<<<<<< - * res2[i]-=np.sign(D)*boxl - * - */ - } + /* "View.MemoryView":465 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: + */ + PyErr_NoMemory(); __PYX_ERR(1, 465, __pyx_L1_error) + + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp + */ + } + + /* "View.MemoryView":466 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array + */ + __pyx_v_item = __pyx_v_tmp; + + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) + * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + */ + goto __pyx_L3; } - /* "src/helpers/miscellaneous.pyx":553 - * res2[i]-=np.sign(D)*boxl + /* "View.MemoryView":468 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< * - * vec[0] = res2[0] - res1[0] # <<<<<<<<<<<<<< - * vec[1] = res2[1] - res1[1] - * vec[2] = res2[2] - res1[2] + * try: */ - __pyx_t_7 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_res2.shape[0]; - __pyx_t_6 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_res1.shape[0]; - __pyx_t_11 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_vec.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_vec.data + __pyx_t_11 * __pyx_v_vec.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_res2.data + __pyx_t_7 * __pyx_v_res2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_res1.data + __pyx_t_6 * __pyx_v_res1.strides[0]) )))); + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":554 + /* "View.MemoryView":470 + * item = array * - * vec[0] = res2[0] - res1[0] - * vec[1] = res2[1] - res1[1] # <<<<<<<<<<<<<< - * vec[2] = res2[2] - res1[2] - * return norm(vec) + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value */ - __pyx_t_6 = 1; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_res2.shape[0]; - __pyx_t_7 = 1; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_res1.shape[0]; - __pyx_t_11 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_vec.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_vec.data + __pyx_t_11 * __pyx_v_vec.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_res2.data + __pyx_t_6 * __pyx_v_res2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_res1.data + __pyx_t_7 * __pyx_v_res1.strides[0]) )))); + /*try:*/ { - /* "src/helpers/miscellaneous.pyx":555 - * vec[0] = res2[0] - res1[0] - * vec[1] = res2[1] - res1[1] - * vec[2] = res2[2] - res1[2] # <<<<<<<<<<<<<< - * return norm(vec) + /* "View.MemoryView":471 * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - __pyx_t_7 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_res2.shape[0]; - __pyx_t_6 = 2; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_res1.shape[0]; - __pyx_t_11 = 2; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_vec.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_vec.data + __pyx_t_11 * __pyx_v_vec.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_res2.data + __pyx_t_7 * __pyx_v_res2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_res1.data + __pyx_t_6 * __pyx_v_res1.strides[0]) )))); + if (__pyx_v_self->dtype_is_object) { - /* "src/helpers/miscellaneous.pyx":556 - * vec[1] = res2[1] - res1[1] - * vec[2] = res2[2] - res1[2] - * return norm(vec) # <<<<<<<<<<<<<< + /* "View.MemoryView":472 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) + */ + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + + /* "View.MemoryView":471 + * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: + */ + goto __pyx_L8; + } + + /* "View.MemoryView":474 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_norm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_vec, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":478 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + */ + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { + + /* "View.MemoryView":479 + * + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) + */ + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 479, __pyx_L6_error) + + /* "View.MemoryView":478 + * + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + */ } + + /* "View.MemoryView":480 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: + */ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); } - __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_9, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":543 + /* "View.MemoryView":483 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def min_dist(double[:] res1, double[:] res2, double boxl): # <<<<<<<<<<<<<< - * cdef int i - * cdef double D + * cdef setitem_indexed(self, index, value): + */ + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + } + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } + + /* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("newanalysis.miscellaneous.min_dist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_vec, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_res1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_res2, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":560 +/* "View.MemoryView":485 + * PyMem_Free(tmp) * - * @cython.boundscheck(False) - * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 # <<<<<<<<<<<<<< - * cdef double [:] rv = np.zeros(3) #distance vector - * rv[0] = coo2[0] - coo1[0] + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_35dipTen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_35dipTen = {"dipTen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_35dipTen, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_35dipTen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coo1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coo2 = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("dipTen (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coo1,&__pyx_n_s_coo2,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coo1)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coo2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dipTen", 1, 2, 2, 1); __PYX_ERR(0, 560, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dipTen") < 0)) __PYX_ERR(0, 560, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_coo1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coo1.memview)) __PYX_ERR(0, 560, __pyx_L3_error) - __pyx_v_coo2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coo2.memview)) __PYX_ERR(0, 560, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dipTen", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 560, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.dipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_34dipTen(__pyx_self, __pyx_v_coo1, __pyx_v_coo2); + __Pyx_RefNannySetupContext("setitem_indexed", 0); + + /* "View.MemoryView":486 + * + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 486, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; + + /* "View.MemoryView":487 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":485 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) + */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_34dipTen(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coo1, __Pyx_memviewslice __pyx_v_coo2) { - __Pyx_memviewslice __pyx_v_rv = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_r2; - double __pyx_v_f1; - double __pyx_v_f2; - __Pyx_memviewslice __pyx_v_dipt = { 0, 0, { 0 }, { 0 }, { 0 } }; +/* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + */ + +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - double __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dipTen", 0); + __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "src/helpers/miscellaneous.pyx":561 - * @cython.boundscheck(False) - * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 - * cdef double [:] rv = np.zeros(3) #distance vector # <<<<<<<<<<<<<< - * rv[0] = coo2[0] - coo1[0] - * rv[1] = coo2[1] - coo1[1] + /* "View.MemoryView":492 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem + * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 561, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_rv = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":562 - * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 - * cdef double [:] rv = np.zeros(3) #distance vector - * rv[0] = coo2[0] - coo1[0] # <<<<<<<<<<<<<< - * rv[1] = coo2[1] - coo1[1] - * rv[2] = coo2[2] - coo1[2] + /* "View.MemoryView":495 + * cdef bytes bytesitem + * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) */ - __pyx_t_5 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coo2.shape[0]; - __pyx_t_6 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coo1.shape[0]; - __pyx_t_7 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_rv.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_7 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_coo2.data + __pyx_t_5 * __pyx_v_coo2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coo1.data + __pyx_t_6 * __pyx_v_coo1.strides[0]) )))); + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":563 - * cdef double [:] rv = np.zeros(3) #distance vector - * rv[0] = coo2[0] - coo1[0] - * rv[1] = coo2[1] - coo1[1] # <<<<<<<<<<<<<< - * rv[2] = coo2[2] - coo1[2] - * cdef double r2 = np.dot(rv,rv) #norm squared of rv + /* "View.MemoryView":496 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - __pyx_t_6 = 1; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coo2.shape[0]; - __pyx_t_5 = 1; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coo1.shape[0]; - __pyx_t_7 = 1; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_rv.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_7 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_coo2.data + __pyx_t_6 * __pyx_v_coo2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coo1.data + __pyx_t_5 * __pyx_v_coo1.strides[0]) )))); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { - /* "src/helpers/miscellaneous.pyx":564 - * rv[0] = coo2[0] - coo1[0] - * rv[1] = coo2[1] - coo1[1] - * rv[2] = coo2[2] - coo1[2] # <<<<<<<<<<<<<< - * cdef double r2 = np.dot(rv,rv) #norm squared of rv - * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 + /* "View.MemoryView":497 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" */ - __pyx_t_5 = 2; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coo2.shape[0]; - __pyx_t_6 = 2; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coo1.shape[0]; - __pyx_t_7 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_rv.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_7 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_coo2.data + __pyx_t_5 * __pyx_v_coo2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coo1.data + __pyx_t_6 * __pyx_v_coo1.strides[0]) )))); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":565 - * rv[1] = coo2[1] - coo1[1] - * rv[2] = coo2[2] - coo1[2] - * cdef double r2 = np.dot(rv,rv) #norm squared of rv # <<<<<<<<<<<<<< - * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 - * cdef double f2 = 3/r2 #prefactor 2: 3*1/r**2 + /* "View.MemoryView":496 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_3, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_3, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL; } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8); - __pyx_t_3 = 0; - __pyx_t_8 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 565, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_r2 = __pyx_t_12; - /* "src/helpers/miscellaneous.pyx":566 - * rv[2] = coo2[2] - coo1[2] - * cdef double r2 = np.dot(rv,rv) #norm squared of rv - * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 # <<<<<<<<<<<<<< - * cdef double f2 = 3/r2 #prefactor 2: 3*1/r**2 - * cdef double[:] dipt = np.empty(6,dtype=np.float64) #initialize dipole dipole tensor (xx,yy,zz,xy,xz,yz) + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result */ - __pyx_v_f1 = pow(__pyx_v_r2, -1.5); + /*else:*/ { + __pyx_t_9 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 501, __pyx_L5_except_error) + __pyx_t_10 = (__pyx_t_9 == 1); + if (__pyx_t_10) { - /* "src/helpers/miscellaneous.pyx":567 - * cdef double r2 = np.dot(rv,rv) #norm squared of rv - * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 - * cdef double f2 = 3/r2 #prefactor 2: 3*1/r**2 # <<<<<<<<<<<<<< - * cdef double[:] dipt = np.empty(6,dtype=np.float64) #initialize dipole dipole tensor (xx,yy,zz,xy,xz,yz) + /* "View.MemoryView":502 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result * */ - if (unlikely(__pyx_v_r2 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 567, __pyx_L1_error) - } - __pyx_v_f2 = (3.0 / __pyx_v_r2); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 502, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; - /* "src/helpers/miscellaneous.pyx":568 - * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 - * cdef double f2 = 3/r2 #prefactor 2: 3*1/r**2 - * cdef double[:] dipt = np.empty(6,dtype=np.float64) #initialize dipole dipole tensor (xx,yy,zz,xy,xz,yz) # <<<<<<<<<<<<<< + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result + */ + } + + /* "View.MemoryView":503 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< * - * dipt[0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements + * cdef assign_item_from_object(self, char *itemp, object value): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":498 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: + */ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_6); + __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; + if (__pyx_t_8) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_1); + + /* "View.MemoryView":499 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 499, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "View.MemoryView":496 + * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; + } + + /* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":505 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + */ + +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + char *__pyx_t_10; + char *__pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":508 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue + */ + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple_, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_dipt = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":570 - * cdef double[:] dipt = np.empty(6,dtype=np.float64) #initialize dipole dipole tensor (xx,yy,zz,xy,xz,yz) + /* "View.MemoryView":513 + * cdef Py_ssize_t i * - * dipt[0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements # <<<<<<<<<<<<<< - * dipt[1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor - * dipt[2]=f1*(rv[2]*rv[2]*f2-1) + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: */ - __pyx_t_6 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; - __pyx_t_5 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_rv.shape[0]; - __pyx_t_7 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipt.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_7 * __pyx_v_dipt.strides[0]) )) = (__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_5 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0)); + __pyx_t_2 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":571 + /* "View.MemoryView":514 * - * dipt[0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements - * dipt[1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor # <<<<<<<<<<<<<< - * dipt[2]=f1*(rv[2]*rv[2]*f2-1) - * dipt[3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) */ - __pyx_t_5 = 1; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_rv.shape[0]; - __pyx_t_6 = 1; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; - __pyx_t_7 = 1; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipt.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_7 * __pyx_v_dipt.strides[0]) )) = (__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_5 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0)); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 514, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/miscellaneous.pyx":572 - * dipt[0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements - * dipt[1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor - * dipt[2]=f1*(rv[2]*rv[2]*f2-1) # <<<<<<<<<<<<<< - * dipt[3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice - * dipt[4]=f1*(rv[0]*rv[2]*f2)*2 + /* "View.MemoryView":513 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: */ - __pyx_t_6 = 2; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; - __pyx_t_5 = 2; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_rv.shape[0]; - __pyx_t_7 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipt.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_7 * __pyx_v_dipt.strides[0]) )) = (__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_5 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0)); + goto __pyx_L3; + } - /* "src/helpers/miscellaneous.pyx":573 - * dipt[1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor - * dipt[2]=f1*(rv[2]*rv[2]*f2-1) - * dipt[3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice # <<<<<<<<<<<<<< - * dipt[4]=f1*(rv[0]*rv[2]*f2)*2 - * dipt[5]=f1*(rv[1]*rv[2]*f2)*2 + /* "View.MemoryView":516 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + * + * for i, c in enumerate(bytesvalue): */ - __pyx_t_5 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_rv.shape[0]; - __pyx_t_6 = 1; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; - __pyx_t_7 = 3; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipt.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_7 * __pyx_v_dipt.strides[0]) )) = ((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_5 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0); + /*else*/ { + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_value}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":574 - * dipt[2]=f1*(rv[2]*rv[2]*f2-1) - * dipt[3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice - * dipt[4]=f1*(rv[0]*rv[2]*f2)*2 # <<<<<<<<<<<<<< - * dipt[5]=f1*(rv[1]*rv[2]*f2)*2 - * return dipt + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c + * */ - __pyx_t_6 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; - __pyx_t_5 = 2; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_rv.shape[0]; - __pyx_t_7 = 4; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipt.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_7 * __pyx_v_dipt.strides[0]) )) = ((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_5 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0); + __pyx_t_7 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 518, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_8 = __pyx_v_bytesvalue; + __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8); + __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8)); + for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) { + __pyx_t_9 = __pyx_t_12; + __pyx_v_c = (__pyx_t_9[0]); - /* "src/helpers/miscellaneous.pyx":575 - * dipt[3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice - * dipt[4]=f1*(rv[0]*rv[2]*f2)*2 - * dipt[5]=f1*(rv[1]*rv[2]*f2)*2 # <<<<<<<<<<<<<< - * return dipt + /* "View.MemoryView":519 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< * + * @cname('getbuffer') */ - __pyx_t_5 = 1; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_rv.shape[0]; - __pyx_t_6 = 2; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; - __pyx_t_7 = 5; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipt.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_7 * __pyx_v_dipt.strides[0]) )) = ((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_5 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0); + __pyx_v_i = __pyx_t_7; - /* "src/helpers/miscellaneous.pyx":576 - * dipt[4]=f1*(rv[0]*rv[2]*f2)*2 - * dipt[5]=f1*(rv[1]*rv[2]*f2)*2 - * return dipt # <<<<<<<<<<<<<< + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_dipt, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 576, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_r = __pyx_t_8; - __pyx_t_8 = 0; - goto __pyx_L0; + __pyx_t_7 = (__pyx_t_7 + 1); - /* "src/helpers/miscellaneous.pyx":560 + /* "View.MemoryView":519 * - * @cython.boundscheck(False) - * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 # <<<<<<<<<<<<<< - * cdef double [:] rv = np.zeros(3) #distance vector - * rv[0] = coo2[0] - coo1[0] + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< + * + * @cname('getbuffer') + */ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "View.MemoryView":505 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("newanalysis.miscellaneous.dipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_rv, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dipt, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coo1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coo2, 1); + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":580 - * @cython.boundscheck(False) - * class selfobject: - * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? # <<<<<<<<<<<<<< - * self.p = p - * self.apr_emim_h = apr_emim_h +/* "View.MemoryView":521 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_10selfobject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_10selfobject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_10selfobject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_10selfobject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - int __pyx_v_p; - __Pyx_memviewslice __pyx_v_p_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_apr_emim_h; - int __pyx_v_n_pairs_h; - __Pyx_memviewslice __pyx_v_emim_h = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_p,&__pyx_n_s_p_coor,&__pyx_n_s_apr_emim_h,&__pyx_n_s_n_pairs_h,&__pyx_n_s_emim_h,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 1); __PYX_ERR(0, 580, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 2); __PYX_ERR(0, 580, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr_emim_h)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 3); __PYX_ERR(0, 580, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pairs_h)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 4); __PYX_ERR(0, 580, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_emim_h)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 5); __PYX_ERR(0, 580, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 580, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - } - __pyx_v_self = values[0]; - __pyx_v_p = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_p == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) - __pyx_v_p_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_p_coor.memview)) __PYX_ERR(0, 580, __pyx_L3_error) - __pyx_v_apr_emim_h = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_apr_emim_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) - __pyx_v_n_pairs_h = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_n_pairs_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) - __pyx_v_emim_h = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_emim_h.memview)) __PYX_ERR(0, 580, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 580, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.selfobject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_10selfobject___init__(__pyx_self, __pyx_v_self, __pyx_v_p, __pyx_v_p_coor, __pyx_v_apr_emim_h, __pyx_v_n_pairs_h, __pyx_v_emim_h); + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_10selfobject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_p, __Pyx_memviewslice __pyx_v_p_coor, int __pyx_v_apr_emim_h, int __pyx_v_n_pairs_h, __Pyx_memviewslice __pyx_v_emim_h) { - __Pyx_memviewslice __pyx_v_pl = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_v_i = 0; - PyObject *__pyx_v_j = 0; - PyObject *__pyx_v_index = 0; - __Pyx_memviewslice __pyx_v_rv = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_r2; - double __pyx_v_f1; - double __pyx_v_f2; - __Pyx_memviewslice __pyx_v_r_0 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dipt_0 = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_r = NULL; +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t *__pyx_t_3; + char *__pyx_t_4; + void *__pyx_t_5; + int __pyx_t_6; Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - double __pyx_t_13; - PyObject *(*__pyx_t_14)(PyObject *); - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; - Py_ssize_t __pyx_t_17; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - int __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); - /* "src/helpers/miscellaneous.pyx":581 - * class selfobject: - * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? - * self.p = p # <<<<<<<<<<<<<< - * self.apr_emim_h = apr_emim_h - * self.emim_h = emim_h + /* "View.MemoryView":523 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_p, __pyx_t_1) < 0) __PYX_ERR(0, 581, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "src/helpers/miscellaneous.pyx":582 - * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? - * self.p = p - * self.apr_emim_h = apr_emim_h # <<<<<<<<<<<<<< - * self.emim_h = emim_h - * self.n_pairs_h = n_pairs_h + /* "View.MemoryView":524 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 582, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 524, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":583 - * self.p = p - * self.apr_emim_h = apr_emim_h - * self.emim_h = emim_h # <<<<<<<<<<<<<< - * self.n_pairs_h = n_pairs_h + /* "View.MemoryView":523 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * */ - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_emim_h, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 583, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } - /* "src/helpers/miscellaneous.pyx":584 - * self.apr_emim_h = apr_emim_h - * self.emim_h = emim_h - * self.n_pairs_h = n_pairs_h # <<<<<<<<<<<<<< + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * - * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h, __pyx_t_1) < 0) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":586 - * self.n_pairs_h = n_pairs_h + /* "View.MemoryView":527 * - * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< - * cdef i, j, index = 0 + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL + */ + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; + + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 586, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 586, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_pl = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + goto __pyx_L6; + } - /* "src/helpers/miscellaneous.pyx":587 + /* "View.MemoryView":529 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< * - * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') - * cdef i, j, index = 0 # <<<<<<<<<<<<<< + * if flags & PyBUF_STRIDES: + */ + /*else*/ { + __pyx_v_info->shape = NULL; + } + __pyx_L6:; + + /* "View.MemoryView":531 + * info.shape = NULL * - * cdef double [:] rv = np.zeros(3) + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_index = __pyx_int_0; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":589 - * cdef i, j, index = 0 + /* "View.MemoryView":532 * - * cdef double [:] rv = np.zeros(3) # <<<<<<<<<<<<<< - * cdef double r2 - * cdef double f1 + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_int_3); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 589, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_rv = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":594 - * cdef double f2 + /* "View.MemoryView":531 + * info.shape = NULL * - * for i in self.emim_h: # <<<<<<<<<<<<<< - * pl[index, 0] = np.copy(p_coor[i,0]) - * pl[index, 1] = np.copy(p_coor[i,1]) + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 594, __pyx_L1_error) + goto __pyx_L7; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 594, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 594, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_8(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 594, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); - __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":595 + /* "View.MemoryView":534 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< * - * for i in self.emim_h: - * pl[index, 0] = np.copy(p_coor[i,0]) # <<<<<<<<<<<<<< - * pl[index, 1] = np.copy(p_coor[i,1]) - * pl[index, 2] = np.copy(p_coor[i,2]) + * if flags & PyBUF_INDIRECT: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L1_error) - __pyx_t_10 = __pyx_t_9; - __pyx_t_11 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p_coor.shape[1]; - __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p_coor.data + __pyx_t_10 * __pyx_v_p_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p_coor.strides[1]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_12, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L1_error) - __pyx_t_11 = __pyx_t_9; - __pyx_t_10 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_pl.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_11 * __pyx_v_pl.strides[0]) ) + __pyx_t_10 * __pyx_v_pl.strides[1]) )) = __pyx_t_13; + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; - /* "src/helpers/miscellaneous.pyx":596 - * for i in self.emim_h: - * pl[index, 0] = np.copy(p_coor[i,0]) - * pl[index, 1] = np.copy(p_coor[i,1]) # <<<<<<<<<<<<<< - * pl[index, 2] = np.copy(p_coor[i,2]) - * index += 1 + /* "View.MemoryView":536 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 596, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error) - __pyx_t_10 = __pyx_t_9; - __pyx_t_11 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p_coor.shape[1]; - __pyx_t_2 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p_coor.data + __pyx_t_10 * __pyx_v_p_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p_coor.strides[1]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_12, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 596, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error) - __pyx_t_11 = __pyx_t_9; - __pyx_t_10 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_pl.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_11 * __pyx_v_pl.strides[0]) ) + __pyx_t_10 * __pyx_v_pl.strides[1]) )) = __pyx_t_13; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":597 - * pl[index, 0] = np.copy(p_coor[i,0]) - * pl[index, 1] = np.copy(p_coor[i,1]) - * pl[index, 2] = np.copy(p_coor[i,2]) # <<<<<<<<<<<<<< - * index += 1 + /* "View.MemoryView":537 * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 597, __pyx_L1_error) - __pyx_t_10 = __pyx_t_9; - __pyx_t_11 = 2; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p_coor.shape[1]; - __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p_coor.data + __pyx_t_10 * __pyx_v_p_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p_coor.strides[1]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_12, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 597, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 597, __pyx_L1_error) - __pyx_t_11 = __pyx_t_9; - __pyx_t_10 = 2; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_pl.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_11 * __pyx_v_pl.strides[0]) ) + __pyx_t_10 * __pyx_v_pl.strides[1]) )) = __pyx_t_13; + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":598 - * pl[index, 1] = np.copy(p_coor[i,1]) - * pl[index, 2] = np.copy(p_coor[i,2]) - * index += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":536 + * info.strides = NULL * - * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: */ - __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); - __pyx_t_4 = 0; + goto __pyx_L8; + } - /* "src/helpers/miscellaneous.pyx":594 - * cdef double f2 + /* "View.MemoryView":539 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< * - * for i in self.emim_h: # <<<<<<<<<<<<<< - * pl[index, 0] = np.copy(p_coor[i,0]) - * pl[index, 1] = np.copy(p_coor[i,1]) + * if flags & PyBUF_FORMAT: */ + /*else*/ { + __pyx_v_info->suboffsets = NULL; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_L8:; - /* "src/helpers/miscellaneous.pyx":600 - * index += 1 + /* "View.MemoryView":541 + * info.suboffsets = NULL * - * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') # <<<<<<<<<<<<<< - * #cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') - * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 600, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 600, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_r_0 = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":602 - * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') - * #cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') - * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') # <<<<<<<<<<<<<< - * self.r_0 = r_0 - * #self.bin = bins + /* "View.MemoryView":542 + * + * if flags & PyBUF_FORMAT: + * info.format = self.view.format # <<<<<<<<<<<<<< + * else: + * info.format = NULL */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 602, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 602, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 602, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 602, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_int_6); - __Pyx_GIVEREF(__pyx_int_6); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_6); - __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 602, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 602, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 602, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 602, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 602, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_dipt_0 = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + __pyx_t_4 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_4; - /* "src/helpers/miscellaneous.pyx":603 - * #cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') - * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') - * self.r_0 = r_0 # <<<<<<<<<<<<<< - * #self.bin = bins + /* "View.MemoryView":541 + * info.suboffsets = NULL * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * info.format = self.view.format + * else: */ - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_r_0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 603, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_r_0, __pyx_t_4) < 0) __PYX_ERR(0, 603, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L9; + } - /* "src/helpers/miscellaneous.pyx":606 - * #self.bin = bins + /* "View.MemoryView":544 + * info.format = self.view.format + * else: + * info.format = NULL # <<<<<<<<<<<<<< * - * index = 0 # <<<<<<<<<<<<<< - * for i in range(self.apr_emim_h-1): - * for j in range((i+1), self.apr_emim_h): + * info.buf = self.view.buf */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_DECREF_SET(__pyx_v_index, __pyx_int_0); + /*else*/ { + __pyx_v_info->format = NULL; + } + __pyx_L9:; - /* "src/helpers/miscellaneous.pyx":607 + /* "View.MemoryView":546 + * info.format = NULL * - * index = 0 - * for i in range(self.apr_emim_h-1): # <<<<<<<<<<<<<< - * for j in range((i+1), self.apr_emim_h): - * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 607, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 607, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 607, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_8(__pyx_t_2); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 607, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; - /* "src/helpers/miscellaneous.pyx":608 - * index = 0 - * for i in range(self.apr_emim_h-1): - * for j in range((i+1), self.apr_emim_h): # <<<<<<<<<<<<<< - * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) - * #self.bin[index] = int(self.r_0[index]) + /* "View.MemoryView":547 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len */ - __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 608, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __pyx_t_4 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; - __pyx_t_14 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 608, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 608, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 608, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_14(__pyx_t_1); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 608, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; - /* "src/helpers/miscellaneous.pyx":609 - * for i in range(self.apr_emim_h-1): - * for j in range((i+1), self.apr_emim_h): - * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) # <<<<<<<<<<<<<< - * #self.bin[index] = int(self.r_0[index]) - * index += 1 + /* "View.MemoryView":548 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_norm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_float64); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 609, __pyx_L1_error) - __pyx_t_6.data = __pyx_v_pl.data; - __pyx_t_6.memview = __pyx_v_pl.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_t_17; - Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; -} + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; -__pyx_t_6.shape[0] = __pyx_v_pl.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_pl.strides[1]; - __pyx_t_6.suboffsets[0] = -1; + /* "View.MemoryView":549 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self + */ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; -__pyx_t_15 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_18 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) { - __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_16); - if (likely(__pyx_t_18)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); - __Pyx_INCREF(__pyx_t_18); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_16, function); - } - } - __pyx_t_12 = (__pyx_t_18) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_18, __pyx_t_15) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_15); - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_float64); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 609, __pyx_L1_error) - __pyx_t_6.data = __pyx_v_pl.data; - __pyx_t_6.memview = __pyx_v_pl.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_t_17; - Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; -} + /* "View.MemoryView":550 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * + */ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; -__pyx_t_6.shape[0] = __pyx_v_pl.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_pl.strides[1]; - __pyx_t_6.suboffsets[0] = -1; + /* "View.MemoryView":551 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * + * + */ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); -__pyx_t_15 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_19 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_18); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_18, function); - } - } - __pyx_t_16 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_19, __pyx_t_15) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_15); - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyNumber_Subtract(__pyx_t_12, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_16)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_16); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_16, __pyx_t_18) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_18); - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_v_index, __pyx_t_3) < 0)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /* "View.MemoryView":521 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + */ - /* "src/helpers/miscellaneous.pyx":611 - * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) - * #self.bin[index] = int(self.r_0[index]) - * index += 1 # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":554 * - * self.dipt_0 = dipt_0 + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); - __pyx_t_3 = 0; - /* "src/helpers/miscellaneous.pyx":608 - * index = 0 - * for i in range(self.apr_emim_h-1): - * for j in range((i+1), self.apr_emim_h): # <<<<<<<<<<<<<< - * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) - * #self.bin[index] = int(self.r_0[index]) +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":556 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 556, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":607 + /* "View.MemoryView":557 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result * - * index = 0 - * for i in range(self.apr_emim_h-1): # <<<<<<<<<<<<<< - * for j in range((i+1), self.apr_emim_h): - * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 557, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":613 - * index += 1 + /* "View.MemoryView":558 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< * - * self.dipt_0 = dipt_0 # <<<<<<<<<<<<<< - * index = 0 - * for i in range(self.apr_emim_h-1): + * @property */ - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dipt_0, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0, __pyx_t_2) < 0) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":614 + /* "View.MemoryView":554 * - * self.dipt_0 = dipt_0 - * index = 0 # <<<<<<<<<<<<<< - * for i in range(self.apr_emim_h-1): - * for j in range((i+1), self.apr_emim_h): + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_DECREF_SET(__pyx_v_index, __pyx_int_0); - /* "src/helpers/miscellaneous.pyx":615 - * self.dipt_0 = dipt_0 - * index = 0 - * for i in range(self.apr_emim_h-1): # <<<<<<<<<<<<<< - * for j in range((i+1), self.apr_emim_h): - * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 615, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 615, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 615, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_8(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 615, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); - __pyx_t_2 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":616 - * index = 0 - * for i in range(self.apr_emim_h-1): - * for j in range((i+1), self.apr_emim_h): # <<<<<<<<<<<<<< - * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) - * #self.bin[index] = int(self.r_0[index]) +/* "View.MemoryView":560 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ - __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0; - __pyx_t_14 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_14 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 616, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 616, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 616, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_14(__pyx_t_4); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 616, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3); - __pyx_t_3 = 0; - /* "src/helpers/miscellaneous.pyx":617 - * for i in range(self.apr_emim_h-1): - * for j in range((i+1), self.apr_emim_h): - * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) # <<<<<<<<<<<<<< - * #self.bin[index] = int(self.r_0[index]) +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":562 + * @property + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< * + * cdef _get_base(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_norm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 617, __pyx_L1_error) - __pyx_t_6.data = __pyx_v_pl.data; - __pyx_t_6.memview = __pyx_v_pl.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_t_17; - Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; -} + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; -__pyx_t_6.shape[0] = __pyx_v_pl.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_pl.strides[1]; - __pyx_t_6.suboffsets[0] = -1; + /* "View.MemoryView":560 + * return result + * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() + */ -__pyx_t_16 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_15 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - } - } - __pyx_t_18 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_15, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_16); - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_float64); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 617, __pyx_L1_error) - __pyx_t_6.data = __pyx_v_pl.data; - __pyx_t_6.memview = __pyx_v_pl.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_t_17; - Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -__pyx_t_6.shape[0] = __pyx_v_pl.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_pl.strides[1]; - __pyx_t_6.suboffsets[0] = -1; +/* "View.MemoryView":564 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * + */ -__pyx_t_16 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_19 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_15); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_15, function); - } - } - __pyx_t_12 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_19, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_16); - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyNumber_Subtract(__pyx_t_18, __pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_12, __pyx_t_15) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_15); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_v_index, __pyx_t_3) < 0)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_base", 0); - /* "src/helpers/miscellaneous.pyx":620 - * #self.bin[index] = int(self.r_0[index]) + /* "View.MemoryView":565 * - * self.dipt_0[index] = dipTen(np.float64(pl[j]), np.float64(pl[i])) # <<<<<<<<<<<<<< - * rv[0] = pl[i,0] - pl[j,0] - * rv[1] = pl[i,1] - pl[j,1] + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< + * + * @property */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_dipTen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 620, __pyx_L1_error) - __pyx_t_6.data = __pyx_v_pl.data; - __pyx_t_6.memview = __pyx_v_pl.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_t_17; - Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; -} + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; + goto __pyx_L0; -__pyx_t_6.shape[0] = __pyx_v_pl.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_pl.strides[1]; - __pyx_t_6.suboffsets[0] = -1; + /* "View.MemoryView":564 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj + * + */ -__pyx_t_12 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_16 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_18); - if (likely(__pyx_t_16)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18); - __Pyx_INCREF(__pyx_t_16); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_18, function); - } - } - __pyx_t_15 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_16, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_12); - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 620, __pyx_L1_error) - __pyx_t_6.data = __pyx_v_pl.data; - __pyx_t_6.memview = __pyx_v_pl.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_t_17; - Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -__pyx_t_6.shape[0] = __pyx_v_pl.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_pl.strides[1]; - __pyx_t_6.suboffsets[0] = -1; +/* "View.MemoryView":567 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + */ -__pyx_t_12 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_19 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_16); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_16, function); - } - } - __pyx_t_18 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_19, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_12); - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = NULL; - __pyx_t_20 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_16)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_16); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_20 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_t_18}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_t_18}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_16) { - __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_16); __pyx_t_16 = NULL; - } - __Pyx_GIVEREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_20, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_20, __pyx_t_18); - __pyx_t_15 = 0; - __pyx_t_18 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_v_index, __pyx_t_3) < 0)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/miscellaneous.pyx":621 + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":569 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< * - * self.dipt_0[index] = dipTen(np.float64(pl[j]), np.float64(pl[i])) - * rv[0] = pl[i,0] - pl[j,0] # <<<<<<<<<<<<<< - * rv[1] = pl[i,1] - pl[j,1] - * rv[2] = pl[i,2] - pl[j,2] + * @property */ - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 621, __pyx_L1_error) - __pyx_t_10 = __pyx_t_17; - __pyx_t_11 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_pl.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[1]; - __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 621, __pyx_L1_error) - __pyx_t_22 = __pyx_t_21; - __pyx_t_23 = 0; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_pl.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_pl.shape[1]; - __pyx_t_24 = 0; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_10 * __pyx_v_pl.strides[0]) ) + __pyx_t_11 * __pyx_v_pl.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_22 * __pyx_v_pl.strides[0]) ) + __pyx_t_23 * __pyx_v_pl.strides[1]) )))); + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyInt_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":622 - * self.dipt_0[index] = dipTen(np.float64(pl[j]), np.float64(pl[i])) - * rv[0] = pl[i,0] - pl[j,0] - * rv[1] = pl[i,1] - pl[j,1] # <<<<<<<<<<<<<< - * rv[2] = pl[i,2] - pl[j,2] - * r2 = np.dot(rv,rv) #norm squared of rv + /* "View.MemoryView":567 + * return self.obj + * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ - __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 622, __pyx_L1_error) - __pyx_t_23 = __pyx_t_21; - __pyx_t_22 = 1; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_pl.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_pl.shape[1]; - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 622, __pyx_L1_error) - __pyx_t_11 = __pyx_t_17; - __pyx_t_10 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_pl.shape[1]; - __pyx_t_24 = 1; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_23 * __pyx_v_pl.strides[0]) ) + __pyx_t_22 * __pyx_v_pl.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_11 * __pyx_v_pl.strides[0]) ) + __pyx_t_10 * __pyx_v_pl.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":623 - * rv[0] = pl[i,0] - pl[j,0] - * rv[1] = pl[i,1] - pl[j,1] - * rv[2] = pl[i,2] - pl[j,2] # <<<<<<<<<<<<<< - * r2 = np.dot(rv,rv) #norm squared of rv - * f1 = r2**-1.5 #prefactor 1: 1/r**3 - */ - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 623, __pyx_L1_error) - __pyx_t_10 = __pyx_t_17; - __pyx_t_11 = 2; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_pl.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[1]; - __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 623, __pyx_L1_error) - __pyx_t_22 = __pyx_t_21; - __pyx_t_23 = 2; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_pl.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_pl.shape[1]; - __pyx_t_24 = 2; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_10 * __pyx_v_pl.strides[0]) ) + __pyx_t_11 * __pyx_v_pl.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_22 * __pyx_v_pl.strides[0]) ) + __pyx_t_23 * __pyx_v_pl.strides[1]) )))); - - /* "src/helpers/miscellaneous.pyx":624 - * rv[1] = pl[i,1] - pl[j,1] - * rv[2] = pl[i,2] - pl[j,2] - * r2 = np.dot(rv,rv) #norm squared of rv # <<<<<<<<<<<<<< - * f1 = r2**-1.5 #prefactor 1: 1/r**3 - * f2 = 3/r2 #prefactor 2: 3*1/r**2 - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_15 = NULL; - __pyx_t_20 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - __pyx_t_20 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_12)) { - PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_2, __pyx_t_18}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) { - PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_2, __pyx_t_18}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - { - __pyx_t_16 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - if (__pyx_t_15) { - __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_20, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_20, __pyx_t_18); - __pyx_t_2 = 0; - __pyx_t_18 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_r2 = __pyx_t_13; - - /* "src/helpers/miscellaneous.pyx":625 - * rv[2] = pl[i,2] - pl[j,2] - * r2 = np.dot(rv,rv) #norm squared of rv - * f1 = r2**-1.5 #prefactor 1: 1/r**3 # <<<<<<<<<<<<<< - * f2 = 3/r2 #prefactor 2: 3*1/r**2 - * - */ - __pyx_v_f1 = pow(__pyx_v_r2, -1.5); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":626 - * r2 = np.dot(rv,rv) #norm squared of rv - * f1 = r2**-1.5 #prefactor 1: 1/r**3 - * f2 = 3/r2 #prefactor 2: 3*1/r**2 # <<<<<<<<<<<<<< +/* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) * - * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ - if (unlikely(__pyx_v_r2 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 626, __pyx_L1_error) - } - __pyx_v_f2 = (3.0 / __pyx_v_r2); - /* "src/helpers/miscellaneous.pyx":628 - * f2 = 3/r2 #prefactor 2: 3*1/r**2 - * - * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements # <<<<<<<<<<<<<< - * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor - * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) - */ - __pyx_t_23 = 0; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_22 = 0; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; - __pyx_t_3 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_index); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_int_0); - if (unlikely(PyObject_SetItem(__pyx_t_12, __pyx_t_16, __pyx_t_3) < 0)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/miscellaneous.pyx":629 - * - * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements - * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor # <<<<<<<<<<<<<< - * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) - * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice - */ - __pyx_t_22 = 1; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; - __pyx_t_23 = 1; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_3 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 629, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 629, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 629, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_index); - __Pyx_INCREF(__pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_int_1); - if (unlikely(PyObject_SetItem(__pyx_t_16, __pyx_t_12, __pyx_t_3) < 0)) __PYX_ERR(0, 629, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":630 - * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements - * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor - * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) # <<<<<<<<<<<<<< - * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice - * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 - */ - __pyx_t_23 = 2; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_22 = 2; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; - __pyx_t_3 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 630, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 630, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 630, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_index); - __Pyx_INCREF(__pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_int_2); - if (unlikely(PyObject_SetItem(__pyx_t_12, __pyx_t_16, __pyx_t_3) < 0)) __PYX_ERR(0, 630, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/miscellaneous.pyx":631 - * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor - * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) - * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice # <<<<<<<<<<<<<< - * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 - * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" */ - __pyx_t_22 = 0; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; - __pyx_t_23 = 1; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_index); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_int_3); - if (unlikely(PyObject_SetItem(__pyx_t_16, __pyx_t_12, __pyx_t_3) < 0)) __PYX_ERR(0, 631, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/miscellaneous.pyx":632 - * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) - * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice - * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 # <<<<<<<<<<<<<< - * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 + /* "View.MemoryView":575 + * if self.view.strides == NULL: + * + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_23 = 0; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_22 = 2; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; - __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 632, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 632, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 632, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_index); - __Pyx_INCREF(__pyx_int_4); - __Pyx_GIVEREF(__pyx_int_4); - PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_int_4); - if (unlikely(PyObject_SetItem(__pyx_t_12, __pyx_t_16, __pyx_t_3) < 0)) __PYX_ERR(0, 632, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 575, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":633 - * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice - * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 - * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 # <<<<<<<<<<<<<< + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< * - * index += 1 + * raise ValueError, "Buffer view does not expose strides" */ - __pyx_t_22 = 1; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; - __pyx_t_23 = 2; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_index); - __Pyx_INCREF(__pyx_int_5); - __Pyx_GIVEREF(__pyx_int_5); - PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_int_5); - if (unlikely(PyObject_SetItem(__pyx_t_16, __pyx_t_12, __pyx_t_3) < 0)) __PYX_ERR(0, 633, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } - /* "src/helpers/miscellaneous.pyx":635 - * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 - * - * index += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":577 + * raise ValueError, "Buffer view does not expose strides" * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); - __pyx_t_3 = 0; - - /* "src/helpers/miscellaneous.pyx":616 - * index = 0 - * for i in range(self.apr_emim_h-1): - * for j in range((i+1), self.apr_emim_h): # <<<<<<<<<<<<<< - * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) - * #self.bin[index] = int(self.r_0[index]) - */ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "src/helpers/miscellaneous.pyx":615 - * self.dipt_0 = dipt_0 - * index = 0 - * for i in range(self.apr_emim_h-1): # <<<<<<<<<<<<<< - * for j in range((i+1), self.apr_emim_h): - * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":580 - * @cython.boundscheck(False) - * class selfobject: - * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? # <<<<<<<<<<<<<< - * self.p = p - * self.apr_emim_h = apr_emim_h + /* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_19); - __Pyx_AddTraceback("newanalysis.miscellaneous.selfobject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_pl, 1); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_j); - __Pyx_XDECREF(__pyx_v_index); - __PYX_XDEC_MEMVIEW(&__pyx_v_rv, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_r_0, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dipt_0, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_p_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_emim_h, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":640 - * @cython.boundscheck(False) - * class pairobject: - * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 # <<<<<<<<<<<<<< - * self.p1 = p1 - * self.p2 = p2 +/* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_10pairobject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_10pairobject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_10pairobject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_10pairobject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - int __pyx_v_p1; - int __pyx_v_p2; - __Pyx_memviewslice __pyx_v_p1_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_p2_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_apr_emim_h; - int __pyx_v_n_pairs_h; - __Pyx_memviewslice __pyx_v_emim_h = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_p1,&__pyx_n_s_p2,&__pyx_n_s_p1_coor,&__pyx_n_s_p2_coor,&__pyx_n_s_apr_emim_h,&__pyx_n_s_n_pairs_h,&__pyx_n_s_emim_h,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 1); __PYX_ERR(0, 640, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 2); __PYX_ERR(0, 640, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p1_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 3); __PYX_ERR(0, 640, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p2_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 4); __PYX_ERR(0, 640, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr_emim_h)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 5); __PYX_ERR(0, 640, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pairs_h)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 6); __PYX_ERR(0, 640, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_emim_h)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 7); __PYX_ERR(0, 640, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 640, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - } - __pyx_v_self = values[0]; - __pyx_v_p1 = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_p1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) - __pyx_v_p2 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_p2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) - __pyx_v_p1_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_p1_coor.memview)) __PYX_ERR(0, 640, __pyx_L3_error) - __pyx_v_p2_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_p2_coor.memview)) __PYX_ERR(0, 640, __pyx_L3_error) - __pyx_v_apr_emim_h = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_apr_emim_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) - __pyx_v_n_pairs_h = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_n_pairs_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) - __pyx_v_emim_h = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_emim_h.memview)) __PYX_ERR(0, 640, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 640, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.pairobject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_10pairobject___init__(__pyx_self, __pyx_v_self, __pyx_v_p1, __pyx_v_p2, __pyx_v_p1_coor, __pyx_v_p2_coor, __pyx_v_apr_emim_h, __pyx_v_n_pairs_h, __pyx_v_emim_h); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_10pairobject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_p1, int __pyx_v_p2, __Pyx_memviewslice __pyx_v_p1_coor, __Pyx_memviewslice __pyx_v_p2_coor, int __pyx_v_apr_emim_h, int __pyx_v_n_pairs_h, __Pyx_memviewslice __pyx_v_emim_h) { - __Pyx_memviewslice __pyx_v_p1l = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_p2l = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_index; - __Pyx_memviewslice __pyx_v_rv = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_r2; - double __pyx_v_f1; - double __pyx_v_f2; - __Pyx_memviewslice __pyx_v_r_0 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_bins = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dipt_0 = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - int __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - double __pyx_t_13; - __Pyx_memviewslice __pyx_t_14 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - long __pyx_t_18; - int __pyx_t_19; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - int __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/helpers/miscellaneous.pyx":641 - * class pairobject: - * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 - * self.p1 = p1 # <<<<<<<<<<<<<< - * self.p2 = p2 - * self.apr_emim_h = apr_emim_h + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_p1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_p1, __pyx_t_1) < 0) __PYX_ERR(0, 641, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":642 - * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 - * self.p1 = p1 - * self.p2 = p2 # <<<<<<<<<<<<<< - * self.apr_emim_h = apr_emim_h - * self.n_pairs_h = n_pairs_h + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_p2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_p2, __pyx_t_1) < 0) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":643 - * self.p1 = p1 - * self.p2 = p2 - * self.apr_emim_h = apr_emim_h # <<<<<<<<<<<<<< - * self.n_pairs_h = n_pairs_h - * self.emim_h = emim_h + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 643, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } - /* "src/helpers/miscellaneous.pyx":644 - * self.p2 = p2 - * self.apr_emim_h = apr_emim_h - * self.n_pairs_h = n_pairs_h # <<<<<<<<<<<<<< - * self.emim_h = emim_h + /* "View.MemoryView":584 + * return (-1,) * self.view.ndim * - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h, __pyx_t_1) < 0) __PYX_ERR(0, 644, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":645 - * self.apr_emim_h = apr_emim_h - * self.n_pairs_h = n_pairs_h - * self.emim_h = emim_h # <<<<<<<<<<<<<< + /* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) * - * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_emim_h, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 645, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":647 - * self.emim_h = emim_h + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) * - * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< - * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') - * cdef int i, j, index = 0 + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":588 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3); + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 647, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 647, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_p1l = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":648 + /* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) * - * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') - * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< - * cdef int i, j, index = 0 + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":590 + * return self.view.ndim * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 648, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error) + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":592 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 592, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3); - __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error) + goto __pyx_L0; + + /* "View.MemoryView":590 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":594 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":596 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 648, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 648, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 648, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_p2l = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":649 - * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') - * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') - * cdef int i, j, index = 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":594 + * return self.view.itemsize * - * cdef double [:] rv = np.zeros(3) #distance vector + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize */ - __pyx_v_index = 0; - /* "src/helpers/miscellaneous.pyx":651 - * cdef int i, j, index = 0 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":598 + * return self.size * self.view.itemsize * - * cdef double [:] rv = np.zeros(3) #distance vector # <<<<<<<<<<<<<< - * cdef double r2 - * cdef double f1 + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_int_3); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 651, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_rv = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - /* "src/helpers/miscellaneous.pyx":656 - * cdef double f2 +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * for i in self.emim_h: # <<<<<<<<<<<<<< - * p1l[index,0] = np.copy(p1_coor[i,0]) - * p1l[index,1] = np.copy(p1_coor[i,1]) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_emim_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 656, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 656, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 656, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_8(__pyx_t_4); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 656, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 656, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_i = __pyx_t_9; + __pyx_t_1 = (__pyx_v_self->_size == Py_None); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":657 + /* "View.MemoryView":601 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< * - * for i in self.emim_h: - * p1l[index,0] = np.copy(p1_coor[i,0]) # <<<<<<<<<<<<<< - * p1l[index,1] = np.copy(p1_coor[i,1]) - * p1l[index,2] = np.copy(p1_coor[i,2]) + * for length in self.view.shape[:self.view.ndim]: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 657, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1_coor.shape[1]; - __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1_coor.data + __pyx_t_10 * __pyx_v_p1_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p1_coor.strides[1]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_12, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 657, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 657, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __pyx_v_index; - __pyx_t_10 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1l.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_11 * __pyx_v_p1l.strides[0]) ) + __pyx_t_10 * __pyx_v_p1l.strides[1]) )) = __pyx_t_13; + __Pyx_INCREF(__pyx_int_1); + __pyx_v_result = __pyx_int_1; - /* "src/helpers/miscellaneous.pyx":658 - * for i in self.emim_h: - * p1l[index,0] = np.copy(p1_coor[i,0]) - * p1l[index,1] = np.copy(p1_coor[i,1]) # <<<<<<<<<<<<<< - * p1l[index,2] = np.copy(p1_coor[i,2]) + /* "View.MemoryView":603 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 658, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1_coor.shape[1]; - __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1_coor.data + __pyx_t_10 * __pyx_v_p1_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p1_coor.strides[1]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 658, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_2 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_12, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __pyx_v_index; - __pyx_t_10 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1l.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_11 * __pyx_v_p1l.strides[0]) ) + __pyx_t_10 * __pyx_v_p1l.strides[1]) )) = __pyx_t_13; + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyInt_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":659 - * p1l[index,0] = np.copy(p1_coor[i,0]) - * p1l[index,1] = np.copy(p1_coor[i,1]) - * p1l[index,2] = np.copy(p1_coor[i,2]) # <<<<<<<<<<<<<< + /* "View.MemoryView":604 * - * p2l[index,0] = np.copy(p2_coor[i,0]) + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 2; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1_coor.shape[1]; - __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1_coor.data + __pyx_t_10 * __pyx_v_p1_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p1_coor.strides[1]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; } - __pyx_t_2 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_12, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __pyx_v_index; - __pyx_t_10 = 2; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1l.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_11 * __pyx_v_p1l.strides[0]) ) + __pyx_t_10 * __pyx_v_p1l.strides[1]) )) = __pyx_t_13; - /* "src/helpers/miscellaneous.pyx":661 - * p1l[index,2] = np.copy(p1_coor[i,2]) + /* "View.MemoryView":606 + * result *= length * - * p2l[index,0] = np.copy(p2_coor[i,0]) # <<<<<<<<<<<<<< - * p2l[index,1] = np.copy(p2_coor[i,1]) - * p2l[index,2] = np.copy(p2_coor[i,2]) + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2_coor.shape[1]; - __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2_coor.data + __pyx_t_10 * __pyx_v_p2_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p2_coor.strides[1]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_2 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_12, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 661, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __pyx_v_index; - __pyx_t_10 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2l.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_11 * __pyx_v_p2l.strides[0]) ) + __pyx_t_10 * __pyx_v_p2l.strides[1]) )) = __pyx_t_13; + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; - /* "src/helpers/miscellaneous.pyx":662 + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * p2l[index,0] = np.copy(p2_coor[i,0]) - * p2l[index,1] = np.copy(p2_coor[i,1]) # <<<<<<<<<<<<<< - * p2l[index,2] = np.copy(p2_coor[i,2]) - * index += 1 */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 1; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2_coor.shape[1]; - __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2_coor.data + __pyx_t_10 * __pyx_v_p2_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p2_coor.strides[1]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_12, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __pyx_v_index; - __pyx_t_10 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2l.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_11 * __pyx_v_p2l.strides[0]) ) + __pyx_t_10 * __pyx_v_p2l.strides[1]) )) = __pyx_t_13; + } - /* "src/helpers/miscellaneous.pyx":663 - * p2l[index,0] = np.copy(p2_coor[i,0]) - * p2l[index,1] = np.copy(p2_coor[i,1]) - * p2l[index,2] = np.copy(p2_coor[i,2]) # <<<<<<<<<<<<<< - * index += 1 + /* "View.MemoryView":608 + * self._size = result * - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 2; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2_coor.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2_coor.shape[1]; - __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2_coor.data + __pyx_t_10 * __pyx_v_p2_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p2_coor.strides[1]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_2 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_12, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 663, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __pyx_v_index; - __pyx_t_10 = 2; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2l.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_11 * __pyx_v_p2l.strides[0]) ) + __pyx_t_10 * __pyx_v_p2l.strides[1]) )) = __pyx_t_13; - - /* "src/helpers/miscellaneous.pyx":664 - * p2l[index,1] = np.copy(p2_coor[i,1]) - * p2l[index,2] = np.copy(p2_coor[i,2]) - * index += 1 # <<<<<<<<<<<<<< + * return self._size # <<<<<<<<<<<<<< * - * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') + * def __len__(self): */ - __pyx_v_index = (__pyx_v_index + 1); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":656 - * cdef double f2 + /* "View.MemoryView":598 + * return self.size * self.view.itemsize * - * for i in self.emim_h: # <<<<<<<<<<<<<< - * p1l[index,0] = np.copy(p1_coor[i,0]) - * p1l[index,1] = np.copy(p1_coor[i,1]) + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":666 - * index += 1 - * - * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') # <<<<<<<<<<<<<< - * cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') - * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 666, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 666, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 666, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 666, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_r_0 = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":667 +/* "View.MemoryView":610 + * return self._size * - * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') - * cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') # <<<<<<<<<<<<<< - * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') - * self.r_0 = r_0 + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_int32) < 0) __PYX_ERR(0, 667, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(0, 667, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_bins = __pyx_t_14; - __pyx_t_14.memview = NULL; - __pyx_t_14.data = NULL; - /* "src/helpers/miscellaneous.pyx":668 - * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') - * cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') - * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') # <<<<<<<<<<<<<< - * self.r_0 = r_0 - * self.bin = bins - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_6); - __Pyx_GIVEREF(__pyx_int_6); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_6); - __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 668, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 668, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_dipt_0 = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; +/* Python wrapper */ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/miscellaneous.pyx":669 - * cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') - * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') - * self.r_0 = r_0 # <<<<<<<<<<<<<< - * self.bin = bins + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__len__", 0); + + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] * */ - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_r_0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_r_0, __pyx_t_4) < 0) __PYX_ERR(0, 669, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":670 - * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') - * self.r_0 = r_0 - * self.bin = bins # <<<<<<<<<<<<<< + /* "View.MemoryView":612 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< * - * index = 0 + * return 0 */ - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_bins, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 670, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bin, __pyx_t_4) < 0) __PYX_ERR(0, 670, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":672 - * self.bin = bins + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] * - * index = 0 # <<<<<<<<<<<<<< - * for i in range(self.apr_emim_h): - * for j in range(i, self.apr_emim_h): */ - __pyx_v_index = 0; + } - /* "src/helpers/miscellaneous.pyx":673 + /* "View.MemoryView":614 + * return self.view.shape[0] * - * index = 0 - * for i in range(self.apr_emim_h): # <<<<<<<<<<<<<< - * for j in range(i, self.apr_emim_h): - * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) + * return 0 # <<<<<<<<<<<<<< + * + * def __repr__(self): */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 673, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_15 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_15 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_16; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":674 - * index = 0 - * for i in range(self.apr_emim_h): - * for j in range(i, self.apr_emim_h): # <<<<<<<<<<<<<< - * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) - * self.bin[index] = int(self.r_0[index]) + /* "View.MemoryView":610 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 674, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_17 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_17 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 674, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = __pyx_v_i; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_j = __pyx_t_19; - /* "src/helpers/miscellaneous.pyx":675 - * for i in range(self.apr_emim_h): - * for j in range(i, self.apr_emim_h): - * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) # <<<<<<<<<<<<<< - * self.bin[index] = int(self.r_0[index]) - * index += 1 - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_norm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6.data = __pyx_v_p2l.data; - __pyx_t_6.memview = __pyx_v_p2l.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_j; - Py_ssize_t __pyx_tmp_shape = __pyx_v_p2l.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_p2l.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -__pyx_t_6.shape[0] = __pyx_v_p2l.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_p2l.strides[1]; - __pyx_t_6.suboffsets[0] = -1; +/* "View.MemoryView":616 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) + */ -__pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_20 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_20)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_20); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - } - } - __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_20, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6.data = __pyx_v_p1l.data; - __pyx_t_6.memview = __pyx_v_p1l.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_shape = __pyx_v_p1l.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_p1l.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; -} +/* Python wrapper */ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); -__pyx_t_6.shape[0] = __pyx_v_p1l.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_p1l.strides[1]; - __pyx_t_6.suboffsets[0] = -1; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -__pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_21 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) { - __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_20); - if (likely(__pyx_t_21)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20); - __Pyx_INCREF(__pyx_t_21); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_20, function); - } - } - __pyx_t_12 = (__pyx_t_21) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_21, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __pyx_t_20 = PyNumber_Subtract(__pyx_t_2, __pyx_t_12); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_12, __pyx_t_20) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_20); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_v_index, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0)) __PYX_ERR(0, 675, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/helpers/miscellaneous.pyx":676 - * for j in range(i, self.apr_emim_h): - * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) - * self.bin[index] = int(self.r_0[index]) # <<<<<<<<<<<<<< - * index += 1 + /* "View.MemoryView":617 * - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_v_index, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0)) __PYX_ERR(0, 676, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "src/helpers/miscellaneous.pyx":677 - * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) - * self.bin[index] = int(self.r_0[index]) - * index += 1 # <<<<<<<<<<<<<< + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) * - * ################ */ - __pyx_v_index = (__pyx_v_index + 1); - } - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/miscellaneous.pyx":683 - * #self.dipt_0 = dipt_0 - * ################# COMMIT 5: UNCOMMENT ABOVE, COMMENT BELOW - * self.dipt_0 = dipt_0 # <<<<<<<<<<<<<< + /* "View.MemoryView":618 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< * - * index = 0 + * def __str__(self): */ - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_dipt_0, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0, __pyx_t_4) < 0) __PYX_ERR(0, 683, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "src/helpers/miscellaneous.pyx":685 - * self.dipt_0 = dipt_0 + /* "View.MemoryView":617 * - * index = 0 # <<<<<<<<<<<<<< + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) * - * for i in range(self.apr_emim_h): */ - __pyx_v_index = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":687 - * index = 0 + /* "View.MemoryView":616 + * return 0 * - * for i in range(self.apr_emim_h): # <<<<<<<<<<<<<< - * for j in range(i, self.apr_emim_h): - * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_15 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_15 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_16; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; - /* "src/helpers/miscellaneous.pyx":688 - * - * for i in range(self.apr_emim_h): - * for j in range(i, self.apr_emim_h): # <<<<<<<<<<<<<< - * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) - * self.bin[index] = int(self.r_0[index]) - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 688, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_17 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_17 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 688, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = __pyx_v_i; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_j = __pyx_t_19; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":689 - * for i in range(self.apr_emim_h): - * for j in range(i, self.apr_emim_h): - * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) # <<<<<<<<<<<<<< - * self.bin[index] = int(self.r_0[index]) +/* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_norm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_6.data = __pyx_v_p2l.data; - __pyx_t_6.memview = __pyx_v_p2l.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_j; - Py_ssize_t __pyx_tmp_shape = __pyx_v_p2l.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_p2l.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; -} -__pyx_t_6.shape[0] = __pyx_v_p2l.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_p2l.strides[1]; - __pyx_t_6.suboffsets[0] = -1; +/* Python wrapper */ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); -__pyx_t_12 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_20 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_12); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_6.data = __pyx_v_p1l.data; - __pyx_t_6.memview = __pyx_v_p1l.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_shape = __pyx_v_p1l.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_p1l.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -__pyx_t_6.shape[0] = __pyx_v_p1l.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_p1l.strides[1]; - __pyx_t_6.suboffsets[0] = -1; - -__pyx_t_12 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_21 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_21)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_21); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_21) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_21, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_12); - __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_20, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_v_index, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0)) __PYX_ERR(0, 689, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); - /* "src/helpers/miscellaneous.pyx":690 - * for j in range(i, self.apr_emim_h): - * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) - * self.bin[index] = int(self.r_0[index]) # <<<<<<<<<<<<<< + /* "View.MemoryView":621 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * * - * self.dipt_0[index] = dipTen(np.float64(p1l[j]), np.float64(p2l[i])) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 690, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 690, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_v_index, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0)) __PYX_ERR(0, 690, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":692 - * self.bin[index] = int(self.r_0[index]) + /* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) * - * self.dipt_0[index] = dipTen(np.float64(p1l[j]), np.float64(p2l[i])) # <<<<<<<<<<<<<< - * rv[0] = p2l[i,0] - p1l[j,0] - * rv[1] = p2l[i,1] - p1l[j,1] */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_dipTen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6.data = __pyx_v_p1l.data; - __pyx_t_6.memview = __pyx_v_p1l.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_j; - Py_ssize_t __pyx_tmp_shape = __pyx_v_p1l.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_p1l.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -__pyx_t_6.shape[0] = __pyx_v_p1l.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_p1l.strides[1]; - __pyx_t_6.suboffsets[0] = -1; +/* "View.MemoryView":624 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + */ -__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_20); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_20, function); - } - } - __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_12, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6.data = __pyx_v_p2l.data; - __pyx_t_6.memview = __pyx_v_p2l.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_shape = __pyx_v_p2l.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_p2l.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; -} +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 624, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_c_contig", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); -__pyx_t_6.shape[0] = __pyx_v_p2l.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_p2l.strides[1]; - __pyx_t_6.suboffsets[0] = -1; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_21 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_21)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_21); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - } - } - __pyx_t_20 = (__pyx_t_21) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_21, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - __pyx_t_22 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_22 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_3, __pyx_t_20}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_3, __pyx_t_20}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - } else - #endif - { - __pyx_t_2 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_12); __pyx_t_12 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_22, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_22, __pyx_t_20); - __pyx_t_3 = 0; - __pyx_t_20 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_v_index, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); - /* "src/helpers/miscellaneous.pyx":693 + /* "View.MemoryView":627 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * - * self.dipt_0[index] = dipTen(np.float64(p1l[j]), np.float64(p2l[i])) - * rv[0] = p2l[i,0] - p1l[j,0] # <<<<<<<<<<<<<< - * rv[1] = p2l[i,1] - p1l[j,1] - * rv[2] = p2l[i,2] - p1l[j,2] */ - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2l.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2l.shape[1]; - __pyx_t_23 = __pyx_v_j; - __pyx_t_24 = 0; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_p1l.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_p1l.shape[1]; - __pyx_t_25 = 0; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rv.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_25 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_10 * __pyx_v_p2l.strides[0]) ) + __pyx_t_11 * __pyx_v_p2l.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_23 * __pyx_v_p1l.strides[0]) ) + __pyx_t_24 * __pyx_v_p1l.strides[1]) )))); + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 627, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":694 - * self.dipt_0[index] = dipTen(np.float64(p1l[j]), np.float64(p2l[i])) - * rv[0] = p2l[i,0] - p1l[j,0] - * rv[1] = p2l[i,1] - p1l[j,1] # <<<<<<<<<<<<<< - * rv[2] = p2l[i,2] - p1l[j,2] - * r2 = np.dot(rv,rv) #norm squared of rv + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * + * def is_f_contig(self): */ - __pyx_t_24 = __pyx_v_i; - __pyx_t_23 = 1; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_p2l.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_p2l.shape[1]; - __pyx_t_11 = __pyx_v_j; - __pyx_t_10 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1l.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1l.shape[1]; - __pyx_t_25 = 1; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rv.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_25 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_24 * __pyx_v_p2l.strides[0]) ) + __pyx_t_23 * __pyx_v_p2l.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_11 * __pyx_v_p1l.strides[0]) ) + __pyx_t_10 * __pyx_v_p1l.strides[1]) )))); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":695 - * rv[0] = p2l[i,0] - p1l[j,0] - * rv[1] = p2l[i,1] - p1l[j,1] - * rv[2] = p2l[i,2] - p1l[j,2] # <<<<<<<<<<<<<< - * r2 = np.dot(rv,rv) #norm squared of rv - * f1 = r2**-1.5 #prefactor 1: 1/r**3 + /* "View.MemoryView":624 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = 2; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2l.shape[0]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2l.shape[1]; - __pyx_t_23 = __pyx_v_j; - __pyx_t_24 = 2; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_p1l.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_p1l.shape[1]; - __pyx_t_25 = 2; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rv.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_25 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_10 * __pyx_v_p2l.strides[0]) ) + __pyx_t_11 * __pyx_v_p2l.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_23 * __pyx_v_p1l.strides[0]) ) + __pyx_t_24 * __pyx_v_p1l.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":696 - * rv[1] = p2l[i,1] - p1l[j,1] - * rv[2] = p2l[i,2] - p1l[j,2] - * r2 = np.dot(rv,rv) #norm squared of rv # <<<<<<<<<<<<<< - * f1 = r2**-1.5 #prefactor 1: 1/r**3 - * f2 = 3/r2 #prefactor 2: 3*1/r**2 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_20 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_3 = NULL; - __pyx_t_22 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_22 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_1, __pyx_t_20}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_1, __pyx_t_20}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_22, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_22, __pyx_t_20); - __pyx_t_1 = 0; - __pyx_t_20 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 696, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_r2 = __pyx_t_13; - /* "src/helpers/miscellaneous.pyx":697 - * rv[2] = p2l[i,2] - p1l[j,2] - * r2 = np.dot(rv,rv) #norm squared of rv - * f1 = r2**-1.5 #prefactor 1: 1/r**3 # <<<<<<<<<<<<<< - * f2 = 3/r2 #prefactor 2: 3*1/r**2 +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 630, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_f_contig", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_f_contig", 0); + + /* "View.MemoryView":633 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * */ - __pyx_v_f1 = pow(__pyx_v_r2, -1.5); + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 633, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":698 - * r2 = np.dot(rv,rv) #norm squared of rv - * f1 = r2**-1.5 #prefactor 1: 1/r**3 - * f2 = 3/r2 #prefactor 2: 3*1/r**2 # <<<<<<<<<<<<<< + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< * - * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements + * def copy(self): */ - if (unlikely(__pyx_v_r2 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 698, __pyx_L1_error) - } - __pyx_v_f2 = (3.0 / __pyx_v_r2); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":700 - * f2 = 3/r2 #prefactor 2: 3*1/r**2 + /* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * - * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements # <<<<<<<<<<<<<< - * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor - * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - __pyx_t_24 = 0; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; - __pyx_t_23 = 0; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_4 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_12); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_int_0); - __pyx_t_12 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_t_20, __pyx_t_4) < 0)) __PYX_ERR(0, 700, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":701 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * - * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements - * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor # <<<<<<<<<<<<<< - * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) - * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ - __pyx_t_23 = 1; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_24 = 1; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; - __pyx_t_4 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 701, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 701, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 701, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_int_1); - __pyx_t_2 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_20, __pyx_t_12, __pyx_t_4) < 0)) __PYX_ERR(0, 701, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":702 - * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements - * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor - * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) # <<<<<<<<<<<<<< - * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice - * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 - */ - __pyx_t_24 = 2; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; - __pyx_t_23 = 2; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_4 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 702, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 702, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 702, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_20); - __Pyx_INCREF(__pyx_int_2); - __Pyx_GIVEREF(__pyx_int_2); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_2); - __pyx_t_20 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_12, __pyx_t_2, __pyx_t_4) < 0)) __PYX_ERR(0, 702, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 636, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "src/helpers/miscellaneous.pyx":703 - * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor - * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) - * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice # <<<<<<<<<<<<<< - * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 - * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":638 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &mslice) */ - __pyx_t_23 = 0; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_24 = 1; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; - __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 703, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 703, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 703, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 703, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_12); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_int_3); - __pyx_t_12 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_t_20, __pyx_t_4) < 0)) __PYX_ERR(0, 703, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - /* "src/helpers/miscellaneous.pyx":704 - * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) - * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice - * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 # <<<<<<<<<<<<<< - * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 + /* "View.MemoryView":640 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, */ - __pyx_t_24 = 0; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; - __pyx_t_23 = 2; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 704, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 704, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_4); - __Pyx_GIVEREF(__pyx_int_4); - PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_int_4); - __pyx_t_2 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_20, __pyx_t_12, __pyx_t_4) < 0)) __PYX_ERR(0, 704, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - /* "src/helpers/miscellaneous.pyx":705 - * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice - * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 - * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 # <<<<<<<<<<<<<< + /* "View.MemoryView":641 * - * index += 1 + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, */ - __pyx_t_23 = 1; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; - __pyx_t_24 = 2; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; - __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_20); - __Pyx_INCREF(__pyx_int_5); - __Pyx_GIVEREF(__pyx_int_5); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_5); - __pyx_t_20 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_12, __pyx_t_2, __pyx_t_4) < 0)) __PYX_ERR(0, 705, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 641, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":707 - * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 + /* "View.MemoryView":646 + * self.dtype_is_object) * - * index += 1 # <<<<<<<<<<<<<< - * ################# + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< * + * def copy_fortran(self): */ - __pyx_v_index = (__pyx_v_index + 1); - } - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":640 - * @cython.boundscheck(False) - * class pairobject: - * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 # <<<<<<<<<<<<<< - * self.p1 = p1 - * self.p2 = p2 + /* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + */ + +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 648, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy_fortran", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":650 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) + */ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + + /* "View.MemoryView":652 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, + */ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + + /* "View.MemoryView":653 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, + */ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 653, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; + + /* "View.MemoryView":658 + * self.dtype_is_object) + * + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; + + /* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + */ + + /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_XDECREF(__pyx_t_12); - __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1); - __Pyx_XDECREF(__pyx_t_20); - __Pyx_XDECREF(__pyx_t_21); - __Pyx_AddTraceback("newanalysis.miscellaneous.pairobject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_p1l, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_p2l, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rv, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_r_0, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_bins, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dipt_0, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_p1_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_p2_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_emim_h, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":713 - * class noe_task: - * @cython.boundscheck(False) - * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): # <<<<<<<<<<<<<< - * self.apr_emim_h = apr_emim_h - * self.emim_h = emim_h +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_8noe_task_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_8noe_task_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_8noe_task_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_8noe_task_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - int __pyx_v_apr_emim_h; - __Pyx_memviewslice __pyx_v_emim_h = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_n_pairs_h; - int __pyx_v_n_self_pairs_h; - int __pyx_v_max_distance; - int __pyx_v_n_res_emim; - int __pyx_v_apr_pair; - __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_apr_emim_h,&__pyx_n_s_emim_h,&__pyx_n_s_n_pairs_h,&__pyx_n_s_n_self_pairs_h,&__pyx_n_s_max_distance,&__pyx_n_s_n_res_emim,&__pyx_n_s_apr_pair,&__pyx_n_s_coors,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr_emim_h)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 1); __PYX_ERR(0, 713, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_emim_h)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 2); __PYX_ERR(0, 713, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_pairs_h)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 3); __PYX_ERR(0, 713, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_self_pairs_h)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 4); __PYX_ERR(0, 713, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_distance)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 5); __PYX_ERR(0, 713, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_res_emim)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 6); __PYX_ERR(0, 713, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr_pair)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 7); __PYX_ERR(0, 713, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coors)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 8); __PYX_ERR(0, 713, __pyx_L3_error) + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 713, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_self = values[0]; - __pyx_v_apr_emim_h = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_apr_emim_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) - __pyx_v_emim_h = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_emim_h.memview)) __PYX_ERR(0, 713, __pyx_L3_error) - __pyx_v_n_pairs_h = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_n_pairs_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) - __pyx_v_n_self_pairs_h = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_n_self_pairs_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) - __pyx_v_max_distance = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_max_distance == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) - __pyx_v_n_res_emim = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_n_res_emim == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) - __pyx_v_apr_pair = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_apr_pair == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) - __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 713, __pyx_L3_error) + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 713, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.noe_task.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_8noe_task___init__(__pyx_self, __pyx_v_self, __pyx_v_apr_emim_h, __pyx_v_emim_h, __pyx_v_n_pairs_h, __pyx_v_n_self_pairs_h, __pyx_v_max_distance, __pyx_v_n_res_emim, __pyx_v_apr_pair, __pyx_v_coors); + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_8noe_task___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_apr_emim_h, __Pyx_memviewslice __pyx_v_emim_h, int __pyx_v_n_pairs_h, int __pyx_v_n_self_pairs_h, int __pyx_v_max_distance, int __pyx_v_n_res_emim, int __pyx_v_apr_pair, __Pyx_memviewslice __pyx_v_coors) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_atom; - __Pyx_memviewslice __pyx_v_coor_i = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor_j = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - int __pyx_t_23; - int __pyx_t_24; - int __pyx_t_25; - int __pyx_t_26; - PyObject *__pyx_t_27 = NULL; - PyObject *__pyx_t_28 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/helpers/miscellaneous.pyx":714 - * @cython.boundscheck(False) - * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): - * self.apr_emim_h = apr_emim_h # <<<<<<<<<<<<<< - * self.emim_h = emim_h - * self.n_pairs_h = n_pairs_h + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 714, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":715 - * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): - * self.apr_emim_h = apr_emim_h - * self.emim_h = emim_h # <<<<<<<<<<<<<< - * self.n_pairs_h = n_pairs_h - * self.max_distance = max_distance + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_emim_h, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/helpers/miscellaneous.pyx":716 - * self.apr_emim_h = apr_emim_h - * self.emim_h = emim_h - * self.n_pairs_h = n_pairs_h # <<<<<<<<<<<<<< - * self.max_distance = max_distance - * self.pairlist = [] - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h, __pyx_t_1) < 0) __PYX_ERR(0, 716, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/helpers/miscellaneous.pyx":717 - * self.emim_h = emim_h - * self.n_pairs_h = n_pairs_h - * self.max_distance = max_distance # <<<<<<<<<<<<<< - * self.pairlist = [] - * self.selflist = [] - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_max_distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_max_distance, __pyx_t_1) < 0) __PYX_ERR(0, 717, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":718 - * self.n_pairs_h = n_pairs_h - * self.max_distance = max_distance - * self.pairlist = [] # <<<<<<<<<<<<<< - * self.selflist = [] - * self.n_self_pairs_h = n_self_pairs_h - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pairlist, __pyx_t_1) < 0) __PYX_ERR(0, 718, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":719 - * self.max_distance = max_distance - * self.pairlist = [] - * self.selflist = [] # <<<<<<<<<<<<<< - * self.n_self_pairs_h = n_self_pairs_h +/* "View.MemoryView":662 * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_selflist, __pyx_t_1) < 0) __PYX_ERR(0, 719, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":720 - * self.pairlist = [] - * self.selflist = [] - * self.n_self_pairs_h = n_self_pairs_h # <<<<<<<<<<<<<< - * - * cdef int i, j, atom - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_self_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 720, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_self_pairs_h, __pyx_t_1) < 0) __PYX_ERR(0, 720, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - /* "src/helpers/miscellaneous.pyx":723 - * - * cdef int i, j, atom - * cdef double [:,:] coor_i = np.zeros((apr_pair, 3), dtype='float64') # <<<<<<<<<<<<<< - * cdef double [:,:] coor_j = np.zeros((apr_pair, 3), dtype='float64') - * + /* "View.MemoryView":663 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_apr_pair); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o)) __PYX_ERR(1, 663, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 723, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 723, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 723, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_coor_i = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/helpers/miscellaneous.pyx":724 - * cdef int i, j, atom - * cdef double [:,:] coor_i = np.zeros((apr_pair, 3), dtype='float64') - * cdef double [:,:] coor_j = np.zeros((apr_pair, 3), dtype='float64') # <<<<<<<<<<<<<< + /* "View.MemoryView":664 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result * - * for i in range(n_res_emim): */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_apr_pair); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3); - __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 724, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_coor_j = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + __pyx_v_result->typeinfo = __pyx_v_typeinfo; - /* "src/helpers/miscellaneous.pyx":726 - * cdef double [:,:] coor_j = np.zeros((apr_pair, 3), dtype='float64') + /* "View.MemoryView":665 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< * - * for i in range(n_res_emim): # <<<<<<<<<<<<<< - * for atom in range(apr_pair): - * coor_i[atom, 0] = coors[i, atom, 0] + * @cname('__pyx_memoryview_check') */ - __pyx_t_6 = __pyx_v_n_res_emim; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":727 + /* "View.MemoryView":662 * - * for i in range(n_res_emim): - * for atom in range(apr_pair): # <<<<<<<<<<<<<< - * coor_i[atom, 0] = coors[i, atom, 0] - * coor_i[atom, 1] = coors[i, atom, 1] + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ - __pyx_t_9 = __pyx_v_apr_pair; - __pyx_t_10 = __pyx_t_9; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_atom = __pyx_t_11; - /* "src/helpers/miscellaneous.pyx":728 - * for i in range(n_res_emim): - * for atom in range(apr_pair): - * coor_i[atom, 0] = coors[i, atom, 0] # <<<<<<<<<<<<<< - * coor_i[atom, 1] = coors[i, atom, 1] - * coor_i[atom, 2] = coors[i, atom, 2] + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":668 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) + * */ - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = __pyx_v_atom; - __pyx_t_14 = 0; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[2]; - __pyx_t_15 = __pyx_v_atom; - __pyx_t_16 = 0; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_15 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_16 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_12 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_14 * __pyx_v_coors.strides[2]) ))); - /* "src/helpers/miscellaneous.pyx":729 - * for atom in range(apr_pair): - * coor_i[atom, 0] = coors[i, atom, 0] - * coor_i[atom, 1] = coors[i, atom, 1] # <<<<<<<<<<<<<< - * coor_i[atom, 2] = coors[i, atom, 2] - * self.selflist.append(selfobject(i, coor_i, apr_emim_h, n_self_pairs_h, emim_h)) +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("memoryview_check", 0); + + /* "View.MemoryView":669 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): */ - __pyx_t_14 = __pyx_v_i; - __pyx_t_13 = __pyx_v_atom; - __pyx_t_12 = 1; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[2]; - __pyx_t_16 = __pyx_v_atom; - __pyx_t_15 = 1; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_16 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_15 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_14 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_12 * __pyx_v_coors.strides[2]) ))); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":730 - * coor_i[atom, 0] = coors[i, atom, 0] - * coor_i[atom, 1] = coors[i, atom, 1] - * coor_i[atom, 2] = coors[i, atom, 2] # <<<<<<<<<<<<<< - * self.selflist.append(selfobject(i, coor_i, apr_emim_h, n_self_pairs_h, emim_h)) + /* "View.MemoryView":668 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) * */ - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = __pyx_v_atom; - __pyx_t_14 = 2; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[2]; - __pyx_t_15 = __pyx_v_atom; - __pyx_t_16 = 2; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_15 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_16 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_12 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_14 * __pyx_v_coors.strides[2]) ))); - } - /* "src/helpers/miscellaneous.pyx":731 - * coor_i[atom, 1] = coors[i, atom, 1] - * coor_i[atom, 2] = coors[i, atom, 2] - * self.selflist.append(selfobject(i, coor_i, apr_emim_h, n_self_pairs_h, emim_h)) # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":671 + * return isinstance(o, memoryview) * - * for i in range(n_res_emim): + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_selflist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 731, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_selfobject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 731, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 731, __pyx_L1_error) + +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_UCS4 __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); + + /* "View.MemoryView":677 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< + * + * result = [slice(None)] * ndim + */ + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 677, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_17 = __pyx_memoryview_fromslice(__pyx_v_coor_i, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 731, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_apr_emim_h); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 731, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_n_self_pairs_h); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 731, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_20 = __pyx_memoryview_fromslice(__pyx_v_emim_h, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 731, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_21 = NULL; - __pyx_t_9 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_21)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_21); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_9 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[6] = {__pyx_t_21, __pyx_t_3, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[6] = {__pyx_t_21, __pyx_t_3, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 5+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - } else - #endif - { - __pyx_t_22 = PyTuple_New(5+__pyx_t_9); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 731, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_22); - if (__pyx_t_21) { - __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_21); __pyx_t_21 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_9, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_9, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_22, 2+__pyx_t_9, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_19); - PyTuple_SET_ITEM(__pyx_t_22, 3+__pyx_t_9, __pyx_t_19); - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_22, 4+__pyx_t_9, __pyx_t_20); - __pyx_t_3 = 0; - __pyx_t_17 = 0; - __pyx_t_18 = 0; - __pyx_t_19 = 0; - __pyx_t_20 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_23 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_23 == ((int)-1))) __PYX_ERR(0, 731, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index)) __PYX_ERR(1, 677, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":733 - * self.selflist.append(selfobject(i, coor_i, apr_emim_h, n_self_pairs_h, emim_h)) + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) * - * for i in range(n_res_emim): # <<<<<<<<<<<<<< - * for j in range((i+1), n_res_emim): - * for atom in range(apr_pair): + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False */ - __pyx_t_6 = __pyx_v_n_res_emim; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":734 + /* "View.MemoryView":680 * - * for i in range(n_res_emim): - * for j in range((i+1), n_res_emim): # <<<<<<<<<<<<<< - * for atom in range(apr_pair): - * coor_i[atom, 0] = coors[i, atom, 0] + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 */ - __pyx_t_9 = __pyx_v_n_res_emim; - __pyx_t_10 = __pyx_t_9; - for (__pyx_t_11 = (__pyx_v_i + 1); __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_j = __pyx_t_11; + __pyx_v_have_slices = 0; - /* "src/helpers/miscellaneous.pyx":735 - * for i in range(n_res_emim): - * for j in range((i+1), n_res_emim): - * for atom in range(apr_pair): # <<<<<<<<<<<<<< - * coor_i[atom, 0] = coors[i, atom, 0] - * coor_i[atom, 1] = coors[i, atom, 1] + /* "View.MemoryView":681 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: */ - __pyx_t_24 = __pyx_v_apr_pair; - __pyx_t_25 = __pyx_t_24; - for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) { - __pyx_v_atom = __pyx_t_26; + __pyx_v_seen_ellipsis = 0; - /* "src/helpers/miscellaneous.pyx":736 - * for j in range((i+1), n_res_emim): - * for atom in range(apr_pair): - * coor_i[atom, 0] = coors[i, atom, 0] # <<<<<<<<<<<<<< - * coor_i[atom, 1] = coors[i, atom, 1] - * coor_i[atom, 2] = coors[i, atom, 2] + /* "View.MemoryView":682 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: */ - __pyx_t_14 = __pyx_v_i; - __pyx_t_13 = __pyx_v_atom; - __pyx_t_12 = 0; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[2]; - __pyx_t_16 = __pyx_v_atom; - __pyx_t_15 = 0; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_16 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_15 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_14 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_12 * __pyx_v_coors.strides[2]) ))); + __pyx_v_idx = 0; - /* "src/helpers/miscellaneous.pyx":737 - * for atom in range(apr_pair): - * coor_i[atom, 0] = coors[i, atom, 0] - * coor_i[atom, 1] = coors[i, atom, 1] # <<<<<<<<<<<<<< - * coor_i[atom, 2] = coors[i, atom, 2] - * + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: */ - __pyx_t_12 = __pyx_v_i; - __pyx_t_13 = __pyx_v_atom; - __pyx_t_14 = 1; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[2]; - __pyx_t_15 = __pyx_v_atom; - __pyx_t_16 = 1; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_15 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_16 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_12 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_14 * __pyx_v_coors.strides[2]) ))); + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 683, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; + for (;;) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 683, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/miscellaneous.pyx":738 - * coor_i[atom, 0] = coors[i, atom, 0] - * coor_i[atom, 1] = coors[i, atom, 1] - * coor_i[atom, 2] = coors[i, atom, 2] # <<<<<<<<<<<<<< - * - * coor_j[atom, 0] = coors[j, atom, 0] + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) */ - __pyx_t_14 = __pyx_v_i; - __pyx_t_13 = __pyx_v_atom; - __pyx_t_12 = 2; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[2]; - __pyx_t_16 = __pyx_v_atom; - __pyx_t_15 = 2; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_16 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_15 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_14 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_12 * __pyx_v_coors.strides[2]) ))); + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":740 - * coor_i[atom, 2] = coors[i, atom, 2] - * - * coor_j[atom, 0] = coors[j, atom, 0] # <<<<<<<<<<<<<< - * coor_j[atom, 1] = coors[j, atom, 1] - * coor_j[atom, 2] = coors[j, atom, 2] + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True */ - __pyx_t_12 = __pyx_v_j; - __pyx_t_13 = __pyx_v_atom; - __pyx_t_14 = 0; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[2]; - __pyx_t_15 = __pyx_v_atom; - __pyx_t_16 = 0; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_j.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_j.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_j.data + __pyx_t_15 * __pyx_v_coor_j.strides[0]) ) + __pyx_t_16 * __pyx_v_coor_j.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_12 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_14 * __pyx_v_coors.strides[2]) ))); + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":741 - * - * coor_j[atom, 0] = coors[j, atom, 0] - * coor_j[atom, 1] = coors[j, atom, 1] # <<<<<<<<<<<<<< - * coor_j[atom, 2] = coors[j, atom, 2] - * self.pairlist.append(pairobject(i, j, coor_i, coor_j, apr_emim_h, n_pairs_h, emim_h)) + /* "View.MemoryView":686 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True */ - __pyx_t_14 = __pyx_v_j; - __pyx_t_13 = __pyx_v_atom; - __pyx_t_12 = 1; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[2]; - __pyx_t_16 = __pyx_v_atom; - __pyx_t_15 = 1; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_j.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_j.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_j.data + __pyx_t_16 * __pyx_v_coor_j.strides[0]) ) + __pyx_t_15 * __pyx_v_coor_j.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_14 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_12 * __pyx_v_coors.strides[2]) ))); + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 686, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 686, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); - /* "src/helpers/miscellaneous.pyx":742 - * coor_j[atom, 0] = coors[j, atom, 0] - * coor_j[atom, 1] = coors[j, atom, 1] - * coor_j[atom, 2] = coors[j, atom, 2] # <<<<<<<<<<<<<< - * self.pairlist.append(pairobject(i, j, coor_i, coor_j, apr_emim_h, n_pairs_h, emim_h)) - * #print("Pairs: ", len(self.pairlist), "Should be 499500") + /* "View.MemoryView":687 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True + * else: + */ + __pyx_v_seen_ellipsis = 1; + + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True */ - __pyx_t_12 = __pyx_v_j; - __pyx_t_13 = __pyx_v_atom; - __pyx_t_14 = 2; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[2]; - __pyx_t_15 = __pyx_v_atom; - __pyx_t_16 = 2; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_j.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_j.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_j.data + __pyx_t_15 * __pyx_v_coor_j.strides[0]) ) + __pyx_t_16 * __pyx_v_coor_j.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_12 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_14 * __pyx_v_coors.strides[2]) ))); } - /* "src/helpers/miscellaneous.pyx":743 - * coor_j[atom, 1] = coors[j, atom, 1] - * coor_j[atom, 2] = coors[j, atom, 2] - * self.pairlist.append(pairobject(i, j, coor_i, coor_j, apr_emim_h, n_pairs_h, emim_h)) # <<<<<<<<<<<<<< - * #print("Pairs: ", len(self.pairlist), "Should be 499500") - * #exit() + /* "View.MemoryView":688 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< + * else: + * if isinstance(item, slice): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pairlist); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pairobject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_22); - __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_19 = __pyx_memoryview_fromslice(__pyx_v_coor_i, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_coor_j, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_apr_emim_h); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_pairs_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_21 = __pyx_memoryview_fromslice(__pyx_v_emim_h, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __pyx_t_27 = NULL; - __pyx_t_24 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_27 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_27)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_27); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_24 = 1; - } + __pyx_v_have_slices = 1; + + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) + */ + goto __pyx_L5; + } + + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): + */ + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { + + /* "View.MemoryView":691 + * else: + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + */ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): + */ + goto __pyx_L7; } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[8] = {__pyx_t_27, __pyx_t_22, __pyx_t_20, __pyx_t_19, __pyx_t_18, __pyx_t_17, __pyx_t_3, __pyx_t_21}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_24, 7+__pyx_t_24); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[8] = {__pyx_t_27, __pyx_t_22, __pyx_t_20, __pyx_t_19, __pyx_t_18, __pyx_t_17, __pyx_t_3, __pyx_t_21}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_24, 7+__pyx_t_24); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + */ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":693 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = 127; + __Pyx_INCREF(__pyx_kp_u_Cannot_index_with_type); + __pyx_t_5 += 24; + __Pyx_GIVEREF(__pyx_kp_u_Cannot_index_with_type); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Cannot_index_with_type); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_5 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__6); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - } else - #endif - { - __pyx_t_28 = PyTuple_New(7+__pyx_t_24); if (unlikely(!__pyx_t_28)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_28); - if (__pyx_t_27) { - __Pyx_GIVEREF(__pyx_t_27); PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_t_27); __pyx_t_27 = NULL; - } - __Pyx_GIVEREF(__pyx_t_22); - PyTuple_SET_ITEM(__pyx_t_28, 0+__pyx_t_24, __pyx_t_22); - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_28, 1+__pyx_t_24, __pyx_t_20); - __Pyx_GIVEREF(__pyx_t_19); - PyTuple_SET_ITEM(__pyx_t_28, 2+__pyx_t_24, __pyx_t_19); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_28, 3+__pyx_t_24, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_28, 4+__pyx_t_24, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_28, 5+__pyx_t_24, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_21); - PyTuple_SET_ITEM(__pyx_t_28, 6+__pyx_t_24, __pyx_t_21); - __pyx_t_22 = 0; - __pyx_t_20 = 0; - __pyx_t_19 = 0; - __pyx_t_18 = 0; - __pyx_t_17 = 0; - __pyx_t_3 = 0; - __pyx_t_21 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_28, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 693, __pyx_L1_error) + + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + */ } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_23 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_23 == ((int)-1))) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_L7:; + + /* "View.MemoryView":694 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 + * + */ + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0))) __PYX_ERR(1, 694, __pyx_L1_error) } + __pyx_L5:; + + /* "View.MemoryView":695 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx + */ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: + */ } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":713 - * class noe_task: - * @cython.boundscheck(False) - * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): # <<<<<<<<<<<<<< - * self.apr_emim_h = apr_emim_h - * self.emim_h = emim_h + /* "View.MemoryView":697 + * idx += 1 + * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) + * */ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "View.MemoryView":698 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + */ + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 698, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; + + /* "View.MemoryView":671 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_19); - __Pyx_XDECREF(__pyx_t_20); - __Pyx_XDECREF(__pyx_t_21); - __Pyx_XDECREF(__pyx_t_22); - __Pyx_XDECREF(__pyx_t_27); - __Pyx_XDECREF(__pyx_t_28); - __Pyx_AddTraceback("newanalysis.miscellaneous.noe_task.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_coor_i, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor_j, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_emim_h, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coors, 1); + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":749 +/* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) * - * @cython.boundscheck(False) - * def pairiter(self, double [:,:,:] run): # <<<<<<<<<<<<<< - * cdef double [:,:] cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #rename: cl->correlationlist - * #cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_8noe_task_3pairiter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_8noe_task_3pairiter = {"pairiter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_8noe_task_3pairiter, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_8noe_task_3pairiter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - __Pyx_memviewslice __pyx_v_run = { 0, 0, { 0 }, { 0 }, { 0 } }; +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pairiter (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_run,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_run)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("pairiter", 1, 2, 2, 1); __PYX_ERR(0, 749, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pairiter") < 0)) __PYX_ERR(0, 749, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); + + /* "View.MemoryView":701 + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + */ + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); + + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag + */ + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { + + /* "View.MemoryView":703 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag + * + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 703, __pyx_L1_error) + + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag + */ } - __pyx_v_self = values[0]; - __pyx_v_run = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_run.memview)) __PYX_ERR(0, 749, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("pairiter", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 749, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.noe_task.pairiter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_8noe_task_2pairiter(__pyx_self, __pyx_v_self, __pyx_v_run); + + /* "View.MemoryView":704 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + */ /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_8noe_task_2pairiter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, __Pyx_memviewslice __pyx_v_run) { - __Pyx_memviewslice __pyx_v_cl = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dipt_t = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_p1l = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_p2l = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_cl_self = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dipt_t_self = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_pl = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_i; - int __pyx_v_index; - CYTHON_UNUSED __Pyx_memviewslice __pyx_v_rv = { 0, 0, { 0 }, { 0 }, { 0 } }; - CYTHON_UNUSED __Pyx_memviewslice __pyx_v_distvec = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_v_selfobj = NULL; - PyObject *__pyx_v_dipt_0_self = NULL; - PyObject *__pyx_v_pair = NULL; - PyObject *__pyx_v_dipt_0 = NULL; - PyObject *__pyx_r = NULL; +/* "View.MemoryView":711 + * + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step + */ + +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - int __pyx_t_19; - long __pyx_t_20; - long __pyx_t_21; - PyObject *__pyx_t_22 = NULL; - PyObject *__pyx_t_23 = NULL; - PyObject *__pyx_t_24 = NULL; - double __pyx_t_25; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pairiter", 0); + __Pyx_RefNannySetupContext("memview_slice", 0); - /* "src/helpers/miscellaneous.pyx":750 - * @cython.boundscheck(False) - * def pairiter(self, double [:,:,:] run): - * cdef double [:,:] cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #rename: cl->correlationlist # <<<<<<<<<<<<<< - * #cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW - * cdef double [:,:] dipt_t = np.zeros((self.n_pairs_h, 6), dtype='float64') + /* "View.MemoryView":712 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_distance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 750, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 750, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_cl = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; - /* "src/helpers/miscellaneous.pyx":752 - * cdef double [:,:] cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #rename: cl->correlationlist - * #cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW - * cdef double [:,:] dipt_t = np.zeros((self.n_pairs_h, 6), dtype='float64') # <<<<<<<<<<<<<< - * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') - * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') + /* "View.MemoryView":719 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_int_6); - __Pyx_GIVEREF(__pyx_int_6); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_6); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 752, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 752, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_dipt_t = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - /* "src/helpers/miscellaneous.pyx":753 - * #cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW - * cdef double [:,:] dipt_t = np.zeros((self.n_pairs_h, 6), dtype='float64') - * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< - * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') + /* "View.MemoryView":723 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< * + * if isinstance(memview, _memoryviewslice): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3); - __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 753, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 753, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_p1l = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 723, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 723, __pyx_L1_error) + #endif - /* "src/helpers/miscellaneous.pyx":754 - * cdef double [:,:] dipt_t = np.zeros((self.n_pairs_h, 6), dtype='float64') - * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') - * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 * - * cdef double [:] cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #Add bin information? + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_3); - __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 754, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 754, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_p2l = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":756 - * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') + /* "View.MemoryView":726 * - * cdef double [:] cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #Add bin information? # <<<<<<<<<<<<<< - * #cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW - * cdef double [:,:] dipt_t_self = np.zeros((self.n_self_pairs_h, 6), dtype='float64') + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_self_pairs_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 756, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 756, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_cl_self = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 726, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/helpers/miscellaneous.pyx":758 - * cdef double [:] cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #Add bin information? - * #cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW - * cdef double [:,:] dipt_t_self = np.zeros((self.n_self_pairs_h, 6), dtype='float64') # <<<<<<<<<<<<<< - * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') + /* "View.MemoryView":727 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) + */ + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_self_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_int_6); - __Pyx_GIVEREF(__pyx_int_6); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_6); - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 758, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 758, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_dipt_t_self = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + goto __pyx_L3; + } - /* "src/helpers/miscellaneous.pyx":759 - * #cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW - * cdef double [:,:] dipt_t_self = np.zeros((self.n_self_pairs_h, 6), dtype='float64') - * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< + /* "View.MemoryView":729 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src * - * cdef int i, j, index = 0 */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 759, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3); - __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 759, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 759, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 759, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_pl = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - /* "src/helpers/miscellaneous.pyx":761 - * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') + /* "View.MemoryView":730 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< * - * cdef int i, j, index = 0 # <<<<<<<<<<<<<< - * #cdef int [:] local_emim_h = np.int32(self.emim_h) #COMMIT 4: UNCOMMENT * */ - __pyx_v_index = 0; + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":764 - * #cdef int [:] local_emim_h = np.int32(self.emim_h) #COMMIT 4: UNCOMMENT + /* "View.MemoryView":736 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data * - * cdef double [:] rv = np.zeros(3) #distance vector # <<<<<<<<<<<<<< - * cdef double r2 - * cdef double f1 */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_3); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 764, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_rv = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":768 - * cdef double f1 - * cdef double f2 - * cdef double [:] distvec = np.zeros(3, dtype='float64') # <<<<<<<<<<<<<< - * cdef double dist_sq, dist_2, dist_3 + /* "View.MemoryView":737 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 768, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 768, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_distvec = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; - /* "src/helpers/miscellaneous.pyx":771 - * cdef double dist_sq, dist_2, dist_3 + /* "View.MemoryView":742 * - * for selfobj in self.selflist: # <<<<<<<<<<<<<< - * index = 0 * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_selflist); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + __pyx_v_p_dst = (&__pyx_v_dst); + + /* "View.MemoryView":743 + * + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step + */ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index + */ + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; + __pyx_t_7 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 771, __pyx_L1_error) + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 747, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 771, __pyx_L1_error) + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); #endif } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 771, __pyx_L1_error) + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); #endif } } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 771, __pyx_L1_error) + else __PYX_ERR(1, 747, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_8); } - __Pyx_XDECREF_SET(__pyx_v_selfobj, __pyx_t_1); - __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); - /* "src/helpers/miscellaneous.pyx":772 - * - * for selfobj in self.selflist: - * index = 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":748 * - * for i in self.emim_h: + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ - __pyx_v_index = 0; + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":774 - * index = 0 + /* "View.MemoryView":749 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + */ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 749, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; + + /* "View.MemoryView":750 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, + */ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 750, __pyx_L1_error) + + /* "View.MemoryView":748 * - * for i in self.emim_h: # <<<<<<<<<<<<<< - * pl[index, 0] = run[selfobj.p][i,0] - * pl[index, 1] = run[selfobj.p][i,1] + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 774, __pyx_L1_error) + goto __pyx_L6; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 774, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 774, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_10(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 774, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 774, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_i = __pyx_t_11; - /* "src/helpers/miscellaneous.pyx":775 - * - * for i in self.emim_h: - * pl[index, 0] = run[selfobj.p][i,0] # <<<<<<<<<<<<<< - * pl[index, 1] = run[selfobj.p][i,1] - * pl[index, 2] = run[selfobj.p][i,2] + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_selfobj, __pyx_n_s_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 775, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = __pyx_t_12; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 0; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_run.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_run.shape[1]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_run.shape[2]; - __pyx_t_16 = __pyx_v_index; - __pyx_t_17 = 0; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_pl.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_pl.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_16 * __pyx_v_pl.strides[0]) ) + __pyx_t_17 * __pyx_v_pl.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_13 * __pyx_v_run.strides[0]) ) + __pyx_t_14 * __pyx_v_run.strides[1]) ) + __pyx_t_15 * __pyx_v_run.strides[2]) ))); + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":776 - * for i in self.emim_h: - * pl[index, 0] = run[selfobj.p][i,0] - * pl[index, 1] = run[selfobj.p][i,1] # <<<<<<<<<<<<<< - * pl[index, 2] = run[selfobj.p][i,2] - * index += 1 + /* "View.MemoryView":757 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_selfobj, __pyx_n_s_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_15 = __pyx_t_12; - __pyx_t_14 = __pyx_v_i; - __pyx_t_13 = 1; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_run.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_run.shape[1]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_run.shape[2]; - __pyx_t_17 = __pyx_v_index; - __pyx_t_16 = 1; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_pl.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_pl.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_17 * __pyx_v_pl.strides[0]) ) + __pyx_t_16 * __pyx_v_pl.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_15 * __pyx_v_run.strides[0]) ) + __pyx_t_14 * __pyx_v_run.strides[1]) ) + __pyx_t_13 * __pyx_v_run.strides[2]) ))); + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - /* "src/helpers/miscellaneous.pyx":777 - * pl[index, 0] = run[selfobj.p][i,0] - * pl[index, 1] = run[selfobj.p][i,1] - * pl[index, 2] = run[selfobj.p][i,2] # <<<<<<<<<<<<<< - * index += 1 - * + /* "View.MemoryView":758 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_selfobj, __pyx_n_s_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 777, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_13 = __pyx_t_12; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 2; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_run.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_run.shape[1]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_run.shape[2]; - __pyx_t_16 = __pyx_v_index; - __pyx_t_17 = 2; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_pl.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_pl.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_16 * __pyx_v_pl.strides[0]) ) + __pyx_t_17 * __pyx_v_pl.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_13 * __pyx_v_run.strides[0]) ) + __pyx_t_14 * __pyx_v_run.strides[1]) ) + __pyx_t_15 * __pyx_v_run.strides[2]) ))); + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - /* "src/helpers/miscellaneous.pyx":778 - * pl[index, 1] = run[selfobj.p][i,1] - * pl[index, 2] = run[selfobj.p][i,2] - * index += 1 # <<<<<<<<<<<<<< - * - * dipten_double_loop_(&pl[0,0], &pl[0,0], &dipt_t_self[0,0], self.apr_emim_h-1, self.apr_emim_h, 1) + /* "View.MemoryView":759 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: */ - __pyx_v_index = (__pyx_v_index + 1); + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; - /* "src/helpers/miscellaneous.pyx":774 - * index = 0 - * - * for i in self.emim_h: # <<<<<<<<<<<<<< - * pl[index, 0] = run[selfobj.p][i,0] - * pl[index, 1] = run[selfobj.p][i,1] + /* "View.MemoryView":760 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 + */ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 */ + goto __pyx_L6; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/miscellaneous.pyx":780 - * index += 1 - * - * dipten_double_loop_(&pl[0,0], &pl[0,0], &dipt_t_self[0,0], self.apr_emim_h-1, self.apr_emim_h, 1) # <<<<<<<<<<<<<< - * dipt_0_self = selfobj.dipt_0 - * + /* "View.MemoryView":762 + * new_ndim += 1 + * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 */ - __pyx_t_15 = 0; - __pyx_t_14 = 0; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_pl.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_pl.shape[1]; - __pyx_t_13 = 0; - __pyx_t_17 = 0; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_pl.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_pl.shape[1]; - __pyx_t_16 = 0; - __pyx_t_18 = 0; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_dipt_t_self.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_dipt_t_self.shape[1]; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - dipten_double_loop_((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_15 * __pyx_v_pl.strides[0]) ) + __pyx_t_14 * __pyx_v_pl.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_13 * __pyx_v_pl.strides[0]) ) + __pyx_t_17 * __pyx_v_pl.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipt_t_self.data + __pyx_t_16 * __pyx_v_dipt_t_self.strides[0]) ) + __pyx_t_18 * __pyx_v_dipt_t_self.strides[1]) )))), __pyx_t_11, __pyx_t_19, 1); + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 762, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 762, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; - /* "src/helpers/miscellaneous.pyx":781 - * - * dipten_double_loop_(&pl[0,0], &pl[0,0], &dipt_t_self[0,0], self.apr_emim_h-1, self.apr_emim_h, 1) - * dipt_0_self = selfobj.dipt_0 # <<<<<<<<<<<<<< + /* "View.MemoryView":763 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 * - * for i in range(self.n_self_pairs_h): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_selfobj, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_dipt_0_self, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; - /* "src/helpers/miscellaneous.pyx":783 - * dipt_0_self = selfobj.dipt_0 - * - * for i in range(self.n_self_pairs_h): # <<<<<<<<<<<<<< - * cl_self[i] += np.dot(dipt_0_self[i], dipt_t_self[i]) + /* "View.MemoryView":764 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< * + * have_start = index.start is not None */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_self_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_20 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_20 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_21 = __pyx_t_20; - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_21; __pyx_t_19+=1) { - __pyx_v_i = __pyx_t_19; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; - /* "src/helpers/miscellaneous.pyx":784 + /* "View.MemoryView":766 + * step = index.step or 0 * - * for i in range(self.n_self_pairs_h): - * cl_self[i] += np.dot(dipt_0_self[i], dipt_t_self[i]) # <<<<<<<<<<<<<< - * - * for pair in self.pairlist: + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_dipt_0_self, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6.data = __pyx_v_dipt_t_self.data; - __pyx_t_6.memview = __pyx_v_dipt_t_self.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_shape = __pyx_v_dipt_t_self.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_dipt_t_self.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_6.shape[0] = __pyx_v_dipt_t_self.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_dipt_t_self.strides[1]; - __pyx_t_6.suboffsets[0] = -1; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; -__pyx_t_22 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_22); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_23 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_23)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_23); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_23, __pyx_t_2, __pyx_t_22}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_23, __pyx_t_2, __pyx_t_22}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - } else - #endif - { - __pyx_t_24 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - if (__pyx_t_23) { - __Pyx_GIVEREF(__pyx_t_23); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_23); __pyx_t_23 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_11, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_22); - PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_11, __pyx_t_22); - __pyx_t_2 = 0; - __pyx_t_22 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_18 = __pyx_v_i; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_cl_self.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_cl_self.data + __pyx_t_18 * __pyx_v_cl_self.strides[0]) )) += __pyx_t_25; - } + /* "View.MemoryView":767 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None + * + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":771 - * cdef double dist_sq, dist_2, dist_3 + /* "View.MemoryView":768 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< * - * for selfobj in self.selflist: # <<<<<<<<<<<<<< - * index = 0 + * slice_memviewslice( + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; + + /* "View.MemoryView":770 + * have_step = index.step is not None * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 770, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":786 - * cl_self[i] += np.dot(dipt_0_self[i], dipt_t_self[i]) + /* "View.MemoryView":776 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< * - * for pair in self.pairlist: # <<<<<<<<<<<<<< - * index = 0 + * if isinstance(memview, _memoryviewslice): + */ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; + + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pairlist); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 786, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 786, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 786, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_8(__pyx_t_1); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 786, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_pair, __pyx_t_3); - __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/helpers/miscellaneous.pyx":787 + /* "View.MemoryView":778 + * new_ndim += 1 * - * for pair in self.pairlist: - * index = 0 # <<<<<<<<<<<<<< + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + */ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { + + /* "View.MemoryView":779 * - * for i in self.emim_h: + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, */ - __pyx_v_index = 0; + __Pyx_XDECREF((PyObject *)__pyx_r); - /* "src/helpers/miscellaneous.pyx":789 - * index = 0 + /* "View.MemoryView":780 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 780, __pyx_L1_error) } + + /* "View.MemoryView":781 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":779 * - * for i in self.emim_h: # <<<<<<<<<<<<<< + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, + */ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 779, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":778 + * new_ndim += 1 * - * p1l[index, 0] = run[pair.p1][i,0] + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_emim_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 789, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 789, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 789, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_10(__pyx_t_4); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 789, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 789, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_i = __pyx_t_19; + } - /* "src/helpers/miscellaneous.pyx":791 - * for i in self.emim_h: + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) * - * p1l[index, 0] = run[pair.p1][i,0] # <<<<<<<<<<<<<< - * p1l[index, 1] = run[pair.p1][i,1] - * p1l[index, 2] = run[pair.p1][i,2] */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 791, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_18 = __pyx_t_12; - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[2]; - __pyx_t_13 = __pyx_v_index; - __pyx_t_14 = 0; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p1l.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p1l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_13 * __pyx_v_p1l.strides[0]) ) + __pyx_t_14 * __pyx_v_p1l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_18 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_17 * __pyx_v_run.strides[2]) ))); + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); - /* "src/helpers/miscellaneous.pyx":792 + /* "View.MemoryView":785 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< * - * p1l[index, 0] = run[pair.p1][i,0] - * p1l[index, 1] = run[pair.p1][i,1] # <<<<<<<<<<<<<< - * p1l[index, 2] = run[pair.p1][i,2] * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 792, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 792, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_17 = __pyx_t_12; - __pyx_t_16 = __pyx_v_i; - __pyx_t_18 = 1; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[2]; - __pyx_t_14 = __pyx_v_index; - __pyx_t_13 = 1; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p1l.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p1l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_14 * __pyx_v_p1l.strides[0]) ) + __pyx_t_13 * __pyx_v_p1l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_17 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_18 * __pyx_v_run.strides[2]) ))); + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "src/helpers/miscellaneous.pyx":793 - * p1l[index, 0] = run[pair.p1][i,0] - * p1l[index, 1] = run[pair.p1][i,1] - * p1l[index, 2] = run[pair.p1][i,2] # <<<<<<<<<<<<<< + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) * - * p2l[index, 0] = run[pair.p2][i,0] */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 793, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 793, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_18 = __pyx_t_12; - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[2]; - __pyx_t_13 = __pyx_v_index; - __pyx_t_14 = 2; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p1l.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p1l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_13 * __pyx_v_p1l.strides[0]) ) + __pyx_t_14 * __pyx_v_p1l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_18 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_17 * __pyx_v_run.strides[2]) ))); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 784, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } - /* "src/helpers/miscellaneous.pyx":795 - * p1l[index, 2] = run[pair.p1][i,2] + /* "View.MemoryView":711 * - * p2l[index, 0] = run[pair.p2][i,0] # <<<<<<<<<<<<<< - * p2l[index, 1] = run[pair.p2][i,1] - * p2l[index, 2] = run[pair.p2][i,2] + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 795, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 795, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_17 = __pyx_t_12; - __pyx_t_16 = __pyx_v_i; - __pyx_t_18 = 0; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[2]; - __pyx_t_14 = __pyx_v_index; - __pyx_t_13 = 0; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p2l.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p2l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_14 * __pyx_v_p2l.strides[0]) ) + __pyx_t_13 * __pyx_v_p2l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_17 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_18 * __pyx_v_run.strides[2]) ))); - /* "src/helpers/miscellaneous.pyx":796 - * - * p2l[index, 0] = run[pair.p2][i,0] - * p2l[index, 1] = run[pair.p2][i,1] # <<<<<<<<<<<<<< - * p2l[index, 2] = run[pair.p2][i,2] + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":793 * + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 796, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_18 = __pyx_t_12; - __pyx_t_16 = __pyx_v_i; - __pyx_t_17 = 1; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[2]; - __pyx_t_13 = __pyx_v_index; - __pyx_t_14 = 1; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p2l.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p2l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_13 * __pyx_v_p2l.strides[0]) ) + __pyx_t_14 * __pyx_v_p2l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_18 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_17 * __pyx_v_run.strides[2]) ))); - /* "src/helpers/miscellaneous.pyx":797 - * p2l[index, 0] = run[pair.p2][i,0] - * p2l[index, 1] = run[pair.p2][i,1] - * p2l[index, 2] = run[pair.p2][i,2] # <<<<<<<<<<<<<< +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("slice_memviewslice", 1); + + /* "View.MemoryView":813 + * cdef bint negative_step * - * index += 1 + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 797, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 797, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_17 = __pyx_t_12; - __pyx_t_16 = __pyx_v_i; - __pyx_t_18 = 2; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[2]; - __pyx_t_14 = __pyx_v_index; - __pyx_t_13 = 2; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p2l.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p2l.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_14 * __pyx_v_p2l.strides[0]) ) + __pyx_t_13 * __pyx_v_p2l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_17 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_18 * __pyx_v_run.strides[2]) ))); + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":799 - * p2l[index, 2] = run[pair.p2][i,2] + /* "View.MemoryView":815 + * if not is_slice: * - * index += 1 # <<<<<<<<<<<<<< + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: + */ + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { + + /* "View.MemoryView":816 * - * dipten_double_loop_(&p1l[0,0], &p2l[0,0], &dipt_t[0,0], self.apr_emim_h, self.apr_emim_h, 0) + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) */ - __pyx_v_index = (__pyx_v_index + 1); + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "src/helpers/miscellaneous.pyx":789 - * index = 0 + /* "View.MemoryView":815 + * if not is_slice: * - * for i in self.emim_h: # <<<<<<<<<<<<<< + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: + */ + } + + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: + */ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":818 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: * - * p1l[index, 0] = run[pair.p1][i,0] + */ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 818, __pyx_L1_error) + + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: */ } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":801 - * index += 1 + /* "View.MemoryView":813 + * cdef bint negative_step * - * dipten_double_loop_(&p1l[0,0], &p2l[0,0], &dipt_t[0,0], self.apr_emim_h, self.apr_emim_h, 0) # <<<<<<<<<<<<<< - * dipt_0 = pair.dipt_0 + * if not is_slice: # <<<<<<<<<<<<<< * + * if start < 0: */ - __pyx_t_18 = 0; - __pyx_t_16 = 0; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_p1l.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_p1l.shape[1]; - __pyx_t_17 = 0; - __pyx_t_13 = 0; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_p2l.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p2l.shape[1]; - __pyx_t_14 = 0; - __pyx_t_15 = 0; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_dipt_t.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_dipt_t.shape[1]; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 801, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 801, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - dipten_double_loop_((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_18 * __pyx_v_p1l.strides[0]) ) + __pyx_t_16 * __pyx_v_p1l.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_17 * __pyx_v_p2l.strides[0]) ) + __pyx_t_13 * __pyx_v_p2l.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipt_t.data + __pyx_t_14 * __pyx_v_dipt_t.strides[0]) ) + __pyx_t_15 * __pyx_v_dipt_t.strides[1]) )))), __pyx_t_19, __pyx_t_11, 0); + goto __pyx_L3; + } - /* "src/helpers/miscellaneous.pyx":802 + /* "View.MemoryView":821 + * else: * - * dipten_double_loop_(&p1l[0,0], &p2l[0,0], &dipt_t[0,0], self.apr_emim_h, self.apr_emim_h, 0) - * dipt_0 = pair.dipt_0 # <<<<<<<<<<<<<< + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: + */ + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":822 * - * for i in range(self.n_pairs_h): + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 802, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_dipt_0, __pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_negative_step = (__pyx_v_step < 0); - /* "src/helpers/miscellaneous.pyx":804 - * dipt_0 = pair.dipt_0 + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + */ + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":824 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False + */ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 824, __pyx_L1_error) + + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + */ + } + + /* "View.MemoryView":821 + * else: * - * for i in range(self.n_pairs_h): # <<<<<<<<<<<<<< - * cl[i][pair.bin[i]] += np.dot(dipt_0[i], dipt_t[i]) - * return cl, cl_self + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 804, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_20 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_20 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 804, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_21 = __pyx_t_20; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_21; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + goto __pyx_L6; + } - /* "src/helpers/miscellaneous.pyx":805 + /* "View.MemoryView":826 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 * - * for i in range(self.n_pairs_h): - * cl[i][pair.bin[i]] += np.dot(dipt_0[i], dipt_t[i]) # <<<<<<<<<<<<<< - * return cl, cl_self - * ###END DANIEL NOE HELPERS */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dot); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_dipt_0, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6.data = __pyx_v_dipt_t.data; - __pyx_t_6.memview = __pyx_v_dipt_t.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_shape = __pyx_v_dipt_t.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_dipt_t.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_6.shape[0] = __pyx_v_dipt_t.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_dipt_t.strides[1]; - __pyx_t_6.suboffsets[0] = -1; + /*else*/ { + __pyx_v_negative_step = 0; -__pyx_t_22 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_22); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_2 = NULL; - __pyx_t_19 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_24))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_24); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_24, function); - __pyx_t_19 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_24)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_22}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_24)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_22}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - } else - #endif - { - __pyx_t_23 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_19, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_22); - PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_19, __pyx_t_22); - __pyx_t_3 = 0; - __pyx_t_22 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_23, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - } - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_bin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_24 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_24); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __pyx_t_15 = __pyx_v_i; - __pyx_t_14 = __pyx_t_9; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_cl.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_cl.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cl.data + __pyx_t_15 * __pyx_v_cl.strides[0]) ) + __pyx_t_14 * __pyx_v_cl.strides[1]) )) += __pyx_t_25; + /* "View.MemoryView":827 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_step = 1; } + __pyx_L6:; - /* "src/helpers/miscellaneous.pyx":786 - * cl_self[i] += np.dot(dipt_0_self[i], dipt_t_self[i]) + /* "View.MemoryView":830 * - * for pair in self.pairlist: # <<<<<<<<<<<<<< - * index = 0 * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":806 - * for i in range(self.n_pairs_h): - * cl[i][pair.bin[i]] += np.dot(dipt_0[i], dipt_t[i]) - * return cl, cl_self # <<<<<<<<<<<<<< - * ###END DANIEL NOE HELPERS + /* "View.MemoryView":831 * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_cl, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_24 = __pyx_memoryview_fromslice(__pyx_v_cl_self, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 806, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 806, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_24); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_24); - __pyx_t_1 = 0; - __pyx_t_24 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":749 - * - * @cython.boundscheck(False) - * def pairiter(self, double [:,:,:] run): # <<<<<<<<<<<<<< - * cdef double [:,:] cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #rename: cl->correlationlist - * #cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW + /* "View.MemoryView":832 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 */ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_XDECREF(__pyx_t_22); - __Pyx_XDECREF(__pyx_t_23); - __Pyx_XDECREF(__pyx_t_24); - __Pyx_AddTraceback("newanalysis.miscellaneous.noe_task.pairiter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_cl, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dipt_t, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_p1l, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_p2l, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_cl_self, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dipt_t_self, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_pl, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rv, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_distvec, 1); - __Pyx_XDECREF(__pyx_v_selfobj); - __Pyx_XDECREF(__pyx_v_dipt_0_self); - __Pyx_XDECREF(__pyx_v_pair); - __Pyx_XDECREF(__pyx_v_dipt_0); - __PYX_XDEC_MEMVIEW(&__pyx_v_run, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: + */ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { -/* "src/helpers/miscellaneous.pyx":810 - * - * @cython.boundscheck(False) - * def getBestIndex(double [:] aufpunkt, double [:,:] coor): # <<<<<<<<<<<<<< - * ''' - * getBestIndex(point, coor) + /* "View.MemoryView":834 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: */ + __pyx_v_start = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_37getBestIndex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_36getBestIndex[] = "\n getBestIndex(point, coor)\n\n This function takes a point in space and a set of coordinates. It returns the index of the particle in the set closest to said point.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_37getBestIndex = {"getBestIndex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_37getBestIndex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_36getBestIndex}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_37getBestIndex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getBestIndex (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_coor,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("getBestIndex", 1, 2, 2, 1); __PYX_ERR(0, 810, __pyx_L3_error) + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: + */ } + + /* "View.MemoryView":831 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: + */ + goto __pyx_L9; } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getBestIndex") < 0)) __PYX_ERR(0, 810, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 810, __pyx_L3_error) - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 810, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("getBestIndex", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 810, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.getBestIndex", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_36getBestIndex(__pyx_self, __pyx_v_aufpunkt, __pyx_v_coor); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 + */ + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_36getBestIndex(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_coor) { - int __pyx_v_particles; - int __pyx_v_best_index; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("getBestIndex", 0); + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: + */ + if (__pyx_v_negative_step) { - /* "src/helpers/miscellaneous.pyx":817 - * ''' - * - * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< - * cdef int best_index - * + /* "View.MemoryView":837 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape */ - __pyx_v_particles = (__pyx_v_coor.shape[0]); + __pyx_v_start = (__pyx_v_shape - 1); - /* "src/helpers/miscellaneous.pyx":820 - * cdef int best_index - * - * best_index = get_best_index(&aufpunkt[0], &coor[0,0], particles) # <<<<<<<<<<<<<< - * return best_index - * + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - __pyx_t_1 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_aufpunkt.shape[0]; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[0]; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor.shape[1]; - __pyx_v_best_index = get_best_index((&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_1 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_2 * __pyx_v_coor.strides[0]) ) + __pyx_t_3 * __pyx_v_coor.strides[1]) )))), __pyx_v_particles); + goto __pyx_L11; + } - /* "src/helpers/miscellaneous.pyx":821 - * - * best_index = get_best_index(&aufpunkt[0], &coor[0,0], particles) - * return best_index # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) + /* "View.MemoryView":839 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_best_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; + + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 + */ + } + __pyx_L9:; - /* "src/helpers/miscellaneous.pyx":810 + /* "View.MemoryView":830 * - * @cython.boundscheck(False) - * def getBestIndex(double [:] aufpunkt, double [:,:] coor): # <<<<<<<<<<<<<< - * ''' - * getBestIndex(point, coor) + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ + goto __pyx_L8; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("newanalysis.miscellaneous.getBestIndex", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: + */ + /*else*/ { + if (__pyx_v_negative_step) { -/* "src/helpers/miscellaneous.pyx":824 - * - * @cython.boundscheck(False) - * def getBestIndices(double [:] aufpunkt, double [:,:] coor, double [:,:] dip, int count): # <<<<<<<<<<<<<< - * ''' - * coor ... (n_particles, 3) + /* "View.MemoryView":842 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 */ + __pyx_v_start = (__pyx_v_shape - 1); -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_39getBestIndices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_38getBestIndices[] = "\n coor ... (n_particles, 3)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_39getBestIndices = {"getBestIndices", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_39getBestIndices, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_38getBestIndices}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_39getBestIndices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_count; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getBestIndices (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_count,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("getBestIndices", 1, 4, 4, 1); __PYX_ERR(0, 824, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("getBestIndices", 1, 4, 4, 2); __PYX_ERR(0, 824, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_count)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("getBestIndices", 1, 4, 4, 3); __PYX_ERR(0, 824, __pyx_L3_error) - } + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: + */ + goto __pyx_L12; } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getBestIndices") < 0)) __PYX_ERR(0, 824, __pyx_L3_error) + + /* "View.MemoryView":844 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< + * + * if have_stop: + */ + /*else*/ { + __pyx_v_start = 0; } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + __pyx_L12:; } - __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 824, __pyx_L3_error) - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 824, __pyx_L3_error) - __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 824, __pyx_L3_error) - __pyx_v_count = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_count == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 824, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("getBestIndices", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 824, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.getBestIndices", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_38getBestIndices(__pyx_self, __pyx_v_aufpunkt, __pyx_v_coor, __pyx_v_dip, __pyx_v_count); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_38getBestIndices(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, int __pyx_v_count) { - int __pyx_v_n_particles; - int __pyx_v_point; - int __pyx_v_ctr; - double __pyx_v_cutoff; - __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_distances_copy = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor_res = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip_res = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - __Pyx_memviewslice __pyx_t_21 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("getBestIndices", 0); + __pyx_L8:; - /* "src/helpers/miscellaneous.pyx":829 - * ''' + /* "View.MemoryView":846 + * start = 0 * - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< - * if count > n_particles: count = n_particles - * cdef int point = 0, ctr = 0 + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":830 + /* "View.MemoryView":847 * - * cdef int n_particles = coor.shape[0] - * if count > n_particles: count = n_particles # <<<<<<<<<<<<<< - * cdef int point = 0, ctr = 0 - * cdef double cutoff = 0 + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: */ - __pyx_t_1 = ((__pyx_v_count > __pyx_v_n_particles) != 0); - if (__pyx_t_1) { - __pyx_v_count = __pyx_v_n_particles; - } + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":831 - * cdef int n_particles = coor.shape[0] - * if count > n_particles: count = n_particles - * cdef int point = 0, ctr = 0 # <<<<<<<<<<<<<< - * cdef double cutoff = 0 - * cdef double [:] distances = np.zeros(n_particles) + /* "View.MemoryView":848 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 */ - __pyx_v_point = 0; - __pyx_v_ctr = 0; + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - /* "src/helpers/miscellaneous.pyx":832 - * if count > n_particles: count = n_particles - * cdef int point = 0, ctr = 0 - * cdef double cutoff = 0 # <<<<<<<<<<<<<< - * cdef double [:] distances = np.zeros(n_particles) - * cdef double [:] distances_copy = np.zeros(n_particles) + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ - __pyx_v_cutoff = 0.0; + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":833 - * cdef int point = 0, ctr = 0 - * cdef double cutoff = 0 - * cdef double [:] distances = np.zeros(n_particles) # <<<<<<<<<<<<<< - * cdef double [:] distances_copy = np.zeros(n_particles) - * cdef double [:,:] coor_res = np.zeros((count,3)) + /* "View.MemoryView":850 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 833, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 833, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 833, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 833, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 833, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_distances = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_v_stop = 0; - /* "src/helpers/miscellaneous.pyx":834 - * cdef double cutoff = 0 - * cdef double [:] distances = np.zeros(n_particles) - * cdef double [:] distances_copy = np.zeros(n_particles) # <<<<<<<<<<<<<< - * cdef double [:,:] coor_res = np.zeros((count,3)) - * cdef double [:,:] dip_res = np.zeros((count,3)) + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + } + + /* "View.MemoryView":847 + * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: + */ + goto __pyx_L14; + } + + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: + */ + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":852 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: + */ + __pyx_v_stop = __pyx_v_shape; + + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: + */ + } + __pyx_L14:; + + /* "View.MemoryView":846 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape + */ + goto __pyx_L13; } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 834, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_distances_copy = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - /* "src/helpers/miscellaneous.pyx":835 - * cdef double [:] distances = np.zeros(n_particles) - * cdef double [:] distances_copy = np.zeros(n_particles) - * cdef double [:,:] coor_res = np.zeros((count,3)) # <<<<<<<<<<<<<< - * cdef double [:,:] dip_res = np.zeros((count,3)) + /* "View.MemoryView":854 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: + */ + /*else*/ { + if (__pyx_v_negative_step) { + + /* "View.MemoryView":855 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape + */ + __pyx_v_stop = -1L; + + /* "View.MemoryView":854 + * stop = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: + */ + goto __pyx_L16; + } + + /* "View.MemoryView":857 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_3); - __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 835, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_coor_res = __pyx_t_7; - __pyx_t_7.memview = NULL; - __pyx_t_7.data = NULL; + __pyx_L13:; - /* "src/helpers/miscellaneous.pyx":836 - * cdef double [:] distances_copy = np.zeros(n_particles) - * cdef double [:,:] coor_res = np.zeros((count,3)) - * cdef double [:,:] dip_res = np.zeros((count,3)) # <<<<<<<<<<<<<< + /* "View.MemoryView":861 + * + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: + */ + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + + /* "View.MemoryView":863 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * + */ + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":864 + * + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: + */ + __pyx_v_new_shape = (__pyx_v_new_shape + 1); + + /* "View.MemoryView":863 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 * - * for point in range(n_particles): */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_INCREF(__pyx_int_3); - __Pyx_GIVEREF(__pyx_int_3); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3); - __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 836, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_dip_res = __pyx_t_7; - __pyx_t_7.memview = NULL; - __pyx_t_7.data = NULL; - /* "src/helpers/miscellaneous.pyx":838 - * cdef double [:,:] dip_res = np.zeros((count,3)) + /* "View.MemoryView":866 + * new_shape += 1 * - * for point in range(n_particles): # <<<<<<<<<<<<<< - * distances[point] = pow((aufpunkt[0] - coor[point, 0]),2) + pow((aufpunkt[1] - coor[point, 1]),2) + pow((aufpunkt[2] - coor[point, 2]),2) + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 * */ - __pyx_t_8 = __pyx_v_n_particles; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_point = __pyx_t_10; + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":839 + /* "View.MemoryView":867 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< * - * for point in range(n_particles): - * distances[point] = pow((aufpunkt[0] - coor[point, 0]),2) + pow((aufpunkt[1] - coor[point, 1]),2) + pow((aufpunkt[2] - coor[point, 2]),2) # <<<<<<<<<<<<<< * - * distances_copy = np.sort(distances, kind='mergesort') */ - __pyx_t_11 = 0; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_aufpunkt.shape[0]; - __pyx_t_12 = __pyx_v_point; - __pyx_t_13 = 0; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[1]; - __pyx_t_14 = 1; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_aufpunkt.shape[0]; - __pyx_t_15 = __pyx_v_point; - __pyx_t_16 = 1; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; - __pyx_t_17 = 2; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_aufpunkt.shape[0]; - __pyx_t_18 = __pyx_v_point; - __pyx_t_19 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_t_20 = __pyx_v_point; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_distances.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_20 * __pyx_v_distances.strides[0]) )) = ((pow(((*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_11 * __pyx_v_aufpunkt.strides[0]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) )))), 2.0) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_14 * __pyx_v_aufpunkt.strides[0]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) )))), 2.0)) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_17 * __pyx_v_aufpunkt.strides[0]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )))), 2.0)); - } + __pyx_v_new_shape = 0; - /* "src/helpers/miscellaneous.pyx":841 - * distances[point] = pow((aufpunkt[0] - coor[point, 0]),2) + pow((aufpunkt[1] - coor[point, 1]),2) + pow((aufpunkt[2] - coor[point, 2]),2) + /* "View.MemoryView":866 + * new_shape += 1 * - * distances_copy = np.sort(distances, kind='mergesort') # <<<<<<<<<<<<<< - * cutoff = distances_copy[(count-1)] #Largest allowed entry + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sort); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_distances, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_kind, __pyx_n_s_mergesort) < 0) __PYX_ERR(0, 841, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 841, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_XDEC_MEMVIEW(&__pyx_v_distances_copy, 1); - __pyx_v_distances_copy = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + } - /* "src/helpers/miscellaneous.pyx":842 + /* "View.MemoryView":870 * - * distances_copy = np.sort(distances, kind='mergesort') - * cutoff = distances_copy[(count-1)] #Largest allowed entry # <<<<<<<<<<<<<< * - * for point in range(n_particles): + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset */ - __pyx_t_19 = (__pyx_v_count - 1); - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_distances_copy.shape[0]; - __pyx_v_cutoff = (*((double *) ( /* dim=0 */ (__pyx_v_distances_copy.data + __pyx_t_19 * __pyx_v_distances_copy.strides[0]) ))); + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - /* "src/helpers/miscellaneous.pyx":844 - * cutoff = distances_copy[(count-1)] #Largest allowed entry + /* "View.MemoryView":871 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset * - * for point in range(n_particles): # <<<<<<<<<<<<<< - * if(distances[point] <= cutoff): - * coor_res[ctr] = coor[point] */ - __pyx_t_8 = __pyx_v_n_particles; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_point = __pyx_t_10; + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - /* "src/helpers/miscellaneous.pyx":845 + /* "View.MemoryView":872 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * * - * for point in range(n_particles): - * if(distances[point] <= cutoff): # <<<<<<<<<<<<<< - * coor_res[ctr] = coor[point] - * dip_res[ctr] = dip[point] */ - __pyx_t_19 = __pyx_v_point; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_distances.shape[0]; - __pyx_t_1 = (((*((double *) ( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_19 * __pyx_v_distances.strides[0]) ))) <= __pyx_v_cutoff) != 0); - if (__pyx_t_1) { + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":846 - * for point in range(n_particles): - * if(distances[point] <= cutoff): - * coor_res[ctr] = coor[point] # <<<<<<<<<<<<<< - * dip_res[ctr] = dip[point] - * ctr += 1 + /* "View.MemoryView":875 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ - __pyx_t_6.data = __pyx_v_coor.data; - __pyx_t_6.memview = __pyx_v_coor.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_point; - Py_ssize_t __pyx_tmp_shape = __pyx_v_coor.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_coor.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; -} + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { -__pyx_t_6.shape[0] = __pyx_v_coor.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_coor.strides[1]; - __pyx_t_6.suboffsets[0] = -1; + /* "View.MemoryView":876 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride + */ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); -__pyx_t_21.data = __pyx_v_coor_res.data; - __pyx_t_21.memview = __pyx_v_coor_res.memview; - __PYX_INC_MEMVIEW(&__pyx_t_21, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_ctr; - Py_ssize_t __pyx_tmp_shape = __pyx_v_coor_res.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_coor_res.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_21.data += __pyx_tmp_idx * __pyx_tmp_stride; -} + /* "View.MemoryView":875 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: + */ + goto __pyx_L19; + } -__pyx_t_21.shape[0] = __pyx_v_coor_res.shape[1]; -__pyx_t_21.strides[0] = __pyx_v_coor_res.strides[1]; - __pyx_t_21.suboffsets[0] = -1; + /* "View.MemoryView":878 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: + */ + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; -if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_6, __pyx_t_21, 1, 1, 0) < 0)) __PYX_ERR(0, 846, __pyx_L1_error) - __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1); - __pyx_t_21.memview = NULL; - __pyx_t_21.data = NULL; - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: + */ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":847 - * if(distances[point] <= cutoff): - * coor_res[ctr] = coor[point] - * dip_res[ctr] = dip[point] # <<<<<<<<<<<<<< - * ctr += 1 + /* "View.MemoryView":881 * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ - __pyx_t_6.data = __pyx_v_dip.data; - __pyx_t_6.memview = __pyx_v_dip.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_point; - Py_ssize_t __pyx_tmp_shape = __pyx_v_dip.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_dip.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; -} + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { -__pyx_t_6.shape[0] = __pyx_v_dip.shape[1]; -__pyx_t_6.strides[0] = __pyx_v_dip.strides[1]; - __pyx_t_6.suboffsets[0] = -1; + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: + */ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { -__pyx_t_21.data = __pyx_v_dip_res.data; - __pyx_t_21.memview = __pyx_v_dip_res.memview; - __PYX_INC_MEMVIEW(&__pyx_t_21, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_ctr; - Py_ssize_t __pyx_tmp_shape = __pyx_v_dip_res.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_dip_res.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_21.data += __pyx_tmp_idx * __pyx_tmp_stride; -} + /* "View.MemoryView":883 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + */ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); -__pyx_t_21.shape[0] = __pyx_v_dip_res.shape[1]; -__pyx_t_21.strides[0] = __pyx_v_dip_res.strides[1]; - __pyx_t_21.suboffsets[0] = -1; + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: + */ + goto __pyx_L22; + } -if (unlikely(__pyx_memoryview_copy_contents(__pyx_t_6, __pyx_t_21, 1, 1, 0) < 0)) __PYX_ERR(0, 847, __pyx_L1_error) - __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1); - __pyx_t_21.memview = NULL; - __pyx_t_21.data = NULL; - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + /* "View.MemoryView":885 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: + */ + /*else*/ { - /* "src/helpers/miscellaneous.pyx":848 - * coor_res[ctr] = coor[point] - * dip_res[ctr] = dip[point] - * ctr += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":886 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim + */ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 885, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":881 * - * return coor_res, dip_res + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ - __pyx_v_ctr = (__pyx_v_ctr + 1); + goto __pyx_L21; + } - /* "src/helpers/miscellaneous.pyx":845 + /* "View.MemoryView":888 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< * - * for point in range(n_particles): - * if(distances[point] <= cutoff): # <<<<<<<<<<<<<< - * coor_res[ctr] = coor[point] - * dip_res[ctr] = dip[point] + * return 0 */ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; } + __pyx_L21:; + + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: + */ } - /* "src/helpers/miscellaneous.pyx":850 - * ctr += 1 + /* "View.MemoryView":890 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< * - * return coor_res, dip_res # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_coor_res, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 850, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dip_res, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 850, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 850, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_4 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_r = 0; goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":824 + /* "View.MemoryView":793 * - * @cython.boundscheck(False) - * def getBestIndices(double [:] aufpunkt, double [:,:] coor, double [:,:] dip, int count): # <<<<<<<<<<<<<< - * ''' - * coor ... (n_particles, 3) + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); - __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1); - __Pyx_AddTraceback("newanalysis.miscellaneous.getBestIndices", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_distances, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_distances_copy, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor_res, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip_res, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":853 +/* "View.MemoryView":896 * - * @cython.boundscheck(False) - * def writeMrHistogram(double [:,:] coor, double [:,:] dip, double [:] aufpunkt, double [:] antagonist, double [:] histogram, double max_distance, int segments_per_angstroem, int order=0): # <<<<<<<<<<<<<< - * ''' - * coor ... (number_of_particles, 3) + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_41writeMrHistogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_40writeMrHistogram[] = "\n coor ... (number_of_particles, 3)\n dip ... (number_of_particles, 3)\n aufpunkt ... (3)\n antagonist ... (3)\n histogram ... (max_distance * segments_per_angstroem)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_41writeMrHistogram = {"writeMrHistogram", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_41writeMrHistogram, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_40writeMrHistogram}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_41writeMrHistogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_antagonist = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_max_distance; - int __pyx_v_segments_per_angstroem; - int __pyx_v_order; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("writeMrHistogram (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_aufpunkt,&__pyx_n_s_antagonist,&__pyx_n_s_histogram,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,&__pyx_n_s_order,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 1); __PYX_ERR(0, 853, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 2); __PYX_ERR(0, 853, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_antagonist)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 3); __PYX_ERR(0, 853, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histogram)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 4); __PYX_ERR(0, 853, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_distance)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 5); __PYX_ERR(0, 853, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_segments_per_angstroem)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 6); __PYX_ERR(0, 853, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order); - if (value) { values[7] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "writeMrHistogram") < 0)) __PYX_ERR(0, 853, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_UCS4 __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pybuffer_index", 0); + + /* "View.MemoryView":898 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp + */ + __pyx_v_suboffset = -1L; + + /* "View.MemoryView":899 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp + * + */ + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":902 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize + */ + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":903 + * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: + */ + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 903, __pyx_L1_error) } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 853, __pyx_L3_error) - __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 853, __pyx_L3_error) - __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 853, __pyx_L3_error) - __pyx_v_antagonist = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_antagonist.memview)) __PYX_ERR(0, 853, __pyx_L3_error) - __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 853, __pyx_L3_error) - __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 853, __pyx_L3_error) - __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 853, __pyx_L3_error) - if (values[7]) { - __pyx_v_order = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 853, __pyx_L3_error) - } else { - __pyx_v_order = ((int)0); + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 903, __pyx_L1_error) } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); + + /* "View.MemoryView":904 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] + */ + __pyx_v_stride = __pyx_v_itemsize; + + /* "View.MemoryView":902 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize + */ + goto __pyx_L3; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 853, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.writeMrHistogram", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_40writeMrHistogram(__pyx_self, __pyx_v_coor, __pyx_v_dip, __pyx_v_aufpunkt, __pyx_v_antagonist, __pyx_v_histogram, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":906 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: + */ + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_40writeMrHistogram(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_antagonist, __Pyx_memviewslice __pyx_v_histogram, double __pyx_v_max_distance, int __pyx_v_segments_per_angstroem, int __pyx_v_order) { - int __pyx_v_number_of_particles; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - __Pyx_RefNannySetupContext("writeMrHistogram", 0); + /* "View.MemoryView":907 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] + */ + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - /* "src/helpers/miscellaneous.pyx":862 - * ''' - * - * cdef int number_of_particles = coor.shape[0] # <<<<<<<<<<<<<< - * write_Mr_diagram(&coor[0,0], &dip[0,0], number_of_particles, &aufpunkt[0], &antagonist[0], &histogram[0], max_distance, segments_per_angstroem, order) + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] * */ - __pyx_v_number_of_particles = (__pyx_v_coor.shape[0]); + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":863 + /* "View.MemoryView":909 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< * - * cdef int number_of_particles = coor.shape[0] - * write_Mr_diagram(&coor[0,0], &dip[0,0], number_of_particles, &aufpunkt[0], &antagonist[0], &histogram[0], max_distance, segments_per_angstroem, order) # <<<<<<<<<<<<<< + * if index < 0: + */ + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] * - * @cython.boundscheck(False) */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_dip.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip.shape[1]; - __pyx_t_5 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_aufpunkt.shape[0]; - __pyx_t_6 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_antagonist.shape[0]; - __pyx_t_7 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[0]; - write_Mr_diagram((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_3 * __pyx_v_dip.strides[0]) ) + __pyx_t_4 * __pyx_v_dip.strides[1]) )))), __pyx_v_number_of_particles, (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_5 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_antagonist.data + __pyx_t_6 * __pyx_v_antagonist.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_7 * __pyx_v_histogram.strides[0]) )))), __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); + } + } + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":853 + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] * - * @cython.boundscheck(False) - * def writeMrHistogram(double [:,:] coor, double [:,:] dip, double [:] aufpunkt, double [:] antagonist, double [:] histogram, double max_distance, int segments_per_angstroem, int order=0): # <<<<<<<<<<<<<< - * ''' - * coor ... (number_of_particles, 3) + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_antagonist, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histogram, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":912 + * + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + */ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); -/* "src/helpers/miscellaneous.pyx":866 + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * @cython.boundscheck(False) - * def writeKirkwoodHistogram(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:] histogram, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< - * #TODO documentation + */ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":914 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< * + * if index >= shape: */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__7); + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 914, __pyx_L1_error) -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_43writeKirkwoodHistogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_43writeKirkwoodHistogram = {"writeKirkwoodHistogram", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_43writeKirkwoodHistogram, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_43writeKirkwoodHistogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_aufpunkt_dipole = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_max_distance; - int __pyx_v_segments_per_angstroem; - int __pyx_v_order; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("writeKirkwoodHistogram (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_aufpunkt_dipole,&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_histogram,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,&__pyx_n_s_order,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt_dipole)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 1); __PYX_ERR(0, 866, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 2); __PYX_ERR(0, 866, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 3); __PYX_ERR(0, 866, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histogram)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 4); __PYX_ERR(0, 866, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_distance)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 5); __PYX_ERR(0, 866, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_segments_per_angstroem)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 6); __PYX_ERR(0, 866, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order); - if (value) { values[7] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "writeKirkwoodHistogram") < 0)) __PYX_ERR(0, 866, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 866, __pyx_L3_error) - __pyx_v_aufpunkt_dipole = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt_dipole.memview)) __PYX_ERR(0, 866, __pyx_L3_error) - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 866, __pyx_L3_error) - __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 866, __pyx_L3_error) - __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 866, __pyx_L3_error) - __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L3_error) - __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L3_error) - if (values[7]) { - __pyx_v_order = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L3_error) - } else { - __pyx_v_order = ((int)1); + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + */ } + + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: + */ } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 866, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogram", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_42writeKirkwoodHistogram(__pyx_self, __pyx_v_aufpunkt, __pyx_v_aufpunkt_dipole, __pyx_v_coor, __pyx_v_dip, __pyx_v_histogram, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + */ + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_42writeKirkwoodHistogram(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_aufpunkt_dipole, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, __Pyx_memviewslice __pyx_v_histogram, double __pyx_v_max_distance, int __pyx_v_segments_per_angstroem, int __pyx_v_order) { - int __pyx_v_particles; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - __Pyx_RefNannySetupContext("writeKirkwoodHistogram", 0); + /* "View.MemoryView":917 + * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride + */ + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__7); + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 917, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":869 - * #TODO documentation + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< - * write_Kirkwood_diagram(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0], max_distance, segments_per_angstroem, order) + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * */ - __pyx_v_particles = (__pyx_v_coor.shape[0]); + } - /* "src/helpers/miscellaneous.pyx":870 + /* "View.MemoryView":919 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * cdef int particles = coor.shape[0] - * write_Kirkwood_diagram(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0], max_distance, segments_per_angstroem, order) # <<<<<<<<<<<<<< + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset + */ + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + + /* "View.MemoryView":920 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset * - * def writeKirkwoodHistogramShellwise(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): */ - __pyx_t_1 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_aufpunkt.shape[0]; - __pyx_t_2 = 0; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_aufpunkt_dipole.shape[0]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dip.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dip.shape[1]; - __pyx_t_7 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[0]; - write_Kirkwood_diagram((&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_1 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt_dipole.data + __pyx_t_2 * __pyx_v_aufpunkt_dipole.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_3 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_5 * __pyx_v_dip.strides[0]) ) + __pyx_t_6 * __pyx_v_dip.strides[1]) )))), __pyx_v_particles, (&(*((double *) ( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_7 * __pyx_v_histogram.strides[0]) )))), __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":866 + /* "View.MemoryView":921 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def writeKirkwoodHistogram(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:] histogram, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< - * #TODO documentation + * return resultp + */ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":920 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * + */ + } + + /* "View.MemoryView":923 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< * + * + */ + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; + + /* "View.MemoryView":896 + * + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histogram, 1); - __Pyx_XGIVEREF(__pyx_r); + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":872 - * write_Kirkwood_diagram(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0], max_distance, segments_per_angstroem, order) +/* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim * - * def writeKirkwoodHistogramShellwise(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< - * ''' - * aufpunkt ... (3) */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_45writeKirkwoodHistogramShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_44writeKirkwoodHistogramShellwise[] = "\n aufpunkt ... (3)\n aufpunkt_dipole ... (3)\n coor ... (number_of_particles, 3)\n dip ... (number_of_particles, 3)\n histogram ... (maxshell, max_distance*segments_per_angstroem)\n norm ... (maxshell)\n dataset ... (number_of_particles)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_45writeKirkwoodHistogramShellwise = {"writeKirkwoodHistogramShellwise", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_45writeKirkwoodHistogramShellwise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_44writeKirkwoodHistogramShellwise}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_45writeKirkwoodHistogramShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_aufpunkt_dipole = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_norm = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_max_distance; - int __pyx_v_segments_per_angstroem; - int __pyx_v_order; +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("writeKirkwoodHistogramShellwise (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_aufpunkt_dipole,&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_histogram,&__pyx_n_s_norm,&__pyx_n_s_dataset,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,&__pyx_n_s_order,0}; - PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt_dipole)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 1); __PYX_ERR(0, 872, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 2); __PYX_ERR(0, 872, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 3); __PYX_ERR(0, 872, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histogram)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 4); __PYX_ERR(0, 872, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_norm)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 5); __PYX_ERR(0, 872, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 6); __PYX_ERR(0, 872, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_distance)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 7); __PYX_ERR(0, 872, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_segments_per_angstroem)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 8); __PYX_ERR(0, 872, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 9: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order); - if (value) { values[9] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "writeKirkwoodHistogramShellwise") < 0)) __PYX_ERR(0, 872, __pyx_L3_error) - } + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("transpose_memslice", 1); + + /* "View.MemoryView":930 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t *shape = memslice.shape + */ + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; + + /* "View.MemoryView":932 + * cdef int ndim = memslice.memview.view.ndim + * + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides + * + */ + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; + + /* "View.MemoryView":933 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; + + /* "View.MemoryView":937 + * + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + */ + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":938 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] + */ + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + + /* "View.MemoryView":939 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] + * + */ + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + + /* "View.MemoryView":940 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + */ + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + */ + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; } - __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 872, __pyx_L3_error) - __pyx_v_aufpunkt_dipole = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt_dipole.memview)) __PYX_ERR(0, 872, __pyx_L3_error) - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 872, __pyx_L3_error) - __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 872, __pyx_L3_error) - __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 872, __pyx_L3_error) - __pyx_v_norm = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_norm.memview)) __PYX_ERR(0, 872, __pyx_L3_error) - __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 872, __pyx_L3_error) - __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) - __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) - if (values[9]) { - __pyx_v_order = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) - } else { - __pyx_v_order = ((int)1); + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { + + /* "View.MemoryView":943 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 + */ + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_kp_s_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L1_error) + + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + */ } } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 872, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogramShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + + /* "View.MemoryView":945 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim + * + */ + + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} + +/* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + */ + +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_44writeKirkwoodHistogramShellwise(__pyx_self, __pyx_v_aufpunkt, __pyx_v_aufpunkt_dipole, __pyx_v_coor, __pyx_v_dip, __pyx_v_histogram, __pyx_v_norm, __pyx_v_dataset, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "View.MemoryView":964 + * + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): + */ + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); + + /* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + */ /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_44writeKirkwoodHistogramShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_aufpunkt_dipole, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, __Pyx_memviewslice __pyx_v_histogram, __Pyx_memviewslice __pyx_v_norm, __Pyx_memviewslice __pyx_v_dataset, double __pyx_v_max_distance, int __pyx_v_segments_per_angstroem, int __pyx_v_order) { - int __pyx_v_particles; - int __pyx_v_maxshell; - int __pyx_v_i; - int __pyx_v_shell; +/* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) + */ + +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("writeKirkwoodHistogramShellwise", 0); + __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "src/helpers/miscellaneous.pyx":883 - * ''' + /* "View.MemoryView":967 * - * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< - * cdef int maxshell = histogram.shape[0] - * cdef int i, shell = 0 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: */ - __pyx_v_particles = (__pyx_v_coor.shape[0]); + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":884 - * - * cdef int particles = coor.shape[0] - * cdef int maxshell = histogram.shape[0] # <<<<<<<<<<<<<< - * cdef int i, shell = 0 - * + /* "View.MemoryView":968 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) */ - __pyx_v_maxshell = (__pyx_v_histogram.shape[0]); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 968, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":885 - * cdef int particles = coor.shape[0] - * cdef int maxshell = histogram.shape[0] - * cdef int i, shell = 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":967 * - * for i in range(particles): + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: */ - __pyx_v_shell = 0; + } - /* "src/helpers/miscellaneous.pyx":887 - * cdef int i, shell = 0 + /* "View.MemoryView":970 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< * - * for i in range(particles): # <<<<<<<<<<<<<< - * shell = dataset[i] - 1 - * if shell >= maxshell: + * cdef assign_item_from_object(self, char *itemp, object value): */ - __pyx_t_1 = __pyx_v_particles; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 970, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } - /* "src/helpers/miscellaneous.pyx":888 + /* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * for i in range(particles): - * shell = dataset[i] - 1 # <<<<<<<<<<<<<< - * if shell >= maxshell: - * shell = maxshell-1 + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) */ - __pyx_t_4 = __pyx_v_i; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_dataset.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_dataset.shape[0])) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - __PYX_ERR(0, 888, __pyx_L1_error) - } - __pyx_v_shell = ((*((char *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_4 * __pyx_v_dataset.strides[0]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":889 - * for i in range(particles): - * shell = dataset[i] - 1 - * if shell >= maxshell: # <<<<<<<<<<<<<< - * shell = maxshell-1 - * norm[shell] += 1 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ - __pyx_t_6 = ((__pyx_v_shell >= __pyx_v_maxshell) != 0); - if (__pyx_t_6) { - /* "src/helpers/miscellaneous.pyx":890 - * shell = dataset[i] - 1 - * if shell >= maxshell: - * shell = maxshell-1 # <<<<<<<<<<<<<< - * norm[shell] += 1 +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":973 * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: */ - __pyx_v_shell = (__pyx_v_maxshell - 1); + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":889 - * for i in range(particles): - * shell = dataset[i] - 1 - * if shell >= maxshell: # <<<<<<<<<<<<<< - * shell = maxshell-1 - * norm[shell] += 1 + /* "View.MemoryView":974 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) */ - } + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 974, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":891 - * if shell >= maxshell: - * shell = maxshell-1 - * norm[shell] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":973 * - * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: */ - __pyx_t_4 = __pyx_v_shell; - __pyx_t_5 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_norm.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_norm.shape[0])) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); - __PYX_ERR(0, 891, __pyx_L1_error) - } - *((double *) ( /* dim=0 */ (__pyx_v_norm.data + __pyx_t_4 * __pyx_v_norm.strides[0]) )) += 1.0; + goto __pyx_L3; } - /* "src/helpers/miscellaneous.pyx":893 - * norm[shell] += 1 - * - * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) # <<<<<<<<<<<<<< + /* "View.MemoryView":976 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< * - * def writeKirkwoodHistogramShellwise(double [:,:] aufpunkte, double [:,:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): + * cdef _get_base(self): */ - __pyx_t_4 = 0; - __pyx_t_1 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_aufpunkt.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_aufpunkt.shape[0])) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 893, __pyx_L1_error) - } - __pyx_t_7 = 0; - __pyx_t_1 = -1; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_v_aufpunkt_dipole.shape[0]; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_7 >= __pyx_v_aufpunkt_dipole.shape[0])) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 893, __pyx_L1_error) - } - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_t_1 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_coor.shape[0]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_v_coor.shape[0])) __pyx_t_1 = 0; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_v_coor.shape[1]; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_1 = 1; - } else if (unlikely(__pyx_t_9 >= __pyx_v_coor.shape[1])) __pyx_t_1 = 1; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 893, __pyx_L1_error) - } - __pyx_t_10 = 0; - __pyx_t_11 = 0; - __pyx_t_1 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_v_dip.shape[0]; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_v_dip.shape[0])) __pyx_t_1 = 0; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_v_dip.shape[1]; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_1 = 1; - } else if (unlikely(__pyx_t_11 >= __pyx_v_dip.shape[1])) __pyx_t_1 = 1; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 893, __pyx_L1_error) - } - __pyx_t_12 = 0; - __pyx_t_13 = 0; - __pyx_t_1 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_v_histogram.shape[0]; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_v_histogram.shape[0])) __pyx_t_1 = 0; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_v_histogram.shape[1]; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_1 = 1; - } else if (unlikely(__pyx_t_13 >= __pyx_v_histogram.shape[1])) __pyx_t_1 = 1; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 893, __pyx_L1_error) - } - __pyx_t_14 = 0; - __pyx_t_1 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_v_dataset.shape[0]; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_v_dataset.shape[0])) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 893, __pyx_L1_error) + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - write_Kirkwood_diagram_shellwise((&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_4 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt_dipole.data + __pyx_t_7 * __pyx_v_aufpunkt_dipole.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_10 * __pyx_v_dip.strides[0]) ) + __pyx_t_11 * __pyx_v_dip.strides[1]) )))), __pyx_v_particles, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_12 * __pyx_v_histogram.strides[0]) ) + __pyx_t_13 * __pyx_v_histogram.strides[1]) )))), (&(*((char *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_14 * __pyx_v_dataset.strides[0]) )))), __pyx_v_maxshell, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":872 - * write_Kirkwood_diagram(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0], max_distance, segments_per_angstroem, order) + /* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) * - * def writeKirkwoodHistogramShellwise(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< - * ''' - * aufpunkt ... (3) + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogramShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histogram, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_norm, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":895 - * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) +/* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object * - * def writeKirkwoodHistogramShellwise(double [:,:] aufpunkte, double [:,:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< - * ''' - * aufpunkt ... (number_aufpunkte, 3) */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_47writeKirkwoodHistogramShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_46writeKirkwoodHistogramShellwise[] = "\n aufpunkt ... (number_aufpunkte, 3)\n aufpunkt_dipole ... (number_aufpunkte, 3)\n coor ... (number_of_particles, 3)\n dip ... (number_of_particles, 3)\n histogram ... (maxshell, max_distance*segments_per_angstroem)\n norm ... (maxshell)\n dataset ... (number_of_particles)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_47writeKirkwoodHistogramShellwise = {"writeKirkwoodHistogramShellwise", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_47writeKirkwoodHistogramShellwise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_46writeKirkwoodHistogramShellwise}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_47writeKirkwoodHistogramShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_aufpunkte = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_aufpunkt_dipole = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_norm = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_max_distance; - int __pyx_v_segments_per_angstroem; - int __pyx_v_order; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("writeKirkwoodHistogramShellwise (wrapper)", 0); + __Pyx_RefNannySetupContext("_get_base", 0); + + /* "View.MemoryView":979 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; + goto __pyx_L0; + + /* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkte,&__pyx_n_s_aufpunkt_dipole,&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_histogram,&__pyx_n_s_norm,&__pyx_n_s_dataset,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,&__pyx_n_s_order,0}; - PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkte)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt_dipole)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 1); __PYX_ERR(0, 895, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 2); __PYX_ERR(0, 895, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 3); __PYX_ERR(0, 895, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histogram)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 4); __PYX_ERR(0, 895, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_norm)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 5); __PYX_ERR(0, 895, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 6); __PYX_ERR(0, 895, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_distance)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 7); __PYX_ERR(0, 895, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_segments_per_angstroem)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 8); __PYX_ERR(0, 895, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 9: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order); - if (value) { values[9] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "writeKirkwoodHistogramShellwise") < 0)) __PYX_ERR(0, 895, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } - } - __pyx_v_aufpunkte = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkte.memview)) __PYX_ERR(0, 895, __pyx_L3_error) - __pyx_v_aufpunkt_dipole = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt_dipole.memview)) __PYX_ERR(0, 895, __pyx_L3_error) - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 895, __pyx_L3_error) - __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 895, __pyx_L3_error) - __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 895, __pyx_L3_error) - __pyx_v_norm = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_norm.memview)) __PYX_ERR(0, 895, __pyx_L3_error) - __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 895, __pyx_L3_error) - __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) - __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) - if (values[9]) { - __pyx_v_order = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - __pyx_v_order = ((int)1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 895, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogramShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_46writeKirkwoodHistogramShellwise(__pyx_self, __pyx_v_aufpunkte, __pyx_v_aufpunkt_dipole, __pyx_v_coor, __pyx_v_dip, __pyx_v_histogram, __pyx_v_norm, __pyx_v_dataset, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_46writeKirkwoodHistogramShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkte, __Pyx_memviewslice __pyx_v_aufpunkt_dipole, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, __Pyx_memviewslice __pyx_v_histogram, __Pyx_memviewslice __pyx_v_norm, __Pyx_memviewslice __pyx_v_dataset, double __pyx_v_max_distance, int __pyx_v_segments_per_angstroem, int __pyx_v_order) { - int __pyx_v_number_aufpunkte; - int __pyx_v_particles; - int __pyx_v_maxshell; - int __pyx_v_i; - int __pyx_v_shell; - __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_aufpunkt_dipol = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("writeKirkwoodHistogramShellwise", 0); + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/helpers/miscellaneous.pyx":906 - * ''' - * - * cdef int number_aufpunkte = aufpunkte.shape[0] # <<<<<<<<<<<<<< - * cdef int particles = coor.shape[0] - * cdef int maxshell = histogram.shape[0] + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_v_number_aufpunkte = (__pyx_v_aufpunkte.shape[0]); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":907 +/* "View.MemoryView":999 * - * cdef int number_aufpunkte = aufpunkte.shape[0] - * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< - * cdef int maxshell = histogram.shape[0] - * cdef int i, shell = 0 + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ - __pyx_v_particles = (__pyx_v_coor.shape[0]); - /* "src/helpers/miscellaneous.pyx":908 - * cdef int number_aufpunkte = aufpunkte.shape[0] - * cdef int particles = coor.shape[0] - * cdef int maxshell = histogram.shape[0] # <<<<<<<<<<<<<< - * cdef int i, shell = 0 - * cdef double [:] aufpunkt = np.zeros(3) +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + + /* "View.MemoryView":1007 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None + * */ - __pyx_v_maxshell = (__pyx_v_histogram.shape[0]); + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":909 - * cdef int particles = coor.shape[0] - * cdef int maxshell = histogram.shape[0] - * cdef int i, shell = 0 # <<<<<<<<<<<<<< - * cdef double [:] aufpunkt = np.zeros(3) - * cdef double [:] aufpunkt_dipol = np.zeros(3) + /* "View.MemoryView":1008 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * + * */ - __pyx_v_shell = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":910 - * cdef int maxshell = histogram.shape[0] - * cdef int i, shell = 0 - * cdef double [:] aufpunkt = np.zeros(3) # <<<<<<<<<<<<<< - * cdef double [:] aufpunkt_dipol = np.zeros(3) + /* "View.MemoryView":1007 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 910, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 910, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 910, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 910, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_aufpunkt = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; - /* "src/helpers/miscellaneous.pyx":911 - * cdef int i, shell = 0 - * cdef double [:] aufpunkt = np.zeros(3) - * cdef double [:] aufpunkt_dipol = np.zeros(3) # <<<<<<<<<<<<<< + /* "View.MemoryView":1013 * - * for i in range(particles): + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 911, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 911, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_3); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 911, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_aufpunkt_dipol = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/helpers/miscellaneous.pyx":913 - * cdef double [:] aufpunkt_dipol = np.zeros(3) + /* "View.MemoryView":1015 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) * - * for i in range(particles): # <<<<<<<<<<<<<< - * shell = dataset[i] - 1 - * if shell >= maxshell: */ - __pyx_t_5 = __pyx_v_particles; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_v_result->from_slice = __pyx_v_memviewslice; - /* "src/helpers/miscellaneous.pyx":914 + /* "View.MemoryView":1016 * - * for i in range(particles): - * shell = dataset[i] - 1 # <<<<<<<<<<<<<< - * if shell >= maxshell: - * shell = maxshell-1 + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() */ - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_dataset.shape[0]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_v_dataset.shape[0])) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 914, __pyx_L1_error) - } - __pyx_v_shell = ((*((char *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_8 * __pyx_v_dataset.strides[0]) ))) - 1); + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - /* "src/helpers/miscellaneous.pyx":915 - * for i in range(particles): - * shell = dataset[i] - 1 - * if shell >= maxshell: # <<<<<<<<<<<<<< - * shell = maxshell-1 - * norm[shell] += 1 + /* "View.MemoryView":1018 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo + * */ - __pyx_t_10 = ((__pyx_v_shell >= __pyx_v_maxshell) != 0); - if (__pyx_t_10) { + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/helpers/miscellaneous.pyx":916 - * shell = dataset[i] - 1 - * if shell >= maxshell: - * shell = maxshell-1 # <<<<<<<<<<<<<< - * norm[shell] += 1 + /* "View.MemoryView":1019 + * + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< * + * result.view = memviewslice.memview.view */ - __pyx_v_shell = (__pyx_v_maxshell - 1); + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - /* "src/helpers/miscellaneous.pyx":915 - * for i in range(particles): - * shell = dataset[i] - 1 - * if shell >= maxshell: # <<<<<<<<<<<<<< - * shell = maxshell-1 - * norm[shell] += 1 + /* "View.MemoryView":1021 + * result.typeinfo = memviewslice.memview.typeinfo + * + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim */ - } + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; - /* "src/helpers/miscellaneous.pyx":917 - * if shell >= maxshell: - * shell = maxshell-1 - * norm[shell] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1022 * - * for i in range(number_aufpunkte): + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None */ - __pyx_t_8 = __pyx_v_shell; - __pyx_t_9 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_norm.shape[0]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_v_norm.shape[0])) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 917, __pyx_L1_error) - } - *((double *) ( /* dim=0 */ (__pyx_v_norm.data + __pyx_t_8 * __pyx_v_norm.strides[0]) )) += 1.0; - } + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - /* "src/helpers/miscellaneous.pyx":919 - * norm[shell] += 1 - * - * for i in range(number_aufpunkte): # <<<<<<<<<<<<<< - * aufpunkt = aufpunkte[i] - * aufpunkt_dipol = aufpunkt_dipole[i] + /* "View.MemoryView":1023 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) */ - __pyx_t_5 = __pyx_v_number_aufpunkte; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - /* "src/helpers/miscellaneous.pyx":920 - * - * for i in range(number_aufpunkte): - * aufpunkt = aufpunkte[i] # <<<<<<<<<<<<<< - * aufpunkt_dipol = aufpunkt_dipole[i] + /* "View.MemoryView":1024 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) * */ - __pyx_t_4.data = __pyx_v_aufpunkte.data; - __pyx_t_4.memview = __pyx_v_aufpunkte.memview; - __PYX_INC_MEMVIEW(&__pyx_t_4, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_shape = __pyx_v_aufpunkte.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_aufpunkte.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - if (unlikely(!__Pyx_is_valid_index(__pyx_tmp_idx, __pyx_tmp_shape))) { - PyErr_SetString(PyExc_IndexError, - "Index out of bounds (axis 0)"); - __PYX_ERR(0, 920, __pyx_L1_error) - } - __pyx_t_4.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_4.shape[0] = __pyx_v_aufpunkte.shape[1]; -__pyx_t_4.strides[0] = __pyx_v_aufpunkte.strides[1]; - __pyx_t_4.suboffsets[0] = -1; - -__PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt, 1); - __pyx_v_aufpunkt = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; - /* "src/helpers/miscellaneous.pyx":921 - * for i in range(number_aufpunkte): - * aufpunkt = aufpunkte[i] - * aufpunkt_dipol = aufpunkt_dipole[i] # <<<<<<<<<<<<<< + /* "View.MemoryView":1025 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< * - * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipol[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) + * if (memviewslice.memview).flags & PyBUF_WRITABLE: */ - __pyx_t_4.data = __pyx_v_aufpunkt_dipole.data; - __pyx_t_4.memview = __pyx_v_aufpunkt_dipole.memview; - __PYX_INC_MEMVIEW(&__pyx_t_4, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_shape = __pyx_v_aufpunkt_dipole.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_aufpunkt_dipole.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - if (unlikely(!__Pyx_is_valid_index(__pyx_tmp_idx, __pyx_tmp_shape))) { - PyErr_SetString(PyExc_IndexError, - "Index out of bounds (axis 0)"); - __PYX_ERR(0, 921, __pyx_L1_error) - } - __pyx_t_4.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_4.shape[0] = __pyx_v_aufpunkt_dipole.shape[1]; -__pyx_t_4.strides[0] = __pyx_v_aufpunkt_dipole.strides[1]; - __pyx_t_4.suboffsets[0] = -1; - -__PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt_dipol, 1); - __pyx_v_aufpunkt_dipol = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + Py_INCREF(Py_None); - /* "src/helpers/miscellaneous.pyx":923 - * aufpunkt_dipol = aufpunkt_dipole[i] - * - * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipol[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) # <<<<<<<<<<<<<< + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) * - * @cython.boundscheck(False) + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: */ - __pyx_t_8 = 0; - __pyx_t_9 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_aufpunkt.shape[0]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_v_aufpunkt.shape[0])) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 923, __pyx_L1_error) - } - __pyx_t_11 = 0; - __pyx_t_9 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_v_aufpunkt_dipol.shape[0]; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_v_aufpunkt_dipol.shape[0])) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 923, __pyx_L1_error) - } - __pyx_t_12 = 0; - __pyx_t_13 = 0; - __pyx_t_9 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_v_coor.shape[0]; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_v_coor.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_v_coor.shape[1]; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_13 >= __pyx_v_coor.shape[1])) __pyx_t_9 = 1; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 923, __pyx_L1_error) - } - __pyx_t_14 = 0; - __pyx_t_15 = 0; - __pyx_t_9 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_v_dip.shape[0]; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_v_dip.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_v_dip.shape[1]; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_15 >= __pyx_v_dip.shape[1])) __pyx_t_9 = 1; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 923, __pyx_L1_error) - } - __pyx_t_16 = 0; - __pyx_t_17 = 0; - __pyx_t_9 = -1; - if (__pyx_t_16 < 0) { - __pyx_t_16 += __pyx_v_histogram.shape[0]; - if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_16 >= __pyx_v_histogram.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_17 < 0) { - __pyx_t_17 += __pyx_v_histogram.shape[1]; - if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_17 >= __pyx_v_histogram.shape[1])) __pyx_t_9 = 1; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 923, __pyx_L1_error) - } - __pyx_t_18 = 0; - __pyx_t_9 = -1; - if (__pyx_t_18 < 0) { - __pyx_t_18 += __pyx_v_dataset.shape[0]; - if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_18 >= __pyx_v_dataset.shape[0])) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 923, __pyx_L1_error) - } - write_Kirkwood_diagram_shellwise((&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_8 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt_dipol.data + __pyx_t_11 * __pyx_v_aufpunkt_dipol.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_14 * __pyx_v_dip.strides[0]) ) + __pyx_t_15 * __pyx_v_dip.strides[1]) )))), __pyx_v_particles, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_16 * __pyx_v_histogram.strides[0]) ) + __pyx_t_17 * __pyx_v_histogram.strides[1]) )))), (&(*((char *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_18 * __pyx_v_dataset.strides[0]) )))), __pyx_v_maxshell, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); - } + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":895 - * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) + /* "View.MemoryView":1028 * - * def writeKirkwoodHistogramShellwise(double [:,:] aufpunkte, double [:,:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< - * ''' - * aufpunkt ... (number_aufpunkte, 3) + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO */ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); - __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogramShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt_dipol, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkte, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histogram, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_norm, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/miscellaneous.pyx":926 - * - * @cython.boundscheck(False) - * def writeKirkwoodHistogram2D(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double max_distance, int segments_per_angstroem, int segments_per_pi, int order = 1): # <<<<<<<<<<<<<< - * #TODO documentation + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_49writeKirkwoodHistogram2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_49writeKirkwoodHistogram2D = {"writeKirkwoodHistogram2D", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_49writeKirkwoodHistogram2D, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_49writeKirkwoodHistogram2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_aufpunkt_dipole = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_max_distance; - int __pyx_v_segments_per_angstroem; - int __pyx_v_segments_per_pi; - int __pyx_v_order; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("writeKirkwoodHistogram2D (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_aufpunkt_dipole,&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_histogram,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,&__pyx_n_s_segments_per_pi,&__pyx_n_s_order,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt_dipole)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 1); __PYX_ERR(0, 926, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 2); __PYX_ERR(0, 926, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 3); __PYX_ERR(0, 926, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histogram)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 4); __PYX_ERR(0, 926, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_distance)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 5); __PYX_ERR(0, 926, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_segments_per_angstroem)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 6); __PYX_ERR(0, 926, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_segments_per_pi)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 7); __PYX_ERR(0, 926, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order); - if (value) { values[8] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "writeKirkwoodHistogram2D") < 0)) __PYX_ERR(0, 926, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 926, __pyx_L3_error) - __pyx_v_aufpunkt_dipole = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt_dipole.memview)) __PYX_ERR(0, 926, __pyx_L3_error) - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 926, __pyx_L3_error) - __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 926, __pyx_L3_error) - __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 926, __pyx_L3_error) - __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L3_error) - __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L3_error) - __pyx_v_segments_per_pi = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_segments_per_pi == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L3_error) - if (values[8]) { - __pyx_v_order = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L3_error) - } else { - __pyx_v_order = ((int)1); - } + goto __pyx_L4; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 926, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogram2D", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_48writeKirkwoodHistogram2D(__pyx_self, __pyx_v_aufpunkt, __pyx_v_aufpunkt_dipole, __pyx_v_coor, __pyx_v_dip, __pyx_v_histogram, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_segments_per_pi, __pyx_v_order); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_48writeKirkwoodHistogram2D(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_aufpunkt_dipole, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, __Pyx_memviewslice __pyx_v_histogram, double __pyx_v_max_distance, int __pyx_v_segments_per_angstroem, int __pyx_v_segments_per_pi, int __pyx_v_order) { - int __pyx_v_particles; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - __Pyx_RefNannySetupContext("writeKirkwoodHistogram2D", 0); + /* "View.MemoryView":1030 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape + */ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; - /* "src/helpers/miscellaneous.pyx":929 - * #TODO documentation + /* "View.MemoryView":1032 + * result.flags = PyBUF_RECORDS_RO * - * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< - * write_Kirkwood_diagram_2D(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], max_distance, segments_per_angstroem, segments_per_pi, order) + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides * */ - __pyx_v_particles = (__pyx_v_coor.shape[0]); + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); - /* "src/helpers/miscellaneous.pyx":930 + /* "View.MemoryView":1033 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< * - * cdef int particles = coor.shape[0] - * write_Kirkwood_diagram_2D(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], max_distance, segments_per_angstroem, segments_per_pi, order) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) */ - __pyx_t_1 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_aufpunkt.shape[0]; - __pyx_t_2 = 0; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_aufpunkt_dipole.shape[0]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dip.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dip.shape[1]; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[1]; - write_Kirkwood_diagram_2D((&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_1 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt_dipole.data + __pyx_t_2 * __pyx_v_aufpunkt_dipole.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_3 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_5 * __pyx_v_dip.strides[0]) ) + __pyx_t_6 * __pyx_v_dip.strides[1]) )))), __pyx_v_particles, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_7 * __pyx_v_histogram.strides[0]) ) + __pyx_t_8 * __pyx_v_histogram.strides[1]) )))), __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_segments_per_pi, __pyx_v_order); + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - /* "src/helpers/miscellaneous.pyx":926 + /* "View.MemoryView":1036 * - * @cython.boundscheck(False) - * def writeKirkwoodHistogram2D(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double max_distance, int segments_per_angstroem, int segments_per_pi, int order = 1): # <<<<<<<<<<<<<< - * #TODO documentation * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: */ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histogram, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1037 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + */ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); + + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break + */ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { -/* "src/helpers/miscellaneous.pyx":933 + /* "View.MemoryView":1039 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break * - * @cython.boundscheck(False) - * def getBondTable(double [:,:] coor, int [:,:] bond_table, int cutoff = 3): # <<<<<<<<<<<<<< - * ''' - * coor ... (n_particles, 3) */ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_51getBondTable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_50getBondTable[] = "\n coor ... (n_particles, 3)\n bond_table ... (n_particles, n_particles)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_51getBondTable = {"getBondTable", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_51getBondTable, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_50getBondTable}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_51getBondTable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_bond_table = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_cutoff; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getBondTable (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_bond_table,&__pyx_n_s_cutoff,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bond_table)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("getBondTable", 0, 2, 3, 1); __PYX_ERR(0, 933, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cutoff); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getBondTable") < 0)) __PYX_ERR(0, 933, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 933, __pyx_L3_error) - __pyx_v_bond_table = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_bond_table.memview)) __PYX_ERR(0, 933, __pyx_L3_error) - if (values[2]) { - __pyx_v_cutoff = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_cutoff == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 933, __pyx_L3_error) - } else { - __pyx_v_cutoff = ((int)3); + /* "View.MemoryView":1040 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize + */ + goto __pyx_L6_break; + + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break + */ } } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("getBondTable", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 933, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.getBondTable", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_50getBondTable(__pyx_self, __pyx_v_coor, __pyx_v_bond_table, __pyx_v_cutoff); + __pyx_L6_break:; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1042 + * break + * + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length + */ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_50getBondTable(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_bond_table, int __pyx_v_cutoff) { - int __pyx_v_n_particles; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - __Pyx_RefNannySetupContext("getBondTable", 0); + /* "View.MemoryView":1043 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * + */ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; - /* "src/helpers/miscellaneous.pyx":939 - * ''' + /* "View.MemoryView":1044 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< * - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< - * calc_donor_grid(&coor[0,0], &bond_table[0,0], n_particles, cutoff) + * result.to_object_func = to_object_func + */ + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } + + /* "View.MemoryView":1046 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func * */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); + __pyx_v_result->to_object_func = __pyx_v_to_object_func; - /* "src/helpers/miscellaneous.pyx":940 + /* "View.MemoryView":1047 * - * cdef int n_particles = coor.shape[0] - * calc_donor_grid(&coor[0,0], &bond_table[0,0], n_particles, cutoff) # <<<<<<<<<<<<<< + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< * - * #@cython.boundscheck(False) + * return result */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_bond_table.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_bond_table.shape[1]; - calc_donor_grid((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), (&(*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_bond_table.data + __pyx_t_3 * __pyx_v_bond_table.strides[0]) ) + __pyx_t_4 * __pyx_v_bond_table.strides[1]) )))), __pyx_v_n_particles, __pyx_v_cutoff); + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; - /* "src/helpers/miscellaneous.pyx":933 + /* "View.MemoryView":1049 + * result.to_dtype_func = to_dtype_func * - * @cython.boundscheck(False) - * def getBondTable(double [:,:] coor, int [:,:] bond_table, int cutoff = 3): # <<<<<<<<<<<<<< - * ''' - * coor ... (n_particles, 3) + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":999 + * + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_bond_table, 1); + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":955 +/* "View.MemoryView":1052 * - * @cython.boundscheck(False) - * def sumVennMDCageSingle(double [:,:,:,:] mdcage_timeseries, double [:,:] dipoles, char [:] dataset1, char [:] dataset2, int maxshell1, int maxshell2, int frame): # <<<<<<<<<<<<<< - * - * cdef int w, shell1, shell2, i, nres_wat = dipoles.shape[0] + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_53sumVennMDCageSingle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_53sumVennMDCageSingle = {"sumVennMDCageSingle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_53sumVennMDCageSingle, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_53sumVennMDCageSingle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_mdcage_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell1; - int __pyx_v_maxshell2; - int __pyx_v_frame; +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sumVennMDCageSingle (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mdcage_timeseries,&__pyx_n_s_dipoles,&__pyx_n_s_dataset1,&__pyx_n_s_dataset2,&__pyx_n_s_maxshell1,&__pyx_n_s_maxshell2,&__pyx_n_s_frame,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mdcage_timeseries)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dipoles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 1); __PYX_ERR(0, 955, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 2); __PYX_ERR(0, 955, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 3); __PYX_ERR(0, 955, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 4); __PYX_ERR(0, 955, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 5); __PYX_ERR(0, 955, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 6); __PYX_ERR(0, 955, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumVennMDCageSingle") < 0)) __PYX_ERR(0, 955, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - } - __pyx_v_mdcage_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mdcage_timeseries.memview)) __PYX_ERR(0, 955, __pyx_L3_error) - __pyx_v_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dipoles.memview)) __PYX_ERR(0, 955, __pyx_L3_error) - __pyx_v_dataset1 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset1.memview)) __PYX_ERR(0, 955, __pyx_L3_error) - __pyx_v_dataset2 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset2.memview)) __PYX_ERR(0, 955, __pyx_L3_error) - __pyx_v_maxshell1 = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 955, __pyx_L3_error) - __pyx_v_maxshell2 = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_maxshell2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 955, __pyx_L3_error) - __pyx_v_frame = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_frame == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 955, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 955, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.sumVennMDCageSingle", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_52sumVennMDCageSingle(__pyx_self, __pyx_v_mdcage_timeseries, __pyx_v_dipoles, __pyx_v_dataset1, __pyx_v_dataset2, __pyx_v_maxshell1, __pyx_v_maxshell2, __pyx_v_frame); + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice + */ + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_52sumVennMDCageSingle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_mdcage_timeseries, __Pyx_memviewslice __pyx_v_dipoles, __Pyx_memviewslice __pyx_v_dataset1, __Pyx_memviewslice __pyx_v_dataset2, int __pyx_v_maxshell1, int __pyx_v_maxshell2, int __pyx_v_frame) { - int __pyx_v_w; - int __pyx_v_shell1; - int __pyx_v_shell2; - int __pyx_v_i; - int __pyx_v_nres_wat; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - __Pyx_RefNannySetupContext("sumVennMDCageSingle", 0); + /* "View.MemoryView":1056 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: + */ + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/helpers/miscellaneous.pyx":957 - * def sumVennMDCageSingle(double [:,:,:,:] mdcage_timeseries, double [:,:] dipoles, char [:] dataset1, char [:] dataset2, int maxshell1, int maxshell2, int frame): - * - * cdef int w, shell1, shell2, i, nres_wat = dipoles.shape[0] # <<<<<<<<<<<<<< - * - * for w in range(nres_wat): + /* "View.MemoryView":1057 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) */ - __pyx_v_nres_wat = (__pyx_v_dipoles.shape[0]); + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":959 - * cdef int w, shell1, shell2, i, nres_wat = dipoles.shape[0] - * - * for w in range(nres_wat): # <<<<<<<<<<<<<< - * shell1 = dataset1[w]-1 - * shell2 = dataset2[w]-1 + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice */ - __pyx_t_1 = __pyx_v_nres_wat; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_w = __pyx_t_3; + } - /* "src/helpers/miscellaneous.pyx":960 - * - * for w in range(nres_wat): - * shell1 = dataset1[w]-1 # <<<<<<<<<<<<<< - * shell2 = dataset2[w]-1 + /* "View.MemoryView":1059 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice * */ - __pyx_t_4 = __pyx_v_w; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dataset1.shape[0]; - __pyx_v_shell1 = ((*((char *) ( /* dim=0 */ (__pyx_v_dataset1.data + __pyx_t_4 * __pyx_v_dataset1.strides[0]) ))) - 1); + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - /* "src/helpers/miscellaneous.pyx":961 - * for w in range(nres_wat): - * shell1 = dataset1[w]-1 - * shell2 = dataset2[w]-1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1060 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< * - * if shell1 >= maxshell1: + * @cname('__pyx_memoryview_slice_copy') */ - __pyx_t_4 = __pyx_v_w; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dataset2.shape[0]; - __pyx_v_shell2 = ((*((char *) ( /* dim=0 */ (__pyx_v_dataset2.data + __pyx_t_4 * __pyx_v_dataset2.strides[0]) ))) - 1); + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } - /* "src/helpers/miscellaneous.pyx":963 - * shell2 = dataset2[w]-1 - * - * if shell1 >= maxshell1: # <<<<<<<<<<<<<< - * shell1 = maxshell1 + /* "View.MemoryView":1052 * + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ - __pyx_t_5 = ((__pyx_v_shell1 >= __pyx_v_maxshell1) != 0); - if (__pyx_t_5) { - /* "src/helpers/miscellaneous.pyx":964 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1063 * - * if shell1 >= maxshell1: - * shell1 = maxshell1 # <<<<<<<<<<<<<< + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets + */ + +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; + __Pyx_RefNannyDeclarations + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("slice_copy", 0); + + /* "View.MemoryView":1067 + * cdef (Py_ssize_t*) shape, strides, suboffsets * - * if shell2 >= maxshell2: + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets */ - __pyx_v_shell1 = __pyx_v_maxshell1; + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":963 - * shell2 = dataset2[w]-1 + /* "View.MemoryView":1068 * - * if shell1 >= maxshell1: # <<<<<<<<<<<<<< - * shell1 = maxshell1 + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets * */ - } + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":966 - * shell1 = maxshell1 - * - * if shell2 >= maxshell2: # <<<<<<<<<<<<<< - * shell2 = maxshell2 + /* "View.MemoryView":1069 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< * + * dst.memview = <__pyx_memoryview *> memview */ - __pyx_t_5 = ((__pyx_v_shell2 >= __pyx_v_maxshell2) != 0); - if (__pyx_t_5) { + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":967 + /* "View.MemoryView":1071 + * suboffsets = memview.view.suboffsets * - * if shell2 >= maxshell2: - * shell2 = maxshell2 # <<<<<<<<<<<<<< + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf * - * for i in range(3): */ - __pyx_v_shell2 = __pyx_v_maxshell2; + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); - /* "src/helpers/miscellaneous.pyx":966 - * shell1 = maxshell1 + /* "View.MemoryView":1072 * - * if shell2 >= maxshell2: # <<<<<<<<<<<<<< - * shell2 = maxshell2 + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< * + * for dim in range(memview.view.ndim): */ - } + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - /* "src/helpers/miscellaneous.pyx":969 - * shell2 = maxshell2 + /* "View.MemoryView":1074 + * dst.data = memview.view.buf * - * for i in range(3): # <<<<<<<<<<<<<< - * mdcage_timeseries[shell1, shell2, frame, i] += dipoles[w, i] + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + */ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; + + /* "View.MemoryView":1075 * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 */ - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); - /* "src/helpers/miscellaneous.pyx":970 + /* "View.MemoryView":1076 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 * - * for i in range(3): - * mdcage_timeseries[shell1, shell2, frame, i] += dipoles[w, i] # <<<<<<<<<<<<<< + */ + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + + /* "View.MemoryView":1077 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * @cname('__pyx_memoryview_copy_object') */ - __pyx_t_4 = __pyx_v_w; - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dipoles.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipoles.shape[1]; - __pyx_t_8 = __pyx_v_shell1; - __pyx_t_9 = __pyx_v_shell2; - __pyx_t_10 = __pyx_v_frame; - __pyx_t_11 = __pyx_v_i; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_mdcage_timeseries.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mdcage_timeseries.shape[1]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mdcage_timeseries.shape[2]; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_mdcage_timeseries.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_timeseries.data + __pyx_t_8 * __pyx_v_mdcage_timeseries.strides[0]) ) + __pyx_t_9 * __pyx_v_mdcage_timeseries.strides[1]) ) + __pyx_t_10 * __pyx_v_mdcage_timeseries.strides[2]) ) + __pyx_t_11 * __pyx_v_mdcage_timeseries.strides[3]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipoles.data + __pyx_t_4 * __pyx_v_dipoles.strides[0]) ) + __pyx_t_7 * __pyx_v_dipoles.strides[1]) ))); + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; } - /* "src/helpers/miscellaneous.pyx":955 - * - * @cython.boundscheck(False) - * def sumVennMDCageSingle(double [:,:,:,:] mdcage_timeseries, double [:,:] dipoles, char [:] dataset1, char [:] dataset2, int maxshell1, int maxshell2, int frame): # <<<<<<<<<<<<<< + /* "View.MemoryView":1063 * - * cdef int w, shell1, shell2, i, nres_wat = dipoles.shape[0] + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_mdcage_timeseries, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dipoles, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset2, 1); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":973 - * - * @cython.boundscheck(False) - * def sumMultiMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, char [:] ds1, char [:] ds2, char [:] ds3, char [:] ds4, char [:] ds5, int maxshell, int frame): # <<<<<<<<<<<<<< +/* "View.MemoryView":1080 * - * cdef int w, shell, i, nres_wat = dip_wat.shape[0] + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_55sumMultiMDCageSingle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_55sumMultiMDCageSingle = {"sumMultiMDCageSingle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_55sumMultiMDCageSingle, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_55sumMultiMDCageSingle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_mdcage_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip_wat = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds3 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell; - int __pyx_v_frame; +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sumMultiMDCageSingle (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mdcage_ts,&__pyx_n_s_dip_wat,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_ds3,&__pyx_n_s_ds4,&__pyx_n_s_ds5,&__pyx_n_s_maxshell,&__pyx_n_s_frame,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mdcage_ts)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_wat)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 1); __PYX_ERR(0, 973, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 2); __PYX_ERR(0, 973, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 3); __PYX_ERR(0, 973, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds3)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 4); __PYX_ERR(0, 973, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds4)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 5); __PYX_ERR(0, 973, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds5)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 6); __PYX_ERR(0, 973, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 7); __PYX_ERR(0, 973, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 8); __PYX_ERR(0, 973, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumMultiMDCageSingle") < 0)) __PYX_ERR(0, 973, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - } - __pyx_v_mdcage_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mdcage_ts.memview)) __PYX_ERR(0, 973, __pyx_L3_error) - __pyx_v_dip_wat = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_wat.memview)) __PYX_ERR(0, 973, __pyx_L3_error) - __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 973, __pyx_L3_error) - __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 973, __pyx_L3_error) - __pyx_v_ds3 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds3.memview)) __PYX_ERR(0, 973, __pyx_L3_error) - __pyx_v_ds4 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds4.memview)) __PYX_ERR(0, 973, __pyx_L3_error) - __pyx_v_ds5 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds5.memview)) __PYX_ERR(0, 973, __pyx_L3_error) - __pyx_v_maxshell = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 973, __pyx_L3_error) - __pyx_v_frame = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_frame == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 973, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 973, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.sumMultiMDCageSingle", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_54sumMultiMDCageSingle(__pyx_self, __pyx_v_mdcage_ts, __pyx_v_dip_wat, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_ds3, __pyx_v_ds4, __pyx_v_ds5, __pyx_v_maxshell, __pyx_v_frame); + __Pyx_RefNannySetupContext("memoryview_copy", 0); + + /* "View.MemoryView":1083 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * + */ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1084 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":1080 + * + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_54sumMultiMDCageSingle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_mdcage_ts, __Pyx_memviewslice __pyx_v_dip_wat, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, __Pyx_memviewslice __pyx_v_ds3, __Pyx_memviewslice __pyx_v_ds4, __Pyx_memviewslice __pyx_v_ds5, int __pyx_v_maxshell, int __pyx_v_frame) { - int __pyx_v_w; - int __pyx_v_shell; - int __pyx_v_i; - int __pyx_v_nres_wat; - int __pyx_v_shell1; - int __pyx_v_shell2; - int __pyx_v_shell3; - int __pyx_v_shell4; - int __pyx_v_shell5; +/* "View.MemoryView":1087 + * + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. + */ + +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - __Pyx_RefNannySetupContext("sumMultiMDCageSingle", 0); + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - /* "src/helpers/miscellaneous.pyx":975 - * def sumMultiMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, char [:] ds1, char [:] ds2, char [:] ds3, char [:] ds4, char [:] ds5, int maxshell, int frame): - * - * cdef int w, shell, i, nres_wat = dip_wat.shape[0] # <<<<<<<<<<<<<< - * cdef int shell1, shell2, shell3, shell4, shell5 + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - __pyx_v_nres_wat = (__pyx_v_dip_wat.shape[0]); + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":978 - * cdef int shell1, shell2, shell3, shell4, shell5 + /* "View.MemoryView":1095 * - * for w in range(nres_wat): # <<<<<<<<<<<<<< - * shell1 = ds1[w]-1 - * shell2 = ds2[w]-1 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: */ - __pyx_t_1 = __pyx_v_nres_wat; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_w = __pyx_t_3; + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; - /* "src/helpers/miscellaneous.pyx":979 - * - * for w in range(nres_wat): - * shell1 = ds1[w]-1 # <<<<<<<<<<<<<< - * shell2 = ds2[w]-1 - * shell3 = ds3[w]-1 + /* "View.MemoryView":1096 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL */ - __pyx_t_4 = __pyx_v_w; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds1.shape[0]; - __pyx_v_shell1 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_4 * __pyx_v_ds1.strides[0]) ))) - 1); + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":980 - * for w in range(nres_wat): - * shell1 = ds1[w]-1 - * shell2 = ds2[w]-1 # <<<<<<<<<<<<<< - * shell3 = ds3[w]-1 - * shell4 = ds4[w]-1 + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - __pyx_t_4 = __pyx_v_w; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds2.shape[0]; - __pyx_v_shell2 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_4 * __pyx_v_ds2.strides[0]) ))) - 1); + goto __pyx_L3; + } - /* "src/helpers/miscellaneous.pyx":981 - * shell1 = ds1[w]-1 - * shell2 = ds2[w]-1 - * shell3 = ds3[w]-1 # <<<<<<<<<<<<<< - * shell4 = ds4[w]-1 - * shell5 = ds5[w]-1 - */ - __pyx_t_4 = __pyx_v_w; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds3.shape[0]; - __pyx_v_shell3 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds3.data + __pyx_t_4 * __pyx_v_ds3.strides[0]) ))) - 1); - - /* "src/helpers/miscellaneous.pyx":982 - * shell2 = ds2[w]-1 - * shell3 = ds3[w]-1 - * shell4 = ds4[w]-1 # <<<<<<<<<<<<<< - * shell5 = ds5[w]-1 + /* "View.MemoryView":1098 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL * */ - __pyx_t_4 = __pyx_v_w; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds4.shape[0]; - __pyx_v_shell4 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds4.data + __pyx_t_4 * __pyx_v_ds4.strides[0]) ))) - 1); + /*else*/ { + __pyx_v_to_object_func = NULL; - /* "src/helpers/miscellaneous.pyx":983 - * shell3 = ds3[w]-1 - * shell4 = ds4[w]-1 - * shell5 = ds5[w]-1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1099 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< * - * shell = min(shell1, shell2, shell3, shell4, shell5) + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, */ - __pyx_t_4 = __pyx_v_w; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds5.shape[0]; - __pyx_v_shell5 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds5.data + __pyx_t_4 * __pyx_v_ds5.strides[0]) ))) - 1); + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":985 - * shell5 = ds5[w]-1 - * - * shell = min(shell1, shell2, shell3, shell4, shell5) # <<<<<<<<<<<<<< + /* "View.MemoryView":1101 + * to_dtype_func = NULL * - * if shell < maxshell: + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) */ - __pyx_t_5 = __pyx_v_shell2; - __pyx_t_6 = __pyx_v_shell3; - __pyx_t_7 = __pyx_v_shell4; - __pyx_t_8 = __pyx_v_shell5; - __pyx_t_9 = __pyx_v_shell1; - if (((__pyx_t_5 < __pyx_t_9) != 0)) { - __pyx_t_10 = __pyx_t_5; - } else { - __pyx_t_10 = __pyx_t_9; - } - __pyx_t_9 = __pyx_t_10; - if (((__pyx_t_6 < __pyx_t_9) != 0)) { - __pyx_t_10 = __pyx_t_6; - } else { - __pyx_t_10 = __pyx_t_9; - } - __pyx_t_9 = __pyx_t_10; - if (((__pyx_t_7 < __pyx_t_9) != 0)) { - __pyx_t_10 = __pyx_t_7; - } else { - __pyx_t_10 = __pyx_t_9; - } - __pyx_t_9 = __pyx_t_10; - if (((__pyx_t_8 < __pyx_t_9) != 0)) { - __pyx_t_10 = __pyx_t_8; - } else { - __pyx_t_10 = __pyx_t_9; - } - __pyx_v_shell = __pyx_t_10; + __Pyx_XDECREF(__pyx_r); - /* "src/helpers/miscellaneous.pyx":987 - * shell = min(shell1, shell2, shell3, shell4, shell5) + /* "View.MemoryView":1103 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * * - * if shell < maxshell: # <<<<<<<<<<<<<< - * for i in range(3): - * mdcage_ts[shell,frame,i] += dip_wat[w,i] */ - __pyx_t_11 = ((__pyx_v_shell < __pyx_v_maxshell) != 0); - if (__pyx_t_11) { + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":988 + /* "View.MemoryView":1087 * - * if shell < maxshell: - * for i in range(3): # <<<<<<<<<<<<<< - * mdcage_ts[shell,frame,i] += dip_wat[w,i] - * else: + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; - /* "src/helpers/miscellaneous.pyx":989 - * if shell < maxshell: - * for i in range(3): - * mdcage_ts[shell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< - * else: - * for i in range(3): - */ - __pyx_t_4 = __pyx_v_w; - __pyx_t_12 = __pyx_v_i; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_dip_wat.shape[1]; - __pyx_t_13 = __pyx_v_shell; - __pyx_t_14 = __pyx_v_frame; - __pyx_t_15 = __pyx_v_i; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_mdcage_ts.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_mdcage_ts.shape[1]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_mdcage_ts.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_13 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_14 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_15 * __pyx_v_mdcage_ts.strides[2]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_4 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_12 * __pyx_v_dip_wat.strides[1]) ))); - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":987 - * shell = min(shell1, shell2, shell3, shell4, shell5) +/* "View.MemoryView":1109 * - * if shell < maxshell: # <<<<<<<<<<<<<< - * for i in range(3): - * mdcage_ts[shell,frame,i] += dip_wat[w,i] - */ - goto __pyx_L5; - } - - /* "src/helpers/miscellaneous.pyx":991 - * mdcage_ts[shell,frame,i] += dip_wat[w,i] - * else: - * for i in range(3): # <<<<<<<<<<<<<< - * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg * */ - /*else*/ { - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; - /* "src/helpers/miscellaneous.pyx":992 - * else: - * for i in range(3): - * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1110 * - * @cython.boundscheck(False) + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') */ - __pyx_t_12 = __pyx_v_w; - __pyx_t_4 = __pyx_v_i; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_dip_wat.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[1]; - __pyx_t_15 = __pyx_v_maxshell; - __pyx_t_14 = __pyx_v_frame; - __pyx_t_13 = __pyx_v_i; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_mdcage_ts.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_mdcage_ts.shape[1]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_mdcage_ts.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_15 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_14 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_13 * __pyx_v_mdcage_ts.strides[2]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_12 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_4 * __pyx_v_dip_wat.strides[1]) ))); - } - } - __pyx_L5:; + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; } + __pyx_r = __pyx_t_1; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":973 + /* "View.MemoryView":1109 * - * @cython.boundscheck(False) - * def sumMultiMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, char [:] ds1, char [:] ds2, char [:] ds3, char [:] ds4, char [:] ds5, int maxshell, int frame): # <<<<<<<<<<<<<< * - * cdef int w, shell, i, nres_wat = dip_wat.shape[0] + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_mdcage_ts, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip_wat, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds3, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds4, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds5, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":995 +/* "View.MemoryView":1113 * - * @cython.boundscheck(False) - * def multiVecShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, long nshells1, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< * """ - * rotTs ... (nmol, n (time length), 3D) + * Figure out the best memory access order for a given slice. */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_57multiVecShellCorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_56multiVecShellCorrelate[] = "\n rotTs ... (nmol, n (time length), 3D)\n (,self,cross)coor ... (shell1, n (time length))\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_57multiVecShellCorrelate = {"multiVecShellCorrelate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_57multiVecShellCorrelate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_56multiVecShellCorrelate}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_57multiVecShellCorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_v_nshells1; - long __pyx_v_maxdt; - long __pyx_v_startingpoints; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("multiVecShellCorrelate (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds1,&__pyx_n_s_nshells1,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rotTs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("multiVecShellCorrelate", 1, 5, 5, 1); __PYX_ERR(0, 995, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("multiVecShellCorrelate", 1, 5, 5, 2); __PYX_ERR(0, 995, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxdt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("multiVecShellCorrelate", 1, 5, 5, 3); __PYX_ERR(0, 995, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startingpoints)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("multiVecShellCorrelate", 1, 5, 5, 4); __PYX_ERR(0, 995, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "multiVecShellCorrelate") < 0)) __PYX_ERR(0, 995, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - } - __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 995, __pyx_L3_error) - __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 995, __pyx_L3_error) - __pyx_v_nshells1 = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_nshells1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 995, __pyx_L3_error) - __pyx_v_maxdt = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 995, __pyx_L3_error) - __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 995, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("multiVecShellCorrelate", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 995, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.multiVecShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_56multiVecShellCorrelate(__pyx_self, __pyx_v_rotTs, __pyx_v_ds1, __pyx_v_nshells1, __pyx_v_maxdt, __pyx_v_startingpoints); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_56multiVecShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds1, long __pyx_v_nshells1, long __pyx_v_maxdt, long __pyx_v_startingpoints) { - long __pyx_v_nmol; - long __pyx_v_n; - long __pyx_v_startskip; - __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_selfcorr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_crosscorr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_selfctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_crossctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_t1; - long __pyx_v_i; - long __pyx_v_j; - long __pyx_v_k; - long __pyx_v_start; - long __pyx_v_point; - long __pyx_v_dt; - long __pyx_v_mol; - long __pyx_v_shellstart1; - long __pyx_v_shelldt1; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - long __pyx_t_9; - long __pyx_t_10; - long __pyx_t_11; - long __pyx_t_12; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - int __pyx_t_19; - long __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - PyObject *__pyx_t_25 = NULL; - PyObject *__pyx_t_26 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("multiVecShellCorrelate", 0); +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; - /* "src/helpers/miscellaneous.pyx":1001 + /* "View.MemoryView":1118 * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 * - * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< - * cdef long n = len(rotTs[0]) # number of time steps - * cdef long startskip = (n-maxdt)/startingpoints */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); - __pyx_v_nmol = ((long)__pyx_t_1); + __pyx_v_c_stride = 0; - /* "src/helpers/miscellaneous.pyx":1002 + /* "View.MemoryView":1119 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< * - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:] corr = np.zeros((nshells1,maxdt)) + * for i in range(ndim - 1, -1, -1): */ - __pyx_t_2.data = __pyx_v_rotTs.data; - __pyx_t_2.memview = __pyx_v_rotTs.memview; - __PYX_INC_MEMVIEW(&__pyx_t_2, 0); - { - Py_ssize_t __pyx_tmp_idx = 0; - Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; -} + __pyx_v_f_stride = 0; -__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; -__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; - __pyx_t_2.suboffsets[0] = -1; + /* "View.MemoryView":1121 + * cdef Py_ssize_t f_stride = 0 + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + */ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; -__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; -__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; - __pyx_t_2.suboffsets[1] = -1; + /* "View.MemoryView":1122 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break + */ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { -__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - __pyx_v_n = ((long)__pyx_t_1); + /* "View.MemoryView":1123 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * + */ + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "src/helpers/miscellaneous.pyx":1003 - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps - * cdef long startskip = (n-maxdt)/startingpoints # <<<<<<<<<<<<<< - * cdef double [:,:] corr = np.zeros((nshells1,maxdt)) - * cdef double [:,:] selfcorr = np.zeros((nshells1,maxdt)) + /* "View.MemoryView":1124 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * for i in range(ndim): */ - __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); - if (unlikely(__pyx_v_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1003, __pyx_L1_error) - } - else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1003, __pyx_L1_error) - } - __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); + goto __pyx_L4_break; - /* "src/helpers/miscellaneous.pyx":1004 - * cdef long n = len(rotTs[0]) # number of time steps - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:] corr = np.zeros((nshells1,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:] selfcorr = np.zeros((nshells1,maxdt)) - * cdef double [:,:] crosscorr = np.zeros((nshells1,maxdt)) + /* "View.MemoryView":1122 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); } } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_corr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; + __pyx_L4_break:; - /* "src/helpers/miscellaneous.pyx":1005 - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:] corr = np.zeros((nshells1,maxdt)) - * cdef double [:,:] selfcorr = np.zeros((nshells1,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:] crosscorr = np.zeros((nshells1,maxdt)) - * cdef double [:,:] ctr = np.zeros((nshells1,maxdt)) # counter array of correlation entries + /* "View.MemoryView":1126 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + */ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1127 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break + */ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1128 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * + */ + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1129 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + */ + goto __pyx_L7_break; + + /* "View.MemoryView":1127 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1005, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1005, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1005, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1005, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1005, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); } } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1005, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1005, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_selfcorr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; + __pyx_L7_break:; - /* "src/helpers/miscellaneous.pyx":1006 - * cdef double [:,:] corr = np.zeros((nshells1,maxdt)) - * cdef double [:,:] selfcorr = np.zeros((nshells1,maxdt)) - * cdef double [:,:] crosscorr = np.zeros((nshells1,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:] ctr = np.zeros((nshells1,maxdt)) # counter array of correlation entries - * cdef double [:,:] selfctr = np.zeros((nshells1,maxdt)) + /* "View.MemoryView":1131 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1006, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_crosscorr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1007 - * cdef double [:,:] selfcorr = np.zeros((nshells1,maxdt)) - * cdef double [:,:] crosscorr = np.zeros((nshells1,maxdt)) - * cdef double [:,:] ctr = np.zeros((nshells1,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< - * cdef double [:,:] selfctr = np.zeros((nshells1,maxdt)) - * cdef double [:,:] crossctr = np.zeros((nshells1,maxdt)) + /* "View.MemoryView":1132 + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1007, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1007, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1007, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1007, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1007, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1007, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1007, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ctr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; + __pyx_r = 'C'; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1008 - * cdef double [:,:] crosscorr = np.zeros((nshells1,maxdt)) - * cdef double [:,:] ctr = np.zeros((nshells1,maxdt)) # counter array of correlation entries - * cdef double [:,:] selfctr = np.zeros((nshells1,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:] crossctr = np.zeros((nshells1,maxdt)) - * cdef double t1 + /* "View.MemoryView":1131 + * break + * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1008, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1008, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1008, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1008, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1008, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1008, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1008, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_selfctr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - /* "src/helpers/miscellaneous.pyx":1009 - * cdef double [:,:] ctr = np.zeros((nshells1,maxdt)) # counter array of correlation entries - * cdef double [:,:] selfctr = np.zeros((nshells1,maxdt)) - * cdef double [:,:] crossctr = np.zeros((nshells1,maxdt)) # <<<<<<<<<<<<<< - * cdef double t1 - * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shelldt1 + /* "View.MemoryView":1134 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< + * + * @cython.cdivision(True) */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1009, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1009, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1009, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1009, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1009, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1009, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_crossctr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - /* "src/helpers/miscellaneous.pyx":1014 + /* "View.MemoryView":1113 * - * #for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t ROLLBACK: Uncomment this, erase below line - * for dt in range(maxdt): # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. */ - __pyx_t_3 = __pyx_v_maxdt; - __pyx_t_9 = __pyx_t_3; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_dt = __pyx_t_10; - /* "src/helpers/miscellaneous.pyx":1015 - * #for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t ROLLBACK: Uncomment this, erase below line - * for dt in range(maxdt): - * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip - */ - __pyx_t_11 = __pyx_v_startingpoints; - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_point = __pyx_t_13; + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":1016 - * for dt in range(maxdt): - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * start = point*startskip - * shellstart1 = ds1[mol,start]-1 +/* "View.MemoryView":1137 + * + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ - __pyx_t_14 = __pyx_v_nmol; - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { - __pyx_v_mol = __pyx_t_16; - /* "src/helpers/miscellaneous.pyx":1017 - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip # <<<<<<<<<<<<<< - * shellstart1 = ds1[mol,start]-1 +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1144 * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] */ - __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); + __pyx_v_src_extent = (__pyx_v_src_shape[0]); - /* "src/helpers/miscellaneous.pyx":1018 - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip - * shellstart1 = ds1[mol,start]-1 # <<<<<<<<<<<<<< - * - * if (shellstart1 < nshells1): + /* "View.MemoryView":1145 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] */ - __pyx_t_17 = __pyx_v_mol; - __pyx_t_18 = __pyx_v_start; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_ds1.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds1.shape[1]; - __pyx_v_shellstart1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_17 * __pyx_v_ds1.strides[0]) ) + __pyx_t_18 * __pyx_v_ds1.strides[1]) ))) - 1); + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - /* "src/helpers/miscellaneous.pyx":1020 - * shellstart1 = ds1[mol,start]-1 - * - * if (shellstart1 < nshells1): # <<<<<<<<<<<<<< - * ctr[shellstart1,dt] += 1 + /* "View.MemoryView":1146 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] * */ - __pyx_t_19 = ((__pyx_v_shellstart1 < __pyx_v_nshells1) != 0); - if (__pyx_t_19) { + __pyx_v_src_stride = (__pyx_v_src_strides[0]); - /* "src/helpers/miscellaneous.pyx":1021 - * - * if (shellstart1 < nshells1): - * ctr[shellstart1,dt] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1147 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< * - * t1 = 0 + * if ndim == 1: */ - __pyx_t_18 = __pyx_v_shellstart1; - __pyx_t_17 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_ctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_18 * __pyx_v_ctr.strides[0]) ) + __pyx_t_17 * __pyx_v_ctr.strides[1]) )) += 1.0; + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); - /* "src/helpers/miscellaneous.pyx":1023 - * ctr[shellstart1,dt] += 1 + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * t1 = 0 # <<<<<<<<<<<<<< - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): */ - __pyx_v_t1 = 0.0; + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":1024 + /* "View.MemoryView":1150 * - * t1 = 0 - * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< - * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] - * corr[shellstart1,dt] += t1 # l=1 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - for (__pyx_t_20 = 0; __pyx_t_20 < 3; __pyx_t_20+=1) { - __pyx_v_k = __pyx_t_20; + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } - /* "src/helpers/miscellaneous.pyx":1025 - * t1 = 0 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] # <<<<<<<<<<<<<< - * corr[shellstart1,dt] += t1 # l=1 - * + /* "View.MemoryView":1151 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: */ - __pyx_t_17 = __pyx_v_mol; - __pyx_t_18 = __pyx_v_start; - __pyx_t_21 = __pyx_v_k; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[2]; - __pyx_t_22 = __pyx_v_mol; - __pyx_t_23 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_24 = __pyx_v_k; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[2]; - __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_17 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_18 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_22 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_24 * __pyx_v_rotTs.strides[2]) ))))); - } + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; - /* "src/helpers/miscellaneous.pyx":1026 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] - * corr[shellstart1,dt] += t1 # l=1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1150 * - * shelldt1 = ds1[mol,start+dt]-1 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - __pyx_t_24 = __pyx_v_shellstart1; - __pyx_t_23 = __pyx_v_dt; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_24 * __pyx_v_corr.strides[0]) ) + __pyx_t_23 * __pyx_v_corr.strides[1]) )) += __pyx_v_t1; + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":1028 - * corr[shellstart1,dt] += t1 # l=1 - * - * shelldt1 = ds1[mol,start+dt]-1 # <<<<<<<<<<<<<< - * if (shellstart1 == shelldt1): - * selfctr[shellstart1,dt] += 1 + /* "View.MemoryView":1152 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): */ - __pyx_t_23 = __pyx_v_mol; - __pyx_t_24 = (__pyx_v_start + __pyx_v_dt); - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_ds1.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ds1.shape[1]; - __pyx_v_shelldt1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_23 * __pyx_v_ds1.strides[0]) ) + __pyx_t_24 * __pyx_v_ds1.strides[1]) ))) - 1); + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); - /* "src/helpers/miscellaneous.pyx":1029 + /* "View.MemoryView":1150 * - * shelldt1 = ds1[mol,start+dt]-1 - * if (shellstart1 == shelldt1): # <<<<<<<<<<<<<< - * selfctr[shellstart1,dt] += 1 - * selfcorr[shellstart1,dt] += t1 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - __pyx_t_19 = ((__pyx_v_shellstart1 == __pyx_v_shelldt1) != 0); - if (__pyx_t_19) { + goto __pyx_L4; + } - /* "src/helpers/miscellaneous.pyx":1030 - * shelldt1 = ds1[mol,start+dt]-1 - * if (shellstart1 == shelldt1): - * selfctr[shellstart1,dt] += 1 # <<<<<<<<<<<<<< - * selfcorr[shellstart1,dt] += t1 - * + /* "View.MemoryView":1154 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride */ - __pyx_t_24 = __pyx_v_shellstart1; - __pyx_t_23 = __pyx_v_dt; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_24 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_23 * __pyx_v_selfctr.strides[1]) )) += 1.0; + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "src/helpers/miscellaneous.pyx":1031 - * if (shellstart1 == shelldt1): - * selfctr[shellstart1,dt] += 1 - * selfcorr[shellstart1,dt] += t1 # <<<<<<<<<<<<<< - * - * for i in range(nshells1): + /* "View.MemoryView":1155 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride */ - __pyx_t_23 = __pyx_v_shellstart1; - __pyx_t_24 = __pyx_v_dt; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_23 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[1]) )) += __pyx_v_t1; + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); - /* "src/helpers/miscellaneous.pyx":1029 - * - * shelldt1 = ds1[mol,start+dt]-1 - * if (shellstart1 == shelldt1): # <<<<<<<<<<<<<< - * selfctr[shellstart1,dt] += 1 - * selfcorr[shellstart1,dt] += t1 + /* "View.MemoryView":1156 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: */ - } + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "src/helpers/miscellaneous.pyx":1020 - * shellstart1 = ds1[mol,start]-1 - * - * if (shellstart1 < nshells1): # <<<<<<<<<<<<<< - * ctr[shellstart1,dt] += 1 - * + /* "View.MemoryView":1157 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): */ - } + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); } } - } + __pyx_L4:; - /* "src/helpers/miscellaneous.pyx":1033 - * selfcorr[shellstart1,dt] += t1 + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * for i in range(nshells1): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * if ctr[i,j] != 0: + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): */ - __pyx_t_3 = __pyx_v_nshells1; - __pyx_t_9 = __pyx_t_3; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; + goto __pyx_L3; + } - /* "src/helpers/miscellaneous.pyx":1034 - * - * for i in range(nshells1): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * if ctr[i,j] != 0: - * corr[i,j] /= ctr[i,j] + /* "View.MemoryView":1159 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, */ - __pyx_t_11 = __pyx_v_maxdt; - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_j = __pyx_t_13; + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "src/helpers/miscellaneous.pyx":1035 - * for i in range(nshells1): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * corr[i,j] /= ctr[i,j] - * else: + /* "View.MemoryView":1160 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, */ - __pyx_t_24 = __pyx_v_i; - __pyx_t_23 = __pyx_v_j; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ctr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_ctr.shape[1]; - __pyx_t_19 = (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_24 * __pyx_v_ctr.strides[0]) ) + __pyx_t_23 * __pyx_v_ctr.strides[1]) ))) != 0.0) != 0); - if (__pyx_t_19) { + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - /* "src/helpers/miscellaneous.pyx":1036 - * for j in range(maxdt): - * if ctr[i,j] != 0: - * corr[i,j] /= ctr[i,j] # <<<<<<<<<<<<<< - * else: - * print 'tot too sparse' + /* "View.MemoryView":1164 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * */ - __pyx_t_23 = __pyx_v_i; - __pyx_t_24 = __pyx_v_j; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_ctr.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ctr.shape[1]; - __pyx_t_22 = __pyx_v_i; - __pyx_t_21 = __pyx_v_j; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_corr.shape[0]; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_22 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_23 * __pyx_v_ctr.strides[0]) ) + __pyx_t_24 * __pyx_v_ctr.strides[1]) ))); + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "src/helpers/miscellaneous.pyx":1035 - * for i in range(nshells1): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * corr[i,j] /= ctr[i,j] - * else: + /* "View.MemoryView":1165 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, */ - goto __pyx_L17; - } + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":1038 - * corr[i,j] /= ctr[i,j] - * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< - * if selfctr[i,j] != 0: - * selfcorr[i,j] /= selfctr[i,j] + /* "View.MemoryView":1137 + * + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 1038, __pyx_L1_error) - } - __pyx_L17:; - /* "src/helpers/miscellaneous.pyx":1039 - * else: - * print 'tot too sparse' - * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< - * selfcorr[i,j] /= selfctr[i,j] - * else: - */ - __pyx_t_24 = __pyx_v_i; - __pyx_t_23 = __pyx_v_j; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfctr.shape[1]; - __pyx_t_19 = (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_24 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_23 * __pyx_v_selfctr.strides[1]) ))) != 0.0) != 0); - if (__pyx_t_19) { + /* function exit code */ +} - /* "src/helpers/miscellaneous.pyx":1040 - * print 'tot too sparse' - * if selfctr[i,j] != 0: - * selfcorr[i,j] /= selfctr[i,j] # <<<<<<<<<<<<<< - * else: - * print 'self too sparse' +/* "View.MemoryView":1167 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ - __pyx_t_23 = __pyx_v_i; - __pyx_t_24 = __pyx_v_j; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfctr.shape[1]; - __pyx_t_21 = __pyx_v_i; - __pyx_t_22 = __pyx_v_j; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_selfcorr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_21 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_22 * __pyx_v_selfcorr.strides[1]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_23 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_24 * __pyx_v_selfctr.strides[1]) ))); - /* "src/helpers/miscellaneous.pyx":1039 - * else: - * print 'tot too sparse' - * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< - * selfcorr[i,j] /= selfctr[i,j] - * else: - */ - goto __pyx_L18; - } +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - /* "src/helpers/miscellaneous.pyx":1042 - * selfcorr[i,j] /= selfctr[i,j] - * else: - * print 'self too sparse' # <<<<<<<<<<<<<< + /* "View.MemoryView":1170 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) * - * for i in range(nshells1): */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_self_too_sparse) < 0) __PYX_ERR(0, 1042, __pyx_L1_error) - } - __pyx_L18:; - } - } + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); - /* "src/helpers/miscellaneous.pyx":1044 - * print 'self too sparse' + /* "View.MemoryView":1167 + * dst_data += dst_stride * - * for i in range(nshells1): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ - __pyx_t_3 = __pyx_v_nshells1; - __pyx_t_9 = __pyx_t_3; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_i = __pyx_t_10; - /* "src/helpers/miscellaneous.pyx":1045 - * - * for i in range(nshells1): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] - * crosscorr[i,j] = corr[i,j] - selfcorr[i,j] - */ - __pyx_t_11 = __pyx_v_maxdt; - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_j = __pyx_t_13; + /* function exit code */ +} - /* "src/helpers/miscellaneous.pyx":1046 - * for i in range(nshells1): - * for j in range(maxdt): - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] # <<<<<<<<<<<<<< - * crosscorr[i,j] = corr[i,j] - selfcorr[i,j] +/* "View.MemoryView":1174 * + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ - __pyx_t_24 = __pyx_v_i; - __pyx_t_23 = __pyx_v_j; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ctr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_ctr.shape[1]; - __pyx_t_22 = __pyx_v_i; - __pyx_t_21 = __pyx_v_j; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfctr.shape[1]; - __pyx_t_18 = __pyx_v_i; - __pyx_t_17 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_crossctr.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_crossctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crossctr.data + __pyx_t_18 * __pyx_v_crossctr.strides[0]) ) + __pyx_t_17 * __pyx_v_crossctr.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_24 * __pyx_v_ctr.strides[0]) ) + __pyx_t_23 * __pyx_v_ctr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_22 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfctr.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1047 - * for j in range(maxdt): - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] - * crosscorr[i,j] = corr[i,j] - selfcorr[i,j] # <<<<<<<<<<<<<< +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + + /* "View.MemoryView":1176 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< * - * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr + * for shape in src.shape[:ndim]: */ - __pyx_t_21 = __pyx_v_i; - __pyx_t_22 = __pyx_v_j; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_corr.shape[1]; - __pyx_t_23 = __pyx_v_i; - __pyx_t_24 = __pyx_v_j; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[1]; - __pyx_t_17 = __pyx_v_i; - __pyx_t_18 = __pyx_v_j; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_crosscorr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_crosscorr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crosscorr.data + __pyx_t_17 * __pyx_v_crosscorr.strides[0]) ) + __pyx_t_18 * __pyx_v_crosscorr.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_21 * __pyx_v_corr.strides[0]) ) + __pyx_t_22 * __pyx_v_corr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_23 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[1]) )))); - } - } + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":1049 - * crosscorr[i,j] = corr[i,j] - selfcorr[i,j] + /* "View.MemoryView":1178 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize * - * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr # <<<<<<<<<<<<<< + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_selfcorr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_crosscorr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_selfctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_25 = __pyx_memoryview_fromslice(__pyx_v_crossctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - __pyx_t_26 = PyTuple_New(6); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_26); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_26, 2, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_26, 3, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_26, 4, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_25); - PyTuple_SET_ITEM(__pyx_t_26, 5, __pyx_t_25); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_25 = 0; - __pyx_r = __pyx_t_26; - __pyx_t_26 = 0; + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); + + /* "View.MemoryView":1179 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< + * + * return size + */ + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } + + /* "View.MemoryView":1181 + * size *= shape + * + * return size # <<<<<<<<<<<<<< + * + * @cname('__pyx_fill_contig_strides_array') + */ + __pyx_r = __pyx_v_size; goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":995 + /* "View.MemoryView":1174 * - * @cython.boundscheck(False) - * def multiVecShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, long nshells1, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * """ - * rotTs ... (nmol, n (time length), 3D) + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ /* function exit code */ - __pyx_L1_error:; - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_25); - __Pyx_XDECREF(__pyx_t_26); - __Pyx_AddTraceback("newanalysis.miscellaneous.multiVecShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_corr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_selfcorr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_crosscorr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_selfctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_crossctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rotTs, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds1, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1052 +/* "View.MemoryView":1184 * - * @cython.boundscheck(False) - * def multiVecVennShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * """ - * rotTs ... (nmol, n (time length), 3D) + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_59multiVecVennShellCorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_58multiVecVennShellCorrelate[] = "\n rotTs ... (nmol, n (time length), 3D)\n (,self,cross)coor ... (shell1, shell2, n (time length))\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_59multiVecVennShellCorrelate = {"multiVecVennShellCorrelate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_59multiVecVennShellCorrelate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_58multiVecVennShellCorrelate}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_59multiVecVennShellCorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_v_nshells1; - long __pyx_v_nshells2; - long __pyx_v_maxdt; - long __pyx_v_startingpoints; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("multiVecVennShellCorrelate (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_nshells1,&__pyx_n_s_nshells2,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rotTs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 1); __PYX_ERR(0, 1052, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 2); __PYX_ERR(0, 1052, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 3); __PYX_ERR(0, 1052, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 4); __PYX_ERR(0, 1052, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxdt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 5); __PYX_ERR(0, 1052, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startingpoints)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 6); __PYX_ERR(0, 1052, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "multiVecVennShellCorrelate") < 0)) __PYX_ERR(0, 1052, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1193 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride + */ + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { + + /* "View.MemoryView":1194 + * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] + */ + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; + + /* "View.MemoryView":1195 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: + */ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1196 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): + */ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } - __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 1052, __pyx_L3_error) - __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 1052, __pyx_L3_error) - __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 1052, __pyx_L3_error) - __pyx_v_nshells1 = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_nshells1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1052, __pyx_L3_error) - __pyx_v_nshells2 = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_nshells2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1052, __pyx_L3_error) - __pyx_v_maxdt = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1052, __pyx_L3_error) - __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1052, __pyx_L3_error) + + /* "View.MemoryView":1193 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride + */ + goto __pyx_L3; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1052, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.multiVecVennShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_58multiVecVennShellCorrelate(__pyx_self, __pyx_v_rotTs, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_nshells1, __pyx_v_nshells2, __pyx_v_maxdt, __pyx_v_startingpoints); + + /* "View.MemoryView":1198 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] + */ + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; + + /* "View.MemoryView":1199 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * + */ + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + + /* "View.MemoryView":1200 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * + * return stride + */ + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + } + __pyx_L3:; + + /* "View.MemoryView":1202 + * stride *= shape[idx] + * + * return stride # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_data_to_temp') + */ + __pyx_r = __pyx_v_stride; + goto __pyx_L0; + + /* "View.MemoryView":1184 + * + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_58multiVecVennShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, long __pyx_v_nshells1, long __pyx_v_nshells2, long __pyx_v_maxdt, long __pyx_v_startingpoints) { - long __pyx_v_nmol; - long __pyx_v_n; - long __pyx_v_startskip; - __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_selfcorr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_crosscorr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_selfctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_crossctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_t1; - long __pyx_v_i; - long __pyx_v_j; - long __pyx_v_k; - long __pyx_v_l; - long __pyx_v_start; - long __pyx_v_point; - long __pyx_v_dt; - long __pyx_v_mol; - long __pyx_v_shellstart1; - long __pyx_v_shellstart2; - long __pyx_v_shelldt1; - long __pyx_v_shelldt2; - PyObject *__pyx_r = NULL; +/* "View.MemoryView":1205 + * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, + */ + +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_11; - long __pyx_t_12; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - long __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - Py_ssize_t __pyx_t_23; - long __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - PyObject *__pyx_t_31 = NULL; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("multiVecVennShellCorrelate", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("copy_data_to_temp", 1); - /* "src/helpers/miscellaneous.pyx":1058 - * """ + /* "View.MemoryView":1216 + * cdef void *result + * + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) * - * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< - * cdef long n = len(rotTs[0]) # number of time steps - * cdef long startskip = (n-maxdt)/startingpoints */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); - __pyx_v_nmol = ((long)__pyx_t_1); + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":1059 + /* "View.MemoryView":1217 * - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:] corr = np.zeros((nshells1,nshells2,maxdt)) + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) */ - __pyx_t_2.data = __pyx_v_rotTs.data; - __pyx_t_2.memview = __pyx_v_rotTs.memview; - __PYX_INC_MEMVIEW(&__pyx_t_2, 0); - { - Py_ssize_t __pyx_tmp_idx = 0; - Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; -} + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); -__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; -__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; - __pyx_t_2.suboffsets[0] = -1; + /* "View.MemoryView":1219 + * cdef size_t size = slice_get_size(src, ndim) + * + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() + */ + __pyx_v_result = malloc(__pyx_v_size); -__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; -__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; - __pyx_t_2.suboffsets[1] = -1; + /* "View.MemoryView":1220 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * + */ + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { -__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - __pyx_v_n = ((long)__pyx_t_1); + /* "View.MemoryView":1221 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1060 - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps - * cdef long startskip = (n-maxdt)/startingpoints # <<<<<<<<<<<<<< - * cdef double [:,:,:] corr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] selfcorr = np.zeros((nshells1,nshells2,maxdt)) + /* "View.MemoryView":1220 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * */ - __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); - if (unlikely(__pyx_v_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1060, __pyx_L1_error) } - else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1060, __pyx_L1_error) - } - __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - /* "src/helpers/miscellaneous.pyx":1061 - * cdef long n = len(rotTs[0]) # number of time steps - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:] corr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:,:] selfcorr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] crosscorr = np.zeros((nshells1,nshells2,maxdt)) + /* "View.MemoryView":1224 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1061, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1061, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1061, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1061, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1061, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1061, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1061, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_corr = __pyx_t_10; - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - /* "src/helpers/miscellaneous.pyx":1062 - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:] corr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] selfcorr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:,:] crosscorr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries + /* "View.MemoryView":1225 + * + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; + + /* "View.MemoryView":1226 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 + */ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "View.MemoryView":1227 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 + * + */ + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + + /* "View.MemoryView":1228 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) + */ + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1062, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_selfcorr = __pyx_t_10; - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; - /* "src/helpers/miscellaneous.pyx":1063 - * cdef double [:,:,:] corr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] selfcorr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] crosscorr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries - * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) + /* "View.MemoryView":1230 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1063, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1063, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1063, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1063, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1063, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1063, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_8); - __pyx_t_9 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1063, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_crosscorr = __pyx_t_10; - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - /* "src/helpers/miscellaneous.pyx":1064 - * cdef double [:,:,:] selfcorr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] crosscorr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< - * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) + /* "View.MemoryView":1233 + * + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_7); - __pyx_t_5 = 0; - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ctr = __pyx_t_10; - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "src/helpers/miscellaneous.pyx":1065 - * cdef double [:,:,:] crosscorr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries - * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double t1 + /* "View.MemoryView":1234 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_8); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_selfctr = __pyx_t_10; - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1066 - * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries - * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< - * cdef double t1 - * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 + /* "View.MemoryView":1235 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< + * + * if slice_is_contig(src[0], order, ndim): */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7); - __pyx_t_9 = 0; - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_crossctr = __pyx_t_10; - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - /* "src/helpers/miscellaneous.pyx":1070 - * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 + /* "View.MemoryView":1234 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_3 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_12 > 0) - { - #ifdef _OPENMP - #pragma omp parallel reduction(+:__pyx_v_t1) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shelldt1) lastprivate(__pyx_v_shelldt2) lastprivate(__pyx_v_shellstart1) lastprivate(__pyx_v_shellstart2) lastprivate(__pyx_v_start) - #endif /* _OPENMP */ - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){ - { - __pyx_v_dt = (long)(0 + 1 * __pyx_t_11); - /* Initialize private variables to invalid values */ - __pyx_v_k = ((long)0xbad0bad0); - __pyx_v_mol = ((long)0xbad0bad0); - __pyx_v_point = ((long)0xbad0bad0); - __pyx_v_shelldt1 = ((long)0xbad0bad0); - __pyx_v_shelldt2 = ((long)0xbad0bad0); - __pyx_v_shellstart1 = ((long)0xbad0bad0); - __pyx_v_shellstart2 = ((long)0xbad0bad0); - __pyx_v_start = ((long)0xbad0bad0); + } + } - /* "src/helpers/miscellaneous.pyx":1071 + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - __pyx_t_13 = __pyx_v_startingpoints; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_point = __pyx_t_15; + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1072 - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * start = point*startskip - * shellstart1 = ds1[mol,start]-1 + /* "View.MemoryView":1238 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) */ - __pyx_t_16 = __pyx_v_nmol; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_mol = __pyx_t_18; + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - /* "src/helpers/miscellaneous.pyx":1073 - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip # <<<<<<<<<<<<<< - * shellstart1 = ds1[mol,start]-1 - * shellstart2 = ds2[mol,start]-1 + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); + goto __pyx_L9; + } - /* "src/helpers/miscellaneous.pyx":1074 - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip - * shellstart1 = ds1[mol,start]-1 # <<<<<<<<<<<<<< - * shellstart2 = ds2[mol,start]-1 - * if (shellstart1 < nshells1) and (shellstart2 < nshells2): + /* "View.MemoryView":1240 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * + * return result */ - __pyx_t_19 = __pyx_v_mol; - __pyx_t_20 = __pyx_v_start; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds1.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds1.shape[1]; - __pyx_v_shellstart1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_19 * __pyx_v_ds1.strides[0]) ) + __pyx_t_20 * __pyx_v_ds1.strides[1]) ))) - 1); + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; - /* "src/helpers/miscellaneous.pyx":1075 - * start = point*startskip - * shellstart1 = ds1[mol,start]-1 - * shellstart2 = ds2[mol,start]-1 # <<<<<<<<<<<<<< - * if (shellstart1 < nshells1) and (shellstart2 < nshells2): - * ctr[shellstart1,shellstart2,dt] += 1 + /* "View.MemoryView":1242 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * + * return result # <<<<<<<<<<<<<< + * + * */ - __pyx_t_20 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds2.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds2.shape[1]; - __pyx_v_shellstart2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_20 * __pyx_v_ds2.strides[0]) ) + __pyx_t_19 * __pyx_v_ds2.strides[1]) ))) - 1); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1076 - * shellstart1 = ds1[mol,start]-1 - * shellstart2 = ds2[mol,start]-1 - * if (shellstart1 < nshells1) and (shellstart2 < nshells2): # <<<<<<<<<<<<<< - * ctr[shellstart1,shellstart2,dt] += 1 + /* "View.MemoryView":1205 * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ - __pyx_t_22 = ((__pyx_v_shellstart1 < __pyx_v_nshells1) != 0); - if (__pyx_t_22) { - } else { - __pyx_t_21 = __pyx_t_22; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_22 = ((__pyx_v_shellstart2 < __pyx_v_nshells2) != 0); - __pyx_t_21 = __pyx_t_22; - __pyx_L15_bool_binop_done:; - if (__pyx_t_21) { - /* "src/helpers/miscellaneous.pyx":1077 - * shellstart2 = ds2[mol,start]-1 - * if (shellstart1 < nshells1) and (shellstart2 < nshells2): - * ctr[shellstart1,shellstart2,dt] += 1 # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} + +/* "View.MemoryView":1247 * - * t1 = 0 + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ - __pyx_t_19 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_23 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_ctr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ) + __pyx_t_23 * __pyx_v_ctr.strides[2]) )) += 1.0; - /* "src/helpers/miscellaneous.pyx":1079 - * ctr[shellstart1,shellstart2,dt] += 1 +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_UCS4 __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1249 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< * - * t1 = 0 # <<<<<<<<<<<<<< - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] + * @cname('__pyx_memoryview_err_dim') */ - __pyx_v_t1 = 0.0; + __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 127; + __Pyx_INCREF(__pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_2 += 35; + __Pyx_GIVEREF(__pyx_kp_u_got_differing_extents_in_dimensi); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_got); + __pyx_t_2 += 6; + __Pyx_GIVEREF(__pyx_kp_u_got); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_got); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_and); + __pyx_t_2 += 5; + __Pyx_GIVEREF(__pyx_kp_u_and); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_and); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_2 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__7); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 1249, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1080 + /* "View.MemoryView":1247 * - * t1 = 0 - * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< - * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] - * corr[shellstart1,shellstart2,dt] += t1 # l=1 + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ - for (__pyx_t_24 = 0; __pyx_t_24 < 3; __pyx_t_24+=1) { - __pyx_v_k = __pyx_t_24; - /* "src/helpers/miscellaneous.pyx":1081 - * t1 = 0 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] # <<<<<<<<<<<<<< - * corr[shellstart1,shellstart2,dt] += t1 # l=1 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1252 + * + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * */ - __pyx_t_23 = __pyx_v_mol; - __pyx_t_20 = __pyx_v_start; - __pyx_t_19 = __pyx_v_k; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - __pyx_t_25 = __pyx_v_mol; - __pyx_t_26 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_27 = __pyx_v_k; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[2]; - __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_23 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_25 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_26 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_27 * __pyx_v_rotTs.strides[2]) ))))); - } - /* "src/helpers/miscellaneous.pyx":1082 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] - * corr[shellstart1,shellstart2,dt] += t1 # l=1 # <<<<<<<<<<<<<< +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1253 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< * - * shelldt1 = ds1[mol,start+dt]-1 + * @cname('__pyx_memoryview_err') */ - __pyx_t_27 = __pyx_v_shellstart1; - __pyx_t_26 = __pyx_v_shellstart2; - __pyx_t_25 = __pyx_v_dt; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_corr.shape[1]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_27 * __pyx_v_corr.strides[0]) ) + __pyx_t_26 * __pyx_v_corr.strides[1]) ) + __pyx_t_25 * __pyx_v_corr.strides[2]) )) += __pyx_v_t1; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1253, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1084 - * corr[shellstart1,shellstart2,dt] += t1 # l=1 + /* "View.MemoryView":1252 * - * shelldt1 = ds1[mol,start+dt]-1 # <<<<<<<<<<<<<< - * shelldt2 = ds2[mol,start+dt]-1 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * */ - __pyx_t_25 = __pyx_v_mol; - __pyx_t_26 = (__pyx_v_start + __pyx_v_dt); - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_ds1.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_ds1.shape[1]; - __pyx_v_shelldt1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_25 * __pyx_v_ds1.strides[0]) ) + __pyx_t_26 * __pyx_v_ds1.strides[1]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":1085 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1256 * - * shelldt1 = ds1[mol,start+dt]-1 - * shelldt2 = ds2[mol,start+dt]-1 # <<<<<<<<<<<<<< + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg * - * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): */ - __pyx_t_26 = __pyx_v_mol; - __pyx_t_25 = (__pyx_v_start + __pyx_v_dt); - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_ds2.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_ds2.shape[1]; - __pyx_v_shelldt2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_26 * __pyx_v_ds2.strides[0]) ) + __pyx_t_25 * __pyx_v_ds2.strides[1]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":1087 - * shelldt2 = ds2[mol,start+dt]-1 +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1257 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< * - * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): # <<<<<<<<<<<<<< - * selfctr[shellstart1,shellstart2,dt] += 1 - * selfcorr[shellstart1,shellstart2,dt] += t1 + * @cname('__pyx_memoryview_err_no_memory') */ - __pyx_t_22 = ((__pyx_v_shellstart1 == __pyx_v_shelldt1) != 0); - if (__pyx_t_22) { - } else { - __pyx_t_21 = __pyx_t_22; - goto __pyx_L20_bool_binop_done; - } - __pyx_t_22 = ((__pyx_v_shellstart2 == __pyx_v_shelldt2) != 0); - __pyx_t_21 = __pyx_t_22; - __pyx_L20_bool_binop_done:; - if (__pyx_t_21) { + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1257, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1088 + /* "View.MemoryView":1256 * - * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): - * selfctr[shellstart1,shellstart2,dt] += 1 # <<<<<<<<<<<<<< - * selfcorr[shellstart1,shellstart2,dt] += t1 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg * */ - __pyx_t_25 = __pyx_v_shellstart1; - __pyx_t_26 = __pyx_v_shellstart2; - __pyx_t_27 = __pyx_v_dt; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_selfctr.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_selfctr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_25 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_26 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_27 * __pyx_v_selfctr.strides[2]) )) += 1.0; - /* "src/helpers/miscellaneous.pyx":1089 - * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): - * selfctr[shellstart1,shellstart2,dt] += 1 - * selfcorr[shellstart1,shellstart2,dt] += t1 # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1260 + * + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * - * for i in range(nshells1): */ - __pyx_t_27 = __pyx_v_shellstart1; - __pyx_t_26 = __pyx_v_shellstart2; - __pyx_t_25 = __pyx_v_dt; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_27 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_26 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_25 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t1; - /* "src/helpers/miscellaneous.pyx":1087 - * shelldt2 = ds2[mol,start+dt]-1 +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_no_memory", 0); + + /* "View.MemoryView":1261 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * * - * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): # <<<<<<<<<<<<<< - * selfctr[shellstart1,shellstart2,dt] += 1 - * selfcorr[shellstart1,shellstart2,dt] += t1 */ - } + PyErr_NoMemory(); __PYX_ERR(1, 1261, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1076 - * shellstart1 = ds1[mol,start]-1 - * shellstart2 = ds2[mol,start]-1 - * if (shellstart1 < nshells1) and (shellstart2 < nshells2): # <<<<<<<<<<<<<< - * ctr[shellstart1,shellstart2,dt] += 1 + /* "View.MemoryView":1260 + * + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/helpers/miscellaneous.pyx":1070 - * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1265 * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - /* "src/helpers/miscellaneous.pyx":1091 - * selfcorr[shellstart1,shellstart2,dt] += t1 +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("memoryview_copy_contents", 1); + + /* "View.MemoryView":1273 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + */ + __pyx_v_tmpdata = NULL; + + /* "View.MemoryView":1274 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + */ + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; + + /* "View.MemoryView":1276 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False + */ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + + /* "View.MemoryView":1277 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp + */ + __pyx_v_broadcasting = 0; + + /* "View.MemoryView":1278 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp * - * for i in range(nshells1): # <<<<<<<<<<<<<< - * for l in range(nshells2): - * for j in range(maxdt): */ - __pyx_t_12 = __pyx_v_nshells1; - __pyx_t_11 = __pyx_t_12; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_v_direct_copy = 0; - /* "src/helpers/miscellaneous.pyx":1092 + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp * - * for i in range(nshells1): - * for l in range(nshells2): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * if ctr[i,l,j] != 0: + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ - __pyx_t_13 = __pyx_v_nshells2; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_l = __pyx_t_15; + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1093 - * for i in range(nshells1): - * for l in range(nshells2): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * if ctr[i,l,j] != 0: - * corr[i,l,j] /= ctr[i,l,j] + /* "View.MemoryView":1282 + * + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) */ - __pyx_t_16 = __pyx_v_maxdt; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_j = __pyx_t_18; + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); - /* "src/helpers/miscellaneous.pyx":1094 - * for l in range(nshells2): - * for j in range(maxdt): - * if ctr[i,l,j] != 0: # <<<<<<<<<<<<<< - * corr[i,l,j] /= ctr[i,l,j] - * else: + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp + * + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ - __pyx_t_25 = __pyx_v_i; - __pyx_t_26 = __pyx_v_l; - __pyx_t_27 = __pyx_v_j; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_ctr.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_ctr.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_ctr.shape[2]; - __pyx_t_21 = (((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_25 * __pyx_v_ctr.strides[0]) ) + __pyx_t_26 * __pyx_v_ctr.strides[1]) ) + __pyx_t_27 * __pyx_v_ctr.strides[2]) ))) != 0.0) != 0); - if (__pyx_t_21) { + goto __pyx_L3; + } - /* "src/helpers/miscellaneous.pyx":1095 - * for j in range(maxdt): - * if ctr[i,l,j] != 0: - * corr[i,l,j] /= ctr[i,l,j] # <<<<<<<<<<<<<< - * else: - * print 'tot too sparse' - */ - __pyx_t_27 = __pyx_v_i; - __pyx_t_26 = __pyx_v_l; - __pyx_t_25 = __pyx_v_j; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_ctr.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_ctr.shape[1]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_ctr.shape[2]; - __pyx_t_19 = __pyx_v_i; - __pyx_t_20 = __pyx_v_l; - __pyx_t_23 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_23 * __pyx_v_corr.strides[2]) )) /= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_27 * __pyx_v_ctr.strides[0]) ) + __pyx_t_26 * __pyx_v_ctr.strides[1]) ) + __pyx_t_25 * __pyx_v_ctr.strides[2]) ))); - - /* "src/helpers/miscellaneous.pyx":1094 - * for l in range(nshells2): - * for j in range(maxdt): - * if ctr[i,l,j] != 0: # <<<<<<<<<<<<<< - * corr[i,l,j] /= ctr[i,l,j] - * else: + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * */ - goto __pyx_L30; - } + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1097 - * corr[i,l,j] /= ctr[i,l,j] - * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< - * if selfctr[i,l,j] != 0: - * selfcorr[i,l,j] /= selfctr[i,l,j] + /* "View.MemoryView":1284 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + * + * cdef int ndim = max(src_ndim, dst_ndim) */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 1097, __pyx_L1_error) - } - __pyx_L30:; + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - /* "src/helpers/miscellaneous.pyx":1098 - * else: - * print 'tot too sparse' - * if selfctr[i,l,j] != 0: # <<<<<<<<<<<<<< - * selfcorr[i,l,j] /= selfctr[i,l,j] - * else: + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) + * */ - __pyx_t_25 = __pyx_v_i; - __pyx_t_26 = __pyx_v_l; - __pyx_t_27 = __pyx_v_j; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_selfctr.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_selfctr.shape[2]; - __pyx_t_21 = (((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_25 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_26 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_27 * __pyx_v_selfctr.strides[2]) ))) != 0.0) != 0); - if (__pyx_t_21) { - - /* "src/helpers/miscellaneous.pyx":1099 - * print 'tot too sparse' - * if selfctr[i,l,j] != 0: - * selfcorr[i,l,j] /= selfctr[i,l,j] # <<<<<<<<<<<<<< - * else: - * print 'self too sparse' - */ - __pyx_t_27 = __pyx_v_i; - __pyx_t_26 = __pyx_v_l; - __pyx_t_25 = __pyx_v_j; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_selfctr.shape[1]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_selfctr.shape[2]; - __pyx_t_23 = __pyx_v_i; - __pyx_t_20 = __pyx_v_l; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_23 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) /= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_27 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_26 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_25 * __pyx_v_selfctr.strides[2]) ))); + } + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":1098 - * else: - * print 'tot too sparse' - * if selfctr[i,l,j] != 0: # <<<<<<<<<<<<<< - * selfcorr[i,l,j] /= selfctr[i,l,j] - * else: + /* "View.MemoryView":1286 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * + * for i in range(ndim): */ - goto __pyx_L31; - } + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; - /* "src/helpers/miscellaneous.pyx":1101 - * selfcorr[i,l,j] /= selfctr[i,l,j] - * else: - * print 'self too sparse' # <<<<<<<<<<<<<< + /* "View.MemoryView":1288 + * cdef int ndim = max(src_ndim, dst_ndim) * - * for i in range(nshells1): + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_self_too_sparse) < 0) __PYX_ERR(0, 1101, __pyx_L1_error) - } - __pyx_L31:; + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1289 + * + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True + */ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { + + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 + */ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1291 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: + */ + __pyx_v_broadcasting = 1; + + /* "View.MemoryView":1292 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) + */ + (__pyx_v_src.strides[__pyx_v_i]) = 0; + + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 + */ + goto __pyx_L7; } - } - } - /* "src/helpers/miscellaneous.pyx":1103 - * print 'self too sparse' + /* "View.MemoryView":1294 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< * - * for i in range(nshells1): # <<<<<<<<<<<<<< - * for l in range(nshells2): - * for j in range(maxdt): + * if src.suboffsets[i] >= 0: */ - __pyx_t_12 = __pyx_v_nshells1; - __pyx_t_11 = __pyx_t_12; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1294, __pyx_L1_error) + } + __pyx_L7:; - /* "src/helpers/miscellaneous.pyx":1104 + /* "View.MemoryView":1289 * - * for i in range(nshells1): - * for l in range(nshells2): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ - __pyx_t_13 = __pyx_v_nshells2; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_l = __pyx_t_15; + } - /* "src/helpers/miscellaneous.pyx":1105 - * for i in range(nshells1): - * for l in range(nshells2): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] - * crosscorr[i,l,j] = corr[i,l,j] - selfcorr[i,l,j] + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * */ - __pyx_t_16 = __pyx_v_maxdt; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_j = __pyx_t_18; + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1106 - * for l in range(nshells2): - * for j in range(maxdt): - * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] # <<<<<<<<<<<<<< - * crosscorr[i,l,j] = corr[i,l,j] - selfcorr[i,l,j] + /* "View.MemoryView":1297 + * + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< * + * if slices_overlap(&src, &dst, ndim, itemsize): */ - __pyx_t_25 = __pyx_v_i; - __pyx_t_26 = __pyx_v_l; - __pyx_t_27 = __pyx_v_j; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_ctr.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_ctr.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_ctr.shape[2]; - __pyx_t_19 = __pyx_v_i; - __pyx_t_20 = __pyx_v_l; - __pyx_t_23 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfctr.shape[2]; - __pyx_t_28 = __pyx_v_i; - __pyx_t_29 = __pyx_v_l; - __pyx_t_30 = __pyx_v_j; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_crossctr.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_crossctr.shape[1]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_crossctr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crossctr.data + __pyx_t_28 * __pyx_v_crossctr.strides[0]) ) + __pyx_t_29 * __pyx_v_crossctr.strides[1]) ) + __pyx_t_30 * __pyx_v_crossctr.strides[2]) )) = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_25 * __pyx_v_ctr.strides[0]) ) + __pyx_t_26 * __pyx_v_ctr.strides[1]) ) + __pyx_t_27 * __pyx_v_ctr.strides[2]) ))) - (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_19 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_23 * __pyx_v_selfctr.strides[2]) )))); + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1107 - * for j in range(maxdt): - * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] - * crosscorr[i,l,j] = corr[i,l,j] - selfcorr[i,l,j] # <<<<<<<<<<<<<< + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr */ - __pyx_t_23 = __pyx_v_i; - __pyx_t_20 = __pyx_v_l; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; - __pyx_t_27 = __pyx_v_i; - __pyx_t_26 = __pyx_v_l; - __pyx_t_25 = __pyx_v_j; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_selfcorr.shape[2]; - __pyx_t_30 = __pyx_v_i; - __pyx_t_29 = __pyx_v_l; - __pyx_t_28 = __pyx_v_j; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_crosscorr.shape[0]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_crosscorr.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_crosscorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crosscorr.data + __pyx_t_30 * __pyx_v_crosscorr.strides[0]) ) + __pyx_t_29 * __pyx_v_crosscorr.strides[1]) ) + __pyx_t_28 * __pyx_v_crosscorr.strides[2]) )) = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) ))) - (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_27 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_26 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_25 * __pyx_v_selfcorr.strides[2]) )))); - } } } - /* "src/helpers/miscellaneous.pyx":1109 - * crosscorr[i,l,j] = corr[i,l,j] - selfcorr[i,l,j] + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr # <<<<<<<<<<<<<< + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * if not slice_is_contig(src, order, ndim): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_selfcorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_crosscorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_selfctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_crossctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_31 = PyTuple_New(6); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_31); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_31, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_31, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_31, 2, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_31, 3, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_31, 4, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_31, 5, __pyx_t_9); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_r = __pyx_t_31; - __pyx_t_31 = 0; - goto __pyx_L0; + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1052 + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) * - * @cython.boundscheck(False) - * def multiVecVennShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * """ - * rotTs ... (nmol, n (time length), 3D) */ + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { - /* function exit code */ - __pyx_L1_error:; - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); - __Pyx_XDECREF(__pyx_t_31); - __Pyx_AddTraceback("newanalysis.miscellaneous.multiVecVennShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_corr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_selfcorr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_crosscorr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_selfctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_crossctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rotTs, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds2, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/miscellaneous.pyx":1112 + /* "View.MemoryView":1302 * - * @cython.boundscheck(False) - * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) */ + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_61rotationMatrixVennShellCorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_61rotationMatrixVennShellCorrelate = {"rotationMatrixVennShellCorrelate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_61rotationMatrixVennShellCorrelate, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_61rotationMatrixVennShellCorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_v_nshells1; - long __pyx_v_nshells2; - long __pyx_v_maxdt; - long __pyx_v_startingpoints; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("rotationMatrixVennShellCorrelate (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_nshells1,&__pyx_n_s_nshells2,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rotTs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 1); __PYX_ERR(0, 1112, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 2); __PYX_ERR(0, 1112, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 3); __PYX_ERR(0, 1112, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 4); __PYX_ERR(0, 1112, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxdt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 5); __PYX_ERR(0, 1112, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startingpoints)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 6); __PYX_ERR(0, 1112, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotationMatrixVennShellCorrelate") < 0)) __PYX_ERR(0, 1112, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) + * + */ } - __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 1112, __pyx_L3_error) - __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 1112, __pyx_L3_error) - __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 1112, __pyx_L3_error) - __pyx_v_nshells1 = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_nshells1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1112, __pyx_L3_error) - __pyx_v_nshells2 = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_nshells2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1112, __pyx_L3_error) - __pyx_v_maxdt = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1112, __pyx_L3_error) - __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1112, __pyx_L3_error) + + /* "View.MemoryView":1304 + * order = get_best_order(&dst, ndim) + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp + * + */ + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1304, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; + + /* "View.MemoryView":1305 + * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: + */ + __pyx_v_src = __pyx_v_tmp; + + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): + */ } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1112, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.rotationMatrixVennShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_60rotationMatrixVennShellCorrelate(__pyx_self, __pyx_v_rotTs, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_nshells1, __pyx_v_nshells2, __pyx_v_maxdt, __pyx_v_startingpoints); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_60rotationMatrixVennShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, long __pyx_v_nshells1, long __pyx_v_nshells2, long __pyx_v_maxdt, long __pyx_v_startingpoints) { - long __pyx_v_nmol; - long __pyx_v_n; - long __pyx_v_startskip; - __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_selfcorr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_crosscorr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_selfctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_crossctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_t1; - double __pyx_v_t2; - double __pyx_v_t3; - double __pyx_v_t4; - double __pyx_v_t5; - double __pyx_v_t6; - long __pyx_v_i; - long __pyx_v_j; - long __pyx_v_k; - long __pyx_v_l; - long __pyx_v_start; - long __pyx_v_point; - long __pyx_v_dt; - long __pyx_v_mol; - long __pyx_v_shellstart1; - long __pyx_v_shellstart2; - long __pyx_v_shelldt1; - long __pyx_v_shelldt2; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_11; - long __pyx_t_12; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - long __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - Py_ssize_t __pyx_t_23; - double __pyx_t_24; - double __pyx_t_25; - double __pyx_t_26; - double __pyx_t_27; - double __pyx_t_28; - double __pyx_t_29; - long __pyx_t_30; - Py_ssize_t __pyx_t_31; - Py_ssize_t __pyx_t_32; - Py_ssize_t __pyx_t_33; - Py_ssize_t __pyx_t_34; - Py_ssize_t __pyx_t_35; - Py_ssize_t __pyx_t_36; - Py_ssize_t __pyx_t_37; - Py_ssize_t __pyx_t_38; - Py_ssize_t __pyx_t_39; - PyObject *__pyx_t_40 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("rotationMatrixVennShellCorrelate", 0); - - /* "src/helpers/miscellaneous.pyx":1113 - * @cython.boundscheck(False) - * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< - * cdef long n = len(rotTs[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array - */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); - __pyx_v_nmol = ((long)__pyx_t_1); - - /* "src/helpers/miscellaneous.pyx":1114 - * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints - */ - __pyx_t_2.data = __pyx_v_rotTs.data; - __pyx_t_2.memview = __pyx_v_rotTs.memview; - __PYX_INC_MEMVIEW(&__pyx_t_2, 0); - { - Py_ssize_t __pyx_tmp_idx = 0; - Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; -__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; - __pyx_t_2.suboffsets[0] = -1; - -__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; -__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; - __pyx_t_2.suboffsets[1] = -1; - -__pyx_t_2.shape[2] = __pyx_v_rotTs.shape[3]; -__pyx_t_2.strides[2] = __pyx_v_rotTs.strides[3]; - __pyx_t_2.suboffsets[2] = -1; - -__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - __pyx_v_n = ((long)__pyx_t_1); - - /* "src/helpers/miscellaneous.pyx":1116 - * cdef long n = len(rotTs[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints # <<<<<<<<<<<<<< - * cdef double [:,:,:,:] corr = np.zeros((12,nshells1,nshells2,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:,:,:] selfcorr = np.zeros((12,nshells1,nshells2,maxdt)) - */ - __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); - if (unlikely(__pyx_v_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1116, __pyx_L1_error) - } - else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1116, __pyx_L1_error) - } - __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - - /* "src/helpers/miscellaneous.pyx":1117 - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:,:] corr = np.zeros((12,nshells1,nshells2,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< - * cdef double [:,:,:,:] selfcorr = np.zeros((12,nshells1,nshells2,maxdt)) - * cdef double [:,:,:,:] crosscorr = np.zeros((12,nshells1,nshells2,maxdt)) - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_int_12); - __Pyx_GIVEREF(__pyx_int_12); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_12); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_8); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_corr = __pyx_t_10; - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; - - /* "src/helpers/miscellaneous.pyx":1118 - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:,:] corr = np.zeros((12,nshells1,nshells2,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:,:,:] selfcorr = np.zeros((12,nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:,:,:] crosscorr = np.zeros((12,nshells1,nshells2,maxdt)) - * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_int_12); - __Pyx_GIVEREF(__pyx_int_12); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_12); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1118, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_selfcorr = __pyx_t_10; - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; - - /* "src/helpers/miscellaneous.pyx":1119 - * cdef double [:,:,:,:] corr = np.zeros((12,nshells1,nshells2,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:,:,:] selfcorr = np.zeros((12,nshells1,nshells2,maxdt)) - * cdef double [:,:,:,:] crosscorr = np.zeros((12,nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries - * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) - */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_int_12); - __Pyx_GIVEREF(__pyx_int_12); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_12); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_8); - __pyx_t_9 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1119, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_crosscorr = __pyx_t_10; - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; - - /* "src/helpers/miscellaneous.pyx":1120 - * cdef double [:,:,:,:] selfcorr = np.zeros((12,nshells1,nshells2,maxdt)) - * cdef double [:,:,:,:] crosscorr = np.zeros((12,nshells1,nshells2,maxdt)) - * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< - * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_7); - __pyx_t_5 = 0; - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1120, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ctr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - - /* "src/helpers/miscellaneous.pyx":1121 - * cdef double [:,:,:,:] crosscorr = np.zeros((12,nshells1,nshells2,maxdt)) - * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries - * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double t1,t2,t3,t4,t5,t6 - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_8); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1121, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_selfctr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - - /* "src/helpers/miscellaneous.pyx":1122 - * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries - * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) - * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< - * cdef double t1,t2,t3,t4,t5,t6 - * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 - */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7); - __pyx_t_9 = 0; - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1122, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_crossctr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - - /* "src/helpers/miscellaneous.pyx":1126 - * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 - * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_3 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_12 > 0) - { - #ifdef _OPENMP - #pragma omp parallel reduction(+:__pyx_v_t1) reduction(+:__pyx_v_t2) reduction(+:__pyx_v_t3) reduction(+:__pyx_v_t4) reduction(+:__pyx_v_t5) reduction(+:__pyx_v_t6) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33, __pyx_t_34, __pyx_t_35) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shelldt1) lastprivate(__pyx_v_shelldt2) lastprivate(__pyx_v_shellstart1) lastprivate(__pyx_v_shellstart2) lastprivate(__pyx_v_start) - #endif /* _OPENMP */ - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){ - { - __pyx_v_dt = (long)(0 + 1 * __pyx_t_11); - /* Initialize private variables to invalid values */ - __pyx_v_k = ((long)0xbad0bad0); - __pyx_v_mol = ((long)0xbad0bad0); - __pyx_v_point = ((long)0xbad0bad0); - __pyx_v_shelldt1 = ((long)0xbad0bad0); - __pyx_v_shelldt2 = ((long)0xbad0bad0); - __pyx_v_shellstart1 = ((long)0xbad0bad0); - __pyx_v_shellstart2 = ((long)0xbad0bad0); - __pyx_v_start = ((long)0xbad0bad0); - - /* "src/helpers/miscellaneous.pyx":1127 - * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip - */ - __pyx_t_13 = __pyx_v_startingpoints; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_point = __pyx_t_15; - - /* "src/helpers/miscellaneous.pyx":1128 - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * start = point*startskip - * shellstart1 = ds1[mol,start]-1 - */ - __pyx_t_16 = __pyx_v_nmol; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_mol = __pyx_t_18; - - /* "src/helpers/miscellaneous.pyx":1129 - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip # <<<<<<<<<<<<<< - * shellstart1 = ds1[mol,start]-1 - * shellstart2 = ds2[mol,start]-1 - */ - __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); - - /* "src/helpers/miscellaneous.pyx":1130 - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip - * shellstart1 = ds1[mol,start]-1 # <<<<<<<<<<<<<< - * shellstart2 = ds2[mol,start]-1 - * if (shellstart1 < nshells1) and (shellstart2 < nshells2): - */ - __pyx_t_19 = __pyx_v_mol; - __pyx_t_20 = __pyx_v_start; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds1.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds1.shape[1]; - __pyx_v_shellstart1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_19 * __pyx_v_ds1.strides[0]) ) + __pyx_t_20 * __pyx_v_ds1.strides[1]) ))) - 1); - - /* "src/helpers/miscellaneous.pyx":1131 - * start = point*startskip - * shellstart1 = ds1[mol,start]-1 - * shellstart2 = ds2[mol,start]-1 # <<<<<<<<<<<<<< - * if (shellstart1 < nshells1) and (shellstart2 < nshells2): - * ctr[shellstart1,shellstart2,dt] += 1 - */ - __pyx_t_20 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds2.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds2.shape[1]; - __pyx_v_shellstart2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_20 * __pyx_v_ds2.strides[0]) ) + __pyx_t_19 * __pyx_v_ds2.strides[1]) ))) - 1); - - /* "src/helpers/miscellaneous.pyx":1132 - * shellstart1 = ds1[mol,start]-1 - * shellstart2 = ds2[mol,start]-1 - * if (shellstart1 < nshells1) and (shellstart2 < nshells2): # <<<<<<<<<<<<<< - * ctr[shellstart1,shellstart2,dt] += 1 - * - */ - __pyx_t_22 = ((__pyx_v_shellstart1 < __pyx_v_nshells1) != 0); - if (__pyx_t_22) { - } else { - __pyx_t_21 = __pyx_t_22; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_22 = ((__pyx_v_shellstart2 < __pyx_v_nshells2) != 0); - __pyx_t_21 = __pyx_t_22; - __pyx_L15_bool_binop_done:; - if (__pyx_t_21) { - - /* "src/helpers/miscellaneous.pyx":1133 - * shellstart2 = ds2[mol,start]-1 - * if (shellstart1 < nshells1) and (shellstart2 < nshells2): - * ctr[shellstart1,shellstart2,dt] += 1 # <<<<<<<<<<<<<< - * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 - */ - __pyx_t_19 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_23 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_ctr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ) + __pyx_t_23 * __pyx_v_ctr.strides[2]) )) += 1.0; - - /* "src/helpers/miscellaneous.pyx":1135 - * ctr[shellstart1,shellstart2,dt] += 1 - * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 # <<<<<<<<<<<<<< - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - */ - __pyx_t_24 = 0.0; - __pyx_t_25 = 0.0; - __pyx_t_26 = 0.0; - __pyx_t_27 = 0.0; - __pyx_t_28 = 0.0; - __pyx_t_29 = 0.0; - __pyx_v_t1 = __pyx_t_24; - __pyx_v_t2 = __pyx_t_25; - __pyx_v_t3 = __pyx_t_26; - __pyx_v_t4 = __pyx_t_27; - __pyx_v_t5 = __pyx_t_28; - __pyx_v_t6 = __pyx_t_29; - - /* "src/helpers/miscellaneous.pyx":1136 + /* "View.MemoryView":1310 * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 - * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - */ - for (__pyx_t_30 = 0; __pyx_t_30 < 3; __pyx_t_30+=1) { - __pyx_v_k = __pyx_t_30; - - /* "src/helpers/miscellaneous.pyx":1137 - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] # <<<<<<<<<<<<<< - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - */ - __pyx_t_23 = __pyx_v_mol; - __pyx_t_20 = __pyx_v_start; - __pyx_t_19 = 0; - __pyx_t_31 = __pyx_v_k; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; - __pyx_t_32 = __pyx_v_mol; - __pyx_t_33 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_34 = 0; - __pyx_t_35 = __pyx_v_k; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; - __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_23 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))))); - - /* "src/helpers/miscellaneous.pyx":1138 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - */ - __pyx_t_35 = __pyx_v_mol; - __pyx_t_34 = __pyx_v_start; - __pyx_t_33 = 1; - __pyx_t_32 = __pyx_v_k; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; - __pyx_t_31 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_20 = 1; - __pyx_t_23 = __pyx_v_k; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[3]; - __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[3]) ))))); - - /* "src/helpers/miscellaneous.pyx":1139 - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - */ - __pyx_t_23 = __pyx_v_mol; - __pyx_t_20 = __pyx_v_start; - __pyx_t_19 = 2; - __pyx_t_31 = __pyx_v_k; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; - __pyx_t_32 = __pyx_v_mol; - __pyx_t_33 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_34 = 2; - __pyx_t_35 = __pyx_v_k; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; - __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_23 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))))); - - /* "src/helpers/miscellaneous.pyx":1140 - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - */ - __pyx_t_35 = __pyx_v_mol; - __pyx_t_34 = __pyx_v_start; - __pyx_t_33 = 0; - __pyx_t_32 = __pyx_v_k; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; - __pyx_t_31 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_20 = 1; - __pyx_t_23 = __pyx_v_k; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[3]; - __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[3]) ))))); - - /* "src/helpers/miscellaneous.pyx":1141 - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart1,shellstart2,dt] += t1 # l=1 - */ - __pyx_t_23 = __pyx_v_mol; - __pyx_t_20 = __pyx_v_start; - __pyx_t_19 = 0; - __pyx_t_31 = __pyx_v_k; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[3]; - __pyx_t_32 = __pyx_v_mol; - __pyx_t_33 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_34 = 2; - __pyx_t_35 = __pyx_v_k; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; - __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_23 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_31 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))))); - - /* "src/helpers/miscellaneous.pyx":1142 - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * corr[0,shellstart1,shellstart2,dt] += t1 # l=1 - * corr[1,shellstart1,shellstart2,dt] += t2 - */ - __pyx_t_35 = __pyx_v_mol; - __pyx_t_34 = __pyx_v_start; - __pyx_t_33 = 1; - __pyx_t_32 = __pyx_v_k; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; - __pyx_t_31 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_20 = 2; - __pyx_t_23 = __pyx_v_k; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[3]; - __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_31 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_23 * __pyx_v_rotTs.strides[3]) ))))); - } - - /* "src/helpers/miscellaneous.pyx":1143 - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart1,shellstart2,dt] += t1 # l=1 # <<<<<<<<<<<<<< - * corr[1,shellstart1,shellstart2,dt] += t2 - * corr[2,shellstart1,shellstart2,dt] += t3 - */ - __pyx_t_23 = 0; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_19 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) ) + __pyx_t_31 * __pyx_v_corr.strides[3]) )) += __pyx_v_t1; - - /* "src/helpers/miscellaneous.pyx":1144 - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart1,shellstart2,dt] += t1 # l=1 - * corr[1,shellstart1,shellstart2,dt] += t2 # <<<<<<<<<<<<<< - * corr[2,shellstart1,shellstart2,dt] += t3 - * corr[3,shellstart1,shellstart2,dt] += t4 - */ - __pyx_t_31 = 1; - __pyx_t_19 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_23 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_31 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_23 * __pyx_v_corr.strides[3]) )) += __pyx_v_t2; - - /* "src/helpers/miscellaneous.pyx":1145 - * corr[0,shellstart1,shellstart2,dt] += t1 # l=1 - * corr[1,shellstart1,shellstart2,dt] += t2 - * corr[2,shellstart1,shellstart2,dt] += t3 # <<<<<<<<<<<<<< - * corr[3,shellstart1,shellstart2,dt] += t4 - * corr[4,shellstart1,shellstart2,dt] += t5 - */ - __pyx_t_23 = 2; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_19 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) ) + __pyx_t_31 * __pyx_v_corr.strides[3]) )) += __pyx_v_t3; - - /* "src/helpers/miscellaneous.pyx":1146 - * corr[1,shellstart1,shellstart2,dt] += t2 - * corr[2,shellstart1,shellstart2,dt] += t3 - * corr[3,shellstart1,shellstart2,dt] += t4 # <<<<<<<<<<<<<< - * corr[4,shellstart1,shellstart2,dt] += t5 - * corr[5,shellstart1,shellstart2,dt] += t6 - */ - __pyx_t_31 = 3; - __pyx_t_19 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_23 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_31 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_23 * __pyx_v_corr.strides[3]) )) += __pyx_v_t4; - - /* "src/helpers/miscellaneous.pyx":1147 - * corr[2,shellstart1,shellstart2,dt] += t3 - * corr[3,shellstart1,shellstart2,dt] += t4 - * corr[4,shellstart1,shellstart2,dt] += t5 # <<<<<<<<<<<<<< - * corr[5,shellstart1,shellstart2,dt] += t6 - * corr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # l=2 - */ - __pyx_t_23 = 4; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_19 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) ) + __pyx_t_31 * __pyx_v_corr.strides[3]) )) += __pyx_v_t5; - - /* "src/helpers/miscellaneous.pyx":1148 - * corr[3,shellstart1,shellstart2,dt] += t4 - * corr[4,shellstart1,shellstart2,dt] += t5 - * corr[5,shellstart1,shellstart2,dt] += t6 # <<<<<<<<<<<<<< - * corr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 - */ - __pyx_t_31 = 5; - __pyx_t_19 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_23 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_31 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_23 * __pyx_v_corr.strides[3]) )) += __pyx_v_t6; - - /* "src/helpers/miscellaneous.pyx":1149 - * corr[4,shellstart1,shellstart2,dt] += t5 - * corr[5,shellstart1,shellstart2,dt] += t6 - * corr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # l=2 # <<<<<<<<<<<<<< - * corr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 - */ - __pyx_t_23 = 6; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_19 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) ) + __pyx_t_31 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - - /* "src/helpers/miscellaneous.pyx":1150 - * corr[5,shellstart1,shellstart2,dt] += t6 - * corr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< - * corr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 - */ - __pyx_t_31 = 7; - __pyx_t_19 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_23 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_31 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_23 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); - - /* "src/helpers/miscellaneous.pyx":1151 - * corr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< - * corr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 - */ - __pyx_t_23 = 8; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_19 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) ) + __pyx_t_31 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); - - /* "src/helpers/miscellaneous.pyx":1152 - * corr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< - * corr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 - * corr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 - */ - __pyx_t_31 = 9; - __pyx_t_19 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_23 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_31 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_23 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); - - /* "src/helpers/miscellaneous.pyx":1153 - * corr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< - * corr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ - __pyx_t_23 = 10; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_19 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) ) + __pyx_t_31 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1154 - * corr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 - * corr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< + /* "View.MemoryView":1311 * - * shelldt1 = ds1[mol,start+dt]-1 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) */ - __pyx_t_31 = 11; - __pyx_t_19 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_23 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_31 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_23 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); - /* "src/helpers/miscellaneous.pyx":1156 - * corr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":1310 * - * shelldt1 = ds1[mol,start+dt]-1 # <<<<<<<<<<<<<< - * shelldt2 = ds2[mol,start+dt]-1 * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ - __pyx_t_23 = __pyx_v_mol; - __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_ds1.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds1.shape[1]; - __pyx_v_shelldt1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_23 * __pyx_v_ds1.strides[0]) ) + __pyx_t_20 * __pyx_v_ds1.strides[1]) ))) - 1); + goto __pyx_L12; + } - /* "src/helpers/miscellaneous.pyx":1157 - * - * shelldt1 = ds1[mol,start+dt]-1 - * shelldt2 = ds2[mol,start+dt]-1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): */ - __pyx_t_20 = __pyx_v_mol; - __pyx_t_23 = (__pyx_v_start + __pyx_v_dt); - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds2.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_ds2.shape[1]; - __pyx_v_shelldt2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_20 * __pyx_v_ds2.strides[0]) ) + __pyx_t_23 * __pyx_v_ds2.strides[1]) ))) - 1); + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1159 - * shelldt2 = ds2[mol,start+dt]-1 - * - * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): # <<<<<<<<<<<<<< - * selfctr[shellstart1,shellstart2,dt] += 1 + /* "View.MemoryView":1313 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< * + * if direct_copy: */ - __pyx_t_22 = ((__pyx_v_shellstart1 == __pyx_v_shelldt1) != 0); - if (__pyx_t_22) { - } else { - __pyx_t_21 = __pyx_t_22; - goto __pyx_L20_bool_binop_done; - } - __pyx_t_22 = ((__pyx_v_shellstart2 == __pyx_v_shelldt2) != 0); - __pyx_t_21 = __pyx_t_22; - __pyx_L20_bool_binop_done:; - if (__pyx_t_21) { + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - /* "src/helpers/miscellaneous.pyx":1160 - * - * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): - * selfctr[shellstart1,shellstart2,dt] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * selfcorr[0,shellstart1,shellstart2,dt] += t1 */ - __pyx_t_23 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_19 = __pyx_v_dt; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_23 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfctr.strides[2]) )) += 1.0; + } + __pyx_L12:; - /* "src/helpers/miscellaneous.pyx":1162 - * selfctr[shellstart1,shellstart2,dt] += 1 + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * selfcorr[0,shellstart1,shellstart2,dt] += t1 # <<<<<<<<<<<<<< - * selfcorr[1,shellstart1,shellstart2,dt] += t2 - * selfcorr[2,shellstart1,shellstart2,dt] += t3 - */ - __pyx_t_19 = 0; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_23 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_31 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t1; - - /* "src/helpers/miscellaneous.pyx":1163 + * if direct_copy: # <<<<<<<<<<<<<< * - * selfcorr[0,shellstart1,shellstart2,dt] += t1 - * selfcorr[1,shellstart1,shellstart2,dt] += t2 # <<<<<<<<<<<<<< - * selfcorr[2,shellstart1,shellstart2,dt] += t3 - * selfcorr[3,shellstart1,shellstart2,dt] += t4 - */ - __pyx_t_31 = 1; - __pyx_t_23 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_19 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_31 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t2; - - /* "src/helpers/miscellaneous.pyx":1164 - * selfcorr[0,shellstart1,shellstart2,dt] += t1 - * selfcorr[1,shellstart1,shellstart2,dt] += t2 - * selfcorr[2,shellstart1,shellstart2,dt] += t3 # <<<<<<<<<<<<<< - * selfcorr[3,shellstart1,shellstart2,dt] += t4 - * selfcorr[4,shellstart1,shellstart2,dt] += t5 - */ - __pyx_t_19 = 2; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_23 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_31 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t3; - - /* "src/helpers/miscellaneous.pyx":1165 - * selfcorr[1,shellstart1,shellstart2,dt] += t2 - * selfcorr[2,shellstart1,shellstart2,dt] += t3 - * selfcorr[3,shellstart1,shellstart2,dt] += t4 # <<<<<<<<<<<<<< - * selfcorr[4,shellstart1,shellstart2,dt] += t5 - * selfcorr[5,shellstart1,shellstart2,dt] += t6 - */ - __pyx_t_31 = 3; - __pyx_t_23 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_19 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_31 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t4; - - /* "src/helpers/miscellaneous.pyx":1166 - * selfcorr[2,shellstart1,shellstart2,dt] += t3 - * selfcorr[3,shellstart1,shellstart2,dt] += t4 - * selfcorr[4,shellstart1,shellstart2,dt] += t5 # <<<<<<<<<<<<<< - * selfcorr[5,shellstart1,shellstart2,dt] += t6 - * selfcorr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 - */ - __pyx_t_19 = 4; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_23 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_31 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t5; - - /* "src/helpers/miscellaneous.pyx":1167 - * selfcorr[3,shellstart1,shellstart2,dt] += t4 - * selfcorr[4,shellstart1,shellstart2,dt] += t5 - * selfcorr[5,shellstart1,shellstart2,dt] += t6 # <<<<<<<<<<<<<< - * selfcorr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 - * selfcorr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - __pyx_t_31 = 5; - __pyx_t_23 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_19 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_31 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t6; + if (__pyx_v_direct_copy) { - /* "src/helpers/miscellaneous.pyx":1168 - * selfcorr[4,shellstart1,shellstart2,dt] += t5 - * selfcorr[5,shellstart1,shellstart2,dt] += t6 - * selfcorr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # <<<<<<<<<<<<<< - * selfcorr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 - * selfcorr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 - */ - __pyx_t_19 = 6; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_23 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_31 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - - /* "src/helpers/miscellaneous.pyx":1169 - * selfcorr[5,shellstart1,shellstart2,dt] += t6 - * selfcorr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 - * selfcorr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< - * selfcorr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 - * selfcorr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 - */ - __pyx_t_31 = 7; - __pyx_t_23 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_19 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_31 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); - - /* "src/helpers/miscellaneous.pyx":1170 - * selfcorr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 - * selfcorr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 - * selfcorr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< - * selfcorr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 - * selfcorr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 - */ - __pyx_t_19 = 8; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_23 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_31 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); - - /* "src/helpers/miscellaneous.pyx":1171 - * selfcorr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 - * selfcorr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 - * selfcorr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< - * selfcorr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 - * selfcorr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 - */ - __pyx_t_31 = 9; - __pyx_t_23 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_19 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_31 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); - - /* "src/helpers/miscellaneous.pyx":1172 - * selfcorr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 - * selfcorr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 - * selfcorr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< - * selfcorr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":1317 + * if direct_copy: * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) */ - __pyx_t_19 = 10; - __pyx_t_20 = __pyx_v_shellstart1; - __pyx_t_23 = __pyx_v_shellstart2; - __pyx_t_31 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_31 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "src/helpers/miscellaneous.pyx":1173 - * selfcorr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 - * selfcorr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 - * selfcorr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< + /* "View.MemoryView":1318 * - * for i in range(nshells1): + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) */ - __pyx_t_31 = 11; - __pyx_t_23 = __pyx_v_shellstart1; - __pyx_t_20 = __pyx_v_shellstart2; - __pyx_t_19 = __pyx_v_dt; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_31 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - /* "src/helpers/miscellaneous.pyx":1159 - * shelldt2 = ds2[mol,start+dt]-1 - * - * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): # <<<<<<<<<<<<<< - * selfctr[shellstart1,shellstart2,dt] += 1 - * + /* "View.MemoryView":1319 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 */ - } + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "src/helpers/miscellaneous.pyx":1132 - * shellstart1 = ds1[mol,start]-1 - * shellstart2 = ds2[mol,start]-1 - * if (shellstart1 < nshells1) and (shellstart2 < nshells2): # <<<<<<<<<<<<<< - * ctr[shellstart1,shellstart2,dt] += 1 + /* "View.MemoryView":1320 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 * */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + free(__pyx_v_tmpdata); - /* "src/helpers/miscellaneous.pyx":1126 - * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 + /* "View.MemoryView":1321 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * if order == 'F' == get_best_order(&dst, ndim): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1175 - * selfcorr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * for i in range(nshells1): # <<<<<<<<<<<<<< - * for l in range(nshells2): - * for j in range(maxdt): - */ - __pyx_t_12 = __pyx_v_nshells1; - __pyx_t_11 = __pyx_t_12; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "src/helpers/miscellaneous.pyx":1176 + * if direct_copy: # <<<<<<<<<<<<<< * - * for i in range(nshells1): - * for l in range(nshells2): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * if ctr[i,l,j] != 0: - */ - __pyx_t_13 = __pyx_v_nshells2; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_l = __pyx_t_15; - - /* "src/helpers/miscellaneous.pyx":1177 - * for i in range(nshells1): - * for l in range(nshells2): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * if ctr[i,l,j] != 0: - * for k in range(12): - */ - __pyx_t_16 = __pyx_v_maxdt; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_j = __pyx_t_18; - - /* "src/helpers/miscellaneous.pyx":1178 - * for l in range(nshells2): - * for j in range(maxdt): - * if ctr[i,l,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * corr[k,i,l,j] /= ctr[i,l,j] - */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_20 = __pyx_v_l; - __pyx_t_23 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_ctr.shape[2]; - __pyx_t_21 = (((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ) + __pyx_t_23 * __pyx_v_ctr.strides[2]) ))) != 0.0) != 0); - if (__pyx_t_21) { - - /* "src/helpers/miscellaneous.pyx":1179 - * for j in range(maxdt): - * if ctr[i,l,j] != 0: - * for k in range(12): # <<<<<<<<<<<<<< - * corr[k,i,l,j] /= ctr[i,l,j] - * else: - */ - for (__pyx_t_30 = 0; __pyx_t_30 < 12; __pyx_t_30+=1) { - __pyx_v_k = __pyx_t_30; - - /* "src/helpers/miscellaneous.pyx":1180 - * if ctr[i,l,j] != 0: - * for k in range(12): - * corr[k,i,l,j] /= ctr[i,l,j] # <<<<<<<<<<<<<< - * else: - * print 'tot too sparse' - */ - __pyx_t_23 = __pyx_v_i; - __pyx_t_20 = __pyx_v_l; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_ctr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[2]; - __pyx_t_31 = __pyx_v_k; - __pyx_t_32 = __pyx_v_i; - __pyx_t_33 = __pyx_v_l; - __pyx_t_34 = __pyx_v_j; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[0]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[2]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_31 * __pyx_v_corr.strides[0]) ) + __pyx_t_32 * __pyx_v_corr.strides[1]) ) + __pyx_t_33 * __pyx_v_corr.strides[2]) ) + __pyx_t_34 * __pyx_v_corr.strides[3]) )) /= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_23 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ) + __pyx_t_19 * __pyx_v_ctr.strides[2]) ))); - } - - /* "src/helpers/miscellaneous.pyx":1178 - * for l in range(nshells2): - * for j in range(maxdt): - * if ctr[i,l,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * corr[k,i,l,j] /= ctr[i,l,j] - */ - goto __pyx_L30; - } - - /* "src/helpers/miscellaneous.pyx":1182 - * corr[k,i,l,j] /= ctr[i,l,j] - * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< - * if selfctr[i,l,j] != 0: - * for k in range(12): - */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 1182, __pyx_L1_error) - } - __pyx_L30:; - - /* "src/helpers/miscellaneous.pyx":1183 - * else: - * print 'tot too sparse' - * if selfctr[i,l,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * selfcorr[k,i,l,j] /= selfctr[i,l,j] - */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_20 = __pyx_v_l; - __pyx_t_23 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfctr.shape[2]; - __pyx_t_21 = (((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_19 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_23 * __pyx_v_selfctr.strides[2]) ))) != 0.0) != 0); - if (__pyx_t_21) { - - /* "src/helpers/miscellaneous.pyx":1184 - * print 'tot too sparse' - * if selfctr[i,l,j] != 0: - * for k in range(12): # <<<<<<<<<<<<<< - * selfcorr[k,i,l,j] /= selfctr[i,l,j] - * else: - */ - for (__pyx_t_30 = 0; __pyx_t_30 < 12; __pyx_t_30+=1) { - __pyx_v_k = __pyx_t_30; - - /* "src/helpers/miscellaneous.pyx":1185 - * if selfctr[i,l,j] != 0: - * for k in range(12): - * selfcorr[k,i,l,j] /= selfctr[i,l,j] # <<<<<<<<<<<<<< - * else: - * print 'self too sparse' - */ - __pyx_t_23 = __pyx_v_i; - __pyx_t_20 = __pyx_v_l; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[2]; - __pyx_t_34 = __pyx_v_k; - __pyx_t_33 = __pyx_v_i; - __pyx_t_32 = __pyx_v_l; - __pyx_t_31 = __pyx_v_j; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfcorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_34 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_33 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_32 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_31 * __pyx_v_selfcorr.strides[3]) )) /= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_23 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfctr.strides[2]) ))); - } + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + */ + } - /* "src/helpers/miscellaneous.pyx":1183 - * else: - * print 'tot too sparse' - * if selfctr[i,l,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * selfcorr[k,i,l,j] /= selfctr[i,l,j] + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * */ - goto __pyx_L33; - } + } - /* "src/helpers/miscellaneous.pyx":1187 - * selfcorr[k,i,l,j] /= selfctr[i,l,j] - * else: - * print 'self too sparse' # <<<<<<<<<<<<<< + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * * - * for i in range(nshells1): */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_self_too_sparse) < 0) __PYX_ERR(0, 1187, __pyx_L1_error) - } - __pyx_L33:; - } - } + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); } + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1189 - * print 'self too sparse' + /* "View.MemoryView":1326 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) * - * for i in range(nshells1): # <<<<<<<<<<<<<< - * for l in range(nshells2): - * for j in range(maxdt): */ - __pyx_t_12 = __pyx_v_nshells1; - __pyx_t_11 = __pyx_t_12; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1326, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1190 + /* "View.MemoryView":1327 * - * for i in range(nshells1): - * for l in range(nshells2): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - __pyx_t_13 = __pyx_v_nshells2; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_l = __pyx_t_15; + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1191 - * for i in range(nshells1): - * for l in range(nshells2): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] - * for k in range(12): + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * */ - __pyx_t_16 = __pyx_v_maxdt; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_j = __pyx_t_18; + } - /* "src/helpers/miscellaneous.pyx":1192 - * for l in range(nshells2): - * for j in range(maxdt): - * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] # <<<<<<<<<<<<<< - * for k in range(12): - * crosscorr[k,i,l,j] = corr[k,i,l,j] - selfcorr[k,i,l,j] + /* "View.MemoryView":1329 + * transpose_memslice(&dst) + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_20 = __pyx_v_l; - __pyx_t_23 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_ctr.shape[2]; - __pyx_t_31 = __pyx_v_i; - __pyx_t_32 = __pyx_v_l; - __pyx_t_33 = __pyx_v_j; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfctr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfctr.shape[2]; - __pyx_t_34 = __pyx_v_i; - __pyx_t_35 = __pyx_v_l; - __pyx_t_36 = __pyx_v_j; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_crossctr.shape[0]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_crossctr.shape[1]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_crossctr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crossctr.data + __pyx_t_34 * __pyx_v_crossctr.strides[0]) ) + __pyx_t_35 * __pyx_v_crossctr.strides[1]) ) + __pyx_t_36 * __pyx_v_crossctr.strides[2]) )) = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ) + __pyx_t_23 * __pyx_v_ctr.strides[2]) ))) - (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_31 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_32 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_33 * __pyx_v_selfctr.strides[2]) )))); + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "src/helpers/miscellaneous.pyx":1193 - * for j in range(maxdt): - * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] - * for k in range(12): # <<<<<<<<<<<<<< - * crosscorr[k,i,l,j] = corr[k,i,l,j] - selfcorr[k,i,l,j] + /* "View.MemoryView":1330 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * */ - for (__pyx_t_30 = 0; __pyx_t_30 < 12; __pyx_t_30+=1) { - __pyx_v_k = __pyx_t_30; + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - /* "src/helpers/miscellaneous.pyx":1194 - * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] - * for k in range(12): - * crosscorr[k,i,l,j] = corr[k,i,l,j] - selfcorr[k,i,l,j] # <<<<<<<<<<<<<< + /* "View.MemoryView":1331 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< * - * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr + * free(tmpdata) */ - __pyx_t_33 = __pyx_v_k; - __pyx_t_32 = __pyx_v_i; - __pyx_t_31 = __pyx_v_l; - __pyx_t_23 = __pyx_v_j; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[0]; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[1]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_corr.shape[2]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[3]; - __pyx_t_20 = __pyx_v_k; - __pyx_t_19 = __pyx_v_i; - __pyx_t_36 = __pyx_v_l; - __pyx_t_35 = __pyx_v_j; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_selfcorr.shape[2]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_selfcorr.shape[3]; - __pyx_t_34 = __pyx_v_k; - __pyx_t_37 = __pyx_v_i; - __pyx_t_38 = __pyx_v_l; - __pyx_t_39 = __pyx_v_j; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_crosscorr.shape[0]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_crosscorr.shape[1]; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_crosscorr.shape[2]; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_crosscorr.shape[3]; - *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crosscorr.data + __pyx_t_34 * __pyx_v_crosscorr.strides[0]) ) + __pyx_t_37 * __pyx_v_crosscorr.strides[1]) ) + __pyx_t_38 * __pyx_v_crosscorr.strides[2]) ) + __pyx_t_39 * __pyx_v_crosscorr.strides[3]) )) = ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_33 * __pyx_v_corr.strides[0]) ) + __pyx_t_32 * __pyx_v_corr.strides[1]) ) + __pyx_t_31 * __pyx_v_corr.strides[2]) ) + __pyx_t_23 * __pyx_v_corr.strides[3]) ))) - (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_20 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_36 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_35 * __pyx_v_selfcorr.strides[3]) )))); - } - } - } - } + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "src/helpers/miscellaneous.pyx":1196 - * crosscorr[k,i,l,j] = corr[k,i,l,j] - selfcorr[k,i,l,j] + /* "View.MemoryView":1333 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * - * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr # <<<<<<<<<<<<<< + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 * + */ + free(__pyx_v_tmpdata); + + /* "View.MemoryView":1334 * + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 4, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_selfcorr, 4, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_crosscorr, 4, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_selfctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_crossctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_40 = PyTuple_New(6); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_40); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_40, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_40, 2, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_40, 3, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_40, 4, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_40, 5, __pyx_t_9); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_r = __pyx_t_40; - __pyx_t_40 = 0; + __pyx_r = 0; goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1112 + /* "View.MemoryView":1265 * - * @cython.boundscheck(False) - * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ /* function exit code */ __pyx_L1_error:; - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); - __Pyx_XDECREF(__pyx_t_40); - __Pyx_AddTraceback("newanalysis.miscellaneous.rotationMatrixVennShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_corr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_selfcorr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_crosscorr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_selfctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_crossctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rotTs, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds2, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1200 +/* "View.MemoryView":1337 * - * @cython.boundscheck(False) - * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_63rotationMatrixMultiShellCorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_63rotationMatrixMultiShellCorrelate = {"rotationMatrixMultiShellCorrelate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_63rotationMatrixMultiShellCorrelate, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_63rotationMatrixMultiShellCorrelate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds3 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_v_nshells; - long __pyx_v_maxdt; - long __pyx_v_startingpoints; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("rotationMatrixMultiShellCorrelate (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_ds3,&__pyx_n_s_ds4,&__pyx_n_s_ds5,&__pyx_n_s_nshells,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rotTs)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 1); __PYX_ERR(0, 1200, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 2); __PYX_ERR(0, 1200, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds3)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 3); __PYX_ERR(0, 1200, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds4)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 4); __PYX_ERR(0, 1200, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds5)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 5); __PYX_ERR(0, 1200, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nshells)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 6); __PYX_ERR(0, 1200, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxdt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 7); __PYX_ERR(0, 1200, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startingpoints)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 8); __PYX_ERR(0, 1200, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotationMatrixMultiShellCorrelate") < 0)) __PYX_ERR(0, 1200, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - } - __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) - __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) - __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) - __pyx_v_ds3 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds3.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) - __pyx_v_ds4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds4.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) - __pyx_v_ds5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds5.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) - __pyx_v_nshells = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_nshells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1200, __pyx_L3_error) - __pyx_v_maxdt = __Pyx_PyInt_As_long(values[7]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1200, __pyx_L3_error) - __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[8]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1200, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1200, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.rotationMatrixMultiShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_62rotationMatrixMultiShellCorrelate(__pyx_self, __pyx_v_rotTs, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_ds3, __pyx_v_ds4, __pyx_v_ds5, __pyx_v_nshells, __pyx_v_maxdt, __pyx_v_startingpoints); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_62rotationMatrixMultiShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, __Pyx_memviewslice __pyx_v_ds3, __Pyx_memviewslice __pyx_v_ds4, __Pyx_memviewslice __pyx_v_ds5, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints) { - long __pyx_v_nmol; - long __pyx_v_n; - long __pyx_v_startskip; - __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_selfcorr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_crosscorr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_selfctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_crossctr = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_t1; - double __pyx_v_t2; - double __pyx_v_t3; - double __pyx_v_t4; - double __pyx_v_t5; - double __pyx_v_t6; - long __pyx_v_i; - long __pyx_v_j; - long __pyx_v_k; - long __pyx_v_start; - long __pyx_v_point; - long __pyx_v_dt; - long __pyx_v_mol; - long __pyx_v_shellstart; - long __pyx_v_shelldt; - long __pyx_v_shell1; - long __pyx_v_shell2; - long __pyx_v_shell3; - long __pyx_v_shell4; - long __pyx_v_shell5; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } }; - long __pyx_t_10; - long __pyx_t_11; - long __pyx_t_12; - long __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - long __pyx_t_16; - long __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - long __pyx_t_20; - long __pyx_t_21; - long __pyx_t_22; - long __pyx_t_23; - long __pyx_t_24; - long __pyx_t_25; - int __pyx_t_26; - double __pyx_t_27; - double __pyx_t_28; - double __pyx_t_29; - double __pyx_t_30; - double __pyx_t_31; - double __pyx_t_32; - Py_ssize_t __pyx_t_33; - Py_ssize_t __pyx_t_34; - Py_ssize_t __pyx_t_35; - Py_ssize_t __pyx_t_36; - Py_ssize_t __pyx_t_37; - Py_ssize_t __pyx_t_38; - Py_ssize_t __pyx_t_39; - PyObject *__pyx_t_40 = NULL; - PyObject *__pyx_t_41 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("rotationMatrixMultiShellCorrelate", 0); - - /* "src/helpers/miscellaneous.pyx":1201 - * @cython.boundscheck(False) - * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< - * cdef long n = len(rotTs[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array - */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); - __pyx_v_nmol = ((long)__pyx_t_1); - - /* "src/helpers/miscellaneous.pyx":1202 - * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints - */ - __pyx_t_2.data = __pyx_v_rotTs.data; - __pyx_t_2.memview = __pyx_v_rotTs.memview; - __PYX_INC_MEMVIEW(&__pyx_t_2, 0); - { - Py_ssize_t __pyx_tmp_idx = 0; - Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; -__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; - __pyx_t_2.suboffsets[0] = -1; - -__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; -__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; - __pyx_t_2.suboffsets[1] = -1; - -__pyx_t_2.shape[2] = __pyx_v_rotTs.shape[3]; -__pyx_t_2.strides[2] = __pyx_v_rotTs.strides[3]; - __pyx_t_2.suboffsets[2] = -1; - -__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; - __pyx_v_n = ((long)__pyx_t_1); - - /* "src/helpers/miscellaneous.pyx":1204 - * cdef long n = len(rotTs[0]) # number of time steps - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints # <<<<<<<<<<<<<< - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ - __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); - if (unlikely(__pyx_v_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1204, __pyx_L1_error) - } - else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1204, __pyx_L1_error) - } - __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - /* "src/helpers/miscellaneous.pyx":1205 - * # cdef long nds = len(ds) # number of steps in delaunay array - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< - * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_int_12); - __Pyx_GIVEREF(__pyx_int_12); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_12); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1205, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_corr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":1206 - * cdef long startskip = (n-maxdt)/startingpoints - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + /* "View.MemoryView":1341 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + * + * for i in range(ndim - 1, -1, -1): */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_int_12); - __Pyx_GIVEREF(__pyx_int_12); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_12); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1206, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_selfcorr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - /* "src/helpers/miscellaneous.pyx":1207 - * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 - * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries - * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) - */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_int_12); - __Pyx_GIVEREF(__pyx_int_12); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_12); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7); - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1207, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_crosscorr = __pyx_t_2; - __pyx_t_2.memview = NULL; - __pyx_t_2.data = NULL; + /* "View.MemoryView":1343 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + */ + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* "src/helpers/miscellaneous.pyx":1208 - * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< - * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) - * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) + /* "View.MemoryView":1344 + * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1208, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ctr = __pyx_t_9; - __pyx_t_9.memview = NULL; - __pyx_t_9.data = NULL; + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - /* "src/helpers/miscellaneous.pyx":1209 - * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries - * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) # <<<<<<<<<<<<<< - * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) - * cdef double t1,t2,t3,t4,t5,t6 + /* "View.MemoryView":1345 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1346 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): + */ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1209, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_selfctr = __pyx_t_9; - __pyx_t_9.memview = NULL; - __pyx_t_9.data = NULL; - /* "src/helpers/miscellaneous.pyx":1210 - * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries - * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) - * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) # <<<<<<<<<<<<<< - * cdef double t1,t2,t3,t4,t5,t6 - * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt + /* "View.MemoryView":1348 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); - __pyx_t_8 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1349 + * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 + */ + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + + /* "View.MemoryView":1350 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 + * + */ + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + + /* "View.MemoryView":1351 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * + */ + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_crossctr = __pyx_t_9; - __pyx_t_9.memview = NULL; - __pyx_t_9.data = NULL; - /* "src/helpers/miscellaneous.pyx":1215 - * cdef long shell1, shell2, shell3, shell4, shell5 + /* "View.MemoryView":1337 * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_3 = __pyx_v_maxdt; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_11 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_11 > 0) - { - #ifdef _OPENMP - #pragma omp parallel reduction(+:__pyx_v_t1) reduction(+:__pyx_v_t2) reduction(+:__pyx_v_t3) reduction(+:__pyx_v_t4) reduction(+:__pyx_v_t5) reduction(+:__pyx_v_t6) private(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33, __pyx_t_34, __pyx_t_35, __pyx_t_36, __pyx_t_37, __pyx_t_38) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shell1) lastprivate(__pyx_v_shell2) lastprivate(__pyx_v_shell3) lastprivate(__pyx_v_shell4) lastprivate(__pyx_v_shell5) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) - #endif /* _OPENMP */ - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){ - { - __pyx_v_dt = (long)(0 + 1 * __pyx_t_10); - /* Initialize private variables to invalid values */ - __pyx_v_k = ((long)0xbad0bad0); - __pyx_v_mol = ((long)0xbad0bad0); - __pyx_v_point = ((long)0xbad0bad0); - __pyx_v_shell1 = ((long)0xbad0bad0); - __pyx_v_shell2 = ((long)0xbad0bad0); - __pyx_v_shell3 = ((long)0xbad0bad0); - __pyx_v_shell4 = ((long)0xbad0bad0); - __pyx_v_shell5 = ((long)0xbad0bad0); - __pyx_v_shelldt = ((long)0xbad0bad0); - __pyx_v_shellstart = ((long)0xbad0bad0); - __pyx_v_start = ((long)0xbad0bad0); - /* "src/helpers/miscellaneous.pyx":1216 + /* function exit code */ +} + +/* "View.MemoryView":1359 * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< + * + * if dtype_is_object: */ - __pyx_t_12 = __pyx_v_startingpoints; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_point = __pyx_t_14; - /* "src/helpers/miscellaneous.pyx":1217 - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< - * start = point*startskip - * shell1 = ds1[mol,start]-1 +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { + + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * */ - __pyx_t_15 = __pyx_v_nmol; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_mol = __pyx_t_17; + if (__pyx_v_dtype_is_object) { - /* "src/helpers/miscellaneous.pyx":1218 - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip # <<<<<<<<<<<<<< - * shell1 = ds1[mol,start]-1 - * shell2 = ds2[mol,start]-1 + /* "View.MemoryView":1362 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') */ - __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); - /* "src/helpers/miscellaneous.pyx":1219 - * for mol in range(nmol): # loop over molecules/entries - * start = point*startskip - * shell1 = ds1[mol,start]-1 # <<<<<<<<<<<<<< - * shell2 = ds2[mol,start]-1 - * shell3 = ds3[mol,start]-1 + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds1.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds1.shape[1]; - __pyx_v_shell1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_18 * __pyx_v_ds1.strides[0]) ) + __pyx_t_19 * __pyx_v_ds1.strides[1]) ))) - 1); + } - /* "src/helpers/miscellaneous.pyx":1220 - * start = point*startskip - * shell1 = ds1[mol,start]-1 - * shell2 = ds2[mol,start]-1 # <<<<<<<<<<<<<< - * shell3 = ds3[mol,start]-1 - * shell4 = ds4[mol,start]-1 + /* "View.MemoryView":1359 + * + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< + * + * if dtype_is_object: */ - __pyx_t_19 = __pyx_v_mol; - __pyx_t_18 = __pyx_v_start; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds2.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds2.shape[1]; - __pyx_v_shell2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_19 * __pyx_v_ds2.strides[0]) ) + __pyx_t_18 * __pyx_v_ds2.strides[1]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":1221 - * shell1 = ds1[mol,start]-1 - * shell2 = ds2[mol,start]-1 - * shell3 = ds3[mol,start]-1 # <<<<<<<<<<<<<< - * shell4 = ds4[mol,start]-1 - * shell5 = ds5[mol,start]-1 + /* function exit code */ +} + +/* "View.MemoryView":1365 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds3.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds3.shape[1]; - __pyx_v_shell3 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds3.data + __pyx_t_18 * __pyx_v_ds3.strides[0]) ) + __pyx_t_19 * __pyx_v_ds3.strides[1]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":1222 - * shell2 = ds2[mol,start]-1 - * shell3 = ds3[mol,start]-1 - * shell4 = ds4[mol,start]-1 # <<<<<<<<<<<<<< - * shell5 = ds5[mol,start]-1 - * shellstart = min(shell1, shell2, shell3, shell4, shell5) +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + __Pyx_RefNannyDeclarations + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); + + /* "View.MemoryView":1368 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') */ - __pyx_t_19 = __pyx_v_mol; - __pyx_t_18 = __pyx_v_start; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds4.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds4.shape[1]; - __pyx_v_shell4 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds4.data + __pyx_t_19 * __pyx_v_ds4.strides[0]) ) + __pyx_t_18 * __pyx_v_ds4.strides[1]) ))) - 1); + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - /* "src/helpers/miscellaneous.pyx":1223 - * shell3 = ds3[mol,start]-1 - * shell4 = ds4[mol,start]-1 - * shell5 = ds5[mol,start]-1 # <<<<<<<<<<<<<< - * shellstart = min(shell1, shell2, shell3, shell4, shell5) - * if shellstart < nshells: + /* "View.MemoryView":1365 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds5.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds5.shape[1]; - __pyx_v_shell5 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds5.data + __pyx_t_18 * __pyx_v_ds5.strides[0]) ) + __pyx_t_19 * __pyx_v_ds5.strides[1]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":1224 - * shell4 = ds4[mol,start]-1 - * shell5 = ds5[mol,start]-1 - * shellstart = min(shell1, shell2, shell3, shell4, shell5) # <<<<<<<<<<<<<< - * if shellstart < nshells: - * ctr[shellstart,dt] += 1 + /* function exit code */ + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif +} + +/* "View.MemoryView":1371 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ - __pyx_t_20 = __pyx_v_shell2; - __pyx_t_21 = __pyx_v_shell3; - __pyx_t_22 = __pyx_v_shell4; - __pyx_t_23 = __pyx_v_shell5; - __pyx_t_24 = __pyx_v_shell1; - if (((__pyx_t_20 < __pyx_t_24) != 0)) { - __pyx_t_25 = __pyx_t_20; - } else { - __pyx_t_25 = __pyx_t_24; - } - __pyx_t_24 = __pyx_t_25; - if (((__pyx_t_21 < __pyx_t_24) != 0)) { - __pyx_t_25 = __pyx_t_21; - } else { - __pyx_t_25 = __pyx_t_24; - } - __pyx_t_24 = __pyx_t_25; - if (((__pyx_t_22 < __pyx_t_24) != 0)) { - __pyx_t_25 = __pyx_t_22; - } else { - __pyx_t_25 = __pyx_t_24; - } - __pyx_t_24 = __pyx_t_25; - if (((__pyx_t_23 < __pyx_t_24) != 0)) { - __pyx_t_25 = __pyx_t_23; - } else { - __pyx_t_25 = __pyx_t_24; - } - __pyx_v_shellstart = __pyx_t_25; - /* "src/helpers/miscellaneous.pyx":1225 - * shell5 = ds5[mol,start]-1 - * shellstart = min(shell1, shell2, shell3, shell4, shell5) - * if shellstart < nshells: # <<<<<<<<<<<<<< - * ctr[shellstart,dt] += 1 +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); + + /* "View.MemoryView":1374 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< * + * for i in range(shape[0]): */ - __pyx_t_26 = ((__pyx_v_shellstart < __pyx_v_nshells) != 0); - if (__pyx_t_26) { + __pyx_v_stride = (__pyx_v_strides[0]); - /* "src/helpers/miscellaneous.pyx":1226 - * shellstart = min(shell1, shell2, shell3, shell4, shell5) - * if shellstart < nshells: - * ctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1376 + * cdef Py_ssize_t stride = strides[0] * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: */ - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_18 * __pyx_v_ctr.strides[1]) )) += 1.0; + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":1228 - * ctr[shellstart,dt] += 1 + /* "View.MemoryView":1377 * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 # <<<<<<<<<<<<<< - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) */ - __pyx_t_27 = 0.0; - __pyx_t_28 = 0.0; - __pyx_t_29 = 0.0; - __pyx_t_30 = 0.0; - __pyx_t_31 = 0.0; - __pyx_t_32 = 0.0; - __pyx_v_t1 = __pyx_t_27; - __pyx_v_t2 = __pyx_t_28; - __pyx_v_t3 = __pyx_t_29; - __pyx_v_t4 = __pyx_t_30; - __pyx_v_t5 = __pyx_t_31; - __pyx_v_t6 = __pyx_t_32; + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { + + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: + */ + if (__pyx_v_inc) { + + /* "View.MemoryView":1379 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) + */ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); + + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: + */ + goto __pyx_L6; + } + + /* "View.MemoryView":1381 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + */ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; - /* "src/helpers/miscellaneous.pyx":1229 + /* "View.MemoryView":1377 * - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 - * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) */ - for (__pyx_t_25 = 0; __pyx_t_25 < 3; __pyx_t_25+=1) { - __pyx_v_k = __pyx_t_25; + goto __pyx_L5; + } - /* "src/helpers/miscellaneous.pyx":1230 - * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] # <<<<<<<<<<<<<< - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + /* "View.MemoryView":1383 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< + * + * data += stride */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_33 = 0; - __pyx_t_34 = __pyx_v_k; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[3]; - __pyx_t_35 = __pyx_v_mol; - __pyx_t_36 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_37 = 0; - __pyx_t_38 = __pyx_v_k; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[3]; - __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_18 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[3]) ))))); + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; - /* "src/helpers/miscellaneous.pyx":1231 - * for k in range(3): # skalar produkt - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + /* "View.MemoryView":1385 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< + * + * */ - __pyx_t_38 = __pyx_v_mol; - __pyx_t_37 = __pyx_v_start; - __pyx_t_36 = 1; - __pyx_t_35 = __pyx_v_k; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; - __pyx_t_34 = __pyx_v_mol; - __pyx_t_33 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_19 = 1; - __pyx_t_18 = __pyx_v_k; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[3]; - __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_38 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_34 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_18 * __pyx_v_rotTs.strides[3]) ))))); - - /* "src/helpers/miscellaneous.pyx":1232 - * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1371 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_33 = 2; - __pyx_t_34 = __pyx_v_k; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[3]; - __pyx_t_35 = __pyx_v_mol; - __pyx_t_36 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_37 = 2; - __pyx_t_38 = __pyx_v_k; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[3]; - __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_18 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[3]) ))))); - /* "src/helpers/miscellaneous.pyx":1233 - * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "View.MemoryView":1391 + * + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: */ - __pyx_t_38 = __pyx_v_mol; - __pyx_t_37 = __pyx_v_start; - __pyx_t_36 = 0; - __pyx_t_35 = __pyx_v_k; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; - __pyx_t_34 = __pyx_v_mol; - __pyx_t_33 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_19 = 1; - __pyx_t_18 = __pyx_v_k; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[3]; - __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_38 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_34 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_18 * __pyx_v_rotTs.strides[3]) ))))); - - /* "src/helpers/miscellaneous.pyx":1234 - * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart,dt] += t1 # l=1 + +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { + + /* "View.MemoryView":1394 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = __pyx_v_start; - __pyx_t_33 = 0; - __pyx_t_34 = __pyx_v_k; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[3]; - __pyx_t_35 = __pyx_v_mol; - __pyx_t_36 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_37 = 2; - __pyx_t_38 = __pyx_v_k; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[3]; - __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_18 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[3]) ))))); + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "src/helpers/miscellaneous.pyx":1235 - * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< - * corr[0,shellstart,dt] += t1 # l=1 - * corr[1,shellstart,dt] += t2 + /* "View.MemoryView":1395 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + * */ - __pyx_t_38 = __pyx_v_mol; - __pyx_t_37 = __pyx_v_start; - __pyx_t_36 = 1; - __pyx_t_35 = __pyx_v_k; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; - __pyx_t_34 = __pyx_v_mol; - __pyx_t_33 = (__pyx_v_start + __pyx_v_dt); - __pyx_t_19 = 2; - __pyx_t_18 = __pyx_v_k; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[2]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[3]; - __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_38 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_34 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_18 * __pyx_v_rotTs.strides[3]) ))))); - } + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - /* "src/helpers/miscellaneous.pyx":1236 - * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart,dt] += t1 # l=1 # <<<<<<<<<<<<<< - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 + /* "View.MemoryView":1396 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * */ - __pyx_t_18 = 0; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_33 * __pyx_v_corr.strides[2]) )) += __pyx_v_t1; - - /* "src/helpers/miscellaneous.pyx":1237 - * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] - * corr[0,shellstart,dt] += t1 # l=1 - * corr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + + /* "View.MemoryView":1391 + * + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: */ - __pyx_t_33 = 1; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_33 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t2; - /* "src/helpers/miscellaneous.pyx":1238 - * corr[0,shellstart,dt] += t1 # l=1 - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 - */ - __pyx_t_18 = 2; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_33 * __pyx_v_corr.strides[2]) )) += __pyx_v_t3; - - /* "src/helpers/miscellaneous.pyx":1239 - * corr[1,shellstart,dt] += t2 - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 + /* function exit code */ +} + +/* "View.MemoryView":1400 + * + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ - __pyx_t_33 = 3; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_33 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t4; - /* "src/helpers/miscellaneous.pyx":1240 - * corr[2,shellstart,dt] += t3 - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + + /* "View.MemoryView":1404 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] + * */ - __pyx_t_18 = 4; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_33 * __pyx_v_corr.strides[2]) )) += __pyx_v_t5; + __pyx_v_stride = (__pyx_v_strides[0]); - /* "src/helpers/miscellaneous.pyx":1241 - * corr[3,shellstart,dt] += t4 - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + /* "View.MemoryView":1405 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: */ - __pyx_t_33 = 5; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_33 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += __pyx_v_t6; + __pyx_v_extent = (__pyx_v_shape[0]); - /* "src/helpers/miscellaneous.pyx":1242 - * corr[4,shellstart,dt] += t5 - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 # <<<<<<<<<<<<<< - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) */ - __pyx_t_18 = 6; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_33 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":1243 - * corr[5,shellstart,dt] += t6 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + /* "View.MemoryView":1408 + * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride */ - __pyx_t_33 = 7; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_33 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/miscellaneous.pyx":1244 - * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 + /* "View.MemoryView":1409 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: */ - __pyx_t_18 = 8; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_33 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - /* "src/helpers/miscellaneous.pyx":1245 - * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":1410 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): */ - __pyx_t_33 = 9; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_33 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } - /* "src/helpers/miscellaneous.pyx":1246 - * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) */ - __pyx_t_18 = 10; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_18 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_33 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); + goto __pyx_L3; + } - /* "src/helpers/miscellaneous.pyx":1247 - * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< + /* "View.MemoryView":1412 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride + */ + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1413 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride * - * shell1 = ds1[mol,start+dt]-1 */ - __pyx_t_33 = 11; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_33 * __pyx_v_corr.strides[0]) ) + __pyx_t_19 * __pyx_v_corr.strides[1]) ) + __pyx_t_18 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - /* "src/helpers/miscellaneous.pyx":1249 - * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "View.MemoryView":1414 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< + * * - * shell1 = ds1[mol,start+dt]-1 # <<<<<<<<<<<<<< - * shell2 = ds2[mol,start+dt]-1 - * shell3 = ds3[mol,start+dt]-1 */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds1.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds1.shape[1]; - __pyx_v_shell1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_18 * __pyx_v_ds1.strides[0]) ) + __pyx_t_19 * __pyx_v_ds1.strides[1]) ))) - 1); + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; - /* "src/helpers/miscellaneous.pyx":1250 + /* "View.MemoryView":1400 * - * shell1 = ds1[mol,start+dt]-1 - * shell2 = ds2[mol,start+dt]-1 # <<<<<<<<<<<<<< - * shell3 = ds3[mol,start+dt]-1 - * shell4 = ds4[mol,start+dt]-1 + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ - __pyx_t_19 = __pyx_v_mol; - __pyx_t_18 = (__pyx_v_start + __pyx_v_dt); - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds2.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds2.shape[1]; - __pyx_v_shell2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_19 * __pyx_v_ds2.strides[0]) ) + __pyx_t_18 * __pyx_v_ds2.strides[1]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":1251 - * shell1 = ds1[mol,start+dt]-1 - * shell2 = ds2[mol,start+dt]-1 - * shell3 = ds3[mol,start+dt]-1 # <<<<<<<<<<<<<< - * shell4 = ds4[mol,start+dt]-1 - * shell5 = ds5[mol,start+dt]-1 + /* function exit code */ +} + +/* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds3.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds3.shape[1]; - __pyx_v_shell3 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds3.data + __pyx_t_18 * __pyx_v_ds3.strides[0]) ) + __pyx_t_19 * __pyx_v_ds3.strides[1]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":1252 - * shell2 = ds2[mol,start+dt]-1 - * shell3 = ds3[mol,start+dt]-1 - * shell4 = ds4[mol,start+dt]-1 # <<<<<<<<<<<<<< - * shell5 = ds5[mol,start+dt]-1 - * shelldt = min(shell1, shell2, shell3, shell4, shell5) +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - __pyx_t_19 = __pyx_v_mol; - __pyx_t_18 = (__pyx_v_start + __pyx_v_dt); - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds4.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds4.shape[1]; - __pyx_v_shell4 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds4.data + __pyx_t_19 * __pyx_v_ds4.strides[0]) ) + __pyx_t_18 * __pyx_v_ds4.strides[1]) ))) - 1); + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1253 - * shell3 = ds3[mol,start+dt]-1 - * shell4 = ds4[mol,start+dt]-1 - * shell5 = ds5[mol,start+dt]-1 # <<<<<<<<<<<<<< - * shelldt = min(shell1, shell2, shell3, shell4, shell5) - * if shellstart == shelldt: + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) */ - __pyx_t_18 = __pyx_v_mol; - __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds5.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds5.shape[1]; - __pyx_v_shell5 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds5.data + __pyx_t_18 * __pyx_v_ds5.strides[0]) ) + __pyx_t_19 * __pyx_v_ds5.strides[1]) ))) - 1); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/helpers/miscellaneous.pyx":1254 - * shell4 = ds4[mol,start+dt]-1 - * shell5 = ds5[mol,start+dt]-1 - * shelldt = min(shell1, shell2, shell3, shell4, shell5) # <<<<<<<<<<<<<< - * if shellstart == shelldt: - * selfctr[shellstart,dt] += 1 + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: */ - __pyx_t_25 = __pyx_v_shell2; - __pyx_t_20 = __pyx_v_shell3; - __pyx_t_21 = __pyx_v_shell4; - __pyx_t_22 = __pyx_v_shell5; - __pyx_t_23 = __pyx_v_shell1; - if (((__pyx_t_25 < __pyx_t_23) != 0)) { - __pyx_t_24 = __pyx_t_25; - } else { - __pyx_t_24 = __pyx_t_23; - } - __pyx_t_23 = __pyx_t_24; - if (((__pyx_t_20 < __pyx_t_23) != 0)) { - __pyx_t_24 = __pyx_t_20; - } else { - __pyx_t_24 = __pyx_t_23; - } - __pyx_t_23 = __pyx_t_24; - if (((__pyx_t_21 < __pyx_t_23) != 0)) { - __pyx_t_24 = __pyx_t_21; - } else { - __pyx_t_24 = __pyx_t_23; - } - __pyx_t_23 = __pyx_t_24; - if (((__pyx_t_22 < __pyx_t_23) != 0)) { - __pyx_t_24 = __pyx_t_22; - } else { - __pyx_t_24 = __pyx_t_23; - } - __pyx_v_shelldt = __pyx_t_24; + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1255 - * shell5 = ds5[mol,start+dt]-1 - * shelldt = min(shell1, shell2, shell3, shell4, shell5) - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * selfctr[shellstart,dt] += 1 - * + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - __pyx_t_26 = ((__pyx_v_shellstart == __pyx_v_shelldt) != 0); - if (__pyx_t_26) { + } - /* "src/helpers/miscellaneous.pyx":1256 - * shelldt = min(shell1, shell2, shell3, shell4, shell5) - * if shellstart == shelldt: - * selfctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< - * - * selfcorr[0,shellstart,dt] += t1 + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) */ - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_19 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_18 * __pyx_v_selfctr.strides[1]) )) += 1.0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":1258 - * selfctr[shellstart,dt] += 1 - * - * selfcorr[0,shellstart,dt] += t1 # <<<<<<<<<<<<<< - * selfcorr[1,shellstart,dt] += t2 - * selfcorr[2,shellstart,dt] += t3 + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result */ - __pyx_t_18 = 0; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_33 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t1; + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1259 - * - * selfcorr[0,shellstart,dt] += t1 - * selfcorr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< - * selfcorr[2,shellstart,dt] += t3 - * selfcorr[3,shellstart,dt] += t4 + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): */ - __pyx_t_33 = 1; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_33 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t2; + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":1260 - * selfcorr[0,shellstart,dt] += t1 - * selfcorr[1,shellstart,dt] += t2 - * selfcorr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< - * selfcorr[3,shellstart,dt] += t4 - * selfcorr[4,shellstart,dt] += t5 + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result */ - __pyx_t_18 = 2; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_33 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t3; + } - /* "src/helpers/miscellaneous.pyx":1261 - * selfcorr[1,shellstart,dt] += t2 - * selfcorr[2,shellstart,dt] += t3 - * selfcorr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< - * selfcorr[4,shellstart,dt] += t5 - * selfcorr[5,shellstart,dt] += t6 + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ - __pyx_t_33 = 3; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_33 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t4; - /* "src/helpers/miscellaneous.pyx":1262 - * selfcorr[2,shellstart,dt] += t3 - * selfcorr[3,shellstart,dt] += t4 - * selfcorr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< - * selfcorr[5,shellstart,dt] += t6 - * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ - __pyx_t_18 = 4; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_33 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t5; - /* "src/helpers/miscellaneous.pyx":1263 - * selfcorr[3,shellstart,dt] += t4 - * selfcorr[4,shellstart,dt] += t5 - * selfcorr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< - * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 - * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) */ - __pyx_t_33 = 5; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_33 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t6; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":1264 - * selfcorr[4,shellstart,dt] += t5 - * selfcorr[5,shellstart,dt] += t6 - * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 # <<<<<<<<<<<<<< - * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) */ - __pyx_t_18 = 6; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_33 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 > 1); + if (__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { - /* "src/helpers/miscellaneous.pyx":1265 - * selfcorr[5,shellstart,dt] += t6 - * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 - * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< - * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 + /* "(tree fragment)":14 + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< */ - __pyx_t_33 = 7; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_33 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/miscellaneous.pyx":1266 - * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 - * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< - * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) */ - __pyx_t_18 = 8; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_33 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); + } - /* "src/helpers/miscellaneous.pyx":1267 - * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 - * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< - * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ - __pyx_t_33 = 9; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_33 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); - /* "src/helpers/miscellaneous.pyx":1268 - * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 - * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< - * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ - __pyx_t_18 = 10; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_33 = __pyx_v_dt; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_33 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); - /* "src/helpers/miscellaneous.pyx":1269 - * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 - * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 - * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":248 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< * - * for i in range(nshells): + * @property */ - __pyx_t_33 = 11; - __pyx_t_19 = __pyx_v_shellstart; - __pyx_t_18 = __pyx_v_dt; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_33 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_18 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1255 - * shell5 = ds5[mol,start+dt]-1 - * shelldt = min(shell1, shell2, shell3, shell4, shell5) - * if shellstart == shelldt: # <<<<<<<<<<<<<< - * selfctr[shellstart,dt] += 1 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ - } - /* "src/helpers/miscellaneous.pyx":1225 - * shell5 = ds5[mol,start]-1 - * shellstart = min(shell1, shell2, shell3, shell4, shell5) - * if shellstart < nshells: # <<<<<<<<<<<<<< - * ctr[shellstart,dt] += 1 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 * + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ */ - } - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } - /* "src/helpers/miscellaneous.pyx":1215 - * cdef long shell1, shell2, shell3, shell4, shell5 +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":254 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< * - * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< - * for point in range(startingpoints): # loop over all possible interval start points - * for mol in range(nmol): # loop over molecules/entries + * @property */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1271 - * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 * - * for i in range(nshells): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * if ctr[i,j] != 0: + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ */ - __pyx_t_11 = __pyx_v_nshells; - __pyx_t_10 = __pyx_t_11; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_10; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":1272 + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 * - * for i in range(nshells): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * if ctr[i,j] != 0: - * for k in range(12): + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ */ - __pyx_t_12 = __pyx_v_maxdt; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_j = __pyx_t_14; - /* "src/helpers/miscellaneous.pyx":1273 - * for i in range(nshells): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] - */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; - __pyx_t_26 = (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_18 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) ))) != 0.0) != 0); - if (__pyx_t_26) { +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; - /* "src/helpers/miscellaneous.pyx":1274 - * for j in range(maxdt): - * if ctr[i,j] != 0: - * for k in range(12): # <<<<<<<<<<<<<< - * corr[k,i,j] /= ctr[i,j] - * else: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":260 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * @property */ - for (__pyx_t_15 = 0; __pyx_t_15 < 12; __pyx_t_15+=1) { - __pyx_v_k = __pyx_t_15; + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1275 - * if ctr[i,j] != 0: - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] # <<<<<<<<<<<<<< - * else: - * print 'tot too sparse' + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 + * + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_18 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[1]; - __pyx_t_33 = __pyx_v_k; - __pyx_t_34 = __pyx_v_i; - __pyx_t_35 = __pyx_v_j; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[0]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[1]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_corr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_33 * __pyx_v_corr.strides[0]) ) + __pyx_t_34 * __pyx_v_corr.strides[1]) ) + __pyx_t_35 * __pyx_v_corr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_18 * __pyx_v_ctr.strides[1]) ))); - } - /* "src/helpers/miscellaneous.pyx":1273 - * for i in range(nshells): - * for j in range(maxdt): - * if ctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * corr[k,i,j] /= ctr[i,j] - */ - goto __pyx_L24; - } + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":1277 - * corr[k,i,j] /= ctr[i,j] - * else: - * print 'tot too sparse' # <<<<<<<<<<<<<< - * if selfctr[i,j] != 0: - * for k in range(12): +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 + * + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_tot_too_sparse) < 0) __PYX_ERR(0, 1277, __pyx_L1_error) - } - __pyx_L24:; - /* "src/helpers/miscellaneous.pyx":1278 - * else: - * print 'tot too sparse' - * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * selfcorr[k,i,j] /= selfctr[i,j] - */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[1]; - __pyx_t_26 = (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_18 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfctr.strides[1]) ))) != 0.0) != 0); - if (__pyx_t_26) { +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; - /* "src/helpers/miscellaneous.pyx":1279 - * print 'tot too sparse' - * if selfctr[i,j] != 0: - * for k in range(12): # <<<<<<<<<<<<<< - * selfcorr[k,i,j] /= selfctr[i,j] - * else: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":268 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< + * + * @property */ - for (__pyx_t_15 = 0; __pyx_t_15 < 12; __pyx_t_15+=1) { - __pyx_v_k = __pyx_t_15; + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1280 - * if selfctr[i,j] != 0: - * for k in range(12): - * selfcorr[k,i,j] /= selfctr[i,j] # <<<<<<<<<<<<<< - * else: - * print 'self too sparse' + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 + * + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_18 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfctr.shape[1]; - __pyx_t_35 = __pyx_v_k; - __pyx_t_34 = __pyx_v_i; - __pyx_t_33 = __pyx_v_j; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_35 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_34 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_33 * __pyx_v_selfcorr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_19 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_18 * __pyx_v_selfctr.strides[1]) ))); - } - /* "src/helpers/miscellaneous.pyx":1278 - * else: - * print 'tot too sparse' - * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< - * for k in range(12): - * selfcorr[k,i,j] /= selfctr[i,j] - */ - goto __pyx_L27; - } + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":1282 - * selfcorr[k,i,j] /= selfctr[i,j] - * else: - * print 'self too sparse' # <<<<<<<<<<<<<< - * for i in range(nshells): - * for j in range(maxdt): +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 + * + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - /*else*/ { - if (__Pyx_PrintOne(0, __pyx_kp_s_self_too_sparse) < 0) __PYX_ERR(0, 1282, __pyx_L1_error) - } - __pyx_L27:; - } - } - /* "src/helpers/miscellaneous.pyx":1283 - * else: - * print 'self too sparse' - * for i in range(nshells): # <<<<<<<<<<<<<< - * for j in range(maxdt): - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] - */ - __pyx_t_11 = __pyx_v_nshells; - __pyx_t_10 = __pyx_t_11; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_10; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; - /* "src/helpers/miscellaneous.pyx":1284 - * print 'self too sparse' - * for i in range(nshells): - * for j in range(maxdt): # <<<<<<<<<<<<<< - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] - * for k in range(12): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":275 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_12 = __pyx_v_maxdt; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_j = __pyx_t_14; + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1285 - * for i in range(nshells): - * for j in range(maxdt): - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] # <<<<<<<<<<<<<< - * for k in range(12): - * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] - */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; - __pyx_t_33 = __pyx_v_i; - __pyx_t_34 = __pyx_v_j; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfctr.shape[0]; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfctr.shape[1]; - __pyx_t_35 = __pyx_v_i; - __pyx_t_36 = __pyx_v_j; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_crossctr.shape[0]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_crossctr.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crossctr.data + __pyx_t_35 * __pyx_v_crossctr.strides[0]) ) + __pyx_t_36 * __pyx_v_crossctr.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_18 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_33 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_34 * __pyx_v_selfctr.strides[1]) )))); - - /* "src/helpers/miscellaneous.pyx":1286 - * for j in range(maxdt): - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] - * for k in range(12): # <<<<<<<<<<<<<< - * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 * + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - for (__pyx_t_15 = 0; __pyx_t_15 < 12; __pyx_t_15+=1) { - __pyx_v_k = __pyx_t_15; - /* "src/helpers/miscellaneous.pyx":1287 - * crossctr[i,j] = ctr[i,j] - selfctr[i,j] - * for k in range(12): - * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 * - * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ */ - __pyx_t_34 = __pyx_v_k; - __pyx_t_33 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[0]; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; - __pyx_t_18 = __pyx_v_k; - __pyx_t_36 = __pyx_v_i; - __pyx_t_35 = __pyx_v_j; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_selfcorr.shape[0]; - if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_selfcorr.shape[1]; - if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_selfcorr.shape[2]; - __pyx_t_37 = __pyx_v_k; - __pyx_t_38 = __pyx_v_i; - __pyx_t_39 = __pyx_v_j; - if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_crosscorr.shape[0]; - if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_crosscorr.shape[1]; - if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_crosscorr.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crosscorr.data + __pyx_t_37 * __pyx_v_crosscorr.strides[0]) ) + __pyx_t_38 * __pyx_v_crosscorr.strides[1]) ) + __pyx_t_39 * __pyx_v_crosscorr.strides[2]) )) = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_34 * __pyx_v_corr.strides[0]) ) + __pyx_t_33 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) ))) - (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_18 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_36 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_35 * __pyx_v_selfcorr.strides[2]) )))); - } - } - } - - /* "src/helpers/miscellaneous.pyx":1289 - * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] - * - * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr # <<<<<<<<<<<<<< + +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":281 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * @property */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_selfcorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_crosscorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_selfctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_40 = __pyx_memoryview_fromslice(__pyx_v_crossctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_40); - __pyx_t_41 = PyTuple_New(6); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_41); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_41, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_41, 2, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_41, 3, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_41, 4, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_40); - PyTuple_SET_ITEM(__pyx_t_41, 5, __pyx_t_40); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_40 = 0; - __pyx_r = __pyx_t_41; - __pyx_t_41 = 0; + __pyx_r = PyArray_SIZE(__pyx_v_self); goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1200 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 * - * @cython.boundscheck(False) - * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< - * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ */ /* function exit code */ - __pyx_L1_error:; - __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1); - __Pyx_XDECREF(__pyx_t_40); - __Pyx_XDECREF(__pyx_t_41); - __Pyx_AddTraceback("newanalysis.miscellaneous.rotationMatrixMultiShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_corr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_selfcorr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_crosscorr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_selfctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_crossctr, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_rotTs, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds3, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds4, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds5, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1292 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 * - * @cython.boundscheck(False) - * def collectiveDipolesCutoff(double [:,:] coor, double[:,:] dipoles, double[:] aufpunkt, double[:] dip_inside, double[:] dip_outside, double cutoff): # <<<<<<<<<<<<<< - * #TODO documentation + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":290 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< * + * ctypedef unsigned char npy_bool */ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_65collectiveDipolesCutoff(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_65collectiveDipolesCutoff = {"collectiveDipolesCutoff", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_65collectiveDipolesCutoff, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_65collectiveDipolesCutoff(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip_inside = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip_outside = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_cutoff; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("collectiveDipolesCutoff (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_dipoles,&__pyx_n_s_aufpunkt,&__pyx_n_s_dip_inside,&__pyx_n_s_dip_outside,&__pyx_n_s_cutoff,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dipoles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, 1); __PYX_ERR(0, 1292, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, 2); __PYX_ERR(0, 1292, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_inside)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, 3); __PYX_ERR(0, 1292, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_outside)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, 4); __PYX_ERR(0, 1292, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cutoff)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, 5); __PYX_ERR(0, 1292, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "collectiveDipolesCutoff") < 0)) __PYX_ERR(0, 1292, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1292, __pyx_L3_error) - __pyx_v_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dipoles.memview)) __PYX_ERR(0, 1292, __pyx_L3_error) - __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 1292, __pyx_L3_error) - __pyx_v_dip_inside = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_inside.memview)) __PYX_ERR(0, 1292, __pyx_L3_error) - __pyx_v_dip_outside = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_outside.memview)) __PYX_ERR(0, 1292, __pyx_L3_error) - __pyx_v_cutoff = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_cutoff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1292, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1292, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.collectiveDipolesCutoff", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_64collectiveDipolesCutoff(__pyx_self, __pyx_v_coor, __pyx_v_dipoles, __pyx_v_aufpunkt, __pyx_v_dip_inside, __pyx_v_dip_outside, __pyx_v_cutoff); + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 + * + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_64collectiveDipolesCutoff(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dipoles, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_dip_inside, __Pyx_memviewslice __pyx_v_dip_outside, double __pyx_v_cutoff) { - int __pyx_v_particles; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - __Pyx_RefNannySetupContext("collectiveDipolesCutoff", 0); - - /* "src/helpers/miscellaneous.pyx":1295 - * #TODO documentation +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t * - * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< - * separateCollectiveDipolesSpherically(&coor[0,0], &dipoles[0,0], particles, &aufpunkt[0], &dip_inside[0], &dip_outside[0], cutoff) + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) * */ - __pyx_v_particles = (__pyx_v_coor.shape[0]); - /* "src/helpers/miscellaneous.pyx":1296 +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":774 * - * cdef int particles = coor.shape[0] - * separateCollectiveDipolesSpherically(&coor[0,0], &dipoles[0,0], particles, &aufpunkt[0], &dip_inside[0], &dip_outside[0], cutoff) # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * - * #TODO: As a C++ function? + * cdef inline object PyArray_MultiIterNew2(a, b): */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_dipoles.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dipoles.shape[1]; - __pyx_t_5 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_aufpunkt.shape[0]; - __pyx_t_6 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dip_inside.shape[0]; - __pyx_t_7 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dip_outside.shape[0]; - separateCollectiveDipolesSpherically((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipoles.data + __pyx_t_3 * __pyx_v_dipoles.strides[0]) ) + __pyx_t_4 * __pyx_v_dipoles.strides[1]) )))), __pyx_v_particles, (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_5 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_dip_inside.data + __pyx_t_6 * __pyx_v_dip_inside.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_dip_outside.data + __pyx_t_7 * __pyx_v_dip_outside.strides[0]) )))), __pyx_v_cutoff); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1292 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t * - * @cython.boundscheck(False) - * def collectiveDipolesCutoff(double [:,:] coor, double[:,:] dipoles, double[:] aufpunkt, double[:] dip_inside, double[:] dip_outside, double cutoff): # <<<<<<<<<<<<<< - * #TODO documentation + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dipoles, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip_inside, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip_outside, 1); + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1300 - * #TODO: As a C++ function? - * @cython.boundscheck(False) - * def shellHistograms(double [:,:] histograms, double [:] aufpunkt, double [:,:] coors, char [:] ds, int maxshell, double max_distance, int segs_per_angstroem): # <<<<<<<<<<<<<< - * #TODO documentation +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_67shellHistograms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_67shellHistograms = {"shellHistograms", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_67shellHistograms, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_67shellHistograms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_histograms = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell; - double __pyx_v_max_distance; - int __pyx_v_segs_per_angstroem; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("shellHistograms (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_histograms,&__pyx_n_s_aufpunkt,&__pyx_n_s_coors,&__pyx_n_s_ds,&__pyx_n_s_maxshell,&__pyx_n_s_max_distance,&__pyx_n_s_segs_per_angstroem,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histograms)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 1); __PYX_ERR(0, 1300, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coors)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 2); __PYX_ERR(0, 1300, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 3); __PYX_ERR(0, 1300, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 4); __PYX_ERR(0, 1300, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_distance)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 5); __PYX_ERR(0, 1300, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_segs_per_angstroem)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 6); __PYX_ERR(0, 1300, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "shellHistograms") < 0)) __PYX_ERR(0, 1300, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - } - __pyx_v_histograms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histograms.memview)) __PYX_ERR(0, 1300, __pyx_L3_error) - __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 1300, __pyx_L3_error) - __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 1300, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1300, __pyx_L3_error) - __pyx_v_maxshell = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1300, __pyx_L3_error) - __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1300, __pyx_L3_error) - __pyx_v_segs_per_angstroem = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_segs_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1300, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1300, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.shellHistograms", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_66shellHistograms(__pyx_self, __pyx_v_histograms, __pyx_v_aufpunkt, __pyx_v_coors, __pyx_v_ds, __pyx_v_maxshell, __pyx_v_max_distance, __pyx_v_segs_per_angstroem); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":777 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_66shellHistograms(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_histograms, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_coors, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, double __pyx_v_max_distance, int __pyx_v_segs_per_angstroem) { - int __pyx_v_i; - int __pyx_v_shell; - int __pyx_v_bin_dist; - int __pyx_v_particles; - double __pyx_v_distance; +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - PyObject *__pyx_t_17 = NULL; - double __pyx_t_18; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("shellHistograms", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "src/helpers/miscellaneous.pyx":1304 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":780 * - * #cdef int w, shell, i, nres_wat = dip_wat.shape[0] - * cdef int i, shell, bin_dist, particles = coors.shape[0] # <<<<<<<<<<<<<< - * cdef double distance + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __pyx_v_particles = (__pyx_v_coors.shape[0]); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1307 - * cdef double distance + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) * - * for i in range(particles): # <<<<<<<<<<<<<< - * shell = ds[i] - 1 - * if shell < maxshell: - */ - __pyx_t_1 = __pyx_v_particles; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "src/helpers/miscellaneous.pyx":1308 + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * - * for i in range(particles): - * shell = ds[i] - 1 # <<<<<<<<<<<<<< - * if shell < maxshell: - * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) - */ - __pyx_t_4 = __pyx_v_i; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds.shape[0]; - __pyx_v_shell = ((*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_4 * __pyx_v_ds.strides[0]) ))) - 1); - - /* "src/helpers/miscellaneous.pyx":1309 - * for i in range(particles): - * shell = ds[i] - 1 - * if shell < maxshell: # <<<<<<<<<<<<<< - * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) - * if distance < max_distance: - */ - __pyx_t_5 = ((__pyx_v_shell < __pyx_v_maxshell) != 0); - if (__pyx_t_5) { - - /* "src/helpers/miscellaneous.pyx":1310 - * shell = ds[i] - 1 - * if shell < maxshell: - * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) # <<<<<<<<<<<<<< - * if distance < max_distance: - * bin_dist = int(distance * segs_per_angstroem) */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_4 = __pyx_v_i; - __pyx_t_9 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coors.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; - __pyx_t_10 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_aufpunkt.shape[0]; - __pyx_t_11 = __pyx_v_i; - __pyx_t_12 = 1; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coors.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[1]; - __pyx_t_13 = 1; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_aufpunkt.shape[0]; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 2; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coors.shape[1]; - __pyx_t_16 = 2; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_aufpunkt.shape[0]; - __pyx_t_7 = PyFloat_FromDouble(((pow(((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_4 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_10 * __pyx_v_aufpunkt.strides[0]) )))), 2.0) + pow(((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_11 * __pyx_v_coors.strides[0]) ) + __pyx_t_12 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_13 * __pyx_v_aufpunkt.strides[0]) )))), 2.0)) + pow(((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_14 * __pyx_v_coors.strides[0]) ) + __pyx_t_15 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_16 * __pyx_v_aufpunkt.strides[0]) )))), 2.0))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_17 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_17)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_17); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_6 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_17, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1310, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_distance = __pyx_t_18; - /* "src/helpers/miscellaneous.pyx":1311 - * if shell < maxshell: - * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) - * if distance < max_distance: # <<<<<<<<<<<<<< - * bin_dist = int(distance * segs_per_angstroem) - * histograms[shell][bin_dist] += 1 - */ - __pyx_t_5 = ((__pyx_v_distance < __pyx_v_max_distance) != 0); - if (__pyx_t_5) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/miscellaneous.pyx":1312 - * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) - * if distance < max_distance: - * bin_dist = int(distance * segs_per_angstroem) # <<<<<<<<<<<<<< - * histograms[shell][bin_dist] += 1 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) * - */ - __pyx_v_bin_dist = ((int)(__pyx_v_distance * __pyx_v_segs_per_angstroem)); - - /* "src/helpers/miscellaneous.pyx":1313 - * if distance < max_distance: - * bin_dist = int(distance * segs_per_angstroem) - * histograms[shell][bin_dist] += 1 # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * - * #TODO: As a C++ function? */ - __pyx_t_16 = __pyx_v_shell; - __pyx_t_15 = __pyx_v_bin_dist; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_histograms.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_histograms.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histograms.data + __pyx_t_16 * __pyx_v_histograms.strides[0]) ) + __pyx_t_15 * __pyx_v_histograms.strides[1]) )) += 1.0; - /* "src/helpers/miscellaneous.pyx":1311 - * if shell < maxshell: - * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) - * if distance < max_distance: # <<<<<<<<<<<<<< - * bin_dist = int(distance * segs_per_angstroem) - * histograms[shell][bin_dist] += 1 - */ - } +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "src/helpers/miscellaneous.pyx":1309 - * for i in range(particles): - * shell = ds[i] - 1 - * if shell < maxshell: # <<<<<<<<<<<<<< - * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) - * if distance < max_distance: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":783 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - } - } + __Pyx_XDECREF(__pyx_r); + __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_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1300 - * #TODO: As a C++ function? - * @cython.boundscheck(False) - * def shellHistograms(double [:,:] histograms, double [:] aufpunkt, double [:,:] coors, char [:] ds, int maxshell, double max_distance, int segs_per_angstroem): # <<<<<<<<<<<<<< - * #TODO documentation + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_AddTraceback("newanalysis.miscellaneous.shellHistograms", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_histograms, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_aufpunkt, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coors, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1345 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * @cython.boundscheck(False) - * def correlateSingleVector(double[:,:] timeseries, double[:] result, int order = 1): # <<<<<<<<<<<<<< - * """ - * Correlate the timeseries of a single vector (e.g. collective dipole, one single particle, etc...) */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_69correlateSingleVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_68correlateSingleVector[] = "\n Correlate the timeseries of a single vector (e.g. collective dipole, one single particle, etc...)\n timeseries ... (number_of_frames, 3)\n result ... (number_of_frames)\n order ... Which order of Lagrangian Polynom (1-6 available)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_69correlateSingleVector = {"correlateSingleVector", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_69correlateSingleVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_68correlateSingleVector}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_69correlateSingleVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_order; +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("correlateSingleVector (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_result,&__pyx_n_s_order,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("correlateSingleVector", 0, 2, 3, 1); __PYX_ERR(0, 1345, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "correlateSingleVector") < 0)) __PYX_ERR(0, 1345, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1345, __pyx_L3_error) - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1345, __pyx_L3_error) - if (values[2]) { - __pyx_v_order = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1345, __pyx_L3_error) - } else { - __pyx_v_order = ((int)1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("correlateSingleVector", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1345, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.correlateSingleVector", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_68correlateSingleVector(__pyx_self, __pyx_v_timeseries, __pyx_v_result, __pyx_v_order); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): + */ + __Pyx_XDECREF(__pyx_r); + __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_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_68correlateSingleVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_result, int __pyx_v_order) { - int __pyx_v_number_of_frames; +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - __Pyx_RefNannySetupContext("correlateSingleVector", 0); + int __pyx_t_1; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - /* "src/helpers/miscellaneous.pyx":1353 - * """ + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 * - * cdef int number_of_frames = timeseries.shape[0] # <<<<<<<<<<<<<< - * correlateSingleVectorTS(×eries[0,0], &result[0], number_of_frames, order) + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: + */ + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":790 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< + * else: + * return () + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); + __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 * + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape + * else: */ - __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[0]); + } - /* "src/helpers/miscellaneous.pyx":1354 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":792 + * return d.subarray.shape + * else: + * return () # <<<<<<<<<<<<<< * - * cdef int number_of_frames = timeseries.shape[0] - * correlateSingleVectorTS(×eries[0,0], &result[0], number_of_frames, order) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries.shape[1]; - __pyx_t_3 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_result.shape[0]; - correlateSingleVectorTS((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_3 * __pyx_v_result.strides[0]) )))), __pyx_v_number_of_frames, __pyx_v_order); + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_empty_tuple); + __pyx_r = __pyx_empty_tuple; + goto __pyx_L0; + } - /* "src/helpers/miscellaneous.pyx":1345 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * @cython.boundscheck(False) - * def correlateSingleVector(double[:,:] timeseries, double[:] result, int order = 1): # <<<<<<<<<<<<<< - * """ - * Correlate the timeseries of a single vector (e.g. collective dipole, one single particle, etc...) + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1); + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1357 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 * - * @cython.boundscheck(False) - * def crossCorrelateSingleVector(double[:,:] timeseries1, double[:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): # <<<<<<<<<<<<<< - * """ - * Correlate the timeseries of two different single vectors (e.g. collective dipole, one single particle, etc...) + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_71crossCorrelateSingleVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_70crossCorrelateSingleVector[] = "\n Correlate the timeseries of two different single vectors (e.g. collective dipole, one single particle, etc...)\n ATTN: Both timeseries need to be equally long! #TODO: Aendern?\n\n timeseries1 ... (number_of_frames1, 3)\n timeseries2 ... (number_of_frames2, 3)\n result ... (number_of_frames)\n both_directions ... Do you want to cross-correlate both vectors, that is + yes/no.\n order ... Which order of Lagrangian Polynom (1-6 available)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_71crossCorrelateSingleVector = {"crossCorrelateSingleVector", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_71crossCorrelateSingleVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_70crossCorrelateSingleVector}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_71crossCorrelateSingleVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_timeseries1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_timeseries2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_both_directions; - int __pyx_v_order; +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("crossCorrelateSingleVector (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries1,&__pyx_n_s_timeseries2,&__pyx_n_s_result,&__pyx_n_s_both_directions,&__pyx_n_s_order,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries1)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("crossCorrelateSingleVector", 0, 3, 5, 1); __PYX_ERR(0, 1357, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("crossCorrelateSingleVector", 0, 3, 5, 2); __PYX_ERR(0, 1357, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_both_directions); - if (value) { values[3] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "crossCorrelateSingleVector") < 0)) __PYX_ERR(0, 1357, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_timeseries1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries1.memview)) __PYX_ERR(0, 1357, __pyx_L3_error) - __pyx_v_timeseries2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries2.memview)) __PYX_ERR(0, 1357, __pyx_L3_error) - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1357, __pyx_L3_error) - if (values[3]) { - __pyx_v_both_directions = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_both_directions == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1357, __pyx_L3_error) - } else { - __pyx_v_both_directions = ((int)1); - } - if (values[4]) { - __pyx_v_order = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1357, __pyx_L3_error) - } else { - __pyx_v_order = ((int)1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("crossCorrelateSingleVector", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1357, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.crossCorrelateSingleVector", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_70crossCorrelateSingleVector(__pyx_self, __pyx_v_timeseries1, __pyx_v_timeseries2, __pyx_v_result, __pyx_v_both_directions, __pyx_v_order); + __Pyx_RefNannySetupContext("set_array_base", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":968 + * + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * + */ + Py_INCREF(__pyx_v_base); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":969 + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 969, __pyx_L1_error) + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) + */ /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_70crossCorrelateSingleVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries1, __Pyx_memviewslice __pyx_v_timeseries2, __Pyx_memviewslice __pyx_v_result, int __pyx_v_both_directions, int __pyx_v_order) { - int __pyx_v_number_of_frames1; - int __pyx_v_number_of_frames2; +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("crossCorrelateSingleVector", 0); + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":972 + * + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None + */ + __pyx_v_base = PyArray_BASE(__pyx_v_arr); - /* "src/helpers/miscellaneous.pyx":1369 - * """ - * - * cdef int number_of_frames1 = timeseries1.shape[0] # <<<<<<<<<<<<<< - * cdef int number_of_frames2 = timeseries2.shape[0] - * crossCorrelateSingleVectorTS(×eries1[0,0], ×eries2[0,0], &result[0], number_of_frames1, number_of_frames2, both_directions, order) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base */ - __pyx_v_number_of_frames1 = (__pyx_v_timeseries1.shape[0]); + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { - /* "src/helpers/miscellaneous.pyx":1370 - * - * cdef int number_of_frames1 = timeseries1.shape[0] - * cdef int number_of_frames2 = timeseries2.shape[0] # <<<<<<<<<<<<<< - * crossCorrelateSingleVectorTS(×eries1[0,0], ×eries2[0,0], &result[0], number_of_frames1, number_of_frames2, both_directions, order) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":974 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base * */ - __pyx_v_number_of_frames2 = (__pyx_v_timeseries2.shape[0]); + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1371 - * cdef int number_of_frames1 = timeseries1.shape[0] - * cdef int number_of_frames2 = timeseries2.shape[0] - * crossCorrelateSingleVectorTS(×eries1[0,0], ×eries2[0,0], &result[0], number_of_frames1, number_of_frames2, both_directions, order) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base + */ + } + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":975 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * # Versions of the import_* functions which are more suitable for */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries1.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries1.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_timeseries2.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_timeseries2.shape[1]; - __pyx_t_5 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_result.shape[0]; - crossCorrelateSingleVectorTS((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries1.data + __pyx_t_1 * __pyx_v_timeseries1.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries1.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries2.data + __pyx_t_3 * __pyx_v_timeseries2.strides[0]) ) + __pyx_t_4 * __pyx_v_timeseries2.strides[1]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_5 * __pyx_v_result.strides[0]) )))), __pyx_v_number_of_frames1, __pyx_v_number_of_frames2, __pyx_v_both_directions, __pyx_v_order); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1357 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) * - * @cython.boundscheck(False) - * def crossCorrelateSingleVector(double[:,:] timeseries1, double[:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): # <<<<<<<<<<<<<< - * """ - * Correlate the timeseries of two different single vectors (e.g. collective dipole, one single particle, etc...) + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1); + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1374 - * - * @cython.boundscheck(False) - * def correlateMultiVector(double[:,:,:] timeseries, double[:] result, int order = 1): # <<<<<<<<<<<<<< - * """ - * Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_73correlateMultiVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_72correlateMultiVector[] = "\n Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...)\n timeseries ... (number_of_particles, number_of_frames, 3)\n result ... (number_of_frames)\n order ... Which order of Lagrangian Polynom (1-6 available)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_73correlateMultiVector = {"correlateMultiVector", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_73correlateMultiVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_72correlateMultiVector}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_73correlateMultiVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_order; +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("correlateMultiVector (wrapper)", 0); + __Pyx_RefNannySetupContext("import_array", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: + */ { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_result,&__pyx_n_s_order,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("correlateMultiVector", 0, 2, 3, 1); __PYX_ERR(0, 1374, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "correlateMultiVector") < 0)) __PYX_ERR(0, 1374, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":981 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") + */ + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 981, __pyx_L3_error) + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: + */ } - __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1374, __pyx_L3_error) - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1374, __pyx_L3_error) - if (values[2]) { - __pyx_v_order = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1374, __pyx_L3_error) - } else { - __pyx_v_order = ((int)1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":982 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.multiarray failed to import") + * + */ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 982, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: + */ + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 983, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 983, __pyx_L5_except_error) } + goto __pyx_L5_except_error; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: + */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("correlateMultiVector", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1374, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.correlateMultiVector", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_72correlateMultiVector(__pyx_self, __pyx_v_timeseries, __pyx_v_result, __pyx_v_order); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() + */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_72correlateMultiVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_result, int __pyx_v_order) { - int __pyx_v_number_of_particles; - int __pyx_v_number_of_frames; - PyObject *__pyx_r = NULL; +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() + */ + +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - __Pyx_RefNannySetupContext("correlateMultiVector", 0); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); - /* "src/helpers/miscellaneous.pyx":1382 - * """ + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * cdef int number_of_particles = timeseries.shape[0] # <<<<<<<<<<<<<< - * cdef int number_of_frames = timeseries.shape[1] - * correlateMultiVectorTS(×eries[0,0,0], &result[0], number_of_particles, number_of_frames, order) + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_v_number_of_particles = (__pyx_v_timeseries.shape[0]); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":987 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") + */ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 987, __pyx_L3_error) - /* "src/helpers/miscellaneous.pyx":1383 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * cdef int number_of_particles = timeseries.shape[0] - * cdef int number_of_frames = timeseries.shape[1] # <<<<<<<<<<<<<< - * correlateMultiVectorTS(×eries[0,0,0], &result[0], number_of_particles, number_of_frames, order) + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":988 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") * */ - __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[1]); + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 988, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "src/helpers/miscellaneous.pyx":1384 - * cdef int number_of_particles = timeseries.shape[0] - * cdef int number_of_frames = timeseries.shape[1] - * correlateMultiVectorTS(×eries[0,0,0], &result[0], number_of_particles, number_of_frames, order) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * cdef inline int import_ufunc() except -1: */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_timeseries.shape[2]; - __pyx_t_4 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_result.shape[0]; - correlateMultiVectorTS((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_3 * __pyx_v_timeseries.strides[2]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_4 * __pyx_v_result.strides[0]) )))), __pyx_v_number_of_particles, __pyx_v_number_of_frames, __pyx_v_order); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 989, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 989, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "src/helpers/miscellaneous.pyx":1374 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * @cython.boundscheck(False) - * def correlateMultiVector(double[:,:,:] timeseries, double[:] result, int order = 1): # <<<<<<<<<<<<<< - * """ - * Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...) + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: + */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") + * + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1); - __Pyx_XGIVEREF(__pyx_r); + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1387 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") * - * @cython.boundscheck(False) - * def correlateMultiVectorShellwise(double [:,:,:] timeseries, double [:,:] dataset, double [:,:] result, int maxshell, int order = 1): # <<<<<<<<<<<<<< - * """ - * timeseries ... (number_of_particles, number_of_frames, 3) + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_75correlateMultiVectorShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_74correlateMultiVectorShellwise[] = "\n timeseries ... (number_of_particles, number_of_frames, 3)\n dataset ... (number_of_frames, number_of_particles)\n result ... (number_of_shells, number_of_frames)\n order ... Which order of Lagrangian Polynom (1-6 available) \n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_75correlateMultiVectorShellwise = {"correlateMultiVectorShellwise", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_75correlateMultiVectorShellwise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_74correlateMultiVectorShellwise}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_75correlateMultiVectorShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell; - int __pyx_v_order; +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("correlateMultiVectorShellwise (wrapper)", 0); + __Pyx_RefNannySetupContext("import_ufunc", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: + */ { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_dataset,&__pyx_n_s_result,&__pyx_n_s_maxshell,&__pyx_n_s_order,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("correlateMultiVectorShellwise", 0, 4, 5, 1); __PYX_ERR(0, 1387, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("correlateMultiVectorShellwise", 0, 4, 5, 2); __PYX_ERR(0, 1387, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("correlateMultiVectorShellwise", 0, 4, 5, 3); __PYX_ERR(0, 1387, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "correlateMultiVectorShellwise") < 0)) __PYX_ERR(0, 1387, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":993 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") + */ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 993, __pyx_L3_error) + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: + */ } - __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1387, __pyx_L3_error) - __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 1387, __pyx_L3_error) - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1387, __pyx_L3_error) - __pyx_v_maxshell = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1387, __pyx_L3_error) - if (values[4]) { - __pyx_v_order = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1387, __pyx_L3_error) - } else { - __pyx_v_order = ((int)1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":994 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") + * + */ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 994, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":995 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 995, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 995, __pyx_L5_except_error) } + goto __pyx_L5_except_error; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: + */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("correlateMultiVectorShellwise", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1387, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.correlateMultiVectorShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_74correlateMultiVectorShellwise(__pyx_self, __pyx_v_timeseries, __pyx_v_dataset, __pyx_v_result, __pyx_v_maxshell, __pyx_v_order); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() + */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_74correlateMultiVectorShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_dataset, __Pyx_memviewslice __pyx_v_result, int __pyx_v_maxshell, int __pyx_v_order) { - int __pyx_v_number_of_particles; - int __pyx_v_number_of_frames; - PyObject *__pyx_r = NULL; +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 + * + * + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` + */ + +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - __Pyx_RefNannySetupContext("correlateMultiVectorShellwise", 0); + __Pyx_RefNannySetupContext("is_timedelta64_object", 0); - /* "src/helpers/miscellaneous.pyx":1395 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1010 + * bool * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< + * * - * cdef int number_of_particles = timeseries.shape[0] # <<<<<<<<<<<<<< - * cdef int number_of_frames = timeseries.shape[1] - * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) */ - __pyx_v_number_of_particles = (__pyx_v_timeseries.shape[0]); + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1396 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - * cdef int number_of_particles = timeseries.shape[0] - * cdef int number_of_frames = timeseries.shape[1] # <<<<<<<<<<<<<< - * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) * + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ - __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[1]); - /* "src/helpers/miscellaneous.pyx":1397 - * cdef int number_of_particles = timeseries.shape[0] - * cdef int number_of_frames = timeseries.shape[1] - * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * def correlateMultiVectorVennShellwise(double [:,:,:] timeseries, double [:,:] dataset1, double [:,:] dataset2, double [:,:,:] result, int maxshell1, int maxshell2, int order = 1): + * + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_timeseries.shape[2]; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dataset.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dataset.shape[1]; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_result.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_result.shape[1]; - correlateMultiVectorShellwiseTS((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_3 * __pyx_v_timeseries.strides[2]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_4 * __pyx_v_dataset.strides[0]) ) + __pyx_t_5 * __pyx_v_dataset.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_6 * __pyx_v_result.strides[0]) ) + __pyx_t_7 * __pyx_v_result.strides[1]) )))), __pyx_v_number_of_particles, __pyx_v_number_of_frames, __pyx_v_maxshell, __pyx_v_order); - /* "src/helpers/miscellaneous.pyx":1387 +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_datetime64_object", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1025 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def correlateMultiVectorShellwise(double [:,:,:] timeseries, double [:,:] dataset, double [:,:] result, int maxshell, int order = 1): # <<<<<<<<<<<<<< + * + */ + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 + * + * + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< * """ - * timeseries ... (number_of_particles, number_of_frames, 3) + * Cython equivalent of `isinstance(obj, np.datetime64)` */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1); - __Pyx_XGIVEREF(__pyx_r); + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1399 - * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 * - * def correlateMultiVectorVennShellwise(double [:,:,:] timeseries, double [:,:] dataset1, double [:,:] dataset2, double [:,:,:] result, int maxshell1, int maxshell2, int order = 1): # <<<<<<<<<<<<<< + * + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< * """ - * timeseries ... (number_of_particles, number_of_frames, 3) + * returns the int64 value underlying scalar numpy datetime64 object */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_77correlateMultiVectorVennShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_76correlateMultiVectorVennShellwise[] = "\n timeseries ... (number_of_particles, number_of_frames, 3)\n dataset1 ... (number_of_frames, number_of_particles)\n dataset2 ... (number_of_frames, number_of_particles)\n result ... (number_of_shells1, number_of_shells2, number_of_frames)\n order ... Which order of Lagrangian Polynom (1-6 available) \n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_77correlateMultiVectorVennShellwise = {"correlateMultiVectorVennShellwise", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_77correlateMultiVectorVennShellwise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_76correlateMultiVectorVennShellwise}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_77correlateMultiVectorVennShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell1; - int __pyx_v_maxshell2; - int __pyx_v_order; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("correlateMultiVectorVennShellwise (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_dataset1,&__pyx_n_s_dataset2,&__pyx_n_s_result,&__pyx_n_s_maxshell1,&__pyx_n_s_maxshell2,&__pyx_n_s_order,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, 1); __PYX_ERR(0, 1399, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, 2); __PYX_ERR(0, 1399, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, 3); __PYX_ERR(0, 1399, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell1)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, 4); __PYX_ERR(0, 1399, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, 5); __PYX_ERR(0, 1399, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order); - if (value) { values[6] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "correlateMultiVectorVennShellwise") < 0)) __PYX_ERR(0, 1399, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1399, __pyx_L3_error) - __pyx_v_dataset1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset1.memview)) __PYX_ERR(0, 1399, __pyx_L3_error) - __pyx_v_dataset2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset2.memview)) __PYX_ERR(0, 1399, __pyx_L3_error) - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1399, __pyx_L3_error) - __pyx_v_maxshell1 = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) - __pyx_v_maxshell2 = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_maxshell2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) - if (values[6]) { - __pyx_v_order = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) - } else { - __pyx_v_order = ((int)1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1399, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.correlateMultiVectorVennShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_76correlateMultiVectorVennShellwise(__pyx_self, __pyx_v_timeseries, __pyx_v_dataset1, __pyx_v_dataset2, __pyx_v_result, __pyx_v_maxshell1, __pyx_v_maxshell2, __pyx_v_order); +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1035 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_76correlateMultiVectorVennShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_dataset1, __Pyx_memviewslice __pyx_v_dataset2, __Pyx_memviewslice __pyx_v_result, int __pyx_v_maxshell1, int __pyx_v_maxshell2, int __pyx_v_order) { - int __pyx_v_number_of_particles; - int __pyx_v_number_of_frames; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("correlateMultiVectorVennShellwise", 0); +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 + * + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object + */ + +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; - /* "src/helpers/miscellaneous.pyx":1408 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1042 + * returns the int64 value underlying scalar numpy timedelta64 object * """ + * return (obj).obval # <<<<<<<<<<<<<< + * * - * cdef int number_of_particles = timeseries.shape[0] # <<<<<<<<<<<<<< - * cdef int number_of_frames = timeseries.shape[1] - * correlateMultiVectorVennShellwiseTS(×eries[0,0,0], &dataset1[0,0], &dataset2[0,0], &result[0,0,0], number_of_particles, number_of_frames, maxshell1, maxshell2, order) */ - __pyx_v_number_of_particles = (__pyx_v_timeseries.shape[0]); + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1409 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 * - * cdef int number_of_particles = timeseries.shape[0] - * cdef int number_of_frames = timeseries.shape[1] # <<<<<<<<<<<<<< - * correlateMultiVectorVennShellwiseTS(×eries[0,0,0], &dataset1[0,0], &dataset2[0,0], &result[0,0,0], number_of_particles, number_of_frames, maxshell1, maxshell2, order) * + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object */ - __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[1]); - /* "src/helpers/miscellaneous.pyx":1410 - * cdef int number_of_particles = timeseries.shape[0] - * cdef int number_of_frames = timeseries.shape[1] - * correlateMultiVectorVennShellwiseTS(×eries[0,0,0], &dataset1[0,0], &dataset2[0,0], &result[0,0,0], number_of_particles, number_of_frames, maxshell1, maxshell2, order) # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 * - * @cython.boundscheck(False) + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = -1; - if (__pyx_t_1 < 0) { - __pyx_t_1 += __pyx_v_timeseries.shape[0]; - if (unlikely(__pyx_t_1 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_1 >= __pyx_v_timeseries.shape[0])) __pyx_t_4 = 0; - if (__pyx_t_2 < 0) { - __pyx_t_2 += __pyx_v_timeseries.shape[1]; - if (unlikely(__pyx_t_2 < 0)) __pyx_t_4 = 1; - } else if (unlikely(__pyx_t_2 >= __pyx_v_timeseries.shape[1])) __pyx_t_4 = 1; - if (__pyx_t_3 < 0) { - __pyx_t_3 += __pyx_v_timeseries.shape[2]; - if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 2; - } else if (unlikely(__pyx_t_3 >= __pyx_v_timeseries.shape[2])) __pyx_t_4 = 2; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - __PYX_ERR(0, 1410, __pyx_L1_error) - } - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_4 = -1; - if (__pyx_t_5 < 0) { - __pyx_t_5 += __pyx_v_dataset1.shape[0]; - if (unlikely(__pyx_t_5 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_5 >= __pyx_v_dataset1.shape[0])) __pyx_t_4 = 0; - if (__pyx_t_6 < 0) { - __pyx_t_6 += __pyx_v_dataset1.shape[1]; - if (unlikely(__pyx_t_6 < 0)) __pyx_t_4 = 1; - } else if (unlikely(__pyx_t_6 >= __pyx_v_dataset1.shape[1])) __pyx_t_4 = 1; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - __PYX_ERR(0, 1410, __pyx_L1_error) - } - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_4 = -1; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_v_dataset2.shape[0]; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_7 >= __pyx_v_dataset2.shape[0])) __pyx_t_4 = 0; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_dataset2.shape[1]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_4 = 1; - } else if (unlikely(__pyx_t_8 >= __pyx_v_dataset2.shape[1])) __pyx_t_4 = 1; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - __PYX_ERR(0, 1410, __pyx_L1_error) - } - __pyx_t_9 = 0; - __pyx_t_10 = 0; - __pyx_t_11 = 0; - __pyx_t_4 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_v_result.shape[0]; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_4 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_v_result.shape[0])) __pyx_t_4 = 0; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_v_result.shape[1]; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_4 = 1; - } else if (unlikely(__pyx_t_10 >= __pyx_v_result.shape[1])) __pyx_t_4 = 1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_v_result.shape[2]; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_4 = 2; - } else if (unlikely(__pyx_t_11 >= __pyx_v_result.shape[2])) __pyx_t_4 = 2; - if (unlikely(__pyx_t_4 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_4); - __PYX_ERR(0, 1410, __pyx_L1_error) - } - correlateMultiVectorVennShellwiseTS((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_3 * __pyx_v_timeseries.strides[2]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset1.data + __pyx_t_5 * __pyx_v_dataset1.strides[0]) ) + __pyx_t_6 * __pyx_v_dataset1.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset2.data + __pyx_t_7 * __pyx_v_dataset2.strides[0]) ) + __pyx_t_8 * __pyx_v_dataset2.strides[1]) )))), (&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_9 * __pyx_v_result.strides[0]) ) + __pyx_t_10 * __pyx_v_result.strides[1]) ) + __pyx_t_11 * __pyx_v_result.strides[2]) )))), __pyx_v_number_of_particles, __pyx_v_number_of_frames, __pyx_v_maxshell1, __pyx_v_maxshell2, __pyx_v_order); - /* "src/helpers/miscellaneous.pyx":1399 - * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1049 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< + */ + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 * - * def correlateMultiVectorVennShellwise(double [:,:,:] timeseries, double [:,:] dataset1, double [:,:] dataset2, double [:,:,:] result, int maxshell1, int maxshell2, int order = 1): # <<<<<<<<<<<<<< + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< * """ - * timeseries ... (number_of_particles, number_of_frames, 3) + * returns the unit part of the dtype for a numpy datetime64 object. */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.correlateMultiVectorVennShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1413 +/* "newanalysis/helpers/miscellaneous.pyx":68 + * void dipten_double_loop2_(double * coor_1, double * coor_2, double * dipt_t, int n_particles_1, int n_particles_2, int only_different_nuclei) * - * @cython.boundscheck(False) - * def crossCorrelateMultiVector(double[:,:,:] timeseries1, double[:,:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): # <<<<<<<<<<<<<< - * """ - * Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def testParallelism(int n_iterations): + * test_parallelism(n_iterations) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_79crossCorrelateMultiVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_78crossCorrelateMultiVector[] = "\n Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...)\n ATTN: Both timeseries need to be equally long and contain the equal amount of particles! #TODO: Aendern?\n\n timeseries1 ... (number_of_particles, number_of_frames, 3)\n timeseries2 ... (number_of_particles, number_of_frames, 3)\n result ... (number_of_frames)\n both_directions ... Do you want to cross-correlate both vectors, that is + yes/no.\n order ... Which order of Lagrangian Polynom (1-6 available)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_79crossCorrelateMultiVector = {"crossCorrelateMultiVector", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_79crossCorrelateMultiVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_78crossCorrelateMultiVector}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_79crossCorrelateMultiVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_timeseries1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_timeseries2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_both_directions; - int __pyx_v_order; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_1testParallelism(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_1testParallelism = {"testParallelism", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_1testParallelism, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_1testParallelism(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + int __pyx_v_n_iterations; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("crossCorrelateMultiVector (wrapper)", 0); + __Pyx_RefNannySetupContext("testParallelism (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 68, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries1,&__pyx_n_s_timeseries2,&__pyx_n_s_result,&__pyx_n_s_both_directions,&__pyx_n_s_order,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n_iterations,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries1)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("crossCorrelateMultiVector", 0, 3, 5, 1); __PYX_ERR(0, 1413, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("crossCorrelateMultiVector", 0, 3, 5, 2); __PYX_ERR(0, 1413, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_both_directions); - if (value) { values[3] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order); - if (value) { values[4] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_iterations)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 68, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "crossCorrelateMultiVector") < 0)) __PYX_ERR(0, 1413, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "testParallelism") < 0)) __PYX_ERR(0, 68, __pyx_L3_error) } - } - __pyx_v_timeseries1 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries1.memview)) __PYX_ERR(0, 1413, __pyx_L3_error) - __pyx_v_timeseries2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries2.memview)) __PYX_ERR(0, 1413, __pyx_L3_error) - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1413, __pyx_L3_error) - if (values[3]) { - __pyx_v_both_directions = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_both_directions == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1413, __pyx_L3_error) - } else { - __pyx_v_both_directions = ((int)1); - } - if (values[4]) { - __pyx_v_order = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1413, __pyx_L3_error) + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - __pyx_v_order = ((int)1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } + __pyx_v_n_iterations = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_n_iterations == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("crossCorrelateMultiVector", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1413, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("testParallelism", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 68, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.crossCorrelateMultiVector", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.miscellaneous.testParallelism", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_78crossCorrelateMultiVector(__pyx_self, __pyx_v_timeseries1, __pyx_v_timeseries2, __pyx_v_result, __pyx_v_both_directions, __pyx_v_order); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_testParallelism(__pyx_self, __pyx_v_n_iterations); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_78crossCorrelateMultiVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries1, __Pyx_memviewslice __pyx_v_timeseries2, __Pyx_memviewslice __pyx_v_result, int __pyx_v_both_directions, int __pyx_v_order) { - int __pyx_v_number_of_particles; - int __pyx_v_number_of_frames1; - int __pyx_v_number_of_frames2; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_testParallelism(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n_iterations) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - __Pyx_RefNannySetupContext("crossCorrelateMultiVector", 0); - - /* "src/helpers/miscellaneous.pyx":1425 - * """ - * - * cdef int number_of_particles = timeseries1.shape[0] # <<<<<<<<<<<<<< - * cdef int number_of_frames1 = timeseries1.shape[1] - * cdef int number_of_frames2 = timeseries2.shape[1] - */ - __pyx_v_number_of_particles = (__pyx_v_timeseries1.shape[0]); - - /* "src/helpers/miscellaneous.pyx":1426 - * - * cdef int number_of_particles = timeseries1.shape[0] - * cdef int number_of_frames1 = timeseries1.shape[1] # <<<<<<<<<<<<<< - * cdef int number_of_frames2 = timeseries2.shape[1] - * crossCorrelateMultiVectorTS(×eries1[0,0,0], ×eries2[0,0,0], &result[0], number_of_particles, number_of_frames1, number_of_frames2, both_directions, order) - */ - __pyx_v_number_of_frames1 = (__pyx_v_timeseries1.shape[1]); + __Pyx_RefNannySetupContext("testParallelism", 0); - /* "src/helpers/miscellaneous.pyx":1427 - * cdef int number_of_particles = timeseries1.shape[0] - * cdef int number_of_frames1 = timeseries1.shape[1] - * cdef int number_of_frames2 = timeseries2.shape[1] # <<<<<<<<<<<<<< - * crossCorrelateMultiVectorTS(×eries1[0,0,0], ×eries2[0,0,0], &result[0], number_of_particles, number_of_frames1, number_of_frames2, both_directions, order) + /* "newanalysis/helpers/miscellaneous.pyx":70 + * @cython.boundscheck(False) + * def testParallelism(int n_iterations): + * test_parallelism(n_iterations) # <<<<<<<<<<<<<< + * return * */ - __pyx_v_number_of_frames2 = (__pyx_v_timeseries2.shape[1]); + test_parallelism(__pyx_v_n_iterations); - /* "src/helpers/miscellaneous.pyx":1428 - * cdef int number_of_frames1 = timeseries1.shape[1] - * cdef int number_of_frames2 = timeseries2.shape[1] - * crossCorrelateMultiVectorTS(×eries1[0,0,0], ×eries2[0,0,0], &result[0], number_of_particles, number_of_frames1, number_of_frames2, both_directions, order) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":71 + * def testParallelism(int n_iterations): + * test_parallelism(n_iterations) + * return # <<<<<<<<<<<<<< * * @cython.boundscheck(False) */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries1.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries1.shape[1]; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_timeseries1.shape[2]; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_timeseries2.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_timeseries2.shape[1]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_timeseries2.shape[2]; - __pyx_t_7 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_result.shape[0]; - crossCorrelateMultiVectorTS((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries1.data + __pyx_t_1 * __pyx_v_timeseries1.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries1.strides[1]) ) + __pyx_t_3 * __pyx_v_timeseries1.strides[2]) )))), (&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries2.data + __pyx_t_4 * __pyx_v_timeseries2.strides[0]) ) + __pyx_t_5 * __pyx_v_timeseries2.strides[1]) ) + __pyx_t_6 * __pyx_v_timeseries2.strides[2]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_7 * __pyx_v_result.strides[0]) )))), __pyx_v_number_of_particles, __pyx_v_number_of_frames1, __pyx_v_number_of_frames2, __pyx_v_both_directions, __pyx_v_order); + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1413 + /* "newanalysis/helpers/miscellaneous.pyx":68 + * void dipten_double_loop2_(double * coor_1, double * coor_2, double * dipt_t, int n_particles_1, int n_particles_2, int only_different_nuclei) * - * @cython.boundscheck(False) - * def crossCorrelateMultiVector(double[:,:,:] timeseries1, double[:,:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): # <<<<<<<<<<<<<< - * """ - * Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def testParallelism(int n_iterations): + * test_parallelism(n_iterations) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1); + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1431 +/* "newanalysis/helpers/miscellaneous.pyx":73 + * return * - * @cython.boundscheck(False) - * def correlateSingleParticleMuShellwise(double[:,:,:] timeseries, double[:,:] result, int[:,:] dataset, int number_of_startingpoints): # <<<<<<<<<<<<<< - * """ - * timeseries... (N_particle, number_of_frames, mu) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def countHBonds(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist, double cos_angle=-0.95): + * # this function is designed only for water hydrogen bonds! */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_81correlateSingleParticleMuShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_80correlateSingleParticleMuShellwise[] = "\n timeseries... (N_particle, number_of_frames, mu)\n result ... (N_shell, correlation_length)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_81correlateSingleParticleMuShellwise = {"correlateSingleParticleMuShellwise", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_81correlateSingleParticleMuShellwise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_80correlateSingleParticleMuShellwise}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_81correlateSingleParticleMuShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_number_of_startingpoints; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_3countHBonds(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_3countHBonds = {"countHBonds", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_3countHBonds, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_3countHBonds(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor_surr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor_oh2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_nres_surr; + double __pyx_v_maxdist; + double __pyx_v_cos_angle; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("correlateSingleParticleMuShellwise (wrapper)", 0); + __Pyx_RefNannySetupContext("countHBonds (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 73, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_result,&__pyx_n_s_dataset,&__pyx_n_s_number_of_startingpoints,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor_surr,&__pyx_n_s_coor_oh2,&__pyx_n_s_nres_surr,&__pyx_n_s_maxdist,&__pyx_n_s_cos_angle,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_surr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_oh2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuShellwise", 1, 4, 4, 1); __PYX_ERR(0, 1431, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countHBonds", 0, 4, 5, 1); __PYX_ERR(0, 73, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nres_surr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuShellwise", 1, 4, 4, 2); __PYX_ERR(0, 1431, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countHBonds", 0, 4, 5, 2); __PYX_ERR(0, 73, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_number_of_startingpoints)) != 0)) kw_args--; + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxdist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuShellwise", 1, 4, 4, 3); __PYX_ERR(0, 1431, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countHBonds", 0, 4, 5, 3); __PYX_ERR(0, 73, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cos_angle); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "correlateSingleParticleMuShellwise") < 0)) __PYX_ERR(0, 1431, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "countHBonds") < 0)) __PYX_ERR(0, 73, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_coor_surr = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_surr.memview)) __PYX_ERR(0, 74, __pyx_L3_error) + __pyx_v_coor_oh2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_oh2.memview)) __PYX_ERR(0, 74, __pyx_L3_error) + __pyx_v_nres_surr = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nres_surr == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) + __pyx_v_maxdist = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_maxdist == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) + if (values[4]) { + __pyx_v_cos_angle = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_cos_angle == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) + } else { + __pyx_v_cos_angle = ((double)((double)-0.95)); } - __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1431, __pyx_L3_error) - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1431, __pyx_L3_error) - __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 1431, __pyx_L3_error) - __pyx_v_number_of_startingpoints = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_number_of_startingpoints == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1431, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuShellwise", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1431, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countHBonds", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 73, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.correlateSingleParticleMuShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_surr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_oh2, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.countHBonds", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_80correlateSingleParticleMuShellwise(__pyx_self, __pyx_v_timeseries, __pyx_v_result, __pyx_v_dataset, __pyx_v_number_of_startingpoints); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_2countHBonds(__pyx_self, __pyx_v_coor_surr, __pyx_v_coor_oh2, __pyx_v_nres_surr, __pyx_v_maxdist, __pyx_v_cos_angle); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_surr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_oh2, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_80correlateSingleParticleMuShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_result, __Pyx_memviewslice __pyx_v_dataset, int __pyx_v_number_of_startingpoints) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_2countHBonds(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor_surr, __Pyx_memviewslice __pyx_v_coor_oh2, int __pyx_v_nres_surr, double __pyx_v_maxdist, double __pyx_v_cos_angle) { + int __pyx_v_sites_per_res; + int __pyx_v_nsurr; + int __pyx_v_nwat; int __pyx_v_i; int __pyx_v_j; int __pyx_v_k; - int __pyx_v_shell; - int __pyx_v_particles; - int __pyx_v_number_of_frames; - int __pyx_v_number_of_shells; - int __pyx_v_correlation_length; - CYTHON_UNUSED __Pyx_memviewslice __pyx_v_sub_correlation = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_norm; - __Pyx_memviewslice __pyx_v_counter = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_l; + int __pyx_v_idx; + int __pyx_v_idx2; + int __pyx_v_idx3; + __Pyx_memviewslice __pyx_v_hbond = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_dx; + double __pyx_v_dy; + double __pyx_v_dz; + double __pyx_v_dx2; + double __pyx_v_dy2; + double __pyx_v_dz2; + double __pyx_v_dot; + double __pyx_v_dot2; + double __pyx_v_dist; + double __pyx_v_dist2; + double __pyx_v_cosine; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_6; + PyObject *__pyx_t_5 = NULL; + __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_8; + int __pyx_t_9; int __pyx_t_10; int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; Py_ssize_t __pyx_t_19; Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - int __pyx_t_30; - int __pyx_t_31; - int __pyx_t_32; - double __pyx_t_33; + int __pyx_t_21; + double __pyx_t_22; + double __pyx_t_23; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("correlateSingleParticleMuShellwise", 0); - - /* "src/helpers/miscellaneous.pyx":1438 - * - * cdef int i, j, k, shell - * cdef int particles = timeseries.shape[1] # <<<<<<<<<<<<<< - * cdef int number_of_frames = timeseries.shape[0] - * cdef int number_of_shells = result.shape[0] - */ - __pyx_v_particles = (__pyx_v_timeseries.shape[1]); - - /* "src/helpers/miscellaneous.pyx":1439 - * cdef int i, j, k, shell - * cdef int particles = timeseries.shape[1] - * cdef int number_of_frames = timeseries.shape[0] # <<<<<<<<<<<<<< - * cdef int number_of_shells = result.shape[0] - * cdef int correlation_length = result.shape[1] - */ - __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[0]); - - /* "src/helpers/miscellaneous.pyx":1440 - * cdef int particles = timeseries.shape[1] - * cdef int number_of_frames = timeseries.shape[0] - * cdef int number_of_shells = result.shape[0] # <<<<<<<<<<<<<< - * cdef int correlation_length = result.shape[1] - * cdef double [:] sub_correlation = np.zeros((correlation_length)) - */ - __pyx_v_number_of_shells = (__pyx_v_result.shape[0]); - - /* "src/helpers/miscellaneous.pyx":1441 - * cdef int number_of_frames = timeseries.shape[0] - * cdef int number_of_shells = result.shape[0] - * cdef int correlation_length = result.shape[1] # <<<<<<<<<<<<<< - * cdef double [:] sub_correlation = np.zeros((correlation_length)) - * cdef double norm - */ - __pyx_v_correlation_length = (__pyx_v_result.shape[1]); - - /* "src/helpers/miscellaneous.pyx":1442 - * cdef int number_of_shells = result.shape[0] - * cdef int correlation_length = result.shape[1] - * cdef double [:] sub_correlation = np.zeros((correlation_length)) # <<<<<<<<<<<<<< - * cdef double norm - * cdef double [:] counter = np.zeros((number_of_shells)) - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1442, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1442, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_correlation_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1442, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1442, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_sub_correlation = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + __Pyx_RefNannySetupContext("countHBonds", 0); - /* "src/helpers/miscellaneous.pyx":1444 - * cdef double [:] sub_correlation = np.zeros((correlation_length)) - * cdef double norm - * cdef double [:] counter = np.zeros((number_of_shells)) # <<<<<<<<<<<<<< - * - * if(correlation_length > number_of_frames): + /* "newanalysis/helpers/miscellaneous.pyx":76 + * def countHBonds(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist, double cos_angle=-0.95): + * # this function is designed only for water hydrogen bonds! + * cdef int sites_per_res = coor_surr.shape[0] // nres_surr # <<<<<<<<<<<<<< + * cdef int nsurr = coor_surr.shape[0] // sites_per_res + * cdef int nwat = coor_oh2.shape[0] // 3 */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_number_of_shells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } + if (unlikely(__pyx_v_nres_surr == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 76, __pyx_L1_error) } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1444, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_counter = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; - - /* "src/helpers/miscellaneous.pyx":1446 - * cdef double [:] counter = np.zeros((number_of_shells)) - * - * if(correlation_length > number_of_frames): # <<<<<<<<<<<<<< - * print("Correlation length must not be longer than the available trajectory length") - * return - */ - __pyx_t_6 = ((__pyx_v_correlation_length > __pyx_v_number_of_frames) != 0); - if (__pyx_t_6) { - - /* "src/helpers/miscellaneous.pyx":1447 - * - * if(correlation_length > number_of_frames): - * print("Correlation length must not be longer than the available trajectory length") # <<<<<<<<<<<<<< - * return - * - */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Correlation_length_must_not_be_l) < 0) __PYX_ERR(0, 1447, __pyx_L1_error) - - /* "src/helpers/miscellaneous.pyx":1448 - * if(correlation_length > number_of_frames): - * print("Correlation length must not be longer than the available trajectory length") - * return # <<<<<<<<<<<<<< - * - * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "src/helpers/miscellaneous.pyx":1446 - * cdef double [:] counter = np.zeros((number_of_shells)) - * - * if(correlation_length > number_of_frames): # <<<<<<<<<<<<<< - * print("Correlation length must not be longer than the available trajectory length") - * return - */ + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_nres_surr == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW((__pyx_v_coor_surr.shape[0])))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 76, __pyx_L1_error) } + __pyx_v_sites_per_res = __Pyx_div_Py_ssize_t((__pyx_v_coor_surr.shape[0]), __pyx_v_nres_surr); - /* "src/helpers/miscellaneous.pyx":1450 - * return - * - * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: # <<<<<<<<<<<<<< - * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") - * return + /* "newanalysis/helpers/miscellaneous.pyx":77 + * # this function is designed only for water hydrogen bonds! + * cdef int sites_per_res = coor_surr.shape[0] // nres_surr + * cdef int nsurr = coor_surr.shape[0] // sites_per_res # <<<<<<<<<<<<<< + * cdef int nwat = coor_oh2.shape[0] // 3 + * cdef int i, j, k, l, idx, idx2, idx3 */ - __pyx_t_7 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); - if (unlikely(__pyx_v_number_of_startingpoints == 0)) { + if (unlikely(__pyx_v_sites_per_res == 0)) { PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1450, __pyx_L1_error) + __PYX_ERR(0, 77, __pyx_L1_error) } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_number_of_startingpoints == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_7))) { + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_sites_per_res == (int)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW((__pyx_v_coor_surr.shape[0])))) { PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1450, __pyx_L1_error) + __PYX_ERR(0, 77, __pyx_L1_error) } - __pyx_t_6 = ((__Pyx_div_int(__pyx_t_7, __pyx_v_number_of_startingpoints) == 0) != 0); - if (__pyx_t_6) { - - /* "src/helpers/miscellaneous.pyx":1451 - * - * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: - * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") # <<<<<<<<<<<<<< - * return - * - */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Number_of_starting_points_too_hi) < 0) __PYX_ERR(0, 1451, __pyx_L1_error) - - /* "src/helpers/miscellaneous.pyx":1452 - * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: - * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") - * return # <<<<<<<<<<<<<< - * - * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_v_nsurr = __Pyx_div_Py_ssize_t((__pyx_v_coor_surr.shape[0]), __pyx_v_sites_per_res); - /* "src/helpers/miscellaneous.pyx":1450 - * return + /* "newanalysis/helpers/miscellaneous.pyx":78 + * cdef int sites_per_res = coor_surr.shape[0] // nres_surr + * cdef int nsurr = coor_surr.shape[0] // sites_per_res + * cdef int nwat = coor_oh2.shape[0] // 3 # <<<<<<<<<<<<<< + * cdef int i, j, k, l, idx, idx2, idx3 * - * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: # <<<<<<<<<<<<<< - * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") - * return */ - } + __pyx_v_nwat = __Pyx_div_Py_ssize_t((__pyx_v_coor_oh2.shape[0]), 3); - /* "src/helpers/miscellaneous.pyx":1454 - * return + /* "newanalysis/helpers/miscellaneous.pyx":81 + * cdef int i, j, k, l, idx, idx2, idx3 * - * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): # <<<<<<<<<<<<<< - * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") + * cdef int [:] hbond = np.zeros(nwat, dtype=np.int32) # <<<<<<<<<<<<<< * + * cdef double dx, dy, dz, dx2, dy2, dz2, dot, dot2, dist, dist2, cosine */ - __pyx_t_7 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); - if (unlikely(((double)__pyx_v_number_of_startingpoints) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 1454, __pyx_L1_error) - } - __pyx_t_1 = PyFloat_FromDouble((__pyx_t_7 / ((double)__pyx_v_number_of_startingpoints))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1454, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); - if (unlikely(__pyx_v_number_of_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1454, __pyx_L1_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_number_of_startingpoints == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_7))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1454, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_PyInt_From_int(__Pyx_div_int(__pyx_t_7, __pyx_v_number_of_startingpoints)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1454, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_NeObjC(__pyx_t_2, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1454, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nwat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1454, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_hbond = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "src/helpers/miscellaneous.pyx":1455 - * - * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): - * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":86 * - * #Loop over each starting point + * # loop over water molecules + * for i in prange(nwat, nogil=True): # <<<<<<<<<<<<<< + * # loop over h atoms + * for j in range(2): + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_7 = __pyx_v_nwat; + { + double __pyx_parallel_temp0 = ((double)__PYX_NAN()); + double __pyx_parallel_temp1 = ((double)__PYX_NAN()); + double __pyx_parallel_temp2 = ((double)__PYX_NAN()); + double __pyx_parallel_temp3 = ((double)__PYX_NAN()); + double __pyx_parallel_temp4 = ((double)__PYX_NAN()); + double __pyx_parallel_temp5 = ((double)__PYX_NAN()); + double __pyx_parallel_temp6 = ((double)__PYX_NAN()); + double __pyx_parallel_temp7 = ((double)__PYX_NAN()); + double __pyx_parallel_temp8 = ((double)__PYX_NAN()); + double __pyx_parallel_temp9 = ((double)__PYX_NAN()); + double __pyx_parallel_temp10 = ((double)__PYX_NAN()); + int __pyx_parallel_temp11 = ((int)0xbad0bad0); + int __pyx_parallel_temp12 = ((int)0xbad0bad0); + int __pyx_parallel_temp13 = ((int)0xbad0bad0); + int __pyx_parallel_temp14 = ((int)0xbad0bad0); + int __pyx_parallel_temp15 = ((int)0xbad0bad0); + int __pyx_parallel_temp16 = ((int)0xbad0bad0); + int __pyx_parallel_temp17 = ((int)0xbad0bad0); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_9 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_9 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_cosine) lastprivate(__pyx_v_dist) lastprivate(__pyx_v_dist2) lastprivate(__pyx_v_dot) lastprivate(__pyx_v_dot2) lastprivate(__pyx_v_dx) lastprivate(__pyx_v_dx2) lastprivate(__pyx_v_dy) lastprivate(__pyx_v_dy2) lastprivate(__pyx_v_dz) lastprivate(__pyx_v_dz2) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_idx) lastprivate(__pyx_v_idx2) lastprivate(__pyx_v_idx3) lastprivate(__pyx_v_j) lastprivate(__pyx_v_k) lastprivate(__pyx_v_l) + #endif /* _OPENMP */ + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_8); + /* Initialize private variables to invalid values */ + __pyx_v_cosine = ((double)__PYX_NAN()); + __pyx_v_dist = ((double)__PYX_NAN()); + __pyx_v_dist2 = ((double)__PYX_NAN()); + __pyx_v_dot = ((double)__PYX_NAN()); + __pyx_v_dot2 = ((double)__PYX_NAN()); + __pyx_v_dx = ((double)__PYX_NAN()); + __pyx_v_dx2 = ((double)__PYX_NAN()); + __pyx_v_dy = ((double)__PYX_NAN()); + __pyx_v_dy2 = ((double)__PYX_NAN()); + __pyx_v_dz = ((double)__PYX_NAN()); + __pyx_v_dz2 = ((double)__PYX_NAN()); + __pyx_v_idx = ((int)0xbad0bad0); + __pyx_v_idx2 = ((int)0xbad0bad0); + __pyx_v_idx3 = ((int)0xbad0bad0); + __pyx_v_j = ((int)0xbad0bad0); + __pyx_v_k = ((int)0xbad0bad0); + __pyx_v_l = ((int)0xbad0bad0); + + /* "newanalysis/helpers/miscellaneous.pyx":88 + * for i in prange(nwat, nogil=True): + * # loop over h atoms + * for j in range(2): # <<<<<<<<<<<<<< + * idx = i*3+1+j + * idx3 = i*3 */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Warning_number_of_frames_correla) < 0) __PYX_ERR(0, 1455, __pyx_L1_error) + for (__pyx_t_10 = 0; __pyx_t_10 < 2; __pyx_t_10+=1) { + __pyx_v_j = __pyx_t_10; - /* "src/helpers/miscellaneous.pyx":1454 - * return - * - * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): # <<<<<<<<<<<<<< - * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") - * + /* "newanalysis/helpers/miscellaneous.pyx":89 + * # loop over h atoms + * for j in range(2): + * idx = i*3+1+j # <<<<<<<<<<<<<< + * idx3 = i*3 + * # loop over surrounding molecules */ - } + __pyx_v_idx = (((__pyx_v_i * 3) + 1) + __pyx_v_j); - /* "src/helpers/miscellaneous.pyx":1458 - * - * #Loop over each starting point - * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): # <<<<<<<<<<<<<< - * #Loop over each particle - * for j in range(0, particles): + /* "newanalysis/helpers/miscellaneous.pyx":90 + * for j in range(2): + * idx = i*3+1+j + * idx3 = i*3 # <<<<<<<<<<<<<< + * # loop over surrounding molecules + * for k in range(nsurr): */ - __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_number_of_frames - __pyx_v_correlation_length)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); - if (unlikely(__pyx_v_number_of_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1458, __pyx_L1_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_number_of_startingpoints == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_7))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1458, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_PyInt_From_int(__Pyx_div_int(__pyx_t_7, __pyx_v_number_of_startingpoints)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1458, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1458, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1458, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_9(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1458, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1458, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_i = __pyx_t_7; + __pyx_v_idx3 = (__pyx_v_i * 3); + + /* "newanalysis/helpers/miscellaneous.pyx":92 + * idx3 = i*3 + * # loop over surrounding molecules + * for k in range(nsurr): # <<<<<<<<<<<<<< + * # loop over oxygen atoms + * for l in range(sites_per_res): + */ + __pyx_t_11 = __pyx_v_nsurr; + __pyx_t_12 = __pyx_t_11; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_k = __pyx_t_13; + + /* "newanalysis/helpers/miscellaneous.pyx":94 + * for k in range(nsurr): + * # loop over oxygen atoms + * for l in range(sites_per_res): # <<<<<<<<<<<<<< + * idx2 = k*sites_per_res+l + * dx = coor_surr[idx2,0] - coor_oh2[idx,0] + */ + __pyx_t_14 = __pyx_v_sites_per_res; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_l = __pyx_t_16; - /* "src/helpers/miscellaneous.pyx":1460 - * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): - * #Loop over each particle - * for j in range(0, particles): # <<<<<<<<<<<<<< - * shell = dataset[j, i] - 1 - * if(shell < number_of_shells): + /* "newanalysis/helpers/miscellaneous.pyx":95 + * # loop over oxygen atoms + * for l in range(sites_per_res): + * idx2 = k*sites_per_res+l # <<<<<<<<<<<<<< + * dx = coor_surr[idx2,0] - coor_oh2[idx,0] + * dy = coor_surr[idx2,1] - coor_oh2[idx,1] */ - __pyx_t_7 = __pyx_v_particles; - __pyx_t_10 = __pyx_t_7; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_j = __pyx_t_11; + __pyx_v_idx2 = ((__pyx_v_k * __pyx_v_sites_per_res) + __pyx_v_l); - /* "src/helpers/miscellaneous.pyx":1461 - * #Loop over each particle - * for j in range(0, particles): - * shell = dataset[j, i] - 1 # <<<<<<<<<<<<<< - * if(shell < number_of_shells): - * #Loop over each distance + /* "newanalysis/helpers/miscellaneous.pyx":96 + * for l in range(sites_per_res): + * idx2 = k*sites_per_res+l + * dx = coor_surr[idx2,0] - coor_oh2[idx,0] # <<<<<<<<<<<<<< + * dy = coor_surr[idx2,1] - coor_oh2[idx,1] + * dz = coor_surr[idx2,2] - coor_oh2[idx,2] */ - __pyx_t_12 = __pyx_v_j; - __pyx_t_13 = __pyx_v_i; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_dataset.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_dataset.shape[1]; - __pyx_v_shell = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_12 * __pyx_v_dataset.strides[0]) ) + __pyx_t_13 * __pyx_v_dataset.strides[1]) ))) - 1); + __pyx_t_17 = __pyx_v_idx2; + __pyx_t_18 = 0; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_surr.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_surr.shape[1]; + __pyx_t_19 = __pyx_v_idx; + __pyx_t_20 = 0; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dx = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_17 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_18 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_oh2.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1462 - * for j in range(0, particles): - * shell = dataset[j, i] - 1 - * if(shell < number_of_shells): # <<<<<<<<<<<<<< - * #Loop over each distance - * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] + /* "newanalysis/helpers/miscellaneous.pyx":97 + * idx2 = k*sites_per_res+l + * dx = coor_surr[idx2,0] - coor_oh2[idx,0] + * dy = coor_surr[idx2,1] - coor_oh2[idx,1] # <<<<<<<<<<<<<< + * dz = coor_surr[idx2,2] - coor_oh2[idx,2] + * dot = dx*dx + dy*dy + dz*dz */ - __pyx_t_6 = ((__pyx_v_shell < __pyx_v_number_of_shells) != 0); - if (__pyx_t_6) { + __pyx_t_20 = __pyx_v_idx2; + __pyx_t_19 = 1; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_surr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_surr.shape[1]; + __pyx_t_18 = __pyx_v_idx; + __pyx_t_17 = 1; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dy = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_20 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_18 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_17 * __pyx_v_coor_oh2.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1464 - * if(shell < number_of_shells): - * #Loop over each distance - * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] # <<<<<<<<<<<<<< - * - * if(norm != 0): + /* "newanalysis/helpers/miscellaneous.pyx":98 + * dx = coor_surr[idx2,0] - coor_oh2[idx,0] + * dy = coor_surr[idx2,1] - coor_oh2[idx,1] + * dz = coor_surr[idx2,2] - coor_oh2[idx,2] # <<<<<<<<<<<<<< + * dot = dx*dx + dy*dy + dz*dz + * dist = sqrt(dot) */ - __pyx_t_13 = __pyx_v_i; - __pyx_t_12 = __pyx_v_j; - __pyx_t_14 = 0; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_timeseries.shape[2]; - __pyx_t_15 = __pyx_v_i; - __pyx_t_16 = __pyx_v_j; - __pyx_t_17 = 0; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_timeseries.shape[2]; - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - __pyx_t_20 = 1; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_timeseries.shape[2]; - __pyx_t_21 = __pyx_v_i; - __pyx_t_22 = __pyx_v_j; - __pyx_t_23 = 1; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_timeseries.shape[2]; - __pyx_t_24 = __pyx_v_i; - __pyx_t_25 = __pyx_v_j; - __pyx_t_26 = 2; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_timeseries.shape[2]; - __pyx_t_27 = __pyx_v_i; - __pyx_t_28 = __pyx_v_j; - __pyx_t_29 = 2; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_timeseries.shape[2]; - __pyx_v_norm = ((((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_13 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_12 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_14 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_15 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_16 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_17 * __pyx_v_timeseries.strides[2]) )))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_18 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_19 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_20 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_21 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_22 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_23 * __pyx_v_timeseries.strides[2]) ))))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_24 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_25 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_26 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_27 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_28 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_29 * __pyx_v_timeseries.strides[2]) ))))); + __pyx_t_17 = __pyx_v_idx2; + __pyx_t_18 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_surr.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_surr.shape[1]; + __pyx_t_19 = __pyx_v_idx; + __pyx_t_20 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dz = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surr.data + __pyx_t_17 * __pyx_v_coor_surr.strides[0]) ) + __pyx_t_18 * __pyx_v_coor_surr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_oh2.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1466 - * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] - * - * if(norm != 0): # <<<<<<<<<<<<<< - * for k in range(i, i+correlation_length): - * result[shell][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm + /* "newanalysis/helpers/miscellaneous.pyx":99 + * dy = coor_surr[idx2,1] - coor_oh2[idx,1] + * dz = coor_surr[idx2,2] - coor_oh2[idx,2] + * dot = dx*dx + dy*dy + dz*dz # <<<<<<<<<<<<<< + * dist = sqrt(dot) + * if dist < maxdist: */ - __pyx_t_6 = ((__pyx_v_norm != 0.0) != 0); - if (__pyx_t_6) { + __pyx_v_dot = (((__pyx_v_dx * __pyx_v_dx) + (__pyx_v_dy * __pyx_v_dy)) + (__pyx_v_dz * __pyx_v_dz)); - /* "src/helpers/miscellaneous.pyx":1467 - * - * if(norm != 0): - * for k in range(i, i+correlation_length): # <<<<<<<<<<<<<< - * result[shell][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm - * + /* "newanalysis/helpers/miscellaneous.pyx":100 + * dz = coor_surr[idx2,2] - coor_oh2[idx,2] + * dot = dx*dx + dy*dy + dz*dz + * dist = sqrt(dot) # <<<<<<<<<<<<<< + * if dist < maxdist: + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] */ - __pyx_t_30 = (__pyx_v_i + __pyx_v_correlation_length); - __pyx_t_31 = __pyx_t_30; - for (__pyx_t_32 = __pyx_v_i; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { - __pyx_v_k = __pyx_t_32; + __pyx_v_dist = sqrt(__pyx_v_dot); - /* "src/helpers/miscellaneous.pyx":1468 - * if(norm != 0): - * for k in range(i, i+correlation_length): - * result[shell][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm # <<<<<<<<<<<<<< - * - * #for k in range(0, correlation_length): + /* "newanalysis/helpers/miscellaneous.pyx":101 + * dot = dx*dx + dy*dy + dz*dz + * dist = sqrt(dot) + * if dist < maxdist: # <<<<<<<<<<<<<< + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] */ - __pyx_t_29 = __pyx_v_k; - __pyx_t_28 = __pyx_v_j; - __pyx_t_27 = 0; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_timeseries.shape[2]; - __pyx_t_26 = __pyx_v_i; - __pyx_t_25 = __pyx_v_j; - __pyx_t_24 = 0; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_timeseries.shape[2]; - __pyx_t_23 = __pyx_v_k; - __pyx_t_22 = __pyx_v_j; - __pyx_t_21 = 1; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_timeseries.shape[2]; - __pyx_t_20 = __pyx_v_i; - __pyx_t_19 = __pyx_v_j; - __pyx_t_18 = 1; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_timeseries.shape[2]; - __pyx_t_17 = __pyx_v_k; - __pyx_t_16 = __pyx_v_j; - __pyx_t_15 = 2; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_timeseries.shape[2]; - __pyx_t_14 = __pyx_v_i; - __pyx_t_12 = __pyx_v_j; - __pyx_t_13 = 2; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_timeseries.shape[2]; - __pyx_t_33 = ((((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_29 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_28 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_27 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_26 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_25 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_24 * __pyx_v_timeseries.strides[2]) )))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_23 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_22 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_21 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_20 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_19 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_18 * __pyx_v_timeseries.strides[2]) ))))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_17 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_16 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_15 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_14 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_12 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_13 * __pyx_v_timeseries.strides[2]) ))))); - if (unlikely(__pyx_v_norm == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 1468, __pyx_L1_error) - } - __pyx_t_13 = __pyx_v_shell; - __pyx_t_12 = (__pyx_v_k - __pyx_v_i); - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_result.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_result.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_13 * __pyx_v_result.strides[0]) ) + __pyx_t_12 * __pyx_v_result.strides[1]) )) += (__pyx_t_33 / __pyx_v_norm); - } + __pyx_t_21 = (__pyx_v_dist < __pyx_v_maxdist); + if (__pyx_t_21) { - /* "src/helpers/miscellaneous.pyx":1472 - * #for k in range(0, correlation_length): - * #result[shell][k] += sub_correlation[k] - * counter[shell] += 1 # <<<<<<<<<<<<<< - * - * for i in range(0, number_of_shells): + /* "newanalysis/helpers/miscellaneous.pyx":102 + * dist = sqrt(dot) + * if dist < maxdist: + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] # <<<<<<<<<<<<<< + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] + * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] */ - __pyx_t_12 = __pyx_v_shell; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_counter.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_12 * __pyx_v_counter.strides[0]) )) += 1.0; + __pyx_t_20 = __pyx_v_idx3; + __pyx_t_19 = 0; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[1]; + __pyx_t_18 = __pyx_v_idx; + __pyx_t_17 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dx2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_20 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_18 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_17 * __pyx_v_coor_oh2.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1466 - * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] - * - * if(norm != 0): # <<<<<<<<<<<<<< - * for k in range(i, i+correlation_length): - * result[shell][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm + /* "newanalysis/helpers/miscellaneous.pyx":103 + * if dist < maxdist: + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] # <<<<<<<<<<<<<< + * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] + * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 */ - } + __pyx_t_17 = __pyx_v_idx3; + __pyx_t_18 = 1; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_oh2.shape[1]; + __pyx_t_19 = __pyx_v_idx; + __pyx_t_20 = 1; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dy2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_17 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_18 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_19 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_20 * __pyx_v_coor_oh2.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1462 - * for j in range(0, particles): - * shell = dataset[j, i] - 1 - * if(shell < number_of_shells): # <<<<<<<<<<<<<< - * #Loop over each distance - * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] + /* "newanalysis/helpers/miscellaneous.pyx":104 + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] + * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] # <<<<<<<<<<<<<< + * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 + * dist2 = sqrt(dot2) */ - } - } + __pyx_t_20 = __pyx_v_idx3; + __pyx_t_19 = 2; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor_oh2.shape[1]; + __pyx_t_18 = __pyx_v_idx; + __pyx_t_17 = 2; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor_oh2.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor_oh2.shape[1]; + __pyx_v_dz2 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_20 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_19 * __pyx_v_coor_oh2.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_oh2.data + __pyx_t_18 * __pyx_v_coor_oh2.strides[0]) ) + __pyx_t_17 * __pyx_v_coor_oh2.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1458 - * - * #Loop over each starting point - * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): # <<<<<<<<<<<<<< - * #Loop over each particle - * for j in range(0, particles): + /* "newanalysis/helpers/miscellaneous.pyx":105 + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] + * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] + * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 # <<<<<<<<<<<<<< + * dist2 = sqrt(dot2) + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_dot2 = (((__pyx_v_dx2 * __pyx_v_dx2) + (__pyx_v_dy2 * __pyx_v_dy2)) + (__pyx_v_dz2 * __pyx_v_dz2)); - /* "src/helpers/miscellaneous.pyx":1474 - * counter[shell] += 1 - * - * for i in range(0, number_of_shells): # <<<<<<<<<<<<<< - * for k in range(0, correlation_length): - * if(counter[i] > 0): + /* "newanalysis/helpers/miscellaneous.pyx":106 + * dz2 = coor_oh2[idx3,2] - coor_oh2[idx,2] + * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 + * dist2 = sqrt(dot2) # <<<<<<<<<<<<<< + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) + * if cosine < cos_angle: */ - __pyx_t_7 = __pyx_v_number_of_shells; - __pyx_t_10 = __pyx_t_7; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + __pyx_v_dist2 = sqrt(__pyx_v_dot2); + + /* "newanalysis/helpers/miscellaneous.pyx":107 + * dot2 = dx2*dx2 + dy2*dy2 + dz2*dz2 + * dist2 = sqrt(dot2) + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) # <<<<<<<<<<<<<< + * if cosine < cos_angle: + * hbond[i] += 1 + */ + __pyx_t_22 = (((__pyx_v_dx * __pyx_v_dx2) + (__pyx_v_dy * __pyx_v_dy2)) + (__pyx_v_dz * __pyx_v_dz2)); + __pyx_t_23 = (__pyx_v_dist * __pyx_v_dist2); + if (unlikely(__pyx_t_23 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __PYX_ERR(0, 107, __pyx_L8_error) + } + __pyx_v_cosine = (__pyx_t_22 / __pyx_t_23); - /* "src/helpers/miscellaneous.pyx":1475 + /* "newanalysis/helpers/miscellaneous.pyx":108 + * dist2 = sqrt(dot2) + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) + * if cosine < cos_angle: # <<<<<<<<<<<<<< + * hbond[i] += 1 * - * for i in range(0, number_of_shells): - * for k in range(0, correlation_length): # <<<<<<<<<<<<<< - * if(counter[i] > 0): - * result[i][k] /= counter[i] */ - __pyx_t_30 = __pyx_v_correlation_length; - __pyx_t_31 = __pyx_t_30; - for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { - __pyx_v_k = __pyx_t_32; + __pyx_t_21 = (__pyx_v_cosine < __pyx_v_cos_angle); + if (__pyx_t_21) { - /* "src/helpers/miscellaneous.pyx":1476 - * for i in range(0, number_of_shells): - * for k in range(0, correlation_length): - * if(counter[i] > 0): # <<<<<<<<<<<<<< - * result[i][k] /= counter[i] + /* "newanalysis/helpers/miscellaneous.pyx":109 + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) + * if cosine < cos_angle: + * hbond[i] += 1 # <<<<<<<<<<<<<< * + * return np.asarray(hbond) */ - __pyx_t_12 = __pyx_v_i; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_counter.shape[0]; - __pyx_t_6 = (((*((double *) ( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_12 * __pyx_v_counter.strides[0]) ))) > 0.0) != 0); - if (__pyx_t_6) { + __pyx_t_17 = __pyx_v_i; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_hbond.shape[0]; + *((int *) ( /* dim=0 */ (__pyx_v_hbond.data + __pyx_t_17 * __pyx_v_hbond.strides[0]) )) += 1; - /* "src/helpers/miscellaneous.pyx":1477 - * for k in range(0, correlation_length): - * if(counter[i] > 0): - * result[i][k] /= counter[i] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":108 + * dist2 = sqrt(dot2) + * cosine = (dx * dx2 + dy * dy2 + dz * dz2) / (dist * dist2) + * if cosine < cos_angle: # <<<<<<<<<<<<<< + * hbond[i] += 1 * - * @cython.boundscheck(False) */ - __pyx_t_12 = __pyx_v_i; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_counter.shape[0]; - __pyx_t_13 = __pyx_v_i; - __pyx_t_14 = __pyx_v_k; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_result.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_result.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_13 * __pyx_v_result.strides[0]) ) + __pyx_t_14 * __pyx_v_result.strides[1]) )) /= (*((double *) ( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_12 * __pyx_v_counter.strides[0]) ))); + } - /* "src/helpers/miscellaneous.pyx":1476 - * for i in range(0, number_of_shells): - * for k in range(0, correlation_length): - * if(counter[i] > 0): # <<<<<<<<<<<<<< - * result[i][k] /= counter[i] + /* "newanalysis/helpers/miscellaneous.pyx":101 + * dot = dx*dx + dy*dy + dz*dz + * dist = sqrt(dot) + * if dist < maxdist: # <<<<<<<<<<<<<< + * dx2 = coor_oh2[idx3,0] - coor_oh2[idx,0] + * dy2 = coor_oh2[idx3,1] - coor_oh2[idx,1] + */ + } + } + } + } + goto __pyx_L19; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L18; + __pyx_L18:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates0) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_cosine; + __pyx_parallel_temp1 = __pyx_v_dist; + __pyx_parallel_temp2 = __pyx_v_dist2; + __pyx_parallel_temp3 = __pyx_v_dot; + __pyx_parallel_temp4 = __pyx_v_dot2; + __pyx_parallel_temp5 = __pyx_v_dx; + __pyx_parallel_temp6 = __pyx_v_dx2; + __pyx_parallel_temp7 = __pyx_v_dy; + __pyx_parallel_temp8 = __pyx_v_dy2; + __pyx_parallel_temp9 = __pyx_v_dz; + __pyx_parallel_temp10 = __pyx_v_dz2; + __pyx_parallel_temp11 = __pyx_v_i; + __pyx_parallel_temp12 = __pyx_v_idx; + __pyx_parallel_temp13 = __pyx_v_idx2; + __pyx_parallel_temp14 = __pyx_v_idx3; + __pyx_parallel_temp15 = __pyx_v_j; + __pyx_parallel_temp16 = __pyx_v_k; + __pyx_parallel_temp17 = __pyx_v_l; + } + __pyx_L19:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP +} +#endif /* _OPENMP */ + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_cosine = __pyx_parallel_temp0; + __pyx_v_dist = __pyx_parallel_temp1; + __pyx_v_dist2 = __pyx_parallel_temp2; + __pyx_v_dot = __pyx_parallel_temp3; + __pyx_v_dot2 = __pyx_parallel_temp4; + __pyx_v_dx = __pyx_parallel_temp5; + __pyx_v_dx2 = __pyx_parallel_temp6; + __pyx_v_dy = __pyx_parallel_temp7; + __pyx_v_dy2 = __pyx_parallel_temp8; + __pyx_v_dz = __pyx_parallel_temp9; + __pyx_v_dz2 = __pyx_parallel_temp10; + __pyx_v_i = __pyx_parallel_temp11; + __pyx_v_idx = __pyx_parallel_temp12; + __pyx_v_idx2 = __pyx_parallel_temp13; + __pyx_v_idx3 = __pyx_parallel_temp14; + __pyx_v_j = __pyx_parallel_temp15; + __pyx_v_k = __pyx_parallel_temp16; + __pyx_v_l = __pyx_parallel_temp17; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } + + /* "newanalysis/helpers/miscellaneous.pyx":86 * + * # loop over water molecules + * for i in prange(nwat, nogil=True): # <<<<<<<<<<<<<< + * # loop over h atoms + * for j in range(2): */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; } + } + + /* "newanalysis/helpers/miscellaneous.pyx":111 + * hbond[i] += 1 + * + * return np.asarray(hbond) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_hbond, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_9 = 1; } } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1431 + /* "newanalysis/helpers/miscellaneous.pyx":73 + * return * - * @cython.boundscheck(False) - * def correlateSingleParticleMuShellwise(double[:,:,:] timeseries, double[:,:] result, int[:,:] dataset, int number_of_startingpoints): # <<<<<<<<<<<<<< - * """ - * timeseries... (N_particle, number_of_frames, mu) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def countHBonds(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist, double cos_angle=-0.95): + * # this function is designed only for water hydrogen bonds! */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __Pyx_AddTraceback("newanalysis.miscellaneous.correlateSingleParticleMuShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.countHBonds", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_sub_correlation, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_counter, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_hbond, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1480 +/* "newanalysis/helpers/miscellaneous.pyx":113 + * return np.asarray(hbond) * - * @cython.boundscheck(False) - * def correlateSingleParticleMuVennShellwise(double[:,:,:] timeseries, double[:,:,:] result, int[:,:] dataset1, int[:,:] dataset2, int number_of_startingpoints): # <<<<<<<<<<<<<< - * """ - * timeseries... (N_particle, number_of_frames, mu) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): + * cdef int n_particles = coors.shape[0] */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_83correlateSingleParticleMuVennShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_82correlateSingleParticleMuVennShellwise[] = "\n timeseries... (N_particle, number_of_frames, mu)\n result ... (N_shell, correlation_length)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_83correlateSingleParticleMuVennShellwise = {"correlateSingleParticleMuVennShellwise", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_83correlateSingleParticleMuVennShellwise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_82correlateSingleParticleMuVennShellwise}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_83correlateSingleParticleMuVennShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dataset2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_number_of_startingpoints; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_5structureFactorDipTen(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_5structureFactorDipTen = {"structureFactorDipTen", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_5structureFactorDipTen, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_5structureFactorDipTen(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_bin_dist; + int __pyx_v_segs; + double __pyx_v_boxlength; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("correlateSingleParticleMuVennShellwise (wrapper)", 0); + __Pyx_RefNannySetupContext("structureFactorDipTen (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 113, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_result,&__pyx_n_s_dataset1,&__pyx_n_s_dataset2,&__pyx_n_s_number_of_startingpoints,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coors,&__pyx_n_s_histogram,&__pyx_n_s_bin_dist,&__pyx_n_s_segs,&__pyx_n_s_boxlength,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coors)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histogram)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuVennShellwise", 1, 5, 5, 1); __PYX_ERR(0, 1480, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("structureFactorDipTen", 1, 5, 5, 1); __PYX_ERR(0, 113, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset1)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bin_dist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuVennShellwise", 1, 5, 5, 2); __PYX_ERR(0, 1480, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("structureFactorDipTen", 1, 5, 5, 2); __PYX_ERR(0, 113, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset2)) != 0)) kw_args--; + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_segs)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuVennShellwise", 1, 5, 5, 3); __PYX_ERR(0, 1480, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("structureFactorDipTen", 1, 5, 5, 3); __PYX_ERR(0, 113, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_number_of_startingpoints)) != 0)) kw_args--; + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuVennShellwise", 1, 5, 5, 4); __PYX_ERR(0, 1480, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("structureFactorDipTen", 1, 5, 5, 4); __PYX_ERR(0, 113, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "correlateSingleParticleMuVennShellwise") < 0)) __PYX_ERR(0, 1480, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "structureFactorDipTen") < 0)) __PYX_ERR(0, 113, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + } else if (unlikely(__pyx_nargs != 5)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); } - __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1480, __pyx_L3_error) - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1480, __pyx_L3_error) - __pyx_v_dataset1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset1.memview)) __PYX_ERR(0, 1480, __pyx_L3_error) - __pyx_v_dataset2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset2.memview)) __PYX_ERR(0, 1480, __pyx_L3_error) - __pyx_v_number_of_startingpoints = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_number_of_startingpoints == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1480, __pyx_L3_error) + __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 114, __pyx_L3_error) + __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 114, __pyx_L3_error) + __pyx_v_bin_dist = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_bin_dist == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L3_error) + __pyx_v_segs = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_segs == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L3_error) + __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuVennShellwise", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1480, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("structureFactorDipTen", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 113, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.correlateSingleParticleMuVennShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.structureFactorDipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_82correlateSingleParticleMuVennShellwise(__pyx_self, __pyx_v_timeseries, __pyx_v_result, __pyx_v_dataset1, __pyx_v_dataset2, __pyx_v_number_of_startingpoints); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_4structureFactorDipTen(__pyx_self, __pyx_v_coors, __pyx_v_histogram, __pyx_v_bin_dist, __pyx_v_segs, __pyx_v_boxlength); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_82correlateSingleParticleMuVennShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_result, __Pyx_memviewslice __pyx_v_dataset1, __Pyx_memviewslice __pyx_v_dataset2, int __pyx_v_number_of_startingpoints) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_shell1; - int __pyx_v_shell2; - int __pyx_v_particles; - int __pyx_v_number_of_frames; - int __pyx_v_number_of_shells1; - int __pyx_v_number_of_shells2; - int __pyx_v_correlation_length; - double __pyx_v_norm; - __Pyx_memviewslice __pyx_v_counter = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_4structureFactorDipTen(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coors, __Pyx_memviewslice __pyx_v_histogram, int __pyx_v_bin_dist, int __pyx_v_segs, double __pyx_v_boxlength) { + int __pyx_v_n_particles; + int __pyx_v_pair_1_par_1; + int __pyx_v_pair_1_par_2; + int __pyx_v_pair_2_par_1; + int __pyx_v_pair_2_par_2; + double __pyx_v_D_x; + double __pyx_v_D_y; + double __pyx_v_D_z; + double __pyx_v_dist1; + double __pyx_v_dist2; + int __pyx_v_bin1; + int __pyx_v_bin2; + double __pyx_v_blen2; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_1; + long __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); + Py_ssize_t __pyx_t_10; int __pyx_t_11; - int __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - int __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - Py_ssize_t __pyx_t_31; - int __pyx_t_32; - int __pyx_t_33; - int __pyx_t_34; - double __pyx_t_35; - int __pyx_t_36; - int __pyx_t_37; - int __pyx_t_38; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_t_16; + double __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("correlateSingleParticleMuVennShellwise", 0); - - /* "src/helpers/miscellaneous.pyx":1487 - * - * cdef int i, j, k, shell1, shell2 - * cdef int particles = timeseries.shape[1] # <<<<<<<<<<<<<< - * cdef int number_of_frames = timeseries.shape[0] - * cdef int number_of_shells1 = result.shape[0] - */ - __pyx_v_particles = (__pyx_v_timeseries.shape[1]); - - /* "src/helpers/miscellaneous.pyx":1488 - * cdef int i, j, k, shell1, shell2 - * cdef int particles = timeseries.shape[1] - * cdef int number_of_frames = timeseries.shape[0] # <<<<<<<<<<<<<< - * cdef int number_of_shells1 = result.shape[0] - * cdef int number_of_shells2 = result.shape[1] - */ - __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[0]); - - /* "src/helpers/miscellaneous.pyx":1489 - * cdef int particles = timeseries.shape[1] - * cdef int number_of_frames = timeseries.shape[0] - * cdef int number_of_shells1 = result.shape[0] # <<<<<<<<<<<<<< - * cdef int number_of_shells2 = result.shape[1] - * cdef int correlation_length = result.shape[2] - */ - __pyx_v_number_of_shells1 = (__pyx_v_result.shape[0]); - - /* "src/helpers/miscellaneous.pyx":1490 - * cdef int number_of_frames = timeseries.shape[0] - * cdef int number_of_shells1 = result.shape[0] - * cdef int number_of_shells2 = result.shape[1] # <<<<<<<<<<<<<< - * cdef int correlation_length = result.shape[2] - * cdef double norm - */ - __pyx_v_number_of_shells2 = (__pyx_v_result.shape[1]); + __Pyx_RefNannySetupContext("structureFactorDipTen", 0); - /* "src/helpers/miscellaneous.pyx":1491 - * cdef int number_of_shells1 = result.shape[0] - * cdef int number_of_shells2 = result.shape[1] - * cdef int correlation_length = result.shape[2] # <<<<<<<<<<<<<< - * cdef double norm - * cdef double [:,:] counter = np.zeros((number_of_shells1, number_of_shells2)) + /* "newanalysis/helpers/miscellaneous.pyx":115 + * @cython.boundscheck(False) + * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): + * cdef int n_particles = coors.shape[0] # <<<<<<<<<<<<<< + * cdef int pair_1_par_1 = 0 + * cdef int pair_1_par_2 = 0 */ - __pyx_v_correlation_length = (__pyx_v_result.shape[2]); + __pyx_v_n_particles = (__pyx_v_coors.shape[0]); - /* "src/helpers/miscellaneous.pyx":1493 - * cdef int correlation_length = result.shape[2] - * cdef double norm - * cdef double [:,:] counter = np.zeros((number_of_shells1, number_of_shells2)) # <<<<<<<<<<<<<< - * - * if(correlation_length > number_of_frames): + /* "newanalysis/helpers/miscellaneous.pyx":116 + * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): + * cdef int n_particles = coors.shape[0] + * cdef int pair_1_par_1 = 0 # <<<<<<<<<<<<<< + * cdef int pair_1_par_2 = 0 + * cdef int pair_2_par_1 = 0 */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_number_of_shells1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_number_of_shells2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1493, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_counter = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_v_pair_1_par_1 = 0; - /* "src/helpers/miscellaneous.pyx":1495 - * cdef double [:,:] counter = np.zeros((number_of_shells1, number_of_shells2)) - * - * if(correlation_length > number_of_frames): # <<<<<<<<<<<<<< - * print("Correlation length must not be longer than the available trajectory length") - * return + /* "newanalysis/helpers/miscellaneous.pyx":117 + * cdef int n_particles = coors.shape[0] + * cdef int pair_1_par_1 = 0 + * cdef int pair_1_par_2 = 0 # <<<<<<<<<<<<<< + * cdef int pair_2_par_1 = 0 + * cdef int pair_2_par_2 = 0 */ - __pyx_t_7 = ((__pyx_v_correlation_length > __pyx_v_number_of_frames) != 0); - if (__pyx_t_7) { + __pyx_v_pair_1_par_2 = 0; - /* "src/helpers/miscellaneous.pyx":1496 - * - * if(correlation_length > number_of_frames): - * print("Correlation length must not be longer than the available trajectory length") # <<<<<<<<<<<<<< - * return - * + /* "newanalysis/helpers/miscellaneous.pyx":118 + * cdef int pair_1_par_1 = 0 + * cdef int pair_1_par_2 = 0 + * cdef int pair_2_par_1 = 0 # <<<<<<<<<<<<<< + * cdef int pair_2_par_2 = 0 + * cdef double D_x, D_y, D_z */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Correlation_length_must_not_be_l) < 0) __PYX_ERR(0, 1496, __pyx_L1_error) + __pyx_v_pair_2_par_1 = 0; - /* "src/helpers/miscellaneous.pyx":1497 - * if(correlation_length > number_of_frames): - * print("Correlation length must not be longer than the available trajectory length") - * return # <<<<<<<<<<<<<< - * - * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: + /* "newanalysis/helpers/miscellaneous.pyx":119 + * cdef int pair_1_par_2 = 0 + * cdef int pair_2_par_1 = 0 + * cdef int pair_2_par_2 = 0 # <<<<<<<<<<<<<< + * cdef double D_x, D_y, D_z + * cdef double dist1, dist2 */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_v_pair_2_par_2 = 0; - /* "src/helpers/miscellaneous.pyx":1495 - * cdef double [:,:] counter = np.zeros((number_of_shells1, number_of_shells2)) + /* "newanalysis/helpers/miscellaneous.pyx":123 + * cdef double dist1, dist2 + * cdef int bin1, bin2 + * cdef double blen2 = boxlength / 2.0 # <<<<<<<<<<<<<< * - * if(correlation_length > number_of_frames): # <<<<<<<<<<<<<< - * print("Correlation length must not be longer than the available trajectory length") - * return + * for pair_1_par_1 in range(0, n_particles-1): */ - } + __pyx_v_blen2 = (__pyx_v_boxlength / 2.0); - /* "src/helpers/miscellaneous.pyx":1499 - * return + /* "newanalysis/helpers/miscellaneous.pyx":125 + * cdef double blen2 = boxlength / 2.0 * - * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: # <<<<<<<<<<<<<< - * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") - * return + * for pair_1_par_1 in range(0, n_particles-1): # <<<<<<<<<<<<<< + * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): + * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] */ - __pyx_t_8 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); - if (unlikely(__pyx_v_number_of_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1499, __pyx_L1_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_number_of_startingpoints == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_8))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1499, __pyx_L1_error) - } - __pyx_t_7 = ((__Pyx_div_int(__pyx_t_8, __pyx_v_number_of_startingpoints) == 0) != 0); - if (__pyx_t_7) { + __pyx_t_1 = (__pyx_v_n_particles - 1); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_pair_1_par_1 = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":1500 - * - * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: - * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") # <<<<<<<<<<<<<< - * return + /* "newanalysis/helpers/miscellaneous.pyx":126 * + * for pair_1_par_1 in range(0, n_particles-1): + * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): # <<<<<<<<<<<<<< + * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] + * if(D_x > blen2) : D_x -= boxlength */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Number_of_starting_points_too_hi) < 0) __PYX_ERR(0, 1500, __pyx_L1_error) + __pyx_t_4 = __pyx_v_n_particles; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = (__pyx_v_pair_1_par_1 + 1); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_pair_1_par_2 = __pyx_t_6; - /* "src/helpers/miscellaneous.pyx":1501 - * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: - * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") - * return # <<<<<<<<<<<<<< - * - * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): + /* "newanalysis/helpers/miscellaneous.pyx":127 + * for pair_1_par_1 in range(0, n_particles-1): + * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): + * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] # <<<<<<<<<<<<<< + * if(D_x > blen2) : D_x -= boxlength + * elif(D_x < -blen2) : D_x += boxlength */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_t_7 = __pyx_v_pair_1_par_1; + __pyx_t_8 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; + __pyx_t_9 = __pyx_v_pair_1_par_2; + __pyx_t_10 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; + __pyx_v_D_x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1499 - * return + /* "newanalysis/helpers/miscellaneous.pyx":128 + * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): + * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] + * if(D_x > blen2) : D_x -= boxlength # <<<<<<<<<<<<<< + * elif(D_x < -blen2) : D_x += boxlength * - * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: # <<<<<<<<<<<<<< - * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") - * return */ - } + __pyx_t_11 = (__pyx_v_D_x > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_x = (__pyx_v_D_x - __pyx_v_boxlength); + goto __pyx_L7; + } - /* "src/helpers/miscellaneous.pyx":1503 - * return - * - * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): # <<<<<<<<<<<<<< - * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") + /* "newanalysis/helpers/miscellaneous.pyx":129 + * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] + * if(D_x > blen2) : D_x -= boxlength + * elif(D_x < -blen2) : D_x += boxlength # <<<<<<<<<<<<<< * + * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] */ - __pyx_t_8 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); - if (unlikely(((double)__pyx_v_number_of_startingpoints) == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 1503, __pyx_L1_error) - } - __pyx_t_1 = PyFloat_FromDouble((__pyx_t_8 / ((double)__pyx_v_number_of_startingpoints))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); - if (unlikely(__pyx_v_number_of_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1503, __pyx_L1_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_number_of_startingpoints == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_8))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1503, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_From_int(__Pyx_div_int(__pyx_t_8, __pyx_v_number_of_startingpoints)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_NeObjC(__pyx_t_3, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1503, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + __pyx_t_11 = (__pyx_v_D_x < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_x = (__pyx_v_D_x + __pyx_v_boxlength); + } + __pyx_L7:; - /* "src/helpers/miscellaneous.pyx":1504 - * - * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): - * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":131 + * elif(D_x < -blen2) : D_x += boxlength * - * #Loop over each starting point + * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] # <<<<<<<<<<<<<< + * if(D_y > blen2) : D_y -= boxlength + * elif(D_y < -blen2) : D_y += boxlength */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Warning_number_of_frames_correla) < 0) __PYX_ERR(0, 1504, __pyx_L1_error) + __pyx_t_10 = __pyx_v_pair_1_par_1; + __pyx_t_9 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; + __pyx_t_8 = __pyx_v_pair_1_par_2; + __pyx_t_7 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; + __pyx_v_D_y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_10 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1503 - * return + /* "newanalysis/helpers/miscellaneous.pyx":132 * - * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): # <<<<<<<<<<<<<< - * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") + * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] + * if(D_y > blen2) : D_y -= boxlength # <<<<<<<<<<<<<< + * elif(D_y < -blen2) : D_y += boxlength * */ - } + __pyx_t_11 = (__pyx_v_D_y > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_y = (__pyx_v_D_y - __pyx_v_boxlength); + goto __pyx_L8; + } - /* "src/helpers/miscellaneous.pyx":1507 + /* "newanalysis/helpers/miscellaneous.pyx":133 + * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] + * if(D_y > blen2) : D_y -= boxlength + * elif(D_y < -blen2) : D_y += boxlength # <<<<<<<<<<<<<< * - * #Loop over each starting point - * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): # <<<<<<<<<<<<<< - * #Loop over each particle - * for j in range(0, particles): + * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] */ - __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_number_of_frames - __pyx_v_correlation_length)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); - if (unlikely(__pyx_v_number_of_startingpoints == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(0, 1507, __pyx_L1_error) - } - else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_number_of_startingpoints == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_8))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(0, 1507, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_From_int(__Pyx_div_int(__pyx_t_8, __pyx_v_number_of_startingpoints)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1507, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1507, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1507, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_10(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 1507, __pyx_L1_error) - } - break; + __pyx_t_11 = (__pyx_v_D_y < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_y = (__pyx_v_D_y + __pyx_v_boxlength); } - __Pyx_GOTREF(__pyx_t_1); - } - __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1507, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_i = __pyx_t_8; + __pyx_L8:; - /* "src/helpers/miscellaneous.pyx":1509 - * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): - * #Loop over each particle - * for j in range(0, particles): # <<<<<<<<<<<<<< - * shell1 = dataset1[j, i] - 1 - * shell2 = dataset2[j, i] - 1 + /* "newanalysis/helpers/miscellaneous.pyx":135 + * elif(D_y < -blen2) : D_y += boxlength + * + * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] # <<<<<<<<<<<<<< + * if(D_z > blen2) : D_z -= boxlength + * elif(D_z < -blen2) : D_z += boxlength */ - __pyx_t_8 = __pyx_v_particles; - __pyx_t_11 = __pyx_t_8; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; + __pyx_t_7 = __pyx_v_pair_1_par_1; + __pyx_t_8 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; + __pyx_t_9 = __pyx_v_pair_1_par_2; + __pyx_t_10 = 2; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; + __pyx_v_D_z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1510 - * #Loop over each particle - * for j in range(0, particles): - * shell1 = dataset1[j, i] - 1 # <<<<<<<<<<<<<< - * shell2 = dataset2[j, i] - 1 - * if(shell1 < number_of_shells1 and shell2 < number_of_shells2): + /* "newanalysis/helpers/miscellaneous.pyx":136 + * + * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] + * if(D_z > blen2) : D_z -= boxlength # <<<<<<<<<<<<<< + * elif(D_z < -blen2) : D_z += boxlength + * */ - __pyx_t_13 = __pyx_v_j; - __pyx_t_14 = __pyx_v_i; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_dataset1.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_dataset1.shape[1]; - __pyx_v_shell1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset1.data + __pyx_t_13 * __pyx_v_dataset1.strides[0]) ) + __pyx_t_14 * __pyx_v_dataset1.strides[1]) ))) - 1); + __pyx_t_11 = (__pyx_v_D_z > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_z = (__pyx_v_D_z - __pyx_v_boxlength); + goto __pyx_L9; + } - /* "src/helpers/miscellaneous.pyx":1511 - * for j in range(0, particles): - * shell1 = dataset1[j, i] - 1 - * shell2 = dataset2[j, i] - 1 # <<<<<<<<<<<<<< - * if(shell1 < number_of_shells1 and shell2 < number_of_shells2): - * #Loop over each distance + /* "newanalysis/helpers/miscellaneous.pyx":137 + * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] + * if(D_z > blen2) : D_z -= boxlength + * elif(D_z < -blen2) : D_z += boxlength # <<<<<<<<<<<<<< + * + * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) */ - __pyx_t_14 = __pyx_v_j; - __pyx_t_13 = __pyx_v_i; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_dataset2.shape[0]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_dataset2.shape[1]; - __pyx_v_shell2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset2.data + __pyx_t_14 * __pyx_v_dataset2.strides[0]) ) + __pyx_t_13 * __pyx_v_dataset2.strides[1]) ))) - 1); + __pyx_t_11 = (__pyx_v_D_z < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_z = (__pyx_v_D_z + __pyx_v_boxlength); + } + __pyx_L9:; - /* "src/helpers/miscellaneous.pyx":1512 - * shell1 = dataset1[j, i] - 1 - * shell2 = dataset2[j, i] - 1 - * if(shell1 < number_of_shells1 and shell2 < number_of_shells2): # <<<<<<<<<<<<<< - * #Loop over each distance - * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] + /* "newanalysis/helpers/miscellaneous.pyx":139 + * elif(D_z < -blen2) : D_z += boxlength + * + * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) # <<<<<<<<<<<<<< + * + * for pair_2_par_1 in range(0, n_particles-1): */ - __pyx_t_15 = ((__pyx_v_shell1 < __pyx_v_number_of_shells1) != 0); - if (__pyx_t_15) { - } else { - __pyx_t_7 = __pyx_t_15; - goto __pyx_L11_bool_binop_done; + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyFloat_FromDouble((((__pyx_v_D_x * __pyx_v_D_x) + (__pyx_v_D_y * __pyx_v_D_y)) + (__pyx_v_D_z * __pyx_v_D_z))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_15 = NULL; + __pyx_t_16 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_14))) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14); + if (likely(__pyx_t_15)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_14, function); + __pyx_t_16 = 1; + } } - __pyx_t_15 = ((__pyx_v_shell2 < __pyx_v_number_of_shells2) != 0); - __pyx_t_7 = __pyx_t_15; - __pyx_L11_bool_binop_done:; - if (__pyx_t_7) { + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_13}; + __pyx_t_12 = __Pyx_PyObject_FastCall(__pyx_t_14, __pyx_callargs+1-__pyx_t_16, 1+__pyx_t_16); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_dist1 = __pyx_t_17; - /* "src/helpers/miscellaneous.pyx":1514 - * if(shell1 < number_of_shells1 and shell2 < number_of_shells2): - * #Loop over each distance - * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":141 + * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) * - * for k in range(i, i+correlation_length): + * for pair_2_par_1 in range(0, n_particles-1): # <<<<<<<<<<<<<< + * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): + * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue */ - __pyx_t_13 = __pyx_v_i; - __pyx_t_14 = __pyx_v_j; - __pyx_t_16 = 0; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_timeseries.shape[2]; - __pyx_t_17 = __pyx_v_i; - __pyx_t_18 = __pyx_v_j; - __pyx_t_19 = 0; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_timeseries.shape[2]; - __pyx_t_20 = __pyx_v_i; - __pyx_t_21 = __pyx_v_j; - __pyx_t_22 = 1; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_timeseries.shape[2]; - __pyx_t_23 = __pyx_v_i; - __pyx_t_24 = __pyx_v_j; - __pyx_t_25 = 1; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_timeseries.shape[2]; - __pyx_t_26 = __pyx_v_i; - __pyx_t_27 = __pyx_v_j; - __pyx_t_28 = 2; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_timeseries.shape[2]; - __pyx_t_29 = __pyx_v_i; - __pyx_t_30 = __pyx_v_j; - __pyx_t_31 = 2; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_timeseries.shape[2]; - __pyx_v_norm = ((((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_13 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_14 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_16 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_17 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_18 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_19 * __pyx_v_timeseries.strides[2]) )))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_20 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_21 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_22 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_23 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_24 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_25 * __pyx_v_timeseries.strides[2]) ))))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_26 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_27 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_28 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_29 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_30 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_31 * __pyx_v_timeseries.strides[2]) ))))); + __pyx_t_18 = (__pyx_v_n_particles - 1); + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_19; __pyx_t_16+=1) { + __pyx_v_pair_2_par_1 = __pyx_t_16; - /* "src/helpers/miscellaneous.pyx":1516 - * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] + /* "newanalysis/helpers/miscellaneous.pyx":142 * - * for k in range(i, i+correlation_length): # <<<<<<<<<<<<<< - * result[shell1][shell2][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm + * for pair_2_par_1 in range(0, n_particles-1): + * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): # <<<<<<<<<<<<<< + * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue * */ - __pyx_t_32 = (__pyx_v_i + __pyx_v_correlation_length); - __pyx_t_33 = __pyx_t_32; - for (__pyx_t_34 = __pyx_v_i; __pyx_t_34 < __pyx_t_33; __pyx_t_34+=1) { - __pyx_v_k = __pyx_t_34; + __pyx_t_20 = __pyx_v_n_particles; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = (__pyx_v_pair_2_par_1 + 1); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_pair_2_par_2 = __pyx_t_22; - /* "src/helpers/miscellaneous.pyx":1517 - * - * for k in range(i, i+correlation_length): - * result[shell1][shell2][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":143 + * for pair_2_par_1 in range(0, n_particles-1): + * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): + * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue # <<<<<<<<<<<<<< * - * #for k in range(0, correlation_length): + * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] */ - __pyx_t_31 = __pyx_v_k; - __pyx_t_30 = __pyx_v_j; - __pyx_t_29 = 0; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_timeseries.shape[2]; - __pyx_t_28 = __pyx_v_i; - __pyx_t_27 = __pyx_v_j; - __pyx_t_26 = 0; - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_timeseries.shape[2]; - __pyx_t_25 = __pyx_v_k; - __pyx_t_24 = __pyx_v_j; - __pyx_t_23 = 1; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_timeseries.shape[2]; - __pyx_t_22 = __pyx_v_i; - __pyx_t_21 = __pyx_v_j; - __pyx_t_20 = 1; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_timeseries.shape[2]; - __pyx_t_19 = __pyx_v_k; - __pyx_t_18 = __pyx_v_j; - __pyx_t_17 = 2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_timeseries.shape[2]; - __pyx_t_16 = __pyx_v_i; - __pyx_t_14 = __pyx_v_j; - __pyx_t_13 = 2; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_timeseries.shape[2]; - __pyx_t_35 = ((((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_31 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_30 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_29 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_28 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_27 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_26 * __pyx_v_timeseries.strides[2]) )))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_25 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_24 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_23 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_22 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_21 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_20 * __pyx_v_timeseries.strides[2]) ))))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_19 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_18 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_17 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_16 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_14 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_13 * __pyx_v_timeseries.strides[2]) ))))); - if (unlikely(__pyx_v_norm == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 1517, __pyx_L1_error) + __pyx_t_23 = (__pyx_v_pair_1_par_1 == __pyx_v_pair_2_par_1); + if (__pyx_t_23) { + } else { + __pyx_t_11 = __pyx_t_23; + goto __pyx_L15_bool_binop_done; + } + __pyx_t_23 = (__pyx_v_pair_1_par_2 == __pyx_v_pair_2_par_2); + __pyx_t_11 = __pyx_t_23; + __pyx_L15_bool_binop_done:; + if (__pyx_t_11) { + goto __pyx_L12_continue; } - __pyx_t_13 = __pyx_v_shell1; - __pyx_t_14 = __pyx_v_shell2; - __pyx_t_16 = (__pyx_v_k - __pyx_v_i); - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_result.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_result.shape[1]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_result.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_13 * __pyx_v_result.strides[0]) ) + __pyx_t_14 * __pyx_v_result.strides[1]) ) + __pyx_t_16 * __pyx_v_result.strides[2]) )) += (__pyx_t_35 / __pyx_v_norm); - } - /* "src/helpers/miscellaneous.pyx":1521 - * #for k in range(0, correlation_length): - * #result[shell][k] += sub_correlation[k] - * counter[shell1][shell2] += 1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":145 + * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue * - * for i in range(0, number_of_shells1): + * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] # <<<<<<<<<<<<<< + * if(D_x > blen2) : D_x -= boxlength + * elif(D_x < -blen2) : D_x += boxlength */ - __pyx_t_16 = __pyx_v_shell1; - __pyx_t_14 = __pyx_v_shell2; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_counter.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_counter.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_16 * __pyx_v_counter.strides[0]) ) + __pyx_t_14 * __pyx_v_counter.strides[1]) )) += 1.0; + __pyx_t_10 = __pyx_v_pair_2_par_1; + __pyx_t_9 = 0; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; + __pyx_t_8 = __pyx_v_pair_2_par_2; + __pyx_t_7 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; + __pyx_v_D_x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_10 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1512 - * shell1 = dataset1[j, i] - 1 - * shell2 = dataset2[j, i] - 1 - * if(shell1 < number_of_shells1 and shell2 < number_of_shells2): # <<<<<<<<<<<<<< - * #Loop over each distance - * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] + /* "newanalysis/helpers/miscellaneous.pyx":146 + * + * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] + * if(D_x > blen2) : D_x -= boxlength # <<<<<<<<<<<<<< + * elif(D_x < -blen2) : D_x += boxlength + * */ - } - } + __pyx_t_11 = (__pyx_v_D_x > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_x = (__pyx_v_D_x - __pyx_v_boxlength); + goto __pyx_L17; + } - /* "src/helpers/miscellaneous.pyx":1507 + /* "newanalysis/helpers/miscellaneous.pyx":147 + * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] + * if(D_x > blen2) : D_x -= boxlength + * elif(D_x < -blen2) : D_x += boxlength # <<<<<<<<<<<<<< * - * #Loop over each starting point - * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): # <<<<<<<<<<<<<< - * #Loop over each particle - * for j in range(0, particles): + * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_11 = (__pyx_v_D_x < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_x = (__pyx_v_D_x + __pyx_v_boxlength); + } + __pyx_L17:; - /* "src/helpers/miscellaneous.pyx":1523 - * counter[shell1][shell2] += 1 + /* "newanalysis/helpers/miscellaneous.pyx":149 + * elif(D_x < -blen2) : D_x += boxlength * - * for i in range(0, number_of_shells1): # <<<<<<<<<<<<<< - * for j in range(0, number_of_shells2): - * for k in range(0, correlation_length): + * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] # <<<<<<<<<<<<<< + * if(D_y > blen2) : D_y -= boxlength + * elif(D_y < -blen2) : D_y += boxlength */ - __pyx_t_8 = __pyx_v_number_of_shells1; - __pyx_t_11 = __pyx_t_8; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_i = __pyx_t_12; + __pyx_t_7 = __pyx_v_pair_2_par_1; + __pyx_t_8 = 1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; + __pyx_t_9 = __pyx_v_pair_2_par_2; + __pyx_t_10 = 1; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; + __pyx_v_D_y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1524 + /* "newanalysis/helpers/miscellaneous.pyx":150 + * + * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] + * if(D_y > blen2) : D_y -= boxlength # <<<<<<<<<<<<<< + * elif(D_y < -blen2) : D_y += boxlength * - * for i in range(0, number_of_shells1): - * for j in range(0, number_of_shells2): # <<<<<<<<<<<<<< - * for k in range(0, correlation_length): - * if(counter[i][j] > 0): */ - __pyx_t_32 = __pyx_v_number_of_shells2; - __pyx_t_33 = __pyx_t_32; - for (__pyx_t_34 = 0; __pyx_t_34 < __pyx_t_33; __pyx_t_34+=1) { - __pyx_v_j = __pyx_t_34; + __pyx_t_11 = (__pyx_v_D_y > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_y = (__pyx_v_D_y - __pyx_v_boxlength); + goto __pyx_L18; + } - /* "src/helpers/miscellaneous.pyx":1525 - * for i in range(0, number_of_shells1): - * for j in range(0, number_of_shells2): - * for k in range(0, correlation_length): # <<<<<<<<<<<<<< - * if(counter[i][j] > 0): - * result[i][j][k] /= counter[i][j] + /* "newanalysis/helpers/miscellaneous.pyx":151 + * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] + * if(D_y > blen2) : D_y -= boxlength + * elif(D_y < -blen2) : D_y += boxlength # <<<<<<<<<<<<<< + * + * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] */ - __pyx_t_36 = __pyx_v_correlation_length; - __pyx_t_37 = __pyx_t_36; - for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_37; __pyx_t_38+=1) { - __pyx_v_k = __pyx_t_38; + __pyx_t_11 = (__pyx_v_D_y < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_y = (__pyx_v_D_y + __pyx_v_boxlength); + } + __pyx_L18:; - /* "src/helpers/miscellaneous.pyx":1526 - * for j in range(0, number_of_shells2): - * for k in range(0, correlation_length): - * if(counter[i][j] > 0): # <<<<<<<<<<<<<< - * result[i][j][k] /= counter[i][j] + /* "newanalysis/helpers/miscellaneous.pyx":153 + * elif(D_y < -blen2) : D_y += boxlength * + * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] # <<<<<<<<<<<<<< + * if(D_z > blen2) : D_z -= boxlength + * elif(D_z < -blen2) : D_z += boxlength */ - __pyx_t_14 = __pyx_v_i; - __pyx_t_16 = __pyx_v_j; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_counter.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_counter.shape[1]; - __pyx_t_7 = (((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_14 * __pyx_v_counter.strides[0]) ) + __pyx_t_16 * __pyx_v_counter.strides[1]) ))) > 0.0) != 0); - if (__pyx_t_7) { + __pyx_t_10 = __pyx_v_pair_2_par_1; + __pyx_t_9 = 2; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; + __pyx_t_8 = __pyx_v_pair_2_par_2; + __pyx_t_7 = 2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; + __pyx_v_D_z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_10 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1527 - * for k in range(0, correlation_length): - * if(counter[i][j] > 0): - * result[i][j][k] /= counter[i][j] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":154 + * + * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] + * if(D_z > blen2) : D_z -= boxlength # <<<<<<<<<<<<<< + * elif(D_z < -blen2) : D_z += boxlength * - * @cython.boundscheck(False) */ - __pyx_t_16 = __pyx_v_i; - __pyx_t_14 = __pyx_v_j; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_counter.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_counter.shape[1]; - __pyx_t_13 = __pyx_v_i; - __pyx_t_17 = __pyx_v_j; - __pyx_t_18 = __pyx_v_k; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_result.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_result.shape[1]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_result.shape[2]; - *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_13 * __pyx_v_result.strides[0]) ) + __pyx_t_17 * __pyx_v_result.strides[1]) ) + __pyx_t_18 * __pyx_v_result.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_16 * __pyx_v_counter.strides[0]) ) + __pyx_t_14 * __pyx_v_counter.strides[1]) ))); + __pyx_t_11 = (__pyx_v_D_z > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_z = (__pyx_v_D_z - __pyx_v_boxlength); + goto __pyx_L19; + } - /* "src/helpers/miscellaneous.pyx":1526 - * for j in range(0, number_of_shells2): - * for k in range(0, correlation_length): - * if(counter[i][j] > 0): # <<<<<<<<<<<<<< - * result[i][j][k] /= counter[i][j] + /* "newanalysis/helpers/miscellaneous.pyx":155 + * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] + * if(D_z > blen2) : D_z -= boxlength + * elif(D_z < -blen2) : D_z += boxlength # <<<<<<<<<<<<<< * + * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) */ - } - } - } - } + __pyx_t_11 = (__pyx_v_D_z < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_z = (__pyx_v_D_z + __pyx_v_boxlength); + } + __pyx_L19:; - /* "src/helpers/miscellaneous.pyx":1480 + /* "newanalysis/helpers/miscellaneous.pyx":157 + * elif(D_z < -blen2) : D_z += boxlength * - * @cython.boundscheck(False) - * def correlateSingleParticleMuVennShellwise(double[:,:,:] timeseries, double[:,:,:] result, int[:,:] dataset1, int[:,:] dataset2, int number_of_startingpoints): # <<<<<<<<<<<<<< - * """ - * timeseries... (N_particle, number_of_frames, mu) + * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) # <<<<<<<<<<<<<< + * + * bin1 = int(segs * dist1) */ + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = PyFloat_FromDouble((((__pyx_v_D_x * __pyx_v_D_x) + (__pyx_v_D_y * __pyx_v_D_y)) + (__pyx_v_D_z * __pyx_v_D_z))); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = NULL; + __pyx_t_24 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_13); + if (likely(__pyx_t_15)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_13, function); + __pyx_t_24 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_14}; + __pyx_t_12 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+1-__pyx_t_24, 1+__pyx_t_24); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } + __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_dist2 = __pyx_t_17; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_AddTraceback("newanalysis.miscellaneous.correlateSingleParticleMuVennShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_counter, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset2, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/miscellaneous.pyx":1530 + /* "newanalysis/helpers/miscellaneous.pyx":159 + * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) + * + * bin1 = int(segs * dist1) # <<<<<<<<<<<<<< + * bin2 = int(segs * dist2) * - * @cython.boundscheck(False) - * def vanHoveSingleVector(double[:,:] timeseries, double[:,:] histogram): # <<<<<<<<<<<<<< - * """ - * timeseries ... (correlation_length * 3) */ + __pyx_v_bin1 = ((int)(__pyx_v_segs * __pyx_v_dist1)); -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_85vanHoveSingleVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_84vanHoveSingleVector[] = "\n timeseries ... (correlation_length * 3)\n histogram ... (correlation_length * cos_segs)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_85vanHoveSingleVector = {"vanHoveSingleVector", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_85vanHoveSingleVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_84vanHoveSingleVector}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_85vanHoveSingleVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("vanHoveSingleVector (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_histogram,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histogram)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vanHoveSingleVector", 1, 2, 2, 1); __PYX_ERR(0, 1530, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vanHoveSingleVector") < 0)) __PYX_ERR(0, 1530, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1530, __pyx_L3_error) - __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 1530, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("vanHoveSingleVector", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1530, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.vanHoveSingleVector", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_84vanHoveSingleVector(__pyx_self, __pyx_v_timeseries, __pyx_v_histogram); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":160 + * + * bin1 = int(segs * dist1) + * bin2 = int(segs * dist2) # <<<<<<<<<<<<<< + * + * if (bin1 < bin_dist) and (bin2 < bin_dist): + */ + __pyx_v_bin2 = ((int)(__pyx_v_segs * __pyx_v_dist2)); -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_84vanHoveSingleVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_histogram) { - int __pyx_v_correlation_length; - int __pyx_v_cos_segs; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - __Pyx_RefNannySetupContext("vanHoveSingleVector", 0); + /* "newanalysis/helpers/miscellaneous.pyx":162 + * bin2 = int(segs * dist2) + * + * if (bin1 < bin_dist) and (bin2 < bin_dist): # <<<<<<<<<<<<<< + * histogram[bin1, bin2] += (pow(dist1, -3) * pow(dist2, -3)) + * histogram[bin2, bin2] += histogram[bin1, bin2] + */ + __pyx_t_23 = (__pyx_v_bin1 < __pyx_v_bin_dist); + if (__pyx_t_23) { + } else { + __pyx_t_11 = __pyx_t_23; + goto __pyx_L21_bool_binop_done; + } + __pyx_t_23 = (__pyx_v_bin2 < __pyx_v_bin_dist); + __pyx_t_11 = __pyx_t_23; + __pyx_L21_bool_binop_done:; + if (__pyx_t_11) { - /* "src/helpers/miscellaneous.pyx":1536 - * """ + /* "newanalysis/helpers/miscellaneous.pyx":163 * - * cdef int correlation_length = timeseries.shape[0] # <<<<<<<<<<<<<< - * cdef int cos_segs = histogram.shape[1] + * if (bin1 < bin_dist) and (bin2 < bin_dist): + * histogram[bin1, bin2] += (pow(dist1, -3) * pow(dist2, -3)) # <<<<<<<<<<<<<< + * histogram[bin2, bin2] += histogram[bin1, bin2] * */ - __pyx_v_correlation_length = (__pyx_v_timeseries.shape[0]); + __pyx_t_7 = __pyx_v_bin1; + __pyx_t_8 = __pyx_v_bin2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_7 * __pyx_v_histogram.strides[0]) ) + __pyx_t_8 * __pyx_v_histogram.strides[1]) )) += (pow(__pyx_v_dist1, -3.0) * pow(__pyx_v_dist2, -3.0)); - /* "src/helpers/miscellaneous.pyx":1537 - * - * cdef int correlation_length = timeseries.shape[0] - * cdef int cos_segs = histogram.shape[1] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":164 + * if (bin1 < bin_dist) and (bin2 < bin_dist): + * histogram[bin1, bin2] += (pow(dist1, -3) * pow(dist2, -3)) + * histogram[bin2, bin2] += histogram[bin1, bin2] # <<<<<<<<<<<<<< + * * - * calcVanHoveSingleVector(×eries[0,0], &histogram[0,0], correlation_length, cos_segs) */ - __pyx_v_cos_segs = (__pyx_v_histogram.shape[1]); + __pyx_t_8 = __pyx_v_bin1; + __pyx_t_7 = __pyx_v_bin2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[1]; + __pyx_t_9 = __pyx_v_bin2; + __pyx_t_10 = __pyx_v_bin2; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_histogram.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_histogram.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_9 * __pyx_v_histogram.strides[0]) ) + __pyx_t_10 * __pyx_v_histogram.strides[1]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_8 * __pyx_v_histogram.strides[0]) ) + __pyx_t_7 * __pyx_v_histogram.strides[1]) ))); - /* "src/helpers/miscellaneous.pyx":1539 - * cdef int cos_segs = histogram.shape[1] - * - * calcVanHoveSingleVector(×eries[0,0], &histogram[0,0], correlation_length, cos_segs) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":162 + * bin2 = int(segs * dist2) * - * @cython.boundscheck(False) + * if (bin1 < bin_dist) and (bin2 < bin_dist): # <<<<<<<<<<<<<< + * histogram[bin1, bin2] += (pow(dist1, -3) * pow(dist2, -3)) + * histogram[bin2, bin2] += histogram[bin1, bin2] */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_histogram.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_histogram.shape[1]; - calcVanHoveSingleVector((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_3 * __pyx_v_histogram.strides[0]) ) + __pyx_t_4 * __pyx_v_histogram.strides[1]) )))), __pyx_v_correlation_length, __pyx_v_cos_segs); + } + __pyx_L12_continue:; + } + } + } + } - /* "src/helpers/miscellaneous.pyx":1530 + /* "newanalysis/helpers/miscellaneous.pyx":113 + * return np.asarray(hbond) * - * @cython.boundscheck(False) - * def vanHoveSingleVector(double[:,:] timeseries, double[:,:] histogram): # <<<<<<<<<<<<<< - * """ - * timeseries ... (correlation_length * 3) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): + * cdef int n_particles = coors.shape[0] */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histogram, 1); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("newanalysis.miscellaneous.structureFactorDipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1542 +/* "newanalysis/helpers/miscellaneous.pyx":167 * - * @cython.boundscheck(False) - * def vanHoveMultiVector(double[:,:,:] timeseries, double[:,:] histogram): # <<<<<<<<<<<<<< - * """ - * timeseries ... (n_particles * correlation_length * 3) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): + * cdef int n_particles = coors.shape[0] */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_87vanHoveMultiVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_86vanHoveMultiVector[] = "\n timeseries ... (n_particles * correlation_length * 3)\n histogram ... (correlation_length * cos_segs)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_87vanHoveMultiVector = {"vanHoveMultiVector", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_87vanHoveMultiVector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_86vanHoveMultiVector}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_87vanHoveMultiVector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_7structureFactorCharge(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_7structureFactorCharge = {"structureFactorCharge", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_7structureFactorCharge, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_7structureFactorCharge(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_bin_dist; + int __pyx_v_segs; + double __pyx_v_boxlength; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("vanHoveMultiVector (wrapper)", 0); + __Pyx_RefNannySetupContext("structureFactorCharge (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 167, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_histogram,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coors,&__pyx_n_s_charges,&__pyx_n_s_histogram,&__pyx_n_s_bin_dist,&__pyx_n_s_segs,&__pyx_n_s_boxlength,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeseries)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coors)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_histogram)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, 1); __PYX_ERR(0, 167, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histogram)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, 2); __PYX_ERR(0, 167, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bin_dist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, 3); __PYX_ERR(0, 167, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_segs)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, 4); __PYX_ERR(0, 167, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("vanHoveMultiVector", 1, 2, 2, 1); __PYX_ERR(0, 1542, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, 5); __PYX_ERR(0, 167, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vanHoveMultiVector") < 0)) __PYX_ERR(0, 1542, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "structureFactorCharge") < 0)) __PYX_ERR(0, 167, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 6)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); } - __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1542, __pyx_L3_error) - __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 1542, __pyx_L3_error) + __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_bin_dist = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_bin_dist == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_segs = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_segs == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("vanHoveMultiVector", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1542, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("structureFactorCharge", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 167, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.vanHoveMultiVector", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.structureFactorCharge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_86vanHoveMultiVector(__pyx_self, __pyx_v_timeseries, __pyx_v_histogram); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_6structureFactorCharge(__pyx_self, __pyx_v_coors, __pyx_v_charges, __pyx_v_histogram, __pyx_v_bin_dist, __pyx_v_segs, __pyx_v_boxlength); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_86vanHoveMultiVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_histogram) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_6structureFactorCharge(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coors, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_histogram, int __pyx_v_bin_dist, int __pyx_v_segs, double __pyx_v_boxlength) { int __pyx_v_n_particles; - int __pyx_v_correlation_length; - int __pyx_v_cos_segs; + int __pyx_v_pair_1_par_1; + int __pyx_v_pair_1_par_2; + int __pyx_v_pair_2_par_1; + int __pyx_v_pair_2_par_2; + double __pyx_v_D_x; + double __pyx_v_D_y; + double __pyx_v_D_z; + double __pyx_v_dist1; + double __pyx_v_dist2; + double __pyx_v_energy1; + double __pyx_v_energy2; + int __pyx_v_bin1; + int __pyx_v_bin2; + double __pyx_v_blen2; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("vanHoveMultiVector", 0); + long __pyx_t_1; + long __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_t_16; + double __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("structureFactorCharge", 0); - /* "src/helpers/miscellaneous.pyx":1548 - * """ + /* "newanalysis/helpers/miscellaneous.pyx":169 + * @cython.boundscheck(False) + * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): + * cdef int n_particles = coors.shape[0] # <<<<<<<<<<<<<< + * cdef int pair_1_par_1 = 0 + * cdef int pair_1_par_2 = 0 + */ + __pyx_v_n_particles = (__pyx_v_coors.shape[0]); + + /* "newanalysis/helpers/miscellaneous.pyx":170 + * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): + * cdef int n_particles = coors.shape[0] + * cdef int pair_1_par_1 = 0 # <<<<<<<<<<<<<< + * cdef int pair_1_par_2 = 0 + * cdef int pair_2_par_1 = 0 + */ + __pyx_v_pair_1_par_1 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":171 + * cdef int n_particles = coors.shape[0] + * cdef int pair_1_par_1 = 0 + * cdef int pair_1_par_2 = 0 # <<<<<<<<<<<<<< + * cdef int pair_2_par_1 = 0 + * cdef int pair_2_par_2 = 0 + */ + __pyx_v_pair_1_par_2 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":172 + * cdef int pair_1_par_1 = 0 + * cdef int pair_1_par_2 = 0 + * cdef int pair_2_par_1 = 0 # <<<<<<<<<<<<<< + * cdef int pair_2_par_2 = 0 + * cdef double D_x, D_y, D_z + */ + __pyx_v_pair_2_par_1 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":173 + * cdef int pair_1_par_2 = 0 + * cdef int pair_2_par_1 = 0 + * cdef int pair_2_par_2 = 0 # <<<<<<<<<<<<<< + * cdef double D_x, D_y, D_z + * cdef double dist1, dist2 + */ + __pyx_v_pair_2_par_2 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":178 + * cdef double energy1, energy2 + * cdef int bin1, bin2 + * cdef double blen2 = boxlength / 2.0 # <<<<<<<<<<<<<< * - * cdef int n_particles = timeseries.shape[0] # <<<<<<<<<<<<<< - * cdef int correlation_length = timeseries.shape[1] - * cdef int cos_segs = histogram.shape[1] + * for pair_1_par_1 in range(0, n_particles-1): */ - __pyx_v_n_particles = (__pyx_v_timeseries.shape[0]); + __pyx_v_blen2 = (__pyx_v_boxlength / 2.0); - /* "src/helpers/miscellaneous.pyx":1549 + /* "newanalysis/helpers/miscellaneous.pyx":180 + * cdef double blen2 = boxlength / 2.0 * - * cdef int n_particles = timeseries.shape[0] - * cdef int correlation_length = timeseries.shape[1] # <<<<<<<<<<<<<< - * cdef int cos_segs = histogram.shape[1] + * for pair_1_par_1 in range(0, n_particles-1): # <<<<<<<<<<<<<< + * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): + * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] + */ + __pyx_t_1 = (__pyx_v_n_particles - 1); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_pair_1_par_1 = __pyx_t_3; + + /* "newanalysis/helpers/miscellaneous.pyx":181 * + * for pair_1_par_1 in range(0, n_particles-1): + * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): # <<<<<<<<<<<<<< + * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] + * if(D_x > blen2) : D_x -= boxlength */ - __pyx_v_correlation_length = (__pyx_v_timeseries.shape[1]); + __pyx_t_4 = __pyx_v_n_particles; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = (__pyx_v_pair_1_par_1 + 1); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_pair_1_par_2 = __pyx_t_6; - /* "src/helpers/miscellaneous.pyx":1550 - * cdef int n_particles = timeseries.shape[0] - * cdef int correlation_length = timeseries.shape[1] - * cdef int cos_segs = histogram.shape[1] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":182 + * for pair_1_par_1 in range(0, n_particles-1): + * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): + * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] # <<<<<<<<<<<<<< + * if(D_x > blen2) : D_x -= boxlength + * elif(D_x < -blen2) : D_x += boxlength + */ + __pyx_t_7 = __pyx_v_pair_1_par_1; + __pyx_t_8 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; + __pyx_t_9 = __pyx_v_pair_1_par_2; + __pyx_t_10 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; + __pyx_v_D_x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) )))); + + /* "newanalysis/helpers/miscellaneous.pyx":183 + * for pair_1_par_2 in range(pair_1_par_1+1, n_particles): + * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] + * if(D_x > blen2) : D_x -= boxlength # <<<<<<<<<<<<<< + * elif(D_x < -blen2) : D_x += boxlength * - * calcVanHoveMultiVector(×eries[0,0,0], &histogram[0,0], n_particles, correlation_length, cos_segs) */ - __pyx_v_cos_segs = (__pyx_v_histogram.shape[1]); + __pyx_t_11 = (__pyx_v_D_x > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_x = (__pyx_v_D_x - __pyx_v_boxlength); + goto __pyx_L7; + } - /* "src/helpers/miscellaneous.pyx":1552 - * cdef int cos_segs = histogram.shape[1] + /* "newanalysis/helpers/miscellaneous.pyx":184 + * D_x = coors[pair_1_par_1, 0] - coors[pair_1_par_2, 0] + * if(D_x > blen2) : D_x -= boxlength + * elif(D_x < -blen2) : D_x += boxlength # <<<<<<<<<<<<<< * - * calcVanHoveMultiVector(×eries[0,0,0], &histogram[0,0], n_particles, correlation_length, cos_segs) # <<<<<<<<<<<<<< + * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] + */ + __pyx_t_11 = (__pyx_v_D_x < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_x = (__pyx_v_D_x + __pyx_v_boxlength); + } + __pyx_L7:; + + /* "newanalysis/helpers/miscellaneous.pyx":186 + * elif(D_x < -blen2) : D_x += boxlength * - * @cython.boundscheck(False) + * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] # <<<<<<<<<<<<<< + * if(D_y > blen2) : D_y -= boxlength + * elif(D_y < -blen2) : D_y += boxlength */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries.shape[1]; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_timeseries.shape[2]; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_histogram.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_histogram.shape[1]; - calcVanHoveMultiVector((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_3 * __pyx_v_timeseries.strides[2]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_4 * __pyx_v_histogram.strides[0]) ) + __pyx_t_5 * __pyx_v_histogram.strides[1]) )))), __pyx_v_n_particles, __pyx_v_correlation_length, __pyx_v_cos_segs); + __pyx_t_10 = __pyx_v_pair_1_par_1; + __pyx_t_9 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; + __pyx_t_8 = __pyx_v_pair_1_par_2; + __pyx_t_7 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; + __pyx_v_D_y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_10 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1542 + /* "newanalysis/helpers/miscellaneous.pyx":187 + * + * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] + * if(D_y > blen2) : D_y -= boxlength # <<<<<<<<<<<<<< + * elif(D_y < -blen2) : D_y += boxlength * - * @cython.boundscheck(False) - * def vanHoveMultiVector(double[:,:,:] timeseries, double[:,:] histogram): # <<<<<<<<<<<<<< - * """ - * timeseries ... (n_particles * correlation_length * 3) */ + __pyx_t_11 = (__pyx_v_D_y > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_y = (__pyx_v_D_y - __pyx_v_boxlength); + goto __pyx_L8; + } - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_timeseries, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_histogram, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":188 + * D_y = coors[pair_1_par_1, 1] - coors[pair_1_par_2, 1] + * if(D_y > blen2) : D_y -= boxlength + * elif(D_y < -blen2) : D_y += boxlength # <<<<<<<<<<<<<< + * + * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] + */ + __pyx_t_11 = (__pyx_v_D_y < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_y = (__pyx_v_D_y + __pyx_v_boxlength); + } + __pyx_L8:; -/* "src/helpers/miscellaneous.pyx":1555 + /* "newanalysis/helpers/miscellaneous.pyx":190 + * elif(D_y < -blen2) : D_y += boxlength * - * @cython.boundscheck(False) - * def sortCollectiveDipNNShells(char[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): # <<<<<<<<<<<<<< - * """ - * ds ... (n_particles, n_particles) + * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] # <<<<<<<<<<<<<< + * if(D_z > blen2) : D_z -= boxlength + * elif(D_z < -blen2) : D_z += boxlength */ + __pyx_t_7 = __pyx_v_pair_1_par_1; + __pyx_t_8 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; + __pyx_t_9 = __pyx_v_pair_1_par_2; + __pyx_t_10 = 2; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; + __pyx_v_D_z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) )))); -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_89sortCollectiveDipNNShells(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_88sortCollectiveDipNNShells[] = "\n ds ... (n_particles, n_particles)\n dip_wat ... (n_particles, 3)\n dip_shell ... (n_shells, 3)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_89sortCollectiveDipNNShells = {"sortCollectiveDipNNShells", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_89sortCollectiveDipNNShells, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_88sortCollectiveDipNNShells}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_89sortCollectiveDipNNShells(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip_wat = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip_shell = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sortCollectiveDipNNShells (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_dip_wat,&__pyx_n_s_dip_shell,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; + /* "newanalysis/helpers/miscellaneous.pyx":191 + * + * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] + * if(D_z > blen2) : D_z -= boxlength # <<<<<<<<<<<<<< + * elif(D_z < -blen2) : D_z += boxlength + * + */ + __pyx_t_11 = (__pyx_v_D_z > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_z = (__pyx_v_D_z - __pyx_v_boxlength); + goto __pyx_L9; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_wat)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShells", 1, 3, 3, 1); __PYX_ERR(0, 1555, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_shell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShells", 1, 3, 3, 2); __PYX_ERR(0, 1555, __pyx_L3_error) + + /* "newanalysis/helpers/miscellaneous.pyx":192 + * D_z = coors[pair_1_par_1, 2] - coors[pair_1_par_2, 2] + * if(D_z > blen2) : D_z -= boxlength + * elif(D_z < -blen2) : D_z += boxlength # <<<<<<<<<<<<<< + * + * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) + */ + __pyx_t_11 = (__pyx_v_D_z < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_z = (__pyx_v_D_z + __pyx_v_boxlength); + } + __pyx_L9:; + + /* "newanalysis/helpers/miscellaneous.pyx":194 + * elif(D_z < -blen2) : D_z += boxlength + * + * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) # <<<<<<<<<<<<<< + * energy1 = charges[pair_1_par_1] * charges[pair_1_par_2] / dist1 + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyFloat_FromDouble((((__pyx_v_D_x * __pyx_v_D_x) + (__pyx_v_D_y * __pyx_v_D_y)) + (__pyx_v_D_z * __pyx_v_D_z))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_15 = NULL; + __pyx_t_16 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_14))) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14); + if (likely(__pyx_t_15)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_14, function); + __pyx_t_16 = 1; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sortCollectiveDipNNShells") < 0)) __PYX_ERR(0, 1555, __pyx_L3_error) + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_13}; + __pyx_t_12 = __Pyx_PyObject_FastCall(__pyx_t_14, __pyx_callargs+1-__pyx_t_16, 1+__pyx_t_16); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1555, __pyx_L3_error) - __pyx_v_dip_wat = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_wat.memview)) __PYX_ERR(0, 1555, __pyx_L3_error) - __pyx_v_dip_shell = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_shell.memview)) __PYX_ERR(0, 1555, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShells", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1555, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.sortCollectiveDipNNShells", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_88sortCollectiveDipNNShells(__pyx_self, __pyx_v_ds, __pyx_v_dip_wat, __pyx_v_dip_shell); + __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_dist1 = __pyx_t_17; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":195 + * + * dist1 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) + * energy1 = charges[pair_1_par_1] * charges[pair_1_par_2] / dist1 # <<<<<<<<<<<<<< + * + * for pair_2_par_1 in range(0, n_particles-1): + */ + __pyx_t_10 = __pyx_v_pair_1_par_1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_charges.shape[0]; + __pyx_t_9 = __pyx_v_pair_1_par_2; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_charges.shape[0]; + __pyx_t_17 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_10 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_9 * __pyx_v_charges.strides[0]) )))); + if (unlikely(__pyx_v_dist1 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 195, __pyx_L1_error) + } + __pyx_v_energy1 = (__pyx_t_17 / __pyx_v_dist1); -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_88sortCollectiveDipNNShells(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_dip_wat, __Pyx_memviewslice __pyx_v_dip_shell) { - int __pyx_v_n_particles; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - __Pyx_RefNannySetupContext("sortCollectiveDipNNShells", 0); + /* "newanalysis/helpers/miscellaneous.pyx":197 + * energy1 = charges[pair_1_par_1] * charges[pair_1_par_2] / dist1 + * + * for pair_2_par_1 in range(0, n_particles-1): # <<<<<<<<<<<<<< + * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): + * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue + */ + __pyx_t_18 = (__pyx_v_n_particles - 1); + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_19; __pyx_t_16+=1) { + __pyx_v_pair_2_par_1 = __pyx_t_16; + + /* "newanalysis/helpers/miscellaneous.pyx":198 + * + * for pair_2_par_1 in range(0, n_particles-1): + * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): # <<<<<<<<<<<<<< + * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue + * + */ + __pyx_t_20 = __pyx_v_n_particles; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = (__pyx_v_pair_2_par_1 + 1); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_pair_2_par_2 = __pyx_t_22; + + /* "newanalysis/helpers/miscellaneous.pyx":199 + * for pair_2_par_1 in range(0, n_particles-1): + * for pair_2_par_2 in range(pair_2_par_1+1, n_particles): + * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue # <<<<<<<<<<<<<< + * + * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] + */ + __pyx_t_23 = (__pyx_v_pair_1_par_1 == __pyx_v_pair_2_par_1); + if (__pyx_t_23) { + } else { + __pyx_t_11 = __pyx_t_23; + goto __pyx_L15_bool_binop_done; + } + __pyx_t_23 = (__pyx_v_pair_1_par_2 == __pyx_v_pair_2_par_2); + __pyx_t_11 = __pyx_t_23; + __pyx_L15_bool_binop_done:; + if (__pyx_t_11) { + goto __pyx_L12_continue; + } + + /* "newanalysis/helpers/miscellaneous.pyx":201 + * if (pair_1_par_1 == pair_2_par_1) and (pair_1_par_2 == pair_2_par_2): continue + * + * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] # <<<<<<<<<<<<<< + * if(D_x > blen2) : D_x -= boxlength + * elif(D_x < -blen2) : D_x += boxlength + */ + __pyx_t_9 = __pyx_v_pair_2_par_1; + __pyx_t_10 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; + __pyx_t_8 = __pyx_v_pair_2_par_2; + __pyx_t_7 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; + __pyx_v_D_x = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); + + /* "newanalysis/helpers/miscellaneous.pyx":202 + * + * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] + * if(D_x > blen2) : D_x -= boxlength # <<<<<<<<<<<<<< + * elif(D_x < -blen2) : D_x += boxlength + * + */ + __pyx_t_11 = (__pyx_v_D_x > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_x = (__pyx_v_D_x - __pyx_v_boxlength); + goto __pyx_L17; + } - /* "src/helpers/miscellaneous.pyx":1562 - * """ + /* "newanalysis/helpers/miscellaneous.pyx":203 + * D_x = coors[pair_2_par_1, 0] - coors[pair_2_par_2, 0] + * if(D_x > blen2) : D_x -= boxlength + * elif(D_x < -blen2) : D_x += boxlength # <<<<<<<<<<<<<< * - * cdef int n_particles = dip_wat.shape[0] # <<<<<<<<<<<<<< - * sort_collective_dip_NN_shells(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) + * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] + */ + __pyx_t_11 = (__pyx_v_D_x < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_x = (__pyx_v_D_x + __pyx_v_boxlength); + } + __pyx_L17:; + + /* "newanalysis/helpers/miscellaneous.pyx":205 + * elif(D_x < -blen2) : D_x += boxlength * + * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] # <<<<<<<<<<<<<< + * if(D_y > blen2) : D_y -= boxlength + * elif(D_y < -blen2) : D_y += boxlength */ - __pyx_v_n_particles = (__pyx_v_dip_wat.shape[0]); + __pyx_t_7 = __pyx_v_pair_2_par_1; + __pyx_t_8 = 1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[1]; + __pyx_t_10 = __pyx_v_pair_2_par_2; + __pyx_t_9 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; + __pyx_v_D_y = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_7 * __pyx_v_coors.strides[0]) ) + __pyx_t_8 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_10 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) )))); - /* "src/helpers/miscellaneous.pyx":1563 + /* "newanalysis/helpers/miscellaneous.pyx":206 * - * cdef int n_particles = dip_wat.shape[0] - * sort_collective_dip_NN_shells(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) # <<<<<<<<<<<<<< + * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] + * if(D_y > blen2) : D_y -= boxlength # <<<<<<<<<<<<<< + * elif(D_y < -blen2) : D_y += boxlength * - * @cython.boundscheck(False) */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_ds.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_ds.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_dip_wat.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[1]; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dip_shell.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dip_shell.shape[1]; - sort_collective_dip_NN_shells((&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_1 * __pyx_v_ds.strides[0]) ) + __pyx_t_2 * __pyx_v_ds.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_3 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_4 * __pyx_v_dip_wat.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_shell.data + __pyx_t_5 * __pyx_v_dip_shell.strides[0]) ) + __pyx_t_6 * __pyx_v_dip_shell.strides[1]) )))), __pyx_v_n_particles); + __pyx_t_11 = (__pyx_v_D_y > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_y = (__pyx_v_D_y - __pyx_v_boxlength); + goto __pyx_L18; + } - /* "src/helpers/miscellaneous.pyx":1555 + /* "newanalysis/helpers/miscellaneous.pyx":207 + * D_y = coors[pair_2_par_1, 1] - coors[pair_2_par_2, 1] + * if(D_y > blen2) : D_y -= boxlength + * elif(D_y < -blen2) : D_y += boxlength # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def sortCollectiveDipNNShells(char[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): # <<<<<<<<<<<<<< - * """ - * ds ... (n_particles, n_particles) + * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] */ + __pyx_t_11 = (__pyx_v_D_y < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_y = (__pyx_v_D_y + __pyx_v_boxlength); + } + __pyx_L18:; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip_wat, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip_shell, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":209 + * elif(D_y < -blen2) : D_y += boxlength + * + * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] # <<<<<<<<<<<<<< + * if(D_z > blen2) : D_z -= boxlength + * elif(D_z < -blen2) : D_z += boxlength + */ + __pyx_t_9 = __pyx_v_pair_2_par_1; + __pyx_t_10 = 2; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coors.shape[1]; + __pyx_t_8 = __pyx_v_pair_2_par_2; + __pyx_t_7 = 2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coors.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coors.shape[1]; + __pyx_v_D_z = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_9 * __pyx_v_coors.strides[0]) ) + __pyx_t_10 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_8 * __pyx_v_coors.strides[0]) ) + __pyx_t_7 * __pyx_v_coors.strides[1]) )))); -/* "src/helpers/miscellaneous.pyx":1566 + /* "newanalysis/helpers/miscellaneous.pyx":210 + * + * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] + * if(D_z > blen2) : D_z -= boxlength # <<<<<<<<<<<<<< + * elif(D_z < -blen2) : D_z += boxlength * - * @cython.boundscheck(False) - * def sortCollectiveDipNNShellsInt(int[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): # <<<<<<<<<<<<<< - * """ - * ds ... (n_particles, n_particles) */ + __pyx_t_11 = (__pyx_v_D_z > __pyx_v_blen2); + if (__pyx_t_11) { + __pyx_v_D_z = (__pyx_v_D_z - __pyx_v_boxlength); + goto __pyx_L19; + } -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_91sortCollectiveDipNNShellsInt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_90sortCollectiveDipNNShellsInt[] = "\n ds ... (n_particles, n_particles)\n dip_wat ... (n_particles, 3)\n dip_shell ... (n_shells, 3)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_91sortCollectiveDipNNShellsInt = {"sortCollectiveDipNNShellsInt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_91sortCollectiveDipNNShellsInt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_90sortCollectiveDipNNShellsInt}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_91sortCollectiveDipNNShellsInt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip_wat = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_dip_shell = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sortCollectiveDipNNShellsInt (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_dip_wat,&__pyx_n_s_dip_shell,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_wat)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShellsInt", 1, 3, 3, 1); __PYX_ERR(0, 1566, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dip_shell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShellsInt", 1, 3, 3, 2); __PYX_ERR(0, 1566, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sortCollectiveDipNNShellsInt") < 0)) __PYX_ERR(0, 1566, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1566, __pyx_L3_error) - __pyx_v_dip_wat = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_wat.memview)) __PYX_ERR(0, 1566, __pyx_L3_error) - __pyx_v_dip_shell = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_shell.memview)) __PYX_ERR(0, 1566, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShellsInt", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1566, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.sortCollectiveDipNNShellsInt", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_90sortCollectiveDipNNShellsInt(__pyx_self, __pyx_v_ds, __pyx_v_dip_wat, __pyx_v_dip_shell); + /* "newanalysis/helpers/miscellaneous.pyx":211 + * D_z = coors[pair_2_par_1, 2] - coors[pair_2_par_2, 2] + * if(D_z > blen2) : D_z -= boxlength + * elif(D_z < -blen2) : D_z += boxlength # <<<<<<<<<<<<<< + * + * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) + */ + __pyx_t_11 = (__pyx_v_D_z < (-__pyx_v_blen2)); + if (__pyx_t_11) { + __pyx_v_D_z = (__pyx_v_D_z + __pyx_v_boxlength); + } + __pyx_L19:; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":213 + * elif(D_z < -blen2) : D_z += boxlength + * + * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) # <<<<<<<<<<<<<< + * energy2 = charges[pair_2_par_1] * charges[pair_2_par_2] / dist1 + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = PyFloat_FromDouble((((__pyx_v_D_x * __pyx_v_D_x) + (__pyx_v_D_y * __pyx_v_D_y)) + (__pyx_v_D_z * __pyx_v_D_z))); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = NULL; + __pyx_t_24 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_13); + if (likely(__pyx_t_15)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_13, function); + __pyx_t_24 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_14}; + __pyx_t_12 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+1-__pyx_t_24, 1+__pyx_t_24); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } + __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_dist2 = __pyx_t_17; -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_90sortCollectiveDipNNShellsInt(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_dip_wat, __Pyx_memviewslice __pyx_v_dip_shell) { - int __pyx_v_n_particles; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - __Pyx_RefNannySetupContext("sortCollectiveDipNNShellsInt", 0); + /* "newanalysis/helpers/miscellaneous.pyx":214 + * + * dist2 = np.sqrt(D_x*D_x + D_y*D_y + D_z*D_z) + * energy2 = charges[pair_2_par_1] * charges[pair_2_par_2] / dist1 # <<<<<<<<<<<<<< + * + * bin1 = int(segs * dist1) + */ + __pyx_t_7 = __pyx_v_pair_2_par_1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_charges.shape[0]; + __pyx_t_8 = __pyx_v_pair_2_par_2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_charges.shape[0]; + __pyx_t_17 = ((*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_7 * __pyx_v_charges.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_8 * __pyx_v_charges.strides[0]) )))); + if (unlikely(__pyx_v_dist1 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 214, __pyx_L1_error) + } + __pyx_v_energy2 = (__pyx_t_17 / __pyx_v_dist1); - /* "src/helpers/miscellaneous.pyx":1573 - * """ + /* "newanalysis/helpers/miscellaneous.pyx":216 + * energy2 = charges[pair_2_par_1] * charges[pair_2_par_2] / dist1 * - * cdef int n_particles = dip_wat.shape[0] # <<<<<<<<<<<<<< - * sort_collective_dip_NN_shells_int(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) + * bin1 = int(segs * dist1) # <<<<<<<<<<<<<< + * bin2 = int(segs * dist2) * */ - __pyx_v_n_particles = (__pyx_v_dip_wat.shape[0]); + __pyx_v_bin1 = ((int)(__pyx_v_segs * __pyx_v_dist1)); - /* "src/helpers/miscellaneous.pyx":1574 + /* "newanalysis/helpers/miscellaneous.pyx":217 * - * cdef int n_particles = dip_wat.shape[0] - * sort_collective_dip_NN_shells_int(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) # <<<<<<<<<<<<<< + * bin1 = int(segs * dist1) + * bin2 = int(segs * dist2) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) + * if (bin1 < bin_dist) and (bin2 < bin_dist): */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_ds.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_ds.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_dip_wat.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[1]; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dip_shell.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dip_shell.shape[1]; - sort_collective_dip_NN_shells_int((&(*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_1 * __pyx_v_ds.strides[0]) ) + __pyx_t_2 * __pyx_v_ds.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_3 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_4 * __pyx_v_dip_wat.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_shell.data + __pyx_t_5 * __pyx_v_dip_shell.strides[0]) ) + __pyx_t_6 * __pyx_v_dip_shell.strides[1]) )))), __pyx_v_n_particles); + __pyx_v_bin2 = ((int)(__pyx_v_segs * __pyx_v_dist2)); - /* "src/helpers/miscellaneous.pyx":1566 + /* "newanalysis/helpers/miscellaneous.pyx":219 + * bin2 = int(segs * dist2) * - * @cython.boundscheck(False) - * def sortCollectiveDipNNShellsInt(int[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): # <<<<<<<<<<<<<< - * """ - * ds ... (n_particles, n_particles) + * if (bin1 < bin_dist) and (bin2 < bin_dist): # <<<<<<<<<<<<<< + * histogram[bin1, bin2] += energy1 * energy2 + * histogram[bin2, bin2] += histogram[bin1, bin2] */ + __pyx_t_23 = (__pyx_v_bin1 < __pyx_v_bin_dist); + if (__pyx_t_23) { + } else { + __pyx_t_11 = __pyx_t_23; + goto __pyx_L21_bool_binop_done; + } + __pyx_t_23 = (__pyx_v_bin2 < __pyx_v_bin_dist); + __pyx_t_11 = __pyx_t_23; + __pyx_L21_bool_binop_done:; + if (__pyx_t_11) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip_wat, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_dip_shell, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":220 + * + * if (bin1 < bin_dist) and (bin2 < bin_dist): + * histogram[bin1, bin2] += energy1 * energy2 # <<<<<<<<<<<<<< + * histogram[bin2, bin2] += histogram[bin1, bin2] + * + */ + __pyx_t_8 = __pyx_v_bin1; + __pyx_t_7 = __pyx_v_bin2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_8 * __pyx_v_histogram.strides[0]) ) + __pyx_t_7 * __pyx_v_histogram.strides[1]) )) += (__pyx_v_energy1 * __pyx_v_energy2); -/* "src/helpers/miscellaneous.pyx":1577 + /* "newanalysis/helpers/miscellaneous.pyx":221 + * if (bin1 < bin_dist) and (bin2 < bin_dist): + * histogram[bin1, bin2] += energy1 * energy2 + * histogram[bin2, bin2] += histogram[bin1, bin2] # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) - * def calcDipTenCollective(double[:,:] coor, double[:] results): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) */ + __pyx_t_7 = __pyx_v_bin1; + __pyx_t_8 = __pyx_v_bin2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[1]; + __pyx_t_10 = __pyx_v_bin2; + __pyx_t_9 = __pyx_v_bin2; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_histogram.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_histogram.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_10 * __pyx_v_histogram.strides[0]) ) + __pyx_t_9 * __pyx_v_histogram.strides[1]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_7 * __pyx_v_histogram.strides[0]) ) + __pyx_t_8 * __pyx_v_histogram.strides[1]) ))); -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_93calcDipTenCollective(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_92calcDipTenCollective[] = "\n coor ... (n_particles, 3)\n results ... (6) \n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_93calcDipTenCollective = {"calcDipTenCollective", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_93calcDipTenCollective, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_92calcDipTenCollective}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_93calcDipTenCollective(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDipTenCollective (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_results,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_results)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollective", 1, 2, 2, 1); __PYX_ERR(0, 1577, __pyx_L3_error) + /* "newanalysis/helpers/miscellaneous.pyx":219 + * bin2 = int(segs * dist2) + * + * if (bin1 < bin_dist) and (bin2 < bin_dist): # <<<<<<<<<<<<<< + * histogram[bin1, bin2] += energy1 * energy2 + * histogram[bin2, bin2] += histogram[bin1, bin2] + */ + } + __pyx_L12_continue:; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDipTenCollective") < 0)) __PYX_ERR(0, 1577, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1577, __pyx_L3_error) - __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1577, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDipTenCollective", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1577, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollective", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_92calcDipTenCollective(__pyx_self, __pyx_v_coor, __pyx_v_results); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_92calcDipTenCollective(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_results) { - int __pyx_v_n_particles; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - __Pyx_RefNannySetupContext("calcDipTenCollective", 0); - - /* "src/helpers/miscellaneous.pyx":1582 - * results ... (6) - * """ - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< - * - * calc_dip_ten_collective(&coor[0,0], n_particles, &results[0]) - */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "src/helpers/miscellaneous.pyx":1584 - * cdef int n_particles = coor.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":167 * - * calc_dip_ten_collective(&coor[0,0], n_particles, &results[0]) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; - __pyx_t_3 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_results.shape[0]; - calc_dip_ten_collective((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((double *) ( /* dim=0 */ (__pyx_v_results.data + __pyx_t_3 * __pyx_v_results.strides[0]) ))))); - - /* "src/helpers/miscellaneous.pyx":1577 * - * @cython.boundscheck(False) - * def calcDipTenCollective(double[:,:] coor, double[:] results): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): + * cdef int n_particles = coors.shape[0] */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_results, 1); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("newanalysis.miscellaneous.structureFactorCharge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1587 +/* "newanalysis/helpers/miscellaneous.pyx":225 * - * @cython.boundscheck(False) - * def calcDipTenCollectivePerAtom(int idx, double[:,:] coor, double[:] results): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) + * #Version1: Just one distance per targeted (water) molecule + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def accumulateShellwiseGFunction(double [:,:] aufpunkte, double [:,:] coor, char [:] dataset, double[:,:] histogram, double[:] norm, int maxshell, double histo_min, double histo_max, double boxlength): + * ''' */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_95calcDipTenCollectivePerAtom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_94calcDipTenCollectivePerAtom[] = "\n coor ... (n_particles, 3)\n results ... (6) \n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_95calcDipTenCollectivePerAtom = {"calcDipTenCollectivePerAtom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_95calcDipTenCollectivePerAtom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_94calcDipTenCollectivePerAtom}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_95calcDipTenCollectivePerAtom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_idx; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_9accumulateShellwiseGFunction(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_8accumulateShellwiseGFunction, "\n aufpunkte ... (n_aufpunkte, 3)\n coor ... (n_particles, 3)\n dataset ... (n_particles)\n histogram ... (number_of_shells, number_of_datapoints)\n norm ... (number_of_shells)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_9accumulateShellwiseGFunction = {"accumulateShellwiseGFunction", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_9accumulateShellwiseGFunction, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_8accumulateShellwiseGFunction}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_9accumulateShellwiseGFunction(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_aufpunkte = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_norm = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell; + double __pyx_v_histo_min; + double __pyx_v_histo_max; + double __pyx_v_boxlength; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDipTenCollectivePerAtom (wrapper)", 0); + __Pyx_RefNannySetupContext("accumulateShellwiseGFunction (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 225, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_coor,&__pyx_n_s_results,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkte,&__pyx_n_s_coor,&__pyx_n_s_dataset,&__pyx_n_s_histogram,&__pyx_n_s_norm,&__pyx_n_s_maxshell,&__pyx_n_s_histo_min,&__pyx_n_s_histo_max,&__pyx_n_s_boxlength,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkte)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectivePerAtom", 1, 3, 3, 1); __PYX_ERR(0, 1587, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 1); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_results)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectivePerAtom", 1, 3, 3, 2); __PYX_ERR(0, 1587, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 2); __PYX_ERR(0, 225, __pyx_L3_error) } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDipTenCollectivePerAtom") < 0)) __PYX_ERR(0, 1587, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_idx = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1587, __pyx_L3_error) - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1587, __pyx_L3_error) - __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1587, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectivePerAtom", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1587, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectivePerAtom", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_94calcDipTenCollectivePerAtom(__pyx_self, __pyx_v_idx, __pyx_v_coor, __pyx_v_results); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_94calcDipTenCollectivePerAtom(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_idx, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_results) { - int __pyx_v_n_particles; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - __Pyx_RefNannySetupContext("calcDipTenCollectivePerAtom", 0); - - /* "src/helpers/miscellaneous.pyx":1592 - * results ... (6) - * """ - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< - * - * calc_dip_ten_collective_per_atom(idx, &coor[0,0], n_particles, &results[0]) - */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - - /* "src/helpers/miscellaneous.pyx":1594 - * cdef int n_particles = coor.shape[0] - * - * calc_dip_ten_collective_per_atom(idx, &coor[0,0], n_particles, &results[0]) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; - __pyx_t_3 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_results.shape[0]; - calc_dip_ten_collective_per_atom(__pyx_v_idx, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((double *) ( /* dim=0 */ (__pyx_v_results.data + __pyx_t_3 * __pyx_v_results.strides[0]) ))))); - - /* "src/helpers/miscellaneous.pyx":1587 - * - * @cython.boundscheck(False) - * def calcDipTenCollectivePerAtom(int idx, double[:,:] coor, double[:] results): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_results, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/miscellaneous.pyx":1597 - * - * @cython.boundscheck(False) - * def calcDipTenCollectiveCross(double[:,:] coor1, double[:,:] coor2, double[:] results): # <<<<<<<<<<<<<< - * """ - * coor1 ... (n_particles1, 3) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_97calcDipTenCollectiveCross(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_96calcDipTenCollectiveCross[] = "\n coor1 ... (n_particles1, 3)\n coor2 ... (n_particles2, 3)\n results ... (6) \n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_97calcDipTenCollectiveCross = {"calcDipTenCollectiveCross", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_97calcDipTenCollectiveCross, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_96calcDipTenCollectiveCross}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_97calcDipTenCollectiveCross(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDipTenCollectiveCross (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_results,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histogram)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 3); __PYX_ERR(0, 225, __pyx_L3_error) + } CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_norm)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 4); __PYX_ERR(0, 225, __pyx_L3_error) + } CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor1)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 5); __PYX_ERR(0, 225, __pyx_L3_error) + } CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor2)) != 0)) kw_args--; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_min)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveCross", 1, 3, 3, 1); __PYX_ERR(0, 1597, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 6); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_results)) != 0)) kw_args--; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histo_max)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveCross", 1, 3, 3, 2); __PYX_ERR(0, 1597, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 7); __PYX_ERR(0, 225, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, 8); __PYX_ERR(0, 225, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDipTenCollectiveCross") < 0)) __PYX_ERR(0, 1597, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "accumulateShellwiseGFunction") < 0)) __PYX_ERR(0, 225, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 9)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); } - __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 1597, __pyx_L3_error) - __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 1597, __pyx_L3_error) - __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1597, __pyx_L3_error) + __pyx_v_aufpunkte = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkte.memview)) __PYX_ERR(0, 226, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 226, __pyx_L3_error) + __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 226, __pyx_L3_error) + __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 226, __pyx_L3_error) + __pyx_v_norm = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_norm.memview)) __PYX_ERR(0, 226, __pyx_L3_error) + __pyx_v_maxshell = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L3_error) + __pyx_v_histo_min = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_histo_min == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L3_error) + __pyx_v_histo_max = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_histo_max == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L3_error) + __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveCross", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1597, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("accumulateShellwiseGFunction", 1, 9, 9, __pyx_nargs); __PYX_ERR(0, 225, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveCross", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkte, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_norm, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.accumulateShellwiseGFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_96calcDipTenCollectiveCross(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_results); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_8accumulateShellwiseGFunction(__pyx_self, __pyx_v_aufpunkte, __pyx_v_coor, __pyx_v_dataset, __pyx_v_histogram, __pyx_v_norm, __pyx_v_maxshell, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_boxlength); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkte, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_norm, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_96calcDipTenCollectiveCross(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, __Pyx_memviewslice __pyx_v_results) { - int __pyx_v_n_particles1; - int __pyx_v_n_particles2; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_8accumulateShellwiseGFunction(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkte, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dataset, __Pyx_memviewslice __pyx_v_histogram, __Pyx_memviewslice __pyx_v_norm, int __pyx_v_maxshell, double __pyx_v_histo_min, double __pyx_v_histo_max, double __pyx_v_boxlength) { + int __pyx_v_n_aufpunkte; + int __pyx_v_n_particles; + int __pyx_v_number_of_datapoints; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -28601,1247 +24551,1977 @@ static PyObject *__pyx_pf_11newanalysis_13miscellaneous_96calcDipTenCollectiveCr Py_ssize_t __pyx_t_3; Py_ssize_t __pyx_t_4; Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("calcDipTenCollectiveCross", 0); + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + __Pyx_RefNannySetupContext("accumulateShellwiseGFunction", 0); - /* "src/helpers/miscellaneous.pyx":1603 - * results ... (6) - * """ - * cdef int n_particles1 = coor1.shape[0] # <<<<<<<<<<<<<< - * cdef int n_particles2 = coor2.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":235 + * ''' * + * cdef int n_aufpunkte = aufpunkte.shape[0] # <<<<<<<<<<<<<< + * cdef int n_particles = coor.shape[0] + * cdef int number_of_datapoints = histogram.shape[1] */ - __pyx_v_n_particles1 = (__pyx_v_coor1.shape[0]); + __pyx_v_n_aufpunkte = (__pyx_v_aufpunkte.shape[0]); - /* "src/helpers/miscellaneous.pyx":1604 - * """ - * cdef int n_particles1 = coor1.shape[0] - * cdef int n_particles2 = coor2.shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":236 + * + * cdef int n_aufpunkte = aufpunkte.shape[0] + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< + * cdef int number_of_datapoints = histogram.shape[1] * - * calc_dip_ten_collective_cross(&coor1[0,0], n_particles1, &coor2[0,0], n_particles2, &results[0]) */ - __pyx_v_n_particles2 = (__pyx_v_coor2.shape[0]); + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "src/helpers/miscellaneous.pyx":1606 - * cdef int n_particles2 = coor2.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":237 + * cdef int n_aufpunkte = aufpunkte.shape[0] + * cdef int n_particles = coor.shape[0] + * cdef int number_of_datapoints = histogram.shape[1] # <<<<<<<<<<<<<< * - * calc_dip_ten_collective_cross(&coor1[0,0], n_particles1, &coor2[0,0], n_particles2, &results[0]) # <<<<<<<<<<<<<< + * calc_accumulate_shellwise_g_function(&aufpunkte[0,0], &coor[0,0], &dataset[0], &histogram[0,0], &norm[0], n_aufpunkte, n_particles, number_of_datapoints, maxshell, histo_min, histo_max, boxlength) + */ + __pyx_v_number_of_datapoints = (__pyx_v_histogram.shape[1]); + + /* "newanalysis/helpers/miscellaneous.pyx":239 + * cdef int number_of_datapoints = histogram.shape[1] * + * calc_accumulate_shellwise_g_function(&aufpunkte[0,0], &coor[0,0], &dataset[0], &histogram[0,0], &norm[0], n_aufpunkte, n_particles, number_of_datapoints, maxshell, histo_min, histo_max, boxlength) # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ __pyx_t_1 = 0; __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor1.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor1.shape[1]; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_aufpunkte.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_aufpunkte.shape[1]; __pyx_t_3 = 0; __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor2.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor2.shape[1]; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; __pyx_t_5 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_results.shape[0]; - calc_dip_ten_collective_cross((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor1.data + __pyx_t_1 * __pyx_v_coor1.strides[0]) ) + __pyx_t_2 * __pyx_v_coor1.strides[1]) )))), __pyx_v_n_particles1, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor2.data + __pyx_t_3 * __pyx_v_coor2.strides[0]) ) + __pyx_t_4 * __pyx_v_coor2.strides[1]) )))), __pyx_v_n_particles2, (&(*((double *) ( /* dim=0 */ (__pyx_v_results.data + __pyx_t_5 * __pyx_v_results.strides[0]) ))))); + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dataset.shape[0]; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_histogram.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[1]; + __pyx_t_8 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_norm.shape[0]; + calc_accumulate_shellwise_g_function((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_aufpunkte.data + __pyx_t_1 * __pyx_v_aufpunkte.strides[0]) ) + __pyx_t_2 * __pyx_v_aufpunkte.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_3 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))), (&(*((char *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_5 * __pyx_v_dataset.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_6 * __pyx_v_histogram.strides[0]) ) + __pyx_t_7 * __pyx_v_histogram.strides[1]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_norm.data + __pyx_t_8 * __pyx_v_norm.strides[0]) )))), __pyx_v_n_aufpunkte, __pyx_v_n_particles, __pyx_v_number_of_datapoints, __pyx_v_maxshell, __pyx_v_histo_min, __pyx_v_histo_max, __pyx_v_boxlength); - /* "src/helpers/miscellaneous.pyx":1597 + /* "newanalysis/helpers/miscellaneous.pyx":225 * - * @cython.boundscheck(False) - * def calcDipTenCollectiveCross(double[:,:] coor1, double[:,:] coor2, double[:] results): # <<<<<<<<<<<<<< - * """ - * coor1 ... (n_particles1, 3) + * #Version1: Just one distance per targeted (water) molecule + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def accumulateShellwiseGFunction(double [:,:] aufpunkte, double [:,:] coor, char [:] dataset, double[:,:] histogram, double[:] norm, int maxshell, double histo_min, double histo_max, double boxlength): + * ''' */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_results, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1610 +/* "newanalysis/helpers/miscellaneous.pyx":241 + * calc_accumulate_shellwise_g_function(&aufpunkte[0,0], &coor[0,0], &dataset[0], &histogram[0,0], &norm[0], n_aufpunkte, n_particles, number_of_datapoints, maxshell, histo_min, histo_max, boxlength) * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwise(double[:,:] coor, char [:,:] ds, double[:,:] results): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def accumulateNMShellwiseGFunction(double [:,:] coor1, double [:,:] coor2, int[:,:] dataset, double[:,:] histogram, int particle_first, int n_particles, int max_distance, int segments_per_angstroem): + * cdef int particle1, particle2, point1, point2, shell, bin_dist */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_99calcDipTenCollectiveNNShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_98calcDipTenCollectiveNNShellwise[] = "\n coor ... (n_particles, 3)\n ds ... (n_particles, n_particles)\n results ... (shells, 6)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_99calcDipTenCollectiveNNShellwise = {"calcDipTenCollectiveNNShellwise", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_99calcDipTenCollectiveNNShellwise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_98calcDipTenCollectiveNNShellwise}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_99calcDipTenCollectiveNNShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_11accumulateNMShellwiseGFunction(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_11accumulateNMShellwiseGFunction = {"accumulateNMShellwiseGFunction", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_11accumulateNMShellwiseGFunction, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_11accumulateNMShellwiseGFunction(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_particle_first; + int __pyx_v_n_particles; + int __pyx_v_max_distance; + int __pyx_v_segments_per_angstroem; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwise (wrapper)", 0); + __Pyx_RefNannySetupContext("accumulateNMShellwiseGFunction (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 241, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_ds,&__pyx_n_s_results,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_dataset,&__pyx_n_s_histogram,&__pyx_n_s_particle_first,&__pyx_n_s_n_particles,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwise", 1, 3, 3, 1); __PYX_ERR(0, 1610, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 1); __PYX_ERR(0, 241, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_results)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 2); __PYX_ERR(0, 241, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histogram)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 3); __PYX_ERR(0, 241, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_particle_first)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 4); __PYX_ERR(0, 241, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_particles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 5); __PYX_ERR(0, 241, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_distance)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 6); __PYX_ERR(0, 241, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_segments_per_angstroem)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwise", 1, 3, 3, 2); __PYX_ERR(0, 1610, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, 7); __PYX_ERR(0, 241, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDipTenCollectiveNNShellwise") < 0)) __PYX_ERR(0, 1610, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "accumulateNMShellwiseGFunction") < 0)) __PYX_ERR(0, 241, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 8)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1610, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1610, __pyx_L3_error) - __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1610, __pyx_L3_error) + __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_particle_first = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_particle_first == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_n_particles = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_n_particles == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_max_distance = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_max_distance == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwise", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1610, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("accumulateNMShellwiseGFunction", 1, 8, 8, __pyx_nargs); __PYX_ERR(0, 241, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveNNShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.accumulateNMShellwiseGFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_98calcDipTenCollectiveNNShellwise(__pyx_self, __pyx_v_coor, __pyx_v_ds, __pyx_v_results); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_10accumulateNMShellwiseGFunction(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_dataset, __pyx_v_histogram, __pyx_v_particle_first, __pyx_v_n_particles, __pyx_v_max_distance, __pyx_v_segments_per_angstroem); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_98calcDipTenCollectiveNNShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_results) { - int __pyx_v_n_particles; - int __pyx_v_shells; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_10accumulateNMShellwiseGFunction(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coor1, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_coor2, __Pyx_memviewslice __pyx_v_dataset, __Pyx_memviewslice __pyx_v_histogram, int __pyx_v_particle_first, int __pyx_v_n_particles, int __pyx_v_max_distance, int __pyx_v_segments_per_angstroem) { + int __pyx_v_particle1; + int __pyx_v_particle2; + int __pyx_v_point1; + int __pyx_v_point2; + int __pyx_v_shell; + int __pyx_v_bin_dist; + int __pyx_v_maxshell; + double __pyx_v_dist; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwise", 0); + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + __Pyx_RefNannySetupContext("accumulateNMShellwiseGFunction", 0); - /* "src/helpers/miscellaneous.pyx":1616 - * results ... (shells, 6) - * """ - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< - * cdef int shells = results.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":244 + * def accumulateNMShellwiseGFunction(double [:,:] coor1, double [:,:] coor2, int[:,:] dataset, double[:,:] histogram, int particle_first, int n_particles, int max_distance, int segments_per_angstroem): + * cdef int particle1, particle2, point1, point2, shell, bin_dist + * cdef int maxshell = histogram.shape[1] # <<<<<<<<<<<<<< + * cdef double dist * */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); + __pyx_v_maxshell = (__pyx_v_histogram.shape[1]); - /* "src/helpers/miscellaneous.pyx":1617 - * """ - * cdef int n_particles = coor.shape[0] - * cdef int shells = results.shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":247 + * cdef double dist * - * calc_dip_ten_collective_NNshellwise(&coor[0,0], n_particles, &ds[0,0], shells, &results[0,0]) + * for particle1 in range(n_particles): # <<<<<<<<<<<<<< + * for particle2 in range(particle1+1, n_particles): + * point1 = particle_first + particle1 */ - __pyx_v_shells = (__pyx_v_results.shape[0]); + __pyx_t_1 = __pyx_v_n_particles; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_particle1 = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":1619 - * cdef int shells = results.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":248 * - * calc_dip_ten_collective_NNshellwise(&coor[0,0], n_particles, &ds[0,0], shells, &results[0,0]) # <<<<<<<<<<<<<< + * for particle1 in range(n_particles): + * for particle2 in range(particle1+1, n_particles): # <<<<<<<<<<<<<< + * point1 = particle_first + particle1 + * point2 = particle_first + particle2 + */ + __pyx_t_4 = __pyx_v_n_particles; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = (__pyx_v_particle1 + 1); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_particle2 = __pyx_t_6; + + /* "newanalysis/helpers/miscellaneous.pyx":249 + * for particle1 in range(n_particles): + * for particle2 in range(particle1+1, n_particles): + * point1 = particle_first + particle1 # <<<<<<<<<<<<<< + * point2 = particle_first + particle2 + * + */ + __pyx_v_point1 = (__pyx_v_particle_first + __pyx_v_particle1); + + /* "newanalysis/helpers/miscellaneous.pyx":250 + * for particle2 in range(particle1+1, n_particles): + * point1 = particle_first + particle1 + * point2 = particle_first + particle2 # <<<<<<<<<<<<<< * + * shell = dataset[point1, point2] + */ + __pyx_v_point2 = (__pyx_v_particle_first + __pyx_v_particle2); + + /* "newanalysis/helpers/miscellaneous.pyx":252 + * point2 = particle_first + particle2 * + * shell = dataset[point1, point2] # <<<<<<<<<<<<<< + * if(shell >= maxshell): shell = maxshell-1 + * dist = 0 */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_ds.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds.shape[1]; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_results.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_results.shape[1]; - calc_dip_ten_collective_NNshellwise((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_3 * __pyx_v_ds.strides[0]) ) + __pyx_t_4 * __pyx_v_ds.strides[1]) )))), __pyx_v_shells, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_5 * __pyx_v_results.strides[0]) ) + __pyx_t_6 * __pyx_v_results.strides[1]) ))))); + __pyx_t_7 = __pyx_v_point1; + __pyx_t_8 = __pyx_v_point2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dataset.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dataset.shape[1]; + __pyx_v_shell = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_7 * __pyx_v_dataset.strides[0]) ) + __pyx_t_8 * __pyx_v_dataset.strides[1]) ))); - /* "src/helpers/miscellaneous.pyx":1610 + /* "newanalysis/helpers/miscellaneous.pyx":253 + * + * shell = dataset[point1, point2] + * if(shell >= maxshell): shell = maxshell-1 # <<<<<<<<<<<<<< + * dist = 0 + * bin_dist = int(dist*segments_per_angstroem) + */ + __pyx_t_9 = (__pyx_v_shell >= __pyx_v_maxshell); + if (__pyx_t_9) { + __pyx_v_shell = (__pyx_v_maxshell - 1); + } + + /* "newanalysis/helpers/miscellaneous.pyx":254 + * shell = dataset[point1, point2] + * if(shell >= maxshell): shell = maxshell-1 + * dist = 0 # <<<<<<<<<<<<<< + * bin_dist = int(dist*segments_per_angstroem) + * if(bin_dist < max_distance*segments_per_angstroem): + */ + __pyx_v_dist = 0.0; + + /* "newanalysis/helpers/miscellaneous.pyx":255 + * if(shell >= maxshell): shell = maxshell-1 + * dist = 0 + * bin_dist = int(dist*segments_per_angstroem) # <<<<<<<<<<<<<< + * if(bin_dist < max_distance*segments_per_angstroem): + * histogram[shell, bin_dist] += 1 + */ + __pyx_v_bin_dist = ((int)(__pyx_v_dist * __pyx_v_segments_per_angstroem)); + + /* "newanalysis/helpers/miscellaneous.pyx":256 + * dist = 0 + * bin_dist = int(dist*segments_per_angstroem) + * if(bin_dist < max_distance*segments_per_angstroem): # <<<<<<<<<<<<<< + * histogram[shell, bin_dist] += 1 + * + */ + __pyx_t_9 = (__pyx_v_bin_dist < (__pyx_v_max_distance * __pyx_v_segments_per_angstroem)); + if (__pyx_t_9) { + + /* "newanalysis/helpers/miscellaneous.pyx":257 + * bin_dist = int(dist*segments_per_angstroem) + * if(bin_dist < max_distance*segments_per_angstroem): + * histogram[shell, bin_dist] += 1 # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_8 = __pyx_v_shell; + __pyx_t_7 = __pyx_v_bin_dist; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_8 * __pyx_v_histogram.strides[0]) ) + __pyx_t_7 * __pyx_v_histogram.strides[1]) )) += 1.0; + + /* "newanalysis/helpers/miscellaneous.pyx":256 + * dist = 0 + * bin_dist = int(dist*segments_per_angstroem) + * if(bin_dist < max_distance*segments_per_angstroem): # <<<<<<<<<<<<<< + * histogram[shell, bin_dist] += 1 * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwise(double[:,:] coor, char [:,:] ds, double[:,:] results): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) + */ + } + } + } + + /* "newanalysis/helpers/miscellaneous.pyx":241 + * calc_accumulate_shellwise_g_function(&aufpunkte[0,0], &coor[0,0], &dataset[0], &histogram[0,0], &norm[0], n_aufpunkte, n_particles, number_of_datapoints, maxshell, histo_min, histo_max, boxlength) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def accumulateNMShellwiseGFunction(double [:,:] coor1, double [:,:] coor2, int[:,:] dataset, double[:,:] histogram, int particle_first, int n_particles, int max_distance, int segments_per_angstroem): + * cdef int particle1, particle2, point1, point2, shell, bin_dist */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_results, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1623 +/* "newanalysis/helpers/miscellaneous.pyx":260 * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwiseSelf(double[:,:] coor, int[:] f2c, char [:,:] ds, int ds_idx, double[:,:] results): # <<<<<<<<<<<<<< + * + * def sumUpByShell(double [:,:,:] timeseries, double [:,:,:] timeseries_shellwise, char[:,:] ds): # <<<<<<<<<<<<<< * """ - * coor ... (n_particles, 3) + * timeseries ... (n_frames, n_particles, 3) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_101calcDipTenCollectiveNNShellwiseSelf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_100calcDipTenCollectiveNNShellwiseSelf[] = "\n coor ... (n_particles, 3)\n ds ... (n_particles_tot, n_particles_tot)\n results ... (shells, 6)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_101calcDipTenCollectiveNNShellwiseSelf = {"calcDipTenCollectiveNNShellwiseSelf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_101calcDipTenCollectiveNNShellwiseSelf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_100calcDipTenCollectiveNNShellwiseSelf}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_101calcDipTenCollectiveNNShellwiseSelf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_f2c = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_13sumUpByShell(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_12sumUpByShell, "\n timeseries ... (n_frames, n_particles, 3)\n timeseries_shellwise ... (n_shells, n_frames, 3)\n ds ... (n_frames, n_particles)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_13sumUpByShell = {"sumUpByShell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_13sumUpByShell, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_12sumUpByShell}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_13sumUpByShell(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_timeseries_shellwise = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_ds_idx; - __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwiseSelf (wrapper)", 0); + __Pyx_RefNannySetupContext("sumUpByShell (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 260, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_f2c,&__pyx_n_s_ds,&__pyx_n_s_ds_idx,&__pyx_n_s_results,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_timeseries_shellwise,&__pyx_n_s_ds,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 260, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f2c)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseSelf", 1, 5, 5, 1); __PYX_ERR(0, 1623, __pyx_L3_error) + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries_shellwise)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 260, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseSelf", 1, 5, 5, 2); __PYX_ERR(0, 1623, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("sumUpByShell", 1, 3, 3, 1); __PYX_ERR(0, 260, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds_idx)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseSelf", 1, 5, 5, 3); __PYX_ERR(0, 1623, __pyx_L3_error) + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_results)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 260, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseSelf", 1, 5, 5, 4); __PYX_ERR(0, 1623, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("sumUpByShell", 1, 3, 3, 2); __PYX_ERR(0, 260, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDipTenCollectiveNNShellwiseSelf") < 0)) __PYX_ERR(0, 1623, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sumUpByShell") < 0)) __PYX_ERR(0, 260, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1623, __pyx_L3_error) - __pyx_v_f2c = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_f2c.memview)) __PYX_ERR(0, 1623, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1623, __pyx_L3_error) - __pyx_v_ds_idx = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_ds_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1623, __pyx_L3_error) - __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1623, __pyx_L3_error) + __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 260, __pyx_L3_error) + __pyx_v_timeseries_shellwise = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries_shellwise.memview)) __PYX_ERR(0, 260, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 260, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseSelf", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1623, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("sumUpByShell", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 260, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveNNShellwiseSelf", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries_shellwise, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.sumUpByShell", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_100calcDipTenCollectiveNNShellwiseSelf(__pyx_self, __pyx_v_coor, __pyx_v_f2c, __pyx_v_ds, __pyx_v_ds_idx, __pyx_v_results); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_12sumUpByShell(__pyx_self, __pyx_v_timeseries, __pyx_v_timeseries_shellwise, __pyx_v_ds); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries_shellwise, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_100calcDipTenCollectiveNNShellwiseSelf(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_ds_idx, __Pyx_memviewslice __pyx_v_results) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_12sumUpByShell(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_timeseries_shellwise, __Pyx_memviewslice __pyx_v_ds) { + int __pyx_v_n_frames; int __pyx_v_n_particles; - int __pyx_v_n_particles_tot; - int __pyx_v_shells; + int __pyx_v_n_shells; + int __pyx_v_particle; + int __pyx_v_shell; + int __pyx_v_frame; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; Py_ssize_t __pyx_t_7; - __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwiseSelf", 0); + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sumUpByShell", 0); - /* "src/helpers/miscellaneous.pyx":1629 - * results ... (shells, 6) - * """ - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< - * cdef int n_particles_tot = ds.shape[0] - * cdef int shells = results.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":268 + * #BeyondShellPolicy = drop_particle + * + * cdef int n_frames = timeseries.shape[0] # <<<<<<<<<<<<<< + * cdef int n_particles = timeseries.shape[1] + * cdef int n_shells = timeseries_shellwise.shape[0] + */ + __pyx_v_n_frames = (__pyx_v_timeseries.shape[0]); + + /* "newanalysis/helpers/miscellaneous.pyx":269 + * + * cdef int n_frames = timeseries.shape[0] + * cdef int n_particles = timeseries.shape[1] # <<<<<<<<<<<<<< + * cdef int n_shells = timeseries_shellwise.shape[0] + * cdef int particle, shell, frame + */ + __pyx_v_n_particles = (__pyx_v_timeseries.shape[1]); + + /* "newanalysis/helpers/miscellaneous.pyx":270 + * cdef int n_frames = timeseries.shape[0] + * cdef int n_particles = timeseries.shape[1] + * cdef int n_shells = timeseries_shellwise.shape[0] # <<<<<<<<<<<<<< + * cdef int particle, shell, frame + * + */ + __pyx_v_n_shells = (__pyx_v_timeseries_shellwise.shape[0]); + + /* "newanalysis/helpers/miscellaneous.pyx":273 + * cdef int particle, shell, frame + * + * for frame in range(n_frames): # <<<<<<<<<<<<<< + * for particle in range(n_particles): + * shell = ds[frame, particle] - 1 + */ + __pyx_t_1 = __pyx_v_n_frames; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_frame = __pyx_t_3; + + /* "newanalysis/helpers/miscellaneous.pyx":274 + * + * for frame in range(n_frames): + * for particle in range(n_particles): # <<<<<<<<<<<<<< + * shell = ds[frame, particle] - 1 + * if shell < n_shells: + */ + __pyx_t_4 = __pyx_v_n_particles; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_particle = __pyx_t_6; + + /* "newanalysis/helpers/miscellaneous.pyx":275 + * for frame in range(n_frames): + * for particle in range(n_particles): + * shell = ds[frame, particle] - 1 # <<<<<<<<<<<<<< + * if shell < n_shells: + * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] + */ + __pyx_t_7 = __pyx_v_frame; + __pyx_t_8 = __pyx_v_particle; + __pyx_t_9 = -1; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_v_ds.shape[0]; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_7 >= __pyx_v_ds.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_ds.shape[1]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_8 >= __pyx_v_ds.shape[1])) __pyx_t_9 = 1; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 275, __pyx_L1_error) + } + __pyx_v_shell = ((*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_7 * __pyx_v_ds.strides[0]) ) + __pyx_t_8 * __pyx_v_ds.strides[1]) ))) - 1); + + /* "newanalysis/helpers/miscellaneous.pyx":276 + * for particle in range(n_particles): + * shell = ds[frame, particle] - 1 + * if shell < n_shells: # <<<<<<<<<<<<<< + * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] + * timeseries_shellwise[shell, frame, 1] += timeseries[frame, particle, 1] + */ + __pyx_t_10 = (__pyx_v_shell < __pyx_v_n_shells); + if (__pyx_t_10) { + + /* "newanalysis/helpers/miscellaneous.pyx":277 + * shell = ds[frame, particle] - 1 + * if shell < n_shells: + * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] # <<<<<<<<<<<<<< + * timeseries_shellwise[shell, frame, 1] += timeseries[frame, particle, 1] + * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); + __pyx_t_8 = __pyx_v_frame; + __pyx_t_7 = __pyx_v_particle; + __pyx_t_11 = 0; + __pyx_t_9 = -1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_timeseries.shape[0]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_v_timeseries.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_v_timeseries.shape[1]; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_7 >= __pyx_v_timeseries.shape[1])) __pyx_t_9 = 1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_v_timeseries.shape[2]; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 2; + } else if (unlikely(__pyx_t_11 >= __pyx_v_timeseries.shape[2])) __pyx_t_9 = 2; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 277, __pyx_L1_error) + } + __pyx_t_12 = __pyx_v_shell; + __pyx_t_13 = __pyx_v_frame; + __pyx_t_14 = 0; + __pyx_t_9 = -1; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_v_timeseries_shellwise.shape[0]; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_12 >= __pyx_v_timeseries_shellwise.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_v_timeseries_shellwise.shape[1]; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_13 >= __pyx_v_timeseries_shellwise.shape[1])) __pyx_t_9 = 1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_v_timeseries_shellwise.shape[2]; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 2; + } else if (unlikely(__pyx_t_14 >= __pyx_v_timeseries_shellwise.shape[2])) __pyx_t_9 = 2; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 277, __pyx_L1_error) + } + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries_shellwise.data + __pyx_t_12 * __pyx_v_timeseries_shellwise.strides[0]) ) + __pyx_t_13 * __pyx_v_timeseries_shellwise.strides[1]) ) + __pyx_t_14 * __pyx_v_timeseries_shellwise.strides[2]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_8 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_7 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_11 * __pyx_v_timeseries.strides[2]) ))); - /* "src/helpers/miscellaneous.pyx":1630 - * """ - * cdef int n_particles = coor.shape[0] - * cdef int n_particles_tot = ds.shape[0] # <<<<<<<<<<<<<< - * cdef int shells = results.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":278 + * if shell < n_shells: + * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] + * timeseries_shellwise[shell, frame, 1] += timeseries[frame, particle, 1] # <<<<<<<<<<<<<< + * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] * */ - __pyx_v_n_particles_tot = (__pyx_v_ds.shape[0]); + __pyx_t_11 = __pyx_v_frame; + __pyx_t_7 = __pyx_v_particle; + __pyx_t_8 = 1; + __pyx_t_9 = -1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_v_timeseries.shape[0]; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_11 >= __pyx_v_timeseries.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_v_timeseries.shape[1]; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_7 >= __pyx_v_timeseries.shape[1])) __pyx_t_9 = 1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_timeseries.shape[2]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 2; + } else if (unlikely(__pyx_t_8 >= __pyx_v_timeseries.shape[2])) __pyx_t_9 = 2; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 278, __pyx_L1_error) + } + __pyx_t_14 = __pyx_v_shell; + __pyx_t_13 = __pyx_v_frame; + __pyx_t_12 = 1; + __pyx_t_9 = -1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_v_timeseries_shellwise.shape[0]; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_14 >= __pyx_v_timeseries_shellwise.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_v_timeseries_shellwise.shape[1]; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_13 >= __pyx_v_timeseries_shellwise.shape[1])) __pyx_t_9 = 1; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_v_timeseries_shellwise.shape[2]; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 2; + } else if (unlikely(__pyx_t_12 >= __pyx_v_timeseries_shellwise.shape[2])) __pyx_t_9 = 2; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 278, __pyx_L1_error) + } + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries_shellwise.data + __pyx_t_14 * __pyx_v_timeseries_shellwise.strides[0]) ) + __pyx_t_13 * __pyx_v_timeseries_shellwise.strides[1]) ) + __pyx_t_12 * __pyx_v_timeseries_shellwise.strides[2]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_11 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_7 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_8 * __pyx_v_timeseries.strides[2]) ))); - /* "src/helpers/miscellaneous.pyx":1631 - * cdef int n_particles = coor.shape[0] - * cdef int n_particles_tot = ds.shape[0] - * cdef int shells = results.shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":279 + * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] + * timeseries_shellwise[shell, frame, 1] += timeseries[frame, particle, 1] + * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] # <<<<<<<<<<<<<< * - * calc_dip_ten_collective_NNshellwise_self(&coor[0,0], &f2c[0], n_particles, n_particles_tot, &ds[0,0], ds_idx, shells, &results[0,0]) + * def countVennShellOccupation(double[:,:] data, int n_particles, char[:] ds1, char[:] ds2): */ - __pyx_v_shells = (__pyx_v_results.shape[0]); + __pyx_t_8 = __pyx_v_frame; + __pyx_t_7 = __pyx_v_particle; + __pyx_t_11 = 2; + __pyx_t_9 = -1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_timeseries.shape[0]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_v_timeseries.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_v_timeseries.shape[1]; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_7 >= __pyx_v_timeseries.shape[1])) __pyx_t_9 = 1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_v_timeseries.shape[2]; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 2; + } else if (unlikely(__pyx_t_11 >= __pyx_v_timeseries.shape[2])) __pyx_t_9 = 2; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 279, __pyx_L1_error) + } + __pyx_t_12 = __pyx_v_shell; + __pyx_t_13 = __pyx_v_frame; + __pyx_t_14 = 2; + __pyx_t_9 = -1; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_v_timeseries_shellwise.shape[0]; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_12 >= __pyx_v_timeseries_shellwise.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_v_timeseries_shellwise.shape[1]; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_13 >= __pyx_v_timeseries_shellwise.shape[1])) __pyx_t_9 = 1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_v_timeseries_shellwise.shape[2]; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 2; + } else if (unlikely(__pyx_t_14 >= __pyx_v_timeseries_shellwise.shape[2])) __pyx_t_9 = 2; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 279, __pyx_L1_error) + } + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries_shellwise.data + __pyx_t_12 * __pyx_v_timeseries_shellwise.strides[0]) ) + __pyx_t_13 * __pyx_v_timeseries_shellwise.strides[1]) ) + __pyx_t_14 * __pyx_v_timeseries_shellwise.strides[2]) )) += (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_8 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_7 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_11 * __pyx_v_timeseries.strides[2]) ))); - /* "src/helpers/miscellaneous.pyx":1633 - * cdef int shells = results.shape[0] - * - * calc_dip_ten_collective_NNshellwise_self(&coor[0,0], &f2c[0], n_particles, n_particles_tot, &ds[0,0], ds_idx, shells, &results[0,0]) # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/miscellaneous.pyx":276 + * for particle in range(n_particles): + * shell = ds[frame, particle] - 1 + * if shell < n_shells: # <<<<<<<<<<<<<< + * timeseries_shellwise[shell, frame, 0] += timeseries[frame, particle, 0] + * timeseries_shellwise[shell, frame, 1] += timeseries[frame, particle, 1] */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; - __pyx_t_3 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_f2c.shape[0]; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_ds.shape[1]; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_results.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_results.shape[1]; - calc_dip_ten_collective_NNshellwise_self((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_f2c.data + __pyx_t_3 * __pyx_v_f2c.strides[0]) )))), __pyx_v_n_particles, __pyx_v_n_particles_tot, (&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_4 * __pyx_v_ds.strides[0]) ) + __pyx_t_5 * __pyx_v_ds.strides[1]) )))), __pyx_v_ds_idx, __pyx_v_shells, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_6 * __pyx_v_results.strides[0]) ) + __pyx_t_7 * __pyx_v_results.strides[1]) ))))); + } + } + } - /* "src/helpers/miscellaneous.pyx":1623 + /* "newanalysis/helpers/miscellaneous.pyx":260 * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwiseSelf(double[:,:] coor, int[:] f2c, char [:,:] ds, int ds_idx, double[:,:] results): # <<<<<<<<<<<<<< + * + * def sumUpByShell(double [:,:,:] timeseries, double [:,:,:] timeseries_shellwise, char[:,:] ds): # <<<<<<<<<<<<<< * """ - * coor ... (n_particles, 3) + * timeseries ... (n_frames, n_particles, 3) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_f2c, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_results, 1); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("newanalysis.miscellaneous.sumUpByShell", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1637 +/* "newanalysis/helpers/miscellaneous.pyx":281 + * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwiseCross(double[:,:] coor1, double[:,:] coor2, int[:] f2c, char [:,:] ds, int ds1_idx, int ds2_idx, double[:,:] results): # <<<<<<<<<<<<<< - * """ - * coor1 ... (n_particles1, 3) + * def countVennShellOccupation(double[:,:] data, int n_particles, char[:] ds1, char[:] ds2): # <<<<<<<<<<<<<< + * ''' + * data ... (n_shells1, n_shells2) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_103calcDipTenCollectiveNNShellwiseCross(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_102calcDipTenCollectiveNNShellwiseCross[] = "\n coor1 ... (n_particles1, 3)\n coor2 ... (n_particles2, 3)\n ds ... (n_particles_tot, n_particles_tot)\n results ... (shells, 6)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_103calcDipTenCollectiveNNShellwiseCross = {"calcDipTenCollectiveNNShellwiseCross", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_103calcDipTenCollectiveNNShellwiseCross, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_102calcDipTenCollectiveNNShellwiseCross}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_103calcDipTenCollectiveNNShellwiseCross(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_f2c = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_ds1_idx; - int __pyx_v_ds2_idx; - __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_15countVennShellOccupation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_14countVennShellOccupation, "\n data ... (n_shells1, n_shells2)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_15countVennShellOccupation = {"countVennShellOccupation", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_15countVennShellOccupation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_14countVennShellOccupation}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_15countVennShellOccupation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_n_particles; + __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwiseCross (wrapper)", 0); + __Pyx_RefNannySetupContext("countVennShellOccupation (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 281, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_f2c,&__pyx_n_s_ds,&__pyx_n_s_ds1_idx,&__pyx_n_s_ds2_idx,&__pyx_n_s_results,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_n_particles,&__pyx_n_s_ds1,&__pyx_n_s_ds2,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor1)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 281, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 1); __PYX_ERR(0, 1637, __pyx_L3_error) + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_particles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f2c)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 281, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 2); __PYX_ERR(0, 1637, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countVennShellOccupation", 1, 4, 4, 1); __PYX_ERR(0, 281, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 3); __PYX_ERR(0, 1637, __pyx_L3_error) + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds1_idx)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 281, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 4); __PYX_ERR(0, 1637, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countVennShellOccupation", 1, 4, 4, 2); __PYX_ERR(0, 281, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds2_idx)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 5); __PYX_ERR(0, 1637, __pyx_L3_error) + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_results)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 281, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 6); __PYX_ERR(0, 1637, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countVennShellOccupation", 1, 4, 4, 3); __PYX_ERR(0, 281, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDipTenCollectiveNNShellwiseCross") < 0)) __PYX_ERR(0, 1637, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "countVennShellOccupation") < 0)) __PYX_ERR(0, 281, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + } else if (unlikely(__pyx_nargs != 4)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); } - __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 1637, __pyx_L3_error) - __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 1637, __pyx_L3_error) - __pyx_v_f2c = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_f2c.memview)) __PYX_ERR(0, 1637, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1637, __pyx_L3_error) - __pyx_v_ds1_idx = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_ds1_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1637, __pyx_L3_error) - __pyx_v_ds2_idx = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_ds2_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1637, __pyx_L3_error) - __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1637, __pyx_L3_error) + __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 281, __pyx_L3_error) + __pyx_v_n_particles = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n_particles == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 281, __pyx_L3_error) + __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 281, __pyx_L3_error) + __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 281, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1637, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countVennShellOccupation", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 281, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveNNShellwiseCross", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.countVennShellOccupation", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_102calcDipTenCollectiveNNShellwiseCross(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_f2c, __pyx_v_ds, __pyx_v_ds1_idx, __pyx_v_ds2_idx, __pyx_v_results); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_14countVennShellOccupation(__pyx_self, __pyx_v_data, __pyx_v_n_particles, __pyx_v_ds1, __pyx_v_ds2); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_102calcDipTenCollectiveNNShellwiseCross(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_ds1_idx, int __pyx_v_ds2_idx, __Pyx_memviewslice __pyx_v_results) { - int __pyx_v_n_particles1; - int __pyx_v_n_particles2; - int __pyx_v_n_particles_tot; - int __pyx_v_shells; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_14countVennShellOccupation(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_data, int __pyx_v_n_particles, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2) { + int __pyx_v_n_shells1; + int __pyx_v_n_shells2; + int __pyx_v_wat; + int __pyx_v_shell1; + int __pyx_v_shell2; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; + int __pyx_t_5; + int __pyx_t_6; Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwiseCross", 0); - - /* "src/helpers/miscellaneous.pyx":1644 - * results ... (shells, 6) - * """ - * cdef int n_particles1 = coor1.shape[0] # <<<<<<<<<<<<<< - * cdef int n_particles2 = coor2.shape[0] - * cdef int n_particles_tot = ds.shape[0] - */ - __pyx_v_n_particles1 = (__pyx_v_coor1.shape[0]); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("countVennShellOccupation", 0); - /* "src/helpers/miscellaneous.pyx":1645 - * """ - * cdef int n_particles1 = coor1.shape[0] - * cdef int n_particles2 = coor2.shape[0] # <<<<<<<<<<<<<< - * cdef int n_particles_tot = ds.shape[0] - * cdef int shells = results.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":286 + * ''' + * + * cdef int n_shells1 = data.shape[0] # <<<<<<<<<<<<<< + * cdef int n_shells2 = data.shape[1] + * cdef int wat, shell1, shell2 */ - __pyx_v_n_particles2 = (__pyx_v_coor2.shape[0]); + __pyx_v_n_shells1 = (__pyx_v_data.shape[0]); - /* "src/helpers/miscellaneous.pyx":1646 - * cdef int n_particles1 = coor1.shape[0] - * cdef int n_particles2 = coor2.shape[0] - * cdef int n_particles_tot = ds.shape[0] # <<<<<<<<<<<<<< - * cdef int shells = results.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":287 + * + * cdef int n_shells1 = data.shape[0] + * cdef int n_shells2 = data.shape[1] # <<<<<<<<<<<<<< + * cdef int wat, shell1, shell2 * */ - __pyx_v_n_particles_tot = (__pyx_v_ds.shape[0]); + __pyx_v_n_shells2 = (__pyx_v_data.shape[1]); - /* "src/helpers/miscellaneous.pyx":1647 - * cdef int n_particles2 = coor2.shape[0] - * cdef int n_particles_tot = ds.shape[0] - * cdef int shells = results.shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":290 + * cdef int wat, shell1, shell2 * - * calc_dip_ten_collective_NNshellwise_cross(&coor1[0,0], &coor2[0,0], &f2c[0], n_particles1, n_particles2, n_particles_tot, &ds[0,0], ds1_idx, ds2_idx, shells, &results[0,0]) + * for wat in range(n_particles): # <<<<<<<<<<<<<< + * shell1 = ds1[wat] - 1 + * shell2 = ds2[wat] - 1 */ - __pyx_v_shells = (__pyx_v_results.shape[0]); + __pyx_t_1 = __pyx_v_n_particles; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_wat = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":1649 - * cdef int shells = results.shape[0] - * - * calc_dip_ten_collective_NNshellwise_cross(&coor1[0,0], &coor2[0,0], &f2c[0], n_particles1, n_particles2, n_particles_tot, &ds[0,0], ds1_idx, ds2_idx, shells, &results[0,0]) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":291 * + * for wat in range(n_particles): + * shell1 = ds1[wat] - 1 # <<<<<<<<<<<<<< + * shell2 = ds2[wat] - 1 * */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor1.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor1.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor2.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor2.shape[1]; - __pyx_t_5 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_f2c.shape[0]; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_ds.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_ds.shape[1]; - __pyx_t_8 = 0; - __pyx_t_9 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_results.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_results.shape[1]; - calc_dip_ten_collective_NNshellwise_cross((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor1.data + __pyx_t_1 * __pyx_v_coor1.strides[0]) ) + __pyx_t_2 * __pyx_v_coor1.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor2.data + __pyx_t_3 * __pyx_v_coor2.strides[0]) ) + __pyx_t_4 * __pyx_v_coor2.strides[1]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_f2c.data + __pyx_t_5 * __pyx_v_f2c.strides[0]) )))), __pyx_v_n_particles1, __pyx_v_n_particles2, __pyx_v_n_particles_tot, (&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_6 * __pyx_v_ds.strides[0]) ) + __pyx_t_7 * __pyx_v_ds.strides[1]) )))), __pyx_v_ds1_idx, __pyx_v_ds2_idx, __pyx_v_shells, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_8 * __pyx_v_results.strides[0]) ) + __pyx_t_9 * __pyx_v_results.strides[1]) ))))); + __pyx_t_4 = __pyx_v_wat; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_ds1.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_ds1.shape[0])) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + __PYX_ERR(0, 291, __pyx_L1_error) + } + __pyx_v_shell1 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_4 * __pyx_v_ds1.strides[0]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":1637 + /* "newanalysis/helpers/miscellaneous.pyx":292 + * for wat in range(n_particles): + * shell1 = ds1[wat] - 1 + * shell2 = ds2[wat] - 1 # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwiseCross(double[:,:] coor1, double[:,:] coor2, int[:] f2c, char [:,:] ds, int ds1_idx, int ds2_idx, double[:,:] results): # <<<<<<<<<<<<<< - * """ - * coor1 ... (n_particles1, 3) + * if shell1 >= n_shells1 : shell1 = n_shells1 - 1 */ + __pyx_t_4 = __pyx_v_wat; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_ds2.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_ds2.shape[0])) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + __PYX_ERR(0, 292, __pyx_L1_error) + } + __pyx_v_shell2 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_4 * __pyx_v_ds2.strides[0]) ))) - 1); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_f2c, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_results, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/miscellaneous.pyx":1653 + /* "newanalysis/helpers/miscellaneous.pyx":294 + * shell2 = ds2[wat] - 1 + * + * if shell1 >= n_shells1 : shell1 = n_shells1 - 1 # <<<<<<<<<<<<<< + * if shell2 >= n_shells2 : shell2 = n_shells2 - 1 * - * @cython.boundscheck(False) - * def calcDipTenCollective1NShellwiseSelf(double[:,:] coor, char [:] ds, double[:,:,:] results): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_105calcDipTenCollective1NShellwiseSelf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_104calcDipTenCollective1NShellwiseSelf[] = "\n coor ... (n_particles, 3)\n ds ... (n_particles)\n results ... (shells, shells, 6)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_105calcDipTenCollective1NShellwiseSelf = {"calcDipTenCollective1NShellwiseSelf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_105calcDipTenCollective1NShellwiseSelf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_104calcDipTenCollective1NShellwiseSelf}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_105calcDipTenCollective1NShellwiseSelf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDipTenCollective1NShellwiseSelf (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_ds,&__pyx_n_s_results,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseSelf", 1, 3, 3, 1); __PYX_ERR(0, 1653, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_results)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseSelf", 1, 3, 3, 2); __PYX_ERR(0, 1653, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDipTenCollective1NShellwiseSelf") < 0)) __PYX_ERR(0, 1653, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_t_6 = (__pyx_v_shell1 >= __pyx_v_n_shells1); + if (__pyx_t_6) { + __pyx_v_shell1 = (__pyx_v_n_shells1 - 1); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1653, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1653, __pyx_L3_error) - __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1653, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseSelf", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1653, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollective1NShellwiseSelf", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_104calcDipTenCollective1NShellwiseSelf(__pyx_self, __pyx_v_coor, __pyx_v_ds, __pyx_v_results); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_104calcDipTenCollective1NShellwiseSelf(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_results) { - int __pyx_v_n_particles; - int __pyx_v_shells; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - __Pyx_RefNannySetupContext("calcDipTenCollective1NShellwiseSelf", 0); - /* "src/helpers/miscellaneous.pyx":1659 - * results ... (shells, shells, 6) - * """ - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< - * cdef int shells = results.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":295 * - */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - - /* "src/helpers/miscellaneous.pyx":1660 - * """ - * cdef int n_particles = coor.shape[0] - * cdef int shells = results.shape[0] # <<<<<<<<<<<<<< + * if shell1 >= n_shells1 : shell1 = n_shells1 - 1 + * if shell2 >= n_shells2 : shell2 = n_shells2 - 1 # <<<<<<<<<<<<<< * - * calc_dip_ten_collective_1Nshellwise_self(&coor[0,0], n_particles, &ds[0], shells, &results[0,0,0]) + * data[shell1, shell2] += 1 */ - __pyx_v_shells = (__pyx_v_results.shape[0]); + __pyx_t_6 = (__pyx_v_shell2 >= __pyx_v_n_shells2); + if (__pyx_t_6) { + __pyx_v_shell2 = (__pyx_v_n_shells2 - 1); + } - /* "src/helpers/miscellaneous.pyx":1662 - * cdef int shells = results.shape[0] - * - * calc_dip_ten_collective_1Nshellwise_self(&coor[0,0], n_particles, &ds[0], shells, &results[0,0,0]) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":297 + * if shell2 >= n_shells2 : shell2 = n_shells2 - 1 * + * data[shell1, shell2] += 1 # <<<<<<<<<<<<<< * + * def countMultiShell(double[:,:] data, char[:] ds1, char[:] ds2, char[:] ds3, char[:] ds4, char[:] ds5): */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; - __pyx_t_3 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_ds.shape[0]; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_results.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_results.shape[1]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_results.shape[2]; - calc_dip_ten_collective_1Nshellwise_self((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_3 * __pyx_v_ds.strides[0]) )))), __pyx_v_shells, (&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_4 * __pyx_v_results.strides[0]) ) + __pyx_t_5 * __pyx_v_results.strides[1]) ) + __pyx_t_6 * __pyx_v_results.strides[2]) ))))); + __pyx_t_4 = __pyx_v_shell1; + __pyx_t_7 = __pyx_v_shell2; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_data.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_data.shape[0])) __pyx_t_5 = 0; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_v_data.shape[1]; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 1; + } else if (unlikely(__pyx_t_7 >= __pyx_v_data.shape[1])) __pyx_t_5 = 1; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + __PYX_ERR(0, 297, __pyx_L1_error) + } + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_4 * __pyx_v_data.strides[0]) ) + __pyx_t_7 * __pyx_v_data.strides[1]) )) += 1.0; + } - /* "src/helpers/miscellaneous.pyx":1653 + /* "newanalysis/helpers/miscellaneous.pyx":281 + * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] * - * @cython.boundscheck(False) - * def calcDipTenCollective1NShellwiseSelf(double[:,:] coor, char [:] ds, double[:,:,:] results): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) + * def countVennShellOccupation(double[:,:] data, int n_particles, char[:] ds1, char[:] ds2): # <<<<<<<<<<<<<< + * ''' + * data ... (n_shells1, n_shells2) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_results, 1); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("newanalysis.miscellaneous.countVennShellOccupation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1666 +/* "newanalysis/helpers/miscellaneous.pyx":299 + * data[shell1, shell2] += 1 * - * @cython.boundscheck(False) - * def calcDipTenCollective1NShellwiseCross(double[:,:] coor1, double[:,:] coor2, char [:] ds, double[:,:] results): # <<<<<<<<<<<<<< - * """ - * coor1 ... (n_particles1, 3) + * def countMultiShell(double[:,:] data, char[:] ds1, char[:] ds2, char[:] ds3, char[:] ds4, char[:] ds5): # <<<<<<<<<<<<<< + * ''' + * data ... (nshells, max_cardinality {==5}) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_107calcDipTenCollective1NShellwiseCross(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_106calcDipTenCollective1NShellwiseCross[] = "\n coor1 ... (n_particles1, 3)\n coor2 ... (n_particles2, 3)\n ds ... (n_particles1) #IMPORTANT!\n results ... (shells, 6)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_107calcDipTenCollective1NShellwiseCross = {"calcDipTenCollective1NShellwiseCross", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_107calcDipTenCollective1NShellwiseCross, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_106calcDipTenCollective1NShellwiseCross}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_107calcDipTenCollective1NShellwiseCross(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_17countMultiShell(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_16countMultiShell, "\n data ... (nshells, max_cardinality {==5})\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_17countMultiShell = {"countMultiShell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_17countMultiShell, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_16countMultiShell}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_17countMultiShell(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds3 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds4 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDipTenCollective1NShellwiseCross (wrapper)", 0); + __Pyx_RefNannySetupContext("countMultiShell (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 299, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_ds,&__pyx_n_s_results,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_ds3,&__pyx_n_s_ds4,&__pyx_n_s_ds5,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor1)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor2)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseCross", 1, 4, 4, 1); __PYX_ERR(0, 1666, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, 1); __PYX_ERR(0, 299, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseCross", 1, 4, 4, 2); __PYX_ERR(0, 1666, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, 2); __PYX_ERR(0, 299, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_results)) != 0)) kw_args--; + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds3)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, 3); __PYX_ERR(0, 299, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds4)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, 4); __PYX_ERR(0, 299, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds5)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseCross", 1, 4, 4, 3); __PYX_ERR(0, 1666, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, 5); __PYX_ERR(0, 299, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDipTenCollective1NShellwiseCross") < 0)) __PYX_ERR(0, 1666, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "countMultiShell") < 0)) __PYX_ERR(0, 299, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (unlikely(__pyx_nargs != 6)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); } - __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 1666, __pyx_L3_error) - __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 1666, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1666, __pyx_L3_error) - __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1666, __pyx_L3_error) + __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 299, __pyx_L3_error) + __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 299, __pyx_L3_error) + __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 299, __pyx_L3_error) + __pyx_v_ds3 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds3.memview)) __PYX_ERR(0, 299, __pyx_L3_error) + __pyx_v_ds4 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds4.memview)) __PYX_ERR(0, 299, __pyx_L3_error) + __pyx_v_ds5 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds5.memview)) __PYX_ERR(0, 299, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseCross", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1666, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("countMultiShell", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 299, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollective1NShellwiseCross", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds3, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds4, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds5, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.countMultiShell", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_106calcDipTenCollective1NShellwiseCross(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_ds, __pyx_v_results); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_16countMultiShell(__pyx_self, __pyx_v_data, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_ds3, __pyx_v_ds4, __pyx_v_ds5); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds3, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds4, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds5, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_106calcDipTenCollective1NShellwiseCross(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_results) { - int __pyx_v_n_particles1; - int __pyx_v_n_particles2; - int __pyx_v_shells; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_16countMultiShell(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, __Pyx_memviewslice __pyx_v_ds3, __Pyx_memviewslice __pyx_v_ds4, __Pyx_memviewslice __pyx_v_ds5) { + int __pyx_v_n_shells; + int __pyx_v_n_particles; + int __pyx_v_shell_01; + int __pyx_v_shell_02; + int __pyx_v_shell_03; + int __pyx_v_shell_04; + int __pyx_v_shell_05; + int __pyx_v_closest_shell; + int __pyx_v_cardinality; + int __pyx_v_wat; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - __Pyx_RefNannySetupContext("calcDipTenCollective1NShellwiseCross", 0); + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + Py_ssize_t __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("countMultiShell", 0); - /* "src/helpers/miscellaneous.pyx":1673 - * results ... (shells, 6) - * """ - * cdef int n_particles1 = coor1.shape[0] # <<<<<<<<<<<<<< - * cdef int n_particles2 = coor2.shape[0] - * cdef int shells = results.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":304 + * ''' + * + * cdef int n_shells = data.shape[0] # <<<<<<<<<<<<<< + * cdef int n_particles = ds1.shape[0] + * cdef int shell_01, shell_02, shell_03, shell_04, shell_05, closest_shell, cardinality */ - __pyx_v_n_particles1 = (__pyx_v_coor1.shape[0]); + __pyx_v_n_shells = (__pyx_v_data.shape[0]); - /* "src/helpers/miscellaneous.pyx":1674 - * """ - * cdef int n_particles1 = coor1.shape[0] - * cdef int n_particles2 = coor2.shape[0] # <<<<<<<<<<<<<< - * cdef int shells = results.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":305 * + * cdef int n_shells = data.shape[0] + * cdef int n_particles = ds1.shape[0] # <<<<<<<<<<<<<< + * cdef int shell_01, shell_02, shell_03, shell_04, shell_05, closest_shell, cardinality + * cdef int wat */ - __pyx_v_n_particles2 = (__pyx_v_coor2.shape[0]); + __pyx_v_n_particles = (__pyx_v_ds1.shape[0]); - /* "src/helpers/miscellaneous.pyx":1675 - * cdef int n_particles1 = coor1.shape[0] - * cdef int n_particles2 = coor2.shape[0] - * cdef int shells = results.shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":309 + * cdef int wat * - * calc_dip_ten_collective_1Nshellwise_cross(&coor1[0,0], n_particles1, &coor2[0,0], n_particles2, &ds[0], shells, &results[0,0]) + * for wat in range(n_particles): # <<<<<<<<<<<<<< + * shell_01 = ds1[wat] - 1 + * shell_02 = ds2[wat] - 1 */ - __pyx_v_shells = (__pyx_v_results.shape[0]); + __pyx_t_1 = __pyx_v_n_particles; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_wat = __pyx_t_3; - /* "src/helpers/miscellaneous.pyx":1677 - * cdef int shells = results.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":310 * - * calc_dip_ten_collective_1Nshellwise_cross(&coor1[0,0], n_particles1, &coor2[0,0], n_particles2, &ds[0], shells, &results[0,0]) # <<<<<<<<<<<<<< + * for wat in range(n_particles): + * shell_01 = ds1[wat] - 1 # <<<<<<<<<<<<<< + * shell_02 = ds2[wat] - 1 + * shell_03 = ds3[wat] - 1 + */ + __pyx_t_4 = __pyx_v_wat; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_ds1.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_ds1.shape[0])) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + __PYX_ERR(0, 310, __pyx_L1_error) + } + __pyx_v_shell_01 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_4 * __pyx_v_ds1.strides[0]) ))) - 1); + + /* "newanalysis/helpers/miscellaneous.pyx":311 + * for wat in range(n_particles): + * shell_01 = ds1[wat] - 1 + * shell_02 = ds2[wat] - 1 # <<<<<<<<<<<<<< + * shell_03 = ds3[wat] - 1 + * shell_04 = ds4[wat] - 1 + */ + __pyx_t_4 = __pyx_v_wat; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_ds2.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_ds2.shape[0])) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + __PYX_ERR(0, 311, __pyx_L1_error) + } + __pyx_v_shell_02 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_4 * __pyx_v_ds2.strides[0]) ))) - 1); + + /* "newanalysis/helpers/miscellaneous.pyx":312 + * shell_01 = ds1[wat] - 1 + * shell_02 = ds2[wat] - 1 + * shell_03 = ds3[wat] - 1 # <<<<<<<<<<<<<< + * shell_04 = ds4[wat] - 1 + * shell_05 = ds5[wat] - 1 + */ + __pyx_t_4 = __pyx_v_wat; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_ds3.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_ds3.shape[0])) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + __PYX_ERR(0, 312, __pyx_L1_error) + } + __pyx_v_shell_03 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds3.data + __pyx_t_4 * __pyx_v_ds3.strides[0]) ))) - 1); + + /* "newanalysis/helpers/miscellaneous.pyx":313 + * shell_02 = ds2[wat] - 1 + * shell_03 = ds3[wat] - 1 + * shell_04 = ds4[wat] - 1 # <<<<<<<<<<<<<< + * shell_05 = ds5[wat] - 1 * + */ + __pyx_t_4 = __pyx_v_wat; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_ds4.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_ds4.shape[0])) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + __PYX_ERR(0, 313, __pyx_L1_error) + } + __pyx_v_shell_04 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds4.data + __pyx_t_4 * __pyx_v_ds4.strides[0]) ))) - 1); + + /* "newanalysis/helpers/miscellaneous.pyx":314 + * shell_03 = ds3[wat] - 1 + * shell_04 = ds4[wat] - 1 + * shell_05 = ds5[wat] - 1 # <<<<<<<<<<<<<< * + * if shell_01 >= n_shells: shell_01 = n_shells-1 */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor1.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor1.shape[1]; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor2.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor2.shape[1]; - __pyx_t_5 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_ds.shape[0]; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_results.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_results.shape[1]; - calc_dip_ten_collective_1Nshellwise_cross((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor1.data + __pyx_t_1 * __pyx_v_coor1.strides[0]) ) + __pyx_t_2 * __pyx_v_coor1.strides[1]) )))), __pyx_v_n_particles1, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor2.data + __pyx_t_3 * __pyx_v_coor2.strides[0]) ) + __pyx_t_4 * __pyx_v_coor2.strides[1]) )))), __pyx_v_n_particles2, (&(*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_5 * __pyx_v_ds.strides[0]) )))), __pyx_v_shells, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_6 * __pyx_v_results.strides[0]) ) + __pyx_t_7 * __pyx_v_results.strides[1]) ))))); + __pyx_t_4 = __pyx_v_wat; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_ds5.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_ds5.shape[0])) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + __PYX_ERR(0, 314, __pyx_L1_error) + } + __pyx_v_shell_05 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds5.data + __pyx_t_4 * __pyx_v_ds5.strides[0]) ))) - 1); - /* "src/helpers/miscellaneous.pyx":1666 + /* "newanalysis/helpers/miscellaneous.pyx":316 + * shell_05 = ds5[wat] - 1 * - * @cython.boundscheck(False) - * def calcDipTenCollective1NShellwiseCross(double[:,:] coor1, double[:,:] coor2, char [:] ds, double[:,:] results): # <<<<<<<<<<<<<< - * """ - * coor1 ... (n_particles1, 3) + * if shell_01 >= n_shells: shell_01 = n_shells-1 # <<<<<<<<<<<<<< + * if shell_02 >= n_shells: shell_02 = n_shells-1 + * if shell_03 >= n_shells: shell_03 = n_shells-1 */ + __pyx_t_6 = (__pyx_v_shell_01 >= __pyx_v_n_shells); + if (__pyx_t_6) { + __pyx_v_shell_01 = (__pyx_v_n_shells - 1); + } - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_results, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":317 + * + * if shell_01 >= n_shells: shell_01 = n_shells-1 + * if shell_02 >= n_shells: shell_02 = n_shells-1 # <<<<<<<<<<<<<< + * if shell_03 >= n_shells: shell_03 = n_shells-1 + * if shell_04 >= n_shells: shell_04 = n_shells-1 + */ + __pyx_t_6 = (__pyx_v_shell_02 >= __pyx_v_n_shells); + if (__pyx_t_6) { + __pyx_v_shell_02 = (__pyx_v_n_shells - 1); + } -/* "src/helpers/miscellaneous.pyx":1682 - * # Deprecated! - * @cython.boundscheck(False) - * def calcDipTenCollectiveShellwise(double[:,:] coor, char [:] ds, int maxshell, double[:,:] results): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) + /* "newanalysis/helpers/miscellaneous.pyx":318 + * if shell_01 >= n_shells: shell_01 = n_shells-1 + * if shell_02 >= n_shells: shell_02 = n_shells-1 + * if shell_03 >= n_shells: shell_03 = n_shells-1 # <<<<<<<<<<<<<< + * if shell_04 >= n_shells: shell_04 = n_shells-1 + * if shell_05 >= n_shells: shell_05 = n_shells-1 */ + __pyx_t_6 = (__pyx_v_shell_03 >= __pyx_v_n_shells); + if (__pyx_t_6) { + __pyx_v_shell_03 = (__pyx_v_n_shells - 1); + } -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_109calcDipTenCollectiveShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_108calcDipTenCollectiveShellwise[] = "\n coor ... (n_particles, 3)\n ds ... (n_particles)\n results ... (shells, 6)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_109calcDipTenCollectiveShellwise = {"calcDipTenCollectiveShellwise", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_109calcDipTenCollectiveShellwise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_108calcDipTenCollectiveShellwise}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_109calcDipTenCollectiveShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell; - __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDipTenCollectiveShellwise (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_ds,&__pyx_n_s_maxshell,&__pyx_n_s_results,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveShellwise", 1, 4, 4, 1); __PYX_ERR(0, 1682, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveShellwise", 1, 4, 4, 2); __PYX_ERR(0, 1682, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_results)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveShellwise", 1, 4, 4, 3); __PYX_ERR(0, 1682, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDipTenCollectiveShellwise") < 0)) __PYX_ERR(0, 1682, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; + /* "newanalysis/helpers/miscellaneous.pyx":319 + * if shell_02 >= n_shells: shell_02 = n_shells-1 + * if shell_03 >= n_shells: shell_03 = n_shells-1 + * if shell_04 >= n_shells: shell_04 = n_shells-1 # <<<<<<<<<<<<<< + * if shell_05 >= n_shells: shell_05 = n_shells-1 + * + */ + __pyx_t_6 = (__pyx_v_shell_04 >= __pyx_v_n_shells); + if (__pyx_t_6) { + __pyx_v_shell_04 = (__pyx_v_n_shells - 1); + } + + /* "newanalysis/helpers/miscellaneous.pyx":320 + * if shell_03 >= n_shells: shell_03 = n_shells-1 + * if shell_04 >= n_shells: shell_04 = n_shells-1 + * if shell_05 >= n_shells: shell_05 = n_shells-1 # <<<<<<<<<<<<<< + * + * closest_shell = min(shell_01, shell_02, shell_03, shell_04, shell_05) + */ + __pyx_t_6 = (__pyx_v_shell_05 >= __pyx_v_n_shells); + if (__pyx_t_6) { + __pyx_v_shell_05 = (__pyx_v_n_shells - 1); + } + + /* "newanalysis/helpers/miscellaneous.pyx":322 + * if shell_05 >= n_shells: shell_05 = n_shells-1 + * + * closest_shell = min(shell_01, shell_02, shell_03, shell_04, shell_05) # <<<<<<<<<<<<<< + * + * cardinality = 0 + */ + __pyx_t_5 = __pyx_v_shell_02; + __pyx_t_7 = __pyx_v_shell_03; + __pyx_t_8 = __pyx_v_shell_04; + __pyx_t_9 = __pyx_v_shell_05; + __pyx_t_10 = __pyx_v_shell_01; + __pyx_t_6 = (__pyx_t_5 < __pyx_t_10); + if (__pyx_t_6) { + __pyx_t_11 = __pyx_t_5; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + __pyx_t_11 = __pyx_t_10; } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1682, __pyx_L3_error) - __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1682, __pyx_L3_error) - __pyx_v_maxshell = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1682, __pyx_L3_error) - __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1682, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveShellwise", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1682, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_108calcDipTenCollectiveShellwise(__pyx_self, __pyx_v_coor, __pyx_v_ds, __pyx_v_maxshell, __pyx_v_results); + __pyx_t_10 = __pyx_t_11; + __pyx_t_6 = (__pyx_t_7 < __pyx_t_10); + if (__pyx_t_6) { + __pyx_t_11 = __pyx_t_7; + } else { + __pyx_t_11 = __pyx_t_10; + } + __pyx_t_10 = __pyx_t_11; + __pyx_t_6 = (__pyx_t_8 < __pyx_t_10); + if (__pyx_t_6) { + __pyx_t_11 = __pyx_t_8; + } else { + __pyx_t_11 = __pyx_t_10; + } + __pyx_t_10 = __pyx_t_11; + __pyx_t_6 = (__pyx_t_9 < __pyx_t_10); + if (__pyx_t_6) { + __pyx_t_11 = __pyx_t_9; + } else { + __pyx_t_11 = __pyx_t_10; + } + __pyx_v_closest_shell = __pyx_t_11; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":324 + * closest_shell = min(shell_01, shell_02, shell_03, shell_04, shell_05) + * + * cardinality = 0 # <<<<<<<<<<<<<< + * if(shell_01 == closest_shell): cardinality += 1 + * if(shell_02 == closest_shell): cardinality += 1 + */ + __pyx_v_cardinality = 0; -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_108calcDipTenCollectiveShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, __Pyx_memviewslice __pyx_v_results) { - int __pyx_v_n_particles; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("calcDipTenCollectiveShellwise", 0); + /* "newanalysis/helpers/miscellaneous.pyx":325 + * + * cardinality = 0 + * if(shell_01 == closest_shell): cardinality += 1 # <<<<<<<<<<<<<< + * if(shell_02 == closest_shell): cardinality += 1 + * if(shell_03 == closest_shell): cardinality += 1 + */ + __pyx_t_6 = (__pyx_v_shell_01 == __pyx_v_closest_shell); + if (__pyx_t_6) { + __pyx_v_cardinality = (__pyx_v_cardinality + 1); + } - /* "src/helpers/miscellaneous.pyx":1688 - * results ... (shells, 6) - * """ - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":326 + * cardinality = 0 + * if(shell_01 == closest_shell): cardinality += 1 + * if(shell_02 == closest_shell): cardinality += 1 # <<<<<<<<<<<<<< + * if(shell_03 == closest_shell): cardinality += 1 + * if(shell_04 == closest_shell): cardinality += 1 + */ + __pyx_t_6 = (__pyx_v_shell_02 == __pyx_v_closest_shell); + if (__pyx_t_6) { + __pyx_v_cardinality = (__pyx_v_cardinality + 1); + } + + /* "newanalysis/helpers/miscellaneous.pyx":327 + * if(shell_01 == closest_shell): cardinality += 1 + * if(shell_02 == closest_shell): cardinality += 1 + * if(shell_03 == closest_shell): cardinality += 1 # <<<<<<<<<<<<<< + * if(shell_04 == closest_shell): cardinality += 1 + * if(shell_05 == closest_shell): cardinality += 1 + */ + __pyx_t_6 = (__pyx_v_shell_03 == __pyx_v_closest_shell); + if (__pyx_t_6) { + __pyx_v_cardinality = (__pyx_v_cardinality + 1); + } + + /* "newanalysis/helpers/miscellaneous.pyx":328 + * if(shell_02 == closest_shell): cardinality += 1 + * if(shell_03 == closest_shell): cardinality += 1 + * if(shell_04 == closest_shell): cardinality += 1 # <<<<<<<<<<<<<< + * if(shell_05 == closest_shell): cardinality += 1 * - * calc_dip_ten_collective_shellwise(&coor[0,0], n_particles, &ds[0], maxshell, &results[0,0]) */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); + __pyx_t_6 = (__pyx_v_shell_04 == __pyx_v_closest_shell); + if (__pyx_t_6) { + __pyx_v_cardinality = (__pyx_v_cardinality + 1); + } - /* "src/helpers/miscellaneous.pyx":1690 - * cdef int n_particles = coor.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":329 + * if(shell_03 == closest_shell): cardinality += 1 + * if(shell_04 == closest_shell): cardinality += 1 + * if(shell_05 == closest_shell): cardinality += 1 # <<<<<<<<<<<<<< * - * calc_dip_ten_collective_shellwise(&coor[0,0], n_particles, &ds[0], maxshell, &results[0,0]) # <<<<<<<<<<<<<< + * data[closest_shell, cardinality-1] += 1 + */ + __pyx_t_6 = (__pyx_v_shell_05 == __pyx_v_closest_shell); + if (__pyx_t_6) { + __pyx_v_cardinality = (__pyx_v_cardinality + 1); + } + + /* "newanalysis/helpers/miscellaneous.pyx":331 + * if(shell_05 == closest_shell): cardinality += 1 * - * # Deprecated! + * data[closest_shell, cardinality-1] += 1 # <<<<<<<<<<<<<< + * + * ''' */ - __pyx_t_1 = 0; - __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; - __pyx_t_3 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_ds.shape[0]; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_results.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_results.shape[1]; - calc_dip_ten_collective_shellwise((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_3 * __pyx_v_ds.strides[0]) )))), __pyx_v_maxshell, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_4 * __pyx_v_results.strides[0]) ) + __pyx_t_5 * __pyx_v_results.strides[1]) ))))); + __pyx_t_4 = __pyx_v_closest_shell; + __pyx_t_12 = (__pyx_v_cardinality - 1); + __pyx_t_11 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_data.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_11 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_data.shape[0])) __pyx_t_11 = 0; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_v_data.shape[1]; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 1; + } else if (unlikely(__pyx_t_12 >= __pyx_v_data.shape[1])) __pyx_t_11 = 1; + if (unlikely(__pyx_t_11 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_11); + __PYX_ERR(0, 331, __pyx_L1_error) + } + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_4 * __pyx_v_data.strides[0]) ) + __pyx_t_12 * __pyx_v_data.strides[1]) )) += 1.0; + } - /* "src/helpers/miscellaneous.pyx":1682 - * # Deprecated! - * @cython.boundscheck(False) - * def calcDipTenCollectiveShellwise(double[:,:] coor, char [:] ds, int maxshell, double[:,:] results): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) + /* "newanalysis/helpers/miscellaneous.pyx":299 + * data[shell1, shell2] += 1 + * + * def countMultiShell(double[:,:] data, char[:] ds1, char[:] ds2, char[:] ds3, char[:] ds4, char[:] ds5): # <<<<<<<<<<<<<< + * ''' + * data ... (nshells, max_cardinality {==5}) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_results, 1); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("newanalysis.miscellaneous.countMultiShell", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1694 - * # Deprecated! - * @cython.boundscheck(False) - * def calcDipTenCollectiveVennShellwise(double[:,:] coor, char [:] ds1, char [:] ds2, int maxshell1, int maxshell2, double[:,:,:] results): # <<<<<<<<<<<<<< +/* "newanalysis/helpers/miscellaneous.pyx":352 + * ''' + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicIndDip(double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): * """ - * coor ... (n_particles, 3) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_111calcDipTenCollectiveVennShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_110calcDipTenCollectiveVennShellwise[] = "\n coor ... (n_particles, 3)\n ds1 ... (n_particles)\n ds2 ... (n_particles)\n results ... (shells1, shells2, n_particles)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_111calcDipTenCollectiveVennShellwise = {"calcDipTenCollectiveVennShellwise", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_111calcDipTenCollectiveVennShellwise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_110calcDipTenCollectiveVennShellwise}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_111calcDipTenCollectiveVennShellwise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_maxshell1; - int __pyx_v_maxshell2; - __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_19atomicIndDip(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_18atomicIndDip, "\n coors ... (N_all, 3)\n charges ... (N_all)\n alpha ... (N_ind)\n coors_ind ... (N_ind, 3)\n atomic_dipoles ... (N_ind, 3)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_19atomicIndDip = {"atomicIndDip", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_19atomicIndDip, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_18atomicIndDip}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_19atomicIndDip(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coors_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_prev_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxlength; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDipTenCollectiveVennShellwise (wrapper)", 0); + __Pyx_RefNannySetupContext("atomicIndDip (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 352, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_maxshell1,&__pyx_n_s_maxshell2,&__pyx_n_s_results,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coors,&__pyx_n_s_charges,&__pyx_n_s_alpha,&__pyx_n_s_coors_ind,&__pyx_n_s_prev_atomic_dipoles,&__pyx_n_s_atomic_dipoles,&__pyx_n_s_boxlength,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coors)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds1)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, 1); __PYX_ERR(0, 1694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 1); __PYX_ERR(0, 352, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds2)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_alpha)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, 2); __PYX_ERR(0, 1694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 2); __PYX_ERR(0, 352, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell1)) != 0)) kw_args--; + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coors_ind)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, 3); __PYX_ERR(0, 1694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 3); __PYX_ERR(0, 352, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell2)) != 0)) kw_args--; + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_prev_atomic_dipoles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, 4); __PYX_ERR(0, 1694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 4); __PYX_ERR(0, 352, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_results)) != 0)) kw_args--; + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_atomic_dipoles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 5); __PYX_ERR(0, 352, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, 5); __PYX_ERR(0, 1694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, 6); __PYX_ERR(0, 352, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDipTenCollectiveVennShellwise") < 0)) __PYX_ERR(0, 1694, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "atomicIndDip") < 0)) __PYX_ERR(0, 352, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + } else if (unlikely(__pyx_nargs != 7)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1694, __pyx_L3_error) - __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 1694, __pyx_L3_error) - __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 1694, __pyx_L3_error) - __pyx_v_maxshell1 = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_maxshell1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1694, __pyx_L3_error) - __pyx_v_maxshell2 = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1694, __pyx_L3_error) - __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1694, __pyx_L3_error) + __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 353, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 353, __pyx_L3_error) + __pyx_v_alpha = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_alpha.memview)) __PYX_ERR(0, 353, __pyx_L3_error) + __pyx_v_coors_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors_ind.memview)) __PYX_ERR(0, 353, __pyx_L3_error) + __pyx_v_prev_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_prev_atomic_dipoles.memview)) __PYX_ERR(0, 353, __pyx_L3_error) + __pyx_v_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_atomic_dipoles.memview)) __PYX_ERR(0, 353, __pyx_L3_error) + __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 353, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("atomicIndDip", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 352, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveVennShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_alpha, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_prev_atomic_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_atomic_dipoles, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.atomicIndDip", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_110calcDipTenCollectiveVennShellwise(__pyx_self, __pyx_v_coor, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_maxshell1, __pyx_v_maxshell2, __pyx_v_results); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_18atomicIndDip(__pyx_self, __pyx_v_coors, __pyx_v_charges, __pyx_v_alpha, __pyx_v_coors_ind, __pyx_v_prev_atomic_dipoles, __pyx_v_atomic_dipoles, __pyx_v_boxlength); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_alpha, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_prev_atomic_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_atomic_dipoles, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_110calcDipTenCollectiveVennShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, int __pyx_v_maxshell1, int __pyx_v_maxshell2, __Pyx_memviewslice __pyx_v_results) { - int __pyx_v_n_particles; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_18atomicIndDip(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coors, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_alpha, __Pyx_memviewslice __pyx_v_coors_ind, __Pyx_memviewslice __pyx_v_prev_atomic_dipoles, __Pyx_memviewslice __pyx_v_atomic_dipoles, double __pyx_v_boxlength) { + int __pyx_v_n_particles_all; + int __pyx_v_n_particles_ind; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -29851,765 +26531,743 @@ static PyObject *__pyx_pf_11newanalysis_13miscellaneous_110calcDipTenCollectiveV Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; Py_ssize_t __pyx_t_7; - __Pyx_RefNannySetupContext("calcDipTenCollectiveVennShellwise", 0); + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + __Pyx_RefNannySetupContext("atomicIndDip", 0); - /* "src/helpers/miscellaneous.pyx":1701 - * results ... (shells1, shells2, n_particles) + /* "newanalysis/helpers/miscellaneous.pyx":362 * """ - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< * - * calc_dip_ten_collective_vennshellwise(&coor[0,0], n_particles, &ds1[0], &ds2[0], maxshell1, maxshell2, &results[0,0,0]) + * cdef int n_particles_all = coors.shape[0] # <<<<<<<<<<<<<< + * cdef int n_particles_ind = atomic_dipoles.shape[0] + * # cdef int atom, dim, atom1, atom2, iteration, i, j */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); + __pyx_v_n_particles_all = (__pyx_v_coors.shape[0]); - /* "src/helpers/miscellaneous.pyx":1703 - * cdef int n_particles = coor.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":363 * - * calc_dip_ten_collective_vennshellwise(&coor[0,0], n_particles, &ds1[0], &ds2[0], maxshell1, maxshell2, &results[0,0,0]) # <<<<<<<<<<<<<< + * cdef int n_particles_all = coors.shape[0] + * cdef int n_particles_ind = atomic_dipoles.shape[0] # <<<<<<<<<<<<<< + * # cdef int atom, dim, atom1, atom2, iteration, i, j + * # cdef double [:,:] e_0 = np.zeros((n_particles_ind, 3), dtype='float64') + */ + __pyx_v_n_particles_ind = (__pyx_v_atomic_dipoles.shape[0]); + + /* "newanalysis/helpers/miscellaneous.pyx":370 + * # cdef double [:,:] dip_ten = np.zeros((3,3), dtype='float64') * - * @cython.boundscheck(False) + * atomic_ind_dip(&coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) # <<<<<<<<<<<<<< + * + * """ */ __pyx_t_1 = 0; __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coors.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coors.shape[1]; __pyx_t_3 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_ds1.shape[0]; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_charges.shape[0]; __pyx_t_4 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds2.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_alpha.shape[0]; __pyx_t_5 = 0; __pyx_t_6 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coors_ind.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coors_ind.shape[1]; __pyx_t_7 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_results.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_results.shape[1]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_results.shape[2]; - calc_dip_ten_collective_vennshellwise((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((char *) ( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_3 * __pyx_v_ds1.strides[0]) )))), (&(*((char *) ( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_4 * __pyx_v_ds2.strides[0]) )))), __pyx_v_maxshell1, __pyx_v_maxshell2, (&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_5 * __pyx_v_results.strides[0]) ) + __pyx_t_6 * __pyx_v_results.strides[1]) ) + __pyx_t_7 * __pyx_v_results.strides[2]) ))))); + __pyx_t_8 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_prev_atomic_dipoles.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_prev_atomic_dipoles.shape[1]; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_atomic_dipoles.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_atomic_dipoles.shape[1]; + atomic_ind_dip((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_1 * __pyx_v_coors.strides[0]) ) + __pyx_t_2 * __pyx_v_coors.strides[1]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_3 * __pyx_v_charges.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_4 * __pyx_v_alpha.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors_ind.data + __pyx_t_5 * __pyx_v_coors_ind.strides[0]) ) + __pyx_t_6 * __pyx_v_coors_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_prev_atomic_dipoles.data + __pyx_t_7 * __pyx_v_prev_atomic_dipoles.strides[0]) ) + __pyx_t_8 * __pyx_v_prev_atomic_dipoles.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_atomic_dipoles.data + __pyx_t_9 * __pyx_v_atomic_dipoles.strides[0]) ) + __pyx_t_10 * __pyx_v_atomic_dipoles.strides[1]) )))), __pyx_v_n_particles_all, __pyx_v_n_particles_ind, __pyx_v_boxlength); - /* "src/helpers/miscellaneous.pyx":1694 - * # Deprecated! - * @cython.boundscheck(False) - * def calcDipTenCollectiveVennShellwise(double[:,:] coor, char [:] ds1, char [:] ds2, int maxshell1, int maxshell2, double[:,:,:] results): # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":352 + * ''' + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicIndDip(double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): * """ - * coor ... (n_particles, 3) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_ds2, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_results, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1706 +/* "newanalysis/helpers/miscellaneous.pyx":426 + * """ * - * @cython.boundscheck(False) - * def calcDistanceDelaunyMindist(double[:,:] coor, double boxlength, int number_of_shells, double bin_width=1.0): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicIndDipPerAtom(int idx, double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): * """ - * coor ... (n_particles, 3) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_113calcDistanceDelaunyMindist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_112calcDistanceDelaunyMindist[] = "\n coor ... (n_particles, 3)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_113calcDistanceDelaunyMindist = {"calcDistanceDelaunyMindist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_113calcDistanceDelaunyMindist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_112calcDistanceDelaunyMindist}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_113calcDistanceDelaunyMindist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_21atomicIndDipPerAtom(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_20atomicIndDipPerAtom, "\n coors ... (N_all, 3)\n charges ... (N_all)\n alpha ... (N_ind)\n coors_ind ... (N_ind, 3)\n atomic_dipoles ... (N_ind, 3)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_21atomicIndDipPerAtom = {"atomicIndDipPerAtom", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_21atomicIndDipPerAtom, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_20atomicIndDipPerAtom}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_21atomicIndDipPerAtom(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + int __pyx_v_idx; + __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_charges = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_alpha = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coors_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_prev_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; double __pyx_v_boxlength; - int __pyx_v_number_of_shells; - double __pyx_v_bin_width; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDistanceDelaunyMindist (wrapper)", 0); + __Pyx_RefNannySetupContext("atomicIndDipPerAtom (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 426, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_boxlength,&__pyx_n_s_number_of_shells,&__pyx_n_s_bin_width,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_coors,&__pyx_n_s_charges,&__pyx_n_s_alpha,&__pyx_n_s_coors_ind,&__pyx_n_s_prev_atomic_dipoles,&__pyx_n_s_atomic_dipoles,&__pyx_n_s_boxlength,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idx)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coors)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDistanceDelaunyMindist", 0, 3, 4, 1); __PYX_ERR(0, 1706, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 1); __PYX_ERR(0, 426, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_number_of_shells)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_charges)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDistanceDelaunyMindist", 0, 3, 4, 2); __PYX_ERR(0, 1706, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 2); __PYX_ERR(0, 426, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bin_width); - if (value) { values[3] = value; kw_args--; } + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_alpha)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 3); __PYX_ERR(0, 426, __pyx_L3_error) } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDistanceDelaunyMindist") < 0)) __PYX_ERR(0, 1706, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1706, __pyx_L3_error) - __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1706, __pyx_L3_error) - __pyx_v_number_of_shells = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_number_of_shells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1706, __pyx_L3_error) - if (values[3]) { - __pyx_v_bin_width = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_bin_width == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1706, __pyx_L3_error) - } else { - __pyx_v_bin_width = ((double)1.0); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDistanceDelaunyMindist", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1706, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDistanceDelaunyMindist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_112calcDistanceDelaunyMindist(__pyx_self, __pyx_v_coor, __pyx_v_boxlength, __pyx_v_number_of_shells, __pyx_v_bin_width); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_112calcDistanceDelaunyMindist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, double __pyx_v_boxlength, int __pyx_v_number_of_shells, double __pyx_v_bin_width) { - int __pyx_v_n_particles; - __Pyx_memviewslice __pyx_v_delauny_matrix = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcDistanceDelaunyMindist", 0); - - /* "src/helpers/miscellaneous.pyx":1711 - * """ - * - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< - * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") - * calc_distance_delauny_mindist(&delauny_matrix[0,0], &coor[0,0], n_particles, boxlength, number_of_shells, bin_width) - */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - - /* "src/helpers/miscellaneous.pyx":1712 - * - * cdef int n_particles = coor.shape[0] - * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") # <<<<<<<<<<<<<< - * calc_distance_delauny_mindist(&delauny_matrix[0,0], &coor[0,0], n_particles, boxlength, number_of_shells, bin_width) - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1712, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1712, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1712, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1712, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1712, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1712, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1712, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_int32) < 0) __PYX_ERR(0, 1712, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1712, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1712, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_delauny_matrix = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; - - /* "src/helpers/miscellaneous.pyx":1713 - * cdef int n_particles = coor.shape[0] - * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") - * calc_distance_delauny_mindist(&delauny_matrix[0,0], &coor[0,0], n_particles, boxlength, number_of_shells, bin_width) # <<<<<<<<<<<<<< - * - * return delauny_matrix - */ - __pyx_t_6 = 0; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_delauny_matrix.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_delauny_matrix.shape[1]; - __pyx_t_8 = 0; - __pyx_t_9 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; - calc_distance_delauny_mindist((&(*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delauny_matrix.data + __pyx_t_6 * __pyx_v_delauny_matrix.strides[0]) ) + __pyx_t_7 * __pyx_v_delauny_matrix.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, __pyx_v_boxlength, __pyx_v_number_of_shells, __pyx_v_bin_width); - - /* "src/helpers/miscellaneous.pyx":1715 - * calc_distance_delauny_mindist(&delauny_matrix[0,0], &coor[0,0], n_particles, boxlength, number_of_shells, bin_width) - * - * return delauny_matrix # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_delauny_matrix, 2, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "src/helpers/miscellaneous.pyx":1706 - * - * @cython.boundscheck(False) - * def calcDistanceDelaunyMindist(double[:,:] coor, double boxlength, int number_of_shells, double bin_width=1.0): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDistanceDelaunyMindist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_delauny_matrix, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/miscellaneous.pyx":1718 - * - * @cython.boundscheck(False) - * def calcDistanceDelauny(double[:,:] coor, int number_of_shells, double bin_width=1.0): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_115calcDistanceDelauny(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_114calcDistanceDelauny[] = "\n coor ... (n_particles, 3)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_115calcDistanceDelauny = {"calcDistanceDelauny", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_115calcDistanceDelauny, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_114calcDistanceDelauny}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_115calcDistanceDelauny(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_number_of_shells; - double __pyx_v_bin_width; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcDistanceDelauny (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_number_of_shells,&__pyx_n_s_bin_width,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coors_ind)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 4); __PYX_ERR(0, 426, __pyx_L3_error) + } CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_prev_atomic_dipoles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 5); __PYX_ERR(0, 426, __pyx_L3_error) + } CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_number_of_shells)) != 0)) kw_args--; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_atomic_dipoles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcDistanceDelauny", 0, 2, 3, 1); __PYX_ERR(0, 1718, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 6); __PYX_ERR(0, 426, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bin_width); - if (value) { values[2] = value; kw_args--; } + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 426, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, 7); __PYX_ERR(0, 426, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcDistanceDelauny") < 0)) __PYX_ERR(0, 1718, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "atomicIndDipPerAtom") < 0)) __PYX_ERR(0, 426, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 8)) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1718, __pyx_L3_error) - __pyx_v_number_of_shells = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_number_of_shells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1718, __pyx_L3_error) - if (values[2]) { - __pyx_v_bin_width = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_bin_width == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1718, __pyx_L3_error) - } else { - __pyx_v_bin_width = ((double)1.0); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); } + __pyx_v_idx = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L3_error) + __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 427, __pyx_L3_error) + __pyx_v_charges = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_charges.memview)) __PYX_ERR(0, 427, __pyx_L3_error) + __pyx_v_alpha = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_alpha.memview)) __PYX_ERR(0, 427, __pyx_L3_error) + __pyx_v_coors_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors_ind.memview)) __PYX_ERR(0, 427, __pyx_L3_error) + __pyx_v_prev_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_prev_atomic_dipoles.memview)) __PYX_ERR(0, 427, __pyx_L3_error) + __pyx_v_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_atomic_dipoles.memview)) __PYX_ERR(0, 427, __pyx_L3_error) + __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 427, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcDistanceDelauny", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1718, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("atomicIndDipPerAtom", 1, 8, 8, __pyx_nargs); __PYX_ERR(0, 426, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDistanceDelauny", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_alpha, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_prev_atomic_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_atomic_dipoles, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.atomicIndDipPerAtom", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_114calcDistanceDelauny(__pyx_self, __pyx_v_coor, __pyx_v_number_of_shells, __pyx_v_bin_width); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_20atomicIndDipPerAtom(__pyx_self, __pyx_v_idx, __pyx_v_coors, __pyx_v_charges, __pyx_v_alpha, __pyx_v_coors_ind, __pyx_v_prev_atomic_dipoles, __pyx_v_atomic_dipoles, __pyx_v_boxlength); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_charges, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_alpha, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_prev_atomic_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_atomic_dipoles, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_114calcDistanceDelauny(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, int __pyx_v_number_of_shells, double __pyx_v_bin_width) { - int __pyx_v_n_particles; - __Pyx_memviewslice __pyx_v_delauny_matrix = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_20atomicIndDipPerAtom(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_idx, __Pyx_memviewslice __pyx_v_coors, __Pyx_memviewslice __pyx_v_charges, __Pyx_memviewslice __pyx_v_alpha, __Pyx_memviewslice __pyx_v_coors_ind, __Pyx_memviewslice __pyx_v_prev_atomic_dipoles, __Pyx_memviewslice __pyx_v_atomic_dipoles, double __pyx_v_boxlength) { + int __pyx_v_n_particles_all; + int __pyx_v_n_particles_ind; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; Py_ssize_t __pyx_t_7; Py_ssize_t __pyx_t_8; Py_ssize_t __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcDistanceDelauny", 0); + Py_ssize_t __pyx_t_10; + __Pyx_RefNannySetupContext("atomicIndDipPerAtom", 0); - /* "src/helpers/miscellaneous.pyx":1723 + /* "newanalysis/helpers/miscellaneous.pyx":436 * """ * - * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< - * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") - * calc_distance_delauny(&delauny_matrix[0,0], &coor[0,0], n_particles, number_of_shells, bin_width) + * cdef int n_particles_all = coors.shape[0] # <<<<<<<<<<<<<< + * cdef int n_particles_ind = atomic_dipoles.shape[0] + * */ - __pyx_v_n_particles = (__pyx_v_coor.shape[0]); + __pyx_v_n_particles_all = (__pyx_v_coors.shape[0]); - /* "src/helpers/miscellaneous.pyx":1724 + /* "newanalysis/helpers/miscellaneous.pyx":437 * - * cdef int n_particles = coor.shape[0] - * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") # <<<<<<<<<<<<<< - * calc_distance_delauny(&delauny_matrix[0,0], &coor[0,0], n_particles, number_of_shells, bin_width) + * cdef int n_particles_all = coors.shape[0] + * cdef int n_particles_ind = atomic_dipoles.shape[0] # <<<<<<<<<<<<<< * + * atomic_ind_dip_per_atom(idx, &coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_int32) < 0) __PYX_ERR(0, 1724, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1724, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_delauny_matrix = __pyx_t_5; - __pyx_t_5.memview = NULL; - __pyx_t_5.data = NULL; + __pyx_v_n_particles_ind = (__pyx_v_atomic_dipoles.shape[0]); - /* "src/helpers/miscellaneous.pyx":1725 - * cdef int n_particles = coor.shape[0] - * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") - * calc_distance_delauny(&delauny_matrix[0,0], &coor[0,0], n_particles, number_of_shells, bin_width) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":439 + * cdef int n_particles_ind = atomic_dipoles.shape[0] * - * return delauny_matrix + * atomic_ind_dip_per_atom(idx, &coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) # <<<<<<<<<<<<<< + * + * def kronecker(int a, int b) -> int: */ + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coors.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coors.shape[1]; + __pyx_t_3 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_charges.shape[0]; + __pyx_t_4 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_alpha.shape[0]; + __pyx_t_5 = 0; __pyx_t_6 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coors_ind.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coors_ind.shape[1]; __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_delauny_matrix.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_delauny_matrix.shape[1]; __pyx_t_8 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_prev_atomic_dipoles.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_prev_atomic_dipoles.shape[1]; __pyx_t_9 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; - calc_distance_delauny((&(*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delauny_matrix.data + __pyx_t_6 * __pyx_v_delauny_matrix.strides[0]) ) + __pyx_t_7 * __pyx_v_delauny_matrix.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, __pyx_v_number_of_shells, __pyx_v_bin_width); - - /* "src/helpers/miscellaneous.pyx":1727 - * calc_distance_delauny(&delauny_matrix[0,0], &coor[0,0], n_particles, number_of_shells, bin_width) - * - * return delauny_matrix # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_delauny_matrix, 2, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1727, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_10 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_atomic_dipoles.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_atomic_dipoles.shape[1]; + atomic_ind_dip_per_atom(__pyx_v_idx, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_1 * __pyx_v_coors.strides[0]) ) + __pyx_t_2 * __pyx_v_coors.strides[1]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_charges.data + __pyx_t_3 * __pyx_v_charges.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_alpha.data + __pyx_t_4 * __pyx_v_alpha.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors_ind.data + __pyx_t_5 * __pyx_v_coors_ind.strides[0]) ) + __pyx_t_6 * __pyx_v_coors_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_prev_atomic_dipoles.data + __pyx_t_7 * __pyx_v_prev_atomic_dipoles.strides[0]) ) + __pyx_t_8 * __pyx_v_prev_atomic_dipoles.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_atomic_dipoles.data + __pyx_t_9 * __pyx_v_atomic_dipoles.strides[0]) ) + __pyx_t_10 * __pyx_v_atomic_dipoles.strides[1]) )))), __pyx_v_n_particles_all, __pyx_v_n_particles_ind, __pyx_v_boxlength); - /* "src/helpers/miscellaneous.pyx":1718 + /* "newanalysis/helpers/miscellaneous.pyx":426 + * """ * - * @cython.boundscheck(False) - * def calcDistanceDelauny(double[:,:] coor, int number_of_shells, double bin_width=1.0): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicIndDipPerAtom(int idx, double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): * """ - * coor ... (n_particles, 3) */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); - __Pyx_AddTraceback("newanalysis.miscellaneous.calcDistanceDelauny", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_delauny_matrix, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1732 - * # Deprecated! - * @cython.boundscheck(False) - * def minDistTesselation(double [:] dataset, double [:,:] coor_core, double [:,:] coor_surround, double binwidth = 1): # <<<<<<<<<<<<<< - * """ - * dataset ... (n_particles_surround) +/* "newanalysis/helpers/miscellaneous.pyx":441 + * atomic_ind_dip_per_atom(idx, &coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) + * + * def kronecker(int a, int b) -> int: # <<<<<<<<<<<<<< + * if (a == b): return 1 + * return 0 */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_117minDistTesselation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_116minDistTesselation[] = "\n dataset ... (n_particles_surround)\n coor_core ... (n_particles_core, 3)\n coor_surround ... (n_particles_surround, 3)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_117minDistTesselation = {"minDistTesselation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_117minDistTesselation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_116minDistTesselation}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_117minDistTesselation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor_core = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor_surround = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_binwidth; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_23kronecker(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_23kronecker = {"kronecker", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_23kronecker, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_23kronecker(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + int __pyx_v_a; + int __pyx_v_b; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("minDistTesselation (wrapper)", 0); + __Pyx_RefNannySetupContext("kronecker (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 441, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dataset,&__pyx_n_s_coor_core,&__pyx_n_s_coor_surround,&__pyx_n_s_binwidth,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataset)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_a)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_core)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDistTesselation", 0, 3, 4, 1); __PYX_ERR(0, 1732, __pyx_L3_error) + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_b)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_surround)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("minDistTesselation", 0, 3, 4, 2); __PYX_ERR(0, 1732, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_binwidth); - if (value) { values[3] = value; kw_args--; } + __Pyx_RaiseArgtupleInvalid("kronecker", 1, 2, 2, 1); __PYX_ERR(0, 441, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "minDistTesselation") < 0)) __PYX_ERR(0, 1732, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "kronecker") < 0)) __PYX_ERR(0, 441, __pyx_L3_error) } - } - __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 1732, __pyx_L3_error) - __pyx_v_coor_core = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_core.memview)) __PYX_ERR(0, 1732, __pyx_L3_error) - __pyx_v_coor_surround = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_surround.memview)) __PYX_ERR(0, 1732, __pyx_L3_error) - if (values[3]) { - __pyx_v_binwidth = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_binwidth == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1732, __pyx_L3_error) + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; } else { - __pyx_v_binwidth = ((double)1.0); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } + __pyx_v_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) + __pyx_v_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("minDistTesselation", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1732, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("kronecker", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 441, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.minDistTesselation", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.miscellaneous.kronecker", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_116minDistTesselation(__pyx_self, __pyx_v_dataset, __pyx_v_coor_core, __pyx_v_coor_surround, __pyx_v_binwidth); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_22kronecker(__pyx_self, __pyx_v_a, __pyx_v_b); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_116minDistTesselation(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_dataset, __Pyx_memviewslice __pyx_v_coor_core, __Pyx_memviewslice __pyx_v_coor_surround, double __pyx_v_binwidth) { - int __pyx_v_n_particle_core; - int __pyx_v_n_particle_surround; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_22kronecker(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_a, int __pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("minDistTesselation", 0); + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("kronecker", 0); - /* "src/helpers/miscellaneous.pyx":1739 - * """ + /* "newanalysis/helpers/miscellaneous.pyx":442 * - * cdef int n_particle_core = coor_core.shape[0] # <<<<<<<<<<<<<< - * cdef int n_particle_surround = coor_surround.shape[0] + * def kronecker(int a, int b) -> int: + * if (a == b): return 1 # <<<<<<<<<<<<<< + * return 0 * */ - __pyx_v_n_particle_core = (__pyx_v_coor_core.shape[0]); + __pyx_t_1 = (__pyx_v_a == __pyx_v_b); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_1))) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_INCREF(__pyx_int_1); + __pyx_r = ((PyObject*)__pyx_int_1); + goto __pyx_L0; + } - /* "src/helpers/miscellaneous.pyx":1740 + /* "newanalysis/helpers/miscellaneous.pyx":443 + * def kronecker(int a, int b) -> int: + * if (a == b): return 1 + * return 0 # <<<<<<<<<<<<<< * - * cdef int n_particle_core = coor_core.shape[0] - * cdef int n_particle_surround = coor_surround.shape[0] # <<<<<<<<<<<<<< * - * calc_min_dist_tesselation(&dataset[0], &coor_core[0,0], &coor_surround[0,0], n_particle_core, n_particle_surround, binwidth) */ - __pyx_v_n_particle_surround = (__pyx_v_coor_surround.shape[0]); + __Pyx_XDECREF(__pyx_r); + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_0)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_0))) __PYX_ERR(0, 443, __pyx_L1_error) + __Pyx_INCREF(__pyx_int_0); + __pyx_r = ((PyObject*)__pyx_int_0); + goto __pyx_L0; - /* "src/helpers/miscellaneous.pyx":1742 - * cdef int n_particle_surround = coor_surround.shape[0] - * - * calc_min_dist_tesselation(&dataset[0], &coor_core[0,0], &coor_surround[0,0], n_particle_core, n_particle_surround, binwidth) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":441 + * atomic_ind_dip_per_atom(idx, &coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) * - * @cython.boundscheck(False) - */ - __pyx_t_1 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_dataset.shape[0]; - __pyx_t_2 = 0; - __pyx_t_3 = 0; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor_core.shape[0]; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor_core.shape[1]; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor_surround.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor_surround.shape[1]; - calc_min_dist_tesselation((&(*((double *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_1 * __pyx_v_dataset.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_core.data + __pyx_t_2 * __pyx_v_coor_core.strides[0]) ) + __pyx_t_3 * __pyx_v_coor_core.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surround.data + __pyx_t_4 * __pyx_v_coor_surround.strides[0]) ) + __pyx_t_5 * __pyx_v_coor_surround.strides[1]) )))), __pyx_v_n_particle_core, __pyx_v_n_particle_surround, __pyx_v_binwidth); - - /* "src/helpers/miscellaneous.pyx":1732 - * # Deprecated! - * @cython.boundscheck(False) - * def minDistTesselation(double [:] dataset, double [:,:] coor_core, double [:,:] coor_surround, double binwidth = 1): # <<<<<<<<<<<<<< - * """ - * dataset ... (n_particles_surround) + * def kronecker(int a, int b) -> int: # <<<<<<<<<<<<<< + * if (a == b): return 1 + * return 0 */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_dataset, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor_core, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor_surround, 1); + __pyx_L1_error:; + __Pyx_AddTraceback("newanalysis.miscellaneous.kronecker", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/miscellaneous.pyx":1745 +/* "newanalysis/helpers/miscellaneous.pyx":446 * - * @cython.boundscheck(False) - * def getPolarizabilityMatrix(double[:,:] coor, double[:,:,:] inv_atom_polarizabilities, double[:,:] matrix): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def deriveIndDip(double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): * """ - * coor ... (n_atoms, 3) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_119getPolarizabilityMatrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_13miscellaneous_118getPolarizabilityMatrix[] = "\n coor ... (n_atoms, 3)\n inv_atom_polarizabilities ... (n_atoms, 3, 3)\n matrix ... (3*n_atoms, 3*n_atoms)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_119getPolarizabilityMatrix = {"getPolarizabilityMatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_119getPolarizabilityMatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_118getPolarizabilityMatrix}; -static PyObject *__pyx_pw_11newanalysis_13miscellaneous_119getPolarizabilityMatrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_inv_atom_polarizabilities = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_matrix = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_25deriveIndDip(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_24deriveIndDip, "\n coors_ind ... (N_ind, 3)\n vel_ind ... (N_ind, 3)\n atomic_dipoles ... (N_ind, 3)\n derived_atomic_dipoles ... (N_ind, 3)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_25deriveIndDip = {"deriveIndDip", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_25deriveIndDip, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_24deriveIndDip}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_25deriveIndDip(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coors_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_vel_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_derived_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxlength; + CYTHON_UNUSED int __pyx_v_new; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getPolarizabilityMatrix (wrapper)", 0); + __Pyx_RefNannySetupContext("deriveIndDip (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 446, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_inv_atom_polarizabilities,&__pyx_n_s_matrix,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coors_ind,&__pyx_n_s_vel_ind,&__pyx_n_s_atomic_dipoles,&__pyx_n_s_derived_atomic_dipoles,&__pyx_n_s_boxlength,&__pyx_n_s_new_2,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coors_ind)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 446, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inv_atom_polarizabilities)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_vel_ind)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 446, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("getPolarizabilityMatrix", 1, 3, 3, 1); __PYX_ERR(0, 1745, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("deriveIndDip", 0, 5, 6, 1); __PYX_ERR(0, 446, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_matrix)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_atomic_dipoles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 446, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("deriveIndDip", 0, 5, 6, 2); __PYX_ERR(0, 446, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_derived_atomic_dipoles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 446, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("deriveIndDip", 0, 5, 6, 3); __PYX_ERR(0, 446, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 446, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("getPolarizabilityMatrix", 1, 3, 3, 2); __PYX_ERR(0, 1745, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("deriveIndDip", 0, 5, 6, 4); __PYX_ERR(0, 446, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_new_2); + if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 446, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getPolarizabilityMatrix") < 0)) __PYX_ERR(0, 1745, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "deriveIndDip") < 0)) __PYX_ERR(0, 446, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_coors_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors_ind.memview)) __PYX_ERR(0, 447, __pyx_L3_error) + __pyx_v_vel_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vel_ind.memview)) __PYX_ERR(0, 447, __pyx_L3_error) + __pyx_v_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_atomic_dipoles.memview)) __PYX_ERR(0, 447, __pyx_L3_error) + __pyx_v_derived_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_derived_atomic_dipoles.memview)) __PYX_ERR(0, 447, __pyx_L3_error) + __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 447, __pyx_L3_error) + if (values[5]) { + __pyx_v_new = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_new == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 447, __pyx_L3_error) + } else { + __pyx_v_new = ((int)((int)0)); } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1745, __pyx_L3_error) - __pyx_v_inv_atom_polarizabilities = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_inv_atom_polarizabilities.memview)) __PYX_ERR(0, 1745, __pyx_L3_error) - __pyx_v_matrix = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_matrix.memview)) __PYX_ERR(0, 1745, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("getPolarizabilityMatrix", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1745, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("deriveIndDip", 0, 5, 6, __pyx_nargs); __PYX_ERR(0, 446, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.miscellaneous.getPolarizabilityMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vel_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_atomic_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_derived_atomic_dipoles, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.deriveIndDip", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_118getPolarizabilityMatrix(__pyx_self, __pyx_v_coor, __pyx_v_inv_atom_polarizabilities, __pyx_v_matrix); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_24deriveIndDip(__pyx_self, __pyx_v_coors_ind, __pyx_v_vel_ind, __pyx_v_atomic_dipoles, __pyx_v_derived_atomic_dipoles, __pyx_v_boxlength, __pyx_v_new); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vel_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_atomic_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_derived_atomic_dipoles, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_13miscellaneous_118getPolarizabilityMatrix(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_inv_atom_polarizabilities, __Pyx_memviewslice __pyx_v_matrix) { - int __pyx_v_n_atoms; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_24deriveIndDip(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coors_ind, __Pyx_memviewslice __pyx_v_vel_ind, __Pyx_memviewslice __pyx_v_atomic_dipoles, __Pyx_memviewslice __pyx_v_derived_atomic_dipoles, double __pyx_v_boxlength, CYTHON_UNUSED int __pyx_v_new) { + int __pyx_v_n_ind_particles; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -30619,14111 +27277,25530 @@ static PyObject *__pyx_pf_11newanalysis_13miscellaneous_118getPolarizabilityMatr Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; Py_ssize_t __pyx_t_7; - __Pyx_RefNannySetupContext("getPolarizabilityMatrix", 0); + Py_ssize_t __pyx_t_8; + __Pyx_RefNannySetupContext("deriveIndDip", 0); - /* "src/helpers/miscellaneous.pyx":1752 + /* "newanalysis/helpers/miscellaneous.pyx":455 * """ * - * cdef int n_atoms = coor.shape[0] # <<<<<<<<<<<<<< - * - * construct_relay_matrix(&coor[0,0], &inv_atom_polarizabilities[0,0,0], &matrix[0,0], n_atoms) + * cdef int n_ind_particles = coors_ind.shape[0] # <<<<<<<<<<<<<< + * #cdef double [:,:,:] dip_ten = np.zeros((3,3,3), dtype = 'float64') + * #cdef int atom1, atom2, dim1, dim2, dim3 */ - __pyx_v_n_atoms = (__pyx_v_coor.shape[0]); + __pyx_v_n_ind_particles = (__pyx_v_coors_ind.shape[0]); - /* "src/helpers/miscellaneous.pyx":1754 - * cdef int n_atoms = coor.shape[0] - * - * construct_relay_matrix(&coor[0,0], &inv_atom_polarizabilities[0,0,0], &matrix[0,0], n_atoms) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":463 + * #cdef double [:] t_mu = np.zeros(3, dtype = 'float64') * - * #TODO: invert relay matrix + * derive_ind_dip(&coors_ind[0,0], &vel_ind[0,0], &atomic_dipoles[0,0], &derived_atomic_dipoles[0,0], n_ind_particles, boxlength) # <<<<<<<<<<<<<< + * """ + * else: */ __pyx_t_1 = 0; __pyx_t_2 = 0; - if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coors_ind.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coors_ind.shape[1]; __pyx_t_3 = 0; __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_vel_ind.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_vel_ind.shape[1]; __pyx_t_5 = 0; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_inv_atom_polarizabilities.shape[0]; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_inv_atom_polarizabilities.shape[1]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_inv_atom_polarizabilities.shape[2]; __pyx_t_6 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_atomic_dipoles.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_atomic_dipoles.shape[1]; __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_matrix.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_matrix.shape[1]; - construct_relay_matrix((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_inv_atom_polarizabilities.data + __pyx_t_3 * __pyx_v_inv_atom_polarizabilities.strides[0]) ) + __pyx_t_4 * __pyx_v_inv_atom_polarizabilities.strides[1]) ) + __pyx_t_5 * __pyx_v_inv_atom_polarizabilities.strides[2]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_matrix.data + __pyx_t_6 * __pyx_v_matrix.strides[0]) ) + __pyx_t_7 * __pyx_v_matrix.strides[1]) )))), __pyx_v_n_atoms); + __pyx_t_8 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_derived_atomic_dipoles.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_derived_atomic_dipoles.shape[1]; + derive_ind_dip((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors_ind.data + __pyx_t_1 * __pyx_v_coors_ind.strides[0]) ) + __pyx_t_2 * __pyx_v_coors_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel_ind.data + __pyx_t_3 * __pyx_v_vel_ind.strides[0]) ) + __pyx_t_4 * __pyx_v_vel_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_atomic_dipoles.data + __pyx_t_5 * __pyx_v_atomic_dipoles.strides[0]) ) + __pyx_t_6 * __pyx_v_atomic_dipoles.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_derived_atomic_dipoles.data + __pyx_t_7 * __pyx_v_derived_atomic_dipoles.strides[0]) ) + __pyx_t_8 * __pyx_v_derived_atomic_dipoles.strides[1]) )))), __pyx_v_n_ind_particles, __pyx_v_boxlength); - /* "src/helpers/miscellaneous.pyx":1745 + /* "newanalysis/helpers/miscellaneous.pyx":446 * - * @cython.boundscheck(False) - * def getPolarizabilityMatrix(double[:,:] coor, double[:,:,:] inv_atom_polarizabilities, double[:,:] matrix): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def deriveIndDip(double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): * """ - * coor ... (n_atoms, 3) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_inv_atom_polarizabilities, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_matrix, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":735 - * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew2(a, b): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":738 - * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":741 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 741, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) +/* "newanalysis/helpers/miscellaneous.pyx":510 + * ''' * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def deriveIndDipPerAtom(int idx, double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): + * """ */ -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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_27deriveIndDipPerAtom(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_26deriveIndDipPerAtom, "\n coors_ind ... (N_ind, 3)\n vel_ind ... (N_ind, 3)\n atomic_dipoles ... (N_ind, 3)\n derived_atomic_dipoles ... (N_ind, 3)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_27deriveIndDipPerAtom = {"deriveIndDipPerAtom", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_27deriveIndDipPerAtom, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_26deriveIndDipPerAtom}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_27deriveIndDipPerAtom(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + int __pyx_v_idx; + __Pyx_memviewslice __pyx_v_coors_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_vel_ind = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_derived_atomic_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxlength; + CYTHON_UNUSED int __pyx_v_new; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":744 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 744, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - -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) { - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":747 - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< - * - * cdef inline tuple PyDataType_SHAPE(dtype d): - */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ + __Pyx_RefNannySetupContext("deriveIndDipPerAtom (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 510, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_coors_ind,&__pyx_n_s_vel_ind,&__pyx_n_s_atomic_dipoles,&__pyx_n_s_derived_atomic_dipoles,&__pyx_n_s_boxlength,&__pyx_n_s_new_2,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idx)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coors_ind)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, 1); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_vel_ind)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, 2); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_atomic_dipoles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, 3); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_derived_atomic_dipoles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, 4); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, 5); __PYX_ERR(0, 510, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_new_2); + if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "deriveIndDipPerAtom") < 0)) __PYX_ERR(0, 510, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_idx = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_coors_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors_ind.memview)) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_vel_ind = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vel_ind.memview)) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_atomic_dipoles.memview)) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_derived_atomic_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_derived_atomic_dipoles.memview)) __PYX_ERR(0, 511, __pyx_L3_error) + __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) + if (values[6]) { + __pyx_v_new = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_new == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 511, __pyx_L3_error) + } else { + __pyx_v_new = ((int)((int)0)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("deriveIndDipPerAtom", 0, 6, 7, __pyx_nargs); __PYX_ERR(0, 510, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vel_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_atomic_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_derived_atomic_dipoles, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.deriveIndDipPerAtom", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_26deriveIndDipPerAtom(__pyx_self, __pyx_v_idx, __pyx_v_coors_ind, __pyx_v_vel_ind, __pyx_v_atomic_dipoles, __pyx_v_derived_atomic_dipoles, __pyx_v_boxlength, __pyx_v_new); /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vel_ind, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_atomic_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_derived_atomic_dipoles, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_26deriveIndDipPerAtom(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_idx, __Pyx_memviewslice __pyx_v_coors_ind, __Pyx_memviewslice __pyx_v_vel_ind, __Pyx_memviewslice __pyx_v_atomic_dipoles, __Pyx_memviewslice __pyx_v_derived_atomic_dipoles, double __pyx_v_boxlength, CYTHON_UNUSED int __pyx_v_new) { + int __pyx_v_n_ind_particles; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + __Pyx_RefNannySetupContext("deriveIndDipPerAtom", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 + /* "newanalysis/helpers/miscellaneous.pyx":519 + * """ * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: - */ - __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); - if (__pyx_t_1) { - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":751 - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape # <<<<<<<<<<<<<< - * else: - * return () - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); - __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 + * cdef int n_ind_particles = coors_ind.shape[0] # <<<<<<<<<<<<<< * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: + * derive_ind_dip_per_atom(idx, &coors_ind[0,0], &vel_ind[0,0], &atomic_dipoles[0,0], &derived_atomic_dipoles[0,0], n_ind_particles, boxlength) */ - } + __pyx_v_n_ind_particles = (__pyx_v_coors_ind.shape[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":753 - * return d.subarray.shape - * else: - * return () # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":521 + * cdef int n_ind_particles = coors_ind.shape[0] * + * derive_ind_dip_per_atom(idx, &coors_ind[0,0], &vel_ind[0,0], &atomic_dipoles[0,0], &derived_atomic_dipoles[0,0], n_ind_particles, boxlength) # <<<<<<<<<<<<<< * + * ###BEGIN DANIEL NOE HELPERS */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_empty_tuple); - __pyx_r = __pyx_empty_tuple; - goto __pyx_L0; - } + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coors_ind.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coors_ind.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_vel_ind.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_vel_ind.shape[1]; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_atomic_dipoles.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_atomic_dipoles.shape[1]; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_derived_atomic_dipoles.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_derived_atomic_dipoles.shape[1]; + derive_ind_dip_per_atom(__pyx_v_idx, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors_ind.data + __pyx_t_1 * __pyx_v_coors_ind.strides[0]) ) + __pyx_t_2 * __pyx_v_coors_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vel_ind.data + __pyx_t_3 * __pyx_v_vel_ind.strides[0]) ) + __pyx_t_4 * __pyx_v_vel_ind.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_atomic_dipoles.data + __pyx_t_5 * __pyx_v_atomic_dipoles.strides[0]) ) + __pyx_t_6 * __pyx_v_atomic_dipoles.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_derived_atomic_dipoles.data + __pyx_t_7 * __pyx_v_derived_atomic_dipoles.strides[0]) ) + __pyx_t_8 * __pyx_v_derived_atomic_dipoles.strides[1]) )))), __pyx_v_n_ind_particles, __pyx_v_boxlength); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) + /* "newanalysis/helpers/miscellaneous.pyx":510 + * ''' * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def deriveIndDipPerAtom(int idx, double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): + * """ */ /* function exit code */ - __pyx_L0:; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 +/* "newanalysis/helpers/miscellaneous.pyx":524 * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) + * ###BEGIN DANIEL NOE HELPERS + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def norm(double[:] x): + * cdef double res = np.dot(x,x)**.5 */ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_29norm(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_29norm = {"norm", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_29norm, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_29norm(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_x = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_array_base", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":929 - * - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< - * PyArray_SetBaseObject(arr, base) - * - */ - Py_INCREF(__pyx_v_base); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":930 - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) - */ + __Pyx_RefNannySetupContext("norm (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 524, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 524, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "norm") < 0)) __PYX_ERR(0, 524, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_x = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_x.memview)) __PYX_ERR(0, 525, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("norm", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 524, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_x, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.norm", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_28norm(__pyx_self, __pyx_v_x); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_x, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_v_base; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_28norm(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_x) { + double __pyx_v_res; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":933 - * - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< - * if base is NULL: - * return None - */ - __pyx_v_base = PyArray_BASE(__pyx_v_arr); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base - */ - __pyx_t_1 = ((__pyx_v_base == NULL) != 0); - if (__pyx_t_1) { + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + double __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("norm", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":935 - * base = PyArray_BASE(arr) - * if base is NULL: - * return None # <<<<<<<<<<<<<< - * return base + /* "newanalysis/helpers/miscellaneous.pyx":526 + * @cython.boundscheck(False) + * def norm(double[:] x): + * cdef double res = np.dot(x,x)**.5 # <<<<<<<<<<<<<< + * return res * */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base - */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_x, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_2, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } + __pyx_t_3 = PyNumber_Power(__pyx_t_1, __pyx_float__5, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 526, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_res = __pyx_t_7; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":936 - * if base is NULL: - * return None - * return base # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":527 + * def norm(double[:] x): + * cdef double res = np.dot(x,x)**.5 + * return res # <<<<<<<<<<<<<< * - * # Versions of the import_* functions which are more suitable for + * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_base)); - __pyx_r = ((PyObject *)__pyx_v_base); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_res); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 527, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) + /* "newanalysis/helpers/miscellaneous.pyx":524 * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: + * ###BEGIN DANIEL NOE HELPERS + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def norm(double[:] x): + * cdef double res = np.dot(x,x)**.5 */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("newanalysis.miscellaneous.norm", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() +/* "newanalysis/helpers/miscellaneous.pyx":529 + * return res + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfold(double[:] ref, double[:] new, double[:] run, double boxl): + * cdef int i */ -static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { - int __pyx_r; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_31unfold(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_31unfold = {"unfold", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_31unfold, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_31unfold(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_ref = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_new = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_run = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxl; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("unfold (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 529, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ref,&__pyx_n_s_new_2,&__pyx_n_s_run,&__pyx_n_s_boxl,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ref)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 529, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_new_2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 529, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfold", 1, 4, 4, 1); __PYX_ERR(0, 529, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_run)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 529, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfold", 1, 4, 4, 2); __PYX_ERR(0, 529, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 529, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfold", 1, 4, 4, 3); __PYX_ERR(0, 529, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "unfold") < 0)) __PYX_ERR(0, 529, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_ref = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ref.memview)) __PYX_ERR(0, 530, __pyx_L3_error) + __pyx_v_new = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_new.memview)) __PYX_ERR(0, 530, __pyx_L3_error) + __pyx_v_run = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_run.memview)) __PYX_ERR(0, 530, __pyx_L3_error) + __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 530, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unfold", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 529, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ref, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_new, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_run, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.unfold", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_30unfold(__pyx_self, __pyx_v_ref, __pyx_v_new, __pyx_v_run, __pyx_v_boxl); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ref, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_new, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_run, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_30unfold(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ref, __Pyx_memviewslice __pyx_v_new, __Pyx_memviewslice __pyx_v_run, double __pyx_v_boxl) { + int __pyx_v_i; + double __pyx_v_D; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + double __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_array", 0); + __Pyx_RefNannySetupContext("unfold", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "newanalysis/helpers/miscellaneous.pyx":534 + * cdef double D + * + * for i in range(3): # <<<<<<<<<<<<<< + * D=(new[i]-ref[i]) + * if abs(D)>(boxl/2): */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":942 - * cdef inline int import_array() except -1: - * try: - * __pyx_import_array() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") + /* "newanalysis/helpers/miscellaneous.pyx":535 + * + * for i in range(3): + * D=(new[i]-ref[i]) # <<<<<<<<<<<<<< + * if abs(D)>(boxl/2): + * D-=np.sign(D)*boxl */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 942, __pyx_L3_error) + __pyx_t_2 = __pyx_v_i; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_new.shape[0]; + __pyx_t_3 = __pyx_v_i; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_ref.shape[0]; + __pyx_v_D = ((*((double *) ( /* dim=0 */ (__pyx_v_new.data + __pyx_t_2 * __pyx_v_new.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_ref.data + __pyx_t_3 * __pyx_v_ref.strides[0]) )))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "newanalysis/helpers/miscellaneous.pyx":536 + * for i in range(3): + * D=(new[i]-ref[i]) + * if abs(D)>(boxl/2): # <<<<<<<<<<<<<< + * D-=np.sign(D)*boxl + * run[i]+=D */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + __pyx_t_4 = (fabs(__pyx_v_D) > (__pyx_v_boxl / 2.0)); + if (__pyx_t_4) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":943 - * try: - * __pyx_import_array() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.multiarray failed to import") - * + /* "newanalysis/helpers/miscellaneous.pyx":537 + * D=(new[i]-ref[i]) + * if abs(D)>(boxl/2): + * D-=np.sign(D)*boxl # <<<<<<<<<<<<<< + * run[i]+=D + * return run */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 943, __pyx_L5_except_error) + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_D); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< - * - * cdef inline int import_umath() except -1: - */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 944, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sign); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_D); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_boxl); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_InPlaceSubtract(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 944, __pyx_L5_except_error) + __pyx_v_D = __pyx_t_11; + + /* "newanalysis/helpers/miscellaneous.pyx":536 + * for i in range(3): + * D=(new[i]-ref[i]) + * if abs(D)>(boxl/2): # <<<<<<<<<<<<<< + * D-=np.sign(D)*boxl + * run[i]+=D + */ } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "newanalysis/helpers/miscellaneous.pyx":538 + * if abs(D)>(boxl/2): + * D-=np.sign(D)*boxl + * run[i]+=D # <<<<<<<<<<<<<< + * return run + * */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + __pyx_t_3 = __pyx_v_i; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_run.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_run.data + __pyx_t_3 * __pyx_v_run.strides[0]) )) += __pyx_v_D; } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() + /* "newanalysis/helpers/miscellaneous.pyx":539 + * D-=np.sign(D)*boxl + * run[i]+=D + * return run # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_run, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L0; + + /* "newanalysis/helpers/miscellaneous.pyx":529 + * return res + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfold(double[:] ref, double[:] new, double[:] run, double boxl): + * cdef int i */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("newanalysis.miscellaneous.unfold", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") +/* "newanalysis/helpers/miscellaneous.pyx":542 * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def min_dist(double[:] res1, double[:] res2, double boxl): + * cdef int i */ -static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { - int __pyx_r; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_33min_dist(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_33min_dist = {"min_dist", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_33min_dist, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_33min_dist(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_res1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_res2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxl; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("min_dist (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 542, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_res1,&__pyx_n_s_res2,&__pyx_n_s_boxl,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_res1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 542, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_res2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 542, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("min_dist", 1, 3, 3, 1); __PYX_ERR(0, 542, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 542, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("min_dist", 1, 3, 3, 2); __PYX_ERR(0, 542, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "min_dist") < 0)) __PYX_ERR(0, 542, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_res1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_res1.memview)) __PYX_ERR(0, 543, __pyx_L3_error) + __pyx_v_res2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_res2.memview)) __PYX_ERR(0, 543, __pyx_L3_error) + __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("min_dist", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 542, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_res1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_res2, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.min_dist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_32min_dist(__pyx_self, __pyx_v_res1, __pyx_v_res2, __pyx_v_boxl); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_res1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_res2, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_32min_dist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_res1, __Pyx_memviewslice __pyx_v_res2, double __pyx_v_boxl) { + int __pyx_v_i; + double __pyx_v_D; + __Pyx_memviewslice __pyx_v_vec = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + double __pyx_t_11; + Py_ssize_t __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_umath", 0); + __Pyx_RefNannySetupContext("min_dist", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "newanalysis/helpers/miscellaneous.pyx":546 + * cdef int i + * cdef double D + * cdef double [:] vec = np.zeros(3) # <<<<<<<<<<<<<< * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * for i in range(3): */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #endif { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 546, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_vec = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":948 - * cdef inline int import_umath() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") + /* "newanalysis/helpers/miscellaneous.pyx":548 + * cdef double [:] vec = np.zeros(3) + * + * for i in range(3): # <<<<<<<<<<<<<< + * D=(res2[i]-res1[i]) + * if abs(D)>(boxl/2): */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 948, __pyx_L3_error) + for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "newanalysis/helpers/miscellaneous.pyx":549 * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * for i in range(3): + * D=(res2[i]-res1[i]) # <<<<<<<<<<<<<< + * if abs(D)>(boxl/2): + * res2[i]-=np.sign(D)*boxl */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + __pyx_t_6 = __pyx_v_i; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_res2.shape[0]; + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_res1.shape[0]; + __pyx_v_D = ((*((double *) ( /* dim=0 */ (__pyx_v_res2.data + __pyx_t_6 * __pyx_v_res2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_res1.data + __pyx_t_7 * __pyx_v_res1.strides[0]) )))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":949 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") + /* "newanalysis/helpers/miscellaneous.pyx":550 + * for i in range(3): + * D=(res2[i]-res1[i]) + * if abs(D)>(boxl/2): # <<<<<<<<<<<<<< + * res2[i]-=np.sign(D)*boxl * */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 949, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = (fabs(__pyx_v_D) > (__pyx_v_boxl / 2.0)); + if (__pyx_t_8) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":551 + * D=(res2[i]-res1[i]) + * if abs(D)>(boxl/2): + * res2[i]-=np.sign(D)*boxl # <<<<<<<<<<<<<< * - * cdef inline int import_ufunc() except -1: + * vec[0] = res2[0] - res1[0] */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 950, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 950, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 551, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sign); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_D); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 551, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_boxl); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 551, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 551, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_res2.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_res2.data + __pyx_t_7 * __pyx_v_res2.strides[0]) )) -= __pyx_t_11; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "newanalysis/helpers/miscellaneous.pyx":550 + * for i in range(3): + * D=(res2[i]-res1[i]) + * if abs(D)>(boxl/2): # <<<<<<<<<<<<<< + * res2[i]-=np.sign(D)*boxl * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + } } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") + /* "newanalysis/helpers/miscellaneous.pyx":553 + * res2[i]-=np.sign(D)*boxl * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * vec[0] = res2[0] - res1[0] # <<<<<<<<<<<<<< + * vec[1] = res2[1] - res1[1] + * vec[2] = res2[2] - res1[2] */ + __pyx_t_7 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_res2.shape[0]; + __pyx_t_6 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_res1.shape[0]; + __pyx_t_12 = 0; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_vec.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_vec.data + __pyx_t_12 * __pyx_v_vec.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_res2.data + __pyx_t_7 * __pyx_v_res2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_res1.data + __pyx_t_6 * __pyx_v_res1.strides[0]) )))); - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") + /* "newanalysis/helpers/miscellaneous.pyx":554 * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * vec[0] = res2[0] - res1[0] + * vec[1] = res2[1] - res1[1] # <<<<<<<<<<<<<< + * vec[2] = res2[2] - res1[2] + * return norm(vec) */ + __pyx_t_6 = 1; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_res2.shape[0]; + __pyx_t_7 = 1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_res1.shape[0]; + __pyx_t_12 = 1; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_vec.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_vec.data + __pyx_t_12 * __pyx_v_vec.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_res2.data + __pyx_t_6 * __pyx_v_res2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_res1.data + __pyx_t_7 * __pyx_v_res1.strides[0]) )))); -static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_ufunc", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + /* "newanalysis/helpers/miscellaneous.pyx":555 + * vec[0] = res2[0] - res1[0] + * vec[1] = res2[1] - res1[1] + * vec[2] = res2[2] - res1[2] # <<<<<<<<<<<<<< + * return norm(vec) * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":954 - * cdef inline int import_ufunc() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 954, __pyx_L3_error) + __pyx_t_7 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_res2.shape[0]; + __pyx_t_6 = 2; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_res1.shape[0]; + __pyx_t_12 = 2; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_vec.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_vec.data + __pyx_t_12 * __pyx_v_vec.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_res2.data + __pyx_t_7 * __pyx_v_res2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_res1.data + __pyx_t_6 * __pyx_v_res1.strides[0]) )))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + /* "newanalysis/helpers/miscellaneous.pyx":556 + * vec[1] = res2[1] - res1[1] + * vec[2] = res2[2] - res1[2] + * return norm(vec) # <<<<<<<<<<<<<< + * * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_norm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_vec, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_1}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":955 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") + /* "newanalysis/helpers/miscellaneous.pyx":542 * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 955, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":956 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * - * cdef extern from *: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def min_dist(double[:] res1, double[:] res2, double boxl): + * cdef int i */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 956, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 956, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("newanalysis.miscellaneous.min_dist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vec, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/miscellaneous.pyx":559 * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 + * cdef double [:] rv = np.zeros(3) #distance vector */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_35dipTen(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_35dipTen = {"dipTen", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_35dipTen, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_35dipTen(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coo1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coo2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dipTen (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 559, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coo1,&__pyx_n_s_coo2,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coo1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 559, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coo2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 559, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("dipTen", 1, 2, 2, 1); __PYX_ERR(0, 559, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dipTen") < 0)) __PYX_ERR(0, 559, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_coo1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coo1.memview)) __PYX_ERR(0, 560, __pyx_L3_error) + __pyx_v_coo2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coo2.memview)) __PYX_ERR(0, 560, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dipTen", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 559, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") - * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coo1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coo2, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.dipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_34dipTen(__pyx_self, __pyx_v_coo1, __pyx_v_coo2); /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coo1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coo2, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 - * - * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` - */ - -static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { - int __pyx_r; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_34dipTen(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coo1, __Pyx_memviewslice __pyx_v_coo2) { + __Pyx_memviewslice __pyx_v_rv = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_r2; + double __pyx_v_f1; + double __pyx_v_f2; + __Pyx_memviewslice __pyx_v_dipt = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_timedelta64_object", 0); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + double __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dipTen", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":978 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/miscellaneous.pyx":561 + * @cython.boundscheck(False) + * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 + * cdef double [:] rv = np.zeros(3) #distance vector # <<<<<<<<<<<<<< + * rv[0] = coo2[0] - coo1[0] + * rv[1] = coo2[1] - coo1[1] */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 561, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 561, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 561, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rv = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 - * - * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` + /* "newanalysis/helpers/miscellaneous.pyx":562 + * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 + * cdef double [:] rv = np.zeros(3) #distance vector + * rv[0] = coo2[0] - coo1[0] # <<<<<<<<<<<<<< + * rv[1] = coo2[1] - coo1[1] + * rv[2] = coo2[2] - coo1[2] */ + __pyx_t_6 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coo2.shape[0]; + __pyx_t_7 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coo1.shape[0]; + __pyx_t_8 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_rv.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_8 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_coo2.data + __pyx_t_6 * __pyx_v_coo2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coo1.data + __pyx_t_7 * __pyx_v_coo1.strides[0]) )))); - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * - * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` + /* "newanalysis/helpers/miscellaneous.pyx":563 + * cdef double [:] rv = np.zeros(3) #distance vector + * rv[0] = coo2[0] - coo1[0] + * rv[1] = coo2[1] - coo1[1] # <<<<<<<<<<<<<< + * rv[2] = coo2[2] - coo1[2] + * cdef double r2 = np.dot(rv,rv) #norm squared of rv */ + __pyx_t_7 = 1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coo2.shape[0]; + __pyx_t_6 = 1; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coo1.shape[0]; + __pyx_t_8 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_rv.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_8 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_coo2.data + __pyx_t_7 * __pyx_v_coo2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coo1.data + __pyx_t_6 * __pyx_v_coo1.strides[0]) )))); -static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_datetime64_object", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":993 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/miscellaneous.pyx":564 + * rv[0] = coo2[0] - coo1[0] + * rv[1] = coo2[1] - coo1[1] + * rv[2] = coo2[2] - coo1[2] # <<<<<<<<<<<<<< + * cdef double r2 = np.dot(rv,rv) #norm squared of rv + * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); - goto __pyx_L0; + __pyx_t_6 = 2; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coo2.shape[0]; + __pyx_t_7 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coo1.shape[0]; + __pyx_t_8 = 2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_rv.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_8 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_coo2.data + __pyx_t_6 * __pyx_v_coo2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coo1.data + __pyx_t_7 * __pyx_v_coo1.strides[0]) )))); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * - * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` + /* "newanalysis/helpers/miscellaneous.pyx":565 + * rv[1] = coo2[1] - coo1[1] + * rv[2] = coo2[2] - coo1[2] + * cdef double r2 = np.dot(rv,rv) #norm squared of rv # <<<<<<<<<<<<<< + * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 + * cdef double f2 = 3/r2 #prefactor 2: 3*1/r**2 */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_t_3, __pyx_t_9}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 565, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_r2 = __pyx_t_11; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":566 + * rv[2] = coo2[2] - coo1[2] + * cdef double r2 = np.dot(rv,rv) #norm squared of rv + * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 # <<<<<<<<<<<<<< + * cdef double f2 = 3/r2 #prefactor 2: 3*1/r**2 + * cdef double[:] dipt = np.empty(6,dtype=np.float64) #initialize dipole dipole tensor (xx,yy,zz,xy,xz,yz) + */ + __pyx_v_f1 = pow(__pyx_v_r2, -1.5); -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 - * + /* "newanalysis/helpers/miscellaneous.pyx":567 + * cdef double r2 = np.dot(rv,rv) #norm squared of rv + * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 + * cdef double f2 = 3/r2 #prefactor 2: 3*1/r**2 # <<<<<<<<<<<<<< + * cdef double[:] dipt = np.empty(6,dtype=np.float64) #initialize dipole dipole tensor (xx,yy,zz,xy,xz,yz) * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object */ + if (unlikely(__pyx_v_r2 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 567, __pyx_L1_error) + } + __pyx_v_f2 = (3.0 / __pyx_v_r2); -static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { - npy_datetime __pyx_r; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1003 - * also needed. That can be found using `get_datetime64_unit`. - * """ - * return (obj).obval # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":568 + * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 + * cdef double f2 = 3/r2 #prefactor 2: 3*1/r**2 + * cdef double[:] dipt = np.empty(6,dtype=np.float64) #initialize dipole dipole tensor (xx,yy,zz,xy,xz,yz) # <<<<<<<<<<<<<< * + * dipt[0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements */ - __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 568, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_dipt = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 - * + /* "newanalysis/helpers/miscellaneous.pyx":570 + * cdef double[:] dipt = np.empty(6,dtype=np.float64) #initialize dipole dipole tensor (xx,yy,zz,xy,xz,yz) * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object + * dipt[0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements # <<<<<<<<<<<<<< + * dipt[1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor + * dipt[2]=f1*(rv[2]*rv[2]*f2-1) */ + __pyx_t_7 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_rv.shape[0]; + __pyx_t_6 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; + __pyx_t_8 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dipt.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_8 * __pyx_v_dipt.strides[0]) )) = (__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_7 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0)); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 + /* "newanalysis/helpers/miscellaneous.pyx":571 * - * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object + * dipt[0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements + * dipt[1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor # <<<<<<<<<<<<<< + * dipt[2]=f1*(rv[2]*rv[2]*f2-1) + * dipt[3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice */ + __pyx_t_6 = 1; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; + __pyx_t_7 = 1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_rv.shape[0]; + __pyx_t_8 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dipt.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_8 * __pyx_v_dipt.strides[0]) )) = (__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_7 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0)); -static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { - npy_timedelta __pyx_r; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1010 - * returns the int64 value underlying scalar numpy timedelta64 object - * """ - * return (obj).obval # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/miscellaneous.pyx":572 + * dipt[0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements + * dipt[1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor + * dipt[2]=f1*(rv[2]*rv[2]*f2-1) # <<<<<<<<<<<<<< + * dipt[3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice + * dipt[4]=f1*(rv[0]*rv[2]*f2)*2 */ - __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; + __pyx_t_7 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_rv.shape[0]; + __pyx_t_6 = 2; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; + __pyx_t_8 = 2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dipt.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_8 * __pyx_v_dipt.strides[0]) )) = (__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_7 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0)); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 - * - * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object + /* "newanalysis/helpers/miscellaneous.pyx":573 + * dipt[1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor + * dipt[2]=f1*(rv[2]*rv[2]*f2-1) + * dipt[3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice # <<<<<<<<<<<<<< + * dipt[4]=f1*(rv[0]*rv[2]*f2)*2 + * dipt[5]=f1*(rv[1]*rv[2]*f2)*2 */ + __pyx_t_6 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; + __pyx_t_7 = 1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_rv.shape[0]; + __pyx_t_8 = 3; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dipt.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_8 * __pyx_v_dipt.strides[0]) )) = ((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_7 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":574 + * dipt[2]=f1*(rv[2]*rv[2]*f2-1) + * dipt[3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice + * dipt[4]=f1*(rv[0]*rv[2]*f2)*2 # <<<<<<<<<<<<<< + * dipt[5]=f1*(rv[1]*rv[2]*f2)*2 + * return dipt + */ + __pyx_t_7 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_rv.shape[0]; + __pyx_t_6 = 2; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; + __pyx_t_8 = 4; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dipt.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_8 * __pyx_v_dipt.strides[0]) )) = ((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_7 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0); -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 - * + /* "newanalysis/helpers/miscellaneous.pyx":575 + * dipt[3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice + * dipt[4]=f1*(rv[0]*rv[2]*f2)*2 + * dipt[5]=f1*(rv[1]*rv[2]*f2)*2 # <<<<<<<<<<<<<< + * return dipt * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. */ + __pyx_t_6 = 1; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_rv.shape[0]; + __pyx_t_7 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_rv.shape[0]; + __pyx_t_8 = 5; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dipt.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_dipt.data + __pyx_t_8 * __pyx_v_dipt.strides[0]) )) = ((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_6 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_7 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0); -static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { - NPY_DATETIMEUNIT __pyx_r; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1017 - * returns the unit part of the dtype for a numpy datetime64 object. - * """ - * return (obj).obmeta.base # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":576 + * dipt[4]=f1*(rv[0]*rv[2]*f2)*2 + * dipt[5]=f1*(rv[1]*rv[2]*f2)*2 + * return dipt # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dipt, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 + /* "newanalysis/helpers/miscellaneous.pyx":559 * * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 + * cdef double [:] rv = np.zeros(3) #distance vector */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("newanalysis.miscellaneous.dipTen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rv, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dipt, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * +/* "newanalysis/helpers/miscellaneous.pyx":580 + * @cython.boundscheck(False) + * class selfobject: + * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? # <<<<<<<<<<<<<< + * self.p = p + * self.apr_emim_h = apr_emim_h */ /* Python wrapper */ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_shape = 0; - Py_ssize_t __pyx_v_itemsize; - PyObject *__pyx_v_format = 0; - PyObject *__pyx_v_mode = 0; - int __pyx_v_allocate_buffer; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_10selfobject_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_10selfobject_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_10selfobject_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_10selfobject_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + int __pyx_v_p; + __Pyx_memviewslice __pyx_v_p_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_apr_emim_h; + int __pyx_v_n_pairs_h; + __Pyx_memviewslice __pyx_v_emim_h = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 580, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; - PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_n_s_c); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_p,&__pyx_n_s_p_coor,&__pyx_n_s_apr_emim_h,&__pyx_n_s_n_pairs_h,&__pyx_n_s_emim_h,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_p)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 123, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 1); __PYX_ERR(0, 580, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_p_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 123, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 2); __PYX_ERR(0, 580, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode); - if (value) { values[3] = value; kw_args--; } + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr_emim_h)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 3); __PYX_ERR(0, 580, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer); - if (value) { values[4] = value; kw_args--; } + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_pairs_h)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 4); __PYX_ERR(0, 580, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_emim_h)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 5); __PYX_ERR(0, 580, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 123, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 580, __pyx_L3_error) } - } - __pyx_v_shape = ((PyObject*)values[0]); - __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_v_format = values[2]; - __pyx_v_mode = values[3]; - if (values[4]) { - __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 124, __pyx_L3_error) + } else if (unlikely(__pyx_nargs != 6)) { + goto __pyx_L5_argtuple_error; } else { - - /* "View.MemoryView":124 - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, - * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< - * - * cdef int idx - */ - __pyx_v_allocate_buffer = ((int)1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); } + __pyx_v_self = values[0]; + __pyx_v_p = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_p == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) + __pyx_v_p_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_p_coor.memview)) __PYX_ERR(0, 580, __pyx_L3_error) + __pyx_v_apr_emim_h = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_apr_emim_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) + __pyx_v_n_pairs_h = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_n_pairs_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error) + __pyx_v_emim_h = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_emim_h.memview)) __PYX_ERR(0, 580, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 123, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 580, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_p_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_emim_h, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.selfobject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return -1; + return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 123, __pyx_L1_error) - if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 123, __pyx_L1_error) - } - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); - - /* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * - */ + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_10selfobject___init__(__pyx_self, __pyx_v_self, __pyx_v_p, __pyx_v_p_coor, __pyx_v_apr_emim_h, __pyx_v_n_pairs_h, __pyx_v_emim_h); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_p_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_emim_h, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { - int __pyx_v_idx; - Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_dim; - PyObject **__pyx_v_p; - char __pyx_v_order; - int __pyx_r; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_10selfobject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_p, __Pyx_memviewslice __pyx_v_p_coor, int __pyx_v_apr_emim_h, int __pyx_v_n_pairs_h, __Pyx_memviewslice __pyx_v_emim_h) { + __Pyx_memviewslice __pyx_v_pl = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_i = 0; + PyObject *__pyx_v_j = 0; + PyObject *__pyx_v_index = 0; + __Pyx_memviewslice __pyx_v_rv = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_r2; + double __pyx_v_f1; + double __pyx_v_f2; + __Pyx_memviewslice __pyx_v_r_0 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dipt_0 = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + Py_ssize_t __pyx_t_10; Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + double __pyx_t_14; + PyObject *(*__pyx_t_15)(PyObject *); + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + Py_ssize_t __pyx_t_18; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_format); + __Pyx_RefNannySetupContext("__init__", 0); + + /* "newanalysis/helpers/miscellaneous.pyx":581 + * class selfobject: + * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? + * self.p = p # <<<<<<<<<<<<<< + * self.apr_emim_h = apr_emim_h + * self.emim_h = emim_h + */ + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_p, __pyx_t_1) < 0) __PYX_ERR(0, 581, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":130 - * cdef PyObject **p - * - * self.ndim = len(shape) # <<<<<<<<<<<<<< - * self.itemsize = itemsize - * + /* "newanalysis/helpers/miscellaneous.pyx":582 + * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? + * self.p = p + * self.apr_emim_h = apr_emim_h # <<<<<<<<<<<<<< + * self.emim_h = emim_h + * self.n_pairs_h = n_pairs_h */ - if (unlikely(__pyx_v_shape == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 130, __pyx_L1_error) - } - __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 130, __pyx_L1_error) - __pyx_v_self->ndim = ((int)__pyx_t_1); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 582, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":131 + /* "newanalysis/helpers/miscellaneous.pyx":583 + * self.p = p + * self.apr_emim_h = apr_emim_h + * self.emim_h = emim_h # <<<<<<<<<<<<<< + * self.n_pairs_h = n_pairs_h * - * self.ndim = len(shape) - * self.itemsize = itemsize # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_emim_h, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 583, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":584 + * self.apr_emim_h = apr_emim_h + * self.emim_h = emim_h + * self.n_pairs_h = n_pairs_h # <<<<<<<<<<<<<< * - * if not self.ndim: + * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') */ - __pyx_v_self->itemsize = __pyx_v_itemsize; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h, __pyx_t_1) < 0) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":133 - * self.itemsize = itemsize + /* "newanalysis/helpers/miscellaneous.pyx":586 + * self.n_pairs_h = n_pairs_h * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") + * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< + * cdef i, j, index = 0 * */ - __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0); - if (unlikely(__pyx_t_2)) { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 586, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3)) __PYX_ERR(0, 586, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 586, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 586, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 586, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 586, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 586, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_pl = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":134 + /* "newanalysis/helpers/miscellaneous.pyx":587 * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< + * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') + * cdef i, j, index = 0 # <<<<<<<<<<<<<< * - * if itemsize <= 0: + * cdef double [:] rv = np.zeros(3) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 134, __pyx_L1_error) + __Pyx_INCREF(__pyx_int_0); + __pyx_v_index = __pyx_int_0; - /* "View.MemoryView":133 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") + /* "newanalysis/helpers/miscellaneous.pyx":589 + * cdef i, j, index = 0 * + * cdef double [:] rv = np.zeros(3) # <<<<<<<<<<<<<< + * cdef double r2 + * cdef double f1 */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_int_3}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_rv = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") + /* "newanalysis/helpers/miscellaneous.pyx":594 + * cdef double f2 * + * for i in self.emim_h: # <<<<<<<<<<<<<< + * pl[index, 0] = np.copy(p_coor[i,0]) + * pl[index, 1] = np.copy(p_coor[i,1]) */ - __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 594, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 594, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 594, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 594, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); + __pyx_t_4 = 0; - /* "View.MemoryView":137 - * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":595 * - * if not isinstance(format, bytes): + * for i in self.emim_h: + * pl[index, 0] = np.copy(p_coor[i,0]) # <<<<<<<<<<<<<< + * pl[index, 1] = np.copy(p_coor[i,1]) + * pl[index, 2] = np.copy(p_coor[i,2]) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 137, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 137, __pyx_L1_error) - - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") - * - */ - } + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L1_error) + __pyx_t_11 = __pyx_t_10; + __pyx_t_12 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p_coor.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_p_coor.shape[1]; + __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p_coor.data + __pyx_t_11 * __pyx_v_p_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_p_coor.strides[1]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_3}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L1_error) + __pyx_t_12 = __pyx_t_10; + __pyx_t_11 = 0; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_pl.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_12 * __pyx_v_pl.strides[0]) ) + __pyx_t_11 * __pyx_v_pl.strides[1]) )) = __pyx_t_14; - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") - * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string + /* "newanalysis/helpers/miscellaneous.pyx":596 + * for i in self.emim_h: + * pl[index, 0] = np.copy(p_coor[i,0]) + * pl[index, 1] = np.copy(p_coor[i,1]) # <<<<<<<<<<<<<< + * pl[index, 2] = np.copy(p_coor[i,2]) + * index += 1 */ - __pyx_t_2 = PyBytes_Check(__pyx_v_format); - __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_4) { + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error) + __pyx_t_11 = __pyx_t_10; + __pyx_t_12 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p_coor.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_p_coor.shape[1]; + __pyx_t_2 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p_coor.data + __pyx_t_11 * __pyx_v_p_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_p_coor.strides[1]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_13 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_2}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error) + __pyx_t_12 = __pyx_t_10; + __pyx_t_11 = 1; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_pl.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_12 * __pyx_v_pl.strides[0]) ) + __pyx_t_11 * __pyx_v_pl.strides[1]) )) = __pyx_t_14; - /* "View.MemoryView":140 + /* "newanalysis/helpers/miscellaneous.pyx":597 + * pl[index, 0] = np.copy(p_coor[i,0]) + * pl[index, 1] = np.copy(p_coor[i,1]) + * pl[index, 2] = np.copy(p_coor[i,2]) # <<<<<<<<<<<<<< + * index += 1 * - * if not isinstance(format, bytes): - * format = format.encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format # keep a reference to the byte string - * self.format = self._format */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 597, __pyx_L1_error) + __pyx_t_11 = __pyx_t_10; + __pyx_t_12 = 2; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p_coor.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_p_coor.shape[1]; + __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p_coor.data + __pyx_t_11 * __pyx_v_p_coor.strides[0]) ) + __pyx_t_12 * __pyx_v_p_coor.strides[1]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; } } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); - __pyx_t_3 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_3}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 597, __pyx_L1_error) + __pyx_t_12 = __pyx_t_10; + __pyx_t_11 = 2; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_pl.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_12 * __pyx_v_pl.strides[0]) ) + __pyx_t_11 * __pyx_v_pl.strides[1]) )) = __pyx_t_14; - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") + /* "newanalysis/helpers/miscellaneous.pyx":598 + * pl[index, 1] = np.copy(p_coor[i,1]) + * pl[index, 2] = np.copy(p_coor[i,2]) + * index += 1 # <<<<<<<<<<<<<< * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string + * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') + */ + __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); + __pyx_t_4 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":594 + * cdef double f2 + * + * for i in self.emim_h: # <<<<<<<<<<<<<< + * pl[index, 0] = np.copy(p_coor[i,0]) + * pl[index, 1] = np.copy(p_coor[i,1]) */ } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":141 - * if not isinstance(format, bytes): - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< - * self.format = self._format + /* "newanalysis/helpers/miscellaneous.pyx":600 + * index += 1 * + * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') # <<<<<<<<<<<<<< + * #cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') + * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 600, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_r_0 = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; + + /* "newanalysis/helpers/miscellaneous.pyx":602 + * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') + * #cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') + * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') # <<<<<<<<<<<<<< + * self.r_0 = r_0 + * #self.bin = bins */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 141, __pyx_L1_error) - __pyx_t_3 = __pyx_v_format; - __Pyx_INCREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->_format); - __Pyx_DECREF(__pyx_v_self->_format); - __pyx_v_self->_format = ((PyObject*)__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(0, 602, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_6); + __Pyx_GIVEREF(__pyx_int_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_6)) __PYX_ERR(0, 602, __pyx_L1_error); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 602, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 602, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_dipt_0 = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":142 - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - * self.format = self._format # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":603 + * #cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') + * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') + * self.r_0 = r_0 # <<<<<<<<<<<<<< + * #self.bin = bins * + */ + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_r_0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_r_0, __pyx_t_4) < 0) __PYX_ERR(0, 603, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":606 + * #self.bin = bins * + * index = 0 # <<<<<<<<<<<<<< + * for i in range(self.apr_emim_h-1): + * for j in range((i+1), self.apr_emim_h): */ - if (unlikely(__pyx_v_self->_format == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(2, 142, __pyx_L1_error) + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF_SET(__pyx_v_index, __pyx_int_0); + + /* "newanalysis/helpers/miscellaneous.pyx":607 + * + * index = 0 + * for i in range(self.apr_emim_h-1): # <<<<<<<<<<<<<< + * for j in range((i+1), self.apr_emim_h): + * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 607, __pyx_L1_error) } - __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 142, __pyx_L1_error) - __pyx_v_self->format = __pyx_t_7; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 607, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 607, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 607, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4); + __pyx_t_4 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":608 + * index = 0 + * for i in range(self.apr_emim_h-1): + * for j in range((i+1), self.apr_emim_h): # <<<<<<<<<<<<<< + * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) + * #self.bin[index] = int(self.r_0[index]) + */ + __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4)) __PYX_ERR(0, 608, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0; + __pyx_t_15 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 608, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_15)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 608, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 608, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_15(__pyx_t_1); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 608, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3); + __pyx_t_3 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":609 + * for i in range(self.apr_emim_h-1): + * for j in range((i+1), self.apr_emim_h): + * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) # <<<<<<<<<<<<<< + * #self.bin[index] = int(self.r_0[index]) + * index += 1 + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_norm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_float64); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 609, __pyx_L1_error) + __pyx_t_7.data = __pyx_v_pl.data; + __pyx_t_7.memview = __pyx_v_pl.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_t_18; + Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; +} + +__pyx_t_7.shape[0] = __pyx_v_pl.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_pl.strides[1]; + __pyx_t_7.suboffsets[0] = -1; + +__pyx_t_16 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_19 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_17))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_17); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_17, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_19, __pyx_t_16}; + __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_17, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } + __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_float64); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 609, __pyx_L1_error) + __pyx_t_7.data = __pyx_v_pl.data; + __pyx_t_7.memview = __pyx_v_pl.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_t_18; + Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":145 - * - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< - * self._strides = self._shape + self.ndim - * - */ - __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); +__pyx_t_7.shape[0] = __pyx_v_pl.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_pl.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* "View.MemoryView":146 - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) - * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< - * - * if not self._shape: - */ - __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); +__pyx_t_16 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_20 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_19))) { + __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19); + if (likely(__pyx_t_20)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); + __Pyx_INCREF(__pyx_t_20); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_19, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_20, __pyx_t_16}; + __pyx_t_17 = __Pyx_PyObject_FastCall(__pyx_t_19, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + } + __pyx_t_19 = PyNumber_Subtract(__pyx_t_13, __pyx_t_17); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_17)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_17, __pyx_t_19}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely((PyObject_SetItem(__pyx_t_4, __pyx_v_index, __pyx_t_3) < 0))) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") + /* "newanalysis/helpers/miscellaneous.pyx":611 + * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) + * #self.bin[index] = int(self.r_0[index]) + * index += 1 # <<<<<<<<<<<<<< * + * self.dipt_0 = dipt_0 */ - __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/miscellaneous.pyx":608 + * index = 0 + * for i in range(self.apr_emim_h-1): + * for j in range((i+1), self.apr_emim_h): # <<<<<<<<<<<<<< + * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) + * #self.bin[index] = int(self.r_0[index]) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 149, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") + /* "newanalysis/helpers/miscellaneous.pyx":607 * + * index = 0 + * for i in range(self.apr_emim_h-1): # <<<<<<<<<<<<<< + * for j in range((i+1), self.apr_emim_h): + * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) */ } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":152 - * + /* "newanalysis/helpers/miscellaneous.pyx":613 + * index += 1 * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) + * self.dipt_0 = dipt_0 # <<<<<<<<<<<<<< + * index = 0 + * for i in range(self.apr_emim_h-1): */ - __pyx_t_8 = 0; - __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; - for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 152, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_9; - __pyx_v_idx = __pyx_t_8; - __pyx_t_8 = (__pyx_t_8 + 1); + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dipt_0, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0, __pyx_t_2) < 0) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":153 + /* "newanalysis/helpers/miscellaneous.pyx":614 * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim + * self.dipt_0 = dipt_0 + * index = 0 # <<<<<<<<<<<<<< + * for i in range(self.apr_emim_h-1): + * for j in range((i+1), self.apr_emim_h): */ - __pyx_t_4 = ((__pyx_v_dim <= 0) != 0); - if (unlikely(__pyx_t_4)) { + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF_SET(__pyx_v_index, __pyx_int_0); - /* "View.MemoryView":154 - * for idx, dim in enumerate(shape): - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<< - * self._shape[idx] = dim - * + /* "newanalysis/helpers/miscellaneous.pyx":615 + * self.dipt_0 = dipt_0 + * index = 0 + * for i in range(self.apr_emim_h-1): # <<<<<<<<<<<<<< + * for j in range((i+1), self.apr_emim_h): + * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 154, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 615, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 615, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 615, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 615, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":153 - * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim + /* "newanalysis/helpers/miscellaneous.pyx":616 + * index = 0 + * for i in range(self.apr_emim_h-1): + * for j in range((i+1), self.apr_emim_h): # <<<<<<<<<<<<<< + * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) + * #self.bin[index] = int(self.r_0[index]) */ + __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_10 = 0; + __pyx_t_15 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 616, __pyx_L1_error) } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_15)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 616, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 616, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_15(__pyx_t_4); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 616, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":155 - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":617 + * for i in range(self.apr_emim_h-1): + * for j in range((i+1), self.apr_emim_h): + * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) # <<<<<<<<<<<<<< + * #self.bin[index] = int(self.r_0[index]) * - * cdef char order */ - (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_norm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_float64); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 617, __pyx_L1_error) + __pyx_t_7.data = __pyx_v_pl.data; + __pyx_t_7.memview = __pyx_v_pl.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_t_18; + Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":152 - * - * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +__pyx_t_7.shape[0] = __pyx_v_pl.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_pl.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* "View.MemoryView":158 - * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 158, __pyx_L1_error) - if (__pyx_t_4) { +__pyx_t_17 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_16 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_13); + if (likely(__pyx_t_16)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_16); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_13, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_16, __pyx_t_17}; + __pyx_t_19 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } + __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_float64); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 617, __pyx_L1_error) + __pyx_t_7.data = __pyx_v_pl.data; + __pyx_t_7.memview = __pyx_v_pl.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_t_18; + Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":159 - * cdef char order - * if mode == 'fortran': - * order = b'F' # <<<<<<<<<<<<<< - * self.mode = u'fortran' - * elif mode == 'c': - */ - __pyx_v_order = 'F'; +__pyx_t_7.shape[0] = __pyx_v_pl.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_pl.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* "View.MemoryView":160 - * if mode == 'fortran': - * order = b'F' - * self.mode = u'fortran' # <<<<<<<<<<<<<< - * elif mode == 'c': - * order = b'C' - */ - __Pyx_INCREF(__pyx_n_u_fortran); - __Pyx_GIVEREF(__pyx_n_u_fortran); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_fortran; +__pyx_t_17 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_20 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_16))) { + __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_16); + if (likely(__pyx_t_20)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); + __Pyx_INCREF(__pyx_t_20); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_16, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_20, __pyx_t_17}; + __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_16, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } + __pyx_t_16 = PyNumber_Subtract(__pyx_t_19, __pyx_t_13); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_16}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((PyObject_SetItem(__pyx_t_2, __pyx_v_index, __pyx_t_3) < 0))) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":158 + /* "newanalysis/helpers/miscellaneous.pyx":620 + * #self.bin[index] = int(self.r_0[index]) * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' + * self.dipt_0[index] = dipTen(np.float64(pl[j]), np.float64(pl[i])) # <<<<<<<<<<<<<< + * rv[0] = pl[i,0] - pl[j,0] + * rv[1] = pl[i,1] - pl[j,1] */ - goto __pyx_L10; - } + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_dipTen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_float64); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 620, __pyx_L1_error) + __pyx_t_7.data = __pyx_v_pl.data; + __pyx_t_7.memview = __pyx_v_pl.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_t_18; + Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 161, __pyx_L1_error) - if (likely(__pyx_t_4)) { +__pyx_t_7.shape[0] = __pyx_v_pl.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_pl.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* "View.MemoryView":162 - * self.mode = u'fortran' - * elif mode == 'c': - * order = b'C' # <<<<<<<<<<<<<< - * self.mode = u'c' - * else: - */ - __pyx_v_order = 'C'; +__pyx_t_13 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_17 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_19))) { + __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_19); + if (likely(__pyx_t_17)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_19, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_17, __pyx_t_13}; + __pyx_t_16 = __Pyx_PyObject_FastCall(__pyx_t_19, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + } + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_float64); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 620, __pyx_L1_error) + __pyx_t_7.data = __pyx_v_pl.data; + __pyx_t_7.memview = __pyx_v_pl.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_t_18; + Py_ssize_t __pyx_tmp_shape = __pyx_v_pl.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_pl.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":163 - * elif mode == 'c': - * order = b'C' - * self.mode = u'c' # <<<<<<<<<<<<<< - * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) - */ - __Pyx_INCREF(__pyx_n_u_c); - __Pyx_GIVEREF(__pyx_n_u_c); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_c; +__pyx_t_7.shape[0] = __pyx_v_pl.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_pl.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - goto __pyx_L10; - } +__pyx_t_13 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_20 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_17))) { + __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_17); + if (likely(__pyx_t_20)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); + __Pyx_INCREF(__pyx_t_20); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_17, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_20, __pyx_t_13}; + __pyx_t_19 = __Pyx_PyObject_FastCall(__pyx_t_17, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } + __pyx_t_17 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_17)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_17, __pyx_t_16, __pyx_t_19}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely((PyObject_SetItem(__pyx_t_2, __pyx_v_index, __pyx_t_3) < 0))) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":165 - * self.mode = u'c' - * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":621 * - * self.len = fill_contig_strides_array(self._shape, self._strides, + * self.dipt_0[index] = dipTen(np.float64(pl[j]), np.float64(pl[i])) + * rv[0] = pl[i,0] - pl[j,0] # <<<<<<<<<<<<<< + * rv[1] = pl[i,1] - pl[j,1] + * rv[2] = pl[i,2] - pl[j,2] */ - /*else*/ { - __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 165, __pyx_L1_error) - } - __pyx_L10:; + __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 621, __pyx_L1_error) + __pyx_t_11 = __pyx_t_18; + __pyx_t_12 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_pl.shape[1]; + __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 621, __pyx_L1_error) + __pyx_t_22 = __pyx_t_21; + __pyx_t_23 = 0; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_pl.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_pl.shape[1]; + __pyx_t_24 = 0; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_11 * __pyx_v_pl.strides[0]) ) + __pyx_t_12 * __pyx_v_pl.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_22 * __pyx_v_pl.strides[0]) ) + __pyx_t_23 * __pyx_v_pl.strides[1]) )))); - /* "View.MemoryView":167 - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) - * - * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<< - * itemsize, self.ndim, order) - * + /* "newanalysis/helpers/miscellaneous.pyx":622 + * self.dipt_0[index] = dipTen(np.float64(pl[j]), np.float64(pl[i])) + * rv[0] = pl[i,0] - pl[j,0] + * rv[1] = pl[i,1] - pl[j,1] # <<<<<<<<<<<<<< + * rv[2] = pl[i,2] - pl[j,2] + * r2 = np.dot(rv,rv) #norm squared of rv */ - __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); + __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 622, __pyx_L1_error) + __pyx_t_23 = __pyx_t_21; + __pyx_t_22 = 1; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_pl.shape[0]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_pl.shape[1]; + __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 622, __pyx_L1_error) + __pyx_t_12 = __pyx_t_18; + __pyx_t_11 = 1; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_pl.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[1]; + __pyx_t_24 = 1; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_23 * __pyx_v_pl.strides[0]) ) + __pyx_t_22 * __pyx_v_pl.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_12 * __pyx_v_pl.strides[0]) ) + __pyx_t_11 * __pyx_v_pl.strides[1]) )))); - /* "View.MemoryView":170 - * itemsize, self.ndim, order) - * - * self.free_data = allocate_buffer # <<<<<<<<<<<<<< - * self.dtype_is_object = format == b'O' - * if allocate_buffer: + /* "newanalysis/helpers/miscellaneous.pyx":623 + * rv[0] = pl[i,0] - pl[j,0] + * rv[1] = pl[i,1] - pl[j,1] + * rv[2] = pl[i,2] - pl[j,2] # <<<<<<<<<<<<<< + * r2 = np.dot(rv,rv) #norm squared of rv + * f1 = r2**-1.5 #prefactor 1: 1/r**3 */ - __pyx_v_self->free_data = __pyx_v_allocate_buffer; + __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 623, __pyx_L1_error) + __pyx_t_11 = __pyx_t_18; + __pyx_t_12 = 2; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_pl.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_pl.shape[1]; + __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 623, __pyx_L1_error) + __pyx_t_22 = __pyx_t_21; + __pyx_t_23 = 2; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_pl.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_pl.shape[1]; + __pyx_t_24 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_11 * __pyx_v_pl.strides[0]) ) + __pyx_t_12 * __pyx_v_pl.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_22 * __pyx_v_pl.strides[0]) ) + __pyx_t_23 * __pyx_v_pl.strides[1]) )))); - /* "View.MemoryView":171 - * - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< - * if allocate_buffer: - * + /* "newanalysis/helpers/miscellaneous.pyx":624 + * rv[1] = pl[i,1] - pl[j,1] + * rv[2] = pl[i,2] - pl[j,2] + * r2 = np.dot(rv,rv) #norm squared of rv # <<<<<<<<<<<<<< + * f1 = r2**-1.5 #prefactor 1: 1/r**3 + * f2 = 3/r2 #prefactor 2: 3*1/r**2 */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 171, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 171, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_self->dtype_is_object = __pyx_t_4; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_16 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_17 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_19))) { + __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_19); + if (likely(__pyx_t_17)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_19, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_17, __pyx_t_2, __pyx_t_16}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_19, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + } + __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_r2 = __pyx_t_14; - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":625 + * rv[2] = pl[i,2] - pl[j,2] + * r2 = np.dot(rv,rv) #norm squared of rv + * f1 = r2**-1.5 #prefactor 1: 1/r**3 # <<<<<<<<<<<<<< + * f2 = 3/r2 #prefactor 2: 3*1/r**2 * */ - __pyx_t_4 = (__pyx_v_allocate_buffer != 0); - if (__pyx_t_4) { + __pyx_v_f1 = pow(__pyx_v_r2, -1.5); - /* "View.MemoryView":175 - * + /* "newanalysis/helpers/miscellaneous.pyx":626 + * r2 = np.dot(rv,rv) #norm squared of rv + * f1 = r2**-1.5 #prefactor 1: 1/r**3 + * f2 = 3/r2 #prefactor 2: 3*1/r**2 # <<<<<<<<<<<<<< * - * self.data = malloc(self.len) # <<<<<<<<<<<<<< - * if not self.data: - * raise MemoryError("unable to allocate array data.") + * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements */ - __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + if (unlikely(__pyx_v_r2 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 626, __pyx_L1_error) + } + __pyx_v_f2 = (3.0 / __pyx_v_r2); - /* "View.MemoryView":176 - * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") + /* "newanalysis/helpers/miscellaneous.pyx":628 + * f2 = 3/r2 #prefactor 2: 3*1/r**2 * + * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements # <<<<<<<<<<<<<< + * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor + * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) */ - __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_23 = 0; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_22 = 0; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; + __pyx_t_3 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_index)) __PYX_ERR(0, 628, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_int_0)) __PYX_ERR(0, 628, __pyx_L1_error); + if (unlikely((PyObject_SetItem(__pyx_t_19, __pyx_t_16, __pyx_t_3) < 0))) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":629 * - * if self.dtype_is_object: + * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements + * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor # <<<<<<<<<<<<<< + * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) + * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 177, __pyx_L1_error) + __pyx_t_22 = 1; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; + __pyx_t_23 = 1; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_3 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_index)) __PYX_ERR(0, 629, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_int_1)) __PYX_ERR(0, 629, __pyx_L1_error); + if (unlikely((PyObject_SetItem(__pyx_t_16, __pyx_t_19, __pyx_t_3) < 0))) __PYX_ERR(0, 629, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":176 - * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") - * + /* "newanalysis/helpers/miscellaneous.pyx":630 + * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements + * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor + * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) # <<<<<<<<<<<<<< + * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice + * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 */ - } + __pyx_t_23 = 2; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_22 = 2; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; + __pyx_t_3 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_index)) __PYX_ERR(0, 630, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_int_2)) __PYX_ERR(0, 630, __pyx_L1_error); + if (unlikely((PyObject_SetItem(__pyx_t_19, __pyx_t_16, __pyx_t_3) < 0))) __PYX_ERR(0, 630, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") - * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): + /* "newanalysis/helpers/miscellaneous.pyx":631 + * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor + * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) + * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice # <<<<<<<<<<<<<< + * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 + * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 */ - __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_4) { + __pyx_t_22 = 0; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; + __pyx_t_23 = 1; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 631, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 631, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 631, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_index)) __PYX_ERR(0, 631, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_int_3)) __PYX_ERR(0, 631, __pyx_L1_error); + if (unlikely((PyObject_SetItem(__pyx_t_16, __pyx_t_19, __pyx_t_3) < 0))) __PYX_ERR(0, 631, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":180 + /* "newanalysis/helpers/miscellaneous.pyx":632 + * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) + * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice + * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 # <<<<<<<<<<<<<< + * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 * - * if self.dtype_is_object: - * p = self.data # <<<<<<<<<<<<<< - * for i in range(self.len / itemsize): - * p[i] = Py_None - */ - __pyx_v_p = ((PyObject **)__pyx_v_self->data); - - /* "View.MemoryView":181 - * if self.dtype_is_object: - * p = self.data - * for i in range(self.len / itemsize): # <<<<<<<<<<<<<< - * p[i] = Py_None - * Py_INCREF(Py_None) */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize); - __pyx_t_9 = __pyx_t_1; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + __pyx_t_23 = 0; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_22 = 2; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; + __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_index)) __PYX_ERR(0, 632, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_4); + __Pyx_GIVEREF(__pyx_int_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_int_4)) __PYX_ERR(0, 632, __pyx_L1_error); + if (unlikely((PyObject_SetItem(__pyx_t_19, __pyx_t_16, __pyx_t_3) < 0))) __PYX_ERR(0, 632, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":182 - * p = self.data - * for i in range(self.len / itemsize): - * p[i] = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "newanalysis/helpers/miscellaneous.pyx":633 + * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice + * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 + * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 # <<<<<<<<<<<<<< * + * index += 1 */ - (__pyx_v_p[__pyx_v_i]) = Py_None; + __pyx_t_22 = 1; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rv.shape[0]; + __pyx_t_23 = 2; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_22 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_index)) __PYX_ERR(0, 633, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_5); + __Pyx_GIVEREF(__pyx_int_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_int_5)) __PYX_ERR(0, 633, __pyx_L1_error); + if (unlikely((PyObject_SetItem(__pyx_t_16, __pyx_t_19, __pyx_t_3) < 0))) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":183 - * for i in range(self.len / itemsize): - * p[i] = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":635 + * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 + * + * index += 1 # <<<<<<<<<<<<<< + * * - * @cname('getbuffer') */ - Py_INCREF(Py_None); - } + __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") - * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): + /* "newanalysis/helpers/miscellaneous.pyx":616 + * index = 0 + * for i in range(self.apr_emim_h-1): + * for j in range((i+1), self.apr_emim_h): # <<<<<<<<<<<<<< + * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) + * #self.bin[index] = int(self.r_0[index]) */ } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/miscellaneous.pyx":615 + * self.dipt_0 = dipt_0 + * index = 0 + * for i in range(self.apr_emim_h-1): # <<<<<<<<<<<<<< + * for j in range((i+1), self.apr_emim_h): + * self.r_0[index] = norm(np.float64(pl[j]) - np.float64(pl[i])) */ } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): - * + /* "newanalysis/helpers/miscellaneous.pyx":580 + * @cython.boundscheck(False) + * class selfobject: + * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? # <<<<<<<<<<<<<< + * self.p = p + * self.apr_emim_h = apr_emim_h */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_4); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_AddTraceback("newanalysis.miscellaneous.selfobject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_format); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_pl, 1); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_j); + __Pyx_XDECREF(__pyx_v_index); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rv, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_r_0, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dipt_0, 1); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":186 - * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": +/* "newanalysis/helpers/miscellaneous.pyx":640 + * @cython.boundscheck(False) + * class pairobject: + * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 # <<<<<<<<<<<<<< + * self.p1 = p1 + * self.p2 = p2 */ /* Python wrapper */ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_10pairobject_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_10pairobject_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_10pairobject_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_10pairobject_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + int __pyx_v_p1; + int __pyx_v_p2; + __Pyx_memviewslice __pyx_v_p1_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_p2_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_apr_emim_h; + int __pyx_v_n_pairs_h; + __Pyx_memviewslice __pyx_v_emim_h = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 640, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_p1,&__pyx_n_s_p2,&__pyx_n_s_p1_coor,&__pyx_n_s_p2_coor,&__pyx_n_s_apr_emim_h,&__pyx_n_s_n_pairs_h,&__pyx_n_s_emim_h,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_p1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 1); __PYX_ERR(0, 640, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_p2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 2); __PYX_ERR(0, 640, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_p1_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 3); __PYX_ERR(0, 640, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_p2_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 4); __PYX_ERR(0, 640, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr_emim_h)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 5); __PYX_ERR(0, 640, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_pairs_h)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 6); __PYX_ERR(0, 640, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_emim_h)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, 7); __PYX_ERR(0, 640, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 640, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 8)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + } + __pyx_v_self = values[0]; + __pyx_v_p1 = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_p1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + __pyx_v_p2 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_p2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + __pyx_v_p1_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_p1_coor.memview)) __PYX_ERR(0, 640, __pyx_L3_error) + __pyx_v_p2_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_p2_coor.memview)) __PYX_ERR(0, 640, __pyx_L3_error) + __pyx_v_apr_emim_h = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_apr_emim_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + __pyx_v_n_pairs_h = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_n_pairs_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) + __pyx_v_emim_h = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_emim_h.memview)) __PYX_ERR(0, 640, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 8, 8, __pyx_nargs); __PYX_ERR(0, 640, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_p1_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_p2_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_emim_h, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.pairobject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_10pairobject___init__(__pyx_self, __pyx_v_self, __pyx_v_p1, __pyx_v_p2, __pyx_v_p1_coor, __pyx_v_p2_coor, __pyx_v_apr_emim_h, __pyx_v_n_pairs_h, __pyx_v_emim_h); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_p1_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_p2_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_emim_h, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_bufmode; - int __pyx_r; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_10pairobject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_p1, int __pyx_v_p2, __Pyx_memviewslice __pyx_v_p1_coor, __Pyx_memviewslice __pyx_v_p2_coor, int __pyx_v_apr_emim_h, int __pyx_v_n_pairs_h, __Pyx_memviewslice __pyx_v_emim_h) { + __Pyx_memviewslice __pyx_v_p1l = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_p2l = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_index; + __Pyx_memviewslice __pyx_v_rv = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_r2; + double __pyx_v_f1; + double __pyx_v_f2; + __Pyx_memviewslice __pyx_v_r_0 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_bins = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dipt_0 = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; - Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_4 = NULL; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_t_6; - Py_ssize_t *__pyx_t_7; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + double __pyx_t_13; + __Pyx_memviewslice __pyx_t_14 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + int __pyx_t_19; + PyObject *__pyx_t_20 = NULL; + int __pyx_t_21; + PyObject *__pyx_t_22 = NULL; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":187 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 # <<<<<<<<<<<<<< - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - __pyx_v_bufmode = -1; - - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 188, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":189 - * cdef int bufmode = -1 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - */ - goto __pyx_L3; - } - - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 190, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":191 - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") - */ - __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - */ - } - __pyx_L3:; - - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - */ - __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 193, __pyx_L1_error) - - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - */ - } - - /* "View.MemoryView":194 - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data # <<<<<<<<<<<<<< - * info.len = self.len - * info.ndim = self.ndim - */ - __pyx_t_4 = __pyx_v_self->data; - __pyx_v_info->buf = __pyx_t_4; - - /* "View.MemoryView":195 - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - * info.len = self.len # <<<<<<<<<<<<<< - * info.ndim = self.ndim - * info.shape = self._shape - */ - __pyx_t_5 = __pyx_v_self->len; - __pyx_v_info->len = __pyx_t_5; - - /* "View.MemoryView":196 - * info.buf = self.data - * info.len = self.len - * info.ndim = self.ndim # <<<<<<<<<<<<<< - * info.shape = self._shape - * info.strides = self._strides - */ - __pyx_t_6 = __pyx_v_self->ndim; - __pyx_v_info->ndim = __pyx_t_6; - - /* "View.MemoryView":197 - * info.len = self.len - * info.ndim = self.ndim - * info.shape = self._shape # <<<<<<<<<<<<<< - * info.strides = self._strides - * info.suboffsets = NULL - */ - __pyx_t_7 = __pyx_v_self->_shape; - __pyx_v_info->shape = __pyx_t_7; - - /* "View.MemoryView":198 - * info.ndim = self.ndim - * info.shape = self._shape - * info.strides = self._strides # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = self.itemsize - */ - __pyx_t_7 = __pyx_v_self->_strides; - __pyx_v_info->strides = __pyx_t_7; - - /* "View.MemoryView":199 - * info.shape = self._shape - * info.strides = self._strides - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = self.itemsize - * info.readonly = 0 - */ - __pyx_v_info->suboffsets = NULL; + __Pyx_RefNannySetupContext("__init__", 0); - /* "View.MemoryView":200 - * info.strides = self._strides - * info.suboffsets = NULL - * info.itemsize = self.itemsize # <<<<<<<<<<<<<< - * info.readonly = 0 - * + /* "newanalysis/helpers/miscellaneous.pyx":641 + * class pairobject: + * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 + * self.p1 = p1 # <<<<<<<<<<<<<< + * self.p2 = p2 + * self.apr_emim_h = apr_emim_h */ - __pyx_t_5 = __pyx_v_self->itemsize; - __pyx_v_info->itemsize = __pyx_t_5; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_p1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_p1, __pyx_t_1) < 0) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":201 - * info.suboffsets = NULL - * info.itemsize = self.itemsize - * info.readonly = 0 # <<<<<<<<<<<<<< - * - * if flags & PyBUF_FORMAT: + /* "newanalysis/helpers/miscellaneous.pyx":642 + * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 + * self.p1 = p1 + * self.p2 = p2 # <<<<<<<<<<<<<< + * self.apr_emim_h = apr_emim_h + * self.n_pairs_h = n_pairs_h */ - __pyx_v_info->readonly = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_p2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_p2, __pyx_t_1) < 0) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":203 - * info.readonly = 0 - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format - * else: + /* "newanalysis/helpers/miscellaneous.pyx":643 + * self.p1 = p1 + * self.p2 = p2 + * self.apr_emim_h = apr_emim_h # <<<<<<<<<<<<<< + * self.n_pairs_h = n_pairs_h + * self.emim_h = emim_h */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 643, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":204 + /* "newanalysis/helpers/miscellaneous.pyx":644 + * self.p2 = p2 + * self.apr_emim_h = apr_emim_h + * self.n_pairs_h = n_pairs_h # <<<<<<<<<<<<<< + * self.emim_h = emim_h * - * if flags & PyBUF_FORMAT: - * info.format = self.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL */ - __pyx_t_4 = __pyx_v_self->format; - __pyx_v_info->format = __pyx_t_4; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h, __pyx_t_1) < 0) __PYX_ERR(0, 644, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":203 - * info.readonly = 0 + /* "newanalysis/helpers/miscellaneous.pyx":645 + * self.apr_emim_h = apr_emim_h + * self.n_pairs_h = n_pairs_h + * self.emim_h = emim_h # <<<<<<<<<<<<<< * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format - * else: + * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') */ - goto __pyx_L5; - } + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_emim_h, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":206 - * info.format = self.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":647 + * self.emim_h = emim_h * - * info.obj = self + * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< + * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') + * cdef int i, j, index = 0 */ - /*else*/ { - __pyx_v_info->format = NULL; - } - __pyx_L5:; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3)) __PYX_ERR(0, 647, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 647, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 647, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_p1l = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":208 - * info.format = NULL + /* "newanalysis/helpers/miscellaneous.pyx":648 * - * info.obj = self # <<<<<<<<<<<<<< + * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') + * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< + * cdef int i, j, index = 0 * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3)) __PYX_ERR(0, 648, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 648, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_p2l = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":186 + /* "newanalysis/helpers/miscellaneous.pyx":649 + * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') + * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') + * cdef int i, j, index = 0 # <<<<<<<<<<<<<< * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * cdef double [:] rv = np.zeros(3) #distance vector */ + __pyx_v_index = 0; - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + /* "newanalysis/helpers/miscellaneous.pyx":651 + * cdef int i, j, index = 0 + * + * cdef double [:] rv = np.zeros(3) #distance vector # <<<<<<<<<<<<<< + * cdef double r2 + * cdef double f1 + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 651, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_int_3}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 651, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 651, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_rv = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; -/* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + /* "newanalysis/helpers/miscellaneous.pyx":656 + * cdef double f2 * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) + * for i in self.emim_h: # <<<<<<<<<<<<<< + * p1l[index,0] = np.copy(p1_coor[i,0]) + * p1l[index,1] = np.copy(p1_coor[i,1]) */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_emim_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 656, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 656, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 656, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_9(__pyx_t_4); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 656, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_i = __pyx_t_6; -/* Python wrapper */ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":213 + /* "newanalysis/helpers/miscellaneous.pyx":657 * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: - */ - __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":214 - * def __dealloc__(array self): - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) # <<<<<<<<<<<<<< - * elif self.free_data: - * if self.dtype_is_object: + * for i in self.emim_h: + * p1l[index,0] = np.copy(p1_coor[i,0]) # <<<<<<<<<<<<<< + * p1l[index,1] = np.copy(p1_coor[i,1]) + * p1l[index,2] = np.copy(p1_coor[i,2]) */ - __pyx_v_self->callback_free_data(__pyx_v_self->data); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 657, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 0; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1_coor.shape[1]; + __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1_coor.data + __pyx_t_10 * __pyx_v_p1_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p1_coor.strides[1]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 657, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 657, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __pyx_v_index; + __pyx_t_10 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1l.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_11 * __pyx_v_p1l.strides[0]) ) + __pyx_t_10 * __pyx_v_p1l.strides[1]) )) = __pyx_t_13; - /* "View.MemoryView":213 + /* "newanalysis/helpers/miscellaneous.pyx":658 + * for i in self.emim_h: + * p1l[index,0] = np.copy(p1_coor[i,0]) + * p1l[index,1] = np.copy(p1_coor[i,1]) # <<<<<<<<<<<<<< + * p1l[index,2] = np.copy(p1_coor[i,2]) * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, - */ - __pyx_t_1 = (__pyx_v_self->free_data != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) - */ - __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":217 - * elif self.free_data: - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< - * self._strides, self.ndim, False) - * free(self.data) - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); - - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1_coor.shape[1]; + __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1_coor.data + __pyx_t_10 * __pyx_v_p1_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p1_coor.strides[1]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __pyx_v_index; + __pyx_t_10 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1l.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_11 * __pyx_v_p1l.strides[0]) ) + __pyx_t_10 * __pyx_v_p1l.strides[1]) )) = __pyx_t_13; - /* "View.MemoryView":219 - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) - * free(self.data) # <<<<<<<<<<<<<< - * PyObject_Free(self._shape) + /* "newanalysis/helpers/miscellaneous.pyx":659 + * p1l[index,0] = np.copy(p1_coor[i,0]) + * p1l[index,1] = np.copy(p1_coor[i,1]) + * p1l[index,2] = np.copy(p1_coor[i,2]) # <<<<<<<<<<<<<< * + * p2l[index,0] = np.copy(p2_coor[i,0]) */ - free(__pyx_v_self->data); - - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, - */ - } - __pyx_L3:; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 2; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1_coor.shape[1]; + __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1_coor.data + __pyx_t_10 * __pyx_v_p1_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p1_coor.strides[1]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __pyx_v_index; + __pyx_t_10 = 2; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1l.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_11 * __pyx_v_p1l.strides[0]) ) + __pyx_t_10 * __pyx_v_p1l.strides[1]) )) = __pyx_t_13; - /* "View.MemoryView":220 - * self._strides, self.ndim, False) - * free(self.data) - * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":661 + * p1l[index,2] = np.copy(p1_coor[i,2]) * - * @property + * p2l[index,0] = np.copy(p2_coor[i,0]) # <<<<<<<<<<<<<< + * p2l[index,1] = np.copy(p2_coor[i,1]) + * p2l[index,2] = np.copy(p2_coor[i,2]) */ - PyObject_Free(__pyx_v_self->_shape); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 0; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2_coor.shape[1]; + __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2_coor.data + __pyx_t_10 * __pyx_v_p2_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p2_coor.strides[1]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 661, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __pyx_v_index; + __pyx_t_10 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2l.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_11 * __pyx_v_p2l.strides[0]) ) + __pyx_t_10 * __pyx_v_p2l.strides[1]) )) = __pyx_t_13; - /* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + /* "newanalysis/helpers/miscellaneous.pyx":662 * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) + * p2l[index,0] = np.copy(p2_coor[i,0]) + * p2l[index,1] = np.copy(p2_coor[i,1]) # <<<<<<<<<<<<<< + * p2l[index,2] = np.copy(p2_coor[i,2]) + * index += 1 */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 1; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2_coor.shape[1]; + __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2_coor.data + __pyx_t_10 * __pyx_v_p2_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p2_coor.strides[1]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __pyx_v_index; + __pyx_t_10 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2l.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_11 * __pyx_v_p2l.strides[0]) ) + __pyx_t_10 * __pyx_v_p2l.strides[1]) )) = __pyx_t_13; - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":223 - * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() + /* "newanalysis/helpers/miscellaneous.pyx":663 + * p2l[index,0] = np.copy(p2_coor[i,0]) + * p2l[index,1] = np.copy(p2_coor[i,1]) + * p2l[index,2] = np.copy(p2_coor[i,2]) # <<<<<<<<<<<<<< + * index += 1 * */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 2; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2_coor.shape[1]; + __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2_coor.data + __pyx_t_10 * __pyx_v_p2_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_p2_coor.strides[1]) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 663, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __pyx_v_index; + __pyx_t_10 = 2; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2l.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_11 * __pyx_v_p2l.strides[0]) ) + __pyx_t_10 * __pyx_v_p2l.strides[1]) )) = __pyx_t_13; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":224 - * @property - * def memview(self): - * return self.get_memview() # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":664 + * p2l[index,1] = np.copy(p2_coor[i,1]) + * p2l[index,2] = np.copy(p2_coor[i,2]) + * index += 1 # <<<<<<<<<<<<<< * - * @cname('get_memview') + * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_index = (__pyx_v_index + 1); - /* "View.MemoryView":223 - * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() + /* "newanalysis/helpers/miscellaneous.pyx":656 + * cdef double f2 * + * for i in self.emim_h: # <<<<<<<<<<<<<< + * p1l[index,0] = np.copy(p1_coor[i,0]) + * p1l[index,1] = np.copy(p1_coor[i,1]) */ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":227 + /* "newanalysis/helpers/miscellaneous.pyx":666 + * index += 1 * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) + * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') # <<<<<<<<<<<<<< + * cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') + * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 666, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 666, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_r_0 = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_memview", 0); - - /* "View.MemoryView":228 - * @cname('get_memview') - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< - * return memoryview(self, flags, self.dtype_is_object) + /* "newanalysis/helpers/miscellaneous.pyx":667 * + * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') + * cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') # <<<<<<<<<<<<<< + * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') + * self.r_0 = r_0 */ - __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_int32) < 0) __PYX_ERR(0, 667, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(0, 667, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_bins = __pyx_t_14; + __pyx_t_14.memview = NULL; + __pyx_t_14.data = NULL; - /* "View.MemoryView":229 - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< - * - * def __len__(self): + /* "newanalysis/helpers/miscellaneous.pyx":668 + * cdef double [:] r_0 = np.zeros(self.n_pairs_h, dtype='float64') + * cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') + * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') # <<<<<<<<<<<<<< + * self.r_0 = r_0 + * self.bin = bins */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 229, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 668, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_6); + __Pyx_GIVEREF(__pyx_int_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_6)) __PYX_ERR(0, 668, __pyx_L1_error); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 668, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":227 - * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_dipt_0 = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; -/* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":669 + * cdef int [:] bins = np.zeros(self.n_pairs_h, dtype='int32') + * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') + * self.r_0 = r_0 # <<<<<<<<<<<<<< + * self.bin = bins * */ + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_r_0, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_r_0, __pyx_t_4) < 0) __PYX_ERR(0, 669, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; -/* Python wrapper */ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); - - /* "View.MemoryView":232 - * - * def __len__(self): - * return self._shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":670 + * cdef double [:,:] dipt_0 = np.zeros((self.n_pairs_h, 6), dtype='float64') + * self.r_0 = r_0 + * self.bin = bins # <<<<<<<<<<<<<< * - * def __getattr__(self, attr): + * index = 0 */ - __pyx_r = (__pyx_v_self->_shape[0]); - goto __pyx_L0; + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_bins, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 670, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bin, __pyx_t_4) < 0) __PYX_ERR(0, 670, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":672 + * self.bin = bins * + * index = 0 # <<<<<<<<<<<<<< + * for i in range(self.apr_emim_h): + * for j in range(i, self.apr_emim_h): */ + __pyx_v_index = 0; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":234 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) + /* "newanalysis/helpers/miscellaneous.pyx":673 * + * index = 0 + * for i in range(self.apr_emim_h): # <<<<<<<<<<<<<< + * for j in range(i, self.apr_emim_h): + * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 673, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_15 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_15 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_16; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; -/* Python wrapper */ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getattr__", 0); - - /* "View.MemoryView":235 - * - * def __getattr__(self, attr): - * return getattr(self.memview, attr) # <<<<<<<<<<<<<< - * - * def __getitem__(self, item): + /* "newanalysis/helpers/miscellaneous.pyx":674 + * index = 0 + * for i in range(self.apr_emim_h): + * for j in range(i, self.apr_emim_h): # <<<<<<<<<<<<<< + * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) + * self.bin[index] = int(self.r_0[index]) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_17 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_17 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 674, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = __pyx_v_i; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; - /* "View.MemoryView":234 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) - * + /* "newanalysis/helpers/miscellaneous.pyx":675 + * for i in range(self.apr_emim_h): + * for j in range(i, self.apr_emim_h): + * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) # <<<<<<<<<<<<<< + * self.bin[index] = int(self.r_0[index]) + * index += 1 */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_norm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7.data = __pyx_v_p2l.data; + __pyx_t_7.memview = __pyx_v_p2l.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_j; + Py_ssize_t __pyx_tmp_shape = __pyx_v_p2l.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_p2l.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; } -/* "View.MemoryView":237 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * - */ - -/* Python wrapper */ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); +__pyx_t_7.shape[0] = __pyx_v_p2l.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_p2l.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; +__pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_20 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_12))) { + __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_12); + if (likely(__pyx_t_20)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); + __Pyx_INCREF(__pyx_t_20); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_12, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_20, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_21, 1+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7.data = __pyx_v_p1l.data; + __pyx_t_7.memview = __pyx_v_p1l.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_i; + Py_ssize_t __pyx_tmp_shape = __pyx_v_p1l.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_p1l.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; } -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "View.MemoryView":238 - * - * def __getitem__(self, item): - * return self.memview[item] # <<<<<<<<<<<<<< - * - * def __setitem__(self, item, value): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":237 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * - */ +__pyx_t_7.shape[0] = __pyx_v_p1l.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_p1l.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} +__pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_22 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_20))) { + __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_20); + if (likely(__pyx_t_22)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20); + __Pyx_INCREF(__pyx_t_22); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_20, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_t_3}; + __pyx_t_12 = __Pyx_PyObject_FastCall(__pyx_t_20, __pyx_callargs+1-__pyx_t_21, 1+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + } + __pyx_t_20 = PyNumber_Subtract(__pyx_t_2, __pyx_t_12); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_20}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_21, 1+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, __pyx_v_index, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0))) __PYX_ERR(0, 675, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; -/* "View.MemoryView":240 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value + /* "newanalysis/helpers/miscellaneous.pyx":676 + * for j in range(i, self.apr_emim_h): + * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) + * self.bin[index] = int(self.r_0[index]) # <<<<<<<<<<<<<< + * index += 1 * */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, __pyx_v_index, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0))) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; -/* Python wrapper */ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); + /* "newanalysis/helpers/miscellaneous.pyx":677 + * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) + * self.bin[index] = int(self.r_0[index]) + * index += 1 # <<<<<<<<<<<<<< + * + * ################ + */ + __pyx_v_index = (__pyx_v_index + 1); + } + } - /* "View.MemoryView":241 + /* "newanalysis/helpers/miscellaneous.pyx":683 + * #self.dipt_0 = dipt_0 + * ################# COMMIT 5: UNCOMMENT ABOVE, COMMENT BELOW + * self.dipt_0 = dipt_0 # <<<<<<<<<<<<<< * - * def __setitem__(self, item, value): - * self.memview[item] = value # <<<<<<<<<<<<<< + * index = 0 + */ + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_dipt_0, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0, __pyx_t_4) < 0) __PYX_ERR(0, 683, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":685 + * self.dipt_0 = dipt_0 * + * index = 0 # <<<<<<<<<<<<<< * + * for i in range(self.apr_emim_h): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 241, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_index = 0; - /* "View.MemoryView":240 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value + /* "newanalysis/helpers/miscellaneous.pyx":687 + * index = 0 * + * for i in range(self.apr_emim_h): # <<<<<<<<<<<<<< + * for j in range(i, self.apr_emim_h): + * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_15 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_15 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_16; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":688 + * + * for i in range(self.apr_emim_h): + * for j in range(i, self.apr_emim_h): # <<<<<<<<<<<<<< + * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) + * self.bin[index] = int(self.r_0[index]) + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_17 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_17 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = __pyx_v_i; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/helpers/miscellaneous.pyx":689 + * for i in range(self.apr_emim_h): + * for j in range(i, self.apr_emim_h): + * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) # <<<<<<<<<<<<<< + * self.bin[index] = int(self.r_0[index]) + * */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_norm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_7.data = __pyx_v_p2l.data; + __pyx_t_7.memview = __pyx_v_p2l.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_j; + Py_ssize_t __pyx_tmp_shape = __pyx_v_p2l.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_p2l.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; +} -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); +__pyx_t_7.shape[0] = __pyx_v_p2l.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_p2l.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; +__pyx_t_12 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_3 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_12}; + __pyx_t_20 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_21, 1+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_7.data = __pyx_v_p1l.data; + __pyx_t_7.memview = __pyx_v_p1l.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_i; + Py_ssize_t __pyx_tmp_shape = __pyx_v_p1l.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_p1l.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; } -static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); +__pyx_t_7.shape[0] = __pyx_v_p1l.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_p1l.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) +__pyx_t_12 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_22 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_22)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_22); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_t_12}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_21, 1+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_3 = PyNumber_Subtract(__pyx_t_20, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_21, 1+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, __pyx_v_index, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0))) __PYX_ERR(0, 689, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/helpers/miscellaneous.pyx":690 + * for j in range(i, self.apr_emim_h): + * self.r_0[index] = norm(np.float64(p2l[j]) - np.float64(p1l[i])) + * self.bin[index] = int(self.r_0[index]) # <<<<<<<<<<<<<< + * + * self.dipt_0[index] = dipTen(np.float64(p1l[j]), np.float64(p2l[i])) */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_r_0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, __pyx_v_index, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0))) __PYX_ERR(0, 690, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/miscellaneous.pyx":692 + * self.bin[index] = int(self.r_0[index]) + * + * self.dipt_0[index] = dipTen(np.float64(p1l[j]), np.float64(p2l[i])) # <<<<<<<<<<<<<< + * rv[0] = p2l[i,0] - p1l[j,0] + * rv[1] = p2l[i,1] - p1l[j,1] */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_dipTen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7.data = __pyx_v_p1l.data; + __pyx_t_7.memview = __pyx_v_p1l.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_j; + Py_ssize_t __pyx_tmp_shape = __pyx_v_p1l.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_p1l.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; +} -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); +__pyx_t_7.shape[0] = __pyx_v_p1l.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_p1l.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; +__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_12 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_20))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_20); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_20, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_2}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_20, __pyx_callargs+1-__pyx_t_21, 1+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + } + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7.data = __pyx_v_p2l.data; + __pyx_t_7.memview = __pyx_v_p2l.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_i; + Py_ssize_t __pyx_tmp_shape = __pyx_v_p2l.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_p2l.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; } -static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); +__pyx_t_7.shape[0] = __pyx_v_p2l.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_p2l.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< +__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + __pyx_t_22 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_12))) { + __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_12); + if (likely(__pyx_t_22)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); + __Pyx_INCREF(__pyx_t_22); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_12, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_t_2}; + __pyx_t_20 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_21, 1+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __pyx_t_12 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_t_3, __pyx_t_20}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_21, 2+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, __pyx_v_index, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0))) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":693 + * + * self.dipt_0[index] = dipTen(np.float64(p1l[j]), np.float64(p2l[i])) + * rv[0] = p2l[i,0] - p1l[j,0] # <<<<<<<<<<<<<< + * rv[1] = p2l[i,1] - p1l[j,1] + * rv[2] = p2l[i,2] - p1l[j,2] */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 0; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2l.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2l.shape[1]; + __pyx_t_23 = __pyx_v_j; + __pyx_t_24 = 0; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_p1l.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_p1l.shape[1]; + __pyx_t_25 = 0; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rv.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_25 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_10 * __pyx_v_p2l.strides[0]) ) + __pyx_t_11 * __pyx_v_p2l.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_23 * __pyx_v_p1l.strides[0]) ) + __pyx_t_24 * __pyx_v_p1l.strides[1]) )))); - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/miscellaneous.pyx":694 + * self.dipt_0[index] = dipTen(np.float64(p1l[j]), np.float64(p2l[i])) + * rv[0] = p2l[i,0] - p1l[j,0] + * rv[1] = p2l[i,1] - p1l[j,1] # <<<<<<<<<<<<<< + * rv[2] = p2l[i,2] - p1l[j,2] + * r2 = np.dot(rv,rv) #norm squared of rv */ + __pyx_t_24 = __pyx_v_i; + __pyx_t_23 = 1; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_p2l.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_p2l.shape[1]; + __pyx_t_11 = __pyx_v_j; + __pyx_t_10 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p1l.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p1l.shape[1]; + __pyx_t_25 = 1; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rv.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_25 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_24 * __pyx_v_p2l.strides[0]) ) + __pyx_t_23 * __pyx_v_p2l.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_11 * __pyx_v_p1l.strides[0]) ) + __pyx_t_10 * __pyx_v_p1l.strides[1]) )))); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":695 + * rv[0] = p2l[i,0] - p1l[j,0] + * rv[1] = p2l[i,1] - p1l[j,1] + * rv[2] = p2l[i,2] - p1l[j,2] # <<<<<<<<<<<<<< + * r2 = np.dot(rv,rv) #norm squared of rv + * f1 = r2**-1.5 #prefactor 1: 1/r**3 + */ + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 2; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_p2l.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_p2l.shape[1]; + __pyx_t_23 = __pyx_v_j; + __pyx_t_24 = 2; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_p1l.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_p1l.shape[1]; + __pyx_t_25 = 2; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rv.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_25 * __pyx_v_rv.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_10 * __pyx_v_p2l.strides[0]) ) + __pyx_t_11 * __pyx_v_p2l.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_23 * __pyx_v_p1l.strides[0]) ) + __pyx_t_24 * __pyx_v_p1l.strides[1]) )))); -/* "View.MemoryView":245 - * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + /* "newanalysis/helpers/miscellaneous.pyx":696 + * rv[1] = p2l[i,1] - p1l[j,1] + * rv[2] = p2l[i,2] - p1l[j,2] + * r2 = np.dot(rv,rv) #norm squared of rv # <<<<<<<<<<<<<< + * f1 = r2**-1.5 #prefactor 1: 1/r**3 + * f2 = 3/r2 #prefactor 2: 3*1/r**2 */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dot); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_rv, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = NULL; + __pyx_t_21 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_20))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_20); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_20, function); + __pyx_t_21 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_t_1, __pyx_t_3}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_20, __pyx_callargs+1-__pyx_t_21, 2+__pyx_t_21); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + } + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_r2 = __pyx_t_13; -static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) { - struct __pyx_array_obj *__pyx_v_result = 0; - struct __pyx_array_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("array_cwrapper", 0); + /* "newanalysis/helpers/miscellaneous.pyx":697 + * rv[2] = p2l[i,2] - p1l[j,2] + * r2 = np.dot(rv,rv) #norm squared of rv + * f1 = r2**-1.5 #prefactor 1: 1/r**3 # <<<<<<<<<<<<<< + * f2 = 3/r2 #prefactor 2: 3*1/r**2 + * + */ + __pyx_v_f1 = pow(__pyx_v_r2, -1.5); - /* "View.MemoryView":249 - * cdef array result + /* "newanalysis/helpers/miscellaneous.pyx":698 + * r2 = np.dot(rv,rv) #norm squared of rv + * f1 = r2**-1.5 #prefactor 1: 1/r**3 + * f2 = 3/r2 #prefactor 2: 3*1/r**2 # <<<<<<<<<<<<<< * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: + * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements */ - __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); - if (__pyx_t_1) { + if (unlikely(__pyx_v_r2 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 698, __pyx_L1_error) + } + __pyx_v_f2 = (3.0 / __pyx_v_r2); - /* "View.MemoryView":250 + /* "newanalysis/helpers/miscellaneous.pyx":700 + * f2 = 3/r2 #prefactor 2: 3*1/r**2 * - * if buf == NULL: - * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<< - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), + * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements # <<<<<<<<<<<<<< + * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor + * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_24 = 0; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; + __pyx_t_23 = 0; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_4 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 700, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 700, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0)) __PYX_ERR(0, 700, __pyx_L1_error); + __pyx_t_3 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_20, __pyx_t_1, __pyx_t_4) < 0))) __PYX_ERR(0, 700, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":249 - * cdef array result + /* "newanalysis/helpers/miscellaneous.pyx":701 * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: + * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements + * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor # <<<<<<<<<<<<<< + * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) + * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice */ - goto __pyx_L3; - } + __pyx_t_23 = 1; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_24 = 1; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; + __pyx_t_4 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 701, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 701, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 701, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_20); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_20)) __PYX_ERR(0, 701, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1)) __PYX_ERR(0, 701, __pyx_L1_error); + __pyx_t_20 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_4) < 0))) __PYX_ERR(0, 701, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":702 + * self.dipt_0[index,0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements + * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor + * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) # <<<<<<<<<<<<<< + * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice + * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 + */ + __pyx_t_24 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; + __pyx_t_23 = 2; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_4 = PyFloat_FromDouble((__pyx_v_f1 * ((((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2) - 1.0))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_1)) __PYX_ERR(0, 702, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_int_2)) __PYX_ERR(0, 702, __pyx_L1_error); + __pyx_t_1 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_3, __pyx_t_20, __pyx_t_4) < 0))) __PYX_ERR(0, 702, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf + /* "newanalysis/helpers/miscellaneous.pyx":703 + * self.dipt_0[index,1]=f1*(rv[1]*rv[1]*f2-1) #minus 1 in definition of dipole dipole tensor + * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) + * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice # <<<<<<<<<<<<<< + * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 + * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 */ - /*else*/ { - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_3 = 0; + __pyx_t_23 = 0; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_24 = 1; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; + __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 703, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3)) __PYX_ERR(0, 703, __pyx_L1_error); + __pyx_t_3 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_20, __pyx_t_1, __pyx_t_4) < 0))) __PYX_ERR(0, 703, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":253 - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) # <<<<<<<<<<<<<< - * result.data = buf + /* "newanalysis/helpers/miscellaneous.pyx":704 + * self.dipt_0[index,2]=f1*(rv[2]*rv[2]*f2-1) + * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice + * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 # <<<<<<<<<<<<<< + * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 253, __pyx_L1_error) - - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf - */ - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_t_24 = 0; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; + __pyx_t_23 = 2; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_20); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_20)) __PYX_ERR(0, 704, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_4); + __Pyx_GIVEREF(__pyx_int_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_4)) __PYX_ERR(0, 704, __pyx_L1_error); + __pyx_t_20 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_4) < 0))) __PYX_ERR(0, 704, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":254 - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) - * result.data = buf # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":705 + * self.dipt_0[index,3]=f1*(rv[0]*rv[1]*f2)*2 #times 2 because off diag elements appear twice + * self.dipt_0[index,4]=f1*(rv[0]*rv[2]*f2)*2 + * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 # <<<<<<<<<<<<<< * - * return result + * index += 1 */ - __pyx_v_result->data = __pyx_v_buf; - } - __pyx_L3:; + __pyx_t_23 = 1; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rv.shape[0]; + __pyx_t_24 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rv.shape[0]; + __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_f1 * (((*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_23 * __pyx_v_rv.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_rv.data + __pyx_t_24 * __pyx_v_rv.strides[0]) )))) * __pyx_v_f2)) * 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 705, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 705, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 705, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_5); + __Pyx_GIVEREF(__pyx_int_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_int_5)) __PYX_ERR(0, 705, __pyx_L1_error); + __pyx_t_1 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_3, __pyx_t_20, __pyx_t_4) < 0))) __PYX_ERR(0, 705, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":256 - * result.data = buf - * - * return result # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":707 + * self.dipt_0[index,5]=f1*(rv[1]*rv[2]*f2)*2 * + * index += 1 # <<<<<<<<<<<<<< + * ################# * */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = __pyx_v_result; - goto __pyx_L0; + __pyx_v_index = (__pyx_v_index + 1); + } + } - /* "View.MemoryView":245 - * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + /* "newanalysis/helpers/miscellaneous.pyx":640 + * @cython.boundscheck(False) + * class pairobject: + * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 # <<<<<<<<<<<<<< + * self.p1 = p1 + * self.p2 = p2 */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_XDECREF(__pyx_t_12); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_14, 1); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_AddTraceback("newanalysis.miscellaneous.pairobject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF((PyObject *)__pyx_r); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_p1l, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_p2l, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rv, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_r_0, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_bins, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dipt_0, 1); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): +/* "newanalysis/helpers/miscellaneous.pyx":712 + * @cython.boundscheck(False) + * class noe_task: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): + * self.apr_emim_h = apr_emim_h */ /* Python wrapper */ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_8noe_task_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_8noe_task_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_8noe_task_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_8noe_task_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + int __pyx_v_apr_emim_h; + __Pyx_memviewslice __pyx_v_emim_h = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_n_pairs_h; + int __pyx_v_n_self_pairs_h; + int __pyx_v_max_distance; + int __pyx_v_n_res_emim; + int __pyx_v_apr_pair; + __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 712, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_apr_emim_h,&__pyx_n_s_emim_h,&__pyx_n_s_n_pairs_h,&__pyx_n_s_n_self_pairs_h,&__pyx_n_s_max_distance,&__pyx_n_s_n_res_emim,&__pyx_n_s_apr_pair,&__pyx_n_s_coors,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L3_error) else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr_emim_h)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 1); __PYX_ERR(0, 712, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_emim_h)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 2); __PYX_ERR(0, 712, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_pairs_h)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 3); __PYX_ERR(0, 712, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_self_pairs_h)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 4); __PYX_ERR(0, 712, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_distance)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 5); __PYX_ERR(0, 712, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n_res_emim)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 6); __PYX_ERR(0, 712, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr_pair)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 7); __PYX_ERR(0, 712, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coors)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, 8); __PYX_ERR(0, 712, __pyx_L3_error) + } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 282, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 712, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + } else if (unlikely(__pyx_nargs != 9)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); } - __pyx_v_name = values[0]; + __pyx_v_self = values[0]; + __pyx_v_apr_emim_h = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_apr_emim_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) + __pyx_v_emim_h = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_emim_h.memview)) __PYX_ERR(0, 713, __pyx_L3_error) + __pyx_v_n_pairs_h = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_n_pairs_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) + __pyx_v_n_self_pairs_h = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_n_self_pairs_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) + __pyx_v_max_distance = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_max_distance == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) + __pyx_v_n_res_emim = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_n_res_emim == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) + __pyx_v_apr_pair = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_apr_pair == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L3_error) + __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 713, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 282, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); - - /* "View.MemoryView":283 - * cdef object name - * def __init__(self, name): - * self.name = name # <<<<<<<<<<<<<< - * def __repr__(self): - * return self.name - */ - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __Pyx_GOTREF(__pyx_v_self->name); - __Pyx_DECREF(__pyx_v_self->name); - __pyx_v_self->name = __pyx_v_name; - - /* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): - */ - - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * - */ - -/* Python wrapper */ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "View.MemoryView":285 - * self.name = name - * def __repr__(self): - * return self.name # <<<<<<<<<<<<<< - * - * cdef generic = Enum("") - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->name); - __pyx_r = __pyx_v_self->name; - goto __pyx_L0; - - /* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self.name,) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_self->name); - __Pyx_GIVEREF(__pyx_v_self->name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); - __pyx_v_state = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) - */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v__dict = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - __pyx_t_2 = (__pyx_v__dict != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); - __pyx_t_4 = 0; - - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self.name is not None - */ - __pyx_v_use_setstate = 1; - - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - goto __pyx_L3; - } - - /* "(tree fragment)":11 - * use_setstate = True - * else: - * use_setstate = self.name is not None # <<<<<<<<<<<<<< - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - */ - /*else*/ { - __pyx_t_3 = (__pyx_v_self->name != Py_None); - __pyx_v_use_setstate = __pyx_t_3; - } - __pyx_L3:; - - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: - */ - __pyx_t_3 = (__pyx_v_use_setstate != 0); - if (__pyx_t_3) { - - /* "(tree fragment)":13 - * use_setstate = self.name is not None - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<< - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); - __pyx_t_4 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: - */ - } - - /* "(tree fragment)":15 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v__dict); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 9, 9, __pyx_nargs); __PYX_ERR(0, 712, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_emim_h, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.noe_task.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_8noe_task___init__(__pyx_self, __pyx_v_self, __pyx_v_apr_emim_h, __pyx_v_emim_h, __pyx_v_n_pairs_h, __pyx_v_n_self_pairs_h, __pyx_v_max_distance, __pyx_v_n_res_emim, __pyx_v_apr_pair, __pyx_v_coors); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_emim_h, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_8noe_task___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_apr_emim_h, __Pyx_memviewslice __pyx_v_emim_h, int __pyx_v_n_pairs_h, int __pyx_v_n_self_pairs_h, int __pyx_v_max_distance, int __pyx_v_n_res_emim, int __pyx_v_apr_pair, __Pyx_memviewslice __pyx_v_coors) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_atom; + __Pyx_memviewslice __pyx_v_coor_i = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor_j = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + PyObject *__pyx_t_21 = NULL; + int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_t_25; + PyObject *__pyx_t_26 = NULL; + PyObject *__pyx_t_27 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "(tree fragment)":17 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":714 + * @cython.boundscheck(False) + * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): + * self.apr_emim_h = apr_emim_h # <<<<<<<<<<<<<< + * self.emim_h = emim_h + * self.n_pairs_h = n_pairs_h */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 714, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) + /* "newanalysis/helpers/miscellaneous.pyx":715 + * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): + * self.apr_emim_h = apr_emim_h + * self.emim_h = emim_h # <<<<<<<<<<<<<< + * self.n_pairs_h = n_pairs_h + * self.max_distance = max_distance */ + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_emim_h, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_emim_h, __pyx_t_1) < 0) __PYX_ERR(0, 715, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":716 + * self.apr_emim_h = apr_emim_h + * self.emim_h = emim_h + * self.n_pairs_h = n_pairs_h # <<<<<<<<<<<<<< + * self.max_distance = max_distance + * self.pairlist = [] + */ + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h, __pyx_t_1) < 0) __PYX_ERR(0, 716, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -/* "View.MemoryView":299 - * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + /* "newanalysis/helpers/miscellaneous.pyx":717 + * self.emim_h = emim_h + * self.n_pairs_h = n_pairs_h + * self.max_distance = max_distance # <<<<<<<<<<<<<< + * self.pairlist = [] + * self.selflist = [] */ + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_max_distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_max_distance, __pyx_t_1) < 0) __PYX_ERR(0, 717, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) { - Py_intptr_t __pyx_v_aligned_p; - size_t __pyx_v_offset; - void *__pyx_r; - int __pyx_t_1; + /* "newanalysis/helpers/miscellaneous.pyx":718 + * self.n_pairs_h = n_pairs_h + * self.max_distance = max_distance + * self.pairlist = [] # <<<<<<<<<<<<<< + * self.selflist = [] + * self.n_self_pairs_h = n_self_pairs_h + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pairlist, __pyx_t_1) < 0) __PYX_ERR(0, 718, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":301 - * cdef void *align_pointer(void *memory, size_t alignment) nogil: - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<< - * cdef size_t offset + /* "newanalysis/helpers/miscellaneous.pyx":719 + * self.max_distance = max_distance + * self.pairlist = [] + * self.selflist = [] # <<<<<<<<<<<<<< + * self.n_self_pairs_h = n_self_pairs_h * */ - __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_selflist, __pyx_t_1) < 0) __PYX_ERR(0, 719, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":305 - * - * with cython.cdivision(True): - * offset = aligned_p % alignment # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":720 + * self.pairlist = [] + * self.selflist = [] + * self.n_self_pairs_h = n_self_pairs_h # <<<<<<<<<<<<<< * - * if offset > 0: + * cdef int i, j, atom */ - __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_self_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 720, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_n_self_pairs_h, __pyx_t_1) < 0) __PYX_ERR(0, 720, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":307 - * offset = aligned_p % alignment + /* "newanalysis/helpers/miscellaneous.pyx":723 * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset + * cdef int i, j, atom + * cdef double [:,:] coor_i = np.zeros((apr_pair, 3), dtype='float64') # <<<<<<<<<<<<<< + * cdef double [:,:] coor_j = np.zeros((apr_pair, 3), dtype='float64') * */ - __pyx_t_1 = ((__pyx_v_offset > 0) != 0); - if (__pyx_t_1) { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_apr_pair); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3)) __PYX_ERR(0, 723, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 723, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_coor_i = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; + + /* "newanalysis/helpers/miscellaneous.pyx":724 + * cdef int i, j, atom + * cdef double [:,:] coor_i = np.zeros((apr_pair, 3), dtype='float64') + * cdef double [:,:] coor_j = np.zeros((apr_pair, 3), dtype='float64') # <<<<<<<<<<<<<< + * + * for i in range(n_res_emim): + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_apr_pair); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3)) __PYX_ERR(0, 724, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 724, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_coor_j = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":308 + /* "newanalysis/helpers/miscellaneous.pyx":726 + * cdef double [:,:] coor_j = np.zeros((apr_pair, 3), dtype='float64') * - * if offset > 0: - * aligned_p += alignment - offset # <<<<<<<<<<<<<< + * for i in range(n_res_emim): # <<<<<<<<<<<<<< + * for atom in range(apr_pair): + * coor_i[atom, 0] = coors[i, atom, 0] + */ + __pyx_t_6 = __pyx_v_n_res_emim; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; + + /* "newanalysis/helpers/miscellaneous.pyx":727 * - * return aligned_p + * for i in range(n_res_emim): + * for atom in range(apr_pair): # <<<<<<<<<<<<<< + * coor_i[atom, 0] = coors[i, atom, 0] + * coor_i[atom, 1] = coors[i, atom, 1] + */ + __pyx_t_9 = __pyx_v_apr_pair; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_atom = __pyx_t_11; + + /* "newanalysis/helpers/miscellaneous.pyx":728 + * for i in range(n_res_emim): + * for atom in range(apr_pair): + * coor_i[atom, 0] = coors[i, atom, 0] # <<<<<<<<<<<<<< + * coor_i[atom, 1] = coors[i, atom, 1] + * coor_i[atom, 2] = coors[i, atom, 2] + */ + __pyx_t_12 = __pyx_v_i; + __pyx_t_13 = __pyx_v_atom; + __pyx_t_14 = 0; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[2]; + __pyx_t_15 = __pyx_v_atom; + __pyx_t_16 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_15 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_16 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_12 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_14 * __pyx_v_coors.strides[2]) ))); + + /* "newanalysis/helpers/miscellaneous.pyx":729 + * for atom in range(apr_pair): + * coor_i[atom, 0] = coors[i, atom, 0] + * coor_i[atom, 1] = coors[i, atom, 1] # <<<<<<<<<<<<<< + * coor_i[atom, 2] = coors[i, atom, 2] + * self.selflist.append(selfobject(i, coor_i, apr_emim_h, n_self_pairs_h, emim_h)) */ - __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset)); + __pyx_t_14 = __pyx_v_i; + __pyx_t_13 = __pyx_v_atom; + __pyx_t_12 = 1; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[2]; + __pyx_t_16 = __pyx_v_atom; + __pyx_t_15 = 1; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_16 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_15 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_14 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_12 * __pyx_v_coors.strides[2]) ))); - /* "View.MemoryView":307 - * offset = aligned_p % alignment + /* "newanalysis/helpers/miscellaneous.pyx":730 + * coor_i[atom, 0] = coors[i, atom, 0] + * coor_i[atom, 1] = coors[i, atom, 1] + * coor_i[atom, 2] = coors[i, atom, 2] # <<<<<<<<<<<<<< + * self.selflist.append(selfobject(i, coor_i, apr_emim_h, n_self_pairs_h, emim_h)) * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset + */ + __pyx_t_12 = __pyx_v_i; + __pyx_t_13 = __pyx_v_atom; + __pyx_t_14 = 2; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[2]; + __pyx_t_15 = __pyx_v_atom; + __pyx_t_16 = 2; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_15 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_16 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_12 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_14 * __pyx_v_coors.strides[2]) ))); + } + + /* "newanalysis/helpers/miscellaneous.pyx":731 + * coor_i[atom, 1] = coors[i, atom, 1] + * coor_i[atom, 2] = coors[i, atom, 2] + * self.selflist.append(selfobject(i, coor_i, apr_emim_h, n_self_pairs_h, emim_h)) # <<<<<<<<<<<<<< * + * for i in range(n_res_emim): */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_selflist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_selfobject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_17 = __pyx_memoryview_fromslice(__pyx_v_coor_i, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_apr_emim_h); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_n_self_pairs_h); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_20 = __pyx_memoryview_fromslice(__pyx_v_emim_h, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_21 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_21)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_21); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[6] = {__pyx_t_21, __pyx_t_3, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_9, 5+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_22 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_22 == ((int)-1))) __PYX_ERR(0, 731, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "View.MemoryView":310 - * aligned_p += alignment - offset + /* "newanalysis/helpers/miscellaneous.pyx":733 + * self.selflist.append(selfobject(i, coor_i, apr_emim_h, n_self_pairs_h, emim_h)) * - * return aligned_p # <<<<<<<<<<<<<< + * for i in range(n_res_emim): # <<<<<<<<<<<<<< + * for j in range((i+1), n_res_emim): + * for atom in range(apr_pair): + */ + __pyx_t_6 = __pyx_v_n_res_emim; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; + + /* "newanalysis/helpers/miscellaneous.pyx":734 * + * for i in range(n_res_emim): + * for j in range((i+1), n_res_emim): # <<<<<<<<<<<<<< + * for atom in range(apr_pair): + * coor_i[atom, 0] = coors[i, atom, 0] + */ + __pyx_t_9 = __pyx_v_n_res_emim; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = (__pyx_v_i + 1); __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_j = __pyx_t_11; + + /* "newanalysis/helpers/miscellaneous.pyx":735 + * for i in range(n_res_emim): + * for j in range((i+1), n_res_emim): + * for atom in range(apr_pair): # <<<<<<<<<<<<<< + * coor_i[atom, 0] = coors[i, atom, 0] + * coor_i[atom, 1] = coors[i, atom, 1] + */ + __pyx_t_23 = __pyx_v_apr_pair; + __pyx_t_24 = __pyx_t_23; + for (__pyx_t_25 = 0; __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) { + __pyx_v_atom = __pyx_t_25; + + /* "newanalysis/helpers/miscellaneous.pyx":736 + * for j in range((i+1), n_res_emim): + * for atom in range(apr_pair): + * coor_i[atom, 0] = coors[i, atom, 0] # <<<<<<<<<<<<<< + * coor_i[atom, 1] = coors[i, atom, 1] + * coor_i[atom, 2] = coors[i, atom, 2] + */ + __pyx_t_14 = __pyx_v_i; + __pyx_t_13 = __pyx_v_atom; + __pyx_t_12 = 0; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[2]; + __pyx_t_16 = __pyx_v_atom; + __pyx_t_15 = 0; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_16 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_15 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_14 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_12 * __pyx_v_coors.strides[2]) ))); + + /* "newanalysis/helpers/miscellaneous.pyx":737 + * for atom in range(apr_pair): + * coor_i[atom, 0] = coors[i, atom, 0] + * coor_i[atom, 1] = coors[i, atom, 1] # <<<<<<<<<<<<<< + * coor_i[atom, 2] = coors[i, atom, 2] * */ - __pyx_r = ((void *)__pyx_v_aligned_p); - goto __pyx_L0; + __pyx_t_12 = __pyx_v_i; + __pyx_t_13 = __pyx_v_atom; + __pyx_t_14 = 1; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[2]; + __pyx_t_15 = __pyx_v_atom; + __pyx_t_16 = 1; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_15 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_16 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_12 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_14 * __pyx_v_coors.strides[2]) ))); + + /* "newanalysis/helpers/miscellaneous.pyx":738 + * coor_i[atom, 0] = coors[i, atom, 0] + * coor_i[atom, 1] = coors[i, atom, 1] + * coor_i[atom, 2] = coors[i, atom, 2] # <<<<<<<<<<<<<< + * + * coor_j[atom, 0] = coors[j, atom, 0] + */ + __pyx_t_14 = __pyx_v_i; + __pyx_t_13 = __pyx_v_atom; + __pyx_t_12 = 2; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[2]; + __pyx_t_16 = __pyx_v_atom; + __pyx_t_15 = 2; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_i.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_i.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_i.data + __pyx_t_16 * __pyx_v_coor_i.strides[0]) ) + __pyx_t_15 * __pyx_v_coor_i.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_14 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_12 * __pyx_v_coors.strides[2]) ))); + + /* "newanalysis/helpers/miscellaneous.pyx":740 + * coor_i[atom, 2] = coors[i, atom, 2] + * + * coor_j[atom, 0] = coors[j, atom, 0] # <<<<<<<<<<<<<< + * coor_j[atom, 1] = coors[j, atom, 1] + * coor_j[atom, 2] = coors[j, atom, 2] + */ + __pyx_t_12 = __pyx_v_j; + __pyx_t_13 = __pyx_v_atom; + __pyx_t_14 = 0; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[2]; + __pyx_t_15 = __pyx_v_atom; + __pyx_t_16 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_j.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_j.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_j.data + __pyx_t_15 * __pyx_v_coor_j.strides[0]) ) + __pyx_t_16 * __pyx_v_coor_j.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_12 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_14 * __pyx_v_coors.strides[2]) ))); - /* "View.MemoryView":299 + /* "newanalysis/helpers/miscellaneous.pyx":741 * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + * coor_j[atom, 0] = coors[j, atom, 0] + * coor_j[atom, 1] = coors[j, atom, 1] # <<<<<<<<<<<<<< + * coor_j[atom, 2] = coors[j, atom, 2] + * self.pairlist.append(pairobject(i, j, coor_i, coor_j, apr_emim_h, n_pairs_h, emim_h)) + */ + __pyx_t_14 = __pyx_v_j; + __pyx_t_13 = __pyx_v_atom; + __pyx_t_12 = 1; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[2]; + __pyx_t_16 = __pyx_v_atom; + __pyx_t_15 = 1; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_j.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_j.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_j.data + __pyx_t_16 * __pyx_v_coor_j.strides[0]) ) + __pyx_t_15 * __pyx_v_coor_j.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_14 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_12 * __pyx_v_coors.strides[2]) ))); + + /* "newanalysis/helpers/miscellaneous.pyx":742 + * coor_j[atom, 0] = coors[j, atom, 0] + * coor_j[atom, 1] = coors[j, atom, 1] + * coor_j[atom, 2] = coors[j, atom, 2] # <<<<<<<<<<<<<< + * self.pairlist.append(pairobject(i, j, coor_i, coor_j, apr_emim_h, n_pairs_h, emim_h)) + * #print("Pairs: ", len(self.pairlist), "Should be 499500") + */ + __pyx_t_12 = __pyx_v_j; + __pyx_t_13 = __pyx_v_atom; + __pyx_t_14 = 2; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coors.shape[1]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[2]; + __pyx_t_15 = __pyx_v_atom; + __pyx_t_16 = 2; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor_j.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor_j.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_j.data + __pyx_t_15 * __pyx_v_coor_j.strides[0]) ) + __pyx_t_16 * __pyx_v_coor_j.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_12 * __pyx_v_coors.strides[0]) ) + __pyx_t_13 * __pyx_v_coors.strides[1]) ) + __pyx_t_14 * __pyx_v_coors.strides[2]) ))); + } + + /* "newanalysis/helpers/miscellaneous.pyx":743 + * coor_j[atom, 1] = coors[j, atom, 1] + * coor_j[atom, 2] = coors[j, atom, 2] + * self.pairlist.append(pairobject(i, j, coor_i, coor_j, apr_emim_h, n_pairs_h, emim_h)) # <<<<<<<<<<<<<< + * #print("Pairs: ", len(self.pairlist), "Should be 499500") + * #exit() + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pairlist); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pairobject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_coor_i, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_17 = __pyx_memoryview_fromslice(__pyx_v_coor_j, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_apr_emim_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_n_pairs_h); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_26 = __pyx_memoryview_fromslice(__pyx_v_emim_h, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_26); + __pyx_t_27 = NULL; + __pyx_t_23 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_27 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_27)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_27); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_23 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[8] = {__pyx_t_27, __pyx_t_20, __pyx_t_19, __pyx_t_18, __pyx_t_17, __pyx_t_3, __pyx_t_21, __pyx_t_26}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_23, 7+__pyx_t_23); + __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_22 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_22 == ((int)-1))) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + } + + /* "newanalysis/helpers/miscellaneous.pyx":712 + * @cython.boundscheck(False) + * class noe_task: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): + * self.apr_emim_h = apr_emim_h */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_26); + __Pyx_XDECREF(__pyx_t_27); + __Pyx_AddTraceback("newanalysis.miscellaneous.noe_task.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_i, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_j, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo +/* "newanalysis/helpers/miscellaneous.pyx":748 * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def pairiter(self, double [:,:,:] run): + * cdef double [:,:] cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #rename: cl->correlationlist */ /* Python wrapper */ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_obj = 0; - int __pyx_v_flags; - int __pyx_v_dtype_is_object; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_8noe_task_3pairiter(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_8noe_task_3pairiter = {"pairiter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_8noe_task_3pairiter, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_8noe_task_3pairiter(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + __Pyx_memviewslice __pyx_v_run = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + __Pyx_RefNannySetupContext("pairiter (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 748, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_run,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 748, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 346, __pyx_L3_error) + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_run)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object); - if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 748, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("pairiter", 1, 2, 2, 1); __PYX_ERR(0, 748, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 346, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pairiter") < 0)) __PYX_ERR(0, 748, __pyx_L3_error) } - } - __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) - if (values[2]) { - __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; } else { - __pyx_v_dtype_is_object = ((int)0); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } + __pyx_v_self = values[0]; + __pyx_v_run = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_run.memview)) __PYX_ERR(0, 749, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 346, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("pairiter", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 748, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_run, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.noe_task.pairiter", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return -1; + return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_8noe_task_2pairiter(__pyx_self, __pyx_v_self, __pyx_v_run); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_run, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { - int __pyx_r; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_8noe_task_2pairiter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, __Pyx_memviewslice __pyx_v_run) { + __Pyx_memviewslice __pyx_v_cl = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dipt_t = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_p1l = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_p2l = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_cl_self = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dipt_t_self = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_pl = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_i; + int __pyx_v_index; + CYTHON_UNUSED __Pyx_memviewslice __pyx_v_rv = { 0, 0, { 0 }, { 0 }, { 0 } }; + CYTHON_UNUSED __Pyx_memviewslice __pyx_v_distvec = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_selfobj = NULL; + PyObject *__pyx_v_dipt_0_self = NULL; + PyObject *__pyx_v_pair = NULL; + PyObject *__pyx_v_dipt_0 = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + int __pyx_t_19; + long __pyx_t_20; + long __pyx_t_21; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; + double __pyx_t_24; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "View.MemoryView":347 - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj # <<<<<<<<<<<<<< - * self.flags = flags - * if type(self) is memoryview or obj is not None: - */ - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - __Pyx_GOTREF(__pyx_v_self->obj); - __Pyx_DECREF(__pyx_v_self->obj); - __pyx_v_self->obj = __pyx_v_obj; - - /* "View.MemoryView":348 - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj - * self.flags = flags # <<<<<<<<<<<<<< - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - */ - __pyx_v_self->flags = __pyx_v_flags; - - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - */ - __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_3 = (__pyx_v_obj != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { + __Pyx_RefNannySetupContext("pairiter", 0); - /* "View.MemoryView":350 - * self.flags = flags - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None + /* "newanalysis/helpers/miscellaneous.pyx":750 + * @cython.boundscheck(False) + * def pairiter(self, double [:,:,:] run): + * cdef double [:,:] cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #rename: cl->correlationlist # <<<<<<<<<<<<<< + * #cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW + * cdef double [:,:] dipt_t = np.zeros((self.n_pairs_h, 6), dtype='float64') */ - __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 350, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_max_distance); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 750, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 750, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_cl = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) + /* "newanalysis/helpers/miscellaneous.pyx":752 + * cdef double [:,:] cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #rename: cl->correlationlist + * #cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW + * cdef double [:,:] dipt_t = np.zeros((self.n_pairs_h, 6), dtype='float64') # <<<<<<<<<<<<<< + * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') + * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') */ - __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); - if (__pyx_t_1) { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_6); + __Pyx_GIVEREF(__pyx_int_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_6)) __PYX_ERR(0, 752, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3)) __PYX_ERR(0, 752, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 752, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_dipt_t = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":352 - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "newanalysis/helpers/miscellaneous.pyx":753 + * #cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW + * cdef double [:,:] dipt_t = np.zeros((self.n_pairs_h, 6), dtype='float64') + * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< + * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') * */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3)) __PYX_ERR(0, 753, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 753, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_p1l = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":353 - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":754 + * cdef double [:,:] dipt_t = np.zeros((self.n_pairs_h, 6), dtype='float64') + * cdef double [:,:] p1l = np.zeros((self.apr_emim_h, 3), dtype='float64') + * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - */ - Py_INCREF(Py_None); - - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) - */ - } - - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: + * cdef double [:] cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #Add bin information? */ - } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_3)) __PYX_ERR(0, 754, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 754, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 754, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_p2l = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":355 - * Py_INCREF(Py_None) + /* "newanalysis/helpers/miscellaneous.pyx":756 + * cdef double [:,:] p2l = np.zeros((self.apr_emim_h, 3), dtype='float64') * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - */ - __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":358 - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - */ - __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - - /* "View.MemoryView":359 - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); - - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - } - - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":361 - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< - * if self.lock is NULL: - * raise MemoryError + * cdef double [:] cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #Add bin information? # <<<<<<<<<<<<<< + * #cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW + * cdef double [:,:] dipt_t_self = np.zeros((self.n_self_pairs_h, 6), dtype='float64') */ - __pyx_v_self->lock = PyThread_allocate_lock(); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_self_pairs_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 756, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_cl_self = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError + /* "newanalysis/helpers/miscellaneous.pyx":758 + * cdef double [:] cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #Add bin information? + * #cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW + * cdef double [:,:] dipt_t_self = np.zeros((self.n_self_pairs_h, 6), dtype='float64') # <<<<<<<<<<<<<< + * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') * */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (unlikely(__pyx_t_1)) { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_self_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_6); + __Pyx_GIVEREF(__pyx_int_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_6)) __PYX_ERR(0, 758, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 758, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 758, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_dipt_t_self = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":363 - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - * raise MemoryError # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":759 + * #cl_self = np.zeros(self.n_self_pairs_h, dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW + * cdef double [:,:] dipt_t_self = np.zeros((self.n_self_pairs_h, 6), dtype='float64') + * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') # <<<<<<<<<<<<<< * - * if flags & PyBUF_FORMAT: + * cdef int i, j, index = 0 */ - PyErr_NoMemory(); __PYX_ERR(2, 363, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3)) __PYX_ERR(0, 759, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 759, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 759, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_pl = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError + /* "newanalysis/helpers/miscellaneous.pyx":761 + * cdef double [:,:] pl = np.zeros((self.apr_emim_h, 3), dtype='float64') + * + * cdef int i, j, index = 0 # <<<<<<<<<<<<<< + * #cdef int [:] local_emim_h = np.int32(self.emim_h) #COMMIT 4: UNCOMMENT * */ - } + __pyx_v_index = 0; - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: + /* "newanalysis/helpers/miscellaneous.pyx":764 + * #cdef int [:] local_emim_h = np.int32(self.emim_h) #COMMIT 4: UNCOMMENT + * + * cdef double [:] rv = np.zeros(3) #distance vector # <<<<<<<<<<<<<< + * cdef double r2 + * cdef double f1 */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_7 = 1; } - - /* "View.MemoryView":355 - * Py_INCREF(Py_None) - * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - */ } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_int_3}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 764, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_rv = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "View.MemoryView":365 - * raise MemoryError + /* "newanalysis/helpers/miscellaneous.pyx":768 + * cdef double f1 + * cdef double f2 + * cdef double [:] distvec = np.zeros(3, dtype='float64') # <<<<<<<<<<<<<< + * cdef double dist_sq, dist_2, dist_3 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 768, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__12, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 768, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_distvec = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "View.MemoryView":366 + /* "newanalysis/helpers/miscellaneous.pyx":771 + * cdef double dist_sq, dist_2, dist_3 + * + * for selfobj in self.selflist: # <<<<<<<<<<<<<< + * index = 0 * - * if flags & PyBUF_FORMAT: - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< - * else: - * self.dtype_is_object = dtype_is_object */ - __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_selflist); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 771, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 771, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 771, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L12_bool_binop_done; + __pyx_t_1 = __pyx_t_9(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 771, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L12_bool_binop_done:; - __pyx_v_self->dtype_is_object = __pyx_t_1; + __Pyx_XDECREF_SET(__pyx_v_selfobj, __pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":365 - * raise MemoryError + /* "newanalysis/helpers/miscellaneous.pyx":772 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - */ - goto __pyx_L11; - } - - /* "View.MemoryView":368 - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * for selfobj in self.selflist: + * index = 0 # <<<<<<<<<<<<<< * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( + * for i in self.emim_h: */ - /*else*/ { - __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; - } - __pyx_L11:; + __pyx_v_index = 0; - /* "View.MemoryView":370 - * self.dtype_is_object = dtype_is_object + /* "newanalysis/helpers/miscellaneous.pyx":774 + * index = 0 * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<< - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL + * for i in self.emim_h: # <<<<<<<<<<<<<< + * pl[index, 0] = run[selfobj.p][i,0] + * pl[index, 1] = run[selfobj.p][i,1] */ - __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int)))); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 774, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 774, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 774, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_11(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 774, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_i = __pyx_t_7; - /* "View.MemoryView":372 - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":775 * - * def __dealloc__(memoryview self): + * for i in self.emim_h: + * pl[index, 0] = run[selfobj.p][i,0] # <<<<<<<<<<<<<< + * pl[index, 1] = run[selfobj.p][i,1] + * pl[index, 2] = run[selfobj.p][i,2] */ - __pyx_v_self->typeinfo = NULL; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_selfobj, __pyx_n_s_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 775, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = __pyx_t_12; + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = 0; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_run.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_run.shape[1]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_run.shape[2]; + __pyx_t_16 = __pyx_v_index; + __pyx_t_17 = 0; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_pl.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_pl.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_16 * __pyx_v_pl.strides[0]) ) + __pyx_t_17 * __pyx_v_pl.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_13 * __pyx_v_run.strides[0]) ) + __pyx_t_14 * __pyx_v_run.strides[1]) ) + __pyx_t_15 * __pyx_v_run.strides[2]) ))); - /* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags + /* "newanalysis/helpers/miscellaneous.pyx":776 + * for i in self.emim_h: + * pl[index, 0] = run[selfobj.p][i,0] + * pl[index, 1] = run[selfobj.p][i,1] # <<<<<<<<<<<<<< + * pl[index, 2] = run[selfobj.p][i,2] + * index += 1 */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_selfobj, __pyx_n_s_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_15 = __pyx_t_12; + __pyx_t_14 = __pyx_v_i; + __pyx_t_13 = 1; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_run.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_run.shape[1]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_run.shape[2]; + __pyx_t_17 = __pyx_v_index; + __pyx_t_16 = 1; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_pl.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_pl.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_17 * __pyx_v_pl.strides[0]) ) + __pyx_t_16 * __pyx_v_pl.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_15 * __pyx_v_run.strides[0]) ) + __pyx_t_14 * __pyx_v_run.strides[1]) ) + __pyx_t_13 * __pyx_v_run.strides[2]) ))); - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":374 - * self.typeinfo = NULL + /* "newanalysis/helpers/miscellaneous.pyx":777 + * pl[index, 0] = run[selfobj.p][i,0] + * pl[index, 1] = run[selfobj.p][i,1] + * pl[index, 2] = run[selfobj.p][i,2] # <<<<<<<<<<<<<< + * index += 1 * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_selfobj, __pyx_n_s_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = __pyx_t_12; + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = 2; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_run.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_run.shape[1]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_run.shape[2]; + __pyx_t_16 = __pyx_v_index; + __pyx_t_17 = 2; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_pl.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_pl.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_16 * __pyx_v_pl.strides[0]) ) + __pyx_t_17 * __pyx_v_pl.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_13 * __pyx_v_run.strides[0]) ) + __pyx_t_14 * __pyx_v_run.strides[1]) ) + __pyx_t_15 * __pyx_v_run.strides[2]) ))); -/* Python wrapper */ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { - int __pyx_v_i; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyThread_type_lock __pyx_t_6; - PyThread_type_lock __pyx_t_7; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":375 + /* "newanalysis/helpers/miscellaneous.pyx":778 + * pl[index, 1] = run[selfobj.p][i,1] + * pl[index, 2] = run[selfobj.p][i,2] + * index += 1 # <<<<<<<<<<<<<< * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * dipten_double_loop_(&pl[0,0], &pl[0,0], &dipt_t_self[0,0], self.apr_emim_h-1, self.apr_emim_h, 1) */ - __pyx_t_1 = (__pyx_v_self->obj != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_v_index = (__pyx_v_index + 1); - /* "View.MemoryView":376 - * def __dealloc__(memoryview self): - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< - * elif (<__pyx_buffer *> &self.view).obj == Py_None: + /* "newanalysis/helpers/miscellaneous.pyx":774 + * index = 0 * + * for i in self.emim_h: # <<<<<<<<<<<<<< + * pl[index, 0] = run[selfobj.p][i,0] + * pl[index, 1] = run[selfobj.p][i,1] */ - __Pyx_ReleaseBuffer((&__pyx_v_self->view)); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":375 + /* "newanalysis/helpers/miscellaneous.pyx":780 + * index += 1 * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * dipten_double_loop_(&pl[0,0], &pl[0,0], &dipt_t_self[0,0], self.apr_emim_h-1, self.apr_emim_h, 1) # <<<<<<<<<<<<<< + * dipt_0_self = selfobj.dipt_0 * - * (<__pyx_buffer *> &self.view).obj = NULL */ - __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0); - if (__pyx_t_2) { + __pyx_t_15 = 0; + __pyx_t_14 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_pl.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_pl.shape[1]; + __pyx_t_13 = 0; + __pyx_t_17 = 0; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_pl.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_pl.shape[1]; + __pyx_t_16 = 0; + __pyx_t_18 = 0; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_dipt_t_self.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_dipt_t_self.shape[1]; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + dipten_double_loop_((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_15 * __pyx_v_pl.strides[0]) ) + __pyx_t_14 * __pyx_v_pl.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_pl.data + __pyx_t_13 * __pyx_v_pl.strides[0]) ) + __pyx_t_17 * __pyx_v_pl.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipt_t_self.data + __pyx_t_16 * __pyx_v_dipt_t_self.strides[0]) ) + __pyx_t_18 * __pyx_v_dipt_t_self.strides[1]) )))), __pyx_t_7, __pyx_t_19, 1); - /* "View.MemoryView":379 - * elif (<__pyx_buffer *> &self.view).obj == Py_None: + /* "newanalysis/helpers/miscellaneous.pyx":781 * - * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< - * Py_DECREF(Py_None) + * dipten_double_loop_(&pl[0,0], &pl[0,0], &dipt_t_self[0,0], self.apr_emim_h-1, self.apr_emim_h, 1) + * dipt_0_self = selfobj.dipt_0 # <<<<<<<<<<<<<< * + * for i in range(self.n_self_pairs_h): */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_selfobj, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_dipt_0_self, __pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":380 - * - * (<__pyx_buffer *> &self.view).obj = NULL - * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":783 + * dipt_0_self = selfobj.dipt_0 * - * cdef int i - */ - Py_DECREF(Py_None); - - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * for i in range(self.n_self_pairs_h): # <<<<<<<<<<<<<< + * cl_self[i] += np.dot(dipt_0_self[i], dipt_t_self[i]) * - * (<__pyx_buffer *> &self.view).obj = NULL - */ - } - __pyx_L3:; - - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - */ - __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":385 - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - */ - __pyx_t_3 = __pyx_memoryview_thread_locks_used; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - */ - __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":387 - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); - - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) */ - __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":390 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< - * break - * else: - */ - __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]); - - /* "View.MemoryView":389 - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break - */ - (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6; - (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7; - - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - */ - } - - /* "View.MemoryView":391 - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break # <<<<<<<<<<<<<< - * else: - * PyThread_free_lock(self.lock) - */ - goto __pyx_L6_break; - - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - */ - } - } - /*else*/ { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_self_pairs_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_20 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_20 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_21; __pyx_t_19+=1) { + __pyx_v_i = __pyx_t_19; - /* "View.MemoryView":393 - * break - * else: - * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":784 * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - */ - PyThread_free_lock(__pyx_v_self->lock); - } - __pyx_L6_break:; - - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - */ - } - - /* "View.MemoryView":374 - * self.typeinfo = NULL + * for i in range(self.n_self_pairs_h): + * cl_self[i] += np.dot(dipt_0_self[i], dipt_t_self[i]) # <<<<<<<<<<<<<< * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) + * for pair in self.pairlist: */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_dipt_0_self, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6.data = __pyx_v_dipt_t_self.data; + __pyx_t_6.memview = __pyx_v_dipt_t_self.memview; + __PYX_INC_MEMVIEW(&__pyx_t_6, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_i; + Py_ssize_t __pyx_tmp_shape = __pyx_v_dipt_t_self.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_dipt_t_self.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; } -/* "View.MemoryView":395 - * PyThread_free_lock(self.lock) - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf - */ +__pyx_t_6.shape[0] = __pyx_v_dipt_t_self.shape[1]; +__pyx_t_6.strides[0] = __pyx_v_dipt_t_self.strides[1]; + __pyx_t_6.suboffsets[0] = -1; -static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - Py_ssize_t __pyx_v_dim; - char *__pyx_v_itemp; - PyObject *__pyx_v_idx = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - char *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_item_pointer", 0); +__pyx_t_22 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL; + __pyx_t_23 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_23)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_23); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_23, __pyx_t_2, __pyx_t_22}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 784, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_18 = __pyx_v_i; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_cl_self.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_cl_self.data + __pyx_t_18 * __pyx_v_cl_self.strides[0]) )) += __pyx_t_24; + } - /* "View.MemoryView":397 - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":771 + * cdef double dist_sq, dist_2, dist_3 + * + * for selfobj in self.selflist: # <<<<<<<<<<<<<< + * index = 0 * - * for dim, idx in enumerate(index): */ - __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf + /* "newanalysis/helpers/miscellaneous.pyx":786 + * cl_self[i] += np.dot(dipt_0_self[i], dipt_t_self[i]) * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * for pair in self.pairlist: # <<<<<<<<<<<<<< + * index = 0 * */ - __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { - __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pairlist); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 399, __pyx_L1_error) + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 786, __pyx_L1_error) } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 786, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); #endif } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 786, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); #endif } } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { + __pyx_t_3 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 399, __pyx_L1_error) + else __PYX_ERR(0, 786, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_3); } - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_1; - __pyx_t_1 = (__pyx_t_1 + 1); - - /* "View.MemoryView":400 - * - * for dim, idx in enumerate(index): - * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< - * - * return itemp - */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_7; - - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "View.MemoryView":402 - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - * return itemp # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_itemp; - goto __pyx_L0; - - /* "View.MemoryView":395 - * PyThread_free_lock(self.lock) - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":405 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self - */ - -/* Python wrapper */ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_indices = NULL; - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - char *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "View.MemoryView":406 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":407 - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: - * return self # <<<<<<<<<<<<<< - * - * have_slices, indices = _unellipsify(index, self.view.ndim) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; + __Pyx_XDECREF_SET(__pyx_v_pair, __pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":406 + /* "newanalysis/helpers/miscellaneous.pyx":787 * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self + * for pair in self.pairlist: + * index = 0 # <<<<<<<<<<<<<< * + * for i in self.emim_h: */ - } + __pyx_v_index = 0; - /* "View.MemoryView":409 - * return self + /* "newanalysis/helpers/miscellaneous.pyx":789 + * index = 0 * - * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * for i in self.emim_h: # <<<<<<<<<<<<<< * - * cdef char *itemp + * p1l[index, 0] = run[pair.p1][i,0] */ - __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(__pyx_t_3 != Py_None)) { - PyObject* sequence = __pyx_t_3; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 409, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_emim_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_10 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 789, __pyx_L1_error) } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 409, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_v_indices = __pyx_t_5; - __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 789, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 789, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_11(__pyx_t_4); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 789, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 789, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_i = __pyx_t_19; - /* "View.MemoryView":412 + /* "newanalysis/helpers/miscellaneous.pyx":791 + * for i in self.emim_h: * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: - */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 412, __pyx_L1_error) - if (__pyx_t_2) { - - /* "View.MemoryView":413 - * cdef char *itemp - * if have_slices: - * return memview_slice(self, indices) # <<<<<<<<<<<<<< - * else: - * itemp = self.get_item_pointer(indices) + * p1l[index, 0] = run[pair.p1][i,0] # <<<<<<<<<<<<<< + * p1l[index, 1] = run[pair.p1][i,1] + * p1l[index, 2] = run[pair.p1][i,2] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 791, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_18 = __pyx_t_12; + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[2]; + __pyx_t_13 = __pyx_v_index; + __pyx_t_14 = 0; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p1l.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p1l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_13 * __pyx_v_p1l.strides[0]) ) + __pyx_t_14 * __pyx_v_p1l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_18 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_17 * __pyx_v_run.strides[2]) ))); - /* "View.MemoryView":412 + /* "newanalysis/helpers/miscellaneous.pyx":792 + * + * p1l[index, 0] = run[pair.p1][i,0] + * p1l[index, 1] = run[pair.p1][i,1] # <<<<<<<<<<<<<< + * p1l[index, 2] = run[pair.p1][i,2] * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: */ - } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 792, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 792, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_17 = __pyx_t_12; + __pyx_t_16 = __pyx_v_i; + __pyx_t_18 = 1; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[2]; + __pyx_t_14 = __pyx_v_index; + __pyx_t_13 = 1; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p1l.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p1l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_14 * __pyx_v_p1l.strides[0]) ) + __pyx_t_13 * __pyx_v_p1l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_17 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_18 * __pyx_v_run.strides[2]) ))); - /* "View.MemoryView":415 - * return memview_slice(self, indices) - * else: - * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< - * return self.convert_item_to_object(itemp) + /* "newanalysis/helpers/miscellaneous.pyx":793 + * p1l[index, 0] = run[pair.p1][i,0] + * p1l[index, 1] = run[pair.p1][i,1] + * p1l[index, 2] = run[pair.p1][i,2] # <<<<<<<<<<<<<< * + * p2l[index, 0] = run[pair.p2][i,0] */ - /*else*/ { - __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 415, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_6; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 793, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 793, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_18 = __pyx_t_12; + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = 2; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[2]; + __pyx_t_13 = __pyx_v_index; + __pyx_t_14 = 2; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p1l.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p1l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_13 * __pyx_v_p1l.strides[0]) ) + __pyx_t_14 * __pyx_v_p1l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_18 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_17 * __pyx_v_run.strides[2]) ))); - /* "View.MemoryView":416 - * else: - * itemp = self.get_item_pointer(indices) - * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":795 + * p1l[index, 2] = run[pair.p1][i,2] * - * def __setitem__(memoryview self, object index, object value): + * p2l[index, 0] = run[pair.p2][i,0] # <<<<<<<<<<<<<< + * p2l[index, 1] = run[pair.p2][i,1] + * p2l[index, 2] = run[pair.p2][i,2] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 795, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 795, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_17 = __pyx_t_12; + __pyx_t_16 = __pyx_v_i; + __pyx_t_18 = 0; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[2]; + __pyx_t_14 = __pyx_v_index; + __pyx_t_13 = 0; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p2l.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p2l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_14 * __pyx_v_p2l.strides[0]) ) + __pyx_t_13 * __pyx_v_p2l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_17 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_18 * __pyx_v_run.strides[2]) ))); - /* "View.MemoryView":405 + /* "newanalysis/helpers/miscellaneous.pyx":796 * + * p2l[index, 0] = run[pair.p2][i,0] + * p2l[index, 1] = run[pair.p2][i,1] # <<<<<<<<<<<<<< + * p2l[index, 2] = run[pair.p2][i,2] * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 796, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_18 = __pyx_t_12; + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = 1; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[2]; + __pyx_t_13 = __pyx_v_index; + __pyx_t_14 = 1; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p2l.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p2l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_13 * __pyx_v_p2l.strides[0]) ) + __pyx_t_14 * __pyx_v_p2l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_18 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_17 * __pyx_v_run.strides[2]) ))); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_indices); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) + /* "newanalysis/helpers/miscellaneous.pyx":797 + * p2l[index, 0] = run[pair.p2][i,0] + * p2l[index, 1] = run[pair.p2][i,1] + * p2l[index, 2] = run[pair.p2][i,2] # <<<<<<<<<<<<<< * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + * index += 1 */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_p2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 797, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 797, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_17 = __pyx_t_12; + __pyx_t_16 = __pyx_v_i; + __pyx_t_18 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_run.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_run.shape[1]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_run.shape[2]; + __pyx_t_14 = __pyx_v_index; + __pyx_t_13 = 2; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_p2l.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p2l.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_14 * __pyx_v_p2l.strides[0]) ) + __pyx_t_13 * __pyx_v_p2l.strides[1]) )) = (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_run.data + __pyx_t_17 * __pyx_v_run.strides[0]) ) + __pyx_t_16 * __pyx_v_run.strides[1]) ) + __pyx_t_18 * __pyx_v_run.strides[2]) ))); -/* Python wrapper */ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_obj = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - __Pyx_INCREF(__pyx_v_index); - - /* "View.MemoryView":419 + /* "newanalysis/helpers/miscellaneous.pyx":799 + * p2l[index, 2] = run[pair.p2][i,2] * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") + * index += 1 # <<<<<<<<<<<<<< * + * dipten_double_loop_(&p1l[0,0], &p2l[0,0], &dipt_t[0,0], self.apr_emim_h, self.apr_emim_h, 0) */ - __pyx_t_1 = (__pyx_v_self->view.readonly != 0); - if (unlikely(__pyx_t_1)) { + __pyx_v_index = (__pyx_v_index + 1); - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":789 + * index = 0 * - * have_slices, index = _unellipsify(index, self.view.ndim) + * for i in self.emim_h: # <<<<<<<<<<<<<< + * + * p1l[index, 0] = run[pair.p1][i,0] */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 420, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":419 + /* "newanalysis/helpers/miscellaneous.pyx":801 + * index += 1 * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") + * dipten_double_loop_(&p1l[0,0], &p2l[0,0], &dipt_t[0,0], self.apr_emim_h, self.apr_emim_h, 0) # <<<<<<<<<<<<<< + * dipt_0 = pair.dipt_0 * */ - } + __pyx_t_18 = 0; + __pyx_t_16 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_p1l.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_p1l.shape[1]; + __pyx_t_17 = 0; + __pyx_t_13 = 0; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_p2l.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_p2l.shape[1]; + __pyx_t_14 = 0; + __pyx_t_15 = 0; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_dipt_t.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_dipt_t.shape[1]; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 801, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apr_emim_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 801, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + dipten_double_loop_((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p1l.data + __pyx_t_18 * __pyx_v_p1l.strides[0]) ) + __pyx_t_16 * __pyx_v_p1l.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_p2l.data + __pyx_t_17 * __pyx_v_p2l.strides[0]) ) + __pyx_t_13 * __pyx_v_p2l.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipt_t.data + __pyx_t_14 * __pyx_v_dipt_t.strides[0]) ) + __pyx_t_15 * __pyx_v_dipt_t.strides[1]) )))), __pyx_t_19, __pyx_t_7, 0); - /* "View.MemoryView":422 - * raise TypeError("Cannot assign to read-only memoryview") + /* "newanalysis/helpers/miscellaneous.pyx":802 * - * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * dipten_double_loop_(&p1l[0,0], &p2l[0,0], &dipt_t[0,0], self.apr_emim_h, self.apr_emim_h, 0) + * dipt_0 = pair.dipt_0 # <<<<<<<<<<<<<< * - * if have_slices: + * for i in range(self.n_pairs_h): */ - __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(__pyx_t_2 != Py_None)) { - PyObject* sequence = __pyx_t_2; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 422, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 422, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_dipt_0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 422, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); - __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_dipt_0, __pyx_t_4); + __pyx_t_4 = 0; - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "newanalysis/helpers/miscellaneous.pyx":804 + * dipt_0 = pair.dipt_0 * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: + * for i in range(self.n_pairs_h): # <<<<<<<<<<<<<< + * cl[i][pair.bin[i]] += np.dot(dipt_0[i], dipt_t[i]) + * return cl, cl_self */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_n_pairs_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_20 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_20 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 804, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_21; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "View.MemoryView":425 + /* "newanalysis/helpers/miscellaneous.pyx":805 * - * if have_slices: - * obj = self.is_slice(value) # <<<<<<<<<<<<<< - * if obj: - * self.setitem_slice_assignment(self[index], obj) + * for i in range(self.n_pairs_h): + * cl[i][pair.bin[i]] += np.dot(dipt_0[i], dipt_t[i]) # <<<<<<<<<<<<<< + * return cl, cl_self + * ###END DANIEL NOE HELPERS */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_obj = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dot); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_dipt_0, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6.data = __pyx_v_dipt_t.data; + __pyx_t_6.memview = __pyx_v_dipt_t.memview; + __PYX_INC_MEMVIEW(&__pyx_t_6, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_i; + Py_ssize_t __pyx_tmp_shape = __pyx_v_dipt_t.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_dipt_t.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 426, __pyx_L1_error) - if (__pyx_t_1) { +__pyx_t_6.shape[0] = __pyx_v_dipt_t.shape[1]; +__pyx_t_6.strides[0] = __pyx_v_dipt_t.strides[1]; + __pyx_t_6.suboffsets[0] = -1; - /* "View.MemoryView":427 - * obj = self.is_slice(value) - * if obj: - * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< - * else: - * self.setitem_slice_assign_scalar(self[index], value) - */ - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error) +__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL; + __pyx_t_23 = NULL; + __pyx_t_19 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_22))) { + __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_22); + if (likely(__pyx_t_23)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22); + __Pyx_INCREF(__pyx_t_23); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_22, function); + __pyx_t_19 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_23, __pyx_t_3, __pyx_t_2}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_22, __pyx_callargs+1-__pyx_t_19, 2+__pyx_t_19); + __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + } + __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: - */ - goto __pyx_L5; - } - - /* "View.MemoryView":429 - * self.setitem_slice_assignment(self[index], obj) - * else: - * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< - * else: - * self.setitem_indexed(index, value) - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 429, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_bin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 429, __pyx_L1_error) - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_22 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_22); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __pyx_t_15 = __pyx_v_i; + __pyx_t_14 = __pyx_t_10; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_cl.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_cl.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cl.data + __pyx_t_15 * __pyx_v_cl.strides[0]) ) + __pyx_t_14 * __pyx_v_cl.strides[1]) )) += __pyx_t_24; } - __pyx_L5:; - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "newanalysis/helpers/miscellaneous.pyx":786 + * cl_self[i] += np.dot(dipt_0_self[i], dipt_t_self[i]) + * + * for pair in self.pairlist: # <<<<<<<<<<<<<< + * index = 0 * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: */ - goto __pyx_L4; } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":431 - * self.setitem_slice_assign_scalar(self[index], value) - * else: - * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":806 + * for i in range(self.n_pairs_h): + * cl[i][pair.bin[i]] += np.dot(dipt_0[i], dipt_t[i]) + * return cl, cl_self # <<<<<<<<<<<<<< + * ###END DANIEL NOE HELPERS * - * cdef is_slice(self, obj): */ - /*else*/ { - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L4:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_cl, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_22 = __pyx_memoryview_fromslice(__pyx_v_cl_self, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 806, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 806, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_22); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_22)) __PYX_ERR(0, 806, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_22 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) + /* "newanalysis/helpers/miscellaneous.pyx":748 * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def pairiter(self, double [:,:,:] run): + * cdef double [:,:] cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #rename: cl->correlationlist */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_XDECREF(__pyx_t_23); + __Pyx_AddTraceback("newanalysis.miscellaneous.noe_task.pairiter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XDECREF(__pyx_v_index); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_cl, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dipt_t, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_p1l, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_p2l, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_cl_self, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dipt_t_self, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_pl, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rv, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_distvec, 1); + __Pyx_XDECREF(__pyx_v_selfobj); + __Pyx_XDECREF(__pyx_v_dipt_0_self); + __Pyx_XDECREF(__pyx_v_pair); + __Pyx_XDECREF(__pyx_v_dipt_0); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":433 - * self.setitem_indexed(index, value) +/* "newanalysis/helpers/miscellaneous.pyx":809 + * ###END DANIEL NOE HELPERS * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBestIndex(double [:] aufpunkt, double [:,:] coor): + * ''' */ -static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_37getBestIndex(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_36getBestIndex, "\n getBestIndex(point, coor)\n\n This function takes a point in space and a set of coordinates. It returns the index of the particle in the set closest to said point.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_37getBestIndex = {"getBestIndex", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_37getBestIndex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_36getBestIndex}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_37getBestIndex(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getBestIndex (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 809, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_coor,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 809, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 809, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("getBestIndex", 1, 2, 2, 1); __PYX_ERR(0, 809, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "getBestIndex") < 0)) __PYX_ERR(0, 809, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 810, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 810, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("getBestIndex", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 809, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.getBestIndex", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_36getBestIndex(__pyx_self, __pyx_v_aufpunkt, __pyx_v_coor); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_36getBestIndex(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_coor) { + int __pyx_v_particles; + int __pyx_v_best_index; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_slice", 0); - __Pyx_INCREF(__pyx_v_obj); + __Pyx_RefNannySetupContext("getBestIndex", 0); - /* "View.MemoryView":434 + /* "newanalysis/helpers/miscellaneous.pyx":817 + * ''' * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_5); - /*try:*/ { - - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: - */ - __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - - /* "View.MemoryView":437 - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * except TypeError: - * return None - */ - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 437, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: - */ - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); - __pyx_t_7 = 0; - - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "View.MemoryView":438 - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - * except TypeError: # <<<<<<<<<<<<<< - * return None + * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< + * cdef int best_index * */ - __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); - if (__pyx_t_9) { - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 438, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_6); + __pyx_v_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":439 - * self.dtype_is_object) - * except TypeError: - * return None # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":820 + * cdef int best_index * - * return obj - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_except_return; - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; - - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L1_error; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L0; - __pyx_L9_try_end:; - } - - /* "View.MemoryView":434 + * best_index = get_best_index(&aufpunkt[0], &coor[0,0], particles) # <<<<<<<<<<<<<< + * return best_index * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - } + __pyx_t_1 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_aufpunkt.shape[0]; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[0]; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor.shape[1]; + __pyx_v_best_index = get_best_index((&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_1 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_2 * __pyx_v_coor.strides[0]) ) + __pyx_t_3 * __pyx_v_coor.strides[1]) )))), __pyx_v_particles); - /* "View.MemoryView":441 - * return None + /* "newanalysis/helpers/miscellaneous.pyx":821 * - * return obj # <<<<<<<<<<<<<< + * best_index = get_best_index(&aufpunkt[0], &coor[0,0], particles) + * return best_index # <<<<<<<<<<<<<< * - * cdef setitem_slice_assignment(self, dst, src): + * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_obj); - __pyx_r = __pyx_v_obj; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_best_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 821, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "View.MemoryView":433 - * self.setitem_indexed(index, value) + /* "newanalysis/helpers/miscellaneous.pyx":809 + * ###END DANIEL NOE HELPERS * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBestIndex(double [:] aufpunkt, double [:,:] coor): + * ''' */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("newanalysis.miscellaneous.getBestIndex", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_obj); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":443 - * return obj +/* "newanalysis/helpers/miscellaneous.pyx":823 + * return best_index * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBestIndices(double [:] aufpunkt, double [:,:] coor, double [:,:] dip, int count): + * ''' */ -static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { - __Pyx_memviewslice __pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_src_slice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - __Pyx_memviewslice *__pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_39getBestIndices(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_38getBestIndices, "\n coor ... (n_particles, 3)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_39getBestIndices = {"getBestIndices", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_39getBestIndices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_38getBestIndices}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_39getBestIndices(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_count; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice - * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) - */ - if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 447, __pyx_L1_error) - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 447, __pyx_L1_error) - - /* "View.MemoryView":448 - * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<< - * src.ndim, dst.ndim, self.dtype_is_object) - * - */ - if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 448, __pyx_L1_error) - __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 448, __pyx_L1_error) - - /* "View.MemoryView":449 - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< - * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice - * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) - */ - __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 447, __pyx_L1_error) - - /* "View.MemoryView":443 - * return obj - * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getBestIndices (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 823, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_count,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("getBestIndices", 1, 4, 4, 1); __PYX_ERR(0, 823, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("getBestIndices", 1, 4, 4, 2); __PYX_ERR(0, 823, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_count)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("getBestIndices", 1, 4, 4, 3); __PYX_ERR(0, 823, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "getBestIndices") < 0)) __PYX_ERR(0, 823, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 824, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 824, __pyx_L3_error) + __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 824, __pyx_L3_error) + __pyx_v_count = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_count == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 824, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("getBestIndices", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 823, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.getBestIndices", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_38getBestIndices(__pyx_self, __pyx_v_aufpunkt, __pyx_v_coor, __pyx_v_dip, __pyx_v_count); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) - * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL - */ - -static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { - int __pyx_v_array[0x80]; - void *__pyx_v_tmp; - void *__pyx_v_item; - __Pyx_memviewslice *__pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_tmp_slice; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_38getBestIndices(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, int __pyx_v_count) { + int __pyx_v_n_particles; + int __pyx_v_point; + int __pyx_v_ctr; + double __pyx_v_cutoff; + __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_distances_copy = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor_res = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip_res = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - int __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - char const *__pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + __Pyx_memviewslice __pyx_t_21 = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - - /* "View.MemoryView":453 - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - * cdef int array[128] - * cdef void *tmp = NULL # <<<<<<<<<<<<<< - * cdef void *item - * - */ - __pyx_v_tmp = NULL; - - /* "View.MemoryView":458 - * cdef __Pyx_memviewslice *dst_slice - * cdef __Pyx_memviewslice tmp_slice - * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< - * - * if self.view.itemsize > sizeof(array): - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 458, __pyx_L1_error) - __pyx_v_dst_slice = __pyx_t_1; + __Pyx_RefNannySetupContext("getBestIndices", 0); - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) + /* "newanalysis/helpers/miscellaneous.pyx":829 + * ''' * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< + * if count > n_particles: count = n_particles + * cdef int point = 0, ctr = 0 */ - __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); - if (__pyx_t_2) { + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":461 + /* "newanalysis/helpers/miscellaneous.pyx":830 * - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< - * if tmp == NULL: - * raise MemoryError + * cdef int n_particles = coor.shape[0] + * if count > n_particles: count = n_particles # <<<<<<<<<<<<<< + * cdef int point = 0, ctr = 0 + * cdef double cutoff = 0 */ - __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + __pyx_t_1 = (__pyx_v_count > __pyx_v_n_particles); + if (__pyx_t_1) { + __pyx_v_count = __pyx_v_n_particles; + } - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp + /* "newanalysis/helpers/miscellaneous.pyx":831 + * cdef int n_particles = coor.shape[0] + * if count > n_particles: count = n_particles + * cdef int point = 0, ctr = 0 # <<<<<<<<<<<<<< + * cdef double cutoff = 0 + * cdef double [:] distances = np.zeros(n_particles) */ - __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_v_point = 0; + __pyx_v_ctr = 0; - /* "View.MemoryView":463 - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * item = tmp - * else: + /* "newanalysis/helpers/miscellaneous.pyx":832 + * if count > n_particles: count = n_particles + * cdef int point = 0, ctr = 0 + * cdef double cutoff = 0 # <<<<<<<<<<<<<< + * cdef double [:] distances = np.zeros(n_particles) + * cdef double [:] distances_copy = np.zeros(n_particles) */ - PyErr_NoMemory(); __PYX_ERR(2, 463, __pyx_L1_error) + __pyx_v_cutoff = 0.0; - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp + /* "newanalysis/helpers/miscellaneous.pyx":833 + * cdef int point = 0, ctr = 0 + * cdef double cutoff = 0 + * cdef double [:] distances = np.zeros(n_particles) # <<<<<<<<<<<<<< + * cdef double [:] distances_copy = np.zeros(n_particles) + * cdef double [:,:] coor_res = np.zeros((count,3)) */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } - - /* "View.MemoryView":464 - * if tmp == NULL: - * raise MemoryError - * item = tmp # <<<<<<<<<<<<<< - * else: - * item = array - */ - __pyx_v_item = __pyx_v_tmp; - - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) - * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - */ - goto __pyx_L3; } - - /* "View.MemoryView":466 - * item = tmp - * else: - * item = array # <<<<<<<<<<<<<< - * - * try: - */ - /*else*/ { - __pyx_v_item = ((void *)__pyx_v_array); + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_L3:; - - /* "View.MemoryView":468 - * item = array - * - * try: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * ( item)[0] = value - */ - /*try:*/ { - - /* "View.MemoryView":469 - * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: - */ - __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":470 - * try: - * if self.dtype_is_object: - * ( item)[0] = value # <<<<<<<<<<<<<< - * else: - * self.assign_item_from_object( item, value) - */ - (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - - /* "View.MemoryView":469 - * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: - */ - goto __pyx_L8; - } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_distances = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":472 - * ( item)[0] = value - * else: - * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/miscellaneous.pyx":834 + * cdef double cutoff = 0 + * cdef double [:] distances = np.zeros(n_particles) + * cdef double [:] distances_copy = np.zeros(n_particles) # <<<<<<<<<<<<<< + * cdef double [:,:] coor_res = np.zeros((count,3)) + * cdef double [:,:] dip_res = np.zeros((count,3)) */ - /*else*/ { - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 472, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; } - __pyx_L8:; - - /* "View.MemoryView":476 - * - * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - */ - __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":477 - * - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) - */ - __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 477, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 834, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_distances_copy = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":476 - * + /* "newanalysis/helpers/miscellaneous.pyx":835 + * cdef double [:] distances = np.zeros(n_particles) + * cdef double [:] distances_copy = np.zeros(n_particles) + * cdef double [:,:] coor_res = np.zeros((count,3)) # <<<<<<<<<<<<<< + * cdef double [:,:] dip_res = np.zeros((count,3)) * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 835, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_3)) __PYX_ERR(0, 835, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } - - /* "View.MemoryView":478 - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< - * item, self.dtype_is_object) - * finally: - */ - __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 835, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_coor_res = __pyx_t_8; + __pyx_t_8.memview = NULL; + __pyx_t_8.data = NULL; - /* "View.MemoryView":481 - * item, self.dtype_is_object) - * finally: - * PyMem_Free(tmp) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":836 + * cdef double [:] distances_copy = np.zeros(n_particles) + * cdef double [:,:] coor_res = np.zeros((count,3)) + * cdef double [:,:] dip_res = np.zeros((count,3)) # <<<<<<<<<<<<<< * - * cdef setitem_indexed(self, index, value): + * for point in range(n_particles): */ - /*finally:*/ { - /*normal exit:*/{ - PyMem_Free(__pyx_v_tmp); - goto __pyx_L7; - } - __pyx_L6_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; - { - PyMem_Free(__pyx_v_tmp); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; - goto __pyx_L1_error; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 836, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3)) __PYX_ERR(0, 836, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } - __pyx_L7:; } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 836, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_dip_res = __pyx_t_8; + __pyx_t_8.memview = NULL; + __pyx_t_8.data = NULL; - /* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) + /* "newanalysis/helpers/miscellaneous.pyx":838 + * cdef double [:,:] dip_res = np.zeros((count,3)) * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":483 - * PyMem_Free(tmp) + * for point in range(n_particles): # <<<<<<<<<<<<<< + * distances[point] = pow((aufpunkt[0] - coor[point, 0]),2) + pow((aufpunkt[1] - coor[point, 1]),2) + pow((aufpunkt[2] - coor[point, 2]),2) * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) */ + __pyx_t_6 = __pyx_v_n_particles; + __pyx_t_9 = __pyx_t_6; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_point = __pyx_t_10; -static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_indexed", 0); - - /* "View.MemoryView":484 + /* "newanalysis/helpers/miscellaneous.pyx":839 * - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< - * self.assign_item_from_object(itemp, value) + * for point in range(n_particles): + * distances[point] = pow((aufpunkt[0] - coor[point, 0]),2) + pow((aufpunkt[1] - coor[point, 1]),2) + pow((aufpunkt[2] - coor[point, 2]),2) # <<<<<<<<<<<<<< * + * distances_copy = np.sort(distances, kind='mergesort') */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 484, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_1; + __pyx_t_11 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_aufpunkt.shape[0]; + __pyx_t_12 = __pyx_v_point; + __pyx_t_13 = 0; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coor.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coor.shape[1]; + __pyx_t_14 = 1; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_aufpunkt.shape[0]; + __pyx_t_15 = __pyx_v_point; + __pyx_t_16 = 1; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + __pyx_t_17 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_aufpunkt.shape[0]; + __pyx_t_18 = __pyx_v_point; + __pyx_t_19 = 2; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + __pyx_t_20 = __pyx_v_point; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_distances.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_20 * __pyx_v_distances.strides[0]) )) = ((pow(((*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_11 * __pyx_v_aufpunkt.strides[0]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) )))), 2.0) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_14 * __pyx_v_aufpunkt.strides[0]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) )))), 2.0)) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_17 * __pyx_v_aufpunkt.strides[0]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )))), 2.0)); + } - /* "View.MemoryView":485 - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":841 + * distances[point] = pow((aufpunkt[0] - coor[point, 0]),2) + pow((aufpunkt[1] - coor[point, 1]),2) + pow((aufpunkt[2] - coor[point, 2]),2) + * + * distances_copy = np.sort(distances, kind='mergesort') # <<<<<<<<<<<<<< + * cutoff = distances_copy[(count-1)] #Largest allowed entry * - * cdef convert_item_to_object(self, char *itemp): */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 485, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sort); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_distances, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_kind, __pyx_n_s_mergesort) < 0) __PYX_ERR(0, 841, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 841, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_distances_copy, 1); + __pyx_v_distances_copy = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":483 - * PyMem_Free(tmp) - * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) + /* "newanalysis/helpers/miscellaneous.pyx":842 * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - */ - -static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_v_struct = NULL; - PyObject *__pyx_v_bytesitem = 0; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - size_t __pyx_t_10; - int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":490 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef bytes bytesitem + * distances_copy = np.sort(distances, kind='mergesort') + * cutoff = distances_copy[(count-1)] #Largest allowed entry # <<<<<<<<<<<<<< * + * for point in range(n_particles): */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_19 = (__pyx_v_count - 1); + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_distances_copy.shape[0]; + __pyx_v_cutoff = (*((double *) ( /* dim=0 */ (__pyx_v_distances_copy.data + __pyx_t_19 * __pyx_v_distances_copy.strides[0]) ))); - /* "View.MemoryView":493 - * cdef bytes bytesitem + /* "newanalysis/helpers/miscellaneous.pyx":844 + * cutoff = distances_copy[(count-1)] #Largest allowed entry * - * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< - * try: - * result = struct.unpack(self.view.format, bytesitem) + * for point in range(n_particles): # <<<<<<<<<<<<<< + * if(distances[point] <= cutoff): + * coor_res[ctr] = coor[point] */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_6 = __pyx_v_n_particles; + __pyx_t_9 = __pyx_t_6; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_point = __pyx_t_10; - /* "View.MemoryView":494 + /* "newanalysis/helpers/miscellaneous.pyx":845 * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + * for point in range(n_particles): + * if(distances[point] <= cutoff): # <<<<<<<<<<<<<< + * coor_res[ctr] = coor[point] + * dip_res[ctr] = dip[point] */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { + __pyx_t_19 = __pyx_v_point; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_distances.shape[0]; + __pyx_t_1 = ((*((double *) ( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_19 * __pyx_v_distances.strides[0]) ))) <= __pyx_v_cutoff); + if (__pyx_t_1) { - /* "View.MemoryView":495 - * bytesitem = itemp[:self.view.itemsize] - * try: - * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< - * except struct.error: - * raise ValueError("Unable to convert item to object") + /* "newanalysis/helpers/miscellaneous.pyx":846 + * for point in range(n_particles): + * if(distances[point] <= cutoff): + * coor_res[ctr] = coor[point] # <<<<<<<<<<<<<< + * dip_res[ctr] = dip[point] + * ctr += 1 */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif + __pyx_t_7.data = __pyx_v_coor.data; + __pyx_t_7.memview = __pyx_v_coor.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); - __Pyx_INCREF(__pyx_v_bytesitem); - __Pyx_GIVEREF(__pyx_v_bytesitem); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; + Py_ssize_t __pyx_tmp_idx = __pyx_v_point; + Py_ssize_t __pyx_tmp_shape = __pyx_v_coor.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_coor.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":494 - * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - */ - } +__pyx_t_7.shape[0] = __pyx_v_coor.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_coor.strides[1]; + __pyx_t_7.suboffsets[0] = -1; - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result - */ - /*else:*/ { - __pyx_t_10 = strlen(__pyx_v_self->view.format); - __pyx_t_11 = ((__pyx_t_10 == 1) != 0); - if (__pyx_t_11) { +__pyx_t_21.data = __pyx_v_coor_res.data; + __pyx_t_21.memview = __pyx_v_coor_res.memview; + __PYX_INC_MEMVIEW(&__pyx_t_21, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_ctr; + Py_ssize_t __pyx_tmp_shape = __pyx_v_coor_res.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_coor_res.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_21.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":500 - * else: - * if len(self.view.format) == 1: - * return result[0] # <<<<<<<<<<<<<< - * return result - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L6_except_return; +__pyx_t_21.shape[0] = __pyx_v_coor_res.shape[1]; +__pyx_t_21.strides[0] = __pyx_v_coor_res.strides[1]; + __pyx_t_21.suboffsets[0] = -1; - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result - */ - } +if (unlikely((__pyx_memoryview_copy_contents(__pyx_t_7, __pyx_t_21, 1, 1, 0) < 0))) __PYX_ERR(0, 846, __pyx_L1_error) + __PYX_XCLEAR_MEMVIEW(&__pyx_t_21, 1); + __pyx_t_21.memview = NULL; __pyx_t_21.data = NULL; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "View.MemoryView":501 - * if len(self.view.format) == 1: - * return result[0] - * return result # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":847 + * if(distances[point] <= cutoff): + * coor_res[ctr] = coor[point] + * dip_res[ctr] = dip[point] # <<<<<<<<<<<<<< + * ctr += 1 * - * cdef assign_item_from_object(self, char *itemp, object value): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L6_except_return; - } - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_7.data = __pyx_v_dip.data; + __pyx_t_7.memview = __pyx_v_dip.memview; + __PYX_INC_MEMVIEW(&__pyx_t_7, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_point; + Py_ssize_t __pyx_tmp_shape = __pyx_v_dip.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_dip.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":496 - * try: - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: # <<<<<<<<<<<<<< - * raise ValueError("Unable to convert item to object") - * else: +__pyx_t_7.shape[0] = __pyx_v_dip.shape[1]; +__pyx_t_7.strides[0] = __pyx_v_dip.strides[1]; + __pyx_t_7.suboffsets[0] = -1; + +__pyx_t_21.data = __pyx_v_dip_res.data; + __pyx_t_21.memview = __pyx_v_dip_res.memview; + __PYX_INC_MEMVIEW(&__pyx_t_21, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_ctr; + Py_ssize_t __pyx_tmp_shape = __pyx_v_dip_res.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_dip_res.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_21.data += __pyx_tmp_idx * __pyx_tmp_stride; +} + +__pyx_t_21.shape[0] = __pyx_v_dip_res.shape[1]; +__pyx_t_21.strides[0] = __pyx_v_dip_res.strides[1]; + __pyx_t_21.suboffsets[0] = -1; + +if (unlikely((__pyx_memoryview_copy_contents(__pyx_t_7, __pyx_t_21, 1, 1, 0) < 0))) __PYX_ERR(0, 847, __pyx_L1_error) + __PYX_XCLEAR_MEMVIEW(&__pyx_t_21, 1); + __pyx_t_21.memview = NULL; __pyx_t_21.data = NULL; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; + + /* "newanalysis/helpers/miscellaneous.pyx":848 + * coor_res[ctr] = coor[point] + * dip_res[ctr] = dip[point] + * ctr += 1 # <<<<<<<<<<<<<< + * + * return coor_res, dip_res */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9); - __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0; - if (__pyx_t_8) { - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); + __pyx_v_ctr = (__pyx_v_ctr + 1); - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: + /* "newanalysis/helpers/miscellaneous.pyx":845 + * + * for point in range(n_particles): + * if(distances[point] <= cutoff): # <<<<<<<<<<<<<< + * coor_res[ctr] = coor[point] + * dip_res[ctr] = dip[point] */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 497, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(2, 497, __pyx_L5_except_error) } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + } - /* "View.MemoryView":494 + /* "newanalysis/helpers/miscellaneous.pyx":850 + * ctr += 1 * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + * return coor_res, dip_res # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L6_except_return:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L0; - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_coor_res, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 850, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dip_res, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 850, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 850, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 850, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(0, 850, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) + /* "newanalysis/helpers/miscellaneous.pyx":823 + * return best_index * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBestIndices(double [:] aufpunkt, double [:,:] coor, double [:,:] dip, int count): + * ''' */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_21, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.getBestIndices", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesitem); - __Pyx_XDECREF(__pyx_v_result); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_distances, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_distances_copy, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_res, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_res, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":503 - * return result +/* "newanalysis/helpers/miscellaneous.pyx":852 + * return coor_res, dip_res * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeMrHistogram(double [:,:] coor, double [:,:] dip, double [:] aufpunkt, double [:] antagonist, double [:] histogram, double max_distance, int segments_per_angstroem, int order=0): + * ''' */ -static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_v_struct = NULL; - char __pyx_v_c; - PyObject *__pyx_v_bytesvalue = 0; - Py_ssize_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - char *__pyx_t_11; - char *__pyx_t_12; - char *__pyx_t_13; - char *__pyx_t_14; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_41writeMrHistogram(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_40writeMrHistogram, "\n coor ... (number_of_particles, 3)\n dip ... (number_of_particles, 3)\n aufpunkt ... (3)\n antagonist ... (3)\n histogram ... (max_distance * segments_per_angstroem)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_41writeMrHistogram = {"writeMrHistogram", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_41writeMrHistogram, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_40writeMrHistogram}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_41writeMrHistogram(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_antagonist = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_max_distance; + int __pyx_v_segments_per_angstroem; + int __pyx_v_order; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); - - /* "View.MemoryView":506 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef char c - * cdef bytes bytesvalue - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; - - /* "View.MemoryView":511 - * cdef Py_ssize_t i - * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: - */ - __pyx_t_2 = PyTuple_Check(__pyx_v_value); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "View.MemoryView":512 - * - * if isinstance(value, tuple): - * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< - * else: - * bytesvalue = struct.pack(self.view.format, value) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - - /* "View.MemoryView":511 - * cdef Py_ssize_t i - * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":514 - * bytesvalue = struct.pack(self.view.format, *value) - * else: - * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< - * - * for i, c in enumerate(bytesvalue): - */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_7 = 1; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("writeMrHistogram (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 852, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_aufpunkt,&__pyx_n_s_antagonist,&__pyx_n_s_histogram,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,&__pyx_n_s_order,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 852, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 852, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 1); __PYX_ERR(0, 852, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 852, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 2); __PYX_ERR(0, 852, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_antagonist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 852, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 3); __PYX_ERR(0, 852, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histogram)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 852, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 4); __PYX_ERR(0, 852, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_distance)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 852, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 5); __PYX_ERR(0, 852, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_segments_per_angstroem)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 852, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, 6); __PYX_ERR(0, 852, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order); + if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 852, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "writeMrHistogram") < 0)) __PYX_ERR(0, 852, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 514, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 853, __pyx_L3_error) + __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 853, __pyx_L3_error) + __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 853, __pyx_L3_error) + __pyx_v_antagonist = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_antagonist.memview)) __PYX_ERR(0, 853, __pyx_L3_error) + __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 853, __pyx_L3_error) + __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 853, __pyx_L3_error) + __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 853, __pyx_L3_error) + if (values[7]) { + __pyx_v_order = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 853, __pyx_L3_error) + } else { + __pyx_v_order = ((int)((int)0)); + } } - __pyx_L3:; - - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c - * - */ - __pyx_t_9 = 0; - if (unlikely(__pyx_v_bytesvalue == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(2, 516, __pyx_L1_error) + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("writeMrHistogram", 0, 7, 8, __pyx_nargs); __PYX_ERR(0, 852, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __Pyx_INCREF(__pyx_v_bytesvalue); - __pyx_t_10 = __pyx_v_bytesvalue; - __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10); - __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10)); - for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { - __pyx_t_11 = __pyx_t_14; - __pyx_v_c = (__pyx_t_11[0]); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_antagonist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.writeMrHistogram", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_40writeMrHistogram(__pyx_self, __pyx_v_coor, __pyx_v_dip, __pyx_v_aufpunkt, __pyx_v_antagonist, __pyx_v_histogram, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); - /* "View.MemoryView":517 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< - * - * @cname('getbuffer') - */ - __pyx_v_i = __pyx_t_9; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_antagonist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_40writeMrHistogram(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_antagonist, __Pyx_memviewslice __pyx_v_histogram, double __pyx_v_max_distance, int __pyx_v_segments_per_angstroem, int __pyx_v_order) { + int __pyx_v_number_of_particles; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_RefNannySetupContext("writeMrHistogram", 0); + + /* "newanalysis/helpers/miscellaneous.pyx":862 + * ''' * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c + * cdef int number_of_particles = coor.shape[0] # <<<<<<<<<<<<<< + * write_Mr_diagram(&coor[0,0], &dip[0,0], number_of_particles, &aufpunkt[0], &antagonist[0], &histogram[0], max_distance, segments_per_angstroem, order) * */ - __pyx_t_9 = (__pyx_t_9 + 1); + __pyx_v_number_of_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":517 + /* "newanalysis/helpers/miscellaneous.pyx":863 * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< + * cdef int number_of_particles = coor.shape[0] + * write_Mr_diagram(&coor[0,0], &dip[0,0], number_of_particles, &aufpunkt[0], &antagonist[0], &histogram[0], max_distance, segments_per_angstroem, order) # <<<<<<<<<<<<<< * - * @cname('getbuffer') + * @cython.boundscheck(False) */ - (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_dip.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip.shape[1]; + __pyx_t_5 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_aufpunkt.shape[0]; + __pyx_t_6 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_antagonist.shape[0]; + __pyx_t_7 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[0]; + write_Mr_diagram((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_3 * __pyx_v_dip.strides[0]) ) + __pyx_t_4 * __pyx_v_dip.strides[1]) )))), __pyx_v_number_of_particles, (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_5 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_antagonist.data + __pyx_t_6 * __pyx_v_antagonist.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_7 * __pyx_v_histogram.strides[0]) )))), __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); - /* "View.MemoryView":503 - * return result + /* "newanalysis/helpers/miscellaneous.pyx":852 + * return coor_res, dip_res * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeMrHistogram(double [:,:] coor, double [:,:] dip, double [:] aufpunkt, double [:] antagonist, double [:] histogram, double max_distance, int segments_per_angstroem, int order=0): + * ''' */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesvalue); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":520 +/* "newanalysis/helpers/miscellaneous.pyx":865 + * write_Mr_diagram(&coor[0,0], &dip[0,0], number_of_particles, &aufpunkt[0], &antagonist[0], &histogram[0], max_distance, segments_per_angstroem, order) * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeKirkwoodHistogram(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:] histogram, double max_distance, int segments_per_angstroem, int order = 1): + * #TODO documentation */ /* Python wrapper */ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - char *__pyx_t_5; - void *__pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_43writeKirkwoodHistogram(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_43writeKirkwoodHistogram = {"writeKirkwoodHistogram", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_43writeKirkwoodHistogram, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_43writeKirkwoodHistogram(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_aufpunkt_dipole = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_max_distance; + int __pyx_v_segments_per_angstroem; + int __pyx_v_order; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * - */ - __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_self->view.readonly != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< - * - * if flags & PyBUF_ND: - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 522, __pyx_L1_error) - - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * - */ - } - - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":525 - * - * if flags & PyBUF_ND: - * info.shape = self.view.shape # <<<<<<<<<<<<<< - * else: - * info.shape = NULL - */ - __pyx_t_4 = __pyx_v_self->view.shape; - __pyx_v_info->shape = __pyx_t_4; - - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: - */ - goto __pyx_L6; - } - - /* "View.MemoryView":527 - * info.shape = self.view.shape - * else: - * info.shape = NULL # <<<<<<<<<<<<<< - * - * if flags & PyBUF_STRIDES: - */ - /*else*/ { - __pyx_v_info->shape = NULL; - } - __pyx_L6:; - - /* "View.MemoryView":529 - * info.shape = NULL - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":530 - * - * if flags & PyBUF_STRIDES: - * info.strides = self.view.strides # <<<<<<<<<<<<<< - * else: - * info.strides = NULL - */ - __pyx_t_4 = __pyx_v_self->view.strides; - __pyx_v_info->strides = __pyx_t_4; - - /* "View.MemoryView":529 - * info.shape = NULL - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: - */ - goto __pyx_L7; - } - - /* "View.MemoryView":532 - * info.strides = self.view.strides - * else: - * info.strides = NULL # <<<<<<<<<<<<<< - * - * if flags & PyBUF_INDIRECT: - */ - /*else*/ { - __pyx_v_info->strides = NULL; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("writeKirkwoodHistogram (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 865, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_aufpunkt_dipole,&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_histogram,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,&__pyx_n_s_order,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 865, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt_dipole)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 865, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 1); __PYX_ERR(0, 865, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 865, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 2); __PYX_ERR(0, 865, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 865, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 3); __PYX_ERR(0, 865, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histogram)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 865, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 4); __PYX_ERR(0, 865, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_distance)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 865, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 5); __PYX_ERR(0, 865, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_segments_per_angstroem)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 865, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, 6); __PYX_ERR(0, 865, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order); + if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 865, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "writeKirkwoodHistogram") < 0)) __PYX_ERR(0, 865, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 866, __pyx_L3_error) + __pyx_v_aufpunkt_dipole = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt_dipole.memview)) __PYX_ERR(0, 866, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 866, __pyx_L3_error) + __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 866, __pyx_L3_error) + __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 866, __pyx_L3_error) + __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L3_error) + __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L3_error) + if (values[7]) { + __pyx_v_order = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L3_error) + } else { + __pyx_v_order = ((int)((int)1)); + } } - __pyx_L7:; - - /* "View.MemoryView":534 - * info.strides = NULL - * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":535 - * - * if flags & PyBUF_INDIRECT: - * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< - * else: - * info.suboffsets = NULL - */ - __pyx_t_4 = __pyx_v_self->view.suboffsets; - __pyx_v_info->suboffsets = __pyx_t_4; - - /* "View.MemoryView":534 - * info.strides = NULL - * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: - */ - goto __pyx_L8; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram", 0, 7, 8, __pyx_nargs); __PYX_ERR(0, 865, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogram", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_42writeKirkwoodHistogram(__pyx_self, __pyx_v_aufpunkt, __pyx_v_aufpunkt_dipole, __pyx_v_coor, __pyx_v_dip, __pyx_v_histogram, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); - /* "View.MemoryView":537 - * info.suboffsets = self.view.suboffsets - * else: - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * - * if flags & PyBUF_FORMAT: - */ - /*else*/ { - __pyx_v_info->suboffsets = NULL; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_L8:; - - /* "View.MemoryView":539 - * info.suboffsets = NULL - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: - */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":540 - * - * if flags & PyBUF_FORMAT: - * info.format = self.view.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL - */ - __pyx_t_5 = __pyx_v_self->view.format; - __pyx_v_info->format = __pyx_t_5; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_42writeKirkwoodHistogram(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_aufpunkt_dipole, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, __Pyx_memviewslice __pyx_v_histogram, double __pyx_v_max_distance, int __pyx_v_segments_per_angstroem, int __pyx_v_order) { + int __pyx_v_particles; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_RefNannySetupContext("writeKirkwoodHistogram", 0); - /* "View.MemoryView":539 - * info.suboffsets = NULL + /* "newanalysis/helpers/miscellaneous.pyx":869 + * #TODO documentation * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: - */ - goto __pyx_L9; - } - - /* "View.MemoryView":542 - * info.format = self.view.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< + * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< + * write_Kirkwood_diagram(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0], max_distance, segments_per_angstroem, order) * - * info.buf = self.view.buf */ - /*else*/ { - __pyx_v_info->format = NULL; - } - __pyx_L9:; + __pyx_v_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":544 - * info.format = NULL + /* "newanalysis/helpers/miscellaneous.pyx":870 * - * info.buf = self.view.buf # <<<<<<<<<<<<<< - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - */ - __pyx_t_6 = __pyx_v_self->view.buf; - __pyx_v_info->buf = __pyx_t_6; - - /* "View.MemoryView":545 + * cdef int particles = coor.shape[0] + * write_Kirkwood_diagram(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0], max_distance, segments_per_angstroem, order) # <<<<<<<<<<<<<< * - * info.buf = self.view.buf - * info.ndim = self.view.ndim # <<<<<<<<<<<<<< - * info.itemsize = self.view.itemsize - * info.len = self.view.len - */ - __pyx_t_7 = __pyx_v_self->view.ndim; - __pyx_v_info->ndim = __pyx_t_7; - - /* "View.MemoryView":546 - * info.buf = self.view.buf - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< - * info.len = self.view.len - * info.readonly = self.view.readonly - */ - __pyx_t_8 = __pyx_v_self->view.itemsize; - __pyx_v_info->itemsize = __pyx_t_8; - - /* "View.MemoryView":547 - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - * info.len = self.view.len # <<<<<<<<<<<<<< - * info.readonly = self.view.readonly - * info.obj = self + * def writeKirkwoodHistogramShellwise(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): */ - __pyx_t_8 = __pyx_v_self->view.len; - __pyx_v_info->len = __pyx_t_8; + __pyx_t_1 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_aufpunkt.shape[0]; + __pyx_t_2 = 0; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_aufpunkt_dipole.shape[0]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dip.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dip.shape[1]; + __pyx_t_7 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[0]; + write_Kirkwood_diagram((&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_1 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt_dipole.data + __pyx_t_2 * __pyx_v_aufpunkt_dipole.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_3 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_5 * __pyx_v_dip.strides[0]) ) + __pyx_t_6 * __pyx_v_dip.strides[1]) )))), __pyx_v_particles, (&(*((double *) ( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_7 * __pyx_v_histogram.strides[0]) )))), __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); - /* "View.MemoryView":548 - * info.itemsize = self.view.itemsize - * info.len = self.view.len - * info.readonly = self.view.readonly # <<<<<<<<<<<<<< - * info.obj = self + /* "newanalysis/helpers/miscellaneous.pyx":865 + * write_Mr_diagram(&coor[0,0], &dip[0,0], number_of_particles, &aufpunkt[0], &antagonist[0], &histogram[0], max_distance, segments_per_angstroem, order) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeKirkwoodHistogram(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:] histogram, double max_distance, int segments_per_angstroem, int order = 1): + * #TODO documentation */ - __pyx_t_1 = __pyx_v_self->view.readonly; - __pyx_v_info->readonly = __pyx_t_1; - /* "View.MemoryView":549 - * info.len = self.view.len - * info.readonly = self.view.readonly - * info.obj = self # <<<<<<<<<<<<<< - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") - */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":520 +/* "newanalysis/helpers/miscellaneous.pyx":872 + * write_Kirkwood_diagram(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0], max_distance, segments_per_angstroem, order) * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") + * def writeKirkwoodHistogramShellwise(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< + * ''' + * aufpunkt ... (3) */ - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_45writeKirkwoodHistogramShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_44writeKirkwoodHistogramShellwise, "\n aufpunkt ... (3)\n aufpunkt_dipole ... (3)\n coor ... (number_of_particles, 3)\n dip ... (number_of_particles, 3)\n histogram ... (maxshell, max_distance*segments_per_angstroem)\n norm ... (maxshell)\n dataset ... (number_of_particles)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_45writeKirkwoodHistogramShellwise = {"writeKirkwoodHistogramShellwise", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_45writeKirkwoodHistogramShellwise, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_44writeKirkwoodHistogramShellwise}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_45writeKirkwoodHistogramShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_aufpunkt_dipole = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_norm = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_max_distance; + int __pyx_v_segments_per_angstroem; + int __pyx_v_order; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("writeKirkwoodHistogramShellwise (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 872, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_aufpunkt_dipole,&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_histogram,&__pyx_n_s_norm,&__pyx_n_s_dataset,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,&__pyx_n_s_order,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt_dipole)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 1); __PYX_ERR(0, 872, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 2); __PYX_ERR(0, 872, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 3); __PYX_ERR(0, 872, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histogram)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 4); __PYX_ERR(0, 872, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_norm)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 5); __PYX_ERR(0, 872, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 6); __PYX_ERR(0, 872, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_distance)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 7); __PYX_ERR(0, 872, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_segments_per_angstroem)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 8); __PYX_ERR(0, 872, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order); + if (value) { values[9] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "writeKirkwoodHistogramShellwise") < 0)) __PYX_ERR(0, 872, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 872, __pyx_L3_error) + __pyx_v_aufpunkt_dipole = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt_dipole.memview)) __PYX_ERR(0, 872, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 872, __pyx_L3_error) + __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 872, __pyx_L3_error) + __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 872, __pyx_L3_error) + __pyx_v_norm = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_norm.memview)) __PYX_ERR(0, 872, __pyx_L3_error) + __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 872, __pyx_L3_error) + __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + if (values[9]) { + __pyx_v_order = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 872, __pyx_L3_error) + } else { + __pyx_v_order = ((int)((int)1)); + } } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, __pyx_nargs); __PYX_ERR(0, 872, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_L2:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_norm, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogramShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":555 - * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_44writeKirkwoodHistogramShellwise(__pyx_self, __pyx_v_aufpunkt, __pyx_v_aufpunkt_dipole, __pyx_v_coor, __pyx_v_dip, __pyx_v_histogram, __pyx_v_norm, __pyx_v_dataset, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_norm, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_44writeKirkwoodHistogramShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_aufpunkt_dipole, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, __Pyx_memviewslice __pyx_v_histogram, __Pyx_memviewslice __pyx_v_norm, __Pyx_memviewslice __pyx_v_dataset, double __pyx_v_max_distance, int __pyx_v_segments_per_angstroem, int __pyx_v_order) { + int __pyx_v_particles; + int __pyx_v_maxshell; + int __pyx_v_i; + int __pyx_v_shell; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("writeKirkwoodHistogramShellwise", 0); - /* "View.MemoryView":556 - * @property - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< - * transpose_memslice(&result.from_slice) - * return result + /* "newanalysis/helpers/miscellaneous.pyx":883 + * ''' + * + * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< + * cdef int maxshell = histogram.shape[0] + * cdef int i, shell = 0 */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 556, __pyx_L1_error) - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":557 - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< - * return result + /* "newanalysis/helpers/miscellaneous.pyx":884 + * + * cdef int particles = coor.shape[0] + * cdef int maxshell = histogram.shape[0] # <<<<<<<<<<<<<< + * cdef int i, shell = 0 * */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 557, __pyx_L1_error) + __pyx_v_maxshell = (__pyx_v_histogram.shape[0]); - /* "View.MemoryView":558 - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - * return result # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":885 + * cdef int particles = coor.shape[0] + * cdef int maxshell = histogram.shape[0] + * cdef int i, shell = 0 # <<<<<<<<<<<<<< * - * @property + * for i in range(particles): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + __pyx_v_shell = 0; - /* "View.MemoryView":555 + /* "newanalysis/helpers/miscellaneous.pyx":887 + * cdef int i, shell = 0 * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) + * for i in range(particles): # <<<<<<<<<<<<<< + * shell = dataset[i] - 1 + * if shell >= maxshell: */ + __pyx_t_1 = __pyx_v_particles; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj + /* "newanalysis/helpers/miscellaneous.pyx":888 * + * for i in range(particles): + * shell = dataset[i] - 1 # <<<<<<<<<<<<<< + * if shell >= maxshell: + * shell = maxshell-1 */ + __pyx_t_4 = __pyx_v_i; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_dataset.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_dataset.shape[0])) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + __PYX_ERR(0, 888, __pyx_L1_error) + } + __pyx_v_shell = ((*((char *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_4 * __pyx_v_dataset.strides[0]) ))) - 1); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "newanalysis/helpers/miscellaneous.pyx":889 + * for i in range(particles): + * shell = dataset[i] - 1 + * if shell >= maxshell: # <<<<<<<<<<<<<< + * shell = maxshell-1 + * norm[shell] += 1 + */ + __pyx_t_6 = (__pyx_v_shell >= __pyx_v_maxshell); + if (__pyx_t_6) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":890 + * shell = dataset[i] - 1 + * if shell >= maxshell: + * shell = maxshell-1 # <<<<<<<<<<<<<< + * norm[shell] += 1 + * + */ + __pyx_v_shell = (__pyx_v_maxshell - 1); -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/helpers/miscellaneous.pyx":889 + * for i in range(particles): + * shell = dataset[i] - 1 + * if shell >= maxshell: # <<<<<<<<<<<<<< + * shell = maxshell-1 + * norm[shell] += 1 + */ + } - /* "View.MemoryView":562 - * @property - * def base(self): - * return self.obj # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":891 + * if shell >= maxshell: + * shell = maxshell-1 + * norm[shell] += 1 # <<<<<<<<<<<<<< * - * @property + * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->obj); - __pyx_r = __pyx_v_self->obj; - goto __pyx_L0; + __pyx_t_4 = __pyx_v_shell; + __pyx_t_5 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_norm.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_norm.shape[0])) __pyx_t_5 = 0; + if (unlikely(__pyx_t_5 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_5); + __PYX_ERR(0, 891, __pyx_L1_error) + } + *((double *) ( /* dim=0 */ (__pyx_v_norm.data + __pyx_t_4 * __pyx_v_norm.strides[0]) )) += 1.0; + } - /* "View.MemoryView":561 + /* "newanalysis/helpers/miscellaneous.pyx":893 + * norm[shell] += 1 * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj + * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) # <<<<<<<<<<<<<< + * + * def writeKirkwoodHistogramShellwise(double [:,:] aufpunkte, double [:,:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): + */ + __pyx_t_4 = 0; + __pyx_t_1 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_aufpunkt.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_aufpunkt.shape[0])) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 893, __pyx_L1_error) + } + __pyx_t_7 = 0; + __pyx_t_1 = -1; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_v_aufpunkt_dipole.shape[0]; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_7 >= __pyx_v_aufpunkt_dipole.shape[0])) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 893, __pyx_L1_error) + } + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_1 = -1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_coor.shape[0]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_v_coor.shape[0])) __pyx_t_1 = 0; + if (__pyx_t_9 < 0) { + __pyx_t_9 += __pyx_v_coor.shape[1]; + if (unlikely(__pyx_t_9 < 0)) __pyx_t_1 = 1; + } else if (unlikely(__pyx_t_9 >= __pyx_v_coor.shape[1])) __pyx_t_1 = 1; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 893, __pyx_L1_error) + } + __pyx_t_10 = 0; + __pyx_t_11 = 0; + __pyx_t_1 = -1; + if (__pyx_t_10 < 0) { + __pyx_t_10 += __pyx_v_dip.shape[0]; + if (unlikely(__pyx_t_10 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_10 >= __pyx_v_dip.shape[0])) __pyx_t_1 = 0; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_v_dip.shape[1]; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_1 = 1; + } else if (unlikely(__pyx_t_11 >= __pyx_v_dip.shape[1])) __pyx_t_1 = 1; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 893, __pyx_L1_error) + } + __pyx_t_12 = 0; + __pyx_t_13 = 0; + __pyx_t_1 = -1; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_v_histogram.shape[0]; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_12 >= __pyx_v_histogram.shape[0])) __pyx_t_1 = 0; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_v_histogram.shape[1]; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_1 = 1; + } else if (unlikely(__pyx_t_13 >= __pyx_v_histogram.shape[1])) __pyx_t_1 = 1; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 893, __pyx_L1_error) + } + __pyx_t_14 = 0; + __pyx_t_1 = -1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_v_dataset.shape[0]; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_14 >= __pyx_v_dataset.shape[0])) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 893, __pyx_L1_error) + } + write_Kirkwood_diagram_shellwise((&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_4 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt_dipole.data + __pyx_t_7 * __pyx_v_aufpunkt_dipole.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_10 * __pyx_v_dip.strides[0]) ) + __pyx_t_11 * __pyx_v_dip.strides[1]) )))), __pyx_v_particles, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_12 * __pyx_v_histogram.strides[0]) ) + __pyx_t_13 * __pyx_v_histogram.strides[1]) )))), (&(*((char *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_14 * __pyx_v_dataset.strides[0]) )))), __pyx_v_maxshell, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); + + /* "newanalysis/helpers/miscellaneous.pyx":872 + * write_Kirkwood_diagram(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0], max_distance, segments_per_angstroem, order) * + * def writeKirkwoodHistogramShellwise(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< + * ''' + * aufpunkt ... (3) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogramShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":565 - * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) +/* "newanalysis/helpers/miscellaneous.pyx":895 + * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) * + * def writeKirkwoodHistogramShellwise(double [:,:] aufpunkte, double [:,:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< + * ''' + * aufpunkt ... (number_aufpunkte, 3) */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_47writeKirkwoodHistogramShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_46writeKirkwoodHistogramShellwise, "\n aufpunkt ... (number_aufpunkte, 3)\n aufpunkt_dipole ... (number_aufpunkte, 3)\n coor ... (number_of_particles, 3)\n dip ... (number_of_particles, 3)\n histogram ... (maxshell, max_distance*segments_per_angstroem)\n norm ... (maxshell)\n dataset ... (number_of_particles)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_47writeKirkwoodHistogramShellwise = {"writeKirkwoodHistogramShellwise", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_47writeKirkwoodHistogramShellwise, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_46writeKirkwoodHistogramShellwise}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_47writeKirkwoodHistogramShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_aufpunkte = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_aufpunkt_dipole = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_norm = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_max_distance; + int __pyx_v_segments_per_angstroem; + int __pyx_v_order; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("writeKirkwoodHistogramShellwise (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 895, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkte,&__pyx_n_s_aufpunkt_dipole,&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_histogram,&__pyx_n_s_norm,&__pyx_n_s_dataset,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,&__pyx_n_s_order,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkte)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt_dipole)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 1); __PYX_ERR(0, 895, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 2); __PYX_ERR(0, 895, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 3); __PYX_ERR(0, 895, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histogram)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 4); __PYX_ERR(0, 895, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_norm)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 5); __PYX_ERR(0, 895, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 6); __PYX_ERR(0, 895, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_distance)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 7); __PYX_ERR(0, 895, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_segments_per_angstroem)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, 8); __PYX_ERR(0, 895, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order); + if (value) { values[9] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "writeKirkwoodHistogramShellwise") < 0)) __PYX_ERR(0, 895, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_aufpunkte = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkte.memview)) __PYX_ERR(0, 895, __pyx_L3_error) + __pyx_v_aufpunkt_dipole = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt_dipole.memview)) __PYX_ERR(0, 895, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 895, __pyx_L3_error) + __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 895, __pyx_L3_error) + __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 895, __pyx_L3_error) + __pyx_v_norm = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_norm.memview)) __PYX_ERR(0, 895, __pyx_L3_error) + __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 895, __pyx_L3_error) + __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + if (values[9]) { + __pyx_v_order = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 895, __pyx_L3_error) + } else { + __pyx_v_order = ((int)((int)1)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogramShellwise", 0, 9, 10, __pyx_nargs); __PYX_ERR(0, 895, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkte, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_norm, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogramShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_46writeKirkwoodHistogramShellwise(__pyx_self, __pyx_v_aufpunkte, __pyx_v_aufpunkt_dipole, __pyx_v_coor, __pyx_v_dip, __pyx_v_histogram, __pyx_v_norm, __pyx_v_dataset, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkte, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_norm, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_length; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_46writeKirkwoodHistogramShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkte, __Pyx_memviewslice __pyx_v_aufpunkt_dipole, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, __Pyx_memviewslice __pyx_v_histogram, __Pyx_memviewslice __pyx_v_norm, __Pyx_memviewslice __pyx_v_dataset, double __pyx_v_max_distance, int __pyx_v_segments_per_angstroem, int __pyx_v_order) { + int __pyx_v_number_aufpunkte; + int __pyx_v_particles; + int __pyx_v_maxshell; + int __pyx_v_i; + int __pyx_v_shell; + __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_aufpunkt_dipol = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("writeKirkwoodHistogramShellwise", 0); - /* "View.MemoryView":566 - * @property - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":906 + * ''' * - * @property + * cdef int number_aufpunkte = aufpunkte.shape[0] # <<<<<<<<<<<<<< + * cdef int particles = coor.shape[0] + * cdef int maxshell = histogram.shape[0] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_length = (__pyx_t_2[0]); - __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __pyx_v_number_aufpunkte = (__pyx_v_aufpunkte.shape[0]); - /* "View.MemoryView":565 + /* "newanalysis/helpers/miscellaneous.pyx":907 * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) + * cdef int number_aufpunkte = aufpunkte.shape[0] + * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< + * cdef int maxshell = histogram.shape[0] + * cdef int i, shell = 0 + */ + __pyx_v_particles = (__pyx_v_coor.shape[0]); + + /* "newanalysis/helpers/miscellaneous.pyx":908 + * cdef int number_aufpunkte = aufpunkte.shape[0] + * cdef int particles = coor.shape[0] + * cdef int maxshell = histogram.shape[0] # <<<<<<<<<<<<<< + * cdef int i, shell = 0 + * cdef double [:] aufpunkt = np.zeros(3) + */ + __pyx_v_maxshell = (__pyx_v_histogram.shape[0]); + + /* "newanalysis/helpers/miscellaneous.pyx":909 + * cdef int particles = coor.shape[0] + * cdef int maxshell = histogram.shape[0] + * cdef int i, shell = 0 # <<<<<<<<<<<<<< + * cdef double [:] aufpunkt = np.zeros(3) + * cdef double [:] aufpunkt_dipol = np.zeros(3) + */ + __pyx_v_shell = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":910 + * cdef int maxshell = histogram.shape[0] + * cdef int i, shell = 0 + * cdef double [:] aufpunkt = np.zeros(3) # <<<<<<<<<<<<<< + * cdef double [:] aufpunkt_dipol = np.zeros(3) * */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 910, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 910, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 910, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 910, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_aufpunkt = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":911 + * cdef int i, shell = 0 + * cdef double [:] aufpunkt = np.zeros(3) + * cdef double [:] aufpunkt_dipol = np.zeros(3) # <<<<<<<<<<<<<< + * + * for i in range(particles): + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 911, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 911, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_int_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 911, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_aufpunkt_dipol = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; -/* "View.MemoryView":569 + /* "newanalysis/helpers/miscellaneous.pyx":913 + * cdef double [:] aufpunkt_dipol = np.zeros(3) * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: + * for i in range(particles): # <<<<<<<<<<<<<< + * shell = dataset[i] - 1 + * if shell >= maxshell: + */ + __pyx_t_4 = __pyx_v_particles; + __pyx_t_6 = __pyx_t_4; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "newanalysis/helpers/miscellaneous.pyx":914 * + * for i in range(particles): + * shell = dataset[i] - 1 # <<<<<<<<<<<<<< + * if shell >= maxshell: + * shell = maxshell-1 */ + __pyx_t_8 = __pyx_v_i; + __pyx_t_9 = -1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_dataset.shape[0]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_v_dataset.shape[0])) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 914, __pyx_L1_error) + } + __pyx_v_shell = ((*((char *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_8 * __pyx_v_dataset.strides[0]) ))) - 1); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "newanalysis/helpers/miscellaneous.pyx":915 + * for i in range(particles): + * shell = dataset[i] - 1 + * if shell >= maxshell: # <<<<<<<<<<<<<< + * shell = maxshell-1 + * norm[shell] += 1 + */ + __pyx_t_10 = (__pyx_v_shell >= __pyx_v_maxshell); + if (__pyx_t_10) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":916 + * shell = dataset[i] - 1 + * if shell >= maxshell: + * shell = maxshell-1 # <<<<<<<<<<<<<< + * norm[shell] += 1 + * + */ + __pyx_v_shell = (__pyx_v_maxshell - 1); -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_stride; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "newanalysis/helpers/miscellaneous.pyx":915 + * for i in range(particles): + * shell = dataset[i] - 1 + * if shell >= maxshell: # <<<<<<<<<<<<<< + * shell = maxshell-1 + * norm[shell] += 1 + */ + } - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":917 + * if shell >= maxshell: + * shell = maxshell-1 + * norm[shell] += 1 # <<<<<<<<<<<<<< * - * raise ValueError("Buffer view does not expose strides") + * for i in range(number_aufpunkte): */ - __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_8 = __pyx_v_shell; + __pyx_t_9 = -1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_norm.shape[0]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_v_norm.shape[0])) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 917, __pyx_L1_error) + } + *((double *) ( /* dim=0 */ (__pyx_v_norm.data + __pyx_t_8 * __pyx_v_norm.strides[0]) )) += 1.0; + } - /* "View.MemoryView":572 - * if self.view.strides == NULL: + /* "newanalysis/helpers/miscellaneous.pyx":919 + * norm[shell] += 1 * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< + * for i in range(number_aufpunkte): # <<<<<<<<<<<<<< + * aufpunkt = aufpunkte[i] + * aufpunkt_dipol = aufpunkt_dipole[i] + */ + __pyx_t_4 = __pyx_v_number_aufpunkte; + __pyx_t_6 = __pyx_t_4; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "newanalysis/helpers/miscellaneous.pyx":920 + * + * for i in range(number_aufpunkte): + * aufpunkt = aufpunkte[i] # <<<<<<<<<<<<<< + * aufpunkt_dipol = aufpunkt_dipole[i] * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_t_5.data = __pyx_v_aufpunkte.data; + __pyx_t_5.memview = __pyx_v_aufpunkte.memview; + __PYX_INC_MEMVIEW(&__pyx_t_5, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_i; + Py_ssize_t __pyx_tmp_shape = __pyx_v_aufpunkte.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_aufpunkte.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + if (unlikely(!__Pyx_is_valid_index(__pyx_tmp_idx, __pyx_tmp_shape))) { + PyErr_SetString(PyExc_IndexError, + "Index out of bounds (axis 0)"); + __PYX_ERR(0, 920, __pyx_L1_error) + } + __pyx_t_5.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< +__pyx_t_5.shape[0] = __pyx_v_aufpunkte.shape[1]; +__pyx_t_5.strides[0] = __pyx_v_aufpunkte.strides[1]; + __pyx_t_5.suboffsets[0] = -1; + +__PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __pyx_v_aufpunkt = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; + + /* "newanalysis/helpers/miscellaneous.pyx":921 + * for i in range(number_aufpunkte): + * aufpunkt = aufpunkte[i] + * aufpunkt_dipol = aufpunkt_dipole[i] # <<<<<<<<<<<<<< * - * raise ValueError("Buffer view does not expose strides") + * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipol[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) */ - } + __pyx_t_5.data = __pyx_v_aufpunkt_dipole.data; + __pyx_t_5.memview = __pyx_v_aufpunkt_dipole.memview; + __PYX_INC_MEMVIEW(&__pyx_t_5, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_i; + Py_ssize_t __pyx_tmp_shape = __pyx_v_aufpunkt_dipole.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_aufpunkt_dipole.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + if (unlikely(!__Pyx_is_valid_index(__pyx_tmp_idx, __pyx_tmp_shape))) { + PyErr_SetString(PyExc_IndexError, + "Index out of bounds (axis 0)"); + __PYX_ERR(0, 921, __pyx_L1_error) + } + __pyx_t_5.data += __pyx_tmp_idx * __pyx_tmp_stride; +} + +__pyx_t_5.shape[0] = __pyx_v_aufpunkt_dipole.shape[1]; +__pyx_t_5.strides[0] = __pyx_v_aufpunkt_dipole.strides[1]; + __pyx_t_5.suboffsets[0] = -1; - /* "View.MemoryView":574 - * raise ValueError("Buffer view does not expose strides") +__PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt_dipol, 1); + __pyx_v_aufpunkt_dipol = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; + + /* "newanalysis/helpers/miscellaneous.pyx":923 + * aufpunkt_dipol = aufpunkt_dipole[i] * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipol[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) # <<<<<<<<<<<<<< * - * @property + * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_v_stride = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = -1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_aufpunkt.shape[0]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_v_aufpunkt.shape[0])) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 923, __pyx_L1_error) + } + __pyx_t_11 = 0; + __pyx_t_9 = -1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_v_aufpunkt_dipol.shape[0]; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_11 >= __pyx_v_aufpunkt_dipol.shape[0])) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 923, __pyx_L1_error) + } + __pyx_t_12 = 0; + __pyx_t_13 = 0; + __pyx_t_9 = -1; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_v_coor.shape[0]; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_12 >= __pyx_v_coor.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_v_coor.shape[1]; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_13 >= __pyx_v_coor.shape[1])) __pyx_t_9 = 1; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 923, __pyx_L1_error) + } + __pyx_t_14 = 0; + __pyx_t_15 = 0; + __pyx_t_9 = -1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_v_dip.shape[0]; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_14 >= __pyx_v_dip.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_15 < 0) { + __pyx_t_15 += __pyx_v_dip.shape[1]; + if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_15 >= __pyx_v_dip.shape[1])) __pyx_t_9 = 1; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 923, __pyx_L1_error) + } + __pyx_t_16 = 0; + __pyx_t_17 = 0; + __pyx_t_9 = -1; + if (__pyx_t_16 < 0) { + __pyx_t_16 += __pyx_v_histogram.shape[0]; + if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_16 >= __pyx_v_histogram.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_17 < 0) { + __pyx_t_17 += __pyx_v_histogram.shape[1]; + if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_17 >= __pyx_v_histogram.shape[1])) __pyx_t_9 = 1; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 923, __pyx_L1_error) + } + __pyx_t_18 = 0; + __pyx_t_9 = -1; + if (__pyx_t_18 < 0) { + __pyx_t_18 += __pyx_v_dataset.shape[0]; + if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_18 >= __pyx_v_dataset.shape[0])) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 923, __pyx_L1_error) + } + write_Kirkwood_diagram_shellwise((&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_8 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt_dipol.data + __pyx_t_11 * __pyx_v_aufpunkt_dipol.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_12 * __pyx_v_coor.strides[0]) ) + __pyx_t_13 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_14 * __pyx_v_dip.strides[0]) ) + __pyx_t_15 * __pyx_v_dip.strides[1]) )))), __pyx_v_particles, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_16 * __pyx_v_histogram.strides[0]) ) + __pyx_t_17 * __pyx_v_histogram.strides[1]) )))), (&(*((char *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_18 * __pyx_v_dataset.strides[0]) )))), __pyx_v_maxshell, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_order); } - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - /* "View.MemoryView":569 - * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: + /* "newanalysis/helpers/miscellaneous.pyx":895 + * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) * + * def writeKirkwoodHistogramShellwise(double [:,:] aufpunkte, double [:,:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< + * ''' + * aufpunkt ... (number_aufpunkte, 3) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogramShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt_dipol, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":577 +/* "newanalysis/helpers/miscellaneous.pyx":925 + * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipol[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeKirkwoodHistogram2D(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double max_distance, int segments_per_angstroem, int segments_per_pi, int order = 1): + * #TODO documentation */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_49writeKirkwoodHistogram2D(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_49writeKirkwoodHistogram2D = {"writeKirkwoodHistogram2D", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_49writeKirkwoodHistogram2D, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_49writeKirkwoodHistogram2D(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_aufpunkt_dipole = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_max_distance; + int __pyx_v_segments_per_angstroem; + int __pyx_v_segments_per_pi; + int __pyx_v_order; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("writeKirkwoodHistogram2D (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 925, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_aufpunkt_dipole,&__pyx_n_s_coor,&__pyx_n_s_dip,&__pyx_n_s_histogram,&__pyx_n_s_max_distance,&__pyx_n_s_segments_per_angstroem,&__pyx_n_s_segments_per_pi,&__pyx_n_s_order,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt_dipole)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 1); __PYX_ERR(0, 925, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 2); __PYX_ERR(0, 925, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 3); __PYX_ERR(0, 925, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histogram)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 4); __PYX_ERR(0, 925, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_distance)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 5); __PYX_ERR(0, 925, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_segments_per_angstroem)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 6); __PYX_ERR(0, 925, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_segments_per_pi)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, 7); __PYX_ERR(0, 925, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order); + if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "writeKirkwoodHistogram2D") < 0)) __PYX_ERR(0, 925, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 926, __pyx_L3_error) + __pyx_v_aufpunkt_dipole = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt_dipole.memview)) __PYX_ERR(0, 926, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 926, __pyx_L3_error) + __pyx_v_dip = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip.memview)) __PYX_ERR(0, 926, __pyx_L3_error) + __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 926, __pyx_L3_error) + __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L3_error) + __pyx_v_segments_per_angstroem = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_segments_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L3_error) + __pyx_v_segments_per_pi = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_segments_per_pi == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L3_error) + if (values[8]) { + __pyx_v_order = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L3_error) + } else { + __pyx_v_order = ((int)((int)1)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("writeKirkwoodHistogram2D", 0, 8, 9, __pyx_nargs); __PYX_ERR(0, 925, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.writeKirkwoodHistogram2D", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_48writeKirkwoodHistogram2D(__pyx_self, __pyx_v_aufpunkt, __pyx_v_aufpunkt_dipole, __pyx_v_coor, __pyx_v_dip, __pyx_v_histogram, __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_segments_per_pi, __pyx_v_order); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt_dipole, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_suboffset; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_48writeKirkwoodHistogram2D(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_aufpunkt_dipole, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dip, __Pyx_memviewslice __pyx_v_histogram, double __pyx_v_max_distance, int __pyx_v_segments_per_angstroem, int __pyx_v_segments_per_pi, int __pyx_v_order) { + int __pyx_v_particles; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - Py_ssize_t *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim - * - */ - __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); - if (__pyx_t_1) { + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + __Pyx_RefNannySetupContext("writeKirkwoodHistogram2D", 0); - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":929 + * #TODO documentation * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__16, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim + * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< + * write_Kirkwood_diagram_2D(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], max_distance, segments_per_angstroem, segments_per_pi, order) * */ - } + __pyx_v_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":581 - * return (-1,) * self.view.ndim + /* "newanalysis/helpers/miscellaneous.pyx":930 * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * cdef int particles = coor.shape[0] + * write_Kirkwood_diagram_2D(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], max_distance, segments_per_angstroem, segments_per_pi, order) # <<<<<<<<<<<<<< * - * @property + * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); - for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) { - __pyx_t_4 = __pyx_t_6; - __pyx_v_suboffset = (__pyx_t_4[0]); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; + __pyx_t_1 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_aufpunkt.shape[0]; __pyx_t_2 = 0; - goto __pyx_L0; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_aufpunkt_dipole.shape[0]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor.shape[1]; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dip.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dip.shape[1]; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_histogram.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_histogram.shape[1]; + write_Kirkwood_diagram_2D((&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_1 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt_dipole.data + __pyx_t_2 * __pyx_v_aufpunkt_dipole.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_3 * __pyx_v_coor.strides[0]) ) + __pyx_t_4 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip.data + __pyx_t_5 * __pyx_v_dip.strides[0]) ) + __pyx_t_6 * __pyx_v_dip.strides[1]) )))), __pyx_v_particles, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_7 * __pyx_v_histogram.strides[0]) ) + __pyx_t_8 * __pyx_v_histogram.strides[1]) )))), __pyx_v_max_distance, __pyx_v_segments_per_angstroem, __pyx_v_segments_per_pi, __pyx_v_order); - /* "View.MemoryView":577 + /* "newanalysis/helpers/miscellaneous.pyx":925 + * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipol[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeKirkwoodHistogram2D(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double max_distance, int segments_per_angstroem, int segments_per_pi, int order = 1): + * #TODO documentation */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":584 - * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim +/* "newanalysis/helpers/miscellaneous.pyx":932 + * write_Kirkwood_diagram_2D(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], max_distance, segments_per_angstroem, segments_per_pi, order) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBondTable(double [:,:] coor, int [:,:] bond_table, int cutoff = 3): + * ''' */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_51getBondTable(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_50getBondTable, "\n coor ... (n_particles, 3)\n bond_table ... (n_particles, n_particles)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_51getBondTable = {"getBondTable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_51getBondTable, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_50getBondTable}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_51getBondTable(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_bond_table = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_cutoff; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("getBondTable (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 932, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_bond_table,&__pyx_n_s_cutoff,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bond_table)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("getBondTable", 0, 2, 3, 1); __PYX_ERR(0, 932, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cutoff); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "getBondTable") < 0)) __PYX_ERR(0, 932, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 933, __pyx_L3_error) + __pyx_v_bond_table = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_bond_table.memview)) __PYX_ERR(0, 933, __pyx_L3_error) + if (values[2]) { + __pyx_v_cutoff = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_cutoff == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 933, __pyx_L3_error) + } else { + __pyx_v_cutoff = ((int)((int)3)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("getBondTable", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 932, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_bond_table, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.getBondTable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_50getBondTable(__pyx_self, __pyx_v_coor, __pyx_v_bond_table, __pyx_v_cutoff); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_bond_table, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_50getBondTable(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_bond_table, int __pyx_v_cutoff) { + int __pyx_v_n_particles; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + __Pyx_RefNannySetupContext("getBondTable", 0); - /* "View.MemoryView":585 - * @property - * def ndim(self): - * return self.view.ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":939 + * ''' + * + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< + * calc_donor_grid(&coor[0,0], &bond_table[0,0], n_particles, cutoff) * - * @property */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 585, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":584 + /* "newanalysis/helpers/miscellaneous.pyx":940 * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim + * cdef int n_particles = coor.shape[0] + * calc_donor_grid(&coor[0,0], &bond_table[0,0], n_particles, cutoff) # <<<<<<<<<<<<<< + * + * #@cython.boundscheck(False) + */ + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_bond_table.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_bond_table.shape[1]; + calc_donor_grid((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), (&(*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_bond_table.data + __pyx_t_3 * __pyx_v_bond_table.strides[0]) ) + __pyx_t_4 * __pyx_v_bond_table.strides[1]) )))), __pyx_v_n_particles, __pyx_v_cutoff); + + /* "newanalysis/helpers/miscellaneous.pyx":932 + * write_Kirkwood_diagram_2D(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], max_distance, segments_per_angstroem, segments_per_pi, order) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBondTable(double [:,:] coor, int [:,:] bond_table, int cutoff = 3): + * ''' */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":588 +/* "newanalysis/helpers/miscellaneous.pyx":954 + * # calc_sum_Venn_MD_Cage_Single(&mdcage_timeseries[0,0,0], &dipoles[0,0], n_particles, &dataset1[0], &dataset2[0], maxshell1, maxshell2) * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumVennMDCageSingle(double [:,:,:,:] mdcage_timeseries, double [:,:] dipoles, char [:] dataset1, char [:] dataset2, int maxshell1, int maxshell2, int frame): * */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_53sumVennMDCageSingle(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_53sumVennMDCageSingle = {"sumVennMDCageSingle", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_53sumVennMDCageSingle, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_53sumVennMDCageSingle(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_mdcage_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell1; + int __pyx_v_maxshell2; + int __pyx_v_frame; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("sumVennMDCageSingle (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 954, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mdcage_timeseries,&__pyx_n_s_dipoles,&__pyx_n_s_dataset1,&__pyx_n_s_dataset2,&__pyx_n_s_maxshell1,&__pyx_n_s_maxshell2,&__pyx_n_s_frame,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mdcage_timeseries)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 954, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dipoles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 954, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 1); __PYX_ERR(0, 954, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 954, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 2); __PYX_ERR(0, 954, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 954, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 3); __PYX_ERR(0, 954, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 954, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 4); __PYX_ERR(0, 954, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 954, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 5); __PYX_ERR(0, 954, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frame)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 954, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, 6); __PYX_ERR(0, 954, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sumVennMDCageSingle") < 0)) __PYX_ERR(0, 954, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 7)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + } + __pyx_v_mdcage_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mdcage_timeseries.memview)) __PYX_ERR(0, 955, __pyx_L3_error) + __pyx_v_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dipoles.memview)) __PYX_ERR(0, 955, __pyx_L3_error) + __pyx_v_dataset1 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset1.memview)) __PYX_ERR(0, 955, __pyx_L3_error) + __pyx_v_dataset2 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset2.memview)) __PYX_ERR(0, 955, __pyx_L3_error) + __pyx_v_maxshell1 = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 955, __pyx_L3_error) + __pyx_v_maxshell2 = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_maxshell2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 955, __pyx_L3_error) + __pyx_v_frame = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_frame == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 955, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sumVennMDCageSingle", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 954, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mdcage_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset2, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.sumVennMDCageSingle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_52sumVennMDCageSingle(__pyx_self, __pyx_v_mdcage_timeseries, __pyx_v_dipoles, __pyx_v_dataset1, __pyx_v_dataset2, __pyx_v_maxshell1, __pyx_v_maxshell2, __pyx_v_frame); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mdcage_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset2, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_52sumVennMDCageSingle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_mdcage_timeseries, __Pyx_memviewslice __pyx_v_dipoles, __Pyx_memviewslice __pyx_v_dataset1, __Pyx_memviewslice __pyx_v_dataset2, int __pyx_v_maxshell1, int __pyx_v_maxshell2, int __pyx_v_frame) { + int __pyx_v_w; + int __pyx_v_shell1; + int __pyx_v_shell2; + int __pyx_v_i; + int __pyx_v_nres_wat; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + __Pyx_RefNannySetupContext("sumVennMDCageSingle", 0); - /* "View.MemoryView":589 - * @property - * def itemsize(self): - * return self.view.itemsize # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":957 + * def sumVennMDCageSingle(double [:,:,:,:] mdcage_timeseries, double [:,:] dipoles, char [:] dataset1, char [:] dataset2, int maxshell1, int maxshell2, int frame): * - * @property + * cdef int w, shell1, shell2, i, nres_wat = dipoles.shape[0] # <<<<<<<<<<<<<< + * + * for w in range(nres_wat): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_nres_wat = (__pyx_v_dipoles.shape[0]); - /* "View.MemoryView":588 - * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize + /* "newanalysis/helpers/miscellaneous.pyx":959 + * cdef int w, shell1, shell2, i, nres_wat = dipoles.shape[0] * + * for w in range(nres_wat): # <<<<<<<<<<<<<< + * shell1 = dataset1[w]-1 + * shell2 = dataset2[w]-1 */ + __pyx_t_1 = __pyx_v_nres_wat; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_w = __pyx_t_3; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":592 + /* "newanalysis/helpers/miscellaneous.pyx":960 * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize + * for w in range(nres_wat): + * shell1 = dataset1[w]-1 # <<<<<<<<<<<<<< + * shell2 = dataset2[w]-1 * */ + __pyx_t_4 = __pyx_v_w; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dataset1.shape[0]; + __pyx_v_shell1 = ((*((char *) ( /* dim=0 */ (__pyx_v_dataset1.data + __pyx_t_4 * __pyx_v_dataset1.strides[0]) ))) - 1); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":593 - * @property - * def nbytes(self): - * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":961 + * for w in range(nres_wat): + * shell1 = dataset1[w]-1 + * shell2 = dataset2[w]-1 # <<<<<<<<<<<<<< * - * @property + * if shell1 >= maxshell1: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_4 = __pyx_v_w; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dataset2.shape[0]; + __pyx_v_shell2 = ((*((char *) ( /* dim=0 */ (__pyx_v_dataset2.data + __pyx_t_4 * __pyx_v_dataset2.strides[0]) ))) - 1); - /* "View.MemoryView":592 + /* "newanalysis/helpers/miscellaneous.pyx":963 + * shell2 = dataset2[w]-1 * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize + * if shell1 >= maxshell1: # <<<<<<<<<<<<<< + * shell1 = maxshell1 * */ + __pyx_t_5 = (__pyx_v_shell1 >= __pyx_v_maxshell1); + if (__pyx_t_5) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":596 + /* "newanalysis/helpers/miscellaneous.pyx":964 * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 + * if shell1 >= maxshell1: + * shell1 = maxshell1 # <<<<<<<<<<<<<< + * + * if shell2 >= maxshell2: */ + __pyx_v_shell1 = __pyx_v_maxshell1; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 + /* "newanalysis/helpers/miscellaneous.pyx":963 + * shell2 = dataset2[w]-1 + * + * if shell1 >= maxshell1: # <<<<<<<<<<<<<< + * shell1 = maxshell1 * */ - __pyx_t_1 = (__pyx_v_self->_size == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + } - /* "View.MemoryView":598 - * def size(self): - * if self._size is None: - * result = 1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":966 + * shell1 = maxshell1 + * + * if shell2 >= maxshell2: # <<<<<<<<<<<<<< + * shell2 = maxshell2 * - * for length in self.view.shape[:self.view.ndim]: */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_result = __pyx_int_1; + __pyx_t_5 = (__pyx_v_shell2 >= __pyx_v_maxshell2); + if (__pyx_t_5) { - /* "View.MemoryView":600 - * result = 1 + /* "newanalysis/helpers/miscellaneous.pyx":967 * - * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< - * result *= length + * if shell2 >= maxshell2: + * shell2 = maxshell2 # <<<<<<<<<<<<<< * + * for i in range(3): */ - __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6); - __pyx_t_6 = 0; + __pyx_v_shell2 = __pyx_v_maxshell2; - /* "View.MemoryView":601 + /* "newanalysis/helpers/miscellaneous.pyx":966 + * shell1 = maxshell1 * - * for length in self.view.shape[:self.view.ndim]: - * result *= length # <<<<<<<<<<<<<< + * if shell2 >= maxshell2: # <<<<<<<<<<<<<< + * shell2 = maxshell2 * - * self._size = result */ - __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 601, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6); - __pyx_t_6 = 0; } - /* "View.MemoryView":603 - * result *= length + /* "newanalysis/helpers/miscellaneous.pyx":969 + * shell2 = maxshell2 * - * self._size = result # <<<<<<<<<<<<<< + * for i in range(3): # <<<<<<<<<<<<<< + * mdcage_timeseries[shell1, shell2, frame, i] += dipoles[w, i] * - * return self._size */ - __Pyx_INCREF(__pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - __Pyx_GOTREF(__pyx_v_self->_size); - __Pyx_DECREF(__pyx_v_self->_size); - __pyx_v_self->_size = __pyx_v_result; + for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 + /* "newanalysis/helpers/miscellaneous.pyx":970 * + * for i in range(3): + * mdcage_timeseries[shell1, shell2, frame, i] += dipoles[w, i] # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ + __pyx_t_4 = __pyx_v_w; + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dipoles.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dipoles.shape[1]; + __pyx_t_8 = __pyx_v_shell1; + __pyx_t_9 = __pyx_v_shell2; + __pyx_t_10 = __pyx_v_frame; + __pyx_t_11 = __pyx_v_i; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_mdcage_timeseries.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_mdcage_timeseries.shape[1]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_mdcage_timeseries.shape[2]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_mdcage_timeseries.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_timeseries.data + __pyx_t_8 * __pyx_v_mdcage_timeseries.strides[0]) ) + __pyx_t_9 * __pyx_v_mdcage_timeseries.strides[1]) ) + __pyx_t_10 * __pyx_v_mdcage_timeseries.strides[2]) ) + __pyx_t_11 * __pyx_v_mdcage_timeseries.strides[3]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipoles.data + __pyx_t_4 * __pyx_v_dipoles.strides[0]) ) + __pyx_t_7 * __pyx_v_dipoles.strides[1]) ))); + } } - /* "View.MemoryView":605 - * self._size = result - * - * return self._size # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":954 + * # calc_sum_Venn_MD_Cage_Single(&mdcage_timeseries[0,0,0], &dipoles[0,0], n_particles, &dataset1[0], &dataset2[0], maxshell1, maxshell2) * - * def __len__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_size); - __pyx_r = __pyx_v_self->_size; - goto __pyx_L0; - - /* "View.MemoryView":596 + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumVennMDCageSingle(double [:,:,:,:] mdcage_timeseries, double [:,:] dipoles, char [:] dataset1, char [:] dataset2, int maxshell1, int maxshell2, int frame): * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":607 - * return self._size +/* "newanalysis/helpers/miscellaneous.pyx":972 + * mdcage_timeseries[shell1, shell2, frame, i] += dipoles[w, i] + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMultiMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, char [:] ds1, char [:] ds2, char [:] ds3, char [:] ds4, char [:] ds5, int maxshell, int frame): * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] */ /* Python wrapper */ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_55sumMultiMDCageSingle(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_55sumMultiMDCageSingle = {"sumMultiMDCageSingle", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_55sumMultiMDCageSingle, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_55sumMultiMDCageSingle(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_mdcage_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip_wat = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds3 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds4 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell; + int __pyx_v_frame; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("sumMultiMDCageSingle (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 972, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mdcage_ts,&__pyx_n_s_dip_wat,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_ds3,&__pyx_n_s_ds4,&__pyx_n_s_ds5,&__pyx_n_s_maxshell,&__pyx_n_s_frame,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mdcage_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 972, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_wat)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 972, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 1); __PYX_ERR(0, 972, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 972, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 2); __PYX_ERR(0, 972, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 972, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 3); __PYX_ERR(0, 972, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds3)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 972, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 4); __PYX_ERR(0, 972, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds4)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 972, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 5); __PYX_ERR(0, 972, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds5)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 972, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 6); __PYX_ERR(0, 972, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 972, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 7); __PYX_ERR(0, 972, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frame)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 972, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, 8); __PYX_ERR(0, 972, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sumMultiMDCageSingle") < 0)) __PYX_ERR(0, 972, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 9)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + } + __pyx_v_mdcage_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mdcage_ts.memview)) __PYX_ERR(0, 973, __pyx_L3_error) + __pyx_v_dip_wat = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_wat.memview)) __PYX_ERR(0, 973, __pyx_L3_error) + __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 973, __pyx_L3_error) + __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 973, __pyx_L3_error) + __pyx_v_ds3 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds3.memview)) __PYX_ERR(0, 973, __pyx_L3_error) + __pyx_v_ds4 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds4.memview)) __PYX_ERR(0, 973, __pyx_L3_error) + __pyx_v_ds5 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds5.memview)) __PYX_ERR(0, 973, __pyx_L3_error) + __pyx_v_maxshell = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 973, __pyx_L3_error) + __pyx_v_frame = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_frame == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 973, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sumMultiMDCageSingle", 1, 9, 9, __pyx_nargs); __PYX_ERR(0, 972, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mdcage_ts, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_wat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds3, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds4, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds5, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.sumMultiMDCageSingle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_54sumMultiMDCageSingle(__pyx_self, __pyx_v_mdcage_ts, __pyx_v_dip_wat, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_ds3, __pyx_v_ds4, __pyx_v_ds5, __pyx_v_maxshell, __pyx_v_frame); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_mdcage_ts, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_wat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds3, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds4, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds5, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_54sumMultiMDCageSingle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_mdcage_ts, __Pyx_memviewslice __pyx_v_dip_wat, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, __Pyx_memviewslice __pyx_v_ds3, __Pyx_memviewslice __pyx_v_ds4, __Pyx_memviewslice __pyx_v_ds5, int __pyx_v_maxshell, int __pyx_v_frame) { + int __pyx_v_w; + int __pyx_v_shell; + int __pyx_v_i; + int __pyx_v_nres_wat; + int __pyx_v_shell1; + int __pyx_v_shell2; + int __pyx_v_shell3; + int __pyx_v_shell4; + int __pyx_v_shell5; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__len__", 0); + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + __Pyx_RefNannySetupContext("sumMultiMDCageSingle", 0); - /* "View.MemoryView":608 + /* "newanalysis/helpers/miscellaneous.pyx":975 + * def sumMultiMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, char [:] ds1, char [:] ds2, char [:] ds3, char [:] ds4, char [:] ds5, int maxshell, int frame): * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] + * cdef int w, shell, i, nres_wat = dip_wat.shape[0] # <<<<<<<<<<<<<< + * cdef int shell1, shell2, shell3, shell4, shell5 * */ - __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); - if (__pyx_t_1) { + __pyx_v_nres_wat = (__pyx_v_dip_wat.shape[0]); - /* "View.MemoryView":609 - * def __len__(self): - * if self.view.ndim >= 1: - * return self.view.shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":978 + * cdef int shell1, shell2, shell3, shell4, shell5 * - * return 0 + * for w in range(nres_wat): # <<<<<<<<<<<<<< + * shell1 = ds1[w]-1 + * shell2 = ds2[w]-1 */ - __pyx_r = (__pyx_v_self->view.shape[0]); - goto __pyx_L0; + __pyx_t_1 = __pyx_v_nres_wat; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_w = __pyx_t_3; - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":979 * + * for w in range(nres_wat): + * shell1 = ds1[w]-1 # <<<<<<<<<<<<<< + * shell2 = ds2[w]-1 + * shell3 = ds3[w]-1 */ - } + __pyx_t_4 = __pyx_v_w; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds1.shape[0]; + __pyx_v_shell1 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_4 * __pyx_v_ds1.strides[0]) ))) - 1); - /* "View.MemoryView":611 - * return self.view.shape[0] - * - * return 0 # <<<<<<<<<<<<<< - * - * def __repr__(self): + /* "newanalysis/helpers/miscellaneous.pyx":980 + * for w in range(nres_wat): + * shell1 = ds1[w]-1 + * shell2 = ds2[w]-1 # <<<<<<<<<<<<<< + * shell3 = ds3[w]-1 + * shell4 = ds4[w]-1 */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_4 = __pyx_v_w; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds2.shape[0]; + __pyx_v_shell2 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_4 * __pyx_v_ds2.strides[0]) ))) - 1); - /* "View.MemoryView":607 - * return self._size - * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":981 + * shell1 = ds1[w]-1 + * shell2 = ds2[w]-1 + * shell3 = ds3[w]-1 # <<<<<<<<<<<<<< + * shell4 = ds4[w]-1 + * shell5 = ds5[w]-1 */ + __pyx_t_4 = __pyx_v_w; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds3.shape[0]; + __pyx_v_shell3 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds3.data + __pyx_t_4 * __pyx_v_ds3.strides[0]) ))) - 1); - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":613 - * return 0 + /* "newanalysis/helpers/miscellaneous.pyx":982 + * shell2 = ds2[w]-1 + * shell3 = ds3[w]-1 + * shell4 = ds4[w]-1 # <<<<<<<<<<<<<< + * shell5 = ds5[w]-1 * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) */ + __pyx_t_4 = __pyx_v_w; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds4.shape[0]; + __pyx_v_shell4 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds4.data + __pyx_t_4 * __pyx_v_ds4.strides[0]) ))) - 1); -/* Python wrapper */ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "View.MemoryView":614 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) + /* "newanalysis/helpers/miscellaneous.pyx":983 + * shell3 = ds3[w]-1 + * shell4 = ds4[w]-1 + * shell5 = ds5[w]-1 # <<<<<<<<<<<<<< * + * shell = min(shell1, shell2, shell3, shell4, shell5) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_v_w; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds5.shape[0]; + __pyx_v_shell5 = ((*((char *) ( /* dim=0 */ (__pyx_v_ds5.data + __pyx_t_4 * __pyx_v_ds5.strides[0]) ))) - 1); - /* "View.MemoryView":615 - * def __repr__(self): - * return "" % (self.base.__class__.__name__, - * id(self)) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":985 + * shell5 = ds5[w]-1 * - * def __str__(self): + * shell = min(shell1, shell2, shell3, shell4, shell5) # <<<<<<<<<<<<<< + * + * if shell < maxshell: */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __pyx_v_shell2; + __pyx_t_6 = __pyx_v_shell3; + __pyx_t_7 = __pyx_v_shell4; + __pyx_t_8 = __pyx_v_shell5; + __pyx_t_9 = __pyx_v_shell1; + __pyx_t_11 = (__pyx_t_5 < __pyx_t_9); + if (__pyx_t_11) { + __pyx_t_10 = __pyx_t_5; + } else { + __pyx_t_10 = __pyx_t_9; + } + __pyx_t_9 = __pyx_t_10; + __pyx_t_11 = (__pyx_t_6 < __pyx_t_9); + if (__pyx_t_11) { + __pyx_t_10 = __pyx_t_6; + } else { + __pyx_t_10 = __pyx_t_9; + } + __pyx_t_9 = __pyx_t_10; + __pyx_t_11 = (__pyx_t_7 < __pyx_t_9); + if (__pyx_t_11) { + __pyx_t_10 = __pyx_t_7; + } else { + __pyx_t_10 = __pyx_t_9; + } + __pyx_t_9 = __pyx_t_10; + __pyx_t_11 = (__pyx_t_8 < __pyx_t_9); + if (__pyx_t_11) { + __pyx_t_10 = __pyx_t_8; + } else { + __pyx_t_10 = __pyx_t_9; + } + __pyx_v_shell = __pyx_t_10; - /* "View.MemoryView":614 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) + /* "newanalysis/helpers/miscellaneous.pyx":987 + * shell = min(shell1, shell2, shell3, shell4, shell5) * + * if shell < maxshell: # <<<<<<<<<<<<<< + * for i in range(3): + * mdcage_ts[shell,frame,i] += dip_wat[w,i] */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_11 = (__pyx_v_shell < __pyx_v_maxshell); + if (__pyx_t_11) { - /* "View.MemoryView":613 - * return 0 + /* "newanalysis/helpers/miscellaneous.pyx":988 * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) + * if shell < maxshell: + * for i in range(3): # <<<<<<<<<<<<<< + * mdcage_ts[shell,frame,i] += dip_wat[w,i] + * else: */ + for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":989 + * if shell < maxshell: + * for i in range(3): + * mdcage_ts[shell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< + * else: + * for i in range(3): + */ + __pyx_t_4 = __pyx_v_w; + __pyx_t_12 = __pyx_v_i; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_dip_wat.shape[1]; + __pyx_t_13 = __pyx_v_shell; + __pyx_t_14 = __pyx_v_frame; + __pyx_t_15 = __pyx_v_i; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_mdcage_ts.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_mdcage_ts.shape[1]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_mdcage_ts.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_13 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_14 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_15 * __pyx_v_mdcage_ts.strides[2]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_4 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_12 * __pyx_v_dip_wat.strides[1]) ))); + } -/* "View.MemoryView":617 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + /* "newanalysis/helpers/miscellaneous.pyx":987 + * shell = min(shell1, shell2, shell3, shell4, shell5) * + * if shell < maxshell: # <<<<<<<<<<<<<< + * for i in range(3): + * mdcage_ts[shell,frame,i] += dip_wat[w,i] */ + goto __pyx_L5; + } -/* Python wrapper */ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "View.MemoryView":618 - * - * def __str__(self): - * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":991 + * mdcage_ts[shell,frame,i] += dip_wat[w,i] + * else: + * for i in range(3): # <<<<<<<<<<<<<< + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] * + */ + /*else*/ { + for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; + + /* "newanalysis/helpers/miscellaneous.pyx":992 + * else: + * for i in range(3): + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_12 = __pyx_v_w; + __pyx_t_4 = __pyx_v_i; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_dip_wat.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[1]; + __pyx_t_15 = __pyx_v_maxshell; + __pyx_t_14 = __pyx_v_frame; + __pyx_t_13 = __pyx_v_i; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_mdcage_ts.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_mdcage_ts.shape[1]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_mdcage_ts.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mdcage_ts.data + __pyx_t_15 * __pyx_v_mdcage_ts.strides[0]) ) + __pyx_t_14 * __pyx_v_mdcage_ts.strides[1]) ) + __pyx_t_13 * __pyx_v_mdcage_ts.strides[2]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_12 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_4 * __pyx_v_dip_wat.strides[1]) ))); + } + } + __pyx_L5:; + } - /* "View.MemoryView":617 - * id(self)) + /* "newanalysis/helpers/miscellaneous.pyx":972 + * mdcage_timeseries[shell1, shell2, frame, i] += dipoles[w, i] * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMultiMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, char [:] ds1, char [:] ds2, char [:] ds3, char [:] ds4, char [:] ds5, int maxshell, int frame): * */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":621 - * +/* "newanalysis/helpers/miscellaneous.pyx":994 + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def multiVecShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, long nshells1, long maxdt, long startingpoints): + * """ */ /* Python wrapper */ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_57multiVecShellCorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_56multiVecShellCorrelate, "\n rotTs ... (nmol, n (time length), 3D)\n (,self,cross)coor ... (shell1, n (time length))\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_57multiVecShellCorrelate = {"multiVecShellCorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_57multiVecShellCorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_56multiVecShellCorrelate}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_57multiVecShellCorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_nshells1; + long __pyx_v_maxdt; + long __pyx_v_startingpoints; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("multiVecShellCorrelate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 994, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds1,&__pyx_n_s_nshells1,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rotTs)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 994, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 994, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("multiVecShellCorrelate", 1, 5, 5, 1); __PYX_ERR(0, 994, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 994, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("multiVecShellCorrelate", 1, 5, 5, 2); __PYX_ERR(0, 994, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxdt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 994, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("multiVecShellCorrelate", 1, 5, 5, 3); __PYX_ERR(0, 994, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_startingpoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 994, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("multiVecShellCorrelate", 1, 5, 5, 4); __PYX_ERR(0, 994, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "multiVecShellCorrelate") < 0)) __PYX_ERR(0, 994, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 5)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + } + __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 995, __pyx_L3_error) + __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 995, __pyx_L3_error) + __pyx_v_nshells1 = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_nshells1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 995, __pyx_L3_error) + __pyx_v_maxdt = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 995, __pyx_L3_error) + __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 995, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("multiVecShellCorrelate", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 994, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.multiVecShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_56multiVecShellCorrelate(__pyx_self, __pyx_v_rotTs, __pyx_v_ds1, __pyx_v_nshells1, __pyx_v_maxdt, __pyx_v_startingpoints); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_56multiVecShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds1, long __pyx_v_nshells1, long __pyx_v_maxdt, long __pyx_v_startingpoints) { + long __pyx_v_nmol; + long __pyx_v_n; + long __pyx_v_startskip; + __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_selfcorr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_crosscorr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_selfctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_crossctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_t1; + long __pyx_v_i; + long __pyx_v_j; + long __pyx_v_k; + long __pyx_v_start; + long __pyx_v_point; + long __pyx_v_dt; + long __pyx_v_mol; + long __pyx_v_shellstart1; + long __pyx_v_shelldt1; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_1; + __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + long __pyx_t_10; + long __pyx_t_11; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + int __pyx_t_20; + long __pyx_t_21; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + PyObject *__pyx_t_26 = NULL; + PyObject *__pyx_t_27 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_c_contig", 0); + __Pyx_RefNannySetupContext("multiVecShellCorrelate", 0); - /* "View.MemoryView":624 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "newanalysis/helpers/miscellaneous.pyx":1001 + * """ * + * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< + * cdef long n = len(rotTs[0]) # number of time steps + * cdef long startskip = (n-maxdt)//startingpoints */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 624, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); + __pyx_v_nmol = ((long)__pyx_t_1); - /* "View.MemoryView":625 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1002 * - * def is_f_contig(self): + * cdef long nmol = len(rotTs) # number of molecules + * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:] corr = np.zeros((nshells1,maxdt)) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_2.data = __pyx_v_rotTs.data; + __pyx_t_2.memview = __pyx_v_rotTs.memview; + __PYX_INC_MEMVIEW(&__pyx_t_2, 1); + { + Py_ssize_t __pyx_tmp_idx = 0; + Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":621 - * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp +__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; +__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; + __pyx_t_2.suboffsets[0] = -1; + +__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; +__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; + __pyx_t_2.suboffsets[1] = -1; + +__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL; + __pyx_v_n = ((long)__pyx_t_1); + + /* "newanalysis/helpers/miscellaneous.pyx":1003 + * cdef long nmol = len(rotTs) # number of molecules + * cdef long n = len(rotTs[0]) # number of time steps + * cdef long startskip = (n-maxdt)//startingpoints # <<<<<<<<<<<<<< + * cdef double [:,:] corr = np.zeros((nshells1,maxdt)) + * cdef double [:,:] selfcorr = np.zeros((nshells1,maxdt)) */ + __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); + if (unlikely(__pyx_v_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 1003, __pyx_L1_error) + } + else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 1003, __pyx_L1_error) + } + __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":1004 + * cdef long n = len(rotTs[0]) # number of time steps + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:] corr = np.zeros((nshells1,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:] selfcorr = np.zeros((nshells1,maxdt)) + * cdef double [:,:] crosscorr = np.zeros((nshells1,maxdt)) + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1004, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1004, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1004, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1004, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1004, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5)) __PYX_ERR(0, 1004, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7)) __PYX_ERR(0, 1004, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1004, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1004, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_corr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; + + /* "newanalysis/helpers/miscellaneous.pyx":1005 + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:] corr = np.zeros((nshells1,maxdt)) + * cdef double [:,:] selfcorr = np.zeros((nshells1,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:] crosscorr = np.zeros((nshells1,maxdt)) + * cdef double [:,:] ctr = np.zeros((nshells1,maxdt)) # counter array of correlation entries + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 1005, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 1005, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1005, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_selfcorr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; + + /* "newanalysis/helpers/miscellaneous.pyx":1006 + * cdef double [:,:] corr = np.zeros((nshells1,maxdt)) + * cdef double [:,:] selfcorr = np.zeros((nshells1,maxdt)) + * cdef double [:,:] crosscorr = np.zeros((nshells1,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:] ctr = np.zeros((nshells1,maxdt)) # counter array of correlation entries + * cdef double [:,:] selfctr = np.zeros((nshells1,maxdt)) + */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8)) __PYX_ERR(0, 1006, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7)) __PYX_ERR(0, 1006, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1006, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_crosscorr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; + + /* "newanalysis/helpers/miscellaneous.pyx":1007 + * cdef double [:,:] selfcorr = np.zeros((nshells1,maxdt)) + * cdef double [:,:] crosscorr = np.zeros((nshells1,maxdt)) + * cdef double [:,:] ctr = np.zeros((nshells1,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< + * cdef double [:,:] selfctr = np.zeros((nshells1,maxdt)) + * cdef double [:,:] crossctr = np.zeros((nshells1,maxdt)) + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1007, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1007, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1007, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1007, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1007, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5)) __PYX_ERR(0, 1007, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7)) __PYX_ERR(0, 1007, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1007, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1007, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_ctr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; + + /* "newanalysis/helpers/miscellaneous.pyx":1008 + * cdef double [:,:] crosscorr = np.zeros((nshells1,maxdt)) + * cdef double [:,:] ctr = np.zeros((nshells1,maxdt)) # counter array of correlation entries + * cdef double [:,:] selfctr = np.zeros((nshells1,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:] crossctr = np.zeros((nshells1,maxdt)) + * cdef double t1 + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1008, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1008, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1008, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1008, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1008, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 1008, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 1008, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1008, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1008, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_selfctr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; + + /* "newanalysis/helpers/miscellaneous.pyx":1009 + * cdef double [:,:] ctr = np.zeros((nshells1,maxdt)) # counter array of correlation entries + * cdef double [:,:] selfctr = np.zeros((nshells1,maxdt)) + * cdef double [:,:] crossctr = np.zeros((nshells1,maxdt)) # <<<<<<<<<<<<<< + * cdef double t1 + * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shelldt1 + */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1009, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1009, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1009, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1009, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1009, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8)) __PYX_ERR(0, 1009, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7)) __PYX_ERR(0, 1009, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1009, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_crossctr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; -/* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "newanalysis/helpers/miscellaneous.pyx":1014 * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + * #for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t ROLLBACK: Uncomment this, erase below line + * for dt in range(maxdt): # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ + __pyx_t_3 = __pyx_v_maxdt; + __pyx_t_10 = __pyx_t_3; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_dt = __pyx_t_11; -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":1015 + * #for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t ROLLBACK: Uncomment this, erase below line + * for dt in range(maxdt): + * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip + */ + __pyx_t_12 = __pyx_v_startingpoints; + __pyx_t_13 = __pyx_t_12; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_point = __pyx_t_14; -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_f_contig", 0); + /* "newanalysis/helpers/miscellaneous.pyx":1016 + * for dt in range(maxdt): + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * start = point*startskip + * shellstart1 = ds1[mol,start]-1 + */ + __pyx_t_15 = __pyx_v_nmol; + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_mol = __pyx_t_17; - /* "View.MemoryView":630 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "newanalysis/helpers/miscellaneous.pyx":1017 + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip # <<<<<<<<<<<<<< + * shellstart1 = ds1[mol,start]-1 * */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 630, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); - /* "View.MemoryView":631 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1018 + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip + * shellstart1 = ds1[mol,start]-1 # <<<<<<<<<<<<<< * - * def copy(self): + * if (shellstart1 < nshells1): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_18 = __pyx_v_mol; + __pyx_t_19 = __pyx_v_start; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ds1.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds1.shape[1]; + __pyx_v_shellstart1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_18 * __pyx_v_ds1.strides[0]) ) + __pyx_t_19 * __pyx_v_ds1.strides[1]) ))) - 1); - /* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "newanalysis/helpers/miscellaneous.pyx":1020 + * shellstart1 = ds1[mol,start]-1 + * + * if (shellstart1 < nshells1): # <<<<<<<<<<<<<< + * ctr[shellstart1,dt] += 1 * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp */ + __pyx_t_20 = (__pyx_v_shellstart1 < __pyx_v_nshells1); + if (__pyx_t_20) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "newanalysis/helpers/miscellaneous.pyx":1021 * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * if (shellstart1 < nshells1): + * ctr[shellstart1,dt] += 1 # <<<<<<<<<<<<<< + * + * t1 = 0 */ + __pyx_t_19 = __pyx_v_shellstart1; + __pyx_t_18 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_ctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_18 * __pyx_v_ctr.strides[1]) )) += 1.0; -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_mslice; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy", 0); - - /* "View.MemoryView":635 - * def copy(self): - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1023 + * ctr[shellstart1,dt] += 1 * - * slice_copy(self, &mslice) + * t1 = 0 # <<<<<<<<<<<<<< + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + __pyx_v_t1 = 0.0; - /* "View.MemoryView":637 - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + /* "newanalysis/helpers/miscellaneous.pyx":1024 * - * slice_copy(self, &mslice) # <<<<<<<<<<<<<< - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, - * self.view.itemsize, + * t1 = 0 + * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< + * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] + * corr[shellstart1,dt] += t1 # l=1 */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + for (__pyx_t_21 = 0; __pyx_t_21 < 3; __pyx_t_21+=1) { + __pyx_v_k = __pyx_t_21; - /* "View.MemoryView":638 + /* "newanalysis/helpers/miscellaneous.pyx":1025 + * t1 = 0 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] # <<<<<<<<<<<<<< + * corr[shellstart1,dt] += t1 # l=1 * - * slice_copy(self, &mslice) - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_C_CONTIGUOUS, */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 638, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __pyx_t_18 = __pyx_v_mol; + __pyx_t_19 = __pyx_v_start; + __pyx_t_22 = __pyx_v_k; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_rotTs.shape[2]; + __pyx_t_23 = __pyx_v_mol; + __pyx_t_24 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_25 = __pyx_v_k; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_rotTs.shape[2]; + __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_18 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_22 * __pyx_v_rotTs.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_23 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_24 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_25 * __pyx_v_rotTs.strides[2]) ))))); + } - /* "View.MemoryView":643 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1026 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] + * corr[shellstart1,dt] += t1 # l=1 # <<<<<<<<<<<<<< * - * def copy_fortran(self): + * shelldt1 = ds1[mol,start+dt]-1 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_25 = __pyx_v_shellstart1; + __pyx_t_24 = __pyx_v_dt; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_corr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_25 * __pyx_v_corr.strides[0]) ) + __pyx_t_24 * __pyx_v_corr.strides[1]) )) += __pyx_v_t1; - /* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "newanalysis/helpers/miscellaneous.pyx":1028 + * corr[shellstart1,dt] += t1 # l=1 * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * shelldt1 = ds1[mol,start+dt]-1 # <<<<<<<<<<<<<< + * if (shellstart1 == shelldt1): + * selfctr[shellstart1,dt] += 1 */ + __pyx_t_24 = __pyx_v_mol; + __pyx_t_25 = (__pyx_v_start + __pyx_v_dt); + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ds1.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_ds1.shape[1]; + __pyx_v_shelldt1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_24 * __pyx_v_ds1.strides[0]) ) + __pyx_t_25 * __pyx_v_ds1.strides[1]) ))) - 1); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) + /* "newanalysis/helpers/miscellaneous.pyx":1029 * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * shelldt1 = ds1[mol,start+dt]-1 + * if (shellstart1 == shelldt1): # <<<<<<<<<<<<<< + * selfctr[shellstart1,dt] += 1 + * selfcorr[shellstart1,dt] += t1 */ + __pyx_t_20 = (__pyx_v_shellstart1 == __pyx_v_shelldt1); + if (__pyx_t_20) { -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy_fortran", 0); - - /* "View.MemoryView":647 - * def copy_fortran(self): - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1030 + * shelldt1 = ds1[mol,start+dt]-1 + * if (shellstart1 == shelldt1): + * selfctr[shellstart1,dt] += 1 # <<<<<<<<<<<<<< + * selfcorr[shellstart1,dt] += t1 * - * slice_copy(self, &src) */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + __pyx_t_25 = __pyx_v_shellstart1; + __pyx_t_24 = __pyx_v_dt; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_25 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_24 * __pyx_v_selfctr.strides[1]) )) += 1.0; - /* "View.MemoryView":649 - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + /* "newanalysis/helpers/miscellaneous.pyx":1031 + * if (shellstart1 == shelldt1): + * selfctr[shellstart1,dt] += 1 + * selfcorr[shellstart1,dt] += t1 # <<<<<<<<<<<<<< * - * slice_copy(self, &src) # <<<<<<<<<<<<<< - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, - * self.view.itemsize, + * for i in range(nshells1): */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + __pyx_t_24 = __pyx_v_shellstart1; + __pyx_t_25 = __pyx_v_dt; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_selfcorr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_24 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_25 * __pyx_v_selfcorr.strides[1]) )) += __pyx_v_t1; - /* "View.MemoryView":650 + /* "newanalysis/helpers/miscellaneous.pyx":1029 * - * slice_copy(self, &src) - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_F_CONTIGUOUS, + * shelldt1 = ds1[mol,start+dt]-1 + * if (shellstart1 == shelldt1): # <<<<<<<<<<<<<< + * selfctr[shellstart1,dt] += 1 + * selfcorr[shellstart1,dt] += t1 */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 650, __pyx_L1_error) - __pyx_v_dst = __pyx_t_1; + } - /* "View.MemoryView":655 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1020 + * shellstart1 = ds1[mol,start]-1 * + * if (shellstart1 < nshells1): # <<<<<<<<<<<<<< + * ctr[shellstart1,dt] += 1 * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + } + } + } + } - /* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) + /* "newanalysis/helpers/miscellaneous.pyx":1033 + * selfcorr[shellstart1,dt] += t1 * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * for i in range(nshells1): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * if ctr[i,j] != 0: */ + __pyx_t_3 = __pyx_v_nshells1; + __pyx_t_10 = __pyx_t_3; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/helpers/miscellaneous.pyx":1034 + * + * for i in range(nshells1): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * if ctr[i,j] != 0: + * corr[i,j] /= ctr[i,j] */ + __pyx_t_12 = __pyx_v_maxdt; + __pyx_t_13 = __pyx_t_12; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_j = __pyx_t_14; -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/miscellaneous.pyx":1035 + * for i in range(nshells1): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * corr[i,j] /= ctr[i,j] + * else: */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_25 = __pyx_v_i; + __pyx_t_24 = __pyx_v_j; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_ctr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ctr.shape[1]; + __pyx_t_20 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_25 * __pyx_v_ctr.strides[0]) ) + __pyx_t_24 * __pyx_v_ctr.strides[1]) ))) != 0.0); + if (__pyx_t_20) { - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/helpers/miscellaneous.pyx":1036 + * for j in range(maxdt): + * if ctr[i,j] != 0: + * corr[i,j] /= ctr[i,j] # <<<<<<<<<<<<<< + * else: + * print('tot too sparse') */ + __pyx_t_24 = __pyx_v_i; + __pyx_t_25 = __pyx_v_j; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ctr.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_ctr.shape[1]; + __pyx_t_23 = __pyx_v_i; + __pyx_t_22 = __pyx_v_j; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[0]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_corr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_23 * __pyx_v_corr.strides[0]) ) + __pyx_t_22 * __pyx_v_corr.strides[1]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_24 * __pyx_v_ctr.strides[0]) ) + __pyx_t_25 * __pyx_v_ctr.strides[1]) ))); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/miscellaneous.pyx":1035 + * for i in range(nshells1): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * corr[i,j] /= ctr[i,j] + * else: */ + goto __pyx_L17; + } -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":1038 + * corr[i,j] /= ctr[i,j] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if selfctr[i,j] != 0: + * selfcorr[i,j] /= selfctr[i,j] + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1038, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L17:; -static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + /* "newanalysis/helpers/miscellaneous.pyx":1039 + * else: + * print('tot too sparse') + * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< + * selfcorr[i,j] /= selfctr[i,j] + * else: + */ + __pyx_t_25 = __pyx_v_i; + __pyx_t_24 = __pyx_v_j; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfctr.shape[1]; + __pyx_t_20 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_25 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_24 * __pyx_v_selfctr.strides[1]) ))) != 0.0); + if (__pyx_t_20) { - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1040 + * print('tot too sparse') + * if selfctr[i,j] != 0: + * selfcorr[i,j] /= selfctr[i,j] # <<<<<<<<<<<<<< + * else: + * print('self too sparse') */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_24 = __pyx_v_i; + __pyx_t_25 = __pyx_v_j; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_selfctr.shape[1]; + __pyx_t_22 = __pyx_v_i; + __pyx_t_23 = __pyx_v_j; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfcorr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_22 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_23 * __pyx_v_selfcorr.strides[1]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_24 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_25 * __pyx_v_selfctr.strides[1]) ))); - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/miscellaneous.pyx":1039 + * else: + * print('tot too sparse') + * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< + * selfcorr[i,j] /= selfctr[i,j] + * else: */ + goto __pyx_L18; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":1042 + * selfcorr[i,j] /= selfctr[i,j] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< + * + * for i in range(nshells1): + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1042, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L18:; + } + } -/* "View.MemoryView":659 + /* "newanalysis/helpers/miscellaneous.pyx":1044 + * print('self too sparse') * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo + * for i in range(nshells1): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] */ + __pyx_t_3 = __pyx_v_nshells1; + __pyx_t_10 = __pyx_t_3; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; -static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { - struct __pyx_memoryview_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + /* "newanalysis/helpers/miscellaneous.pyx":1045 + * + * for i in range(nshells1): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] + * crosscorr[i,j] = corr[i,j] - selfcorr[i,j] + */ + __pyx_t_12 = __pyx_v_maxdt; + __pyx_t_13 = __pyx_t_12; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_j = __pyx_t_14; - /* "View.MemoryView":660 - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< - * result.typeinfo = typeinfo - * return result + /* "newanalysis/helpers/miscellaneous.pyx":1046 + * for i in range(nshells1): + * for j in range(maxdt): + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] # <<<<<<<<<<<<<< + * crosscorr[i,j] = corr[i,j] - selfcorr[i,j] + * */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_o); - __Pyx_GIVEREF(__pyx_v_o); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_25 = __pyx_v_i; + __pyx_t_24 = __pyx_v_j; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_ctr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ctr.shape[1]; + __pyx_t_23 = __pyx_v_i; + __pyx_t_22 = __pyx_v_j; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_selfctr.shape[1]; + __pyx_t_19 = __pyx_v_i; + __pyx_t_18 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_crossctr.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_crossctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crossctr.data + __pyx_t_19 * __pyx_v_crossctr.strides[0]) ) + __pyx_t_18 * __pyx_v_crossctr.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_25 * __pyx_v_ctr.strides[0]) ) + __pyx_t_24 * __pyx_v_ctr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_23 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_22 * __pyx_v_selfctr.strides[1]) )))); - /* "View.MemoryView":661 - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo # <<<<<<<<<<<<<< - * return result + /* "newanalysis/helpers/miscellaneous.pyx":1047 + * for j in range(maxdt): + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] + * crosscorr[i,j] = corr[i,j] - selfcorr[i,j] # <<<<<<<<<<<<<< * + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr */ - __pyx_v_result->typeinfo = __pyx_v_typeinfo; + __pyx_t_22 = __pyx_v_i; + __pyx_t_23 = __pyx_v_j; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_corr.shape[0]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_corr.shape[1]; + __pyx_t_24 = __pyx_v_i; + __pyx_t_25 = __pyx_v_j; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_selfcorr.shape[1]; + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_crosscorr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_crosscorr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crosscorr.data + __pyx_t_18 * __pyx_v_crosscorr.strides[0]) ) + __pyx_t_19 * __pyx_v_crosscorr.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_22 * __pyx_v_corr.strides[0]) ) + __pyx_t_23 * __pyx_v_corr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_24 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_25 * __pyx_v_selfcorr.strides[1]) )))); + } + } - /* "View.MemoryView":662 - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - * return result # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1049 + * crosscorr[i,j] = corr[i,j] - selfcorr[i,j] * - * @cname('__pyx_memoryview_check') + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_selfcorr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_crosscorr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_selfctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_26 = __pyx_memoryview_fromslice(__pyx_v_crossctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_26); + __pyx_t_27 = PyTuple_New(6); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_27); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_27, 1, __pyx_t_5)) __PYX_ERR(0, 1049, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_27, 2, __pyx_t_6)) __PYX_ERR(0, 1049, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_27, 3, __pyx_t_7)) __PYX_ERR(0, 1049, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_27, 4, __pyx_t_8)) __PYX_ERR(0, 1049, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_26); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_27, 5, __pyx_t_26)) __PYX_ERR(0, 1049, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_26 = 0; + __pyx_r = __pyx_t_27; + __pyx_t_27 = 0; goto __pyx_L0; - /* "View.MemoryView":659 + /* "newanalysis/helpers/miscellaneous.pyx":994 + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def multiVecShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, long nshells1, long maxdt, long startingpoints): + * """ */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_26); + __Pyx_XDECREF(__pyx_t_27); + __Pyx_AddTraceback("newanalysis.miscellaneous.multiVecShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_selfcorr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_crosscorr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ctr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_selfctr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_crossctr, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) +/* "newanalysis/helpers/miscellaneous.pyx":1051 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def multiVecVennShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): + * """ */ -static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { - int __pyx_r; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_59multiVecVennShellCorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_58multiVecVennShellCorrelate, "\n rotTs ... (nmol, n (time length), 3D)\n (,self,cross)coor ... (shell1, shell2, n (time length))\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_59multiVecVennShellCorrelate = {"multiVecVennShellCorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_59multiVecVennShellCorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_58multiVecVennShellCorrelate}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_59multiVecVennShellCorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_nshells1; + long __pyx_v_nshells2; + long __pyx_v_maxdt; + long __pyx_v_startingpoints; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("memoryview_check", 0); - - /* "View.MemoryView":666 - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): - * return isinstance(o, memoryview) # <<<<<<<<<<<<<< - * - * cdef tuple _unellipsify(object index, int ndim): - */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); - __pyx_r = __pyx_t_1; - goto __pyx_L0; - - /* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) - * - */ + __Pyx_RefNannySetupContext("multiVecVennShellCorrelate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1051, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_nshells1,&__pyx_n_s_nshells2,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rotTs)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 1); __PYX_ERR(0, 1051, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 2); __PYX_ERR(0, 1051, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 3); __PYX_ERR(0, 1051, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 4); __PYX_ERR(0, 1051, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxdt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 5); __PYX_ERR(0, 1051, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_startingpoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, 6); __PYX_ERR(0, 1051, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "multiVecVennShellCorrelate") < 0)) __PYX_ERR(0, 1051, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 7)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + } + __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 1052, __pyx_L3_error) + __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 1052, __pyx_L3_error) + __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 1052, __pyx_L3_error) + __pyx_v_nshells1 = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_nshells1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1052, __pyx_L3_error) + __pyx_v_nshells2 = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_nshells2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1052, __pyx_L3_error) + __pyx_v_maxdt = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1052, __pyx_L3_error) + __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1052, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("multiVecVennShellCorrelate", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 1051, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.multiVecVennShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_58multiVecVennShellCorrelate(__pyx_self, __pyx_v_rotTs, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_nshells1, __pyx_v_nshells2, __pyx_v_maxdt, __pyx_v_startingpoints); /* function exit code */ - __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":668 - * return isinstance(o, memoryview) - * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with - */ - -static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { - PyObject *__pyx_v_tup = NULL; - PyObject *__pyx_v_result = NULL; - int __pyx_v_have_slices; - int __pyx_v_seen_ellipsis; - CYTHON_UNUSED PyObject *__pyx_v_idx = NULL; - PyObject *__pyx_v_item = NULL; - Py_ssize_t __pyx_v_nslices; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_58multiVecVennShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, long __pyx_v_nshells1, long __pyx_v_nshells2, long __pyx_v_maxdt, long __pyx_v_startingpoints) { + long __pyx_v_nmol; + long __pyx_v_n; + long __pyx_v_startskip; + __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_selfcorr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_crosscorr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_selfctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_crossctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_t1; + long __pyx_v_i; + long __pyx_v_j; + long __pyx_v_k; + long __pyx_v_l; + long __pyx_v_start; + long __pyx_v_point; + long __pyx_v_dt; + long __pyx_v_mol; + long __pyx_v_shellstart1; + long __pyx_v_shellstart2; + long __pyx_v_shelldt1; + long __pyx_v_shelldt2; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_1; + __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_3; PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; + __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + Py_ssize_t __pyx_t_24; + long __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + PyObject *__pyx_t_32 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_unellipsify", 0); + __Pyx_RefNannySetupContext("multiVecVennShellCorrelate", 0); - /* "View.MemoryView":673 - * full slices. + /* "newanalysis/helpers/miscellaneous.pyx":1058 * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: + * + * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< + * cdef long n = len(rotTs[0]) # number of time steps + * cdef long startskip = (n-maxdt)//startingpoints */ - __pyx_t_1 = PyTuple_Check(__pyx_v_index); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); + __pyx_v_nmol = ((long)__pyx_t_1); - /* "View.MemoryView":674 - * """ - * if not isinstance(index, tuple): - * tup = (index,) # <<<<<<<<<<<<<< - * else: - * tup = index + /* "newanalysis/helpers/miscellaneous.pyx":1059 + * + * cdef long nmol = len(rotTs) # number of molecules + * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:] corr = np.zeros((nshells1,nshells2,maxdt)) */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 674, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); - __pyx_v_tup = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2.data = __pyx_v_rotTs.data; + __pyx_t_2.memview = __pyx_v_rotTs.memview; + __PYX_INC_MEMVIEW(&__pyx_t_2, 1); + { + Py_ssize_t __pyx_tmp_idx = 0; + Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: - */ - goto __pyx_L3; - } +__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; +__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; + __pyx_t_2.suboffsets[0] = -1; - /* "View.MemoryView":676 - * tup = (index,) - * else: - * tup = index # <<<<<<<<<<<<<< - * - * result = [] - */ - /*else*/ { - __Pyx_INCREF(__pyx_v_index); - __pyx_v_tup = __pyx_v_index; - } - __pyx_L3:; +__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; +__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; + __pyx_t_2.suboffsets[1] = -1; - /* "View.MemoryView":678 - * tup = index - * - * result = [] # <<<<<<<<<<<<<< - * have_slices = False - * seen_ellipsis = False +__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL; + __pyx_v_n = ((long)__pyx_t_1); + + /* "newanalysis/helpers/miscellaneous.pyx":1060 + * cdef long nmol = len(rotTs) # number of molecules + * cdef long n = len(rotTs[0]) # number of time steps + * cdef long startskip = (n-maxdt)//startingpoints # <<<<<<<<<<<<<< + * cdef double [:,:,:] corr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] selfcorr = np.zeros((nshells1,nshells2,maxdt)) */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 678, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_result = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); + if (unlikely(__pyx_v_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 1060, __pyx_L1_error) + } + else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 1060, __pyx_L1_error) + } + __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - /* "View.MemoryView":679 - * - * result = [] - * have_slices = False # <<<<<<<<<<<<<< - * seen_ellipsis = False - * for idx, item in enumerate(tup): + /* "newanalysis/helpers/miscellaneous.pyx":1061 + * cdef long n = len(rotTs[0]) # number of time steps + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:] corr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:,:] selfcorr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] crosscorr = np.zeros((nshells1,nshells2,maxdt)) */ - __pyx_v_have_slices = 0; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1061, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1061, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1061, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1061, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1061, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1061, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5)) __PYX_ERR(0, 1061, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7)) __PYX_ERR(0, 1061, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8)) __PYX_ERR(0, 1061, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_9}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1061, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_corr = __pyx_t_11; + __pyx_t_11.memview = NULL; + __pyx_t_11.data = NULL; - /* "View.MemoryView":680 - * result = [] - * have_slices = False - * seen_ellipsis = False # <<<<<<<<<<<<<< - * for idx, item in enumerate(tup): - * if item is Ellipsis: + /* "newanalysis/helpers/miscellaneous.pyx":1062 + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:] corr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] selfcorr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:,:] crosscorr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries */ - __pyx_v_seen_ellipsis = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 1062, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8)) __PYX_ERR(0, 1062, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7)) __PYX_ERR(0, 1062, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1062, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_selfcorr = __pyx_t_11; + __pyx_t_11.memview = NULL; + __pyx_t_11.data = NULL; - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: + /* "newanalysis/helpers/miscellaneous.pyx":1063 + * cdef double [:,:,:] corr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] selfcorr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] crosscorr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries + * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_3 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) { - __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 681, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9)) __PYX_ERR(0, 1063, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7)) __PYX_ERR(0, 1063, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_8)) __PYX_ERR(0, 1063, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 681, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } - } else { - __pyx_t_7 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_7)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 681, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_crosscorr = __pyx_t_11; + __pyx_t_11.memview = NULL; + __pyx_t_11.data = NULL; + + /* "newanalysis/helpers/miscellaneous.pyx":1064 + * cdef double [:,:,:] selfcorr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] crosscorr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< + * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5)) __PYX_ERR(0, 1064, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8)) __PYX_ERR(0, 1064, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_7)) __PYX_ERR(0, 1064, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_10 = 1; } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_7; - __pyx_t_7 = 0; + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_ctr = __pyx_t_11; + __pyx_t_11.memview = NULL; + __pyx_t_11.data = NULL; - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) + /* "newanalysis/helpers/miscellaneous.pyx":1065 + * cdef double [:,:,:] crosscorr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries + * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double t1 */ - __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 1065, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 1065, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_8)) __PYX_ERR(0, 1065, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_selfctr = __pyx_t_11; + __pyx_t_11.memview = NULL; + __pyx_t_11.data = NULL; - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True + /* "newanalysis/helpers/miscellaneous.pyx":1066 + * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries + * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< + * cdef double t1 + * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 */ - __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0); - if (__pyx_t_1) { + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9)) __PYX_ERR(0, 1066, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8)) __PYX_ERR(0, 1066, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7)) __PYX_ERR(0, 1066, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1066, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_crossctr = __pyx_t_11; + __pyx_t_11.memview = NULL; + __pyx_t_11.data = NULL; - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1070 + * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 + * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__19); - __Pyx_GIVEREF(__pyx_slice__19); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__19); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_3 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_13 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_13 > 0) + { + #ifdef _OPENMP + #pragma omp parallel reduction(+:__pyx_v_t1) private(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shelldt1) lastprivate(__pyx_v_shelldt2) lastprivate(__pyx_v_shellstart1) lastprivate(__pyx_v_shellstart2) lastprivate(__pyx_v_start) + #endif /* _OPENMP */ + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){ + { + __pyx_v_dt = (long)(0 + 1 * __pyx_t_12); + /* Initialize private variables to invalid values */ + __pyx_v_k = ((long)0xbad0bad0); + __pyx_v_mol = ((long)0xbad0bad0); + __pyx_v_point = ((long)0xbad0bad0); + __pyx_v_shelldt1 = ((long)0xbad0bad0); + __pyx_v_shelldt2 = ((long)0xbad0bad0); + __pyx_v_shellstart1 = ((long)0xbad0bad0); + __pyx_v_shellstart2 = ((long)0xbad0bad0); + __pyx_v_start = ((long)0xbad0bad0); - /* "View.MemoryView":685 - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True # <<<<<<<<<<<<<< - * else: - * result.append(slice(None)) + /* "newanalysis/helpers/miscellaneous.pyx":1071 + * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip */ - __pyx_v_seen_ellipsis = 1; + __pyx_t_14 = __pyx_v_startingpoints; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_point = __pyx_t_16; - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True + /* "newanalysis/helpers/miscellaneous.pyx":1072 + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * start = point*startskip + * shellstart1 = ds1[mol,start]-1 */ - goto __pyx_L7; - } + __pyx_t_17 = __pyx_v_nmol; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_mol = __pyx_t_19; - /* "View.MemoryView":687 - * seen_ellipsis = True - * else: - * result.append(slice(None)) # <<<<<<<<<<<<<< - * have_slices = True - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1073 + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip # <<<<<<<<<<<<<< + * shellstart1 = ds1[mol,start]-1 + * shellstart2 = ds2[mol,start]-1 */ - /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__19); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 687, __pyx_L1_error) - } - __pyx_L7:; + __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); - /* "View.MemoryView":688 - * else: - * result.append(slice(None)) - * have_slices = True # <<<<<<<<<<<<<< - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): + /* "newanalysis/helpers/miscellaneous.pyx":1074 + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip + * shellstart1 = ds1[mol,start]-1 # <<<<<<<<<<<<<< + * shellstart2 = ds2[mol,start]-1 + * if (shellstart1 < nshells1) and (shellstart2 < nshells2): */ - __pyx_v_have_slices = 1; + __pyx_t_20 = __pyx_v_mol; + __pyx_t_21 = __pyx_v_start; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds1.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ds1.shape[1]; + __pyx_v_shellstart1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_20 * __pyx_v_ds1.strides[0]) ) + __pyx_t_21 * __pyx_v_ds1.strides[1]) ))) - 1); - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) + /* "newanalysis/helpers/miscellaneous.pyx":1075 + * start = point*startskip + * shellstart1 = ds1[mol,start]-1 + * shellstart2 = ds2[mol,start]-1 # <<<<<<<<<<<<<< + * if (shellstart1 < nshells1) and (shellstart2 < nshells2): + * ctr[shellstart1,shellstart2,dt] += 1 */ - goto __pyx_L6; - } + __pyx_t_21 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ds2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds2.shape[1]; + __pyx_v_shellstart2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_21 * __pyx_v_ds2.strides[0]) ) + __pyx_t_20 * __pyx_v_ds2.strides[1]) ))) - 1); - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) + /* "newanalysis/helpers/miscellaneous.pyx":1076 + * shellstart1 = ds1[mol,start]-1 + * shellstart2 = ds2[mol,start]-1 + * if (shellstart1 < nshells1) and (shellstart2 < nshells2): # <<<<<<<<<<<<<< + * ctr[shellstart1,shellstart2,dt] += 1 * */ - /*else*/ { - __pyx_t_2 = PySlice_Check(__pyx_v_item); - __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0); - __pyx_t_1 = __pyx_t_10; - __pyx_L9_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_t_23 = (__pyx_v_shellstart1 < __pyx_v_nshells1); + if (__pyx_t_23) { + } else { + __pyx_t_22 = __pyx_t_23; + goto __pyx_L15_bool_binop_done; + } + __pyx_t_23 = (__pyx_v_shellstart2 < __pyx_v_nshells2); + __pyx_t_22 = __pyx_t_23; + __pyx_L15_bool_binop_done:; + if (__pyx_t_22) { - /* "View.MemoryView":691 - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): - * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1077 + * shellstart2 = ds2[mol,start]-1 + * if (shellstart1 < nshells1) and (shellstart2 < nshells2): + * ctr[shellstart1,shellstart2,dt] += 1 # <<<<<<<<<<<<<< * - * have_slices = have_slices or isinstance(item, slice) + * t1 = 0 */ - __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(2, 691, __pyx_L1_error) - - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) + __pyx_t_20 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_24 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ctr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ctr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_21 * __pyx_v_ctr.strides[1]) ) + __pyx_t_24 * __pyx_v_ctr.strides[2]) )) += 1.0; + + /* "newanalysis/helpers/miscellaneous.pyx":1079 + * ctr[shellstart1,shellstart2,dt] += 1 * + * t1 = 0 # <<<<<<<<<<<<<< + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] */ - } + __pyx_v_t1 = 0.0; - /* "View.MemoryView":693 - * raise TypeError("Cannot index with type '%s'" % type(item)) - * - * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< - * result.append(item) + /* "newanalysis/helpers/miscellaneous.pyx":1080 * + * t1 = 0 + * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< + * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] + * corr[shellstart1,shellstart2,dt] += t1 # l=1 */ - __pyx_t_10 = (__pyx_v_have_slices != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = PySlice_Check(__pyx_v_item); - __pyx_t_2 = (__pyx_t_10 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L11_bool_binop_done:; - __pyx_v_have_slices = __pyx_t_1; + for (__pyx_t_25 = 0; __pyx_t_25 < 3; __pyx_t_25+=1) { + __pyx_v_k = __pyx_t_25; - /* "View.MemoryView":694 - * - * have_slices = have_slices or isinstance(item, slice) - * result.append(item) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1081 + * t1 = 0 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] # <<<<<<<<<<<<<< + * corr[shellstart1,shellstart2,dt] += t1 # l=1 * - * nslices = ndim - len(result) - */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 694, __pyx_L1_error) - } - __pyx_L6:; - - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_24 = __pyx_v_mol; + __pyx_t_21 = __pyx_v_start; + __pyx_t_20 = __pyx_v_k; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + __pyx_t_26 = __pyx_v_mol; + __pyx_t_27 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_28 = __pyx_v_k; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_rotTs.shape[2]; + __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_24 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_26 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_27 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_28 * __pyx_v_rotTs.strides[2]) ))))); + } - /* "View.MemoryView":696 - * result.append(item) + /* "newanalysis/helpers/miscellaneous.pyx":1082 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,k]*rotTs[mol,start+dt,k] + * corr[shellstart1,shellstart2,dt] += t1 # l=1 # <<<<<<<<<<<<<< * - * nslices = ndim - len(result) # <<<<<<<<<<<<<< - * if nslices: - * result.extend([slice(None)] * nslices) + * shelldt1 = ds1[mol,start+dt]-1 */ - __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 696, __pyx_L1_error) - __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); + __pyx_t_28 = __pyx_v_shellstart1; + __pyx_t_27 = __pyx_v_shellstart2; + __pyx_t_26 = __pyx_v_dt; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_corr.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_corr.shape[1]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_28 * __pyx_v_corr.strides[0]) ) + __pyx_t_27 * __pyx_v_corr.strides[1]) ) + __pyx_t_26 * __pyx_v_corr.strides[2]) )) += __pyx_v_t1; - /* "View.MemoryView":697 - * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) + /* "newanalysis/helpers/miscellaneous.pyx":1084 + * corr[shellstart1,shellstart2,dt] += t1 # l=1 * - */ - __pyx_t_1 = (__pyx_v_nslices != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":698 - * nslices = ndim - len(result) - * if nslices: - * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< + * shelldt1 = ds1[mol,start+dt]-1 # <<<<<<<<<<<<<< + * shelldt2 = ds2[mol,start+dt]-1 * - * return have_slices or nslices, tuple(result) */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__19); - __Pyx_GIVEREF(__pyx_slice__19); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__19); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_26 = __pyx_v_mol; + __pyx_t_27 = (__pyx_v_start + __pyx_v_dt); + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_ds1.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_ds1.shape[1]; + __pyx_v_shelldt1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_26 * __pyx_v_ds1.strides[0]) ) + __pyx_t_27 * __pyx_v_ds1.strides[1]) ))) - 1); - /* "View.MemoryView":697 + /* "newanalysis/helpers/miscellaneous.pyx":1085 * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) + * shelldt1 = ds1[mol,start+dt]-1 + * shelldt2 = ds2[mol,start+dt]-1 # <<<<<<<<<<<<<< * + * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): */ - } + __pyx_t_27 = __pyx_v_mol; + __pyx_t_26 = (__pyx_v_start + __pyx_v_dt); + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_ds2.shape[0]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_ds2.shape[1]; + __pyx_v_shelldt2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_27 * __pyx_v_ds2.strides[0]) ) + __pyx_t_26 * __pyx_v_ds2.strides[1]) ))) - 1); - /* "View.MemoryView":700 - * result.extend([slice(None)] * nslices) - * - * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1087 + * shelldt2 = ds2[mol,start+dt]-1 * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): + * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): # <<<<<<<<<<<<<< + * selfctr[shellstart1,shellstart2,dt] += 1 + * selfcorr[shellstart1,shellstart2,dt] += t1 */ - __Pyx_XDECREF(__pyx_r); - if (!__pyx_v_have_slices) { - } else { - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L14_bool_binop_done; - } - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_L14_bool_binop_done:; - __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject*)__pyx_t_11); - __pyx_t_11 = 0; - goto __pyx_L0; + __pyx_t_23 = (__pyx_v_shellstart1 == __pyx_v_shelldt1); + if (__pyx_t_23) { + } else { + __pyx_t_22 = __pyx_t_23; + goto __pyx_L20_bool_binop_done; + } + __pyx_t_23 = (__pyx_v_shellstart2 == __pyx_v_shelldt2); + __pyx_t_22 = __pyx_t_23; + __pyx_L20_bool_binop_done:; + if (__pyx_t_22) { - /* "View.MemoryView":668 - * return isinstance(o, memoryview) + /* "newanalysis/helpers/miscellaneous.pyx":1088 * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tup); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_XDECREF(__pyx_v_item); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) + * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): + * selfctr[shellstart1,shellstart2,dt] += 1 # <<<<<<<<<<<<<< + * selfcorr[shellstart1,shellstart2,dt] += t1 * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: */ + __pyx_t_26 = __pyx_v_shellstart1; + __pyx_t_27 = __pyx_v_shellstart2; + __pyx_t_28 = __pyx_v_dt; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_selfctr.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfctr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_26 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_27 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_28 * __pyx_v_selfctr.strides[2]) )) += 1.0; -static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - - /* "View.MemoryView":703 + /* "newanalysis/helpers/miscellaneous.pyx":1089 + * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): + * selfctr[shellstart1,shellstart2,dt] += 1 + * selfcorr[shellstart1,shellstart2,dt] += t1 # <<<<<<<<<<<<<< * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") + * for i in range(nshells1): */ - __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); - for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { - __pyx_t_1 = __pyx_t_3; - __pyx_v_suboffset = (__pyx_t_1[0]); + __pyx_t_28 = __pyx_v_shellstart1; + __pyx_t_27 = __pyx_v_shellstart2; + __pyx_t_26 = __pyx_v_dt; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_28 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_27 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_26 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t1; - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") + /* "newanalysis/helpers/miscellaneous.pyx":1087 + * shelldt2 = ds2[mol,start+dt]-1 * + * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): # <<<<<<<<<<<<<< + * selfctr[shellstart1,shellstart2,dt] += 1 + * selfcorr[shellstart1,shellstart2,dt] += t1 */ - __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0); - if (unlikely(__pyx_t_4)) { + } - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1076 + * shellstart1 = ds1[mol,start]-1 + * shellstart2 = ds2[mol,start]-1 + * if (shellstart1 < nshells1) and (shellstart2 < nshells2): # <<<<<<<<<<<<<< + * ctr[shellstart1,shellstart2,dt] += 1 * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(2, 705, __pyx_L1_error) + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") + /* "newanalysis/helpers/miscellaneous.pyx":1070 + * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - } + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } } - /* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) + /* "newanalysis/helpers/miscellaneous.pyx":1091 + * selfcorr[shellstart1,shellstart2,dt] += t1 * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: + * for i in range(nshells1): # <<<<<<<<<<<<<< + * for l in range(nshells2): + * for j in range(maxdt): */ + __pyx_t_13 = __pyx_v_nshells1; + __pyx_t_12 = __pyx_t_13; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_12; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":712 + /* "newanalysis/helpers/miscellaneous.pyx":1092 * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step + * for i in range(nshells1): + * for l in range(nshells2): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * if ctr[i,l,j] != 0: */ + __pyx_t_14 = __pyx_v_nshells2; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_l = __pyx_t_16; -static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { - int __pyx_v_new_ndim; - int __pyx_v_suboffset_dim; - int __pyx_v_dim; - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - __Pyx_memviewslice *__pyx_v_p_src; - struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; - __Pyx_memviewslice *__pyx_v_p_dst; - int *__pyx_v_p_suboffset_dim; - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - int __pyx_v_have_start; - int __pyx_v_have_stop; - int __pyx_v_have_step; - PyObject *__pyx_v_index = NULL; - struct __pyx_memoryview_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - struct __pyx_memoryview_obj *__pyx_t_4; - char *__pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memview_slice", 0); - - /* "View.MemoryView":713 - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): - * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< - * cdef bint negative_step - * cdef __Pyx_memviewslice src, dst + /* "newanalysis/helpers/miscellaneous.pyx":1093 + * for i in range(nshells1): + * for l in range(nshells2): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * if ctr[i,l,j] != 0: + * corr[i,l,j] /= ctr[i,l,j] */ - __pyx_v_new_ndim = 0; - __pyx_v_suboffset_dim = -1; + __pyx_t_17 = __pyx_v_maxdt; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; - /* "View.MemoryView":720 - * - * - * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< - * - * cdef _memoryviewslice memviewsliceobj + /* "newanalysis/helpers/miscellaneous.pyx":1094 + * for l in range(nshells2): + * for j in range(maxdt): + * if ctr[i,l,j] != 0: # <<<<<<<<<<<<<< + * corr[i,l,j] /= ctr[i,l,j] + * else: */ - (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = __pyx_v_l; + __pyx_t_28 = __pyx_v_j; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_ctr.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_ctr.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_ctr.shape[2]; + __pyx_t_22 = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_26 * __pyx_v_ctr.strides[0]) ) + __pyx_t_27 * __pyx_v_ctr.strides[1]) ) + __pyx_t_28 * __pyx_v_ctr.strides[2]) ))) != 0.0); + if (__pyx_t_22) { - /* "View.MemoryView":724 - * cdef _memoryviewslice memviewsliceobj - * - * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< - * - * if isinstance(memview, _memoryviewslice): + /* "newanalysis/helpers/miscellaneous.pyx":1095 + * for j in range(maxdt): + * if ctr[i,l,j] != 0: + * corr[i,l,j] /= ctr[i,l,j] # <<<<<<<<<<<<<< + * else: + * print('tot too sparse') */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { - PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(2, 724, __pyx_L1_error) - } - } - #endif + __pyx_t_28 = __pyx_v_i; + __pyx_t_27 = __pyx_v_l; + __pyx_t_26 = __pyx_v_j; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_ctr.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_ctr.shape[1]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_ctr.shape[2]; + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_l; + __pyx_t_24 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_20 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) ) + __pyx_t_24 * __pyx_v_corr.strides[2]) )) /= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_28 * __pyx_v_ctr.strides[0]) ) + __pyx_t_27 * __pyx_v_ctr.strides[1]) ) + __pyx_t_26 * __pyx_v_ctr.strides[2]) ))); - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice + /* "newanalysis/helpers/miscellaneous.pyx":1094 + * for l in range(nshells2): + * for j in range(maxdt): + * if ctr[i,l,j] != 0: # <<<<<<<<<<<<<< + * corr[i,l,j] /= ctr[i,l,j] + * else: */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + goto __pyx_L30; + } - /* "View.MemoryView":727 - * - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview # <<<<<<<<<<<<<< - * p_src = &memviewsliceobj.from_slice - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1097 + * corr[i,l,j] /= ctr[i,l,j] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if selfctr[i,l,j] != 0: + * selfcorr[i,l,j] /= selfctr[i,l,j] */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 727, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1097, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L30:; - /* "View.MemoryView":728 - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, &src) + /* "newanalysis/helpers/miscellaneous.pyx":1098 + * else: + * print('tot too sparse') + * if selfctr[i,l,j] != 0: # <<<<<<<<<<<<<< + * selfcorr[i,l,j] /= selfctr[i,l,j] + * else: */ - __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = __pyx_v_l; + __pyx_t_28 = __pyx_v_j; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_selfctr.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfctr.shape[2]; + __pyx_t_22 = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_26 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_27 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_28 * __pyx_v_selfctr.strides[2]) ))) != 0.0); + if (__pyx_t_22) { + + /* "newanalysis/helpers/miscellaneous.pyx":1099 + * print('tot too sparse') + * if selfctr[i,l,j] != 0: + * selfcorr[i,l,j] /= selfctr[i,l,j] # <<<<<<<<<<<<<< + * else: + * print('self too sparse') + */ + __pyx_t_28 = __pyx_v_i; + __pyx_t_27 = __pyx_v_l; + __pyx_t_26 = __pyx_v_j; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_selfctr.shape[1]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_selfctr.shape[2]; + __pyx_t_24 = __pyx_v_i; + __pyx_t_21 = __pyx_v_l; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_24 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[2]) )) /= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_28 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_27 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_26 * __pyx_v_selfctr.strides[2]) ))); + + /* "newanalysis/helpers/miscellaneous.pyx":1098 + * else: + * print('tot too sparse') + * if selfctr[i,l,j] != 0: # <<<<<<<<<<<<<< + * selfcorr[i,l,j] /= selfctr[i,l,j] + * else: + */ + goto __pyx_L31; + } - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 + /* "newanalysis/helpers/miscellaneous.pyx":1101 + * selfcorr[i,l,j] /= selfctr[i,l,j] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice + * for i in range(nshells1): */ - goto __pyx_L3; + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L31:; + } + } } - /* "View.MemoryView":730 - * p_src = &memviewsliceobj.from_slice - * else: - * slice_copy(memview, &src) # <<<<<<<<<<<<<< - * p_src = &src + /* "newanalysis/helpers/miscellaneous.pyx":1103 + * print('self too sparse') * + * for i in range(nshells1): # <<<<<<<<<<<<<< + * for l in range(nshells2): + * for j in range(maxdt): */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + __pyx_t_13 = __pyx_v_nshells1; + __pyx_t_12 = __pyx_t_13; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_12; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":731 - * else: - * slice_copy(memview, &src) - * p_src = &src # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1104 * + * for i in range(nshells1): + * for l in range(nshells2): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] */ - __pyx_v_p_src = (&__pyx_v_src); - } - __pyx_L3:; + __pyx_t_14 = __pyx_v_nshells2; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_l = __pyx_t_16; - /* "View.MemoryView":737 - * - * - * dst.memview = p_src.memview # <<<<<<<<<<<<<< - * dst.data = p_src.data - * + /* "newanalysis/helpers/miscellaneous.pyx":1105 + * for i in range(nshells1): + * for l in range(nshells2): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] + * crosscorr[i,l,j] = corr[i,l,j] - selfcorr[i,l,j] */ - __pyx_t_4 = __pyx_v_p_src->memview; - __pyx_v_dst.memview = __pyx_t_4; + __pyx_t_17 = __pyx_v_maxdt; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; - /* "View.MemoryView":738 - * - * dst.memview = p_src.memview - * dst.data = p_src.data # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1106 + * for l in range(nshells2): + * for j in range(maxdt): + * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] # <<<<<<<<<<<<<< + * crosscorr[i,l,j] = corr[i,l,j] - selfcorr[i,l,j] * + */ + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = __pyx_v_l; + __pyx_t_28 = __pyx_v_j; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_ctr.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_ctr.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_ctr.shape[2]; + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_l; + __pyx_t_24 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfctr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfctr.shape[2]; + __pyx_t_29 = __pyx_v_i; + __pyx_t_30 = __pyx_v_l; + __pyx_t_31 = __pyx_v_j; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_crossctr.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_crossctr.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_crossctr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crossctr.data + __pyx_t_29 * __pyx_v_crossctr.strides[0]) ) + __pyx_t_30 * __pyx_v_crossctr.strides[1]) ) + __pyx_t_31 * __pyx_v_crossctr.strides[2]) )) = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_26 * __pyx_v_ctr.strides[0]) ) + __pyx_t_27 * __pyx_v_ctr.strides[1]) ) + __pyx_t_28 * __pyx_v_ctr.strides[2]) ))) - (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_20 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_24 * __pyx_v_selfctr.strides[2]) )))); + + /* "newanalysis/helpers/miscellaneous.pyx":1107 + * for j in range(maxdt): + * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] + * crosscorr[i,l,j] = corr[i,l,j] - selfcorr[i,l,j] # <<<<<<<<<<<<<< * + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr */ - __pyx_t_5 = __pyx_v_p_src->data; - __pyx_v_dst.data = __pyx_t_5; + __pyx_t_24 = __pyx_v_i; + __pyx_t_21 = __pyx_v_l; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; + __pyx_t_28 = __pyx_v_i; + __pyx_t_27 = __pyx_v_l; + __pyx_t_26 = __pyx_v_j; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_selfcorr.shape[2]; + __pyx_t_31 = __pyx_v_i; + __pyx_t_30 = __pyx_v_l; + __pyx_t_29 = __pyx_v_j; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_crosscorr.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_crosscorr.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_crosscorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crosscorr.data + __pyx_t_31 * __pyx_v_crosscorr.strides[0]) ) + __pyx_t_30 * __pyx_v_crosscorr.strides[1]) ) + __pyx_t_29 * __pyx_v_crosscorr.strides[2]) )) = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_24 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ))) - (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_28 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_27 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_26 * __pyx_v_selfcorr.strides[2]) )))); + } + } + } - /* "View.MemoryView":743 + /* "newanalysis/helpers/miscellaneous.pyx":1109 + * crosscorr[i,l,j] = corr[i,l,j] - selfcorr[i,l,j] * + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr # <<<<<<<<<<<<<< * - * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< - * cdef int *p_suboffset_dim = &suboffset_dim - * cdef Py_ssize_t start, stop, step + * @cython.boundscheck(False) */ - __pyx_v_p_dst = (&__pyx_v_dst); + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_selfcorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_crosscorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_selfctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_crossctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_32 = PyTuple_New(6); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 1109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_32); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_32, 0, __pyx_t_4)) __PYX_ERR(0, 1109, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_32, 1, __pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_32, 2, __pyx_t_6)) __PYX_ERR(0, 1109, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_32, 3, __pyx_t_7)) __PYX_ERR(0, 1109, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_32, 4, __pyx_t_8)) __PYX_ERR(0, 1109, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_32, 5, __pyx_t_9)) __PYX_ERR(0, 1109, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_r = __pyx_t_32; + __pyx_t_32 = 0; + goto __pyx_L0; - /* "View.MemoryView":744 + /* "newanalysis/helpers/miscellaneous.pyx":1051 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * - * cdef __Pyx_memviewslice *p_dst = &dst - * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< - * cdef Py_ssize_t start, stop, step - * cdef bint have_start, have_stop, have_step + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def multiVecVennShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): + * """ */ - __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step + /* function exit code */ + __pyx_L1_error:; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_11, 1); + __Pyx_XDECREF(__pyx_t_32); + __Pyx_AddTraceback("newanalysis.miscellaneous.multiVecVennShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_selfcorr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_crosscorr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ctr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_selfctr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_crossctr, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/miscellaneous.pyx":1111 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ - __pyx_t_6 = 0; - if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 748, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_61rotationMatrixVennShellCorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_61rotationMatrixVennShellCorrelate = {"rotationMatrixVennShellCorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_61rotationMatrixVennShellCorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_61rotationMatrixVennShellCorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_nshells1; + long __pyx_v_nshells2; + long __pyx_v_maxdt; + long __pyx_v_startingpoints; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("rotationMatrixVennShellCorrelate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1111, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_nshells1,&__pyx_n_s_nshells2,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } else { - __pyx_t_9 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_9)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 748, __pyx_L1_error) + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rotTs)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } - break; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1111, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1111, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 1); __PYX_ERR(0, 1111, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1111, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 2); __PYX_ERR(0, 1111, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1111, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 3); __PYX_ERR(0, 1111, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1111, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 4); __PYX_ERR(0, 1111, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxdt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1111, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 5); __PYX_ERR(0, 1111, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_startingpoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1111, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, 6); __PYX_ERR(0, 1111, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rotationMatrixVennShellCorrelate") < 0)) __PYX_ERR(0, 1111, __pyx_L3_error) } - __Pyx_GOTREF(__pyx_t_9); + } else if (unlikely(__pyx_nargs != 7)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); } - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_v_dim = __pyx_t_6; - __pyx_t_6 = (__pyx_t_6 + 1); + __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 1112, __pyx_L3_error) + __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 1112, __pyx_L3_error) + __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 1112, __pyx_L3_error) + __pyx_v_nshells1 = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_nshells1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1112, __pyx_L3_error) + __pyx_v_nshells2 = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_nshells2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1112, __pyx_L3_error) + __pyx_v_maxdt = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1112, __pyx_L3_error) + __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1112, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("rotationMatrixVennShellCorrelate", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 1111, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.rotationMatrixVennShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_60rotationMatrixVennShellCorrelate(__pyx_self, __pyx_v_rotTs, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_nshells1, __pyx_v_nshells2, __pyx_v_maxdt, __pyx_v_startingpoints); - /* "View.MemoryView":749 - * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - */ - __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0); - if (__pyx_t_2) { + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":753 - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<< - * 0, 0, 0, # have_{start,stop,step} - * False) - */ - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 753, __pyx_L1_error) +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_60rotationMatrixVennShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, long __pyx_v_nshells1, long __pyx_v_nshells2, long __pyx_v_maxdt, long __pyx_v_startingpoints) { + long __pyx_v_nmol; + long __pyx_v_n; + long __pyx_v_startskip; + __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_selfcorr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_crosscorr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_selfctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_crossctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_t1; + double __pyx_v_t2; + double __pyx_v_t3; + double __pyx_v_t4; + double __pyx_v_t5; + double __pyx_v_t6; + long __pyx_v_i; + long __pyx_v_j; + long __pyx_v_k; + long __pyx_v_l; + long __pyx_v_start; + long __pyx_v_point; + long __pyx_v_dt; + long __pyx_v_mol; + long __pyx_v_shellstart1; + long __pyx_v_shellstart2; + long __pyx_v_shelldt1; + long __pyx_v_shelldt2; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + Py_ssize_t __pyx_t_24; + double __pyx_t_25; + double __pyx_t_26; + double __pyx_t_27; + double __pyx_t_28; + double __pyx_t_29; + double __pyx_t_30; + long __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; + Py_ssize_t __pyx_t_35; + Py_ssize_t __pyx_t_36; + Py_ssize_t __pyx_t_37; + Py_ssize_t __pyx_t_38; + Py_ssize_t __pyx_t_39; + Py_ssize_t __pyx_t_40; + PyObject *__pyx_t_41 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("rotationMatrixVennShellCorrelate", 0); - /* "View.MemoryView":750 - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + /* "newanalysis/helpers/miscellaneous.pyx":1113 + * @cython.boundscheck(False) + * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< + * cdef long n = len(rotTs[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 750, __pyx_L1_error) + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); + __pyx_v_nmol = ((long)__pyx_t_1); - /* "View.MemoryView":749 - * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + /* "newanalysis/helpers/miscellaneous.pyx":1114 + * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules + * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints */ - goto __pyx_L6; - } + __pyx_t_2.data = __pyx_v_rotTs.data; + __pyx_t_2.memview = __pyx_v_rotTs.memview; + __PYX_INC_MEMVIEW(&__pyx_t_2, 1); + { + Py_ssize_t __pyx_tmp_idx = 0; + Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 +__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; +__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; + __pyx_t_2.suboffsets[0] = -1; + +__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; +__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; + __pyx_t_2.suboffsets[1] = -1; + +__pyx_t_2.shape[2] = __pyx_v_rotTs.shape[3]; +__pyx_t_2.strides[2] = __pyx_v_rotTs.strides[3]; + __pyx_t_2.suboffsets[2] = -1; + +__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL; + __pyx_v_n = ((long)__pyx_t_1); + + /* "newanalysis/helpers/miscellaneous.pyx":1116 + * cdef long n = len(rotTs[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints # <<<<<<<<<<<<<< + * cdef double [:,:,:,:] corr = np.zeros((12,nshells1,nshells2,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:,:,:] selfcorr = np.zeros((12,nshells1,nshells2,maxdt)) */ - __pyx_t_2 = (__pyx_v_index == Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); + if (unlikely(__pyx_v_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 1116, __pyx_L1_error) + } + else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 1116, __pyx_L1_error) + } + __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - /* "View.MemoryView":757 - * False) - * elif index is None: - * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 + /* "newanalysis/helpers/miscellaneous.pyx":1117 + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:,:] corr = np.zeros((12,nshells1,nshells2,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< + * cdef double [:,:,:,:] selfcorr = np.zeros((12,nshells1,nshells2,maxdt)) + * cdef double [:,:,:,:] crosscorr = np.zeros((12,nshells1,nshells2,maxdt)) */ - (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_12)) __PYX_ERR(0, 1117, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5)) __PYX_ERR(0, 1117, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_7)) __PYX_ERR(0, 1117, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_8)) __PYX_ERR(0, 1117, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_9}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_corr = __pyx_t_11; + __pyx_t_11.memview = NULL; + __pyx_t_11.data = NULL; - /* "View.MemoryView":758 - * elif index is None: - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 + /* "newanalysis/helpers/miscellaneous.pyx":1118 + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:,:] corr = np.zeros((12,nshells1,nshells2,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:,:,:] selfcorr = np.zeros((12,nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:,:,:] crosscorr = np.zeros((12,nshells1,nshells2,maxdt)) + * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries */ - (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_12)) __PYX_ERR(0, 1118, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 1118, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_8)) __PYX_ERR(0, 1118, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_7)) __PYX_ERR(0, 1118, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1118, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_selfcorr = __pyx_t_11; + __pyx_t_11.memview = NULL; + __pyx_t_11.data = NULL; - /* "View.MemoryView":759 - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< - * new_ndim += 1 - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1119 + * cdef double [:,:,:,:] corr = np.zeros((12,nshells1,nshells2,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:,:,:] selfcorr = np.zeros((12,nshells1,nshells2,maxdt)) + * cdef double [:,:,:,:] crosscorr = np.zeros((12,nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries + * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) */ - (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_12)) __PYX_ERR(0, 1119, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7)) __PYX_ERR(0, 1119, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_8)) __PYX_ERR(0, 1119, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1119, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_crosscorr = __pyx_t_11; + __pyx_t_11.memview = NULL; + __pyx_t_11.data = NULL; - /* "View.MemoryView":760 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 # <<<<<<<<<<<<<< - * else: - * start = index.start or 0 + /* "newanalysis/helpers/miscellaneous.pyx":1120 + * cdef double [:,:,:,:] selfcorr = np.zeros((12,nshells1,nshells2,maxdt)) + * cdef double [:,:,:,:] crosscorr = np.zeros((12,nshells1,nshells2,maxdt)) + * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< + * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5)) __PYX_ERR(0, 1120, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8)) __PYX_ERR(0, 1120, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_7)) __PYX_ERR(0, 1120, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1120, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_ctr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 + /* "newanalysis/helpers/miscellaneous.pyx":1121 + * cdef double [:,:,:,:] crosscorr = np.zeros((12,nshells1,nshells2,maxdt)) + * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries + * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double t1,t2,t3,t4,t5,t6 */ - goto __pyx_L6; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 1121, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 1121, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_8)) __PYX_ERR(0, 1121, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_10 = 1; } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1121, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_selfctr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; - /* "View.MemoryView":762 - * new_ndim += 1 - * else: - * start = index.start or 0 # <<<<<<<<<<<<<< - * stop = index.stop or 0 - * step = index.step or 0 + /* "newanalysis/helpers/miscellaneous.pyx":1122 + * cdef double [:,:,:] ctr = np.zeros((nshells1,nshells2,maxdt)) # counter array of correlation entries + * cdef double [:,:,:] selfctr = np.zeros((nshells1,nshells2,maxdt)) + * cdef double [:,:,:] crossctr = np.zeros((nshells1,nshells2,maxdt)) # <<<<<<<<<<<<<< + * cdef double t1,t2,t3,t4,t5,t6 + * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 */ - /*else*/ { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L7_bool_binop_done:; - __pyx_v_start = __pyx_t_10; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_nshells1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9)) __PYX_ERR(0, 1122, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8)) __PYX_ERR(0, 1122, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7)) __PYX_ERR(0, 1122, __pyx_L1_error); + __pyx_t_9 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_10 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_10 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1122, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_crossctr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; - /* "View.MemoryView":763 - * else: - * start = index.start or 0 - * stop = index.stop or 0 # <<<<<<<<<<<<<< - * step = index.step or 0 + /* "newanalysis/helpers/miscellaneous.pyx":1126 + * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 763, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 763, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 763, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L9_bool_binop_done:; - __pyx_v_stop = __pyx_t_10; + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_3 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_13 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_13 > 0) + { + #ifdef _OPENMP + #pragma omp parallel reduction(+:__pyx_v_t1) reduction(+:__pyx_v_t2) reduction(+:__pyx_v_t3) reduction(+:__pyx_v_t4) reduction(+:__pyx_v_t5) reduction(+:__pyx_v_t6) private(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33, __pyx_t_34, __pyx_t_35, __pyx_t_36) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shelldt1) lastprivate(__pyx_v_shelldt2) lastprivate(__pyx_v_shellstart1) lastprivate(__pyx_v_shellstart2) lastprivate(__pyx_v_start) + #endif /* _OPENMP */ + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){ + { + __pyx_v_dt = (long)(0 + 1 * __pyx_t_12); + /* Initialize private variables to invalid values */ + __pyx_v_k = ((long)0xbad0bad0); + __pyx_v_mol = ((long)0xbad0bad0); + __pyx_v_point = ((long)0xbad0bad0); + __pyx_v_shelldt1 = ((long)0xbad0bad0); + __pyx_v_shelldt2 = ((long)0xbad0bad0); + __pyx_v_shellstart1 = ((long)0xbad0bad0); + __pyx_v_shellstart2 = ((long)0xbad0bad0); + __pyx_v_start = ((long)0xbad0bad0); - /* "View.MemoryView":764 - * start = index.start or 0 - * stop = index.stop or 0 - * step = index.step or 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1127 * - * have_start = index.start is not None + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 764, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 764, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L11_bool_binop_done:; - __pyx_v_step = __pyx_t_10; + __pyx_t_14 = __pyx_v_startingpoints; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_point = __pyx_t_16; - /* "View.MemoryView":766 - * step = index.step or 0 - * - * have_start = index.start is not None # <<<<<<<<<<<<<< - * have_stop = index.stop is not None - * have_step = index.step is not None + /* "newanalysis/helpers/miscellaneous.pyx":1128 + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * start = point*startskip + * shellstart1 = ds1[mol,start]-1 */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_start = __pyx_t_1; + __pyx_t_17 = __pyx_v_nmol; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_mol = __pyx_t_19; - /* "View.MemoryView":767 - * - * have_start = index.start is not None - * have_stop = index.stop is not None # <<<<<<<<<<<<<< - * have_step = index.step is not None - * + /* "newanalysis/helpers/miscellaneous.pyx":1129 + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip # <<<<<<<<<<<<<< + * shellstart1 = ds1[mol,start]-1 + * shellstart2 = ds2[mol,start]-1 */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 767, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_stop = __pyx_t_1; + __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); - /* "View.MemoryView":768 - * have_start = index.start is not None - * have_stop = index.stop is not None - * have_step = index.step is not None # <<<<<<<<<<<<<< - * - * slice_memviewslice( + /* "newanalysis/helpers/miscellaneous.pyx":1130 + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip + * shellstart1 = ds1[mol,start]-1 # <<<<<<<<<<<<<< + * shellstart2 = ds2[mol,start]-1 + * if (shellstart1 < nshells1) and (shellstart2 < nshells2): */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_step = __pyx_t_1; + __pyx_t_20 = __pyx_v_mol; + __pyx_t_21 = __pyx_v_start; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds1.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ds1.shape[1]; + __pyx_v_shellstart1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_20 * __pyx_v_ds1.strides[0]) ) + __pyx_t_21 * __pyx_v_ds1.strides[1]) ))) - 1); - /* "View.MemoryView":770 - * have_step = index.step is not None - * - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + /* "newanalysis/helpers/miscellaneous.pyx":1131 + * start = point*startskip + * shellstart1 = ds1[mol,start]-1 + * shellstart2 = ds2[mol,start]-1 # <<<<<<<<<<<<<< + * if (shellstart1 < nshells1) and (shellstart2 < nshells2): + * ctr[shellstart1,shellstart2,dt] += 1 */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 770, __pyx_L1_error) + __pyx_t_21 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ds2.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds2.shape[1]; + __pyx_v_shellstart2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_21 * __pyx_v_ds2.strides[0]) ) + __pyx_t_20 * __pyx_v_ds2.strides[1]) ))) - 1); - /* "View.MemoryView":776 - * have_start, have_stop, have_step, - * True) - * new_ndim += 1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1132 + * shellstart1 = ds1[mol,start]-1 + * shellstart2 = ds2[mol,start]-1 + * if (shellstart1 < nshells1) and (shellstart2 < nshells2): # <<<<<<<<<<<<<< + * ctr[shellstart1,shellstart2,dt] += 1 * - * if isinstance(memview, _memoryviewslice): */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - } - __pyx_L6:; + __pyx_t_23 = (__pyx_v_shellstart1 < __pyx_v_nshells1); + if (__pyx_t_23) { + } else { + __pyx_t_22 = __pyx_t_23; + goto __pyx_L15_bool_binop_done; + } + __pyx_t_23 = (__pyx_v_shellstart2 < __pyx_v_nshells2); + __pyx_t_22 = __pyx_t_23; + __pyx_L15_bool_binop_done:; + if (__pyx_t_22) { - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step + /* "newanalysis/helpers/miscellaneous.pyx":1133 + * shellstart2 = ds2[mol,start]-1 + * if (shellstart1 < nshells1) and (shellstart2 < nshells2): + * ctr[shellstart1,shellstart2,dt] += 1 # <<<<<<<<<<<<<< * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "View.MemoryView":778 - * new_ndim += 1 + __pyx_t_20 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_24 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ctr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ctr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_21 * __pyx_v_ctr.strides[1]) ) + __pyx_t_24 * __pyx_v_ctr.strides[2]) )) += 1.0; + + /* "newanalysis/helpers/miscellaneous.pyx":1135 + * ctr[shellstart1,shellstart2,dt] += 1 * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 # <<<<<<<<<<<<<< + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_25 = 0.0; + __pyx_t_26 = 0.0; + __pyx_t_27 = 0.0; + __pyx_t_28 = 0.0; + __pyx_t_29 = 0.0; + __pyx_t_30 = 0.0; + __pyx_v_t1 = __pyx_t_25; + __pyx_v_t2 = __pyx_t_26; + __pyx_v_t3 = __pyx_t_27; + __pyx_v_t4 = __pyx_t_28; + __pyx_v_t5 = __pyx_t_29; + __pyx_v_t6 = __pyx_t_30; - /* "View.MemoryView":779 + /* "newanalysis/helpers/miscellaneous.pyx":1136 * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - - /* "View.MemoryView":780 - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< - * memviewsliceobj.to_dtype_func, - * memview.dtype_is_object) - */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 780, __pyx_L1_error) } - - /* "View.MemoryView":781 - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * else: + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 781, __pyx_L1_error) } + for (__pyx_t_31 = 0; __pyx_t_31 < 3; __pyx_t_31+=1) { + __pyx_v_k = __pyx_t_31; - /* "View.MemoryView":779 - * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, + /* "newanalysis/helpers/miscellaneous.pyx":1137 + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] # <<<<<<<<<<<<<< + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 779, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 779, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_24 = __pyx_v_mol; + __pyx_t_21 = __pyx_v_start; + __pyx_t_20 = 0; + __pyx_t_32 = __pyx_v_k; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; + __pyx_t_33 = __pyx_v_mol; + __pyx_t_34 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_35 = 0; + __pyx_t_36 = __pyx_v_k; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; + __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_24 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":778 - * new_ndim += 1 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, + /* "newanalysis/helpers/miscellaneous.pyx":1138 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] */ - } + __pyx_t_36 = __pyx_v_mol; + __pyx_t_35 = __pyx_v_start; + __pyx_t_34 = 1; + __pyx_t_33 = __pyx_v_k; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; + __pyx_t_32 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_21 = 1; + __pyx_t_24 = __pyx_v_k; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[3]; + __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_24 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * + /* "newanalysis/helpers/miscellaneous.pyx":1139 + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] */ - /*else*/ { - __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_24 = __pyx_v_mol; + __pyx_t_21 = __pyx_v_start; + __pyx_t_20 = 2; + __pyx_t_32 = __pyx_v_k; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; + __pyx_t_33 = __pyx_v_mol; + __pyx_t_34 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_35 = 2; + __pyx_t_36 = __pyx_v_k; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; + __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_24 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":785 - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, - * memview.dtype_is_object) # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/miscellaneous.pyx":1140 + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_36 = __pyx_v_mol; + __pyx_t_35 = __pyx_v_start; + __pyx_t_34 = 0; + __pyx_t_33 = __pyx_v_k; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; + __pyx_t_32 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_21 = 1; + __pyx_t_24 = __pyx_v_k; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[3]; + __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_24 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * + /* "newanalysis/helpers/miscellaneous.pyx":1141 + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart1,shellstart2,dt] += t1 # l=1 */ - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 784, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - } + __pyx_t_24 = __pyx_v_mol; + __pyx_t_21 = __pyx_v_start; + __pyx_t_20 = 0; + __pyx_t_32 = __pyx_v_k; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[3]; + __pyx_t_33 = __pyx_v_mol; + __pyx_t_34 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_35 = 2; + __pyx_t_36 = __pyx_v_k; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; + __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_24 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_32 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_33 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":712 - * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step + /* "newanalysis/helpers/miscellaneous.pyx":1142 + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * corr[0,shellstart1,shellstart2,dt] += t1 # l=1 + * corr[1,shellstart1,shellstart2,dt] += t2 */ + __pyx_t_36 = __pyx_v_mol; + __pyx_t_35 = __pyx_v_start; + __pyx_t_34 = 1; + __pyx_t_33 = __pyx_v_k; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_rotTs.shape[3]; + __pyx_t_32 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_21 = 2; + __pyx_t_24 = __pyx_v_k; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_rotTs.shape[3]; + __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_33 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_32 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_21 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_24 * __pyx_v_rotTs.strides[3]) ))))); + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":1143 + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart1,shellstart2,dt] += t1 # l=1 # <<<<<<<<<<<<<< + * corr[1,shellstart1,shellstart2,dt] += t2 + * corr[2,shellstart1,shellstart2,dt] += t3 + */ + __pyx_t_24 = 0; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_20 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_24 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_32 * __pyx_v_corr.strides[3]) )) += __pyx_v_t1; -/* "View.MemoryView":809 - * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + /* "newanalysis/helpers/miscellaneous.pyx":1144 + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart1,shellstart2,dt] += t1 # l=1 + * corr[1,shellstart1,shellstart2,dt] += t2 # <<<<<<<<<<<<<< + * corr[2,shellstart1,shellstart2,dt] += t3 + * corr[3,shellstart1,shellstart2,dt] += t4 */ + __pyx_t_32 = 1; + __pyx_t_20 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_24 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_32 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_21 * __pyx_v_corr.strides[2]) ) + __pyx_t_24 * __pyx_v_corr.strides[3]) )) += __pyx_v_t2; -static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { - Py_ssize_t __pyx_v_new_shape; - int __pyx_v_negative_step; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; + /* "newanalysis/helpers/miscellaneous.pyx":1145 + * corr[0,shellstart1,shellstart2,dt] += t1 # l=1 + * corr[1,shellstart1,shellstart2,dt] += t2 + * corr[2,shellstart1,shellstart2,dt] += t3 # <<<<<<<<<<<<<< + * corr[3,shellstart1,shellstart2,dt] += t4 + * corr[4,shellstart1,shellstart2,dt] += t5 + */ + __pyx_t_24 = 2; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_20 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_24 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_32 * __pyx_v_corr.strides[3]) )) += __pyx_v_t3; - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< - * - * if start < 0: + /* "newanalysis/helpers/miscellaneous.pyx":1146 + * corr[1,shellstart1,shellstart2,dt] += t2 + * corr[2,shellstart1,shellstart2,dt] += t3 + * corr[3,shellstart1,shellstart2,dt] += t4 # <<<<<<<<<<<<<< + * corr[4,shellstart1,shellstart2,dt] += t5 + * corr[5,shellstart1,shellstart2,dt] += t6 */ - __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_1) { + __pyx_t_32 = 3; + __pyx_t_20 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_24 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_32 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_21 * __pyx_v_corr.strides[2]) ) + __pyx_t_24 * __pyx_v_corr.strides[3]) )) += __pyx_v_t4; - /* "View.MemoryView":831 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: + /* "newanalysis/helpers/miscellaneous.pyx":1147 + * corr[2,shellstart1,shellstart2,dt] += t3 + * corr[3,shellstart1,shellstart2,dt] += t4 + * corr[4,shellstart1,shellstart2,dt] += t5 # <<<<<<<<<<<<<< + * corr[5,shellstart1,shellstart2,dt] += t6 + * corr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # l=2 */ - __pyx_t_1 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_1) { + __pyx_t_24 = 4; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_20 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_24 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_32 * __pyx_v_corr.strides[3]) )) += __pyx_v_t5; - /* "View.MemoryView":832 - * - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) + /* "newanalysis/helpers/miscellaneous.pyx":1148 + * corr[3,shellstart1,shellstart2,dt] += t4 + * corr[4,shellstart1,shellstart2,dt] += t5 + * corr[5,shellstart1,shellstart2,dt] += t6 # <<<<<<<<<<<<<< + * corr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + __pyx_t_32 = 5; + __pyx_t_20 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_24 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_32 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_21 * __pyx_v_corr.strides[2]) ) + __pyx_t_24 * __pyx_v_corr.strides[3]) )) += __pyx_v_t6; - /* "View.MemoryView":831 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: + /* "newanalysis/helpers/miscellaneous.pyx":1149 + * corr[4,shellstart1,shellstart2,dt] += t5 + * corr[5,shellstart1,shellstart2,dt] += t6 + * corr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # l=2 # <<<<<<<<<<<<<< + * corr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 */ - } + __pyx_t_24 = 6; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_20 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_24 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_32 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1150 + * corr[5,shellstart1,shellstart2,dt] += t6 + * corr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< + * corr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 */ - __pyx_t_1 = (0 <= __pyx_v_start); - if (__pyx_t_1) { - __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); - } - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_32 = 7; + __pyx_t_20 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_24 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_32 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_21 * __pyx_v_corr.strides[2]) ) + __pyx_t_24 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); - /* "View.MemoryView":834 - * start += shape - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< - * else: - * + /* "newanalysis/helpers/miscellaneous.pyx":1151 + * corr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< + * corr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 834, __pyx_L1_error) + __pyx_t_24 = 8; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_20 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_24 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_32 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1152 + * corr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< + * corr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 + * corr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 */ - } + __pyx_t_32 = 9; + __pyx_t_20 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_24 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_32 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_21 * __pyx_v_corr.strides[2]) ) + __pyx_t_24 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1153 + * corr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< + * corr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 * - * if start < 0: */ - goto __pyx_L3; - } + __pyx_t_24 = 10; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_20 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_24 * __pyx_v_corr.strides[0]) ) + __pyx_t_21 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ) + __pyx_t_32 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); - /* "View.MemoryView":837 - * else: - * - * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1154 + * corr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 + * corr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< * - * if have_step and step == 0: + * shelldt1 = ds1[mol,start+dt]-1 */ - /*else*/ { - __pyx_t_1 = ((__pyx_v_have_step != 0) != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_1 = ((__pyx_v_step < 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L6_bool_binop_done:; - __pyx_v_negative_step = __pyx_t_2; + __pyx_t_32 = 11; + __pyx_t_20 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_24 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_corr.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_32 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_21 * __pyx_v_corr.strides[2]) ) + __pyx_t_24 * __pyx_v_corr.strides[3]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 + /* "newanalysis/helpers/miscellaneous.pyx":1156 + * corr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + * shelldt1 = ds1[mol,start+dt]-1 # <<<<<<<<<<<<<< + * shelldt2 = ds2[mol,start+dt]-1 * */ - __pyx_t_1 = (__pyx_v_have_step != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_1 = ((__pyx_v_step == 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L9_bool_binop_done:; - if (__pyx_t_2) { + __pyx_t_24 = __pyx_v_mol; + __pyx_t_21 = (__pyx_v_start + __pyx_v_dt); + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ds1.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ds1.shape[1]; + __pyx_v_shelldt1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_24 * __pyx_v_ds1.strides[0]) ) + __pyx_t_21 * __pyx_v_ds1.strides[1]) ))) - 1); - /* "View.MemoryView":840 - * - * if have_step and step == 0: - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1157 * + * shelldt1 = ds1[mol,start+dt]-1 + * shelldt2 = ds2[mol,start+dt]-1 # <<<<<<<<<<<<<< * + * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 840, __pyx_L1_error) + __pyx_t_21 = __pyx_v_mol; + __pyx_t_24 = (__pyx_v_start + __pyx_v_dt); + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ds2.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ds2.shape[1]; + __pyx_v_shelldt2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_21 * __pyx_v_ds2.strides[0]) ) + __pyx_t_24 * __pyx_v_ds2.strides[1]) ))) - 1); - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 + /* "newanalysis/helpers/miscellaneous.pyx":1159 + * shelldt2 = ds2[mol,start+dt]-1 * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): # <<<<<<<<<<<<<< + * selfctr[shellstart1,shellstart2,dt] += 1 * */ - } + __pyx_t_23 = (__pyx_v_shellstart1 == __pyx_v_shelldt1); + if (__pyx_t_23) { + } else { + __pyx_t_22 = __pyx_t_23; + goto __pyx_L20_bool_binop_done; + } + __pyx_t_23 = (__pyx_v_shellstart2 == __pyx_v_shelldt2); + __pyx_t_22 = __pyx_t_23; + __pyx_L20_bool_binop_done:; + if (__pyx_t_22) { - /* "View.MemoryView":843 + /* "newanalysis/helpers/miscellaneous.pyx":1160 * + * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): + * selfctr[shellstart1,shellstart2,dt] += 1 # <<<<<<<<<<<<<< * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape + * selfcorr[0,shellstart1,shellstart2,dt] += t1 */ - __pyx_t_2 = (__pyx_v_have_start != 0); - if (__pyx_t_2) { + __pyx_t_24 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_20 = __pyx_v_dt; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfctr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_24 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_20 * __pyx_v_selfctr.strides[2]) )) += 1.0; - /* "View.MemoryView":844 + /* "newanalysis/helpers/miscellaneous.pyx":1162 + * selfctr[shellstart1,shellstart2,dt] += 1 * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: + * selfcorr[0,shellstart1,shellstart2,dt] += t1 # <<<<<<<<<<<<<< + * selfcorr[1,shellstart1,shellstart2,dt] += t2 + * selfcorr[2,shellstart1,shellstart2,dt] += t3 */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { + __pyx_t_20 = 0; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_24 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_20 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_32 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t1; - /* "View.MemoryView":845 - * if have_start: - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if start < 0: - * start = 0 + /* "newanalysis/helpers/miscellaneous.pyx":1163 + * + * selfcorr[0,shellstart1,shellstart2,dt] += t1 + * selfcorr[1,shellstart1,shellstart2,dt] += t2 # <<<<<<<<<<<<<< + * selfcorr[2,shellstart1,shellstart2,dt] += t3 + * selfcorr[3,shellstart1,shellstart2,dt] += t4 */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + __pyx_t_32 = 1; + __pyx_t_24 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_20 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_32 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t2; + + /* "newanalysis/helpers/miscellaneous.pyx":1164 + * selfcorr[0,shellstart1,shellstart2,dt] += t1 + * selfcorr[1,shellstart1,shellstart2,dt] += t2 + * selfcorr[2,shellstart1,shellstart2,dt] += t3 # <<<<<<<<<<<<<< + * selfcorr[3,shellstart1,shellstart2,dt] += t4 + * selfcorr[4,shellstart1,shellstart2,dt] += t5 */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":847 - * start += shape - * if start < 0: - * start = 0 # <<<<<<<<<<<<<< - * elif start >= shape: - * if negative_step: + __pyx_t_20 = 2; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_24 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_20 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_32 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t3; + + /* "newanalysis/helpers/miscellaneous.pyx":1165 + * selfcorr[1,shellstart1,shellstart2,dt] += t2 + * selfcorr[2,shellstart1,shellstart2,dt] += t3 + * selfcorr[3,shellstart1,shellstart2,dt] += t4 # <<<<<<<<<<<<<< + * selfcorr[4,shellstart1,shellstart2,dt] += t5 + * selfcorr[5,shellstart1,shellstart2,dt] += t6 */ - __pyx_v_start = 0; - - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + __pyx_t_32 = 3; + __pyx_t_24 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_20 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_32 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t4; + + /* "newanalysis/helpers/miscellaneous.pyx":1166 + * selfcorr[2,shellstart1,shellstart2,dt] += t3 + * selfcorr[3,shellstart1,shellstart2,dt] += t4 + * selfcorr[4,shellstart1,shellstart2,dt] += t5 # <<<<<<<<<<<<<< + * selfcorr[5,shellstart1,shellstart2,dt] += t6 + * selfcorr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 */ - } - - /* "View.MemoryView":844 - * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: + __pyx_t_20 = 4; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_24 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_20 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_32 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t5; + + /* "newanalysis/helpers/miscellaneous.pyx":1167 + * selfcorr[3,shellstart1,shellstart2,dt] += t4 + * selfcorr[4,shellstart1,shellstart2,dt] += t5 + * selfcorr[5,shellstart1,shellstart2,dt] += t6 # <<<<<<<<<<<<<< + * selfcorr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 + * selfcorr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 */ - goto __pyx_L12; - } - - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 + __pyx_t_32 = 5; + __pyx_t_24 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_20 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_32 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[3]) )) += __pyx_v_t6; + + /* "newanalysis/helpers/miscellaneous.pyx":1168 + * selfcorr[4,shellstart1,shellstart2,dt] += t5 + * selfcorr[5,shellstart1,shellstart2,dt] += t6 + * selfcorr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 # <<<<<<<<<<<<<< + * selfcorr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 + * selfcorr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 */ - __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + __pyx_t_20 = 6; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_24 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_20 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_32 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); + + /* "newanalysis/helpers/miscellaneous.pyx":1169 + * selfcorr[5,shellstart1,shellstart2,dt] += t6 + * selfcorr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 + * selfcorr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< + * selfcorr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 + * selfcorr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 */ - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":850 - * elif start >= shape: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = shape + __pyx_t_32 = 7; + __pyx_t_24 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_20 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_32 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); + + /* "newanalysis/helpers/miscellaneous.pyx":1170 + * selfcorr[6,shellstart1,shellstart2,dt] += 1.5*t1*t1-0.5 + * selfcorr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 + * selfcorr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< + * selfcorr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 + * selfcorr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 */ - __pyx_v_start = (__pyx_v_shape - 1); - - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + __pyx_t_20 = 8; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_24 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_20 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_32 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); + + /* "newanalysis/helpers/miscellaneous.pyx":1171 + * selfcorr[7,shellstart1,shellstart2,dt] += 1.5*t2*t2-0.5 + * selfcorr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 + * selfcorr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< + * selfcorr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 + * selfcorr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 */ - goto __pyx_L14; - } - - /* "View.MemoryView":852 - * start = shape - 1 - * else: - * start = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: + __pyx_t_32 = 9; + __pyx_t_24 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_20 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_32 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); + + /* "newanalysis/helpers/miscellaneous.pyx":1172 + * selfcorr[8,shellstart1,shellstart2,dt] += 1.5*t3*t3-0.5 + * selfcorr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 + * selfcorr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< + * selfcorr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 + * */ - /*else*/ { - __pyx_v_start = __pyx_v_shape; - } - __pyx_L14:; + __pyx_t_20 = 10; + __pyx_t_21 = __pyx_v_shellstart1; + __pyx_t_24 = __pyx_v_shellstart2; + __pyx_t_32 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_20 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_32 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 + /* "newanalysis/helpers/miscellaneous.pyx":1173 + * selfcorr[9,shellstart1,shellstart2,dt] += 1.5*t4*t4-0.5 + * selfcorr[10,shellstart1,shellstart2,dt] += 1.5*t5*t5-0.5 + * selfcorr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< + * + * for i in range(nshells1): */ - } - __pyx_L12:; - - /* "View.MemoryView":843 + __pyx_t_32 = 11; + __pyx_t_24 = __pyx_v_shellstart1; + __pyx_t_21 = __pyx_v_shellstart2; + __pyx_t_20 = __pyx_v_dt; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_32 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_24 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_21 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[3]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); + + /* "newanalysis/helpers/miscellaneous.pyx":1159 + * shelldt2 = ds2[mol,start+dt]-1 * + * if (shellstart1 == shelldt1) and (shellstart2 == shelldt2): # <<<<<<<<<<<<<< + * selfctr[shellstart1,shellstart2,dt] += 1 * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape - */ - goto __pyx_L11; - } - - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":855 - * else: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = 0 */ - __pyx_v_start = (__pyx_v_shape - 1); + } - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1132 + * shellstart1 = ds1[mol,start]-1 + * shellstart2 = ds2[mol,start]-1 + * if (shellstart1 < nshells1) and (shellstart2 < nshells2): # <<<<<<<<<<<<<< + * ctr[shellstart1,shellstart2,dt] += 1 + * */ - goto __pyx_L15; + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif } - /* "View.MemoryView":857 - * start = shape - 1 - * else: - * start = 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1126 + * cdef long i,j,k,l,start,point,dt,mol,shellstart1,shellstart2,shelldt1,shelldt2 * - * if have_stop: + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - /*else*/ { - __pyx_v_start = 0; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; } - __pyx_L15:; - } - __pyx_L11:; + } - /* "View.MemoryView":859 - * start = 0 + /* "newanalysis/helpers/miscellaneous.pyx":1175 + * selfcorr[11,shellstart1,shellstart2,dt] += 1.5*t6*t6-0.5 * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape + * for i in range(nshells1): # <<<<<<<<<<<<<< + * for l in range(nshells2): + * for j in range(maxdt): */ - __pyx_t_2 = (__pyx_v_have_stop != 0); - if (__pyx_t_2) { + __pyx_t_13 = __pyx_v_nshells1; + __pyx_t_12 = __pyx_t_13; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_12; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":860 + /* "newanalysis/helpers/miscellaneous.pyx":1176 * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: + * for i in range(nshells1): + * for l in range(nshells2): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * if ctr[i,l,j] != 0: */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { + __pyx_t_14 = __pyx_v_nshells2; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_l = __pyx_t_16; - /* "View.MemoryView":861 - * if have_stop: - * if stop < 0: - * stop += shape # <<<<<<<<<<<<<< - * if stop < 0: - * stop = 0 + /* "newanalysis/helpers/miscellaneous.pyx":1177 + * for i in range(nshells1): + * for l in range(nshells2): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * if ctr[i,l,j] != 0: + * for k in range(12): + */ + __pyx_t_17 = __pyx_v_maxdt; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; + + /* "newanalysis/helpers/miscellaneous.pyx":1178 + * for l in range(nshells2): + * for j in range(maxdt): + * if ctr[i,l,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * corr[k,i,l,j] /= ctr[i,l,j] */ - __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_l; + __pyx_t_24 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ctr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ctr.shape[2]; + __pyx_t_22 = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_21 * __pyx_v_ctr.strides[1]) ) + __pyx_t_24 * __pyx_v_ctr.strides[2]) ))) != 0.0); + if (__pyx_t_22) { - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: + /* "newanalysis/helpers/miscellaneous.pyx":1179 + * for j in range(maxdt): + * if ctr[i,l,j] != 0: + * for k in range(12): # <<<<<<<<<<<<<< + * corr[k,i,l,j] /= ctr[i,l,j] + * else: */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { + for (__pyx_t_31 = 0; __pyx_t_31 < 12; __pyx_t_31+=1) { + __pyx_v_k = __pyx_t_31; - /* "View.MemoryView":863 - * stop += shape - * if stop < 0: - * stop = 0 # <<<<<<<<<<<<<< - * elif stop > shape: - * stop = shape + /* "newanalysis/helpers/miscellaneous.pyx":1180 + * if ctr[i,l,j] != 0: + * for k in range(12): + * corr[k,i,l,j] /= ctr[i,l,j] # <<<<<<<<<<<<<< + * else: + * print('tot too sparse') + */ + __pyx_t_24 = __pyx_v_i; + __pyx_t_21 = __pyx_v_l; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ctr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ctr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[2]; + __pyx_t_32 = __pyx_v_k; + __pyx_t_33 = __pyx_v_i; + __pyx_t_34 = __pyx_v_l; + __pyx_t_35 = __pyx_v_j; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[0]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[2]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_corr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_32 * __pyx_v_corr.strides[0]) ) + __pyx_t_33 * __pyx_v_corr.strides[1]) ) + __pyx_t_34 * __pyx_v_corr.strides[2]) ) + __pyx_t_35 * __pyx_v_corr.strides[3]) )) /= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_24 * __pyx_v_ctr.strides[0]) ) + __pyx_t_21 * __pyx_v_ctr.strides[1]) ) + __pyx_t_20 * __pyx_v_ctr.strides[2]) ))); + } + + /* "newanalysis/helpers/miscellaneous.pyx":1178 + * for l in range(nshells2): + * for j in range(maxdt): + * if ctr[i,l,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * corr[k,i,l,j] /= ctr[i,l,j] */ - __pyx_v_stop = 0; + goto __pyx_L30; + } - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: + /* "newanalysis/helpers/miscellaneous.pyx":1182 + * corr[k,i,l,j] /= ctr[i,l,j] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if selfctr[i,l,j] != 0: + * for k in range(12): */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } + __pyx_L30:; - /* "View.MemoryView":860 - * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: + /* "newanalysis/helpers/miscellaneous.pyx":1183 + * else: + * print('tot too sparse') + * if selfctr[i,l,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * selfcorr[k,i,l,j] /= selfctr[i,l,j] */ - goto __pyx_L17; - } + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_l; + __pyx_t_24 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfctr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfctr.shape[2]; + __pyx_t_22 = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_20 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_24 * __pyx_v_selfctr.strides[2]) ))) != 0.0); + if (__pyx_t_22) { + + /* "newanalysis/helpers/miscellaneous.pyx":1184 + * print('tot too sparse') + * if selfctr[i,l,j] != 0: + * for k in range(12): # <<<<<<<<<<<<<< + * selfcorr[k,i,l,j] /= selfctr[i,l,j] + * else: + */ + for (__pyx_t_31 = 0; __pyx_t_31 < 12; __pyx_t_31+=1) { + __pyx_v_k = __pyx_t_31; - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1185 + * if selfctr[i,l,j] != 0: + * for k in range(12): + * selfcorr[k,i,l,j] /= selfctr[i,l,j] # <<<<<<<<<<<<<< + * else: + * print('self too sparse') */ - __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0); - if (__pyx_t_2) { + __pyx_t_24 = __pyx_v_i; + __pyx_t_21 = __pyx_v_l; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfctr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[2]; + __pyx_t_35 = __pyx_v_k; + __pyx_t_34 = __pyx_v_i; + __pyx_t_33 = __pyx_v_l; + __pyx_t_32 = __pyx_v_j; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfcorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_35 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_34 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_33 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_32 * __pyx_v_selfcorr.strides[3]) )) /= (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_24 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_21 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_20 * __pyx_v_selfctr.strides[2]) ))); + } - /* "View.MemoryView":865 - * stop = 0 - * elif stop > shape: - * stop = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: + /* "newanalysis/helpers/miscellaneous.pyx":1183 + * else: + * print('tot too sparse') + * if selfctr[i,l,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * selfcorr[k,i,l,j] /= selfctr[i,l,j] */ - __pyx_v_stop = __pyx_v_shape; + goto __pyx_L33; + } - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1187 + * selfcorr[k,i,l,j] /= selfctr[i,l,j] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< + * + * for i in range(nshells1): */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L33:; } - __pyx_L17:; + } + } - /* "View.MemoryView":859 - * start = 0 + /* "newanalysis/helpers/miscellaneous.pyx":1189 + * print('self too sparse') * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape + * for i in range(nshells1): # <<<<<<<<<<<<<< + * for l in range(nshells2): + * for j in range(maxdt): */ - goto __pyx_L16; - } + __pyx_t_13 = __pyx_v_nshells1; + __pyx_t_12 = __pyx_t_13; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_12; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1190 + * + * for i in range(nshells1): + * for l in range(nshells2): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + __pyx_t_14 = __pyx_v_nshells2; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_l = __pyx_t_16; - /* "View.MemoryView":868 - * else: - * if negative_step: - * stop = -1 # <<<<<<<<<<<<<< - * else: - * stop = shape + /* "newanalysis/helpers/miscellaneous.pyx":1191 + * for i in range(nshells1): + * for l in range(nshells2): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] + * for k in range(12): */ - __pyx_v_stop = -1L; + __pyx_t_17 = __pyx_v_maxdt; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1192 + * for l in range(nshells2): + * for j in range(maxdt): + * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] # <<<<<<<<<<<<<< + * for k in range(12): + * crosscorr[k,i,l,j] = corr[k,i,l,j] - selfcorr[k,i,l,j] */ - goto __pyx_L19; - } + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_l; + __pyx_t_24 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_ctr.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_ctr.shape[2]; + __pyx_t_32 = __pyx_v_i; + __pyx_t_33 = __pyx_v_l; + __pyx_t_34 = __pyx_v_j; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_selfctr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfctr.shape[2]; + __pyx_t_35 = __pyx_v_i; + __pyx_t_36 = __pyx_v_l; + __pyx_t_37 = __pyx_v_j; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_crossctr.shape[0]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_crossctr.shape[1]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_crossctr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crossctr.data + __pyx_t_35 * __pyx_v_crossctr.strides[0]) ) + __pyx_t_36 * __pyx_v_crossctr.strides[1]) ) + __pyx_t_37 * __pyx_v_crossctr.strides[2]) )) = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_21 * __pyx_v_ctr.strides[1]) ) + __pyx_t_24 * __pyx_v_ctr.strides[2]) ))) - (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_32 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_33 * __pyx_v_selfctr.strides[1]) ) + __pyx_t_34 * __pyx_v_selfctr.strides[2]) )))); + + /* "newanalysis/helpers/miscellaneous.pyx":1193 + * for j in range(maxdt): + * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] + * for k in range(12): # <<<<<<<<<<<<<< + * crosscorr[k,i,l,j] = corr[k,i,l,j] - selfcorr[k,i,l,j] + * + */ + for (__pyx_t_31 = 0; __pyx_t_31 < 12; __pyx_t_31+=1) { + __pyx_v_k = __pyx_t_31; - /* "View.MemoryView":870 - * stop = -1 - * else: - * stop = shape # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1194 + * crossctr[i,l,j] = ctr[i,l,j] - selfctr[i,l,j] + * for k in range(12): + * crosscorr[k,i,l,j] = corr[k,i,l,j] - selfcorr[k,i,l,j] # <<<<<<<<<<<<<< * - * if not have_step: + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr */ - /*else*/ { - __pyx_v_stop = __pyx_v_shape; + __pyx_t_34 = __pyx_v_k; + __pyx_t_33 = __pyx_v_i; + __pyx_t_32 = __pyx_v_l; + __pyx_t_24 = __pyx_v_j; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[0]; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_corr.shape[1]; + if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_corr.shape[2]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_corr.shape[3]; + __pyx_t_21 = __pyx_v_k; + __pyx_t_20 = __pyx_v_i; + __pyx_t_37 = __pyx_v_l; + __pyx_t_36 = __pyx_v_j; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_selfcorr.shape[2]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_selfcorr.shape[3]; + __pyx_t_35 = __pyx_v_k; + __pyx_t_38 = __pyx_v_i; + __pyx_t_39 = __pyx_v_l; + __pyx_t_40 = __pyx_v_j; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_crosscorr.shape[0]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_crosscorr.shape[1]; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_crosscorr.shape[2]; + if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_crosscorr.shape[3]; + *((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crosscorr.data + __pyx_t_35 * __pyx_v_crosscorr.strides[0]) ) + __pyx_t_38 * __pyx_v_crosscorr.strides[1]) ) + __pyx_t_39 * __pyx_v_crosscorr.strides[2]) ) + __pyx_t_40 * __pyx_v_crosscorr.strides[3]) )) = ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_34 * __pyx_v_corr.strides[0]) ) + __pyx_t_33 * __pyx_v_corr.strides[1]) ) + __pyx_t_32 * __pyx_v_corr.strides[2]) ) + __pyx_t_24 * __pyx_v_corr.strides[3]) ))) - (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_21 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_37 * __pyx_v_selfcorr.strides[2]) ) + __pyx_t_36 * __pyx_v_selfcorr.strides[3]) )))); + } } - __pyx_L19:; } - __pyx_L16:; + } - /* "View.MemoryView":872 - * stop = shape + /* "newanalysis/helpers/miscellaneous.pyx":1196 + * crosscorr[k,i,l,j] = corr[k,i,l,j] - selfcorr[k,i,l,j] + * + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr # <<<<<<<<<<<<<< * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 * */ - __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0); - if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 4, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_selfcorr, 4, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_crosscorr, 4, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_selfctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_crossctr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_41 = PyTuple_New(6); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_41); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_4)) __PYX_ERR(0, 1196, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_41, 1, __pyx_t_5)) __PYX_ERR(0, 1196, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_41, 2, __pyx_t_6)) __PYX_ERR(0, 1196, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_41, 3, __pyx_t_7)) __PYX_ERR(0, 1196, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_41, 4, __pyx_t_8)) __PYX_ERR(0, 1196, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_9); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_41, 5, __pyx_t_9)) __PYX_ERR(0, 1196, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_r = __pyx_t_41; + __pyx_t_41 = 0; + goto __pyx_L0; - /* "View.MemoryView":873 - * - * if not have_step: - * step = 1 # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1111 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ - __pyx_v_step = 1; - /* "View.MemoryView":872 - * stop = shape + /* function exit code */ + __pyx_L1_error:; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_11, 1); + __Pyx_XDECREF(__pyx_t_41); + __Pyx_AddTraceback("newanalysis.miscellaneous.rotationMatrixVennShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_selfcorr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_crosscorr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ctr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_selfctr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_crossctr, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/miscellaneous.pyx":1199 * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_63rotationMatrixMultiShellCorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_63rotationMatrixMultiShellCorrelate = {"rotationMatrixMultiShellCorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_63rotationMatrixMultiShellCorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_63rotationMatrixMultiShellCorrelate(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_rotTs = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds3 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds4 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_nshells; + long __pyx_v_maxdt; + long __pyx_v_startingpoints; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("rotationMatrixMultiShellCorrelate (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1199, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rotTs,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_ds3,&__pyx_n_s_ds4,&__pyx_n_s_ds5,&__pyx_n_s_nshells,&__pyx_n_s_maxdt,&__pyx_n_s_startingpoints,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rotTs)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1199, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1199, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 1); __PYX_ERR(0, 1199, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1199, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 2); __PYX_ERR(0, 1199, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds3)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1199, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 3); __PYX_ERR(0, 1199, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds4)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1199, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 4); __PYX_ERR(0, 1199, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds5)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1199, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 5); __PYX_ERR(0, 1199, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nshells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1199, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 6); __PYX_ERR(0, 1199, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxdt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1199, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 7); __PYX_ERR(0, 1199, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_startingpoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1199, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, 8); __PYX_ERR(0, 1199, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rotationMatrixMultiShellCorrelate") < 0)) __PYX_ERR(0, 1199, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 9)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + } + __pyx_v_rotTs = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rotTs.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) + __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) + __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) + __pyx_v_ds3 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds3.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) + __pyx_v_ds4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds4.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) + __pyx_v_ds5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds5.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) + __pyx_v_nshells = __Pyx_PyInt_As_long(values[6]); if (unlikely((__pyx_v_nshells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1200, __pyx_L3_error) + __pyx_v_maxdt = __Pyx_PyInt_As_long(values[7]); if (unlikely((__pyx_v_maxdt == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1200, __pyx_L3_error) + __pyx_v_startingpoints = __Pyx_PyInt_As_long(values[8]); if (unlikely((__pyx_v_startingpoints == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1200, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("rotationMatrixMultiShellCorrelate", 1, 9, 9, __pyx_nargs); __PYX_ERR(0, 1199, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds3, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds4, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds5, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.rotationMatrixMultiShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_62rotationMatrixMultiShellCorrelate(__pyx_self, __pyx_v_rotTs, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_ds3, __pyx_v_ds4, __pyx_v_ds5, __pyx_v_nshells, __pyx_v_maxdt, __pyx_v_startingpoints); - /* "View.MemoryView":877 - * - * with cython.cdivision(True): - * new_shape = (stop - start) // step # <<<<<<<<<<<<<< - * - * if (stop - start) - step * new_shape: - */ - __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_rotTs, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds3, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds4, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds5, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":879 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 - * - */ - __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); - if (__pyx_t_2) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_62rotationMatrixMultiShellCorrelate(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_rotTs, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, __Pyx_memviewslice __pyx_v_ds3, __Pyx_memviewslice __pyx_v_ds4, __Pyx_memviewslice __pyx_v_ds5, long __pyx_v_nshells, long __pyx_v_maxdt, long __pyx_v_startingpoints) { + long __pyx_v_nmol; + long __pyx_v_n; + long __pyx_v_startskip; + __Pyx_memviewslice __pyx_v_corr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_selfcorr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_crosscorr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_selfctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_crossctr = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_t1; + double __pyx_v_t2; + double __pyx_v_t3; + double __pyx_v_t4; + double __pyx_v_t5; + double __pyx_v_t6; + long __pyx_v_i; + long __pyx_v_j; + long __pyx_v_k; + long __pyx_v_start; + long __pyx_v_point; + long __pyx_v_dt; + long __pyx_v_mol; + long __pyx_v_shellstart; + long __pyx_v_shelldt; + long __pyx_v_shell1; + long __pyx_v_shell2; + long __pyx_v_shell3; + long __pyx_v_shell4; + long __pyx_v_shell5; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_t_11; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + long __pyx_t_21; + long __pyx_t_22; + long __pyx_t_23; + long __pyx_t_24; + long __pyx_t_25; + long __pyx_t_26; + int __pyx_t_27; + double __pyx_t_28; + double __pyx_t_29; + double __pyx_t_30; + double __pyx_t_31; + double __pyx_t_32; + double __pyx_t_33; + Py_ssize_t __pyx_t_34; + Py_ssize_t __pyx_t_35; + Py_ssize_t __pyx_t_36; + Py_ssize_t __pyx_t_37; + Py_ssize_t __pyx_t_38; + Py_ssize_t __pyx_t_39; + Py_ssize_t __pyx_t_40; + PyObject *__pyx_t_41 = NULL; + PyObject *__pyx_t_42 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("rotationMatrixMultiShellCorrelate", 0); - /* "View.MemoryView":880 - * - * if (stop - start) - step * new_shape: - * new_shape += 1 # <<<<<<<<<<<<<< - * - * if new_shape < 0: + /* "newanalysis/helpers/miscellaneous.pyx":1201 + * @cython.boundscheck(False) + * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules # <<<<<<<<<<<<<< + * cdef long n = len(rotTs[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array */ - __pyx_v_new_shape = (__pyx_v_new_shape + 1); + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_rotTs); + __pyx_v_nmol = ((long)__pyx_t_1); - /* "View.MemoryView":879 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 - * + /* "newanalysis/helpers/miscellaneous.pyx":1202 + * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules + * cdef long n = len(rotTs[0]) # number of time steps # <<<<<<<<<<<<<< + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints */ - } + __pyx_t_2.data = __pyx_v_rotTs.data; + __pyx_t_2.memview = __pyx_v_rotTs.memview; + __PYX_INC_MEMVIEW(&__pyx_t_2, 1); + { + Py_ssize_t __pyx_tmp_idx = 0; + Py_ssize_t __pyx_tmp_shape = __pyx_v_rotTs.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_rotTs.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride; +} - /* "View.MemoryView":882 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 - * - */ - __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0); - if (__pyx_t_2) { +__pyx_t_2.shape[0] = __pyx_v_rotTs.shape[1]; +__pyx_t_2.strides[0] = __pyx_v_rotTs.strides[1]; + __pyx_t_2.suboffsets[0] = -1; - /* "View.MemoryView":883 - * - * if new_shape < 0: - * new_shape = 0 # <<<<<<<<<<<<<< - * - * +__pyx_t_2.shape[1] = __pyx_v_rotTs.shape[2]; +__pyx_t_2.strides[1] = __pyx_v_rotTs.strides[2]; + __pyx_t_2.suboffsets[1] = -1; + +__pyx_t_2.shape[2] = __pyx_v_rotTs.shape[3]; +__pyx_t_2.strides[2] = __pyx_v_rotTs.strides[3]; + __pyx_t_2.suboffsets[2] = -1; + +__pyx_t_1 = __Pyx_MemoryView_Len(__pyx_t_2); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL; + __pyx_v_n = ((long)__pyx_t_1); + + /* "newanalysis/helpers/miscellaneous.pyx":1204 + * cdef long n = len(rotTs[0]) # number of time steps + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints # <<<<<<<<<<<<<< + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) */ - __pyx_v_new_shape = 0; + __pyx_t_3 = ((long)(__pyx_v_n - __pyx_v_maxdt)); + if (unlikely(__pyx_v_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 1204, __pyx_L1_error) + } + else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_startingpoints == (long)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(0, 1204, __pyx_L1_error) + } + __pyx_v_startskip = __Pyx_div_long(__pyx_t_3, __pyx_v_startingpoints); - /* "View.MemoryView":882 - * new_shape += 1 - * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 - * + /* "newanalysis/helpers/miscellaneous.pyx":1205 + * # cdef long nds = len(ds) # number of steps in delaunay array + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 # <<<<<<<<<<<<<< + * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_12)) __PYX_ERR(0, 1205, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(0, 1205, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1205, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_corr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; - /* "View.MemoryView":886 - * - * - * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset + /* "newanalysis/helpers/miscellaneous.pyx":1206 + * cdef long startskip = (n-maxdt)//startingpoints + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries */ - (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_12)) __PYX_ERR(0, 1206, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7)) __PYX_ERR(0, 1206, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1206, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_selfcorr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; - /* "View.MemoryView":887 - * - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< - * dst.suboffsets[new_ndim] = suboffset - * + /* "newanalysis/helpers/miscellaneous.pyx":1207 + * cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 + * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) */ - (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_int_12); + __Pyx_GIVEREF(__pyx_int_12); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_12)) __PYX_ERR(0, 1207, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8)) __PYX_ERR(0, 1207, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7)) __PYX_ERR(0, 1207, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1207, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_crosscorr = __pyx_t_2; + __pyx_t_2.memview = NULL; + __pyx_t_2.data = NULL; - /* "View.MemoryView":888 - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/miscellaneous.pyx":1208 + * cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries # <<<<<<<<<<<<<< + * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) + * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) */ - (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5)) __PYX_ERR(0, 1208, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7)) __PYX_ERR(0, 1208, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; + } } - __pyx_L3:; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1208, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_ctr = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; - /* "View.MemoryView":891 - * - * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1209 + * cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) # <<<<<<<<<<<<<< + * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) + * cdef double t1,t2,t3,t4,t5,t6 */ - __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0); - if (__pyx_t_2) { + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6)) __PYX_ERR(0, 1209, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 1209, __pyx_L1_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1209, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_selfctr = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; - /* "View.MemoryView":892 - * - * if suboffset_dim[0] < 0: - * dst.data += start * stride # <<<<<<<<<<<<<< - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride + /* "newanalysis/helpers/miscellaneous.pyx":1210 + * cdef double [:,:] ctr = np.zeros((nshells,maxdt)) # counter array of correlation entries + * cdef double [:,:] selfctr = np.zeros((nshells,maxdt)) + * cdef double [:,:] crossctr = np.zeros((nshells,maxdt)) # <<<<<<<<<<<<<< + * cdef double t1,t2,t3,t4,t5,t6 + * cdef long i,j,k,start,point,dt,mol,shellstart,shelldt */ - __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_nshells); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_maxdt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8)) __PYX_ERR(0, 1210, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7)) __PYX_ERR(0, 1210, __pyx_L1_error); + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_9 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1210, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_crossctr = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; - /* "View.MemoryView":891 - * + /* "newanalysis/helpers/miscellaneous.pyx":1215 + * cdef long shell1, shell2, shell3, shell4, shell5 * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - goto __pyx_L23; - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_3 = __pyx_v_maxdt; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_12 > 0) + { + #ifdef _OPENMP + #pragma omp parallel reduction(+:__pyx_v_t1) reduction(+:__pyx_v_t2) reduction(+:__pyx_v_t3) reduction(+:__pyx_v_t4) reduction(+:__pyx_v_t5) reduction(+:__pyx_v_t6) private(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_23, __pyx_t_24, __pyx_t_25, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_33, __pyx_t_34, __pyx_t_35, __pyx_t_36, __pyx_t_37, __pyx_t_38, __pyx_t_39) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_dt) lastprivate(__pyx_v_dt) lastprivate(__pyx_v_k) lastprivate(__pyx_v_mol) lastprivate(__pyx_v_point) lastprivate(__pyx_v_shell1) lastprivate(__pyx_v_shell2) lastprivate(__pyx_v_shell3) lastprivate(__pyx_v_shell4) lastprivate(__pyx_v_shell5) lastprivate(__pyx_v_shelldt) lastprivate(__pyx_v_shellstart) lastprivate(__pyx_v_start) + #endif /* _OPENMP */ + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){ + { + __pyx_v_dt = (long)(0 + 1 * __pyx_t_11); + /* Initialize private variables to invalid values */ + __pyx_v_k = ((long)0xbad0bad0); + __pyx_v_mol = ((long)0xbad0bad0); + __pyx_v_point = ((long)0xbad0bad0); + __pyx_v_shell1 = ((long)0xbad0bad0); + __pyx_v_shell2 = ((long)0xbad0bad0); + __pyx_v_shell3 = ((long)0xbad0bad0); + __pyx_v_shell4 = ((long)0xbad0bad0); + __pyx_v_shell5 = ((long)0xbad0bad0); + __pyx_v_shelldt = ((long)0xbad0bad0); + __pyx_v_shellstart = ((long)0xbad0bad0); + __pyx_v_start = ((long)0xbad0bad0); - /* "View.MemoryView":894 - * dst.data += start * stride - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1216 * - * if suboffset >= 0: + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points # <<<<<<<<<<<<<< + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip */ - /*else*/ { - __pyx_t_3 = (__pyx_v_suboffset_dim[0]); - (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); - } - __pyx_L23:; + __pyx_t_13 = __pyx_v_startingpoints; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_point = __pyx_t_15; - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride - * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: + /* "newanalysis/helpers/miscellaneous.pyx":1217 + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries # <<<<<<<<<<<<<< + * start = point*startskip + * shell1 = ds1[mol,start]-1 */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { + __pyx_t_16 = __pyx_v_nmol; + __pyx_t_17 = __pyx_t_16; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_mol = __pyx_t_18; - /* "View.MemoryView":897 - * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset + /* "newanalysis/helpers/miscellaneous.pyx":1218 + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip # <<<<<<<<<<<<<< + * shell1 = ds1[mol,start]-1 + * shell2 = ds2[mol,start]-1 */ - __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_2) { + __pyx_v_start = (__pyx_v_point * __pyx_v_startskip); - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1219 + * for mol in range(nmol): # loop over molecules/entries + * start = point*startskip + * shell1 = ds1[mol,start]-1 # <<<<<<<<<<<<<< + * shell2 = ds2[mol,start]-1 + * shell3 = ds3[mol,start]-1 */ - __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0); - if (__pyx_t_2) { + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds1.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds1.shape[1]; + __pyx_v_shell1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_19 * __pyx_v_ds1.strides[0]) ) + __pyx_t_20 * __pyx_v_ds1.strides[1]) ))) - 1); - /* "View.MemoryView":899 - * if not is_slice: - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " + /* "newanalysis/helpers/miscellaneous.pyx":1220 + * start = point*startskip + * shell1 = ds1[mol,start]-1 + * shell2 = ds2[mol,start]-1 # <<<<<<<<<<<<<< + * shell3 = ds3[mol,start]-1 + * shell4 = ds4[mol,start]-1 */ - __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + __pyx_t_20 = __pyx_v_mol; + __pyx_t_19 = __pyx_v_start; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds2.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds2.shape[1]; + __pyx_v_shell2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_20 * __pyx_v_ds2.strides[0]) ) + __pyx_t_19 * __pyx_v_ds2.strides[1]) ))) - 1); - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1221 + * shell1 = ds1[mol,start]-1 + * shell2 = ds2[mol,start]-1 + * shell3 = ds3[mol,start]-1 # <<<<<<<<<<<<<< + * shell4 = ds4[mol,start]-1 + * shell5 = ds5[mol,start]-1 */ - goto __pyx_L26; - } + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds3.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds3.shape[1]; + __pyx_v_shell3 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds3.data + __pyx_t_19 * __pyx_v_ds3.strides[0]) ) + __pyx_t_20 * __pyx_v_ds3.strides[1]) ))) - 1); - /* "View.MemoryView":901 - * dst.data = ( dst.data)[0] + suboffset - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< - * "must be indexed and not sliced", dim) - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1222 + * shell2 = ds2[mol,start]-1 + * shell3 = ds3[mol,start]-1 + * shell4 = ds4[mol,start]-1 # <<<<<<<<<<<<<< + * shell5 = ds5[mol,start]-1 + * shellstart = min(shell1, shell2, shell3, shell4, shell5) */ - /*else*/ { + __pyx_t_20 = __pyx_v_mol; + __pyx_t_19 = __pyx_v_start; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds4.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds4.shape[1]; + __pyx_v_shell4 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds4.data + __pyx_t_20 * __pyx_v_ds4.strides[0]) ) + __pyx_t_19 * __pyx_v_ds4.strides[1]) ))) - 1); - /* "View.MemoryView":902 - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< - * else: - * suboffset_dim[0] = new_ndim + /* "newanalysis/helpers/miscellaneous.pyx":1223 + * shell3 = ds3[mol,start]-1 + * shell4 = ds4[mol,start]-1 + * shell5 = ds5[mol,start]-1 # <<<<<<<<<<<<<< + * shellstart = min(shell1, shell2, shell3, shell4, shell5) + * if shellstart < nshells: */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 901, __pyx_L1_error) - } - __pyx_L26:; + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds5.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds5.shape[1]; + __pyx_v_shell5 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds5.data + __pyx_t_19 * __pyx_v_ds5.strides[0]) ) + __pyx_t_20 * __pyx_v_ds5.strides[1]) ))) - 1); - /* "View.MemoryView":897 - * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset + /* "newanalysis/helpers/miscellaneous.pyx":1224 + * shell4 = ds4[mol,start]-1 + * shell5 = ds5[mol,start]-1 + * shellstart = min(shell1, shell2, shell3, shell4, shell5) # <<<<<<<<<<<<<< + * if shellstart < nshells: + * ctr[shellstart,dt] += 1 */ - goto __pyx_L25; - } + __pyx_t_21 = __pyx_v_shell2; + __pyx_t_22 = __pyx_v_shell3; + __pyx_t_23 = __pyx_v_shell4; + __pyx_t_24 = __pyx_v_shell5; + __pyx_t_25 = __pyx_v_shell1; + __pyx_t_27 = (__pyx_t_21 < __pyx_t_25); + if (__pyx_t_27) { + __pyx_t_26 = __pyx_t_21; + } else { + __pyx_t_26 = __pyx_t_25; + } + __pyx_t_25 = __pyx_t_26; + __pyx_t_27 = (__pyx_t_22 < __pyx_t_25); + if (__pyx_t_27) { + __pyx_t_26 = __pyx_t_22; + } else { + __pyx_t_26 = __pyx_t_25; + } + __pyx_t_25 = __pyx_t_26; + __pyx_t_27 = (__pyx_t_23 < __pyx_t_25); + if (__pyx_t_27) { + __pyx_t_26 = __pyx_t_23; + } else { + __pyx_t_26 = __pyx_t_25; + } + __pyx_t_25 = __pyx_t_26; + __pyx_t_27 = (__pyx_t_24 < __pyx_t_25); + if (__pyx_t_27) { + __pyx_t_26 = __pyx_t_24; + } else { + __pyx_t_26 = __pyx_t_25; + } + __pyx_v_shellstart = __pyx_t_26; - /* "View.MemoryView":904 - * "must be indexed and not sliced", dim) - * else: - * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1225 + * shell5 = ds5[mol,start]-1 + * shellstart = min(shell1, shell2, shell3, shell4, shell5) + * if shellstart < nshells: # <<<<<<<<<<<<<< + * ctr[shellstart,dt] += 1 * - * return 0 */ - /*else*/ { - (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; - } - __pyx_L25:; + __pyx_t_27 = (__pyx_v_shellstart < __pyx_v_nshells); + if (__pyx_t_27) { - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride + /* "newanalysis/helpers/miscellaneous.pyx":1226 + * shellstart = min(shell1, shell2, shell3, shell4, shell5) + * if shellstart < nshells: + * ctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 */ - } + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) )) += 1.0; - /* "View.MemoryView":906 - * suboffset_dim[0] = new_ndim - * - * return 0 # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1228 + * ctr[shellstart,dt] += 1 * + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 # <<<<<<<<<<<<<< + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_28 = 0.0; + __pyx_t_29 = 0.0; + __pyx_t_30 = 0.0; + __pyx_t_31 = 0.0; + __pyx_t_32 = 0.0; + __pyx_t_33 = 0.0; + __pyx_v_t1 = __pyx_t_28; + __pyx_v_t2 = __pyx_t_29; + __pyx_v_t3 = __pyx_t_30; + __pyx_v_t4 = __pyx_t_31; + __pyx_v_t5 = __pyx_t_32; + __pyx_v_t6 = __pyx_t_33; - /* "View.MemoryView":809 + /* "newanalysis/helpers/miscellaneous.pyx":1229 * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * for k in range(3): # skalar produkt # <<<<<<<<<<<<<< + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] */ + for (__pyx_t_26 = 0; __pyx_t_26 < 3; __pyx_t_26+=1) { + __pyx_v_k = __pyx_t_26; - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = -1; - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":912 - * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 + /* "newanalysis/helpers/miscellaneous.pyx":1230 + * t1,t2,t3,t4,t5,t6 = 0,0,0,0,0,0 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] # <<<<<<<<<<<<<< + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] */ + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_34 = 0; + __pyx_t_35 = __pyx_v_k; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; + __pyx_t_36 = __pyx_v_mol; + __pyx_t_37 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_38 = 0; + __pyx_t_39 = __pyx_v_k; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[3]; + __pyx_v_t1 = (__pyx_v_t1 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[3]) ))))); -static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_suboffset; - Py_ssize_t __pyx_v_itemsize; - char *__pyx_v_resultp; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pybuffer_index", 0); + /* "newanalysis/helpers/miscellaneous.pyx":1231 + * for k in range(3): # skalar produkt + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + */ + __pyx_t_39 = __pyx_v_mol; + __pyx_t_38 = __pyx_v_start; + __pyx_t_37 = 1; + __pyx_t_36 = __pyx_v_k; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; + __pyx_t_35 = __pyx_v_mol; + __pyx_t_34 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_20 = 1; + __pyx_t_19 = __pyx_v_k; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; + __pyx_v_t2 = (__pyx_v_t2 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_39 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":914 - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< - * cdef Py_ssize_t itemsize = view.itemsize - * cdef char *resultp + /* "newanalysis/helpers/miscellaneous.pyx":1232 + * t1 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,0,k] + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] */ - __pyx_v_suboffset = -1L; + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_34 = 2; + __pyx_t_35 = __pyx_v_k; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; + __pyx_t_36 = __pyx_v_mol; + __pyx_t_37 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_38 = 2; + __pyx_t_39 = __pyx_v_k; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[3]; + __pyx_v_t3 = (__pyx_v_t3 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":915 - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< - * cdef char *resultp - * + /* "newanalysis/helpers/miscellaneous.pyx":1233 + * t2 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,1,k] + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] # <<<<<<<<<<<<<< + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] */ - __pyx_t_1 = __pyx_v_view->itemsize; - __pyx_v_itemsize = __pyx_t_1; + __pyx_t_39 = __pyx_v_mol; + __pyx_t_38 = __pyx_v_start; + __pyx_t_37 = 0; + __pyx_t_36 = __pyx_v_k; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; + __pyx_t_35 = __pyx_v_mol; + __pyx_t_34 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_20 = 1; + __pyx_t_19 = __pyx_v_k; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; + __pyx_v_t4 = (__pyx_v_t4 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_39 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":918 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + /* "newanalysis/helpers/miscellaneous.pyx":1234 + * t3 += rotTs[mol,start,2,k]*rotTs[mol,start+dt,2,k] + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart,dt] += t1 # l=1 */ - __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0); - if (__pyx_t_2) { + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = __pyx_v_start; + __pyx_t_34 = 0; + __pyx_t_35 = __pyx_v_k; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[3]; + __pyx_t_36 = __pyx_v_mol; + __pyx_t_37 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_38 = 2; + __pyx_t_39 = __pyx_v_k; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[3]; + __pyx_v_t5 = (__pyx_v_t5 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_19 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_35 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_36 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_39 * __pyx_v_rotTs.strides[3]) ))))); - /* "View.MemoryView":919 - * - * if view.ndim == 0: - * shape = view.len / itemsize # <<<<<<<<<<<<<< - * stride = itemsize - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1235 + * t4 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,1,k] + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] # <<<<<<<<<<<<<< + * corr[0,shellstart,dt] += t1 # l=1 + * corr[1,shellstart,dt] += t2 */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); + __pyx_t_39 = __pyx_v_mol; + __pyx_t_38 = __pyx_v_start; + __pyx_t_37 = 1; + __pyx_t_36 = __pyx_v_k; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_rotTs.shape[3]; + __pyx_t_35 = __pyx_v_mol; + __pyx_t_34 = (__pyx_v_start + __pyx_v_dt); + __pyx_t_20 = 2; + __pyx_t_19 = __pyx_v_k; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_rotTs.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_rotTs.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_rotTs.shape[2]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_rotTs.shape[3]; + __pyx_v_t6 = (__pyx_v_t6 + ((*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_39 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_38 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_37 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_36 * __pyx_v_rotTs.strides[3]) ))) * (*((double *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rotTs.data + __pyx_t_35 * __pyx_v_rotTs.strides[0]) ) + __pyx_t_34 * __pyx_v_rotTs.strides[1]) ) + __pyx_t_20 * __pyx_v_rotTs.strides[2]) ) + __pyx_t_19 * __pyx_v_rotTs.strides[3]) ))))); + } - /* "View.MemoryView":920 - * if view.ndim == 0: - * shape = view.len / itemsize - * stride = itemsize # <<<<<<<<<<<<<< - * else: - * shape = view.shape[dim] + /* "newanalysis/helpers/miscellaneous.pyx":1236 + * t5 += rotTs[mol,start,0,k]*rotTs[mol,start+dt,2,k] + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart,dt] += t1 # l=1 # <<<<<<<<<<<<<< + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 */ - __pyx_v_stride = __pyx_v_itemsize; + __pyx_t_19 = 0; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_34 * __pyx_v_corr.strides[2]) )) += __pyx_v_t1; - /* "View.MemoryView":918 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + /* "newanalysis/helpers/miscellaneous.pyx":1237 + * t6 += rotTs[mol,start,1,k]*rotTs[mol,start+dt,2,k] + * corr[0,shellstart,dt] += t1 # l=1 + * corr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 */ - goto __pyx_L3; - } + __pyx_t_34 = 1; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_34 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t2; - /* "View.MemoryView":922 - * stride = itemsize - * else: - * shape = view.shape[dim] # <<<<<<<<<<<<<< - * stride = view.strides[dim] - * if view.suboffsets != NULL: + /* "newanalysis/helpers/miscellaneous.pyx":1238 + * corr[0,shellstart,dt] += t1 # l=1 + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 */ - /*else*/ { - __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + __pyx_t_19 = 2; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_34 * __pyx_v_corr.strides[2]) )) += __pyx_v_t3; - /* "View.MemoryView":923 - * else: - * shape = view.shape[dim] - * stride = view.strides[dim] # <<<<<<<<<<<<<< - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] + /* "newanalysis/helpers/miscellaneous.pyx":1239 + * corr[1,shellstart,dt] += t2 + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 */ - __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + __pyx_t_34 = 3; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_34 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t4; - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * + /* "newanalysis/helpers/miscellaneous.pyx":1240 + * corr[2,shellstart,dt] += t3 + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 */ - __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0); - if (__pyx_t_2) { + __pyx_t_19 = 4; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_34 * __pyx_v_corr.strides[2]) )) += __pyx_v_t5; - /* "View.MemoryView":925 - * stride = view.strides[dim] - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< - * - * if index < 0: + /* "newanalysis/helpers/miscellaneous.pyx":1241 + * corr[3,shellstart,dt] += t4 + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 */ - __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + __pyx_t_34 = 5; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_34 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += __pyx_v_t6; - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * + /* "newanalysis/helpers/miscellaneous.pyx":1242 + * corr[4,shellstart,dt] += t5 + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 # <<<<<<<<<<<<<< + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 */ - } - } - __pyx_L3:; + __pyx_t_19 = 6; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_34 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] - * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: + /* "newanalysis/helpers/miscellaneous.pyx":1243 + * corr[5,shellstart,dt] += t6 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (__pyx_t_2) { + __pyx_t_34 = 7; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_34 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); - /* "View.MemoryView":928 - * - * if index < 0: - * index += view.shape[dim] # <<<<<<<<<<<<<< - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "newanalysis/helpers/miscellaneous.pyx":1244 + * corr[6,shellstart,dt] += 1.5*t1*t1-0.5 # l=2 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 */ - __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + __pyx_t_19 = 8; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_34 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * + /* "newanalysis/helpers/miscellaneous.pyx":1245 + * corr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_34 = 9; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_34 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); - /* "View.MemoryView":930 - * index += view.shape[dim] - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1246 + * corr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 * - * if index >= shape: */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 930, __pyx_L1_error) + __pyx_t_19 = 10; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_19 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_34 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "newanalysis/helpers/miscellaneous.pyx":1247 + * corr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * corr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< * + * shell1 = ds1[mol,start+dt]-1 */ - } + __pyx_t_34 = 11; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_34 * __pyx_v_corr.strides[0]) ) + __pyx_t_20 * __pyx_v_corr.strides[1]) ) + __pyx_t_19 * __pyx_v_corr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] + /* "newanalysis/helpers/miscellaneous.pyx":1249 + * corr[11,shellstart,dt] += 1.5*t6*t6-0.5 * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: + * shell1 = ds1[mol,start+dt]-1 # <<<<<<<<<<<<<< + * shell2 = ds2[mol,start+dt]-1 + * shell3 = ds3[mol,start+dt]-1 */ - } + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds1.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds1.shape[1]; + __pyx_v_shell1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_19 * __pyx_v_ds1.strides[0]) ) + __pyx_t_20 * __pyx_v_ds1.strides[1]) ))) - 1); - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "newanalysis/helpers/miscellaneous.pyx":1250 * + * shell1 = ds1[mol,start+dt]-1 + * shell2 = ds2[mol,start+dt]-1 # <<<<<<<<<<<<<< + * shell3 = ds3[mol,start+dt]-1 + * shell4 = ds4[mol,start+dt]-1 */ - __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_20 = __pyx_v_mol; + __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds2.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds2.shape[1]; + __pyx_v_shell2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_20 * __pyx_v_ds2.strides[0]) ) + __pyx_t_19 * __pyx_v_ds2.strides[1]) ))) - 1); - /* "View.MemoryView":933 - * - * if index >= shape: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< - * - * resultp = bufp + index * stride + /* "newanalysis/helpers/miscellaneous.pyx":1251 + * shell1 = ds1[mol,start+dt]-1 + * shell2 = ds2[mol,start+dt]-1 + * shell3 = ds3[mol,start+dt]-1 # <<<<<<<<<<<<<< + * shell4 = ds4[mol,start+dt]-1 + * shell5 = ds5[mol,start+dt]-1 */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 933, __pyx_L1_error) + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds3.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds3.shape[1]; + __pyx_v_shell3 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds3.data + __pyx_t_19 * __pyx_v_ds3.strides[0]) ) + __pyx_t_20 * __pyx_v_ds3.strides[1]) ))) - 1); - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * + /* "newanalysis/helpers/miscellaneous.pyx":1252 + * shell2 = ds2[mol,start+dt]-1 + * shell3 = ds3[mol,start+dt]-1 + * shell4 = ds4[mol,start+dt]-1 # <<<<<<<<<<<<<< + * shell5 = ds5[mol,start+dt]-1 + * shelldt = min(shell1, shell2, shell3, shell4, shell5) */ - } + __pyx_t_20 = __pyx_v_mol; + __pyx_t_19 = (__pyx_v_start + __pyx_v_dt); + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds4.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds4.shape[1]; + __pyx_v_shell4 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds4.data + __pyx_t_20 * __pyx_v_ds4.strides[0]) ) + __pyx_t_19 * __pyx_v_ds4.strides[1]) ))) - 1); - /* "View.MemoryView":935 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * resultp = bufp + index * stride # <<<<<<<<<<<<<< - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset + /* "newanalysis/helpers/miscellaneous.pyx":1253 + * shell3 = ds3[mol,start+dt]-1 + * shell4 = ds4[mol,start+dt]-1 + * shell5 = ds5[mol,start+dt]-1 # <<<<<<<<<<<<<< + * shelldt = min(shell1, shell2, shell3, shell4, shell5) + * if shellstart == shelldt: */ - __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + __pyx_t_19 = __pyx_v_mol; + __pyx_t_20 = (__pyx_v_start + __pyx_v_dt); + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ds5.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ds5.shape[1]; + __pyx_v_shell5 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds5.data + __pyx_t_19 * __pyx_v_ds5.strides[0]) ) + __pyx_t_20 * __pyx_v_ds5.strides[1]) ))) - 1); - /* "View.MemoryView":936 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset - * + /* "newanalysis/helpers/miscellaneous.pyx":1254 + * shell4 = ds4[mol,start+dt]-1 + * shell5 = ds5[mol,start+dt]-1 + * shelldt = min(shell1, shell2, shell3, shell4, shell5) # <<<<<<<<<<<<<< + * if shellstart == shelldt: + * selfctr[shellstart,dt] += 1 */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { + __pyx_t_26 = __pyx_v_shell2; + __pyx_t_21 = __pyx_v_shell3; + __pyx_t_22 = __pyx_v_shell4; + __pyx_t_23 = __pyx_v_shell5; + __pyx_t_24 = __pyx_v_shell1; + __pyx_t_27 = (__pyx_t_26 < __pyx_t_24); + if (__pyx_t_27) { + __pyx_t_25 = __pyx_t_26; + } else { + __pyx_t_25 = __pyx_t_24; + } + __pyx_t_24 = __pyx_t_25; + __pyx_t_27 = (__pyx_t_21 < __pyx_t_24); + if (__pyx_t_27) { + __pyx_t_25 = __pyx_t_21; + } else { + __pyx_t_25 = __pyx_t_24; + } + __pyx_t_24 = __pyx_t_25; + __pyx_t_27 = (__pyx_t_22 < __pyx_t_24); + if (__pyx_t_27) { + __pyx_t_25 = __pyx_t_22; + } else { + __pyx_t_25 = __pyx_t_24; + } + __pyx_t_24 = __pyx_t_25; + __pyx_t_27 = (__pyx_t_23 < __pyx_t_24); + if (__pyx_t_27) { + __pyx_t_25 = __pyx_t_23; + } else { + __pyx_t_25 = __pyx_t_24; + } + __pyx_v_shelldt = __pyx_t_25; - /* "View.MemoryView":937 - * resultp = bufp + index * stride - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1255 + * shell5 = ds5[mol,start+dt]-1 + * shelldt = min(shell1, shell2, shell3, shell4, shell5) + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * selfctr[shellstart,dt] += 1 * - * return resultp */ - __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + __pyx_t_27 = (__pyx_v_shellstart == __pyx_v_shelldt); + if (__pyx_t_27) { - /* "View.MemoryView":936 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset + /* "newanalysis/helpers/miscellaneous.pyx":1256 + * shelldt = min(shell1, shell2, shell3, shell4, shell5) + * if shellstart == shelldt: + * selfctr[shellstart,dt] += 1 # <<<<<<<<<<<<<< * + * selfcorr[0,shellstart,dt] += t1 */ - } + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_20 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfctr.strides[1]) )) += 1.0; - /* "View.MemoryView":939 - * resultp = ( resultp)[0] + suboffset - * - * return resultp # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1258 + * selfctr[shellstart,dt] += 1 * + * selfcorr[0,shellstart,dt] += t1 # <<<<<<<<<<<<<< + * selfcorr[1,shellstart,dt] += t2 + * selfcorr[2,shellstart,dt] += t3 */ - __pyx_r = __pyx_v_resultp; - goto __pyx_L0; + __pyx_t_19 = 0; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_34 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t1; - /* "View.MemoryView":912 + /* "newanalysis/helpers/miscellaneous.pyx":1259 * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 + * selfcorr[0,shellstart,dt] += t1 + * selfcorr[1,shellstart,dt] += t2 # <<<<<<<<<<<<<< + * selfcorr[2,shellstart,dt] += t3 + * selfcorr[3,shellstart,dt] += t4 */ + __pyx_t_34 = 1; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_34 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t2; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":1260 + * selfcorr[0,shellstart,dt] += t1 + * selfcorr[1,shellstart,dt] += t2 + * selfcorr[2,shellstart,dt] += t3 # <<<<<<<<<<<<<< + * selfcorr[3,shellstart,dt] += t4 + * selfcorr[4,shellstart,dt] += t5 + */ + __pyx_t_19 = 2; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_34 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t3; -/* "View.MemoryView":945 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim - * + /* "newanalysis/helpers/miscellaneous.pyx":1261 + * selfcorr[1,shellstart,dt] += t2 + * selfcorr[2,shellstart,dt] += t3 + * selfcorr[3,shellstart,dt] += t4 # <<<<<<<<<<<<<< + * selfcorr[4,shellstart,dt] += t5 + * selfcorr[5,shellstart,dt] += t6 */ + __pyx_t_34 = 3; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_34 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t4; -static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { - int __pyx_v_ndim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_r; - int __pyx_t_1; - Py_ssize_t *__pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; + /* "newanalysis/helpers/miscellaneous.pyx":1262 + * selfcorr[2,shellstart,dt] += t3 + * selfcorr[3,shellstart,dt] += t4 + * selfcorr[4,shellstart,dt] += t5 # <<<<<<<<<<<<<< + * selfcorr[5,shellstart,dt] += t6 + * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 + */ + __pyx_t_19 = 4; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_34 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t5; - /* "View.MemoryView":946 - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: - * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< - * - * cdef Py_ssize_t *shape = memslice.shape + /* "newanalysis/helpers/miscellaneous.pyx":1263 + * selfcorr[3,shellstart,dt] += t4 + * selfcorr[4,shellstart,dt] += t5 + * selfcorr[5,shellstart,dt] += t6 # <<<<<<<<<<<<<< + * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 + * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 */ - __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; - __pyx_v_ndim = __pyx_t_1; + __pyx_t_34 = 5; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_34 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += __pyx_v_t6; - /* "View.MemoryView":948 - * cdef int ndim = memslice.memview.view.ndim - * - * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< - * cdef Py_ssize_t *strides = memslice.strides - * + /* "newanalysis/helpers/miscellaneous.pyx":1264 + * selfcorr[4,shellstart,dt] += t5 + * selfcorr[5,shellstart,dt] += t6 + * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 # <<<<<<<<<<<<<< + * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 */ - __pyx_t_2 = __pyx_v_memslice->shape; - __pyx_v_shape = __pyx_t_2; + __pyx_t_19 = 6; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_34 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t1) * __pyx_v_t1) - 0.5); - /* "View.MemoryView":949 - * - * cdef Py_ssize_t *shape = memslice.shape - * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/miscellaneous.pyx":1265 + * selfcorr[5,shellstart,dt] += t6 + * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 + * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 # <<<<<<<<<<<<<< + * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 */ - __pyx_t_2 = __pyx_v_memslice->strides; - __pyx_v_strides = __pyx_t_2; + __pyx_t_34 = 7; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_34 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t2) * __pyx_v_t2) - 0.5); - /* "View.MemoryView":953 - * - * cdef int i, j - * for i in range(ndim / 2): # <<<<<<<<<<<<<< - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] + /* "newanalysis/helpers/miscellaneous.pyx":1266 + * selfcorr[6,shellstart,dt] += 1.5*t1*t1-0.5 + * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 # <<<<<<<<<<<<<< + * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 */ - __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_19 = 8; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_34 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t3) * __pyx_v_t3) - 0.5); - /* "View.MemoryView":954 - * cdef int i, j - * for i in range(ndim / 2): - * j = ndim - 1 - i # <<<<<<<<<<<<<< - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] + /* "newanalysis/helpers/miscellaneous.pyx":1267 + * selfcorr[7,shellstart,dt] += 1.5*t2*t2-0.5 + * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 # <<<<<<<<<<<<<< + * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 */ - __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + __pyx_t_34 = 9; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_34 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t4) * __pyx_v_t4) - 0.5); - /* "View.MemoryView":955 - * for i in range(ndim / 2): - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< - * shape[i], shape[j] = shape[j], shape[i] + /* "newanalysis/helpers/miscellaneous.pyx":1268 + * selfcorr[8,shellstart,dt] += 1.5*t3*t3-0.5 + * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 # <<<<<<<<<<<<<< + * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 * */ - __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); - __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); - (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; - (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + __pyx_t_19 = 10; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_34 = __pyx_v_dt; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_34 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t5) * __pyx_v_t5) - 0.5); - /* "View.MemoryView":956 - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1269 + * selfcorr[9,shellstart,dt] += 1.5*t4*t4-0.5 + * selfcorr[10,shellstart,dt] += 1.5*t5*t5-0.5 + * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 # <<<<<<<<<<<<<< * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * for i in range(nshells): */ - __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); - __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); - (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; - (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + __pyx_t_34 = 11; + __pyx_t_20 = __pyx_v_shellstart; + __pyx_t_19 = __pyx_v_dt; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_34 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_19 * __pyx_v_selfcorr.strides[2]) )) += (((1.5 * __pyx_v_t6) * __pyx_v_t6) - 0.5); - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") + /* "newanalysis/helpers/miscellaneous.pyx":1255 + * shell5 = ds5[mol,start+dt]-1 + * shelldt = min(shell1, shell2, shell3, shell4, shell5) + * if shellstart == shelldt: # <<<<<<<<<<<<<< + * selfctr[shellstart,dt] += 1 * */ - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0); - __pyx_t_7 = __pyx_t_8; - __pyx_L6_bool_binop_done:; - if (__pyx_t_7) { + } - /* "View.MemoryView":959 - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1225 + * shell5 = ds5[mol,start]-1 + * shellstart = min(shell1, shell2, shell3, shell4, shell5) + * if shellstart < nshells: # <<<<<<<<<<<<<< + * ctr[shellstart,dt] += 1 * - * return 1 */ - __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 959, __pyx_L1_error) + } + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") + /* "newanalysis/helpers/miscellaneous.pyx":1215 + * cdef long shell1, shell2, shell3, shell4, shell5 * + * for dt in prange(maxdt,nogil=True,schedule=dynamic): # loop over all delta t # <<<<<<<<<<<<<< + * for point in range(startingpoints): # loop over all possible interval start points + * for mol in range(nmol): # loop over molecules/entries */ - } + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } } - /* "View.MemoryView":961 - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") - * - * return 1 # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1271 + * selfcorr[11,shellstart,dt] += 1.5*t6*t6-0.5 * + * for i in range(nshells): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * if ctr[i,j] != 0: */ - __pyx_r = 1; - goto __pyx_L0; + __pyx_t_12 = __pyx_v_nshells; + __pyx_t_11 = __pyx_t_12; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":945 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim + /* "newanalysis/helpers/miscellaneous.pyx":1272 * + * for i in range(nshells): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * if ctr[i,j] != 0: + * for k in range(12): */ + __pyx_t_13 = __pyx_v_maxdt; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = 0; - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * + /* "newanalysis/helpers/miscellaneous.pyx":1273 + * for i in range(nshells): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] */ + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; + __pyx_t_27 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ))) != 0.0); + if (__pyx_t_27) { -/* Python wrapper */ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":979 - * - * def __dealloc__(self): - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< - * - * cdef convert_item_to_object(self, char *itemp): + /* "newanalysis/helpers/miscellaneous.pyx":1274 + * for j in range(maxdt): + * if ctr[i,j] != 0: + * for k in range(12): # <<<<<<<<<<<<<< + * corr[k,i,j] /= ctr[i,j] + * else: */ - __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); + for (__pyx_t_16 = 0; __pyx_t_16 < 12; __pyx_t_16+=1) { + __pyx_v_k = __pyx_t_16; - /* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * + /* "newanalysis/helpers/miscellaneous.pyx":1275 + * if ctr[i,j] != 0: + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] # <<<<<<<<<<<<<< + * else: + * print('tot too sparse') */ + __pyx_t_20 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[1]; + __pyx_t_34 = __pyx_v_k; + __pyx_t_35 = __pyx_v_i; + __pyx_t_36 = __pyx_v_j; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[0]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_corr.shape[1]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_corr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_34 * __pyx_v_corr.strides[0]) ) + __pyx_t_35 * __pyx_v_corr.strides[1]) ) + __pyx_t_36 * __pyx_v_corr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_20 * __pyx_v_ctr.strides[0]) ) + __pyx_t_19 * __pyx_v_ctr.strides[1]) ))); + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} + /* "newanalysis/helpers/miscellaneous.pyx":1273 + * for i in range(nshells): + * for j in range(maxdt): + * if ctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * corr[k,i,j] /= ctr[i,j] + */ + goto __pyx_L24; + } -/* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) + /* "newanalysis/helpers/miscellaneous.pyx":1277 + * corr[k,i,j] /= ctr[i,j] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if selfctr[i,j] != 0: + * for k in range(12): */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L24:; -static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); + /* "newanalysis/helpers/miscellaneous.pyx":1278 + * else: + * print('tot too sparse') + * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * selfcorr[k,i,j] /= selfctr[i,j] + */ + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[1]; + __pyx_t_27 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_19 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_20 * __pyx_v_selfctr.strides[1]) ))) != 0.0); + if (__pyx_t_27) { - /* "View.MemoryView":982 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1279 + * print('tot too sparse') + * if selfctr[i,j] != 0: + * for k in range(12): # <<<<<<<<<<<<<< + * selfcorr[k,i,j] /= selfctr[i,j] + * else: */ - __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0); - if (__pyx_t_1) { + for (__pyx_t_16 = 0; __pyx_t_16 < 12; __pyx_t_16+=1) { + __pyx_v_k = __pyx_t_16; - /* "View.MemoryView":983 - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) # <<<<<<<<<<<<<< - * else: - * return memoryview.convert_item_to_object(self, itemp) + /* "newanalysis/helpers/miscellaneous.pyx":1280 + * if selfctr[i,j] != 0: + * for k in range(12): + * selfcorr[k,i,j] /= selfctr[i,j] # <<<<<<<<<<<<<< + * else: + * print('self too sparse') */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_20 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfctr.shape[1]; + __pyx_t_36 = __pyx_v_k; + __pyx_t_35 = __pyx_v_i; + __pyx_t_34 = __pyx_v_j; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfcorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_36 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_35 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_34 * __pyx_v_selfcorr.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_20 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_19 * __pyx_v_selfctr.strides[1]) ))); + } - /* "View.MemoryView":982 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1278 + * else: + * print('tot too sparse') + * if selfctr[i,j] != 0: # <<<<<<<<<<<<<< + * for k in range(12): + * selfcorr[k,i,j] /= selfctr[i,j] */ - } + goto __pyx_L27; + } - /* "View.MemoryView":985 - * return self.to_object_func(itemp) - * else: - * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): + /* "newanalysis/helpers/miscellaneous.pyx":1282 + * selfcorr[k,i,j] /= selfctr[i,j] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< + * for i in range(nshells): + * for j in range(maxdt): */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 985, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L27:; + } } - /* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) + /* "newanalysis/helpers/miscellaneous.pyx":1283 + * else: + * print('self too sparse') + * for i in range(nshells): # <<<<<<<<<<<<<< + * for j in range(maxdt): + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] */ + __pyx_t_12 = __pyx_v_nshells; + __pyx_t_11 = __pyx_t_12; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_11; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + /* "newanalysis/helpers/miscellaneous.pyx":1284 + * print('self too sparse') + * for i in range(nshells): + * for j in range(maxdt): # <<<<<<<<<<<<<< + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] + * for k in range(12): */ + __pyx_t_13 = __pyx_v_maxdt; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; -static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); - - /* "View.MemoryView":988 - * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1285 + * for i in range(nshells): + * for j in range(maxdt): + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] # <<<<<<<<<<<<<< + * for k in range(12): + * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] */ - __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":989 - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< - * else: - * memoryview.assign_item_from_object(self, itemp, value) + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_ctr.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_ctr.shape[1]; + __pyx_t_34 = __pyx_v_i; + __pyx_t_35 = __pyx_v_j; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_selfctr.shape[0]; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_selfctr.shape[1]; + __pyx_t_36 = __pyx_v_i; + __pyx_t_37 = __pyx_v_j; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_crossctr.shape[0]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_crossctr.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crossctr.data + __pyx_t_36 * __pyx_v_crossctr.strides[0]) ) + __pyx_t_37 * __pyx_v_crossctr.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ctr.data + __pyx_t_19 * __pyx_v_ctr.strides[0]) ) + __pyx_t_20 * __pyx_v_ctr.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfctr.data + __pyx_t_34 * __pyx_v_selfctr.strides[0]) ) + __pyx_t_35 * __pyx_v_selfctr.strides[1]) )))); + + /* "newanalysis/helpers/miscellaneous.pyx":1286 + * for j in range(maxdt): + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] + * for k in range(12): # <<<<<<<<<<<<<< + * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] + * */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 989, __pyx_L1_error) + for (__pyx_t_16 = 0; __pyx_t_16 < 12; __pyx_t_16+=1) { + __pyx_v_k = __pyx_t_16; - /* "View.MemoryView":988 + /* "newanalysis/helpers/miscellaneous.pyx":1287 + * crossctr[i,j] = ctr[i,j] - selfctr[i,j] + * for k in range(12): + * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] # <<<<<<<<<<<<<< * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr */ - goto __pyx_L3; + __pyx_t_35 = __pyx_v_k; + __pyx_t_34 = __pyx_v_i; + __pyx_t_20 = __pyx_v_j; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_v_corr.shape[0]; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_corr.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_corr.shape[2]; + __pyx_t_19 = __pyx_v_k; + __pyx_t_37 = __pyx_v_i; + __pyx_t_36 = __pyx_v_j; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_selfcorr.shape[0]; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_v_selfcorr.shape[1]; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_v_selfcorr.shape[2]; + __pyx_t_38 = __pyx_v_k; + __pyx_t_39 = __pyx_v_i; + __pyx_t_40 = __pyx_v_j; + if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_v_crosscorr.shape[0]; + if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_v_crosscorr.shape[1]; + if (__pyx_t_40 < 0) __pyx_t_40 += __pyx_v_crosscorr.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_crosscorr.data + __pyx_t_38 * __pyx_v_crosscorr.strides[0]) ) + __pyx_t_39 * __pyx_v_crosscorr.strides[1]) ) + __pyx_t_40 * __pyx_v_crosscorr.strides[2]) )) = ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_corr.data + __pyx_t_35 * __pyx_v_corr.strides[0]) ) + __pyx_t_34 * __pyx_v_corr.strides[1]) ) + __pyx_t_20 * __pyx_v_corr.strides[2]) ))) - (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_selfcorr.data + __pyx_t_19 * __pyx_v_selfcorr.strides[0]) ) + __pyx_t_37 * __pyx_v_selfcorr.strides[1]) ) + __pyx_t_36 * __pyx_v_selfcorr.strides[2]) )))); + } + } } - /* "View.MemoryView":991 - * self.to_dtype_func(itemp, value) - * else: - * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1289 + * crosscorr[k,i,j] = corr[k,i,j] - selfcorr[k,i,j] * - * @property + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - /*else*/ { - __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 991, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L3:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_corr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_selfcorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_crosscorr, 3, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_ctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_selfctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_41 = __pyx_memoryview_fromslice(__pyx_v_crossctr, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_41); + __pyx_t_42 = PyTuple_New(6); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 1289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_42); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 0, __pyx_t_4)) __PYX_ERR(0, 1289, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 1, __pyx_t_5)) __PYX_ERR(0, 1289, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 2, __pyx_t_6)) __PYX_ERR(0, 1289, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 3, __pyx_t_7)) __PYX_ERR(0, 1289, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_8); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 4, __pyx_t_8)) __PYX_ERR(0, 1289, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_41); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 5, __pyx_t_41)) __PYX_ERR(0, 1289, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_41 = 0; + __pyx_r = __pyx_t_42; + __pyx_t_42 = 0; + goto __pyx_L0; - /* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) + /* "newanalysis/helpers/miscellaneous.pyx":1199 * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): + * cdef long nmol = len(rotTs) # number of molecules */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1); + __Pyx_XDECREF(__pyx_t_41); + __Pyx_XDECREF(__pyx_t_42); + __Pyx_AddTraceback("newanalysis.miscellaneous.rotationMatrixMultiShellCorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_selfcorr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_crosscorr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ctr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_selfctr, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_crossctr, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":994 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object +/* "newanalysis/helpers/miscellaneous.pyx":1291 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def collectiveDipolesCutoff(double [:,:] coor, double[:,:] dipoles, double[:] aufpunkt, double[:] dip_inside, double[:] dip_outside, double cutoff): + * #TODO documentation */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_65collectiveDipolesCutoff(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_65collectiveDipolesCutoff = {"collectiveDipolesCutoff", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_65collectiveDipolesCutoff, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_65collectiveDipolesCutoff(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dipoles = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip_inside = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip_outside = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_cutoff; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("collectiveDipolesCutoff (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1291, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_dipoles,&__pyx_n_s_aufpunkt,&__pyx_n_s_dip_inside,&__pyx_n_s_dip_outside,&__pyx_n_s_cutoff,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1291, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dipoles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1291, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, 1); __PYX_ERR(0, 1291, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1291, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, 2); __PYX_ERR(0, 1291, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_inside)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1291, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, 3); __PYX_ERR(0, 1291, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_outside)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1291, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, 4); __PYX_ERR(0, 1291, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cutoff)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1291, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, 5); __PYX_ERR(0, 1291, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "collectiveDipolesCutoff") < 0)) __PYX_ERR(0, 1291, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 6)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1292, __pyx_L3_error) + __pyx_v_dipoles = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dipoles.memview)) __PYX_ERR(0, 1292, __pyx_L3_error) + __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 1292, __pyx_L3_error) + __pyx_v_dip_inside = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_inside.memview)) __PYX_ERR(0, 1292, __pyx_L3_error) + __pyx_v_dip_outside = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_outside.memview)) __PYX_ERR(0, 1292, __pyx_L3_error) + __pyx_v_cutoff = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_cutoff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1292, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("collectiveDipolesCutoff", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 1291, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_inside, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_outside, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.collectiveDipolesCutoff", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_64collectiveDipolesCutoff(__pyx_self, __pyx_v_coor, __pyx_v_dipoles, __pyx_v_aufpunkt, __pyx_v_dip_inside, __pyx_v_dip_outside, __pyx_v_cutoff); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dipoles, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_inside, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_outside, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_64collectiveDipolesCutoff(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_dipoles, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_dip_inside, __Pyx_memviewslice __pyx_v_dip_outside, double __pyx_v_cutoff) { + int __pyx_v_particles; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_RefNannySetupContext("collectiveDipolesCutoff", 0); - /* "View.MemoryView":995 - * @property - * def base(self): - * return self.from_object # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1295 + * #TODO documentation + * + * cdef int particles = coor.shape[0] # <<<<<<<<<<<<<< + * separateCollectiveDipolesSpherically(&coor[0,0], &dipoles[0,0], particles, &aufpunkt[0], &dip_inside[0], &dip_outside[0], cutoff) * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->from_object); - __pyx_r = __pyx_v_self->from_object; - goto __pyx_L0; + __pyx_v_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":994 + /* "newanalysis/helpers/miscellaneous.pyx":1296 * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object + * cdef int particles = coor.shape[0] + * separateCollectiveDipolesSpherically(&coor[0,0], &dipoles[0,0], particles, &aufpunkt[0], &dip_inside[0], &dip_outside[0], cutoff) # <<<<<<<<<<<<<< + * + * #TODO: As a C++ function? + */ + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_dipoles.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dipoles.shape[1]; + __pyx_t_5 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_aufpunkt.shape[0]; + __pyx_t_6 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dip_inside.shape[0]; + __pyx_t_7 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_dip_outside.shape[0]; + separateCollectiveDipolesSpherically((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dipoles.data + __pyx_t_3 * __pyx_v_dipoles.strides[0]) ) + __pyx_t_4 * __pyx_v_dipoles.strides[1]) )))), __pyx_v_particles, (&(*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_5 * __pyx_v_aufpunkt.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_dip_inside.data + __pyx_t_6 * __pyx_v_dip_inside.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_dip_outside.data + __pyx_t_7 * __pyx_v_dip_outside.strides[0]) )))), __pyx_v_cutoff); + + /* "newanalysis/helpers/miscellaneous.pyx":1291 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def collectiveDipolesCutoff(double [:,:] coor, double[:,:] dipoles, double[:] aufpunkt, double[:] dip_inside, double[:] dip_outside, double cutoff): + * #TODO documentation */ /* function exit code */ - __pyx_L0:; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): +/* "newanalysis/helpers/miscellaneous.pyx":1299 + * + * #TODO: As a C++ function? + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def shellHistograms(double [:,:] histograms, double [:] aufpunkt, double [:,:] coors, char [:] ds, int maxshell, double max_distance, int segs_per_angstroem): + * #TODO documentation */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_67shellHistograms(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_67shellHistograms = {"shellHistograms", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_67shellHistograms, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_67shellHistograms(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_histograms = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_aufpunkt = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coors = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell; + double __pyx_v_max_distance; + int __pyx_v_segs_per_angstroem; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("shellHistograms (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1299, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_histograms,&__pyx_n_s_aufpunkt,&__pyx_n_s_coors,&__pyx_n_s_ds,&__pyx_n_s_maxshell,&__pyx_n_s_max_distance,&__pyx_n_s_segs_per_angstroem,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histograms)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1299, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1299, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 1); __PYX_ERR(0, 1299, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coors)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1299, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 2); __PYX_ERR(0, 1299, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1299, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 3); __PYX_ERR(0, 1299, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1299, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 4); __PYX_ERR(0, 1299, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_distance)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1299, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 5); __PYX_ERR(0, 1299, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_segs_per_angstroem)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1299, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, 6); __PYX_ERR(0, 1299, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "shellHistograms") < 0)) __PYX_ERR(0, 1299, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 7)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + } + __pyx_v_histograms = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histograms.memview)) __PYX_ERR(0, 1300, __pyx_L3_error) + __pyx_v_aufpunkt = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_aufpunkt.memview)) __PYX_ERR(0, 1300, __pyx_L3_error) + __pyx_v_coors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coors.memview)) __PYX_ERR(0, 1300, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1300, __pyx_L3_error) + __pyx_v_maxshell = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1300, __pyx_L3_error) + __pyx_v_max_distance = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_max_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1300, __pyx_L3_error) + __pyx_v_segs_per_angstroem = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_segs_per_angstroem == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1300, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("shellHistograms", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 1299, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histograms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.shellHistograms", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_66shellHistograms(__pyx_self, __pyx_v_histograms, __pyx_v_aufpunkt, __pyx_v_coors, __pyx_v_ds, __pyx_v_maxshell, __pyx_v_max_distance, __pyx_v_segs_per_angstroem); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histograms, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_aufpunkt, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coors, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_66shellHistograms(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_histograms, __Pyx_memviewslice __pyx_v_aufpunkt, __Pyx_memviewslice __pyx_v_coors, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, double __pyx_v_max_distance, int __pyx_v_segs_per_angstroem) { + int __pyx_v_i; + int __pyx_v_shell; + int __pyx_v_bin_dist; + int __pyx_v_particles; + double __pyx_v_distance; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + PyObject *__pyx_t_17 = NULL; + int __pyx_t_18; + double __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("shellHistograms", 0); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/miscellaneous.pyx":1304 + * + * #cdef int w, shell, i, nres_wat = dip_wat.shape[0] + * cdef int i, shell, bin_dist, particles = coors.shape[0] # <<<<<<<<<<<<<< + * cdef double distance + * */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_v_particles = (__pyx_v_coors.shape[0]); - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "newanalysis/helpers/miscellaneous.pyx":1307 + * cdef double distance + * + * for i in range(particles): # <<<<<<<<<<<<<< + * shell = ds[i] - 1 + * if shell < maxshell: */ + __pyx_t_1 = __pyx_v_particles; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":1308 + * + * for i in range(particles): + * shell = ds[i] - 1 # <<<<<<<<<<<<<< + * if shell < maxshell: + * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) + */ + __pyx_t_4 = __pyx_v_i; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds.shape[0]; + __pyx_v_shell = ((*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_4 * __pyx_v_ds.strides[0]) ))) - 1); -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/miscellaneous.pyx":1309 + * for i in range(particles): + * shell = ds[i] - 1 + * if shell < maxshell: # <<<<<<<<<<<<<< + * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) + * if distance < max_distance: */ + __pyx_t_5 = (__pyx_v_shell < __pyx_v_maxshell); + if (__pyx_t_5) { -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + /* "newanalysis/helpers/miscellaneous.pyx":1310 + * shell = ds[i] - 1 + * if shell < maxshell: + * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) # <<<<<<<<<<<<<< + * if distance < max_distance: + * bin_dist = int(distance * segs_per_angstroem) + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = __pyx_v_i; + __pyx_t_9 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coors.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coors.shape[1]; + __pyx_t_10 = 0; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_aufpunkt.shape[0]; + __pyx_t_11 = __pyx_v_i; + __pyx_t_12 = 1; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coors.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coors.shape[1]; + __pyx_t_13 = 1; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_aufpunkt.shape[0]; + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = 2; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coors.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coors.shape[1]; + __pyx_t_16 = 2; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_aufpunkt.shape[0]; + __pyx_t_7 = PyFloat_FromDouble(((pow(((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_4 * __pyx_v_coors.strides[0]) ) + __pyx_t_9 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_10 * __pyx_v_aufpunkt.strides[0]) )))), 2.0) + pow(((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_11 * __pyx_v_coors.strides[0]) ) + __pyx_t_12 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_13 * __pyx_v_aufpunkt.strides[0]) )))), 2.0)) + pow(((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coors.data + __pyx_t_14 * __pyx_v_coors.strides[0]) ) + __pyx_t_15 * __pyx_v_coors.strides[1]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_aufpunkt.data + __pyx_t_16 * __pyx_v_aufpunkt.strides[0]) )))), 2.0))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_17 = NULL; + __pyx_t_18 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_17)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_18 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_17, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_18, 1+__pyx_t_18); + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_19 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1310, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_distance = __pyx_t_19; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":1311 + * if shell < maxshell: + * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) + * if distance < max_distance: # <<<<<<<<<<<<<< + * bin_dist = int(distance * segs_per_angstroem) + * histograms[shell][bin_dist] += 1 + */ + __pyx_t_5 = (__pyx_v_distance < __pyx_v_max_distance); + if (__pyx_t_5) { -static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + /* "newanalysis/helpers/miscellaneous.pyx":1312 + * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) + * if distance < max_distance: + * bin_dist = int(distance * segs_per_angstroem) # <<<<<<<<<<<<<< + * histograms[shell][bin_dist] += 1 + * + */ + __pyx_v_bin_dist = ((int)(__pyx_v_distance * __pyx_v_segs_per_angstroem)); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1313 + * if distance < max_distance: + * bin_dist = int(distance * segs_per_angstroem) + * histograms[shell][bin_dist] += 1 # <<<<<<<<<<<<<< + * + * #TODO: As a C++ function? */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_16 = __pyx_v_shell; + __pyx_t_15 = __pyx_v_bin_dist; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_histograms.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_histograms.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histograms.data + __pyx_t_16 * __pyx_v_histograms.strides[0]) ) + __pyx_t_15 * __pyx_v_histograms.strides[1]) )) += 1.0; - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/miscellaneous.pyx":1311 + * if shell < maxshell: + * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) + * if distance < max_distance: # <<<<<<<<<<<<<< + * bin_dist = int(distance * segs_per_angstroem) + * histograms[shell][bin_dist] += 1 + */ + } + + /* "newanalysis/helpers/miscellaneous.pyx":1309 + * for i in range(particles): + * shell = ds[i] - 1 + * if shell < maxshell: # <<<<<<<<<<<<<< + * distance = np.sqrt(pow((coors[i][0] - aufpunkt[0]), 2) + pow((coors[i][1] - aufpunkt[1]), 2) + pow((coors[i][2] - aufpunkt[2]), 2)) + * if distance < max_distance: + */ + } + } + + /* "newanalysis/helpers/miscellaneous.pyx":1299 + * + * #TODO: As a C++ function? + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def shellHistograms(double [:,:] histograms, double [:] aufpunkt, double [:,:] coors, char [:] ds, int maxshell, double max_distance, int segs_per_angstroem): + * #TODO documentation */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_AddTraceback("newanalysis.miscellaneous.shellHistograms", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1001 +/* "newanalysis/helpers/miscellaneous.pyx":1344 * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleVector(double[:,:] timeseries, double[:] result, int order = 1): + * """ */ -static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_TypeInfo *__pyx_t_4; - Py_buffer __pyx_t_5; - Py_ssize_t *__pyx_t_6; - Py_ssize_t *__pyx_t_7; - Py_ssize_t *__pyx_t_8; - Py_ssize_t __pyx_t_9; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_69correlateSingleVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_68correlateSingleVector, "\n Correlate the timeseries of a single vector (e.g. collective dipole, one single particle, etc...)\n timeseries ... (number_of_frames, 3)\n result ... (number_of_frames)\n order ... Which order of Lagrangian Polynom (1-6 available)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_69correlateSingleVector = {"correlateSingleVector", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_69correlateSingleVector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_68correlateSingleVector}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_69correlateSingleVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_order; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - - /* "View.MemoryView":1009 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None - * - */ - __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1010 - * - * if memviewslice.memview == Py_None: - * return None # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "View.MemoryView":1009 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None - * - */ + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("correlateSingleVector (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1344, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_result,&__pyx_n_s_order,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1344, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1344, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateSingleVector", 0, 2, 3, 1); __PYX_ERR(0, 1344, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1344, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "correlateSingleVector") < 0)) __PYX_ERR(0, 1344, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1345, __pyx_L3_error) + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1345, __pyx_L3_error) + if (values[2]) { + __pyx_v_order = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1345, __pyx_L3_error) + } else { + __pyx_v_order = ((int)((int)1)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("correlateSingleVector", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 1344, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.correlateSingleVector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_68correlateSingleVector(__pyx_self, __pyx_v_timeseries, __pyx_v_result, __pyx_v_order); - /* "View.MemoryView":1015 - * - * - * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<< - * - * result.from_slice = memviewslice - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1017 - * result = _memoryviewslice(None, 0, dtype_is_object) - * - * result.from_slice = memviewslice # <<<<<<<<<<<<<< - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - */ - __pyx_v_result->from_slice = __pyx_v_memviewslice; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_68correlateSingleVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_result, int __pyx_v_order) { + int __pyx_v_number_of_frames; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + __Pyx_RefNannySetupContext("correlateSingleVector", 0); - /* "View.MemoryView":1018 - * - * result.from_slice = memviewslice - * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1353 + * """ + * + * cdef int number_of_frames = timeseries.shape[0] # <<<<<<<<<<<<<< + * correlateSingleVectorTS(×eries[0,0], &result[0], number_of_frames, order) * - * result.from_object = ( memviewslice.memview).base */ - __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[0]); - /* "View.MemoryView":1020 - * __PYX_INC_MEMVIEW(&memviewslice, 1) + /* "newanalysis/helpers/miscellaneous.pyx":1354 * - * result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<< - * result.typeinfo = memviewslice.memview.typeinfo + * cdef int number_of_frames = timeseries.shape[0] + * correlateSingleVectorTS(×eries[0,0], &result[0], number_of_frames, order) # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_result->from_object); - __Pyx_DECREF(__pyx_v_result->from_object); - __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_1 = 0; __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries.shape[1]; + __pyx_t_3 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_result.shape[0]; + correlateSingleVectorTS((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_3 * __pyx_v_result.strides[0]) )))), __pyx_v_number_of_frames, __pyx_v_order); - /* "View.MemoryView":1021 + /* "newanalysis/helpers/miscellaneous.pyx":1344 * - * result.from_object = ( memviewslice.memview).base - * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< * - * result.view = memviewslice.memview.view + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleVector(double[:,:] timeseries, double[:] result, int order = 1): + * """ */ - __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; - __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - /* "View.MemoryView":1023 - * result.typeinfo = memviewslice.memview.typeinfo - * - * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - */ - __pyx_t_5 = __pyx_v_memviewslice.memview->view; - __pyx_v_result->__pyx_base.view = __pyx_t_5; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1024 +/* "newanalysis/helpers/miscellaneous.pyx":1356 + * correlateSingleVectorTS(×eries[0,0], &result[0], number_of_frames, order) * - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossCorrelateSingleVector(double[:,:] timeseries1, double[:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): + * """ */ - __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - /* "View.MemoryView":1025 - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data - * result.view.ndim = ndim # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) - */ - __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_71crossCorrelateSingleVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_70crossCorrelateSingleVector, "\n Correlate the timeseries of two different single vectors (e.g. collective dipole, one single particle, etc...)\n ATTN: Both timeseries need to be equally long! #TODO: Aendern?\n\n timeseries1 ... (number_of_frames1, 3)\n timeseries2 ... (number_of_frames2, 3)\n result ... (number_of_frames)\n both_directions ... Do you want to cross-correlate both vectors, that is + yes/no.\n order ... Which order of Lagrangian Polynom (1-6 available)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_71crossCorrelateSingleVector = {"crossCorrelateSingleVector", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_71crossCorrelateSingleVector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_70crossCorrelateSingleVector}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_71crossCorrelateSingleVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_timeseries1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_timeseries2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_both_directions; + int __pyx_v_order; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("crossCorrelateSingleVector (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1356, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries1,&__pyx_n_s_timeseries2,&__pyx_n_s_result,&__pyx_n_s_both_directions,&__pyx_n_s_order,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1356, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1356, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("crossCorrelateSingleVector", 0, 3, 5, 1); __PYX_ERR(0, 1356, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1356, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("crossCorrelateSingleVector", 0, 3, 5, 2); __PYX_ERR(0, 1356, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_both_directions); + if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1356, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1356, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "crossCorrelateSingleVector") < 0)) __PYX_ERR(0, 1356, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_timeseries1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries1.memview)) __PYX_ERR(0, 1357, __pyx_L3_error) + __pyx_v_timeseries2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries2.memview)) __PYX_ERR(0, 1357, __pyx_L3_error) + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1357, __pyx_L3_error) + if (values[3]) { + __pyx_v_both_directions = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_both_directions == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1357, __pyx_L3_error) + } else { + __pyx_v_both_directions = ((int)((int)1)); + } + if (values[4]) { + __pyx_v_order = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1357, __pyx_L3_error) + } else { + __pyx_v_order = ((int)((int)1)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("crossCorrelateSingleVector", 0, 3, 5, __pyx_nargs); __PYX_ERR(0, 1356, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.crossCorrelateSingleVector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_70crossCorrelateSingleVector(__pyx_self, __pyx_v_timeseries1, __pyx_v_timeseries2, __pyx_v_result, __pyx_v_both_directions, __pyx_v_order); - /* "View.MemoryView":1026 - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_70crossCorrelateSingleVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries1, __Pyx_memviewslice __pyx_v_timeseries2, __Pyx_memviewslice __pyx_v_result, int __pyx_v_both_directions, int __pyx_v_order) { + int __pyx_v_number_of_frames1; + int __pyx_v_number_of_frames2; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + __Pyx_RefNannySetupContext("crossCorrelateSingleVector", 0); + + /* "newanalysis/helpers/miscellaneous.pyx":1369 + * """ * + * cdef int number_of_frames1 = timeseries1.shape[0] # <<<<<<<<<<<<<< + * cdef int number_of_frames2 = timeseries2.shape[0] + * crossCorrelateSingleVectorTS(×eries1[0,0], ×eries2[0,0], &result[0], number_of_frames1, number_of_frames2, both_directions, order) */ - ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + __pyx_v_number_of_frames1 = (__pyx_v_timeseries1.shape[0]); - /* "View.MemoryView":1027 - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1370 + * + * cdef int number_of_frames1 = timeseries1.shape[0] + * cdef int number_of_frames2 = timeseries2.shape[0] # <<<<<<<<<<<<<< + * crossCorrelateSingleVectorTS(×eries1[0,0], ×eries2[0,0], &result[0], number_of_frames1, number_of_frames2, both_directions, order) * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: */ - Py_INCREF(Py_None); + __pyx_v_number_of_frames2 = (__pyx_v_timeseries2.shape[0]); - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) + /* "newanalysis/helpers/miscellaneous.pyx":1371 + * cdef int number_of_frames1 = timeseries1.shape[0] + * cdef int number_of_frames2 = timeseries2.shape[0] + * crossCorrelateSingleVectorTS(×eries1[0,0], ×eries2[0,0], &result[0], number_of_frames1, number_of_frames2, both_directions, order) # <<<<<<<<<<<<<< * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: + * @cython.boundscheck(False) */ - __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_1) { + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries1.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries1.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_timeseries2.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_timeseries2.shape[1]; + __pyx_t_5 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_result.shape[0]; + crossCorrelateSingleVectorTS((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries1.data + __pyx_t_1 * __pyx_v_timeseries1.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries1.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries2.data + __pyx_t_3 * __pyx_v_timeseries2.strides[0]) ) + __pyx_t_4 * __pyx_v_timeseries2.strides[1]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_5 * __pyx_v_result.strides[0]) )))), __pyx_v_number_of_frames1, __pyx_v_number_of_frames2, __pyx_v_both_directions, __pyx_v_order); - /* "View.MemoryView":1030 + /* "newanalysis/helpers/miscellaneous.pyx":1356 + * correlateSingleVectorTS(×eries[0,0], &result[0], number_of_frames, order) * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: - * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< - * else: - * result.flags = PyBUF_RECORDS_RO + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossCorrelateSingleVector(double[:,:] timeseries1, double[:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): + * """ */ - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/miscellaneous.pyx":1373 + * crossCorrelateSingleVectorTS(×eries1[0,0], ×eries2[0,0], &result[0], number_of_frames1, number_of_frames2, both_directions, order) * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateMultiVector(double[:,:,:] timeseries, double[:] result, int order = 1): + * """ */ - goto __pyx_L4; + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_73correlateMultiVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_72correlateMultiVector, "\n Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...)\n timeseries ... (number_of_particles, number_of_frames, 3)\n result ... (number_of_frames)\n order ... Which order of Lagrangian Polynom (1-6 available)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_73correlateMultiVector = {"correlateMultiVector", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_73correlateMultiVector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_72correlateMultiVector}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_73correlateMultiVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_order; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("correlateMultiVector (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1373, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_result,&__pyx_n_s_order,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1373, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1373, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateMultiVector", 0, 2, 3, 1); __PYX_ERR(0, 1373, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1373, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "correlateMultiVector") < 0)) __PYX_ERR(0, 1373, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1374, __pyx_L3_error) + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1374, __pyx_L3_error) + if (values[2]) { + __pyx_v_order = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1374, __pyx_L3_error) + } else { + __pyx_v_order = ((int)((int)1)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("correlateMultiVector", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 1373, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.correlateMultiVector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_72correlateMultiVector(__pyx_self, __pyx_v_timeseries, __pyx_v_result, __pyx_v_order); - /* "View.MemoryView":1032 - * result.flags = PyBUF_RECORDS - * else: - * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< - * - * result.view.shape = result.from_slice.shape - */ - /*else*/ { - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_L4:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1034 - * result.flags = PyBUF_RECORDS_RO - * - * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< - * result.view.strides = result.from_slice.strides - * - */ - __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_72correlateMultiVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_result, int __pyx_v_order) { + int __pyx_v_number_of_particles; + int __pyx_v_number_of_frames; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + __Pyx_RefNannySetupContext("correlateMultiVector", 0); - /* "View.MemoryView":1035 - * - * result.view.shape = result.from_slice.shape - * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1382 + * """ * + * cdef int number_of_particles = timeseries.shape[0] # <<<<<<<<<<<<<< + * cdef int number_of_frames = timeseries.shape[1] + * correlateMultiVectorTS(×eries[0,0,0], &result[0], number_of_particles, number_of_frames, order) */ - __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + __pyx_v_number_of_particles = (__pyx_v_timeseries.shape[0]); - /* "View.MemoryView":1038 + /* "newanalysis/helpers/miscellaneous.pyx":1383 * + * cdef int number_of_particles = timeseries.shape[0] + * cdef int number_of_frames = timeseries.shape[1] # <<<<<<<<<<<<<< + * correlateMultiVectorTS(×eries[0,0,0], &result[0], number_of_particles, number_of_frames, order) * - * result.view.suboffsets = NULL # <<<<<<<<<<<<<< - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: */ - __pyx_v_result->__pyx_base.view.suboffsets = NULL; + __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[1]); - /* "View.MemoryView":1039 + /* "newanalysis/helpers/miscellaneous.pyx":1384 + * cdef int number_of_particles = timeseries.shape[0] + * cdef int number_of_frames = timeseries.shape[1] + * correlateMultiVectorTS(×eries[0,0,0], &result[0], number_of_particles, number_of_frames, order) # <<<<<<<<<<<<<< * - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - */ - __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_v_suboffset = (__pyx_t_6[0]); - - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break + * @cython.boundscheck(False) */ - __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_1) { + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_timeseries.shape[2]; + __pyx_t_4 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_result.shape[0]; + correlateMultiVectorTS((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_3 * __pyx_v_timeseries.strides[2]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_4 * __pyx_v_result.strides[0]) )))), __pyx_v_number_of_particles, __pyx_v_number_of_frames, __pyx_v_order); - /* "View.MemoryView":1041 - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< - * break + /* "newanalysis/helpers/miscellaneous.pyx":1373 + * crossCorrelateSingleVectorTS(×eries1[0,0], ×eries2[0,0], &result[0], number_of_frames1, number_of_frames2, both_directions, order) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateMultiVector(double[:,:,:] timeseries, double[:] result, int order = 1): + * """ */ - __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - /* "View.MemoryView":1042 - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - * break # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/miscellaneous.pyx":1386 + * correlateMultiVectorTS(×eries[0,0,0], &result[0], number_of_particles, number_of_frames, order) * - * result.view.len = result.view.itemsize + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateMultiVectorShellwise(double [:,:,:] timeseries, double [:,:] dataset, double [:,:] result, int maxshell, int order = 1): + * """ */ - goto __pyx_L6_break; - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break - */ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_75correlateMultiVectorShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_74correlateMultiVectorShellwise, "\n timeseries ... (number_of_particles, number_of_frames, 3)\n dataset ... (number_of_frames, number_of_particles)\n result ... (number_of_shells, number_of_frames)\n order ... Which order of Lagrangian Polynom (1-6 available) \n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_75correlateMultiVectorShellwise = {"correlateMultiVectorShellwise", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_75correlateMultiVectorShellwise, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_74correlateMultiVectorShellwise}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_75correlateMultiVectorShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell; + int __pyx_v_order; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("correlateMultiVectorShellwise (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1386, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_dataset,&__pyx_n_s_result,&__pyx_n_s_maxshell,&__pyx_n_s_order,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1386, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1386, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateMultiVectorShellwise", 0, 4, 5, 1); __PYX_ERR(0, 1386, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1386, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateMultiVectorShellwise", 0, 4, 5, 2); __PYX_ERR(0, 1386, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1386, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateMultiVectorShellwise", 0, 4, 5, 3); __PYX_ERR(0, 1386, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1386, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "correlateMultiVectorShellwise") < 0)) __PYX_ERR(0, 1386, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1387, __pyx_L3_error) + __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 1387, __pyx_L3_error) + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1387, __pyx_L3_error) + __pyx_v_maxshell = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1387, __pyx_L3_error) + if (values[4]) { + __pyx_v_order = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1387, __pyx_L3_error) + } else { + __pyx_v_order = ((int)((int)1)); } } - __pyx_L6_break:; - - /* "View.MemoryView":1044 - * break - * - * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< - * for length in result.view.shape[:ndim]: - * result.view.len *= length - */ - __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - - /* "View.MemoryView":1045 - * - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< - * result.view.len *= length - * - */ - __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1045, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":1046 - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: - * result.view.len *= length # <<<<<<<<<<<<<< - * - * result.to_object_func = to_object_func - */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("correlateMultiVectorShellwise", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 1386, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.correlateMultiVectorShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_74correlateMultiVectorShellwise(__pyx_self, __pyx_v_timeseries, __pyx_v_dataset, __pyx_v_result, __pyx_v_maxshell, __pyx_v_order); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1048 - * result.view.len *= length - * - * result.to_object_func = to_object_func # <<<<<<<<<<<<<< - * result.to_dtype_func = to_dtype_func +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_74correlateMultiVectorShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_dataset, __Pyx_memviewslice __pyx_v_result, int __pyx_v_maxshell, int __pyx_v_order) { + int __pyx_v_number_of_particles; + int __pyx_v_number_of_frames; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_RefNannySetupContext("correlateMultiVectorShellwise", 0); + + /* "newanalysis/helpers/miscellaneous.pyx":1395 + * """ * + * cdef int number_of_particles = timeseries.shape[0] # <<<<<<<<<<<<<< + * cdef int number_of_frames = timeseries.shape[1] + * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) */ - __pyx_v_result->to_object_func = __pyx_v_to_object_func; + __pyx_v_number_of_particles = (__pyx_v_timeseries.shape[0]); - /* "View.MemoryView":1049 + /* "newanalysis/helpers/miscellaneous.pyx":1396 * - * result.to_object_func = to_object_func - * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * cdef int number_of_particles = timeseries.shape[0] + * cdef int number_of_frames = timeseries.shape[1] # <<<<<<<<<<<<<< + * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) * - * return result */ - __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[1]); - /* "View.MemoryView":1051 - * result.to_dtype_func = to_dtype_func - * - * return result # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1397 + * cdef int number_of_particles = timeseries.shape[0] + * cdef int number_of_frames = timeseries.shape[1] + * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_get_slice_from_memoryview') + * def correlateMultiVectorVennShellwise(double [:,:,:] timeseries, double [:,:] dataset1, double [:,:] dataset2, double [:,:,:] result, int maxshell1, int maxshell2, int order = 1): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_timeseries.shape[2]; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dataset.shape[0]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dataset.shape[1]; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_result.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_result.shape[1]; + correlateMultiVectorShellwiseTS((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_3 * __pyx_v_timeseries.strides[2]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_4 * __pyx_v_dataset.strides[0]) ) + __pyx_t_5 * __pyx_v_dataset.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_6 * __pyx_v_result.strides[0]) ) + __pyx_t_7 * __pyx_v_result.strides[1]) )))), __pyx_v_number_of_particles, __pyx_v_number_of_frames, __pyx_v_maxshell, __pyx_v_order); - /* "View.MemoryView":1001 + /* "newanalysis/helpers/miscellaneous.pyx":1386 + * correlateMultiVectorTS(×eries[0,0,0], &result[0], number_of_particles, number_of_frames, order) * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateMultiVectorShellwise(double [:,:,:] timeseries, double [:,:] dataset, double [:,:] result, int maxshell, int order = 1): + * """ */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1054 +/* "newanalysis/helpers/miscellaneous.pyx":1399 + * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj + * def correlateMultiVectorVennShellwise(double [:,:,:] timeseries, double [:,:] dataset1, double [:,:] dataset2, double [:,:,:] result, int maxshell1, int maxshell2, int order = 1): # <<<<<<<<<<<<<< + * """ + * timeseries ... (number_of_particles, number_of_frames, 3) */ -static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { - struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; - __Pyx_memviewslice *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_77correlateMultiVectorVennShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_76correlateMultiVectorVennShellwise, "\n timeseries ... (number_of_particles, number_of_frames, 3)\n dataset1 ... (number_of_frames, number_of_particles)\n dataset2 ... (number_of_frames, number_of_particles)\n result ... (number_of_shells1, number_of_shells2, number_of_frames)\n order ... Which order of Lagrangian Polynom (1-6 available) \n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_77correlateMultiVectorVennShellwise = {"correlateMultiVectorVennShellwise", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_77correlateMultiVectorVennShellwise, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_76correlateMultiVectorVennShellwise}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_77correlateMultiVectorVennShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell1; + int __pyx_v_maxshell2; + int __pyx_v_order; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("correlateMultiVectorVennShellwise (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1399, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_dataset1,&__pyx_n_s_dataset2,&__pyx_n_s_result,&__pyx_n_s_maxshell1,&__pyx_n_s_maxshell2,&__pyx_n_s_order,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, 1); __PYX_ERR(0, 1399, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, 2); __PYX_ERR(0, 1399, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, 3); __PYX_ERR(0, 1399, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, 4); __PYX_ERR(0, 1399, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, 5); __PYX_ERR(0, 1399, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order); + if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "correlateMultiVectorVennShellwise") < 0)) __PYX_ERR(0, 1399, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1399, __pyx_L3_error) + __pyx_v_dataset1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset1.memview)) __PYX_ERR(0, 1399, __pyx_L3_error) + __pyx_v_dataset2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset2.memview)) __PYX_ERR(0, 1399, __pyx_L3_error) + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1399, __pyx_L3_error) + __pyx_v_maxshell1 = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) + __pyx_v_maxshell2 = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_maxshell2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) + if (values[6]) { + __pyx_v_order = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1399, __pyx_L3_error) + } else { + __pyx_v_order = ((int)((int)1)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("correlateMultiVectorVennShellwise", 0, 6, 7, __pyx_nargs); __PYX_ERR(0, 1399, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.correlateMultiVectorVennShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_76correlateMultiVectorVennShellwise(__pyx_self, __pyx_v_timeseries, __pyx_v_dataset1, __pyx_v_dataset2, __pyx_v_result, __pyx_v_maxshell1, __pyx_v_maxshell2, __pyx_v_order); - /* "View.MemoryView":1058 - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): - * obj = memview # <<<<<<<<<<<<<< - * return &obj.from_slice - * else: - */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1058, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1059 - * if isinstance(memview, _memoryviewslice): - * obj = memview - * return &obj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, mslice) - */ - __pyx_r = (&__pyx_v_obj->from_slice); - goto __pyx_L0; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_76correlateMultiVectorVennShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_dataset1, __Pyx_memviewslice __pyx_v_dataset2, __Pyx_memviewslice __pyx_v_result, int __pyx_v_maxshell1, int __pyx_v_maxshell2, int __pyx_v_order) { + int __pyx_v_number_of_particles; + int __pyx_v_number_of_frames; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("correlateMultiVectorVennShellwise", 0); - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "newanalysis/helpers/miscellaneous.pyx":1408 + * """ + * + * cdef int number_of_particles = timeseries.shape[0] # <<<<<<<<<<<<<< + * cdef int number_of_frames = timeseries.shape[1] + * correlateMultiVectorVennShellwiseTS(×eries[0,0,0], &dataset1[0,0], &dataset2[0,0], &result[0,0,0], number_of_particles, number_of_frames, maxshell1, maxshell2, order) */ - } + __pyx_v_number_of_particles = (__pyx_v_timeseries.shape[0]); - /* "View.MemoryView":1061 - * return &obj.from_slice - * else: - * slice_copy(memview, mslice) # <<<<<<<<<<<<<< - * return mslice + /* "newanalysis/helpers/miscellaneous.pyx":1409 + * + * cdef int number_of_particles = timeseries.shape[0] + * cdef int number_of_frames = timeseries.shape[1] # <<<<<<<<<<<<<< + * correlateMultiVectorVennShellwiseTS(×eries[0,0,0], &dataset1[0,0], &dataset2[0,0], &result[0,0,0], number_of_particles, number_of_frames, maxshell1, maxshell2, order) * */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[1]); - /* "View.MemoryView":1062 - * else: - * slice_copy(memview, mslice) - * return mslice # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1410 + * cdef int number_of_particles = timeseries.shape[0] + * cdef int number_of_frames = timeseries.shape[1] + * correlateMultiVectorVennShellwiseTS(×eries[0,0,0], &dataset1[0,0], &dataset2[0,0], &result[0,0,0], number_of_particles, number_of_frames, maxshell1, maxshell2, order) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_slice_copy') + * @cython.boundscheck(False) */ - __pyx_r = __pyx_v_mslice; - goto __pyx_L0; + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = -1; + if (__pyx_t_1 < 0) { + __pyx_t_1 += __pyx_v_timeseries.shape[0]; + if (unlikely(__pyx_t_1 < 0)) __pyx_t_4 = 0; + } else if (unlikely(__pyx_t_1 >= __pyx_v_timeseries.shape[0])) __pyx_t_4 = 0; + if (__pyx_t_2 < 0) { + __pyx_t_2 += __pyx_v_timeseries.shape[1]; + if (unlikely(__pyx_t_2 < 0)) __pyx_t_4 = 1; + } else if (unlikely(__pyx_t_2 >= __pyx_v_timeseries.shape[1])) __pyx_t_4 = 1; + if (__pyx_t_3 < 0) { + __pyx_t_3 += __pyx_v_timeseries.shape[2]; + if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 2; + } else if (unlikely(__pyx_t_3 >= __pyx_v_timeseries.shape[2])) __pyx_t_4 = 2; + if (unlikely(__pyx_t_4 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_4); + __PYX_ERR(0, 1410, __pyx_L1_error) + } + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_4 = -1; + if (__pyx_t_5 < 0) { + __pyx_t_5 += __pyx_v_dataset1.shape[0]; + if (unlikely(__pyx_t_5 < 0)) __pyx_t_4 = 0; + } else if (unlikely(__pyx_t_5 >= __pyx_v_dataset1.shape[0])) __pyx_t_4 = 0; + if (__pyx_t_6 < 0) { + __pyx_t_6 += __pyx_v_dataset1.shape[1]; + if (unlikely(__pyx_t_6 < 0)) __pyx_t_4 = 1; + } else if (unlikely(__pyx_t_6 >= __pyx_v_dataset1.shape[1])) __pyx_t_4 = 1; + if (unlikely(__pyx_t_4 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_4); + __PYX_ERR(0, 1410, __pyx_L1_error) + } + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_4 = -1; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_v_dataset2.shape[0]; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_4 = 0; + } else if (unlikely(__pyx_t_7 >= __pyx_v_dataset2.shape[0])) __pyx_t_4 = 0; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_dataset2.shape[1]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_4 = 1; + } else if (unlikely(__pyx_t_8 >= __pyx_v_dataset2.shape[1])) __pyx_t_4 = 1; + if (unlikely(__pyx_t_4 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_4); + __PYX_ERR(0, 1410, __pyx_L1_error) + } + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + __pyx_t_4 = -1; + if (__pyx_t_9 < 0) { + __pyx_t_9 += __pyx_v_result.shape[0]; + if (unlikely(__pyx_t_9 < 0)) __pyx_t_4 = 0; + } else if (unlikely(__pyx_t_9 >= __pyx_v_result.shape[0])) __pyx_t_4 = 0; + if (__pyx_t_10 < 0) { + __pyx_t_10 += __pyx_v_result.shape[1]; + if (unlikely(__pyx_t_10 < 0)) __pyx_t_4 = 1; + } else if (unlikely(__pyx_t_10 >= __pyx_v_result.shape[1])) __pyx_t_4 = 1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_v_result.shape[2]; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_4 = 2; + } else if (unlikely(__pyx_t_11 >= __pyx_v_result.shape[2])) __pyx_t_4 = 2; + if (unlikely(__pyx_t_4 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_4); + __PYX_ERR(0, 1410, __pyx_L1_error) } + correlateMultiVectorVennShellwiseTS((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_3 * __pyx_v_timeseries.strides[2]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset1.data + __pyx_t_5 * __pyx_v_dataset1.strides[0]) ) + __pyx_t_6 * __pyx_v_dataset1.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset2.data + __pyx_t_7 * __pyx_v_dataset2.strides[0]) ) + __pyx_t_8 * __pyx_v_dataset2.strides[1]) )))), (&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_9 * __pyx_v_result.strides[0]) ) + __pyx_t_10 * __pyx_v_result.strides[1]) ) + __pyx_t_11 * __pyx_v_result.strides[2]) )))), __pyx_v_number_of_particles, __pyx_v_number_of_frames, __pyx_v_maxshell1, __pyx_v_maxshell2, __pyx_v_order); - /* "View.MemoryView":1054 + /* "newanalysis/helpers/miscellaneous.pyx":1399 + * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj + * def correlateMultiVectorVennShellwise(double [:,:,:] timeseries, double [:,:] dataset1, double [:,:] dataset2, double [:,:,:] result, int maxshell1, int maxshell2, int order = 1): # <<<<<<<<<<<<<< + * """ + * timeseries ... (number_of_particles, number_of_frames, 3) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("newanalysis.miscellaneous.correlateMultiVectorVennShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1065 +/* "newanalysis/helpers/miscellaneous.pyx":1412 + * correlateMultiVectorVennShellwiseTS(×eries[0,0,0], &dataset1[0,0], &dataset2[0,0], &result[0,0,0], number_of_particles, number_of_frames, maxshell1, maxshell2, order) * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossCorrelateMultiVector(double[:,:,:] timeseries1, double[:,:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): + * """ */ -static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { - int __pyx_v_dim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - Py_ssize_t *__pyx_v_suboffsets; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_79crossCorrelateMultiVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_78crossCorrelateMultiVector, "\n Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...)\n ATTN: Both timeseries need to be equally long and contain the equal amount of particles! #TODO: Aendern?\n\n timeseries1 ... (number_of_particles, number_of_frames, 3)\n timeseries2 ... (number_of_particles, number_of_frames, 3)\n result ... (number_of_frames)\n both_directions ... Do you want to cross-correlate both vectors, that is + yes/no.\n order ... Which order of Lagrangian Polynom (1-6 available)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_79crossCorrelateMultiVector = {"crossCorrelateMultiVector", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_79crossCorrelateMultiVector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_78crossCorrelateMultiVector}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_79crossCorrelateMultiVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_timeseries1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_timeseries2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_both_directions; + int __pyx_v_order; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("slice_copy", 0); - - /* "View.MemoryView":1069 - * cdef (Py_ssize_t*) shape, strides, suboffsets - * - * shape = memview.view.shape # <<<<<<<<<<<<<< - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets - */ - __pyx_t_1 = __pyx_v_memview->view.shape; - __pyx_v_shape = __pyx_t_1; + __Pyx_RefNannySetupContext("crossCorrelateMultiVector (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1412, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries1,&__pyx_n_s_timeseries2,&__pyx_n_s_result,&__pyx_n_s_both_directions,&__pyx_n_s_order,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1412, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1412, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("crossCorrelateMultiVector", 0, 3, 5, 1); __PYX_ERR(0, 1412, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1412, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("crossCorrelateMultiVector", 0, 3, 5, 2); __PYX_ERR(0, 1412, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_both_directions); + if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1412, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order); + if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1412, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "crossCorrelateMultiVector") < 0)) __PYX_ERR(0, 1412, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_timeseries1 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries1.memview)) __PYX_ERR(0, 1413, __pyx_L3_error) + __pyx_v_timeseries2 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries2.memview)) __PYX_ERR(0, 1413, __pyx_L3_error) + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1413, __pyx_L3_error) + if (values[3]) { + __pyx_v_both_directions = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_both_directions == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1413, __pyx_L3_error) + } else { + __pyx_v_both_directions = ((int)((int)1)); + } + if (values[4]) { + __pyx_v_order = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1413, __pyx_L3_error) + } else { + __pyx_v_order = ((int)((int)1)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("crossCorrelateMultiVector", 0, 3, 5, __pyx_nargs); __PYX_ERR(0, 1412, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.crossCorrelateMultiVector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_78crossCorrelateMultiVector(__pyx_self, __pyx_v_timeseries1, __pyx_v_timeseries2, __pyx_v_result, __pyx_v_both_directions, __pyx_v_order); - /* "View.MemoryView":1070 - * - * shape = memview.view.shape - * strides = memview.view.strides # <<<<<<<<<<<<<< - * suboffsets = memview.view.suboffsets - * - */ - __pyx_t_1 = __pyx_v_memview->view.strides; - __pyx_v_strides = __pyx_t_1; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1071 - * shape = memview.view.shape - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< - * - * dst.memview = <__pyx_memoryview *> memview - */ - __pyx_t_1 = __pyx_v_memview->view.suboffsets; - __pyx_v_suboffsets = __pyx_t_1; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_78crossCorrelateMultiVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries1, __Pyx_memviewslice __pyx_v_timeseries2, __Pyx_memviewslice __pyx_v_result, int __pyx_v_both_directions, int __pyx_v_order) { + int __pyx_v_number_of_particles; + int __pyx_v_number_of_frames1; + int __pyx_v_number_of_frames2; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_RefNannySetupContext("crossCorrelateMultiVector", 0); - /* "View.MemoryView":1073 - * suboffsets = memview.view.suboffsets - * - * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< - * dst.data = memview.view.buf + /* "newanalysis/helpers/miscellaneous.pyx":1425 + * """ * + * cdef int number_of_particles = timeseries1.shape[0] # <<<<<<<<<<<<<< + * cdef int number_of_frames1 = timeseries1.shape[1] + * cdef int number_of_frames2 = timeseries2.shape[1] */ - __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + __pyx_v_number_of_particles = (__pyx_v_timeseries1.shape[0]); - /* "View.MemoryView":1074 + /* "newanalysis/helpers/miscellaneous.pyx":1426 * - * dst.memview = <__pyx_memoryview *> memview - * dst.data = memview.view.buf # <<<<<<<<<<<<<< - * - * for dim in range(memview.view.ndim): + * cdef int number_of_particles = timeseries1.shape[0] + * cdef int number_of_frames1 = timeseries1.shape[1] # <<<<<<<<<<<<<< + * cdef int number_of_frames2 = timeseries2.shape[1] + * crossCorrelateMultiVectorTS(×eries1[0,0,0], ×eries2[0,0,0], &result[0], number_of_particles, number_of_frames1, number_of_frames2, both_directions, order) */ - __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + __pyx_v_number_of_frames1 = (__pyx_v_timeseries1.shape[1]); - /* "View.MemoryView":1076 - * dst.data = memview.view.buf + /* "newanalysis/helpers/miscellaneous.pyx":1427 + * cdef int number_of_particles = timeseries1.shape[0] + * cdef int number_of_frames1 = timeseries1.shape[1] + * cdef int number_of_frames2 = timeseries2.shape[1] # <<<<<<<<<<<<<< + * crossCorrelateMultiVectorTS(×eries1[0,0,0], ×eries2[0,0,0], &result[0], number_of_particles, number_of_frames1, number_of_frames2, both_directions, order) * - * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] */ - __pyx_t_2 = __pyx_v_memview->view.ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_dim = __pyx_t_4; + __pyx_v_number_of_frames2 = (__pyx_v_timeseries2.shape[1]); - /* "View.MemoryView":1077 + /* "newanalysis/helpers/miscellaneous.pyx":1428 + * cdef int number_of_frames1 = timeseries1.shape[1] + * cdef int number_of_frames2 = timeseries2.shape[1] + * crossCorrelateMultiVectorTS(×eries1[0,0,0], ×eries2[0,0,0], &result[0], number_of_particles, number_of_frames1, number_of_frames2, both_directions, order) # <<<<<<<<<<<<<< * - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * @cython.boundscheck(False) */ - (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries1.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries1.shape[1]; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_timeseries1.shape[2]; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_timeseries2.shape[0]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_timeseries2.shape[1]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_timeseries2.shape[2]; + __pyx_t_7 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_result.shape[0]; + crossCorrelateMultiVectorTS((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries1.data + __pyx_t_1 * __pyx_v_timeseries1.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries1.strides[1]) ) + __pyx_t_3 * __pyx_v_timeseries1.strides[2]) )))), (&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries2.data + __pyx_t_4 * __pyx_v_timeseries2.strides[0]) ) + __pyx_t_5 * __pyx_v_timeseries2.strides[1]) ) + __pyx_t_6 * __pyx_v_timeseries2.strides[2]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_7 * __pyx_v_result.strides[0]) )))), __pyx_v_number_of_particles, __pyx_v_number_of_frames1, __pyx_v_number_of_frames2, __pyx_v_both_directions, __pyx_v_order); - /* "View.MemoryView":1078 - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + /* "newanalysis/helpers/miscellaneous.pyx":1412 + * correlateMultiVectorVennShellwiseTS(×eries[0,0,0], &dataset1[0,0], &dataset2[0,0], &result[0,0,0], number_of_particles, number_of_frames, maxshell1, maxshell2, order) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossCorrelateMultiVector(double[:,:,:] timeseries1, double[:,:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): + * """ */ - (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); - /* "View.MemoryView":1079 - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/miscellaneous.pyx":1430 + * crossCorrelateMultiVectorTS(×eries1[0,0,0], ×eries2[0,0,0], &result[0], number_of_particles, number_of_frames1, number_of_frames2, both_directions, order) * - * @cname('__pyx_memoryview_copy_object') + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleParticleMuShellwise(double[:,:,:] timeseries, double[:,:] result, int[:,:] dataset, int number_of_startingpoints): + * """ */ - if ((__pyx_v_suboffsets != 0)) { - __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_81correlateSingleParticleMuShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_80correlateSingleParticleMuShellwise, "\n timeseries... (N_particle, number_of_frames, mu)\n result ... (N_shell, correlation_length)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_81correlateSingleParticleMuShellwise = {"correlateSingleParticleMuShellwise", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_81correlateSingleParticleMuShellwise, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_80correlateSingleParticleMuShellwise}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_81correlateSingleParticleMuShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_number_of_startingpoints; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("correlateSingleParticleMuShellwise (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1430, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_result,&__pyx_n_s_dataset,&__pyx_n_s_number_of_startingpoints,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1430, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1430, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuShellwise", 1, 4, 4, 1); __PYX_ERR(0, 1430, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1430, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuShellwise", 1, 4, 4, 2); __PYX_ERR(0, 1430, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_number_of_startingpoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1430, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuShellwise", 1, 4, 4, 3); __PYX_ERR(0, 1430, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "correlateSingleParticleMuShellwise") < 0)) __PYX_ERR(0, 1430, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; } else { - __pyx_t_5 = -1L; + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); } - (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1431, __pyx_L3_error) + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1431, __pyx_L3_error) + __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 1431, __pyx_L3_error) + __pyx_v_number_of_startingpoints = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_number_of_startingpoints == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1431, __pyx_L3_error) } - - /* "View.MemoryView":1065 - * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets - */ + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuShellwise", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1430, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.correlateSingleParticleMuShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_80correlateSingleParticleMuShellwise(__pyx_self, __pyx_v_timeseries, __pyx_v_result, __pyx_v_dataset, __pyx_v_number_of_startingpoints); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1082 - * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - */ - -static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { - __Pyx_memviewslice __pyx_v_memviewslice; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_80correlateSingleParticleMuShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_result, __Pyx_memviewslice __pyx_v_dataset, int __pyx_v_number_of_startingpoints) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_shell; + int __pyx_v_particles; + int __pyx_v_number_of_frames; + int __pyx_v_number_of_shells; + int __pyx_v_correlation_length; + CYTHON_UNUSED __Pyx_memviewslice __pyx_v_sub_correlation = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_norm; + __Pyx_memviewslice __pyx_v_counter = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_10; + int __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + int __pyx_t_30; + int __pyx_t_31; + int __pyx_t_32; + double __pyx_t_33; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy", 0); + __Pyx_RefNannySetupContext("correlateSingleParticleMuShellwise", 0); - /* "View.MemoryView":1085 - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< - * return memoryview_copy_from_slice(memview, &memviewslice) + /* "newanalysis/helpers/miscellaneous.pyx":1438 * + * cdef int i, j, k, shell + * cdef int particles = timeseries.shape[1] # <<<<<<<<<<<<<< + * cdef int number_of_frames = timeseries.shape[0] + * cdef int number_of_shells = result.shape[0] */ - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + __pyx_v_particles = (__pyx_v_timeseries.shape[1]); - /* "View.MemoryView":1086 - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) - * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_object_from_slice') + /* "newanalysis/helpers/miscellaneous.pyx":1439 + * cdef int i, j, k, shell + * cdef int particles = timeseries.shape[1] + * cdef int number_of_frames = timeseries.shape[0] # <<<<<<<<<<<<<< + * cdef int number_of_shells = result.shape[0] + * cdef int correlation_length = result.shape[1] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1086, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[0]); - /* "View.MemoryView":1082 - * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice + /* "newanalysis/helpers/miscellaneous.pyx":1440 + * cdef int particles = timeseries.shape[1] + * cdef int number_of_frames = timeseries.shape[0] + * cdef int number_of_shells = result.shape[0] # <<<<<<<<<<<<<< + * cdef int correlation_length = result.shape[1] + * cdef double [:] sub_correlation = np.zeros((correlation_length)) */ + __pyx_v_number_of_shells = (__pyx_v_result.shape[0]); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "newanalysis/helpers/miscellaneous.pyx":1441 + * cdef int number_of_frames = timeseries.shape[0] + * cdef int number_of_shells = result.shape[0] + * cdef int correlation_length = result.shape[1] # <<<<<<<<<<<<<< + * cdef double [:] sub_correlation = np.zeros((correlation_length)) + * cdef double norm + */ + __pyx_v_correlation_length = (__pyx_v_result.shape[1]); + + /* "newanalysis/helpers/miscellaneous.pyx":1442 + * cdef int number_of_shells = result.shape[0] + * cdef int correlation_length = result.shape[1] + * cdef double [:] sub_correlation = np.zeros((correlation_length)) # <<<<<<<<<<<<<< + * cdef double norm + * cdef double [:] counter = np.zeros((number_of_shells)) + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_correlation_length); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_sub_correlation = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; -/* "View.MemoryView":1089 + /* "newanalysis/helpers/miscellaneous.pyx":1444 + * cdef double [:] sub_correlation = np.zeros((correlation_length)) + * cdef double norm + * cdef double [:] counter = np.zeros((number_of_shells)) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. + * if(correlation_length > number_of_frames): */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_number_of_shells); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_counter = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; -static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { - PyObject *(*__pyx_v_to_object_func)(char *); - int (*__pyx_v_to_dtype_func)(char *, PyObject *); - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *(*__pyx_t_3)(char *); - int (*__pyx_t_4)(char *, PyObject *); - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + /* "newanalysis/helpers/miscellaneous.pyx":1446 + * cdef double [:] counter = np.zeros((number_of_shells)) + * + * if(correlation_length > number_of_frames): # <<<<<<<<<<<<<< + * print("Correlation length must not be longer than the available trajectory length") + * return + */ + __pyx_t_7 = (__pyx_v_correlation_length > __pyx_v_number_of_frames); + if (__pyx_t_7) { - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 + /* "newanalysis/helpers/miscellaneous.pyx":1447 + * + * if(correlation_length > number_of_frames): + * print("Correlation length must not be longer than the available trajectory length") # <<<<<<<<<<<<<< + * return * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1097 + /* "newanalysis/helpers/miscellaneous.pyx":1448 + * if(correlation_length > number_of_frames): + * print("Correlation length must not be longer than the available trajectory length") + * return # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: + * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: */ - __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; - __pyx_v_to_object_func = __pyx_t_3; + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "View.MemoryView":1098 - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< - * else: - * to_object_func = NULL + /* "newanalysis/helpers/miscellaneous.pyx":1446 + * cdef double [:] counter = np.zeros((number_of_shells)) + * + * if(correlation_length > number_of_frames): # <<<<<<<<<<<<<< + * print("Correlation length must not be longer than the available trajectory length") + * return */ - __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; - __pyx_v_to_dtype_func = __pyx_t_4; + } - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 + /* "newanalysis/helpers/miscellaneous.pyx":1450 + * return * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: # <<<<<<<<<<<<<< + * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") + * return */ - goto __pyx_L3; + __pyx_t_5 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); + if (unlikely(__pyx_v_number_of_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 1450, __pyx_L1_error) } + __pyx_t_7 = ((((double)__pyx_t_5) / ((double)__pyx_v_number_of_startingpoints)) == 0.0); + if (__pyx_t_7) { - /* "View.MemoryView":1100 - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - * to_object_func = NULL # <<<<<<<<<<<<<< - * to_dtype_func = NULL + /* "newanalysis/helpers/miscellaneous.pyx":1451 + * + * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: + * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") # <<<<<<<<<<<<<< + * return * */ - /*else*/ { - __pyx_v_to_object_func = NULL; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1101 - * else: - * to_object_func = NULL - * to_dtype_func = NULL # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1452 + * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: + * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") + * return # <<<<<<<<<<<<<< * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): */ - __pyx_v_to_dtype_func = NULL; - } - __pyx_L3:; + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "View.MemoryView":1103 - * to_dtype_func = NULL + /* "newanalysis/helpers/miscellaneous.pyx":1450 + * return * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< - * to_object_func, to_dtype_func, - * memview.dtype_is_object) + * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: # <<<<<<<<<<<<<< + * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") + * return */ - __Pyx_XDECREF(__pyx_r); + } - /* "View.MemoryView":1105 - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - * to_object_func, to_dtype_func, - * memview.dtype_is_object) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1454 + * return * + * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): # <<<<<<<<<<<<<< + * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") * */ - __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __pyx_t_5 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); + if (unlikely(((double)__pyx_v_number_of_startingpoints) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 1454, __pyx_L1_error) + } + __pyx_t_1 = PyFloat_FromDouble((((double)__pyx_t_5) / ((double)__pyx_v_number_of_startingpoints))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); + if (unlikely(__pyx_v_number_of_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 1454, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyInt_FromDouble((((double)__pyx_t_5) / ((double)__pyx_v_number_of_startingpoints))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_3, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1454, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { - /* "View.MemoryView":1089 + /* "newanalysis/helpers/miscellaneous.pyx":1455 * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. + * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): + * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") # <<<<<<<<<<<<<< + * + * #Loop over each starting point */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":1111 + /* "newanalysis/helpers/miscellaneous.pyx":1454 + * return * + * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): # <<<<<<<<<<<<<< + * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg */ + } -static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { - Py_ssize_t __pyx_r; - int __pyx_t_1; - - /* "View.MemoryView":1112 + /* "newanalysis/helpers/miscellaneous.pyx":1458 * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: + * #Loop over each starting point + * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): # <<<<<<<<<<<<<< + * #Loop over each particle + * for j in range(0, particles): */ - __pyx_t_1 = ((__pyx_v_arg < 0) != 0); - if (__pyx_t_1) { + __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_number_of_frames - __pyx_v_correlation_length)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); + if (unlikely(__pyx_v_number_of_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 1458, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyInt_FromDouble((((double)__pyx_t_5) / ((double)__pyx_v_number_of_startingpoints))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0)) __PYX_ERR(0, 1458, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(0, 1458, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2)) __PYX_ERR(0, 1458, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1458, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 1458, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 1458, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1458, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1458, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":1113 - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: - * return -arg # <<<<<<<<<<<<<< - * else: - * return arg + /* "newanalysis/helpers/miscellaneous.pyx":1460 + * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): + * #Loop over each particle + * for j in range(0, particles): # <<<<<<<<<<<<<< + * shell = dataset[j, i] - 1 + * if(shell < number_of_shells): */ - __pyx_r = (-__pyx_v_arg); - goto __pyx_L0; + __pyx_t_5 = __pyx_v_particles; + __pyx_t_10 = __pyx_t_5; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_j = __pyx_t_11; - /* "View.MemoryView":1112 - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1461 + * #Loop over each particle + * for j in range(0, particles): + * shell = dataset[j, i] - 1 # <<<<<<<<<<<<<< + * if(shell < number_of_shells): + * #Loop over each distance */ - } + __pyx_t_12 = __pyx_v_j; + __pyx_t_13 = __pyx_v_i; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_dataset.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_dataset.shape[1]; + __pyx_v_shell = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_12 * __pyx_v_dataset.strides[0]) ) + __pyx_t_13 * __pyx_v_dataset.strides[1]) ))) - 1); - /* "View.MemoryView":1115 - * return -arg - * else: - * return arg # <<<<<<<<<<<<<< - * - * @cname('__pyx_get_best_slice_order') + /* "newanalysis/helpers/miscellaneous.pyx":1462 + * for j in range(0, particles): + * shell = dataset[j, i] - 1 + * if(shell < number_of_shells): # <<<<<<<<<<<<<< + * #Loop over each distance + * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] */ - /*else*/ { - __pyx_r = __pyx_v_arg; - goto __pyx_L0; - } + __pyx_t_7 = (__pyx_v_shell < __pyx_v_number_of_shells); + if (__pyx_t_7) { - /* "View.MemoryView":1111 - * + /* "newanalysis/helpers/miscellaneous.pyx":1464 + * if(shell < number_of_shells): + * #Loop over each distance + * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] # <<<<<<<<<<<<<< * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg + * if(norm != 0): */ + __pyx_t_13 = __pyx_v_i; + __pyx_t_12 = __pyx_v_j; + __pyx_t_14 = 0; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_timeseries.shape[2]; + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = __pyx_v_j; + __pyx_t_17 = 0; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_timeseries.shape[2]; + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + __pyx_t_20 = 1; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_timeseries.shape[2]; + __pyx_t_21 = __pyx_v_i; + __pyx_t_22 = __pyx_v_j; + __pyx_t_23 = 1; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_timeseries.shape[2]; + __pyx_t_24 = __pyx_v_i; + __pyx_t_25 = __pyx_v_j; + __pyx_t_26 = 2; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_timeseries.shape[2]; + __pyx_t_27 = __pyx_v_i; + __pyx_t_28 = __pyx_v_j; + __pyx_t_29 = 2; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_timeseries.shape[2]; + __pyx_v_norm = ((((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_13 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_12 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_14 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_15 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_16 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_17 * __pyx_v_timeseries.strides[2]) )))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_18 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_19 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_20 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_21 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_22 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_23 * __pyx_v_timeseries.strides[2]) ))))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_24 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_25 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_26 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_27 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_28 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_29 * __pyx_v_timeseries.strides[2]) ))))); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1118 + /* "newanalysis/helpers/miscellaneous.pyx":1466 + * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. + * if(norm != 0): # <<<<<<<<<<<<<< + * for k in range(i, i+correlation_length): + * result[shell][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm */ + __pyx_t_7 = (__pyx_v_norm != 0.0); + if (__pyx_t_7) { -static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { - int __pyx_v_i; - Py_ssize_t __pyx_v_c_stride; - Py_ssize_t __pyx_v_f_stride; - char __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1123 - * """ - * cdef int i - * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< - * cdef Py_ssize_t f_stride = 0 + /* "newanalysis/helpers/miscellaneous.pyx":1467 * - */ - __pyx_v_c_stride = 0; - - /* "View.MemoryView":1124 - * cdef int i - * cdef Py_ssize_t c_stride = 0 - * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + * if(norm != 0): + * for k in range(i, i+correlation_length): # <<<<<<<<<<<<<< + * result[shell][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm * - * for i in range(ndim - 1, -1, -1): */ - __pyx_v_f_stride = 0; + __pyx_t_30 = (__pyx_v_i + __pyx_v_correlation_length); + __pyx_t_31 = __pyx_t_30; + for (__pyx_t_32 = __pyx_v_i; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { + __pyx_v_k = __pyx_t_32; - /* "View.MemoryView":1126 - * cdef Py_ssize_t f_stride = 0 + /* "newanalysis/helpers/miscellaneous.pyx":1468 + * if(norm != 0): + * for k in range(i, i+correlation_length): + * result[shell][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm # <<<<<<<<<<<<<< * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] + * #for k in range(0, correlation_length): */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_29 = __pyx_v_k; + __pyx_t_28 = __pyx_v_j; + __pyx_t_27 = 0; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_timeseries.shape[2]; + __pyx_t_26 = __pyx_v_i; + __pyx_t_25 = __pyx_v_j; + __pyx_t_24 = 0; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_timeseries.shape[2]; + __pyx_t_23 = __pyx_v_k; + __pyx_t_22 = __pyx_v_j; + __pyx_t_21 = 1; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_timeseries.shape[2]; + __pyx_t_20 = __pyx_v_i; + __pyx_t_19 = __pyx_v_j; + __pyx_t_18 = 1; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_timeseries.shape[2]; + __pyx_t_17 = __pyx_v_k; + __pyx_t_16 = __pyx_v_j; + __pyx_t_15 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_timeseries.shape[2]; + __pyx_t_14 = __pyx_v_i; + __pyx_t_12 = __pyx_v_j; + __pyx_t_13 = 2; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_timeseries.shape[2]; + __pyx_t_33 = ((((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_29 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_28 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_27 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_26 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_25 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_24 * __pyx_v_timeseries.strides[2]) )))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_23 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_22 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_21 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_20 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_19 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_18 * __pyx_v_timeseries.strides[2]) ))))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_17 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_16 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_15 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_14 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_12 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_13 * __pyx_v_timeseries.strides[2]) ))))); + if (unlikely(__pyx_v_norm == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 1468, __pyx_L1_error) + } + __pyx_t_13 = __pyx_v_shell; + __pyx_t_12 = (__pyx_v_k - __pyx_v_i); + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_result.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_result.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_13 * __pyx_v_result.strides[0]) ) + __pyx_t_12 * __pyx_v_result.strides[1]) )) += (__pyx_t_33 / __pyx_v_norm); + } - /* "View.MemoryView":1127 + /* "newanalysis/helpers/miscellaneous.pyx":1472 + * #for k in range(0, correlation_length): + * #result[shell][k] += sub_correlation[k] + * counter[shell] += 1 # <<<<<<<<<<<<<< * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break + * for i in range(0, number_of_shells): */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { + __pyx_t_12 = __pyx_v_shell; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_counter.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_12 * __pyx_v_counter.strides[0]) )) += 1.0; - /* "View.MemoryView":1128 - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break + /* "newanalysis/helpers/miscellaneous.pyx":1466 + * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] * + * if(norm != 0): # <<<<<<<<<<<<<< + * for k in range(i, i+correlation_length): + * result[shell][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm */ - __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + } - /* "View.MemoryView":1129 - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< - * - * for i in range(ndim): + /* "newanalysis/helpers/miscellaneous.pyx":1462 + * for j in range(0, particles): + * shell = dataset[j, i] - 1 + * if(shell < number_of_shells): # <<<<<<<<<<<<<< + * #Loop over each distance + * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] */ - goto __pyx_L4_break; + } + } - /* "View.MemoryView":1127 + /* "newanalysis/helpers/miscellaneous.pyx":1458 * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break + * #Loop over each starting point + * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): # <<<<<<<<<<<<<< + * #Loop over each particle + * for j in range(0, particles): */ - } } - __pyx_L4_break:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1131 - * break + /* "newanalysis/helpers/miscellaneous.pyx":1474 + * counter[shell] += 1 * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] + * for i in range(0, number_of_shells): # <<<<<<<<<<<<<< + * for k in range(0, correlation_length): + * if(counter[i] > 0): */ - __pyx_t_1 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_1; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_5 = __pyx_v_number_of_shells; + __pyx_t_10 = __pyx_t_5; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; - /* "View.MemoryView":1132 + /* "newanalysis/helpers/miscellaneous.pyx":1475 * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break + * for i in range(0, number_of_shells): + * for k in range(0, correlation_length): # <<<<<<<<<<<<<< + * if(counter[i] > 0): + * result[i][k] /= counter[i] */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { + __pyx_t_30 = __pyx_v_correlation_length; + __pyx_t_31 = __pyx_t_30; + for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { + __pyx_v_k = __pyx_t_32; - /* "View.MemoryView":1133 - * for i in range(ndim): - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break + /* "newanalysis/helpers/miscellaneous.pyx":1476 + * for i in range(0, number_of_shells): + * for k in range(0, correlation_length): + * if(counter[i] > 0): # <<<<<<<<<<<<<< + * result[i][k] /= counter[i] * */ - __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + __pyx_t_12 = __pyx_v_i; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_counter.shape[0]; + __pyx_t_7 = ((*((double *) ( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_12 * __pyx_v_counter.strides[0]) ))) > 0.0); + if (__pyx_t_7) { - /* "View.MemoryView":1134 - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1477 + * for k in range(0, correlation_length): + * if(counter[i] > 0): + * result[i][k] /= counter[i] # <<<<<<<<<<<<<< * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * @cython.boundscheck(False) */ - goto __pyx_L7_break; + __pyx_t_12 = __pyx_v_i; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_counter.shape[0]; + __pyx_t_13 = __pyx_v_i; + __pyx_t_14 = __pyx_v_k; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_result.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_result.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_13 * __pyx_v_result.strides[0]) ) + __pyx_t_14 * __pyx_v_result.strides[1]) )) /= (*((double *) ( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_12 * __pyx_v_counter.strides[0]) ))); - /* "View.MemoryView":1132 + /* "newanalysis/helpers/miscellaneous.pyx":1476 + * for i in range(0, number_of_shells): + * for k in range(0, correlation_length): + * if(counter[i] > 0): # <<<<<<<<<<<<<< + * result[i][k] /= counter[i] * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break */ + } } } - __pyx_L7_break:; - /* "View.MemoryView":1136 - * break + /* "newanalysis/helpers/miscellaneous.pyx":1430 + * crossCorrelateMultiVectorTS(×eries1[0,0,0], ×eries2[0,0,0], &result[0], number_of_particles, number_of_frames1, number_of_frames2, both_directions, order) * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleParticleMuShellwise(double[:,:,:] timeseries, double[:,:] result, int[:,:] dataset, int number_of_startingpoints): + * """ */ - __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1137 - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - * return 'C' # <<<<<<<<<<<<<< - * else: - * return 'F' - */ - __pyx_r = 'C'; - goto __pyx_L0; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.correlateSingleParticleMuShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_sub_correlation, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_counter, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1136 - * break +/* "newanalysis/helpers/miscellaneous.pyx":1479 + * result[i][k] /= counter[i] * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleParticleMuVennShellwise(double[:,:,:] timeseries, double[:,:,:] result, int[:,:] dataset1, int[:,:] dataset2, int number_of_startingpoints): + * """ */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_83correlateSingleParticleMuVennShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_82correlateSingleParticleMuVennShellwise, "\n timeseries... (N_particle, number_of_frames, mu)\n result ... (N_shell, correlation_length)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_83correlateSingleParticleMuVennShellwise = {"correlateSingleParticleMuVennShellwise", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_83correlateSingleParticleMuVennShellwise, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_82correlateSingleParticleMuVennShellwise}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_83correlateSingleParticleMuVennShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dataset2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_number_of_startingpoints; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("correlateSingleParticleMuVennShellwise (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1479, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_result,&__pyx_n_s_dataset1,&__pyx_n_s_dataset2,&__pyx_n_s_number_of_startingpoints,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1479, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1479, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuVennShellwise", 1, 5, 5, 1); __PYX_ERR(0, 1479, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1479, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuVennShellwise", 1, 5, 5, 2); __PYX_ERR(0, 1479, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1479, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuVennShellwise", 1, 5, 5, 3); __PYX_ERR(0, 1479, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_number_of_startingpoints)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1479, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuVennShellwise", 1, 5, 5, 4); __PYX_ERR(0, 1479, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "correlateSingleParticleMuVennShellwise") < 0)) __PYX_ERR(0, 1479, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 5)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + } + __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1480, __pyx_L3_error) + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_result.memview)) __PYX_ERR(0, 1480, __pyx_L3_error) + __pyx_v_dataset1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset1.memview)) __PYX_ERR(0, 1480, __pyx_L3_error) + __pyx_v_dataset2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset2.memview)) __PYX_ERR(0, 1480, __pyx_L3_error) + __pyx_v_number_of_startingpoints = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_number_of_startingpoints == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1480, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("correlateSingleParticleMuVennShellwise", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1479, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset2, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.correlateSingleParticleMuVennShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_82correlateSingleParticleMuVennShellwise(__pyx_self, __pyx_v_timeseries, __pyx_v_result, __pyx_v_dataset1, __pyx_v_dataset2, __pyx_v_number_of_startingpoints); - /* "View.MemoryView":1139 - * return 'C' - * else: - * return 'F' # <<<<<<<<<<<<<< - * - * @cython.cdivision(True) - */ - /*else*/ { - __pyx_r = 'F'; - goto __pyx_L0; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_result, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset2, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_82correlateSingleParticleMuVennShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_result, __Pyx_memviewslice __pyx_v_dataset1, __Pyx_memviewslice __pyx_v_dataset2, int __pyx_v_number_of_startingpoints) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_shell1; + int __pyx_v_shell2; + int __pyx_v_particles; + int __pyx_v_number_of_frames; + int __pyx_v_number_of_shells1; + int __pyx_v_number_of_shells2; + int __pyx_v_correlation_length; + double __pyx_v_norm; + __Pyx_memviewslice __pyx_v_counter = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + int __pyx_t_11; + int __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + int __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + int __pyx_t_32; + int __pyx_t_33; + int __pyx_t_34; + double __pyx_t_35; + int __pyx_t_36; + int __pyx_t_37; + int __pyx_t_38; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("correlateSingleParticleMuVennShellwise", 0); - /* "View.MemoryView":1118 + /* "newanalysis/helpers/miscellaneous.pyx":1487 * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. + * cdef int i, j, k, shell1, shell2 + * cdef int particles = timeseries.shape[1] # <<<<<<<<<<<<<< + * cdef int number_of_frames = timeseries.shape[0] + * cdef int number_of_shells1 = result.shape[0] */ + __pyx_v_particles = (__pyx_v_timeseries.shape[1]); - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1142 - * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + /* "newanalysis/helpers/miscellaneous.pyx":1488 + * cdef int i, j, k, shell1, shell2 + * cdef int particles = timeseries.shape[1] + * cdef int number_of_frames = timeseries.shape[0] # <<<<<<<<<<<<<< + * cdef int number_of_shells1 = result.shape[0] + * cdef int number_of_shells2 = result.shape[1] */ + __pyx_v_number_of_frames = (__pyx_v_timeseries.shape[0]); -static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; - Py_ssize_t __pyx_v_dst_extent; - Py_ssize_t __pyx_v_src_stride; - Py_ssize_t __pyx_v_dst_stride; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - - /* "View.MemoryView":1149 - * - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] + /* "newanalysis/helpers/miscellaneous.pyx":1489 + * cdef int particles = timeseries.shape[1] + * cdef int number_of_frames = timeseries.shape[0] + * cdef int number_of_shells1 = result.shape[0] # <<<<<<<<<<<<<< + * cdef int number_of_shells2 = result.shape[1] + * cdef int correlation_length = result.shape[2] */ - __pyx_v_src_extent = (__pyx_v_src_shape[0]); + __pyx_v_number_of_shells1 = (__pyx_v_result.shape[0]); - /* "View.MemoryView":1150 - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] + /* "newanalysis/helpers/miscellaneous.pyx":1490 + * cdef int number_of_frames = timeseries.shape[0] + * cdef int number_of_shells1 = result.shape[0] + * cdef int number_of_shells2 = result.shape[1] # <<<<<<<<<<<<<< + * cdef int correlation_length = result.shape[2] + * cdef double norm */ - __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + __pyx_v_number_of_shells2 = (__pyx_v_result.shape[1]); - /* "View.MemoryView":1151 - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_stride = dst_strides[0] - * + /* "newanalysis/helpers/miscellaneous.pyx":1491 + * cdef int number_of_shells1 = result.shape[0] + * cdef int number_of_shells2 = result.shape[1] + * cdef int correlation_length = result.shape[2] # <<<<<<<<<<<<<< + * cdef double norm + * cdef double [:,:] counter = np.zeros((number_of_shells1, number_of_shells2)) */ - __pyx_v_src_stride = (__pyx_v_src_strides[0]); + __pyx_v_correlation_length = (__pyx_v_result.shape[2]); - /* "View.MemoryView":1152 - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1493 + * cdef int correlation_length = result.shape[2] + * cdef double norm + * cdef double [:,:] counter = np.zeros((number_of_shells1, number_of_shells2)) # <<<<<<<<<<<<<< * - * if ndim == 1: + * if(correlation_length > number_of_frames): */ - __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_number_of_shells1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_number_of_shells2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2)) __PYX_ERR(0, 1493, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4)) __PYX_ERR(0, 1493, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1493, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_counter = __pyx_t_7; + __pyx_t_7.memview = NULL; + __pyx_t_7.data = NULL; - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] + /* "newanalysis/helpers/miscellaneous.pyx":1495 + * cdef double [:,:] counter = np.zeros((number_of_shells1, number_of_shells2)) * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): + * if(correlation_length > number_of_frames): # <<<<<<<<<<<<<< + * print("Correlation length must not be longer than the available trajectory length") + * return */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { + __pyx_t_8 = (__pyx_v_correlation_length > __pyx_v_number_of_frames); + if (__pyx_t_8) { - /* "View.MemoryView":1155 + /* "newanalysis/helpers/miscellaneous.pyx":1496 * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) - */ - __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - - /* "View.MemoryView":1156 - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - */ - __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); - if (__pyx_t_2) { - __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); - } - __pyx_t_3 = (__pyx_t_2 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L5_bool_binop_done:; - - /* "View.MemoryView":1155 + * if(correlation_length > number_of_frames): + * print("Correlation length must not be longer than the available trajectory length") # <<<<<<<<<<<<<< + * return * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) - */ - if (__pyx_t_1) { - - /* "View.MemoryView":1157 - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1496, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1155 + /* "newanalysis/helpers/miscellaneous.pyx":1497 + * if(correlation_length > number_of_frames): + * print("Correlation length must not be longer than the available trajectory length") + * return # <<<<<<<<<<<<<< * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) - */ - goto __pyx_L4; - } - - /* "View.MemoryView":1159 - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1160 - * else: - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< - * src_data += src_stride - * dst_data += dst_stride - */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); - - /* "View.MemoryView":1161 - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * else: + * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "View.MemoryView":1162 - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): + /* "newanalysis/helpers/miscellaneous.pyx":1495 + * cdef double [:,:] counter = np.zeros((number_of_shells1, number_of_shells2)) + * + * if(correlation_length > number_of_frames): # <<<<<<<<<<<<<< + * print("Correlation length must not be longer than the available trajectory length") + * return */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } - } - __pyx_L4:; + } - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] + /* "newanalysis/helpers/miscellaneous.pyx":1499 + * return * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): + * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: # <<<<<<<<<<<<<< + * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") + * return */ - goto __pyx_L3; + __pyx_t_6 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); + if (unlikely(__pyx_v_number_of_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 1499, __pyx_L1_error) } + __pyx_t_8 = ((((double)__pyx_t_6) / ((double)__pyx_v_number_of_startingpoints)) == 0.0); + if (__pyx_t_8) { - /* "View.MemoryView":1164 - * dst_data += dst_stride - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * _copy_strided_to_strided(src_data, src_strides + 1, - * dst_data, dst_strides + 1, + /* "newanalysis/helpers/miscellaneous.pyx":1500 + * + * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: + * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") # <<<<<<<<<<<<<< + * return + * */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1165 - * else: - * for i in range(dst_extent): - * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< - * dst_data, dst_strides + 1, - * src_shape + 1, dst_shape + 1, + /* "newanalysis/helpers/miscellaneous.pyx":1501 + * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: + * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") + * return # <<<<<<<<<<<<<< + * + * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): */ - _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "View.MemoryView":1169 - * src_shape + 1, dst_shape + 1, - * ndim - 1, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride + /* "newanalysis/helpers/miscellaneous.pyx":1499 + * return * + * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: # <<<<<<<<<<<<<< + * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") + * return */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + } - /* "View.MemoryView":1170 - * ndim - 1, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1503 + * return + * + * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): # <<<<<<<<<<<<<< + * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } + __pyx_t_6 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); + if (unlikely(((double)__pyx_v_number_of_startingpoints) == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 1503, __pyx_L1_error) } - __pyx_L3:; + __pyx_t_1 = PyFloat_FromDouble((((double)__pyx_t_6) / ((double)__pyx_v_number_of_startingpoints))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); + if (unlikely(__pyx_v_number_of_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 1503, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyInt_FromDouble((((double)__pyx_t_6) / ((double)__pyx_v_number_of_startingpoints))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_5, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { - /* "View.MemoryView":1142 + /* "newanalysis/helpers/miscellaneous.pyx":1504 * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): + * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") # <<<<<<<<<<<<<< + * + * #Loop over each starting point */ + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1504, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* function exit code */ -} - -/* "View.MemoryView":1172 - * dst_data += dst_stride + /* "newanalysis/helpers/miscellaneous.pyx":1503 + * return + * + * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): # <<<<<<<<<<<<<< + * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: */ + } -static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - - /* "View.MemoryView":1175 - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: - * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< - * src.shape, dst.shape, ndim, itemsize) + /* "newanalysis/helpers/miscellaneous.pyx":1507 * + * #Loop over each starting point + * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): # <<<<<<<<<<<<<< + * #Loop over each particle + * for j in range(0, particles): */ - _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_number_of_frames - __pyx_v_correlation_length)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = (__pyx_v_number_of_frames - __pyx_v_correlation_length); + if (unlikely(__pyx_v_number_of_startingpoints == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 1507, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyInt_FromDouble((((double)__pyx_t_6) / ((double)__pyx_v_number_of_startingpoints))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0)) __PYX_ERR(0, 1507, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5)) __PYX_ERR(0, 1507, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3)) __PYX_ERR(0, 1507, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1507, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(0, 1507, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(0, 1507, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_10(__pyx_t_1); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1507, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1507, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1172 - * dst_data += dst_stride - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + /* "newanalysis/helpers/miscellaneous.pyx":1509 + * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): + * #Loop over each particle + * for j in range(0, particles): # <<<<<<<<<<<<<< + * shell1 = dataset1[j, i] - 1 + * shell2 = dataset2[j, i] - 1 */ + __pyx_t_6 = __pyx_v_particles; + __pyx_t_11 = __pyx_t_6; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; - /* function exit code */ -} + /* "newanalysis/helpers/miscellaneous.pyx":1510 + * #Loop over each particle + * for j in range(0, particles): + * shell1 = dataset1[j, i] - 1 # <<<<<<<<<<<<<< + * shell2 = dataset2[j, i] - 1 + * if(shell1 < number_of_shells1 and shell2 < number_of_shells2): + */ + __pyx_t_13 = __pyx_v_j; + __pyx_t_14 = __pyx_v_i; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_dataset1.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_dataset1.shape[1]; + __pyx_v_shell1 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset1.data + __pyx_t_13 * __pyx_v_dataset1.strides[0]) ) + __pyx_t_14 * __pyx_v_dataset1.strides[1]) ))) - 1); -/* "View.MemoryView":1179 - * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + /* "newanalysis/helpers/miscellaneous.pyx":1511 + * for j in range(0, particles): + * shell1 = dataset1[j, i] - 1 + * shell2 = dataset2[j, i] - 1 # <<<<<<<<<<<<<< + * if(shell1 < number_of_shells1 and shell2 < number_of_shells2): + * #Loop over each distance */ + __pyx_t_14 = __pyx_v_j; + __pyx_t_13 = __pyx_v_i; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_dataset2.shape[0]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_dataset2.shape[1]; + __pyx_v_shell2 = ((*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dataset2.data + __pyx_t_14 * __pyx_v_dataset2.strides[0]) ) + __pyx_t_13 * __pyx_v_dataset2.strides[1]) ))) - 1); -static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_size; - Py_ssize_t __pyx_r; - Py_ssize_t __pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; + /* "newanalysis/helpers/miscellaneous.pyx":1512 + * shell1 = dataset1[j, i] - 1 + * shell2 = dataset2[j, i] - 1 + * if(shell1 < number_of_shells1 and shell2 < number_of_shells2): # <<<<<<<<<<<<<< + * #Loop over each distance + * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] + */ + __pyx_t_15 = (__pyx_v_shell1 < __pyx_v_number_of_shells1); + if (__pyx_t_15) { + } else { + __pyx_t_8 = __pyx_t_15; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_15 = (__pyx_v_shell2 < __pyx_v_number_of_shells2); + __pyx_t_8 = __pyx_t_15; + __pyx_L11_bool_binop_done:; + if (__pyx_t_8) { - /* "View.MemoryView":1181 - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1514 + * if(shell1 < number_of_shells1 and shell2 < number_of_shells2): + * #Loop over each distance + * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] # <<<<<<<<<<<<<< * - * for shape in src.shape[:ndim]: + * for k in range(i, i+correlation_length): */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_size = __pyx_t_1; + __pyx_t_13 = __pyx_v_i; + __pyx_t_14 = __pyx_v_j; + __pyx_t_16 = 0; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_timeseries.shape[2]; + __pyx_t_17 = __pyx_v_i; + __pyx_t_18 = __pyx_v_j; + __pyx_t_19 = 0; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_timeseries.shape[2]; + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_j; + __pyx_t_22 = 1; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_timeseries.shape[2]; + __pyx_t_23 = __pyx_v_i; + __pyx_t_24 = __pyx_v_j; + __pyx_t_25 = 1; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_timeseries.shape[2]; + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = __pyx_v_j; + __pyx_t_28 = 2; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_timeseries.shape[2]; + __pyx_t_29 = __pyx_v_i; + __pyx_t_30 = __pyx_v_j; + __pyx_t_31 = 2; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_timeseries.shape[2]; + __pyx_v_norm = ((((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_13 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_14 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_16 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_17 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_18 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_19 * __pyx_v_timeseries.strides[2]) )))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_20 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_21 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_22 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_23 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_24 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_25 * __pyx_v_timeseries.strides[2]) ))))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_26 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_27 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_28 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_29 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_30 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_31 * __pyx_v_timeseries.strides[2]) ))))); - /* "View.MemoryView":1183 - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + /* "newanalysis/helpers/miscellaneous.pyx":1516 + * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] * - * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< - * size *= shape + * for k in range(i, i+correlation_length): # <<<<<<<<<<<<<< + * result[shell1][shell2][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm * */ - __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); - for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_shape = (__pyx_t_2[0]); + __pyx_t_32 = (__pyx_v_i + __pyx_v_correlation_length); + __pyx_t_33 = __pyx_t_32; + for (__pyx_t_34 = __pyx_v_i; __pyx_t_34 < __pyx_t_33; __pyx_t_34+=1) { + __pyx_v_k = __pyx_t_34; - /* "View.MemoryView":1184 + /* "newanalysis/helpers/miscellaneous.pyx":1517 * - * for shape in src.shape[:ndim]: - * size *= shape # <<<<<<<<<<<<<< + * for k in range(i, i+correlation_length): + * result[shell1][shell2][k-i] += (timeseries[k, j, 0]*timeseries[i, j, 0] + timeseries[k, j, 1]*timeseries[i, j, 1] + timeseries[k, j, 2]*timeseries[i, j, 2])/norm # <<<<<<<<<<<<<< * - * return size + * #for k in range(0, correlation_length): */ - __pyx_v_size = (__pyx_v_size * __pyx_v_shape); - } + __pyx_t_31 = __pyx_v_k; + __pyx_t_30 = __pyx_v_j; + __pyx_t_29 = 0; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_timeseries.shape[2]; + __pyx_t_28 = __pyx_v_i; + __pyx_t_27 = __pyx_v_j; + __pyx_t_26 = 0; + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_timeseries.shape[2]; + __pyx_t_25 = __pyx_v_k; + __pyx_t_24 = __pyx_v_j; + __pyx_t_23 = 1; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_timeseries.shape[2]; + __pyx_t_22 = __pyx_v_i; + __pyx_t_21 = __pyx_v_j; + __pyx_t_20 = 1; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_timeseries.shape[2]; + __pyx_t_19 = __pyx_v_k; + __pyx_t_18 = __pyx_v_j; + __pyx_t_17 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_timeseries.shape[2]; + __pyx_t_16 = __pyx_v_i; + __pyx_t_14 = __pyx_v_j; + __pyx_t_13 = 2; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_timeseries.shape[2]; + __pyx_t_35 = ((((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_31 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_30 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_29 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_28 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_27 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_26 * __pyx_v_timeseries.strides[2]) )))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_25 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_24 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_23 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_22 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_21 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_20 * __pyx_v_timeseries.strides[2]) ))))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_19 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_18 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_17 * __pyx_v_timeseries.strides[2]) ))) * (*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_16 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_14 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_13 * __pyx_v_timeseries.strides[2]) ))))); + if (unlikely(__pyx_v_norm == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 1517, __pyx_L1_error) + } + __pyx_t_13 = __pyx_v_shell1; + __pyx_t_14 = __pyx_v_shell2; + __pyx_t_16 = (__pyx_v_k - __pyx_v_i); + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_result.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_result.shape[1]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_result.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_13 * __pyx_v_result.strides[0]) ) + __pyx_t_14 * __pyx_v_result.strides[1]) ) + __pyx_t_16 * __pyx_v_result.strides[2]) )) += (__pyx_t_35 / __pyx_v_norm); + } - /* "View.MemoryView":1186 - * size *= shape - * - * return size # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1521 + * #for k in range(0, correlation_length): + * #result[shell][k] += sub_correlation[k] + * counter[shell1][shell2] += 1 # <<<<<<<<<<<<<< * - * @cname('__pyx_fill_contig_strides_array') + * for i in range(0, number_of_shells1): */ - __pyx_r = __pyx_v_size; - goto __pyx_L0; + __pyx_t_16 = __pyx_v_shell1; + __pyx_t_14 = __pyx_v_shell2; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_counter.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_counter.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_16 * __pyx_v_counter.strides[0]) ) + __pyx_t_14 * __pyx_v_counter.strides[1]) )) += 1.0; - /* "View.MemoryView":1179 - * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + /* "newanalysis/helpers/miscellaneous.pyx":1512 + * shell1 = dataset1[j, i] - 1 + * shell2 = dataset2[j, i] - 1 + * if(shell1 < number_of_shells1 and shell2 < number_of_shells2): # <<<<<<<<<<<<<< + * #Loop over each distance + * norm = timeseries[i, j, 0]*timeseries[i, j, 0] + timeseries[i, j, 1]*timeseries[i, j, 1] + timeseries[i, j, 2]*timeseries[i, j, 2] */ + } + } - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1189 + /* "newanalysis/helpers/miscellaneous.pyx":1507 * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + * #Loop over each starting point + * for i in range(0, (number_of_frames - correlation_length), int((number_of_frames - correlation_length)/number_of_startingpoints)): # <<<<<<<<<<<<<< + * #Loop over each particle + * for j in range(0, particles): */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { - int __pyx_v_idx; - Py_ssize_t __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1198 - * cdef int idx + /* "newanalysis/helpers/miscellaneous.pyx":1523 + * counter[shell1][shell2] += 1 * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride + * for i in range(0, number_of_shells1): # <<<<<<<<<<<<<< + * for j in range(0, number_of_shells2): + * for k in range(0, correlation_length): */ - __pyx_t_1 = ((__pyx_v_order == 'F') != 0); - if (__pyx_t_1) { + __pyx_t_6 = __pyx_v_number_of_shells1; + __pyx_t_11 = __pyx_t_6; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_i = __pyx_t_12; - /* "View.MemoryView":1199 + /* "newanalysis/helpers/miscellaneous.pyx":1524 * - * if order == 'F': - * for idx in range(ndim): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] - */ - __pyx_t_2 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_idx = __pyx_t_4; - - /* "View.MemoryView":1200 - * if order == 'F': - * for idx in range(ndim): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * else: + * for i in range(0, number_of_shells1): + * for j in range(0, number_of_shells2): # <<<<<<<<<<<<<< + * for k in range(0, correlation_length): + * if(counter[i][j] > 0): */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + __pyx_t_32 = __pyx_v_number_of_shells2; + __pyx_t_33 = __pyx_t_32; + for (__pyx_t_34 = 0; __pyx_t_34 < __pyx_t_33; __pyx_t_34+=1) { + __pyx_v_j = __pyx_t_34; - /* "View.MemoryView":1201 - * for idx in range(ndim): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * else: - * for idx in range(ndim - 1, -1, -1): + /* "newanalysis/helpers/miscellaneous.pyx":1525 + * for i in range(0, number_of_shells1): + * for j in range(0, number_of_shells2): + * for k in range(0, correlation_length): # <<<<<<<<<<<<<< + * if(counter[i][j] > 0): + * result[i][j][k] /= counter[i][j] */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } + __pyx_t_36 = __pyx_v_correlation_length; + __pyx_t_37 = __pyx_t_36; + for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_37; __pyx_t_38+=1) { + __pyx_v_k = __pyx_t_38; - /* "View.MemoryView":1198 - * cdef int idx + /* "newanalysis/helpers/miscellaneous.pyx":1526 + * for j in range(0, number_of_shells2): + * for k in range(0, correlation_length): + * if(counter[i][j] > 0): # <<<<<<<<<<<<<< + * result[i][j][k] /= counter[i][j] * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1203 - * stride *= shape[idx] - * else: - * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] */ - /*else*/ { - for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { - __pyx_v_idx = __pyx_t_2; + __pyx_t_14 = __pyx_v_i; + __pyx_t_16 = __pyx_v_j; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_counter.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_counter.shape[1]; + __pyx_t_8 = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_14 * __pyx_v_counter.strides[0]) ) + __pyx_t_16 * __pyx_v_counter.strides[1]) ))) > 0.0); + if (__pyx_t_8) { - /* "View.MemoryView":1204 - * else: - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] + /* "newanalysis/helpers/miscellaneous.pyx":1527 + * for k in range(0, correlation_length): + * if(counter[i][j] > 0): + * result[i][j][k] /= counter[i][j] # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + __pyx_t_16 = __pyx_v_i; + __pyx_t_14 = __pyx_v_j; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_counter.shape[0]; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_counter.shape[1]; + __pyx_t_13 = __pyx_v_i; + __pyx_t_17 = __pyx_v_j; + __pyx_t_18 = __pyx_v_k; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_result.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_result.shape[1]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_result.shape[2]; + *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_result.data + __pyx_t_13 * __pyx_v_result.strides[0]) ) + __pyx_t_17 * __pyx_v_result.strides[1]) ) + __pyx_t_18 * __pyx_v_result.strides[2]) )) /= (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_counter.data + __pyx_t_16 * __pyx_v_counter.strides[0]) ) + __pyx_t_14 * __pyx_v_counter.strides[1]) ))); - /* "View.MemoryView":1205 - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1526 + * for j in range(0, number_of_shells2): + * for k in range(0, correlation_length): + * if(counter[i][j] > 0): # <<<<<<<<<<<<<< + * result[i][j][k] /= counter[i][j] * - * return stride */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + } + } } } - __pyx_L3:; - - /* "View.MemoryView":1207 - * stride *= shape[idx] - * - * return stride # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_data_to_temp') - */ - __pyx_r = __pyx_v_stride; - goto __pyx_L0; - /* "View.MemoryView":1189 + /* "newanalysis/helpers/miscellaneous.pyx":1479 + * result[i][k] /= counter[i] * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleParticleMuVennShellwise(double[:,:,:] timeseries, double[:,:,:] result, int[:,:] dataset1, int[:,:] dataset2, int number_of_startingpoints): + * """ */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.correlateSingleParticleMuVennShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_counter, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1210 +/* "newanalysis/helpers/miscellaneous.pyx":1529 + * result[i][j][k] /= counter[i][j] * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vanHoveSingleVector(double[:,:] timeseries, double[:,:] histogram): + * """ */ -static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { - int __pyx_v_i; - void *__pyx_v_result; - size_t __pyx_v_itemsize; - size_t __pyx_v_size; - void *__pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - struct __pyx_memoryview_obj *__pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_85vanHoveSingleVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_84vanHoveSingleVector, "\n timeseries ... (correlation_length * 3)\n histogram ... (correlation_length * cos_segs)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_85vanHoveSingleVector = {"vanHoveSingleVector", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_85vanHoveSingleVector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_84vanHoveSingleVector}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_85vanHoveSingleVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vanHoveSingleVector (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1529, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_histogram,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1529, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histogram)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1529, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("vanHoveSingleVector", 1, 2, 2, 1); __PYX_ERR(0, 1529, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "vanHoveSingleVector") < 0)) __PYX_ERR(0, 1529, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1530, __pyx_L3_error) + __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 1530, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("vanHoveSingleVector", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1529, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.vanHoveSingleVector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_84vanHoveSingleVector(__pyx_self, __pyx_v_timeseries, __pyx_v_histogram); - /* "View.MemoryView":1221 - * cdef void *result - * - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef size_t size = slice_get_size(src, ndim) - * - */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":1222 - * - * cdef size_t itemsize = src.memview.view.itemsize - * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< - * - * result = malloc(size) - */ - __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - - /* "View.MemoryView":1224 - * cdef size_t size = slice_get_size(src, ndim) - * - * result = malloc(size) # <<<<<<<<<<<<<< - * if not result: - * _err(MemoryError, NULL) - */ - __pyx_v_result = malloc(__pyx_v_size); + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1225 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) - * - */ - __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0); - if (__pyx_t_2) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_84vanHoveSingleVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_histogram) { + int __pyx_v_correlation_length; + int __pyx_v_cos_segs; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + __Pyx_RefNannySetupContext("vanHoveSingleVector", 0); - /* "View.MemoryView":1226 - * result = malloc(size) - * if not result: - * _err(MemoryError, NULL) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1536 + * """ * + * cdef int correlation_length = timeseries.shape[0] # <<<<<<<<<<<<<< + * cdef int cos_segs = histogram.shape[1] * */ - __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1226, __pyx_L1_error) + __pyx_v_correlation_length = (__pyx_v_timeseries.shape[0]); - /* "View.MemoryView":1225 + /* "newanalysis/helpers/miscellaneous.pyx":1537 * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) + * cdef int correlation_length = timeseries.shape[0] + * cdef int cos_segs = histogram.shape[1] # <<<<<<<<<<<<<< * + * calcVanHoveSingleVector(×eries[0,0], &histogram[0,0], correlation_length, cos_segs) */ - } + __pyx_v_cos_segs = (__pyx_v_histogram.shape[1]); - /* "View.MemoryView":1229 + /* "newanalysis/helpers/miscellaneous.pyx":1539 + * cdef int cos_segs = histogram.shape[1] * + * calcVanHoveSingleVector(×eries[0,0], &histogram[0,0], correlation_length, cos_segs) # <<<<<<<<<<<<<< * - * tmpslice.data = result # <<<<<<<<<<<<<< - * tmpslice.memview = src.memview - * for i in range(ndim): + * @cython.boundscheck(False) */ - __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_histogram.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_histogram.shape[1]; + calcVanHoveSingleVector((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_3 * __pyx_v_histogram.strides[0]) ) + __pyx_t_4 * __pyx_v_histogram.strides[1]) )))), __pyx_v_correlation_length, __pyx_v_cos_segs); - /* "View.MemoryView":1230 + /* "newanalysis/helpers/miscellaneous.pyx":1529 + * result[i][j][k] /= counter[i][j] * - * tmpslice.data = result - * tmpslice.memview = src.memview # <<<<<<<<<<<<<< - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vanHoveSingleVector(double[:,:] timeseries, double[:,:] histogram): + * """ */ - __pyx_t_4 = __pyx_v_src->memview; - __pyx_v_tmpslice->memview = __pyx_t_4; - /* "View.MemoryView":1231 - * tmpslice.data = result - * tmpslice.memview = src.memview - * for i in range(ndim): # <<<<<<<<<<<<<< - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 - */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1232 - * tmpslice.memview = src.memview - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< - * tmpslice.suboffsets[i] = -1 +/* "newanalysis/helpers/miscellaneous.pyx":1541 + * calcVanHoveSingleVector(×eries[0,0], &histogram[0,0], correlation_length, cos_segs) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vanHoveMultiVector(double[:,:,:] timeseries, double[:,:] histogram): + * """ */ - (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - /* "View.MemoryView":1233 - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, - */ - (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_87vanHoveMultiVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_86vanHoveMultiVector, "\n timeseries ... (n_particles * correlation_length * 3)\n histogram ... (correlation_length * cos_segs)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_87vanHoveMultiVector = {"vanHoveMultiVector", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_87vanHoveMultiVector, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_86vanHoveMultiVector}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_87vanHoveMultiVector(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_timeseries = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_histogram = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vanHoveMultiVector (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1541, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeseries,&__pyx_n_s_histogram,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeseries)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1541, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_histogram)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1541, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("vanHoveMultiVector", 1, 2, 2, 1); __PYX_ERR(0, 1541, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "vanHoveMultiVector") < 0)) __PYX_ERR(0, 1541, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_timeseries = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_timeseries.memview)) __PYX_ERR(0, 1542, __pyx_L3_error) + __pyx_v_histogram = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_histogram.memview)) __PYX_ERR(0, 1542, __pyx_L3_error) } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("vanHoveMultiVector", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1541, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.vanHoveMultiVector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_86vanHoveMultiVector(__pyx_self, __pyx_v_timeseries, __pyx_v_histogram); - /* "View.MemoryView":1235 - * tmpslice.suboffsets[i] = -1 - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< - * ndim, order) - * - */ - (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - - /* "View.MemoryView":1239 - * - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 - */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * - */ - __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1241 - * for i in range(ndim): - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< - * - * if slice_is_contig(src[0], order, ndim): - */ - (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * - */ + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_timeseries, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_histogram, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: - */ - __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0); - if (__pyx_t_2) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_86vanHoveMultiVector(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_timeseries, __Pyx_memviewslice __pyx_v_histogram) { + int __pyx_v_n_particles; + int __pyx_v_correlation_length; + int __pyx_v_cos_segs; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + __Pyx_RefNannySetupContext("vanHoveMultiVector", 0); - /* "View.MemoryView":1244 + /* "newanalysis/helpers/miscellaneous.pyx":1548 + * """ * - * if slice_is_contig(src[0], order, ndim): - * memcpy(result, src.data, size) # <<<<<<<<<<<<<< - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * cdef int n_particles = timeseries.shape[0] # <<<<<<<<<<<<<< + * cdef int correlation_length = timeseries.shape[1] + * cdef int cos_segs = histogram.shape[1] */ - (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + __pyx_v_n_particles = (__pyx_v_timeseries.shape[0]); - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 + /* "newanalysis/helpers/miscellaneous.pyx":1549 * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: - */ - goto __pyx_L9; - } - - /* "View.MemoryView":1246 - * memcpy(result, src.data, size) - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + * cdef int n_particles = timeseries.shape[0] + * cdef int correlation_length = timeseries.shape[1] # <<<<<<<<<<<<<< + * cdef int cos_segs = histogram.shape[1] * - * return result */ - /*else*/ { - copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); - } - __pyx_L9:; + __pyx_v_correlation_length = (__pyx_v_timeseries.shape[1]); - /* "View.MemoryView":1248 - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + /* "newanalysis/helpers/miscellaneous.pyx":1550 + * cdef int n_particles = timeseries.shape[0] + * cdef int correlation_length = timeseries.shape[1] + * cdef int cos_segs = histogram.shape[1] # <<<<<<<<<<<<<< * - * return result # <<<<<<<<<<<<<< + * calcVanHoveMultiVector(×eries[0,0,0], &histogram[0,0], n_particles, correlation_length, cos_segs) + */ + __pyx_v_cos_segs = (__pyx_v_histogram.shape[1]); + + /* "newanalysis/helpers/miscellaneous.pyx":1552 + * cdef int cos_segs = histogram.shape[1] * + * calcVanHoveMultiVector(×eries[0,0,0], &histogram[0,0], n_particles, correlation_length, cos_segs) # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_timeseries.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_timeseries.shape[1]; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_timeseries.shape[2]; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_histogram.shape[0]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_histogram.shape[1]; + calcVanHoveMultiVector((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_timeseries.data + __pyx_t_1 * __pyx_v_timeseries.strides[0]) ) + __pyx_t_2 * __pyx_v_timeseries.strides[1]) ) + __pyx_t_3 * __pyx_v_timeseries.strides[2]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_histogram.data + __pyx_t_4 * __pyx_v_histogram.strides[0]) ) + __pyx_t_5 * __pyx_v_histogram.strides[1]) )))), __pyx_v_n_particles, __pyx_v_correlation_length, __pyx_v_cos_segs); - /* "View.MemoryView":1210 + /* "newanalysis/helpers/miscellaneous.pyx":1541 + * calcVanHoveSingleVector(×eries[0,0], &histogram[0,0], correlation_length, cos_segs) * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vanHoveMultiVector(double[:,:,:] timeseries, double[:,:] histogram): + * """ */ /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = NULL; - __pyx_L0:; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1253 +/* "newanalysis/helpers/miscellaneous.pyx":1554 + * calcVanHoveMultiVector(×eries[0,0,0], &histogram[0,0], n_particles, correlation_length, cos_segs) * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sortCollectiveDipNNShells(char[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): + * """ */ -static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_89sortCollectiveDipNNShells(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_88sortCollectiveDipNNShells, "\n ds ... (n_particles, n_particles)\n dip_wat ... (n_particles, 3)\n dip_shell ... (n_shells, 3)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_89sortCollectiveDipNNShells = {"sortCollectiveDipNNShells", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_89sortCollectiveDipNNShells, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_88sortCollectiveDipNNShells}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_89sortCollectiveDipNNShells(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip_wat = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip_shell = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sortCollectiveDipNNShells (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1554, __pyx_L3_error) #endif - __Pyx_RefNannySetupContext("_err_extents", 0); + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_dip_wat,&__pyx_n_s_dip_shell,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1554, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_wat)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1554, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShells", 1, 3, 3, 1); __PYX_ERR(0, 1554, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_shell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1554, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShells", 1, 3, 3, 2); __PYX_ERR(0, 1554, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sortCollectiveDipNNShells") < 0)) __PYX_ERR(0, 1554, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1555, __pyx_L3_error) + __pyx_v_dip_wat = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_wat.memview)) __PYX_ERR(0, 1555, __pyx_L3_error) + __pyx_v_dip_shell = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_shell.memview)) __PYX_ERR(0, 1555, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShells", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1554, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_wat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_shell, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.sortCollectiveDipNNShells", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_88sortCollectiveDipNNShells(__pyx_self, __pyx_v_ds, __pyx_v_dip_wat, __pyx_v_dip_shell); - /* "View.MemoryView":1256 - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % - * (i, extent1, extent2)) # <<<<<<<<<<<<<< + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_wat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_shell, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_88sortCollectiveDipNNShells(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_dip_wat, __Pyx_memviewslice __pyx_v_dip_shell) { + int __pyx_v_n_particles; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + __Pyx_RefNannySetupContext("sortCollectiveDipNNShells", 0); + + /* "newanalysis/helpers/miscellaneous.pyx":1562 + * """ + * + * cdef int n_particles = dip_wat.shape[0] # <<<<<<<<<<<<<< + * sort_collective_dip_NN_shells(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) * - * @cname('__pyx_memoryview_err_dim') */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; + __pyx_v_n_particles = (__pyx_v_dip_wat.shape[0]); - /* "View.MemoryView":1255 - * cdef int _err_extents(int i, Py_ssize_t extent1, - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<< - * (i, extent1, extent2)) + /* "newanalysis/helpers/miscellaneous.pyx":1563 * + * cdef int n_particles = dip_wat.shape[0] + * sort_collective_dip_NN_shells(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 1255, __pyx_L1_error) + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_ds.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_ds.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_dip_wat.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[1]; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dip_shell.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dip_shell.shape[1]; + sort_collective_dip_NN_shells((&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_1 * __pyx_v_ds.strides[0]) ) + __pyx_t_2 * __pyx_v_ds.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_3 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_4 * __pyx_v_dip_wat.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_shell.data + __pyx_t_5 * __pyx_v_dip_shell.strides[0]) ) + __pyx_t_6 * __pyx_v_dip_shell.strides[1]) )))), __pyx_v_n_particles); - /* "View.MemoryView":1253 + /* "newanalysis/helpers/miscellaneous.pyx":1554 + * calcVanHoveMultiVector(×eries[0,0,0], &histogram[0,0], n_particles, correlation_length, cos_segs) * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sortCollectiveDipNNShells(char[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): + * """ */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif return __pyx_r; } -/* "View.MemoryView":1259 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) +/* "newanalysis/helpers/miscellaneous.pyx":1565 + * sort_collective_dip_NN_shells(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sortCollectiveDipNNShellsInt(int[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): + * """ */ -static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_91sortCollectiveDipNNShellsInt(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_90sortCollectiveDipNNShellsInt, "\n ds ... (n_particles, n_particles)\n dip_wat ... (n_particles, 3)\n dip_shell ... (n_shells, 3)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_91sortCollectiveDipNNShellsInt = {"sortCollectiveDipNNShellsInt", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_91sortCollectiveDipNNShellsInt, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_90sortCollectiveDipNNShellsInt}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_91sortCollectiveDipNNShellsInt(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip_wat = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_dip_shell = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sortCollectiveDipNNShellsInt (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1565, __pyx_L3_error) #endif - __Pyx_RefNannySetupContext("_err_dim", 0); - __Pyx_INCREF(__pyx_v_error); - - /* "View.MemoryView":1260 - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: - * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err') - */ - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_v_error); - __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_dip_wat,&__pyx_n_s_dip_shell,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1565, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_wat)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1565, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShellsInt", 1, 3, 3, 1); __PYX_ERR(0, 1565, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dip_shell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1565, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShellsInt", 1, 3, 3, 2); __PYX_ERR(0, 1565, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sortCollectiveDipNNShellsInt") < 0)) __PYX_ERR(0, 1565, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1566, __pyx_L3_error) + __pyx_v_dip_wat = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_wat.memview)) __PYX_ERR(0, 1566, __pyx_L3_error) + __pyx_v_dip_shell = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dip_shell.memview)) __PYX_ERR(0, 1566, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("sortCollectiveDipNNShellsInt", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1565, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 1260, __pyx_L1_error) - - /* "View.MemoryView":1259 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) - * - */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_wat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_shell, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.sortCollectiveDipNNShellsInt", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_90sortCollectiveDipNNShellsInt(__pyx_self, __pyx_v_ds, __pyx_v_dip_wat, __pyx_v_dip_shell); /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_wat, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dip_shell, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif return __pyx_r; } -/* "View.MemoryView":1263 - * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) - */ - -static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { - int __pyx_r; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_90sortCollectiveDipNNShellsInt(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_dip_wat, __Pyx_memviewslice __pyx_v_dip_shell) { + int __pyx_v_n_particles; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err", 0); - __Pyx_INCREF(__pyx_v_error); - - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: - */ - __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":1265 - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: - * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< - * else: - * raise error - */ - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_error); - __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 1265, __pyx_L1_error) + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + __Pyx_RefNannySetupContext("sortCollectiveDipNNShellsInt", 0); - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1573 + * """ + * + * cdef int n_particles = dip_wat.shape[0] # <<<<<<<<<<<<<< + * sort_collective_dip_NN_shells_int(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) + * */ - } + __pyx_v_n_particles = (__pyx_v_dip_wat.shape[0]); - /* "View.MemoryView":1267 - * raise error(msg.decode('ascii')) - * else: - * raise error # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1574 * - * @cname('__pyx_memoryview_copy_contents') + * cdef int n_particles = dip_wat.shape[0] + * sort_collective_dip_NN_shells_int(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - /*else*/ { - __Pyx_Raise(__pyx_v_error, 0, 0, 0); - __PYX_ERR(2, 1267, __pyx_L1_error) - } + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_ds.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_ds.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_dip_wat.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_dip_wat.shape[1]; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dip_shell.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dip_shell.shape[1]; + sort_collective_dip_NN_shells_int((&(*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_1 * __pyx_v_ds.strides[0]) ) + __pyx_t_2 * __pyx_v_ds.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_wat.data + __pyx_t_3 * __pyx_v_dip_wat.strides[0]) ) + __pyx_t_4 * __pyx_v_dip_wat.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dip_shell.data + __pyx_t_5 * __pyx_v_dip_shell.strides[0]) ) + __pyx_t_6 * __pyx_v_dip_shell.strides[1]) )))), __pyx_v_n_particles); - /* "View.MemoryView":1263 + /* "newanalysis/helpers/miscellaneous.pyx":1565 + * sort_collective_dip_NN_shells(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sortCollectiveDipNNShellsInt(int[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): + * """ */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif return __pyx_r; } -/* "View.MemoryView":1270 +/* "newanalysis/helpers/miscellaneous.pyx":1576 + * sort_collective_dip_NN_shells_int(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective(double[:,:] coor, double[:] results): + * """ */ -static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { - void *__pyx_v_tmpdata; - size_t __pyx_v_itemsize; - int __pyx_v_i; - char __pyx_v_order; - int __pyx_v_broadcasting; - int __pyx_v_direct_copy; - __Pyx_memviewslice __pyx_v_tmp; - int __pyx_v_ndim; - int __pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - void *__pyx_t_7; - int __pyx_t_8; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_93calcDipTenCollective(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_92calcDipTenCollective, "\n coor ... (n_particles, 3)\n results ... (6) \n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_93calcDipTenCollective = {"calcDipTenCollective", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_93calcDipTenCollective, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_92calcDipTenCollective}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_93calcDipTenCollective(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDipTenCollective (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1576, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_results,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1576, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_results)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1576, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollective", 1, 2, 2, 1); __PYX_ERR(0, 1576, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDipTenCollective") < 0)) __PYX_ERR(0, 1576, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1577, __pyx_L3_error) + __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1577, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDipTenCollective", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1576, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollective", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_92calcDipTenCollective(__pyx_self, __pyx_v_coor, __pyx_v_results); - /* "View.MemoryView":1278 - * Check for overlapping memory and verify the shapes. - * """ - * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - */ - __pyx_v_tmpdata = NULL; - - /* "View.MemoryView":1279 - * """ - * cdef void *tmpdata = NULL - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - */ - __pyx_t_1 = __pyx_v_src.memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; - - /* "View.MemoryView":1281 - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< - * cdef bint broadcasting = False - * cdef bint direct_copy = False - */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1282 - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False # <<<<<<<<<<<<<< - * cdef bint direct_copy = False - * cdef __Pyx_memviewslice tmp - */ - __pyx_v_broadcasting = 0; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_92calcDipTenCollective(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_results) { + int __pyx_v_n_particles; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + __Pyx_RefNannySetupContext("calcDipTenCollective", 0); - /* "View.MemoryView":1283 - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False - * cdef bint direct_copy = False # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/miscellaneous.pyx":1582 + * results ... (6) + * """ + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< * + * calc_dip_ten_collective(&coor[0,0], n_particles, &results[0]) */ - __pyx_v_direct_copy = 0; + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/miscellaneous.pyx":1584 + * cdef int n_particles = coor.shape[0] * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - */ - __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1287 + * calc_dip_ten_collective(&coor[0,0], n_particles, &results[0]) # <<<<<<<<<<<<<< * - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) + * @cython.boundscheck(False) */ - __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + __pyx_t_3 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_results.shape[0]; + calc_dip_ten_collective((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((double *) ( /* dim=0 */ (__pyx_v_results.data + __pyx_t_3 * __pyx_v_results.strides[0]) ))))); - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/miscellaneous.pyx":1576 + * sort_collective_dip_NN_shells_int(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective(double[:,:] coor, double[:] results): + * """ */ - goto __pyx_L3; - } - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - */ - __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0); - if (__pyx_t_2) { + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1289 - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< +/* "newanalysis/helpers/miscellaneous.pyx":1586 + * calc_dip_ten_collective(&coor[0,0], n_particles, &results[0]) * - * cdef int ndim = max(src_ndim, dst_ndim) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectivePerAtom(int idx, double[:,:] coor, double[:] results): + * """ */ - __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - */ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_95calcDipTenCollectivePerAtom(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_94calcDipTenCollectivePerAtom, "\n coor ... (n_particles, 3)\n results ... (6) \n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_95calcDipTenCollectivePerAtom = {"calcDipTenCollectivePerAtom", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_95calcDipTenCollectivePerAtom, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_94calcDipTenCollectivePerAtom}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_95calcDipTenCollectivePerAtom(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + int __pyx_v_idx; + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDipTenCollectivePerAtom (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1586, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_coor,&__pyx_n_s_results,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idx)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1586, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1586, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectivePerAtom", 1, 3, 3, 1); __PYX_ERR(0, 1586, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_results)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1586, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectivePerAtom", 1, 3, 3, 2); __PYX_ERR(0, 1586, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDipTenCollectivePerAtom") < 0)) __PYX_ERR(0, 1586, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_idx = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1587, __pyx_L3_error) + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1587, __pyx_L3_error) + __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1587, __pyx_L3_error) } - __pyx_L3:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectivePerAtom", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1586, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectivePerAtom", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_94calcDipTenCollectivePerAtom(__pyx_self, __pyx_v_idx, __pyx_v_coor, __pyx_v_results); - /* "View.MemoryView":1291 - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * - * for i in range(ndim): - */ - __pyx_t_3 = __pyx_v_dst_ndim; - __pyx_t_4 = __pyx_v_src_ndim; - if (((__pyx_t_3 > __pyx_t_4) != 0)) { - __pyx_t_5 = __pyx_t_3; - } else { - __pyx_t_5 = __pyx_t_4; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_v_ndim = __pyx_t_5; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1293 - * cdef int ndim = max(src_ndim, dst_ndim) +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_94calcDipTenCollectivePerAtom(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_idx, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_results) { + int __pyx_v_n_particles; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + __Pyx_RefNannySetupContext("calcDipTenCollectivePerAtom", 0); + + /* "newanalysis/helpers/miscellaneous.pyx":1592 + * results ... (6) + * """ + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: + * calc_dip_ten_collective_per_atom(idx, &coor[0,0], n_particles, &results[0]) */ - __pyx_t_5 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_5; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":1294 + /* "newanalysis/helpers/miscellaneous.pyx":1594 + * cdef int n_particles = coor.shape[0] * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + * calc_dip_ten_collective_per_atom(idx, &coor[0,0], n_particles, &results[0]) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0); - if (__pyx_t_2) { + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + __pyx_t_3 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_results.shape[0]; + calc_dip_ten_collective_per_atom(__pyx_v_idx, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((double *) ( /* dim=0 */ (__pyx_v_results.data + __pyx_t_3 * __pyx_v_results.strides[0]) ))))); - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/helpers/miscellaneous.pyx":1586 + * calc_dip_ten_collective(&coor[0,0], n_particles, &results[0]) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectivePerAtom(int idx, double[:,:] coor, double[:] results): + * """ */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1296 - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - * broadcasting = True # <<<<<<<<<<<<<< - * src.strides[i] = 0 - * else: - */ - __pyx_v_broadcasting = 1; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1297 - * if src.shape[i] == 1: - * broadcasting = True - * src.strides[i] = 0 # <<<<<<<<<<<<<< - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) +/* "newanalysis/helpers/miscellaneous.pyx":1596 + * calc_dip_ten_collective_per_atom(idx, &coor[0,0], n_particles, &results[0]) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveCross(double[:,:] coor1, double[:,:] coor2, double[:] results): + * """ */ - (__pyx_v_src.strides[__pyx_v_i]) = 0; - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 - */ - goto __pyx_L7; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_97calcDipTenCollectiveCross(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_96calcDipTenCollectiveCross, "\n coor1 ... (n_particles1, 3)\n coor2 ... (n_particles2, 3)\n results ... (6) \n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_97calcDipTenCollectiveCross = {"calcDipTenCollectiveCross", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_97calcDipTenCollectiveCross, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_96calcDipTenCollectiveCross}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_97calcDipTenCollectiveCross(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDipTenCollectiveCross (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1596, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_results,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - - /* "View.MemoryView":1299 - * src.strides[i] = 0 - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< - * - * if src.suboffsets[i] >= 0: - */ - /*else*/ { - __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1299, __pyx_L1_error) + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1596, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1596, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveCross", 1, 3, 3, 1); __PYX_ERR(0, 1596, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_results)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1596, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveCross", 1, 3, 3, 2); __PYX_ERR(0, 1596, __pyx_L3_error) + } } - __pyx_L7:; - - /* "View.MemoryView":1294 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True - */ + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDipTenCollectiveCross") < 0)) __PYX_ERR(0, 1596, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); } + __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 1597, __pyx_L3_error) + __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 1597, __pyx_L3_error) + __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1597, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveCross", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1596, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveCross", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_96calcDipTenCollectiveCross(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_results); - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - */ - __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1302 - * - * if src.suboffsets[i] >= 0: - * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< - * - * if slices_overlap(&src, &dst, ndim, itemsize): - */ - __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1302, __pyx_L1_error) - - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - */ + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): - */ - __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0); - if (__pyx_t_2) { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_96calcDipTenCollectiveCross(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, __Pyx_memviewslice __pyx_v_results) { + int __pyx_v_n_particles1; + int __pyx_v_n_particles2; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + __Pyx_RefNannySetupContext("calcDipTenCollectiveCross", 0); - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) + /* "newanalysis/helpers/miscellaneous.pyx":1603 + * results ... (6) + * """ + * cdef int n_particles1 = coor1.shape[0] # <<<<<<<<<<<<<< + * cdef int n_particles2 = coor2.shape[0] * */ - __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0); - if (__pyx_t_2) { + __pyx_v_n_particles1 = (__pyx_v_coor1.shape[0]); - /* "View.MemoryView":1307 - * - * if not slice_is_contig(src, order, ndim): - * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1604 + * """ + * cdef int n_particles1 = coor1.shape[0] + * cdef int n_particles2 = coor2.shape[0] # <<<<<<<<<<<<<< * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * calc_dip_ten_collective_cross(&coor1[0,0], n_particles1, &coor2[0,0], n_particles2, &results[0]) */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + __pyx_v_n_particles2 = (__pyx_v_coor2.shape[0]); - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) + /* "newanalysis/helpers/miscellaneous.pyx":1606 + * cdef int n_particles2 = coor2.shape[0] * - */ - } - - /* "View.MemoryView":1309 - * order = get_best_order(&dst, ndim) + * calc_dip_ten_collective_cross(&coor1[0,0], n_particles1, &coor2[0,0], n_particles2, &results[0]) # <<<<<<<<<<<<<< * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< - * src = tmp * */ - __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1309, __pyx_L1_error) - __pyx_v_tmpdata = __pyx_t_7; + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor1.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor1.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor2.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor2.shape[1]; + __pyx_t_5 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_results.shape[0]; + calc_dip_ten_collective_cross((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor1.data + __pyx_t_1 * __pyx_v_coor1.strides[0]) ) + __pyx_t_2 * __pyx_v_coor1.strides[1]) )))), __pyx_v_n_particles1, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor2.data + __pyx_t_3 * __pyx_v_coor2.strides[0]) ) + __pyx_t_4 * __pyx_v_coor2.strides[1]) )))), __pyx_v_n_particles2, (&(*((double *) ( /* dim=0 */ (__pyx_v_results.data + __pyx_t_5 * __pyx_v_results.strides[0]) ))))); - /* "View.MemoryView":1310 - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) - * src = tmp # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1596 + * calc_dip_ten_collective_per_atom(idx, &coor[0,0], n_particles, &results[0]) * - * if not broadcasting: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveCross(double[:,:] coor1, double[:,:] coor2, double[:] results): + * """ */ - __pyx_v_src = __pyx_v_tmp; - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): - */ - } + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< +/* "newanalysis/helpers/miscellaneous.pyx":1609 * * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwise(double[:,:] coor, char [:,:] ds, double[:,:] results): + * """ */ - __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1315 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0); - if (__pyx_t_2) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_99calcDipTenCollectiveNNShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_98calcDipTenCollectiveNNShellwise, "\n coor ... (n_particles, 3)\n ds ... (n_particles, n_particles)\n results ... (shells, 6)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_99calcDipTenCollectiveNNShellwise = {"calcDipTenCollectiveNNShellwise", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_99calcDipTenCollectiveNNShellwise, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_98calcDipTenCollectiveNNShellwise}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_99calcDipTenCollectiveNNShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwise (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1609, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_ds,&__pyx_n_s_results,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwise", 1, 3, 3, 1); __PYX_ERR(0, 1609, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_results)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1609, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwise", 1, 3, 3, 2); __PYX_ERR(0, 1609, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDipTenCollectiveNNShellwise") < 0)) __PYX_ERR(0, 1609, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1610, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1610, __pyx_L3_error) + __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1610, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwise", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1609, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveNNShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_98calcDipTenCollectiveNNShellwise(__pyx_self, __pyx_v_coor, __pyx_v_ds, __pyx_v_results); - /* "View.MemoryView":1316 - * - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) - */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_98calcDipTenCollectiveNNShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_results) { + int __pyx_v_n_particles; + int __pyx_v_shells; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwise", 0); - /* "View.MemoryView":1315 - * + /* "newanalysis/helpers/miscellaneous.pyx":1616 + * results ... (shells, 6) + * """ + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< + * cdef int shells = results.shape[0] * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): */ - goto __pyx_L12; - } + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/helpers/miscellaneous.pyx":1617 + * """ + * cdef int n_particles = coor.shape[0] + * cdef int shells = results.shape[0] # <<<<<<<<<<<<<< * + * calc_dip_ten_collective_NNshellwise(&coor[0,0], n_particles, &ds[0,0], shells, &results[0,0]) */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_v_shells = (__pyx_v_results.shape[0]); - /* "View.MemoryView":1318 - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1619 + * cdef int shells = results.shape[0] + * + * calc_dip_ten_collective_NNshellwise(&coor[0,0], n_particles, &ds[0,0], shells, &results[0,0]) # <<<<<<<<<<<<<< * - * if direct_copy: - */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) * */ - } - __pyx_L12:; + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_ds.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds.shape[1]; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_results.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_results.shape[1]; + calc_dip_ten_collective_NNshellwise((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_3 * __pyx_v_ds.strides[0]) ) + __pyx_t_4 * __pyx_v_ds.strides[1]) )))), __pyx_v_shells, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_5 * __pyx_v_results.strides[0]) ) + __pyx_t_6 * __pyx_v_results.strides[1]) ))))); - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/helpers/miscellaneous.pyx":1609 * - * if direct_copy: # <<<<<<<<<<<<<< * - * refcount_copying(&dst, dtype_is_object, ndim, False) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwise(double[:,:] coor, char [:,:] ds, double[:,:] results): + * """ */ - __pyx_t_2 = (__pyx_v_direct_copy != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1322 - * if direct_copy: - * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1323 +/* "newanalysis/helpers/miscellaneous.pyx":1622 * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwiseSelf(double[:,:] coor, int[:] f2c, char [:,:] ds, int ds_idx, double[:,:] results): + * """ */ - (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - /* "View.MemoryView":1324 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * free(tmpdata) - * return 0 +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_101calcDipTenCollectiveNNShellwiseSelf(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_100calcDipTenCollectiveNNShellwiseSelf, "\n coor ... (n_particles, 3)\n ds ... (n_particles_tot, n_particles_tot)\n results ... (shells, 6)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_101calcDipTenCollectiveNNShellwiseSelf = {"calcDipTenCollectiveNNShellwiseSelf", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_101calcDipTenCollectiveNNShellwiseSelf, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_100calcDipTenCollectiveNNShellwiseSelf}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_101calcDipTenCollectiveNNShellwiseSelf(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_f2c = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_ds_idx; + __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwiseSelf (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1622, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_f2c,&__pyx_n_s_ds,&__pyx_n_s_ds_idx,&__pyx_n_s_results,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1622, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_f2c)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1622, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseSelf", 1, 5, 5, 1); __PYX_ERR(0, 1622, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1622, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseSelf", 1, 5, 5, 2); __PYX_ERR(0, 1622, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds_idx)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1622, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseSelf", 1, 5, 5, 3); __PYX_ERR(0, 1622, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_results)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1622, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseSelf", 1, 5, 5, 4); __PYX_ERR(0, 1622, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDipTenCollectiveNNShellwiseSelf") < 0)) __PYX_ERR(0, 1622, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 5)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1623, __pyx_L3_error) + __pyx_v_f2c = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_f2c.memview)) __PYX_ERR(0, 1623, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1623, __pyx_L3_error) + __pyx_v_ds_idx = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_ds_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1623, __pyx_L3_error) + __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1623, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseSelf", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1622, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_f2c, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveNNShellwiseSelf", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_100calcDipTenCollectiveNNShellwiseSelf(__pyx_self, __pyx_v_coor, __pyx_v_f2c, __pyx_v_ds, __pyx_v_ds_idx, __pyx_v_results); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_f2c, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_100calcDipTenCollectiveNNShellwiseSelf(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_ds_idx, __Pyx_memviewslice __pyx_v_results) { + int __pyx_v_n_particles; + int __pyx_v_n_particles_tot; + int __pyx_v_shells; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwiseSelf", 0); + + /* "newanalysis/helpers/miscellaneous.pyx":1629 + * results ... (shells, 6) + * """ + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< + * cdef int n_particles_tot = ds.shape[0] + * cdef int shells = results.shape[0] */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":1325 - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 + /* "newanalysis/helpers/miscellaneous.pyx":1630 + * """ + * cdef int n_particles = coor.shape[0] + * cdef int n_particles_tot = ds.shape[0] # <<<<<<<<<<<<<< + * cdef int shells = results.shape[0] * */ - free(__pyx_v_tmpdata); + __pyx_v_n_particles_tot = (__pyx_v_ds.shape[0]); - /* "View.MemoryView":1326 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1631 + * cdef int n_particles = coor.shape[0] + * cdef int n_particles_tot = ds.shape[0] + * cdef int shells = results.shape[0] # <<<<<<<<<<<<<< * - * if order == 'F' == get_best_order(&dst, ndim): + * calc_dip_ten_collective_NNshellwise_self(&coor[0,0], &f2c[0], n_particles, n_particles_tot, &ds[0,0], ds_idx, shells, &results[0,0]) */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_v_shells = (__pyx_v_results.shape[0]); - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/helpers/miscellaneous.pyx":1633 + * cdef int shells = results.shape[0] + * + * calc_dip_ten_collective_NNshellwise_self(&coor[0,0], &f2c[0], n_particles, n_particles_tot, &ds[0,0], ds_idx, shells, &results[0,0]) # <<<<<<<<<<<<<< * - * if direct_copy: # <<<<<<<<<<<<<< * - * refcount_copying(&dst, dtype_is_object, ndim, False) */ - } + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + __pyx_t_3 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_f2c.shape[0]; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds.shape[0]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_ds.shape[1]; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_results.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_results.shape[1]; + calc_dip_ten_collective_NNshellwise_self((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_f2c.data + __pyx_t_3 * __pyx_v_f2c.strides[0]) )))), __pyx_v_n_particles, __pyx_v_n_particles_tot, (&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_4 * __pyx_v_ds.strides[0]) ) + __pyx_t_5 * __pyx_v_ds.strides[1]) )))), __pyx_v_ds_idx, __pyx_v_shells, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_6 * __pyx_v_results.strides[0]) ) + __pyx_t_7 * __pyx_v_results.strides[1]) ))))); - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1622 * * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwiseSelf(double[:,:] coor, int[:] f2c, char [:,:] ds, int ds_idx, double[:,:] results): + * """ */ - } - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/miscellaneous.pyx":1636 * * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwiseCross(double[:,:] coor1, double[:,:] coor2, int[:] f2c, char [:,:] ds, int ds1_idx, int ds2_idx, double[:,:] results): + * """ */ - __pyx_t_2 = (__pyx_v_order == 'F'); - if (__pyx_t_2) { - __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_103calcDipTenCollectiveNNShellwiseCross(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_102calcDipTenCollectiveNNShellwiseCross, "\n coor1 ... (n_particles1, 3)\n coor2 ... (n_particles2, 3)\n ds ... (n_particles_tot, n_particles_tot)\n results ... (shells, 6)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_103calcDipTenCollectiveNNShellwiseCross = {"calcDipTenCollectiveNNShellwiseCross", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_103calcDipTenCollectiveNNShellwiseCross, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_102calcDipTenCollectiveNNShellwiseCross}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_103calcDipTenCollectiveNNShellwiseCross(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_f2c = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_ds1_idx; + int __pyx_v_ds2_idx; + __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[7] = {0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwiseCross (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1636, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_f2c,&__pyx_n_s_ds,&__pyx_n_s_ds1_idx,&__pyx_n_s_ds2_idx,&__pyx_n_s_results,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1636, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1636, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 1); __PYX_ERR(0, 1636, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_f2c)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1636, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 2); __PYX_ERR(0, 1636, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1636, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 3); __PYX_ERR(0, 1636, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds1_idx)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1636, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 4); __PYX_ERR(0, 1636, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds2_idx)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1636, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 5); __PYX_ERR(0, 1636, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_results)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1636, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, 6); __PYX_ERR(0, 1636, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDipTenCollectiveNNShellwiseCross") < 0)) __PYX_ERR(0, 1636, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 7)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + } + __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 1637, __pyx_L3_error) + __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 1637, __pyx_L3_error) + __pyx_v_f2c = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_f2c.memview)) __PYX_ERR(0, 1637, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1637, __pyx_L3_error) + __pyx_v_ds1_idx = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_ds1_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1637, __pyx_L3_error) + __pyx_v_ds2_idx = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_ds2_idx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1637, __pyx_L3_error) + __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1637, __pyx_L3_error) } - __pyx_t_8 = (__pyx_t_2 != 0); - if (__pyx_t_8) { + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveNNShellwiseCross", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 1636, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_f2c, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveNNShellwiseCross", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_102calcDipTenCollectiveNNShellwiseCross(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_f2c, __pyx_v_ds, __pyx_v_ds1_idx, __pyx_v_ds2_idx, __pyx_v_results); - /* "View.MemoryView":1331 - * - * - * transpose_memslice(&src) # <<<<<<<<<<<<<< - * transpose_memslice(&dst) - * + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_f2c, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_102calcDipTenCollectiveNNShellwiseCross(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_ds1_idx, int __pyx_v_ds2_idx, __Pyx_memviewslice __pyx_v_results) { + int __pyx_v_n_particles1; + int __pyx_v_n_particles2; + int __pyx_v_n_particles_tot; + int __pyx_v_shells; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + __Pyx_RefNannySetupContext("calcDipTenCollectiveNNShellwiseCross", 0); + + /* "newanalysis/helpers/miscellaneous.pyx":1644 + * results ... (shells, 6) + * """ + * cdef int n_particles1 = coor1.shape[0] # <<<<<<<<<<<<<< + * cdef int n_particles2 = coor2.shape[0] + * cdef int n_particles_tot = ds.shape[0] */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1331, __pyx_L1_error) + __pyx_v_n_particles1 = (__pyx_v_coor1.shape[0]); - /* "View.MemoryView":1332 - * - * transpose_memslice(&src) - * transpose_memslice(&dst) # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) + /* "newanalysis/helpers/miscellaneous.pyx":1645 + * """ + * cdef int n_particles1 = coor1.shape[0] + * cdef int n_particles2 = coor2.shape[0] # <<<<<<<<<<<<<< + * cdef int n_particles_tot = ds.shape[0] + * cdef int shells = results.shape[0] */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1332, __pyx_L1_error) + __pyx_v_n_particles2 = (__pyx_v_coor2.shape[0]); - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1646 + * cdef int n_particles1 = coor1.shape[0] + * cdef int n_particles2 = coor2.shape[0] + * cdef int n_particles_tot = ds.shape[0] # <<<<<<<<<<<<<< + * cdef int shells = results.shape[0] * */ - } + __pyx_v_n_particles_tot = (__pyx_v_ds.shape[0]); - /* "View.MemoryView":1334 - * transpose_memslice(&dst) + /* "newanalysis/helpers/miscellaneous.pyx":1647 + * cdef int n_particles2 = coor2.shape[0] + * cdef int n_particles_tot = ds.shape[0] + * cdef int shells = results.shape[0] # <<<<<<<<<<<<<< * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) + * calc_dip_ten_collective_NNshellwise_cross(&coor1[0,0], &coor2[0,0], &f2c[0], n_particles1, n_particles2, n_particles_tot, &ds[0,0], ds1_idx, ds2_idx, shells, &results[0,0]) */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + __pyx_v_shells = (__pyx_v_results.shape[0]); - /* "View.MemoryView":1335 + /* "newanalysis/helpers/miscellaneous.pyx":1649 + * cdef int shells = results.shape[0] * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) + * calc_dip_ten_collective_NNshellwise_cross(&coor1[0,0], &coor2[0,0], &f2c[0], n_particles1, n_particles2, n_particles_tot, &ds[0,0], ds1_idx, ds2_idx, shells, &results[0,0]) # <<<<<<<<<<<<<< * - */ - copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - - /* "View.MemoryView":1336 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< * - * free(tmpdata) */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor1.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor1.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor2.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor2.shape[1]; + __pyx_t_5 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_f2c.shape[0]; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_ds.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_ds.shape[1]; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_results.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_results.shape[1]; + calc_dip_ten_collective_NNshellwise_cross((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor1.data + __pyx_t_1 * __pyx_v_coor1.strides[0]) ) + __pyx_t_2 * __pyx_v_coor1.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor2.data + __pyx_t_3 * __pyx_v_coor2.strides[0]) ) + __pyx_t_4 * __pyx_v_coor2.strides[1]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_f2c.data + __pyx_t_5 * __pyx_v_f2c.strides[0]) )))), __pyx_v_n_particles1, __pyx_v_n_particles2, __pyx_v_n_particles_tot, (&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_6 * __pyx_v_ds.strides[0]) ) + __pyx_t_7 * __pyx_v_ds.strides[1]) )))), __pyx_v_ds1_idx, __pyx_v_ds2_idx, __pyx_v_shells, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_8 * __pyx_v_results.strides[0]) ) + __pyx_t_9 * __pyx_v_results.strides[1]) ))))); - /* "View.MemoryView":1338 - * refcount_copying(&dst, dtype_is_object, ndim, True) + /* "newanalysis/helpers/miscellaneous.pyx":1636 * - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwiseCross(double[:,:] coor1, double[:,:] coor2, int[:] f2c, char [:,:] ds, int ds1_idx, int ds2_idx, double[:,:] results): + * """ */ - free(__pyx_v_tmpdata); - /* "View.MemoryView":1339 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/miscellaneous.pyx":1652 * - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_broadcast_leading') + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective1NShellwiseSelf(double[:,:] coor, char [:] ds, double[:,:,:] results): + * """ */ - __pyx_r = 0; - goto __pyx_L0; - /* "View.MemoryView":1270 - * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_105calcDipTenCollective1NShellwiseSelf(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_104calcDipTenCollective1NShellwiseSelf, "\n coor ... (n_particles, 3)\n ds ... (n_particles)\n results ... (shells, shells, 6)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_105calcDipTenCollective1NShellwiseSelf = {"calcDipTenCollective1NShellwiseSelf", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_105calcDipTenCollective1NShellwiseSelf, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_104calcDipTenCollective1NShellwiseSelf}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_105calcDipTenCollective1NShellwiseSelf(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDipTenCollective1NShellwiseSelf (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1652, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_ds,&__pyx_n_s_results,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1652, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1652, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseSelf", 1, 3, 3, 1); __PYX_ERR(0, 1652, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_results)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1652, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseSelf", 1, 3, 3, 2); __PYX_ERR(0, 1652, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDipTenCollective1NShellwiseSelf") < 0)) __PYX_ERR(0, 1652, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1653, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1653, __pyx_L3_error) + __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1653, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseSelf", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1652, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollective1NShellwiseSelf", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_104calcDipTenCollective1NShellwiseSelf(__pyx_self, __pyx_v_coor, __pyx_v_ds, __pyx_v_results); /* function exit code */ - __pyx_L1_error:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_r = -1; - __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1342 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: - */ - -static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { - int __pyx_v_i; - int __pyx_v_offset; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_104calcDipTenCollective1NShellwiseSelf(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_results) { + int __pyx_v_n_particles; + int __pyx_v_shells; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + __Pyx_RefNannySetupContext("calcDipTenCollective1NShellwiseSelf", 0); - /* "View.MemoryView":1346 - * int ndim_other) nogil: - * cdef int i - * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1659 + * results ... (shells, shells, 6) + * """ + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< + * cdef int shells = results.shape[0] * - * for i in range(ndim - 1, -1, -1): */ - __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":1348 - * cdef int offset = ndim_other - ndim + /* "newanalysis/helpers/miscellaneous.pyx":1660 + * """ + * cdef int n_particles = coor.shape[0] + * cdef int shells = results.shape[0] # <<<<<<<<<<<<<< * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] + * calc_dip_ten_collective_1Nshellwise_self(&coor[0,0], n_particles, &ds[0], shells, &results[0,0,0]) */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; + __pyx_v_shells = (__pyx_v_results.shape[0]); - /* "View.MemoryView":1349 + /* "newanalysis/helpers/miscellaneous.pyx":1662 + * cdef int shells = results.shape[0] * - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - */ - (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - - /* "View.MemoryView":1350 - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + * calc_dip_ten_collective_1Nshellwise_self(&coor[0,0], n_particles, &ds[0], shells, &results[0,0,0]) # <<<<<<<<<<<<<< * - */ - (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1351 - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< * - * for i in range(offset): */ - (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); - } + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + __pyx_t_3 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_ds.shape[0]; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_results.shape[0]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_results.shape[1]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_results.shape[2]; + calc_dip_ten_collective_1Nshellwise_self((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_3 * __pyx_v_ds.strides[0]) )))), __pyx_v_shells, (&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_4 * __pyx_v_results.strides[0]) ) + __pyx_t_5 * __pyx_v_results.strides[1]) ) + __pyx_t_6 * __pyx_v_results.strides[2]) ))))); - /* "View.MemoryView":1353 - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + /* "newanalysis/helpers/miscellaneous.pyx":1652 * - * for i in range(offset): # <<<<<<<<<<<<<< - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - */ - __pyx_t_1 = __pyx_v_offset; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "View.MemoryView":1354 * - * for i in range(offset): - * mslice.shape[i] = 1 # <<<<<<<<<<<<<< - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective1NShellwiseSelf(double[:,:] coor, char [:] ds, double[:,:,:] results): + * """ */ - (__pyx_v_mslice->shape[__pyx_v_i]) = 1; - /* "View.MemoryView":1355 - * for i in range(offset): - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< - * mslice.suboffsets[i] = -1 - * - */ - (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1356 - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< +/* "newanalysis/helpers/miscellaneous.pyx":1665 * * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective1NShellwiseCross(double[:,:] coor1, double[:,:] coor2, char [:] ds, double[:,:] results): + * """ */ - (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; - } - /* "View.MemoryView":1342 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: - */ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_107calcDipTenCollective1NShellwiseCross(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_106calcDipTenCollective1NShellwiseCross, "\n coor1 ... (n_particles1, 3)\n coor2 ... (n_particles2, 3)\n ds ... (n_particles1) #IMPORTANT!\n results ... (shells, 6)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_107calcDipTenCollective1NShellwiseCross = {"calcDipTenCollective1NShellwiseCross", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_107calcDipTenCollective1NShellwiseCross, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_106calcDipTenCollective1NShellwiseCross}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_107calcDipTenCollective1NShellwiseCross(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDipTenCollective1NShellwiseCross (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1665, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_ds,&__pyx_n_s_results,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1665, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1665, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseCross", 1, 4, 4, 1); __PYX_ERR(0, 1665, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1665, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseCross", 1, 4, 4, 2); __PYX_ERR(0, 1665, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_results)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1665, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseCross", 1, 4, 4, 3); __PYX_ERR(0, 1665, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDipTenCollective1NShellwiseCross") < 0)) __PYX_ERR(0, 1665, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 1666, __pyx_L3_error) + __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 1666, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1666, __pyx_L3_error) + __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1666, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDipTenCollective1NShellwiseCross", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1665, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollective1NShellwiseCross", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_106calcDipTenCollective1NShellwiseCross(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_ds, __pyx_v_results); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1364 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: - * - */ +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_106calcDipTenCollective1NShellwiseCross(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, __Pyx_memviewslice __pyx_v_ds, __Pyx_memviewslice __pyx_v_results) { + int __pyx_v_n_particles1; + int __pyx_v_n_particles2; + int __pyx_v_shells; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_RefNannySetupContext("calcDipTenCollective1NShellwiseCross", 0); -static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - int __pyx_t_1; + /* "newanalysis/helpers/miscellaneous.pyx":1673 + * results ... (shells, 6) + * """ + * cdef int n_particles1 = coor1.shape[0] # <<<<<<<<<<<<<< + * cdef int n_particles2 = coor2.shape[0] + * cdef int shells = results.shape[0] + */ + __pyx_v_n_particles1 = (__pyx_v_coor1.shape[0]); - /* "View.MemoryView":1368 - * + /* "newanalysis/helpers/miscellaneous.pyx":1674 + * """ + * cdef int n_particles1 = coor1.shape[0] + * cdef int n_particles2 = coor2.shape[0] # <<<<<<<<<<<<<< + * cdef int shells = results.shape[0] * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) */ - __pyx_t_1 = (__pyx_v_dtype_is_object != 0); - if (__pyx_t_1) { + __pyx_v_n_particles2 = (__pyx_v_coor2.shape[0]); - /* "View.MemoryView":1369 - * - * if dtype_is_object: - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< - * dst.strides, ndim, inc) + /* "newanalysis/helpers/miscellaneous.pyx":1675 + * cdef int n_particles1 = coor1.shape[0] + * cdef int n_particles2 = coor2.shape[0] + * cdef int shells = results.shape[0] # <<<<<<<<<<<<<< * + * calc_dip_ten_collective_1Nshellwise_cross(&coor1[0,0], n_particles1, &coor2[0,0], n_particles2, &ds[0], shells, &results[0,0]) */ - __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + __pyx_v_shells = (__pyx_v_results.shape[0]); - /* "View.MemoryView":1368 + /* "newanalysis/helpers/miscellaneous.pyx":1677 + * cdef int shells = results.shape[0] + * + * calc_dip_ten_collective_1Nshellwise_cross(&coor1[0,0], n_particles1, &coor2[0,0], n_particles2, &ds[0], shells, &results[0,0]) # <<<<<<<<<<<<<< * * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) */ - } + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor1.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor1.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor2.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor2.shape[1]; + __pyx_t_5 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_ds.shape[0]; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_results.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_results.shape[1]; + calc_dip_ten_collective_1Nshellwise_cross((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor1.data + __pyx_t_1 * __pyx_v_coor1.strides[0]) ) + __pyx_t_2 * __pyx_v_coor1.strides[1]) )))), __pyx_v_n_particles1, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor2.data + __pyx_t_3 * __pyx_v_coor2.strides[0]) ) + __pyx_t_4 * __pyx_v_coor2.strides[1]) )))), __pyx_v_n_particles2, (&(*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_5 * __pyx_v_ds.strides[0]) )))), __pyx_v_shells, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_6 * __pyx_v_results.strides[0]) ) + __pyx_t_7 * __pyx_v_results.strides[1]) ))))); - /* "View.MemoryView":1364 + /* "newanalysis/helpers/miscellaneous.pyx":1665 * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective1NShellwiseCross(double[:,:] coor1, double[:,:] coor2, char [:] ds, double[:,:] results): + * """ */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1373 +/* "newanalysis/helpers/miscellaneous.pyx":1681 * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveShellwise(double[:,:] coor, char [:] ds, int maxshell, double[:,:] results): + * """ */ -static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_109calcDipTenCollectiveShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_108calcDipTenCollectiveShellwise, "\n coor ... (n_particles, 3)\n ds ... (n_particles)\n results ... (shells, 6)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_109calcDipTenCollectiveShellwise = {"calcDipTenCollectiveShellwise", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_109calcDipTenCollectiveShellwise, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_108calcDipTenCollectiveShellwise}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_109calcDipTenCollectiveShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell; + __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("calcDipTenCollectiveShellwise (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1681, __pyx_L3_error) #endif - __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - - /* "View.MemoryView":1376 - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - - /* "View.MemoryView":1373 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - */ + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_ds,&__pyx_n_s_maxshell,&__pyx_n_s_results,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1681, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1681, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveShellwise", 1, 4, 4, 1); __PYX_ERR(0, 1681, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1681, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveShellwise", 1, 4, 4, 2); __PYX_ERR(0, 1681, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_results)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1681, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveShellwise", 1, 4, 4, 3); __PYX_ERR(0, 1681, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDipTenCollectiveShellwise") < 0)) __PYX_ERR(0, 1681, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1682, __pyx_L3_error) + __pyx_v_ds = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds.memview)) __PYX_ERR(0, 1682, __pyx_L3_error) + __pyx_v_maxshell = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1682, __pyx_L3_error) + __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1682, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveShellwise", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1681, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_108calcDipTenCollectiveShellwise(__pyx_self, __pyx_v_coor, __pyx_v_ds, __pyx_v_maxshell, __pyx_v_results); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + return __pyx_r; } -/* "View.MemoryView":1379 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i - */ - -static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_108calcDipTenCollectiveShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_ds, int __pyx_v_maxshell, __Pyx_memviewslice __pyx_v_results) { + int __pyx_v_n_particles; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; Py_ssize_t __pyx_t_2; Py_ssize_t __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + __Pyx_RefNannySetupContext("calcDipTenCollectiveShellwise", 0); - /* "View.MemoryView":1383 - * cdef Py_ssize_t i + /* "newanalysis/helpers/miscellaneous.pyx":1688 + * results ... (shells, 6) + * """ + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< * - * for i in range(shape[0]): # <<<<<<<<<<<<<< - * if ndim == 1: - * if inc: + * calc_dip_ten_collective_shellwise(&coor[0,0], n_particles, &ds[0], maxshell, &results[0,0]) */ - __pyx_t_1 = (__pyx_v_shape[0]); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":1384 + /* "newanalysis/helpers/miscellaneous.pyx":1690 + * cdef int n_particles = coor.shape[0] * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) + * calc_dip_ten_collective_shellwise(&coor[0,0], n_particles, &ds[0], maxshell, &results[0,0]) # <<<<<<<<<<<<<< + * + * # Deprecated! */ - __pyx_t_4 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_4) { + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + __pyx_t_3 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_ds.shape[0]; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_results.shape[0]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_results.shape[1]; + calc_dip_ten_collective_shellwise((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((char *) ( /* dim=0 */ (__pyx_v_ds.data + __pyx_t_3 * __pyx_v_ds.strides[0]) )))), __pyx_v_maxshell, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_4 * __pyx_v_results.strides[0]) ) + __pyx_t_5 * __pyx_v_results.strides[1]) ))))); - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: + /* "newanalysis/helpers/miscellaneous.pyx":1681 + * + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveShellwise(double[:,:] coor, char [:] ds, int maxshell, double[:,:] results): + * """ */ - __pyx_t_4 = (__pyx_v_inc != 0); - if (__pyx_t_4) { - /* "View.MemoryView":1386 - * if ndim == 1: - * if inc: - * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * Py_DECREF(( data)[0]) - */ - Py_INCREF((((PyObject **)__pyx_v_data)[0])); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: +/* "newanalysis/helpers/miscellaneous.pyx":1693 + * + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveVennShellwise(double[:,:] coor, char [:] ds1, char [:] ds2, int maxshell1, int maxshell2, double[:,:,:] results): + * """ */ - goto __pyx_L6; - } - /* "View.MemoryView":1388 - * Py_INCREF(( data)[0]) - * else: - * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, - */ - /*else*/ { - Py_DECREF((((PyObject **)__pyx_v_data)[0])); +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_111calcDipTenCollectiveVennShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_110calcDipTenCollectiveVennShellwise, "\n coor ... (n_particles, 3)\n ds1 ... (n_particles)\n ds2 ... (n_particles)\n results ... (shells1, shells2, n_particles)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_111calcDipTenCollectiveVennShellwise = {"calcDipTenCollectiveVennShellwise", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_111calcDipTenCollectiveVennShellwise, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_110calcDipTenCollectiveVennShellwise}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_111calcDipTenCollectiveVennShellwise(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_ds2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_maxshell1; + int __pyx_v_maxshell2; + __Pyx_memviewslice __pyx_v_results = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDipTenCollectiveVennShellwise (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1693, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_ds1,&__pyx_n_s_ds2,&__pyx_n_s_maxshell1,&__pyx_n_s_maxshell2,&__pyx_n_s_results,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1693, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1693, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, 1); __PYX_ERR(0, 1693, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1693, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, 2); __PYX_ERR(0, 1693, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1693, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, 3); __PYX_ERR(0, 1693, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1693, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, 4); __PYX_ERR(0, 1693, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_results)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1693, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, 5); __PYX_ERR(0, 1693, __pyx_L3_error) + } } - __pyx_L6:; + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDipTenCollectiveVennShellwise") < 0)) __PYX_ERR(0, 1693, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 6)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1694, __pyx_L3_error) + __pyx_v_ds1 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds1.memview)) __PYX_ERR(0, 1694, __pyx_L3_error) + __pyx_v_ds2 = __Pyx_PyObject_to_MemoryviewSlice_ds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ds2.memview)) __PYX_ERR(0, 1694, __pyx_L3_error) + __pyx_v_maxshell1 = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_maxshell1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1694, __pyx_L3_error) + __pyx_v_maxshell2 = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_maxshell2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1694, __pyx_L3_error) + __pyx_v_results = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_results.memview)) __PYX_ERR(0, 1694, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDipTenCollectiveVennShellwise", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 1693, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDipTenCollectiveVennShellwise", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_110calcDipTenCollectiveVennShellwise(__pyx_self, __pyx_v_coor, __pyx_v_ds1, __pyx_v_ds2, __pyx_v_maxshell1, __pyx_v_maxshell2, __pyx_v_results); - /* "View.MemoryView":1384 - * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) - */ - goto __pyx_L5; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_ds2, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_results, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1390 - * Py_DECREF(( data)[0]) - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, inc) - * - */ - /*else*/ { +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_110calcDipTenCollectiveVennShellwise(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_ds1, __Pyx_memviewslice __pyx_v_ds2, int __pyx_v_maxshell1, int __pyx_v_maxshell2, __Pyx_memviewslice __pyx_v_results) { + int __pyx_v_n_particles; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_RefNannySetupContext("calcDipTenCollectiveVennShellwise", 0); - /* "View.MemoryView":1391 - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, - * ndim - 1, inc) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1701 + * results ... (shells1, shells2, n_particles) + * """ + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< * - * data += strides[0] + * calc_dip_ten_collective_vennshellwise(&coor[0,0], n_particles, &ds1[0], &ds2[0], maxshell1, maxshell2, &results[0,0,0]) */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); - } - __pyx_L5:; + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":1393 - * ndim - 1, inc) - * - * data += strides[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1703 + * cdef int n_particles = coor.shape[0] * + * calc_dip_ten_collective_vennshellwise(&coor[0,0], n_particles, &ds1[0], &ds2[0], maxshell1, maxshell2, &results[0,0,0]) # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0])); - } + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + __pyx_t_3 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_ds1.shape[0]; + __pyx_t_4 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_ds2.shape[0]; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_results.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_results.shape[1]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_results.shape[2]; + calc_dip_ten_collective_vennshellwise((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, (&(*((char *) ( /* dim=0 */ (__pyx_v_ds1.data + __pyx_t_3 * __pyx_v_ds1.strides[0]) )))), (&(*((char *) ( /* dim=0 */ (__pyx_v_ds2.data + __pyx_t_4 * __pyx_v_ds2.strides[0]) )))), __pyx_v_maxshell1, __pyx_v_maxshell2, (&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_results.data + __pyx_t_5 * __pyx_v_results.strides[0]) ) + __pyx_t_6 * __pyx_v_results.strides[1]) ) + __pyx_t_7 * __pyx_v_results.strides[2]) ))))); - /* "View.MemoryView":1379 + /* "newanalysis/helpers/miscellaneous.pyx":1693 * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveVennShellwise(double[:,:] coor, char [:] ds1, char [:] ds2, int maxshell1, int maxshell2, double[:,:,:] results): + * """ */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1399 +/* "newanalysis/helpers/miscellaneous.pyx":1705 + * calc_dip_ten_collective_vennshellwise(&coor[0,0], n_particles, &ds1[0], &ds2[0], maxshell1, maxshell2, &results[0,0,0]) * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDistanceDelaunyMindist(double[:,:] coor, double boxlength, int number_of_shells, double bin_width=1.0): + * """ */ -static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_113calcDistanceDelaunyMindist(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_112calcDistanceDelaunyMindist, "\n coor ... (n_particles, 3)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_113calcDistanceDelaunyMindist = {"calcDistanceDelaunyMindist", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_113calcDistanceDelaunyMindist, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_112calcDistanceDelaunyMindist}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_113calcDistanceDelaunyMindist(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxlength; + int __pyx_v_number_of_shells; + double __pyx_v_bin_width; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDistanceDelaunyMindist (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1705, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_boxlength,&__pyx_n_s_number_of_shells,&__pyx_n_s_bin_width,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1705, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1705, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDistanceDelaunyMindist", 0, 3, 4, 1); __PYX_ERR(0, 1705, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_number_of_shells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1705, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDistanceDelaunyMindist", 0, 3, 4, 2); __PYX_ERR(0, 1705, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bin_width); + if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1705, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDistanceDelaunyMindist") < 0)) __PYX_ERR(0, 1705, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1706, __pyx_L3_error) + __pyx_v_boxlength = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_boxlength == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1706, __pyx_L3_error) + __pyx_v_number_of_shells = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_number_of_shells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1706, __pyx_L3_error) + if (values[3]) { + __pyx_v_bin_width = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_bin_width == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1706, __pyx_L3_error) + } else { + __pyx_v_bin_width = ((double)((double)1.0)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDistanceDelaunyMindist", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 1705, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDistanceDelaunyMindist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_112calcDistanceDelaunyMindist(__pyx_self, __pyx_v_coor, __pyx_v_boxlength, __pyx_v_number_of_shells, __pyx_v_bin_width); - /* "View.MemoryView":1402 - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1403 - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) - */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_112calcDistanceDelaunyMindist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, double __pyx_v_boxlength, int __pyx_v_number_of_shells, double __pyx_v_bin_width) { + int __pyx_v_n_particles; + __Pyx_memviewslice __pyx_v_delauny_matrix = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcDistanceDelaunyMindist", 0); - /* "View.MemoryView":1405 - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1711 + * """ * + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< + * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") + * calc_distance_delauny_mindist(&delauny_matrix[0,0], &coor[0,0], n_particles, boxlength, number_of_shells, bin_width) */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":1399 + /* "newanalysis/helpers/miscellaneous.pyx":1712 * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1409 + * cdef int n_particles = coor.shape[0] + * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") # <<<<<<<<<<<<<< + * calc_distance_delauny_mindist(&delauny_matrix[0,0], &coor[0,0], n_particles, boxlength, number_of_shells, bin_width) * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(0, 1712, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 1712, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 1712, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_int32) < 0) __PYX_ERR(0, 1712, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1712, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_delauny_matrix = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; -static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_extent; - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - - /* "View.MemoryView":1413 - * size_t itemsize, void *item) nogil: - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t extent = shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":1713 + * cdef int n_particles = coor.shape[0] + * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") + * calc_distance_delauny_mindist(&delauny_matrix[0,0], &coor[0,0], n_particles, boxlength, number_of_shells, bin_width) # <<<<<<<<<<<<<< * + * return delauny_matrix */ - __pyx_v_stride = (__pyx_v_strides[0]); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_delauny_matrix.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_delauny_matrix.shape[1]; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; + calc_distance_delauny_mindist((&(*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delauny_matrix.data + __pyx_t_6 * __pyx_v_delauny_matrix.strides[0]) ) + __pyx_t_7 * __pyx_v_delauny_matrix.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, __pyx_v_boxlength, __pyx_v_number_of_shells, __pyx_v_bin_width); - /* "View.MemoryView":1414 - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] - * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1715 + * calc_distance_delauny_mindist(&delauny_matrix[0,0], &coor[0,0], n_particles, boxlength, number_of_shells, bin_width) * - * if ndim == 1: + * return delauny_matrix # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - __pyx_v_extent = (__pyx_v_shape[0]); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_delauny_matrix, 2, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1715, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] + /* "newanalysis/helpers/miscellaneous.pyx":1705 + * calc_dip_ten_collective_vennshellwise(&coor[0,0], n_particles, &ds1[0], &ds2[0], maxshell1, maxshell2, &results[0,0,0]) * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDistanceDelaunyMindist(double[:,:] coor, double boxlength, int number_of_shells, double bin_width=1.0): + * """ */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":1417 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDistanceDelaunyMindist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delauny_matrix, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/miscellaneous.pyx":1717 + * return delauny_matrix * - * if ndim == 1: - * for i in range(extent): # <<<<<<<<<<<<<< - * memcpy(data, item, itemsize) - * data += stride + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDistanceDelauny(double[:,:] coor, int number_of_shells, double bin_width=1.0): + * """ */ - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1418 - * if ndim == 1: - * for i in range(extent): - * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< - * data += stride - * else: - */ - (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_115calcDistanceDelauny(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_114calcDistanceDelauny, "\n coor ... (n_particles, 3)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_115calcDistanceDelauny = {"calcDistanceDelauny", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_115calcDistanceDelauny, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_114calcDistanceDelauny}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_115calcDistanceDelauny(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_number_of_shells; + double __pyx_v_bin_width; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcDistanceDelauny (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1717, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_number_of_shells,&__pyx_n_s_bin_width,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1717, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_number_of_shells)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1717, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcDistanceDelauny", 0, 2, 3, 1); __PYX_ERR(0, 1717, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_bin_width); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1717, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcDistanceDelauny") < 0)) __PYX_ERR(0, 1717, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1718, __pyx_L3_error) + __pyx_v_number_of_shells = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_number_of_shells == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1718, __pyx_L3_error) + if (values[2]) { + __pyx_v_bin_width = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_bin_width == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1718, __pyx_L3_error) + } else { + __pyx_v_bin_width = ((double)((double)1.0)); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcDistanceDelauny", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 1717, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDistanceDelauny", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_114calcDistanceDelauny(__pyx_self, __pyx_v_coor, __pyx_v_number_of_shells, __pyx_v_bin_width); - /* "View.MemoryView":1419 - * for i in range(extent): - * memcpy(data, item, itemsize) - * data += stride # <<<<<<<<<<<<<< - * else: - * for i in range(extent): - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_114calcDistanceDelauny(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, int __pyx_v_number_of_shells, double __pyx_v_bin_width) { + int __pyx_v_n_particles; + __Pyx_memviewslice __pyx_v_delauny_matrix = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcDistanceDelauny", 0); + + /* "newanalysis/helpers/miscellaneous.pyx":1723 + * """ * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) + * cdef int n_particles = coor.shape[0] # <<<<<<<<<<<<<< + * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") + * calc_distance_delauny(&delauny_matrix[0,0], &coor[0,0], n_particles, number_of_shells, bin_width) */ - goto __pyx_L3; - } + __pyx_v_n_particles = (__pyx_v_coor.shape[0]); - /* "View.MemoryView":1421 - * data += stride - * else: - * for i in range(extent): # <<<<<<<<<<<<<< - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) + /* "newanalysis/helpers/miscellaneous.pyx":1724 + * + * cdef int n_particles = coor.shape[0] + * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") # <<<<<<<<<<<<<< + * calc_distance_delauny(&delauny_matrix[0,0], &coor[0,0], n_particles, number_of_shells, bin_width) + * */ - /*else*/ { - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_particles); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(0, 1724, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 1724, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 1724, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_int32) < 0) __PYX_ERR(0, 1724, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1724, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_delauny_matrix = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "View.MemoryView":1422 - * else: - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, itemsize, item) - * data += stride + /* "newanalysis/helpers/miscellaneous.pyx":1725 + * cdef int n_particles = coor.shape[0] + * cdef int[:,:] delauny_matrix = np.zeros((n_particles, n_particles), dtype = "int32") + * calc_distance_delauny(&delauny_matrix[0,0], &coor[0,0], n_particles, number_of_shells, bin_width) # <<<<<<<<<<<<<< + * + * return delauny_matrix */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_delauny_matrix.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_delauny_matrix.shape[1]; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[1]; + calc_distance_delauny((&(*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delauny_matrix.data + __pyx_t_6 * __pyx_v_delauny_matrix.strides[0]) ) + __pyx_t_7 * __pyx_v_delauny_matrix.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_9 * __pyx_v_coor.strides[1]) )))), __pyx_v_n_particles, __pyx_v_number_of_shells, __pyx_v_bin_width); - /* "View.MemoryView":1424 - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - * data += stride # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1727 + * calc_distance_delauny(&delauny_matrix[0,0], &coor[0,0], n_particles, number_of_shells, bin_width) + * + * return delauny_matrix # <<<<<<<<<<<<<< * * */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - } - __pyx_L3:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_delauny_matrix, 2, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1727, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":1409 + /* "newanalysis/helpers/miscellaneous.pyx":1717 + * return delauny_matrix * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDistanceDelauny(double[:,:] coor, int number_of_shells, double bin_width=1.0): + * """ */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.calcDistanceDelauny", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delauny_matrix, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result +/* "newanalysis/helpers/miscellaneous.pyx":1731 + * + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistTesselation(double [:] dataset, double [:,:] coor_core, double [:,:] coor_surround, double binwidth = 1): + * """ */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_117minDistTesselation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_116minDistTesselation, "\n dataset ... (n_particles_surround)\n coor_core ... (n_particles_core, 3)\n coor_surround ... (n_particles_surround, 3)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_117minDistTesselation = {"minDistTesselation", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_117minDistTesselation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_116minDistTesselation}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_117minDistTesselation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_dataset = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor_core = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor_surround = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_binwidth; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + __Pyx_RefNannySetupContext("minDistTesselation (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1731, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dataset,&__pyx_n_s_coor_core,&__pyx_n_s_coor_surround,&__pyx_n_s_binwidth,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataset)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1731, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_core)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1731, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("minDistTesselation", 0, 3, 4, 1); __PYX_ERR(0, 1731, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_surround)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1731, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("minDistTesselation", 0, 3, 4, 2); __PYX_ERR(0, 1731, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_binwidth); + if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1731, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "minDistTesselation") < 0)) __PYX_ERR(0, 1731, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_dataset = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dataset.memview)) __PYX_ERR(0, 1732, __pyx_L3_error) + __pyx_v_coor_core = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_core.memview)) __PYX_ERR(0, 1732, __pyx_L3_error) + __pyx_v_coor_surround = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor_surround.memview)) __PYX_ERR(0, 1732, __pyx_L3_error) + if (values[3]) { + __pyx_v_binwidth = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_binwidth == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1732, __pyx_L3_error) + } else { + __pyx_v_binwidth = ((double)((double)1.0)); } - __pyx_v___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error) - __pyx_v___pyx_state = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("minDistTesselation", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 1731, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_core, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_surround, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.minDistTesselation", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_116minDistTesselation(__pyx_self, __pyx_v_dataset, __pyx_v_coor_core, __pyx_v_coor_surround, __pyx_v_binwidth); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_dataset, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_core, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor_surround, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_116minDistTesselation(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_dataset, __Pyx_memviewslice __pyx_v_coor_core, __Pyx_memviewslice __pyx_v_coor_surround, double __pyx_v_binwidth) { + int __pyx_v_n_particle_core; + int __pyx_v_n_particle_surround; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); - - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__23, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); - __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + __Pyx_RefNannySetupContext("minDistTesselation", 0); - /* "(tree fragment)":6 - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: + /* "newanalysis/helpers/miscellaneous.pyx":1739 + * """ + * + * cdef int n_particle_core = coor_core.shape[0] # <<<<<<<<<<<<<< + * cdef int n_particle_surround = coor_surround.shape[0] + * */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_v___pyx_PickleError); - __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_v_n_particle_core = (__pyx_v_coor_core.shape[0]); - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) + /* "newanalysis/helpers/miscellaneous.pyx":1740 + * + * cdef int n_particle_core = coor_core.shape[0] + * cdef int n_particle_surround = coor_surround.shape[0] # <<<<<<<<<<<<<< + * + * calc_min_dist_tesselation(&dataset[0], &coor_core[0,0], &coor_surround[0,0], n_particle_core, n_particle_surround, binwidth) */ - } + __pyx_v_n_particle_surround = (__pyx_v_coor_surround.shape[0]); - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + /* "newanalysis/helpers/miscellaneous.pyx":1742 + * cdef int n_particle_surround = coor_surround.shape[0] + * + * calc_min_dist_tesselation(&dataset[0], &coor_core[0,0], &coor_surround[0,0], n_particle_core, n_particle_surround, binwidth) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result = __pyx_t_4; + __pyx_t_1 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_dataset.shape[0]; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor_core.shape[0]; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor_core.shape[1]; __pyx_t_4 = 0; + __pyx_t_5 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coor_surround.shape[0]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor_surround.shape[1]; + calc_min_dist_tesselation((&(*((double *) ( /* dim=0 */ (__pyx_v_dataset.data + __pyx_t_1 * __pyx_v_dataset.strides[0]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_core.data + __pyx_t_2 * __pyx_v_coor_core.strides[0]) ) + __pyx_t_3 * __pyx_v_coor_core.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor_surround.data + __pyx_t_4 * __pyx_v_coor_surround.strides[0]) ) + __pyx_t_5 * __pyx_v_coor_surround.strides[1]) )))), __pyx_v_n_particle_core, __pyx_v_n_particle_surround, __pyx_v_binwidth); - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ - __pyx_t_3 = (__pyx_v___pyx_state != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "(tree fragment)":9 - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_t_4 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ - } - - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; - goto __pyx_L0; - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "newanalysis/helpers/miscellaneous.pyx":1731 + * + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistTesselation(double [:] dataset, double [:,:] coor_core, double [:,:] coor_surround, double binwidth = 1): + * """ */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): +/* "newanalysis/helpers/miscellaneous.pyx":1744 + * calc_min_dist_tesselation(&dataset[0], &coor_core[0,0], &coor_surround[0,0], n_particle_core, n_particle_surround, binwidth) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getPolarizabilityMatrix(double[:,:] coor, double[:,:,:] inv_atom_polarizabilities, double[:,:] matrix): + * """ */ -static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_119getPolarizabilityMatrix(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_13miscellaneous_118getPolarizabilityMatrix, "\n coor ... (n_atoms, 3)\n inv_atom_polarizabilities ... (n_atoms, 3, 3)\n matrix ... (3*n_atoms, 3*n_atoms)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_13miscellaneous_119getPolarizabilityMatrix = {"getPolarizabilityMatrix", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_13miscellaneous_119getPolarizabilityMatrix, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_13miscellaneous_118getPolarizabilityMatrix}; +static PyObject *__pyx_pw_11newanalysis_13miscellaneous_119getPolarizabilityMatrix(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_inv_atom_polarizabilities = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_matrix = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 12, __pyx_L1_error) + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getPolarizabilityMatrix (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 1744, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_inv_atom_polarizabilities,&__pyx_n_s_matrix,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1744, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_inv_atom_polarizabilities)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1744, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("getPolarizabilityMatrix", 1, 3, 3, 1); __PYX_ERR(0, 1744, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_matrix)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1744, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("getPolarizabilityMatrix", 1, 3, 3, 2); __PYX_ERR(0, 1744, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "getPolarizabilityMatrix") < 0)) __PYX_ERR(0, 1744, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 1745, __pyx_L3_error) + __pyx_v_inv_atom_polarizabilities = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_inv_atom_polarizabilities.memview)) __PYX_ERR(0, 1745, __pyx_L3_error) + __pyx_v_matrix = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_matrix.memview)) __PYX_ERR(0, 1745, __pyx_L3_error) } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->name); - __Pyx_DECREF(__pyx_v___pyx_result->name); - __pyx_v___pyx_result->name = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 13, __pyx_L1_error) + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("getPolarizabilityMatrix", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1744, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_4 = ((__pyx_t_3 > 1) != 0); - if (__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_inv_atom_polarizabilities, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_matrix, 1); + __Pyx_AddTraceback("newanalysis.miscellaneous.getPolarizabilityMatrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_13miscellaneous_118getPolarizabilityMatrix(__pyx_self, __pyx_v_coor, __pyx_v_inv_atom_polarizabilities, __pyx_v_matrix); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_inv_atom_polarizabilities, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_matrix, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "(tree fragment)":14 - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< +static PyObject *__pyx_pf_11newanalysis_13miscellaneous_118getPolarizabilityMatrix(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_inv_atom_polarizabilities, __Pyx_memviewslice __pyx_v_matrix) { + int __pyx_v_n_atoms; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_RefNannySetupContext("getPolarizabilityMatrix", 0); + + /* "newanalysis/helpers/miscellaneous.pyx":1752 + * """ + * + * cdef int n_atoms = coor.shape[0] # <<<<<<<<<<<<<< + * + * construct_relay_matrix(&coor[0,0], &inv_atom_polarizabilities[0,0,0], &matrix[0,0], n_atoms) */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 14, __pyx_L1_error) - } - __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_n_atoms = (__pyx_v_coor.shape[0]); - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) + /* "newanalysis/helpers/miscellaneous.pyx":1754 + * cdef int n_atoms = coor.shape[0] + * + * construct_relay_matrix(&coor[0,0], &inv_atom_polarizabilities[0,0,0], &matrix[0,0], n_atoms) # <<<<<<<<<<<<<< + * + * #TODO: invert relay matrix */ - } + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coor.shape[0]; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor.shape[1]; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_inv_atom_polarizabilities.shape[0]; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_inv_atom_polarizabilities.shape[1]; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_inv_atom_polarizabilities.shape[2]; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_matrix.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_matrix.shape[1]; + construct_relay_matrix((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_1 * __pyx_v_coor.strides[0]) ) + __pyx_t_2 * __pyx_v_coor.strides[1]) )))), (&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_inv_atom_polarizabilities.data + __pyx_t_3 * __pyx_v_inv_atom_polarizabilities.strides[0]) ) + __pyx_t_4 * __pyx_v_inv_atom_polarizabilities.strides[1]) ) + __pyx_t_5 * __pyx_v_inv_atom_polarizabilities.strides[2]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_matrix.data + __pyx_t_6 * __pyx_v_matrix.strides[0]) ) + __pyx_t_7 * __pyx_v_matrix.strides[1]) )))), __pyx_v_n_atoms); - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + /* "newanalysis/helpers/miscellaneous.pyx":1744 + * calc_min_dist_tesselation(&dataset[0], &coor_core[0,0], &coor_surround[0,0], n_particle_core, n_particle_surround, binwidth) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getPolarizabilityMatrix(double[:,:] coor, double[:,:,:] inv_atom_polarizabilities, double[:,:] matrix): + * """ */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -44733,12 +52810,17 @@ static struct __pyx_vtabstruct_array __pyx_vtable_array; static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_array_obj *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_array_obj *)o); p->__pyx_vtab = __pyx_vtabptr_array; p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); @@ -44753,8 +52835,10 @@ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { static void __pyx_tp_dealloc_array(PyObject *o) { struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif { @@ -44767,7 +52851,14 @@ static void __pyx_tp_dealloc_array(PyObject *o) { } Py_CLEAR(p->mode); Py_CLEAR(p->_format); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { PyObject *r; @@ -44782,8 +52873,11 @@ static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { return __pyx_array___setitem__(o, i, v); } else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); return -1; } } @@ -44803,8 +52897,8 @@ static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED vo static PyMethodDef __pyx_methods_array[] = { {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -44812,6 +52906,50 @@ static struct PyGetSetDef __pyx_getsets_array[] = { {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "newanalysis.miscellaneous.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else static PySequenceMethods __pyx_tp_as_sequence_array = { __pyx_array___len__, /*sq_length*/ @@ -44851,7 +52989,7 @@ static PyBufferProcs __pyx_tp_as_buffer_array = { static PyTypeObject __pyx_type___pyx_array = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.miscellaneous.array", /*tp_name*/ + "newanalysis.miscellaneous.""array", /*tp_name*/ sizeof(struct __pyx_array_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_array, /*tp_dealloc*/ @@ -44879,7 +53017,7 @@ static PyTypeObject __pyx_type___pyx_array = { __pyx_tp_getattro_array, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ @@ -44894,7 +53032,9 @@ static PyTypeObject __pyx_type___pyx_array = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_array, /*tp_new*/ @@ -44908,28 +53048,41 @@ static PyTypeObject __pyx_type___pyx_array = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_MemviewEnum_obj *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_MemviewEnum_obj *)o); p->name = Py_None; Py_INCREF(Py_None); return o; @@ -44938,13 +53091,22 @@ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, C static void __pyx_tp_dealloc_Enum(PyObject *o) { struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); Py_CLEAR(p->name); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { @@ -44965,15 +53127,39 @@ static int __pyx_tp_clear_Enum(PyObject *o) { return 0; } +static PyObject *__pyx_specialmethod___pyx_MemviewEnum___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_MemviewEnum___repr__(self); +} + static PyMethodDef __pyx_methods_Enum[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0}, + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_MemviewEnum___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "newanalysis.miscellaneous.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_MemviewEnum_slots, +}; +#else static PyTypeObject __pyx_type___pyx_MemviewEnum = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.miscellaneous.Enum", /*tp_name*/ + "newanalysis.miscellaneous.""Enum", /*tp_name*/ sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_Enum, /*tp_dealloc*/ @@ -45016,7 +53202,9 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif __pyx_MemviewEnum___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_Enum, /*tp_new*/ @@ -45030,29 +53218,42 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_memoryview_obj *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; + #endif p = ((struct __pyx_memoryview_obj *)o); p->__pyx_vtab = __pyx_vtabptr_memoryview; p->obj = Py_None; Py_INCREF(Py_None); @@ -45069,8 +53270,10 @@ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject static void __pyx_tp_dealloc_memoryview(PyObject *o) { struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -45085,7 +53288,14 @@ static void __pyx_tp_dealloc_memoryview(PyObject *o) { Py_CLEAR(p->obj); Py_CLEAR(p->_size); Py_CLEAR(p->_array_interface); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { @@ -45134,8 +53344,11 @@ static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject return __pyx_memoryview___setitem__(o, i, v); } else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); return -1; } } @@ -45176,13 +53389,18 @@ static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); } +static PyObject *__pyx_specialmethod___pyx_memoryview___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_memoryview___repr__(self); +} + static PyMethodDef __pyx_methods_memoryview[] = { - {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0}, - {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0}, - {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0}, - {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0}, + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_memoryview___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"is_c_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -45198,6 +53416,53 @@ static struct PyGetSetDef __pyx_getsets_memoryview[] = { {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "newanalysis.miscellaneous.memoryview", + sizeof(struct __pyx_memoryview_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_memoryview_slots, +}; +#else static PySequenceMethods __pyx_tp_as_sequence_memoryview = { __pyx_memoryview___len__, /*sq_length*/ @@ -45237,7 +53502,7 @@ static PyBufferProcs __pyx_tp_as_buffer_memoryview = { static PyTypeObject __pyx_type___pyx_memoryview = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.miscellaneous.memoryview", /*tp_name*/ + "newanalysis.miscellaneous.""memoryview", /*tp_name*/ sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ @@ -45280,7 +53545,9 @@ static PyTypeObject __pyx_type___pyx_memoryview = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_memoryview, /*tp_new*/ @@ -45294,18 +53561,26 @@ static PyTypeObject __pyx_type___pyx_memoryview = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { @@ -45314,6 +53589,7 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO if (unlikely(!o)) return 0; p = ((struct __pyx_memoryviewslice_obj *)o); p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + new((void*)&(p->from_slice)) __Pyx_memviewslice(); p->from_object = Py_None; Py_INCREF(Py_None); p->from_slice.memview = NULL; return o; @@ -45322,8 +53598,10 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -45335,6 +53613,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } + __Pyx_call_destructor(p->from_slice); Py_CLEAR(p->from_object); PyObject_GC_Track(o); __pyx_tp_dealloc_memoryview(o); @@ -45357,28 +53636,37 @@ static int __pyx_tp_clear__memoryviewslice(PyObject *o) { tmp = ((PyObject*)p->from_object); p->from_object = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - __PYX_XDEC_MEMVIEW(&p->from_slice, 1); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); return 0; } -static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o); -} - static PyMethodDef __pyx_methods__memoryviewslice[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; - -static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = { - {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "newanalysis.miscellaneous._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, }; +#else static PyTypeObject __pyx_type___pyx_memoryviewslice = { PyVarObject_HEAD_INIT(0, 0) - "newanalysis.miscellaneous._memoryviewslice", /*tp_name*/ + "newanalysis.miscellaneous.""_memoryviewslice", /*tp_name*/ sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ @@ -45396,7 +53684,7 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif - #if CYTHON_COMPILING_IN_PYPY + #if CYTHON_COMPILING_IN_PYPY || 0 __pyx_memoryview___repr__, /*tp_repr*/ #else 0, /*tp_repr*/ @@ -45406,7 +53694,7 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY + #if CYTHON_COMPILING_IN_PYPY || 0 __pyx_memoryview___str__, /*tp_str*/ #else 0, /*tp_str*/ @@ -45414,8 +53702,8 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Internal class for passing memoryview slices to Python", /*tp_doc*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ __pyx_tp_clear__memoryviewslice, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -45424,12 +53712,14 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_iternext*/ __pyx_methods__memoryviewslice, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets__memoryviewslice, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new__memoryviewslice, /*tp_new*/ @@ -45443,54 +53733,30 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_miscellaneous(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_miscellaneous}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "miscellaneous", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE @@ -45500,1560 +53766,1521 @@ static struct PyModuleDef __pyx_moduledef = { #define CYTHON_SMALL_CODE #endif #endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, - {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, - {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0}, - {&__pyx_kp_s_Correlation_length_must_not_be_l, __pyx_k_Correlation_length_must_not_be_l, sizeof(__pyx_k_Correlation_length_must_not_be_l), 0, 0, 1, 0}, - {&__pyx_n_s_D, __pyx_k_D, sizeof(__pyx_k_D), 0, 0, 1, 1}, - {&__pyx_n_s_D_x, __pyx_k_D_x, sizeof(__pyx_k_D_x), 0, 0, 1, 1}, - {&__pyx_n_s_D_y, __pyx_k_D_y, sizeof(__pyx_k_D_y), 0, 0, 1, 1}, - {&__pyx_n_s_D_z, __pyx_k_D_z, sizeof(__pyx_k_D_z), 0, 0, 1, 1}, - {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, - {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, - {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, - {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0}, - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, - {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, - {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, - {&__pyx_kp_s_Number_of_starting_points_too_hi, __pyx_k_Number_of_starting_points_too_hi, sizeof(__pyx_k_Number_of_starting_points_too_hi), 0, 0, 1, 0}, - {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, - {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, - {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, - {&__pyx_kp_s_Warning_number_of_frames_correla, __pyx_k_Warning_number_of_frames_correla, sizeof(__pyx_k_Warning_number_of_frames_correla), 0, 0, 1, 0}, - {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1}, - {&__pyx_n_s_accumulateNMShellwiseGFunction, __pyx_k_accumulateNMShellwiseGFunction, sizeof(__pyx_k_accumulateNMShellwiseGFunction), 0, 0, 1, 1}, - {&__pyx_n_s_accumulateShellwiseGFunction, __pyx_k_accumulateShellwiseGFunction, sizeof(__pyx_k_accumulateShellwiseGFunction), 0, 0, 1, 1}, - {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, - {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1}, - {&__pyx_n_s_antagonist, __pyx_k_antagonist, sizeof(__pyx_k_antagonist), 0, 0, 1, 1}, - {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, - {&__pyx_n_s_apr_emim_h, __pyx_k_apr_emim_h, sizeof(__pyx_k_apr_emim_h), 0, 0, 1, 1}, - {&__pyx_n_s_apr_pair, __pyx_k_apr_pair, sizeof(__pyx_k_apr_pair), 0, 0, 1, 1}, - {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, - {&__pyx_n_s_atom, __pyx_k_atom, sizeof(__pyx_k_atom), 0, 0, 1, 1}, - {&__pyx_n_s_atomicIndDip, __pyx_k_atomicIndDip, sizeof(__pyx_k_atomicIndDip), 0, 0, 1, 1}, - {&__pyx_n_s_atomicIndDipPerAtom, __pyx_k_atomicIndDipPerAtom, sizeof(__pyx_k_atomicIndDipPerAtom), 0, 0, 1, 1}, - {&__pyx_n_s_atomic_dipoles, __pyx_k_atomic_dipoles, sizeof(__pyx_k_atomic_dipoles), 0, 0, 1, 1}, - {&__pyx_n_s_aufpunkt, __pyx_k_aufpunkt, sizeof(__pyx_k_aufpunkt), 0, 0, 1, 1}, - {&__pyx_n_s_aufpunkt_dipol, __pyx_k_aufpunkt_dipol, sizeof(__pyx_k_aufpunkt_dipol), 0, 0, 1, 1}, - {&__pyx_n_s_aufpunkt_dipole, __pyx_k_aufpunkt_dipole, sizeof(__pyx_k_aufpunkt_dipole), 0, 0, 1, 1}, - {&__pyx_n_s_aufpunkte, __pyx_k_aufpunkte, sizeof(__pyx_k_aufpunkte), 0, 0, 1, 1}, - {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1}, - {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, - {&__pyx_n_s_best_index, __pyx_k_best_index, sizeof(__pyx_k_best_index), 0, 0, 1, 1}, - {&__pyx_n_s_bin, __pyx_k_bin, sizeof(__pyx_k_bin), 0, 0, 1, 1}, - {&__pyx_n_s_bin1, __pyx_k_bin1, sizeof(__pyx_k_bin1), 0, 0, 1, 1}, - {&__pyx_n_s_bin2, __pyx_k_bin2, sizeof(__pyx_k_bin2), 0, 0, 1, 1}, - {&__pyx_n_s_bin_dist, __pyx_k_bin_dist, sizeof(__pyx_k_bin_dist), 0, 0, 1, 1}, - {&__pyx_n_s_bin_width, __pyx_k_bin_width, sizeof(__pyx_k_bin_width), 0, 0, 1, 1}, - {&__pyx_n_s_bins, __pyx_k_bins, sizeof(__pyx_k_bins), 0, 0, 1, 1}, - {&__pyx_n_s_binwidth, __pyx_k_binwidth, sizeof(__pyx_k_binwidth), 0, 0, 1, 1}, - {&__pyx_n_s_blen2, __pyx_k_blen2, sizeof(__pyx_k_blen2), 0, 0, 1, 1}, - {&__pyx_n_s_bond_table, __pyx_k_bond_table, sizeof(__pyx_k_bond_table), 0, 0, 1, 1}, - {&__pyx_n_s_both_directions, __pyx_k_both_directions, sizeof(__pyx_k_both_directions), 0, 0, 1, 1}, - {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, - {&__pyx_n_s_boxlength, __pyx_k_boxlength, sizeof(__pyx_k_boxlength), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, - {&__pyx_n_s_calcDipTenCollective, __pyx_k_calcDipTenCollective, sizeof(__pyx_k_calcDipTenCollective), 0, 0, 1, 1}, - {&__pyx_n_s_calcDipTenCollective1NShellwiseC, __pyx_k_calcDipTenCollective1NShellwiseC, sizeof(__pyx_k_calcDipTenCollective1NShellwiseC), 0, 0, 1, 1}, - {&__pyx_n_s_calcDipTenCollective1NShellwiseS, __pyx_k_calcDipTenCollective1NShellwiseS, sizeof(__pyx_k_calcDipTenCollective1NShellwiseS), 0, 0, 1, 1}, - {&__pyx_n_s_calcDipTenCollectiveCross, __pyx_k_calcDipTenCollectiveCross, sizeof(__pyx_k_calcDipTenCollectiveCross), 0, 0, 1, 1}, - {&__pyx_n_s_calcDipTenCollectiveNNShellwise, __pyx_k_calcDipTenCollectiveNNShellwise, sizeof(__pyx_k_calcDipTenCollectiveNNShellwise), 0, 0, 1, 1}, - {&__pyx_n_s_calcDipTenCollectiveNNShellwiseC, __pyx_k_calcDipTenCollectiveNNShellwiseC, sizeof(__pyx_k_calcDipTenCollectiveNNShellwiseC), 0, 0, 1, 1}, - {&__pyx_n_s_calcDipTenCollectiveNNShellwiseS, __pyx_k_calcDipTenCollectiveNNShellwiseS, sizeof(__pyx_k_calcDipTenCollectiveNNShellwiseS), 0, 0, 1, 1}, - {&__pyx_n_s_calcDipTenCollectivePerAtom, __pyx_k_calcDipTenCollectivePerAtom, sizeof(__pyx_k_calcDipTenCollectivePerAtom), 0, 0, 1, 1}, - {&__pyx_n_s_calcDipTenCollectiveShellwise, __pyx_k_calcDipTenCollectiveShellwise, sizeof(__pyx_k_calcDipTenCollectiveShellwise), 0, 0, 1, 1}, - {&__pyx_n_s_calcDipTenCollectiveVennShellwis, __pyx_k_calcDipTenCollectiveVennShellwis, sizeof(__pyx_k_calcDipTenCollectiveVennShellwis), 0, 0, 1, 1}, - {&__pyx_n_s_calcDistanceDelauny, __pyx_k_calcDistanceDelauny, sizeof(__pyx_k_calcDistanceDelauny), 0, 0, 1, 1}, - {&__pyx_n_s_calcDistanceDelaunyMindist, __pyx_k_calcDistanceDelaunyMindist, sizeof(__pyx_k_calcDistanceDelaunyMindist), 0, 0, 1, 1}, - {&__pyx_n_s_cardinality, __pyx_k_cardinality, sizeof(__pyx_k_cardinality), 0, 0, 1, 1}, - {&__pyx_n_s_charges, __pyx_k_charges, sizeof(__pyx_k_charges), 0, 0, 1, 1}, - {&__pyx_n_s_cl, __pyx_k_cl, sizeof(__pyx_k_cl), 0, 0, 1, 1}, - {&__pyx_n_s_cl_self, __pyx_k_cl_self, sizeof(__pyx_k_cl_self), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_closest_shell, __pyx_k_closest_shell, sizeof(__pyx_k_closest_shell), 0, 0, 1, 1}, - {&__pyx_n_s_collectiveDipolesCutoff, __pyx_k_collectiveDipolesCutoff, sizeof(__pyx_k_collectiveDipolesCutoff), 0, 0, 1, 1}, - {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, - {&__pyx_n_s_coo1, __pyx_k_coo1, sizeof(__pyx_k_coo1), 0, 0, 1, 1}, - {&__pyx_n_s_coo2, __pyx_k_coo2, sizeof(__pyx_k_coo2), 0, 0, 1, 1}, - {&__pyx_n_s_coor, __pyx_k_coor, sizeof(__pyx_k_coor), 0, 0, 1, 1}, - {&__pyx_n_s_coor1, __pyx_k_coor1, sizeof(__pyx_k_coor1), 0, 0, 1, 1}, - {&__pyx_n_s_coor2, __pyx_k_coor2, sizeof(__pyx_k_coor2), 0, 0, 1, 1}, - {&__pyx_n_s_coor_core, __pyx_k_coor_core, sizeof(__pyx_k_coor_core), 0, 0, 1, 1}, - {&__pyx_n_s_coor_i, __pyx_k_coor_i, sizeof(__pyx_k_coor_i), 0, 0, 1, 1}, - {&__pyx_n_s_coor_j, __pyx_k_coor_j, sizeof(__pyx_k_coor_j), 0, 0, 1, 1}, - {&__pyx_n_s_coor_oh2, __pyx_k_coor_oh2, sizeof(__pyx_k_coor_oh2), 0, 0, 1, 1}, - {&__pyx_n_s_coor_res, __pyx_k_coor_res, sizeof(__pyx_k_coor_res), 0, 0, 1, 1}, - {&__pyx_n_s_coor_surr, __pyx_k_coor_surr, sizeof(__pyx_k_coor_surr), 0, 0, 1, 1}, - {&__pyx_n_s_coor_surround, __pyx_k_coor_surround, sizeof(__pyx_k_coor_surround), 0, 0, 1, 1}, - {&__pyx_n_s_coors, __pyx_k_coors, sizeof(__pyx_k_coors), 0, 0, 1, 1}, - {&__pyx_n_s_coors_ind, __pyx_k_coors_ind, sizeof(__pyx_k_coors_ind), 0, 0, 1, 1}, - {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, - {&__pyx_n_s_corr, __pyx_k_corr, sizeof(__pyx_k_corr), 0, 0, 1, 1}, - {&__pyx_n_s_correlateMultiVector, __pyx_k_correlateMultiVector, sizeof(__pyx_k_correlateMultiVector), 0, 0, 1, 1}, - {&__pyx_n_s_correlateMultiVectorShellwise, __pyx_k_correlateMultiVectorShellwise, sizeof(__pyx_k_correlateMultiVectorShellwise), 0, 0, 1, 1}, - {&__pyx_n_s_correlateMultiVectorVennShellwis, __pyx_k_correlateMultiVectorVennShellwis, sizeof(__pyx_k_correlateMultiVectorVennShellwis), 0, 0, 1, 1}, - {&__pyx_n_s_correlateSingleParticleMuShellwi, __pyx_k_correlateSingleParticleMuShellwi, sizeof(__pyx_k_correlateSingleParticleMuShellwi), 0, 0, 1, 1}, - {&__pyx_n_s_correlateSingleParticleMuVennShe, __pyx_k_correlateSingleParticleMuVennShe, sizeof(__pyx_k_correlateSingleParticleMuVennShe), 0, 0, 1, 1}, - {&__pyx_n_s_correlateSingleVector, __pyx_k_correlateSingleVector, sizeof(__pyx_k_correlateSingleVector), 0, 0, 1, 1}, - {&__pyx_n_s_correlation_length, __pyx_k_correlation_length, sizeof(__pyx_k_correlation_length), 0, 0, 1, 1}, - {&__pyx_n_s_cos_angle, __pyx_k_cos_angle, sizeof(__pyx_k_cos_angle), 0, 0, 1, 1}, - {&__pyx_n_s_cos_segs, __pyx_k_cos_segs, sizeof(__pyx_k_cos_segs), 0, 0, 1, 1}, - {&__pyx_n_s_cosine, __pyx_k_cosine, sizeof(__pyx_k_cosine), 0, 0, 1, 1}, - {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, - {&__pyx_n_s_countHBonds, __pyx_k_countHBonds, sizeof(__pyx_k_countHBonds), 0, 0, 1, 1}, - {&__pyx_n_s_countMultiShell, __pyx_k_countMultiShell, sizeof(__pyx_k_countMultiShell), 0, 0, 1, 1}, - {&__pyx_n_s_countVennShellOccupation, __pyx_k_countVennShellOccupation, sizeof(__pyx_k_countVennShellOccupation), 0, 0, 1, 1}, - {&__pyx_n_s_counter, __pyx_k_counter, sizeof(__pyx_k_counter), 0, 0, 1, 1}, - {&__pyx_n_s_crossCorrelateMultiVector, __pyx_k_crossCorrelateMultiVector, sizeof(__pyx_k_crossCorrelateMultiVector), 0, 0, 1, 1}, - {&__pyx_n_s_crossCorrelateSingleVector, __pyx_k_crossCorrelateSingleVector, sizeof(__pyx_k_crossCorrelateSingleVector), 0, 0, 1, 1}, - {&__pyx_n_s_crosscorr, __pyx_k_crosscorr, sizeof(__pyx_k_crosscorr), 0, 0, 1, 1}, - {&__pyx_n_s_crossctr, __pyx_k_crossctr, sizeof(__pyx_k_crossctr), 0, 0, 1, 1}, - {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, - {&__pyx_n_s_cutoff, __pyx_k_cutoff, sizeof(__pyx_k_cutoff), 0, 0, 1, 1}, - {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, - {&__pyx_n_s_dataset, __pyx_k_dataset, sizeof(__pyx_k_dataset), 0, 0, 1, 1}, - {&__pyx_n_s_dataset1, __pyx_k_dataset1, sizeof(__pyx_k_dataset1), 0, 0, 1, 1}, - {&__pyx_n_s_dataset2, __pyx_k_dataset2, sizeof(__pyx_k_dataset2), 0, 0, 1, 1}, - {&__pyx_n_s_delauny_matrix, __pyx_k_delauny_matrix, sizeof(__pyx_k_delauny_matrix), 0, 0, 1, 1}, - {&__pyx_n_s_deriveIndDip, __pyx_k_deriveIndDip, sizeof(__pyx_k_deriveIndDip), 0, 0, 1, 1}, - {&__pyx_n_s_deriveIndDipPerAtom, __pyx_k_deriveIndDipPerAtom, sizeof(__pyx_k_deriveIndDipPerAtom), 0, 0, 1, 1}, - {&__pyx_n_s_derived_atomic_dipoles, __pyx_k_derived_atomic_dipoles, sizeof(__pyx_k_derived_atomic_dipoles), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_n_s_dip, __pyx_k_dip, sizeof(__pyx_k_dip), 0, 0, 1, 1}, - {&__pyx_n_s_dipTen, __pyx_k_dipTen, sizeof(__pyx_k_dipTen), 0, 0, 1, 1}, - {&__pyx_n_s_dip_inside, __pyx_k_dip_inside, sizeof(__pyx_k_dip_inside), 0, 0, 1, 1}, - {&__pyx_n_s_dip_outside, __pyx_k_dip_outside, sizeof(__pyx_k_dip_outside), 0, 0, 1, 1}, - {&__pyx_n_s_dip_res, __pyx_k_dip_res, sizeof(__pyx_k_dip_res), 0, 0, 1, 1}, - {&__pyx_n_s_dip_shell, __pyx_k_dip_shell, sizeof(__pyx_k_dip_shell), 0, 0, 1, 1}, - {&__pyx_n_s_dip_wat, __pyx_k_dip_wat, sizeof(__pyx_k_dip_wat), 0, 0, 1, 1}, - {&__pyx_n_s_dipoles, __pyx_k_dipoles, sizeof(__pyx_k_dipoles), 0, 0, 1, 1}, - {&__pyx_n_s_dipt, __pyx_k_dipt, sizeof(__pyx_k_dipt), 0, 0, 1, 1}, - {&__pyx_n_s_dipt_0, __pyx_k_dipt_0, sizeof(__pyx_k_dipt_0), 0, 0, 1, 1}, - {&__pyx_n_s_dipt_0_self, __pyx_k_dipt_0_self, sizeof(__pyx_k_dipt_0_self), 0, 0, 1, 1}, - {&__pyx_n_s_dipt_t, __pyx_k_dipt_t, sizeof(__pyx_k_dipt_t), 0, 0, 1, 1}, - {&__pyx_n_s_dipt_t_self, __pyx_k_dipt_t_self, sizeof(__pyx_k_dipt_t_self), 0, 0, 1, 1}, - {&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1}, - {&__pyx_n_s_dist1, __pyx_k_dist1, sizeof(__pyx_k_dist1), 0, 0, 1, 1}, - {&__pyx_n_s_dist2, __pyx_k_dist2, sizeof(__pyx_k_dist2), 0, 0, 1, 1}, - {&__pyx_n_s_dist_2, __pyx_k_dist_2, sizeof(__pyx_k_dist_2), 0, 0, 1, 1}, - {&__pyx_n_s_dist_3, __pyx_k_dist_3, sizeof(__pyx_k_dist_3), 0, 0, 1, 1}, - {&__pyx_n_s_dist_sq, __pyx_k_dist_sq, sizeof(__pyx_k_dist_sq), 0, 0, 1, 1}, - {&__pyx_n_s_distance, __pyx_k_distance, sizeof(__pyx_k_distance), 0, 0, 1, 1}, - {&__pyx_n_s_distances, __pyx_k_distances, sizeof(__pyx_k_distances), 0, 0, 1, 1}, - {&__pyx_n_s_distances_copy, __pyx_k_distances_copy, sizeof(__pyx_k_distances_copy), 0, 0, 1, 1}, - {&__pyx_n_s_distvec, __pyx_k_distvec, sizeof(__pyx_k_distvec), 0, 0, 1, 1}, - {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, - {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1}, - {&__pyx_n_s_dot2, __pyx_k_dot2, sizeof(__pyx_k_dot2), 0, 0, 1, 1}, - {&__pyx_n_s_ds, __pyx_k_ds, sizeof(__pyx_k_ds), 0, 0, 1, 1}, - {&__pyx_n_s_ds1, __pyx_k_ds1, sizeof(__pyx_k_ds1), 0, 0, 1, 1}, - {&__pyx_n_s_ds1_idx, __pyx_k_ds1_idx, sizeof(__pyx_k_ds1_idx), 0, 0, 1, 1}, - {&__pyx_n_s_ds2, __pyx_k_ds2, sizeof(__pyx_k_ds2), 0, 0, 1, 1}, - {&__pyx_n_s_ds2_idx, __pyx_k_ds2_idx, sizeof(__pyx_k_ds2_idx), 0, 0, 1, 1}, - {&__pyx_n_s_ds3, __pyx_k_ds3, sizeof(__pyx_k_ds3), 0, 0, 1, 1}, - {&__pyx_n_s_ds4, __pyx_k_ds4, sizeof(__pyx_k_ds4), 0, 0, 1, 1}, - {&__pyx_n_s_ds5, __pyx_k_ds5, sizeof(__pyx_k_ds5), 0, 0, 1, 1}, - {&__pyx_n_s_ds_idx, __pyx_k_ds_idx, sizeof(__pyx_k_ds_idx), 0, 0, 1, 1}, - {&__pyx_n_s_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, - {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1}, - {&__pyx_n_s_dx2, __pyx_k_dx2, sizeof(__pyx_k_dx2), 0, 0, 1, 1}, - {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1}, - {&__pyx_n_s_dy2, __pyx_k_dy2, sizeof(__pyx_k_dy2), 0, 0, 1, 1}, - {&__pyx_n_s_dz, __pyx_k_dz, sizeof(__pyx_k_dz), 0, 0, 1, 1}, - {&__pyx_n_s_dz2, __pyx_k_dz2, sizeof(__pyx_k_dz2), 0, 0, 1, 1}, - {&__pyx_n_s_emim_h, __pyx_k_emim_h, sizeof(__pyx_k_emim_h), 0, 0, 1, 1}, - {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, - {&__pyx_n_s_energy1, __pyx_k_energy1, sizeof(__pyx_k_energy1), 0, 0, 1, 1}, - {&__pyx_n_s_energy2, __pyx_k_energy2, sizeof(__pyx_k_energy2), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, - {&__pyx_n_s_f1, __pyx_k_f1, sizeof(__pyx_k_f1), 0, 0, 1, 1}, - {&__pyx_n_s_f2, __pyx_k_f2, sizeof(__pyx_k_f2), 0, 0, 1, 1}, - {&__pyx_n_s_f2c, __pyx_k_f2c, sizeof(__pyx_k_f2c), 0, 0, 1, 1}, - {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1}, - {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, - {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, - {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, - {&__pyx_n_s_frame, __pyx_k_frame, sizeof(__pyx_k_frame), 0, 0, 1, 1}, - {&__pyx_n_s_getBestIndex, __pyx_k_getBestIndex, sizeof(__pyx_k_getBestIndex), 0, 0, 1, 1}, - {&__pyx_n_s_getBestIndices, __pyx_k_getBestIndices, sizeof(__pyx_k_getBestIndices), 0, 0, 1, 1}, - {&__pyx_n_s_getBondTable, __pyx_k_getBondTable, sizeof(__pyx_k_getBondTable), 0, 0, 1, 1}, - {&__pyx_n_s_getPolarizabilityMatrix, __pyx_k_getPolarizabilityMatrix, sizeof(__pyx_k_getPolarizabilityMatrix), 0, 0, 1, 1}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0}, - {&__pyx_n_s_hbond, __pyx_k_hbond, sizeof(__pyx_k_hbond), 0, 0, 1, 1}, - {&__pyx_n_s_histo_max, __pyx_k_histo_max, sizeof(__pyx_k_histo_max), 0, 0, 1, 1}, - {&__pyx_n_s_histo_min, __pyx_k_histo_min, sizeof(__pyx_k_histo_min), 0, 0, 1, 1}, - {&__pyx_n_s_histogram, __pyx_k_histogram, sizeof(__pyx_k_histogram), 0, 0, 1, 1}, - {&__pyx_n_s_histograms, __pyx_k_histograms, sizeof(__pyx_k_histograms), 0, 0, 1, 1}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1}, - {&__pyx_n_s_idx2, __pyx_k_idx2, sizeof(__pyx_k_idx2), 0, 0, 1, 1}, - {&__pyx_n_s_idx3, __pyx_k_idx3, sizeof(__pyx_k_idx3), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, - {&__pyx_n_s_inv_atom_polarizabilities, __pyx_k_inv_atom_polarizabilities, sizeof(__pyx_k_inv_atom_polarizabilities), 0, 0, 1, 1}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, - {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, - {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, - {&__pyx_n_s_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 0, 1, 1}, - {&__pyx_n_s_kronecker, __pyx_k_kronecker, sizeof(__pyx_k_kronecker), 0, 0, 1, 1}, - {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_matrix, __pyx_k_matrix, sizeof(__pyx_k_matrix), 0, 0, 1, 1}, - {&__pyx_n_s_max_distance, __pyx_k_max_distance, sizeof(__pyx_k_max_distance), 0, 0, 1, 1}, - {&__pyx_n_s_maxdist, __pyx_k_maxdist, sizeof(__pyx_k_maxdist), 0, 0, 1, 1}, - {&__pyx_n_s_maxdt, __pyx_k_maxdt, sizeof(__pyx_k_maxdt), 0, 0, 1, 1}, - {&__pyx_n_s_maxshell, __pyx_k_maxshell, sizeof(__pyx_k_maxshell), 0, 0, 1, 1}, - {&__pyx_n_s_maxshell1, __pyx_k_maxshell1, sizeof(__pyx_k_maxshell1), 0, 0, 1, 1}, - {&__pyx_n_s_maxshell2, __pyx_k_maxshell2, sizeof(__pyx_k_maxshell2), 0, 0, 1, 1}, - {&__pyx_n_s_mdcage_timeseries, __pyx_k_mdcage_timeseries, sizeof(__pyx_k_mdcage_timeseries), 0, 0, 1, 1}, - {&__pyx_n_s_mdcage_ts, __pyx_k_mdcage_ts, sizeof(__pyx_k_mdcage_ts), 0, 0, 1, 1}, - {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, - {&__pyx_n_s_mergesort, __pyx_k_mergesort, sizeof(__pyx_k_mergesort), 0, 0, 1, 1}, - {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, - {&__pyx_n_s_minDistTesselation, __pyx_k_minDistTesselation, sizeof(__pyx_k_minDistTesselation), 0, 0, 1, 1}, - {&__pyx_n_s_min_dist, __pyx_k_min_dist, sizeof(__pyx_k_min_dist), 0, 0, 1, 1}, - {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_mol, __pyx_k_mol, sizeof(__pyx_k_mol), 0, 0, 1, 1}, - {&__pyx_n_s_multiVecShellCorrelate, __pyx_k_multiVecShellCorrelate, sizeof(__pyx_k_multiVecShellCorrelate), 0, 0, 1, 1}, - {&__pyx_n_s_multiVecVennShellCorrelate, __pyx_k_multiVecVennShellCorrelate, sizeof(__pyx_k_multiVecVennShellCorrelate), 0, 0, 1, 1}, - {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, - {&__pyx_n_s_n_atoms, __pyx_k_n_atoms, sizeof(__pyx_k_n_atoms), 0, 0, 1, 1}, - {&__pyx_n_s_n_aufpunkte, __pyx_k_n_aufpunkte, sizeof(__pyx_k_n_aufpunkte), 0, 0, 1, 1}, - {&__pyx_n_s_n_frames, __pyx_k_n_frames, sizeof(__pyx_k_n_frames), 0, 0, 1, 1}, - {&__pyx_n_s_n_ind_particles, __pyx_k_n_ind_particles, sizeof(__pyx_k_n_ind_particles), 0, 0, 1, 1}, - {&__pyx_n_s_n_iterations, __pyx_k_n_iterations, sizeof(__pyx_k_n_iterations), 0, 0, 1, 1}, - {&__pyx_n_s_n_pairs_h, __pyx_k_n_pairs_h, sizeof(__pyx_k_n_pairs_h), 0, 0, 1, 1}, - {&__pyx_n_s_n_particle_core, __pyx_k_n_particle_core, sizeof(__pyx_k_n_particle_core), 0, 0, 1, 1}, - {&__pyx_n_s_n_particle_surround, __pyx_k_n_particle_surround, sizeof(__pyx_k_n_particle_surround), 0, 0, 1, 1}, - {&__pyx_n_s_n_particles, __pyx_k_n_particles, sizeof(__pyx_k_n_particles), 0, 0, 1, 1}, - {&__pyx_n_s_n_particles1, __pyx_k_n_particles1, sizeof(__pyx_k_n_particles1), 0, 0, 1, 1}, - {&__pyx_n_s_n_particles2, __pyx_k_n_particles2, sizeof(__pyx_k_n_particles2), 0, 0, 1, 1}, - {&__pyx_n_s_n_particles_all, __pyx_k_n_particles_all, sizeof(__pyx_k_n_particles_all), 0, 0, 1, 1}, - {&__pyx_n_s_n_particles_ind, __pyx_k_n_particles_ind, sizeof(__pyx_k_n_particles_ind), 0, 0, 1, 1}, - {&__pyx_n_s_n_particles_tot, __pyx_k_n_particles_tot, sizeof(__pyx_k_n_particles_tot), 0, 0, 1, 1}, - {&__pyx_n_s_n_res_emim, __pyx_k_n_res_emim, sizeof(__pyx_k_n_res_emim), 0, 0, 1, 1}, - {&__pyx_n_s_n_self_pairs_h, __pyx_k_n_self_pairs_h, sizeof(__pyx_k_n_self_pairs_h), 0, 0, 1, 1}, - {&__pyx_n_s_n_shells, __pyx_k_n_shells, sizeof(__pyx_k_n_shells), 0, 0, 1, 1}, - {&__pyx_n_s_n_shells1, __pyx_k_n_shells1, sizeof(__pyx_k_n_shells1), 0, 0, 1, 1}, - {&__pyx_n_s_n_shells2, __pyx_k_n_shells2, sizeof(__pyx_k_n_shells2), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, - {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, - {&__pyx_n_s_new_2, __pyx_k_new_2, sizeof(__pyx_k_new_2), 0, 0, 1, 1}, - {&__pyx_n_s_newanalysis_miscellaneous, __pyx_k_newanalysis_miscellaneous, sizeof(__pyx_k_newanalysis_miscellaneous), 0, 0, 1, 1}, - {&__pyx_n_s_nmol, __pyx_k_nmol, sizeof(__pyx_k_nmol), 0, 0, 1, 1}, - {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, - {&__pyx_n_s_noe_task, __pyx_k_noe_task, sizeof(__pyx_k_noe_task), 0, 0, 1, 1}, - {&__pyx_n_s_noe_task___init, __pyx_k_noe_task___init, sizeof(__pyx_k_noe_task___init), 0, 0, 1, 1}, - {&__pyx_n_s_noe_task_pairiter, __pyx_k_noe_task_pairiter, sizeof(__pyx_k_noe_task_pairiter), 0, 0, 1, 1}, - {&__pyx_n_s_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 0, 0, 1, 1}, - {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, - {&__pyx_n_s_nres_surr, __pyx_k_nres_surr, sizeof(__pyx_k_nres_surr), 0, 0, 1, 1}, - {&__pyx_n_s_nres_wat, __pyx_k_nres_wat, sizeof(__pyx_k_nres_wat), 0, 0, 1, 1}, - {&__pyx_n_s_nshells, __pyx_k_nshells, sizeof(__pyx_k_nshells), 0, 0, 1, 1}, - {&__pyx_n_s_nshells1, __pyx_k_nshells1, sizeof(__pyx_k_nshells1), 0, 0, 1, 1}, - {&__pyx_n_s_nshells2, __pyx_k_nshells2, sizeof(__pyx_k_nshells2), 0, 0, 1, 1}, - {&__pyx_n_s_nsurr, __pyx_k_nsurr, sizeof(__pyx_k_nsurr), 0, 0, 1, 1}, - {&__pyx_n_s_number_aufpunkte, __pyx_k_number_aufpunkte, sizeof(__pyx_k_number_aufpunkte), 0, 0, 1, 1}, - {&__pyx_n_s_number_of_datapoints, __pyx_k_number_of_datapoints, sizeof(__pyx_k_number_of_datapoints), 0, 0, 1, 1}, - {&__pyx_n_s_number_of_frames, __pyx_k_number_of_frames, sizeof(__pyx_k_number_of_frames), 0, 0, 1, 1}, - {&__pyx_n_s_number_of_frames1, __pyx_k_number_of_frames1, sizeof(__pyx_k_number_of_frames1), 0, 0, 1, 1}, - {&__pyx_n_s_number_of_frames2, __pyx_k_number_of_frames2, sizeof(__pyx_k_number_of_frames2), 0, 0, 1, 1}, - {&__pyx_n_s_number_of_particles, __pyx_k_number_of_particles, sizeof(__pyx_k_number_of_particles), 0, 0, 1, 1}, - {&__pyx_n_s_number_of_shells, __pyx_k_number_of_shells, sizeof(__pyx_k_number_of_shells), 0, 0, 1, 1}, - {&__pyx_n_s_number_of_shells1, __pyx_k_number_of_shells1, sizeof(__pyx_k_number_of_shells1), 0, 0, 1, 1}, - {&__pyx_n_s_number_of_shells2, __pyx_k_number_of_shells2, sizeof(__pyx_k_number_of_shells2), 0, 0, 1, 1}, - {&__pyx_n_s_number_of_startingpoints, __pyx_k_number_of_startingpoints, sizeof(__pyx_k_number_of_startingpoints), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, - {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, - {&__pyx_n_s_nwat, __pyx_k_nwat, sizeof(__pyx_k_nwat), 0, 0, 1, 1}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1}, - {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1}, - {&__pyx_n_s_p1, __pyx_k_p1, sizeof(__pyx_k_p1), 0, 0, 1, 1}, - {&__pyx_n_s_p1_coor, __pyx_k_p1_coor, sizeof(__pyx_k_p1_coor), 0, 0, 1, 1}, - {&__pyx_n_s_p1l, __pyx_k_p1l, sizeof(__pyx_k_p1l), 0, 0, 1, 1}, - {&__pyx_n_s_p2, __pyx_k_p2, sizeof(__pyx_k_p2), 0, 0, 1, 1}, - {&__pyx_n_s_p2_coor, __pyx_k_p2_coor, sizeof(__pyx_k_p2_coor), 0, 0, 1, 1}, - {&__pyx_n_s_p2l, __pyx_k_p2l, sizeof(__pyx_k_p2l), 0, 0, 1, 1}, - {&__pyx_n_s_p_coor, __pyx_k_p_coor, sizeof(__pyx_k_p_coor), 0, 0, 1, 1}, - {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, - {&__pyx_n_s_pair, __pyx_k_pair, sizeof(__pyx_k_pair), 0, 0, 1, 1}, - {&__pyx_n_s_pair_1_par_1, __pyx_k_pair_1_par_1, sizeof(__pyx_k_pair_1_par_1), 0, 0, 1, 1}, - {&__pyx_n_s_pair_1_par_2, __pyx_k_pair_1_par_2, sizeof(__pyx_k_pair_1_par_2), 0, 0, 1, 1}, - {&__pyx_n_s_pair_2_par_1, __pyx_k_pair_2_par_1, sizeof(__pyx_k_pair_2_par_1), 0, 0, 1, 1}, - {&__pyx_n_s_pair_2_par_2, __pyx_k_pair_2_par_2, sizeof(__pyx_k_pair_2_par_2), 0, 0, 1, 1}, - {&__pyx_n_s_pairiter, __pyx_k_pairiter, sizeof(__pyx_k_pairiter), 0, 0, 1, 1}, - {&__pyx_n_s_pairlist, __pyx_k_pairlist, sizeof(__pyx_k_pairlist), 0, 0, 1, 1}, - {&__pyx_n_s_pairobject, __pyx_k_pairobject, sizeof(__pyx_k_pairobject), 0, 0, 1, 1}, - {&__pyx_n_s_pairobject___init, __pyx_k_pairobject___init, sizeof(__pyx_k_pairobject___init), 0, 0, 1, 1}, - {&__pyx_n_s_particle, __pyx_k_particle, sizeof(__pyx_k_particle), 0, 0, 1, 1}, - {&__pyx_n_s_particle1, __pyx_k_particle1, sizeof(__pyx_k_particle1), 0, 0, 1, 1}, - {&__pyx_n_s_particle2, __pyx_k_particle2, sizeof(__pyx_k_particle2), 0, 0, 1, 1}, - {&__pyx_n_s_particle_first, __pyx_k_particle_first, sizeof(__pyx_k_particle_first), 0, 0, 1, 1}, - {&__pyx_n_s_particles, __pyx_k_particles, sizeof(__pyx_k_particles), 0, 0, 1, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_n_s_pl, __pyx_k_pl, sizeof(__pyx_k_pl), 0, 0, 1, 1}, - {&__pyx_n_s_point, __pyx_k_point, sizeof(__pyx_k_point), 0, 0, 1, 1}, - {&__pyx_n_s_point1, __pyx_k_point1, sizeof(__pyx_k_point1), 0, 0, 1, 1}, - {&__pyx_n_s_point2, __pyx_k_point2, sizeof(__pyx_k_point2), 0, 0, 1, 1}, - {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_prev_atomic_dipoles, __pyx_k_prev_atomic_dipoles, sizeof(__pyx_k_prev_atomic_dipoles), 0, 0, 1, 1}, - {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, - {&__pyx_n_s_r2, __pyx_k_r2, sizeof(__pyx_k_r2), 0, 0, 1, 1}, - {&__pyx_n_s_r_0, __pyx_k_r_0, sizeof(__pyx_k_r_0), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1}, - {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1}, - {&__pyx_n_s_res1, __pyx_k_res1, sizeof(__pyx_k_res1), 0, 0, 1, 1}, - {&__pyx_n_s_res2, __pyx_k_res2, sizeof(__pyx_k_res2), 0, 0, 1, 1}, - {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, - {&__pyx_n_s_results, __pyx_k_results, sizeof(__pyx_k_results), 0, 0, 1, 1}, - {&__pyx_n_s_rotTs, __pyx_k_rotTs, sizeof(__pyx_k_rotTs), 0, 0, 1, 1}, - {&__pyx_n_s_rotationMatrixMultiShellCorrelat, __pyx_k_rotationMatrixMultiShellCorrelat, sizeof(__pyx_k_rotationMatrixMultiShellCorrelat), 0, 0, 1, 1}, - {&__pyx_n_s_rotationMatrixVennShellCorrelate, __pyx_k_rotationMatrixVennShellCorrelate, sizeof(__pyx_k_rotationMatrixVennShellCorrelate), 0, 0, 1, 1}, - {&__pyx_n_s_run, __pyx_k_run, sizeof(__pyx_k_run), 0, 0, 1, 1}, - {&__pyx_n_s_rv, __pyx_k_rv, sizeof(__pyx_k_rv), 0, 0, 1, 1}, - {&__pyx_n_s_segments_per_angstroem, __pyx_k_segments_per_angstroem, sizeof(__pyx_k_segments_per_angstroem), 0, 0, 1, 1}, - {&__pyx_n_s_segments_per_pi, __pyx_k_segments_per_pi, sizeof(__pyx_k_segments_per_pi), 0, 0, 1, 1}, - {&__pyx_n_s_segs, __pyx_k_segs, sizeof(__pyx_k_segs), 0, 0, 1, 1}, - {&__pyx_n_s_segs_per_angstroem, __pyx_k_segs_per_angstroem, sizeof(__pyx_k_segs_per_angstroem), 0, 0, 1, 1}, - {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, - {&__pyx_kp_s_self_too_sparse, __pyx_k_self_too_sparse, sizeof(__pyx_k_self_too_sparse), 0, 0, 1, 0}, - {&__pyx_n_s_selfcorr, __pyx_k_selfcorr, sizeof(__pyx_k_selfcorr), 0, 0, 1, 1}, - {&__pyx_n_s_selfctr, __pyx_k_selfctr, sizeof(__pyx_k_selfctr), 0, 0, 1, 1}, - {&__pyx_n_s_selflist, __pyx_k_selflist, sizeof(__pyx_k_selflist), 0, 0, 1, 1}, - {&__pyx_n_s_selfobj, __pyx_k_selfobj, sizeof(__pyx_k_selfobj), 0, 0, 1, 1}, - {&__pyx_n_s_selfobject, __pyx_k_selfobject, sizeof(__pyx_k_selfobject), 0, 0, 1, 1}, - {&__pyx_n_s_selfobject___init, __pyx_k_selfobject___init, sizeof(__pyx_k_selfobject___init), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, - {&__pyx_n_s_shell, __pyx_k_shell, sizeof(__pyx_k_shell), 0, 0, 1, 1}, - {&__pyx_n_s_shell1, __pyx_k_shell1, sizeof(__pyx_k_shell1), 0, 0, 1, 1}, - {&__pyx_n_s_shell2, __pyx_k_shell2, sizeof(__pyx_k_shell2), 0, 0, 1, 1}, - {&__pyx_n_s_shell3, __pyx_k_shell3, sizeof(__pyx_k_shell3), 0, 0, 1, 1}, - {&__pyx_n_s_shell4, __pyx_k_shell4, sizeof(__pyx_k_shell4), 0, 0, 1, 1}, - {&__pyx_n_s_shell5, __pyx_k_shell5, sizeof(__pyx_k_shell5), 0, 0, 1, 1}, - {&__pyx_n_s_shellHistograms, __pyx_k_shellHistograms, sizeof(__pyx_k_shellHistograms), 0, 0, 1, 1}, - {&__pyx_n_s_shell_01, __pyx_k_shell_01, sizeof(__pyx_k_shell_01), 0, 0, 1, 1}, - {&__pyx_n_s_shell_02, __pyx_k_shell_02, sizeof(__pyx_k_shell_02), 0, 0, 1, 1}, - {&__pyx_n_s_shell_03, __pyx_k_shell_03, sizeof(__pyx_k_shell_03), 0, 0, 1, 1}, - {&__pyx_n_s_shell_04, __pyx_k_shell_04, sizeof(__pyx_k_shell_04), 0, 0, 1, 1}, - {&__pyx_n_s_shell_05, __pyx_k_shell_05, sizeof(__pyx_k_shell_05), 0, 0, 1, 1}, - {&__pyx_n_s_shelldt, __pyx_k_shelldt, sizeof(__pyx_k_shelldt), 0, 0, 1, 1}, - {&__pyx_n_s_shelldt1, __pyx_k_shelldt1, sizeof(__pyx_k_shelldt1), 0, 0, 1, 1}, - {&__pyx_n_s_shelldt2, __pyx_k_shelldt2, sizeof(__pyx_k_shelldt2), 0, 0, 1, 1}, - {&__pyx_n_s_shells, __pyx_k_shells, sizeof(__pyx_k_shells), 0, 0, 1, 1}, - {&__pyx_n_s_shellstart, __pyx_k_shellstart, sizeof(__pyx_k_shellstart), 0, 0, 1, 1}, - {&__pyx_n_s_shellstart1, __pyx_k_shellstart1, sizeof(__pyx_k_shellstart1), 0, 0, 1, 1}, - {&__pyx_n_s_shellstart2, __pyx_k_shellstart2, sizeof(__pyx_k_shellstart2), 0, 0, 1, 1}, - {&__pyx_n_s_sign, __pyx_k_sign, sizeof(__pyx_k_sign), 0, 0, 1, 1}, - {&__pyx_n_s_sites_per_res, __pyx_k_sites_per_res, sizeof(__pyx_k_sites_per_res), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 0, 0, 1, 1}, - {&__pyx_n_s_sortCollectiveDipNNShells, __pyx_k_sortCollectiveDipNNShells, sizeof(__pyx_k_sortCollectiveDipNNShells), 0, 0, 1, 1}, - {&__pyx_n_s_sortCollectiveDipNNShellsInt, __pyx_k_sortCollectiveDipNNShellsInt, sizeof(__pyx_k_sortCollectiveDipNNShellsInt), 0, 0, 1, 1}, - {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1}, - {&__pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_k_src_helpers_miscellaneous_pyx, sizeof(__pyx_k_src_helpers_miscellaneous_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_startingpoints, __pyx_k_startingpoints, sizeof(__pyx_k_startingpoints), 0, 0, 1, 1}, - {&__pyx_n_s_startskip, __pyx_k_startskip, sizeof(__pyx_k_startskip), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_n_s_structureFactorCharge, __pyx_k_structureFactorCharge, sizeof(__pyx_k_structureFactorCharge), 0, 0, 1, 1}, - {&__pyx_n_s_structureFactorDipTen, __pyx_k_structureFactorDipTen, sizeof(__pyx_k_structureFactorDipTen), 0, 0, 1, 1}, - {&__pyx_n_s_sub_correlation, __pyx_k_sub_correlation, sizeof(__pyx_k_sub_correlation), 0, 0, 1, 1}, - {&__pyx_n_s_sumMultiMDCageSingle, __pyx_k_sumMultiMDCageSingle, sizeof(__pyx_k_sumMultiMDCageSingle), 0, 0, 1, 1}, - {&__pyx_n_s_sumUpByShell, __pyx_k_sumUpByShell, sizeof(__pyx_k_sumUpByShell), 0, 0, 1, 1}, - {&__pyx_n_s_sumVennMDCageSingle, __pyx_k_sumVennMDCageSingle, sizeof(__pyx_k_sumVennMDCageSingle), 0, 0, 1, 1}, - {&__pyx_n_s_t1, __pyx_k_t1, sizeof(__pyx_k_t1), 0, 0, 1, 1}, - {&__pyx_n_s_t2, __pyx_k_t2, sizeof(__pyx_k_t2), 0, 0, 1, 1}, - {&__pyx_n_s_t3, __pyx_k_t3, sizeof(__pyx_k_t3), 0, 0, 1, 1}, - {&__pyx_n_s_t4, __pyx_k_t4, sizeof(__pyx_k_t4), 0, 0, 1, 1}, - {&__pyx_n_s_t5, __pyx_k_t5, sizeof(__pyx_k_t5), 0, 0, 1, 1}, - {&__pyx_n_s_t6, __pyx_k_t6, sizeof(__pyx_k_t6), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_testParallelism, __pyx_k_testParallelism, sizeof(__pyx_k_testParallelism), 0, 0, 1, 1}, - {&__pyx_n_s_timeseries, __pyx_k_timeseries, sizeof(__pyx_k_timeseries), 0, 0, 1, 1}, - {&__pyx_n_s_timeseries1, __pyx_k_timeseries1, sizeof(__pyx_k_timeseries1), 0, 0, 1, 1}, - {&__pyx_n_s_timeseries2, __pyx_k_timeseries2, sizeof(__pyx_k_timeseries2), 0, 0, 1, 1}, - {&__pyx_n_s_timeseries_shellwise, __pyx_k_timeseries_shellwise, sizeof(__pyx_k_timeseries_shellwise), 0, 0, 1, 1}, - {&__pyx_kp_s_tot_too_sparse, __pyx_k_tot_too_sparse, sizeof(__pyx_k_tot_too_sparse), 0, 0, 1, 0}, - {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, - {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, - {&__pyx_n_s_unfold, __pyx_k_unfold, sizeof(__pyx_k_unfold), 0, 0, 1, 1}, - {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {&__pyx_n_s_vanHoveMultiVector, __pyx_k_vanHoveMultiVector, sizeof(__pyx_k_vanHoveMultiVector), 0, 0, 1, 1}, - {&__pyx_n_s_vanHoveSingleVector, __pyx_k_vanHoveSingleVector, sizeof(__pyx_k_vanHoveSingleVector), 0, 0, 1, 1}, - {&__pyx_n_s_vec, __pyx_k_vec, sizeof(__pyx_k_vec), 0, 0, 1, 1}, - {&__pyx_n_s_vel_ind, __pyx_k_vel_ind, sizeof(__pyx_k_vel_ind), 0, 0, 1, 1}, - {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, - {&__pyx_n_s_wat, __pyx_k_wat, sizeof(__pyx_k_wat), 0, 0, 1, 1}, - {&__pyx_n_s_writeKirkwoodHistogram, __pyx_k_writeKirkwoodHistogram, sizeof(__pyx_k_writeKirkwoodHistogram), 0, 0, 1, 1}, - {&__pyx_n_s_writeKirkwoodHistogram2D, __pyx_k_writeKirkwoodHistogram2D, sizeof(__pyx_k_writeKirkwoodHistogram2D), 0, 0, 1, 1}, - {&__pyx_n_s_writeKirkwoodHistogramShellwise, __pyx_k_writeKirkwoodHistogramShellwise, sizeof(__pyx_k_writeKirkwoodHistogramShellwise), 0, 0, 1, 1}, - {&__pyx_n_s_writeMrHistogram, __pyx_k_writeMrHistogram, sizeof(__pyx_k_writeMrHistogram), 0, 0, 1, 1}, - {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, - {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, + {&__pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_k_All_dimensions_preceding_dimensi, sizeof(__pyx_k_All_dimensions_preceding_dimensi), 0, 0, 1, 0}, + {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, + {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, + {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, + {&__pyx_kp_u_Cannot_index_with_type, __pyx_k_Cannot_index_with_type, sizeof(__pyx_k_Cannot_index_with_type), 0, 1, 0, 0}, + {&__pyx_kp_s_Cannot_transpose_memoryview_with, __pyx_k_Cannot_transpose_memoryview_with, sizeof(__pyx_k_Cannot_transpose_memoryview_with), 0, 0, 1, 0}, + {&__pyx_kp_s_Correlation_length_must_not_be_l, __pyx_k_Correlation_length_must_not_be_l, sizeof(__pyx_k_Correlation_length_must_not_be_l), 0, 0, 1, 0}, + {&__pyx_n_s_D, __pyx_k_D, sizeof(__pyx_k_D), 0, 0, 1, 1}, + {&__pyx_n_s_D_x, __pyx_k_D_x, sizeof(__pyx_k_D_x), 0, 0, 1, 1}, + {&__pyx_n_s_D_y, __pyx_k_D_y, sizeof(__pyx_k_D_y), 0, 0, 1, 1}, + {&__pyx_n_s_D_z, __pyx_k_D_z, sizeof(__pyx_k_D_z), 0, 0, 1, 1}, + {&__pyx_kp_s_Dimension_d_is_not_direct, __pyx_k_Dimension_d_is_not_direct, sizeof(__pyx_k_Dimension_d_is_not_direct), 0, 0, 1, 0}, + {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, + {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, + {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_k_Index_out_of_bounds_axis_d, sizeof(__pyx_k_Index_out_of_bounds_axis_d), 0, 0, 1, 0}, + {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, + {&__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 1, 0, 0}, + {&__pyx_kp_u_Invalid_shape_in_axis, __pyx_k_Invalid_shape_in_axis, sizeof(__pyx_k_Invalid_shape_in_axis), 0, 1, 0, 0}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, + {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, + {&__pyx_kp_s_Number_of_starting_points_too_hi, __pyx_k_Number_of_starting_points_too_hi, sizeof(__pyx_k_Number_of_starting_points_too_hi), 0, 0, 1, 0}, + {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, + {&__pyx_kp_u_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 1, 0, 0}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1}, + {&__pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_k_Step_may_not_be_zero_axis_d, sizeof(__pyx_k_Step_may_not_be_zero_axis_d), 0, 0, 1, 0}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, + {&__pyx_kp_s_Warning_number_of_frames_correla, __pyx_k_Warning_number_of_frames_correla, sizeof(__pyx_k_Warning_number_of_frames_correla), 0, 0, 1, 0}, + {&__pyx_n_s__155, __pyx_k__155, sizeof(__pyx_k__155), 0, 0, 1, 1}, + {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, + {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, + {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, + {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, + {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1}, + {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, + {&__pyx_n_s_accumulateNMShellwiseGFunction, __pyx_k_accumulateNMShellwiseGFunction, sizeof(__pyx_k_accumulateNMShellwiseGFunction), 0, 0, 1, 1}, + {&__pyx_n_s_accumulateShellwiseGFunction, __pyx_k_accumulateShellwiseGFunction, sizeof(__pyx_k_accumulateShellwiseGFunction), 0, 0, 1, 1}, + {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1}, + {&__pyx_kp_u_and, __pyx_k_and, sizeof(__pyx_k_and), 0, 1, 0, 0}, + {&__pyx_n_s_antagonist, __pyx_k_antagonist, sizeof(__pyx_k_antagonist), 0, 0, 1, 1}, + {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, + {&__pyx_n_s_apr_emim_h, __pyx_k_apr_emim_h, sizeof(__pyx_k_apr_emim_h), 0, 0, 1, 1}, + {&__pyx_n_s_apr_pair, __pyx_k_apr_pair, sizeof(__pyx_k_apr_pair), 0, 0, 1, 1}, + {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_atom, __pyx_k_atom, sizeof(__pyx_k_atom), 0, 0, 1, 1}, + {&__pyx_n_s_atomicIndDip, __pyx_k_atomicIndDip, sizeof(__pyx_k_atomicIndDip), 0, 0, 1, 1}, + {&__pyx_n_s_atomicIndDipPerAtom, __pyx_k_atomicIndDipPerAtom, sizeof(__pyx_k_atomicIndDipPerAtom), 0, 0, 1, 1}, + {&__pyx_n_s_atomic_dipoles, __pyx_k_atomic_dipoles, sizeof(__pyx_k_atomic_dipoles), 0, 0, 1, 1}, + {&__pyx_n_s_aufpunkt, __pyx_k_aufpunkt, sizeof(__pyx_k_aufpunkt), 0, 0, 1, 1}, + {&__pyx_n_s_aufpunkt_dipol, __pyx_k_aufpunkt_dipol, sizeof(__pyx_k_aufpunkt_dipol), 0, 0, 1, 1}, + {&__pyx_n_s_aufpunkt_dipole, __pyx_k_aufpunkt_dipole, sizeof(__pyx_k_aufpunkt_dipole), 0, 0, 1, 1}, + {&__pyx_n_s_aufpunkte, __pyx_k_aufpunkte, sizeof(__pyx_k_aufpunkte), 0, 0, 1, 1}, + {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1}, + {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, + {&__pyx_n_s_best_index, __pyx_k_best_index, sizeof(__pyx_k_best_index), 0, 0, 1, 1}, + {&__pyx_n_s_bin, __pyx_k_bin, sizeof(__pyx_k_bin), 0, 0, 1, 1}, + {&__pyx_n_s_bin1, __pyx_k_bin1, sizeof(__pyx_k_bin1), 0, 0, 1, 1}, + {&__pyx_n_s_bin2, __pyx_k_bin2, sizeof(__pyx_k_bin2), 0, 0, 1, 1}, + {&__pyx_n_s_bin_dist, __pyx_k_bin_dist, sizeof(__pyx_k_bin_dist), 0, 0, 1, 1}, + {&__pyx_n_s_bin_width, __pyx_k_bin_width, sizeof(__pyx_k_bin_width), 0, 0, 1, 1}, + {&__pyx_n_s_bins, __pyx_k_bins, sizeof(__pyx_k_bins), 0, 0, 1, 1}, + {&__pyx_n_s_binwidth, __pyx_k_binwidth, sizeof(__pyx_k_binwidth), 0, 0, 1, 1}, + {&__pyx_n_s_blen2, __pyx_k_blen2, sizeof(__pyx_k_blen2), 0, 0, 1, 1}, + {&__pyx_n_s_bond_table, __pyx_k_bond_table, sizeof(__pyx_k_bond_table), 0, 0, 1, 1}, + {&__pyx_n_s_both_directions, __pyx_k_both_directions, sizeof(__pyx_k_both_directions), 0, 0, 1, 1}, + {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, + {&__pyx_n_s_boxlength, __pyx_k_boxlength, sizeof(__pyx_k_boxlength), 0, 0, 1, 1}, + {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, + {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, + {&__pyx_n_s_calcDipTenCollective, __pyx_k_calcDipTenCollective, sizeof(__pyx_k_calcDipTenCollective), 0, 0, 1, 1}, + {&__pyx_n_s_calcDipTenCollective1NShellwiseC, __pyx_k_calcDipTenCollective1NShellwiseC, sizeof(__pyx_k_calcDipTenCollective1NShellwiseC), 0, 0, 1, 1}, + {&__pyx_n_s_calcDipTenCollective1NShellwiseS, __pyx_k_calcDipTenCollective1NShellwiseS, sizeof(__pyx_k_calcDipTenCollective1NShellwiseS), 0, 0, 1, 1}, + {&__pyx_n_s_calcDipTenCollectiveCross, __pyx_k_calcDipTenCollectiveCross, sizeof(__pyx_k_calcDipTenCollectiveCross), 0, 0, 1, 1}, + {&__pyx_n_s_calcDipTenCollectiveNNShellwise, __pyx_k_calcDipTenCollectiveNNShellwise, sizeof(__pyx_k_calcDipTenCollectiveNNShellwise), 0, 0, 1, 1}, + {&__pyx_n_s_calcDipTenCollectiveNNShellwiseC, __pyx_k_calcDipTenCollectiveNNShellwiseC, sizeof(__pyx_k_calcDipTenCollectiveNNShellwiseC), 0, 0, 1, 1}, + {&__pyx_n_s_calcDipTenCollectiveNNShellwiseS, __pyx_k_calcDipTenCollectiveNNShellwiseS, sizeof(__pyx_k_calcDipTenCollectiveNNShellwiseS), 0, 0, 1, 1}, + {&__pyx_n_s_calcDipTenCollectivePerAtom, __pyx_k_calcDipTenCollectivePerAtom, sizeof(__pyx_k_calcDipTenCollectivePerAtom), 0, 0, 1, 1}, + {&__pyx_n_s_calcDipTenCollectiveShellwise, __pyx_k_calcDipTenCollectiveShellwise, sizeof(__pyx_k_calcDipTenCollectiveShellwise), 0, 0, 1, 1}, + {&__pyx_n_s_calcDipTenCollectiveVennShellwis, __pyx_k_calcDipTenCollectiveVennShellwis, sizeof(__pyx_k_calcDipTenCollectiveVennShellwis), 0, 0, 1, 1}, + {&__pyx_n_s_calcDistanceDelauny, __pyx_k_calcDistanceDelauny, sizeof(__pyx_k_calcDistanceDelauny), 0, 0, 1, 1}, + {&__pyx_n_s_calcDistanceDelaunyMindist, __pyx_k_calcDistanceDelaunyMindist, sizeof(__pyx_k_calcDistanceDelaunyMindist), 0, 0, 1, 1}, + {&__pyx_n_s_cardinality, __pyx_k_cardinality, sizeof(__pyx_k_cardinality), 0, 0, 1, 1}, + {&__pyx_n_s_charges, __pyx_k_charges, sizeof(__pyx_k_charges), 0, 0, 1, 1}, + {&__pyx_n_s_cl, __pyx_k_cl, sizeof(__pyx_k_cl), 0, 0, 1, 1}, + {&__pyx_n_s_cl_self, __pyx_k_cl_self, sizeof(__pyx_k_cl_self), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_closest_shell, __pyx_k_closest_shell, sizeof(__pyx_k_closest_shell), 0, 0, 1, 1}, + {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, + {&__pyx_kp_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 0}, + {&__pyx_n_s_collectiveDipolesCutoff, __pyx_k_collectiveDipolesCutoff, sizeof(__pyx_k_collectiveDipolesCutoff), 0, 0, 1, 1}, + {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, + {&__pyx_n_s_coo1, __pyx_k_coo1, sizeof(__pyx_k_coo1), 0, 0, 1, 1}, + {&__pyx_n_s_coo2, __pyx_k_coo2, sizeof(__pyx_k_coo2), 0, 0, 1, 1}, + {&__pyx_n_s_coor, __pyx_k_coor, sizeof(__pyx_k_coor), 0, 0, 1, 1}, + {&__pyx_n_s_coor1, __pyx_k_coor1, sizeof(__pyx_k_coor1), 0, 0, 1, 1}, + {&__pyx_n_s_coor2, __pyx_k_coor2, sizeof(__pyx_k_coor2), 0, 0, 1, 1}, + {&__pyx_n_s_coor_core, __pyx_k_coor_core, sizeof(__pyx_k_coor_core), 0, 0, 1, 1}, + {&__pyx_n_s_coor_i, __pyx_k_coor_i, sizeof(__pyx_k_coor_i), 0, 0, 1, 1}, + {&__pyx_n_s_coor_j, __pyx_k_coor_j, sizeof(__pyx_k_coor_j), 0, 0, 1, 1}, + {&__pyx_n_s_coor_oh2, __pyx_k_coor_oh2, sizeof(__pyx_k_coor_oh2), 0, 0, 1, 1}, + {&__pyx_n_s_coor_res, __pyx_k_coor_res, sizeof(__pyx_k_coor_res), 0, 0, 1, 1}, + {&__pyx_n_s_coor_surr, __pyx_k_coor_surr, sizeof(__pyx_k_coor_surr), 0, 0, 1, 1}, + {&__pyx_n_s_coor_surround, __pyx_k_coor_surround, sizeof(__pyx_k_coor_surround), 0, 0, 1, 1}, + {&__pyx_n_s_coors, __pyx_k_coors, sizeof(__pyx_k_coors), 0, 0, 1, 1}, + {&__pyx_n_s_coors_ind, __pyx_k_coors_ind, sizeof(__pyx_k_coors_ind), 0, 0, 1, 1}, + {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, + {&__pyx_n_s_corr, __pyx_k_corr, sizeof(__pyx_k_corr), 0, 0, 1, 1}, + {&__pyx_n_s_correlateMultiVector, __pyx_k_correlateMultiVector, sizeof(__pyx_k_correlateMultiVector), 0, 0, 1, 1}, + {&__pyx_n_s_correlateMultiVectorShellwise, __pyx_k_correlateMultiVectorShellwise, sizeof(__pyx_k_correlateMultiVectorShellwise), 0, 0, 1, 1}, + {&__pyx_n_s_correlateMultiVectorVennShellwis, __pyx_k_correlateMultiVectorVennShellwis, sizeof(__pyx_k_correlateMultiVectorVennShellwis), 0, 0, 1, 1}, + {&__pyx_n_s_correlateSingleParticleMuShellwi, __pyx_k_correlateSingleParticleMuShellwi, sizeof(__pyx_k_correlateSingleParticleMuShellwi), 0, 0, 1, 1}, + {&__pyx_n_s_correlateSingleParticleMuVennShe, __pyx_k_correlateSingleParticleMuVennShe, sizeof(__pyx_k_correlateSingleParticleMuVennShe), 0, 0, 1, 1}, + {&__pyx_n_s_correlateSingleVector, __pyx_k_correlateSingleVector, sizeof(__pyx_k_correlateSingleVector), 0, 0, 1, 1}, + {&__pyx_n_s_correlation_length, __pyx_k_correlation_length, sizeof(__pyx_k_correlation_length), 0, 0, 1, 1}, + {&__pyx_n_s_cos_angle, __pyx_k_cos_angle, sizeof(__pyx_k_cos_angle), 0, 0, 1, 1}, + {&__pyx_n_s_cos_segs, __pyx_k_cos_segs, sizeof(__pyx_k_cos_segs), 0, 0, 1, 1}, + {&__pyx_n_s_cosine, __pyx_k_cosine, sizeof(__pyx_k_cosine), 0, 0, 1, 1}, + {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, + {&__pyx_n_s_countHBonds, __pyx_k_countHBonds, sizeof(__pyx_k_countHBonds), 0, 0, 1, 1}, + {&__pyx_n_s_countMultiShell, __pyx_k_countMultiShell, sizeof(__pyx_k_countMultiShell), 0, 0, 1, 1}, + {&__pyx_n_s_countVennShellOccupation, __pyx_k_countVennShellOccupation, sizeof(__pyx_k_countVennShellOccupation), 0, 0, 1, 1}, + {&__pyx_n_s_counter, __pyx_k_counter, sizeof(__pyx_k_counter), 0, 0, 1, 1}, + {&__pyx_n_s_crossCorrelateMultiVector, __pyx_k_crossCorrelateMultiVector, sizeof(__pyx_k_crossCorrelateMultiVector), 0, 0, 1, 1}, + {&__pyx_n_s_crossCorrelateSingleVector, __pyx_k_crossCorrelateSingleVector, sizeof(__pyx_k_crossCorrelateSingleVector), 0, 0, 1, 1}, + {&__pyx_n_s_crosscorr, __pyx_k_crosscorr, sizeof(__pyx_k_crosscorr), 0, 0, 1, 1}, + {&__pyx_n_s_crossctr, __pyx_k_crossctr, sizeof(__pyx_k_crossctr), 0, 0, 1, 1}, + {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, + {&__pyx_n_s_cutoff, __pyx_k_cutoff, sizeof(__pyx_k_cutoff), 0, 0, 1, 1}, + {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, + {&__pyx_n_s_dataset, __pyx_k_dataset, sizeof(__pyx_k_dataset), 0, 0, 1, 1}, + {&__pyx_n_s_dataset1, __pyx_k_dataset1, sizeof(__pyx_k_dataset1), 0, 0, 1, 1}, + {&__pyx_n_s_dataset2, __pyx_k_dataset2, sizeof(__pyx_k_dataset2), 0, 0, 1, 1}, + {&__pyx_n_s_delauny_matrix, __pyx_k_delauny_matrix, sizeof(__pyx_k_delauny_matrix), 0, 0, 1, 1}, + {&__pyx_n_s_deriveIndDip, __pyx_k_deriveIndDip, sizeof(__pyx_k_deriveIndDip), 0, 0, 1, 1}, + {&__pyx_n_s_deriveIndDipPerAtom, __pyx_k_deriveIndDipPerAtom, sizeof(__pyx_k_deriveIndDipPerAtom), 0, 0, 1, 1}, + {&__pyx_n_s_derived_atomic_dipoles, __pyx_k_derived_atomic_dipoles, sizeof(__pyx_k_derived_atomic_dipoles), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_n_s_dip, __pyx_k_dip, sizeof(__pyx_k_dip), 0, 0, 1, 1}, + {&__pyx_n_s_dipTen, __pyx_k_dipTen, sizeof(__pyx_k_dipTen), 0, 0, 1, 1}, + {&__pyx_n_s_dip_inside, __pyx_k_dip_inside, sizeof(__pyx_k_dip_inside), 0, 0, 1, 1}, + {&__pyx_n_s_dip_outside, __pyx_k_dip_outside, sizeof(__pyx_k_dip_outside), 0, 0, 1, 1}, + {&__pyx_n_s_dip_res, __pyx_k_dip_res, sizeof(__pyx_k_dip_res), 0, 0, 1, 1}, + {&__pyx_n_s_dip_shell, __pyx_k_dip_shell, sizeof(__pyx_k_dip_shell), 0, 0, 1, 1}, + {&__pyx_n_s_dip_wat, __pyx_k_dip_wat, sizeof(__pyx_k_dip_wat), 0, 0, 1, 1}, + {&__pyx_n_s_dipoles, __pyx_k_dipoles, sizeof(__pyx_k_dipoles), 0, 0, 1, 1}, + {&__pyx_n_s_dipt, __pyx_k_dipt, sizeof(__pyx_k_dipt), 0, 0, 1, 1}, + {&__pyx_n_s_dipt_0, __pyx_k_dipt_0, sizeof(__pyx_k_dipt_0), 0, 0, 1, 1}, + {&__pyx_n_s_dipt_0_self, __pyx_k_dipt_0_self, sizeof(__pyx_k_dipt_0_self), 0, 0, 1, 1}, + {&__pyx_n_s_dipt_t, __pyx_k_dipt_t, sizeof(__pyx_k_dipt_t), 0, 0, 1, 1}, + {&__pyx_n_s_dipt_t_self, __pyx_k_dipt_t_self, sizeof(__pyx_k_dipt_t_self), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1}, + {&__pyx_n_s_dist1, __pyx_k_dist1, sizeof(__pyx_k_dist1), 0, 0, 1, 1}, + {&__pyx_n_s_dist2, __pyx_k_dist2, sizeof(__pyx_k_dist2), 0, 0, 1, 1}, + {&__pyx_n_s_dist_2, __pyx_k_dist_2, sizeof(__pyx_k_dist_2), 0, 0, 1, 1}, + {&__pyx_n_s_dist_3, __pyx_k_dist_3, sizeof(__pyx_k_dist_3), 0, 0, 1, 1}, + {&__pyx_n_s_dist_sq, __pyx_k_dist_sq, sizeof(__pyx_k_dist_sq), 0, 0, 1, 1}, + {&__pyx_n_s_distance, __pyx_k_distance, sizeof(__pyx_k_distance), 0, 0, 1, 1}, + {&__pyx_n_s_distances, __pyx_k_distances, sizeof(__pyx_k_distances), 0, 0, 1, 1}, + {&__pyx_n_s_distances_copy, __pyx_k_distances_copy, sizeof(__pyx_k_distances_copy), 0, 0, 1, 1}, + {&__pyx_n_s_distvec, __pyx_k_distvec, sizeof(__pyx_k_distvec), 0, 0, 1, 1}, + {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, + {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1}, + {&__pyx_n_s_dot2, __pyx_k_dot2, sizeof(__pyx_k_dot2), 0, 0, 1, 1}, + {&__pyx_n_s_ds, __pyx_k_ds, sizeof(__pyx_k_ds), 0, 0, 1, 1}, + {&__pyx_n_s_ds1, __pyx_k_ds1, sizeof(__pyx_k_ds1), 0, 0, 1, 1}, + {&__pyx_n_s_ds1_idx, __pyx_k_ds1_idx, sizeof(__pyx_k_ds1_idx), 0, 0, 1, 1}, + {&__pyx_n_s_ds2, __pyx_k_ds2, sizeof(__pyx_k_ds2), 0, 0, 1, 1}, + {&__pyx_n_s_ds2_idx, __pyx_k_ds2_idx, sizeof(__pyx_k_ds2_idx), 0, 0, 1, 1}, + {&__pyx_n_s_ds3, __pyx_k_ds3, sizeof(__pyx_k_ds3), 0, 0, 1, 1}, + {&__pyx_n_s_ds4, __pyx_k_ds4, sizeof(__pyx_k_ds4), 0, 0, 1, 1}, + {&__pyx_n_s_ds5, __pyx_k_ds5, sizeof(__pyx_k_ds5), 0, 0, 1, 1}, + {&__pyx_n_s_ds_idx, __pyx_k_ds_idx, sizeof(__pyx_k_ds_idx), 0, 0, 1, 1}, + {&__pyx_n_s_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, + {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1}, + {&__pyx_n_s_dx2, __pyx_k_dx2, sizeof(__pyx_k_dx2), 0, 0, 1, 1}, + {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1}, + {&__pyx_n_s_dy2, __pyx_k_dy2, sizeof(__pyx_k_dy2), 0, 0, 1, 1}, + {&__pyx_n_s_dz, __pyx_k_dz, sizeof(__pyx_k_dz), 0, 0, 1, 1}, + {&__pyx_n_s_dz2, __pyx_k_dz2, sizeof(__pyx_k_dz2), 0, 0, 1, 1}, + {&__pyx_n_s_emim_h, __pyx_k_emim_h, sizeof(__pyx_k_emim_h), 0, 0, 1, 1}, + {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_energy1, __pyx_k_energy1, sizeof(__pyx_k_energy1), 0, 0, 1, 1}, + {&__pyx_n_s_energy2, __pyx_k_energy2, sizeof(__pyx_k_energy2), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, + {&__pyx_n_s_f1, __pyx_k_f1, sizeof(__pyx_k_f1), 0, 0, 1, 1}, + {&__pyx_n_s_f2, __pyx_k_f2, sizeof(__pyx_k_f2), 0, 0, 1, 1}, + {&__pyx_n_s_f2c, __pyx_k_f2c, sizeof(__pyx_k_f2c), 0, 0, 1, 1}, + {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, + {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, + {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, + {&__pyx_n_s_frame, __pyx_k_frame, sizeof(__pyx_k_frame), 0, 0, 1, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_getBestIndex, __pyx_k_getBestIndex, sizeof(__pyx_k_getBestIndex), 0, 0, 1, 1}, + {&__pyx_n_s_getBestIndices, __pyx_k_getBestIndices, sizeof(__pyx_k_getBestIndices), 0, 0, 1, 1}, + {&__pyx_n_s_getBondTable, __pyx_k_getBondTable, sizeof(__pyx_k_getBondTable), 0, 0, 1, 1}, + {&__pyx_n_s_getPolarizabilityMatrix, __pyx_k_getPolarizabilityMatrix, sizeof(__pyx_k_getPolarizabilityMatrix), 0, 0, 1, 1}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0}, + {&__pyx_kp_u_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 1, 0, 0}, + {&__pyx_n_s_hbond, __pyx_k_hbond, sizeof(__pyx_k_hbond), 0, 0, 1, 1}, + {&__pyx_n_s_histo_max, __pyx_k_histo_max, sizeof(__pyx_k_histo_max), 0, 0, 1, 1}, + {&__pyx_n_s_histo_min, __pyx_k_histo_min, sizeof(__pyx_k_histo_min), 0, 0, 1, 1}, + {&__pyx_n_s_histogram, __pyx_k_histogram, sizeof(__pyx_k_histogram), 0, 0, 1, 1}, + {&__pyx_n_s_histograms, __pyx_k_histograms, sizeof(__pyx_k_histograms), 0, 0, 1, 1}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1}, + {&__pyx_n_s_idx2, __pyx_k_idx2, sizeof(__pyx_k_idx2), 0, 0, 1, 1}, + {&__pyx_n_s_idx3, __pyx_k_idx3, sizeof(__pyx_k_idx3), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, + {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, + {&__pyx_n_s_init_subclass, __pyx_k_init_subclass, sizeof(__pyx_k_init_subclass), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1}, + {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, + {&__pyx_n_s_inv_atom_polarizabilities, __pyx_k_inv_atom_polarizabilities, sizeof(__pyx_k_inv_atom_polarizabilities), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, + {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, + {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, + {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, + {&__pyx_n_s_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 0, 1, 1}, + {&__pyx_n_s_kronecker, __pyx_k_kronecker, sizeof(__pyx_k_kronecker), 0, 0, 1, 1}, + {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_matrix, __pyx_k_matrix, sizeof(__pyx_k_matrix), 0, 0, 1, 1}, + {&__pyx_n_s_max_distance, __pyx_k_max_distance, sizeof(__pyx_k_max_distance), 0, 0, 1, 1}, + {&__pyx_n_s_maxdist, __pyx_k_maxdist, sizeof(__pyx_k_maxdist), 0, 0, 1, 1}, + {&__pyx_n_s_maxdt, __pyx_k_maxdt, sizeof(__pyx_k_maxdt), 0, 0, 1, 1}, + {&__pyx_n_s_maxshell, __pyx_k_maxshell, sizeof(__pyx_k_maxshell), 0, 0, 1, 1}, + {&__pyx_n_s_maxshell1, __pyx_k_maxshell1, sizeof(__pyx_k_maxshell1), 0, 0, 1, 1}, + {&__pyx_n_s_maxshell2, __pyx_k_maxshell2, sizeof(__pyx_k_maxshell2), 0, 0, 1, 1}, + {&__pyx_n_s_mdcage_timeseries, __pyx_k_mdcage_timeseries, sizeof(__pyx_k_mdcage_timeseries), 0, 0, 1, 1}, + {&__pyx_n_s_mdcage_ts, __pyx_k_mdcage_ts, sizeof(__pyx_k_mdcage_ts), 0, 0, 1, 1}, + {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, + {&__pyx_n_s_mergesort, __pyx_k_mergesort, sizeof(__pyx_k_mergesort), 0, 0, 1, 1}, + {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, + {&__pyx_n_s_minDistTesselation, __pyx_k_minDistTesselation, sizeof(__pyx_k_minDistTesselation), 0, 0, 1, 1}, + {&__pyx_n_s_min_dist, __pyx_k_min_dist, sizeof(__pyx_k_min_dist), 0, 0, 1, 1}, + {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, + {&__pyx_n_s_mol, __pyx_k_mol, sizeof(__pyx_k_mol), 0, 0, 1, 1}, + {&__pyx_n_s_multiVecShellCorrelate, __pyx_k_multiVecShellCorrelate, sizeof(__pyx_k_multiVecShellCorrelate), 0, 0, 1, 1}, + {&__pyx_n_s_multiVecVennShellCorrelate, __pyx_k_multiVecVennShellCorrelate, sizeof(__pyx_k_multiVecVennShellCorrelate), 0, 0, 1, 1}, + {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, + {&__pyx_n_s_n_atoms, __pyx_k_n_atoms, sizeof(__pyx_k_n_atoms), 0, 0, 1, 1}, + {&__pyx_n_s_n_aufpunkte, __pyx_k_n_aufpunkte, sizeof(__pyx_k_n_aufpunkte), 0, 0, 1, 1}, + {&__pyx_n_s_n_frames, __pyx_k_n_frames, sizeof(__pyx_k_n_frames), 0, 0, 1, 1}, + {&__pyx_n_s_n_ind_particles, __pyx_k_n_ind_particles, sizeof(__pyx_k_n_ind_particles), 0, 0, 1, 1}, + {&__pyx_n_s_n_iterations, __pyx_k_n_iterations, sizeof(__pyx_k_n_iterations), 0, 0, 1, 1}, + {&__pyx_n_s_n_pairs_h, __pyx_k_n_pairs_h, sizeof(__pyx_k_n_pairs_h), 0, 0, 1, 1}, + {&__pyx_n_s_n_particle_core, __pyx_k_n_particle_core, sizeof(__pyx_k_n_particle_core), 0, 0, 1, 1}, + {&__pyx_n_s_n_particle_surround, __pyx_k_n_particle_surround, sizeof(__pyx_k_n_particle_surround), 0, 0, 1, 1}, + {&__pyx_n_s_n_particles, __pyx_k_n_particles, sizeof(__pyx_k_n_particles), 0, 0, 1, 1}, + {&__pyx_n_s_n_particles1, __pyx_k_n_particles1, sizeof(__pyx_k_n_particles1), 0, 0, 1, 1}, + {&__pyx_n_s_n_particles2, __pyx_k_n_particles2, sizeof(__pyx_k_n_particles2), 0, 0, 1, 1}, + {&__pyx_n_s_n_particles_all, __pyx_k_n_particles_all, sizeof(__pyx_k_n_particles_all), 0, 0, 1, 1}, + {&__pyx_n_s_n_particles_ind, __pyx_k_n_particles_ind, sizeof(__pyx_k_n_particles_ind), 0, 0, 1, 1}, + {&__pyx_n_s_n_particles_tot, __pyx_k_n_particles_tot, sizeof(__pyx_k_n_particles_tot), 0, 0, 1, 1}, + {&__pyx_n_s_n_res_emim, __pyx_k_n_res_emim, sizeof(__pyx_k_n_res_emim), 0, 0, 1, 1}, + {&__pyx_n_s_n_self_pairs_h, __pyx_k_n_self_pairs_h, sizeof(__pyx_k_n_self_pairs_h), 0, 0, 1, 1}, + {&__pyx_n_s_n_shells, __pyx_k_n_shells, sizeof(__pyx_k_n_shells), 0, 0, 1, 1}, + {&__pyx_n_s_n_shells1, __pyx_k_n_shells1, sizeof(__pyx_k_n_shells1), 0, 0, 1, 1}, + {&__pyx_n_s_n_shells2, __pyx_k_n_shells2, sizeof(__pyx_k_n_shells2), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_n_s_new_2, __pyx_k_new_2, sizeof(__pyx_k_new_2), 0, 0, 1, 1}, + {&__pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_k_newanalysis_helpers_miscellaneou, sizeof(__pyx_k_newanalysis_helpers_miscellaneou), 0, 0, 1, 0}, + {&__pyx_n_s_newanalysis_miscellaneous, __pyx_k_newanalysis_miscellaneous, sizeof(__pyx_k_newanalysis_miscellaneous), 0, 0, 1, 1}, + {&__pyx_n_s_nmol, __pyx_k_nmol, sizeof(__pyx_k_nmol), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, + {&__pyx_n_s_noe_task, __pyx_k_noe_task, sizeof(__pyx_k_noe_task), 0, 0, 1, 1}, + {&__pyx_n_s_noe_task___init, __pyx_k_noe_task___init, sizeof(__pyx_k_noe_task___init), 0, 0, 1, 1}, + {&__pyx_n_s_noe_task_pairiter, __pyx_k_noe_task_pairiter, sizeof(__pyx_k_noe_task_pairiter), 0, 0, 1, 1}, + {&__pyx_n_s_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 0, 0, 1, 1}, + {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_nres_surr, __pyx_k_nres_surr, sizeof(__pyx_k_nres_surr), 0, 0, 1, 1}, + {&__pyx_n_s_nres_wat, __pyx_k_nres_wat, sizeof(__pyx_k_nres_wat), 0, 0, 1, 1}, + {&__pyx_n_s_nshells, __pyx_k_nshells, sizeof(__pyx_k_nshells), 0, 0, 1, 1}, + {&__pyx_n_s_nshells1, __pyx_k_nshells1, sizeof(__pyx_k_nshells1), 0, 0, 1, 1}, + {&__pyx_n_s_nshells2, __pyx_k_nshells2, sizeof(__pyx_k_nshells2), 0, 0, 1, 1}, + {&__pyx_n_s_nsurr, __pyx_k_nsurr, sizeof(__pyx_k_nsurr), 0, 0, 1, 1}, + {&__pyx_n_s_number_aufpunkte, __pyx_k_number_aufpunkte, sizeof(__pyx_k_number_aufpunkte), 0, 0, 1, 1}, + {&__pyx_n_s_number_of_datapoints, __pyx_k_number_of_datapoints, sizeof(__pyx_k_number_of_datapoints), 0, 0, 1, 1}, + {&__pyx_n_s_number_of_frames, __pyx_k_number_of_frames, sizeof(__pyx_k_number_of_frames), 0, 0, 1, 1}, + {&__pyx_n_s_number_of_frames1, __pyx_k_number_of_frames1, sizeof(__pyx_k_number_of_frames1), 0, 0, 1, 1}, + {&__pyx_n_s_number_of_frames2, __pyx_k_number_of_frames2, sizeof(__pyx_k_number_of_frames2), 0, 0, 1, 1}, + {&__pyx_n_s_number_of_particles, __pyx_k_number_of_particles, sizeof(__pyx_k_number_of_particles), 0, 0, 1, 1}, + {&__pyx_n_s_number_of_shells, __pyx_k_number_of_shells, sizeof(__pyx_k_number_of_shells), 0, 0, 1, 1}, + {&__pyx_n_s_number_of_shells1, __pyx_k_number_of_shells1, sizeof(__pyx_k_number_of_shells1), 0, 0, 1, 1}, + {&__pyx_n_s_number_of_shells2, __pyx_k_number_of_shells2, sizeof(__pyx_k_number_of_shells2), 0, 0, 1, 1}, + {&__pyx_n_s_number_of_startingpoints, __pyx_k_number_of_startingpoints, sizeof(__pyx_k_number_of_startingpoints), 0, 0, 1, 1}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, + {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, + {&__pyx_n_s_nwat, __pyx_k_nwat, sizeof(__pyx_k_nwat), 0, 0, 1, 1}, + {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, + {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1}, + {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1}, + {&__pyx_n_s_p1, __pyx_k_p1, sizeof(__pyx_k_p1), 0, 0, 1, 1}, + {&__pyx_n_s_p1_coor, __pyx_k_p1_coor, sizeof(__pyx_k_p1_coor), 0, 0, 1, 1}, + {&__pyx_n_s_p1l, __pyx_k_p1l, sizeof(__pyx_k_p1l), 0, 0, 1, 1}, + {&__pyx_n_s_p2, __pyx_k_p2, sizeof(__pyx_k_p2), 0, 0, 1, 1}, + {&__pyx_n_s_p2_coor, __pyx_k_p2_coor, sizeof(__pyx_k_p2_coor), 0, 0, 1, 1}, + {&__pyx_n_s_p2l, __pyx_k_p2l, sizeof(__pyx_k_p2l), 0, 0, 1, 1}, + {&__pyx_n_s_p_coor, __pyx_k_p_coor, sizeof(__pyx_k_p_coor), 0, 0, 1, 1}, + {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_pair, __pyx_k_pair, sizeof(__pyx_k_pair), 0, 0, 1, 1}, + {&__pyx_n_s_pair_1_par_1, __pyx_k_pair_1_par_1, sizeof(__pyx_k_pair_1_par_1), 0, 0, 1, 1}, + {&__pyx_n_s_pair_1_par_2, __pyx_k_pair_1_par_2, sizeof(__pyx_k_pair_1_par_2), 0, 0, 1, 1}, + {&__pyx_n_s_pair_2_par_1, __pyx_k_pair_2_par_1, sizeof(__pyx_k_pair_2_par_1), 0, 0, 1, 1}, + {&__pyx_n_s_pair_2_par_2, __pyx_k_pair_2_par_2, sizeof(__pyx_k_pair_2_par_2), 0, 0, 1, 1}, + {&__pyx_n_s_pairiter, __pyx_k_pairiter, sizeof(__pyx_k_pairiter), 0, 0, 1, 1}, + {&__pyx_n_s_pairlist, __pyx_k_pairlist, sizeof(__pyx_k_pairlist), 0, 0, 1, 1}, + {&__pyx_n_s_pairobject, __pyx_k_pairobject, sizeof(__pyx_k_pairobject), 0, 0, 1, 1}, + {&__pyx_n_s_pairobject___init, __pyx_k_pairobject___init, sizeof(__pyx_k_pairobject___init), 0, 0, 1, 1}, + {&__pyx_n_s_particle, __pyx_k_particle, sizeof(__pyx_k_particle), 0, 0, 1, 1}, + {&__pyx_n_s_particle1, __pyx_k_particle1, sizeof(__pyx_k_particle1), 0, 0, 1, 1}, + {&__pyx_n_s_particle2, __pyx_k_particle2, sizeof(__pyx_k_particle2), 0, 0, 1, 1}, + {&__pyx_n_s_particle_first, __pyx_k_particle_first, sizeof(__pyx_k_particle_first), 0, 0, 1, 1}, + {&__pyx_n_s_particles, __pyx_k_particles, sizeof(__pyx_k_particles), 0, 0, 1, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_pl, __pyx_k_pl, sizeof(__pyx_k_pl), 0, 0, 1, 1}, + {&__pyx_n_s_point, __pyx_k_point, sizeof(__pyx_k_point), 0, 0, 1, 1}, + {&__pyx_n_s_point1, __pyx_k_point1, sizeof(__pyx_k_point1), 0, 0, 1, 1}, + {&__pyx_n_s_point2, __pyx_k_point2, sizeof(__pyx_k_point2), 0, 0, 1, 1}, + {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, + {&__pyx_n_s_prev_atomic_dipoles, __pyx_k_prev_atomic_dipoles, sizeof(__pyx_k_prev_atomic_dipoles), 0, 0, 1, 1}, + {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, + {&__pyx_n_s_r2, __pyx_k_r2, sizeof(__pyx_k_r2), 0, 0, 1, 1}, + {&__pyx_n_s_r_0, __pyx_k_r_0, sizeof(__pyx_k_r_0), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1}, + {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1}, + {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1}, + {&__pyx_n_s_res1, __pyx_k_res1, sizeof(__pyx_k_res1), 0, 0, 1, 1}, + {&__pyx_n_s_res2, __pyx_k_res2, sizeof(__pyx_k_res2), 0, 0, 1, 1}, + {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, + {&__pyx_n_s_results, __pyx_k_results, sizeof(__pyx_k_results), 0, 0, 1, 1}, + {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, + {&__pyx_n_s_rotTs, __pyx_k_rotTs, sizeof(__pyx_k_rotTs), 0, 0, 1, 1}, + {&__pyx_n_s_rotationMatrixMultiShellCorrelat, __pyx_k_rotationMatrixMultiShellCorrelat, sizeof(__pyx_k_rotationMatrixMultiShellCorrelat), 0, 0, 1, 1}, + {&__pyx_n_s_rotationMatrixVennShellCorrelate, __pyx_k_rotationMatrixVennShellCorrelate, sizeof(__pyx_k_rotationMatrixVennShellCorrelate), 0, 0, 1, 1}, + {&__pyx_n_s_run, __pyx_k_run, sizeof(__pyx_k_run), 0, 0, 1, 1}, + {&__pyx_n_s_rv, __pyx_k_rv, sizeof(__pyx_k_rv), 0, 0, 1, 1}, + {&__pyx_n_s_segments_per_angstroem, __pyx_k_segments_per_angstroem, sizeof(__pyx_k_segments_per_angstroem), 0, 0, 1, 1}, + {&__pyx_n_s_segments_per_pi, __pyx_k_segments_per_pi, sizeof(__pyx_k_segments_per_pi), 0, 0, 1, 1}, + {&__pyx_n_s_segs, __pyx_k_segs, sizeof(__pyx_k_segs), 0, 0, 1, 1}, + {&__pyx_n_s_segs_per_angstroem, __pyx_k_segs_per_angstroem, sizeof(__pyx_k_segs_per_angstroem), 0, 0, 1, 1}, + {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_kp_s_self_too_sparse, __pyx_k_self_too_sparse, sizeof(__pyx_k_self_too_sparse), 0, 0, 1, 0}, + {&__pyx_n_s_selfcorr, __pyx_k_selfcorr, sizeof(__pyx_k_selfcorr), 0, 0, 1, 1}, + {&__pyx_n_s_selfctr, __pyx_k_selfctr, sizeof(__pyx_k_selfctr), 0, 0, 1, 1}, + {&__pyx_n_s_selflist, __pyx_k_selflist, sizeof(__pyx_k_selflist), 0, 0, 1, 1}, + {&__pyx_n_s_selfobj, __pyx_k_selfobj, sizeof(__pyx_k_selfobj), 0, 0, 1, 1}, + {&__pyx_n_s_selfobject, __pyx_k_selfobject, sizeof(__pyx_k_selfobject), 0, 0, 1, 1}, + {&__pyx_n_s_selfobject___init, __pyx_k_selfobject___init, sizeof(__pyx_k_selfobject___init), 0, 0, 1, 1}, + {&__pyx_n_s_set_name, __pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_shell, __pyx_k_shell, sizeof(__pyx_k_shell), 0, 0, 1, 1}, + {&__pyx_n_s_shell1, __pyx_k_shell1, sizeof(__pyx_k_shell1), 0, 0, 1, 1}, + {&__pyx_n_s_shell2, __pyx_k_shell2, sizeof(__pyx_k_shell2), 0, 0, 1, 1}, + {&__pyx_n_s_shell3, __pyx_k_shell3, sizeof(__pyx_k_shell3), 0, 0, 1, 1}, + {&__pyx_n_s_shell4, __pyx_k_shell4, sizeof(__pyx_k_shell4), 0, 0, 1, 1}, + {&__pyx_n_s_shell5, __pyx_k_shell5, sizeof(__pyx_k_shell5), 0, 0, 1, 1}, + {&__pyx_n_s_shellHistograms, __pyx_k_shellHistograms, sizeof(__pyx_k_shellHistograms), 0, 0, 1, 1}, + {&__pyx_n_s_shell_01, __pyx_k_shell_01, sizeof(__pyx_k_shell_01), 0, 0, 1, 1}, + {&__pyx_n_s_shell_02, __pyx_k_shell_02, sizeof(__pyx_k_shell_02), 0, 0, 1, 1}, + {&__pyx_n_s_shell_03, __pyx_k_shell_03, sizeof(__pyx_k_shell_03), 0, 0, 1, 1}, + {&__pyx_n_s_shell_04, __pyx_k_shell_04, sizeof(__pyx_k_shell_04), 0, 0, 1, 1}, + {&__pyx_n_s_shell_05, __pyx_k_shell_05, sizeof(__pyx_k_shell_05), 0, 0, 1, 1}, + {&__pyx_n_s_shelldt, __pyx_k_shelldt, sizeof(__pyx_k_shelldt), 0, 0, 1, 1}, + {&__pyx_n_s_shelldt1, __pyx_k_shelldt1, sizeof(__pyx_k_shelldt1), 0, 0, 1, 1}, + {&__pyx_n_s_shelldt2, __pyx_k_shelldt2, sizeof(__pyx_k_shelldt2), 0, 0, 1, 1}, + {&__pyx_n_s_shells, __pyx_k_shells, sizeof(__pyx_k_shells), 0, 0, 1, 1}, + {&__pyx_n_s_shellstart, __pyx_k_shellstart, sizeof(__pyx_k_shellstart), 0, 0, 1, 1}, + {&__pyx_n_s_shellstart1, __pyx_k_shellstart1, sizeof(__pyx_k_shellstart1), 0, 0, 1, 1}, + {&__pyx_n_s_shellstart2, __pyx_k_shellstart2, sizeof(__pyx_k_shellstart2), 0, 0, 1, 1}, + {&__pyx_n_s_sign, __pyx_k_sign, sizeof(__pyx_k_sign), 0, 0, 1, 1}, + {&__pyx_n_s_sites_per_res, __pyx_k_sites_per_res, sizeof(__pyx_k_sites_per_res), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 0, 0, 1, 1}, + {&__pyx_n_s_sortCollectiveDipNNShells, __pyx_k_sortCollectiveDipNNShells, sizeof(__pyx_k_sortCollectiveDipNNShells), 0, 0, 1, 1}, + {&__pyx_n_s_sortCollectiveDipNNShellsInt, __pyx_k_sortCollectiveDipNNShellsInt, sizeof(__pyx_k_sortCollectiveDipNNShellsInt), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_startingpoints, __pyx_k_startingpoints, sizeof(__pyx_k_startingpoints), 0, 0, 1, 1}, + {&__pyx_n_s_startskip, __pyx_k_startskip, sizeof(__pyx_k_startskip), 0, 0, 1, 1}, + {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, + {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, + {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_n_s_structureFactorCharge, __pyx_k_structureFactorCharge, sizeof(__pyx_k_structureFactorCharge), 0, 0, 1, 1}, + {&__pyx_n_s_structureFactorDipTen, __pyx_k_structureFactorDipTen, sizeof(__pyx_k_structureFactorDipTen), 0, 0, 1, 1}, + {&__pyx_n_s_sub_correlation, __pyx_k_sub_correlation, sizeof(__pyx_k_sub_correlation), 0, 0, 1, 1}, + {&__pyx_n_s_sumMultiMDCageSingle, __pyx_k_sumMultiMDCageSingle, sizeof(__pyx_k_sumMultiMDCageSingle), 0, 0, 1, 1}, + {&__pyx_n_s_sumUpByShell, __pyx_k_sumUpByShell, sizeof(__pyx_k_sumUpByShell), 0, 0, 1, 1}, + {&__pyx_n_s_sumVennMDCageSingle, __pyx_k_sumVennMDCageSingle, sizeof(__pyx_k_sumVennMDCageSingle), 0, 0, 1, 1}, + {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_t1, __pyx_k_t1, sizeof(__pyx_k_t1), 0, 0, 1, 1}, + {&__pyx_n_s_t2, __pyx_k_t2, sizeof(__pyx_k_t2), 0, 0, 1, 1}, + {&__pyx_n_s_t3, __pyx_k_t3, sizeof(__pyx_k_t3), 0, 0, 1, 1}, + {&__pyx_n_s_t4, __pyx_k_t4, sizeof(__pyx_k_t4), 0, 0, 1, 1}, + {&__pyx_n_s_t5, __pyx_k_t5, sizeof(__pyx_k_t5), 0, 0, 1, 1}, + {&__pyx_n_s_t6, __pyx_k_t6, sizeof(__pyx_k_t6), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_testParallelism, __pyx_k_testParallelism, sizeof(__pyx_k_testParallelism), 0, 0, 1, 1}, + {&__pyx_n_s_timeseries, __pyx_k_timeseries, sizeof(__pyx_k_timeseries), 0, 0, 1, 1}, + {&__pyx_n_s_timeseries1, __pyx_k_timeseries1, sizeof(__pyx_k_timeseries1), 0, 0, 1, 1}, + {&__pyx_n_s_timeseries2, __pyx_k_timeseries2, sizeof(__pyx_k_timeseries2), 0, 0, 1, 1}, + {&__pyx_n_s_timeseries_shellwise, __pyx_k_timeseries_shellwise, sizeof(__pyx_k_timeseries_shellwise), 0, 0, 1, 1}, + {&__pyx_kp_s_tot_too_sparse, __pyx_k_tot_too_sparse, sizeof(__pyx_k_tot_too_sparse), 0, 0, 1, 0}, + {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, + {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, + {&__pyx_n_s_unfold, __pyx_k_unfold, sizeof(__pyx_k_unfold), 0, 0, 1, 1}, + {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_vanHoveMultiVector, __pyx_k_vanHoveMultiVector, sizeof(__pyx_k_vanHoveMultiVector), 0, 0, 1, 1}, + {&__pyx_n_s_vanHoveSingleVector, __pyx_k_vanHoveSingleVector, sizeof(__pyx_k_vanHoveSingleVector), 0, 0, 1, 1}, + {&__pyx_n_s_vec, __pyx_k_vec, sizeof(__pyx_k_vec), 0, 0, 1, 1}, + {&__pyx_n_s_vel_ind, __pyx_k_vel_ind, sizeof(__pyx_k_vel_ind), 0, 0, 1, 1}, + {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, + {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, + {&__pyx_n_s_wat, __pyx_k_wat, sizeof(__pyx_k_wat), 0, 0, 1, 1}, + {&__pyx_n_s_writeKirkwoodHistogram, __pyx_k_writeKirkwoodHistogram, sizeof(__pyx_k_writeKirkwoodHistogram), 0, 0, 1, 1}, + {&__pyx_n_s_writeKirkwoodHistogram2D, __pyx_k_writeKirkwoodHistogram2D, sizeof(__pyx_k_writeKirkwoodHistogram2D), 0, 0, 1, 1}, + {&__pyx_n_s_writeKirkwoodHistogramShellwise, __pyx_k_writeKirkwoodHistogramShellwise, sizeof(__pyx_k_writeKirkwoodHistogramShellwise), 0, 0, 1, 1}, + {&__pyx_n_s_writeMrHistogram, __pyx_k_writeMrHistogram, sizeof(__pyx_k_writeMrHistogram), 0, 0, 1, 1}, + {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, + {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 88, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 944, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 134, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 149, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 152, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error) - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 406, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 615, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 834, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 1038, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 100, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 141, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 156, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 159, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 373, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 408, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 618, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 914, __pyx_L1_error) + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 983, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } +/* #### Code section: cached_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "src/helpers/miscellaneous.pyx":568 - * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 - * cdef double f2 = 3/r2 #prefactor 2: 3*1/r**2 - * cdef double[:] dipt = np.empty(6,dtype=np.float64) #initialize dipole dipole tensor (xx,yy,zz,xy,xz,yz) # <<<<<<<<<<<<<< + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * - * dipt[0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_int_6); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 568, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); + __pyx_tuple__4 = PyTuple_New(1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_tuple__4, 0, __pyx_int_neg_1)) __PYX_ERR(1, 582, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_tuple__4); - /* "src/helpers/miscellaneous.pyx":768 - * cdef double f1 - * cdef double f2 - * cdef double [:] distvec = np.zeros(3, dtype='float64') # <<<<<<<<<<<<<< - * cdef double dist_sq, dist_2, dist_3 + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); + __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + */ + __pyx_tuple__8 = PyTuple_Pack(3, __pyx_int_136983863, __pyx_int_112105877, __pyx_int_184977713); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 * __pyx_import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 944, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 950, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - - /* "View.MemoryView":134 - * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< - * - * if itemsize <= 0: - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "View.MemoryView":137 - * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< - * - * if not isinstance(format, bytes): - */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< - * - * if self.dtype_is_object: - */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len - */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 989, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":568 + * cdef double f1 = r2**-1.5 #prefactor 1: 1/r**3 + * cdef double f2 = 3/r2 #prefactor 2: 3*1/r**2 + * cdef double[:] dipt = np.empty(6,dtype=np.float64) #initialize dipole dipole tensor (xx,yy,zz,xy,xz,yz) # <<<<<<<<<<<<<< + * + * dipt[0]=f1*(rv[0]*rv[0]*f2-1) #calculate elements */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_int_6); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 568, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":768 + * cdef double f1 + * cdef double f2 + * cdef double [:] distvec = np.zeros(3, dtype='float64') # <<<<<<<<<<<<<< + * cdef double dist_sq, dist_2, dist_3 * - * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 420, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: + /* "newanalysis/helpers/miscellaneous.pyx":1038 + * corr[i,j] /= ctr[i,j] + * else: + * print('tot too sparse') # <<<<<<<<<<<<<< + * if selfctr[i,j] != 0: + * selfcorr[i,j] /= selfctr[i,j] */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 497, __pyx_L1_error) + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_tot_too_sparse); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 1038, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1042 + * selfcorr[i,j] /= selfctr[i,j] + * else: + * print('self too sparse') # <<<<<<<<<<<<<< * - * if flags & PyBUF_ND: + * for i in range(nshells1): */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 522, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_self_too_sparse); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 1042, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); - /* "View.MemoryView":572 - * if self.view.strides == NULL: + /* "newanalysis/helpers/miscellaneous.pyx":1447 * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< + * if(correlation_length > number_of_frames): + * print("Correlation length must not be longer than the available trajectory length") # <<<<<<<<<<<<<< + * return * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Correlation_length_must_not_be_l); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 1447, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1451 + * + * if(number_of_frames - correlation_length)/number_of_startingpoints == 0: + * print("Number of starting points too high, or else trajectory length or correlation length too close to each other") # <<<<<<<<<<<<<< + * return * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_tuple__16 = PyTuple_New(1); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 579, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Number_of_starting_points_too_hi); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 1451, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_INCREF(__pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__16, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_tuple__16); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/miscellaneous.pyx":1455 + * + * if((number_of_frames - correlation_length)/float(number_of_startingpoints) - int((number_of_frames - correlation_length)/number_of_startingpoints) != 0): + * print("Warning: number_of_frames - correlation_length not evenly divideable regarding the number or starting points") # <<<<<<<<<<<<<< + * + * #Loop over each starting point */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Warning_number_of_frames_correla); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 1455, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_sys); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); - - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: - */ - __pyx_slice__19 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__19)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__19); - __Pyx_GIVEREF(__pyx_slice__19); - - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< - * - * + __pyx_tuple__19 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 705, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_collections_abc); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_n_s_collections); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "View.MemoryView":309 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") */ - __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 309, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_tuple__23 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 4, __pyx_L1_error) + + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * + */ + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); - /* "src/helpers/miscellaneous.pyx":69 + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) - * def testParallelism(int n_iterations): # <<<<<<<<<<<<<< - * test_parallelism(n_iterations) - * return */ - __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_s_n_iterations, __pyx_n_s_n_iterations); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_testParallelism, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 69, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":74 + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * + */ + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) - * def countHBonds(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist, double cos_angle=-0.95): # <<<<<<<<<<<<<< - * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr */ - __pyx_tuple__26 = PyTuple_Pack(27, __pyx_n_s_coor_surr, __pyx_n_s_coor_oh2, __pyx_n_s_nres_surr, __pyx_n_s_maxdist, __pyx_n_s_cos_angle, __pyx_n_s_sites_per_res, __pyx_n_s_nsurr, __pyx_n_s_nwat, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_idx3, __pyx_n_s_hbond, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_dx2, __pyx_n_s_dy2, __pyx_n_s_dz2, __pyx_n_s_dot, __pyx_n_s_dot2, __pyx_n_s_dist, __pyx_n_s_dist2, __pyx_n_s_cosine); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 74, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 315, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(5, 0, 27, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_countHBonds, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 74, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":114 + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_tuple__27 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "newanalysis/helpers/miscellaneous.pyx":68 + * void dipten_double_loop2_(double * coor_1, double * coor_2, double * dipt_t, int n_particles_1, int n_particles_2, int only_different_nuclei) * - * @cython.boundscheck(False) - * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def testParallelism(int n_iterations): + * test_parallelism(n_iterations) + */ + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_n_iterations); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_testParallelism, 68, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 68, __pyx_L1_error) + + /* "newanalysis/helpers/miscellaneous.pyx":73 + * return + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def countHBonds(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist, double cos_angle=-0.95): + * # this function is designed only for water hydrogen bonds! + */ + __pyx_tuple__31 = PyTuple_Pack(27, __pyx_n_s_coor_surr, __pyx_n_s_coor_oh2, __pyx_n_s_nres_surr, __pyx_n_s_maxdist, __pyx_n_s_cos_angle, __pyx_n_s_sites_per_res, __pyx_n_s_nsurr, __pyx_n_s_nwat, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_idx, __pyx_n_s_idx2, __pyx_n_s_idx3, __pyx_n_s_hbond, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_dx2, __pyx_n_s_dy2, __pyx_n_s_dz2, __pyx_n_s_dot, __pyx_n_s_dot2, __pyx_n_s_dist, __pyx_n_s_dist2, __pyx_n_s_cosine); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 27, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_countHBonds, 73, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 73, __pyx_L1_error) + + /* "newanalysis/helpers/miscellaneous.pyx":113 + * return np.asarray(hbond) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 */ - __pyx_tuple__28 = PyTuple_Pack(18, __pyx_n_s_coors, __pyx_n_s_histogram, __pyx_n_s_bin_dist, __pyx_n_s_segs, __pyx_n_s_boxlength, __pyx_n_s_n_particles, __pyx_n_s_pair_1_par_1, __pyx_n_s_pair_1_par_2, __pyx_n_s_pair_2_par_1, __pyx_n_s_pair_2_par_2, __pyx_n_s_D_x, __pyx_n_s_D_y, __pyx_n_s_D_z, __pyx_n_s_dist1, __pyx_n_s_dist2, __pyx_n_s_bin1, __pyx_n_s_bin2, __pyx_n_s_blen2); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(5, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_structureFactorDipTen, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_tuple__33 = PyTuple_Pack(18, __pyx_n_s_coors, __pyx_n_s_histogram, __pyx_n_s_bin_dist, __pyx_n_s_segs, __pyx_n_s_boxlength, __pyx_n_s_n_particles, __pyx_n_s_pair_1_par_1, __pyx_n_s_pair_1_par_2, __pyx_n_s_pair_2_par_1, __pyx_n_s_pair_2_par_2, __pyx_n_s_D_x, __pyx_n_s_D_y, __pyx_n_s_D_z, __pyx_n_s_dist1, __pyx_n_s_dist2, __pyx_n_s_bin1, __pyx_n_s_bin2, __pyx_n_s_blen2); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_structureFactorDipTen, 113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 113, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":168 + /* "newanalysis/helpers/miscellaneous.pyx":167 * - * @cython.boundscheck(False) - * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 */ - __pyx_tuple__30 = PyTuple_Pack(21, __pyx_n_s_coors, __pyx_n_s_charges, __pyx_n_s_histogram, __pyx_n_s_bin_dist, __pyx_n_s_segs, __pyx_n_s_boxlength, __pyx_n_s_n_particles, __pyx_n_s_pair_1_par_1, __pyx_n_s_pair_1_par_2, __pyx_n_s_pair_2_par_1, __pyx_n_s_pair_2_par_2, __pyx_n_s_D_x, __pyx_n_s_D_y, __pyx_n_s_D_z, __pyx_n_s_dist1, __pyx_n_s_dist2, __pyx_n_s_energy1, __pyx_n_s_energy2, __pyx_n_s_bin1, __pyx_n_s_bin2, __pyx_n_s_blen2); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(6, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_structureFactorCharge, 168, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_tuple__35 = PyTuple_Pack(21, __pyx_n_s_coors, __pyx_n_s_charges, __pyx_n_s_histogram, __pyx_n_s_bin_dist, __pyx_n_s_segs, __pyx_n_s_boxlength, __pyx_n_s_n_particles, __pyx_n_s_pair_1_par_1, __pyx_n_s_pair_1_par_2, __pyx_n_s_pair_2_par_1, __pyx_n_s_pair_2_par_2, __pyx_n_s_D_x, __pyx_n_s_D_y, __pyx_n_s_D_z, __pyx_n_s_dist1, __pyx_n_s_dist2, __pyx_n_s_energy1, __pyx_n_s_energy2, __pyx_n_s_bin1, __pyx_n_s_bin2, __pyx_n_s_blen2); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_structureFactorCharge, 167, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 167, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":226 + /* "newanalysis/helpers/miscellaneous.pyx":225 + * * #Version1: Just one distance per targeted (water) molecule - * @cython.boundscheck(False) - * def accumulateShellwiseGFunction(double [:,:] aufpunkte, double [:,:] coor, char [:] dataset, double[:,:] histogram, double[:] norm, int maxshell, double histo_min, double histo_max, double boxlength): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def accumulateShellwiseGFunction(double [:,:] aufpunkte, double [:,:] coor, char [:] dataset, double[:,:] histogram, double[:] norm, int maxshell, double histo_min, double histo_max, double boxlength): * ''' - * aufpunkte ... (n_aufpunkte, 3) */ - __pyx_tuple__32 = PyTuple_Pack(12, __pyx_n_s_aufpunkte, __pyx_n_s_coor, __pyx_n_s_dataset, __pyx_n_s_histogram, __pyx_n_s_norm, __pyx_n_s_maxshell, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_boxlength, __pyx_n_s_n_aufpunkte, __pyx_n_s_n_particles, __pyx_n_s_number_of_datapoints); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_accumulateShellwiseGFunction, 226, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 226, __pyx_L1_error) + __pyx_tuple__37 = PyTuple_Pack(12, __pyx_n_s_aufpunkte, __pyx_n_s_coor, __pyx_n_s_dataset, __pyx_n_s_histogram, __pyx_n_s_norm, __pyx_n_s_maxshell, __pyx_n_s_histo_min, __pyx_n_s_histo_max, __pyx_n_s_boxlength, __pyx_n_s_n_aufpunkte, __pyx_n_s_n_particles, __pyx_n_s_number_of_datapoints); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_accumulateShellwiseGFunction, 225, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 225, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":242 + /* "newanalysis/helpers/miscellaneous.pyx":241 + * calc_accumulate_shellwise_g_function(&aufpunkte[0,0], &coor[0,0], &dataset[0], &histogram[0,0], &norm[0], n_aufpunkte, n_particles, number_of_datapoints, maxshell, histo_min, histo_max, boxlength) * - * @cython.boundscheck(False) - * def accumulateNMShellwiseGFunction(double [:,:] coor1, double [:,:] coor2, int[:,:] dataset, double[:,:] histogram, int particle_first, int n_particles, int max_distance, int segments_per_angstroem): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def accumulateNMShellwiseGFunction(double [:,:] coor1, double [:,:] coor2, int[:,:] dataset, double[:,:] histogram, int particle_first, int n_particles, int max_distance, int segments_per_angstroem): * cdef int particle1, particle2, point1, point2, shell, bin_dist - * cdef int maxshell = histogram.shape[1] */ - __pyx_tuple__34 = PyTuple_Pack(16, __pyx_n_s_coor1, __pyx_n_s_coor2, __pyx_n_s_dataset, __pyx_n_s_histogram, __pyx_n_s_particle_first, __pyx_n_s_n_particles, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_particle1, __pyx_n_s_particle2, __pyx_n_s_point1, __pyx_n_s_point2, __pyx_n_s_shell, __pyx_n_s_bin_dist, __pyx_n_s_maxshell, __pyx_n_s_dist); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__34); - __Pyx_GIVEREF(__pyx_tuple__34); - __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(8, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_accumulateNMShellwiseGFunction, 242, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_tuple__39 = PyTuple_Pack(16, __pyx_n_s_coor1, __pyx_n_s_coor2, __pyx_n_s_dataset, __pyx_n_s_histogram, __pyx_n_s_particle_first, __pyx_n_s_n_particles, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_particle1, __pyx_n_s_particle2, __pyx_n_s_point1, __pyx_n_s_point2, __pyx_n_s_shell, __pyx_n_s_bin_dist, __pyx_n_s_maxshell, __pyx_n_s_dist); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_accumulateNMShellwiseGFunction, 241, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 241, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":260 + /* "newanalysis/helpers/miscellaneous.pyx":260 * * * def sumUpByShell(double [:,:,:] timeseries, double [:,:,:] timeseries_shellwise, char[:,:] ds): # <<<<<<<<<<<<<< * """ * timeseries ... (n_frames, n_particles, 3) */ - __pyx_tuple__36 = PyTuple_Pack(9, __pyx_n_s_timeseries, __pyx_n_s_timeseries_shellwise, __pyx_n_s_ds, __pyx_n_s_n_frames, __pyx_n_s_n_particles, __pyx_n_s_n_shells, __pyx_n_s_particle, __pyx_n_s_shell, __pyx_n_s_frame); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__36); - __Pyx_GIVEREF(__pyx_tuple__36); - __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_sumUpByShell, 260, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 260, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(9, __pyx_n_s_timeseries, __pyx_n_s_timeseries_shellwise, __pyx_n_s_ds, __pyx_n_s_n_frames, __pyx_n_s_n_particles, __pyx_n_s_n_shells, __pyx_n_s_particle, __pyx_n_s_shell, __pyx_n_s_frame); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_sumUpByShell, 260, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 260, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":281 + /* "newanalysis/helpers/miscellaneous.pyx":281 * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] * * def countVennShellOccupation(double[:,:] data, int n_particles, char[:] ds1, char[:] ds2): # <<<<<<<<<<<<<< * ''' * data ... (n_shells1, n_shells2) */ - __pyx_tuple__38 = PyTuple_Pack(9, __pyx_n_s_data, __pyx_n_s_n_particles, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_n_shells1, __pyx_n_s_n_shells2, __pyx_n_s_wat, __pyx_n_s_shell1, __pyx_n_s_shell2); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__38); - __Pyx_GIVEREF(__pyx_tuple__38); - __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_countVennShellOccupation, 281, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_tuple__43 = PyTuple_Pack(9, __pyx_n_s_data, __pyx_n_s_n_particles, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_n_shells1, __pyx_n_s_n_shells2, __pyx_n_s_wat, __pyx_n_s_shell1, __pyx_n_s_shell2); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_countVennShellOccupation, 281, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 281, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":299 + /* "newanalysis/helpers/miscellaneous.pyx":299 * data[shell1, shell2] += 1 * * def countMultiShell(double[:,:] data, char[:] ds1, char[:] ds2, char[:] ds3, char[:] ds4, char[:] ds5): # <<<<<<<<<<<<<< * ''' * data ... (nshells, max_cardinality {==5}) */ - __pyx_tuple__40 = PyTuple_Pack(16, __pyx_n_s_data, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_ds3, __pyx_n_s_ds4, __pyx_n_s_ds5, __pyx_n_s_n_shells, __pyx_n_s_n_particles, __pyx_n_s_shell_01, __pyx_n_s_shell_02, __pyx_n_s_shell_03, __pyx_n_s_shell_04, __pyx_n_s_shell_05, __pyx_n_s_closest_shell, __pyx_n_s_cardinality, __pyx_n_s_wat); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__40); - __Pyx_GIVEREF(__pyx_tuple__40); - __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(6, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_countMultiShell, 299, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 299, __pyx_L1_error) + __pyx_tuple__45 = PyTuple_Pack(16, __pyx_n_s_data, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_ds3, __pyx_n_s_ds4, __pyx_n_s_ds5, __pyx_n_s_n_shells, __pyx_n_s_n_particles, __pyx_n_s_shell_01, __pyx_n_s_shell_02, __pyx_n_s_shell_03, __pyx_n_s_shell_04, __pyx_n_s_shell_05, __pyx_n_s_closest_shell, __pyx_n_s_cardinality, __pyx_n_s_wat); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_countMultiShell, 299, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 299, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":353 + /* "newanalysis/helpers/miscellaneous.pyx":352 + * ''' * - * @cython.boundscheck(False) - * def atomicIndDip(double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicIndDip(double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): * """ - * coors ... (N_all, 3) */ - __pyx_tuple__42 = PyTuple_Pack(9, __pyx_n_s_coors, __pyx_n_s_charges, __pyx_n_s_alpha, __pyx_n_s_coors_ind, __pyx_n_s_prev_atomic_dipoles, __pyx_n_s_atomic_dipoles, __pyx_n_s_boxlength, __pyx_n_s_n_particles_all, __pyx_n_s_n_particles_ind); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); - __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(7, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_atomicIndDip, 353, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_tuple__47 = PyTuple_Pack(9, __pyx_n_s_coors, __pyx_n_s_charges, __pyx_n_s_alpha, __pyx_n_s_coors_ind, __pyx_n_s_prev_atomic_dipoles, __pyx_n_s_atomic_dipoles, __pyx_n_s_boxlength, __pyx_n_s_n_particles_all, __pyx_n_s_n_particles_ind); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__47); + __Pyx_GIVEREF(__pyx_tuple__47); + __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_atomicIndDip, 352, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 352, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":427 + /* "newanalysis/helpers/miscellaneous.pyx":426 + * """ * - * @cython.boundscheck(False) - * def atomicIndDipPerAtom(int idx, double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicIndDipPerAtom(int idx, double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): * """ - * coors ... (N_all, 3) */ - __pyx_tuple__44 = PyTuple_Pack(10, __pyx_n_s_idx, __pyx_n_s_coors, __pyx_n_s_charges, __pyx_n_s_alpha, __pyx_n_s_coors_ind, __pyx_n_s_prev_atomic_dipoles, __pyx_n_s_atomic_dipoles, __pyx_n_s_boxlength, __pyx_n_s_n_particles_all, __pyx_n_s_n_particles_ind); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(8, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_atomicIndDipPerAtom, 427, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 427, __pyx_L1_error) + __pyx_tuple__49 = PyTuple_Pack(10, __pyx_n_s_idx, __pyx_n_s_coors, __pyx_n_s_charges, __pyx_n_s_alpha, __pyx_n_s_coors_ind, __pyx_n_s_prev_atomic_dipoles, __pyx_n_s_atomic_dipoles, __pyx_n_s_boxlength, __pyx_n_s_n_particles_all, __pyx_n_s_n_particles_ind); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__49); + __Pyx_GIVEREF(__pyx_tuple__49); + __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_atomicIndDipPerAtom, 426, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 426, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":441 + /* "newanalysis/helpers/miscellaneous.pyx":441 * atomic_ind_dip_per_atom(idx, &coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) * * def kronecker(int a, int b) -> int: # <<<<<<<<<<<<<< * if (a == b): return 1 * return 0 */ - __pyx_tuple__46 = PyTuple_Pack(2, __pyx_n_s_a, __pyx_n_s_b); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_kronecker, 441, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 441, __pyx_L1_error) + __pyx_tuple__51 = PyTuple_Pack(2, __pyx_n_s_a, __pyx_n_s_b); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__51); + __Pyx_GIVEREF(__pyx_tuple__51); + __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_kronecker, 441, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 441, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":447 + /* "newanalysis/helpers/miscellaneous.pyx":446 * - * @cython.boundscheck(False) - * def deriveIndDip(double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def deriveIndDip(double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): * """ - * coors_ind ... (N_ind, 3) */ - __pyx_tuple__48 = PyTuple_Pack(7, __pyx_n_s_coors_ind, __pyx_n_s_vel_ind, __pyx_n_s_atomic_dipoles, __pyx_n_s_derived_atomic_dipoles, __pyx_n_s_boxlength, __pyx_n_s_new, __pyx_n_s_n_ind_particles); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_deriveIndDip, 447, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_tuple__53 = PyTuple_Pack(7, __pyx_n_s_coors_ind, __pyx_n_s_vel_ind, __pyx_n_s_atomic_dipoles, __pyx_n_s_derived_atomic_dipoles, __pyx_n_s_boxlength, __pyx_n_s_new_2, __pyx_n_s_n_ind_particles); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__53); + __Pyx_GIVEREF(__pyx_tuple__53); + __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_deriveIndDip, 446, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 446, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":511 + /* "newanalysis/helpers/miscellaneous.pyx":510 + * ''' * - * @cython.boundscheck(False) - * def deriveIndDipPerAtom(int idx, double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def deriveIndDipPerAtom(int idx, double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): * """ - * coors_ind ... (N_ind, 3) */ - __pyx_tuple__50 = PyTuple_Pack(8, __pyx_n_s_idx, __pyx_n_s_coors_ind, __pyx_n_s_vel_ind, __pyx_n_s_atomic_dipoles, __pyx_n_s_derived_atomic_dipoles, __pyx_n_s_boxlength, __pyx_n_s_new, __pyx_n_s_n_ind_particles); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(7, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_deriveIndDipPerAtom, 511, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 511, __pyx_L1_error) + __pyx_tuple__55 = PyTuple_Pack(8, __pyx_n_s_idx, __pyx_n_s_coors_ind, __pyx_n_s_vel_ind, __pyx_n_s_atomic_dipoles, __pyx_n_s_derived_atomic_dipoles, __pyx_n_s_boxlength, __pyx_n_s_new_2, __pyx_n_s_n_ind_particles); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 510, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__55); + __Pyx_GIVEREF(__pyx_tuple__55); + __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_deriveIndDipPerAtom, 510, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 510, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":525 + /* "newanalysis/helpers/miscellaneous.pyx":524 + * * ###BEGIN DANIEL NOE HELPERS - * @cython.boundscheck(False) - * def norm(double[:] x): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def norm(double[:] x): * cdef double res = np.dot(x,x)**.5 - * return res */ - __pyx_tuple__52 = PyTuple_Pack(3, __pyx_n_s_x, __pyx_n_s_x, __pyx_n_s_res); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 525, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__52); - __Pyx_GIVEREF(__pyx_tuple__52); - __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_norm, 525, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 525, __pyx_L1_error) + __pyx_tuple__57 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_res); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 524, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__57); + __Pyx_GIVEREF(__pyx_tuple__57); + __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_norm, 524, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 524, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":530 + /* "newanalysis/helpers/miscellaneous.pyx":529 + * return res * - * @cython.boundscheck(False) - * def unfold(double[:] ref, double[:] new, double[:] run, double boxl): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfold(double[:] ref, double[:] new, double[:] run, double boxl): * cdef int i - * cdef double D */ - __pyx_tuple__54 = PyTuple_Pack(6, __pyx_n_s_ref, __pyx_n_s_new, __pyx_n_s_run, __pyx_n_s_boxl, __pyx_n_s_i, __pyx_n_s_D); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__54); - __Pyx_GIVEREF(__pyx_tuple__54); - __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_unfold, 530, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 530, __pyx_L1_error) + __pyx_tuple__59 = PyTuple_Pack(6, __pyx_n_s_ref, __pyx_n_s_new_2, __pyx_n_s_run, __pyx_n_s_boxl, __pyx_n_s_i, __pyx_n_s_D); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__59); + __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_unfold, 529, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 529, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":543 + /* "newanalysis/helpers/miscellaneous.pyx":542 * - * @cython.boundscheck(False) - * def min_dist(double[:] res1, double[:] res2, double boxl): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def min_dist(double[:] res1, double[:] res2, double boxl): * cdef int i - * cdef double D */ - __pyx_tuple__56 = PyTuple_Pack(6, __pyx_n_s_res1, __pyx_n_s_res2, __pyx_n_s_boxl, __pyx_n_s_i, __pyx_n_s_D, __pyx_n_s_vec); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__56); - __Pyx_GIVEREF(__pyx_tuple__56); - __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_min_dist, 543, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 543, __pyx_L1_error) + __pyx_tuple__61 = PyTuple_Pack(6, __pyx_n_s_res1, __pyx_n_s_res2, __pyx_n_s_boxl, __pyx_n_s_i, __pyx_n_s_D, __pyx_n_s_vec); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__61); + __Pyx_GIVEREF(__pyx_tuple__61); + __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_min_dist, 542, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 542, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":560 + /* "newanalysis/helpers/miscellaneous.pyx":559 * - * @cython.boundscheck(False) - * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 * cdef double [:] rv = np.zeros(3) #distance vector - * rv[0] = coo2[0] - coo1[0] */ - __pyx_tuple__58 = PyTuple_Pack(7, __pyx_n_s_coo1, __pyx_n_s_coo2, __pyx_n_s_rv, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_dipt); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 560, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__58); - __Pyx_GIVEREF(__pyx_tuple__58); - __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_dipTen, 560, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 560, __pyx_L1_error) + __pyx_tuple__63 = PyTuple_Pack(7, __pyx_n_s_coo1, __pyx_n_s_coo2, __pyx_n_s_rv, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_dipt); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__63); + __Pyx_GIVEREF(__pyx_tuple__63); + __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_dipTen, 559, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 559, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":580 + /* "newanalysis/helpers/miscellaneous.pyx":580 * @cython.boundscheck(False) * class selfobject: * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? # <<<<<<<<<<<<<< * self.p = p * self.apr_emim_h = apr_emim_h */ - __pyx_tuple__60 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_p, __pyx_n_s_p_coor, __pyx_n_s_apr_emim_h, __pyx_n_s_n_pairs_h, __pyx_n_s_emim_h, __pyx_n_s_pl, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_index, __pyx_n_s_rv, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_r_0, __pyx_n_s_dipt_0); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 580, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__60); - __Pyx_GIVEREF(__pyx_tuple__60); - __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(6, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_init, 580, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 580, __pyx_L1_error) + __pyx_tuple__65 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_p, __pyx_n_s_p_coor, __pyx_n_s_apr_emim_h, __pyx_n_s_n_pairs_h, __pyx_n_s_emim_h, __pyx_n_s_pl, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_index, __pyx_n_s_rv, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_r_0, __pyx_n_s_dipt_0); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 580, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__65); + __Pyx_GIVEREF(__pyx_tuple__65); + __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_init, 580, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 580, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":640 + /* "newanalysis/helpers/miscellaneous.pyx":640 * @cython.boundscheck(False) * class pairobject: * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 # <<<<<<<<<<<<<< * self.p1 = p1 * self.p2 = p2 */ - __pyx_tuple__62 = PyTuple_Pack(20, __pyx_n_s_self, __pyx_n_s_p1, __pyx_n_s_p2, __pyx_n_s_p1_coor, __pyx_n_s_p2_coor, __pyx_n_s_apr_emim_h, __pyx_n_s_n_pairs_h, __pyx_n_s_emim_h, __pyx_n_s_p1l, __pyx_n_s_p2l, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_index, __pyx_n_s_rv, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_r_0, __pyx_n_s_bins, __pyx_n_s_dipt_0); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__62); - __Pyx_GIVEREF(__pyx_tuple__62); - __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(8, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_init, 640, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 640, __pyx_L1_error) + __pyx_tuple__67 = PyTuple_Pack(20, __pyx_n_s_self, __pyx_n_s_p1, __pyx_n_s_p2, __pyx_n_s_p1_coor, __pyx_n_s_p2_coor, __pyx_n_s_apr_emim_h, __pyx_n_s_n_pairs_h, __pyx_n_s_emim_h, __pyx_n_s_p1l, __pyx_n_s_p2l, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_index, __pyx_n_s_rv, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_r_0, __pyx_n_s_bins, __pyx_n_s_dipt_0); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__67); + __Pyx_GIVEREF(__pyx_tuple__67); + __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_init, 640, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 640, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":713 + /* "newanalysis/helpers/miscellaneous.pyx":712 + * @cython.boundscheck(False) * class noe_task: - * @cython.boundscheck(False) - * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): * self.apr_emim_h = apr_emim_h - * self.emim_h = emim_h */ - __pyx_tuple__64 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_apr_emim_h, __pyx_n_s_emim_h, __pyx_n_s_n_pairs_h, __pyx_n_s_n_self_pairs_h, __pyx_n_s_max_distance, __pyx_n_s_n_res_emim, __pyx_n_s_apr_pair, __pyx_n_s_coors, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_atom, __pyx_n_s_coor_i, __pyx_n_s_coor_j); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 713, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__64); - __Pyx_GIVEREF(__pyx_tuple__64); - __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(9, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_init, 713, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 713, __pyx_L1_error) + __pyx_tuple__69 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_apr_emim_h, __pyx_n_s_emim_h, __pyx_n_s_n_pairs_h, __pyx_n_s_n_self_pairs_h, __pyx_n_s_max_distance, __pyx_n_s_n_res_emim, __pyx_n_s_apr_pair, __pyx_n_s_coors, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_atom, __pyx_n_s_coor_i, __pyx_n_s_coor_j); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__69); + __Pyx_GIVEREF(__pyx_tuple__69); + __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_init, 712, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 712, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":749 + /* "newanalysis/helpers/miscellaneous.pyx":748 * - * @cython.boundscheck(False) - * def pairiter(self, double [:,:,:] run): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def pairiter(self, double [:,:,:] run): * cdef double [:,:] cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #rename: cl->correlationlist - * #cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW */ - __pyx_tuple__66 = PyTuple_Pack(24, __pyx_n_s_self, __pyx_n_s_run, __pyx_n_s_cl, __pyx_n_s_dipt_t, __pyx_n_s_p1l, __pyx_n_s_p2l, __pyx_n_s_cl_self, __pyx_n_s_dipt_t_self, __pyx_n_s_pl, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_index, __pyx_n_s_rv, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_distvec, __pyx_n_s_dist_sq, __pyx_n_s_dist_2, __pyx_n_s_dist_3, __pyx_n_s_selfobj, __pyx_n_s_dipt_0_self, __pyx_n_s_pair, __pyx_n_s_dipt_0); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__66); - __Pyx_GIVEREF(__pyx_tuple__66); - __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(2, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_pairiter, 749, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 749, __pyx_L1_error) + __pyx_tuple__71 = PyTuple_Pack(24, __pyx_n_s_self, __pyx_n_s_run, __pyx_n_s_cl, __pyx_n_s_dipt_t, __pyx_n_s_p1l, __pyx_n_s_p2l, __pyx_n_s_cl_self, __pyx_n_s_dipt_t_self, __pyx_n_s_pl, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_index, __pyx_n_s_rv, __pyx_n_s_r2, __pyx_n_s_f1, __pyx_n_s_f2, __pyx_n_s_distvec, __pyx_n_s_dist_sq, __pyx_n_s_dist_2, __pyx_n_s_dist_3, __pyx_n_s_selfobj, __pyx_n_s_dipt_0_self, __pyx_n_s_pair, __pyx_n_s_dipt_0); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__71); + __Pyx_GIVEREF(__pyx_tuple__71); + __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_pairiter, 748, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 748, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":810 + /* "newanalysis/helpers/miscellaneous.pyx":809 + * ###END DANIEL NOE HELPERS * - * @cython.boundscheck(False) - * def getBestIndex(double [:] aufpunkt, double [:,:] coor): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBestIndex(double [:] aufpunkt, double [:,:] coor): * ''' - * getBestIndex(point, coor) */ - __pyx_tuple__68 = PyTuple_Pack(4, __pyx_n_s_aufpunkt, __pyx_n_s_coor, __pyx_n_s_particles, __pyx_n_s_best_index); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__68); - __Pyx_GIVEREF(__pyx_tuple__68); - __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_getBestIndex, 810, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 810, __pyx_L1_error) + __pyx_tuple__73 = PyTuple_Pack(4, __pyx_n_s_aufpunkt, __pyx_n_s_coor, __pyx_n_s_particles, __pyx_n_s_best_index); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 809, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__73); + __Pyx_GIVEREF(__pyx_tuple__73); + __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_getBestIndex, 809, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 809, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":824 + /* "newanalysis/helpers/miscellaneous.pyx":823 + * return best_index * - * @cython.boundscheck(False) - * def getBestIndices(double [:] aufpunkt, double [:,:] coor, double [:,:] dip, int count): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBestIndices(double [:] aufpunkt, double [:,:] coor, double [:,:] dip, int count): * ''' - * coor ... (n_particles, 3) */ - __pyx_tuple__70 = PyTuple_Pack(12, __pyx_n_s_aufpunkt, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_count, __pyx_n_s_n_particles, __pyx_n_s_point, __pyx_n_s_ctr, __pyx_n_s_cutoff, __pyx_n_s_distances, __pyx_n_s_distances_copy, __pyx_n_s_coor_res, __pyx_n_s_dip_res); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__70); - __Pyx_GIVEREF(__pyx_tuple__70); - __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_getBestIndices, 824, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 824, __pyx_L1_error) + __pyx_tuple__75 = PyTuple_Pack(12, __pyx_n_s_aufpunkt, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_count, __pyx_n_s_n_particles, __pyx_n_s_point, __pyx_n_s_ctr, __pyx_n_s_cutoff, __pyx_n_s_distances, __pyx_n_s_distances_copy, __pyx_n_s_coor_res, __pyx_n_s_dip_res); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__75); + __Pyx_GIVEREF(__pyx_tuple__75); + __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_getBestIndices, 823, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 823, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":853 + /* "newanalysis/helpers/miscellaneous.pyx":852 + * return coor_res, dip_res * - * @cython.boundscheck(False) - * def writeMrHistogram(double [:,:] coor, double [:,:] dip, double [:] aufpunkt, double [:] antagonist, double [:] histogram, double max_distance, int segments_per_angstroem, int order=0): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeMrHistogram(double [:,:] coor, double [:,:] dip, double [:] aufpunkt, double [:] antagonist, double [:] histogram, double max_distance, int segments_per_angstroem, int order=0): * ''' - * coor ... (number_of_particles, 3) */ - __pyx_tuple__72 = PyTuple_Pack(9, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_aufpunkt, __pyx_n_s_antagonist, __pyx_n_s_histogram, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_order, __pyx_n_s_number_of_particles); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__72); - __Pyx_GIVEREF(__pyx_tuple__72); - __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(8, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_writeMrHistogram, 853, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 853, __pyx_L1_error) + __pyx_tuple__77 = PyTuple_Pack(9, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_aufpunkt, __pyx_n_s_antagonist, __pyx_n_s_histogram, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_order, __pyx_n_s_number_of_particles); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 852, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__77); + __Pyx_GIVEREF(__pyx_tuple__77); + __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_writeMrHistogram, 852, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 852, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":866 + /* "newanalysis/helpers/miscellaneous.pyx":865 + * write_Mr_diagram(&coor[0,0], &dip[0,0], number_of_particles, &aufpunkt[0], &antagonist[0], &histogram[0], max_distance, segments_per_angstroem, order) * - * @cython.boundscheck(False) - * def writeKirkwoodHistogram(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:] histogram, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeKirkwoodHistogram(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:] histogram, double max_distance, int segments_per_angstroem, int order = 1): * #TODO documentation - * */ - __pyx_tuple__74 = PyTuple_Pack(9, __pyx_n_s_aufpunkt, __pyx_n_s_aufpunkt_dipole, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_histogram, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_order, __pyx_n_s_particles); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 866, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__74); - __Pyx_GIVEREF(__pyx_tuple__74); - __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(8, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_writeKirkwoodHistogram, 866, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 866, __pyx_L1_error) + __pyx_tuple__79 = PyTuple_Pack(9, __pyx_n_s_aufpunkt, __pyx_n_s_aufpunkt_dipole, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_histogram, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_order, __pyx_n_s_particles); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 865, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__79); + __Pyx_GIVEREF(__pyx_tuple__79); + __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_writeKirkwoodHistogram, 865, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 865, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":872 + /* "newanalysis/helpers/miscellaneous.pyx":872 * write_Kirkwood_diagram(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0], max_distance, segments_per_angstroem, order) * * def writeKirkwoodHistogramShellwise(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< * ''' * aufpunkt ... (3) */ - __pyx_tuple__76 = PyTuple_Pack(14, __pyx_n_s_aufpunkt, __pyx_n_s_aufpunkt_dipole, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_histogram, __pyx_n_s_norm, __pyx_n_s_dataset, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_order, __pyx_n_s_particles, __pyx_n_s_maxshell, __pyx_n_s_i, __pyx_n_s_shell); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 872, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__76); - __Pyx_GIVEREF(__pyx_tuple__76); - __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(10, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_writeKirkwoodHistogramShellwise, 872, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 872, __pyx_L1_error) + __pyx_tuple__81 = PyTuple_Pack(14, __pyx_n_s_aufpunkt, __pyx_n_s_aufpunkt_dipole, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_histogram, __pyx_n_s_norm, __pyx_n_s_dataset, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_order, __pyx_n_s_particles, __pyx_n_s_maxshell, __pyx_n_s_i, __pyx_n_s_shell); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 872, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__81); + __Pyx_GIVEREF(__pyx_tuple__81); + __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(10, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_writeKirkwoodHistogramShellwise, 872, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 872, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":895 + /* "newanalysis/helpers/miscellaneous.pyx":895 * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) * * def writeKirkwoodHistogramShellwise(double [:,:] aufpunkte, double [:,:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< * ''' * aufpunkt ... (number_aufpunkte, 3) */ - __pyx_tuple__78 = PyTuple_Pack(17, __pyx_n_s_aufpunkte, __pyx_n_s_aufpunkt_dipole, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_histogram, __pyx_n_s_norm, __pyx_n_s_dataset, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_order, __pyx_n_s_number_aufpunkte, __pyx_n_s_particles, __pyx_n_s_maxshell, __pyx_n_s_i, __pyx_n_s_shell, __pyx_n_s_aufpunkt, __pyx_n_s_aufpunkt_dipol); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 895, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__78); - __Pyx_GIVEREF(__pyx_tuple__78); - __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(10, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_writeKirkwoodHistogramShellwise, 895, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 895, __pyx_L1_error) + __pyx_tuple__83 = PyTuple_Pack(17, __pyx_n_s_aufpunkte, __pyx_n_s_aufpunkt_dipole, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_histogram, __pyx_n_s_norm, __pyx_n_s_dataset, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_order, __pyx_n_s_number_aufpunkte, __pyx_n_s_particles, __pyx_n_s_maxshell, __pyx_n_s_i, __pyx_n_s_shell, __pyx_n_s_aufpunkt, __pyx_n_s_aufpunkt_dipol); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 895, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__83); + __Pyx_GIVEREF(__pyx_tuple__83); + __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(10, 0, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_writeKirkwoodHistogramShellwise, 895, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 895, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":926 + /* "newanalysis/helpers/miscellaneous.pyx":925 + * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipol[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) * - * @cython.boundscheck(False) - * def writeKirkwoodHistogram2D(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double max_distance, int segments_per_angstroem, int segments_per_pi, int order = 1): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeKirkwoodHistogram2D(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double max_distance, int segments_per_angstroem, int segments_per_pi, int order = 1): * #TODO documentation - * */ - __pyx_tuple__80 = PyTuple_Pack(10, __pyx_n_s_aufpunkt, __pyx_n_s_aufpunkt_dipole, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_histogram, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_segments_per_pi, __pyx_n_s_order, __pyx_n_s_particles); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 926, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__80); - __Pyx_GIVEREF(__pyx_tuple__80); - __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(9, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_writeKirkwoodHistogram2D, 926, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 926, __pyx_L1_error) + __pyx_tuple__85 = PyTuple_Pack(10, __pyx_n_s_aufpunkt, __pyx_n_s_aufpunkt_dipole, __pyx_n_s_coor, __pyx_n_s_dip, __pyx_n_s_histogram, __pyx_n_s_max_distance, __pyx_n_s_segments_per_angstroem, __pyx_n_s_segments_per_pi, __pyx_n_s_order, __pyx_n_s_particles); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__85); + __Pyx_GIVEREF(__pyx_tuple__85); + __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_writeKirkwoodHistogram2D, 925, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 925, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":933 + /* "newanalysis/helpers/miscellaneous.pyx":932 + * write_Kirkwood_diagram_2D(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], max_distance, segments_per_angstroem, segments_per_pi, order) * - * @cython.boundscheck(False) - * def getBondTable(double [:,:] coor, int [:,:] bond_table, int cutoff = 3): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBondTable(double [:,:] coor, int [:,:] bond_table, int cutoff = 3): * ''' - * coor ... (n_particles, 3) */ - __pyx_tuple__82 = PyTuple_Pack(4, __pyx_n_s_coor, __pyx_n_s_bond_table, __pyx_n_s_cutoff, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__82); - __Pyx_GIVEREF(__pyx_tuple__82); - __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_getBondTable, 933, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 933, __pyx_L1_error) + __pyx_tuple__87 = PyTuple_Pack(4, __pyx_n_s_coor, __pyx_n_s_bond_table, __pyx_n_s_cutoff, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__87); + __Pyx_GIVEREF(__pyx_tuple__87); + __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_getBondTable, 932, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) __PYX_ERR(0, 932, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":955 + /* "newanalysis/helpers/miscellaneous.pyx":954 + * # calc_sum_Venn_MD_Cage_Single(&mdcage_timeseries[0,0,0], &dipoles[0,0], n_particles, &dataset1[0], &dataset2[0], maxshell1, maxshell2) * - * @cython.boundscheck(False) - * def sumVennMDCageSingle(double [:,:,:,:] mdcage_timeseries, double [:,:] dipoles, char [:] dataset1, char [:] dataset2, int maxshell1, int maxshell2, int frame): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumVennMDCageSingle(double [:,:,:,:] mdcage_timeseries, double [:,:] dipoles, char [:] dataset1, char [:] dataset2, int maxshell1, int maxshell2, int frame): * - * cdef int w, shell1, shell2, i, nres_wat = dipoles.shape[0] */ - __pyx_tuple__84 = PyTuple_Pack(12, __pyx_n_s_mdcage_timeseries, __pyx_n_s_dipoles, __pyx_n_s_dataset1, __pyx_n_s_dataset2, __pyx_n_s_maxshell1, __pyx_n_s_maxshell2, __pyx_n_s_frame, __pyx_n_s_w, __pyx_n_s_shell1, __pyx_n_s_shell2, __pyx_n_s_i, __pyx_n_s_nres_wat); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 955, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__84); - __Pyx_GIVEREF(__pyx_tuple__84); - __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_sumVennMDCageSingle, 955, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 955, __pyx_L1_error) + __pyx_tuple__89 = PyTuple_Pack(12, __pyx_n_s_mdcage_timeseries, __pyx_n_s_dipoles, __pyx_n_s_dataset1, __pyx_n_s_dataset2, __pyx_n_s_maxshell1, __pyx_n_s_maxshell2, __pyx_n_s_frame, __pyx_n_s_w, __pyx_n_s_shell1, __pyx_n_s_shell2, __pyx_n_s_i, __pyx_n_s_nres_wat); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 954, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__89); + __Pyx_GIVEREF(__pyx_tuple__89); + __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_sumVennMDCageSingle, 954, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(0, 954, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":973 + /* "newanalysis/helpers/miscellaneous.pyx":972 + * mdcage_timeseries[shell1, shell2, frame, i] += dipoles[w, i] * - * @cython.boundscheck(False) - * def sumMultiMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, char [:] ds1, char [:] ds2, char [:] ds3, char [:] ds4, char [:] ds5, int maxshell, int frame): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMultiMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, char [:] ds1, char [:] ds2, char [:] ds3, char [:] ds4, char [:] ds5, int maxshell, int frame): * - * cdef int w, shell, i, nres_wat = dip_wat.shape[0] */ - __pyx_tuple__86 = PyTuple_Pack(18, __pyx_n_s_mdcage_ts, __pyx_n_s_dip_wat, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_ds3, __pyx_n_s_ds4, __pyx_n_s_ds5, __pyx_n_s_maxshell, __pyx_n_s_frame, __pyx_n_s_w, __pyx_n_s_shell, __pyx_n_s_i, __pyx_n_s_nres_wat, __pyx_n_s_shell1, __pyx_n_s_shell2, __pyx_n_s_shell3, __pyx_n_s_shell4, __pyx_n_s_shell5); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 973, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__86); - __Pyx_GIVEREF(__pyx_tuple__86); - __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(9, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_sumMultiMDCageSingle, 973, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 973, __pyx_L1_error) + __pyx_tuple__91 = PyTuple_Pack(18, __pyx_n_s_mdcage_ts, __pyx_n_s_dip_wat, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_ds3, __pyx_n_s_ds4, __pyx_n_s_ds5, __pyx_n_s_maxshell, __pyx_n_s_frame, __pyx_n_s_w, __pyx_n_s_shell, __pyx_n_s_i, __pyx_n_s_nres_wat, __pyx_n_s_shell1, __pyx_n_s_shell2, __pyx_n_s_shell3, __pyx_n_s_shell4, __pyx_n_s_shell5); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__91); + __Pyx_GIVEREF(__pyx_tuple__91); + __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_sumMultiMDCageSingle, 972, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) __PYX_ERR(0, 972, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":995 + /* "newanalysis/helpers/miscellaneous.pyx":994 + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] * - * @cython.boundscheck(False) - * def multiVecShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, long nshells1, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def multiVecShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, long nshells1, long maxdt, long startingpoints): * """ - * rotTs ... (nmol, n (time length), 3D) */ - __pyx_tuple__88 = PyTuple_Pack(25, __pyx_n_s_rotTs, __pyx_n_s_ds1, __pyx_n_s_nshells1, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_t1, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart1, __pyx_n_s_shelldt1); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 995, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__88); - __Pyx_GIVEREF(__pyx_tuple__88); - __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(5, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_multiVecShellCorrelate, 995, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(0, 995, __pyx_L1_error) + __pyx_tuple__93 = PyTuple_Pack(25, __pyx_n_s_rotTs, __pyx_n_s_ds1, __pyx_n_s_nshells1, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_t1, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart1, __pyx_n_s_shelldt1); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 994, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__93); + __Pyx_GIVEREF(__pyx_tuple__93); + __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_multiVecShellCorrelate, 994, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) __PYX_ERR(0, 994, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1052 + /* "newanalysis/helpers/miscellaneous.pyx":1051 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * - * @cython.boundscheck(False) - * def multiVecVennShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def multiVecVennShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): * """ - * rotTs ... (nmol, n (time length), 3D) */ - __pyx_tuple__90 = PyTuple_Pack(29, __pyx_n_s_rotTs, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_nshells1, __pyx_n_s_nshells2, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_t1, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart1, __pyx_n_s_shellstart2, __pyx_n_s_shelldt1, __pyx_n_s_shelldt2); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 1052, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__90); - __Pyx_GIVEREF(__pyx_tuple__90); - __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(7, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_multiVecVennShellCorrelate, 1052, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(0, 1052, __pyx_L1_error) + __pyx_tuple__95 = PyTuple_Pack(29, __pyx_n_s_rotTs, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_nshells1, __pyx_n_s_nshells2, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_t1, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart1, __pyx_n_s_shellstart2, __pyx_n_s_shelldt1, __pyx_n_s_shelldt2); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__95); + __Pyx_GIVEREF(__pyx_tuple__95); + __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_multiVecVennShellCorrelate, 1051, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) __PYX_ERR(0, 1051, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1112 + /* "newanalysis/helpers/miscellaneous.pyx":1111 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * - * @cython.boundscheck(False) - * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps */ - __pyx_tuple__92 = PyTuple_Pack(34, __pyx_n_s_rotTs, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_nshells1, __pyx_n_s_nshells2, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart1, __pyx_n_s_shellstart2, __pyx_n_s_shelldt1, __pyx_n_s_shelldt2); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__92); - __Pyx_GIVEREF(__pyx_tuple__92); - __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(7, 0, 34, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_rotationMatrixVennShellCorrelate, 1112, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(0, 1112, __pyx_L1_error) + __pyx_tuple__97 = PyTuple_Pack(34, __pyx_n_s_rotTs, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_nshells1, __pyx_n_s_nshells2, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart1, __pyx_n_s_shellstart2, __pyx_n_s_shelldt1, __pyx_n_s_shelldt2); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 1111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__97); + __Pyx_GIVEREF(__pyx_tuple__97); + __pyx_codeobj__98 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 34, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_rotationMatrixVennShellCorrelate, 1111, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__98)) __PYX_ERR(0, 1111, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1200 + /* "newanalysis/helpers/miscellaneous.pyx":1199 * - * @cython.boundscheck(False) - * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps */ - __pyx_tuple__94 = PyTuple_Pack(38, __pyx_n_s_rotTs, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_ds3, __pyx_n_s_ds4, __pyx_n_s_ds5, __pyx_n_s_nshells, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_shell1, __pyx_n_s_shell2, __pyx_n_s_shell3, __pyx_n_s_shell4, __pyx_n_s_shell5); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 1200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__94); - __Pyx_GIVEREF(__pyx_tuple__94); - __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(9, 0, 38, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_rotationMatrixMultiShellCorrelat, 1200, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(0, 1200, __pyx_L1_error) + __pyx_tuple__99 = PyTuple_Pack(38, __pyx_n_s_rotTs, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_ds3, __pyx_n_s_ds4, __pyx_n_s_ds5, __pyx_n_s_nshells, __pyx_n_s_maxdt, __pyx_n_s_startingpoints, __pyx_n_s_nmol, __pyx_n_s_n, __pyx_n_s_startskip, __pyx_n_s_corr, __pyx_n_s_selfcorr, __pyx_n_s_crosscorr, __pyx_n_s_ctr, __pyx_n_s_selfctr, __pyx_n_s_crossctr, __pyx_n_s_t1, __pyx_n_s_t2, __pyx_n_s_t3, __pyx_n_s_t4, __pyx_n_s_t5, __pyx_n_s_t6, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_start, __pyx_n_s_point, __pyx_n_s_dt, __pyx_n_s_mol, __pyx_n_s_shellstart, __pyx_n_s_shelldt, __pyx_n_s_shell1, __pyx_n_s_shell2, __pyx_n_s_shell3, __pyx_n_s_shell4, __pyx_n_s_shell5); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 1199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__99); + __Pyx_GIVEREF(__pyx_tuple__99); + __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 38, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_rotationMatrixMultiShellCorrelat, 1199, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(0, 1199, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1292 + /* "newanalysis/helpers/miscellaneous.pyx":1291 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * - * @cython.boundscheck(False) - * def collectiveDipolesCutoff(double [:,:] coor, double[:,:] dipoles, double[:] aufpunkt, double[:] dip_inside, double[:] dip_outside, double cutoff): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def collectiveDipolesCutoff(double [:,:] coor, double[:,:] dipoles, double[:] aufpunkt, double[:] dip_inside, double[:] dip_outside, double cutoff): * #TODO documentation - * */ - __pyx_tuple__96 = PyTuple_Pack(7, __pyx_n_s_coor, __pyx_n_s_dipoles, __pyx_n_s_aufpunkt, __pyx_n_s_dip_inside, __pyx_n_s_dip_outside, __pyx_n_s_cutoff, __pyx_n_s_particles); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__96); - __Pyx_GIVEREF(__pyx_tuple__96); - __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_collectiveDipolesCutoff, 1292, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(0, 1292, __pyx_L1_error) + __pyx_tuple__101 = PyTuple_Pack(7, __pyx_n_s_coor, __pyx_n_s_dipoles, __pyx_n_s_aufpunkt, __pyx_n_s_dip_inside, __pyx_n_s_dip_outside, __pyx_n_s_cutoff, __pyx_n_s_particles); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 1291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__101); + __Pyx_GIVEREF(__pyx_tuple__101); + __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_collectiveDipolesCutoff, 1291, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 1291, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1300 + /* "newanalysis/helpers/miscellaneous.pyx":1299 + * * #TODO: As a C++ function? - * @cython.boundscheck(False) - * def shellHistograms(double [:,:] histograms, double [:] aufpunkt, double [:,:] coors, char [:] ds, int maxshell, double max_distance, int segs_per_angstroem): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def shellHistograms(double [:,:] histograms, double [:] aufpunkt, double [:,:] coors, char [:] ds, int maxshell, double max_distance, int segs_per_angstroem): * #TODO documentation - * */ - __pyx_tuple__98 = PyTuple_Pack(12, __pyx_n_s_histograms, __pyx_n_s_aufpunkt, __pyx_n_s_coors, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_max_distance, __pyx_n_s_segs_per_angstroem, __pyx_n_s_i, __pyx_n_s_shell, __pyx_n_s_bin_dist, __pyx_n_s_particles, __pyx_n_s_distance); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 1300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__98); - __Pyx_GIVEREF(__pyx_tuple__98); - __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_shellHistograms, 1300, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) __PYX_ERR(0, 1300, __pyx_L1_error) + __pyx_tuple__103 = PyTuple_Pack(12, __pyx_n_s_histograms, __pyx_n_s_aufpunkt, __pyx_n_s_coors, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_max_distance, __pyx_n_s_segs_per_angstroem, __pyx_n_s_i, __pyx_n_s_shell, __pyx_n_s_bin_dist, __pyx_n_s_particles, __pyx_n_s_distance); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 1299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__103); + __Pyx_GIVEREF(__pyx_tuple__103); + __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_shellHistograms, 1299, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) __PYX_ERR(0, 1299, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1345 + /* "newanalysis/helpers/miscellaneous.pyx":1344 * - * @cython.boundscheck(False) - * def correlateSingleVector(double[:,:] timeseries, double[:] result, int order = 1): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleVector(double[:,:] timeseries, double[:] result, int order = 1): * """ - * Correlate the timeseries of a single vector (e.g. collective dipole, one single particle, etc...) */ - __pyx_tuple__100 = PyTuple_Pack(4, __pyx_n_s_timeseries, __pyx_n_s_result, __pyx_n_s_order, __pyx_n_s_number_of_frames); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(0, 1345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__100); - __Pyx_GIVEREF(__pyx_tuple__100); - __pyx_codeobj__101 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__100, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_correlateSingleVector, 1345, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__101)) __PYX_ERR(0, 1345, __pyx_L1_error) + __pyx_tuple__105 = PyTuple_Pack(4, __pyx_n_s_timeseries, __pyx_n_s_result, __pyx_n_s_order, __pyx_n_s_number_of_frames); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 1344, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__105); + __Pyx_GIVEREF(__pyx_tuple__105); + __pyx_codeobj__106 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_correlateSingleVector, 1344, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__106)) __PYX_ERR(0, 1344, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1357 + /* "newanalysis/helpers/miscellaneous.pyx":1356 + * correlateSingleVectorTS(×eries[0,0], &result[0], number_of_frames, order) * - * @cython.boundscheck(False) - * def crossCorrelateSingleVector(double[:,:] timeseries1, double[:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossCorrelateSingleVector(double[:,:] timeseries1, double[:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): * """ - * Correlate the timeseries of two different single vectors (e.g. collective dipole, one single particle, etc...) */ - __pyx_tuple__102 = PyTuple_Pack(7, __pyx_n_s_timeseries1, __pyx_n_s_timeseries2, __pyx_n_s_result, __pyx_n_s_both_directions, __pyx_n_s_order, __pyx_n_s_number_of_frames1, __pyx_n_s_number_of_frames2); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(0, 1357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__102); - __Pyx_GIVEREF(__pyx_tuple__102); - __pyx_codeobj__103 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__102, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_crossCorrelateSingleVector, 1357, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__103)) __PYX_ERR(0, 1357, __pyx_L1_error) + __pyx_tuple__107 = PyTuple_Pack(7, __pyx_n_s_timeseries1, __pyx_n_s_timeseries2, __pyx_n_s_result, __pyx_n_s_both_directions, __pyx_n_s_order, __pyx_n_s_number_of_frames1, __pyx_n_s_number_of_frames2); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 1356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__107); + __Pyx_GIVEREF(__pyx_tuple__107); + __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_crossCorrelateSingleVector, 1356, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) __PYX_ERR(0, 1356, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1374 + /* "newanalysis/helpers/miscellaneous.pyx":1373 + * crossCorrelateSingleVectorTS(×eries1[0,0], ×eries2[0,0], &result[0], number_of_frames1, number_of_frames2, both_directions, order) * - * @cython.boundscheck(False) - * def correlateMultiVector(double[:,:,:] timeseries, double[:] result, int order = 1): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateMultiVector(double[:,:,:] timeseries, double[:] result, int order = 1): * """ - * Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...) */ - __pyx_tuple__104 = PyTuple_Pack(5, __pyx_n_s_timeseries, __pyx_n_s_result, __pyx_n_s_order, __pyx_n_s_number_of_particles, __pyx_n_s_number_of_frames); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 1374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__104); - __Pyx_GIVEREF(__pyx_tuple__104); - __pyx_codeobj__105 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_correlateMultiVector, 1374, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__105)) __PYX_ERR(0, 1374, __pyx_L1_error) + __pyx_tuple__109 = PyTuple_Pack(5, __pyx_n_s_timeseries, __pyx_n_s_result, __pyx_n_s_order, __pyx_n_s_number_of_particles, __pyx_n_s_number_of_frames); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 1373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__109); + __Pyx_GIVEREF(__pyx_tuple__109); + __pyx_codeobj__110 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__109, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_correlateMultiVector, 1373, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__110)) __PYX_ERR(0, 1373, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1387 + /* "newanalysis/helpers/miscellaneous.pyx":1386 + * correlateMultiVectorTS(×eries[0,0,0], &result[0], number_of_particles, number_of_frames, order) * - * @cython.boundscheck(False) - * def correlateMultiVectorShellwise(double [:,:,:] timeseries, double [:,:] dataset, double [:,:] result, int maxshell, int order = 1): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateMultiVectorShellwise(double [:,:,:] timeseries, double [:,:] dataset, double [:,:] result, int maxshell, int order = 1): * """ - * timeseries ... (number_of_particles, number_of_frames, 3) */ - __pyx_tuple__106 = PyTuple_Pack(7, __pyx_n_s_timeseries, __pyx_n_s_dataset, __pyx_n_s_result, __pyx_n_s_maxshell, __pyx_n_s_order, __pyx_n_s_number_of_particles, __pyx_n_s_number_of_frames); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 1387, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__106); - __Pyx_GIVEREF(__pyx_tuple__106); - __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_correlateMultiVectorShellwise, 1387, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 1387, __pyx_L1_error) + __pyx_tuple__111 = PyTuple_Pack(7, __pyx_n_s_timeseries, __pyx_n_s_dataset, __pyx_n_s_result, __pyx_n_s_maxshell, __pyx_n_s_order, __pyx_n_s_number_of_particles, __pyx_n_s_number_of_frames); if (unlikely(!__pyx_tuple__111)) __PYX_ERR(0, 1386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__111); + __Pyx_GIVEREF(__pyx_tuple__111); + __pyx_codeobj__112 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__111, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_correlateMultiVectorShellwise, 1386, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__112)) __PYX_ERR(0, 1386, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1399 + /* "newanalysis/helpers/miscellaneous.pyx":1399 * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) * * def correlateMultiVectorVennShellwise(double [:,:,:] timeseries, double [:,:] dataset1, double [:,:] dataset2, double [:,:,:] result, int maxshell1, int maxshell2, int order = 1): # <<<<<<<<<<<<<< * """ * timeseries ... (number_of_particles, number_of_frames, 3) */ - __pyx_tuple__108 = PyTuple_Pack(9, __pyx_n_s_timeseries, __pyx_n_s_dataset1, __pyx_n_s_dataset2, __pyx_n_s_result, __pyx_n_s_maxshell1, __pyx_n_s_maxshell2, __pyx_n_s_order, __pyx_n_s_number_of_particles, __pyx_n_s_number_of_frames); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 1399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__108); - __Pyx_GIVEREF(__pyx_tuple__108); - __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(7, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_correlateMultiVectorVennShellwis, 1399, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(0, 1399, __pyx_L1_error) - - /* "src/helpers/miscellaneous.pyx":1413 - * - * @cython.boundscheck(False) - * def crossCorrelateMultiVector(double[:,:,:] timeseries1, double[:,:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): # <<<<<<<<<<<<<< - * """ - * Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...) - */ - __pyx_tuple__110 = PyTuple_Pack(8, __pyx_n_s_timeseries1, __pyx_n_s_timeseries2, __pyx_n_s_result, __pyx_n_s_both_directions, __pyx_n_s_order, __pyx_n_s_number_of_particles, __pyx_n_s_number_of_frames1, __pyx_n_s_number_of_frames2); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 1413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__110); - __Pyx_GIVEREF(__pyx_tuple__110); - __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_crossCorrelateMultiVector, 1413, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 1413, __pyx_L1_error) + __pyx_tuple__113 = PyTuple_Pack(9, __pyx_n_s_timeseries, __pyx_n_s_dataset1, __pyx_n_s_dataset2, __pyx_n_s_result, __pyx_n_s_maxshell1, __pyx_n_s_maxshell2, __pyx_n_s_order, __pyx_n_s_number_of_particles, __pyx_n_s_number_of_frames); if (unlikely(!__pyx_tuple__113)) __PYX_ERR(0, 1399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__113); + __Pyx_GIVEREF(__pyx_tuple__113); + __pyx_codeobj__114 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_correlateMultiVectorVennShellwis, 1399, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__114)) __PYX_ERR(0, 1399, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1431 - * - * @cython.boundscheck(False) - * def correlateSingleParticleMuShellwise(double[:,:,:] timeseries, double[:,:] result, int[:,:] dataset, int number_of_startingpoints): # <<<<<<<<<<<<<< - * """ - * timeseries... (N_particle, number_of_frames, mu) - */ - __pyx_tuple__112 = PyTuple_Pack(15, __pyx_n_s_timeseries, __pyx_n_s_result, __pyx_n_s_dataset, __pyx_n_s_number_of_startingpoints, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_shell, __pyx_n_s_particles, __pyx_n_s_number_of_frames, __pyx_n_s_number_of_shells, __pyx_n_s_correlation_length, __pyx_n_s_sub_correlation, __pyx_n_s_norm, __pyx_n_s_counter); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 1431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__112); - __Pyx_GIVEREF(__pyx_tuple__112); - __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(4, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_correlateSingleParticleMuShellwi, 1431, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 1431, __pyx_L1_error) - - /* "src/helpers/miscellaneous.pyx":1480 + /* "newanalysis/helpers/miscellaneous.pyx":1412 + * correlateMultiVectorVennShellwiseTS(×eries[0,0,0], &dataset1[0,0], &dataset2[0,0], &result[0,0,0], number_of_particles, number_of_frames, maxshell1, maxshell2, order) * - * @cython.boundscheck(False) - * def correlateSingleParticleMuVennShellwise(double[:,:,:] timeseries, double[:,:,:] result, int[:,:] dataset1, int[:,:] dataset2, int number_of_startingpoints): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossCorrelateMultiVector(double[:,:,:] timeseries1, double[:,:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): * """ - * timeseries... (N_particle, number_of_frames, mu) */ - __pyx_tuple__114 = PyTuple_Pack(17, __pyx_n_s_timeseries, __pyx_n_s_result, __pyx_n_s_dataset1, __pyx_n_s_dataset2, __pyx_n_s_number_of_startingpoints, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_shell1, __pyx_n_s_shell2, __pyx_n_s_particles, __pyx_n_s_number_of_frames, __pyx_n_s_number_of_shells1, __pyx_n_s_number_of_shells2, __pyx_n_s_correlation_length, __pyx_n_s_norm, __pyx_n_s_counter); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 1480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__114); - __Pyx_GIVEREF(__pyx_tuple__114); - __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(5, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_correlateSingleParticleMuVennShe, 1480, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 1480, __pyx_L1_error) + __pyx_tuple__115 = PyTuple_Pack(8, __pyx_n_s_timeseries1, __pyx_n_s_timeseries2, __pyx_n_s_result, __pyx_n_s_both_directions, __pyx_n_s_order, __pyx_n_s_number_of_particles, __pyx_n_s_number_of_frames1, __pyx_n_s_number_of_frames2); if (unlikely(!__pyx_tuple__115)) __PYX_ERR(0, 1412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__115); + __Pyx_GIVEREF(__pyx_tuple__115); + __pyx_codeobj__116 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__115, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_crossCorrelateMultiVector, 1412, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__116)) __PYX_ERR(0, 1412, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1530 + /* "newanalysis/helpers/miscellaneous.pyx":1430 + * crossCorrelateMultiVectorTS(×eries1[0,0,0], ×eries2[0,0,0], &result[0], number_of_particles, number_of_frames1, number_of_frames2, both_directions, order) * - * @cython.boundscheck(False) - * def vanHoveSingleVector(double[:,:] timeseries, double[:,:] histogram): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleParticleMuShellwise(double[:,:,:] timeseries, double[:,:] result, int[:,:] dataset, int number_of_startingpoints): * """ - * timeseries ... (correlation_length * 3) */ - __pyx_tuple__116 = PyTuple_Pack(4, __pyx_n_s_timeseries, __pyx_n_s_histogram, __pyx_n_s_correlation_length, __pyx_n_s_cos_segs); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 1530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__116); - __Pyx_GIVEREF(__pyx_tuple__116); - __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_vanHoveSingleVector, 1530, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 1530, __pyx_L1_error) + __pyx_tuple__117 = PyTuple_Pack(15, __pyx_n_s_timeseries, __pyx_n_s_result, __pyx_n_s_dataset, __pyx_n_s_number_of_startingpoints, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_shell, __pyx_n_s_particles, __pyx_n_s_number_of_frames, __pyx_n_s_number_of_shells, __pyx_n_s_correlation_length, __pyx_n_s_sub_correlation, __pyx_n_s_norm, __pyx_n_s_counter); if (unlikely(!__pyx_tuple__117)) __PYX_ERR(0, 1430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__117); + __Pyx_GIVEREF(__pyx_tuple__117); + __pyx_codeobj__118 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__117, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_correlateSingleParticleMuShellwi, 1430, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__118)) __PYX_ERR(0, 1430, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1542 + /* "newanalysis/helpers/miscellaneous.pyx":1479 + * result[i][k] /= counter[i] * - * @cython.boundscheck(False) - * def vanHoveMultiVector(double[:,:,:] timeseries, double[:,:] histogram): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleParticleMuVennShellwise(double[:,:,:] timeseries, double[:,:,:] result, int[:,:] dataset1, int[:,:] dataset2, int number_of_startingpoints): * """ - * timeseries ... (n_particles * correlation_length * 3) */ - __pyx_tuple__118 = PyTuple_Pack(5, __pyx_n_s_timeseries, __pyx_n_s_histogram, __pyx_n_s_n_particles, __pyx_n_s_correlation_length, __pyx_n_s_cos_segs); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 1542, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__118); - __Pyx_GIVEREF(__pyx_tuple__118); - __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_vanHoveMultiVector, 1542, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 1542, __pyx_L1_error) + __pyx_tuple__119 = PyTuple_Pack(17, __pyx_n_s_timeseries, __pyx_n_s_result, __pyx_n_s_dataset1, __pyx_n_s_dataset2, __pyx_n_s_number_of_startingpoints, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_shell1, __pyx_n_s_shell2, __pyx_n_s_particles, __pyx_n_s_number_of_frames, __pyx_n_s_number_of_shells1, __pyx_n_s_number_of_shells2, __pyx_n_s_correlation_length, __pyx_n_s_norm, __pyx_n_s_counter); if (unlikely(!__pyx_tuple__119)) __PYX_ERR(0, 1479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__119); + __Pyx_GIVEREF(__pyx_tuple__119); + __pyx_codeobj__120 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__119, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_correlateSingleParticleMuVennShe, 1479, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__120)) __PYX_ERR(0, 1479, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1555 + /* "newanalysis/helpers/miscellaneous.pyx":1529 + * result[i][j][k] /= counter[i][j] * - * @cython.boundscheck(False) - * def sortCollectiveDipNNShells(char[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vanHoveSingleVector(double[:,:] timeseries, double[:,:] histogram): * """ - * ds ... (n_particles, n_particles) */ - __pyx_tuple__120 = PyTuple_Pack(4, __pyx_n_s_ds, __pyx_n_s_dip_wat, __pyx_n_s_dip_shell, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 1555, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__120); - __Pyx_GIVEREF(__pyx_tuple__120); - __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_sortCollectiveDipNNShells, 1555, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(0, 1555, __pyx_L1_error) + __pyx_tuple__121 = PyTuple_Pack(4, __pyx_n_s_timeseries, __pyx_n_s_histogram, __pyx_n_s_correlation_length, __pyx_n_s_cos_segs); if (unlikely(!__pyx_tuple__121)) __PYX_ERR(0, 1529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__121); + __Pyx_GIVEREF(__pyx_tuple__121); + __pyx_codeobj__122 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__121, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_vanHoveSingleVector, 1529, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__122)) __PYX_ERR(0, 1529, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1566 + /* "newanalysis/helpers/miscellaneous.pyx":1541 + * calcVanHoveSingleVector(×eries[0,0], &histogram[0,0], correlation_length, cos_segs) * - * @cython.boundscheck(False) - * def sortCollectiveDipNNShellsInt(int[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vanHoveMultiVector(double[:,:,:] timeseries, double[:,:] histogram): * """ - * ds ... (n_particles, n_particles) */ - __pyx_tuple__122 = PyTuple_Pack(4, __pyx_n_s_ds, __pyx_n_s_dip_wat, __pyx_n_s_dip_shell, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(0, 1566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__122); - __Pyx_GIVEREF(__pyx_tuple__122); - __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_sortCollectiveDipNNShellsInt, 1566, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) __PYX_ERR(0, 1566, __pyx_L1_error) + __pyx_tuple__123 = PyTuple_Pack(5, __pyx_n_s_timeseries, __pyx_n_s_histogram, __pyx_n_s_n_particles, __pyx_n_s_correlation_length, __pyx_n_s_cos_segs); if (unlikely(!__pyx_tuple__123)) __PYX_ERR(0, 1541, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__123); + __Pyx_GIVEREF(__pyx_tuple__123); + __pyx_codeobj__124 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__123, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_vanHoveMultiVector, 1541, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__124)) __PYX_ERR(0, 1541, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1577 + /* "newanalysis/helpers/miscellaneous.pyx":1554 + * calcVanHoveMultiVector(×eries[0,0,0], &histogram[0,0], n_particles, correlation_length, cos_segs) * - * @cython.boundscheck(False) - * def calcDipTenCollective(double[:,:] coor, double[:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sortCollectiveDipNNShells(char[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): * """ - * coor ... (n_particles, 3) */ - __pyx_tuple__124 = PyTuple_Pack(3, __pyx_n_s_coor, __pyx_n_s_results, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 1577, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__124); - __Pyx_GIVEREF(__pyx_tuple__124); - __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDipTenCollective, 1577, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 1577, __pyx_L1_error) + __pyx_tuple__125 = PyTuple_Pack(4, __pyx_n_s_ds, __pyx_n_s_dip_wat, __pyx_n_s_dip_shell, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__125)) __PYX_ERR(0, 1554, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__125); + __Pyx_GIVEREF(__pyx_tuple__125); + __pyx_codeobj__126 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__125, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_sortCollectiveDipNNShells, 1554, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__126)) __PYX_ERR(0, 1554, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1587 + /* "newanalysis/helpers/miscellaneous.pyx":1565 + * sort_collective_dip_NN_shells(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) * - * @cython.boundscheck(False) - * def calcDipTenCollectivePerAtom(int idx, double[:,:] coor, double[:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sortCollectiveDipNNShellsInt(int[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): * """ - * coor ... (n_particles, 3) */ - __pyx_tuple__126 = PyTuple_Pack(4, __pyx_n_s_idx, __pyx_n_s_coor, __pyx_n_s_results, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 1587, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__126); - __Pyx_GIVEREF(__pyx_tuple__126); - __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDipTenCollectivePerAtom, 1587, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(0, 1587, __pyx_L1_error) + __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__125, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_sortCollectiveDipNNShellsInt, 1565, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(0, 1565, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1597 + /* "newanalysis/helpers/miscellaneous.pyx":1576 + * sort_collective_dip_NN_shells_int(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) * - * @cython.boundscheck(False) - * def calcDipTenCollectiveCross(double[:,:] coor1, double[:,:] coor2, double[:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective(double[:,:] coor, double[:] results): * """ - * coor1 ... (n_particles1, 3) */ - __pyx_tuple__128 = PyTuple_Pack(5, __pyx_n_s_coor1, __pyx_n_s_coor2, __pyx_n_s_results, __pyx_n_s_n_particles1, __pyx_n_s_n_particles2); if (unlikely(!__pyx_tuple__128)) __PYX_ERR(0, 1597, __pyx_L1_error) + __pyx_tuple__128 = PyTuple_Pack(3, __pyx_n_s_coor, __pyx_n_s_results, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__128)) __PYX_ERR(0, 1576, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__128); __Pyx_GIVEREF(__pyx_tuple__128); - __pyx_codeobj__129 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDipTenCollectiveCross, 1597, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__129)) __PYX_ERR(0, 1597, __pyx_L1_error) + __pyx_codeobj__129 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDipTenCollective, 1576, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__129)) __PYX_ERR(0, 1576, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1610 + /* "newanalysis/helpers/miscellaneous.pyx":1586 + * calc_dip_ten_collective(&coor[0,0], n_particles, &results[0]) * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwise(double[:,:] coor, char [:,:] ds, double[:,:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectivePerAtom(int idx, double[:,:] coor, double[:] results): * """ - * coor ... (n_particles, 3) */ - __pyx_tuple__130 = PyTuple_Pack(5, __pyx_n_s_coor, __pyx_n_s_ds, __pyx_n_s_results, __pyx_n_s_n_particles, __pyx_n_s_shells); if (unlikely(!__pyx_tuple__130)) __PYX_ERR(0, 1610, __pyx_L1_error) + __pyx_tuple__130 = PyTuple_Pack(4, __pyx_n_s_idx, __pyx_n_s_coor, __pyx_n_s_results, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__130)) __PYX_ERR(0, 1586, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__130); __Pyx_GIVEREF(__pyx_tuple__130); - __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDipTenCollectiveNNShellwise, 1610, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) __PYX_ERR(0, 1610, __pyx_L1_error) + __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDipTenCollectivePerAtom, 1586, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) __PYX_ERR(0, 1586, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1623 + /* "newanalysis/helpers/miscellaneous.pyx":1596 + * calc_dip_ten_collective_per_atom(idx, &coor[0,0], n_particles, &results[0]) * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwiseSelf(double[:,:] coor, int[:] f2c, char [:,:] ds, int ds_idx, double[:,:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveCross(double[:,:] coor1, double[:,:] coor2, double[:] results): * """ - * coor ... (n_particles, 3) */ - __pyx_tuple__132 = PyTuple_Pack(8, __pyx_n_s_coor, __pyx_n_s_f2c, __pyx_n_s_ds, __pyx_n_s_ds_idx, __pyx_n_s_results, __pyx_n_s_n_particles, __pyx_n_s_n_particles_tot, __pyx_n_s_shells); if (unlikely(!__pyx_tuple__132)) __PYX_ERR(0, 1623, __pyx_L1_error) + __pyx_tuple__132 = PyTuple_Pack(5, __pyx_n_s_coor1, __pyx_n_s_coor2, __pyx_n_s_results, __pyx_n_s_n_particles1, __pyx_n_s_n_particles2); if (unlikely(!__pyx_tuple__132)) __PYX_ERR(0, 1596, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__132); __Pyx_GIVEREF(__pyx_tuple__132); - __pyx_codeobj__133 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDipTenCollectiveNNShellwiseS, 1623, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__133)) __PYX_ERR(0, 1623, __pyx_L1_error) + __pyx_codeobj__133 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDipTenCollectiveCross, 1596, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__133)) __PYX_ERR(0, 1596, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1637 + /* "newanalysis/helpers/miscellaneous.pyx":1609 * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwiseCross(double[:,:] coor1, double[:,:] coor2, int[:] f2c, char [:,:] ds, int ds1_idx, int ds2_idx, double[:,:] results): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwise(double[:,:] coor, char [:,:] ds, double[:,:] results): * """ - * coor1 ... (n_particles1, 3) */ - __pyx_tuple__134 = PyTuple_Pack(11, __pyx_n_s_coor1, __pyx_n_s_coor2, __pyx_n_s_f2c, __pyx_n_s_ds, __pyx_n_s_ds1_idx, __pyx_n_s_ds2_idx, __pyx_n_s_results, __pyx_n_s_n_particles1, __pyx_n_s_n_particles2, __pyx_n_s_n_particles_tot, __pyx_n_s_shells); if (unlikely(!__pyx_tuple__134)) __PYX_ERR(0, 1637, __pyx_L1_error) + __pyx_tuple__134 = PyTuple_Pack(5, __pyx_n_s_coor, __pyx_n_s_ds, __pyx_n_s_results, __pyx_n_s_n_particles, __pyx_n_s_shells); if (unlikely(!__pyx_tuple__134)) __PYX_ERR(0, 1609, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__134); __Pyx_GIVEREF(__pyx_tuple__134); - __pyx_codeobj__135 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDipTenCollectiveNNShellwiseC, 1637, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__135)) __PYX_ERR(0, 1637, __pyx_L1_error) + __pyx_codeobj__135 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDipTenCollectiveNNShellwise, 1609, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__135)) __PYX_ERR(0, 1609, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1653 + /* "newanalysis/helpers/miscellaneous.pyx":1622 * - * @cython.boundscheck(False) - * def calcDipTenCollective1NShellwiseSelf(double[:,:] coor, char [:] ds, double[:,:,:] results): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwiseSelf(double[:,:] coor, int[:] f2c, char [:,:] ds, int ds_idx, double[:,:] results): * """ - * coor ... (n_particles, 3) */ - __pyx_tuple__136 = PyTuple_Pack(5, __pyx_n_s_coor, __pyx_n_s_ds, __pyx_n_s_results, __pyx_n_s_n_particles, __pyx_n_s_shells); if (unlikely(!__pyx_tuple__136)) __PYX_ERR(0, 1653, __pyx_L1_error) + __pyx_tuple__136 = PyTuple_Pack(8, __pyx_n_s_coor, __pyx_n_s_f2c, __pyx_n_s_ds, __pyx_n_s_ds_idx, __pyx_n_s_results, __pyx_n_s_n_particles, __pyx_n_s_n_particles_tot, __pyx_n_s_shells); if (unlikely(!__pyx_tuple__136)) __PYX_ERR(0, 1622, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__136); __Pyx_GIVEREF(__pyx_tuple__136); - __pyx_codeobj__137 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDipTenCollective1NShellwiseS, 1653, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__137)) __PYX_ERR(0, 1653, __pyx_L1_error) + __pyx_codeobj__137 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDipTenCollectiveNNShellwiseS, 1622, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__137)) __PYX_ERR(0, 1622, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1666 + /* "newanalysis/helpers/miscellaneous.pyx":1636 * - * @cython.boundscheck(False) - * def calcDipTenCollective1NShellwiseCross(double[:,:] coor1, double[:,:] coor2, char [:] ds, double[:,:] results): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwiseCross(double[:,:] coor1, double[:,:] coor2, int[:] f2c, char [:,:] ds, int ds1_idx, int ds2_idx, double[:,:] results): * """ - * coor1 ... (n_particles1, 3) */ - __pyx_tuple__138 = PyTuple_Pack(7, __pyx_n_s_coor1, __pyx_n_s_coor2, __pyx_n_s_ds, __pyx_n_s_results, __pyx_n_s_n_particles1, __pyx_n_s_n_particles2, __pyx_n_s_shells); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(0, 1666, __pyx_L1_error) + __pyx_tuple__138 = PyTuple_Pack(11, __pyx_n_s_coor1, __pyx_n_s_coor2, __pyx_n_s_f2c, __pyx_n_s_ds, __pyx_n_s_ds1_idx, __pyx_n_s_ds2_idx, __pyx_n_s_results, __pyx_n_s_n_particles1, __pyx_n_s_n_particles2, __pyx_n_s_n_particles_tot, __pyx_n_s_shells); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(0, 1636, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__138); __Pyx_GIVEREF(__pyx_tuple__138); - __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDipTenCollective1NShellwiseC, 1666, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) __PYX_ERR(0, 1666, __pyx_L1_error) + __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDipTenCollectiveNNShellwiseC, 1636, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) __PYX_ERR(0, 1636, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1682 - * # Deprecated! - * @cython.boundscheck(False) - * def calcDipTenCollectiveShellwise(double[:,:] coor, char [:] ds, int maxshell, double[:,:] results): # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1652 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective1NShellwiseSelf(double[:,:] coor, char [:] ds, double[:,:,:] results): * """ - * coor ... (n_particles, 3) */ - __pyx_tuple__140 = PyTuple_Pack(5, __pyx_n_s_coor, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_results, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__140)) __PYX_ERR(0, 1682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__140); - __Pyx_GIVEREF(__pyx_tuple__140); - __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDipTenCollectiveShellwise, 1682, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) __PYX_ERR(0, 1682, __pyx_L1_error) + __pyx_codeobj__140 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDipTenCollective1NShellwiseS, 1652, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__140)) __PYX_ERR(0, 1652, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1694 - * # Deprecated! - * @cython.boundscheck(False) - * def calcDipTenCollectiveVennShellwise(double[:,:] coor, char [:] ds1, char [:] ds2, int maxshell1, int maxshell2, double[:,:,:] results): # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1665 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective1NShellwiseCross(double[:,:] coor1, double[:,:] coor2, char [:] ds, double[:,:] results): * """ - * coor ... (n_particles, 3) */ - __pyx_tuple__142 = PyTuple_Pack(7, __pyx_n_s_coor, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_maxshell1, __pyx_n_s_maxshell2, __pyx_n_s_results, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__142)) __PYX_ERR(0, 1694, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__142); - __Pyx_GIVEREF(__pyx_tuple__142); - __pyx_codeobj__143 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDipTenCollectiveVennShellwis, 1694, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__143)) __PYX_ERR(0, 1694, __pyx_L1_error) + __pyx_tuple__141 = PyTuple_Pack(7, __pyx_n_s_coor1, __pyx_n_s_coor2, __pyx_n_s_ds, __pyx_n_s_results, __pyx_n_s_n_particles1, __pyx_n_s_n_particles2, __pyx_n_s_shells); if (unlikely(!__pyx_tuple__141)) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__141); + __Pyx_GIVEREF(__pyx_tuple__141); + __pyx_codeobj__142 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__141, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDipTenCollective1NShellwiseC, 1665, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__142)) __PYX_ERR(0, 1665, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1706 + /* "newanalysis/helpers/miscellaneous.pyx":1681 * - * @cython.boundscheck(False) - * def calcDistanceDelaunyMindist(double[:,:] coor, double boxlength, int number_of_shells, double bin_width=1.0): # <<<<<<<<<<<<<< + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveShellwise(double[:,:] coor, char [:] ds, int maxshell, double[:,:] results): * """ - * coor ... (n_particles, 3) */ - __pyx_tuple__144 = PyTuple_Pack(6, __pyx_n_s_coor, __pyx_n_s_boxlength, __pyx_n_s_number_of_shells, __pyx_n_s_bin_width, __pyx_n_s_n_particles, __pyx_n_s_delauny_matrix); if (unlikely(!__pyx_tuple__144)) __PYX_ERR(0, 1706, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__144); - __Pyx_GIVEREF(__pyx_tuple__144); - __pyx_codeobj__145 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDistanceDelaunyMindist, 1706, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__145)) __PYX_ERR(0, 1706, __pyx_L1_error) + __pyx_tuple__143 = PyTuple_Pack(5, __pyx_n_s_coor, __pyx_n_s_ds, __pyx_n_s_maxshell, __pyx_n_s_results, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__143)) __PYX_ERR(0, 1681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__143); + __Pyx_GIVEREF(__pyx_tuple__143); + __pyx_codeobj__144 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__143, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDipTenCollectiveShellwise, 1681, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__144)) __PYX_ERR(0, 1681, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1718 + /* "newanalysis/helpers/miscellaneous.pyx":1693 * - * @cython.boundscheck(False) - * def calcDistanceDelauny(double[:,:] coor, int number_of_shells, double bin_width=1.0): # <<<<<<<<<<<<<< + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveVennShellwise(double[:,:] coor, char [:] ds1, char [:] ds2, int maxshell1, int maxshell2, double[:,:,:] results): * """ - * coor ... (n_particles, 3) */ - __pyx_tuple__146 = PyTuple_Pack(5, __pyx_n_s_coor, __pyx_n_s_number_of_shells, __pyx_n_s_bin_width, __pyx_n_s_n_particles, __pyx_n_s_delauny_matrix); if (unlikely(!__pyx_tuple__146)) __PYX_ERR(0, 1718, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__146); - __Pyx_GIVEREF(__pyx_tuple__146); - __pyx_codeobj__147 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__146, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_calcDistanceDelauny, 1718, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__147)) __PYX_ERR(0, 1718, __pyx_L1_error) + __pyx_tuple__145 = PyTuple_Pack(7, __pyx_n_s_coor, __pyx_n_s_ds1, __pyx_n_s_ds2, __pyx_n_s_maxshell1, __pyx_n_s_maxshell2, __pyx_n_s_results, __pyx_n_s_n_particles); if (unlikely(!__pyx_tuple__145)) __PYX_ERR(0, 1693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__145); + __Pyx_GIVEREF(__pyx_tuple__145); + __pyx_codeobj__146 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__145, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDipTenCollectiveVennShellwis, 1693, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__146)) __PYX_ERR(0, 1693, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1732 - * # Deprecated! - * @cython.boundscheck(False) - * def minDistTesselation(double [:] dataset, double [:,:] coor_core, double [:,:] coor_surround, double binwidth = 1): # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1705 + * calc_dip_ten_collective_vennshellwise(&coor[0,0], n_particles, &ds1[0], &ds2[0], maxshell1, maxshell2, &results[0,0,0]) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDistanceDelaunyMindist(double[:,:] coor, double boxlength, int number_of_shells, double bin_width=1.0): * """ - * dataset ... (n_particles_surround) */ - __pyx_tuple__148 = PyTuple_Pack(6, __pyx_n_s_dataset, __pyx_n_s_coor_core, __pyx_n_s_coor_surround, __pyx_n_s_binwidth, __pyx_n_s_n_particle_core, __pyx_n_s_n_particle_surround); if (unlikely(!__pyx_tuple__148)) __PYX_ERR(0, 1732, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__148); - __Pyx_GIVEREF(__pyx_tuple__148); - __pyx_codeobj__149 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__148, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_minDistTesselation, 1732, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__149)) __PYX_ERR(0, 1732, __pyx_L1_error) + __pyx_tuple__147 = PyTuple_Pack(6, __pyx_n_s_coor, __pyx_n_s_boxlength, __pyx_n_s_number_of_shells, __pyx_n_s_bin_width, __pyx_n_s_n_particles, __pyx_n_s_delauny_matrix); if (unlikely(!__pyx_tuple__147)) __PYX_ERR(0, 1705, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__147); + __Pyx_GIVEREF(__pyx_tuple__147); + __pyx_codeobj__148 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__147, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDistanceDelaunyMindist, 1705, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__148)) __PYX_ERR(0, 1705, __pyx_L1_error) - /* "src/helpers/miscellaneous.pyx":1745 + /* "newanalysis/helpers/miscellaneous.pyx":1717 + * return delauny_matrix * - * @cython.boundscheck(False) - * def getPolarizabilityMatrix(double[:,:] coor, double[:,:,:] inv_atom_polarizabilities, double[:,:] matrix): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDistanceDelauny(double[:,:] coor, int number_of_shells, double bin_width=1.0): * """ - * coor ... (n_atoms, 3) */ - __pyx_tuple__150 = PyTuple_Pack(4, __pyx_n_s_coor, __pyx_n_s_inv_atom_polarizabilities, __pyx_n_s_matrix, __pyx_n_s_n_atoms); if (unlikely(!__pyx_tuple__150)) __PYX_ERR(0, 1745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__150); - __Pyx_GIVEREF(__pyx_tuple__150); - __pyx_codeobj__151 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__150, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_miscellaneous_pyx, __pyx_n_s_getPolarizabilityMatrix, 1745, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__151)) __PYX_ERR(0, 1745, __pyx_L1_error) + __pyx_tuple__149 = PyTuple_Pack(5, __pyx_n_s_coor, __pyx_n_s_number_of_shells, __pyx_n_s_bin_width, __pyx_n_s_n_particles, __pyx_n_s_delauny_matrix); if (unlikely(!__pyx_tuple__149)) __PYX_ERR(0, 1717, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__149); + __Pyx_GIVEREF(__pyx_tuple__149); + __pyx_codeobj__150 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__149, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_calcDistanceDelauny, 1717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__150)) __PYX_ERR(0, 1717, __pyx_L1_error) - /* "View.MemoryView":287 - * return self.name + /* "newanalysis/helpers/miscellaneous.pyx":1731 * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistTesselation(double [:] dataset, double [:,:] coor_core, double [:,:] coor_surround, double binwidth = 1): + * """ */ - __pyx_tuple__152 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__152)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__152); - __Pyx_GIVEREF(__pyx_tuple__152); + __pyx_tuple__151 = PyTuple_Pack(6, __pyx_n_s_dataset, __pyx_n_s_coor_core, __pyx_n_s_coor_surround, __pyx_n_s_binwidth, __pyx_n_s_n_particle_core, __pyx_n_s_n_particle_surround); if (unlikely(!__pyx_tuple__151)) __PYX_ERR(0, 1731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__151); + __Pyx_GIVEREF(__pyx_tuple__151); + __pyx_codeobj__152 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_minDistTesselation, 1731, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__152)) __PYX_ERR(0, 1731, __pyx_L1_error) - /* "View.MemoryView":288 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") + /* "newanalysis/helpers/miscellaneous.pyx":1744 + * calc_min_dist_tesselation(&dataset[0], &coor_core[0,0], &coor_surround[0,0], n_particle_core, n_particle_surround, binwidth) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getPolarizabilityMatrix(double[:,:] coor, double[:,:,:] inv_atom_polarizabilities, double[:,:] matrix): + * """ */ - __pyx_tuple__153 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__153)) __PYX_ERR(2, 288, __pyx_L1_error) + __pyx_tuple__153 = PyTuple_Pack(4, __pyx_n_s_coor, __pyx_n_s_inv_atom_polarizabilities, __pyx_n_s_matrix, __pyx_n_s_n_atoms); if (unlikely(!__pyx_tuple__153)) __PYX_ERR(0, 1744, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__153); __Pyx_GIVEREF(__pyx_tuple__153); - - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__154 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__154)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__154); - __Pyx_GIVEREF(__pyx_tuple__154); - - /* "View.MemoryView":292 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_tuple__155 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__155)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__155); - __Pyx_GIVEREF(__pyx_tuple__155); - - /* "View.MemoryView":293 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__156 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__156)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__156); - __Pyx_GIVEREF(__pyx_tuple__156); - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_tuple__157 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__157)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__157); - __Pyx_GIVEREF(__pyx_tuple__157); - __pyx_codeobj__158 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__158)) __PYX_ERR(2, 1, __pyx_L1_error) + __pyx_codeobj__154 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_miscellaneou, __pyx_n_s_getPolarizabilityMatrix, 1744, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__154)) __PYX_ERR(0, 1744, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } +/* #### Code section: init_constants ### */ -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - /* InitThreads.init */ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 -PyEval_InitThreads(); -#endif - -if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error) +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_float__5 = PyFloat_FromDouble(.5); if (unlikely(!__pyx_float__5)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -47071,6 +55298,38 @@ if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_L1_error:; return -1; } +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 0)); else + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* NumpyImportArray.init */ + /* + * Cython has automatically inserted a call to _import_array since + * you didn't include one when you cimported numpy. To disable this + * add the line + * numpy._import_array + */ +#ifdef NPY_FEATURE_VERSION +#ifndef NO_IMPORT_ARRAY +if (unlikely(_import_array() == -1)) { + PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import " + "(auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; " + "use 'numpy._import_array' to disable if you are certain you don't need it)."); +} +#endif +#endif + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_module ### */ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ @@ -47084,6 +55343,7 @@ static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ + __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); generic = Py_None; Py_INCREF(Py_None); strided = Py_None; Py_INCREF(Py_None); indirect = Py_None; Py_INCREF(Py_None); @@ -47111,6 +55371,7 @@ static int __Pyx_modinit_function_export_code(void) { static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -47118,22 +55379,61 @@ static int __Pyx_modinit_type_init_code(void) { /*--- Type init code ---*/ __pyx_vtabptr_array = &__pyx_vtable_array; __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; - if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_array.tp_print = 0; + #if CYTHON_USE_TYPE_SPECS + __pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_array_type)) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_array_type->tp_base->tp_as_buffer && __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." #endif - if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #else __pyx_array_type = &__pyx_type___pyx_array; - if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_MemviewEnum.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_array_type->tp_print = 0; + #endif + if (__Pyx_SetVtable(__pyx_array_type, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_MemviewEnum_type)) __PYX_ERR(1, 302, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #else __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_MemviewEnum_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_MemviewEnum_type->tp_dictoffset && __pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_MemviewEnum_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; @@ -47142,34 +55442,85 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; - if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryview.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_memoryview_type)) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #else __pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryview_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryview_type->tp_dictoffset && __pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryview_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_memoryview_type, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; - __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; - if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryviewslice.tp_print = 0; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_memoryviewslice_type)) __PYX_ERR(1, 952, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #else + __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryviewslice_type->tp_base = __pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr; + #if PY_MAJOR_VERSION < 3 + __pyx_memoryviewslice_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryviewslice_type->tp_dictoffset && __pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryviewslice_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + if (__Pyx_SetVtable(__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } @@ -47184,62 +55535,33 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_2(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyTypeObject), + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), #else - sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyHeapTypeObject), + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyHeapTypeObject), #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT(PyArray_Descr), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 199, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 222, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayMultiIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 226, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error) - __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 770, __pyx_L1_error) - __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 772, __pyx_L1_error) - __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 774, __pyx_L1_error) - __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 776, __pyx_L1_error) - __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 778, __pyx_L1_error) - __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 780, __pyx_L1_error) - __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 782, __pyx_L1_error) - __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 784, __pyx_L1_error) - __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 786, __pyx_L1_error) - __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 788, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT(PyUFuncObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 826, __pyx_L1_error) + __pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArray_Descr),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 202, __pyx_L1_error) + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 225, __pyx_L1_error) + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayMultiIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 229, __pyx_L1_error) + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 238, __pyx_L1_error) + __pyx_ptype_5numpy_generic = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 809, __pyx_L1_error) + __pyx_ptype_5numpy_number = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 811, __pyx_L1_error) + __pyx_ptype_5numpy_integer = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 813, __pyx_L1_error) + __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 815, __pyx_L1_error) + __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 817, __pyx_L1_error) + __pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 819, __pyx_L1_error) + __pyx_ptype_5numpy_floating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 821, __pyx_L1_error) + __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 823, __pyx_L1_error) + __pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_ptype_5numpy_character = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyUFuncObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 865, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -47266,6 +55588,55 @@ static int __Pyx_modinit_function_import_code(void) { } +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_miscellaneous(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_miscellaneous}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "miscellaneous", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #elif PY_MAJOR_VERSION < 3 @@ -47316,12 +55687,21 @@ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { } return 0; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else result = PyDict_SetItemString(moddict, to_name, value); +#endif } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -47331,8 +55711,9 @@ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject } return result; } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) @@ -47342,8 +55723,12 @@ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNU module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; +#endif if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; @@ -47359,9 +55744,18 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_miscellaneous(PyObject *__pyx_pyin #endif #endif { + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - static PyThread_type_lock __pyx_t_3[8]; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + static PyThread_type_lock __pyx_t_8[8]; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -47375,6 +55769,35 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_miscellaneous(PyObject *__pyx_pyin #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("miscellaneous", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to miscellaneous pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { @@ -47393,48 +55816,31 @@ if (!__Pyx_RefNanny) { __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("miscellaneous", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -47446,1050 +55852,1718 @@ if (!__Pyx_RefNanny) { { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "newanalysis.miscellaneous")) { - if (unlikely(PyDict_SetItemString(modules, "newanalysis.miscellaneous", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((PyDict_SetItemString(modules, "newanalysis.miscellaneous", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_version_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__19, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + goto __pyx_L8; + } + + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":104 + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None + */ + /*except:*/ { + __Pyx_AddTraceback("View.MemoryView", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(1, 104, __pyx_L4_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_7); + + /* "View.MemoryView":106 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * + */ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L3_exception_handled; + } + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + __pyx_L4_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":242 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":243 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L16_try_end; + __pyx_L11_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":244 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L12_exception_handled; + } + __pyx_L12_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L16_try_end:; + } + + /* "View.MemoryView":309 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":323 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), + */ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":324 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), + */ + __pyx_t_8[0] = PyThread_allocate_lock(); + __pyx_t_8[1] = PyThread_allocate_lock(); + __pyx_t_8[2] = PyThread_allocate_lock(); + __pyx_t_8[3] = PyThread_allocate_lock(); + __pyx_t_8[4] = PyThread_allocate_lock(); + __pyx_t_8[5] = PyThread_allocate_lock(); + __pyx_t_8[6] = PyThread_allocate_lock(); + __pyx_t_8[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_8, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":983 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); + + /* "View.MemoryView":984 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); + + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L22_try_end; + __pyx_L17_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":985 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L18_exception_handled; + } + __pyx_L18_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L22_try_end:; + } + + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 989, __pyx_L23_error) + if (__pyx_t_6) { + + /* "View.MemoryView":993 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_memoryviewslice_type)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":994 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_array_type)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + } + + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L28_try_end; + __pyx_L23_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":995 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L24_exception_handled; } + __pyx_L24_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L28_try_end:; } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /* "src/helpers/miscellaneous.pyx":7 + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":7 * #TODO: Maybe sort these functions into thematically fitting function libraries * * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_7) < 0) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":69 + /* "newanalysis/helpers/miscellaneous.pyx":68 + * void dipten_double_loop2_(double * coor_1, double * coor_2, double * dipt_t, int n_particles_1, int n_particles_2, int only_different_nuclei) * - * @cython.boundscheck(False) - * def testParallelism(int n_iterations): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def testParallelism(int n_iterations): * test_parallelism(n_iterations) - * return */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_1testParallelism, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_testParallelism, __pyx_t_1) < 0) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_1testParallelism, 0, __pyx_n_s_testParallelism, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_testParallelism, __pyx_t_7) < 0) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":74 + /* "newanalysis/helpers/miscellaneous.pyx":74 * * @cython.boundscheck(False) * def countHBonds(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist, double cos_angle=-0.95): # <<<<<<<<<<<<<< * # this function is designed only for water hydrogen bonds! - * cdef int sites_per_res = coor_surr.shape[0] / nres_surr + * cdef int sites_per_res = coor_surr.shape[0] // nres_surr */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_3countHBonds, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_countHBonds, __pyx_t_1) < 0) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = PyFloat_FromDouble(((double)-0.95)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* "src/helpers/miscellaneous.pyx":114 + /* "newanalysis/helpers/miscellaneous.pyx":73 + * return * - * @cython.boundscheck(False) - * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def countHBonds(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist, double cos_angle=-0.95): + * # this function is designed only for water hydrogen bonds! + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7)) __PYX_ERR(0, 73, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_3countHBonds, 0, __pyx_n_s_countHBonds, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_countHBonds, __pyx_t_7) < 0) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":113 + * return np.asarray(hbond) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def structureFactorDipTen(double [:,:] coors, double [:,:] histogram, int bin_dist, int segs, double boxlength): * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_5structureFactorDipTen, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_structureFactorDipTen, __pyx_t_1) < 0) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_5structureFactorDipTen, 0, __pyx_n_s_structureFactorDipTen, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_structureFactorDipTen, __pyx_t_7) < 0) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":168 + /* "newanalysis/helpers/miscellaneous.pyx":167 * - * @cython.boundscheck(False) - * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def structureFactorCharge(double [:,:] coors, double [:] charges, double [:,:] histogram, int bin_dist, int segs, double boxlength): * cdef int n_particles = coors.shape[0] - * cdef int pair_1_par_1 = 0 */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_7structureFactorCharge, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_structureFactorCharge, __pyx_t_1) < 0) __PYX_ERR(0, 168, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_7structureFactorCharge, 0, __pyx_n_s_structureFactorCharge, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_structureFactorCharge, __pyx_t_7) < 0) __PYX_ERR(0, 167, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":226 + /* "newanalysis/helpers/miscellaneous.pyx":225 + * * #Version1: Just one distance per targeted (water) molecule - * @cython.boundscheck(False) - * def accumulateShellwiseGFunction(double [:,:] aufpunkte, double [:,:] coor, char [:] dataset, double[:,:] histogram, double[:] norm, int maxshell, double histo_min, double histo_max, double boxlength): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def accumulateShellwiseGFunction(double [:,:] aufpunkte, double [:,:] coor, char [:] dataset, double[:,:] histogram, double[:] norm, int maxshell, double histo_min, double histo_max, double boxlength): * ''' - * aufpunkte ... (n_aufpunkte, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_9accumulateShellwiseGFunction, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_accumulateShellwiseGFunction, __pyx_t_1) < 0) __PYX_ERR(0, 226, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_9accumulateShellwiseGFunction, 0, __pyx_n_s_accumulateShellwiseGFunction, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_accumulateShellwiseGFunction, __pyx_t_7) < 0) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":242 + /* "newanalysis/helpers/miscellaneous.pyx":241 + * calc_accumulate_shellwise_g_function(&aufpunkte[0,0], &coor[0,0], &dataset[0], &histogram[0,0], &norm[0], n_aufpunkte, n_particles, number_of_datapoints, maxshell, histo_min, histo_max, boxlength) * - * @cython.boundscheck(False) - * def accumulateNMShellwiseGFunction(double [:,:] coor1, double [:,:] coor2, int[:,:] dataset, double[:,:] histogram, int particle_first, int n_particles, int max_distance, int segments_per_angstroem): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def accumulateNMShellwiseGFunction(double [:,:] coor1, double [:,:] coor2, int[:,:] dataset, double[:,:] histogram, int particle_first, int n_particles, int max_distance, int segments_per_angstroem): * cdef int particle1, particle2, point1, point2, shell, bin_dist - * cdef int maxshell = histogram.shape[1] */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_11accumulateNMShellwiseGFunction, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_accumulateNMShellwiseGFunction, __pyx_t_1) < 0) __PYX_ERR(0, 242, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_11accumulateNMShellwiseGFunction, 0, __pyx_n_s_accumulateNMShellwiseGFunction, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_accumulateNMShellwiseGFunction, __pyx_t_7) < 0) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":260 + /* "newanalysis/helpers/miscellaneous.pyx":260 * * * def sumUpByShell(double [:,:,:] timeseries, double [:,:,:] timeseries_shellwise, char[:,:] ds): # <<<<<<<<<<<<<< * """ * timeseries ... (n_frames, n_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_13sumUpByShell, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sumUpByShell, __pyx_t_1) < 0) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_13sumUpByShell, 0, __pyx_n_s_sumUpByShell, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sumUpByShell, __pyx_t_7) < 0) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":281 + /* "newanalysis/helpers/miscellaneous.pyx":281 * timeseries_shellwise[shell, frame, 2] += timeseries[frame, particle, 2] * * def countVennShellOccupation(double[:,:] data, int n_particles, char[:] ds1, char[:] ds2): # <<<<<<<<<<<<<< * ''' * data ... (n_shells1, n_shells2) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_15countVennShellOccupation, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_countVennShellOccupation, __pyx_t_1) < 0) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_15countVennShellOccupation, 0, __pyx_n_s_countVennShellOccupation, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_countVennShellOccupation, __pyx_t_7) < 0) __PYX_ERR(0, 281, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":299 + /* "newanalysis/helpers/miscellaneous.pyx":299 * data[shell1, shell2] += 1 * * def countMultiShell(double[:,:] data, char[:] ds1, char[:] ds2, char[:] ds3, char[:] ds4, char[:] ds5): # <<<<<<<<<<<<<< * ''' * data ... (nshells, max_cardinality {==5}) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_17countMultiShell, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_countMultiShell, __pyx_t_1) < 0) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_17countMultiShell, 0, __pyx_n_s_countMultiShell, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_countMultiShell, __pyx_t_7) < 0) __PYX_ERR(0, 299, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":353 + /* "newanalysis/helpers/miscellaneous.pyx":352 + * ''' * - * @cython.boundscheck(False) - * def atomicIndDip(double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicIndDip(double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): * """ - * coors ... (N_all, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_19atomicIndDip, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_atomicIndDip, __pyx_t_1) < 0) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_19atomicIndDip, 0, __pyx_n_s_atomicIndDip, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_atomicIndDip, __pyx_t_7) < 0) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":427 + /* "newanalysis/helpers/miscellaneous.pyx":426 + * """ * - * @cython.boundscheck(False) - * def atomicIndDipPerAtom(int idx, double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def atomicIndDipPerAtom(int idx, double [:,:] coors, double [:] charges, double [:] alpha, double [:,:] coors_ind, double [:,:] prev_atomic_dipoles, double [:,:] atomic_dipoles, double boxlength): * """ - * coors ... (N_all, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_21atomicIndDipPerAtom, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_atomicIndDipPerAtom, __pyx_t_1) < 0) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_21atomicIndDipPerAtom, 0, __pyx_n_s_atomicIndDipPerAtom, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_atomicIndDipPerAtom, __pyx_t_7) < 0) __PYX_ERR(0, 426, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":441 + /* "newanalysis/helpers/miscellaneous.pyx":441 * atomic_ind_dip_per_atom(idx, &coors[0,0], &charges[0], &alpha[0], &coors_ind[0,0], &prev_atomic_dipoles[0,0], &atomic_dipoles[0,0], n_particles_all, n_particles_ind, boxlength) * * def kronecker(int a, int b) -> int: # <<<<<<<<<<<<<< * if (a == b): return 1 * return 0 */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_23kronecker, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_kronecker, __pyx_t_1) < 0) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, __pyx_n_s_int) < 0) __PYX_ERR(0, 441, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_23kronecker, 0, __pyx_n_s_kronecker, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_kronecker, __pyx_t_4) < 0) __PYX_ERR(0, 441, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":447 + /* "newanalysis/helpers/miscellaneous.pyx":447 * * @cython.boundscheck(False) * def deriveIndDip(double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): # <<<<<<<<<<<<<< * """ * coors_ind ... (N_ind, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_25deriveIndDip, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_deriveIndDip, __pyx_t_1) < 0) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "newanalysis/helpers/miscellaneous.pyx":446 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def deriveIndDip(double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): + * """ + */ + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4)) __PYX_ERR(0, 446, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_25deriveIndDip, 0, __pyx_n_s_deriveIndDip, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_deriveIndDip, __pyx_t_4) < 0) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":511 + /* "newanalysis/helpers/miscellaneous.pyx":511 * * @cython.boundscheck(False) * def deriveIndDipPerAtom(int idx, double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): # <<<<<<<<<<<<<< * """ * coors_ind ... (N_ind, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_27deriveIndDipPerAtom, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_deriveIndDipPerAtom, __pyx_t_1) < 0) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "newanalysis/helpers/miscellaneous.pyx":510 + * ''' + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def deriveIndDipPerAtom(int idx, double [:,:] coors_ind, double [:,:] vel_ind, double [:,:] atomic_dipoles, double [:,:] derived_atomic_dipoles, double boxlength, int new = 0): + * """ + */ + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 510, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4)) __PYX_ERR(0, 510, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_27deriveIndDipPerAtom, 0, __pyx_n_s_deriveIndDipPerAtom, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 510, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_deriveIndDipPerAtom, __pyx_t_4) < 0) __PYX_ERR(0, 510, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":525 + /* "newanalysis/helpers/miscellaneous.pyx":524 + * * ###BEGIN DANIEL NOE HELPERS - * @cython.boundscheck(False) - * def norm(double[:] x): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def norm(double[:] x): * cdef double res = np.dot(x,x)**.5 - * return res */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_29norm, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_norm, __pyx_t_1) < 0) __PYX_ERR(0, 525, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_29norm, 0, __pyx_n_s_norm, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 524, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_norm, __pyx_t_4) < 0) __PYX_ERR(0, 524, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":530 + /* "newanalysis/helpers/miscellaneous.pyx":529 + * return res * - * @cython.boundscheck(False) - * def unfold(double[:] ref, double[:] new, double[:] run, double boxl): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfold(double[:] ref, double[:] new, double[:] run, double boxl): * cdef int i - * cdef double D */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_31unfold, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_unfold, __pyx_t_1) < 0) __PYX_ERR(0, 530, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_31unfold, 0, __pyx_n_s_unfold, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_unfold, __pyx_t_4) < 0) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":543 + /* "newanalysis/helpers/miscellaneous.pyx":542 * - * @cython.boundscheck(False) - * def min_dist(double[:] res1, double[:] res2, double boxl): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def min_dist(double[:] res1, double[:] res2, double boxl): * cdef int i - * cdef double D */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_33min_dist, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_min_dist, __pyx_t_1) < 0) __PYX_ERR(0, 543, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_33min_dist, 0, __pyx_n_s_min_dist, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_min_dist, __pyx_t_4) < 0) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":560 + /* "newanalysis/helpers/miscellaneous.pyx":559 * - * @cython.boundscheck(False) - * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def dipTen(double[:] coo1, double [:] coo2): #returns dipole dipole tensor for a distance vector between coo1 and coo2 * cdef double [:] rv = np.zeros(3) #distance vector - * rv[0] = coo2[0] - coo1[0] */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_35dipTen, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipTen, __pyx_t_1) < 0) __PYX_ERR(0, 560, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_35dipTen, 0, __pyx_n_s_dipTen, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_dipTen, __pyx_t_4) < 0) __PYX_ERR(0, 559, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":579 + /* "newanalysis/helpers/miscellaneous.pyx":579 * * @cython.boundscheck(False) * class selfobject: # <<<<<<<<<<<<<< * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? * self.p = p */ - __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_selfobject, __pyx_n_s_selfobject, (PyObject *) NULL, __pyx_n_s_newanalysis_miscellaneous, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_selfobject, __pyx_n_s_selfobject, (PyObject *) NULL, __pyx_n_s_newanalysis_miscellaneous, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); - /* "src/helpers/miscellaneous.pyx":580 + /* "newanalysis/helpers/miscellaneous.pyx":580 * @cython.boundscheck(False) * class selfobject: * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? # <<<<<<<<<<<<<< * self.p = p * self.apr_emim_h = apr_emim_h */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_10selfobject_1__init__, 0, __pyx_n_s_selfobject___init, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 580, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_10selfobject_1__init__, 0, __pyx_n_s_selfobject___init, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 580, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 580, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":579 + /* "newanalysis/helpers/miscellaneous.pyx":579 * * @cython.boundscheck(False) * class selfobject: # <<<<<<<<<<<<<< * def __init__(self, int p, double [:,:] p_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #TODO: Bin-handling for intra-molecular? * self.p = p */ - __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_selfobject, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_selfobject, __pyx_t_2) < 0) __PYX_ERR(0, 579, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_Py3ClassCreate(((PyObject*)&PyType_Type), __pyx_n_s_selfobject, __pyx_empty_tuple, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_selfobject, __pyx_t_7) < 0) __PYX_ERR(0, 579, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":639 + /* "newanalysis/helpers/miscellaneous.pyx":639 * * @cython.boundscheck(False) * class pairobject: # <<<<<<<<<<<<<< * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 * self.p1 = p1 */ - __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_pairobject, __pyx_n_s_pairobject, (PyObject *) NULL, __pyx_n_s_newanalysis_miscellaneous, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_pairobject, __pyx_n_s_pairobject, (PyObject *) NULL, __pyx_n_s_newanalysis_miscellaneous, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); - /* "src/helpers/miscellaneous.pyx":640 + /* "newanalysis/helpers/miscellaneous.pyx":640 * @cython.boundscheck(False) * class pairobject: * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 # <<<<<<<<<<<<<< * self.p1 = p1 * self.p2 = p2 */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_10pairobject_1__init__, 0, __pyx_n_s_pairobject___init, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_10pairobject_1__init__, 0, __pyx_n_s_pairobject___init, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":639 + /* "newanalysis/helpers/miscellaneous.pyx":639 * * @cython.boundscheck(False) * class pairobject: # <<<<<<<<<<<<<< * def __init__(self, int p1, int p2, double [:,:] p1_coor, double [:,:] p2_coor, int apr_emim_h, int n_pairs_h, int [:] emim_h): #rename: p1 -> resnum1; p2 -> resnum2 * self.p1 = p1 */ - __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_pairobject, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pairobject, __pyx_t_2) < 0) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_Py3ClassCreate(((PyObject*)&PyType_Type), __pyx_n_s_pairobject, __pyx_empty_tuple, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pairobject, __pyx_t_7) < 0) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":711 + /* "newanalysis/helpers/miscellaneous.pyx":711 * * @cython.boundscheck(False) * class noe_task: # <<<<<<<<<<<<<< * @cython.boundscheck(False) * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): */ - __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_noe_task, __pyx_n_s_noe_task, (PyObject *) NULL, __pyx_n_s_newanalysis_miscellaneous, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_noe_task, __pyx_n_s_noe_task, (PyObject *) NULL, __pyx_n_s_newanalysis_miscellaneous, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); - /* "src/helpers/miscellaneous.pyx":713 + /* "newanalysis/helpers/miscellaneous.pyx":712 + * @cython.boundscheck(False) * class noe_task: - * @cython.boundscheck(False) - * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): * self.apr_emim_h = apr_emim_h - * self.emim_h = emim_h */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_8noe_task_1__init__, 0, __pyx_n_s_noe_task___init, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 713, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_8noe_task_1__init__, 0, __pyx_n_s_noe_task___init, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 712, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":749 + /* "newanalysis/helpers/miscellaneous.pyx":748 * - * @cython.boundscheck(False) - * def pairiter(self, double [:,:,:] run): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def pairiter(self, double [:,:,:] run): * cdef double [:,:] cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #rename: cl->correlationlist - * #cl = np.zeros((self.n_pairs_h, self.max_distance), dtype='float64') #ROLLBACK: ERASE THIS, UNCOMMENT BELOW */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_8noe_task_3pairiter, 0, __pyx_n_s_noe_task_pairiter, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_pairiter, __pyx_t_2) < 0) __PYX_ERR(0, 749, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_8noe_task_3pairiter, 0, __pyx_n_s_noe_task_pairiter, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_pairiter, __pyx_t_7) < 0) __PYX_ERR(0, 748, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":711 + /* "newanalysis/helpers/miscellaneous.pyx":711 * * @cython.boundscheck(False) * class noe_task: # <<<<<<<<<<<<<< * @cython.boundscheck(False) * def __init__(self, int apr_emim_h, int [:] emim_h, int n_pairs_h, int n_self_pairs_h, int max_distance, int n_res_emim, int apr_pair, double [:,:,:] coors): */ - __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_noe_task, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_noe_task, __pyx_t_2) < 0) __PYX_ERR(0, 711, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_Py3ClassCreate(((PyObject*)&PyType_Type), __pyx_n_s_noe_task, __pyx_empty_tuple, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_noe_task, __pyx_t_7) < 0) __PYX_ERR(0, 711, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":810 + /* "newanalysis/helpers/miscellaneous.pyx":809 + * ###END DANIEL NOE HELPERS * - * @cython.boundscheck(False) - * def getBestIndex(double [:] aufpunkt, double [:,:] coor): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBestIndex(double [:] aufpunkt, double [:,:] coor): * ''' - * getBestIndex(point, coor) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_37getBestIndex, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getBestIndex, __pyx_t_1) < 0) __PYX_ERR(0, 810, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_37getBestIndex, 0, __pyx_n_s_getBestIndex, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 809, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_getBestIndex, __pyx_t_4) < 0) __PYX_ERR(0, 809, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":824 + /* "newanalysis/helpers/miscellaneous.pyx":823 + * return best_index * - * @cython.boundscheck(False) - * def getBestIndices(double [:] aufpunkt, double [:,:] coor, double [:,:] dip, int count): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBestIndices(double [:] aufpunkt, double [:,:] coor, double [:,:] dip, int count): * ''' - * coor ... (n_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_39getBestIndices, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getBestIndices, __pyx_t_1) < 0) __PYX_ERR(0, 824, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_39getBestIndices, 0, __pyx_n_s_getBestIndices, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_getBestIndices, __pyx_t_4) < 0) __PYX_ERR(0, 823, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":853 + /* "newanalysis/helpers/miscellaneous.pyx":853 * * @cython.boundscheck(False) * def writeMrHistogram(double [:,:] coor, double [:,:] dip, double [:] aufpunkt, double [:] antagonist, double [:] histogram, double max_distance, int segments_per_angstroem, int order=0): # <<<<<<<<<<<<<< * ''' * coor ... (number_of_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_41writeMrHistogram, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_writeMrHistogram, __pyx_t_1) < 0) __PYX_ERR(0, 853, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 853, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "newanalysis/helpers/miscellaneous.pyx":852 + * return coor_res, dip_res + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeMrHistogram(double [:,:] coor, double [:,:] dip, double [:] aufpunkt, double [:] antagonist, double [:] histogram, double max_distance, int segments_per_angstroem, int order=0): + * ''' + */ + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 852, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4)) __PYX_ERR(0, 852, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_41writeMrHistogram, 0, __pyx_n_s_writeMrHistogram, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 852, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_writeMrHistogram, __pyx_t_4) < 0) __PYX_ERR(0, 852, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":866 + /* "newanalysis/helpers/miscellaneous.pyx":866 * * @cython.boundscheck(False) * def writeKirkwoodHistogram(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:] histogram, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< * #TODO documentation * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_43writeKirkwoodHistogram, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 866, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_writeKirkwoodHistogram, __pyx_t_1) < 0) __PYX_ERR(0, 866, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 866, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "newanalysis/helpers/miscellaneous.pyx":865 + * write_Mr_diagram(&coor[0,0], &dip[0,0], number_of_particles, &aufpunkt[0], &antagonist[0], &histogram[0], max_distance, segments_per_angstroem, order) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeKirkwoodHistogram(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:] histogram, double max_distance, int segments_per_angstroem, int order = 1): + * #TODO documentation + */ + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 865, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4)) __PYX_ERR(0, 865, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_43writeKirkwoodHistogram, 0, __pyx_n_s_writeKirkwoodHistogram, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 865, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_writeKirkwoodHistogram, __pyx_t_4) < 0) __PYX_ERR(0, 865, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":872 + /* "newanalysis/helpers/miscellaneous.pyx":872 * write_Kirkwood_diagram(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0], max_distance, segments_per_angstroem, order) * * def writeKirkwoodHistogramShellwise(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< * ''' * aufpunkt ... (3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_45writeKirkwoodHistogramShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 872, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_writeKirkwoodHistogramShellwise, __pyx_t_1) < 0) __PYX_ERR(0, 872, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 872, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 872, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4)) __PYX_ERR(0, 872, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_45writeKirkwoodHistogramShellwise, 0, __pyx_n_s_writeKirkwoodHistogramShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 872, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_writeKirkwoodHistogramShellwise, __pyx_t_4) < 0) __PYX_ERR(0, 872, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":895 + /* "newanalysis/helpers/miscellaneous.pyx":895 * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) * * def writeKirkwoodHistogramShellwise(double [:,:] aufpunkte, double [:,:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double [:] norm, char [:] dataset, double max_distance, int segments_per_angstroem, int order = 1): # <<<<<<<<<<<<<< * ''' * aufpunkt ... (number_aufpunkte, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_47writeKirkwoodHistogramShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 895, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_writeKirkwoodHistogramShellwise, __pyx_t_1) < 0) __PYX_ERR(0, 895, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 895, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 895, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4)) __PYX_ERR(0, 895, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_47writeKirkwoodHistogramShellwise, 0, __pyx_n_s_writeKirkwoodHistogramShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 895, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_writeKirkwoodHistogramShellwise, __pyx_t_4) < 0) __PYX_ERR(0, 895, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":926 + /* "newanalysis/helpers/miscellaneous.pyx":926 * * @cython.boundscheck(False) * def writeKirkwoodHistogram2D(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double max_distance, int segments_per_angstroem, int segments_per_pi, int order = 1): # <<<<<<<<<<<<<< * #TODO documentation * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_49writeKirkwoodHistogram2D, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 926, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_writeKirkwoodHistogram2D, __pyx_t_1) < 0) __PYX_ERR(0, 926, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 926, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "newanalysis/helpers/miscellaneous.pyx":925 + * write_Kirkwood_diagram_shellwise(&aufpunkt[0], &aufpunkt_dipol[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], &dataset[0], maxshell, max_distance, segments_per_angstroem, order) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def writeKirkwoodHistogram2D(double [:] aufpunkt, double[:] aufpunkt_dipole, double [:,:] coor, double [:,:] dip, double [:,:] histogram, double max_distance, int segments_per_angstroem, int segments_per_pi, int order = 1): + * #TODO documentation + */ + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4)) __PYX_ERR(0, 925, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_49writeKirkwoodHistogram2D, 0, __pyx_n_s_writeKirkwoodHistogram2D, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_writeKirkwoodHistogram2D, __pyx_t_4) < 0) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":933 + /* "newanalysis/helpers/miscellaneous.pyx":933 * * @cython.boundscheck(False) * def getBondTable(double [:,:] coor, int [:,:] bond_table, int cutoff = 3): # <<<<<<<<<<<<<< * ''' * coor ... (n_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_51getBondTable, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getBondTable, __pyx_t_1) < 0) __PYX_ERR(0, 933, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 933, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); - /* "src/helpers/miscellaneous.pyx":955 + /* "newanalysis/helpers/miscellaneous.pyx":932 + * write_Kirkwood_diagram_2D(&aufpunkt[0], &aufpunkt_dipole[0], &coor[0,0], &dip[0,0], particles, &histogram[0,0], max_distance, segments_per_angstroem, segments_per_pi, order) * - * @cython.boundscheck(False) - * def sumVennMDCageSingle(double [:,:,:,:] mdcage_timeseries, double [:,:] dipoles, char [:] dataset1, char [:] dataset2, int maxshell1, int maxshell2, int frame): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getBondTable(double [:,:] coor, int [:,:] bond_table, int cutoff = 3): + * ''' + */ + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4)) __PYX_ERR(0, 932, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_51getBondTable, 0, __pyx_n_s_getBondTable, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__88)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_getBondTable, __pyx_t_4) < 0) __PYX_ERR(0, 932, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "newanalysis/helpers/miscellaneous.pyx":954 + * # calc_sum_Venn_MD_Cage_Single(&mdcage_timeseries[0,0,0], &dipoles[0,0], n_particles, &dataset1[0], &dataset2[0], maxshell1, maxshell2) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumVennMDCageSingle(double [:,:,:,:] mdcage_timeseries, double [:,:] dipoles, char [:] dataset1, char [:] dataset2, int maxshell1, int maxshell2, int frame): * - * cdef int w, shell1, shell2, i, nres_wat = dipoles.shape[0] */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_53sumVennMDCageSingle, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 955, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sumVennMDCageSingle, __pyx_t_1) < 0) __PYX_ERR(0, 955, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_53sumVennMDCageSingle, 0, __pyx_n_s_sumVennMDCageSingle, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__90)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 954, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sumVennMDCageSingle, __pyx_t_4) < 0) __PYX_ERR(0, 954, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":973 + /* "newanalysis/helpers/miscellaneous.pyx":972 + * mdcage_timeseries[shell1, shell2, frame, i] += dipoles[w, i] * - * @cython.boundscheck(False) - * def sumMultiMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, char [:] ds1, char [:] ds2, char [:] ds3, char [:] ds4, char [:] ds5, int maxshell, int frame): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sumMultiMDCageSingle(double [:,:,:] mdcage_ts, double [:,:] dip_wat, char [:] ds1, char [:] ds2, char [:] ds3, char [:] ds4, char [:] ds5, int maxshell, int frame): * - * cdef int w, shell, i, nres_wat = dip_wat.shape[0] */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_55sumMultiMDCageSingle, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 973, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sumMultiMDCageSingle, __pyx_t_1) < 0) __PYX_ERR(0, 973, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_55sumMultiMDCageSingle, 0, __pyx_n_s_sumMultiMDCageSingle, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__92)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sumMultiMDCageSingle, __pyx_t_4) < 0) __PYX_ERR(0, 972, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":995 + /* "newanalysis/helpers/miscellaneous.pyx":994 + * mdcage_ts[maxshell,frame,i] += dip_wat[w,i] * - * @cython.boundscheck(False) - * def multiVecShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, long nshells1, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def multiVecShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, long nshells1, long maxdt, long startingpoints): * """ - * rotTs ... (nmol, n (time length), 3D) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_57multiVecShellCorrelate, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiVecShellCorrelate, __pyx_t_1) < 0) __PYX_ERR(0, 995, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_57multiVecShellCorrelate, 0, __pyx_n_s_multiVecShellCorrelate, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__94)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 994, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiVecShellCorrelate, __pyx_t_4) < 0) __PYX_ERR(0, 994, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":1052 + /* "newanalysis/helpers/miscellaneous.pyx":1051 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * - * @cython.boundscheck(False) - * def multiVecVennShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def multiVecVennShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): * """ - * rotTs ... (nmol, n (time length), 3D) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_59multiVecVennShellCorrelate, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1052, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiVecVennShellCorrelate, __pyx_t_1) < 0) __PYX_ERR(0, 1052, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_59multiVecVennShellCorrelate, 0, __pyx_n_s_multiVecVennShellCorrelate, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__96)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiVecVennShellCorrelate, __pyx_t_4) < 0) __PYX_ERR(0, 1051, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":1112 + /* "newanalysis/helpers/miscellaneous.pyx":1111 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * - * @cython.boundscheck(False) - * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, long nshells1, long nshells2, long maxdt, long startingpoints): * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_61rotationMatrixVennShellCorrelate, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixVennShellCorrelate, __pyx_t_1) < 0) __PYX_ERR(0, 1112, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_61rotationMatrixVennShellCorrelate, 0, __pyx_n_s_rotationMatrixVennShellCorrelate, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__98)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixVennShellCorrelate, __pyx_t_4) < 0) __PYX_ERR(0, 1111, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":1200 + /* "newanalysis/helpers/miscellaneous.pyx":1199 * - * @cython.boundscheck(False) - * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int [:,:] ds2, int [:,:] ds3, int [:,:] ds4, int [:,:] ds5, long nshells, long maxdt, long startingpoints): * cdef long nmol = len(rotTs) # number of molecules - * cdef long n = len(rotTs[0]) # number of time steps */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_63rotationMatrixMultiShellCorrelate, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixMultiShellCorrelat, __pyx_t_1) < 0) __PYX_ERR(0, 1200, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_63rotationMatrixMultiShellCorrelate, 0, __pyx_n_s_rotationMatrixMultiShellCorrelat, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__100)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotationMatrixMultiShellCorrelat, __pyx_t_4) < 0) __PYX_ERR(0, 1199, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":1292 + /* "newanalysis/helpers/miscellaneous.pyx":1291 + * return corr,selfcorr,crosscorr,ctr,selfctr,crossctr * - * @cython.boundscheck(False) - * def collectiveDipolesCutoff(double [:,:] coor, double[:,:] dipoles, double[:] aufpunkt, double[:] dip_inside, double[:] dip_outside, double cutoff): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def collectiveDipolesCutoff(double [:,:] coor, double[:,:] dipoles, double[:] aufpunkt, double[:] dip_inside, double[:] dip_outside, double cutoff): * #TODO documentation - * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_65collectiveDipolesCutoff, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_collectiveDipolesCutoff, __pyx_t_1) < 0) __PYX_ERR(0, 1292, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_65collectiveDipolesCutoff, 0, __pyx_n_s_collectiveDipolesCutoff, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_collectiveDipolesCutoff, __pyx_t_4) < 0) __PYX_ERR(0, 1291, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":1300 + /* "newanalysis/helpers/miscellaneous.pyx":1299 + * * #TODO: As a C++ function? - * @cython.boundscheck(False) - * def shellHistograms(double [:,:] histograms, double [:] aufpunkt, double [:,:] coors, char [:] ds, int maxshell, double max_distance, int segs_per_angstroem): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def shellHistograms(double [:,:] histograms, double [:] aufpunkt, double [:,:] coors, char [:] ds, int maxshell, double max_distance, int segs_per_angstroem): * #TODO documentation - * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_67shellHistograms, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_shellHistograms, __pyx_t_1) < 0) __PYX_ERR(0, 1300, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_67shellHistograms, 0, __pyx_n_s_shellHistograms, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__104)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_shellHistograms, __pyx_t_4) < 0) __PYX_ERR(0, 1299, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":1345 + /* "newanalysis/helpers/miscellaneous.pyx":1345 * * @cython.boundscheck(False) * def correlateSingleVector(double[:,:] timeseries, double[:] result, int order = 1): # <<<<<<<<<<<<<< * """ * Correlate the timeseries of a single vector (e.g. collective dipole, one single particle, etc...) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_69correlateSingleVector, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1345, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateSingleVector, __pyx_t_1) < 0) __PYX_ERR(0, 1345, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); - /* "src/helpers/miscellaneous.pyx":1357 + /* "newanalysis/helpers/miscellaneous.pyx":1344 * - * @cython.boundscheck(False) - * def crossCorrelateSingleVector(double[:,:] timeseries1, double[:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): # <<<<<<<<<<<<<< - * """ - * Correlate the timeseries of two different single vectors (e.g. collective dipole, one single particle, etc...) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_71crossCorrelateSingleVector, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_crossCorrelateSingleVector, __pyx_t_1) < 0) __PYX_ERR(0, 1357, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/helpers/miscellaneous.pyx":1374 * - * @cython.boundscheck(False) - * def correlateMultiVector(double[:,:,:] timeseries, double[:] result, int order = 1): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleVector(double[:,:] timeseries, double[:] result, int order = 1): * """ - * Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_73correlateMultiVector, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateMultiVector, __pyx_t_1) < 0) __PYX_ERR(0, 1374, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1344, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4)) __PYX_ERR(0, 1344, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_69correlateSingleVector, 0, __pyx_n_s_correlateSingleVector, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__106)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1344, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateSingleVector, __pyx_t_4) < 0) __PYX_ERR(0, 1344, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/miscellaneous.pyx":1387 + /* "newanalysis/helpers/miscellaneous.pyx":1357 * * @cython.boundscheck(False) - * def correlateMultiVectorShellwise(double [:,:,:] timeseries, double [:,:] dataset, double [:,:] result, int maxshell, int order = 1): # <<<<<<<<<<<<<< + * def crossCorrelateSingleVector(double[:,:] timeseries1, double[:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): # <<<<<<<<<<<<<< * """ - * timeseries ... (number_of_particles, number_of_frames, 3) + * Correlate the timeseries of two different single vectors (e.g. collective dipole, one single particle, etc...) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_75correlateMultiVectorShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1387, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateMultiVectorShellwise, __pyx_t_1) < 0) __PYX_ERR(0, 1387, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* "src/helpers/miscellaneous.pyx":1399 - * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) + /* "newanalysis/helpers/miscellaneous.pyx":1356 + * correlateSingleVectorTS(×eries[0,0], &result[0], number_of_frames, order) * - * def correlateMultiVectorVennShellwise(double [:,:,:] timeseries, double [:,:] dataset1, double [:,:] dataset2, double [:,:,:] result, int maxshell1, int maxshell2, int order = 1): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossCorrelateSingleVector(double[:,:] timeseries1, double[:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): * """ - * timeseries ... (number_of_particles, number_of_frames, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_77correlateMultiVectorVennShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateMultiVectorVennShellwis, __pyx_t_1) < 0) __PYX_ERR(0, 1399, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4)) __PYX_ERR(0, 1356, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7)) __PYX_ERR(0, 1356, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_71crossCorrelateSingleVector, 0, __pyx_n_s_crossCorrelateSingleVector, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__108)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_crossCorrelateSingleVector, __pyx_t_7) < 0) __PYX_ERR(0, 1356, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":1413 + /* "newanalysis/helpers/miscellaneous.pyx":1374 * * @cython.boundscheck(False) - * def crossCorrelateMultiVector(double[:,:,:] timeseries1, double[:,:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): # <<<<<<<<<<<<<< + * def correlateMultiVector(double[:,:,:] timeseries, double[:] result, int order = 1): # <<<<<<<<<<<<<< * """ * Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_79crossCorrelateMultiVector, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_crossCorrelateMultiVector, __pyx_t_1) < 0) __PYX_ERR(0, 1413, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* "src/helpers/miscellaneous.pyx":1431 + /* "newanalysis/helpers/miscellaneous.pyx":1373 + * crossCorrelateSingleVectorTS(×eries1[0,0], ×eries2[0,0], &result[0], number_of_frames1, number_of_frames2, both_directions, order) * - * @cython.boundscheck(False) - * def correlateSingleParticleMuShellwise(double[:,:,:] timeseries, double[:,:] result, int[:,:] dataset, int number_of_startingpoints): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateMultiVector(double[:,:,:] timeseries, double[:] result, int order = 1): * """ - * timeseries... (N_particle, number_of_frames, mu) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_81correlateSingleParticleMuShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateSingleParticleMuShellwi, __pyx_t_1) < 0) __PYX_ERR(0, 1431, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7)) __PYX_ERR(0, 1373, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_73correlateMultiVector, 0, __pyx_n_s_correlateMultiVector, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__110)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1373, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateMultiVector, __pyx_t_7) < 0) __PYX_ERR(0, 1373, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":1480 + /* "newanalysis/helpers/miscellaneous.pyx":1387 * * @cython.boundscheck(False) - * def correlateSingleParticleMuVennShellwise(double[:,:,:] timeseries, double[:,:,:] result, int[:,:] dataset1, int[:,:] dataset2, int number_of_startingpoints): # <<<<<<<<<<<<<< + * def correlateMultiVectorShellwise(double [:,:,:] timeseries, double [:,:] dataset, double [:,:] result, int maxshell, int order = 1): # <<<<<<<<<<<<<< * """ - * timeseries... (N_particle, number_of_frames, mu) + * timeseries ... (number_of_particles, number_of_frames, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_83correlateSingleParticleMuVennShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1480, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateSingleParticleMuVennShe, __pyx_t_1) < 0) __PYX_ERR(0, 1480, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1387, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* "src/helpers/miscellaneous.pyx":1530 + /* "newanalysis/helpers/miscellaneous.pyx":1386 + * correlateMultiVectorTS(×eries[0,0,0], &result[0], number_of_particles, number_of_frames, order) * - * @cython.boundscheck(False) - * def vanHoveSingleVector(double[:,:] timeseries, double[:,:] histogram): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateMultiVectorShellwise(double [:,:,:] timeseries, double [:,:] dataset, double [:,:] result, int maxshell, int order = 1): * """ - * timeseries ... (correlation_length * 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_85vanHoveSingleVector, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_vanHoveSingleVector, __pyx_t_1) < 0) __PYX_ERR(0, 1530, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7)) __PYX_ERR(0, 1386, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_75correlateMultiVectorShellwise, 0, __pyx_n_s_correlateMultiVectorShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__112)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateMultiVectorShellwise, __pyx_t_7) < 0) __PYX_ERR(0, 1386, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":1542 + /* "newanalysis/helpers/miscellaneous.pyx":1399 + * correlateMultiVectorShellwiseTS(×eries[0,0,0], &dataset[0,0], &result[0,0], number_of_particles, number_of_frames, maxshell, order) * - * @cython.boundscheck(False) - * def vanHoveMultiVector(double[:,:,:] timeseries, double[:,:] histogram): # <<<<<<<<<<<<<< + * def correlateMultiVectorVennShellwise(double [:,:,:] timeseries, double [:,:] dataset1, double [:,:] dataset2, double [:,:,:] result, int maxshell1, int maxshell2, int order = 1): # <<<<<<<<<<<<<< * """ - * timeseries ... (n_particles * correlation_length * 3) + * timeseries ... (number_of_particles, number_of_frames, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_87vanHoveMultiVector, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1542, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_vanHoveMultiVector, __pyx_t_1) < 0) __PYX_ERR(0, 1542, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7)) __PYX_ERR(0, 1399, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_77correlateMultiVectorVennShellwise, 0, __pyx_n_s_correlateMultiVectorVennShellwis, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__114)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateMultiVectorVennShellwis, __pyx_t_7) < 0) __PYX_ERR(0, 1399, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/helpers/miscellaneous.pyx":1555 + /* "newanalysis/helpers/miscellaneous.pyx":1413 * * @cython.boundscheck(False) - * def sortCollectiveDipNNShells(char[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): # <<<<<<<<<<<<<< + * def crossCorrelateMultiVector(double[:,:,:] timeseries1, double[:,:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): # <<<<<<<<<<<<<< * """ - * ds ... (n_particles, n_particles) + * Correlate the timeseries of multiple vectors (e.g. single-particle dynamics of a collection of dipoles,...) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_89sortCollectiveDipNNShells, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1555, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sortCollectiveDipNNShells, __pyx_t_1) < 0) __PYX_ERR(0, 1555, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyInt_From_int(((int)1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); - /* "src/helpers/miscellaneous.pyx":1566 + /* "newanalysis/helpers/miscellaneous.pyx":1412 + * correlateMultiVectorVennShellwiseTS(×eries[0,0,0], &dataset1[0,0], &dataset2[0,0], &result[0,0,0], number_of_particles, number_of_frames, maxshell1, maxshell2, order) * - * @cython.boundscheck(False) - * def sortCollectiveDipNNShellsInt(int[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def crossCorrelateMultiVector(double[:,:,:] timeseries1, double[:,:,:] timeseries2, double[:] result, int both_directions = 1, int order = 1): * """ - * ds ... (n_particles, n_particles) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_91sortCollectiveDipNNShellsInt, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sortCollectiveDipNNShellsInt, __pyx_t_1) < 0) __PYX_ERR(0, 1566, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7)) __PYX_ERR(0, 1412, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5)) __PYX_ERR(0, 1412, __pyx_L1_error); + __pyx_t_7 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_79crossCorrelateMultiVector, 0, __pyx_n_s_crossCorrelateMultiVector, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__116)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1412, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_crossCorrelateMultiVector, __pyx_t_5) < 0) __PYX_ERR(0, 1412, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1577 + /* "newanalysis/helpers/miscellaneous.pyx":1430 + * crossCorrelateMultiVectorTS(×eries1[0,0,0], ×eries2[0,0,0], &result[0], number_of_particles, number_of_frames1, number_of_frames2, both_directions, order) * - * @cython.boundscheck(False) - * def calcDipTenCollective(double[:,:] coor, double[:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleParticleMuShellwise(double[:,:,:] timeseries, double[:,:] result, int[:,:] dataset, int number_of_startingpoints): * """ - * coor ... (n_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_93calcDipTenCollective, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1577, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollective, __pyx_t_1) < 0) __PYX_ERR(0, 1577, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_81correlateSingleParticleMuShellwise, 0, __pyx_n_s_correlateSingleParticleMuShellwi, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__118)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateSingleParticleMuShellwi, __pyx_t_5) < 0) __PYX_ERR(0, 1430, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1587 + /* "newanalysis/helpers/miscellaneous.pyx":1479 + * result[i][k] /= counter[i] * - * @cython.boundscheck(False) - * def calcDipTenCollectivePerAtom(int idx, double[:,:] coor, double[:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def correlateSingleParticleMuVennShellwise(double[:,:,:] timeseries, double[:,:,:] result, int[:,:] dataset1, int[:,:] dataset2, int number_of_startingpoints): * """ - * coor ... (n_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_95calcDipTenCollectivePerAtom, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1587, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectivePerAtom, __pyx_t_1) < 0) __PYX_ERR(0, 1587, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_83correlateSingleParticleMuVennShellwise, 0, __pyx_n_s_correlateSingleParticleMuVennShe, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__120)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1479, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlateSingleParticleMuVennShe, __pyx_t_5) < 0) __PYX_ERR(0, 1479, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1597 + /* "newanalysis/helpers/miscellaneous.pyx":1529 + * result[i][j][k] /= counter[i][j] * - * @cython.boundscheck(False) - * def calcDipTenCollectiveCross(double[:,:] coor1, double[:,:] coor2, double[:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vanHoveSingleVector(double[:,:] timeseries, double[:,:] histogram): * """ - * coor1 ... (n_particles1, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_97calcDipTenCollectiveCross, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveCross, __pyx_t_1) < 0) __PYX_ERR(0, 1597, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_85vanHoveSingleVector, 0, __pyx_n_s_vanHoveSingleVector, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__122)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_vanHoveSingleVector, __pyx_t_5) < 0) __PYX_ERR(0, 1529, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1610 + /* "newanalysis/helpers/miscellaneous.pyx":1541 + * calcVanHoveSingleVector(×eries[0,0], &histogram[0,0], correlation_length, cos_segs) * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwise(double[:,:] coor, char [:,:] ds, double[:,:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def vanHoveMultiVector(double[:,:,:] timeseries, double[:,:] histogram): * """ - * coor ... (n_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_99calcDipTenCollectiveNNShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1610, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveNNShellwise, __pyx_t_1) < 0) __PYX_ERR(0, 1610, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_87vanHoveMultiVector, 0, __pyx_n_s_vanHoveMultiVector, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__124)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1541, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_vanHoveMultiVector, __pyx_t_5) < 0) __PYX_ERR(0, 1541, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1623 + /* "newanalysis/helpers/miscellaneous.pyx":1554 + * calcVanHoveMultiVector(×eries[0,0,0], &histogram[0,0], n_particles, correlation_length, cos_segs) * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwiseSelf(double[:,:] coor, int[:] f2c, char [:,:] ds, int ds_idx, double[:,:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sortCollectiveDipNNShells(char[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): * """ - * coor ... (n_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_101calcDipTenCollectiveNNShellwiseSelf, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1623, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveNNShellwiseS, __pyx_t_1) < 0) __PYX_ERR(0, 1623, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_89sortCollectiveDipNNShells, 0, __pyx_n_s_sortCollectiveDipNNShells, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__126)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1554, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sortCollectiveDipNNShells, __pyx_t_5) < 0) __PYX_ERR(0, 1554, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1637 + /* "newanalysis/helpers/miscellaneous.pyx":1565 + * sort_collective_dip_NN_shells(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) * - * @cython.boundscheck(False) - * def calcDipTenCollectiveNNShellwiseCross(double[:,:] coor1, double[:,:] coor2, int[:] f2c, char [:,:] ds, int ds1_idx, int ds2_idx, double[:,:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def sortCollectiveDipNNShellsInt(int[:,:] ds, double [:,:] dip_wat, double [:,:] dip_shell): * """ - * coor1 ... (n_particles1, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_103calcDipTenCollectiveNNShellwiseCross, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveNNShellwiseC, __pyx_t_1) < 0) __PYX_ERR(0, 1637, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_91sortCollectiveDipNNShellsInt, 0, __pyx_n_s_sortCollectiveDipNNShellsInt, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__127)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sortCollectiveDipNNShellsInt, __pyx_t_5) < 0) __PYX_ERR(0, 1565, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1653 + /* "newanalysis/helpers/miscellaneous.pyx":1576 + * sort_collective_dip_NN_shells_int(&ds[0,0], &dip_wat[0,0], &dip_shell[0,0], n_particles) * - * @cython.boundscheck(False) - * def calcDipTenCollective1NShellwiseSelf(double[:,:] coor, char [:] ds, double[:,:,:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective(double[:,:] coor, double[:] results): * """ - * coor ... (n_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_105calcDipTenCollective1NShellwiseSelf, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1653, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollective1NShellwiseS, __pyx_t_1) < 0) __PYX_ERR(0, 1653, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_93calcDipTenCollective, 0, __pyx_n_s_calcDipTenCollective, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__129)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollective, __pyx_t_5) < 0) __PYX_ERR(0, 1576, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1666 + /* "newanalysis/helpers/miscellaneous.pyx":1586 + * calc_dip_ten_collective(&coor[0,0], n_particles, &results[0]) * - * @cython.boundscheck(False) - * def calcDipTenCollective1NShellwiseCross(double[:,:] coor1, double[:,:] coor2, char [:] ds, double[:,:] results): # <<<<<<<<<<<<<< - * """ - * coor1 ... (n_particles1, 3) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_107calcDipTenCollective1NShellwiseCross, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1666, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollective1NShellwiseC, __pyx_t_1) < 0) __PYX_ERR(0, 1666, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/helpers/miscellaneous.pyx":1682 - * # Deprecated! - * @cython.boundscheck(False) - * def calcDipTenCollectiveShellwise(double[:,:] coor, char [:] ds, int maxshell, double[:,:] results): # <<<<<<<<<<<<<< - * """ - * coor ... (n_particles, 3) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_109calcDipTenCollectiveShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveShellwise, __pyx_t_1) < 0) __PYX_ERR(0, 1682, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/helpers/miscellaneous.pyx":1694 - * # Deprecated! - * @cython.boundscheck(False) - * def calcDipTenCollectiveVennShellwise(double[:,:] coor, char [:] ds1, char [:] ds2, int maxshell1, int maxshell2, double[:,:,:] results): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectivePerAtom(int idx, double[:,:] coor, double[:] results): * """ - * coor ... (n_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_111calcDipTenCollectiveVennShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1694, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveVennShellwis, __pyx_t_1) < 0) __PYX_ERR(0, 1694, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_95calcDipTenCollectivePerAtom, 0, __pyx_n_s_calcDipTenCollectivePerAtom, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__131)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1586, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectivePerAtom, __pyx_t_5) < 0) __PYX_ERR(0, 1586, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1706 + /* "newanalysis/helpers/miscellaneous.pyx":1596 + * calc_dip_ten_collective_per_atom(idx, &coor[0,0], n_particles, &results[0]) * - * @cython.boundscheck(False) - * def calcDistanceDelaunyMindist(double[:,:] coor, double boxlength, int number_of_shells, double bin_width=1.0): # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveCross(double[:,:] coor1, double[:,:] coor2, double[:] results): * """ - * coor ... (n_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_113calcDistanceDelaunyMindist, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1706, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDistanceDelaunyMindist, __pyx_t_1) < 0) __PYX_ERR(0, 1706, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_97calcDipTenCollectiveCross, 0, __pyx_n_s_calcDipTenCollectiveCross, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__133)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveCross, __pyx_t_5) < 0) __PYX_ERR(0, 1596, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1718 + /* "newanalysis/helpers/miscellaneous.pyx":1609 * - * @cython.boundscheck(False) - * def calcDistanceDelauny(double[:,:] coor, int number_of_shells, double bin_width=1.0): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwise(double[:,:] coor, char [:,:] ds, double[:,:] results): * """ - * coor ... (n_particles, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_115calcDistanceDelauny, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1718, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDistanceDelauny, __pyx_t_1) < 0) __PYX_ERR(0, 1718, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_99calcDipTenCollectiveNNShellwise, 0, __pyx_n_s_calcDipTenCollectiveNNShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__135)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveNNShellwise, __pyx_t_5) < 0) __PYX_ERR(0, 1609, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1732 - * # Deprecated! - * @cython.boundscheck(False) - * def minDistTesselation(double [:] dataset, double [:,:] coor_core, double [:,:] coor_surround, double binwidth = 1): # <<<<<<<<<<<<<< + /* "newanalysis/helpers/miscellaneous.pyx":1622 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwiseSelf(double[:,:] coor, int[:] f2c, char [:,:] ds, int ds_idx, double[:,:] results): * """ - * dataset ... (n_particles_surround) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_117minDistTesselation, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1732, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_minDistTesselation, __pyx_t_1) < 0) __PYX_ERR(0, 1732, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_101calcDipTenCollectiveNNShellwiseSelf, 0, __pyx_n_s_calcDipTenCollectiveNNShellwiseS, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__137)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1622, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveNNShellwiseS, __pyx_t_5) < 0) __PYX_ERR(0, 1622, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1745 + /* "newanalysis/helpers/miscellaneous.pyx":1636 * - * @cython.boundscheck(False) - * def getPolarizabilityMatrix(double[:,:] coor, double[:,:,:] inv_atom_polarizabilities, double[:,:] matrix): # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveNNShellwiseCross(double[:,:] coor1, double[:,:] coor2, int[:] f2c, char [:,:] ds, int ds1_idx, int ds2_idx, double[:,:] results): * """ - * coor ... (n_atoms, 3) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_13miscellaneous_119getPolarizabilityMatrix, NULL, __pyx_n_s_newanalysis_miscellaneous); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getPolarizabilityMatrix, __pyx_t_1) < 0) __PYX_ERR(0, 1745, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_103calcDipTenCollectiveNNShellwiseCross, 0, __pyx_n_s_calcDipTenCollectiveNNShellwiseC, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__139)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1636, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveNNShellwiseC, __pyx_t_5) < 0) __PYX_ERR(0, 1636, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/helpers/miscellaneous.pyx":1 - * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< - * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - * #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION + /* "newanalysis/helpers/miscellaneous.pyx":1652 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective1NShellwiseSelf(double[:,:] coor, char [:] ds, double[:,:,:] results): + * """ */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_105calcDipTenCollective1NShellwiseSelf, 0, __pyx_n_s_calcDipTenCollective1NShellwiseS, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__140)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1652, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollective1NShellwiseS, __pyx_t_5) < 0) __PYX_ERR(0, 1652, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":210 - * info.obj = self + /* "newanalysis/helpers/miscellaneous.pyx":1665 * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * - * def __dealloc__(array self): + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollective1NShellwiseCross(double[:,:] coor1, double[:,:] coor2, char [:] ds, double[:,:] results): + * """ */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_array_type); + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_107calcDipTenCollective1NShellwiseCross, 0, __pyx_n_s_calcDipTenCollective1NShellwiseC, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__142)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollective1NShellwiseC, __pyx_t_5) < 0) __PYX_ERR(0, 1665, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":287 - * return self.name + /* "newanalysis/helpers/miscellaneous.pyx":1681 * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveShellwise(double[:,:] coor, char [:] ds, int maxshell, double[:,:] results): + * """ */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__152, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(generic); - __Pyx_DECREF_SET(generic, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_109calcDipTenCollectiveShellwise, 0, __pyx_n_s_calcDipTenCollectiveShellwise, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__144)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveShellwise, __pyx_t_5) < 0) __PYX_ERR(0, 1681, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":288 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") + /* "newanalysis/helpers/miscellaneous.pyx":1693 * + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDipTenCollectiveVennShellwise(double[:,:] coor, char [:] ds1, char [:] ds2, int maxshell1, int maxshell2, double[:,:,:] results): + * """ */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__153, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(strided); - __Pyx_DECREF_SET(strided, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_111calcDipTenCollectiveVennShellwise, 0, __pyx_n_s_calcDipTenCollectiveVennShellwis, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__146)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDipTenCollectiveVennShellwis, __pyx_t_5) < 0) __PYX_ERR(0, 1693, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1706 * + * @cython.boundscheck(False) + * def calcDistanceDelaunyMindist(double[:,:] coor, double boxlength, int number_of_shells, double bin_width=1.0): # <<<<<<<<<<<<<< + * """ + * coor ... (n_particles, 3) */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__154, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(indirect); - __Pyx_DECREF_SET(indirect, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_5 = PyFloat_FromDouble(((double)1.0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); - /* "View.MemoryView":292 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") + /* "newanalysis/helpers/miscellaneous.pyx":1705 + * calc_dip_ten_collective_vennshellwise(&coor[0,0], n_particles, &ds1[0], &ds2[0], maxshell1, maxshell2, &results[0,0,0]) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDistanceDelaunyMindist(double[:,:] coor, double boxlength, int number_of_shells, double bin_width=1.0): + * """ */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__155, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(contiguous); - __Pyx_DECREF_SET(contiguous, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1705, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5)) __PYX_ERR(0, 1705, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_113calcDistanceDelaunyMindist, 0, __pyx_n_s_calcDistanceDelaunyMindist, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__148)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1705, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDistanceDelaunyMindist, __pyx_t_5) < 0) __PYX_ERR(0, 1705, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":293 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1718 * + * @cython.boundscheck(False) + * def calcDistanceDelauny(double[:,:] coor, int number_of_shells, double bin_width=1.0): # <<<<<<<<<<<<<< + * """ + * coor ... (n_particles, 3) */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__156, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(indirect_contiguous); - __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_5 = PyFloat_FromDouble(((double)1.0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1718, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); - /* "View.MemoryView":317 + /* "newanalysis/helpers/miscellaneous.pyx":1717 + * return delauny_matrix * - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ - * PyThread_allocate_lock(), + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcDistanceDelauny(double[:,:] coor, int number_of_shells, double bin_width=1.0): + * """ */ - __pyx_memoryview_thread_locks_used = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1717, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5)) __PYX_ERR(0, 1717, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_115calcDistanceDelauny, 0, __pyx_n_s_calcDistanceDelauny, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__150)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1717, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcDistanceDelauny, __pyx_t_5) < 0) __PYX_ERR(0, 1717, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":318 - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< - * PyThread_allocate_lock(), - * PyThread_allocate_lock(), + /* "newanalysis/helpers/miscellaneous.pyx":1732 + * # Deprecated! + * @cython.boundscheck(False) + * def minDistTesselation(double [:] dataset, double [:,:] coor_core, double [:,:] coor_surround, double binwidth = 1): # <<<<<<<<<<<<<< + * """ + * dataset ... (n_particles_surround) */ - __pyx_t_3[0] = PyThread_allocate_lock(); - __pyx_t_3[1] = PyThread_allocate_lock(); - __pyx_t_3[2] = PyThread_allocate_lock(); - __pyx_t_3[3] = PyThread_allocate_lock(); - __pyx_t_3[4] = PyThread_allocate_lock(); - __pyx_t_3[5] = PyThread_allocate_lock(); - __pyx_t_3[6] = PyThread_allocate_lock(); - __pyx_t_3[7] = PyThread_allocate_lock(); - memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_3, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + __pyx_t_5 = PyFloat_FromDouble(((double)1.0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1732, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); - /* "View.MemoryView":551 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1731 * + * # Deprecated! + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistTesselation(double [:] dataset, double [:,:] coor_core, double [:,:] coor_surround, double binwidth = 1): + * """ */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_memoryview_type); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5)) __PYX_ERR(0, 1731, __pyx_L1_error); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_117minDistTesselation, 0, __pyx_n_s_minDistTesselation, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__152)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1731, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_minDistTesselation, __pyx_t_5) < 0) __PYX_ERR(0, 1731, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":997 - * return self.from_object - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/miscellaneous.pyx":1744 + * calc_min_dist_tesselation(&dataset[0], &coor_core[0,0], &coor_surround[0,0], n_particle_core, n_particle_surround, binwidth) * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def getPolarizabilityMatrix(double[:,:] coor, double[:,:,:] inv_atom_polarizabilities, double[:,:] matrix): + * """ */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_memoryviewslice_type); - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_13miscellaneous_119getPolarizabilityMatrix, 0, __pyx_n_s_getPolarizabilityMatrix, NULL, __pyx_n_s_newanalysis_miscellaneous, __pyx_d, ((PyObject *)__pyx_codeobj__154)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1744, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_getPolarizabilityMatrix, __pyx_t_5) < 0) __PYX_ERR(0, 1744, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + /* "newanalysis/helpers/miscellaneous.pyx":1 + * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< + * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + * #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION */ + __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_5) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); if (__pyx_m) { - if (__pyx_d) { + if (__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init newanalysis.miscellaneous", __pyx_clineno, __pyx_lineno, __pyx_filename); } + #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init newanalysis.miscellaneous"); } @@ -48503,6 +57577,22 @@ if (!__Pyx_RefNanny) { return; #endif } +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ @@ -48522,6 +57612,106 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + /* PyObjectGetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { @@ -48536,10 +57726,32 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject } #endif +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); @@ -48550,6 +57762,213 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) +} +#endif + /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, @@ -48593,6 +58012,7 @@ static void __Pyx_RaiseDoubleKeywordsError( /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, + PyObject *const *kwvalues, PyObject **argnames[], PyObject *kwds2, PyObject *values[], @@ -48603,13 +58023,54 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); // transfer ownership of value to values + Py_DECREF(key); +#endif + key = NULL; + value = NULL; continue; } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_Check(key))) { @@ -48617,6 +58078,9 @@ static int __Pyx_ParseOptionalKeywords( if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif break; } name++; @@ -48637,14 +58101,18 @@ static int __Pyx_ParseOptionalKeywords( #endif if (likely(PyUnicode_Check(key))) { while (*name) { - int cmp = (**name == key) ? 0 : + int cmp = ( #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif - PyUnicode_Compare(**name, key); + PyUnicode_Compare(**name, key) + ); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif break; } name++; @@ -48671,165 +58139,222 @@ static int __Pyx_ParseOptionalKeywords( goto invalid_keyword; } } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* DivInt[Py_ssize_t] */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { - Py_ssize_t q = a / b; - Py_ssize_t r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); + Py_XDECREF(key); + Py_XDECREF(value); + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + Py_XDECREF(key); + Py_XDECREF(value); + return -1; } -#endif -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; } -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } - return result; -} + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } #endif - -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; } -#endif - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif } +bad: + Py_XDECREF(owned_instance); + return; } #endif /* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; @@ -48858,7 +58383,6 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args --tstate->recursion_depth; return result; } -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); @@ -48874,7 +58398,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { return NULL; } if ( @@ -48945,47 +58469,17 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, return result; } #endif -#endif - -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} -/* PyObjectCallMethO */ +/* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; - result = cfunc(self, arg); + result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( @@ -48993,502 +58487,456 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject "NULL result without error in PyObject_Call"); } return result; -} -#endif - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* MemviewSliceInit */ -static int -__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference) -{ - __Pyx_RefNannyDeclarations - int i, retval=-1; - Py_buffer *buf = &memview->view; - __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (unlikely(memviewslice->memview || memviewslice->data)) { - PyErr_SetString(PyExc_ValueError, - "memviewslice is already initialized!"); - goto fail; - } - if (buf->strides) { - for (i = 0; i < ndim; i++) { - memviewslice->strides[i] = buf->strides[i]; - } - } else { - Py_ssize_t stride = buf->itemsize; - for (i = ndim - 1; i >= 0; i--) { - memviewslice->strides[i] = stride; - stride *= buf->shape[i]; - } - } - for (i = 0; i < ndim; i++) { - memviewslice->shape[i] = buf->shape[i]; - if (buf->suboffsets) { - memviewslice->suboffsets[i] = buf->suboffsets[i]; - } else { - memviewslice->suboffsets[i] = -1; - } - } - memviewslice->memview = memview; - memviewslice->data = (char *)buf->buf; - if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { - Py_INCREF(memview); - } - retval = 0; - goto no_fail; -fail: - memviewslice->memview = 0; - memviewslice->data = 0; - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; -} -#ifndef Py_NO_RETURN -#define Py_NO_RETURN -#endif -static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { - va_list vargs; - char msg[200]; -#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) - va_start(vargs, fmt); -#else - va_start(vargs); -#endif - vsnprintf(msg, 200, fmt, vargs); - va_end(vargs); - Py_FatalError(msg); -} -static CYTHON_INLINE int -__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)++; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE int -__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)--; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE void -__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) -{ - int first_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) - return; - if (unlikely(__pyx_get_slice_count(memview) < 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - first_time = __pyx_add_acquisition_count(memview) == 0; - if (unlikely(first_time)) { - if (have_gil) { - Py_INCREF((PyObject *) memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_INCREF((PyObject *) memview); - PyGILState_Release(_gilstate); - } - } -} -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, - int have_gil, int lineno) { - int last_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) { - memslice->memview = NULL; - return; - } - if (unlikely(__pyx_get_slice_count(memview) <= 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - last_time = __pyx_sub_acquisition_count(memview) == 1; - memslice->data = NULL; - if (unlikely(last_time)) { - if (have_gil) { - Py_CLEAR(memslice->memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_CLEAR(memslice->memview); - PyGILState_Release(_gilstate); - } - } else { - memslice->memview = NULL; - } -} - -/* BufferIndexError */ -static void __Pyx_RaiseBufferIndexError(int axis) { - PyErr_Format(PyExc_IndexError, - "Out of bounds on buffer access (axis %d)", axis); -} - -/* PyObjectSetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); -#endif - return PyObject_SetAttr(obj, attr_name, value); -} -#endif - -/* PyIntBinop */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; +} #endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} #endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) +#else + if (PyCFunction_Check(func)) #endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); } } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); + } + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } + } + } #endif - - + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); } #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); -} -#endif - -/* PyIntBinop */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a - b); - if (likely((x^a) >= 0 || (x^~b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_subtract(op1, op2); + #endif + #endif + #if CYTHON_VECTORCALL + #if Py_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); } #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); +} + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* CIntToDigits */ +static const char DIGIT_PAIRS_10[2*10*10+1] = { + "00010203040506070809" + "10111213141516171819" + "20212223242526272829" + "30313233343536373839" + "40414243444546474849" + "50515253545556575859" + "60616263646566676869" + "70717273747576777879" + "80818283848586878889" + "90919293949596979899" +}; +static const char DIGIT_PAIRS_8[2*8*8+1] = { + "0001020304050607" + "1011121314151617" + "2021222324252627" + "3031323334353637" + "4041424344454647" + "5051525354555657" + "6061626364656667" + "7071727374757677" +}; +static const char DIGITS_HEX[2*16+1] = { + "0123456789abcdef" + "0123456789ABCDEF" +}; + +/* BuildPyUnicode */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char) { + PyObject *uval; + Py_ssize_t uoffset = ulength - clength; +#if CYTHON_USE_UNICODE_INTERNALS + Py_ssize_t i; +#if CYTHON_PEP393_ENABLED + void *udata; + uval = PyUnicode_New(ulength, 127); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_DATA(uval); +#else + Py_UNICODE *udata; + uval = PyUnicode_FromUnicode(NULL, ulength); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_AS_UNICODE(uval); #endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + if (uoffset > 0) { + i = 0; + if (prepend_sign) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); + i++; + } + for (; i < uoffset; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); + } + } + for (i=0; i < clength; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); + } +#else + { + PyObject *sign = NULL, *padding = NULL; + uval = NULL; + if (uoffset > 0) { + prepend_sign = !!prepend_sign; + if (uoffset > prepend_sign) { + padding = PyUnicode_FromOrdinal(padding_char); + if (likely(padding) && uoffset > prepend_sign + 1) { + PyObject *tmp; + PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign); + if (unlikely(!repeat)) goto done_or_error; + tmp = PyNumber_Multiply(padding, repeat); + Py_DECREF(repeat); + Py_DECREF(padding); + padding = tmp; + } + if (unlikely(!padding)) goto done_or_error; + } + if (prepend_sign) { + sign = PyUnicode_FromOrdinal('-'); + if (unlikely(!sign)) goto done_or_error; + } + } + uval = PyUnicode_DecodeASCII(chars, clength, NULL); + if (likely(uval) && padding) { + PyObject *tmp = PyNumber_Add(padding, uval); + Py_DECREF(uval); + uval = tmp; + } + if (likely(uval) && sign) { + PyObject *tmp = PyNumber_Add(sign, uval); + Py_DECREF(uval); + uval = tmp; + } +done_or_error: + Py_XDECREF(padding); + Py_XDECREF(sign); + } #endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + return uval; +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(int)*3+2]; + char *dpos, *end = digits + sizeof(int)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + int remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" #endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop #endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (int) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (int) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (int) (remaining / 16); + break; + default: + assert(0); + break; } - x = a - b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla - llb; - return PyLong_FromLongLong(llx); -#endif - - + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("subtract", return NULL) - result = ((double)a) - (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); + if (width > ulength) { + ulength = width; } - return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); } -#endif -/* SetItemInt */ -static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, - CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { - PyObject* old = PyList_GET_ITEM(o, n); - Py_INCREF(v); - PyList_SET_ITEM(o, n, v); - Py_DECREF(old); - return 1; +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (Py_ssize_t) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (Py_ssize_t) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (Py_ssize_t) (remaining / 16); + break; + default: + assert(0); + break; } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_ass_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return -1; - PyErr_Clear(); - } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + CYTHON_MAYBE_UNUSED_VAR(max_char); +#if CYTHON_PEP393_ENABLED + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); +#else + result_uval = PyUnicode_FromUnicode(NULL, result_ulength); + if (unlikely(!result_uval)) return NULL; + result_ukind = sizeof(Py_UNICODE); + kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; + result_udata = PyUnicode_AS_UNICODE(result_uval); +#endif + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); + if (unlikely(__Pyx_PyUnicode_READY(uval))) + goto bad; + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030D0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); } - return m->sq_ass_item(o, i, v); + #endif } + char_pos += ulength; } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; #else -#if CYTHON_COMPILING_IN_PYPY - if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + CYTHON_UNUSED_VAR(value_count); + return PyUnicode_Join(__pyx_empty_unicode, value_tuple); +#endif +} + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) #else - if (is_list || PySequence_Check(o)) + if (likely(PyString_Check(n))) #endif - { - return PySequence_SetItem(o, i, v); - } + return __Pyx_PyObject_GetAttrStr(o, n); #endif - return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); + return PyObject_GetAttr(o, n); } /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; - if (!j) return NULL; + if (unlikely(!j)) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; @@ -49549,10 +58997,18 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return r; } } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); if (likely(l >= 0)) { i += l; } else { @@ -49561,7 +59017,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, PyErr_Clear(); } } - return m->sq_item(o, i); + return sm->sq_item(o, i); } } #else @@ -49572,223 +59028,281 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -/* PyObjectGetMethod */ -static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { - PyObject *attr; -#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP - PyTypeObject *tp = Py_TYPE(obj); - PyObject *descr; - descrgetfunc f = NULL; - PyObject **dictptr, *dict; - int meth_found = 0; - assert (*method == NULL); - if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { - attr = __Pyx_PyObject_GetAttrStr(obj, name); - goto try_unpack; - } - if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { - return 0; +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); } - descr = _PyType_Lookup(tp, name); - if (likely(descr != NULL)) { - Py_INCREF(descr); -#if PY_MAJOR_VERSION >= 3 - #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) - #else - if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type))) - #endif -#else - #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) - #else - if (likely(PyFunction_Check(descr))) - #endif -#endif - { - meth_found = 1; - } else { - f = Py_TYPE(descr)->tp_descr_get; - if (f != NULL && PyDescr_IsData(descr)) { - attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); - Py_DECREF(descr); - goto try_unpack; - } - } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); } - dictptr = _PyObject_GetDictPtr(obj); - if (dictptr != NULL && (dict = *dictptr) != NULL) { - Py_INCREF(dict); - attr = __Pyx_PyDict_GetItemStr(dict, name); - if (attr != NULL) { - Py_INCREF(attr); - Py_DECREF(dict); - Py_XDECREF(descr); - goto try_unpack; + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (meth) { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; } - Py_DECREF(dict); - } - if (meth_found) { - *method = descr; - return 1; } - if (f != NULL) { - attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); - Py_DECREF(descr); - goto try_unpack; + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); } - if (descr != NULL) { - *method = descr; - return 0; + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); } - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, name); + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + Py_ssize_t kwsize; +#if CYTHON_ASSUME_SAFE_MACROS + kwsize = PyTuple_GET_SIZE(kw); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(name)); + kwsize = PyTuple_Size(kw); + if (kwsize < 0) return 0; #endif - return 0; + if (unlikely(kwsize == 0)) + return 1; + if (!kw_allowed) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, 0); #else - attr = __Pyx_PyObject_GetAttrStr(obj, name); - goto try_unpack; + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + goto invalid_keyword; + } +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < kwsize; pos++) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } #endif -try_unpack: -#if CYTHON_UNPACK_METHODS - if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { - PyObject *function = PyMethod_GET_FUNCTION(attr); - Py_INCREF(function); - Py_DECREF(attr); - *method = function; return 1; } + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; #endif - *method = attr; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif return 0; } -/* PyObjectCallMethod1 */ -static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { - PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); - Py_DECREF(method); - return result; +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; } -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { - PyObject *method = NULL, *result; - int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); - if (likely(is_method)) { - result = __Pyx_PyObject_Call2Args(method, obj, arg); - Py_DECREF(method); + +/* GetAttr3 */ +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyString_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; + } +#endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +} + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { return result; } - if (unlikely(!method)) return NULL; - return __Pyx__PyObject_CallMethod1(method, arg); +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); } -/* append */ -static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; - } else { - PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); - if (unlikely(!retval)) - return -1; - Py_DECREF(retval); - } - return 0; +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -/* DivInt[long] */ -static CYTHON_INLINE long __Pyx_div_long(long a, long b) { - long q = a / b; - long r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); } -/* DivInt[int] */ -static CYTHON_INLINE int __Pyx_div_int(int a, int b) { - int q = a / b; - int r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -/* PyIntCompare */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) { - if (op1 == op2) { - Py_RETURN_FALSE; - } - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long a = PyInt_AS_LONG(op1); - if (a != b) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - int unequal; - unsigned long uintval; - Py_ssize_t size = Py_SIZE(op1); - const digit* digits = ((PyLongObject*)op1)->ob_digit; - if (intval == 0) { - if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } else if (intval < 0) { - if (size >= 0) - Py_RETURN_TRUE; - intval = -intval; - size = -size; - } else { - if (size <= 0) - Py_RETURN_TRUE; - } - uintval = (unsigned long) intval; -#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 4)) { - unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 3)) { - unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 2)) { - unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 1)) { - unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif - unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); - if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; } - return ( - PyObject_RichCompare(op1, op2, Py_NE)); + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; } /* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; @@ -49800,21 +59314,46 @@ __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; - #else + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; - #endif Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); + #endif } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; @@ -49835,31 +59374,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); -} -#endif - -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; icurexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + #endif } #endif @@ -49870,20 +59385,32 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { - PyObject *local_type, *local_value, *local_tb; + PyObject *local_type = NULL, *local_value, *local_tb = NULL; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; + #endif #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) @@ -49905,12 +59432,21 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; + #endif } #else tmp_type = tstate->exc_type; @@ -49937,704 +59473,1044 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return -1; } -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; } #else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; + from_list = empty_list; + } + #endif + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); } } + level = 0; } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) goto bad; - } + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + return module; +} + +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); + } + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); +#endif + return imported_module; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; + } + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; +} +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__3; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; + } + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); } - PyException_SetCause(value, fixed_cause); + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); +} + +/* ssize_strlen */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} #else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; itp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; } -/* BytesEquals */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } -#endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } } -#endif -} - -/* UnicodeEquals */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#else #if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) #else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; + if (is_list || PySequence_Check(o)) #endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); + { + return PySequence_SetItem(o, i, v); } #endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } -#if CYTHON_USE_UNICODE_INTERNALS + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +} + +/* RaiseUnboundLocalError */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; + value = PyImport_GetModule(full_name); #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } - } -#endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif + return value; } -/* GetAttr */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +/* HasAttr */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_GetAttr(o, n); + if (!r) { + PyErr_Clear(); + return 0; + } else { + Py_DECREF(r); + return 1; + } +} + +/* BufferIndexError */ +static void __Pyx_RaiseBufferIndexError(int axis) { + PyErr_Format(PyExc_IndexError, + "Out of bounds on buffer access (axis %d)", axis); +} + +/* PyObjectSetAttrStr */ #if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) -#else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); #endif - return PyObject_GetAttr(o, n); + return PyObject_SetAttr(obj, attr_name, value); } +#endif -/* ObjectGetItem */ -#if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr = NULL; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); +/* PyIntBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op1))) { + const long b = intval; + long x; + long a = PyInt_AS_LONG(op1); + + x = (long)((unsigned long)a + (unsigned long)b); + if (likely((x^a) >= 0 || (x^b) >= 0)) + return PyInt_FromLong(x); + return PyLong_Type.tp_as_number->nb_add(op1, op2); } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + #endif + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + const long b = intval; + long a, x; +#ifdef HAVE_LONG_LONG + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla, llx; +#endif + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op2); + } + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); + } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); + switch (size) { + case -2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case -3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case -4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + default: return PyLong_Type.tp_as_number->nb_add(op1, op2); + } + } + x = a + b; + return PyLong_FromLong(x); +#ifdef HAVE_LONG_LONG + long_long: + llx = lla + llb; + return PyLong_FromLongLong(llx); +#endif + + } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else + double a = PyFloat_AS_DOUBLE(op1); +#endif + double result; + + PyFPE_START_PROTECT("add", return NULL) + result = ((double)a) + (double)b; + PyFPE_END_PROTECT(result) + return PyFloat_FromDouble(result); } - return __Pyx_PyObject_GetIndex(obj, key); + return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); } #endif -/* decode_c_string */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; +/* PyIntBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op1))) { + const long b = intval; + long x; + long a = PyInt_AS_LONG(op1); + + x = (long)((unsigned long)a - (unsigned long)b); + if (likely((x^a) >= 0 || (x^~b) >= 0)) + return PyInt_FromLong(x); + return PyLong_Type.tp_as_number->nb_subtract(op1, op2); + } + #endif + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + const long b = intval; + long a, x; +#ifdef HAVE_LONG_LONG + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla, llx; +#endif + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return PyLong_FromLong(-intval); } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - } - if (unlikely(stop <= start)) - return __Pyx_NewRef(__pyx_empty_unicode); - length = stop - start; - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); + } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); + switch (size) { + case -2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case -3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case -4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + #ifdef HAVE_LONG_LONG + } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { + lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); + goto long_long; + #endif + } + CYTHON_FALLTHROUGH; + default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); + } + } + x = a - b; + return PyLong_FromLong(x); +#ifdef HAVE_LONG_LONG + long_long: + llx = lla - llb; + return PyLong_FromLongLong(llx); +#endif + + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else + double a = PyFloat_AS_DOUBLE(op1); +#endif + double result; + + PyFPE_START_PROTECT("subtract", return NULL) + result = ((double)a) - (double)b; + PyFPE_END_PROTECT(result) + return PyFloat_FromDouble(result); + } + return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); } +#endif -/* GetAttr3 */ -static PyObject *__Pyx_GetAttr3Default(PyObject *d) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(d); - return d; -} -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r = __Pyx_GetAttr(o, n); - return (likely(r)) ? r : __Pyx_GetAttr3Default(d); -} - -/* RaiseTooManyValuesToUnpack */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* RaiseNoneIterError */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +/* PyObjectCall2Args */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } -/* ExtTypeTest */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); +/* PyObjectGetMethod */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { return 0; } - if (likely(__Pyx_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -/* SwapException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = *type; - exc_info->exc_value = *value; - exc_info->exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif #else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif #endif - -/* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif } } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* FastTypeChecks */ -#if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; -} -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; } - return 0; + Py_DECREF(dict); } - return __Pyx_InBases(a, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; + if (meth_found) { + *method = descr; + return 1; } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + if (likely(descr != NULL)) { + *method = descr; + return 0; } - return res; -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); + type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 - for (i=0; i= (double)LONG_MIN && value <= (double)LONG_MAX) { + return PyInt_FromLong((long)value); } - return value; + return PyLong_FromDouble(value); } +#endif -/* HasAttr */ -static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { - PyObject *r; - if (unlikely(!__Pyx_PyBaseString_Check(n))) { - PyErr_SetString(PyExc_TypeError, - "hasattr(): attribute name must be string"); - return -1; - } - r = __Pyx_GetAttr(o, n); - if (unlikely(!r)) { - PyErr_Clear(); +/* PyIntCompare */ +static CYTHON_INLINE int __Pyx_PyInt_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); + if (op1 == op2) { return 0; - } else { - Py_DECREF(r); - return 1; } + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op1))) { + const long b = intval; + long a = PyInt_AS_LONG(op1); + return (a != b); + } + #endif + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + int unequal; + unsigned long uintval; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); + if (intval == 0) { + return (__Pyx_PyLong_IsZero(op1) != 1); + } else if (intval < 0) { + if (__Pyx_PyLong_IsNonNeg(op1)) + return 1; + intval = -intval; + } else { + if (__Pyx_PyLong_IsNeg(op1)) + return 1; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + return (unequal != 0); + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else + double a = PyFloat_AS_DOUBLE(op1); +#endif + return ((double)a != (double)b); + } + return __Pyx_PyObject_IsTrueAndDecref( + PyObject_RichCompare(op1, op2, Py_NE)); } /* PyObject_GenericGetAttrNoDict */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif + __Pyx_DECREF_TypeName(type_name); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { @@ -50674,16 +60550,278 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam } #endif +/* FixUpExtensionType */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; + } + if (changed) + PyType_Modified(type); + } +#endif + return 0; +} +#endif + +/* PyObjectCallNoArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectCallMethod0 */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +} + +/* ValidateBasesTuple */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_MACROS + n = PyTuple_GET_SIZE(bases); +#else + n = PyTuple_Size(bases); + if (n < 0) return -1; +#endif + for (i = 1; i < n; i++) + { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#if !CYTHON_USE_TYPE_SLOTS + if (dictoffset == 0) { + PyErr_Format(PyExc_TypeError, + "extension type '%s.200s': " + "unable to validate whether bases have a __dict__ " + "when CYTHON_USE_TYPE_SLOTS is off " + "(likely because you are building in the limited API). " + "Therefore, all extension types with multiple bases " + "must add 'cdef dict __dict__' in this compilation mode", + type_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#else + if (dictoffset == 0 && b->tp_dictoffset) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + } + return 0; +} +#endif + +/* PyType_Ready */ +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + /* SetVTable */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) #else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) #endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) goto bad; Py_DECREF(ob); return 0; @@ -50692,33 +60830,85 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { return -1; } -/* PyObjectGetAttrStrNoError */ -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); +/* GetVTable */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + +/* MergeVTables */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i; + void** base_vtables; + __Pyx_TypeName tp_base_name; + __Pyx_TypeName base_name; + void* unknown = (void*)-1; + PyObject* bases = type->tp_bases; + int base_depth = 0; + { + PyTypeObject* base = type->tp_base; + while (base) { + base_depth += 1; + base = base->tp_base; + } } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; + for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { + void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); + if (base_vtable != NULL) { + int j; + PyTypeObject* base = type->tp_base; + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = base->tp_base; + } + } } - return result; + PyErr_Clear(); + free(base_vtables); + return 0; +bad: + tp_base_name = __Pyx_PyType_GetName(type->tp_base); + base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); + free(base_vtables); + return -1; } +#endif /* SetupReduce */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { @@ -50784,7 +60974,7 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } else if (reduce == object_reduce || PyErr_Occurred()) { goto __PYX_BAD; } - setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); @@ -50800,8 +60990,13 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } goto __PYX_GOOD; __PYX_BAD: - if (!PyErr_Occurred()) - PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } ret = -1; __PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP @@ -50817,18 +61012,19 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { Py_XDECREF(setstate_cython); return ret; } +#endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_2 +#define __PYX_HAVE_RT_ImportType_3_0_2 +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; Py_ssize_t itemsize; -#ifdef Py_LIMITED_API +#if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; PyObject *py_itemsize; #endif @@ -50841,7 +61037,7 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, module_name, class_name); goto bad; } -#ifndef Py_LIMITED_API +#if !CYTHON_COMPILING_IN_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; itemsize = ((PyTypeObject *)result)->tp_itemsize; #else @@ -50873,17 +61069,18 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_2 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_2 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -50897,56 +61094,197 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, } #endif +/* FetchSharedCythonModule */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; +} + /* FetchCommonType */ +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +#if !CYTHON_USE_TYPE_SPECS static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { goto bad; } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { goto bad; } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; + goto done; } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; done: - Py_DECREF(fake_module); - return cached_type; + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } +#endif + +/* PyVectorcallFastCallDict */ +#if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif /* CythonFunctionShared */ -#include +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + CYTHON_UNUSED_VAR(closure); if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { #if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #endif if (unlikely(op->func_doc == NULL)) return NULL; @@ -50954,30 +61292,33 @@ __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure Py_INCREF(Py_None); return Py_None; } +#endif } Py_INCREF(op->func_doc); return op->func_doc; } static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp = op->func_doc; + CYTHON_UNUSED_VAR(context); if (value == NULL) { value = Py_None; } Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_doc, value); return 0; } static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#elif PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; @@ -50986,9 +61327,9 @@ __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_name; } static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -50999,22 +61340,21 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "__name__ must be set to a string object"); return -1; } - tmp = op->func_name; Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_name, value); return 0; } static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_qualname); return op->func_qualname; } static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -51025,25 +61365,14 @@ __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHO "__qualname__ must be set to a string object"); return -1; } - tmp = op->func_qualname; Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); return 0; } static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) @@ -51053,9 +61382,9 @@ __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_dict; } static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL)) { PyErr_SetString(PyExc_TypeError, "function's dictionary may not be deleted"); @@ -51066,28 +61395,30 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "setting function's dictionary to a non-dict"); return -1; } - tmp = op->func_dict; Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_dict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); Py_INCREF(Py_None); return Py_None; } static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) { PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); Py_INCREF(result); return result; } @@ -51103,10 +61434,10 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); Py_INCREF(op->defaults_kwdict); #else - op->defaults_tuple = PySequence_ITEM(res, 0); + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); if (unlikely(!op->defaults_tuple)) result = -1; else { - op->defaults_kwdict = PySequence_ITEM(res, 1); + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); if (unlikely(!op->defaults_kwdict)) result = -1; } #endif @@ -51114,27 +61445,28 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { return result; } static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); return 0; } static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_tuple; } else { result = Py_None; @@ -51144,27 +61476,28 @@ __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *co return result; } static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_kwdict; } else { result = Py_None; @@ -51174,24 +61507,23 @@ __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void * return result; } static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value || value == Py_None) { value = NULL; - } else if (!PyDict_Check(value)) { + } else if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); return 0; } static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; @@ -51200,13 +61532,62 @@ __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void Py_INCREF(result); return result; } +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } +#endif + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); + } +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, @@ -51219,49 +61600,88 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif {0, 0, 0, 0, 0} }; static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) { + CYTHON_UNUSED_VAR(args); #if PY_MAJOR_VERSION >= 3 Py_INCREF(m->func_qualname); return m->func_qualname; #else - return PyString_FromString(m->func.m_ml->ml_name); + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); #endif } static PyMethodDef __pyx_CyFunction_methods[] = { {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, {0, 0, 0, 0} }; -#if PY_VERSION_HEX < 0x030500A0 +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif if (unlikely(op == NULL)) return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif Py_XINCREF(closure); op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API Py_XINCREF(module); - op->func.m_module = module; + cf->m_module = module; +#endif op->func_dict = NULL; op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); @@ -51273,23 +61693,62 @@ static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef * op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif Py_CLEAR(m->func_dict); Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -51305,7 +61764,7 @@ static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); + __Pyx_PyHeapTypeObject_GC_Del(m); } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { @@ -51315,16 +61774,23 @@ static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif Py_VISIT(m->func_dict); Py_VISIT(m->func_name); Py_VISIT(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -51333,24 +61799,6 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, } return 0; } -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ -#if PY_MAJOR_VERSION < 3 - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; -#endif - return __Pyx_PyMethod_New(func, obj, type); -} static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { @@ -51363,10 +61811,22 @@ __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) #endif } static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyObject *py_name = NULL; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) return (*meth)(self, arg); @@ -51375,24 +61835,43 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif if (likely(size == 0)) return (*meth)(self, NULL); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); +#endif return NULL; } break; case METH_O: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif if (likely(size == 1)) { PyObject *result, *arg0; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS arg0 = PyTuple_GET_ITEM(arg, 0); #else - arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; #endif result = (*meth)(self, arg0); #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) @@ -51400,33 +61879,72 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py #endif return result; } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else PyErr_Format(PyExc_TypeError, "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); +#endif return NULL; } break; default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); return NULL; } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", + py_name); + Py_DECREF(py_name); +#else PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", f->m_ml->ml_name); +#endif return NULL; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; } static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { Py_ssize_t argc; PyObject *new_args; PyObject *self; +#if CYTHON_ASSUME_SAFE_MACROS argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(!argc) < 0) return NULL; +#endif new_args = PyTuple_GetSlice(args, 1, argc); if (unlikely(!new_args)) return NULL; @@ -51450,13 +61968,175 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P } return result; } +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else static PyTypeObject __pyx_CyFunctionType_type = { PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif 0, 0, #if PY_MAJOR_VERSION < 3 @@ -51474,7 +62154,13 @@ static PyTypeObject __pyx_CyFunctionType_type = { 0, 0, 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, 0, (traverseproc) __Pyx_CyFunction_traverse, (inquiry) __Pyx_CyFunction_clear, @@ -51491,7 +62177,7 @@ static PyTypeObject __pyx_CyFunctionType_type = { __pyx_CyFunction_getsets, 0, 0, - __Pyx_CyFunction_descr_get, + __Pyx_PyMethod_New, 0, offsetof(__pyx_CyFunctionObject, func_dict), 0, @@ -51512,15 +62198,24 @@ static PyTypeObject __pyx_CyFunctionType_type = { #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, #endif -#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 0, #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, #endif }; -static int __pyx_CyFunction_init(void) { +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif if (unlikely(__pyx_CyFunctionType == NULL)) { return -1; } @@ -51567,10 +62262,21 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qual /* CalculateMetaclass */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { - Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); + Py_ssize_t i, nbases; +#if CYTHON_ASSUME_SAFE_MACROS + nbases = PyTuple_GET_SIZE(bases); +#else + nbases = PyTuple_Size(bases); + if (nbases < 0) return NULL; +#endif for (i=0; i < nbases; i++) { PyTypeObject *tmptype; +#if CYTHON_ASSUME_SAFE_MACROS PyObject *tmp = PyTuple_GET_ITEM(bases, i); +#else + PyObject *tmp = PyTuple_GetItem(bases, i); + if (!tmp) return NULL; +#endif tmptype = Py_TYPE(tmp); #if PY_MAJOR_VERSION < 3 if (tmptype == &PyClass_Type) @@ -51604,25 +62310,43 @@ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bas return (PyObject*) metaclass; } +/* PyObjectLookupSpecial */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) { + PyObject *res; + PyTypeObject *tp = Py_TYPE(obj); +#if PY_MAJOR_VERSION < 3 + if (unlikely(PyInstance_Check(obj))) + return with_error ? __Pyx_PyObject_GetAttrStr(obj, attr_name) : __Pyx_PyObject_GetAttrStrNoError(obj, attr_name); +#endif + res = _PyType_Lookup(tp, attr_name); + if (likely(res)) { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (!f) { + Py_INCREF(res); + } else { + res = f(res, obj, (PyObject *)tp); + } + } else if (with_error) { + PyErr_SetObject(PyExc_AttributeError, attr_name); + } + return res; +} +#endif + /* Py3ClassCreate */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { PyObject *ns; if (metaclass) { - PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); + PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_n_s_prepare); if (prep) { - PyObject *pargs = PyTuple_Pack(2, name, bases); - if (unlikely(!pargs)) { - Py_DECREF(prep); - return NULL; - } - ns = PyObject_Call(prep, pargs, mkw); + PyObject *pargs[3] = {NULL, name, bases}; + ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw); Py_DECREF(prep); - Py_DECREF(pargs); } else { - if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) + if (unlikely(PyErr_Occurred())) return NULL; - PyErr_Clear(); ns = PyDict_New(); } } else { @@ -51631,18 +62355,153 @@ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, if (unlikely(!ns)) return NULL; if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; +#if PY_VERSION_HEX >= 0x03030000 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; +#else + CYTHON_MAYBE_UNUSED_VAR(qualname); +#endif if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; return ns; bad: Py_DECREF(ns); return NULL; } +#if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS +static int __Pyx_SetNamesPEP487(PyObject *type_obj) { + PyTypeObject *type = (PyTypeObject*) type_obj; + PyObject *names_to_set, *key, *value, *set_name, *tmp; + Py_ssize_t i = 0; +#if CYTHON_USE_TYPE_SLOTS + names_to_set = PyDict_Copy(type->tp_dict); +#else + { + PyObject *d = PyObject_GetAttr(type_obj, __pyx_n_s_dict); + names_to_set = NULL; + if (likely(d)) { + PyObject *names_to_set = PyDict_New(); + int ret = likely(names_to_set) ? PyDict_Update(names_to_set, d) : -1; + Py_DECREF(d); + if (unlikely(ret < 0)) + Py_CLEAR(names_to_set); + } + } +#endif + if (unlikely(names_to_set == NULL)) + goto bad; + while (PyDict_Next(names_to_set, &i, &key, &value)) { + set_name = __Pyx_PyObject_LookupSpecialNoError(value, __pyx_n_s_set_name); + if (unlikely(set_name != NULL)) { + tmp = __Pyx_PyObject_Call2Args(set_name, type_obj, key); + Py_DECREF(set_name); + if (unlikely(tmp == NULL)) { + __Pyx_TypeName value_type_name = + __Pyx_PyType_GetName(Py_TYPE(value)); + __Pyx_TypeName type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_RuntimeError, +#if PY_MAJOR_VERSION >= 3 + "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %R " "in '" __Pyx_FMT_TYPENAME "'", + value_type_name, key, type_name); +#else + "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %.100s in '" __Pyx_FMT_TYPENAME "'", + value_type_name, + PyString_Check(key) ? PyString_AS_STRING(key) : "?", + type_name); +#endif + goto bad; + } else { + Py_DECREF(tmp); + } + } + else if (unlikely(PyErr_Occurred())) { + goto bad; + } + } + Py_DECREF(names_to_set); + return 0; +bad: + Py_XDECREF(names_to_set); + return -1; +} +static PyObject *__Pyx_InitSubclassPEP487(PyObject *type_obj, PyObject *mkw) { +#if CYTHON_USE_TYPE_SLOTS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyTypeObject *type = (PyTypeObject*) type_obj; + PyObject *mro = type->tp_mro; + Py_ssize_t i, nbases; + if (unlikely(!mro)) goto done; + (void) &__Pyx_GetBuiltinName; + Py_INCREF(mro); + nbases = PyTuple_GET_SIZE(mro); + assert(PyTuple_GET_ITEM(mro, 0) == type_obj); + for (i = 1; i < nbases-1; i++) { + PyObject *base, *dict, *meth; + base = PyTuple_GET_ITEM(mro, i); + dict = ((PyTypeObject *)base)->tp_dict; + meth = __Pyx_PyDict_GetItemStrWithError(dict, __pyx_n_s_init_subclass); + if (unlikely(meth)) { + descrgetfunc f = Py_TYPE(meth)->tp_descr_get; + PyObject *res; + Py_INCREF(meth); + if (likely(f)) { + res = f(meth, NULL, type_obj); + Py_DECREF(meth); + if (unlikely(!res)) goto bad; + meth = res; + } + res = __Pyx_PyObject_FastCallDict(meth, NULL, 0, mkw); + Py_DECREF(meth); + if (unlikely(!res)) goto bad; + Py_DECREF(res); + goto done; + } else if (unlikely(PyErr_Occurred())) { + goto bad; + } + } +done: + Py_XDECREF(mro); + return type_obj; +bad: + Py_XDECREF(mro); + Py_DECREF(type_obj); + return NULL; +#else + PyObject *super_type, *super, *func, *res; +#if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type) + super_type = __Pyx_GetBuiltinName(__pyx_n_s_super); +#else + super_type = (PyObject*) &PySuper_Type; + (void) &__Pyx_GetBuiltinName; +#endif + super = likely(super_type) ? __Pyx_PyObject_Call2Args(super_type, type_obj, type_obj) : NULL; +#if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type) + Py_XDECREF(super_type); +#endif + if (unlikely(!super)) { + Py_CLEAR(type_obj); + goto done; + } + func = __Pyx_PyObject_GetAttrStrNoError(super, __pyx_n_s_init_subclass); + Py_DECREF(super); + if (likely(!func)) { + if (unlikely(PyErr_Occurred())) + Py_CLEAR(type_obj); + goto done; + } + res = __Pyx_PyObject_FastCallDict(func, NULL, 0, mkw); + Py_DECREF(func); + if (unlikely(!res)) + Py_CLEAR(type_obj); + Py_XDECREF(res); +done: + return type_obj; +#endif +} +#endif static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass) { - PyObject *result, *margs; + PyObject *result; PyObject *owned_metaclass = NULL; + PyObject *margs[4] = {NULL, name, bases, dict}; if (allow_py2_metaclass) { owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); if (owned_metaclass) { @@ -51660,25 +62519,37 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj return NULL; owned_metaclass = metaclass; } - margs = PyTuple_Pack(3, name, bases, dict); - if (unlikely(!margs)) { - result = NULL; - } else { - result = PyObject_Call(metaclass, margs, mkw); - Py_DECREF(margs); - } + result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, +#if PY_VERSION_HEX < 0x030600A4 + (metaclass == (PyObject*)&PyType_Type) ? NULL : mkw +#else + mkw +#endif + ); Py_XDECREF(owned_metaclass); +#if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS + if (likely(result) && likely(PyType_Check(result))) { + if (unlikely(__Pyx_SetNamesPEP487(result) < 0)) { + Py_CLEAR(result); + } else { + result = __Pyx_InitSubclassPEP487(result, mkw); + } + } +#else + (void) &__Pyx_GetBuiltinName; +#endif return result; } /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -51692,7 +62563,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -51714,6 +62585,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { @@ -51792,17 +62664,99 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + PyErr_Clear(); + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #endif +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + py_funcname = PyUnicode_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -51837,6 +62791,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -51899,13 +62854,19 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + __Pyx_TypeName obj_type_name; if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags); - PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' does not have the buffer interface", + obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { @@ -51980,19 +62941,6 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, return (start1 < end2) && (start2 < end1); } -/* Capsule */ -static CYTHON_INLINE PyObject * -__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) -{ - PyObject *cobj; -#if PY_VERSION_HEX >= 0x02070000 - cobj = PyCapsule_New(p, sig, NULL); -#else - cobj = PyCObject_FromVoidPtr(p, NULL); -#endif - return cobj; -} - /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) @@ -52102,7 +63050,7 @@ static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { case 'P': return "a pointer"; case 's': case 'p': return "a string"; case 0: return "end"; - default: return "unparseable format string"; + default: return "unparsable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { @@ -52152,7 +63100,8 @@ typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); @@ -52184,7 +63133,8 @@ typedef struct { void *x; char c; } __Pyx_pad_void_p; #ifdef HAVE_LONG_LONG typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif -static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); @@ -52349,7 +63299,7 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { ctx->is_complex = 0; return 0; } -static PyObject * +static int __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { const char *ts = *tsp; @@ -52358,9 +63308,9 @@ __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, "Cannot handle repeated arrays in format string"); - return NULL; + return -1; } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return -1; ndim = ctx->head->field->type->ndim; while (*ts && *ts != ')') { switch (*ts) { @@ -52368,29 +63318,35 @@ __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) default: break; } number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) - return PyErr_Format(PyExc_ValueError, + if (number == -1) return -1; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) { + PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %d", ctx->head->field->type->arraysize[i], number); - if (*ts != ',' && *ts != ')') - return PyErr_Format(PyExc_ValueError, + return -1; + } + if (*ts != ',' && *ts != ')') { + PyErr_Format(PyExc_ValueError, "Expected a comma in format string, got '%c'", *ts); + return -1; + } if (*ts == ',') ts++; i++; } - if (i != ndim) - return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + if (i != ndim) { + PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", ctx->head->field->type->ndim, i); + return -1; + } if (!*ts) { PyErr_SetString(PyExc_ValueError, "Unexpected end of format string, expected ')'"); - return NULL; + return -1; } ctx->is_valid_array = 1; ctx->new_count = 1; *tsp = ++ts; - return Py_None; + return 0; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; @@ -52516,7 +63472,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha ++ts; break; case '(': - if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + if (__pyx_buffmt_parse_array(ctx, &ts) < 0) return NULL; break; default: { @@ -52624,8 +63580,9 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) return 0; } static int -__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec) +__pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec) { + CYTHON_UNUSED_VAR(ndim); if (spec & __Pyx_MEMVIEW_DIRECT) { if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { PyErr_Format(PyExc_ValueError, @@ -52940,7 +63897,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) { int value = __Pyx_PyInt_As_int(obj); - if ((value == (int)-1) && PyErr_Occurred()) + if (unlikely((value == (int)-1) && PyErr_Occurred())) return 0; *(int *) itemp = value; return 1; @@ -52952,132 +63909,26 @@ static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) } static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) { double value = __pyx_PyFloat_AsDouble(obj); - if ((value == (double)-1) && PyErr_Occurred()) + if (unlikely((value == (double)-1) && PyErr_Occurred())) return 0; *(double *) itemp = value; return 1; } -/* Print */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static PyObject *__Pyx_GetStdout(void) { - PyObject *f = PySys_GetObject((char *)"stdout"); - if (!f) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); - } - return f; -} -static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - int i; - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { - PyObject* v; - if (PyFile_SoftSpace(f, 1)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - v = PyTuple_GET_ITEM(arg_tuple, i); - if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - goto error; - if (PyString_Check(v)) { - char *s = PyString_AsString(v); - Py_ssize_t len = PyString_Size(v); - if (len > 0) { - switch (s[len-1]) { - case ' ': break; - case '\f': case '\r': case '\n': case '\t': case '\v': - PyFile_SoftSpace(f, 0); - break; - default: break; - } - } - } - } - if (newline) { - if (PyFile_WriteString("\n", f) < 0) - goto error; - PyFile_SoftSpace(f, 0); - } - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; -} -#else -static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { - PyObject* kwargs = 0; - PyObject* result = 0; - PyObject* end_string; - if (unlikely(!__pyx_print)) { - __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print); - if (!__pyx_print) - return -1; - } - if (stream) { - kwargs = PyDict_New(); - if (unlikely(!kwargs)) - return -1; - if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0)) - goto bad; - if (!newline) { - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - goto bad; - if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - goto bad; - } - Py_DECREF(end_string); - } - } else if (!newline) { - if (unlikely(!__pyx_print_kwargs)) { - __pyx_print_kwargs = PyDict_New(); - if (unlikely(!__pyx_print_kwargs)) - return -1; - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - return -1; - if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - return -1; - } - Py_DECREF(end_string); - } - kwargs = __pyx_print_kwargs; - } - result = PyObject_Call(__pyx_print, arg_tuple, kwargs); - if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) - Py_DECREF(kwargs); - if (!result) - return -1; - Py_DECREF(result); - return 0; -bad: - if (kwargs != __pyx_print_kwargs) - Py_XDECREF(kwargs); - return -1; -} -#endif - /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return ::std::complex< float >(x, y); + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); } #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; z.real = x; z.imag = y; return z; @@ -53085,90 +63936,90 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else - static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } #if 1 - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { if (b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); - } else if (fabsf(b.real) >= fabsf(b.imag)) { + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabs(b.real) >= fabs(b.imag)) { if (b.real == 0 && b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { - float r = b.imag / b.real; - float s = (float)(1.0) / (b.real + b.imag * r); - return __pyx_t_float_complex_from_parts( + double r = b.imag / b.real; + double s = (double)(1.0) / (b.real + b.imag * r); + return __pyx_t_double_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { - float r = b.real / b.imag; - float s = (float)(1.0) / (b.imag + b.real * r); - return __pyx_t_float_complex_from_parts( + double r = b.real / b.imag; + double s = (double)(1.0) / (b.imag + b.real * r); + return __pyx_t_double_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } } #else - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { if (b.imag == 0) { - return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); } else { - float denom = b.real * b.real + b.imag * b.imag; - return __pyx_t_float_complex_from_parts( + double denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_double_complex_from_parts( (a.real * b.real + a.imag * b.imag) / denom, (a.imag * b.real - a.real * b.imag) / denom); } } #endif - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } - static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { + static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { - __pyx_t_float_complex z; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { + __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 - static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { + static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrtf(z.real*z.real + z.imag*z.imag); + return sqrt(z.real*z.real + z.imag*z.imag); #else - return hypotf(z.real, z.imag); + return hypot(z.real, z.imag); #endif } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float r, lnr, theta, z_r, z_theta; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { - float denom = a.real * a.real + a.imag * a.imag; + double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; @@ -53181,20 +64032,20 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { case 1: return a; case 2: - return __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_double(a, a); case 3: - z = __Pyx_c_prod_float(a, a); - return __Pyx_c_prod_float(z, a); + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, a); case 4: - z = __Pyx_c_prod_float(a, a); - return __Pyx_c_prod_float(z, z); + z = __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_double(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } else if ((b.imag == 0) && (a.real >= 0)) { - z.real = powf(a.real, b.real); + z.real = pow(a.real, b.real); z.imag = 0; return z; } else if (a.real > 0) { @@ -53202,36 +64053,36 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { theta = 0; } else { r = -a.real; - theta = atan2f(0.0, -1.0); + theta = atan2(0.0, -1.0); } } else { - r = __Pyx_c_abs_float(a); - theta = atan2f(a.imag, a.real); + r = __Pyx_c_abs_double(a); + theta = atan2(a.imag, a.real); } - lnr = logf(r); - z_r = expf(lnr * b.real - theta * b.imag); + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cosf(z_theta); - z.imag = z_r * sinf(z_theta); + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); return z; } #endif #endif /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return ::std::complex< double >(x, y); + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); } #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; z.real = x; z.imag = y; return z; @@ -53239,90 +64090,90 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else - static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } #if 1 - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { if (b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); - } else if (fabs(b.real) >= fabs(b.imag)) { + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); + } else if (fabsf(b.real) >= fabsf(b.imag)) { if (b.real == 0 && b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { - double r = b.imag / b.real; - double s = (double)(1.0) / (b.real + b.imag * r); - return __pyx_t_double_complex_from_parts( + float r = b.imag / b.real; + float s = (float)(1.0) / (b.real + b.imag * r); + return __pyx_t_float_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { - double r = b.real / b.imag; - double s = (double)(1.0) / (b.imag + b.real * r); - return __pyx_t_double_complex_from_parts( + float r = b.real / b.imag; + float s = (float)(1.0) / (b.imag + b.real * r); + return __pyx_t_float_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } } #else - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { if (b.imag == 0) { - return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); + return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); } else { - double denom = b.real * b.real + b.imag * b.imag; - return __pyx_t_double_complex_from_parts( + float denom = b.real * b.real + b.imag * b.imag; + return __pyx_t_float_complex_from_parts( (a.real * b.real + a.imag * b.imag) / denom, (a.imag * b.real - a.real * b.imag) / denom); } } #endif - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } - static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { + static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { - __pyx_t_double_complex z; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { + __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 - static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { + static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) - return sqrt(z.real*z.real + z.imag*z.imag); + return sqrtf(z.real*z.real + z.imag*z.imag); #else - return hypot(z.real, z.imag); + return hypotf(z.real, z.imag); #endif } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double r, lnr, theta, z_r, z_theta; + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { - double denom = a.real * a.real + a.imag * a.imag; + float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; @@ -53335,20 +64186,20 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { case 1: return a; case 2: - return __Pyx_c_prod_double(a, a); + return __Pyx_c_prod_float(a, a); case 3: - z = __Pyx_c_prod_double(a, a); - return __Pyx_c_prod_double(z, a); + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, a); case 4: - z = __Pyx_c_prod_double(a, a); - return __Pyx_c_prod_double(z, z); + z = __Pyx_c_prod_float(a, a); + return __Pyx_c_prod_float(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } else if ((b.imag == 0) && (a.real >= 0)) { - z.real = pow(a.real, b.real); + z.real = powf(a.real, b.real); z.imag = 0; return z; } else if (a.real > 0) { @@ -53356,17 +64207,17 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { theta = 0; } else { r = -a.real; - theta = atan2(0.0, -1.0); + theta = atan2f(0.0, -1.0); } } else { - r = __Pyx_c_abs_double(a); - theta = atan2(a.imag, a.real); + r = __Pyx_c_abs_float(a); + theta = atan2f(a.imag, a.real); } - lnr = log(r); - z_r = exp(lnr * b.real - theta * b.imag); + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; - z.real = z_r * cos(z_theta); - z.imag = z_r * sin(z_theta); + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); return z; } #endif @@ -53439,6 +64290,141 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return new_mvs; } +/* MemviewSliceInit */ + static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF(memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} +#ifndef Py_NO_RETURN +#define Py_NO_RETURN +#endif +static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -53452,7 +64438,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -53466,40 +64452,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -53512,109 +64503,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -53635,6 +64698,68 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (int) -1; } +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif + } +} + /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -53648,7 +64773,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -53662,40 +64787,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -53708,109 +64838,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -53831,44 +65033,6 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (long) -1; } -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -53902,47 +65066,34 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); - } -} - -/* PrintOne */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static int __Pyx_PrintOne(PyObject* f, PyObject *o) { - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - if (PyFile_SoftSpace(f, 0)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) - goto error; - if (PyFile_WriteString("\n", f) < 0) - goto error; - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; - /* the line below is just to avoid C compiler - * warnings about unused functions */ - return __Pyx_Print(f, NULL, 0); -} #else -static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { - int res; - PyObject* arg_tuple = PyTuple_Pack(1, o); - if (unlikely(!arg_tuple)) - return -1; - res = __Pyx_Print(stream, arg_tuple, 1); - Py_DECREF(arg_tuple); - return res; -} + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; #endif + } +} /* CIntFromPy */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { @@ -53957,7 +65108,7 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(char) < sizeof(long)) { + if ((sizeof(char) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -53971,40 +65122,45 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { - return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { - return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { - return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -54017,109 +65173,181 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { goto raise_neg_overflow; } #endif - if (sizeof(char) <= sizeof(unsigned long)) { + if ((sizeof(char) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) - case -2: - if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(char) <= sizeof(long)) { + if ((sizeof(char) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (char) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (char) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (char) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (char) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (char) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (char) -1; } } else { @@ -54140,6 +65368,22 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { return (char) -1; } +/* FormatTypeName */ + #if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name_2); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__155); + } + return name; +} +#endif + /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[5]; @@ -54170,7 +65414,7 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { rtversion[i] = rt_from_call[i]; } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -54179,9 +65423,31 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { } /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + #if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -54189,23 +65455,11 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -54267,7 +65521,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -54296,22 +65550,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -54377,13 +65635,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -54451,4 +65707,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/newanalysis/helpers/miscellaneous.pyx b/newanalysis/helpers/miscellaneous.pyx index df2f5f3..602489d 100644 --- a/newanalysis/helpers/miscellaneous.pyx +++ b/newanalysis/helpers/miscellaneous.pyx @@ -73,9 +73,9 @@ def testParallelism(int n_iterations): @cython.boundscheck(False) def countHBonds(double [:,:] coor_surr, double [:,:] coor_oh2, int nres_surr, double maxdist, double cos_angle=-0.95): # this function is designed only for water hydrogen bonds! - cdef int sites_per_res = coor_surr.shape[0] / nres_surr - cdef int nsurr = coor_surr.shape[0] / sites_per_res - cdef int nwat = coor_oh2.shape[0] / 3 + cdef int sites_per_res = coor_surr.shape[0] // nres_surr + cdef int nsurr = coor_surr.shape[0] // sites_per_res + cdef int nwat = coor_oh2.shape[0] // 3 cdef int i, j, k, l, idx, idx2, idx3 cdef int [:] hbond = np.zeros(nwat, dtype=np.int32) @@ -1000,7 +1000,7 @@ def multiVecShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, long nshells1, l cdef long nmol = len(rotTs) # number of molecules cdef long n = len(rotTs[0]) # number of time steps - cdef long startskip = (n-maxdt)/startingpoints + cdef long startskip = (n-maxdt)//startingpoints cdef double [:,:] corr = np.zeros((nshells1,maxdt)) cdef double [:,:] selfcorr = np.zeros((nshells1,maxdt)) cdef double [:,:] crosscorr = np.zeros((nshells1,maxdt)) @@ -1035,11 +1035,11 @@ def multiVecShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, long nshells1, l if ctr[i,j] != 0: corr[i,j] /= ctr[i,j] else: - print 'tot too sparse' + print('tot too sparse') if selfctr[i,j] != 0: selfcorr[i,j] /= selfctr[i,j] else: - print 'self too sparse' + print('self too sparse') for i in range(nshells1): for j in range(maxdt): @@ -1057,7 +1057,7 @@ def multiVecVennShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, int [:,:] ds cdef long nmol = len(rotTs) # number of molecules cdef long n = len(rotTs[0]) # number of time steps - cdef long startskip = (n-maxdt)/startingpoints + cdef long startskip = (n-maxdt)//startingpoints cdef double [:,:,:] corr = np.zeros((nshells1,nshells2,maxdt)) cdef double [:,:,:] selfcorr = np.zeros((nshells1,nshells2,maxdt)) cdef double [:,:,:] crosscorr = np.zeros((nshells1,nshells2,maxdt)) @@ -1094,11 +1094,11 @@ def multiVecVennShellCorrelate(double [:,:,:] rotTs, int [:,:] ds1, int [:,:] ds if ctr[i,l,j] != 0: corr[i,l,j] /= ctr[i,l,j] else: - print 'tot too sparse' + print('tot too sparse') if selfctr[i,l,j] != 0: selfcorr[i,l,j] /= selfctr[i,l,j] else: - print 'self too sparse' + print('self too sparse') for i in range(nshells1): for l in range(nshells2): @@ -1113,7 +1113,7 @@ def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int cdef long nmol = len(rotTs) # number of molecules cdef long n = len(rotTs[0]) # number of time steps # cdef long nds = len(ds) # number of steps in delaunay array - cdef long startskip = (n-maxdt)/startingpoints + cdef long startskip = (n-maxdt)//startingpoints cdef double [:,:,:,:] corr = np.zeros((12,nshells1,nshells2,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 cdef double [:,:,:,:] selfcorr = np.zeros((12,nshells1,nshells2,maxdt)) cdef double [:,:,:,:] crosscorr = np.zeros((12,nshells1,nshells2,maxdt)) @@ -1179,12 +1179,12 @@ def rotationMatrixVennShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int for k in range(12): corr[k,i,l,j] /= ctr[i,l,j] else: - print 'tot too sparse' + print('tot too sparse') if selfctr[i,l,j] != 0: for k in range(12): selfcorr[k,i,l,j] /= selfctr[i,l,j] else: - print 'self too sparse' + print('self too sparse') for i in range(nshells1): for l in range(nshells2): @@ -1201,7 +1201,7 @@ def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int cdef long nmol = len(rotTs) # number of molecules cdef long n = len(rotTs[0]) # number of time steps # cdef long nds = len(ds) # number of steps in delaunay array - cdef long startskip = (n-maxdt)/startingpoints + cdef long startskip = (n-maxdt)//startingpoints cdef double [:,:,:] corr = np.zeros((12,nshells,maxdt)) # 3x l={1,2} rotautocorr+ 3x l={1,2} rotcrosscorr = 12 cdef double [:,:,:] selfcorr = np.zeros((12,nshells,maxdt)) cdef double [:,:,:] crosscorr = np.zeros((12,nshells,maxdt)) @@ -1274,12 +1274,12 @@ def rotationMatrixMultiShellCorrelate(double [:,:,:,:] rotTs, int [:,:] ds1, int for k in range(12): corr[k,i,j] /= ctr[i,j] else: - print 'tot too sparse' + print('tot too sparse') if selfctr[i,j] != 0: for k in range(12): selfcorr[k,i,j] /= selfctr[i,j] else: - print 'self too sparse' + print('self too sparse') for i in range(nshells): for j in range(maxdt): crossctr[i,j] = ctr[i,j] - selfctr[i,j] diff --git a/newanalysis/helpers/unfold.cpp b/newanalysis/helpers/unfold.cpp index f19e48f..2cee5b9 100644 --- a/newanalysis/helpers/unfold.cpp +++ b/newanalysis/helpers/unfold.cpp @@ -1,22 +1,71 @@ -/* Generated by Cython 0.29.34 */ +/* Generated by Cython 3.0.2 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayscalars.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ufuncobject.h", + "newanalysis/helpers/BertholdHorn.h" + ], + "extra_compile_args": [ + "-fopenmp" + ], + "extra_link_args": [ + "-fopenmp" + ], + "include_dirs": [ + "newanalysis/helpers", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include" + ], + "language": "c++", + "name": "newanalysis.unfold", + "sources": [ + "newanalysis/helpers/unfold.pyx", + "newanalysis/helpers/BertholdHorn.cpp" + ] + }, + "module_name": "newanalysis.unfold" +} +END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. +#else +#if CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" #else -#define CYTHON_ABI "0_29_34" -#define CYTHON_HEX_VERSION 0x001D22F0 -#define CYTHON_FUTURE_DIVISION 0 +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_2" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030002F0 +#define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -35,9 +84,7 @@ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -45,13 +92,19 @@ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -76,10 +129,19 @@ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS @@ -89,44 +151,121 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK @@ -136,8 +275,9 @@ #endif #elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 @@ -181,16 +321,17 @@ #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -199,11 +340,8 @@ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5) + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 @@ -226,29 +364,47 @@ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) + #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #endif - #if PY_VERSION_HEX >= 0x030B00A4 + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 @@ -257,6 +413,10 @@ #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -285,6 +445,17 @@ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -298,13 +469,16 @@ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -312,28 +486,59 @@ # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -343,13 +548,26 @@ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." @@ -373,91 +591,151 @@ class __Pyx_FakeReference { T *operator->() { return ptr; } T *operator&() { return ptr; } operator T&() { return *ptr; } - template bool operator ==(U other) { return *ptr == other; } - template bool operator !=(U other) { return *ptr != other; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } private: T *ptr; }; -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + PyObject *version_info; // borrowed + PyObject *py_minor_version = NULL; + long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; - } - end: - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(call_result); - Py_XDECREF(empty); + #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 + minor_version = 11; // we don't yet need to distinguish between versions > 11 + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + Py_XDECREF(py_minor_version); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here + if (!empty_bytes) return NULL; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -471,6 +749,12 @@ class __Pyx_FakeReference { #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -485,30 +769,53 @@ class __Pyx_FakeReference { #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -517,6 +824,22 @@ class __Pyx_FakeReference { #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -547,6 +870,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -559,12 +904,69 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) +#else + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) @@ -575,10 +977,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else @@ -596,11 +998,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -611,14 +1013,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -647,8 +1055,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -658,15 +1072,33 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif #if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -678,6 +1110,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -695,11 +1130,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -744,12 +1174,17 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" #endif #define __PYX_HAVE__newanalysis__unfold @@ -757,19 +1192,18 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + #include "numpy/arrayobject.h" #include "numpy/ndarrayobject.h" #include "numpy/ndarraytypes.h" #include "numpy/arrayscalars.h" #include "numpy/ufuncobject.h" - - /* NumPy API declarations from "numpy/__init__.pxd" */ - #include #include "BertholdHorn.h" #include "pythread.h" #include -#include "pystate.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -838,9 +1272,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -848,11 +1282,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -878,7 +1323,52 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -900,7 +1390,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -965,23 +1455,19 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; /* Header.proto */ #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__)) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 @@ -999,15 +1485,28 @@ static const char *__pyx_filename; #define _Complex_I 1.0fj #endif +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { - "src/helpers/unfold.pyx", - "__init__.pxd", - "stringsource", + "newanalysis/helpers/unfold.pyx", + "", + "__init__.cython-30.pxd", "type.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + /* BufferFormatStructs.proto */ -#define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { @@ -1042,24 +1541,6 @@ typedef struct { char is_valid_array; } __Pyx_BufFmt_Context; -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - -/* MemviewSliceStruct.proto */ -struct __pyx_memoryview_obj; -typedef struct { - struct __pyx_memoryview_obj *memview; - char *data; - Py_ssize_t shape[8]; - Py_ssize_t strides[8]; - Py_ssize_t suboffsets[8]; -} __Pyx_memviewslice; -#define __Pyx_MemoryView_Len(m) (m.shape[0]) - /* Atomics.proto */ #include #ifndef CYTHON_ATOMICS @@ -1067,7 +1548,44 @@ typedef struct { #endif #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS #define __pyx_atomic_int_type int -#if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_incr_aligned(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_incr_aligned(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1) @@ -1075,10 +1593,11 @@ typedef struct { #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif -#elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL +#elif CYTHON_ATOMICS && defined(_MSC_VER) #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type long + #define __pyx_nonatomic_int_type long #pragma intrinsic (_InterlockedExchangeAdd) #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1) @@ -1092,7 +1611,6 @@ typedef struct { #warning "Not using atomics" #endif #endif -typedef volatile __pyx_atomic_int_type __pyx_atomic_int; #if CYTHON_ATOMICS #define __pyx_add_acquisition_count(memview)\ __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview)) @@ -1105,13 +1623,20 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) #endif -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +/* #### Code section: numeric_typedefs ### */ -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":689 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":730 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -1120,7 +1645,7 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":690 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":731 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -1129,7 +1654,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":691 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":732 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -1138,7 +1663,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":692 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":733 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -1147,7 +1672,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":696 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":737 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -1156,7 +1681,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":697 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":738 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -1165,7 +1690,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":698 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":739 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -1174,7 +1699,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":699 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":740 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -1183,7 +1708,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":703 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":744 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -1192,7 +1717,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":704 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":745 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -1201,61 +1726,43 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":713 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":754 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t + * */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":714 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":755 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":715 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":717 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":757 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t + * */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":718 - * - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":758 * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":719 * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":721 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":760 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1264,7 +1771,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":722 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":761 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1273,7 +1780,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":724 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":763 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1282,7 +1789,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":725 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":764 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1291,7 +1798,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":726 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":765 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1299,8 +1806,9 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* #### Code section: complex_type_declarations ### */ /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else @@ -1312,7 +1820,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else @@ -1323,6 +1831,7 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_array_obj; @@ -1330,7 +1839,7 @@ struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":728 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":767 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1339,7 +1848,7 @@ struct __pyx_memoryviewslice_obj; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":729 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":768 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1348,7 +1857,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":730 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":769 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1357,7 +1866,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":732 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":771 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1366,8 +1875,8 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1391,7 +1900,7 @@ struct __pyx_array_obj { }; -/* "View.MemoryView":280 +/* "View.MemoryView":302 * * @cname('__pyx_MemviewEnum') * cdef class Enum(object): # <<<<<<<<<<<<<< @@ -1404,10 +1913,10 @@ struct __pyx_MemviewEnum_obj { }; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1418,8 +1927,7 @@ struct __pyx_memoryview_obj { PyObject *_size; PyObject *_array_interface; PyThread_type_lock lock; - __pyx_atomic_int acquisition_count[2]; - __pyx_atomic_int *acquisition_count_aligned_p; + __pyx_atomic_int_type acquisition_count; Py_buffer view; int flags; int dtype_is_object; @@ -1427,8 +1935,8 @@ struct __pyx_memoryview_obj { }; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1444,8 +1952,8 @@ struct __pyx_memoryviewslice_obj { -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1458,10 +1966,10 @@ struct __pyx_vtabstruct_array { static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1474,12 +1982,13 @@ struct __pyx_vtabstruct_memoryview { PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); }; static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1490,6 +1999,7 @@ struct __pyx_vtabstruct__memoryviewslice { struct __pyx_vtabstruct_memoryview __pyx_base; }; static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1498,11 +2008,11 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1512,28 +2022,40 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1544,6 +2066,10 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1555,65 +2081,30 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); - -/* IsLittleEndian.proto */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); - -/* BufferFormatCheck.proto */ -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type); - -/* BufferGetAndValidate.proto */ -#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ - ((obj == Py_None || obj == NULL) ?\ - (__Pyx_ZeroBuffer(buf), 0) :\ - __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) -static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, - __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static void __Pyx_ZeroBuffer(Py_buffer* buf); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; -static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -#define __Pyx_BufPtrCContig2d(type, buf, i0, s0, i1, s1) ((type)((char*)buf + i0 * s0) + i1) /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() #endif /* PyErrFetchRestore.proto */ @@ -1625,7 +2116,7 @@ static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) @@ -1641,89 +2132,133 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) do {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); #endif -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#else + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) +#endif +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) + #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) +#else + #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op + #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs + #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array #else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS + #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) + #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) #endif +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, + const char* function_name); + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif -#if CYTHON_FAST_PYCALL - static size_t __pyx_pyframe_localsplus_offset = 0; +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL +#endif +#endif #endif /* PyObjectCall.proto */ @@ -1733,113 +2268,67 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); -#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) -#define __Pyx_BufPtrCContig1d(type, buf, i0, s0) ((type)buf + i0) -/* MemviewSliceInit.proto */ -#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d -#define __Pyx_MEMVIEW_DIRECT 1 -#define __Pyx_MEMVIEW_PTR 2 -#define __Pyx_MEMVIEW_FULL 4 -#define __Pyx_MEMVIEW_CONTIG 8 -#define __Pyx_MEMVIEW_STRIDED 16 -#define __Pyx_MEMVIEW_FOLLOW 32 -#define __Pyx_IS_C_CONTIG 1 -#define __Pyx_IS_F_CONTIG 2 -static int __Pyx_init_memviewslice( - struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference); -static CYTHON_INLINE int __pyx_add_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p) -#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview)) -#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) -#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__) -static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); +/* BuildPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char); -/* None.proto */ -static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname); +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); -#endif +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +/* JoinPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); + +/* StrEquals.proto */ +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals #else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals #endif -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +/* PyObjectFormatSimple.proto */ +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#elif PY_MAJOR_VERSION < 3 + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\ + PyObject_Format(s, f)) +#elif CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ + likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ + PyObject_Format(s, f)) #else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) #endif -/* DivInt[Py_ssize_t].proto */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); - -/* UnaryNegOverflows.proto */ -#define UNARY_NEG_WOULD_OVERFLOW(x)\ - (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) - -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ /* GetAttr.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); @@ -1866,36 +2355,107 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + /* ObjectGetItem.proto */ #if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); #else #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif -/* decode_c_string_utf16.proto */ -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 0; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = -1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); -/* decode_c_string.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) /* GetAttr3.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (1) +#elif CYTHON_COMPILING_IN_LIMITED_API || (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000) + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + /* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); @@ -1905,6 +2465,33 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* RaiseNoneIterError.proto */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) @@ -1916,20 +2503,33 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* ssize_strlen.proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); + /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { @@ -1947,43 +2547,22 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif - -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck); + +/* RaiseUnboundLocalError.proto */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); /* DivInt[long].proto */ static CYTHON_INLINE long __Pyx_div_long(long, long); @@ -2000,6 +2579,36 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* HasAttr.proto */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); +/* IsLittleEndian.proto */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); + +/* BufferFormatCheck.proto */ +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type); + +/* BufferGetAndValidate.proto */ +#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ + ((obj == Py_None || obj == NULL) ?\ + (__Pyx_ZeroBuffer(buf), 0) :\ + __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) +static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static void __Pyx_ZeroBuffer(Py_buffer* buf); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; +static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +#define __Pyx_BufPtrCContig2d(type, buf, i0, s0, i1, s1) ((type)((char*)buf + i0 * s0) + i1) +/* ErrOccurredWithGIL.proto */ +static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void); + +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) +#define __Pyx_BufPtrCContig1d(type, buf, i0, s0) ((type)buf + i0) +/* RaiseUnboundMemoryviewSliceNogil.proto */ +static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname); + /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); @@ -2014,34 +2623,202 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr #endif +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + /* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type); +#endif /* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce(PyObject* type_obj); +#endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -#if __STDC_VERSION__ >= 201112L +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_2 +#define __PYX_HAVE_RT_ImportType_proto_3_0_2 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif -#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT(s) alignof(s) +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) alignof(s) #else -#define __PYX_GET_STRUCT_ALIGNMENT(s) sizeof(void*) +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) sizeof(void*) #endif -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +enum __Pyx_ImportType_CheckSize_3_0_2 { + __Pyx_ImportType_CheckSize_Error_3_0_2 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_2 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_2 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size); +#endif + +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + typesModule = PyImport_ImportModule("types"); + if (!typesModule) return NULL; + methodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + if (!methodType) return NULL; + result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); + Py_DECREF(methodType); + return result; +} +#elif PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + void *defaults; + int defaults_pyobjects; + size_t defaults_size; // used by FusedFunction for copying defaults + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif #endif +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -2050,6 +2827,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -2063,6 +2841,7 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -2099,9 +2878,6 @@ static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, __Pyx_memviewslice *slice2, int ndim, size_t itemsize); -/* Capsule.proto */ -static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); - /* TypeInfoCompare.proto */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b); @@ -2122,11 +2898,6 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_dou /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *, int writable_flag); -/* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - /* MemviewDtypeToObject.proto */ static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp); static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj); @@ -2154,7 +2925,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_float(a, b) ((a)==(b)) #define __Pyx_c_sum_float(a, b) ((a)+(b)) #define __Pyx_c_diff_float(a, b) ((a)-(b)) @@ -2192,7 +2963,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_double(a, b) ((a)==(b)) #define __Pyx_c_sum_double(a, b) ((a)+(b)) #define __Pyx_c_diff_double(a, b) ((a)-(b)) @@ -2236,6 +3007,31 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, size_t sizeof_dtype, int contig_flag, int dtype_is_object); +/* MemviewSliceInit.proto */ +#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); @@ -2245,6 +3041,9 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value); +/* None.proto */ +#include + /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); @@ -2254,12 +3053,26 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ @@ -2268,58 +3081,46 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ -/* Module declarations from 'cpython.buffer' */ +/* Module declarations from "libc.string" */ -/* Module declarations from 'libc.string' */ +/* Module declarations from "libc.stdio" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.type" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "cpython" */ -/* Module declarations from 'cpython' */ +/* Module declarations from "cpython.object" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.ref" */ -/* Module declarations from 'cpython.ref' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'cpython.mem' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'numpy' */ +/* Module declarations from "cython.view" */ -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_generic = 0; -static PyTypeObject *__pyx_ptype_5numpy_number = 0; -static PyTypeObject *__pyx_ptype_5numpy_integer = 0; -static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_inexact = 0; -static PyTypeObject *__pyx_ptype_5numpy_floating = 0; -static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0; -static PyTypeObject *__pyx_ptype_5numpy_flexible = 0; -static PyTypeObject *__pyx_ptype_5numpy_character = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +/* Module declarations from "cython.dataclasses" */ -/* Module declarations from 'cython.view' */ +/* Module declarations from "cython" */ -/* Module declarations from 'cython' */ +/* Module declarations from "libc.math" */ -/* Module declarations from 'libc.math' */ - -/* Module declarations from 'newanalysis.unfold' */ -static PyTypeObject *__pyx_array_type = 0; -static PyTypeObject *__pyx_MemviewEnum_type = 0; -static PyTypeObject *__pyx_memoryview_type = 0; -static PyTypeObject *__pyx_memoryviewslice_type = 0; +/* Module declarations from "newanalysis.unfold" */ +static PyObject *__pyx_collections_abc_Sequence = 0; static PyObject *generic = 0; static PyObject *strided = 0; static PyObject *indirect = 0; @@ -2328,12 +3129,12 @@ static PyObject *indirect_contiguous = 0; static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; static CYTHON_INLINE int __pyx_f_11newanalysis_6unfold_sign(double); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ -static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ static PyObject *_unellipsify(PyObject *, int); /*proto*/ -static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ @@ -2351,8 +3152,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /* static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ -static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/ -static int __pyx_memoryview_err(PyObject *, char *); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ @@ -2361,24 +3163,31 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 }; +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "newanalysis.unfold" extern int __pyx_module_is_main_newanalysis__unfold; int __pyx_module_is_main_newanalysis__unfold = 0; -/* Implementation of 'newanalysis.unfold' */ +/* Implementation of "newanalysis.unfold" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_ImportError; +static PyObject *__pyx_builtin___import__; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_AssertionError; static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_ImportError; +/* #### Code section: string_decls ### */ +static const char __pyx_k_[] = ": "; static const char __pyx_k_A[] = "A"; static const char __pyx_k_B[] = "B"; static const char __pyx_k_C[] = "C"; @@ -2397,14 +3206,24 @@ static const char __pyx_k_DZ[] = "DZ"; static const char __pyx_k_T1[] = "T1"; static const char __pyx_k_T2[] = "T2"; static const char __pyx_k_T3[] = "T3"; +static const char __pyx_k__2[] = "."; +static const char __pyx_k__3[] = "*"; +static const char __pyx_k__6[] = "'"; +static const char __pyx_k__7[] = ")"; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_np[] = "np"; +static const char __pyx_k__39[] = "?"; +static const char __pyx_k_abc[] = "abc"; +static const char __pyx_k_and[] = " and "; static const char __pyx_k_apr[] = "apr"; static const char __pyx_k_auf[] = "auf"; static const char __pyx_k_com[] = "com"; +static const char __pyx_k_got[] = " (got "; static const char __pyx_k_new[] = "__new__"; static const char __pyx_k_obj[] = "obj"; static const char __pyx_k_rfa[] = "rfa"; +static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_xyz[] = "xyz"; static const char __pyx_k_base[] = "base"; static const char __pyx_k_boxl[] = "boxl"; @@ -2425,6 +3244,7 @@ static const char __pyx_k_norm[] = "norm"; static const char __pyx_k_pack[] = "pack"; static const char __pyx_k_prev[] = "prev"; static const char __pyx_k_size[] = "size"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_step[] = "step"; static const char __pyx_k_stop[] = "stop"; static const char __pyx_k_test[] = "__test__"; @@ -2438,9 +3258,11 @@ static const char __pyx_k_coor1[] = "coor1"; static const char __pyx_k_coor2[] = "coor2"; static const char __pyx_k_coorA[] = "coorA"; static const char __pyx_k_coorB[] = "coorB"; +static const char __pyx_k_count[] = "count"; static const char __pyx_k_delta[] = "delta"; static const char __pyx_k_error[] = "error"; static const char __pyx_k_flags[] = "flags"; +static const char __pyx_k_index[] = "index"; static const char __pyx_k_natom[] = "natom"; static const char __pyx_k_norm2[] = "norm2"; static const char __pyx_k_numpy[] = "numpy"; @@ -2451,6 +3273,7 @@ static const char __pyx_k_shift[] = "shift"; static const char __pyx_k_start[] = "start"; static const char __pyx_k_zeros[] = "zeros"; static const char __pyx_k_boxl34[] = "boxl34"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_import[] = "__import__"; @@ -2465,22 +3288,26 @@ static const char __pyx_k_unfold[] = "unfold"; static const char __pyx_k_unpack[] = "unpack"; static const char __pyx_k_update[] = "update"; static const char __pyx_k_asarray[] = "asarray"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_fortran[] = "fortran"; static const char __pyx_k_memview[] = "memview"; static const char __pyx_k_minDist[] = "minDist"; static const char __pyx_k_minimum[] = "minimum"; static const char __pyx_k_offdiag[] = "offdiag"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; +static const char __pyx_k_Sequence[] = "Sequence"; static const char __pyx_k_aufpunkt[] = "aufpunkt"; static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_itemsize[] = "itemsize"; static const char __pyx_k_pyx_type[] = "__pyx_type"; +static const char __pyx_k_register[] = "register"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_boxlength[] = "boxlength"; static const char __pyx_k_coor_curr[] = "coor_curr"; static const char __pyx_k_coor_prev[] = "coor_prev"; static const char __pyx_k_enumerate[] = "enumerate"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_unfoldBox[] = "unfoldBox"; @@ -2495,19 +3322,25 @@ static const char __pyx_k_xyz_unfold[] = "xyz_unfold"; static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_PickleError[] = "PickleError"; +static const char __pyx_k_collections[] = "collections"; static const char __pyx_k_coor_unfold[] = "coor_unfold"; static const char __pyx_k_findMinDist[] = "findMinDist"; static const char __pyx_k_bertholdHorn[] = "bertholdHorn"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; -static const char __pyx_k_stringsource[] = "stringsource"; -static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; +static const char __pyx_k_stringsource[] = ""; +static const char __pyx_k_version_info[] = "version_info"; +static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_xyz_traj_curr[] = "xyz_traj_curr"; static const char __pyx_k_xyz_traj_prev[] = "xyz_traj_prev"; +static const char __pyx_k_AssertionError[] = "AssertionError"; static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; static const char __pyx_k_c_xyz_traj_curr[] = "c_xyz_traj_curr"; static const char __pyx_k_c_xyz_traj_prev[] = "c_xyz_traj_prev"; +static const char __pyx_k_collections_abc[] = "collections.abc"; static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; @@ -2515,213 +3348,43 @@ static const char __pyx_k_minDistCenterBox[] = "minDistCenterBox"; static const char __pyx_k_unfoldCharmmOcta[] = "unfoldCharmmOcta"; static const char __pyx_k_atoms_per_residue[] = "atoms_per_residue"; static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_newanalysis_unfold[] = "newanalysis.unfold"; static const char __pyx_k_residue_first_atom[] = "residue_first_atom"; static const char __pyx_k_strided_and_direct[] = ""; static const char __pyx_k_strided_and_indirect[] = ""; +static const char __pyx_k_Invalid_shape_in_axis[] = "Invalid shape in axis "; static const char __pyx_k_contiguous_and_direct[] = ""; +static const char __pyx_k_Cannot_index_with_type[] = "Cannot index with type '"; static const char __pyx_k_MemoryView_of_r_object[] = ""; -static const char __pyx_k_src_helpers_unfold_pyx[] = "src/helpers/unfold.pyx"; static const char __pyx_k_MemoryView_of_r_at_0x_x[] = ""; static const char __pyx_k_contiguous_and_indirect[] = ""; -static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; -static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; +static const char __pyx_k_Dimension_d_is_not_direct[] = "Dimension %d is not direct"; +static const char __pyx_k_Index_out_of_bounds_axis_d[] = "Index out of bounds (axis %d)"; +static const char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero (axis %d)"; static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; +static const char __pyx_k_newanalysis_helpers_unfold_pyx[] = "newanalysis/helpers/unfold.pyx"; static const char __pyx_k_strided_and_direct_or_indirect[] = ""; static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; +static const char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced"; static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview"; static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview"; +static const char __pyx_k_Cannot_transpose_memoryview_with[] = "Cannot transpose memoryview with indirect dimensions"; static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; -static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))"; +static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))"; static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; -static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; -static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)"; +static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got "; +static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis "; static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; -static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)"; +static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension "; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; -static PyObject *__pyx_n_s_A; -static PyObject *__pyx_n_s_ASCII; -static PyObject *__pyx_n_s_B; -static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; -static PyObject *__pyx_n_s_C; -static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; -static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; -static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; -static PyObject *__pyx_kp_s_Cannot_index_with_type_s; -static PyObject *__pyx_n_s_D; -static PyObject *__pyx_n_s_DD; -static PyObject *__pyx_n_s_DX; -static PyObject *__pyx_n_s_DY; -static PyObject *__pyx_n_s_DZ; -static PyObject *__pyx_n_s_Ellipsis; -static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; -static PyObject *__pyx_n_s_ImportError; -static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; -static PyObject *__pyx_n_s_IndexError; -static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; -static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; -static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d; -static PyObject *__pyx_n_s_MemoryError; -static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; -static PyObject *__pyx_kp_s_MemoryView_of_r_object; -static PyObject *__pyx_n_b_O; -static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a; -static PyObject *__pyx_n_s_PickleError; -static PyObject *__pyx_n_s_R; -static PyObject *__pyx_n_s_T1; -static PyObject *__pyx_n_s_T2; -static PyObject *__pyx_n_s_T3; -static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s_View_MemoryView; -static PyObject *__pyx_n_s_allocate_buffer; -static PyObject *__pyx_n_s_apr; -static PyObject *__pyx_n_s_asarray; -static PyObject *__pyx_n_s_atoms_per_residue; -static PyObject *__pyx_n_s_auf; -static PyObject *__pyx_n_s_aufpunkt; -static PyObject *__pyx_n_s_base; -static PyObject *__pyx_n_s_bertholdHorn; -static PyObject *__pyx_n_s_boxl; -static PyObject *__pyx_n_s_boxl2; -static PyObject *__pyx_n_s_boxl34; -static PyObject *__pyx_n_s_boxlength; -static PyObject *__pyx_n_s_c; -static PyObject *__pyx_n_u_c; -static PyObject *__pyx_n_s_c_xyz_traj_curr; -static PyObject *__pyx_n_s_c_xyz_traj_prev; -static PyObject *__pyx_n_s_ccom; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_com; -static PyObject *__pyx_kp_s_contiguous_and_direct; -static PyObject *__pyx_kp_s_contiguous_and_indirect; -static PyObject *__pyx_n_s_coor; -static PyObject *__pyx_n_s_coor1; -static PyObject *__pyx_n_s_coor2; -static PyObject *__pyx_n_s_coorA; -static PyObject *__pyx_n_s_coorB; -static PyObject *__pyx_n_s_coor_curr; -static PyObject *__pyx_n_s_coor_prev; -static PyObject *__pyx_n_s_coor_unfold; -static PyObject *__pyx_n_s_copy; -static PyObject *__pyx_n_s_curr; -static PyObject *__pyx_n_s_cxyz; -static PyObject *__pyx_n_s_delta; -static PyObject *__pyx_n_s_diag; -static PyObject *__pyx_n_s_dict; -static PyObject *__pyx_n_s_dimensions; -static PyObject *__pyx_n_s_dist; -static PyObject *__pyx_n_s_dtype_is_object; -static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_enumerate; -static PyObject *__pyx_n_s_error; -static PyObject *__pyx_n_s_findMinDist; -static PyObject *__pyx_n_s_flags; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_fortran; -static PyObject *__pyx_n_u_fortran; -static PyObject *__pyx_n_s_getstate; -static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_itemsize; -static PyObject *__pyx_kp_s_itemsize_0_for_cython_array; -static PyObject *__pyx_n_s_j; -static PyObject *__pyx_n_s_k; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_memview; -static PyObject *__pyx_n_s_minDist; -static PyObject *__pyx_n_s_minDistBox; -static PyObject *__pyx_n_s_minDistCenterBox; -static PyObject *__pyx_n_s_minVec; -static PyObject *__pyx_n_s_minimum; -static PyObject *__pyx_n_s_mode; -static PyObject *__pyx_n_s_n; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_name_2; -static PyObject *__pyx_n_s_natom; -static PyObject *__pyx_n_s_ndim; -static PyObject *__pyx_n_s_new; -static PyObject *__pyx_n_s_newanalysis_unfold; -static PyObject *__pyx_n_s_nmol; -static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; -static PyObject *__pyx_n_s_norm; -static PyObject *__pyx_n_s_norm2; -static PyObject *__pyx_n_s_norm22; -static PyObject *__pyx_n_s_norm32; -static PyObject *__pyx_n_s_np; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; -static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; -static PyObject *__pyx_n_s_obj; -static PyObject *__pyx_n_s_offdiag; -static PyObject *__pyx_n_s_pack; -static PyObject *__pyx_n_s_pickle; -static PyObject *__pyx_n_s_prev; -static PyObject *__pyx_n_s_pyx_PickleError; -static PyObject *__pyx_n_s_pyx_checksum; -static PyObject *__pyx_n_s_pyx_getbuffer; -static PyObject *__pyx_n_s_pyx_result; -static PyObject *__pyx_n_s_pyx_state; -static PyObject *__pyx_n_s_pyx_type; -static PyObject *__pyx_n_s_pyx_unpickle_Enum; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_reduce; -static PyObject *__pyx_n_s_reduce_cython; -static PyObject *__pyx_n_s_reduce_ex; -static PyObject *__pyx_n_s_residue_first_atom; -static PyObject *__pyx_n_s_rfa; -static PyObject *__pyx_n_s_round; -static PyObject *__pyx_n_s_setstate; -static PyObject *__pyx_n_s_setstate_cython; -static PyObject *__pyx_n_s_shape; -static PyObject *__pyx_n_s_shift; -static PyObject *__pyx_n_s_size; -static PyObject *__pyx_kp_s_src_helpers_unfold_pyx; -static PyObject *__pyx_n_s_start; -static PyObject *__pyx_n_s_step; -static PyObject *__pyx_n_s_stop; -static PyObject *__pyx_kp_s_strided_and_direct; -static PyObject *__pyx_kp_s_strided_and_direct_or_indirect; -static PyObject *__pyx_kp_s_strided_and_indirect; -static PyObject *__pyx_kp_s_stringsource; -static PyObject *__pyx_n_s_struct; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_tmpx; -static PyObject *__pyx_n_s_tmpy; -static PyObject *__pyx_n_s_tmpz; -static PyObject *__pyx_kp_s_unable_to_allocate_array_data; -static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; -static PyObject *__pyx_n_s_unfold; -static PyObject *__pyx_n_s_unfoldBox; -static PyObject *__pyx_n_s_unfoldCharmmOcta; -static PyObject *__pyx_n_s_unfoldOcta; -static PyObject *__pyx_n_s_unpack; -static PyObject *__pyx_n_s_update; -static PyObject *__pyx_n_s_xyz; -static PyObject *__pyx_n_s_xyz_traj_curr; -static PyObject *__pyx_n_s_xyz_traj_prev; -static PyObject *__pyx_n_s_xyz_unfold; -static PyObject *__pyx_n_s_zeros; -static PyObject *__pyx_pf_11newanalysis_6unfold_unfoldBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor_unfold, PyArrayObject *__pyx_v_coor_prev, PyArrayObject *__pyx_v_coor_curr, __pyx_t_5numpy_float64_t __pyx_v_boxl); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6unfold_2unfoldOcta(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz_unfold, PyArrayObject *__pyx_v_xyz_traj_prev, PyArrayObject *__pyx_v_xyz_traj_curr, PyObject *__pyx_v_boxlength); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6unfold_4unfoldCharmmOcta(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz_unfold, PyArrayObject *__pyx_v_xyz_traj_prev, PyArrayObject *__pyx_v_xyz_traj_curr, PyArrayObject *__pyx_v_dimensions); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6unfold_6minDistBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_aufpunkt, PyArrayObject *__pyx_v_com, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_boxlength, PyArrayObject *__pyx_v_atoms_per_residue, PyArrayObject *__pyx_v_residue_first_atom); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6unfold_8minDistCenterBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_aufpunkt, PyArrayObject *__pyx_v_com, PyArrayObject *__pyx_v_coor, __pyx_t_5numpy_float64_t __pyx_v_boxl, PyArrayObject *__pyx_v_apr, PyArrayObject *__pyx_v_rfa); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6unfold_10minVec(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, double __pyx_v_boxl, double __pyx_v_boxl2); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6unfold_12minDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, double __pyx_v_boxl, double __pyx_v_boxl2); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6unfold_14findMinDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, double __pyx_v_boxl); /* proto */ -static PyObject *__pyx_pf_11newanalysis_6unfold_16bertholdHorn(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_coorA, __Pyx_memviewslice __pyx_v_coorB); /* proto */ +/* #### Code section: decls ### */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ @@ -2760,5925 +3423,6345 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6unfold_unfoldBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor_unfold, PyArrayObject *__pyx_v_coor_prev, PyArrayObject *__pyx_v_coor_curr, __pyx_t_5numpy_float64_t __pyx_v_boxl); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6unfold_2unfoldOcta(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz_unfold, PyArrayObject *__pyx_v_xyz_traj_prev, PyArrayObject *__pyx_v_xyz_traj_curr, PyObject *__pyx_v_boxlength); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6unfold_4unfoldCharmmOcta(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz_unfold, PyArrayObject *__pyx_v_xyz_traj_prev, PyArrayObject *__pyx_v_xyz_traj_curr, PyArrayObject *__pyx_v_dimensions); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6unfold_6minDistBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_aufpunkt, PyArrayObject *__pyx_v_com, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_boxlength, PyArrayObject *__pyx_v_atoms_per_residue, PyArrayObject *__pyx_v_residue_first_atom); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6unfold_8minDistCenterBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_aufpunkt, PyArrayObject *__pyx_v_com, PyArrayObject *__pyx_v_coor, __pyx_t_5numpy_float64_t __pyx_v_boxl, PyArrayObject *__pyx_v_apr, PyArrayObject *__pyx_v_rfa); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6unfold_10minVec(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, double __pyx_v_boxl, double __pyx_v_boxl2); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6unfold_12minDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, double __pyx_v_boxl, double __pyx_v_boxl2); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6unfold_14findMinDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, double __pyx_v_boxl); /* proto */ +static PyObject *__pyx_pf_11newanalysis_6unfold_16bertholdHorn(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_coorA, __Pyx_memviewslice __pyx_v_coorB); /* proto */ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_3; -static PyObject *__pyx_int_4; -static PyObject *__pyx_int_112105877; -static PyObject *__pyx_int_136983863; -static PyObject *__pyx_int_184977713; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__18; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_tuple__29; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__33; -static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__37; -static PyObject *__pyx_tuple__39; -static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__42; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__44; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__46; -static PyObject *__pyx_codeobj__24; -static PyObject *__pyx_codeobj__26; -static PyObject *__pyx_codeobj__28; -static PyObject *__pyx_codeobj__30; -static PyObject *__pyx_codeobj__32; -static PyObject *__pyx_codeobj__34; -static PyObject *__pyx_codeobj__36; -static PyObject *__pyx_codeobj__38; -static PyObject *__pyx_codeobj__40; -static PyObject *__pyx_codeobj__47; -/* Late includes */ - -/* "src/helpers/unfold.pyx":12 - * from libc.math cimport fabs, sqrt, floor, pow - * - * cdef inline int sign(double a) nogil: # <<<<<<<<<<<<<< - * return (( 0.0 < a) - (a < 0.0)) - * - */ - -static CYTHON_INLINE int __pyx_f_11newanalysis_6unfold_sign(double __pyx_v_a) { - int __pyx_r; +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4type_type; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + #endif + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + PyObject *__pyx_kp_u_; + PyObject *__pyx_n_s_A; + PyObject *__pyx_n_s_ASCII; + PyObject *__pyx_kp_s_All_dimensions_preceding_dimensi; + PyObject *__pyx_n_s_AssertionError; + PyObject *__pyx_n_s_B; + PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; + PyObject *__pyx_n_s_C; + PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; + PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; + PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; + PyObject *__pyx_kp_u_Cannot_index_with_type; + PyObject *__pyx_kp_s_Cannot_transpose_memoryview_with; + PyObject *__pyx_n_s_D; + PyObject *__pyx_n_s_DD; + PyObject *__pyx_n_s_DX; + PyObject *__pyx_n_s_DY; + PyObject *__pyx_n_s_DZ; + PyObject *__pyx_kp_s_Dimension_d_is_not_direct; + PyObject *__pyx_n_s_Ellipsis; + PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; + PyObject *__pyx_n_s_ImportError; + PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; + PyObject *__pyx_n_s_IndexError; + PyObject *__pyx_kp_s_Index_out_of_bounds_axis_d; + PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; + PyObject *__pyx_kp_u_Invalid_mode_expected_c_or_fortr; + PyObject *__pyx_kp_u_Invalid_shape_in_axis; + PyObject *__pyx_n_s_MemoryError; + PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; + PyObject *__pyx_kp_s_MemoryView_of_r_object; + PyObject *__pyx_n_b_O; + PyObject *__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + PyObject *__pyx_n_s_PickleError; + PyObject *__pyx_n_s_R; + PyObject *__pyx_n_s_Sequence; + PyObject *__pyx_kp_s_Step_may_not_be_zero_axis_d; + PyObject *__pyx_n_s_T1; + PyObject *__pyx_n_s_T2; + PyObject *__pyx_n_s_T3; + PyObject *__pyx_n_s_TypeError; + PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; + PyObject *__pyx_n_s_ValueError; + PyObject *__pyx_n_s_View_MemoryView; + PyObject *__pyx_kp_u__2; + PyObject *__pyx_n_s__3; + PyObject *__pyx_n_s__39; + PyObject *__pyx_kp_u__6; + PyObject *__pyx_kp_u__7; + PyObject *__pyx_n_s_abc; + PyObject *__pyx_n_s_allocate_buffer; + PyObject *__pyx_kp_u_and; + PyObject *__pyx_n_s_apr; + PyObject *__pyx_n_s_asarray; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_atoms_per_residue; + PyObject *__pyx_n_s_auf; + PyObject *__pyx_n_s_aufpunkt; + PyObject *__pyx_n_s_base; + PyObject *__pyx_n_s_bertholdHorn; + PyObject *__pyx_n_s_boxl; + PyObject *__pyx_n_s_boxl2; + PyObject *__pyx_n_s_boxl34; + PyObject *__pyx_n_s_boxlength; + PyObject *__pyx_n_s_c; + PyObject *__pyx_n_u_c; + PyObject *__pyx_n_s_c_xyz_traj_curr; + PyObject *__pyx_n_s_c_xyz_traj_prev; + PyObject *__pyx_n_s_ccom; + PyObject *__pyx_n_s_class; + PyObject *__pyx_n_s_class_getitem; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_collections; + PyObject *__pyx_kp_s_collections_abc; + PyObject *__pyx_n_s_com; + PyObject *__pyx_kp_s_contiguous_and_direct; + PyObject *__pyx_kp_s_contiguous_and_indirect; + PyObject *__pyx_n_s_coor; + PyObject *__pyx_n_s_coor1; + PyObject *__pyx_n_s_coor2; + PyObject *__pyx_n_s_coorA; + PyObject *__pyx_n_s_coorB; + PyObject *__pyx_n_s_coor_curr; + PyObject *__pyx_n_s_coor_prev; + PyObject *__pyx_n_s_coor_unfold; + PyObject *__pyx_n_s_copy; + PyObject *__pyx_n_s_count; + PyObject *__pyx_n_s_curr; + PyObject *__pyx_n_s_cxyz; + PyObject *__pyx_n_s_delta; + PyObject *__pyx_n_s_diag; + PyObject *__pyx_n_s_dict; + PyObject *__pyx_n_s_dimensions; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_n_s_dist; + PyObject *__pyx_n_s_dtype_is_object; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_encode; + PyObject *__pyx_n_s_enumerate; + PyObject *__pyx_n_s_error; + PyObject *__pyx_n_s_findMinDist; + PyObject *__pyx_n_s_flags; + PyObject *__pyx_n_s_format; + PyObject *__pyx_n_s_fortran; + PyObject *__pyx_n_u_fortran; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_getstate; + PyObject *__pyx_kp_u_got; + PyObject *__pyx_kp_u_got_differing_extents_in_dimensi; + PyObject *__pyx_n_s_i; + PyObject *__pyx_n_s_id; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_index; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_itemsize; + PyObject *__pyx_kp_s_itemsize_0_for_cython_array; + PyObject *__pyx_n_s_j; + PyObject *__pyx_n_s_k; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_memview; + PyObject *__pyx_n_s_minDist; + PyObject *__pyx_n_s_minDistBox; + PyObject *__pyx_n_s_minDistCenterBox; + PyObject *__pyx_n_s_minVec; + PyObject *__pyx_n_s_minimum; + PyObject *__pyx_n_s_mode; + PyObject *__pyx_n_s_n; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_name_2; + PyObject *__pyx_n_s_natom; + PyObject *__pyx_n_s_ndim; + PyObject *__pyx_n_s_new; + PyObject *__pyx_kp_s_newanalysis_helpers_unfold_pyx; + PyObject *__pyx_n_s_newanalysis_unfold; + PyObject *__pyx_n_s_nmol; + PyObject *__pyx_kp_s_no_default___reduce___due_to_non; + PyObject *__pyx_n_s_norm; + PyObject *__pyx_n_s_norm2; + PyObject *__pyx_n_s_norm22; + PyObject *__pyx_n_s_norm32; + PyObject *__pyx_n_s_np; + PyObject *__pyx_n_s_numpy; + PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; + PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; + PyObject *__pyx_n_s_obj; + PyObject *__pyx_n_s_offdiag; + PyObject *__pyx_n_s_pack; + PyObject *__pyx_n_s_pickle; + PyObject *__pyx_n_s_prev; + PyObject *__pyx_n_s_pyx_PickleError; + PyObject *__pyx_n_s_pyx_checksum; + PyObject *__pyx_n_s_pyx_result; + PyObject *__pyx_n_s_pyx_state; + PyObject *__pyx_n_s_pyx_type; + PyObject *__pyx_n_s_pyx_unpickle_Enum; + PyObject *__pyx_n_s_pyx_vtable; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_reduce; + PyObject *__pyx_n_s_reduce_cython; + PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_register; + PyObject *__pyx_n_s_residue_first_atom; + PyObject *__pyx_n_s_rfa; + PyObject *__pyx_n_s_round; + PyObject *__pyx_n_s_setstate; + PyObject *__pyx_n_s_setstate_cython; + PyObject *__pyx_n_s_shape; + PyObject *__pyx_n_s_shift; + PyObject *__pyx_n_s_size; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_start; + PyObject *__pyx_n_s_step; + PyObject *__pyx_n_s_stop; + PyObject *__pyx_kp_s_strided_and_direct; + PyObject *__pyx_kp_s_strided_and_direct_or_indirect; + PyObject *__pyx_kp_s_strided_and_indirect; + PyObject *__pyx_kp_s_stringsource; + PyObject *__pyx_n_s_struct; + PyObject *__pyx_n_s_sys; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_tmpx; + PyObject *__pyx_n_s_tmpy; + PyObject *__pyx_n_s_tmpz; + PyObject *__pyx_kp_s_unable_to_allocate_array_data; + PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; + PyObject *__pyx_n_s_unfold; + PyObject *__pyx_n_s_unfoldBox; + PyObject *__pyx_n_s_unfoldCharmmOcta; + PyObject *__pyx_n_s_unfoldOcta; + PyObject *__pyx_n_s_unpack; + PyObject *__pyx_n_s_update; + PyObject *__pyx_n_s_version_info; + PyObject *__pyx_n_s_xyz; + PyObject *__pyx_n_s_xyz_traj_curr; + PyObject *__pyx_n_s_xyz_traj_prev; + PyObject *__pyx_n_s_xyz_unfold; + PyObject *__pyx_n_s_zeros; + PyObject *__pyx_int_0; + PyObject *__pyx_int_1; + PyObject *__pyx_int_3; + PyObject *__pyx_int_4; + PyObject *__pyx_int_112105877; + PyObject *__pyx_int_136983863; + PyObject *__pyx_int_184977713; + PyObject *__pyx_int_neg_1; + PyObject *__pyx_slice__5; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__8; + PyObject *__pyx_tuple__9; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__11; + PyObject *__pyx_tuple__12; + PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__14; + PyObject *__pyx_tuple__15; + PyObject *__pyx_tuple__16; + PyObject *__pyx_tuple__17; + PyObject *__pyx_tuple__18; + PyObject *__pyx_tuple__19; + PyObject *__pyx_tuple__20; + PyObject *__pyx_tuple__22; + PyObject *__pyx_tuple__24; + PyObject *__pyx_tuple__26; + PyObject *__pyx_tuple__28; + PyObject *__pyx_tuple__30; + PyObject *__pyx_tuple__32; + PyObject *__pyx_tuple__35; + PyObject *__pyx_tuple__37; + PyObject *__pyx_codeobj__21; + PyObject *__pyx_codeobj__23; + PyObject *__pyx_codeobj__25; + PyObject *__pyx_codeobj__27; + PyObject *__pyx_codeobj__29; + PyObject *__pyx_codeobj__31; + PyObject *__pyx_codeobj__33; + PyObject *__pyx_codeobj__34; + PyObject *__pyx_codeobj__36; + PyObject *__pyx_codeobj__38; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif - /* "src/helpers/unfold.pyx":13 - * - * cdef inline int sign(double a) nogil: - * return (( 0.0 < a) - (a < 0.0)) # <<<<<<<<<<<<<< - * - * cdef extern from "BertholdHorn.h": - */ - __pyx_r = ((((double)0.0) < __pyx_v_a) - (__pyx_v_a < ((double)0.0))); - goto __pyx_L0; +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) - /* "src/helpers/unfold.pyx":12 - * from libc.math cimport fabs, sqrt, floor, pow - * - * cdef inline int sign(double a) nogil: # <<<<<<<<<<<<<< - * return (( 0.0 < a) - (a < 0.0)) - * - */ +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) - /* function exit code */ - __pyx_L0:; - return __pyx_r; +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_n_s_A); + Py_CLEAR(clear_module_state->__pyx_n_s_ASCII); + Py_CLEAR(clear_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError); + Py_CLEAR(clear_module_state->__pyx_n_s_B); + Py_CLEAR(clear_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_CLEAR(clear_module_state->__pyx_n_s_C); + Py_CLEAR(clear_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_CLEAR(clear_module_state->__pyx_n_s_D); + Py_CLEAR(clear_module_state->__pyx_n_s_DD); + Py_CLEAR(clear_module_state->__pyx_n_s_DX); + Py_CLEAR(clear_module_state->__pyx_n_s_DY); + Py_CLEAR(clear_module_state->__pyx_n_s_DZ); + Py_CLEAR(clear_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_CLEAR(clear_module_state->__pyx_n_s_Ellipsis); + Py_CLEAR(clear_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_CLEAR(clear_module_state->__pyx_n_s_ImportError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_CLEAR(clear_module_state->__pyx_n_s_IndexError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_CLEAR(clear_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_CLEAR(clear_module_state->__pyx_n_b_O); + Py_CLEAR(clear_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_R); + Py_CLEAR(clear_module_state->__pyx_n_s_Sequence); + Py_CLEAR(clear_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_CLEAR(clear_module_state->__pyx_n_s_T1); + Py_CLEAR(clear_module_state->__pyx_n_s_T2); + Py_CLEAR(clear_module_state->__pyx_n_s_T3); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); + Py_CLEAR(clear_module_state->__pyx_n_s_View_MemoryView); + Py_CLEAR(clear_module_state->__pyx_kp_u__2); + Py_CLEAR(clear_module_state->__pyx_n_s__3); + Py_CLEAR(clear_module_state->__pyx_n_s__39); + Py_CLEAR(clear_module_state->__pyx_kp_u__6); + Py_CLEAR(clear_module_state->__pyx_kp_u__7); + Py_CLEAR(clear_module_state->__pyx_n_s_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_allocate_buffer); + Py_CLEAR(clear_module_state->__pyx_kp_u_and); + Py_CLEAR(clear_module_state->__pyx_n_s_apr); + Py_CLEAR(clear_module_state->__pyx_n_s_asarray); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_atoms_per_residue); + Py_CLEAR(clear_module_state->__pyx_n_s_auf); + Py_CLEAR(clear_module_state->__pyx_n_s_aufpunkt); + Py_CLEAR(clear_module_state->__pyx_n_s_base); + Py_CLEAR(clear_module_state->__pyx_n_s_bertholdHorn); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl2); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl34); + Py_CLEAR(clear_module_state->__pyx_n_s_boxlength); + Py_CLEAR(clear_module_state->__pyx_n_s_c); + Py_CLEAR(clear_module_state->__pyx_n_u_c); + Py_CLEAR(clear_module_state->__pyx_n_s_c_xyz_traj_curr); + Py_CLEAR(clear_module_state->__pyx_n_s_c_xyz_traj_prev); + Py_CLEAR(clear_module_state->__pyx_n_s_ccom); + Py_CLEAR(clear_module_state->__pyx_n_s_class); + Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_collections); + Py_CLEAR(clear_module_state->__pyx_kp_s_collections_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_com); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_CLEAR(clear_module_state->__pyx_n_s_coor); + Py_CLEAR(clear_module_state->__pyx_n_s_coor1); + Py_CLEAR(clear_module_state->__pyx_n_s_coor2); + Py_CLEAR(clear_module_state->__pyx_n_s_coorA); + Py_CLEAR(clear_module_state->__pyx_n_s_coorB); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_curr); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_prev); + Py_CLEAR(clear_module_state->__pyx_n_s_coor_unfold); + Py_CLEAR(clear_module_state->__pyx_n_s_copy); + Py_CLEAR(clear_module_state->__pyx_n_s_count); + Py_CLEAR(clear_module_state->__pyx_n_s_curr); + Py_CLEAR(clear_module_state->__pyx_n_s_cxyz); + Py_CLEAR(clear_module_state->__pyx_n_s_delta); + Py_CLEAR(clear_module_state->__pyx_n_s_diag); + Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_n_s_dimensions); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_dist); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype_is_object); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); + Py_CLEAR(clear_module_state->__pyx_n_s_error); + Py_CLEAR(clear_module_state->__pyx_n_s_findMinDist); + Py_CLEAR(clear_module_state->__pyx_n_s_flags); + Py_CLEAR(clear_module_state->__pyx_n_s_format); + Py_CLEAR(clear_module_state->__pyx_n_s_fortran); + Py_CLEAR(clear_module_state->__pyx_n_u_fortran); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_kp_u_got); + Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_i); + Py_CLEAR(clear_module_state->__pyx_n_s_id); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_index); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_itemsize); + Py_CLEAR(clear_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_CLEAR(clear_module_state->__pyx_n_s_j); + Py_CLEAR(clear_module_state->__pyx_n_s_k); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_memview); + Py_CLEAR(clear_module_state->__pyx_n_s_minDist); + Py_CLEAR(clear_module_state->__pyx_n_s_minDistBox); + Py_CLEAR(clear_module_state->__pyx_n_s_minDistCenterBox); + Py_CLEAR(clear_module_state->__pyx_n_s_minVec); + Py_CLEAR(clear_module_state->__pyx_n_s_minimum); + Py_CLEAR(clear_module_state->__pyx_n_s_mode); + Py_CLEAR(clear_module_state->__pyx_n_s_n); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_name_2); + Py_CLEAR(clear_module_state->__pyx_n_s_natom); + Py_CLEAR(clear_module_state->__pyx_n_s_ndim); + Py_CLEAR(clear_module_state->__pyx_n_s_new); + Py_CLEAR(clear_module_state->__pyx_kp_s_newanalysis_helpers_unfold_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_newanalysis_unfold); + Py_CLEAR(clear_module_state->__pyx_n_s_nmol); + Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_CLEAR(clear_module_state->__pyx_n_s_norm); + Py_CLEAR(clear_module_state->__pyx_n_s_norm2); + Py_CLEAR(clear_module_state->__pyx_n_s_norm22); + Py_CLEAR(clear_module_state->__pyx_n_s_norm32); + Py_CLEAR(clear_module_state->__pyx_n_s_np); + Py_CLEAR(clear_module_state->__pyx_n_s_numpy); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_CLEAR(clear_module_state->__pyx_n_s_obj); + Py_CLEAR(clear_module_state->__pyx_n_s_offdiag); + Py_CLEAR(clear_module_state->__pyx_n_s_pack); + Py_CLEAR(clear_module_state->__pyx_n_s_pickle); + Py_CLEAR(clear_module_state->__pyx_n_s_prev); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_register); + Py_CLEAR(clear_module_state->__pyx_n_s_residue_first_atom); + Py_CLEAR(clear_module_state->__pyx_n_s_rfa); + Py_CLEAR(clear_module_state->__pyx_n_s_round); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_shape); + Py_CLEAR(clear_module_state->__pyx_n_s_shift); + Py_CLEAR(clear_module_state->__pyx_n_s_size); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_start); + Py_CLEAR(clear_module_state->__pyx_n_s_step); + Py_CLEAR(clear_module_state->__pyx_n_s_stop); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_struct); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_tmpx); + Py_CLEAR(clear_module_state->__pyx_n_s_tmpy); + Py_CLEAR(clear_module_state->__pyx_n_s_tmpz); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_CLEAR(clear_module_state->__pyx_n_s_unfold); + Py_CLEAR(clear_module_state->__pyx_n_s_unfoldBox); + Py_CLEAR(clear_module_state->__pyx_n_s_unfoldCharmmOcta); + Py_CLEAR(clear_module_state->__pyx_n_s_unfoldOcta); + Py_CLEAR(clear_module_state->__pyx_n_s_unpack); + Py_CLEAR(clear_module_state->__pyx_n_s_update); + Py_CLEAR(clear_module_state->__pyx_n_s_version_info); + Py_CLEAR(clear_module_state->__pyx_n_s_xyz); + Py_CLEAR(clear_module_state->__pyx_n_s_xyz_traj_curr); + Py_CLEAR(clear_module_state->__pyx_n_s_xyz_traj_prev); + Py_CLEAR(clear_module_state->__pyx_n_s_xyz_unfold); + Py_CLEAR(clear_module_state->__pyx_n_s_zeros); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_3); + Py_CLEAR(clear_module_state->__pyx_int_4); + Py_CLEAR(clear_module_state->__pyx_int_112105877); + Py_CLEAR(clear_module_state->__pyx_int_136983863); + Py_CLEAR(clear_module_state->__pyx_int_184977713); + Py_CLEAR(clear_module_state->__pyx_int_neg_1); + Py_CLEAR(clear_module_state->__pyx_slice__5); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_tuple__9); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__14); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__16); + Py_CLEAR(clear_module_state->__pyx_tuple__17); + Py_CLEAR(clear_module_state->__pyx_tuple__18); + Py_CLEAR(clear_module_state->__pyx_tuple__19); + Py_CLEAR(clear_module_state->__pyx_tuple__20); + Py_CLEAR(clear_module_state->__pyx_tuple__22); + Py_CLEAR(clear_module_state->__pyx_tuple__24); + Py_CLEAR(clear_module_state->__pyx_tuple__26); + Py_CLEAR(clear_module_state->__pyx_tuple__28); + Py_CLEAR(clear_module_state->__pyx_tuple__30); + Py_CLEAR(clear_module_state->__pyx_tuple__32); + Py_CLEAR(clear_module_state->__pyx_tuple__35); + Py_CLEAR(clear_module_state->__pyx_tuple__37); + Py_CLEAR(clear_module_state->__pyx_codeobj__21); + Py_CLEAR(clear_module_state->__pyx_codeobj__23); + Py_CLEAR(clear_module_state->__pyx_codeobj__25); + Py_CLEAR(clear_module_state->__pyx_codeobj__27); + Py_CLEAR(clear_module_state->__pyx_codeobj__29); + Py_CLEAR(clear_module_state->__pyx_codeobj__31); + Py_CLEAR(clear_module_state->__pyx_codeobj__33); + Py_CLEAR(clear_module_state->__pyx_codeobj__34); + Py_CLEAR(clear_module_state->__pyx_codeobj__36); + Py_CLEAR(clear_module_state->__pyx_codeobj__38); + return 0; } - -/* "src/helpers/unfold.pyx":19 +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_n_s_A); + Py_VISIT(traverse_module_state->__pyx_n_s_ASCII); + Py_VISIT(traverse_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError); + Py_VISIT(traverse_module_state->__pyx_n_s_B); + Py_VISIT(traverse_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_VISIT(traverse_module_state->__pyx_n_s_C); + Py_VISIT(traverse_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_VISIT(traverse_module_state->__pyx_n_s_D); + Py_VISIT(traverse_module_state->__pyx_n_s_DD); + Py_VISIT(traverse_module_state->__pyx_n_s_DX); + Py_VISIT(traverse_module_state->__pyx_n_s_DY); + Py_VISIT(traverse_module_state->__pyx_n_s_DZ); + Py_VISIT(traverse_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_VISIT(traverse_module_state->__pyx_n_s_Ellipsis); + Py_VISIT(traverse_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_VISIT(traverse_module_state->__pyx_n_s_ImportError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_VISIT(traverse_module_state->__pyx_n_s_IndexError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_VISIT(traverse_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_VISIT(traverse_module_state->__pyx_n_b_O); + Py_VISIT(traverse_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_R); + Py_VISIT(traverse_module_state->__pyx_n_s_Sequence); + Py_VISIT(traverse_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_VISIT(traverse_module_state->__pyx_n_s_T1); + Py_VISIT(traverse_module_state->__pyx_n_s_T2); + Py_VISIT(traverse_module_state->__pyx_n_s_T3); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); + Py_VISIT(traverse_module_state->__pyx_n_s_View_MemoryView); + Py_VISIT(traverse_module_state->__pyx_kp_u__2); + Py_VISIT(traverse_module_state->__pyx_n_s__3); + Py_VISIT(traverse_module_state->__pyx_n_s__39); + Py_VISIT(traverse_module_state->__pyx_kp_u__6); + Py_VISIT(traverse_module_state->__pyx_kp_u__7); + Py_VISIT(traverse_module_state->__pyx_n_s_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_allocate_buffer); + Py_VISIT(traverse_module_state->__pyx_kp_u_and); + Py_VISIT(traverse_module_state->__pyx_n_s_apr); + Py_VISIT(traverse_module_state->__pyx_n_s_asarray); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_atoms_per_residue); + Py_VISIT(traverse_module_state->__pyx_n_s_auf); + Py_VISIT(traverse_module_state->__pyx_n_s_aufpunkt); + Py_VISIT(traverse_module_state->__pyx_n_s_base); + Py_VISIT(traverse_module_state->__pyx_n_s_bertholdHorn); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl2); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl34); + Py_VISIT(traverse_module_state->__pyx_n_s_boxlength); + Py_VISIT(traverse_module_state->__pyx_n_s_c); + Py_VISIT(traverse_module_state->__pyx_n_u_c); + Py_VISIT(traverse_module_state->__pyx_n_s_c_xyz_traj_curr); + Py_VISIT(traverse_module_state->__pyx_n_s_c_xyz_traj_prev); + Py_VISIT(traverse_module_state->__pyx_n_s_ccom); + Py_VISIT(traverse_module_state->__pyx_n_s_class); + Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_collections); + Py_VISIT(traverse_module_state->__pyx_kp_s_collections_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_com); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_VISIT(traverse_module_state->__pyx_n_s_coor); + Py_VISIT(traverse_module_state->__pyx_n_s_coor1); + Py_VISIT(traverse_module_state->__pyx_n_s_coor2); + Py_VISIT(traverse_module_state->__pyx_n_s_coorA); + Py_VISIT(traverse_module_state->__pyx_n_s_coorB); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_curr); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_prev); + Py_VISIT(traverse_module_state->__pyx_n_s_coor_unfold); + Py_VISIT(traverse_module_state->__pyx_n_s_copy); + Py_VISIT(traverse_module_state->__pyx_n_s_count); + Py_VISIT(traverse_module_state->__pyx_n_s_curr); + Py_VISIT(traverse_module_state->__pyx_n_s_cxyz); + Py_VISIT(traverse_module_state->__pyx_n_s_delta); + Py_VISIT(traverse_module_state->__pyx_n_s_diag); + Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_n_s_dimensions); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_dist); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype_is_object); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); + Py_VISIT(traverse_module_state->__pyx_n_s_error); + Py_VISIT(traverse_module_state->__pyx_n_s_findMinDist); + Py_VISIT(traverse_module_state->__pyx_n_s_flags); + Py_VISIT(traverse_module_state->__pyx_n_s_format); + Py_VISIT(traverse_module_state->__pyx_n_s_fortran); + Py_VISIT(traverse_module_state->__pyx_n_u_fortran); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_kp_u_got); + Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_i); + Py_VISIT(traverse_module_state->__pyx_n_s_id); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_index); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_itemsize); + Py_VISIT(traverse_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_VISIT(traverse_module_state->__pyx_n_s_j); + Py_VISIT(traverse_module_state->__pyx_n_s_k); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_memview); + Py_VISIT(traverse_module_state->__pyx_n_s_minDist); + Py_VISIT(traverse_module_state->__pyx_n_s_minDistBox); + Py_VISIT(traverse_module_state->__pyx_n_s_minDistCenterBox); + Py_VISIT(traverse_module_state->__pyx_n_s_minVec); + Py_VISIT(traverse_module_state->__pyx_n_s_minimum); + Py_VISIT(traverse_module_state->__pyx_n_s_mode); + Py_VISIT(traverse_module_state->__pyx_n_s_n); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_name_2); + Py_VISIT(traverse_module_state->__pyx_n_s_natom); + Py_VISIT(traverse_module_state->__pyx_n_s_ndim); + Py_VISIT(traverse_module_state->__pyx_n_s_new); + Py_VISIT(traverse_module_state->__pyx_kp_s_newanalysis_helpers_unfold_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_newanalysis_unfold); + Py_VISIT(traverse_module_state->__pyx_n_s_nmol); + Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_VISIT(traverse_module_state->__pyx_n_s_norm); + Py_VISIT(traverse_module_state->__pyx_n_s_norm2); + Py_VISIT(traverse_module_state->__pyx_n_s_norm22); + Py_VISIT(traverse_module_state->__pyx_n_s_norm32); + Py_VISIT(traverse_module_state->__pyx_n_s_np); + Py_VISIT(traverse_module_state->__pyx_n_s_numpy); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_VISIT(traverse_module_state->__pyx_n_s_obj); + Py_VISIT(traverse_module_state->__pyx_n_s_offdiag); + Py_VISIT(traverse_module_state->__pyx_n_s_pack); + Py_VISIT(traverse_module_state->__pyx_n_s_pickle); + Py_VISIT(traverse_module_state->__pyx_n_s_prev); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_register); + Py_VISIT(traverse_module_state->__pyx_n_s_residue_first_atom); + Py_VISIT(traverse_module_state->__pyx_n_s_rfa); + Py_VISIT(traverse_module_state->__pyx_n_s_round); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_shape); + Py_VISIT(traverse_module_state->__pyx_n_s_shift); + Py_VISIT(traverse_module_state->__pyx_n_s_size); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_start); + Py_VISIT(traverse_module_state->__pyx_n_s_step); + Py_VISIT(traverse_module_state->__pyx_n_s_stop); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_struct); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_tmpx); + Py_VISIT(traverse_module_state->__pyx_n_s_tmpy); + Py_VISIT(traverse_module_state->__pyx_n_s_tmpz); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_VISIT(traverse_module_state->__pyx_n_s_unfold); + Py_VISIT(traverse_module_state->__pyx_n_s_unfoldBox); + Py_VISIT(traverse_module_state->__pyx_n_s_unfoldCharmmOcta); + Py_VISIT(traverse_module_state->__pyx_n_s_unfoldOcta); + Py_VISIT(traverse_module_state->__pyx_n_s_unpack); + Py_VISIT(traverse_module_state->__pyx_n_s_update); + Py_VISIT(traverse_module_state->__pyx_n_s_version_info); + Py_VISIT(traverse_module_state->__pyx_n_s_xyz); + Py_VISIT(traverse_module_state->__pyx_n_s_xyz_traj_curr); + Py_VISIT(traverse_module_state->__pyx_n_s_xyz_traj_prev); + Py_VISIT(traverse_module_state->__pyx_n_s_xyz_unfold); + Py_VISIT(traverse_module_state->__pyx_n_s_zeros); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_3); + Py_VISIT(traverse_module_state->__pyx_int_4); + Py_VISIT(traverse_module_state->__pyx_int_112105877); + Py_VISIT(traverse_module_state->__pyx_int_136983863); + Py_VISIT(traverse_module_state->__pyx_int_184977713); + Py_VISIT(traverse_module_state->__pyx_int_neg_1); + Py_VISIT(traverse_module_state->__pyx_slice__5); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_tuple__9); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__14); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__16); + Py_VISIT(traverse_module_state->__pyx_tuple__17); + Py_VISIT(traverse_module_state->__pyx_tuple__18); + Py_VISIT(traverse_module_state->__pyx_tuple__19); + Py_VISIT(traverse_module_state->__pyx_tuple__20); + Py_VISIT(traverse_module_state->__pyx_tuple__22); + Py_VISIT(traverse_module_state->__pyx_tuple__24); + Py_VISIT(traverse_module_state->__pyx_tuple__26); + Py_VISIT(traverse_module_state->__pyx_tuple__28); + Py_VISIT(traverse_module_state->__pyx_tuple__30); + Py_VISIT(traverse_module_state->__pyx_tuple__32); + Py_VISIT(traverse_module_state->__pyx_tuple__35); + Py_VISIT(traverse_module_state->__pyx_tuple__37); + Py_VISIT(traverse_module_state->__pyx_codeobj__21); + Py_VISIT(traverse_module_state->__pyx_codeobj__23); + Py_VISIT(traverse_module_state->__pyx_codeobj__25); + Py_VISIT(traverse_module_state->__pyx_codeobj__27); + Py_VISIT(traverse_module_state->__pyx_codeobj__29); + Py_VISIT(traverse_module_state->__pyx_codeobj__31); + Py_VISIT(traverse_module_state->__pyx_codeobj__33); + Py_VISIT(traverse_module_state->__pyx_codeobj__34); + Py_VISIT(traverse_module_state->__pyx_codeobj__36); + Py_VISIT(traverse_module_state->__pyx_codeobj__38); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_5numpy_dtype __pyx_mstate_global->__pyx_ptype_5numpy_dtype +#define __pyx_ptype_5numpy_flatiter __pyx_mstate_global->__pyx_ptype_5numpy_flatiter +#define __pyx_ptype_5numpy_broadcast __pyx_mstate_global->__pyx_ptype_5numpy_broadcast +#define __pyx_ptype_5numpy_ndarray __pyx_mstate_global->__pyx_ptype_5numpy_ndarray +#define __pyx_ptype_5numpy_generic __pyx_mstate_global->__pyx_ptype_5numpy_generic +#define __pyx_ptype_5numpy_number __pyx_mstate_global->__pyx_ptype_5numpy_number +#define __pyx_ptype_5numpy_integer __pyx_mstate_global->__pyx_ptype_5numpy_integer +#define __pyx_ptype_5numpy_signedinteger __pyx_mstate_global->__pyx_ptype_5numpy_signedinteger +#define __pyx_ptype_5numpy_unsignedinteger __pyx_mstate_global->__pyx_ptype_5numpy_unsignedinteger +#define __pyx_ptype_5numpy_inexact __pyx_mstate_global->__pyx_ptype_5numpy_inexact +#define __pyx_ptype_5numpy_floating __pyx_mstate_global->__pyx_ptype_5numpy_floating +#define __pyx_ptype_5numpy_complexfloating __pyx_mstate_global->__pyx_ptype_5numpy_complexfloating +#define __pyx_ptype_5numpy_flexible __pyx_mstate_global->__pyx_ptype_5numpy_flexible +#define __pyx_ptype_5numpy_character __pyx_mstate_global->__pyx_ptype_5numpy_character +#define __pyx_ptype_5numpy_ufunc __pyx_mstate_global->__pyx_ptype_5numpy_ufunc +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type___pyx_array __pyx_mstate_global->__pyx_type___pyx_array +#define __pyx_type___pyx_MemviewEnum __pyx_mstate_global->__pyx_type___pyx_MemviewEnum +#define __pyx_type___pyx_memoryview __pyx_mstate_global->__pyx_type___pyx_memoryview +#define __pyx_type___pyx_memoryviewslice __pyx_mstate_global->__pyx_type___pyx_memoryviewslice +#endif +#define __pyx_array_type __pyx_mstate_global->__pyx_array_type +#define __pyx_MemviewEnum_type __pyx_mstate_global->__pyx_MemviewEnum_type +#define __pyx_memoryview_type __pyx_mstate_global->__pyx_memoryview_type +#define __pyx_memoryviewslice_type __pyx_mstate_global->__pyx_memoryviewslice_type +#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_n_s_A __pyx_mstate_global->__pyx_n_s_A +#define __pyx_n_s_ASCII __pyx_mstate_global->__pyx_n_s_ASCII +#define __pyx_kp_s_All_dimensions_preceding_dimensi __pyx_mstate_global->__pyx_kp_s_All_dimensions_preceding_dimensi +#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError +#define __pyx_n_s_B __pyx_mstate_global->__pyx_n_s_B +#define __pyx_kp_s_Buffer_view_does_not_expose_stri __pyx_mstate_global->__pyx_kp_s_Buffer_view_does_not_expose_stri +#define __pyx_n_s_C __pyx_mstate_global->__pyx_n_s_C +#define __pyx_kp_s_Can_only_create_a_buffer_that_is __pyx_mstate_global->__pyx_kp_s_Can_only_create_a_buffer_that_is +#define __pyx_kp_s_Cannot_assign_to_read_only_memor __pyx_mstate_global->__pyx_kp_s_Cannot_assign_to_read_only_memor +#define __pyx_kp_s_Cannot_create_writable_memory_vi __pyx_mstate_global->__pyx_kp_s_Cannot_create_writable_memory_vi +#define __pyx_kp_u_Cannot_index_with_type __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type +#define __pyx_kp_s_Cannot_transpose_memoryview_with __pyx_mstate_global->__pyx_kp_s_Cannot_transpose_memoryview_with +#define __pyx_n_s_D __pyx_mstate_global->__pyx_n_s_D +#define __pyx_n_s_DD __pyx_mstate_global->__pyx_n_s_DD +#define __pyx_n_s_DX __pyx_mstate_global->__pyx_n_s_DX +#define __pyx_n_s_DY __pyx_mstate_global->__pyx_n_s_DY +#define __pyx_n_s_DZ __pyx_mstate_global->__pyx_n_s_DZ +#define __pyx_kp_s_Dimension_d_is_not_direct __pyx_mstate_global->__pyx_kp_s_Dimension_d_is_not_direct +#define __pyx_n_s_Ellipsis __pyx_mstate_global->__pyx_n_s_Ellipsis +#define __pyx_kp_s_Empty_shape_tuple_for_cython_arr __pyx_mstate_global->__pyx_kp_s_Empty_shape_tuple_for_cython_arr +#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError +#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 +#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError +#define __pyx_kp_s_Index_out_of_bounds_axis_d __pyx_mstate_global->__pyx_kp_s_Index_out_of_bounds_axis_d +#define __pyx_kp_s_Indirect_dimensions_not_supporte __pyx_mstate_global->__pyx_kp_s_Indirect_dimensions_not_supporte +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis +#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError +#define __pyx_kp_s_MemoryView_of_r_at_0x_x __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_at_0x_x +#define __pyx_kp_s_MemoryView_of_r_object __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_object +#define __pyx_n_b_O __pyx_mstate_global->__pyx_n_b_O +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a +#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError +#define __pyx_n_s_R __pyx_mstate_global->__pyx_n_s_R +#define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence +#define __pyx_kp_s_Step_may_not_be_zero_axis_d __pyx_mstate_global->__pyx_kp_s_Step_may_not_be_zero_axis_d +#define __pyx_n_s_T1 __pyx_mstate_global->__pyx_n_s_T1 +#define __pyx_n_s_T2 __pyx_mstate_global->__pyx_n_s_T2 +#define __pyx_n_s_T3 __pyx_mstate_global->__pyx_n_s_T3 +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_kp_s_Unable_to_convert_item_to_object __pyx_mstate_global->__pyx_kp_s_Unable_to_convert_item_to_object +#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError +#define __pyx_n_s_View_MemoryView __pyx_mstate_global->__pyx_n_s_View_MemoryView +#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 +#define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3 +#define __pyx_n_s__39 __pyx_mstate_global->__pyx_n_s__39 +#define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6 +#define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7 +#define __pyx_n_s_abc __pyx_mstate_global->__pyx_n_s_abc +#define __pyx_n_s_allocate_buffer __pyx_mstate_global->__pyx_n_s_allocate_buffer +#define __pyx_kp_u_and __pyx_mstate_global->__pyx_kp_u_and +#define __pyx_n_s_apr __pyx_mstate_global->__pyx_n_s_apr +#define __pyx_n_s_asarray __pyx_mstate_global->__pyx_n_s_asarray +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_atoms_per_residue __pyx_mstate_global->__pyx_n_s_atoms_per_residue +#define __pyx_n_s_auf __pyx_mstate_global->__pyx_n_s_auf +#define __pyx_n_s_aufpunkt __pyx_mstate_global->__pyx_n_s_aufpunkt +#define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base +#define __pyx_n_s_bertholdHorn __pyx_mstate_global->__pyx_n_s_bertholdHorn +#define __pyx_n_s_boxl __pyx_mstate_global->__pyx_n_s_boxl +#define __pyx_n_s_boxl2 __pyx_mstate_global->__pyx_n_s_boxl2 +#define __pyx_n_s_boxl34 __pyx_mstate_global->__pyx_n_s_boxl34 +#define __pyx_n_s_boxlength __pyx_mstate_global->__pyx_n_s_boxlength +#define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c +#define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c +#define __pyx_n_s_c_xyz_traj_curr __pyx_mstate_global->__pyx_n_s_c_xyz_traj_curr +#define __pyx_n_s_c_xyz_traj_prev __pyx_mstate_global->__pyx_n_s_c_xyz_traj_prev +#define __pyx_n_s_ccom __pyx_mstate_global->__pyx_n_s_ccom +#define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class +#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections +#define __pyx_kp_s_collections_abc __pyx_mstate_global->__pyx_kp_s_collections_abc +#define __pyx_n_s_com __pyx_mstate_global->__pyx_n_s_com +#define __pyx_kp_s_contiguous_and_direct __pyx_mstate_global->__pyx_kp_s_contiguous_and_direct +#define __pyx_kp_s_contiguous_and_indirect __pyx_mstate_global->__pyx_kp_s_contiguous_and_indirect +#define __pyx_n_s_coor __pyx_mstate_global->__pyx_n_s_coor +#define __pyx_n_s_coor1 __pyx_mstate_global->__pyx_n_s_coor1 +#define __pyx_n_s_coor2 __pyx_mstate_global->__pyx_n_s_coor2 +#define __pyx_n_s_coorA __pyx_mstate_global->__pyx_n_s_coorA +#define __pyx_n_s_coorB __pyx_mstate_global->__pyx_n_s_coorB +#define __pyx_n_s_coor_curr __pyx_mstate_global->__pyx_n_s_coor_curr +#define __pyx_n_s_coor_prev __pyx_mstate_global->__pyx_n_s_coor_prev +#define __pyx_n_s_coor_unfold __pyx_mstate_global->__pyx_n_s_coor_unfold +#define __pyx_n_s_copy __pyx_mstate_global->__pyx_n_s_copy +#define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count +#define __pyx_n_s_curr __pyx_mstate_global->__pyx_n_s_curr +#define __pyx_n_s_cxyz __pyx_mstate_global->__pyx_n_s_cxyz +#define __pyx_n_s_delta __pyx_mstate_global->__pyx_n_s_delta +#define __pyx_n_s_diag __pyx_mstate_global->__pyx_n_s_diag +#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_n_s_dimensions __pyx_mstate_global->__pyx_n_s_dimensions +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_dist __pyx_mstate_global->__pyx_n_s_dist +#define __pyx_n_s_dtype_is_object __pyx_mstate_global->__pyx_n_s_dtype_is_object +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate +#define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error +#define __pyx_n_s_findMinDist __pyx_mstate_global->__pyx_n_s_findMinDist +#define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags +#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format +#define __pyx_n_s_fortran __pyx_mstate_global->__pyx_n_s_fortran +#define __pyx_n_u_fortran __pyx_mstate_global->__pyx_n_u_fortran +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi +#define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i +#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_itemsize __pyx_mstate_global->__pyx_n_s_itemsize +#define __pyx_kp_s_itemsize_0_for_cython_array __pyx_mstate_global->__pyx_kp_s_itemsize_0_for_cython_array +#define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j +#define __pyx_n_s_k __pyx_mstate_global->__pyx_n_s_k +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_memview __pyx_mstate_global->__pyx_n_s_memview +#define __pyx_n_s_minDist __pyx_mstate_global->__pyx_n_s_minDist +#define __pyx_n_s_minDistBox __pyx_mstate_global->__pyx_n_s_minDistBox +#define __pyx_n_s_minDistCenterBox __pyx_mstate_global->__pyx_n_s_minDistCenterBox +#define __pyx_n_s_minVec __pyx_mstate_global->__pyx_n_s_minVec +#define __pyx_n_s_minimum __pyx_mstate_global->__pyx_n_s_minimum +#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode +#define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 +#define __pyx_n_s_natom __pyx_mstate_global->__pyx_n_s_natom +#define __pyx_n_s_ndim __pyx_mstate_global->__pyx_n_s_ndim +#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new +#define __pyx_kp_s_newanalysis_helpers_unfold_pyx __pyx_mstate_global->__pyx_kp_s_newanalysis_helpers_unfold_pyx +#define __pyx_n_s_newanalysis_unfold __pyx_mstate_global->__pyx_n_s_newanalysis_unfold +#define __pyx_n_s_nmol __pyx_mstate_global->__pyx_n_s_nmol +#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non +#define __pyx_n_s_norm __pyx_mstate_global->__pyx_n_s_norm +#define __pyx_n_s_norm2 __pyx_mstate_global->__pyx_n_s_norm2 +#define __pyx_n_s_norm22 __pyx_mstate_global->__pyx_n_s_norm22 +#define __pyx_n_s_norm32 __pyx_mstate_global->__pyx_n_s_norm32 +#define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np +#define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy +#define __pyx_kp_s_numpy_core_multiarray_failed_to __pyx_mstate_global->__pyx_kp_s_numpy_core_multiarray_failed_to +#define __pyx_kp_s_numpy_core_umath_failed_to_impor __pyx_mstate_global->__pyx_kp_s_numpy_core_umath_failed_to_impor +#define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj +#define __pyx_n_s_offdiag __pyx_mstate_global->__pyx_n_s_offdiag +#define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack +#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle +#define __pyx_n_s_prev __pyx_mstate_global->__pyx_n_s_prev +#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError +#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum +#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type +#define __pyx_n_s_pyx_unpickle_Enum __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Enum +#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce +#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython +#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register +#define __pyx_n_s_residue_first_atom __pyx_mstate_global->__pyx_n_s_residue_first_atom +#define __pyx_n_s_rfa __pyx_mstate_global->__pyx_n_s_rfa +#define __pyx_n_s_round __pyx_mstate_global->__pyx_n_s_round +#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate +#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython +#define __pyx_n_s_shape __pyx_mstate_global->__pyx_n_s_shape +#define __pyx_n_s_shift __pyx_mstate_global->__pyx_n_s_shift +#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start +#define __pyx_n_s_step __pyx_mstate_global->__pyx_n_s_step +#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop +#define __pyx_kp_s_strided_and_direct __pyx_mstate_global->__pyx_kp_s_strided_and_direct +#define __pyx_kp_s_strided_and_direct_or_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_direct_or_indirect +#define __pyx_kp_s_strided_and_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_indirect +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_tmpx __pyx_mstate_global->__pyx_n_s_tmpx +#define __pyx_n_s_tmpy __pyx_mstate_global->__pyx_n_s_tmpy +#define __pyx_n_s_tmpz __pyx_mstate_global->__pyx_n_s_tmpz +#define __pyx_kp_s_unable_to_allocate_array_data __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_array_data +#define __pyx_kp_s_unable_to_allocate_shape_and_str __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_shape_and_str +#define __pyx_n_s_unfold __pyx_mstate_global->__pyx_n_s_unfold +#define __pyx_n_s_unfoldBox __pyx_mstate_global->__pyx_n_s_unfoldBox +#define __pyx_n_s_unfoldCharmmOcta __pyx_mstate_global->__pyx_n_s_unfoldCharmmOcta +#define __pyx_n_s_unfoldOcta __pyx_mstate_global->__pyx_n_s_unfoldOcta +#define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack +#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update +#define __pyx_n_s_version_info __pyx_mstate_global->__pyx_n_s_version_info +#define __pyx_n_s_xyz __pyx_mstate_global->__pyx_n_s_xyz +#define __pyx_n_s_xyz_traj_curr __pyx_mstate_global->__pyx_n_s_xyz_traj_curr +#define __pyx_n_s_xyz_traj_prev __pyx_mstate_global->__pyx_n_s_xyz_traj_prev +#define __pyx_n_s_xyz_unfold __pyx_mstate_global->__pyx_n_s_xyz_unfold +#define __pyx_n_s_zeros __pyx_mstate_global->__pyx_n_s_zeros +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3 +#define __pyx_int_4 __pyx_mstate_global->__pyx_int_4 +#define __pyx_int_112105877 __pyx_mstate_global->__pyx_int_112105877 +#define __pyx_int_136983863 __pyx_mstate_global->__pyx_int_136983863 +#define __pyx_int_184977713 __pyx_mstate_global->__pyx_int_184977713 +#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 +#define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 +#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 +#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 +#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 +#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 +#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24 +#define __pyx_tuple__26 __pyx_mstate_global->__pyx_tuple__26 +#define __pyx_tuple__28 __pyx_mstate_global->__pyx_tuple__28 +#define __pyx_tuple__30 __pyx_mstate_global->__pyx_tuple__30 +#define __pyx_tuple__32 __pyx_mstate_global->__pyx_tuple__32 +#define __pyx_tuple__35 __pyx_mstate_global->__pyx_tuple__35 +#define __pyx_tuple__37 __pyx_mstate_global->__pyx_tuple__37 +#define __pyx_codeobj__21 __pyx_mstate_global->__pyx_codeobj__21 +#define __pyx_codeobj__23 __pyx_mstate_global->__pyx_codeobj__23 +#define __pyx_codeobj__25 __pyx_mstate_global->__pyx_codeobj__25 +#define __pyx_codeobj__27 __pyx_mstate_global->__pyx_codeobj__27 +#define __pyx_codeobj__29 __pyx_mstate_global->__pyx_codeobj__29 +#define __pyx_codeobj__31 __pyx_mstate_global->__pyx_codeobj__31 +#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33 +#define __pyx_codeobj__34 __pyx_mstate_global->__pyx_codeobj__34 +#define __pyx_codeobj__36 __pyx_mstate_global->__pyx_codeobj__36 +#define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38 +/* #### Code section: module_code ### */ + +/* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): * - * @cython.boundscheck(False) - * def unfoldBox(np.ndarray[np.float64_t,ndim=2,mode='c'] coor_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_prev, - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_curr, */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6unfold_1unfoldBox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_6unfold_unfoldBox[] = "\n unfoldBox(xyz_unfold,xyz_prev,xyz_curr,boxlength)\n \n You have to hand over 3 coordinate sets and the boxlength as arguments: \n - the in-place-unfolding coordinates (from the previous timestep)\n - the trajectory coordinates from the previous timestep\n - the trajectory coordinates from the current timestep\n - boxlength\n\n This functions returns the unfolded coordinates of the current timestep.\n\n Arguments:\n coor_unfold .. numpy array (float64, ndim=2) in-place-unfolding coordinate set: [[x,y,z],[x,y,z],...,[x,y,z]]\n coor_prev .. numpy array (float64, ndim=2) trajectory coordinates, previous timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n coor_curr .. numpy array (float64, ndim=2) trajectory coordinates, current timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n boxlength .. the box length\n\n Usage:\n With this function one can unfold \n the coordinates of a trajectory on the fly, timestep per timestep.\n\n Example: \n unfoldBox(xyz_unfold, xyz_traj_prev, xyz_traj_curr, boxlength)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_6unfold_1unfoldBox = {"unfoldBox", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6unfold_1unfoldBox, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_unfoldBox}; -static PyObject *__pyx_pw_11newanalysis_6unfold_1unfoldBox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_coor_unfold = 0; - PyArrayObject *__pyx_v_coor_prev = 0; - PyArrayObject *__pyx_v_coor_curr = 0; - __pyx_t_5numpy_float64_t __pyx_v_boxl; +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("unfoldBox (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 131, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor_unfold,&__pyx_n_s_coor_prev,&__pyx_n_s_coor_curr,&__pyx_n_s_boxl,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; + values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_n_s_c)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_unfold)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shape)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_prev)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_itemsize)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("unfoldBox", 1, 4, 4, 1); __PYX_ERR(0, 19, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor_curr)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_format)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("unfoldBox", 1, 4, 4, 2); __PYX_ERR(0, 19, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("unfoldBox", 1, 4, 4, 3); __PYX_ERR(0, 19, __pyx_L3_error) + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode); + if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_allocate_buffer); + if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unfoldBox") < 0)) __PYX_ERR(0, 19, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 131, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 132, __pyx_L3_error) + } else { + + /* "View.MemoryView":132 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx + */ + __pyx_v_allocate_buffer = ((int)1); } - __pyx_v_coor_unfold = ((PyArrayObject *)values[0]); - __pyx_v_coor_prev = ((PyArrayObject *)values[1]); - __pyx_v_coor_curr = ((PyArrayObject *)values[2]); - __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("unfoldBox", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 19, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 131, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.unfold.unfoldBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_unfold), __pyx_ptype_5numpy_ndarray, 1, "coor_unfold", 0))) __PYX_ERR(0, 19, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_prev), __pyx_ptype_5numpy_ndarray, 1, "coor_prev", 0))) __PYX_ERR(0, 20, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_curr), __pyx_ptype_5numpy_ndarray, 1, "coor_curr", 0))) __PYX_ERR(0, 21, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6unfold_unfoldBox(__pyx_self, __pyx_v_coor_unfold, __pyx_v_coor_prev, __pyx_v_coor_curr, __pyx_v_boxl); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 131, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 131, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * + */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __pyx_r = NULL; + __pyx_r = -1; __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6unfold_unfoldBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor_unfold, PyArrayObject *__pyx_v_coor_prev, PyArrayObject *__pyx_v_coor_curr, __pyx_t_5numpy_float64_t __pyx_v_boxl) { - double __pyx_v_boxl2; - CYTHON_UNUSED int __pyx_v_n; - int __pyx_v_i; - double __pyx_v_DX; - double __pyx_v_DY; - double __pyx_v_DZ; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_curr; - __Pyx_Buffer __pyx_pybuffer_coor_curr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_prev; - __Pyx_Buffer __pyx_pybuffer_coor_prev; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_unfold; - __Pyx_Buffer __pyx_pybuffer_coor_unfold; - PyObject *__pyx_r = NULL; +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + Py_ssize_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + char *__pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_UCS4 __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("unfoldBox", 0); - __pyx_pybuffer_coor_unfold.pybuffer.buf = NULL; - __pyx_pybuffer_coor_unfold.refcount = 0; - __pyx_pybuffernd_coor_unfold.data = NULL; - __pyx_pybuffernd_coor_unfold.rcbuffer = &__pyx_pybuffer_coor_unfold; - __pyx_pybuffer_coor_prev.pybuffer.buf = NULL; - __pyx_pybuffer_coor_prev.refcount = 0; - __pyx_pybuffernd_coor_prev.data = NULL; - __pyx_pybuffernd_coor_prev.rcbuffer = &__pyx_pybuffer_coor_prev; - __pyx_pybuffer_coor_curr.pybuffer.buf = NULL; - __pyx_pybuffer_coor_curr.refcount = 0; - __pyx_pybuffernd_coor_curr.data = NULL; - __pyx_pybuffernd_coor_curr.rcbuffer = &__pyx_pybuffer_coor_curr; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_unfold, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 19, __pyx_L1_error) - } - __pyx_pybuffernd_coor_unfold.diminfo[0].strides = __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_unfold.diminfo[0].shape = __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_unfold.diminfo[1].strides = __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_unfold.diminfo[1].shape = __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_prev.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_prev, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 19, __pyx_L1_error) - } - __pyx_pybuffernd_coor_prev.diminfo[0].strides = __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_prev.diminfo[0].shape = __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_prev.diminfo[1].strides = __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_prev.diminfo[1].shape = __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_curr.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_curr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 19, __pyx_L1_error) - } - __pyx_pybuffernd_coor_curr.diminfo[0].strides = __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_curr.diminfo[0].shape = __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_curr.diminfo[1].strides = __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_curr.diminfo[1].shape = __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.shape[1]; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); - /* "src/helpers/unfold.pyx":48 - * """ + /* "View.MemoryView":137 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize * - * cdef double boxl2 = boxl/2 # <<<<<<<<<<<<<< - * # cdef int n = 3*len(xyz_unfold) - * cdef int n = coor_unfold.shape[0], i */ - __pyx_v_boxl2 = (__pyx_v_boxl / 2.0); + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 137, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 137, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); - /* "src/helpers/unfold.pyx":50 - * cdef double boxl2 = boxl/2 - * # cdef int n = 3*len(xyz_unfold) - * cdef int n = coor_unfold.shape[0], i # <<<<<<<<<<<<<< - * cdef double DX,DY,DZ + /* "View.MemoryView":138 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< * + * if not self.ndim: */ - __pyx_v_n = (__pyx_v_coor_unfold->dimensions[0]); + __pyx_v_self->itemsize = __pyx_v_itemsize; - /* "src/helpers/unfold.pyx":53 - * cdef double DX,DY,DZ + /* "View.MemoryView":140 + * self.itemsize = itemsize * - * for i in prange(n, nogil=True): # <<<<<<<<<<<<<< - * DX = coor_curr[i,0] - coor_prev[i,0] - * DY = coor_curr[i,1] - coor_prev[i,1] - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_n; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_3 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for lastprivate(__pyx_v_DX) lastprivate(__pyx_v_DY) lastprivate(__pyx_v_DZ) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) - #endif /* _OPENMP */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - /* Initialize private variables to invalid values */ - __pyx_v_DX = ((double)__PYX_NAN()); - __pyx_v_DY = ((double)__PYX_NAN()); - __pyx_v_DZ = ((double)__PYX_NAN()); - - /* "src/helpers/unfold.pyx":54 + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" * - * for i in prange(n, nogil=True): - * DX = coor_curr[i,0] - coor_prev[i,0] # <<<<<<<<<<<<<< - * DY = coor_curr[i,1] - coor_prev[i,1] - * DZ = coor_curr[i,2] - coor_prev[i,2] */ - __pyx_t_4 = __pyx_v_i; - __pyx_t_5 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_pybuffernd_coor_curr.diminfo[0].shape; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_pybuffernd_coor_curr.diminfo[1].shape; - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = 0; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_coor_prev.diminfo[0].shape; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_prev.diminfo[1].shape; - __pyx_v_DX = ((*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_coor_curr.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_coor_curr.diminfo[1].strides)) - (*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_coor_prev.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_coor_prev.diminfo[1].strides))); + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/unfold.pyx":55 - * for i in prange(n, nogil=True): - * DX = coor_curr[i,0] - coor_prev[i,0] - * DY = coor_curr[i,1] - coor_prev[i,1] # <<<<<<<<<<<<<< - * DZ = coor_curr[i,2] - coor_prev[i,2] - * if fabs(DX) > boxl2: + /* "View.MemoryView":141 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: */ - __pyx_t_7 = __pyx_v_i; - __pyx_t_6 = 1; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_curr.diminfo[0].shape; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_coor_curr.diminfo[1].shape; - __pyx_t_5 = __pyx_v_i; - __pyx_t_4 = 1; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_pybuffernd_coor_prev.diminfo[0].shape; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_pybuffernd_coor_prev.diminfo[1].shape; - __pyx_v_DY = ((*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_coor_curr.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_coor_curr.diminfo[1].strides)) - (*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_coor_prev.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_coor_prev.diminfo[1].strides))); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 141, __pyx_L1_error) - /* "src/helpers/unfold.pyx":56 - * DX = coor_curr[i,0] - coor_prev[i,0] - * DY = coor_curr[i,1] - coor_prev[i,1] - * DZ = coor_curr[i,2] - coor_prev[i,2] # <<<<<<<<<<<<<< - * if fabs(DX) > boxl2: - * DX = DX - sign(DX)*boxl + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * */ - __pyx_t_4 = __pyx_v_i; - __pyx_t_5 = 2; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_pybuffernd_coor_curr.diminfo[0].shape; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_pybuffernd_coor_curr.diminfo[1].shape; - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = 2; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_coor_prev.diminfo[0].shape; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_prev.diminfo[1].shape; - __pyx_v_DZ = ((*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_coor_curr.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_coor_curr.diminfo[1].strides)) - (*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_coor_prev.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_coor_prev.diminfo[1].strides))); + } - /* "src/helpers/unfold.pyx":57 - * DY = coor_curr[i,1] - coor_prev[i,1] - * DZ = coor_curr[i,2] - coor_prev[i,2] - * if fabs(DX) > boxl2: # <<<<<<<<<<<<<< - * DX = DX - sign(DX)*boxl - * if fabs(DY) > boxl2: + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * */ - __pyx_t_8 = ((fabs(__pyx_v_DX) > __pyx_v_boxl2) != 0); - if (__pyx_t_8) { + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { - /* "src/helpers/unfold.pyx":58 - * DZ = coor_curr[i,2] - coor_prev[i,2] - * if fabs(DX) > boxl2: - * DX = DX - sign(DX)*boxl # <<<<<<<<<<<<<< - * if fabs(DY) > boxl2: - * DY = DY - sign(DY)*boxl + /* "View.MemoryView":144 + * + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): */ - __pyx_v_DX = (__pyx_v_DX - (__pyx_f_11newanalysis_6unfold_sign(__pyx_v_DX) * __pyx_v_boxl)); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 144, __pyx_L1_error) - /* "src/helpers/unfold.pyx":57 - * DY = coor_curr[i,1] - coor_prev[i,1] - * DZ = coor_curr[i,2] - coor_prev[i,2] - * if fabs(DX) > boxl2: # <<<<<<<<<<<<<< - * DX = DX - sign(DX)*boxl - * if fabs(DY) > boxl2: + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * */ - } + } - /* "src/helpers/unfold.pyx":59 - * if fabs(DX) > boxl2: - * DX = DX - sign(DX)*boxl - * if fabs(DY) > boxl2: # <<<<<<<<<<<<<< - * DY = DY - sign(DY)*boxl - * if fabs(DZ) > boxl2: + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - __pyx_t_8 = ((fabs(__pyx_v_DY) > __pyx_v_boxl2) != 0); - if (__pyx_t_8) { + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { - /* "src/helpers/unfold.pyx":60 - * DX = DX - sign(DX)*boxl - * if fabs(DY) > boxl2: - * DY = DY - sign(DY)*boxl # <<<<<<<<<<<<<< - * if fabs(DZ) > boxl2: - * DZ = DZ -sign(DZ)*boxl + /* "View.MemoryView":147 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format */ - __pyx_v_DY = (__pyx_v_DY - (__pyx_f_11newanalysis_6unfold_sign(__pyx_v_DY) * __pyx_v_boxl)); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; - /* "src/helpers/unfold.pyx":59 - * if fabs(DX) > boxl2: - * DX = DX - sign(DX)*boxl - * if fabs(DY) > boxl2: # <<<<<<<<<<<<<< - * DY = DY - sign(DY)*boxl - * if fabs(DZ) > boxl2: + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - } + } - /* "src/helpers/unfold.pyx":61 - * if fabs(DY) > boxl2: - * DY = DY - sign(DY)*boxl - * if fabs(DZ) > boxl2: # <<<<<<<<<<<<<< - * DZ = DZ -sign(DZ)*boxl - * coor_unfold[i,0] += DX + /* "View.MemoryView":148 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * */ - __pyx_t_8 = ((fabs(__pyx_v_DZ) > __pyx_v_boxl2) != 0); - if (__pyx_t_8) { + if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_format))) __PYX_ERR(1, 148, __pyx_L1_error) + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "src/helpers/unfold.pyx":62 - * DY = DY - sign(DY)*boxl - * if fabs(DZ) > boxl2: - * DZ = DZ -sign(DZ)*boxl # <<<<<<<<<<<<<< - * coor_unfold[i,0] += DX - * coor_unfold[i,1] += DY + /* "View.MemoryView":149 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * */ - __pyx_v_DZ = (__pyx_v_DZ - (__pyx_f_11newanalysis_6unfold_sign(__pyx_v_DZ) * __pyx_v_boxl)); + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 149, __pyx_L1_error) + } + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 149, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_8; - /* "src/helpers/unfold.pyx":61 - * if fabs(DY) > boxl2: - * DY = DY - sign(DY)*boxl - * if fabs(DZ) > boxl2: # <<<<<<<<<<<<<< - * DZ = DZ -sign(DZ)*boxl - * coor_unfold[i,0] += DX + /* "View.MemoryView":152 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * */ - } + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - /* "src/helpers/unfold.pyx":63 - * if fabs(DZ) > boxl2: - * DZ = DZ -sign(DZ)*boxl - * coor_unfold[i,0] += DX # <<<<<<<<<<<<<< - * coor_unfold[i,1] += DY - * coor_unfold[i,2] += DZ + /* "View.MemoryView":153 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: */ - __pyx_t_7 = __pyx_v_i; - __pyx_t_6 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_unfold.diminfo[0].shape; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_coor_unfold.diminfo[1].shape; - *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_coor_unfold.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_coor_unfold.diminfo[1].strides) += __pyx_v_DX; + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - /* "src/helpers/unfold.pyx":64 - * DZ = DZ -sign(DZ)*boxl - * coor_unfold[i,0] += DX - * coor_unfold[i,1] += DY # <<<<<<<<<<<<<< - * coor_unfold[i,2] += DZ + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." * */ - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = 1; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_coor_unfold.diminfo[0].shape; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_unfold.diminfo[1].shape; - *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_coor_unfold.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_coor_unfold.diminfo[1].strides) += __pyx_v_DY; + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { - /* "src/helpers/unfold.pyx":65 - * coor_unfold[i,0] += DX - * coor_unfold[i,1] += DY - * coor_unfold[i,2] += DZ # <<<<<<<<<<<<<< + /* "View.MemoryView":156 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) */ - __pyx_t_7 = __pyx_v_i; - __pyx_t_6 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_unfold.diminfo[0].shape; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_coor_unfold.diminfo[1].shape; - *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_coor_unfold.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_coor_unfold.diminfo[1].strides) += __pyx_v_DZ; - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 156, __pyx_L1_error) - /* "src/helpers/unfold.pyx":53 - * cdef double DX,DY,DZ + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." * - * for i in prange(n, nogil=True): # <<<<<<<<<<<<<< - * DX = coor_curr[i,0] - coor_prev[i,0] - * DY = coor_curr[i,1] - coor_prev[i,1] */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } - /* "src/helpers/unfold.pyx":19 + /* "View.MemoryView":159 * - * @cython.boundscheck(False) - * def unfoldBox(np.ndarray[np.float64_t,ndim=2,mode='c'] coor_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_prev, - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_curr, + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." */ + __pyx_t_7 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(1, 159, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_7; + __pyx_t_7 = (__pyx_t_7 + 1); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_curr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_prev.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.unfold.unfoldBox", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_curr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_prev.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":160 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim + */ + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { -/* "src/helpers/unfold.pyx":68 + /* "View.MemoryView":161 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim * - * @cython.boundscheck(False) - * def unfoldOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, - * np.ndarray[np.float64_t,ndim=2] xyz_traj_curr, */ + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = 0; + __pyx_t_10 = 127; + __Pyx_INCREF(__pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_9 += 22; + __Pyx_GIVEREF(__pyx_kp_u_Invalid_shape_in_axis); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u_); + __pyx_t_9 += 2; + __Pyx_GIVEREF(__pyx_kp_u_); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_); + __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u__2); + __pyx_t_9 += 1; + __Pyx_GIVEREF(__pyx_kp_u__2); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2); + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 161, __pyx_L1_error) -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6unfold_3unfoldOcta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_6unfold_2unfoldOcta[] = "\n unfoldBox(xyz_unfold,xyz_prev,xyz_curr,boxlength)\n \n You have to hand over 3 coordinate sets and the boxlength as arguments: \n - the in-place-unfolding coordinates (from the previous timestep)\n - the trajectory coordinates from the previous timestep\n - the trajectory coordinates from the current timestep\n - boxlength\n\n This functions returns the unfolded coordinates of the current timestep.\n\n Arguments:\n xyz_unfold .. numpy array (float64, ndim=2) in-place-unfolding coordinate set: [[x,y,z],[x,y,z],...,[x,y,z]]\n xyz_traj_prev .. numpy array (float64, ndim=2) trajectory coordinates, previous timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n xyz_traj_curr .. numpy array (float64, ndim=2) trajectory coordinates, current timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n boxlength .. the box length\n\n Usage:\n With this function one can unfold \n the coordinates of a trajectory on the fly, timestep per timestep.\n\n Example: \n unfoldOcta(xyz_unfold, xyz_traj_prev, xyz_traj_curr, boxlength)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_6unfold_3unfoldOcta = {"unfoldOcta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6unfold_3unfoldOcta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_2unfoldOcta}; -static PyObject *__pyx_pw_11newanalysis_6unfold_3unfoldOcta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_xyz_unfold = 0; - PyArrayObject *__pyx_v_xyz_traj_prev = 0; - PyArrayObject *__pyx_v_xyz_traj_curr = 0; - PyObject *__pyx_v_boxlength = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("unfoldOcta (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz_unfold,&__pyx_n_s_xyz_traj_prev,&__pyx_n_s_xyz_traj_curr,&__pyx_n_s_boxlength,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz_unfold)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz_traj_prev)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("unfoldOcta", 1, 4, 4, 1); __PYX_ERR(0, 68, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz_traj_curr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("unfoldOcta", 1, 4, 4, 2); __PYX_ERR(0, 68, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("unfoldOcta", 1, 4, 4, 3); __PYX_ERR(0, 68, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unfoldOcta") < 0)) __PYX_ERR(0, 68, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + /* "View.MemoryView":160 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim + */ } - __pyx_v_xyz_unfold = ((PyArrayObject *)values[0]); - __pyx_v_xyz_traj_prev = ((PyArrayObject *)values[1]); - __pyx_v_xyz_traj_curr = ((PyArrayObject *)values[2]); - __pyx_v_boxlength = values[3]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("unfoldOcta", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 68, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.unfold.unfoldOcta", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_unfold), __pyx_ptype_5numpy_ndarray, 1, "xyz_unfold", 0))) __PYX_ERR(0, 68, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_traj_prev), __pyx_ptype_5numpy_ndarray, 1, "xyz_traj_prev", 0))) __PYX_ERR(0, 69, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_traj_curr), __pyx_ptype_5numpy_ndarray, 1, "xyz_traj_curr", 0))) __PYX_ERR(0, 70, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6unfold_2unfoldOcta(__pyx_self, __pyx_v_xyz_unfold, __pyx_v_xyz_traj_prev, __pyx_v_xyz_traj_curr, __pyx_v_boxlength); - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":162 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order + */ + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; -static PyObject *__pyx_pf_11newanalysis_6unfold_2unfoldOcta(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz_unfold, PyArrayObject *__pyx_v_xyz_traj_prev, PyArrayObject *__pyx_v_xyz_traj_curr, PyObject *__pyx_v_boxlength) { - double __pyx_v_boxl; - double __pyx_v_boxl2; - double __pyx_v_boxl34; - int __pyx_v_n; - int __pyx_v_i; - double __pyx_v_DX; - double __pyx_v_DY; - double __pyx_v_DZ; - double __pyx_v_DD; - PyArrayObject *__pyx_v_c_xyz_traj_prev = 0; - PyArrayObject *__pyx_v_c_xyz_traj_curr = 0; - double *__pyx_v_unfold; - double *__pyx_v_prev; - double *__pyx_v_curr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_c_xyz_traj_curr; - __Pyx_Buffer __pyx_pybuffer_c_xyz_traj_curr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_c_xyz_traj_prev; - __Pyx_Buffer __pyx_pybuffer_c_xyz_traj_prev; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_traj_curr; - __Pyx_Buffer __pyx_pybuffer_xyz_traj_curr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_traj_prev; - __Pyx_Buffer __pyx_pybuffer_xyz_traj_prev; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_unfold; - __Pyx_Buffer __pyx_pybuffer_xyz_unfold; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - double __pyx_t_1; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - long __pyx_t_13; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("unfoldOcta", 0); - __pyx_pybuffer_c_xyz_traj_prev.pybuffer.buf = NULL; - __pyx_pybuffer_c_xyz_traj_prev.refcount = 0; - __pyx_pybuffernd_c_xyz_traj_prev.data = NULL; - __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer = &__pyx_pybuffer_c_xyz_traj_prev; - __pyx_pybuffer_c_xyz_traj_curr.pybuffer.buf = NULL; - __pyx_pybuffer_c_xyz_traj_curr.refcount = 0; - __pyx_pybuffernd_c_xyz_traj_curr.data = NULL; - __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer = &__pyx_pybuffer_c_xyz_traj_curr; - __pyx_pybuffer_xyz_unfold.pybuffer.buf = NULL; - __pyx_pybuffer_xyz_unfold.refcount = 0; - __pyx_pybuffernd_xyz_unfold.data = NULL; - __pyx_pybuffernd_xyz_unfold.rcbuffer = &__pyx_pybuffer_xyz_unfold; - __pyx_pybuffer_xyz_traj_prev.pybuffer.buf = NULL; - __pyx_pybuffer_xyz_traj_prev.refcount = 0; - __pyx_pybuffernd_xyz_traj_prev.data = NULL; - __pyx_pybuffernd_xyz_traj_prev.rcbuffer = &__pyx_pybuffer_xyz_traj_prev; - __pyx_pybuffer_xyz_traj_curr.pybuffer.buf = NULL; - __pyx_pybuffer_xyz_traj_curr.refcount = 0; - __pyx_pybuffernd_xyz_traj_curr.data = NULL; - __pyx_pybuffernd_xyz_traj_curr.rcbuffer = &__pyx_pybuffer_xyz_traj_curr; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_unfold, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 68, __pyx_L1_error) - } - __pyx_pybuffernd_xyz_unfold.diminfo[0].strides = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_unfold.diminfo[0].shape = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_unfold.diminfo[1].strides = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_unfold.diminfo[1].shape = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_traj_prev, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 68, __pyx_L1_error) - } - __pyx_pybuffernd_xyz_traj_prev.diminfo[0].strides = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_traj_prev.diminfo[0].shape = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_traj_prev.diminfo[1].strides = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_traj_prev.diminfo[1].shape = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_traj_curr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 68, __pyx_L1_error) + /* "View.MemoryView":159 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + */ } - __pyx_pybuffernd_xyz_traj_curr.diminfo[0].strides = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_traj_curr.diminfo[0].shape = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_traj_curr.diminfo[1].strides = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_traj_curr.diminfo[1].shape = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.shape[1]; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/helpers/unfold.pyx":96 - * unfoldOcta(xyz_unfold, xyz_traj_prev, xyz_traj_curr, boxlength) - * """ - * cdef double boxl = boxlength # <<<<<<<<<<<<<< - * cdef double boxl2 = boxl/2 - * cdef double boxl34 = 3*boxl/4 + /* "View.MemoryView":165 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_boxlength); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error) - __pyx_v_boxl = __pyx_t_1; + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 165, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/helpers/unfold.pyx":97 - * """ - * cdef double boxl = boxlength - * cdef double boxl2 = boxl/2 # <<<<<<<<<<<<<< - * cdef double boxl34 = 3*boxl/4 - * cdef int n = 3*len(xyz_unfold) + /* "View.MemoryView":166 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': */ - __pyx_v_boxl2 = (__pyx_v_boxl / 2.0); + __pyx_v_order = 'C'; - /* "src/helpers/unfold.pyx":98 - * cdef double boxl = boxlength - * cdef double boxl2 = boxl/2 - * cdef double boxl34 = 3*boxl/4 # <<<<<<<<<<<<<< - * cdef int n = 3*len(xyz_unfold) - * cdef int i + /* "View.MemoryView":167 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' */ - __pyx_v_boxl34 = ((3.0 * __pyx_v_boxl) / 4.0); + __Pyx_INCREF(__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_c; - /* "src/helpers/unfold.pyx":99 - * cdef double boxl2 = boxl/2 - * cdef double boxl34 = 3*boxl/4 - * cdef int n = 3*len(xyz_unfold) # <<<<<<<<<<<<<< - * cdef int i - * cdef double DX,DY,DZ,DD + /* "View.MemoryView":165 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' */ - __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_xyz_unfold)); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 99, __pyx_L1_error) - __pyx_v_n = (3 * __pyx_t_2); + goto __pyx_L11; + } - /* "src/helpers/unfold.pyx":102 - * cdef int i - * cdef double DX,DY,DZ,DD - * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_prev = np.copy(xyz_traj_prev) # <<<<<<<<<<<<<< - * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_curr = np.copy(xyz_traj_curr) - * cdef double *unfold = xyz_unfold.data + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, ((PyObject *)__pyx_v_xyz_traj_prev)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_xyz_traj_prev)); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 102, __pyx_L1_error) - __pyx_t_6 = ((PyArrayObject *)__pyx_t_3); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_c_xyz_traj_prev = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 102, __pyx_L1_error) - } else {__pyx_pybuffernd_c_xyz_traj_prev.diminfo[0].strides = __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c_xyz_traj_prev.diminfo[0].shape = __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_c_xyz_traj_prev.diminfo[1].strides = __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_c_xyz_traj_prev.diminfo[1].shape = __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer.shape[1]; - } - } - __pyx_t_6 = 0; - __pyx_v_c_xyz_traj_prev = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 168, __pyx_L1_error) + if (likely(__pyx_t_3)) { - /* "src/helpers/unfold.pyx":103 - * cdef double DX,DY,DZ,DD - * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_prev = np.copy(xyz_traj_prev) - * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_curr = np.copy(xyz_traj_curr) # <<<<<<<<<<<<<< - * cdef double *unfold = xyz_unfold.data - * cdef double *prev = c_xyz_traj_prev.data + /* "View.MemoryView":169 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } + __pyx_v_order = 'F'; + + /* "View.MemoryView":170 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + */ + __Pyx_INCREF(__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_fortran; + + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' + */ + goto __pyx_L11; } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, ((PyObject *)__pyx_v_xyz_traj_curr)) : __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_xyz_traj_curr)); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 103, __pyx_L1_error) - __pyx_t_7 = ((PyArrayObject *)__pyx_t_3); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { - __pyx_v_c_xyz_traj_curr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 103, __pyx_L1_error) - } else {__pyx_pybuffernd_c_xyz_traj_curr.diminfo[0].strides = __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c_xyz_traj_curr.diminfo[0].shape = __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_c_xyz_traj_curr.diminfo[1].strides = __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_c_xyz_traj_curr.diminfo[1].shape = __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer.shape[1]; - } + + /* "View.MemoryView":172 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 172, __pyx_L1_error) } - __pyx_t_7 = 0; - __pyx_v_c_xyz_traj_curr = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_L11:; - /* "src/helpers/unfold.pyx":104 - * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_prev = np.copy(xyz_traj_prev) - * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_curr = np.copy(xyz_traj_curr) - * cdef double *unfold = xyz_unfold.data # <<<<<<<<<<<<<< - * cdef double *prev = c_xyz_traj_prev.data - * cdef double *curr = c_xyz_traj_curr.data + /* "View.MemoryView":174 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer */ - __pyx_v_unfold = ((double *)__pyx_v_xyz_unfold->data); + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - /* "src/helpers/unfold.pyx":105 - * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_curr = np.copy(xyz_traj_curr) - * cdef double *unfold = xyz_unfold.data - * cdef double *prev = c_xyz_traj_prev.data # <<<<<<<<<<<<<< - * cdef double *curr = c_xyz_traj_curr.data + /* "View.MemoryView":176 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' * */ - __pyx_v_prev = ((double *)__pyx_v_c_xyz_traj_prev->data); + __pyx_v_self->free_data = __pyx_v_allocate_buffer; - /* "src/helpers/unfold.pyx":106 - * cdef double *unfold = xyz_unfold.data - * cdef double *prev = c_xyz_traj_prev.data - * cdef double *curr = c_xyz_traj_curr.data # <<<<<<<<<<<<<< + /* "View.MemoryView":177 * - * for i in range(0,n,3): + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: */ - __pyx_v_curr = ((double *)__pyx_v_c_xyz_traj_curr->data); + __pyx_t_6 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 177, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; - /* "src/helpers/unfold.pyx":108 - * cdef double *curr = c_xyz_traj_curr.data + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) * - * for i in range(0,n,3): # <<<<<<<<<<<<<< - * DX = curr[i] - prev[i] - * DY = curr[i+1] - prev[i+1] */ - __pyx_t_8 = __pyx_v_n; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=3) { - __pyx_v_i = __pyx_t_10; + if (__pyx_v_allocate_buffer) { - /* "src/helpers/unfold.pyx":109 + /* "View.MemoryView":180 * - * for i in range(0,n,3): - * DX = curr[i] - prev[i] # <<<<<<<<<<<<<< - * DY = curr[i+1] - prev[i+1] - * DZ = curr[i+2] - prev[i+2] + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') */ - __pyx_v_DX = ((__pyx_v_curr[__pyx_v_i]) - (__pyx_v_prev[__pyx_v_i])); + __pyx_t_7 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 180, __pyx_L1_error) - /* "src/helpers/unfold.pyx":110 - * for i in range(0,n,3): - * DX = curr[i] - prev[i] - * DY = curr[i+1] - prev[i+1] # <<<<<<<<<<<<<< - * DZ = curr[i+2] - prev[i+2] - * DD = fabs(DX) + fabs(DY) + fabs(DZ) + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * */ - __pyx_v_DY = ((__pyx_v_curr[(__pyx_v_i + 1)]) - (__pyx_v_prev[(__pyx_v_i + 1)])); + } - /* "src/helpers/unfold.pyx":111 - * DX = curr[i] - prev[i] - * DY = curr[i+1] - prev[i+1] - * DZ = curr[i+2] - prev[i+2] # <<<<<<<<<<<<<< - * DD = fabs(DX) + fabs(DY) + fabs(DZ) - * if DD > boxl34: + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * */ - __pyx_v_DZ = ((__pyx_v_curr[(__pyx_v_i + 2)]) - (__pyx_v_prev[(__pyx_v_i + 2)])); - /* "src/helpers/unfold.pyx":112 - * DY = curr[i+1] - prev[i+1] - * DZ = curr[i+2] - prev[i+2] - * DD = fabs(DX) + fabs(DY) + fabs(DZ) # <<<<<<<<<<<<<< - * if DD > boxl34: - * DX -= sign(DX)*boxl2 + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":182 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ - __pyx_v_DD = ((fabs(__pyx_v_DX) + fabs(__pyx_v_DY)) + fabs(__pyx_v_DZ)); - /* "src/helpers/unfold.pyx":113 - * DZ = curr[i+2] - prev[i+2] - * DD = fabs(DX) + fabs(DY) + fabs(DZ) - * if DD > boxl34: # <<<<<<<<<<<<<< - * DX -= sign(DX)*boxl2 - * DY -= sign(DY)*boxl2 +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":184 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": */ - __pyx_t_11 = ((__pyx_v_DD > __pyx_v_boxl34) != 0); - if (__pyx_t_11) { + __pyx_v_bufmode = -1; - /* "src/helpers/unfold.pyx":114 - * DD = fabs(DX) + fabs(DY) + fabs(DZ) - * if DD > boxl34: - * DX -= sign(DX)*boxl2 # <<<<<<<<<<<<<< - * DY -= sign(DY)*boxl2 - * DZ -= sign(DZ)*boxl2 + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __pyx_v_DX = (__pyx_v_DX - (__pyx_f_11newanalysis_6unfold_sign(__pyx_v_DX) * __pyx_v_boxl2)); + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { - /* "src/helpers/unfold.pyx":115 - * if DD > boxl34: - * DX -= sign(DX)*boxl2 - * DY -= sign(DY)*boxl2 # <<<<<<<<<<<<<< - * DZ -= sign(DZ)*boxl2 - * else: + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": */ - __pyx_v_DY = (__pyx_v_DY - (__pyx_f_11newanalysis_6unfold_sign(__pyx_v_DY) * __pyx_v_boxl2)); + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { - /* "src/helpers/unfold.pyx":116 - * DX -= sign(DX)*boxl2 - * DY -= sign(DY)*boxl2 - * DZ -= sign(DZ)*boxl2 # <<<<<<<<<<<<<< - * else: - * if fabs(DX) > boxl2: + /* "View.MemoryView":187 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __pyx_v_DZ = (__pyx_v_DZ - (__pyx_f_11newanalysis_6unfold_sign(__pyx_v_DZ) * __pyx_v_boxl2)); + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - /* "src/helpers/unfold.pyx":113 - * DZ = curr[i+2] - prev[i+2] - * DD = fabs(DX) + fabs(DY) + fabs(DZ) - * if DD > boxl34: # <<<<<<<<<<<<<< - * DX -= sign(DX)*boxl2 - * DY -= sign(DY)*boxl2 + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": */ - goto __pyx_L5; + goto __pyx_L4; } - /* "src/helpers/unfold.pyx":118 - * DZ -= sign(DZ)*boxl2 - * else: - * if fabs(DX) > boxl2: # <<<<<<<<<<<<<< - * DX -= sign(DX)*boxl - * if fabs(DY) > boxl2: + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): */ - /*else*/ { - __pyx_t_11 = ((fabs(__pyx_v_DX) > __pyx_v_boxl2) != 0); - if (__pyx_t_11) { + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 188, __pyx_L1_error) + if (__pyx_t_1) { - /* "src/helpers/unfold.pyx":119 - * else: - * if fabs(DX) > boxl2: - * DX -= sign(DX)*boxl # <<<<<<<<<<<<<< - * if fabs(DY) > boxl2: - * DY -= sign(DY)*boxl + /* "View.MemoryView":189 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." */ - __pyx_v_DX = (__pyx_v_DX - (__pyx_f_11newanalysis_6unfold_sign(__pyx_v_DX) * __pyx_v_boxl)); + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - /* "src/helpers/unfold.pyx":118 - * DZ -= sign(DZ)*boxl2 - * else: - * if fabs(DX) > boxl2: # <<<<<<<<<<<<<< - * DX -= sign(DX)*boxl - * if fabs(DY) > boxl2: + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): */ - } + } + __pyx_L4:; - /* "src/helpers/unfold.pyx":120 - * if fabs(DX) > boxl2: - * DX -= sign(DX)*boxl - * if fabs(DY) > boxl2: # <<<<<<<<<<<<<< - * DY -= sign(DY)*boxl - * if fabs(DZ) > boxl2: + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data */ - __pyx_t_11 = ((fabs(__pyx_v_DY) > __pyx_v_boxl2) != 0); - if (__pyx_t_11) { + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/unfold.pyx":121 - * DX -= sign(DX)*boxl - * if fabs(DY) > boxl2: - * DY -= sign(DY)*boxl # <<<<<<<<<<<<<< - * if fabs(DZ) > boxl2: - * DZ -= sign(DZ)*boxl + /* "View.MemoryView":191 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len */ - __pyx_v_DY = (__pyx_v_DY - (__pyx_f_11newanalysis_6unfold_sign(__pyx_v_DY) * __pyx_v_boxl)); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 191, __pyx_L1_error) - /* "src/helpers/unfold.pyx":120 - * if fabs(DX) > boxl2: - * DX -= sign(DX)*boxl - * if fabs(DY) > boxl2: # <<<<<<<<<<<<<< - * DY -= sign(DY)*boxl - * if fabs(DZ) > boxl2: + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data */ - } + } - /* "src/helpers/unfold.pyx":122 - * if fabs(DY) > boxl2: - * DY -= sign(DY)*boxl - * if fabs(DZ) > boxl2: # <<<<<<<<<<<<<< - * DZ -= sign(DZ)*boxl - * unfold[i] += DX + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __pyx_t_11 = ((fabs(__pyx_v_DZ) > __pyx_v_boxl2) != 0); - if (__pyx_t_11) { + } - /* "src/helpers/unfold.pyx":123 - * DY -= sign(DY)*boxl - * if fabs(DZ) > boxl2: - * DZ -= sign(DZ)*boxl # <<<<<<<<<<<<<< - * unfold[i] += DX - * unfold[i+1] += DY + /* "View.MemoryView":192 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len + * */ - __pyx_v_DZ = (__pyx_v_DZ - (__pyx_f_11newanalysis_6unfold_sign(__pyx_v_DZ) * __pyx_v_boxl)); + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; - /* "src/helpers/unfold.pyx":122 - * if fabs(DY) > boxl2: - * DY -= sign(DY)*boxl - * if fabs(DZ) > boxl2: # <<<<<<<<<<<<<< - * DZ -= sign(DZ)*boxl - * unfold[i] += DX + /* "View.MemoryView":193 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: */ - } + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; + + /* "View.MemoryView":195 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":196 + * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides + */ + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; + + /* "View.MemoryView":197 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides + * else: + */ + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":198 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< + * else: + * info.ndim = 1 + */ + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; + + /* "View.MemoryView":195 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape + */ + goto __pyx_L6; + } + + /* "View.MemoryView":200 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL + */ + /*else*/ { + __pyx_v_info->ndim = 1; + + /* "View.MemoryView":201 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL + * + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; } - __pyx_L5:; + __pyx_v_info->shape = __pyx_t_5; - /* "src/helpers/unfold.pyx":124 - * if fabs(DZ) > boxl2: - * DZ -= sign(DZ)*boxl - * unfold[i] += DX # <<<<<<<<<<<<<< - * unfold[i+1] += DY - * unfold[i+2] += DZ + /* "View.MemoryView":202 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL */ - __pyx_t_12 = __pyx_v_i; - (__pyx_v_unfold[__pyx_t_12]) = ((__pyx_v_unfold[__pyx_t_12]) + __pyx_v_DX); + __pyx_v_info->strides = NULL; + } + __pyx_L6:; - /* "src/helpers/unfold.pyx":125 - * DZ -= sign(DZ)*boxl - * unfold[i] += DX - * unfold[i+1] += DY # <<<<<<<<<<<<<< - * unfold[i+2] += DZ + /* "View.MemoryView":204 + * info.strides = NULL * + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 */ - __pyx_t_13 = (__pyx_v_i + 1); - (__pyx_v_unfold[__pyx_t_13]) = ((__pyx_v_unfold[__pyx_t_13]) + __pyx_v_DY); + __pyx_v_info->suboffsets = NULL; - /* "src/helpers/unfold.pyx":126 - * unfold[i] += DX - * unfold[i+1] += DY - * unfold[i+2] += DZ # <<<<<<<<<<<<<< + /* "View.MemoryView":205 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + */ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":206 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self + */ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":207 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self * - * @cython.boundscheck(False) */ - __pyx_t_13 = (__pyx_v_i + 2); - (__pyx_v_unfold[__pyx_t_13]) = ((__pyx_v_unfold[__pyx_t_13]) + __pyx_v_DZ); + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; } + __pyx_v_info->format = __pyx_t_2; + + /* "View.MemoryView":208 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< + * + * def __dealloc__(array self): + */ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "src/helpers/unfold.pyx":68 + /* "View.MemoryView":182 + * _allocate_buffer(self) * - * @cython.boundscheck(False) - * def unfoldOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, - * np.ndarray[np.float64_t,ndim=2] xyz_traj_curr, + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.unfold.unfoldOcta", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer); + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_c_xyz_traj_prev); - __Pyx_XDECREF((PyObject *)__pyx_v_c_xyz_traj_curr); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/unfold.pyx":129 +/* "View.MemoryView":210 + * info.obj = self * - * @cython.boundscheck(False) - * def unfoldCharmmOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, - * np.ndarray[np.float64_t,ndim=2] xyz_traj_curr, + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6unfold_5unfoldCharmmOcta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_6unfold_4unfoldCharmmOcta[] = "\n unfoldCharmmOcta(xyz_unfold,xyz_prev,xyz_curr,dimensions)\n \n You have to hand over 3 coordinate sets and the dimensions array as arguments: \n - the in-place-unfolding coordinates (from the previous timestep)\n - the trajectory coordinates from the previous timestep\n - the trajectory coordinates from the current timestep\n - dimensions = matrix with entries for basis vectors\n\n This functions returns the unfolded coordinates of the current timestep.\n\n Arguments:\n xyz_unfold .. numpy array (float64, ndim=2) in-place-unfolding coordinate set: [[x,y,z],[x,y,z],...,[x,y,z]]\n xyz_traj_prev .. numpy array (float64, ndim=2) trajectory coordinates, previous timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n xyz_traj_curr .. numpy array (float64, ndim=2) trajectory coordinates, current timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n dimensions .. numpy array (float32, ndim=1) output from u.coord.dimensions\n\n Usage:\n With this function one can unfold \n the coordinates of a trajectory on the fly, timestep per timestep.\n Compatible with every box-shape in CHARMM.\n\n Example: \n unfoldCharmmOcta(xyz_unfold, xyz_traj_prev, xyz_traj_curr, dimensions)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_6unfold_5unfoldCharmmOcta = {"unfoldCharmmOcta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6unfold_5unfoldCharmmOcta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_4unfoldCharmmOcta}; -static PyObject *__pyx_pw_11newanalysis_6unfold_5unfoldCharmmOcta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_xyz_unfold = 0; - PyArrayObject *__pyx_v_xyz_traj_prev = 0; - PyArrayObject *__pyx_v_xyz_traj_curr = 0; - PyArrayObject *__pyx_v_dimensions = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("unfoldCharmmOcta (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz_unfold,&__pyx_n_s_xyz_traj_prev,&__pyx_n_s_xyz_traj_curr,&__pyx_n_s_dimensions,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz_unfold)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz_traj_prev)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("unfoldCharmmOcta", 1, 4, 4, 1); __PYX_ERR(0, 129, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz_traj_curr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("unfoldCharmmOcta", 1, 4, 4, 2); __PYX_ERR(0, 129, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dimensions)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("unfoldCharmmOcta", 1, 4, 4, 3); __PYX_ERR(0, 129, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unfoldCharmmOcta") < 0)) __PYX_ERR(0, 129, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_xyz_unfold = ((PyArrayObject *)values[0]); - __pyx_v_xyz_traj_prev = ((PyArrayObject *)values[1]); - __pyx_v_xyz_traj_curr = ((PyArrayObject *)values[2]); - __pyx_v_dimensions = ((PyArrayObject *)values[3]); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "View.MemoryView":211 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + */ + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":212 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + */ + __pyx_v_self->callback_free_data(__pyx_v_self->data); + + /* "View.MemoryView":211 + * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + */ + goto __pyx_L3; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("unfoldCharmmOcta", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 129, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.unfold.unfoldCharmmOcta", __pyx_clineno, __pyx_lineno, __pyx_filename); + + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + */ + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + */ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":215 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) + */ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + */ + } + + /* "View.MemoryView":216 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) + * + */ + free(__pyx_v_self->data); + + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + */ + } + __pyx_L3:; + + /* "View.MemoryView":217 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + * + * @property + */ + PyObject_Free(__pyx_v_self->_shape); + + /* "View.MemoryView":210 + * info.obj = self + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_unfold), __pyx_ptype_5numpy_ndarray, 1, "xyz_unfold", 0))) __PYX_ERR(0, 129, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_traj_prev), __pyx_ptype_5numpy_ndarray, 1, "xyz_traj_prev", 0))) __PYX_ERR(0, 130, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_traj_curr), __pyx_ptype_5numpy_ndarray, 1, "xyz_traj_curr", 0))) __PYX_ERR(0, 131, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dimensions), __pyx_ptype_5numpy_ndarray, 1, "dimensions", 0))) __PYX_ERR(0, 132, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6unfold_4unfoldCharmmOcta(__pyx_self, __pyx_v_xyz_unfold, __pyx_v_xyz_traj_prev, __pyx_v_xyz_traj_curr, __pyx_v_dimensions); +} + +/* "View.MemoryView":219 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":221 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< + * + * @cname('get_memview') + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; + + /* "View.MemoryView":219 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() + */ + + /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6unfold_4unfoldCharmmOcta(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz_unfold, PyArrayObject *__pyx_v_xyz_traj_prev, PyArrayObject *__pyx_v_xyz_traj_curr, PyArrayObject *__pyx_v_dimensions) { - double __pyx_v_diag; - double __pyx_v_offdiag; - double __pyx_v_norm; - double __pyx_v_norm2; - double __pyx_v_norm22; - double __pyx_v_norm32; - double __pyx_v_A; - double __pyx_v_B; - double __pyx_v_C; - double __pyx_v_DX; - double __pyx_v_DY; - double __pyx_v_DZ; - double __pyx_v_D; - double __pyx_v_T1; - double __pyx_v_T2; - double __pyx_v_T3; - int __pyx_v_n; - int __pyx_v_i; - double *__pyx_v_unfold; - double *__pyx_v_prev; - double *__pyx_v_curr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_dimensions; - __Pyx_Buffer __pyx_pybuffer_dimensions; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_traj_curr; - __Pyx_Buffer __pyx_pybuffer_xyz_traj_curr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_traj_prev; - __Pyx_Buffer __pyx_pybuffer_xyz_traj_prev; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_unfold; - __Pyx_Buffer __pyx_pybuffer_xyz_unfold; +/* "View.MemoryView":224 + * + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) + */ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - double __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - long __pyx_t_15; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("unfoldCharmmOcta", 0); - __pyx_pybuffer_xyz_unfold.pybuffer.buf = NULL; - __pyx_pybuffer_xyz_unfold.refcount = 0; - __pyx_pybuffernd_xyz_unfold.data = NULL; - __pyx_pybuffernd_xyz_unfold.rcbuffer = &__pyx_pybuffer_xyz_unfold; - __pyx_pybuffer_xyz_traj_prev.pybuffer.buf = NULL; - __pyx_pybuffer_xyz_traj_prev.refcount = 0; - __pyx_pybuffernd_xyz_traj_prev.data = NULL; - __pyx_pybuffernd_xyz_traj_prev.rcbuffer = &__pyx_pybuffer_xyz_traj_prev; - __pyx_pybuffer_xyz_traj_curr.pybuffer.buf = NULL; - __pyx_pybuffer_xyz_traj_curr.refcount = 0; - __pyx_pybuffernd_xyz_traj_curr.data = NULL; - __pyx_pybuffernd_xyz_traj_curr.rcbuffer = &__pyx_pybuffer_xyz_traj_curr; - __pyx_pybuffer_dimensions.pybuffer.buf = NULL; - __pyx_pybuffer_dimensions.refcount = 0; - __pyx_pybuffernd_dimensions.data = NULL; - __pyx_pybuffernd_dimensions.rcbuffer = &__pyx_pybuffer_dimensions; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_unfold, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 129, __pyx_L1_error) - } - __pyx_pybuffernd_xyz_unfold.diminfo[0].strides = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_unfold.diminfo[0].shape = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_unfold.diminfo[1].strides = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_unfold.diminfo[1].shape = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_traj_prev, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 129, __pyx_L1_error) - } - __pyx_pybuffernd_xyz_traj_prev.diminfo[0].strides = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_traj_prev.diminfo[0].shape = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_traj_prev.diminfo[1].strides = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_traj_prev.diminfo[1].shape = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_traj_curr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 129, __pyx_L1_error) - } - __pyx_pybuffernd_xyz_traj_curr.diminfo[0].strides = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_traj_curr.diminfo[0].shape = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_traj_curr.diminfo[1].strides = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_traj_curr.diminfo[1].shape = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dimensions.rcbuffer->pybuffer, (PyObject*)__pyx_v_dimensions, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 129, __pyx_L1_error) - } - __pyx_pybuffernd_dimensions.diminfo[0].strides = __pyx_pybuffernd_dimensions.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dimensions.diminfo[0].shape = __pyx_pybuffernd_dimensions.rcbuffer->pybuffer.shape[0]; + __Pyx_RefNannySetupContext("get_memview", 0); - /* "src/helpers/unfold.pyx":159 - * """ + /* "View.MemoryView":225 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) * - * cdef double diag = np.round(dimensions[0],4) # <<<<<<<<<<<<<< - * cdef double offdiag = np.round(dimensions[3],4) - * cdef double norm = sqrt(diag*diag+2*offdiag*offdiag) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_round); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = 0; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_pybuffernd_dimensions.diminfo[0].shape; - __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dimensions.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_dimensions.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_2, __pyx_int_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_2, __pyx_int_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2); - __Pyx_INCREF(__pyx_int_4); - __Pyx_GIVEREF(__pyx_int_4); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_int_4); - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_diag = ((double)__pyx_t_8); + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); - /* "src/helpers/unfold.pyx":160 + /* "View.MemoryView":226 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< * - * cdef double diag = np.round(dimensions[0],4) - * cdef double offdiag = np.round(dimensions[3],4) # <<<<<<<<<<<<<< - * cdef double norm = sqrt(diag*diag+2*offdiag*offdiag) - * cdef double norm2 = norm/2.0, norm22 = norm2*norm2, norm32 = 2*norm/3.0 + * def __len__(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_round); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = 3; - if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_pybuffernd_dimensions.diminfo[0].shape; - __pyx_t_3 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dimensions.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_dimensions.diminfo[0].strides))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_int_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_int_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_3); - __Pyx_INCREF(__pyx_int_4); - __Pyx_GIVEREF(__pyx_int_4); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_int_4); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_offdiag = ((double)__pyx_t_8); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/unfold.pyx":161 - * cdef double diag = np.round(dimensions[0],4) - * cdef double offdiag = np.round(dimensions[3],4) - * cdef double norm = sqrt(diag*diag+2*offdiag*offdiag) # <<<<<<<<<<<<<< - * cdef double norm2 = norm/2.0, norm22 = norm2*norm2, norm32 = 2*norm/3.0 - * cdef double A = diag/norm, B = offdiag/norm, C = 1/sqrt(3) + /* "View.MemoryView":224 + * + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) */ - __pyx_v_norm = sqrt(((__pyx_v_diag * __pyx_v_diag) + ((2.0 * __pyx_v_offdiag) * __pyx_v_offdiag))); - /* "src/helpers/unfold.pyx":162 - * cdef double offdiag = np.round(dimensions[3],4) - * cdef double norm = sqrt(diag*diag+2*offdiag*offdiag) - * cdef double norm2 = norm/2.0, norm22 = norm2*norm2, norm32 = 2*norm/3.0 # <<<<<<<<<<<<<< - * cdef double A = diag/norm, B = offdiag/norm, C = 1/sqrt(3) - * cdef double DX, DY, DZ, D, T1, T2, T3 - */ - __pyx_v_norm2 = (__pyx_v_norm / 2.0); - __pyx_v_norm22 = (__pyx_v_norm2 * __pyx_v_norm2); - __pyx_v_norm32 = ((2.0 * __pyx_v_norm) / 3.0); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":163 - * cdef double norm = sqrt(diag*diag+2*offdiag*offdiag) - * cdef double norm2 = norm/2.0, norm22 = norm2*norm2, norm32 = 2*norm/3.0 - * cdef double A = diag/norm, B = offdiag/norm, C = 1/sqrt(3) # <<<<<<<<<<<<<< - * cdef double DX, DY, DZ, D, T1, T2, T3 - * cdef int n = 3*len(xyz_unfold) +/* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] + * */ - if (unlikely(__pyx_v_norm == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 163, __pyx_L1_error) - } - __pyx_v_A = (__pyx_v_diag / __pyx_v_norm); - if (unlikely(__pyx_v_norm == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 163, __pyx_L1_error) - } - __pyx_v_B = (__pyx_v_offdiag / __pyx_v_norm); - __pyx_t_8 = sqrt(3.0); - if (unlikely(__pyx_t_8 == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 163, __pyx_L1_error) - } - __pyx_v_C = (1.0 / __pyx_t_8); - /* "src/helpers/unfold.pyx":165 - * cdef double A = diag/norm, B = offdiag/norm, C = 1/sqrt(3) - * cdef double DX, DY, DZ, D, T1, T2, T3 - * cdef int n = 3*len(xyz_unfold) # <<<<<<<<<<<<<< - * cdef int i - * cdef double *unfold = xyz_unfold.data - */ - __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_xyz_unfold)); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 165, __pyx_L1_error) - __pyx_v_n = (3 * __pyx_t_9); +/* Python wrapper */ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); - /* "src/helpers/unfold.pyx":167 - * cdef int n = 3*len(xyz_unfold) - * cdef int i - * cdef double *unfold = xyz_unfold.data # <<<<<<<<<<<<<< - * cdef double *prev = xyz_traj_prev.data - * cdef double *curr = xyz_traj_curr.data - */ - __pyx_v_unfold = ((double *)__pyx_v_xyz_unfold->data); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":168 - * cdef int i - * cdef double *unfold = xyz_unfold.data - * cdef double *prev = xyz_traj_prev.data # <<<<<<<<<<<<<< - * cdef double *curr = xyz_traj_curr.data +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__", 0); + + /* "View.MemoryView":229 + * + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< * + * def __getattr__(self, attr): */ - __pyx_v_prev = ((double *)__pyx_v_xyz_traj_prev->data); + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; - /* "src/helpers/unfold.pyx":169 - * cdef double *unfold = xyz_unfold.data - * cdef double *prev = xyz_traj_prev.data - * cdef double *curr = xyz_traj_curr.data # <<<<<<<<<<<<<< + /* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * - * for i in range(0,n,3): */ - __pyx_v_curr = ((double *)__pyx_v_xyz_traj_curr->data); - /* "src/helpers/unfold.pyx":171 - * cdef double *curr = xyz_traj_curr.data + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":231 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * - * for i in range(0,n,3): # <<<<<<<<<<<<<< - * DX = curr[i] - prev[i] - * DY = curr[i+1] - prev[i+1] */ - __pyx_t_6 = __pyx_v_n; - __pyx_t_10 = __pyx_t_6; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=3) { - __pyx_v_i = __pyx_t_11; - /* "src/helpers/unfold.pyx":172 +/* Python wrapper */ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "View.MemoryView":232 * - * for i in range(0,n,3): - * DX = curr[i] - prev[i] # <<<<<<<<<<<<<< - * DY = curr[i+1] - prev[i+1] - * DZ = curr[i+2] - prev[i+2] + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, item): */ - __pyx_v_DX = ((__pyx_v_curr[__pyx_v_i]) - (__pyx_v_prev[__pyx_v_i])); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/unfold.pyx":173 - * for i in range(0,n,3): - * DX = curr[i] - prev[i] - * DY = curr[i+1] - prev[i+1] # <<<<<<<<<<<<<< - * DZ = curr[i+2] - prev[i+2] - * D = DX*DX+DY*DY+DZ*DZ + /* "View.MemoryView":231 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * */ - __pyx_v_DY = ((__pyx_v_curr[(__pyx_v_i + 1)]) - (__pyx_v_prev[(__pyx_v_i + 1)])); - /* "src/helpers/unfold.pyx":174 - * DX = curr[i] - prev[i] - * DY = curr[i+1] - prev[i+1] - * DZ = curr[i+2] - prev[i+2] # <<<<<<<<<<<<<< - * D = DX*DX+DY*DY+DZ*DZ - * if D > norm22: # if there was a jump - */ - __pyx_v_DZ = ((__pyx_v_curr[(__pyx_v_i + 2)]) - (__pyx_v_prev[(__pyx_v_i + 2)])); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":175 - * DY = curr[i+1] - prev[i+1] - * DZ = curr[i+2] - prev[i+2] - * D = DX*DX+DY*DY+DZ*DZ # <<<<<<<<<<<<<< - * if D > norm22: # if there was a jump - * T1 = DX*A+DY*B+DZ*B +/* "View.MemoryView":234 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * */ - __pyx_v_D = (((__pyx_v_DX * __pyx_v_DX) + (__pyx_v_DY * __pyx_v_DY)) + (__pyx_v_DZ * __pyx_v_DZ)); - /* "src/helpers/unfold.pyx":176 - * DZ = curr[i+2] - prev[i+2] - * D = DX*DX+DY*DY+DZ*DZ - * if D > norm22: # if there was a jump # <<<<<<<<<<<<<< - * T1 = DX*A+DY*B+DZ*B - * T2 = DX*B+DY*A+DZ*B - */ - __pyx_t_12 = ((__pyx_v_D > __pyx_v_norm22) != 0); - if (__pyx_t_12) { +/* Python wrapper */ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); - /* "src/helpers/unfold.pyx":177 - * D = DX*DX+DY*DY+DZ*DZ - * if D > norm22: # if there was a jump - * T1 = DX*A+DY*B+DZ*B # <<<<<<<<<<<<<< - * T2 = DX*B+DY*A+DZ*B - * T3 = DX*B+DY*B+DZ*A - */ - __pyx_v_T1 = (((__pyx_v_DX * __pyx_v_A) + (__pyx_v_DY * __pyx_v_B)) + (__pyx_v_DZ * __pyx_v_B)); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":178 - * if D > norm22: # if there was a jump - * T1 = DX*A+DY*B+DZ*B - * T2 = DX*B+DY*A+DZ*B # <<<<<<<<<<<<<< - * T3 = DX*B+DY*B+DZ*A - * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis - */ - __pyx_v_T2 = (((__pyx_v_DX * __pyx_v_B) + (__pyx_v_DY * __pyx_v_A)) + (__pyx_v_DZ * __pyx_v_B)); +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "src/helpers/unfold.pyx":179 - * T1 = DX*A+DY*B+DZ*B - * T2 = DX*B+DY*A+DZ*B - * T3 = DX*B+DY*B+DZ*A # <<<<<<<<<<<<<< - * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis - * DX -= sign(T1)*norm*C + /* "View.MemoryView":235 + * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< + * + * def __setitem__(self, item, value): */ - __pyx_v_T3 = (((__pyx_v_DX * __pyx_v_B) + (__pyx_v_DY * __pyx_v_B)) + (__pyx_v_DZ * __pyx_v_A)); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/helpers/unfold.pyx":180 - * T2 = DX*B+DY*A+DZ*B - * T3 = DX*B+DY*B+DZ*A - * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis # <<<<<<<<<<<<<< - * DX -= sign(T1)*norm*C - * DY -= sign(T1)*norm*C + /* "View.MemoryView":234 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * */ - __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); - __pyx_t_12 = (__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) == __pyx_t_13); - if (__pyx_t_12) { - __pyx_t_12 = (__pyx_t_13 == __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3)); - } - __pyx_t_14 = (__pyx_t_12 != 0); - if (__pyx_t_14) { - /* "src/helpers/unfold.pyx":181 - * T3 = DX*B+DY*B+DZ*A - * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis - * DX -= sign(T1)*norm*C # <<<<<<<<<<<<<< - * DY -= sign(T1)*norm*C - * DZ -= sign(T1)*norm*C - */ - __pyx_v_DX = (__pyx_v_DX - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) * __pyx_v_norm) * __pyx_v_C)); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":182 - * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis - * DX -= sign(T1)*norm*C - * DY -= sign(T1)*norm*C # <<<<<<<<<<<<<< - * DZ -= sign(T1)*norm*C - * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 +/* "View.MemoryView":237 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * */ - __pyx_v_DY = (__pyx_v_DY - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) * __pyx_v_norm) * __pyx_v_C)); - /* "src/helpers/unfold.pyx":183 - * DX -= sign(T1)*norm*C - * DY -= sign(T1)*norm*C - * DZ -= sign(T1)*norm*C # <<<<<<<<<<<<<< - * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 - * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 - */ - __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) * __pyx_v_norm) * __pyx_v_C)); +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); - /* "src/helpers/unfold.pyx":180 - * T2 = DX*B+DY*A+DZ*B - * T3 = DX*B+DY*B+DZ*A - * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis # <<<<<<<<<<<<<< - * DX -= sign(T1)*norm*C - * DY -= sign(T1)*norm*C - */ - goto __pyx_L6; - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":184 - * DY -= sign(T1)*norm*C - * DZ -= sign(T1)*norm*C - * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 # <<<<<<<<<<<<<< - * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 - * DX -= sign(T1)*norm*A - */ - __pyx_t_14 = ((((fabs((fabs(__pyx_v_T1) - fabs(__pyx_v_T2))) + fabs((fabs(__pyx_v_T1) - fabs(__pyx_v_T3)))) + fabs((fabs(__pyx_v_T2) - fabs(__pyx_v_T3)))) < __pyx_v_norm32) != 0); - if (__pyx_t_14) { +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); - /* "src/helpers/unfold.pyx":185 - * DZ -= sign(T1)*norm*C - * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 - * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 # <<<<<<<<<<<<<< - * DX -= sign(T1)*norm*A - * DY -= sign(T1)*norm*B + /* "View.MemoryView":238 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * */ - __pyx_t_12 = ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) == __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2)) != 0); - if (!__pyx_t_12) { - } else { - __pyx_t_14 = __pyx_t_12; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_12 = ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) == __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3)) != 0); - __pyx_t_14 = __pyx_t_12; - __pyx_L8_bool_binop_done:; - if (__pyx_t_14) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/helpers/unfold.pyx":186 - * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 - * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 - * DX -= sign(T1)*norm*A # <<<<<<<<<<<<<< - * DY -= sign(T1)*norm*B - * DZ -= sign(T1)*norm*B + /* "View.MemoryView":237 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * */ - __pyx_v_DX = (__pyx_v_DX - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) * __pyx_v_norm) * __pyx_v_A)); - /* "src/helpers/unfold.pyx":187 - * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 - * DX -= sign(T1)*norm*A - * DY -= sign(T1)*norm*B # <<<<<<<<<<<<<< - * DZ -= sign(T1)*norm*B - * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 - */ - __pyx_v_DY = (__pyx_v_DY - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) * __pyx_v_norm) * __pyx_v_B)); + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":188 - * DX -= sign(T1)*norm*A - * DY -= sign(T1)*norm*B - * DZ -= sign(T1)*norm*B # <<<<<<<<<<<<<< - * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 - * DX -= sign(T2)*norm*B +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) * __pyx_v_norm) * __pyx_v_B)); - /* "src/helpers/unfold.pyx":185 - * DZ -= sign(T1)*norm*C - * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 - * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 # <<<<<<<<<<<<<< - * DX -= sign(T1)*norm*A - * DY -= sign(T1)*norm*B - */ - } +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); - /* "src/helpers/unfold.pyx":189 - * DY -= sign(T1)*norm*B - * DZ -= sign(T1)*norm*B - * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 # <<<<<<<<<<<<<< - * DX -= sign(T2)*norm*B - * DY -= sign(T2)*norm*A - */ - __pyx_t_12 = ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2) == __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1)) != 0); - if (!__pyx_t_12) { - } else { - __pyx_t_14 = __pyx_t_12; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_12 = ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2) == __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3)) != 0); - __pyx_t_14 = __pyx_t_12; - __pyx_L11_bool_binop_done:; - if (__pyx_t_14) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":190 - * DZ -= sign(T1)*norm*B - * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 - * DX -= sign(T2)*norm*B # <<<<<<<<<<<<<< - * DY -= sign(T2)*norm*A - * DZ -= sign(T2)*norm*B - */ - __pyx_v_DX = (__pyx_v_DX - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2) * __pyx_v_norm) * __pyx_v_B)); +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "src/helpers/unfold.pyx":191 - * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 - * DX -= sign(T2)*norm*B - * DY -= sign(T2)*norm*A # <<<<<<<<<<<<<< - * DZ -= sign(T2)*norm*B - * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_v_DY = (__pyx_v_DY - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2) * __pyx_v_norm) * __pyx_v_A)); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "src/helpers/unfold.pyx":192 - * DX -= sign(T2)*norm*B - * DY -= sign(T2)*norm*A - * DZ -= sign(T2)*norm*B # <<<<<<<<<<<<<< - * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 - * DX -= sign(T3)*norm*B + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2) * __pyx_v_norm) * __pyx_v_B)); - /* "src/helpers/unfold.pyx":189 - * DY -= sign(T1)*norm*B - * DZ -= sign(T1)*norm*B - * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 # <<<<<<<<<<<<<< - * DX -= sign(T2)*norm*B - * DY -= sign(T2)*norm*A - */ - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":193 - * DY -= sign(T2)*norm*A - * DZ -= sign(T2)*norm*B - * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 # <<<<<<<<<<<<<< - * DX -= sign(T3)*norm*B - * DY -= sign(T3)*norm*B +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_12 = ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3) == __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1)) != 0); - if (!__pyx_t_12) { - } else { - __pyx_t_14 = __pyx_t_12; - goto __pyx_L14_bool_binop_done; + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } - __pyx_t_12 = ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3) == __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2)) != 0); - __pyx_t_14 = __pyx_t_12; - __pyx_L14_bool_binop_done:; - if (__pyx_t_14) { + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state); - /* "src/helpers/unfold.pyx":194 - * DZ -= sign(T2)*norm*B - * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 - * DX -= sign(T3)*norm*B # <<<<<<<<<<<<<< - * DY -= sign(T3)*norm*B - * DZ -= sign(T3)*norm*A - */ - __pyx_v_DX = (__pyx_v_DX - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3) * __pyx_v_norm) * __pyx_v_B)); + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":195 - * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 - * DX -= sign(T3)*norm*B - * DY -= sign(T3)*norm*B # <<<<<<<<<<<<<< - * DZ -= sign(T3)*norm*A - * else: # jump across one of three hexagons, orthogonal to a basis vector +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_v_DY = (__pyx_v_DY - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3) * __pyx_v_norm) * __pyx_v_B)); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/helpers/unfold.pyx":196 - * DX -= sign(T3)*norm*B - * DY -= sign(T3)*norm*B - * DZ -= sign(T3)*norm*A # <<<<<<<<<<<<<< - * else: # jump across one of three hexagons, orthogonal to a basis vector - * if fabs(T1) > norm2: + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3) * __pyx_v_norm) * __pyx_v_A)); - /* "src/helpers/unfold.pyx":193 - * DY -= sign(T2)*norm*A - * DZ -= sign(T2)*norm*B - * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 # <<<<<<<<<<<<<< - * DX -= sign(T3)*norm*B - * DY -= sign(T3)*norm*B + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * + * */ - } - /* "src/helpers/unfold.pyx":184 - * DY -= sign(T1)*norm*C - * DZ -= sign(T1)*norm*C - * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 # <<<<<<<<<<<<<< - * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 - * DX -= sign(T1)*norm*A +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_allocate_buffer", 0); + + /* "View.MemoryView":254 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: */ - goto __pyx_L6; - } + __pyx_v_self->free_data = 1; - /* "src/helpers/unfold.pyx":198 - * DZ -= sign(T3)*norm*A - * else: # jump across one of three hexagons, orthogonal to a basis vector - * if fabs(T1) > norm2: # <<<<<<<<<<<<<< - * DX -= sign(T1)*norm*A - * DY -= sign(T1)*norm*B + /* "View.MemoryView":255 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." */ - /*else*/ { - __pyx_t_14 = ((fabs(__pyx_v_T1) > __pyx_v_norm2) != 0); - if (__pyx_t_14) { + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); - /* "src/helpers/unfold.pyx":199 - * else: # jump across one of three hexagons, orthogonal to a basis vector - * if fabs(T1) > norm2: - * DX -= sign(T1)*norm*A # <<<<<<<<<<<<<< - * DY -= sign(T1)*norm*B - * DZ -= sign(T1)*norm*B + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * */ - __pyx_v_DX = (__pyx_v_DX - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) * __pyx_v_norm) * __pyx_v_A)); + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/unfold.pyx":200 - * if fabs(T1) > norm2: - * DX -= sign(T1)*norm*A - * DY -= sign(T1)*norm*B # <<<<<<<<<<<<<< - * DZ -= sign(T1)*norm*B - * if fabs(T2) > norm2: + /* "View.MemoryView":257 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: */ - __pyx_v_DY = (__pyx_v_DY - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) * __pyx_v_norm) * __pyx_v_B)); + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 257, __pyx_L1_error) - /* "src/helpers/unfold.pyx":201 - * DX -= sign(T1)*norm*A - * DY -= sign(T1)*norm*B - * DZ -= sign(T1)*norm*B # <<<<<<<<<<<<<< - * if fabs(T2) > norm2: - * DX -= sign(T2)*norm*B + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * */ - __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1) * __pyx_v_norm) * __pyx_v_B)); + } - /* "src/helpers/unfold.pyx":198 - * DZ -= sign(T3)*norm*A - * else: # jump across one of three hexagons, orthogonal to a basis vector - * if fabs(T1) > norm2: # <<<<<<<<<<<<<< - * DX -= sign(T1)*norm*A - * DY -= sign(T1)*norm*B + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - } + if (__pyx_v_self->dtype_is_object) { - /* "src/helpers/unfold.pyx":202 - * DY -= sign(T1)*norm*B - * DZ -= sign(T1)*norm*B - * if fabs(T2) > norm2: # <<<<<<<<<<<<<< - * DX -= sign(T2)*norm*B - * DY -= sign(T2)*norm*A + /* "View.MemoryView":260 + * + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None */ - __pyx_t_14 = ((fabs(__pyx_v_T2) > __pyx_v_norm2) != 0); - if (__pyx_t_14) { + __pyx_v_p = ((PyObject **)__pyx_v_self->data); - /* "src/helpers/unfold.pyx":203 - * DZ -= sign(T1)*norm*B - * if fabs(T2) > norm2: - * DX -= sign(T2)*norm*B # <<<<<<<<<<<<<< - * DY -= sign(T2)*norm*A - * DZ -= sign(T2)*norm*B + /* "View.MemoryView":261 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) */ - __pyx_v_DX = (__pyx_v_DX - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2) * __pyx_v_norm) * __pyx_v_B)); + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/unfold.pyx":204 - * if fabs(T2) > norm2: - * DX -= sign(T2)*norm*B - * DY -= sign(T2)*norm*A # <<<<<<<<<<<<<< - * DZ -= sign(T2)*norm*B - * if fabs(T3) > norm2: + /* "View.MemoryView":262 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 */ - __pyx_v_DY = (__pyx_v_DY - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2) * __pyx_v_norm) * __pyx_v_A)); + (__pyx_v_p[__pyx_v_i]) = Py_None; - /* "src/helpers/unfold.pyx":205 - * DX -= sign(T2)*norm*B - * DY -= sign(T2)*norm*A - * DZ -= sign(T2)*norm*B # <<<<<<<<<<<<<< - * if fabs(T3) > norm2: - * DX -= sign(T3)*norm*B + /* "View.MemoryView":263 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 + * */ - __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2) * __pyx_v_norm) * __pyx_v_B)); + Py_INCREF(Py_None); + } - /* "src/helpers/unfold.pyx":202 - * DY -= sign(T1)*norm*B - * DZ -= sign(T1)*norm*B - * if fabs(T2) > norm2: # <<<<<<<<<<<<<< - * DX -= sign(T2)*norm*B - * DY -= sign(T2)*norm*A + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - } + } - /* "src/helpers/unfold.pyx":206 - * DY -= sign(T2)*norm*A - * DZ -= sign(T2)*norm*B - * if fabs(T3) > norm2: # <<<<<<<<<<<<<< - * DX -= sign(T3)*norm*B - * DY -= sign(T3)*norm*B + /* "View.MemoryView":264 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * + * */ - __pyx_t_14 = ((fabs(__pyx_v_T3) > __pyx_v_norm2) != 0); - if (__pyx_t_14) { + __pyx_r = 0; + goto __pyx_L0; - /* "src/helpers/unfold.pyx":207 - * DZ -= sign(T2)*norm*B - * if fabs(T3) > norm2: - * DX -= sign(T3)*norm*B # <<<<<<<<<<<<<< - * DY -= sign(T3)*norm*B - * DZ -= sign(T3)*norm*A + /* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * + * */ - __pyx_v_DX = (__pyx_v_DX - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3) * __pyx_v_norm) * __pyx_v_B)); - /* "src/helpers/unfold.pyx":208 - * if fabs(T3) > norm2: - * DX -= sign(T3)*norm*B - * DY -= sign(T3)*norm*B # <<<<<<<<<<<<<< - * DZ -= sign(T3)*norm*A - * unfold[i] += DX - */ - __pyx_v_DY = (__pyx_v_DY - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3) * __pyx_v_norm) * __pyx_v_B)); + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":209 - * DX -= sign(T3)*norm*B - * DY -= sign(T3)*norm*B - * DZ -= sign(T3)*norm*A # <<<<<<<<<<<<<< - * unfold[i] += DX - * unfold[i+1] += DY +/* "View.MemoryView":268 + * + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ - __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3) * __pyx_v_norm) * __pyx_v_A)); - /* "src/helpers/unfold.pyx":206 - * DY -= sign(T2)*norm*A - * DZ -= sign(T2)*norm*B - * if fabs(T3) > norm2: # <<<<<<<<<<<<<< - * DX -= sign(T3)*norm*B - * DY -= sign(T3)*norm*B +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_cwrapper", 0); + + /* "View.MemoryView":270 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: */ - } - } - __pyx_L6:; + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_n_s_fortran); + __pyx_t_1 = __pyx_n_s_fortran; + } else { + __Pyx_INCREF(__pyx_n_s_c); + __pyx_t_1 = __pyx_n_s_c; + } + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/unfold.pyx":176 - * DZ = curr[i+2] - prev[i+2] - * D = DX*DX+DY*DY+DZ*DZ - * if D > norm22: # if there was a jump # <<<<<<<<<<<<<< - * T1 = DX*A+DY*B+DZ*B - * T2 = DX*B+DY*A+DZ*B + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. + * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - } + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { - /* "src/helpers/unfold.pyx":210 - * DY -= sign(T3)*norm*B - * DZ -= sign(T3)*norm*A - * unfold[i] += DX # <<<<<<<<<<<<<< - * unfold[i+1] += DY - * unfold[i+2] += DZ + /* "View.MemoryView":273 + * + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) */ - __pyx_t_13 = __pyx_v_i; - (__pyx_v_unfold[__pyx_t_13]) = ((__pyx_v_unfold[__pyx_t_13]) + __pyx_v_DX); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/helpers/unfold.pyx":211 - * DZ -= sign(T3)*norm*A - * unfold[i] += DX - * unfold[i+1] += DY # <<<<<<<<<<<<<< - * unfold[i+2] += DZ + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. * + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - __pyx_t_15 = (__pyx_v_i + 1); - (__pyx_v_unfold[__pyx_t_15]) = ((__pyx_v_unfold[__pyx_t_15]) + __pyx_v_DY); + goto __pyx_L3; + } - /* "src/helpers/unfold.pyx":212 - * unfold[i] += DX - * unfold[i+1] += DY - * unfold[i+2] += DZ # <<<<<<<<<<<<<< + /* "View.MemoryView":275 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf * + */ + /*else*/ { + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode)) __PYX_ERR(1, 275, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 275, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "View.MemoryView":276 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< * + * return result */ - __pyx_t_15 = (__pyx_v_i + 2); - (__pyx_v_unfold[__pyx_t_15]) = ((__pyx_v_unfold[__pyx_t_15]) + __pyx_v_DZ); + __pyx_v_result->data = __pyx_v_buf; } + __pyx_L3:; + + /* "View.MemoryView":278 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "src/helpers/unfold.pyx":129 + /* "View.MemoryView":268 * - * @cython.boundscheck(False) - * def unfoldCharmmOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, - * np.ndarray[np.float64_t,ndim=2] xyz_traj_curr, + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dimensions.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.unfold.unfoldCharmmOcta", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dimensions.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/unfold.pyx":216 - * - * @cython.boundscheck(False) - * def minDistBox(np.ndarray[np.float64_t,ndim=1,mode="c"] aufpunkt, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] com, - * np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, +/* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6unfold_7minDistBox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_6unfold_6minDistBox[] = "\n translateBox(vec, com, xyz, boxlength, atoms_per_residue, residue_first_atom)\n\n Translate the box by a given vector\n\n Args:\n aufpunkt .. vector by which the coordinates are translated\n com .. centers of mass of all molecules in the box\n xyz .. coordinates of all atoms\n boxlength .. edge length of the cubic box\n atoms_per_residue .. array showing how many atoms each residue contains\n residue_first_atom .. index of the first atom of each residue\n "; -static PyMethodDef __pyx_mdef_11newanalysis_6unfold_7minDistBox = {"minDistBox", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6unfold_7minDistBox, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_6minDistBox}; -static PyObject *__pyx_pw_11newanalysis_6unfold_7minDistBox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_aufpunkt = 0; - PyArrayObject *__pyx_v_com = 0; - PyArrayObject *__pyx_v_xyz = 0; - PyObject *__pyx_v_boxlength = 0; - PyArrayObject *__pyx_v_atoms_per_residue = 0; - PyArrayObject *__pyx_v_residue_first_atom = 0; +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("minDistBox (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 304, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_com,&__pyx_n_s_xyz,&__pyx_n_s_boxlength,&__pyx_n_s_atoms_per_residue,&__pyx_n_s_residue_first_atom,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_com)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, 1); __PYX_ERR(0, 216, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, 2); __PYX_ERR(0, 216, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, 3); __PYX_ERR(0, 216, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_atoms_per_residue)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, 4); __PYX_ERR(0, 216, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_residue_first_atom)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, 5); __PYX_ERR(0, 216, __pyx_L3_error) + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "minDistBox") < 0)) __PYX_ERR(0, 216, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 304, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } - __pyx_v_aufpunkt = ((PyArrayObject *)values[0]); - __pyx_v_com = ((PyArrayObject *)values[1]); - __pyx_v_xyz = ((PyArrayObject *)values[2]); - __pyx_v_boxlength = values[3]; - __pyx_v_atoms_per_residue = ((PyArrayObject *)values[4]); - __pyx_v_residue_first_atom = ((PyArrayObject *)values[5]); + __pyx_v_name = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 304, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.unfold.minDistBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_aufpunkt), __pyx_ptype_5numpy_ndarray, 1, "aufpunkt", 0))) __PYX_ERR(0, 216, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_com), __pyx_ptype_5numpy_ndarray, 1, "com", 0))) __PYX_ERR(0, 217, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 218, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_atoms_per_residue), __pyx_ptype_5numpy_ndarray, 1, "atoms_per_residue", 0))) __PYX_ERR(0, 220, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_residue_first_atom), __pyx_ptype_5numpy_ndarray, 1, "residue_first_atom", 0))) __PYX_ERR(0, 221, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6unfold_6minDistBox(__pyx_self, __pyx_v_aufpunkt, __pyx_v_com, __pyx_v_xyz, __pyx_v_boxlength, __pyx_v_atoms_per_residue, __pyx_v_residue_first_atom); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6unfold_6minDistBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_aufpunkt, PyArrayObject *__pyx_v_com, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_boxlength, PyArrayObject *__pyx_v_atoms_per_residue, PyArrayObject *__pyx_v_residue_first_atom) { - double __pyx_v_shift[3]; - double *__pyx_v_auf; - double __pyx_v_boxl; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_nmol; - double *__pyx_v_ccom; - double *__pyx_v_cxyz; - int *__pyx_v_apr; - int *__pyx_v_rfa; - CYTHON_UNUSED int __pyx_v_natom; - __Pyx_LocalBuf_ND __pyx_pybuffernd_atoms_per_residue; - __Pyx_Buffer __pyx_pybuffer_atoms_per_residue; - __Pyx_LocalBuf_ND __pyx_pybuffernd_aufpunkt; - __Pyx_Buffer __pyx_pybuffer_aufpunkt; - __Pyx_LocalBuf_ND __pyx_pybuffernd_com; - __Pyx_Buffer __pyx_pybuffer_com; - __Pyx_LocalBuf_ND __pyx_pybuffernd_residue_first_atom; - __Pyx_Buffer __pyx_pybuffer_residue_first_atom; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; - __Pyx_Buffer __pyx_pybuffer_xyz; - PyObject *__pyx_r = NULL; +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; __Pyx_RefNannyDeclarations - double __pyx_t_1; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - long __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("minDistBox", 0); - __pyx_pybuffer_aufpunkt.pybuffer.buf = NULL; - __pyx_pybuffer_aufpunkt.refcount = 0; - __pyx_pybuffernd_aufpunkt.data = NULL; - __pyx_pybuffernd_aufpunkt.rcbuffer = &__pyx_pybuffer_aufpunkt; - __pyx_pybuffer_com.pybuffer.buf = NULL; - __pyx_pybuffer_com.refcount = 0; - __pyx_pybuffernd_com.data = NULL; - __pyx_pybuffernd_com.rcbuffer = &__pyx_pybuffer_com; - __pyx_pybuffer_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_xyz.refcount = 0; - __pyx_pybuffernd_xyz.data = NULL; - __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; - __pyx_pybuffer_atoms_per_residue.pybuffer.buf = NULL; - __pyx_pybuffer_atoms_per_residue.refcount = 0; - __pyx_pybuffernd_atoms_per_residue.data = NULL; - __pyx_pybuffernd_atoms_per_residue.rcbuffer = &__pyx_pybuffer_atoms_per_residue; - __pyx_pybuffer_residue_first_atom.pybuffer.buf = NULL; - __pyx_pybuffer_residue_first_atom.refcount = 0; - __pyx_pybuffernd_residue_first_atom.data = NULL; - __pyx_pybuffernd_residue_first_atom.rcbuffer = &__pyx_pybuffer_residue_first_atom; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer, (PyObject*)__pyx_v_aufpunkt, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 216, __pyx_L1_error) - } - __pyx_pybuffernd_aufpunkt.diminfo[0].strides = __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_aufpunkt.diminfo[0].shape = __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_com.rcbuffer->pybuffer, (PyObject*)__pyx_v_com, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 216, __pyx_L1_error) - } - __pyx_pybuffernd_com.diminfo[0].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_com.diminfo[0].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_com.diminfo[1].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_com.diminfo[1].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 216, __pyx_L1_error) - } - __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer, (PyObject*)__pyx_v_atoms_per_residue, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 216, __pyx_L1_error) - } - __pyx_pybuffernd_atoms_per_residue.diminfo[0].strides = __pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_atoms_per_residue.diminfo[0].shape = __pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer, (PyObject*)__pyx_v_residue_first_atom, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 216, __pyx_L1_error) - } - __pyx_pybuffernd_residue_first_atom.diminfo[0].strides = __pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_residue_first_atom.diminfo[0].shape = __pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer.shape[0]; - - /* "src/helpers/unfold.pyx":237 - * - * cdef double[3] shift - * cdef double* auf = aufpunkt.data # <<<<<<<<<<<<<< - * cdef double boxl = boxlength - * cdef int i, j, k, nmol=len(com) - */ - __pyx_v_auf = ((double *)__pyx_v_aufpunkt->data); - - /* "src/helpers/unfold.pyx":238 - * cdef double[3] shift - * cdef double* auf = aufpunkt.data - * cdef double boxl = boxlength # <<<<<<<<<<<<<< - * cdef int i, j, k, nmol=len(com) - * cdef double *ccom = com.data - */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_boxlength); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error) - __pyx_v_boxl = ((double)__pyx_t_1); - - /* "src/helpers/unfold.pyx":239 - * cdef double* auf = aufpunkt.data - * cdef double boxl = boxlength - * cdef int i, j, k, nmol=len(com) # <<<<<<<<<<<<<< - * cdef double *ccom = com.data - * cdef double *cxyz = xyz.data - */ - __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_com)); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 239, __pyx_L1_error) - __pyx_v_nmol = __pyx_t_2; - - /* "src/helpers/unfold.pyx":240 - * cdef double boxl = boxlength - * cdef int i, j, k, nmol=len(com) - * cdef double *ccom = com.data # <<<<<<<<<<<<<< - * cdef double *cxyz = xyz.data - * cdef int* apr = atoms_per_residue.data - */ - __pyx_v_ccom = ((double *)__pyx_v_com->data); - - /* "src/helpers/unfold.pyx":241 - * cdef int i, j, k, nmol=len(com) - * cdef double *ccom = com.data - * cdef double *cxyz = xyz.data # <<<<<<<<<<<<<< - * cdef int* apr = atoms_per_residue.data - * cdef int* rfa = residue_first_atom.data - */ - __pyx_v_cxyz = ((double *)__pyx_v_xyz->data); - - /* "src/helpers/unfold.pyx":242 - * cdef double *ccom = com.data - * cdef double *cxyz = xyz.data - * cdef int* apr = atoms_per_residue.data # <<<<<<<<<<<<<< - * cdef int* rfa = residue_first_atom.data - * cdef int natom = len(xyz) - */ - __pyx_v_apr = ((int *)__pyx_v_atoms_per_residue->data); - - /* "src/helpers/unfold.pyx":243 - * cdef double *cxyz = xyz.data - * cdef int* apr = atoms_per_residue.data - * cdef int* rfa = residue_first_atom.data # <<<<<<<<<<<<<< - * cdef int natom = len(xyz) - * - */ - __pyx_v_rfa = ((int *)__pyx_v_residue_first_atom->data); - - /* "src/helpers/unfold.pyx":244 - * cdef int* apr = atoms_per_residue.data - * cdef int* rfa = residue_first_atom.data - * cdef int natom = len(xyz) # <<<<<<<<<<<<<< - * - * for i in range(nmol): - */ - __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 244, __pyx_L1_error) - __pyx_v_natom = ((int)__pyx_t_2); + __Pyx_RefNannySetupContext("__init__", 0); - /* "src/helpers/unfold.pyx":246 - * cdef int natom = len(xyz) - * - * for i in range(nmol): # <<<<<<<<<<<<<< - * for j in range(3): - * ccom[i*3+j]-=auf[j] + /* "View.MemoryView":305 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name */ - __pyx_t_3 = __pyx_v_nmol; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; - /* "src/helpers/unfold.pyx":247 - * - * for i in range(nmol): - * for j in range(3): # <<<<<<<<<<<<<< - * ccom[i*3+j]-=auf[j] - * shift[j] = boxl*floor(ccom[i*3+j]/boxl + 0.5) + /* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ - for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) { - __pyx_v_j = __pyx_t_6; - /* "src/helpers/unfold.pyx":248 - * for i in range(nmol): - * for j in range(3): - * ccom[i*3+j]-=auf[j] # <<<<<<<<<<<<<< - * shift[j] = boxl*floor(ccom[i*3+j]/boxl + 0.5) - * ccom[i*3+j]-=shift[j] - */ - __pyx_t_7 = ((__pyx_v_i * 3) + __pyx_v_j); - (__pyx_v_ccom[__pyx_t_7]) = ((__pyx_v_ccom[__pyx_t_7]) - (__pyx_v_auf[__pyx_v_j])); + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":249 - * for j in range(3): - * ccom[i*3+j]-=auf[j] - * shift[j] = boxl*floor(ccom[i*3+j]/boxl + 0.5) # <<<<<<<<<<<<<< - * ccom[i*3+j]-=shift[j] +/* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name * */ - __pyx_t_1 = (__pyx_v_ccom[((__pyx_v_i * 3) + __pyx_v_j)]); - if (unlikely(__pyx_v_boxl == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 249, __pyx_L1_error) - } - (__pyx_v_shift[__pyx_v_j]) = (__pyx_v_boxl * floor(((__pyx_t_1 / __pyx_v_boxl) + 0.5))); - /* "src/helpers/unfold.pyx":250 - * ccom[i*3+j]-=auf[j] - * shift[j] = boxl*floor(ccom[i*3+j]/boxl + 0.5) - * ccom[i*3+j]-=shift[j] # <<<<<<<<<<<<<< - * - * for k in range(rfa[i],rfa[i]+apr[i]): - */ - __pyx_t_7 = ((__pyx_v_i * 3) + __pyx_v_j); - (__pyx_v_ccom[__pyx_t_7]) = ((__pyx_v_ccom[__pyx_t_7]) - (__pyx_v_shift[__pyx_v_j])); - } +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - /* "src/helpers/unfold.pyx":252 - * ccom[i*3+j]-=shift[j] - * - * for k in range(rfa[i],rfa[i]+apr[i]): # <<<<<<<<<<<<<< - * for j in range(3): - * cxyz[k*3+j]-= shift[j] - */ - __pyx_t_6 = ((__pyx_v_rfa[__pyx_v_i]) + (__pyx_v_apr[__pyx_v_i])); - __pyx_t_8 = __pyx_t_6; - for (__pyx_t_9 = (__pyx_v_rfa[__pyx_v_i]); __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { - __pyx_v_k = __pyx_t_9; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":253 - * - * for k in range(rfa[i],rfa[i]+apr[i]): - * for j in range(3): # <<<<<<<<<<<<<< - * cxyz[k*3+j]-= shift[j] - * - */ - for (__pyx_t_10 = 0; __pyx_t_10 < 3; __pyx_t_10+=1) { - __pyx_v_j = __pyx_t_10; +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/helpers/unfold.pyx":254 - * for k in range(rfa[i],rfa[i]+apr[i]): - * for j in range(3): - * cxyz[k*3+j]-= shift[j] # <<<<<<<<<<<<<< - * + /* "View.MemoryView":307 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< * + * cdef generic = Enum("") */ - __pyx_t_7 = ((__pyx_v_k * 3) + __pyx_v_j); - (__pyx_v_cxyz[__pyx_t_7]) = ((__pyx_v_cxyz[__pyx_t_7]) - (__pyx_v_shift[__pyx_v_j])); - } - } - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; - /* "src/helpers/unfold.pyx":216 + /* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name * - * @cython.boundscheck(False) - * def minDistBox(np.ndarray[np.float64_t,ndim=1,mode="c"] aufpunkt, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] com, - * np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.unfold.minDistBox", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/unfold.pyx":258 - * - * @cython.boundscheck(False) - * def minDistCenterBox(np.ndarray[np.float64_t,ndim=1,mode='c'] aufpunkt, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] com, - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor, +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6unfold_9minDistCenterBox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_6unfold_8minDistCenterBox[] = "\n translateBox(vec, com, xyz, boxlength, atoms_per_residue, residue_first_atom)\n\n Translate the box by a given vector\n\n Args:\n aufpunkt .. vector by which the coordinates are translated\n com .. centers of mass of all molecules in the box\n xyz .. coordinates of all atoms\n boxlength .. edge length of the cubic box\n atoms_per_residue .. array showing how many atoms each residue contains\n residue_first_atom .. index of the first atom of each residue\n "; -static PyMethodDef __pyx_mdef_11newanalysis_6unfold_9minDistCenterBox = {"minDistCenterBox", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6unfold_9minDistCenterBox, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_8minDistCenterBox}; -static PyObject *__pyx_pw_11newanalysis_6unfold_9minDistCenterBox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_aufpunkt = 0; - PyArrayObject *__pyx_v_com = 0; - PyArrayObject *__pyx_v_coor = 0; - __pyx_t_5numpy_float64_t __pyx_v_boxl; - PyArrayObject *__pyx_v_apr = 0; - PyArrayObject *__pyx_v_rfa = 0; +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("minDistCenterBox (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_com,&__pyx_n_s_coor,&__pyx_n_s_boxl,&__pyx_n_s_apr,&__pyx_n_s_rfa,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_aufpunkt)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_com)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, 1); __PYX_ERR(0, 258, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, 2); __PYX_ERR(0, 258, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, 3); __PYX_ERR(0, 258, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, 4); __PYX_ERR(0, 258, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rfa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, 5); __PYX_ERR(0, 258, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "minDistCenterBox") < 0)) __PYX_ERR(0, 258, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - } - __pyx_v_aufpunkt = ((PyArrayObject *)values[0]); - __pyx_v_com = ((PyArrayObject *)values[1]); - __pyx_v_coor = ((PyArrayObject *)values[2]); - __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 261, __pyx_L3_error) - __pyx_v_apr = ((PyArrayObject *)values[4]); - __pyx_v_rfa = ((PyArrayObject *)values[5]); - } + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 258, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.unfold.minDistCenterBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_aufpunkt), __pyx_ptype_5numpy_ndarray, 1, "aufpunkt", 0))) __PYX_ERR(0, 258, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_com), __pyx_ptype_5numpy_ndarray, 1, "com", 0))) __PYX_ERR(0, 259, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor), __pyx_ptype_5numpy_ndarray, 1, "coor", 0))) __PYX_ERR(0, 260, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_apr), __pyx_ptype_5numpy_ndarray, 1, "apr", 0))) __PYX_ERR(0, 262, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rfa), __pyx_ptype_5numpy_ndarray, 1, "rfa", 0))) __PYX_ERR(0, 263, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_6unfold_8minDistCenterBox(__pyx_self, __pyx_v_aufpunkt, __pyx_v_com, __pyx_v_coor, __pyx_v_boxl, __pyx_v_apr, __pyx_v_rfa); + __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6unfold_8minDistCenterBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_aufpunkt, PyArrayObject *__pyx_v_com, PyArrayObject *__pyx_v_coor, __pyx_t_5numpy_float64_t __pyx_v_boxl, PyArrayObject *__pyx_v_apr, PyArrayObject *__pyx_v_rfa) { - double __pyx_v_shift[3]; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_nmol; - CYTHON_UNUSED int __pyx_v_natom; - __Pyx_LocalBuf_ND __pyx_pybuffernd_apr; - __Pyx_Buffer __pyx_pybuffer_apr; - __Pyx_LocalBuf_ND __pyx_pybuffernd_aufpunkt; - __Pyx_Buffer __pyx_pybuffer_aufpunkt; - __Pyx_LocalBuf_ND __pyx_pybuffernd_com; - __Pyx_Buffer __pyx_pybuffer_com; - __Pyx_LocalBuf_ND __pyx_pybuffernd_coor; - __Pyx_Buffer __pyx_pybuffer_coor; - __Pyx_LocalBuf_ND __pyx_pybuffernd_rfa; - __Pyx_Buffer __pyx_pybuffer_rfa; +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - __pyx_t_5numpy_float64_t __pyx_t_8; - __pyx_t_5numpy_int32_t __pyx_t_9; - __pyx_t_5numpy_int32_t __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("minDistCenterBox", 0); - __pyx_pybuffer_aufpunkt.pybuffer.buf = NULL; - __pyx_pybuffer_aufpunkt.refcount = 0; - __pyx_pybuffernd_aufpunkt.data = NULL; - __pyx_pybuffernd_aufpunkt.rcbuffer = &__pyx_pybuffer_aufpunkt; - __pyx_pybuffer_com.pybuffer.buf = NULL; - __pyx_pybuffer_com.refcount = 0; - __pyx_pybuffernd_com.data = NULL; - __pyx_pybuffernd_com.rcbuffer = &__pyx_pybuffer_com; - __pyx_pybuffer_coor.pybuffer.buf = NULL; - __pyx_pybuffer_coor.refcount = 0; - __pyx_pybuffernd_coor.data = NULL; - __pyx_pybuffernd_coor.rcbuffer = &__pyx_pybuffer_coor; - __pyx_pybuffer_apr.pybuffer.buf = NULL; - __pyx_pybuffer_apr.refcount = 0; - __pyx_pybuffernd_apr.data = NULL; - __pyx_pybuffernd_apr.rcbuffer = &__pyx_pybuffer_apr; - __pyx_pybuffer_rfa.pybuffer.buf = NULL; - __pyx_pybuffer_rfa.refcount = 0; - __pyx_pybuffernd_rfa.data = NULL; - __pyx_pybuffernd_rfa.rcbuffer = &__pyx_pybuffer_rfa; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer, (PyObject*)__pyx_v_aufpunkt, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 258, __pyx_L1_error) - } - __pyx_pybuffernd_aufpunkt.diminfo[0].strides = __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_aufpunkt.diminfo[0].shape = __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_com.rcbuffer->pybuffer, (PyObject*)__pyx_v_com, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 258, __pyx_L1_error) - } - __pyx_pybuffernd_com.diminfo[0].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_com.diminfo[0].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_com.diminfo[1].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_com.diminfo[1].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 258, __pyx_L1_error) - } - __pyx_pybuffernd_coor.diminfo[0].strides = __pyx_pybuffernd_coor.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor.diminfo[0].shape = __pyx_pybuffernd_coor.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor.diminfo[1].strides = __pyx_pybuffernd_coor.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor.diminfo[1].shape = __pyx_pybuffernd_coor.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_apr.rcbuffer->pybuffer, (PyObject*)__pyx_v_apr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 258, __pyx_L1_error) - } - __pyx_pybuffernd_apr.diminfo[0].strides = __pyx_pybuffernd_apr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_apr.diminfo[0].shape = __pyx_pybuffernd_apr.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rfa.rcbuffer->pybuffer, (PyObject*)__pyx_v_rfa, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 258, __pyx_L1_error) - } - __pyx_pybuffernd_rfa.diminfo[0].strides = __pyx_pybuffernd_rfa.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rfa.diminfo[0].shape = __pyx_pybuffernd_rfa.rcbuffer->pybuffer.shape[0]; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "src/helpers/unfold.pyx":279 - * - * cdef double[3] shift - * cdef int i, j, k, nmol = com.shape[0], natom = coor.shape[0] # <<<<<<<<<<<<<< - * - * for i in range(nmol): + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: */ - __pyx_v_nmol = (__pyx_v_com->dimensions[0]); - __pyx_v_natom = (__pyx_v_coor->dimensions[0]); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/helpers/unfold.pyx":281 - * cdef int i, j, k, nmol = com.shape[0], natom = coor.shape[0] - * - * for i in range(nmol): # <<<<<<<<<<<<<< - * for j in range(3): - * com[i,j] -= aufpunkt[j] + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) */ - __pyx_t_1 = __pyx_v_nmol; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/helpers/unfold.pyx":282 - * - * for i in range(nmol): - * for j in range(3): # <<<<<<<<<<<<<< - * com[i,j] -= aufpunkt[j] - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { - __pyx_v_j = __pyx_t_4; + __pyx_t_2 = (__pyx_v__dict != Py_None); + if (__pyx_t_2) { - /* "src/helpers/unfold.pyx":283 - * for i in range(nmol): - * for j in range(3): - * com[i,j] -= aufpunkt[j] # <<<<<<<<<<<<<< - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) - * com[i,j] -= shift[j] + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: */ - __pyx_t_5 = __pyx_v_j; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_pybuffernd_aufpunkt.diminfo[0].shape; - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = __pyx_v_j; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_com.diminfo[0].shape; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_com.diminfo[1].shape; - *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_com.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_com.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_com.diminfo[1].strides) -= (*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_aufpunkt.diminfo[0].strides)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "src/helpers/unfold.pyx":284 - * for j in range(3): - * com[i,j] -= aufpunkt[j] - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) # <<<<<<<<<<<<<< - * com[i,j] -= shift[j] - * + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.name is not None */ - __pyx_t_5 = __pyx_v_i; - __pyx_t_7 = __pyx_v_j; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_pybuffernd_com.diminfo[0].shape; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_com.diminfo[1].shape; - __pyx_t_8 = (*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_com.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_com.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_com.diminfo[1].strides)); - if (unlikely(__pyx_v_boxl == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 284, __pyx_L1_error) - } - (__pyx_v_shift[__pyx_v_j]) = (__pyx_v_boxl * floor(((__pyx_t_8 / __pyx_v_boxl) + 0.5))); + __pyx_v_use_setstate = 1; - /* "src/helpers/unfold.pyx":285 - * com[i,j] -= aufpunkt[j] - * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) - * com[i,j] -= shift[j] # <<<<<<<<<<<<<< - * - * for k in range(rfa[i], rfa[i]+apr[i]): + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - __pyx_t_7 = __pyx_v_i; - __pyx_t_5 = __pyx_v_j; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_com.diminfo[0].shape; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_pybuffernd_com.diminfo[1].shape; - *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_com.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_com.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_com.diminfo[1].strides) -= (__pyx_v_shift[__pyx_v_j]); - } + goto __pyx_L3; + } - /* "src/helpers/unfold.pyx":287 - * com[i,j] -= shift[j] - * - * for k in range(rfa[i], rfa[i]+apr[i]): # <<<<<<<<<<<<<< - * for j in range(3): - * coor[k,j] -= (aufpunkt[j] + shift[j]) + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = self.name is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state */ - __pyx_t_5 = __pyx_v_i; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_pybuffernd_rfa.diminfo[0].shape; - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_apr.diminfo[0].shape; - __pyx_t_9 = ((*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_rfa.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_rfa.diminfo[0].strides)) + (*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_apr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_apr.diminfo[0].strides))); - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_rfa.diminfo[0].shape; - __pyx_t_10 = __pyx_t_9; - for (__pyx_t_4 = (*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_rfa.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rfa.diminfo[0].strides)); __pyx_t_4 < __pyx_t_10; __pyx_t_4+=1) { - __pyx_v_k = __pyx_t_4; + /*else*/ { + __pyx_t_2 = (__pyx_v_self->name != Py_None); + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; - /* "src/helpers/unfold.pyx":288 - * - * for k in range(rfa[i], rfa[i]+apr[i]): - * for j in range(3): # <<<<<<<<<<<<<< - * coor[k,j] -= (aufpunkt[j] + shift[j]) - * + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: */ - for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { - __pyx_v_j = __pyx_t_11; + if (__pyx_v_use_setstate) { - /* "src/helpers/unfold.pyx":289 - * for k in range(rfa[i], rfa[i]+apr[i]): - * for j in range(3): - * coor[k,j] -= (aufpunkt[j] + shift[j]) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) + /* "(tree fragment)":13 + * use_setstate = self.name is not None + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: */ - __pyx_t_5 = __pyx_v_j; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_pybuffernd_aufpunkt.diminfo[0].shape; - __pyx_t_6 = __pyx_v_k; - __pyx_t_12 = __pyx_v_j; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_coor.diminfo[0].shape; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_pybuffernd_coor.diminfo[1].shape; - *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_coor.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_coor.diminfo[1].strides) -= ((*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_aufpunkt.diminfo[0].strides)) + (__pyx_v_shift[__pyx_v_j])); - } - } } - /* "src/helpers/unfold.pyx":258 - * - * @cython.boundscheck(False) - * def minDistCenterBox(np.ndarray[np.float64_t,ndim=1,mode='c'] aufpunkt, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] com, - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor, + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_apr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rfa.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.unfold.minDistCenterBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_apr.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rfa.rcbuffer->pybuffer); - __pyx_L2:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/unfold.pyx":292 - * - * @cython.boundscheck(False) - * def minVec(double [:] coor1, double [:] coor2, double boxl, double boxl2): # <<<<<<<<<<<<<< - * """ - * minVec(xyz1, xyz2, boxl, boxl2) +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6unfold_11minVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_6unfold_10minVec[] = "\n minVec(xyz1, xyz2, boxl, boxl2)\n\n Gives the shortes vector pointing from xyz1 to xyz2 considering periodic boundary conditions.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_6unfold_11minVec = {"minVec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6unfold_11minVec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_10minVec}; -static PyObject *__pyx_pw_11newanalysis_6unfold_11minVec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxl; - double __pyx_v_boxl2; +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("minVec (wrapper)", 0); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 16, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_boxl,&__pyx_n_s_boxl2,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor1)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minVec", 1, 4, 4, 1); __PYX_ERR(0, 292, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minVec", 1, 4, 4, 2); __PYX_ERR(0, 292, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minVec", 1, 4, 4, 3); __PYX_ERR(0, 292, __pyx_L3_error) + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "minVec") < 0)) __PYX_ERR(0, 292, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 292, __pyx_L3_error) - __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 292, __pyx_L3_error) - __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error) - __pyx_v_boxl2 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error) + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("minVec", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 292, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.unfold.minVec", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_6unfold_10minVec(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_boxl, __pyx_v_boxl2); + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6unfold_10minVec(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, double __pyx_v_boxl, double __pyx_v_boxl2) { - __Pyx_memviewslice __pyx_v_delta = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_i; +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("minVec", 0); + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/helpers/unfold.pyx":298 - * Gives the shortes vector pointing from xyz1 to xyz2 considering periodic boundary conditions. - * """ - * cdef double [:] delta = np.zeros(3) # <<<<<<<<<<<<<< - * cdef int i - * + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_delta = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; - /* "src/helpers/unfold.pyx":301 - * cdef int i - * - * for i in range(3): # <<<<<<<<<<<<<< - * delta[i] = coor2[i] - coor1[i] - * if fabs(delta[i]) > boxl2: + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ - for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - /* "src/helpers/unfold.pyx":302 - * - * for i in range(3): - * delta[i] = coor2[i] - coor1[i] # <<<<<<<<<<<<<< - * if fabs(delta[i]) > boxl2: - * delta[i] -= sign(delta[i]) * boxl - */ - __pyx_t_6 = __pyx_v_i; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor2.shape[0]; - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor1.shape[0]; - __pyx_t_8 = __pyx_v_i; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_delta.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_delta.data + __pyx_t_8 * __pyx_v_delta.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_coor2.data + __pyx_t_6 * __pyx_v_coor2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coor1.data + __pyx_t_7 * __pyx_v_coor1.strides[0]) )))); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/helpers/unfold.pyx":303 - * for i in range(3): - * delta[i] = coor2[i] - coor1[i] - * if fabs(delta[i]) > boxl2: # <<<<<<<<<<<<<< - * delta[i] -= sign(delta[i]) * boxl +/* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo * - */ - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_delta.shape[0]; - __pyx_t_9 = ((fabs((*((double *) ( /* dim=0 */ (__pyx_v_delta.data + __pyx_t_7 * __pyx_v_delta.strides[0]) )))) > __pyx_v_boxl2) != 0); - if (__pyx_t_9) { - - /* "src/helpers/unfold.pyx":304 - * delta[i] = coor2[i] - coor1[i] - * if fabs(delta[i]) > boxl2: - * delta[i] -= sign(delta[i]) * boxl # <<<<<<<<<<<<<< - * - * return np.asarray(delta) - */ - __pyx_t_7 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_delta.shape[0]; - __pyx_t_6 = __pyx_v_i; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_delta.shape[0]; - *((double *) ( /* dim=0 */ (__pyx_v_delta.data + __pyx_t_6 * __pyx_v_delta.strides[0]) )) -= (__pyx_f_11newanalysis_6unfold_sign((*((double *) ( /* dim=0 */ (__pyx_v_delta.data + __pyx_t_7 * __pyx_v_delta.strides[0]) )))) * __pyx_v_boxl); - - /* "src/helpers/unfold.pyx":303 - * for i in range(3): - * delta[i] = coor2[i] - coor1[i] - * if fabs(delta[i]) > boxl2: # <<<<<<<<<<<<<< - * delta[i] -= sign(delta[i]) * boxl - * - */ - } - } - - /* "src/helpers/unfold.pyx":306 - * delta[i] -= sign(delta[i]) * boxl - * - * return np.asarray(delta) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_delta, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_10, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "src/helpers/unfold.pyx":292 - * - * @cython.boundscheck(False) - * def minVec(double [:] coor1, double [:] coor2, double boxl, double boxl2): # <<<<<<<<<<<<<< - * """ - * minVec(xyz1, xyz2, boxl, boxl2) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("newanalysis.unfold.minVec", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_delta, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor2, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/helpers/unfold.pyx":309 - * - * @cython.boundscheck(False) - * def minDist(double [:] coor1, double [:] coor2, double boxl, double boxl2): # <<<<<<<<<<<<<< - * """ - * minDist(xyz1, xyz2, boxl, boxl2) + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6unfold_13minDist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_6unfold_12minDist[] = "\n minDist(xyz1, xyz2, boxl, boxl2)\n\n Gives the shortest distance between xyz1 and xyz2 considering periodic boundary conditions.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_6unfold_13minDist = {"minDist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6unfold_13minDist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_12minDist}; -static PyObject *__pyx_pw_11newanalysis_6unfold_13minDist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxl; - double __pyx_v_boxl2; +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("minDist (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 349, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_boxl,&__pyx_n_s_boxl2,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor1)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDist", 1, 4, 4, 1); __PYX_ERR(0, 309, __pyx_L3_error) + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("minDist", 1, 4, 4, 2); __PYX_ERR(0, 309, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 349, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("minDist", 1, 4, 4, 3); __PYX_ERR(0, 309, __pyx_L3_error) + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype_is_object); + if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "minDist") < 0)) __PYX_ERR(0, 309, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 349, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); } - __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 309, __pyx_L3_error) - __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 309, __pyx_L3_error) - __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error) - __pyx_v_boxl2 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("minDist", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 309, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 349, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.unfold.minDist", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_6unfold_12minDist(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_boxl, __pyx_v_boxl2); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6unfold_12minDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, double __pyx_v_boxl, double __pyx_v_boxl2) { - double __pyx_v_delta[3]; - int __pyx_v_i; - PyObject *__pyx_r = NULL; +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("minDist", 0); + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "src/helpers/unfold.pyx":319 - * cdef int i + /* "View.MemoryView":350 * - * for i in range(3): # <<<<<<<<<<<<<< - * delta[i] = coor2[i] - coor1[i] - * if fabs(delta[i]) > boxl2: + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: */ - for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; - /* "src/helpers/unfold.pyx":320 - * - * for i in range(3): - * delta[i] = coor2[i] - coor1[i] # <<<<<<<<<<<<<< - * if fabs(delta[i]) > boxl2: - * delta[i] -= sign(delta[i]) * boxl + /* "View.MemoryView":351 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) */ - __pyx_t_2 = __pyx_v_i; - if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor2.shape[0]; - __pyx_t_3 = __pyx_v_i; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor1.shape[0]; - (__pyx_v_delta[__pyx_v_i]) = ((*((double *) ( /* dim=0 */ (__pyx_v_coor2.data + __pyx_t_2 * __pyx_v_coor2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coor1.data + __pyx_t_3 * __pyx_v_coor1.strides[0]) )))); + __pyx_v_self->flags = __pyx_v_flags; - /* "src/helpers/unfold.pyx":321 - * for i in range(3): - * delta[i] = coor2[i] - coor1[i] - * if fabs(delta[i]) > boxl2: # <<<<<<<<<<<<<< - * delta[i] -= sign(delta[i]) * boxl - * + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ - __pyx_t_4 = ((fabs((__pyx_v_delta[__pyx_v_i])) > __pyx_v_boxl2) != 0); - if (__pyx_t_4) { + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/helpers/unfold.pyx":322 - * delta[i] = coor2[i] - coor1[i] - * if fabs(delta[i]) > boxl2: - * delta[i] -= sign(delta[i]) * boxl # <<<<<<<<<<<<<< - * - * return float(sqrt(delta[0]*delta[0] + delta[1]*delta[1] + delta[2]*delta[2])) + /* "View.MemoryView":353 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None */ - __pyx_t_5 = __pyx_v_i; - (__pyx_v_delta[__pyx_t_5]) = ((__pyx_v_delta[__pyx_t_5]) - (__pyx_f_11newanalysis_6unfold_sign((__pyx_v_delta[__pyx_v_i])) * __pyx_v_boxl)); + __pyx_t_3 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 353, __pyx_L1_error) - /* "src/helpers/unfold.pyx":321 - * for i in range(3): - * delta[i] = coor2[i] - coor1[i] - * if fabs(delta[i]) > boxl2: # <<<<<<<<<<<<<< - * delta[i] -= sign(delta[i]) * boxl - * + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) */ - } - } + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { - /* "src/helpers/unfold.pyx":324 - * delta[i] -= sign(delta[i]) * boxl - * - * return float(sqrt(delta[0]*delta[0] + delta[1]*delta[1] + delta[2]*delta[2])) # <<<<<<<<<<<<<< + /* "View.MemoryView":355 + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = PyFloat_FromDouble(sqrt(((((__pyx_v_delta[0]) * (__pyx_v_delta[0])) + ((__pyx_v_delta[1]) * (__pyx_v_delta[1]))) + ((__pyx_v_delta[2]) * (__pyx_v_delta[2]))))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 324, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - /* "src/helpers/unfold.pyx":309 + /* "View.MemoryView":356 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< * - * @cython.boundscheck(False) - * def minDist(double [:] coor1, double [:] coor2, double boxl, double boxl2): # <<<<<<<<<<<<<< - * """ - * minDist(xyz1, xyz2, boxl, boxl2) + * if not __PYX_CYTHON_ATOMICS_ENABLED(): */ + Py_INCREF(Py_None); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("newanalysis.unfold.minDist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_coor1, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor2, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) + */ + } + + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + */ + } -/* "src/helpers/unfold.pyx":327 + /* "View.MemoryView":358 + * Py_INCREF(Py_None) * - * @cython.boundscheck(False) - * def findMinDist(double [:,:] coor, double boxl): # <<<<<<<<<<<<<< - * cdef int n = coor.shape[0], i, j - * cdef double minimum = 1000000.0, dist + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: */ + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6unfold_15findMinDist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_6unfold_15findMinDist = {"findMinDist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6unfold_15findMinDist, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_6unfold_15findMinDist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_boxl; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("findMinDist (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_boxl,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxl)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("findMinDist", 1, 2, 2, 1); __PYX_ERR(0, 327, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "findMinDist") < 0)) __PYX_ERR(0, 327, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 327, __pyx_L3_error) - __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 327, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("findMinDist", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 327, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.unfold.findMinDist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_6unfold_14findMinDist(__pyx_self, __pyx_v_coor, __pyx_v_boxl); + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + */ + __pyx_t_1 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_1) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":361 + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + */ + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); -static PyObject *__pyx_pf_11newanalysis_6unfold_14findMinDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, double __pyx_v_boxl) { - int __pyx_v_n; - int __pyx_v_i; - int __pyx_v_j; - double __pyx_v_minimum; - double __pyx_v_dist; - double __pyx_v_boxl2; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - int __pyx_t_16; - PyObject *__pyx_t_17 = NULL; - double __pyx_t_18; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("findMinDist", 0); + /* "View.MemoryView":362 + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + */ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); - /* "src/helpers/unfold.pyx":328 - * @cython.boundscheck(False) - * def findMinDist(double [:,:] coor, double boxl): - * cdef int n = coor.shape[0], i, j # <<<<<<<<<<<<<< - * cdef double minimum = 1000000.0, dist - * cdef double boxl2 = boxl/2.0 + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 */ - __pyx_v_n = (__pyx_v_coor.shape[0]); + } - /* "src/helpers/unfold.pyx":329 - * def findMinDist(double [:,:] coor, double boxl): - * cdef int n = coor.shape[0], i, j - * cdef double minimum = 1000000.0, dist # <<<<<<<<<<<<<< - * cdef double boxl2 = boxl/2.0 - * + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: */ - __pyx_v_minimum = 1000000.0; + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { - /* "src/helpers/unfold.pyx":330 - * cdef int n = coor.shape[0], i, j - * cdef double minimum = 1000000.0, dist - * cdef double boxl2 = boxl/2.0 # <<<<<<<<<<<<<< - * - * for i in range(n): + /* "View.MemoryView":364 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError */ - __pyx_v_boxl2 = (__pyx_v_boxl / 2.0); + __pyx_v_self->lock = PyThread_allocate_lock(); - /* "src/helpers/unfold.pyx":332 - * cdef double boxl2 = boxl/2.0 + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError * - * for i in range(n): # <<<<<<<<<<<<<< - * for j in range(n): - * if i == j: continue */ - __pyx_t_1 = __pyx_v_n; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { - /* "src/helpers/unfold.pyx":333 + /* "View.MemoryView":366 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< * - * for i in range(n): - * for j in range(n): # <<<<<<<<<<<<<< - * if i == j: continue - * dist = minDist(coor[i], coor[j], boxl, boxl2) + * if flags & PyBUF_FORMAT: */ - __pyx_t_4 = __pyx_v_n; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_j = __pyx_t_6; + PyErr_NoMemory(); __PYX_ERR(1, 366, __pyx_L1_error) - /* "src/helpers/unfold.pyx":334 - * for i in range(n): - * for j in range(n): - * if i == j: continue # <<<<<<<<<<<<<< - * dist = minDist(coor[i], coor[j], boxl, boxl2) - * if dist < minimum: + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * */ - __pyx_t_7 = ((__pyx_v_i == __pyx_v_j) != 0); - if (__pyx_t_7) { - goto __pyx_L5_continue; } - /* "src/helpers/unfold.pyx":335 - * for j in range(n): - * if i == j: continue - * dist = minDist(coor[i], coor[j], boxl, boxl2) # <<<<<<<<<<<<<< - * if dist < minimum: - * minimum = dist + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_minDist); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10.data = __pyx_v_coor.data; - __pyx_t_10.memview = __pyx_v_coor.memview; - __PYX_INC_MEMVIEW(&__pyx_t_10, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_i; - Py_ssize_t __pyx_tmp_shape = __pyx_v_coor.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_coor.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_10.shape[0] = __pyx_v_coor.shape[1]; -__pyx_t_10.strides[0] = __pyx_v_coor.strides[1]; - __pyx_t_10.suboffsets[0] = -1; - -__pyx_t_11 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; - __pyx_t_10.data = __pyx_v_coor.data; - __pyx_t_10.memview = __pyx_v_coor.memview; - __PYX_INC_MEMVIEW(&__pyx_t_10, 0); - { - Py_ssize_t __pyx_tmp_idx = __pyx_v_j; - Py_ssize_t __pyx_tmp_shape = __pyx_v_coor.shape[0]; - Py_ssize_t __pyx_tmp_stride = __pyx_v_coor.strides[0]; - if (__pyx_tmp_idx < 0) - __pyx_tmp_idx += __pyx_tmp_shape; - __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride; -} - -__pyx_t_10.shape[0] = __pyx_v_coor.shape[1]; -__pyx_t_10.strides[0] = __pyx_v_coor.strides[1]; - __pyx_t_10.suboffsets[0] = -1; - -__pyx_t_12 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); - __pyx_t_10.memview = NULL; - __pyx_t_10.data = NULL; - __pyx_t_13 = PyFloat_FromDouble(__pyx_v_boxl); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = PyFloat_FromDouble(__pyx_v_boxl2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = NULL; - __pyx_t_16 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_16 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[5] = {__pyx_t_15, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_16, 4+__pyx_t_16); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[5] = {__pyx_t_15, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_16, 4+__pyx_t_16); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else - #endif - { - __pyx_t_17 = PyTuple_New(4+__pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - if (__pyx_t_15) { - __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15); __pyx_t_15 = NULL; - } - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_16, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_16, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_16, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_17, 3+__pyx_t_16, __pyx_t_14); - __pyx_t_11 = 0; - __pyx_t_12 = 0; - __pyx_t_13 = 0; - __pyx_t_14 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_17, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_dist = __pyx_t_18; + } - /* "src/helpers/unfold.pyx":336 - * if i == j: continue - * dist = minDist(coor[i], coor[j], boxl, boxl2) - * if dist < minimum: # <<<<<<<<<<<<<< - * minimum = dist + /* "View.MemoryView":358 + * Py_INCREF(Py_None) * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: */ - __pyx_t_7 = ((__pyx_v_dist < __pyx_v_minimum) != 0); - if (__pyx_t_7) { + } - /* "src/helpers/unfold.pyx":337 - * dist = minDist(coor[i], coor[j], boxl, boxl2) - * if dist < minimum: - * minimum = dist # <<<<<<<<<<<<<< - * - * return float(minimum) + /* "View.MemoryView":368 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: */ - __pyx_v_minimum = __pyx_v_dist; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { - /* "src/helpers/unfold.pyx":336 - * if i == j: continue - * dist = minDist(coor[i], coor[j], boxl, boxl2) - * if dist < minimum: # <<<<<<<<<<<<<< - * minimum = dist + /* "View.MemoryView":369 * + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object */ - } - __pyx_L5_continue:; + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L12_bool_binop_done; } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L12_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; + + /* "View.MemoryView":368 + * raise MemoryError + * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + */ + goto __pyx_L11; } - /* "src/helpers/unfold.pyx":339 - * minimum = dist + /* "View.MemoryView":371 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< * - * return float(minimum) # <<<<<<<<<<<<<< + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + */ + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L11:; + + /* "View.MemoryView":373 + * self.dtype_is_object = dtype_is_object + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL * - * @cython.boundscheck(False) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = PyFloat_FromDouble(__pyx_v_minimum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_r = __pyx_t_8; - __pyx_t_8 = 0; - goto __pyx_L0; + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 373, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 373, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 373, __pyx_L1_error) + #endif + + /* "View.MemoryView":374 + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(memoryview self): + */ + __pyx_v_self->typeinfo = NULL; - /* "src/helpers/unfold.pyx":327 + /* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo * - * @cython.boundscheck(False) - * def findMinDist(double [:,:] coor, double boxl): # <<<<<<<<<<<<<< - * cdef int n = coor.shape[0], i, j - * cdef double minimum = 1000000.0, dist + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_AddTraceback("newanalysis.unfold.findMinDist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/helpers/unfold.pyx":342 +/* "View.MemoryView":376 + * self.typeinfo = NULL * - * @cython.boundscheck(False) - * def bertholdHorn(double [:,:] coor, double [:,:] coorA, double [:,:] coorB): # <<<<<<<<<<<<<< - * """ - * bertholdHorn(coor,coorA,coorB) + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_6unfold_17bertholdHorn(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_6unfold_16bertholdHorn[] = "\n bertholdHorn(coor,coorA,coorB)\n\n Applies the Berthold-Horn-algorithm to a set of coordinates xyz, inplace.\n\n Args:\n coor .. coordinates of all atoms\n coorA .. template coordinates\n coorB .. corresponding coordinates of the current frame\n "; -static PyMethodDef __pyx_mdef_11newanalysis_6unfold_17bertholdHorn = {"bertholdHorn", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_6unfold_17bertholdHorn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_16bertholdHorn}; -static PyObject *__pyx_pw_11newanalysis_6unfold_17bertholdHorn(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coorA = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_coorB = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("bertholdHorn (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_coorA,&__pyx_n_s_coorB,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coor)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coorA)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("bertholdHorn", 1, 3, 3, 1); __PYX_ERR(0, 342, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coorB)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("bertholdHorn", 1, 3, 3, 2); __PYX_ERR(0, 342, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bertholdHorn") < 0)) __PYX_ERR(0, 342, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 342, __pyx_L3_error) - __pyx_v_coorA = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorA.memview)) __PYX_ERR(0, 342, __pyx_L3_error) - __pyx_v_coorB = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorB.memview)) __PYX_ERR(0, 342, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("bertholdHorn", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 342, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.unfold.bertholdHorn", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_6unfold_16bertholdHorn(__pyx_self, __pyx_v_coor, __pyx_v_coorA, __pyx_v_coorB); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_6unfold_16bertholdHorn(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_coorA, __Pyx_memviewslice __pyx_v_coorB) { - __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_v_tmpx; - double __pyx_v_tmpy; - double __pyx_v_tmpz; +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { int __pyx_v_i; - PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("bertholdHorn", 0); + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "src/helpers/unfold.pyx":353 - * coorB .. corresponding coordinates of the current frame - * """ - * cdef double [:,:] R = np.zeros((3,3)) # <<<<<<<<<<<<<< - * cdef double tmpx, tmpy, tmpz - * cdef int i + /* "View.MemoryView":377 + * + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_tuple_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple_); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_R = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { - /* "src/helpers/unfold.pyx":357 - * cdef int i + /* "View.MemoryView":378 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: * - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) # <<<<<<<<<<<<<< + */ + __Pyx_ReleaseBuffer((&__pyx_v_self->view)); + + /* "View.MemoryView":377 * - * for i in prange(coor.shape[0], nogil=True): + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - __pyx_t_5 = 0; - __pyx_t_6 = 0; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_R.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[1]; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coorA.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coorA.shape[1]; - __pyx_t_9 = 0; - __pyx_t_10 = 0; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coorB.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coorB.shape[1]; - GetRotation((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_5 * __pyx_v_R.strides[0]) ) + __pyx_t_6 * __pyx_v_R.strides[1]) )))), (__pyx_v_coorA.shape[0]), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorA.data + __pyx_t_7 * __pyx_v_coorA.strides[0]) ) + __pyx_t_8 * __pyx_v_coorA.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorB.data + __pyx_t_9 * __pyx_v_coorB.strides[0]) ) + __pyx_t_10 * __pyx_v_coorB.strides[1]) )))), 0); + goto __pyx_L3; + } - /* "src/helpers/unfold.pyx":359 - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * - * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * (<__pyx_buffer *> &self.view).obj = NULL */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - if (unlikely(!__pyx_v_coor.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("coor"); __PYX_ERR(0, 359, __pyx_L4_error) } - __pyx_t_11 = (__pyx_v_coor.shape[0]); - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_13 = (__pyx_t_11 - 0 + 1 - 1/abs(1)) / 1; - if (__pyx_t_13 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_10, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_tmpx) lastprivate(__pyx_v_tmpy) lastprivate(__pyx_v_tmpz) - #endif /* _OPENMP */ - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){ - { - __pyx_v_i = (int)(0 + 1 * __pyx_t_12); - /* Initialize private variables to invalid values */ - __pyx_v_tmpx = ((double)__PYX_NAN()); - __pyx_v_tmpy = ((double)__PYX_NAN()); - __pyx_v_tmpz = ((double)__PYX_NAN()); + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { - /* "src/helpers/unfold.pyx":360 + /* "View.MemoryView":381 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) * - * for i in prange(coor.shape[0], nogil=True): - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] # <<<<<<<<<<<<<< - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] */ - __pyx_t_10 = 0; - __pyx_t_9 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_R.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[1]; - __pyx_t_8 = __pyx_v_i; - __pyx_t_7 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor.shape[1]; - __pyx_t_6 = 0; - __pyx_t_5 = 1; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_R.shape[1]; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 1; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - __pyx_t_16 = 0; - __pyx_t_17 = 2; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_R.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[1]; - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_v_tmpx = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_10 * __pyx_v_R.strides[0]) ) + __pyx_t_9 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_7 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_6 * __pyx_v_R.strides[0]) ) + __pyx_t_5 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_16 * __pyx_v_R.strides[0]) ) + __pyx_t_17 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))))); + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; - /* "src/helpers/unfold.pyx":361 - * for i in prange(coor.shape[0], nogil=True): - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] # <<<<<<<<<<<<<< - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx + /* "View.MemoryView":382 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i */ - __pyx_t_19 = 1; - __pyx_t_18 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_R.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_R.shape[1]; - __pyx_t_17 = __pyx_v_i; - __pyx_t_16 = 0; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[0]; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; - __pyx_t_15 = 1; - __pyx_t_14 = 1; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_R.shape[0]; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_R.shape[1]; - __pyx_t_5 = __pyx_v_i; - __pyx_t_6 = 1; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coor.shape[0]; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[1]; - __pyx_t_7 = 1; - __pyx_t_8 = 2; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[0]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_R.shape[1]; - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = 2; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[1]; - __pyx_v_tmpy = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_19 * __pyx_v_R.strides[0]) ) + __pyx_t_18 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_17 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_15 * __pyx_v_R.strides[0]) ) + __pyx_t_14 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_5 * __pyx_v_coor.strides[0]) ) + __pyx_t_6 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_7 * __pyx_v_R.strides[0]) ) + __pyx_t_8 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_10 * __pyx_v_coor.strides[1]) ))))); + Py_DECREF(Py_None); - /* "src/helpers/unfold.pyx":362 - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] # <<<<<<<<<<<<<< - * coor[i,0] = tmpx - * coor[i,1] = tmpy + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL */ - __pyx_t_10 = 2; - __pyx_t_9 = 0; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_R.shape[0]; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[1]; - __pyx_t_8 = __pyx_v_i; - __pyx_t_7 = 0; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[0]; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor.shape[1]; - __pyx_t_6 = 2; - __pyx_t_5 = 1; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[0]; - if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_R.shape[1]; - __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = 1; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coor.shape[0]; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[1]; - __pyx_t_16 = 2; - __pyx_t_17 = 2; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_R.shape[0]; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[1]; - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = 2; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - __pyx_v_tmpz = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_10 * __pyx_v_R.strides[0]) ) + __pyx_t_9 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_8 * __pyx_v_coor.strides[0]) ) + __pyx_t_7 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_6 * __pyx_v_R.strides[0]) ) + __pyx_t_5 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_14 * __pyx_v_coor.strides[0]) ) + __pyx_t_15 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_16 * __pyx_v_R.strides[0]) ) + __pyx_t_17 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) ))))); + } + __pyx_L3:; - /* "src/helpers/unfold.pyx":363 - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx # <<<<<<<<<<<<<< - * coor[i,1] = tmpy - * coor[i,2] = tmpz + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_18 = 0; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpx; + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { - /* "src/helpers/unfold.pyx":364 - * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] - * coor[i,0] = tmpx - * coor[i,1] = tmpy # <<<<<<<<<<<<<< - * coor[i,2] = tmpz + /* "View.MemoryView":387 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = 1; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpy; + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/helpers/unfold.pyx":365 - * coor[i,0] = tmpx - * coor[i,1] = tmpy - * coor[i,2] = tmpz # <<<<<<<<<<<<<< + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + */ + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { + + /* "View.MemoryView":389 + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + */ + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + */ + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { + + /* "View.MemoryView":392 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: + */ + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + + /* "View.MemoryView":391 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break + */ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; + + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) */ - __pyx_t_19 = __pyx_v_i; - __pyx_t_18 = 2; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[1]; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_18 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpz; - } - } - } - } } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif + + /* "View.MemoryView":393 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) + */ + goto __pyx_L6_break; + + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + */ } + } + /*else*/ { - /* "src/helpers/unfold.pyx":359 - * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) + /* "View.MemoryView":395 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< * - * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< - * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] - * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + */ + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; + + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L4_error: { - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L1_error; - } - __pyx_L5:; - } } - /* "src/helpers/unfold.pyx":342 + /* "View.MemoryView":376 + * self.typeinfo = NULL * - * @cython.boundscheck(False) - * def bertholdHorn(double [:,:] coor, double [:,:] coorA, double [:,:] coorB): # <<<<<<<<<<<<<< - * """ - * bertholdHorn(coor,coorA,coorB) + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); - __Pyx_AddTraceback("newanalysis.unfold.bertholdHorn", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_R, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coor, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coorA, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_coorB, 1); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t - * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) +/* "View.MemoryView":397 + * PyThread_free_lock(self.lock) * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + __Pyx_RefNannySetupContext("get_item_pointer", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":735 + /* "View.MemoryView":399 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * for dim, idx in enumerate(index): + */ + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); + + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * - * cdef inline object PyArray_MultiIterNew2(a, b): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 401, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 401, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t + /* "View.MemoryView":402 * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< * + * return itemp */ + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) * */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":738 + /* "View.MemoryView":404 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew3(a, b, c): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = __pyx_v_itemp; goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) + /* "View.MemoryView":397 + * PyThread_free_lock(self.lock) * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_idx); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) +/* "View.MemoryView":407 * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; +/* Python wrapper */ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":741 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 741, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) - * - */ - -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) { +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":744 + /* "View.MemoryView":408 * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 744, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) + /* "View.MemoryView":409 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< * + * have_slices, indices = _unellipsify(index, self.view.ndim) */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) + /* "View.MemoryView":408 * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self * */ + } -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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":747 + /* "View.MemoryView":411 + * return self * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * - * cdef inline tuple PyDataType_SHAPE(dtype d): + * cdef char *itemp */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 411, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 411, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 + /* "View.MemoryView":414 * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: */ - __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 414, __pyx_L1_error) if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":751 - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape # <<<<<<<<<<<<<< - * else: - * return () + /* "View.MemoryView":415 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); - __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 + /* "View.MemoryView":414 * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: */ } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":753 - * return d.subarray.shape - * else: - * return () # <<<<<<<<<<<<<< - * + /* "View.MemoryView":417 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) * */ /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((char *)NULL))) __PYX_ERR(1, 417, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; + + /* "View.MemoryView":418 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * + * def __setitem__(memoryview self, object index, object value): + */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_empty_tuple); - __pyx_r = __pyx_empty_tuple; + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) + /* "View.MemoryView":407 * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 +/* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_array_base", 0); + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":929 + /* "View.MemoryView":421 * - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< - * PyArray_SetBaseObject(arr, base) + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * */ - Py_INCREF(__pyx_v_base); + if (unlikely(__pyx_v_self->view.readonly)) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":930 - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + /* "View.MemoryView":422 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< * - * cdef inline object get_array_base(ndarray arr): + * have_slices, index = _unellipsify(index, self.view.ndim) */ - (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 422, __pyx_L1_error) - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 + /* "View.MemoryView":421 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) */ + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) + /* "View.MemoryView":424 + * raise TypeError, "Cannot assign to read-only memoryview" * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * if have_slices: */ + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 424, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 424, __pyx_L1_error) + } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_v_base; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":933 + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) * - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< - * if base is NULL: - * return None + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ - __pyx_v_base = PyArray_BASE(__pyx_v_arr); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 426, __pyx_L1_error) + if (__pyx_t_4) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base + /* "View.MemoryView":427 + * + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj: + * self.setitem_slice_assignment(self[index], obj) */ - __pyx_t_1 = ((__pyx_v_base == NULL) != 0); - if (__pyx_t_1) { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":935 - * base = PyArray_BASE(arr) - * if base is NULL: - * return None # <<<<<<<<<<<<<< - * return base - * + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 428, __pyx_L1_error) + if (__pyx_t_4) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base - */ - } - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":936 - * if base is NULL: - * return None - * return base # <<<<<<<<<<<<<< - * - * # Versions of the import_* functions which are more suitable for - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_base)); - __pyx_r = ((PyObject *)__pyx_v_base); - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() - */ - -static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_array", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":429 + * obj = self.is_slice(value) + * if obj: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":942 - * cdef inline int import_array() except -1: - * try: - * __pyx_import_array() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 942, __pyx_L3_error) + goto __pyx_L5; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":431 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) */ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 431, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + __pyx_L5:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":943 - * try: - * __pyx_import_array() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) * + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 943, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + goto __pyx_L4; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":433 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< * - * cdef inline int import_umath() except -1: - */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 944, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 944, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + * cdef is_slice(self, obj): */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } + __pyx_L4:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() + /* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") +/* "View.MemoryView":435 + * self.setitem_indexed(index, value) * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ -static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { - int __pyx_r; +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; + PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_umath", 0); + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "View.MemoryView":436 * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":948 - * cdef inline int import_umath() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 948, __pyx_L3_error) + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 - * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":949 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":439 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None + */ + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: + */ + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "View.MemoryView":440 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None * */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 949, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); + if (__pyx_t_9) { + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 440, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":441 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< * - * cdef inline int import_ufunc() except -1: + * return obj */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 950, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 950, __pyx_L5_except_error) + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + */ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "View.MemoryView":436 * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":443 + * return None * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * return obj # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assignment(self, dst, src): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; + goto __pyx_L0; + + /* "View.MemoryView":435 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") +/* "View.MemoryView":445 + * return obj * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ -static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { - int __pyx_r; +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + __Pyx_memviewslice *__pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_3; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_ufunc", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":954 - * cdef inline int import_ufunc() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") - */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 954, __pyx_L3_error) + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + /* "View.MemoryView":448 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":955 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 955, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":956 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":451 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] * - * cdef extern from *: - */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 956, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 956, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; - } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 451, __pyx_L1_error) - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":445 + * return obj * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 - * +/* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL */ -static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { - int __pyx_r; +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[0x80]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_timedelta64_object", 0); + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":978 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< - * + /* "View.MemoryView":455 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item * */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); - goto __pyx_L0; + __pyx_v_tmp = NULL; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 - * + /* "View.MemoryView":460 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` + * if self.view.itemsize > sizeof(array): */ + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 460, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { -static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_datetime64_object", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":993 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< - * + /* "View.MemoryView":463 * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); - goto __pyx_L0; + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * - * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp */ + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":465 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: + */ + PyErr_NoMemory(); __PYX_ERR(1, 465, __pyx_L1_error) -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 - * - * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp */ + } -static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { - npy_datetime __pyx_r; + /* "View.MemoryView":466 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array + */ + __pyx_v_item = __pyx_v_tmp; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1003 - * also needed. That can be found using `get_datetime64_unit`. - * """ - * return (obj).obval # <<<<<<<<<<<<<< - * + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ - __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; + goto __pyx_L3; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 - * + /* "View.MemoryView":468 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object + * try: */ + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 + /* "View.MemoryView":470 + * item = array * + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value + */ + /*try:*/ { + + /* "View.MemoryView":471 * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ + if (__pyx_v_self->dtype_is_object) { -static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { - npy_timedelta __pyx_r; + /* "View.MemoryView":472 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) + */ + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1010 - * returns the int64 value underlying scalar numpy timedelta64 object - * """ - * return (obj).obval # <<<<<<<<<<<<<< - * + /* "View.MemoryView":471 * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; + goto __pyx_L8; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 + /* "View.MemoryView":474 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< * * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object */ + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 + /* "View.MemoryView":478 * * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. - */ - -static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { - NPY_DATETIMEUNIT __pyx_r; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1017 - * returns the unit part of the dtype for a numpy datetime64 object. - * """ - * return (obj).obmeta.base # <<<<<<<<<<<<<< + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); - goto __pyx_L0; + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 - * + /* "View.MemoryView":479 * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) */ + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 479, __pyx_L6_error) - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":123 - * cdef bint dtype_is_object + /* "View.MemoryView":478 * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - -/* Python wrapper */ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_shape = 0; - Py_ssize_t __pyx_v_itemsize; - PyObject *__pyx_v_format = 0; - PyObject *__pyx_v_mode = 0; - int __pyx_v_allocate_buffer; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; - PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_n_s_c); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 123, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 123, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode); - if (value) { values[3] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 123, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } } - __pyx_v_shape = ((PyObject*)values[0]); - __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_v_format = values[2]; - __pyx_v_mode = values[3]; - if (values[4]) { - __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 124, __pyx_L3_error) - } else { - /* "View.MemoryView":124 - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, - * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + /* "View.MemoryView":480 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: + */ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); + } + + /* "View.MemoryView":483 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< * - * cdef int idx + * cdef setitem_indexed(self, index, value): */ - __pyx_v_allocate_buffer = ((int)1); + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + } + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 123, __pyx_L1_error) - if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 123, __pyx_L1_error) - } - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); - /* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): + /* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { - int __pyx_v_idx; - Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_dim; - PyObject **__pyx_v_p; - char __pyx_v_order; - int __pyx_r; +/* "View.MemoryView":485 + * PyMem_Free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) + */ + +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - Py_ssize_t __pyx_t_11; + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_format); + __Pyx_RefNannySetupContext("setitem_indexed", 0); - /* "View.MemoryView":130 - * cdef PyObject **p + /* "View.MemoryView":486 * - * self.ndim = len(shape) # <<<<<<<<<<<<<< - * self.itemsize = itemsize + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) * */ - if (unlikely(__pyx_v_shape == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 130, __pyx_L1_error) - } - __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 130, __pyx_L1_error) - __pyx_v_self->ndim = ((int)__pyx_t_1); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 486, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; - /* "View.MemoryView":131 - * - * self.ndim = len(shape) - * self.itemsize = itemsize # <<<<<<<<<<<<<< + /* "View.MemoryView":487 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< * - * if not self.ndim: + * cdef convert_item_to_object(self, char *itemp): */ - __pyx_v_self->itemsize = __pyx_v_itemsize; + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":133 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") + /* "View.MemoryView":485 + * PyMem_Free(tmp) * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) */ - __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0); - if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":134 - * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< - * - * if itemsize <= 0: - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 134, __pyx_L1_error) + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":133 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") +/* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - } - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":492 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem * */ - __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":137 - * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< - * - * if not isinstance(format, bytes): - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 137, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") + /* "View.MemoryView":495 + * cdef bytes bytesitem * + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) */ - } + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") + /* "View.MemoryView":496 * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - __pyx_t_2 = PyBytes_Check(__pyx_v_format); - __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_4) { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { - /* "View.MemoryView":140 - * - * if not isinstance(format, bytes): - * format = format.encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format # keep a reference to the byte string - * self.format = self._format + /* "View.MemoryView":497 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } } - } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); - __pyx_t_3 = 0; + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") + /* "View.MemoryView":496 * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - } + } - /* "View.MemoryView":141 - * if not isinstance(format, bytes): - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< - * self.format = self._format - * + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 141, __pyx_L1_error) - __pyx_t_3 = __pyx_v_format; - __Pyx_INCREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->_format); - __Pyx_DECREF(__pyx_v_self->_format); - __pyx_v_self->_format = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + /*else:*/ { + __pyx_t_9 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 501, __pyx_L5_except_error) + __pyx_t_10 = (__pyx_t_9 == 1); + if (__pyx_t_10) { - /* "View.MemoryView":142 - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - * self.format = self._format # <<<<<<<<<<<<<< - * + /* "View.MemoryView":502 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result * */ - if (unlikely(__pyx_v_self->_format == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(2, 142, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 142, __pyx_L1_error) - __pyx_v_self->format = __pyx_t_7; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 502, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; - /* "View.MemoryView":145 - * - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< - * self._strides = self._shape + self.ndim - * + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result */ - __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); + } - /* "View.MemoryView":146 - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) - * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + /* "View.MemoryView":503 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< * - * if not self._shape: + * cdef assign_item_from_object(self, char *itemp, object value): */ - __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") - * + /* "View.MemoryView":498 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" + * else: */ - __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0); - if (unlikely(__pyx_t_4)) { + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_6); + __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; + if (__pyx_t_8) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_1); - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * - * + /* "View.MemoryView":499 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< + * else: + * if len(self.view.format) == 1: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 149, __pyx_L1_error) + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 499, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") + /* "View.MemoryView":496 * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; } - /* "View.MemoryView":152 - * + /* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_t_8 = 0; - __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; - for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 152, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_9; - __pyx_v_idx = __pyx_t_8; - __pyx_t_8 = (__pyx_t_8 + 1); - /* "View.MemoryView":153 - * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim - */ - __pyx_t_4 = ((__pyx_v_dim <= 0) != 0); - if (unlikely(__pyx_t_4)) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":154 - * for idx, dim in enumerate(shape): - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<< - * self._shape[idx] = dim +/* "View.MemoryView":505 + * return result * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 154, __pyx_L1_error) - /* "View.MemoryView":153 - * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim - */ - } - - /* "View.MemoryView":155 - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim # <<<<<<<<<<<<<< - * - * cdef char order - */ - (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + char *__pyx_t_10; + char *__pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "View.MemoryView":152 - * - * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) + /* "View.MemoryView":508 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":158 + /* "View.MemoryView":513 + * cdef Py_ssize_t i * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 158, __pyx_L1_error) - if (__pyx_t_4) { - - /* "View.MemoryView":159 - * cdef char order - * if mode == 'fortran': - * order = b'F' # <<<<<<<<<<<<<< - * self.mode = u'fortran' - * elif mode == 'c': - */ - __pyx_v_order = 'F'; - - /* "View.MemoryView":160 - * if mode == 'fortran': - * order = b'F' - * self.mode = u'fortran' # <<<<<<<<<<<<<< - * elif mode == 'c': - * order = b'C' + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: */ - __Pyx_INCREF(__pyx_n_u_fortran); - __Pyx_GIVEREF(__pyx_n_u_fortran); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_fortran; + __pyx_t_2 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_2) { - /* "View.MemoryView":158 + /* "View.MemoryView":514 * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - goto __pyx_L10; - } - - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 161, __pyx_L1_error) - if (likely(__pyx_t_4)) { - - /* "View.MemoryView":162 - * self.mode = u'fortran' - * elif mode == 'c': - * order = b'C' # <<<<<<<<<<<<<< - * self.mode = u'c' + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< * else: + * bytesvalue = struct.pack(self.view.format, value) */ - __pyx_v_order = 'C'; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 514, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":163 - * elif mode == 'c': - * order = b'C' - * self.mode = u'c' # <<<<<<<<<<<<<< + /* "View.MemoryView":513 + * cdef Py_ssize_t i + * + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) */ - __Pyx_INCREF(__pyx_n_u_c); - __Pyx_GIVEREF(__pyx_n_u_c); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_c; - - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' - */ - goto __pyx_L10; + goto __pyx_L3; } - /* "View.MemoryView":165 - * self.mode = u'c' + /* "View.MemoryView":516 + * bytesvalue = struct.pack(self.view.format, *value) * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< * - * self.len = fill_contig_strides_array(self._shape, self._strides, + * for i, c in enumerate(bytesvalue): */ /*else*/ { - __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 165, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_value}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; } - __pyx_L10:; - - /* "View.MemoryView":167 - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) - * - * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<< - * itemsize, self.ndim, order) - * - */ - __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - - /* "View.MemoryView":170 - * itemsize, self.ndim, order) - * - * self.free_data = allocate_buffer # <<<<<<<<<<<<<< - * self.dtype_is_object = format == b'O' - * if allocate_buffer: - */ - __pyx_v_self->free_data = __pyx_v_allocate_buffer; - - /* "View.MemoryView":171 - * - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< - * if allocate_buffer: - * - */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 171, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 171, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_self->dtype_is_object = __pyx_t_4; - - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = (__pyx_v_allocate_buffer != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":175 - * - * - * self.data = malloc(self.len) # <<<<<<<<<<<<<< - * if not self.data: - * raise MemoryError("unable to allocate array data.") - */ - __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); + __pyx_L3:; - /* "View.MemoryView":176 - * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) * - */ - __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0); - if (unlikely(__pyx_t_4)) { - - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c * - * if self.dtype_is_object: */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 177, __pyx_L1_error) + __pyx_t_7 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 518, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_8 = __pyx_v_bytesvalue; + __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8); + __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8)); + for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) { + __pyx_t_9 = __pyx_t_12; + __pyx_v_c = (__pyx_t_9[0]); - /* "View.MemoryView":176 + /* "View.MemoryView":519 * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< * + * @cname('getbuffer') */ - } + __pyx_v_i = __pyx_t_7; - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): - */ - __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":180 + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c * - * if self.dtype_is_object: - * p = self.data # <<<<<<<<<<<<<< - * for i in range(self.len / itemsize): - * p[i] = Py_None */ - __pyx_v_p = ((PyObject **)__pyx_v_self->data); - - /* "View.MemoryView":181 - * if self.dtype_is_object: - * p = self.data - * for i in range(self.len / itemsize): # <<<<<<<<<<<<<< - * p[i] = Py_None - * Py_INCREF(Py_None) - */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize); - __pyx_t_9 = __pyx_t_1; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + __pyx_t_7 = (__pyx_t_7 + 1); - /* "View.MemoryView":182 - * p = self.data - * for i in range(self.len / itemsize): - * p[i] = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "View.MemoryView":519 * - */ - (__pyx_v_p[__pyx_v_i]) = Py_None; - - /* "View.MemoryView":183 - * for i in range(self.len / itemsize): - * p[i] = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< * * @cname('getbuffer') */ - Py_INCREF(Py_None); - } - - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") - * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): - */ - } - - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< - * - * - */ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): + /* "View.MemoryView":505 + * return result * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_format); + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":186 +/* "View.MemoryView":521 + * itemp[i] = c * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ /* Python wrapper */ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_bufmode; +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + Py_ssize_t *__pyx_t_3; char *__pyx_t_4; - Py_ssize_t __pyx_t_5; + void *__pyx_t_5; int __pyx_t_6; - Py_ssize_t *__pyx_t_7; + Py_ssize_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { + if (unlikely(__pyx_v_info == NULL)) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; } @@ -8686,254 +9769,286 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); - /* "View.MemoryView":187 + /* "View.MemoryView":523 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 # <<<<<<<<<<<<<< - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - __pyx_v_bufmode = -1; - - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 188, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":189 - * cdef int bufmode = -1 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + /* "View.MemoryView":524 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: */ - __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 524, __pyx_L1_error) - /* "View.MemoryView":188 + /* "View.MemoryView":523 + * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * */ - goto __pyx_L3; } - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 190, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); if (__pyx_t_1) { - /* "View.MemoryView":191 - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") + /* "View.MemoryView":527 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL */ - __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ + goto __pyx_L6; } - __pyx_L3:; - - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - */ - __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 193, __pyx_L1_error) - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data + /* "View.MemoryView":529 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: */ + /*else*/ { + __pyx_v_info->shape = NULL; } + __pyx_L6:; - /* "View.MemoryView":194 - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data # <<<<<<<<<<<<<< - * info.len = self.len - * info.ndim = self.ndim + /* "View.MemoryView":531 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - __pyx_t_4 = __pyx_v_self->data; - __pyx_v_info->buf = __pyx_t_4; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { - /* "View.MemoryView":195 - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - * info.len = self.len # <<<<<<<<<<<<<< - * info.ndim = self.ndim - * info.shape = self._shape + /* "View.MemoryView":532 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL */ - __pyx_t_5 = __pyx_v_self->len; - __pyx_v_info->len = __pyx_t_5; + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; - /* "View.MemoryView":196 - * info.buf = self.data - * info.len = self.len - * info.ndim = self.ndim # <<<<<<<<<<<<<< - * info.shape = self._shape - * info.strides = self._strides + /* "View.MemoryView":531 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - __pyx_t_6 = __pyx_v_self->ndim; - __pyx_v_info->ndim = __pyx_t_6; + goto __pyx_L7; + } - /* "View.MemoryView":197 - * info.len = self.len - * info.ndim = self.ndim - * info.shape = self._shape # <<<<<<<<<<<<<< - * info.strides = self._strides - * info.suboffsets = NULL + /* "View.MemoryView":534 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_INDIRECT: */ - __pyx_t_7 = __pyx_v_self->_shape; - __pyx_v_info->shape = __pyx_t_7; + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; - /* "View.MemoryView":198 - * info.ndim = self.ndim - * info.shape = self._shape - * info.strides = self._strides # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = self.itemsize + /* "View.MemoryView":536 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: */ - __pyx_t_7 = __pyx_v_self->_strides; - __pyx_v_info->strides = __pyx_t_7; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { - /* "View.MemoryView":199 - * info.shape = self._shape - * info.strides = self._strides - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = self.itemsize - * info.readonly = 0 + /* "View.MemoryView":537 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL */ - __pyx_v_info->suboffsets = NULL; + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; - /* "View.MemoryView":200 - * info.strides = self._strides - * info.suboffsets = NULL - * info.itemsize = self.itemsize # <<<<<<<<<<<<<< - * info.readonly = 0 + /* "View.MemoryView":536 + * info.strides = NULL * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: */ - __pyx_t_5 = __pyx_v_self->itemsize; - __pyx_v_info->itemsize = __pyx_t_5; + goto __pyx_L8; + } - /* "View.MemoryView":201 - * info.suboffsets = NULL - * info.itemsize = self.itemsize - * info.readonly = 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":539 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< * * if flags & PyBUF_FORMAT: */ - __pyx_v_info->readonly = 0; + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; - /* "View.MemoryView":203 - * info.readonly = 0 + /* "View.MemoryView":541 + * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format + * info.format = self.view.format * else: */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":204 + /* "View.MemoryView":542 * * if flags & PyBUF_FORMAT: - * info.format = self.format # <<<<<<<<<<<<<< + * info.format = self.view.format # <<<<<<<<<<<<<< * else: * info.format = NULL */ - __pyx_t_4 = __pyx_v_self->format; + __pyx_t_4 = __pyx_v_self->view.format; __pyx_v_info->format = __pyx_t_4; - /* "View.MemoryView":203 - * info.readonly = 0 + /* "View.MemoryView":541 + * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format + * info.format = self.view.format * else: */ - goto __pyx_L5; + goto __pyx_L9; } - /* "View.MemoryView":206 - * info.format = self.format + /* "View.MemoryView":544 + * info.format = self.view.format * else: * info.format = NULL # <<<<<<<<<<<<<< * - * info.obj = self + * info.buf = self.view.buf */ /*else*/ { __pyx_v_info->format = NULL; } - __pyx_L5:; + __pyx_L9:; - /* "View.MemoryView":208 + /* "View.MemoryView":546 * info.format = NULL * + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + */ + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; + + /* "View.MemoryView":547 + * + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len + */ + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":548 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly + */ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":549 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self + */ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; + + /* "View.MemoryView":550 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * + */ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":551 + * info.len = self.view.len + * info.readonly = self.view.readonly * info.obj = self # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + * */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "View.MemoryView":186 + /* "View.MemoryView":521 + * itemp[i] = c * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); @@ -8950,159 +10065,118 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru return __pyx_r; } -/* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") +/* "View.MemoryView":554 * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ /* Python wrapper */ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__", 0); + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":213 - * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: - */ - __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":214 - * def __dealloc__(array self): - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) # <<<<<<<<<<<<<< - * elif self.free_data: - * if self.dtype_is_object: - */ - __pyx_v_self->callback_free_data(__pyx_v_self->data); - - /* "View.MemoryView":213 - * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, - */ - __pyx_t_1 = (__pyx_v_self->free_data != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) - */ - __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":217 - * elif self.free_data: - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< - * self._strides, self.ndim, False) - * free(self.data) - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); - - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) + /* "View.MemoryView":556 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result */ - } + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 556, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":219 - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) - * free(self.data) # <<<<<<<<<<<<<< - * PyObject_Free(self._shape) + /* "View.MemoryView":557 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result * */ - free(__pyx_v_self->data); - - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, - */ - } - __pyx_L3:; + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 557, __pyx_L1_error) - /* "View.MemoryView":220 - * self._strides, self.ndim, False) - * free(self.data) - * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + /* "View.MemoryView":558 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< * * @property */ - PyObject_Free(__pyx_v_self->_shape); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + /* "View.MemoryView":554 * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":223 - * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() +/* "View.MemoryView":560 + * return result * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9111,32 +10185,32 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":224 + /* "View.MemoryView":562 * @property - * def memview(self): - * return self.get_memview() # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< * - * @cname('get_memview') + * cdef _get_base(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 224, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":223 - * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() + /* "View.MemoryView":560 + * return result * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9144,197 +10218,239 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ return __pyx_r; } -/* "View.MemoryView":227 +/* "View.MemoryView":564 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) */ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { - int __pyx_v_flags; +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_memview", 0); + __Pyx_RefNannySetupContext("_get_base", 0); - /* "View.MemoryView":228 - * @cname('get_memview') - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< - * return memoryview(self, flags, self.dtype_is_object) + /* "View.MemoryView":565 * - */ - __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); - - /* "View.MemoryView":229 - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< * - * def __len__(self): + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; goto __pyx_L0; - /* "View.MemoryView":227 + /* "View.MemoryView":564 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] +/* "View.MemoryView":567 + * return self.obj * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ /* Python wrapper */ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":232 - * - * def __len__(self): - * return self._shape[0] # <<<<<<<<<<<<<< + /* "View.MemoryView":569 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< * - * def __getattr__(self, attr): + * @property */ - __pyx_r = (__pyx_v_self->_shape[0]); + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyInt_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; - /* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] + /* "View.MemoryView":567 + * return self.obj * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":234 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) +/* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ /* Python wrapper */ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getattr__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":235 + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< * - * def __getattr__(self, attr): - * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * raise ValueError, "Buffer view does not expose strides" + */ + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":575 + * if self.view.strides == NULL: * - * def __getitem__(self, item): + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 575, __pyx_L1_error) + + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" + */ + } + + /* "View.MemoryView":577 + * raise ValueError, "Buffer view does not expose strides" + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; goto __pyx_L0; - /* "View.MemoryView":234 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) + /* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9342,67 +10458,118 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__( return __pyx_r; } -/* "View.MemoryView":237 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] +/* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ /* Python wrapper */ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":238 + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim * - * def __getitem__(self, item): - * return self.memview[item] # <<<<<<<<<<<<<< + */ + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * - * def __setitem__(self, item, value): + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * + */ + } + + /* "View.MemoryView":584 + * return (-1,) * self.view.ndim + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; goto __pyx_L0; - /* "View.MemoryView":237 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] + /* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9410,788 +10577,840 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__ return __pyx_r; } -/* "View.MemoryView":240 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value +/* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ /* Python wrapper */ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":241 - * - * def __setitem__(self, item, value): - * self.memview[item] = value # <<<<<<<<<<<<<< - * + /* "View.MemoryView":588 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 241, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 241, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":240 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value + /* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): +/* "View.MemoryView":590 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":592 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 592, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "View.MemoryView":590 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") +/* "View.MemoryView":594 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "View.MemoryView":596 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":594 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":245 +/* "View.MemoryView":598 + * return self.size * self.view.itemsize * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ -static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) { - struct __pyx_array_obj *__pyx_v_result = 0; - struct __pyx_array_obj *__pyx_r = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("array_cwrapper", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":249 - * cdef array result + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: */ - __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_size == Py_None); if (__pyx_t_1) { - /* "View.MemoryView":250 + /* "View.MemoryView":601 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< * - * if buf == NULL: - * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<< - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), + * for length in self.view.shape[:self.view.ndim]: */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); - __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_int_1); + __pyx_v_result = __pyx_int_1; - /* "View.MemoryView":249 - * cdef array result + /* "View.MemoryView":603 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf */ - /*else*/ { - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_3 = 0; + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyInt_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; - /* "View.MemoryView":253 - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) # <<<<<<<<<<<<<< - * result.data = buf + /* "View.MemoryView":604 + * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< * + * self._size = result */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 253, __pyx_L1_error) + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; + } - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf + /* "View.MemoryView":606 + * result *= length + * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size */ - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5); - __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; - /* "View.MemoryView":254 - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) - * result.data = buf # <<<<<<<<<<<<<< + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * return result */ - __pyx_v_result->data = __pyx_v_buf; } - __pyx_L3:; - /* "View.MemoryView":256 - * result.data = buf - * - * return result # <<<<<<<<<<<<<< + /* "View.MemoryView":608 + * self._size = result * + * return self._size # <<<<<<<<<<<<<< * + * def __len__(self): */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = __pyx_v_result; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; goto __pyx_L0; - /* "View.MemoryView":245 + /* "View.MemoryView":598 + * return self.size * self.view.itemsize * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): +/* "View.MemoryView":610 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ /* Python wrapper */ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 282, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_name = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 282, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { - int __pyx_r; +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); + int __pyx_t_1; + __Pyx_RefNannySetupContext("__len__", 0); - /* "View.MemoryView":283 - * cdef object name - * def __init__(self, name): - * self.name = name # <<<<<<<<<<<<<< - * def __repr__(self): - * return self.name + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * */ - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __Pyx_GOTREF(__pyx_v_self->name); - __Pyx_DECREF(__pyx_v_self->name); - __pyx_v_self->name = __pyx_v_name; + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { - /* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name + /* "View.MemoryView":612 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< + * + * return 0 + */ + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * + */ + } + + /* "View.MemoryView":614 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * * def __repr__(self): + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":610 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ /* function exit code */ - __pyx_r = 0; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name +/* "View.MemoryView":616 + * return 0 * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ /* Python wrapper */ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); - /* "View.MemoryView":285 - * self.name = name + /* "View.MemoryView":617 + * * def __repr__(self): - * return self.name # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) * - * cdef generic = Enum("") */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->name); - __pyx_r = __pyx_v_self->name; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":618 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":617 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name + /* "View.MemoryView":616 + * return 0 * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict +/* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("__str__", 0); - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self.name,) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: + /* "View.MemoryView":621 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * + * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_self->name); - __Pyx_GIVEREF(__pyx_v_self->name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); - __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error); __pyx_t_1 = 0; - - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) - */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v__dict = __pyx_t_1; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; + goto __pyx_L0; - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True + /* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * */ - __pyx_t_2 = (__pyx_v__dict != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); - __pyx_t_4 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self.name is not None +/* "View.MemoryView":624 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - __pyx_v_use_setstate = 1; - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - goto __pyx_L3; - } +/* Python wrapper */ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 624, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_c_contig", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "(tree fragment)":11 - * use_setstate = True - * else: - * use_setstate = self.name is not None # <<<<<<<<<<<<<< - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - */ - /*else*/ { - __pyx_t_3 = (__pyx_v_self->name != Py_None); - __pyx_v_use_setstate = __pyx_t_3; - } - __pyx_L3:; - - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: - */ - __pyx_t_3 = (__pyx_v_use_setstate != 0); - if (__pyx_t_3) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "(tree fragment)":13 - * use_setstate = self.name is not None - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<< - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); - __pyx_t_4 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_c_contig", 0); - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: + /* "View.MemoryView":627 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * */ - } + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 627, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "(tree fragment)":15 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + * + * def is_f_contig(self): */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "View.MemoryView":624 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v__dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) +/* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 630, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_f_contig", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("is_f_contig", 0); - /* "(tree fragment)":17 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + /* "View.MemoryView":633 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 633, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * + * def copy(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -10199,6936 +11418,6973 @@ static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_Me return __pyx_r; } -/* "View.MemoryView":299 +/* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ -static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) { - Py_intptr_t __pyx_v_aligned_p; - size_t __pyx_v_offset; - void *__pyx_r; - int __pyx_t_1; +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 636, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); - /* "View.MemoryView":301 - * cdef void *align_pointer(void *memory, size_t alignment) nogil: - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<< - * cdef size_t offset + /* "View.MemoryView":638 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< * + * slice_copy(self, &mslice) */ - __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory); + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - /* "View.MemoryView":305 - * - * with cython.cdivision(True): - * offset = aligned_p % alignment # <<<<<<<<<<<<<< + /* "View.MemoryView":640 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS * - * if offset > 0: + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, */ - __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment); + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - /* "View.MemoryView":307 - * offset = aligned_p % alignment - * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset + /* "View.MemoryView":641 * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, */ - __pyx_t_1 = ((__pyx_v_offset > 0) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 641, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "View.MemoryView":308 + /* "View.MemoryView":646 + * self.dtype_is_object) * - * if offset > 0: - * aligned_p += alignment - offset # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< * - * return aligned_p + * def copy_fortran(self): */ - __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset)); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "View.MemoryView":307 - * offset = aligned_p % alignment + /* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ - } - /* "View.MemoryView":310 - * aligned_p += alignment - offset +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 648, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy_fortran", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); + + /* "View.MemoryView":650 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + * + * slice_copy(self, &src) + */ + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + + /* "View.MemoryView":652 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, + */ + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + + /* "View.MemoryView":653 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, + */ + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 653, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; + + /* "View.MemoryView":658 + * self.dtype_is_object) * - * return aligned_p # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< * * */ - __pyx_r = ((void *)__pyx_v_aligned_p); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":299 + /* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_obj = 0; - int __pyx_v_flags; - int __pyx_v_dtype_is_object; +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 346, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object); - if (value) { values[2] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 346, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } - } - __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) - if (values[2]) { - __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - __pyx_v_dtype_is_object = ((int)0); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 346, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return -1; + return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { - int __pyx_r; +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "View.MemoryView":347 - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj # <<<<<<<<<<<<<< - * self.flags = flags - * if type(self) is memoryview or obj is not None: + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - __Pyx_GOTREF(__pyx_v_self->obj); - __Pyx_DECREF(__pyx_v_self->obj); - __pyx_v_self->obj = __pyx_v_obj; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "View.MemoryView":348 - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj - * self.flags = flags # <<<<<<<<<<<<<< - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - */ - __pyx_v_self->flags = __pyx_v_flags; - - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_3 = (__pyx_v_obj != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { - /* "View.MemoryView":350 - * self.flags = flags - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":662 + * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ - __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 350, __pyx_L1_error) - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + + /* "View.MemoryView":663 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result */ - __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":352 - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "View.MemoryView":664 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result * */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; + __pyx_v_result->typeinfo = __pyx_v_typeinfo; - /* "View.MemoryView":353 - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "View.MemoryView":665 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * @cname('__pyx_memoryview_check') */ - Py_INCREF(Py_None); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) + /* "View.MemoryView":662 + * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ - } - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - */ - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":355 - * Py_INCREF(Py_None) +/* "View.MemoryView":668 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: */ - __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0); - if (__pyx_t_1) { +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("memoryview_check", 0); - /* "View.MemoryView":358 - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: + /* "View.MemoryView":669 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): */ - __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; - /* "View.MemoryView":359 - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() + /* "View.MemoryView":668 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) + * */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - } + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: +/* "View.MemoryView":671 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":361 - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< - * if self.lock is NULL: - * raise MemoryError - */ - __pyx_v_self->lock = PyThread_allocate_lock(); +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_UCS4 __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unellipsify", 0); - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError + /* "View.MemoryView":677 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< * + * result = [slice(None)] * ndim */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_2 = PyTuple_Check(__pyx_v_index); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index)) __PYX_ERR(1, 677, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":363 - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - * raise MemoryError # <<<<<<<<<<<<<< + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) * - * if flags & PyBUF_FORMAT: + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False */ - PyErr_NoMemory(); __PYX_ERR(2, 363, __pyx_L1_error) + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError + /* "View.MemoryView":680 * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 */ - } + __pyx_v_have_slices = 0; - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: + /* "View.MemoryView":681 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: */ - } + __pyx_v_seen_ellipsis = 0; - /* "View.MemoryView":355 - * Py_INCREF(Py_None) - * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: + /* "View.MemoryView":682 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: + */ + __pyx_v_idx = 0; + + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: */ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 683, __pyx_L1_error) } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; + for (;;) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 683, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":365 - * raise MemoryError - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) + */ + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True + */ + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":686 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True + */ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 686, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 686, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); + + /* "View.MemoryView":687 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + __pyx_v_seen_ellipsis = 1; - /* "View.MemoryView":366 - * - * if flags & PyBUF_FORMAT: - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True + */ + } + + /* "View.MemoryView":688 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< * else: - * self.dtype_is_object = dtype_is_object + * if isinstance(item, slice): */ - __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L12_bool_binop_done; + __pyx_v_have_slices = 1; + + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) + */ + goto __pyx_L5; } - __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L12_bool_binop_done:; - __pyx_v_self->dtype_is_object = __pyx_t_1; - /* "View.MemoryView":365 - * raise MemoryError - * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + /* "View.MemoryView":690 + * have_slices = True * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): */ - goto __pyx_L11; - } + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { - /* "View.MemoryView":368 - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + /* "View.MemoryView":691 * else: - * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + */ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): + */ + goto __pyx_L7; + } + + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + */ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":693 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = 127; + __Pyx_INCREF(__pyx_kp_u_Cannot_index_with_type); + __pyx_t_5 += 24; + __Pyx_GIVEREF(__pyx_kp_u_Cannot_index_with_type); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Cannot_index_with_type); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_5 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__6); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 693, __pyx_L1_error) + + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + */ + } + __pyx_L7:; + + /* "View.MemoryView":694 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( */ - /*else*/ { - __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0))) __PYX_ERR(1, 694, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":695 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx + */ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: + */ } - __pyx_L11:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":370 - * self.dtype_is_object = dtype_is_object + /* "View.MemoryView":697 + * idx += 1 + * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<< - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL */ - __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int)))); + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); - /* "View.MemoryView":372 - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":698 * - * def __dealloc__(memoryview self): + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: */ - __pyx_v_self->typeinfo = NULL; + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 698, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; - /* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo + /* "View.MemoryView":671 + * return isinstance(o, memoryview) * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":374 - * self.typeinfo = NULL +/* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: */ -/* Python wrapper */ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { - int __pyx_v_i; +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; int __pyx_t_4; - int __pyx_t_5; - PyThread_type_lock __pyx_t_6; - PyThread_type_lock __pyx_t_7; - __Pyx_RefNannySetupContext("__dealloc__", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - /* "View.MemoryView":375 + /* "View.MemoryView":701 * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" */ - __pyx_t_1 = (__pyx_v_self->obj != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); - /* "View.MemoryView":376 - * def __dealloc__(memoryview self): - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - * + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag */ - __Pyx_ReleaseBuffer((&__pyx_v_self->view)); + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":375 + /* "View.MemoryView":703 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - goto __pyx_L3; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 703, __pyx_L1_error) + + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag + */ + } } - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + /* "View.MemoryView":704 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * * - * (<__pyx_buffer *> &self.view).obj = NULL */ - __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0); - if (__pyx_t_2) { + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":379 - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - * - * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< - * Py_DECREF(Py_None) + /* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; - /* "View.MemoryView":380 - * - * (<__pyx_buffer *> &self.view).obj = NULL - * Py_DECREF(Py_None) # <<<<<<<<<<<<<< - * - * cdef int i - */ - Py_DECREF(Py_None); + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< +/* "View.MemoryView":711 * - * (<__pyx_buffer *> &self.view).obj = NULL + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step */ - } - __pyx_L3:; - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - */ - __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0); - if (__pyx_t_2) { +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memview_slice", 0); - /* "View.MemoryView":385 - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 + /* "View.MemoryView":712 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst */ - __pyx_t_3 = __pyx_memoryview_thread_locks_used; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: + /* "View.MemoryView":719 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj */ - __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0); - if (__pyx_t_2) { + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - /* "View.MemoryView":387 - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + /* "View.MemoryView":723 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 723, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 723, __pyx_L1_error) + #endif - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ - __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "View.MemoryView":390 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< - * break - * else: + /* "View.MemoryView":726 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: */ - __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 726, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":389 - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break + /* "View.MemoryView":727 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) */ - (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6; - (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7; + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ - } + goto __pyx_L3; + } - /* "View.MemoryView":391 - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break # <<<<<<<<<<<<<< - * else: - * PyThread_free_lock(self.lock) + /* "View.MemoryView":729 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src + * */ - goto __pyx_L6_break; + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: + /* "View.MemoryView":730 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * + * */ - } - } - /*else*/ { + __pyx_v_p_src = (&__pyx_v_src); + } + __pyx_L3:; - /* "View.MemoryView":393 - * break - * else: - * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< + /* "View.MemoryView":736 + * + * + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: */ - PyThread_free_lock(__pyx_v_self->lock); - } - __pyx_L6_break:; + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: + /* "View.MemoryView":737 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< + * + * */ - } + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; - /* "View.MemoryView":374 - * self.typeinfo = NULL + /* "View.MemoryView":742 * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) + * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex */ + __pyx_v_p_dst = (&__pyx_v_dst); - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":395 - * PyThread_free_lock(self.lock) + /* "View.MemoryView":743 * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step */ + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); -static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - Py_ssize_t __pyx_v_dim; - char *__pyx_v_itemp; - PyObject *__pyx_v_idx = NULL; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - char *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_item_pointer", 0); - - /* "View.MemoryView":397 - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< - * - * for dim, idx in enumerate(index): - */ - __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index */ - __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { - __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; + __pyx_t_7 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 399, __pyx_L1_error) + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 747, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 399, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 747, __pyx_L1_error) } for (;;) { - if (likely(!__pyx_t_4)) { + if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); #endif } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); #endif } } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 399, __pyx_L1_error) + else __PYX_ERR(1, 747, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_8); } - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_1; - __pyx_t_1 = (__pyx_t_1 + 1); + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); - /* "View.MemoryView":400 - * - * for dim, idx in enumerate(index): - * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + /* "View.MemoryView":748 * - * return itemp + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_7; + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * + /* "View.MemoryView":749 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 749, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; - /* "View.MemoryView":402 - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - * return itemp # <<<<<<<<<<<<<< - * - * + /* "View.MemoryView":750 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - __pyx_r = __pyx_v_itemp; - goto __pyx_L0; + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 750, __pyx_L1_error) - /* "View.MemoryView":395 - * PyThread_free_lock(self.lock) + /* "View.MemoryView":748 * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ + goto __pyx_L6; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":405 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 */ + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { -/* Python wrapper */ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_indices = NULL; - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - char *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); + /* "View.MemoryView":757 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + */ + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - /* "View.MemoryView":406 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * + /* "View.MemoryView":758 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 */ - __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - /* "View.MemoryView":407 - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: - * return self # <<<<<<<<<<<<<< - * - * have_slices, indices = _unellipsify(index, self.view.ndim) + /* "View.MemoryView":759 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 + * else: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; - /* "View.MemoryView":406 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self - * + /* "View.MemoryView":760 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 */ - } + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - /* "View.MemoryView":409 - * return self - * - * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< - * - * cdef char *itemp + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 */ - __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(__pyx_t_3 != Py_None)) { - PyObject* sequence = __pyx_t_3; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 409, __pyx_L1_error) + goto __pyx_L6; } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 409, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_v_indices = __pyx_t_5; - __pyx_t_5 = 0; - /* "View.MemoryView":412 - * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) + /* "View.MemoryView":762 + * new_ndim += 1 * else: + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 412, __pyx_L1_error) - if (__pyx_t_2) { + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 762, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 762, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; - /* "View.MemoryView":413 - * cdef char *itemp - * if have_slices: - * return memview_slice(self, indices) # <<<<<<<<<<<<<< + /* "View.MemoryView":763 * else: - * itemp = self.get_item_pointer(indices) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "View.MemoryView":412 + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; + + /* "View.MemoryView":764 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< + * + * have_start = index.start is not None + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; + + /* "View.MemoryView":766 + * step = index.step or 0 + * + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; + + /* "View.MemoryView":767 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None + * + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; + + /* "View.MemoryView":768 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; + + /* "View.MemoryView":770 + * have_step = index.step is not None + * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, + */ + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 770, __pyx_L1_error) + + /* "View.MemoryView":776 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): + */ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + } + __pyx_L6:; + + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step + * + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index */ } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":415 - * return memview_slice(self, indices) - * else: - * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< - * return self.convert_item_to_object(itemp) + /* "View.MemoryView":778 + * new_ndim += 1 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, */ - /*else*/ { - __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 415, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_6; + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "View.MemoryView":416 - * else: - * itemp = self.get_item_pointer(indices) - * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + /* "View.MemoryView":779 * - * def __setitem__(memoryview self, object index, object value): + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":780 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 780, __pyx_L1_error) } + + /* "View.MemoryView":781 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":779 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, + */ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 779, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; goto __pyx_L0; + + /* "View.MemoryView":778 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + */ } - /* "View.MemoryView":405 + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) * + */ + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":785 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self + * + */ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * + */ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 784, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + + /* "View.MemoryView":711 + * + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_indices); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) +/* "View.MemoryView":793 * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ -/* Python wrapper */ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_obj = NULL; +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_2; + int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - __Pyx_INCREF(__pyx_v_index); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("slice_memviewslice", 1); - /* "View.MemoryView":419 + /* "View.MemoryView":813 + * cdef bint negative_step * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") + * if not is_slice: # <<<<<<<<<<<<<< * + * if start < 0: */ - __pyx_t_1 = (__pyx_v_self->view.readonly != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< + /* "View.MemoryView":815 + * if not is_slice: * - * have_slices, index = _unellipsify(index, self.view.ndim) + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 420, __pyx_L1_error) + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { - /* "View.MemoryView":419 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") + /* "View.MemoryView":816 * + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) */ - } + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "View.MemoryView":422 - * raise TypeError("Cannot assign to read-only memoryview") + /* "View.MemoryView":815 + * if not is_slice: * - * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: + */ + } + + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: + */ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + + /* "View.MemoryView":818 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: * - * if have_slices: */ - __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(__pyx_t_2 != Py_None)) { - PyObject* sequence = __pyx_t_2; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 422, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 818, __pyx_L1_error) + + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: + */ } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 422, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); - __pyx_t_4 = 0; - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "View.MemoryView":813 + * cdef bint negative_step * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error) - if (__pyx_t_1) { + goto __pyx_L3; + } - /* "View.MemoryView":425 + /* "View.MemoryView":821 + * else: * - * if have_slices: - * obj = self.is_slice(value) # <<<<<<<<<<<<<< - * if obj: - * self.setitem_slice_assignment(self[index], obj) + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_obj = __pyx_t_2; - __pyx_t_2 = 0; + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: + /* "View.MemoryView":822 + * + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 426, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_v_negative_step = (__pyx_v_step < 0); - /* "View.MemoryView":427 - * obj = self.is_slice(value) - * if obj: - * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< - * else: - * self.setitem_slice_assign_scalar(self[index], value) + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) + * else: */ - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: + /* "View.MemoryView":824 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + * else: + * negative_step = False */ - goto __pyx_L5; - } + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 824, __pyx_L1_error) - /* "View.MemoryView":429 - * self.setitem_slice_assignment(self[index], obj) - * else: - * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) * else: - * self.setitem_indexed(index, value) */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 429, __pyx_L1_error) - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L5:; + } - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "View.MemoryView":821 + * else: * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ - goto __pyx_L4; - } + goto __pyx_L6; + } - /* "View.MemoryView":431 - * self.setitem_slice_assign_scalar(self[index], value) + /* "View.MemoryView":826 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) * else: - * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 * - * cdef is_slice(self, obj): */ - /*else*/ { - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L4:; + /*else*/ { + __pyx_v_negative_step = 0; - /* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) + /* "View.MemoryView":827 + * else: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") */ + __pyx_v_step = 1; + } + __pyx_L6:; - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":433 - * self.setitem_indexed(index, value) + /* "View.MemoryView":830 * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { -static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_slice", 0); - __Pyx_INCREF(__pyx_v_obj); - - /* "View.MemoryView":434 + /* "View.MemoryView":831 * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) + /* "View.MemoryView":832 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_5); - /*try:*/ { + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: */ - __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { - /* "View.MemoryView":437 - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * except TypeError: - * return None + /* "View.MemoryView":834 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: */ - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 437, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_v_start = 0; - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: */ - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); - __pyx_t_7 = 0; + } - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) + /* "View.MemoryView":831 + * + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ + goto __pyx_L9; } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "View.MemoryView":438 - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - * except TypeError: # <<<<<<<<<<<<<< - * return None - * + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 */ - __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); - if (__pyx_t_9) { - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 438, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { - /* "View.MemoryView":439 - * self.dtype_is_object) - * except TypeError: - * return None # <<<<<<<<<<<<<< - * - * return obj + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_except_return; - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; + if (__pyx_v_negative_step) { - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) + /* "View.MemoryView":837 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape */ - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L1_error; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L0; - __pyx_L9_try_end:; - } + __pyx_v_start = (__pyx_v_shape - 1); - /* "View.MemoryView":434 - * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - } + goto __pyx_L11; + } - /* "View.MemoryView":441 - * return None - * - * return obj # <<<<<<<<<<<<<< - * - * cdef setitem_slice_assignment(self, dst, src): + /* "View.MemoryView":839 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_obj); - __pyx_r = __pyx_v_obj; - goto __pyx_L0; + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; - /* "View.MemoryView":433 - * self.setitem_indexed(index, value) - * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 */ + } + __pyx_L9:; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":443 - * return obj + /* "View.MemoryView":830 * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ + goto __pyx_L8; + } -static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { - __Pyx_memviewslice __pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_src_slice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - __Pyx_memviewslice *__pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: + */ + /*else*/ { + if (__pyx_v_negative_step) { - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice - * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) + /* "View.MemoryView":842 + * else: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 */ - if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 447, __pyx_L1_error) - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 447, __pyx_L1_error) + __pyx_v_start = (__pyx_v_shape - 1); - /* "View.MemoryView":448 - * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<< - * src.ndim, dst.ndim, self.dtype_is_object) - * + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 448, __pyx_L1_error) - __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 448, __pyx_L1_error) + goto __pyx_L12; + } - /* "View.MemoryView":449 - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + /* "View.MemoryView":844 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * if have_stop: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice + /* "View.MemoryView":846 + * start = 0 * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ - __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 447, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { - /* "View.MemoryView":443 - * return obj + /* "View.MemoryView":847 * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: */ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":848 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 + */ + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); -/* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) - * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { -static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { - int __pyx_v_array[0x80]; - void *__pyx_v_tmp; - void *__pyx_v_item; - __Pyx_memviewslice *__pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_tmp_slice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - char const *__pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - - /* "View.MemoryView":453 - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - * cdef int array[128] - * cdef void *tmp = NULL # <<<<<<<<<<<<<< - * cdef void *item - * + /* "View.MemoryView":850 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape */ - __pyx_v_tmp = NULL; + __pyx_v_stop = 0; - /* "View.MemoryView":458 - * cdef __Pyx_memviewslice *dst_slice - * cdef __Pyx_memviewslice tmp_slice - * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< - * - * if self.view.itemsize > sizeof(array): + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 458, __pyx_L1_error) - __pyx_v_dst_slice = __pyx_t_1; + } - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) + /* "View.MemoryView":847 * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: */ - __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); - if (__pyx_t_2) { + goto __pyx_L14; + } - /* "View.MemoryView":461 - * - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< - * if tmp == NULL: - * raise MemoryError + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape + * else: */ - __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp + /* "View.MemoryView":852 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< + * else: + * if negative_step: */ - __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_v_stop = __pyx_v_shape; - /* "View.MemoryView":463 - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * item = tmp + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape * else: */ - PyErr_NoMemory(); __PYX_ERR(2, 463, __pyx_L1_error) + } + __pyx_L14:; - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp + /* "View.MemoryView":846 + * start = 0 + * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ + goto __pyx_L13; } - /* "View.MemoryView":464 - * if tmp == NULL: - * raise MemoryError - * item = tmp # <<<<<<<<<<<<<< + /* "View.MemoryView":854 + * stop = shape * else: - * item = array + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: */ - __pyx_v_item = __pyx_v_tmp; + /*else*/ { + if (__pyx_v_negative_step) { - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) - * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: + /* "View.MemoryView":855 + * else: + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape */ - goto __pyx_L3; - } + __pyx_v_stop = -1L; - /* "View.MemoryView":466 - * item = tmp + /* "View.MemoryView":854 + * stop = shape * else: - * item = array # <<<<<<<<<<<<<< - * - * try: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: */ - /*else*/ { - __pyx_v_item = ((void *)__pyx_v_array); - } - __pyx_L3:; + goto __pyx_L16; + } - /* "View.MemoryView":468 - * item = array + /* "View.MemoryView":857 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * * - * try: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * ( item)[0] = value */ - /*try:*/ { + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; - /* "View.MemoryView":469 + /* "View.MemoryView":861 * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: */ - __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_2) { + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - /* "View.MemoryView":470 - * try: - * if self.dtype_is_object: - * ( item)[0] = value # <<<<<<<<<<<<<< - * else: - * self.assign_item_from_object( item, value) + /* "View.MemoryView":863 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 + * */ - (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { - /* "View.MemoryView":469 + /* "View.MemoryView":864 * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: */ - goto __pyx_L8; - } + __pyx_v_new_shape = (__pyx_v_new_shape + 1); - /* "View.MemoryView":472 - * ( item)[0] = value - * else: - * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< + /* "View.MemoryView":863 + * new_shape = (stop - start) // step * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 * */ - /*else*/ { - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 472, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __pyx_L8:; - /* "View.MemoryView":476 + /* "View.MemoryView":866 + * new_shape += 1 * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0); + __pyx_t_2 = (__pyx_v_new_shape < 0); if (__pyx_t_2) { - /* "View.MemoryView":477 + /* "View.MemoryView":867 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * * - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) */ - __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 477, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_new_shape = 0; - /* "View.MemoryView":476 + /* "View.MemoryView":866 + * new_shape += 1 * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ } - /* "View.MemoryView":478 - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< - * item, self.dtype_is_object) - * finally: + /* "View.MemoryView":870 + * + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset */ - __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); - } + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - /* "View.MemoryView":481 - * item, self.dtype_is_object) - * finally: - * PyMem_Free(tmp) # <<<<<<<<<<<<<< + /* "View.MemoryView":871 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset * - * cdef setitem_indexed(self, index, value): */ - /*finally:*/ { - /*normal exit:*/{ - PyMem_Free(__pyx_v_tmp); - goto __pyx_L7; - } - __pyx_L6_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; - { - PyMem_Free(__pyx_v_tmp); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; - goto __pyx_L1_error; - } - __pyx_L7:; + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + + /* "View.MemoryView":872 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * + * + */ + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; } + __pyx_L3:; - /* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) + /* "View.MemoryView":875 * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":876 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride + */ + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); -/* "View.MemoryView":483 - * PyMem_Free(tmp) + /* "View.MemoryView":875 * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ + goto __pyx_L19; + } -static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_indexed", 0); + /* "View.MemoryView":878 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + * + * if suboffset >= 0: + */ + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; - /* "View.MemoryView":484 + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride * - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< - * self.assign_item_from_object(itemp, value) + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: + */ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { + + /* "View.MemoryView":881 * + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 484, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_1; + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { - /* "View.MemoryView":485 - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: + */ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":883 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + */ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: + */ + goto __pyx_L22; + } + + /* "View.MemoryView":885 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: + */ + /*else*/ { + + /* "View.MemoryView":886 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim + */ + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 885, __pyx_L1_error) + } + __pyx_L22:; + + /* "View.MemoryView":881 * - * cdef convert_item_to_object(self, char *itemp): + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 485, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L21; + } - /* "View.MemoryView":483 - * PyMem_Free(tmp) + /* "View.MemoryView":888 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) + * return 0 */ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride + * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: + */ + } + + /* "View.MemoryView":890 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 0; goto __pyx_L0; + + /* "View.MemoryView":793 + * + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + */ + + /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) +/* "View.MemoryView":896 * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ -static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_v_struct = NULL; - PyObject *__pyx_v_bytesitem = 0; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + Py_UCS4 __pyx_t_4; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - size_t __pyx_t_10; - int __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); + __Pyx_RefNannySetupContext("pybuffer_index", 0); - /* "View.MemoryView":490 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef bytes bytesitem - * + /* "View.MemoryView":898 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_suboffset = -1L; - /* "View.MemoryView":493 - * cdef bytes bytesitem + /* "View.MemoryView":899 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp * - * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< - * try: - * result = struct.unpack(self.view.format, bytesitem) */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":494 + /* "View.MemoryView":902 + * cdef char *resultp * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { - - /* "View.MemoryView":495 - * bytesitem = itemp[:self.view.itemsize] - * try: - * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< - * except struct.error: - * raise ValueError("Unable to convert item to object") + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); - __Pyx_INCREF(__pyx_v_bytesitem); - __Pyx_GIVEREF(__pyx_v_bytesitem); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { - /* "View.MemoryView":494 + /* "View.MemoryView":903 * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: */ + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 903, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 903, __pyx_L1_error) } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result + /* "View.MemoryView":904 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] */ - /*else:*/ { - __pyx_t_10 = strlen(__pyx_v_self->view.format); - __pyx_t_11 = ((__pyx_t_10 == 1) != 0); - if (__pyx_t_11) { + __pyx_v_stride = __pyx_v_itemsize; - /* "View.MemoryView":500 - * else: - * if len(self.view.format) == 1: - * return result[0] # <<<<<<<<<<<<<< - * return result + /* "View.MemoryView":902 + * cdef char *resultp * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L6_except_return; + goto __pyx_L3; + } - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") - * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result + /* "View.MemoryView":906 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: */ - } + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - /* "View.MemoryView":501 - * if len(self.view.format) == 1: - * return result[0] - * return result # <<<<<<<<<<<<<< + /* "View.MemoryView":907 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] + */ + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] * - * cdef assign_item_from_object(self, char *itemp, object value): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L6_except_return; - } - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { - /* "View.MemoryView":496 - * try: - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: # <<<<<<<<<<<<<< - * raise ValueError("Unable to convert item to object") - * else: + /* "View.MemoryView":909 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + * + * if index < 0: */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9); - __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0; - if (__pyx_t_8) { - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] + * */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 497, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(2, 497, __pyx_L5_except_error) } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + } + __pyx_L3:; - /* "View.MemoryView":494 + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L6_except_return:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L0; - } + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { - /* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) + /* "View.MemoryView":912 * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" */ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesitem); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + */ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { -/* "View.MemoryView":503 - * return result + /* "View.MemoryView":914 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * if index >= shape: */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__7); + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 914, __pyx_L1_error) -static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_v_struct = NULL; - char __pyx_v_c; - PyObject *__pyx_v_bytesvalue = 0; - Py_ssize_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - char *__pyx_t_11; - char *__pyx_t_12; - char *__pyx_t_13; - char *__pyx_t_14; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + */ + } - /* "View.MemoryView":506 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef char c - * cdef bytes bytesvalue + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] + * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; + } - /* "View.MemoryView":511 - * cdef Py_ssize_t i + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: */ - __pyx_t_2 = PyTuple_Check(__pyx_v_value); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":512 + /* "View.MemoryView":917 * - * if isinstance(value, tuple): - * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< - * else: - * bytesvalue = struct.pack(self.view.format, value) + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 512, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__7); + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 917, __pyx_L1_error) - /* "View.MemoryView":511 - * cdef Py_ssize_t i + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: */ - goto __pyx_L3; } - /* "View.MemoryView":514 - * bytesvalue = struct.pack(self.view.format, *value) - * else: - * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< + /* "View.MemoryView":919 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * for i, c in enumerate(bytesvalue): + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 514, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - } - __pyx_L3:; + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) + /* "View.MemoryView":920 * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset * */ - __pyx_t_9 = 0; - if (unlikely(__pyx_v_bytesvalue == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(2, 516, __pyx_L1_error) - } - __Pyx_INCREF(__pyx_v_bytesvalue); - __pyx_t_10 = __pyx_v_bytesvalue; - __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10); - __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10)); - for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { - __pyx_t_11 = __pyx_t_14; - __pyx_v_c = (__pyx_t_11[0]); + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { - /* "View.MemoryView":517 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< + /* "View.MemoryView":921 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< * - * @cname('getbuffer') + * return resultp */ - __pyx_v_i = __pyx_t_9; + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) + /* "View.MemoryView":920 * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset * */ - __pyx_t_9 = (__pyx_t_9 + 1); + } - /* "View.MemoryView":517 + /* "View.MemoryView":923 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< * - * @cname('getbuffer') */ - (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_r = __pyx_v_resultp; + goto __pyx_L0; - /* "View.MemoryView":503 - * return result + /* "View.MemoryView":896 * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesvalue); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":520 +/* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") */ -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - char *__pyx_t_5; - void *__pyx_t_6; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; int __pyx_t_7; - Py_ssize_t __pyx_t_8; + int __pyx_t_8; + int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("transpose_memslice", 1); - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "View.MemoryView":930 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< * + * cdef Py_ssize_t *shape = memslice.shape */ - __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_self->view.readonly != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< + /* "View.MemoryView":932 + * cdef int ndim = memslice.memview.view.ndim * - * if flags & PyBUF_ND: - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 522, __pyx_L1_error) - - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides * */ - } + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "View.MemoryView":933 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); - if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; - /* "View.MemoryView":525 + /* "View.MemoryView":937 * - * if flags & PyBUF_ND: - * info.shape = self.view.shape # <<<<<<<<<<<<<< - * else: - * info.shape = NULL + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] */ - __pyx_t_4 = __pyx_v_self->view.shape; - __pyx_v_info->shape = __pyx_t_4; + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "View.MemoryView":938 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] + */ + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + + /* "View.MemoryView":939 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape - * else: */ - goto __pyx_L6; - } + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; - /* "View.MemoryView":527 - * info.shape = self.view.shape - * else: - * info.shape = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":940 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< * - * if flags & PyBUF_STRIDES: + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: */ - /*else*/ { - __pyx_v_info->shape = NULL; - } - __pyx_L6:; + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; - /* "View.MemoryView":529 - * info.shape = NULL + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); - if (__pyx_t_1) { + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { - /* "View.MemoryView":530 + /* "View.MemoryView":943 * - * if flags & PyBUF_STRIDES: - * info.strides = self.view.strides # <<<<<<<<<<<<<< - * else: - * info.strides = NULL + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 */ - __pyx_t_4 = __pyx_v_self->view.strides; - __pyx_v_info->strides = __pyx_t_4; + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_kp_s_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L1_error) - /* "View.MemoryView":529 - * info.shape = NULL + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides - * else: */ - goto __pyx_L7; + } } - /* "View.MemoryView":532 - * info.strides = self.view.strides - * else: - * info.strides = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":945 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * * - * if flags & PyBUF_INDIRECT: */ - /*else*/ { - __pyx_v_info->strides = NULL; - } - __pyx_L7:; + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":534 - * info.strides = NULL + /* "View.MemoryView":929 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":535 + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} + +/* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * if flags & PyBUF_INDIRECT: - * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< - * else: - * info.suboffsets = NULL */ - __pyx_t_4 = __pyx_v_self->view.suboffsets; - __pyx_v_info->suboffsets = __pyx_t_4; - /* "View.MemoryView":534 - * info.strides = NULL +/* Python wrapper */ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "View.MemoryView":964 * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + * + * cdef convert_item_to_object(self, char *itemp): */ - goto __pyx_L8; - } + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); - /* "View.MemoryView":537 - * info.suboffsets = self.view.suboffsets - * else: - * info.suboffsets = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * if flags & PyBUF_FORMAT: */ - /*else*/ { - __pyx_v_info->suboffsets = NULL; - } - __pyx_L8:; - /* "View.MemoryView":539 - * info.suboffsets = NULL + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) + */ + +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":967 + * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); if (__pyx_t_1) { - /* "View.MemoryView":540 - * - * if flags & PyBUF_FORMAT: - * info.format = self.view.format # <<<<<<<<<<<<<< + /* "View.MemoryView":968 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< * else: - * info.format = NULL + * return memoryview.convert_item_to_object(self, itemp) */ - __pyx_t_5 = __pyx_v_self->view.format; - __pyx_v_info->format = __pyx_t_5; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 968, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "View.MemoryView":539 - * info.suboffsets = NULL + /* "View.MemoryView":967 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) * else: */ - goto __pyx_L9; } - /* "View.MemoryView":542 - * info.format = self.view.format + /* "View.MemoryView":970 + * return self.to_object_func(itemp) * else: - * info.format = NULL # <<<<<<<<<<<<<< + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< * - * info.buf = self.view.buf + * cdef assign_item_from_object(self, char *itemp, object value): */ /*else*/ { - __pyx_v_info->format = NULL; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 970, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; } - __pyx_L9:; - /* "View.MemoryView":544 - * info.format = NULL + /* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * info.buf = self.view.buf # <<<<<<<<<<<<<< - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) */ - __pyx_t_6 = __pyx_v_self->view.buf; - __pyx_v_info->buf = __pyx_t_6; - /* "View.MemoryView":545 - * - * info.buf = self.view.buf - * info.ndim = self.view.ndim # <<<<<<<<<<<<<< - * info.itemsize = self.view.itemsize - * info.len = self.view.len - */ - __pyx_t_7 = __pyx_v_self->view.ndim; - __pyx_v_info->ndim = __pyx_t_7; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":546 - * info.buf = self.view.buf - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< - * info.len = self.view.len - * info.readonly = self.view.readonly +/* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ - __pyx_t_8 = __pyx_v_self->view.itemsize; - __pyx_v_info->itemsize = __pyx_t_8; - /* "View.MemoryView":547 - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - * info.len = self.view.len # <<<<<<<<<<<<<< - * info.readonly = self.view.readonly - * info.obj = self +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); + + /* "View.MemoryView":973 + * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: */ - __pyx_t_8 = __pyx_v_self->view.len; - __pyx_v_info->len = __pyx_t_8; + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); + if (__pyx_t_1) { - /* "View.MemoryView":548 - * info.itemsize = self.view.itemsize - * info.len = self.view.len - * info.readonly = self.view.readonly # <<<<<<<<<<<<<< - * info.obj = self + /* "View.MemoryView":974 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) + */ + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 974, __pyx_L1_error) + + /* "View.MemoryView":973 * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: */ - __pyx_t_1 = __pyx_v_self->view.readonly; - __pyx_v_info->readonly = __pyx_t_1; + goto __pyx_L3; + } - /* "View.MemoryView":549 - * info.len = self.view.len - * info.readonly = self.view.readonly - * info.obj = self # <<<<<<<<<<<<<< + /* "View.MemoryView":976 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") + * cdef _get_base(self): */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; - /* "View.MemoryView":520 + /* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":555 +/* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) */ -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":556 - * @property - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< - * transpose_memslice(&result.from_slice) - * return result - */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 556, __pyx_L1_error) - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("_get_base", 0); - /* "View.MemoryView":557 - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< - * return result + /* "View.MemoryView":979 + * + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< * - */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 557, __pyx_L1_error) - - /* "View.MemoryView":558 - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - * return result # <<<<<<<<<<<<<< * - * @property */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; goto __pyx_L0; - /* "View.MemoryView":555 + /* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj - * +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "View.MemoryView":562 - * @property - * def base(self): - * return self.obj # <<<<<<<<<<<<<< - * - * @property + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->obj); - __pyx_r = __pyx_v_self->obj; - goto __pyx_L0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj - * + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ - __pyx_L0:; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":565 - * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - * +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_length; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":566 - * @property - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_length = (__pyx_t_2[0]); - __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "View.MemoryView":565 - * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":569 - * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_stride; +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< - * - * raise ValueError("Buffer view does not expose strides") - */ - __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":572 - * if self.view.strides == NULL: - * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 572, __pyx_L1_error) - - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< - * - * raise ValueError("Buffer view does not expose strides") - */ - } + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "View.MemoryView":574 - * raise ValueError("Buffer view does not expose strides") - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_v_stride = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "View.MemoryView":569 - * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: - * + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":577 +/* "View.MemoryView":999 * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; + __Pyx_TypeInfo *__pyx_t_4; + Py_buffer __pyx_t_5; Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim + /* "View.MemoryView":1007 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None * */ - __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); if (__pyx_t_1) { - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + /* "View.MemoryView":1008 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__15, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim + /* "View.MemoryView":1007 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None * */ } - /* "View.MemoryView":581 - * return (-1,) * self.view.ndim + /* "View.MemoryView":1013 * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< * - * @property + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); - for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) { - __pyx_t_4 = __pyx_t_6; - __pyx_v_suboffset = (__pyx_t_4[0]); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L0; - /* "View.MemoryView":577 + /* "View.MemoryView":1015 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim */ + __pyx_v_result->from_slice = __pyx_v_memviewslice; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":584 + /* "View.MemoryView":1016 * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< * + * result.from_object = ( memviewslice.memview)._get_base() */ + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":585 - * @property - * def ndim(self): - * return self.view.ndim # <<<<<<<<<<<<<< + /* "View.MemoryView":1018 + * __PYX_INC_MEMVIEW(&memviewslice, 1) + * + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo * - * @property */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 585, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; + __pyx_t_2 = 0; - /* "View.MemoryView":584 + /* "View.MemoryView":1019 * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< * + * result.view = memviewslice.memview.view */ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":588 + /* "View.MemoryView":1021 + * result.typeinfo = memviewslice.memview.typeinfo * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + */ + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; + + /* "View.MemoryView":1022 * + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None */ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "View.MemoryView":1023 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) + */ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1024 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * + */ + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":1025 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + */ + Py_INCREF(Py_None); - /* "View.MemoryView":589 - * @property - * def itemsize(self): - * return self.view.itemsize # <<<<<<<<<<<<<< + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) * - * @property + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { - /* "View.MemoryView":588 + /* "View.MemoryView":1028 * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO + */ + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: */ + goto __pyx_L4; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1030 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape + */ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; -/* "View.MemoryView":592 + /* "View.MemoryView":1032 + * result.flags = PyBUF_RECORDS_RO * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides * */ + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":593 - * @property - * def nbytes(self): - * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + /* "View.MemoryView":1033 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * * - * @property */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - /* "View.MemoryView":592 + /* "View.MemoryView":1036 * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: */ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":596 + /* "View.MemoryView":1037 * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets */ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break + */ + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":1039 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break + * + */ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 + /* "View.MemoryView":1040 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< * + * result.view.len = result.view.itemsize */ - __pyx_t_1 = (__pyx_v_self->_size == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + goto __pyx_L6_break; - /* "View.MemoryView":598 - * def size(self): - * if self._size is None: - * result = 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break + */ + } + } + __pyx_L6_break:; + + /* "View.MemoryView":1042 + * break * - * for length in self.view.shape[:self.view.ndim]: + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_result = __pyx_int_1; + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - /* "View.MemoryView":600 - * result = 1 + /* "View.MemoryView":1043 * - * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< - * result *= length + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length * */ - __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":601 - * - * for length in self.view.shape[:self.view.ndim]: - * result *= length # <<<<<<<<<<<<<< + /* "View.MemoryView":1044 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< * - * self._size = result + * result.to_object_func = to_object_func */ - __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 601, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6); - __pyx_t_6 = 0; - } + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } - /* "View.MemoryView":603 - * result *= length + /* "View.MemoryView":1046 + * result.view.len *= length * - * self._size = result # <<<<<<<<<<<<<< + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func * - * return self._size */ - __Pyx_INCREF(__pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - __Pyx_GOTREF(__pyx_v_self->_size); - __Pyx_DECREF(__pyx_v_self->_size); - __pyx_v_self->_size = __pyx_v_result; + __pyx_v_result->to_object_func = __pyx_v_to_object_func; - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 + /* "View.MemoryView":1047 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< * + * return result */ - } + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; - /* "View.MemoryView":605 - * self._size = result + /* "View.MemoryView":1049 + * result.to_dtype_func = to_dtype_func * - * return self._size # <<<<<<<<<<<<<< + * return result # <<<<<<<<<<<<<< * - * def __len__(self): + * @cname('__pyx_memoryview_get_slice_from_memoryview') */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_size); - __pyx_r = __pyx_v_self->_size; + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "View.MemoryView":596 + /* "View.MemoryView":999 * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XDECREF(__pyx_v_length); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":607 - * return self._size +/* "View.MemoryView":1052 * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ -/* Python wrapper */ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__len__", 0); + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] - * + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice */ - __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); if (__pyx_t_1) { - /* "View.MemoryView":609 - * def __len__(self): - * if self.view.ndim >= 1: - * return self.view.shape[0] # <<<<<<<<<<<<<< - * - * return 0 + /* "View.MemoryView":1056 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: */ - __pyx_r = (__pyx_v_self->view.shape[0]); + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1057 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) + */ + __pyx_r = (&__pyx_v_obj->from_slice); goto __pyx_L0; - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] - * + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice */ } - /* "View.MemoryView":611 - * return self.view.shape[0] + /* "View.MemoryView":1059 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice * - * return 0 # <<<<<<<<<<<<<< + */ + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + + /* "View.MemoryView":1060 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< * - * def __repr__(self): + * @cname('__pyx_memoryview_slice_copy') */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } - /* "View.MemoryView":607 - * return self._size + /* "View.MemoryView":1052 * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_obj); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":613 - * return 0 +/* "View.MemoryView":1063 * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets */ -/* Python wrapper */ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("slice_copy", 0); -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__repr__", 0); + /* "View.MemoryView":1067 + * cdef (Py_ssize_t*) shape, strides, suboffsets + * + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets + */ + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; - /* "View.MemoryView":614 + /* "View.MemoryView":1068 * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; - /* "View.MemoryView":615 - * def __repr__(self): - * return "" % (self.base.__class__.__name__, - * id(self)) # <<<<<<<<<<<<<< + /* "View.MemoryView":1069 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< * - * def __str__(self): + * dst.memview = <__pyx_memoryview *> memview */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; - /* "View.MemoryView":614 + /* "View.MemoryView":1071 + * suboffsets = memview.view.suboffsets * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf * */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); - /* "View.MemoryView":613 - * return 0 + /* "View.MemoryView":1072 * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): */ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1074 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + */ + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; -/* "View.MemoryView":617 - * id(self)) + /* "View.MemoryView":1075 * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + */ + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + + /* "View.MemoryView":1076 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 * */ + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); -/* Python wrapper */ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "View.MemoryView":1077 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object') + */ + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + } + + /* "View.MemoryView":1063 + * + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets + */ /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { +/* "View.MemoryView":1080 + * + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + */ + +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); + __Pyx_RefNannySetupContext("memoryview_copy", 0); - /* "View.MemoryView":618 - * - * def __str__(self): - * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + /* "View.MemoryView":1083 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) * + */ + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + + /* "View.MemoryView":1084 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< * + * @cname('__pyx_memoryview_copy_object_from_slice') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":617 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) + /* "View.MemoryView":1080 * + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":621 +/* "View.MemoryView":1087 * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_c_contig", 0); + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - /* "View.MemoryView":624 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 624, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "View.MemoryView":625 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< + /* "View.MemoryView":1095 * - * def is_f_contig(self): + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; - /* "View.MemoryView":621 - * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + /* "View.MemoryView":1096 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL */ + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ + goto __pyx_L3; + } -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_f_contig", 0); + /* "View.MemoryView":1098 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL + * + */ + /*else*/ { + __pyx_v_to_object_func = NULL; - /* "View.MemoryView":630 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "View.MemoryView":1099 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 630, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __pyx_v_to_dtype_func = NULL; + } + __pyx_L3:; - /* "View.MemoryView":631 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + /* "View.MemoryView":1101 + * to_dtype_func = NULL * - * def copy(self): + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + + /* "View.MemoryView":1103 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "View.MemoryView":1087 * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) +/* "View.MemoryView":1109 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1110 + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< + * + * @cname('__pyx_get_best_slice_order') + */ + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); + } else { + __pyx_t_1 = __pyx_v_arg; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":1109 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg + * + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_mslice; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy", 0); +/* "View.MemoryView":1113 + * + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. + */ - /* "View.MemoryView":635 - * def copy(self): - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + + /* "View.MemoryView":1118 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 * - * slice_copy(self, &mslice) */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + __pyx_v_c_stride = 0; - /* "View.MemoryView":637 - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + /* "View.MemoryView":1119 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< * - * slice_copy(self, &mslice) # <<<<<<<<<<<<<< - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, - * self.view.itemsize, + * for i in range(ndim - 1, -1, -1): */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + __pyx_v_f_stride = 0; - /* "View.MemoryView":638 + /* "View.MemoryView":1121 + * cdef Py_ssize_t f_stride = 0 * - * slice_copy(self, &mslice) - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_C_CONTIGUOUS, + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 638, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":643 - * self.dtype_is_object) + /* "View.MemoryView":1122 * - * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break + */ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1123 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break * - * def copy_fortran(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "View.MemoryView":1124 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * for i in range(ndim): */ + goto __pyx_L4_break; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) + /* "View.MemoryView":1122 * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break */ + } + } + __pyx_L4_break:; -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "View.MemoryView":1126 + * break + * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + */ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1127 + * + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break + */ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy_fortran", 0); + /* "View.MemoryView":1128 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break + * + */ + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":647 - * def copy_fortran(self): - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + /* "View.MemoryView":1129 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< * - * slice_copy(self, &src) + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + goto __pyx_L7_break; - /* "View.MemoryView":649 - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + /* "View.MemoryView":1127 * - * slice_copy(self, &src) # <<<<<<<<<<<<<< - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, - * self.view.itemsize, + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + } + } + __pyx_L7_break:; - /* "View.MemoryView":650 + /* "View.MemoryView":1131 + * break * - * slice_copy(self, &src) - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_F_CONTIGUOUS, + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 650, __pyx_L1_error) - __pyx_v_dst = __pyx_t_1; + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); + if (__pyx_t_2) { - /* "View.MemoryView":655 - * self.dtype_is_object) + /* "View.MemoryView":1132 * - * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< + * else: + * return 'F' + */ + __pyx_r = 'C'; + goto __pyx_L0; + + /* "View.MemoryView":1131 + * break * + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: + */ + } + + /* "View.MemoryView":1134 + * return 'C' + * else: + * return 'F' # <<<<<<<<<<<<<< * + * @cython.cdivision(True) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + /*else*/ { + __pyx_r = 'F'; + goto __pyx_L0; + } - /* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) + /* "View.MemoryView":1113 * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): +/* "View.MemoryView":1137 + * + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; -static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + /* "View.MemoryView":1144 + * + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + */ + __pyx_v_src_extent = (__pyx_v_src_shape[0]); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":1145 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "View.MemoryView":1146 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] + * */ + __pyx_v_src_stride = (__pyx_v_src_strides[0]); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1147 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< + * + * if ndim == 1: + */ + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): */ + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + /* "View.MemoryView":1150 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) + */ + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1151 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + */ + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); + } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; -static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + /* "View.MemoryView":1150 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) + */ + if (__pyx_t_1) { - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "View.MemoryView":1152 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":1150 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ + goto __pyx_L4; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1154 + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + */ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "View.MemoryView":1155 + * else: + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride + */ + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + + /* "View.MemoryView":1156 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: + */ + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + + /* "View.MemoryView":1157 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): + */ + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L4:; -/* "View.MemoryView":659 + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): */ + goto __pyx_L3; + } -static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { - struct __pyx_memoryview_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + /* "View.MemoryView":1159 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, + */ + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":660 - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< - * result.typeinfo = typeinfo - * return result + /* "View.MemoryView":1160 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_o); - __Pyx_GIVEREF(__pyx_v_o); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - /* "View.MemoryView":661 - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo # <<<<<<<<<<<<<< - * return result + /* "View.MemoryView":1164 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride * */ - __pyx_v_result->typeinfo = __pyx_v_typeinfo; + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "View.MemoryView":662 - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - * return result # <<<<<<<<<<<<<< + /* "View.MemoryView":1165 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_check') + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; - /* "View.MemoryView":659 + /* "View.MemoryView":1137 * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) +/* "View.MemoryView":1167 + * dst_data += dst_stride * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ -static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("memoryview_check", 0); +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - /* "View.MemoryView":666 - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): - * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + /* "View.MemoryView":1170 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) * - * cdef tuple _unellipsify(object index, int ndim): */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); - __pyx_r = __pyx_t_1; - goto __pyx_L0; + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); - /* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) + /* "View.MemoryView":1167 + * dst_data += dst_stride * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":668 - * return isinstance(o, memoryview) +/* "View.MemoryView":1174 * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ -static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { - PyObject *__pyx_v_tup = NULL; - PyObject *__pyx_v_result = NULL; - int __pyx_v_have_slices; - int __pyx_v_seen_ellipsis; - CYTHON_UNUSED PyObject *__pyx_v_idx = NULL; - PyObject *__pyx_v_item = NULL; - Py_ssize_t __pyx_v_nslices; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_unellipsify", 0); +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: + /* "View.MemoryView":1176 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + * + * for shape in src.shape[:ndim]: */ - __pyx_t_1 = PyTuple_Check(__pyx_v_index); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; - /* "View.MemoryView":674 - * """ - * if not isinstance(index, tuple): - * tup = (index,) # <<<<<<<<<<<<<< - * else: - * tup = index + /* "View.MemoryView":1178 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape + * */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 674, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); - __pyx_v_tup = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":676 - * tup = (index,) - * else: - * tup = index # <<<<<<<<<<<<<< + /* "View.MemoryView":1179 + * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< * - * result = [] + * return size */ - /*else*/ { - __Pyx_INCREF(__pyx_v_index); - __pyx_v_tup = __pyx_v_index; + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); } - __pyx_L3:; - /* "View.MemoryView":678 - * tup = index + /* "View.MemoryView":1181 + * size *= shape * - * result = [] # <<<<<<<<<<<<<< - * have_slices = False - * seen_ellipsis = False - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 678, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_result = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "View.MemoryView":679 + * return size # <<<<<<<<<<<<<< * - * result = [] - * have_slices = False # <<<<<<<<<<<<<< - * seen_ellipsis = False - * for idx, item in enumerate(tup): - */ - __pyx_v_have_slices = 0; - - /* "View.MemoryView":680 - * result = [] - * have_slices = False - * seen_ellipsis = False # <<<<<<<<<<<<<< - * for idx, item in enumerate(tup): - * if item is Ellipsis: - */ - __pyx_v_seen_ellipsis = 0; - - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: + * @cname('__pyx_fill_contig_strides_array') */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_3 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) { - __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 681, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } - } else { - __pyx_t_7 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_7)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 681, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_r = __pyx_v_size; + goto __pyx_L0; - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) + /* "View.MemoryView":1174 + * + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ - __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True - */ - __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: +/* "View.MemoryView":1184 + * + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ - __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__18); - __Pyx_GIVEREF(__pyx_slice__18); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__18); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":685 - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True # <<<<<<<<<<<<<< - * else: - * result.append(slice(None)) - */ - __pyx_v_seen_ellipsis = 1; +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True + /* "View.MemoryView":1193 + * cdef int idx + * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ - goto __pyx_L7; - } + __pyx_t_1 = (__pyx_v_order == 'F'); + if (__pyx_t_1) { - /* "View.MemoryView":687 - * seen_ellipsis = True - * else: - * result.append(slice(None)) # <<<<<<<<<<<<<< - * have_slices = True - * else: + /* "View.MemoryView":1194 + * + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] */ - /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__18); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 687, __pyx_L1_error) - } - __pyx_L7:; + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; - /* "View.MemoryView":688 - * else: - * result.append(slice(None)) - * have_slices = True # <<<<<<<<<<<<<< - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): + /* "View.MemoryView":1195 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: */ - __pyx_v_have_slices = 1; + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) + /* "View.MemoryView":1196 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< + * else: + * for idx in range(ndim - 1, -1, -1): */ - goto __pyx_L6; + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) - * - */ - /*else*/ { - __pyx_t_2 = PySlice_Check(__pyx_v_item); - __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0); - __pyx_t_1 = __pyx_t_10; - __pyx_L9_bool_binop_done:; - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":691 - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): - * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<< + /* "View.MemoryView":1193 + * cdef int idx * - * have_slices = have_slices or isinstance(item, slice) + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ - __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(2, 691, __pyx_L1_error) + goto __pyx_L3; + } - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) - * + /* "View.MemoryView":1198 + * stride *= shape[idx] + * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] */ - } + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; - /* "View.MemoryView":693 - * raise TypeError("Cannot index with type '%s'" % type(item)) - * - * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< - * result.append(item) + /* "View.MemoryView":1199 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] * */ - __pyx_t_10 = (__pyx_v_have_slices != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = PySlice_Check(__pyx_v_item); - __pyx_t_2 = (__pyx_t_10 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L11_bool_binop_done:; - __pyx_v_have_slices = __pyx_t_1; + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":694 - * - * have_slices = have_slices or isinstance(item, slice) - * result.append(item) # <<<<<<<<<<<<<< + /* "View.MemoryView":1200 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< * - * nslices = ndim - len(result) + * return stride */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 694, __pyx_L1_error) + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } - __pyx_L6:; - - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: - */ } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "View.MemoryView":696 - * result.append(item) - * - * nslices = ndim - len(result) # <<<<<<<<<<<<<< - * if nslices: - * result.extend([slice(None)] * nslices) - */ - __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 696, __pyx_L1_error) - __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); + __pyx_L3:; - /* "View.MemoryView":697 + /* "View.MemoryView":1202 + * stride *= shape[idx] * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) + * return stride # <<<<<<<<<<<<<< * + * @cname('__pyx_memoryview_copy_data_to_temp') */ - __pyx_t_1 = (__pyx_v_nslices != 0); - if (__pyx_t_1) { + __pyx_r = __pyx_v_stride; + goto __pyx_L0; - /* "View.MemoryView":698 - * nslices = ndim - len(result) - * if nslices: - * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< + /* "View.MemoryView":1184 * - * return have_slices or nslices, tuple(result) + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__18); - __Pyx_GIVEREF(__pyx_slice__18); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__18); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":697 - * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1205 * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ - } - /* "View.MemoryView":700 - * result.extend([slice(None)] * nslices) +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("copy_data_to_temp", 1); + + /* "View.MemoryView":1216 + * cdef void *result * - * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): */ - __Pyx_XDECREF(__pyx_r); - if (!__pyx_v_have_slices) { - } else { - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L14_bool_binop_done; - } - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_L14_bool_binop_done:; - __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject*)__pyx_t_11); - __pyx_t_11 = 0; - goto __pyx_L0; + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":668 - * return isinstance(o, memoryview) + /* "View.MemoryView":1217 * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< + * + * result = malloc(size) */ + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tup); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_XDECREF(__pyx_v_item); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) + /* "View.MemoryView":1219 + * cdef size_t size = slice_get_size(src, ndim) * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() */ + __pyx_v_result = malloc(__pyx_v_size); -static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - - /* "View.MemoryView":703 + /* "View.MemoryView":1220 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") */ - __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); - for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { - __pyx_t_1 = __pyx_t_3; - __pyx_v_suboffset = (__pyx_t_1[0]); + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") + /* "View.MemoryView":1221 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * * */ - __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error) - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< + /* "View.MemoryView":1220 * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(2, 705, __pyx_L1_error) + } - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") + /* "View.MemoryView":1224 * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): */ - } - } + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - /* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) + /* "View.MemoryView":1225 * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] */ + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1226 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 + */ + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; -/* "View.MemoryView":712 + /* "View.MemoryView":1227 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step */ + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); -static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { - int __pyx_v_new_ndim; - int __pyx_v_suboffset_dim; - int __pyx_v_dim; - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - __Pyx_memviewslice *__pyx_v_p_src; - struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; - __Pyx_memviewslice *__pyx_v_p_dst; - int *__pyx_v_p_suboffset_dim; - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - int __pyx_v_have_start; - int __pyx_v_have_stop; - int __pyx_v_have_step; - PyObject *__pyx_v_index = NULL; - struct __pyx_memoryview_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - struct __pyx_memoryview_obj *__pyx_t_4; - char *__pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memview_slice", 0); - - /* "View.MemoryView":713 - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): - * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< - * cdef bint negative_step - * cdef __Pyx_memviewslice src, dst + /* "View.MemoryView":1228 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) */ - __pyx_v_new_ndim = 0; - __pyx_v_suboffset_dim = -1; + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } - /* "View.MemoryView":720 + /* "View.MemoryView":1230 + * tmpslice.suboffsets[i] = -1 * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< * - * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< * - * cdef _memoryviewslice memviewsliceobj */ - (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - /* "View.MemoryView":724 - * cdef _memoryviewslice memviewsliceobj + /* "View.MemoryView":1233 * - * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { - PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(2, 724, __pyx_L1_error) - } - } - #endif + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 + /* "View.MemoryView":1234 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { - /* "View.MemoryView":727 + /* "View.MemoryView":1235 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview # <<<<<<<<<<<<<< - * p_src = &memviewsliceobj.from_slice - * else: + * if slice_is_contig(src[0], order, ndim): */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 727, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - /* "View.MemoryView":728 - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, &src) + /* "View.MemoryView":1234 + * + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 + * */ - __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); + } + } - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - goto __pyx_L3; - } + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":730 - * p_src = &memviewsliceobj.from_slice + /* "View.MemoryView":1238 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< * else: - * slice_copy(memview, &src) # <<<<<<<<<<<<<< - * p_src = &src + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + */ + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); + goto __pyx_L9; + } - /* "View.MemoryView":731 + /* "View.MemoryView":1240 + * memcpy(result, src.data, size) * else: - * slice_copy(memview, &src) - * p_src = &src # <<<<<<<<<<<<<< - * + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< * + * return result */ - __pyx_v_p_src = (&__pyx_v_src); + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); } - __pyx_L3:; + __pyx_L9:; - /* "View.MemoryView":737 + /* "View.MemoryView":1242 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) * + * return result # <<<<<<<<<<<<<< * - * dst.memview = p_src.memview # <<<<<<<<<<<<<< - * dst.data = p_src.data * */ - __pyx_t_4 = __pyx_v_p_src->memview; - __pyx_v_dst.memview = __pyx_t_4; + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "View.MemoryView":738 - * - * dst.memview = p_src.memview - * dst.data = p_src.data # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1205 * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ - __pyx_t_5 = __pyx_v_p_src->data; - __pyx_v_dst.data = __pyx_t_5; - /* "View.MemoryView":743 + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} + +/* "View.MemoryView":1247 * + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" + */ + +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_UCS4 __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1249 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< * - * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< - * cdef int *p_suboffset_dim = &suboffset_dim - * cdef Py_ssize_t start, stop, step + * @cname('__pyx_memoryview_err_dim') */ - __pyx_v_p_dst = (&__pyx_v_dst); + __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 127; + __Pyx_INCREF(__pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_2 += 35; + __Pyx_GIVEREF(__pyx_kp_u_got_differing_extents_in_dimensi); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_got); + __pyx_t_2 += 6; + __Pyx_GIVEREF(__pyx_kp_u_got); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_got); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_and); + __pyx_t_2 += 5; + __Pyx_GIVEREF(__pyx_kp_u_and); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_and); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_2 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__7); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 1249, __pyx_L1_error) - /* "View.MemoryView":744 + /* "View.MemoryView":1247 * - * cdef __Pyx_memviewslice *p_dst = &dst - * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< - * cdef Py_ssize_t start, stop, step - * cdef bint have_start, have_stop, have_step + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ - __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1252 + * + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( */ - __pyx_t_6 = 0; - if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 748, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } - } else { - __pyx_t_9 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_9)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 748, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_9); - } - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_v_dim = __pyx_t_6; - __pyx_t_6 = (__pyx_t_6 + 1); - /* "View.MemoryView":749 +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1253 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * @cname('__pyx_memoryview_err') */ - __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1253, __pyx_L1_error) - /* "View.MemoryView":753 - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<< - * 0, 0, 0, # have_{start,stop,step} - * False) + /* "View.MemoryView":1252 + * + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim + * */ - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 753, __pyx_L1_error) - /* "View.MemoryView":750 - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1256 + * + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg + * */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 750, __pyx_L1_error) - /* "View.MemoryView":749 +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1257 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * @cname('__pyx_memoryview_err_no_memory') */ - goto __pyx_L6; - } + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1257, __pyx_L1_error) - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 + /* "View.MemoryView":1256 + * + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg + * */ - __pyx_t_2 = (__pyx_v_index == Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - /* "View.MemoryView":757 - * False) - * elif index is None: - * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - */ - (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} - /* "View.MemoryView":758 - * elif index is None: - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 +/* "View.MemoryView":1260 + * + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError + * */ - (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - /* "View.MemoryView":759 - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< - * new_ndim += 1 - * else: - */ - (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_no_memory", 0); - /* "View.MemoryView":760 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 # <<<<<<<<<<<<<< - * else: - * start = index.start or 0 + /* "View.MemoryView":1261 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< + * + * */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + PyErr_NoMemory(); __PYX_ERR(1, 1261, __pyx_L1_error) - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 + /* "View.MemoryView":1260 + * + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError + * */ - goto __pyx_L6; - } - /* "View.MemoryView":762 - * new_ndim += 1 - * else: - * start = index.start or 0 # <<<<<<<<<<<<<< - * stop = index.stop or 0 - * step = index.step or 0 - */ - /*else*/ { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L7_bool_binop_done:; - __pyx_v_start = __pyx_t_10; + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} - /* "View.MemoryView":763 - * else: - * start = index.start or 0 - * stop = index.stop or 0 # <<<<<<<<<<<<<< - * step = index.step or 0 +/* "View.MemoryView":1265 * + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 763, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 763, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 763, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L9_bool_binop_done:; - __pyx_v_stop = __pyx_t_10; - /* "View.MemoryView":764 - * start = index.start or 0 - * stop = index.stop or 0 - * step = index.step or 0 # <<<<<<<<<<<<<< - * - * have_start = index.start is not None +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("memoryview_copy_contents", 1); + + /* "View.MemoryView":1273 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 764, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 764, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L11_bool_binop_done:; - __pyx_v_step = __pyx_t_10; + __pyx_v_tmpdata = NULL; - /* "View.MemoryView":766 - * step = index.step or 0 - * - * have_start = index.start is not None # <<<<<<<<<<<<<< - * have_stop = index.stop is not None - * have_step = index.step is not None + /* "View.MemoryView":1274 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_start = __pyx_t_1; + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":767 - * - * have_start = index.start is not None - * have_stop = index.stop is not None # <<<<<<<<<<<<<< - * have_step = index.step is not None - * + /* "View.MemoryView":1276 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 767, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_stop = __pyx_t_1; + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); - /* "View.MemoryView":768 - * have_start = index.start is not None - * have_stop = index.stop is not None - * have_step = index.step is not None # <<<<<<<<<<<<<< + /* "View.MemoryView":1277 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp + */ + __pyx_v_broadcasting = 0; + + /* "View.MemoryView":1278 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp * - * slice_memviewslice( */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_step = __pyx_t_1; + __pyx_v_direct_copy = 0; - /* "View.MemoryView":770 - * have_step = index.step is not None + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp * - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 770, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":776 - * have_start, have_stop, have_step, - * True) - * new_ndim += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1282 * - * if isinstance(memview, _memoryviewslice): + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - } - __pyx_L6:; + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ + goto __pyx_L3; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":778 - * new_ndim += 1 + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); if (__pyx_t_2) { - /* "View.MemoryView":779 + /* "View.MemoryView":1284 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, + * cdef int ndim = max(src_ndim, dst_ndim) */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - /* "View.MemoryView":780 - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< - * memviewsliceobj.to_dtype_func, - * memview.dtype_is_object) - */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 780, __pyx_L1_error) } - - /* "View.MemoryView":781 - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * else: - */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 781, __pyx_L1_error) } - - /* "View.MemoryView":779 - * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, - */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 779, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 779, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "View.MemoryView":778 - * new_ndim += 1 + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, */ } + __pyx_L3:; - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * - */ - /*else*/ { - __Pyx_XDECREF(((PyObject *)__pyx_r)); - - /* "View.MemoryView":785 - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, - * memview.dtype_is_object) # <<<<<<<<<<<<<< + /* "View.MemoryView":1286 + * broadcast_leading(&dst, dst_ndim, src_ndim) * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< * + * for i in range(ndim): */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) + /* "View.MemoryView":1288 + * cdef int ndim = max(src_ndim, dst_ndim) * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: */ - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 784, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - } + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":712 + /* "View.MemoryView":1289 * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":809 - * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 */ + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { -static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { - Py_ssize_t __pyx_v_new_shape; - int __pyx_v_negative_step; - int __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; + /* "View.MemoryView":1291 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: + */ + __pyx_v_broadcasting = 1; - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< - * - * if start < 0: + /* "View.MemoryView":1292 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) */ - __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_1) { + (__pyx_v_src.strides[__pyx_v_i]) = 0; - /* "View.MemoryView":831 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 */ - __pyx_t_1 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_1) { + goto __pyx_L7; + } - /* "View.MemoryView":832 + /* "View.MemoryView":1294 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< * - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) + * if src.suboffsets[i] >= 0: */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1294, __pyx_L1_error) + } + __pyx_L7:; - /* "View.MemoryView":831 - * if not is_slice: + /* "View.MemoryView":1289 * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ } - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - * else: + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) + * + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * */ - __pyx_t_1 = (0 <= __pyx_v_start); - if (__pyx_t_1) { - __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); - } - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); if (__pyx_t_2) { - /* "View.MemoryView":834 - * start += shape - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< - * else: + /* "View.MemoryView":1297 * + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< + * + * if slices_overlap(&src, &dst, ndim, itemsize): */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 834, __pyx_L1_error) - - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - * else: - */ - } + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error) - /* "View.MemoryView":829 - * cdef bint negative_step + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) * - * if not is_slice: # <<<<<<<<<<<<<< + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * if start < 0: */ - goto __pyx_L3; + } } - /* "View.MemoryView":837 - * else: + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< * - * if have_step and step == 0: + * if not slice_is_contig(src, order, ndim): */ - /*else*/ { - __pyx_t_1 = ((__pyx_v_have_step != 0) != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_1 = ((__pyx_v_step < 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L6_bool_binop_done:; - __pyx_v_negative_step = __pyx_t_2; + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) * */ - __pyx_t_1 = (__pyx_v_have_step != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_1 = ((__pyx_v_step == 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L9_bool_binop_done:; + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); if (__pyx_t_2) { - /* "View.MemoryView":840 - * - * if have_step and step == 0: - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + /* "View.MemoryView":1302 * + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 840, __pyx_L1_error) + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) * */ } - /* "View.MemoryView":843 + /* "View.MemoryView":1304 + * order = get_best_order(&dst, ndim) * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape */ - __pyx_t_2 = (__pyx_v_have_start != 0); - if (__pyx_t_2) { + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1304, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; - /* "View.MemoryView":844 + /* "View.MemoryView":1305 * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":845 - * if have_start: - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if start < 0: - * start = 0 - */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + __pyx_v_src = __pyx_v_tmp; - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) + * + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< + * + * if not slice_is_contig(src, order, ndim): */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { + } - /* "View.MemoryView":847 - * start += shape - * if start < 0: - * start = 0 # <<<<<<<<<<<<<< - * elif start >= shape: - * if negative_step: + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * + * */ - __pyx_v_start = 0; + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "View.MemoryView":1310 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ - } + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":844 + /* "View.MemoryView":1311 * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) */ - goto __pyx_L12; - } + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 + /* "View.MemoryView":1310 + * + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ - __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0); - if (__pyx_t_2) { + goto __pyx_L12; + } - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * */ - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":850 - * elif start >= shape: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = shape + /* "View.MemoryView":1313 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< + * + * if direct_copy: */ - __pyx_v_start = (__pyx_v_shape - 1); + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) + * */ - goto __pyx_L14; - } + } + __pyx_L12:; - /* "View.MemoryView":852 - * start = shape - 1 - * else: - * start = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) + * + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - /*else*/ { - __pyx_v_start = __pyx_v_shape; - } - __pyx_L14:; + if (__pyx_v_direct_copy) { - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 + /* "View.MemoryView":1317 + * if direct_copy: + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) */ - } - __pyx_L12:; + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":843 - * + /* "View.MemoryView":1318 * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) */ - goto __pyx_L11; - } + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "View.MemoryView":1319 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":855 - * else: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = 0 + /* "View.MemoryView":1320 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * */ - __pyx_v_start = (__pyx_v_shape - 1); + free(__pyx_v_tmpdata); - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "View.MemoryView":1321 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * if order == 'F' == get_best_order(&dst, ndim): */ - goto __pyx_L15; - } + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":857 - * start = shape - 1 - * else: - * start = 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * if have_stop: + * if direct_copy: # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - /*else*/ { - __pyx_v_start = 0; - } - __pyx_L15:; } - __pyx_L11:; - /* "View.MemoryView":859 - * start = 0 + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< + * * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape */ - __pyx_t_2 = (__pyx_v_have_stop != 0); - if (__pyx_t_2) { + } - /* "View.MemoryView":860 + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + } + if (__pyx_t_2) { - /* "View.MemoryView":861 - * if have_stop: - * if stop < 0: - * stop += shape # <<<<<<<<<<<<<< - * if stop < 0: - * stop = 0 + /* "View.MemoryView":1326 + * + * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) + * */ - __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1326, __pyx_L1_error) - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: + /* "View.MemoryView":1327 + * + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) - /* "View.MemoryView":863 - * stop += shape - * if stop < 0: - * stop = 0 # <<<<<<<<<<<<<< - * elif stop > shape: - * stop = shape + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< + * + * */ - __pyx_v_stop = 0; + } - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: + /* "View.MemoryView":1329 + * transpose_memslice(&dst) + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) */ - } + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":860 + /* "View.MemoryView":1330 + * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: */ - goto __pyx_L17; - } + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: + /* "View.MemoryView":1331 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * + * free(tmpdata) */ - __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0); - if (__pyx_t_2) { + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":865 - * stop = 0 - * elif stop > shape: - * stop = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: + /* "View.MemoryView":1333 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 + * */ - __pyx_v_stop = __pyx_v_shape; + free(__pyx_v_tmpdata); - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: + /* "View.MemoryView":1334 + * + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') */ - } - __pyx_L17:; + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":859 - * start = 0 + /* "View.MemoryView":1265 * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ - goto __pyx_L16; - } - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} - /* "View.MemoryView":868 - * else: - * if negative_step: - * stop = -1 # <<<<<<<<<<<<<< - * else: - * stop = shape +/* "View.MemoryView":1337 + * + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ - __pyx_v_stop = -1L; - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - goto __pyx_L19; - } +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; - /* "View.MemoryView":870 - * stop = -1 - * else: - * stop = shape # <<<<<<<<<<<<<< + /* "View.MemoryView":1341 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< * - * if not have_step: + * for i in range(ndim - 1, -1, -1): */ - /*else*/ { - __pyx_v_stop = __pyx_v_shape; - } - __pyx_L19:; - } - __pyx_L16:; + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - /* "View.MemoryView":872 - * stop = shape - * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 + /* "View.MemoryView":1343 + * cdef int offset = ndim_other - ndim * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] */ - __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0); - if (__pyx_t_2) { + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":873 - * - * if not have_step: - * step = 1 # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1344 * + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] */ - __pyx_v_step = 1; + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - /* "View.MemoryView":872 - * stop = shape - * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 + /* "View.MemoryView":1345 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] * */ - } + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":877 - * - * with cython.cdivision(True): - * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + /* "View.MemoryView":1346 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< * - * if (stop - start) - step * new_shape: + * for i in range(offset): */ - __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); + } - /* "View.MemoryView":879 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 + /* "View.MemoryView":1348 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] * + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] */ - __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":880 - * - * if (stop - start) - step * new_shape: - * new_shape += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1349 * - * if new_shape < 0: + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 */ - __pyx_v_new_shape = (__pyx_v_new_shape + 1); + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; - /* "View.MemoryView":879 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 + /* "View.MemoryView":1350 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 * */ - } + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); - /* "View.MemoryView":882 - * new_shape += 1 + /* "View.MemoryView":1351 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 * */ - __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0); - if (__pyx_t_2) { + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } - /* "View.MemoryView":883 - * - * if new_shape < 0: - * new_shape = 0 # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1337 * + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ - __pyx_v_new_shape = 0; - /* "View.MemoryView":882 - * new_shape += 1 + /* function exit code */ +} + +/* "View.MemoryView":1359 * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< * + * if dtype_is_object: */ - } - /* "View.MemoryView":886 +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { + + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) * - * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset */ - (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); + if (__pyx_v_dtype_is_object) { - /* "View.MemoryView":887 + /* "View.MemoryView":1362 * - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< - * dst.suboffsets[new_ndim] = suboffset + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') */ - (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); - /* "View.MemoryView":888 - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) * */ - (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; } - __pyx_L3:; - /* "View.MemoryView":891 + /* "View.MemoryView":1359 * + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: + * if dtype_is_object: */ - __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":892 - * - * if suboffset_dim[0] < 0: - * dst.data += start * stride # <<<<<<<<<<<<<< - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride - */ - __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); + /* function exit code */ +} - /* "View.MemoryView":891 - * +/* "View.MemoryView":1365 * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: */ - goto __pyx_L23; - } - /* "View.MemoryView":894 - * dst.data += start * stride - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + __Pyx_RefNannyDeclarations + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); + + /* "View.MemoryView":1368 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< * - * if suboffset >= 0: + * @cname('__pyx_memoryview_refcount_objects_in_slice') */ - /*else*/ { - __pyx_t_3 = (__pyx_v_suboffset_dim[0]); - (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); - } - __pyx_L23:; + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride + /* "View.MemoryView":1365 * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":897 + /* function exit code */ + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif +} + +/* "View.MemoryView":1371 * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ - __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); + + /* "View.MemoryView":1374 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * + * for i in range(shape[0]): */ - __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0); - if (__pyx_t_2) { + __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":899 - * if not is_slice: - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + /* "View.MemoryView":1376 + * cdef Py_ssize_t stride = strides[0] + * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: + */ + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "View.MemoryView":1377 + * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) + */ + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { + + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " */ - __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + if (__pyx_v_inc) { - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset + /* "View.MemoryView":1379 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< * else: + * Py_DECREF(( data)[0]) */ - goto __pyx_L26; - } + Py_INCREF((((PyObject **)__pyx_v_data)[0])); - /* "View.MemoryView":901 - * dst.data = ( dst.data)[0] + suboffset + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< - * "must be indexed and not sliced", dim) - * else: */ - /*else*/ { + goto __pyx_L6; + } - /* "View.MemoryView":902 + /* "View.MemoryView":1381 + * Py_INCREF(( data)[0]) * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< * else: - * suboffset_dim[0] = new_ndim + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 901, __pyx_L1_error) + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); } - __pyx_L26:; + __pyx_L6:; - /* "View.MemoryView":897 + /* "View.MemoryView":1377 * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) */ - goto __pyx_L25; + goto __pyx_L5; } - /* "View.MemoryView":904 - * "must be indexed and not sliced", dim) + /* "View.MemoryView":1383 + * Py_DECREF(( data)[0]) * else: - * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< * - * return 0 + * data += stride */ /*else*/ { - (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); } - __pyx_L25:; - - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride - * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: - */ - } + __pyx_L5:; - /* "View.MemoryView":906 - * suboffset_dim[0] = new_ndim + /* "View.MemoryView":1385 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) * - * return 0 # <<<<<<<<<<<<<< + * data += stride # <<<<<<<<<<<<<< * * */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } - /* "View.MemoryView":809 + /* "View.MemoryView":1371 * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = -1; - __pyx_L0:; - return __pyx_r; + __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":912 +/* "View.MemoryView":1391 * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: */ -static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_suboffset; - Py_ssize_t __pyx_v_itemsize; - char *__pyx_v_resultp; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pybuffer_index", 0); +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - /* "View.MemoryView":914 - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< - * cdef Py_ssize_t itemsize = view.itemsize - * cdef char *resultp + /* "View.MemoryView":1394 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) */ - __pyx_v_suboffset = -1L; + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":915 - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< - * cdef char *resultp + /* "View.MemoryView":1395 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) * */ - __pyx_t_1 = __pyx_v_view->itemsize; - __pyx_v_itemsize = __pyx_t_1; + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":918 - * cdef char *resultp + /* "View.MemoryView":1396 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize */ - __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0); - if (__pyx_t_2) { + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":919 + /* "View.MemoryView":1391 * - * if view.ndim == 0: - * shape = view.len / itemsize # <<<<<<<<<<<<<< - * stride = itemsize - * else: + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); - /* "View.MemoryView":920 - * if view.ndim == 0: - * shape = view.len / itemsize - * stride = itemsize # <<<<<<<<<<<<<< - * else: - * shape = view.shape[dim] - */ - __pyx_v_stride = __pyx_v_itemsize; + /* function exit code */ +} - /* "View.MemoryView":918 - * cdef char *resultp +/* "View.MemoryView":1400 * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ - goto __pyx_L3; - } - /* "View.MemoryView":922 - * stride = itemsize - * else: - * shape = view.shape[dim] # <<<<<<<<<<<<<< - * stride = view.strides[dim] - * if view.suboffsets != NULL: - */ - /*else*/ { - __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - - /* "View.MemoryView":923 - * else: - * shape = view.shape[dim] - * stride = view.strides[dim] # <<<<<<<<<<<<<< - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] - */ - __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] - * - */ - __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":925 - * stride = view.strides[dim] - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< - * - * if index < 0: - */ - __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] + /* "View.MemoryView":1404 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] * */ - } - } - __pyx_L3:; + __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] + /* "View.MemoryView":1405 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: + * if ndim == 1: */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (__pyx_t_2) { + __pyx_v_extent = (__pyx_v_shape[0]); - /* "View.MemoryView":928 + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] * - * if index < 0: - * index += view.shape[dim] # <<<<<<<<<<<<<< - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) */ - __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "View.MemoryView":1408 * + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":930 - * index += view.shape[dim] - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< - * - * if index >= shape: + /* "View.MemoryView":1409 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride + * else: */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 930, __pyx_L1_error) + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * + /* "View.MemoryView":1410 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< + * else: + * for i in range(extent): */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); } - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] - * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: - */ - } - - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - */ - __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0); - if (unlikely(__pyx_t_2)) { - - /* "View.MemoryView":933 - * - * if index >= shape: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< - * - * resultp = bufp + index * stride - */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 933, __pyx_L1_error) - - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] * + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) */ + goto __pyx_L3; } - /* "View.MemoryView":935 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - * - * resultp = bufp + index * stride # <<<<<<<<<<<<<< - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset - */ - __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - - /* "View.MemoryView":936 - * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset - * + /* "View.MemoryView":1412 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":937 - * resultp = bufp + index * stride - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + /* "View.MemoryView":1413 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride * - * return resultp */ - __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":936 + /* "View.MemoryView":1414 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset * */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } } + __pyx_L3:; - /* "View.MemoryView":939 - * resultp = ( resultp)[0] + suboffset - * - * return resultp # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_resultp; - goto __pyx_L0; - - /* "View.MemoryView":912 + /* "View.MemoryView":1400 * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "View.MemoryView":945 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim - * +/* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ -static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { - int __pyx_v_ndim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_r; - int __pyx_t_1; - Py_ssize_t *__pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); - /* "View.MemoryView":946 - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: - * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< - * - * cdef Py_ssize_t *shape = memslice.shape - */ - __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; - __pyx_v_ndim = __pyx_t_1; - - /* "View.MemoryView":948 - * cdef int ndim = memslice.memview.view.ndim - * - * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< - * cdef Py_ssize_t *strides = memslice.strides - * - */ - __pyx_t_2 = __pyx_v_memslice->shape; - __pyx_v_shape = __pyx_t_2; - - /* "View.MemoryView":949 - * - * cdef Py_ssize_t *shape = memslice.shape - * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __pyx_v_memslice->strides; - __pyx_v_strides = __pyx_t_2; - - /* "View.MemoryView":953 - * - * cdef int i, j - * for i in range(ndim / 2): # <<<<<<<<<<<<<< - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "View.MemoryView":954 - * cdef int i, j - * for i in range(ndim / 2): - * j = ndim - 1 - i # <<<<<<<<<<<<<< - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) */ - __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":955 - * for i in range(ndim / 2): - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< - * shape[i], shape[j] = shape[j], shape[i] - * + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: */ - __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); - __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); - (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; - (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) - /* "View.MemoryView":956 - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); - __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); - (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; - (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + } - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") - * + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) */ - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0); - __pyx_t_7 = __pyx_t_8; - __pyx_L6_bool_binop_done:; - if (__pyx_t_7) { + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":959 - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< - * - * return 1 + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result */ - __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 959, __pyx_L1_error) + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] - * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") - * + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result */ - } } - /* "View.MemoryView":961 - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") - * - * return 1 # <<<<<<<<<<<<<< - * - * + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] */ - __pyx_r = 1; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; goto __pyx_L0; - /* "View.MemoryView":945 - * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim - * + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* function exit code */ __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ -/* Python wrapper */ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":979 - * - * def __dealloc__(self): - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< - * - * cdef convert_item_to_object(self, char *itemp): - */ - __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); - - /* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) - */ - -static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - /* "View.MemoryView":982 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) */ - __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0); - if (__pyx_t_1) { + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":983 - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) # <<<<<<<<<<<<<< - * else: - * return memoryview.convert_item_to_object(self, itemp) + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 > 1); + if (__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { - /* "View.MemoryView":982 - * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: + /* "(tree fragment)":14 + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< */ - } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":985 - * return self.to_object_func(itemp) - * else: - * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< - * - * cdef assign_item_from_object(self, char *itemp, object value): + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 985, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; } - /* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17136,1115 +18392,1238 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor return __pyx_r; } -/* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ -static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; - /* "View.MemoryView":988 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":248 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: + * @property */ - __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0); - if (__pyx_t_1) { + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; - /* "View.MemoryView":989 - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< - * else: - * memoryview.assign_item_from_object(self, itemp, value) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 + * + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 989, __pyx_L1_error) - /* "View.MemoryView":988 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ */ - goto __pyx_L3; - } - /* "View.MemoryView":991 - * self.to_dtype_func(itemp, value) - * else: - * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":254 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< * - * @property + * @property */ - /*else*/ { - __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 991, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L3:; + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; - /* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":994 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ + */ + +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":260 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< * + * @property */ + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 + * + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 + * + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). + */ - /* "View.MemoryView":995 - * @property - * def base(self): - * return self.from_object # <<<<<<<<<<<<<< +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":268 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") + * @property */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->from_object); - __pyx_r = __pyx_v_self->from_object; + __pyx_r = PyArray_DIMS(__pyx_v_self); goto __pyx_L0; - /* "View.MemoryView":994 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 * + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ /* function exit code */ __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 + * + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":275 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 + * + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 + * + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ + */ - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":281 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 + * + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 + * + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":290 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * ctypedef unsigned char npy_bool + */ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 + * + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; return __pyx_r; } -static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":774 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1001 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), */ -static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_v_length = NULL; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_TypeInfo *__pyx_t_4; - Py_buffer __pyx_t_5; - Py_ssize_t *__pyx_t_6; - Py_ssize_t *__pyx_t_7; - Py_ssize_t *__pyx_t_8; - Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "View.MemoryView":1009 - * cdef _memoryviewslice result + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":777 * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * + * cdef inline object PyArray_MultiIterNew3(a, b, c): */ - __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0); - if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":1010 - * - * if memviewslice.memview == Py_None: - * return None # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - /* "View.MemoryView":1009 - * cdef _memoryviewslice result + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * */ - } - /* "View.MemoryView":1015 - * +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":780 * - * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * - * result.from_slice = memviewslice + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":1017 - * result = _memoryviewslice(None, 0, dtype_is_object) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) * - * result.from_slice = memviewslice # <<<<<<<<<<<<<< - * __PYX_INC_MEMVIEW(&memviewslice, 1) + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * */ - __pyx_v_result->from_slice = __pyx_v_memviewslice; - /* "View.MemoryView":1018 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) * - * result.from_slice = memviewslice - * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * - * result.from_object = ( memviewslice.memview).base */ - __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - /* "View.MemoryView":1020 - * __PYX_INC_MEMVIEW(&memviewslice, 1) +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":783 * - * result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<< - * result.typeinfo = memviewslice.memview.typeinfo + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_result->from_object); - __Pyx_DECREF(__pyx_v_result->from_object); - __pyx_v_result->from_object = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_r); + __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_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":1021 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) * - * result.from_object = ( memviewslice.memview).base - * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * - * result.view = memviewslice.memview.view */ - __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; - __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - /* "View.MemoryView":1023 - * result.typeinfo = memviewslice.memview.typeinfo - * - * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - */ - __pyx_t_5 = __pyx_v_memviewslice.memview->view; - __pyx_v_result->__pyx_base.view = __pyx_t_5; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1024 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None */ - __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - /* "View.MemoryView":1025 - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data - * result.view.ndim = ndim # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":786 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline tuple PyDataType_SHAPE(dtype d): */ - __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; + __Pyx_XDECREF(__pyx_r); + __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_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":1026 - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ - ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; - /* "View.MemoryView":1027 - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape */ - Py_INCREF(Py_None); - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape * else: */ - __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); if (__pyx_t_1) { - /* "View.MemoryView":1030 - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: - * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":790 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< * else: - * result.flags = PyBUF_RECORDS_RO + * return () */ - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); + __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); + goto __pyx_L0; - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape * else: */ - goto __pyx_L4; } - /* "View.MemoryView":1032 - * result.flags = PyBUF_RECORDS + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":792 + * return d.subarray.shape * else: - * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * return () # <<<<<<<<<<<<<< + * * - * result.view.shape = result.from_slice.shape */ /*else*/ { - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_empty_tuple); + __pyx_r = __pyx_empty_tuple; + goto __pyx_L0; } - __pyx_L4:; - /* "View.MemoryView":1034 - * result.flags = PyBUF_RECORDS_RO - * - * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< - * result.view.strides = result.from_slice.strides + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) * + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape */ - __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); - /* "View.MemoryView":1035 - * - * result.view.shape = result.from_slice.shape - * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< - * + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ - __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - /* "View.MemoryView":1038 +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_array_base", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":968 * + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) * - * result.view.suboffsets = NULL # <<<<<<<<<<<<<< - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: */ - __pyx_v_result->__pyx_base.view.suboffsets = NULL; + Py_INCREF(__pyx_v_base); - /* "View.MemoryView":1039 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":969 + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< * - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets + * cdef inline object get_array_base(ndarray arr): */ - __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_v_suboffset = (__pyx_t_6[0]); + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 969, __pyx_L1_error) - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ - __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":1041 - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< - * break + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ - __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - /* "View.MemoryView":1042 - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - * break # <<<<<<<<<<<<<< +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":972 * - * result.view.len = result.view.itemsize + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None */ - goto __pyx_L6_break; + __pyx_v_base = PyArray_BASE(__pyx_v_arr); - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base */ - } - } - __pyx_L6_break:; + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { - /* "View.MemoryView":1044 - * break + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":974 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base * - * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< - * for length in result.view.shape[:ndim]: - * result.view.len *= length */ - __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "View.MemoryView":1045 - * - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< - * result.view.len *= length - * - */ - __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1045, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); - __pyx_t_2 = 0; - - /* "View.MemoryView":1046 - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: - * result.view.len *= length # <<<<<<<<<<<<<< - * - * result.to_object_func = to_object_func + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; } - /* "View.MemoryView":1048 - * result.view.len *= length - * - * result.to_object_func = to_object_func # <<<<<<<<<<<<<< - * result.to_dtype_func = to_dtype_func - * - */ - __pyx_v_result->to_object_func = __pyx_v_to_object_func; - - /* "View.MemoryView":1049 - * - * result.to_object_func = to_object_func - * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< - * - * return result - */ - __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; - - /* "View.MemoryView":1051 - * result.to_dtype_func = to_dtype_func - * - * return result # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":975 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_get_slice_from_memoryview') + * # Versions of the import_* functions which are more suitable for */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); goto __pyx_L0; - /* "View.MemoryView":1001 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1054 - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ -static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { - struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; - __Pyx_memviewslice *__pyx_r; +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + __Pyx_RefNannySetupContext("import_array", 0); - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":1058 - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): - * obj = memview # <<<<<<<<<<<<<< - * return &obj.from_slice - * else: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":981 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1058, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 981, __pyx_L3_error) - /* "View.MemoryView":1059 - * if isinstance(memview, _memoryviewslice): - * obj = memview - * return &obj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, mslice) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - __pyx_r = (&__pyx_v_obj->from_slice); - goto __pyx_L0; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":982 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.multiarray failed to import") + * */ - } + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 982, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":1061 - * return &obj.from_slice - * else: - * slice_copy(memview, mslice) # <<<<<<<<<<<<<< - * return mslice + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * + * cdef inline int import_umath() except -1: */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 983, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 983, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "View.MemoryView":1062 - * else: - * slice_copy(memview, mslice) - * return mslice # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_slice_copy') + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - __pyx_r = __pyx_v_mslice; - goto __pyx_L0; + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; } - /* "View.MemoryView":1054 - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_obj); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1065 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ -static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { - int __pyx_v_dim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - Py_ssize_t *__pyx_v_suboffsets; +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("slice_copy", 0); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); - /* "View.MemoryView":1069 - * cdef (Py_ssize_t*) shape, strides, suboffsets + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * shape = memview.view.shape # <<<<<<<<<<<<<< - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_1 = __pyx_v_memview->view.shape; - __pyx_v_shape = __pyx_t_1; - - /* "View.MemoryView":1070 - * - * shape = memview.view.shape - * strides = memview.view.strides # <<<<<<<<<<<<<< - * suboffsets = memview.view.suboffsets - * - */ - __pyx_t_1 = __pyx_v_memview->view.strides; - __pyx_v_strides = __pyx_t_1; - - /* "View.MemoryView":1071 - * shape = memview.view.shape - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< - * - * dst.memview = <__pyx_memoryview *> memview - */ - __pyx_t_1 = __pyx_v_memview->view.suboffsets; - __pyx_v_suboffsets = __pyx_t_1; - - /* "View.MemoryView":1073 - * suboffsets = memview.view.suboffsets - * - * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< - * dst.data = memview.view.buf - * - */ - __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":1074 - * - * dst.memview = <__pyx_memoryview *> memview - * dst.data = memview.view.buf # <<<<<<<<<<<<<< - * - * for dim in range(memview.view.ndim): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":987 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") */ - __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 987, __pyx_L3_error) - /* "View.MemoryView":1076 - * dst.data = memview.view.buf + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_2 = __pyx_v_memview->view.ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_dim = __pyx_t_4; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":1077 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":988 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") * - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 */ - (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 988, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":1078 - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * + * cdef inline int import_ufunc() except -1: */ - (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 989, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 989, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "View.MemoryView":1079 - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * @cname('__pyx_memoryview_copy_object') + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - if ((__pyx_v_suboffsets != 0)) { - __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); - } else { - __pyx_t_5 = -1L; - } - (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; } - /* "View.MemoryView":1065 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1082 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ -static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { - __Pyx_memviewslice __pyx_v_memviewslice; - PyObject *__pyx_r = NULL; +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy", 0); + __Pyx_RefNannySetupContext("import_ufunc", 0); - /* "View.MemoryView":1085 - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< - * return memoryview_copy_from_slice(memview, &memviewslice) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":1086 - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) - * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":993 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") + */ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 993, __pyx_L3_error) + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * - * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1086, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":1082 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":994 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice + */ + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 994, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":995 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 995, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 995, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 + * + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: + */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") + * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1089 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. + * + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ -static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { - PyObject *(*__pyx_v_to_object_func)(char *); - int (*__pyx_v_to_dtype_func)(char *, PyObject *); - PyObject *__pyx_r = NULL; +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *(*__pyx_t_3)(char *); - int (*__pyx_t_4)(char *, PyObject *); - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + __Pyx_RefNannySetupContext("is_timedelta64_object", 0); - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1010 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1097 * - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - */ - __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; - __pyx_v_to_object_func = __pyx_t_3; - - /* "View.MemoryView":1098 - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< - * else: - * to_object_func = NULL */ - __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; - __pyx_v_to_dtype_func = __pyx_t_4; + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); + goto __pyx_L0; - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1100 - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - * to_object_func = NULL # <<<<<<<<<<<<<< - * to_dtype_func = NULL * + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ - /*else*/ { - __pyx_v_to_object_func = NULL; - /* "View.MemoryView":1101 - * else: - * to_object_func = NULL - * to_dtype_func = NULL # <<<<<<<<<<<<<< - * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - */ - __pyx_v_to_dtype_func = NULL; - } - __pyx_L3:; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1103 - * to_dtype_func = NULL +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< - * to_object_func, to_dtype_func, - * memview.dtype_is_object) + * + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` */ - __Pyx_XDECREF(__pyx_r); - /* "View.MemoryView":1105 - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - * to_object_func, to_dtype_func, - * memview.dtype_is_object) # <<<<<<<<<<<<<< +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_datetime64_object", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1025 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); goto __pyx_L0; - /* "View.MemoryView":1089 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< * """ - * Create a new memoryview object from a given memoryview object and slice. + * Cython equivalent of `isinstance(obj, np.datetime64)` */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1111 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 * * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object */ -static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { - Py_ssize_t __pyx_r; - int __pyx_t_1; +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; - /* "View.MemoryView":1112 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1035 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: */ - __pyx_t_1 = ((__pyx_v_arg < 0) != 0); - if (__pyx_t_1) { + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; - /* "View.MemoryView":1113 - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: - * return -arg # <<<<<<<<<<<<<< - * else: - * return arg + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 + * + * + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object */ - __pyx_r = (-__pyx_v_arg); - goto __pyx_L0; - /* "View.MemoryView":1112 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: + * + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object */ - } - /* "View.MemoryView":1115 - * return -arg - * else: - * return arg # <<<<<<<<<<<<<< +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1042 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< + * * - * @cname('__pyx_get_best_slice_order') */ - /*else*/ { - __pyx_r = __pyx_v_arg; - goto __pyx_L0; - } + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; - /* "View.MemoryView":1111 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 * * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object */ /* function exit code */ @@ -18252,4885 +19631,7930 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { return __pyx_r; } -/* "View.MemoryView":1118 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< + * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< * """ - * Figure out the best memory access order for a given slice. + * returns the unit part of the dtype for a numpy datetime64 object. */ -static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { - int __pyx_v_i; - Py_ssize_t __pyx_v_c_stride; - Py_ssize_t __pyx_v_f_stride; - char __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; - /* "View.MemoryView":1123 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1049 + * returns the unit part of the dtype for a numpy datetime64 object. * """ - * cdef int i - * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< - * cdef Py_ssize_t f_stride = 0 - * + * return (obj).obmeta.base # <<<<<<<<<<<<<< */ - __pyx_v_c_stride = 0; + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; - /* "View.MemoryView":1124 - * cdef int i - * cdef Py_ssize_t c_stride = 0 - * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 * - * for i in range(ndim - 1, -1, -1): - */ - __pyx_v_f_stride = 0; - - /* "View.MemoryView":1126 - * cdef Py_ssize_t f_stride = 0 * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":1127 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "newanalysis/helpers/unfold.pyx":12 + * from libc.math cimport fabs, sqrt, floor, pow + * + * cdef inline int sign(double a) nogil: # <<<<<<<<<<<<<< + * return (( 0.0 < a) - (a < 0.0)) * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1128 - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break +static CYTHON_INLINE int __pyx_f_11newanalysis_6unfold_sign(double __pyx_v_a) { + int __pyx_r; + + /* "newanalysis/helpers/unfold.pyx":13 + * + * cdef inline int sign(double a) nogil: + * return (( 0.0 < a) - (a < 0.0)) # <<<<<<<<<<<<<< * + * cdef extern from "BertholdHorn.h": */ - __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + __pyx_r = ((((double)0.0) < __pyx_v_a) - (__pyx_v_a < ((double)0.0))); + goto __pyx_L0; - /* "View.MemoryView":1129 - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< + /* "newanalysis/helpers/unfold.pyx":12 + * from libc.math cimport fabs, sqrt, floor, pow + * + * cdef inline int sign(double a) nogil: # <<<<<<<<<<<<<< + * return (( 0.0 < a) - (a < 0.0)) * - * for i in range(ndim): */ - goto __pyx_L4_break; - /* "View.MemoryView":1127 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "newanalysis/helpers/unfold.pyx":18 + * void GetRotation(double *R_ptr, int n, double *APoints_ptr, double *BPoints_ptr, int debug) * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldBox(np.ndarray[np.float64_t,ndim=2,mode='c'] coor_unfold, + * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_prev, */ - } - } - __pyx_L4_break:; - - /* "View.MemoryView":1131 - * break - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - */ - __pyx_t_1 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_1; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1132 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break - */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1133 - * for i in range(ndim): - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1134 - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - */ - goto __pyx_L7_break; - /* "View.MemoryView":1132 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break - */ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6unfold_1unfoldBox(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_6unfold_unfoldBox, "\n unfoldBox(xyz_unfold,xyz_prev,xyz_curr,boxlength)\n \n You have to hand over 3 coordinate sets and the boxlength as arguments: \n - the in-place-unfolding coordinates (from the previous timestep)\n - the trajectory coordinates from the previous timestep\n - the trajectory coordinates from the current timestep\n - boxlength\n\n This functions returns the unfolded coordinates of the current timestep.\n\n Arguments:\n coor_unfold .. numpy array (float64, ndim=2) in-place-unfolding coordinate set: [[x,y,z],[x,y,z],...,[x,y,z]]\n coor_prev .. numpy array (float64, ndim=2) trajectory coordinates, previous timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n coor_curr .. numpy array (float64, ndim=2) trajectory coordinates, current timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n boxlength .. the box length\n\n Usage:\n With this function one can unfold \n the coordinates of a trajectory on the fly, timestep per timestep.\n\n Example: \n unfoldBox(xyz_unfold, xyz_traj_prev, xyz_traj_curr, boxlength)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_6unfold_1unfoldBox = {"unfoldBox", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6unfold_1unfoldBox, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_unfoldBox}; +static PyObject *__pyx_pw_11newanalysis_6unfold_1unfoldBox(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_coor_unfold = 0; + PyArrayObject *__pyx_v_coor_prev = 0; + PyArrayObject *__pyx_v_coor_curr = 0; + __pyx_t_5numpy_float64_t __pyx_v_boxl; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unfoldBox (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 18, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor_unfold,&__pyx_n_s_coor_prev,&__pyx_n_s_coor_curr,&__pyx_n_s_boxl,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_unfold)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_prev)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfoldBox", 1, 4, 4, 1); __PYX_ERR(0, 18, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor_curr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfoldBox", 1, 4, 4, 2); __PYX_ERR(0, 18, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfoldBox", 1, 4, 4, 3); __PYX_ERR(0, 18, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "unfoldBox") < 0)) __PYX_ERR(0, 18, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); } + __pyx_v_coor_unfold = ((PyArrayObject *)values[0]); + __pyx_v_coor_prev = ((PyArrayObject *)values[1]); + __pyx_v_coor_curr = ((PyArrayObject *)values[2]); + __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L3_error) } - __pyx_L7_break:; - - /* "View.MemoryView":1136 - * break - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: - */ - __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1137 - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - * return 'C' # <<<<<<<<<<<<<< - * else: - * return 'F' - */ - __pyx_r = 'C'; - goto __pyx_L0; - - /* "View.MemoryView":1136 - * break - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' - * else: - */ - } - - /* "View.MemoryView":1139 - * return 'C' - * else: - * return 'F' # <<<<<<<<<<<<<< - * - * @cython.cdivision(True) - */ - /*else*/ { - __pyx_r = 'F'; - goto __pyx_L0; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unfoldBox", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 18, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - - /* "View.MemoryView":1118 - * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. - */ + __Pyx_AddTraceback("newanalysis.unfold.unfoldBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_unfold), __pyx_ptype_5numpy_ndarray, 1, "coor_unfold", 0))) __PYX_ERR(0, 19, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_prev), __pyx_ptype_5numpy_ndarray, 1, "coor_prev", 0))) __PYX_ERR(0, 20, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor_curr), __pyx_ptype_5numpy_ndarray, 1, "coor_curr", 0))) __PYX_ERR(0, 21, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6unfold_unfoldBox(__pyx_self, __pyx_v_coor_unfold, __pyx_v_coor_prev, __pyx_v_coor_curr, __pyx_v_boxl); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1142 - * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, - */ - -static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; - Py_ssize_t __pyx_v_dst_extent; - Py_ssize_t __pyx_v_src_stride; - Py_ssize_t __pyx_v_dst_stride; - int __pyx_t_1; +static PyObject *__pyx_pf_11newanalysis_6unfold_unfoldBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coor_unfold, PyArrayObject *__pyx_v_coor_prev, PyArrayObject *__pyx_v_coor_curr, __pyx_t_5numpy_float64_t __pyx_v_boxl) { + double __pyx_v_boxl2; + CYTHON_UNUSED int __pyx_v_n; + int __pyx_v_i; + double __pyx_v_DX; + double __pyx_v_DY; + double __pyx_v_DZ; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_curr; + __Pyx_Buffer __pyx_pybuffer_coor_curr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_prev; + __Pyx_Buffer __pyx_pybuffer_coor_prev; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor_unfold; + __Pyx_Buffer __pyx_pybuffer_coor_unfold; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + npy_intp *__pyx_t_1; int __pyx_t_2; int __pyx_t_3; - Py_ssize_t __pyx_t_4; + int __pyx_t_4; Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unfoldBox", 0); + __pyx_pybuffer_coor_unfold.pybuffer.buf = NULL; + __pyx_pybuffer_coor_unfold.refcount = 0; + __pyx_pybuffernd_coor_unfold.data = NULL; + __pyx_pybuffernd_coor_unfold.rcbuffer = &__pyx_pybuffer_coor_unfold; + __pyx_pybuffer_coor_prev.pybuffer.buf = NULL; + __pyx_pybuffer_coor_prev.refcount = 0; + __pyx_pybuffernd_coor_prev.data = NULL; + __pyx_pybuffernd_coor_prev.rcbuffer = &__pyx_pybuffer_coor_prev; + __pyx_pybuffer_coor_curr.pybuffer.buf = NULL; + __pyx_pybuffer_coor_curr.refcount = 0; + __pyx_pybuffernd_coor_curr.data = NULL; + __pyx_pybuffernd_coor_curr.rcbuffer = &__pyx_pybuffer_coor_curr; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_unfold, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error) + } + __pyx_pybuffernd_coor_unfold.diminfo[0].strides = __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_unfold.diminfo[0].shape = __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_unfold.diminfo[1].strides = __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_unfold.diminfo[1].shape = __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_prev.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_prev, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error) + } + __pyx_pybuffernd_coor_prev.diminfo[0].strides = __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_prev.diminfo[0].shape = __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_prev.diminfo[1].strides = __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_prev.diminfo[1].shape = __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor_curr.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor_curr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error) + } + __pyx_pybuffernd_coor_curr.diminfo[0].strides = __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor_curr.diminfo[0].shape = __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor_curr.diminfo[1].strides = __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor_curr.diminfo[1].shape = __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.shape[1]; - /* "View.MemoryView":1149 + /* "newanalysis/helpers/unfold.pyx":48 + * """ * - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] + * cdef double boxl2 = boxl/2 # <<<<<<<<<<<<<< + * # cdef int n = 3*len(xyz_unfold) + * cdef int n = coor_unfold.shape[0], i */ - __pyx_v_src_extent = (__pyx_v_src_shape[0]); + __pyx_v_boxl2 = (__pyx_v_boxl / 2.0); - /* "View.MemoryView":1150 - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] + /* "newanalysis/helpers/unfold.pyx":50 + * cdef double boxl2 = boxl/2 + * # cdef int n = 3*len(xyz_unfold) + * cdef int n = coor_unfold.shape[0], i # <<<<<<<<<<<<<< + * cdef double DX,DY,DZ + * */ - __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_coor_unfold)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_v_n = (__pyx_t_1[0]); - /* "View.MemoryView":1151 - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_stride = dst_strides[0] + /* "newanalysis/helpers/unfold.pyx":53 + * cdef double DX,DY,DZ * + * for i in prange(n, nogil=True): # <<<<<<<<<<<<<< + * DX = coor_curr[i,0] - coor_prev[i,0] + * DY = coor_curr[i,1] - coor_prev[i,1] */ - __pyx_v_src_stride = (__pyx_v_src_strides[0]); - - /* "View.MemoryView":1152 - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: - */ - __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_2 = __pyx_v_n; + { + double __pyx_parallel_temp0 = ((double)__PYX_NAN()); + double __pyx_parallel_temp1 = ((double)__PYX_NAN()); + double __pyx_parallel_temp2 = ((double)__PYX_NAN()); + int __pyx_parallel_temp3 = ((int)0xbad0bad0); + const char *__pyx_parallel_filename = NULL; int __pyx_parallel_lineno = 0, __pyx_parallel_clineno = 0; + PyObject *__pyx_parallel_exc_type = NULL, *__pyx_parallel_exc_value = NULL, *__pyx_parallel_exc_tb = NULL; + int __pyx_parallel_why; + __pyx_parallel_why = 0; + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_4 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_4 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) private(__pyx_filename, __pyx_lineno, __pyx_clineno) shared(__pyx_parallel_why, __pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + Py_BEGIN_ALLOW_THREADS + #endif /* _OPENMP */ + #ifdef _OPENMP + #pragma omp for lastprivate(__pyx_v_DX) lastprivate(__pyx_v_DY) lastprivate(__pyx_v_DZ) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) + #endif /* _OPENMP */ + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3++){ + if (__pyx_parallel_why < 2) + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_3); + /* Initialize private variables to invalid values */ + __pyx_v_DX = ((double)__PYX_NAN()); + __pyx_v_DY = ((double)__PYX_NAN()); + __pyx_v_DZ = ((double)__PYX_NAN()); - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] + /* "newanalysis/helpers/unfold.pyx":54 * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): + * for i in prange(n, nogil=True): + * DX = coor_curr[i,0] - coor_prev[i,0] # <<<<<<<<<<<<<< + * DY = coor_curr[i,1] - coor_prev[i,1] + * DZ = coor_curr[i,2] - coor_prev[i,2] */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { + __pyx_t_5 = __pyx_v_i; + __pyx_t_6 = 0; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_pybuffernd_coor_curr.diminfo[0].shape; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_coor_curr.diminfo[1].shape; + __pyx_t_7 = __pyx_v_i; + __pyx_t_8 = 0; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_prev.diminfo[0].shape; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_coor_prev.diminfo[1].shape; + __pyx_v_DX = ((*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_coor_curr.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_coor_curr.diminfo[1].strides)) - (*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_coor_prev.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_coor_prev.diminfo[1].strides))); - /* "View.MemoryView":1155 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + /* "newanalysis/helpers/unfold.pyx":55 + * for i in prange(n, nogil=True): + * DX = coor_curr[i,0] - coor_prev[i,0] + * DY = coor_curr[i,1] - coor_prev[i,1] # <<<<<<<<<<<<<< + * DZ = coor_curr[i,2] - coor_prev[i,2] + * if fabs(DX) > boxl2: */ - __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } + __pyx_t_8 = __pyx_v_i; + __pyx_t_7 = 1; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_coor_curr.diminfo[0].shape; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_curr.diminfo[1].shape; + __pyx_t_6 = __pyx_v_i; + __pyx_t_5 = 1; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_coor_prev.diminfo[0].shape; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_pybuffernd_coor_prev.diminfo[1].shape; + __pyx_v_DY = ((*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_coor_curr.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_coor_curr.diminfo[1].strides)) - (*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_coor_prev.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_coor_prev.diminfo[1].strides))); - /* "View.MemoryView":1156 - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: + /* "newanalysis/helpers/unfold.pyx":56 + * DX = coor_curr[i,0] - coor_prev[i,0] + * DY = coor_curr[i,1] - coor_prev[i,1] + * DZ = coor_curr[i,2] - coor_prev[i,2] # <<<<<<<<<<<<<< + * if fabs(DX) > boxl2: + * DX = DX - sign(DX)*boxl */ - __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); - if (__pyx_t_2) { - __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); - } - __pyx_t_3 = (__pyx_t_2 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L5_bool_binop_done:; + __pyx_t_5 = __pyx_v_i; + __pyx_t_6 = 2; + if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_pybuffernd_coor_curr.diminfo[0].shape; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_coor_curr.diminfo[1].shape; + __pyx_t_7 = __pyx_v_i; + __pyx_t_8 = 2; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_prev.diminfo[0].shape; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_coor_prev.diminfo[1].shape; + __pyx_v_DZ = ((*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_curr.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_coor_curr.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_coor_curr.diminfo[1].strides)) - (*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_prev.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_coor_prev.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_coor_prev.diminfo[1].strides))); - /* "View.MemoryView":1155 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + /* "newanalysis/helpers/unfold.pyx":57 + * DY = coor_curr[i,1] - coor_prev[i,1] + * DZ = coor_curr[i,2] - coor_prev[i,2] + * if fabs(DX) > boxl2: # <<<<<<<<<<<<<< + * DX = DX - sign(DX)*boxl + * if fabs(DY) > boxl2: */ - if (__pyx_t_1) { + __pyx_t_9 = (fabs(__pyx_v_DX) > __pyx_v_boxl2); + if (__pyx_t_9) { - /* "View.MemoryView":1157 - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): + /* "newanalysis/helpers/unfold.pyx":58 + * DZ = coor_curr[i,2] - coor_prev[i,2] + * if fabs(DX) > boxl2: + * DX = DX - sign(DX)*boxl # <<<<<<<<<<<<<< + * if fabs(DY) > boxl2: + * DY = DY - sign(DY)*boxl */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + __pyx_t_10 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_DX); if (unlikely(__pyx_t_10 == ((int)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 58, __pyx_L8_error) + __pyx_v_DX = (__pyx_v_DX - (__pyx_t_10 * __pyx_v_boxl)); - /* "View.MemoryView":1155 - * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + /* "newanalysis/helpers/unfold.pyx":57 + * DY = coor_curr[i,1] - coor_prev[i,1] + * DZ = coor_curr[i,2] - coor_prev[i,2] + * if fabs(DX) > boxl2: # <<<<<<<<<<<<<< + * DX = DX - sign(DX)*boxl + * if fabs(DY) > boxl2: */ - goto __pyx_L4; - } + } - /* "View.MemoryView":1159 - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1160 - * else: - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< - * src_data += src_stride - * dst_data += dst_stride + /* "newanalysis/helpers/unfold.pyx":59 + * if fabs(DX) > boxl2: + * DX = DX - sign(DX)*boxl + * if fabs(DY) > boxl2: # <<<<<<<<<<<<<< + * DY = DY - sign(DY)*boxl + * if fabs(DZ) > boxl2: */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); + __pyx_t_9 = (fabs(__pyx_v_DY) > __pyx_v_boxl2); + if (__pyx_t_9) { - /* "View.MemoryView":1161 - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * else: + /* "newanalysis/helpers/unfold.pyx":60 + * DX = DX - sign(DX)*boxl + * if fabs(DY) > boxl2: + * DY = DY - sign(DY)*boxl # <<<<<<<<<<<<<< + * if fabs(DZ) > boxl2: + * DZ = DZ -sign(DZ)*boxl */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + __pyx_t_10 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_DY); if (unlikely(__pyx_t_10 == ((int)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 60, __pyx_L8_error) + __pyx_v_DY = (__pyx_v_DY - (__pyx_t_10 * __pyx_v_boxl)); - /* "View.MemoryView":1162 - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): + /* "newanalysis/helpers/unfold.pyx":59 + * if fabs(DX) > boxl2: + * DX = DX - sign(DX)*boxl + * if fabs(DY) > boxl2: # <<<<<<<<<<<<<< + * DY = DY - sign(DY)*boxl + * if fabs(DZ) > boxl2: */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } - } - __pyx_L4:; + } - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): + /* "newanalysis/helpers/unfold.pyx":61 + * if fabs(DY) > boxl2: + * DY = DY - sign(DY)*boxl + * if fabs(DZ) > boxl2: # <<<<<<<<<<<<<< + * DZ = DZ -sign(DZ)*boxl + * coor_unfold[i,0] += DX */ - goto __pyx_L3; - } + __pyx_t_9 = (fabs(__pyx_v_DZ) > __pyx_v_boxl2); + if (__pyx_t_9) { - /* "View.MemoryView":1164 - * dst_data += dst_stride - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * _copy_strided_to_strided(src_data, src_strides + 1, - * dst_data, dst_strides + 1, + /* "newanalysis/helpers/unfold.pyx":62 + * DY = DY - sign(DY)*boxl + * if fabs(DZ) > boxl2: + * DZ = DZ -sign(DZ)*boxl # <<<<<<<<<<<<<< + * coor_unfold[i,0] += DX + * coor_unfold[i,1] += DY */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_10 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_DZ); if (unlikely(__pyx_t_10 == ((int)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 62, __pyx_L8_error) + __pyx_v_DZ = (__pyx_v_DZ - (__pyx_t_10 * __pyx_v_boxl)); - /* "View.MemoryView":1165 - * else: - * for i in range(dst_extent): - * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< - * dst_data, dst_strides + 1, - * src_shape + 1, dst_shape + 1, + /* "newanalysis/helpers/unfold.pyx":61 + * if fabs(DY) > boxl2: + * DY = DY - sign(DY)*boxl + * if fabs(DZ) > boxl2: # <<<<<<<<<<<<<< + * DZ = DZ -sign(DZ)*boxl + * coor_unfold[i,0] += DX */ - _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + } - /* "View.MemoryView":1169 - * src_shape + 1, dst_shape + 1, - * ndim - 1, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * + /* "newanalysis/helpers/unfold.pyx":63 + * if fabs(DZ) > boxl2: + * DZ = DZ -sign(DZ)*boxl + * coor_unfold[i,0] += DX # <<<<<<<<<<<<<< + * coor_unfold[i,1] += DY + * coor_unfold[i,2] += DZ */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + __pyx_t_8 = __pyx_v_i; + __pyx_t_7 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_coor_unfold.diminfo[0].shape; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_unfold.diminfo[1].shape; + *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_coor_unfold.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_coor_unfold.diminfo[1].strides) += __pyx_v_DX; - /* "View.MemoryView":1170 - * ndim - 1, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< + /* "newanalysis/helpers/unfold.pyx":64 + * DZ = DZ -sign(DZ)*boxl + * coor_unfold[i,0] += DX + * coor_unfold[i,1] += DY # <<<<<<<<<<<<<< + * coor_unfold[i,2] += DZ * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } - } - __pyx_L3:; + __pyx_t_7 = __pyx_v_i; + __pyx_t_8 = 1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_unfold.diminfo[0].shape; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_coor_unfold.diminfo[1].shape; + *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_coor_unfold.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_coor_unfold.diminfo[1].strides) += __pyx_v_DY; - /* "View.MemoryView":1142 + /* "newanalysis/helpers/unfold.pyx":65 + * coor_unfold[i,0] += DX + * coor_unfold[i,1] += DY + * coor_unfold[i,2] += DZ # <<<<<<<<<<<<<< * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + * @cython.boundscheck(False) */ - - /* function exit code */ + __pyx_t_8 = __pyx_v_i; + __pyx_t_7 = 2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_coor_unfold.diminfo[0].shape; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor_unfold.diminfo[1].shape; + *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_coor_unfold.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_coor_unfold.diminfo[1].strides) += __pyx_v_DZ; + goto __pyx_L14; + __pyx_L8_error:; + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_exc_type) + #endif /* _OPENMP */ + if (!__pyx_parallel_exc_type) { + __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb); + __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno; + __Pyx_GOTREF(__pyx_parallel_exc_type); + } + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + __pyx_parallel_why = 4; + goto __pyx_L13; + __pyx_L13:; + #ifdef _OPENMP + #pragma omp critical(__pyx_parallel_lastprivates1) + #endif /* _OPENMP */ + { + __pyx_parallel_temp0 = __pyx_v_DX; + __pyx_parallel_temp1 = __pyx_v_DY; + __pyx_parallel_temp2 = __pyx_v_DZ; + __pyx_parallel_temp3 = __pyx_v_i; + } + __pyx_L14:; + #ifdef _OPENMP + #pragma omp flush(__pyx_parallel_why) + #endif /* _OPENMP */ + } + } + #ifdef _OPENMP + Py_END_ALLOW_THREADS + #else +{ +#ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + #endif /* _OPENMP */ + /* Clean up any temporaries */ + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + #ifndef _OPENMP } +#endif /* _OPENMP */ + } + } + if (__pyx_parallel_exc_type) { + /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */ + __pyx_parallel_why = 4; + } + if (__pyx_parallel_why) { + __pyx_v_DX = __pyx_parallel_temp0; + __pyx_v_DY = __pyx_parallel_temp1; + __pyx_v_DZ = __pyx_parallel_temp2; + __pyx_v_i = __pyx_parallel_temp3; + switch (__pyx_parallel_why) { + case 4: + { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_GIVEREF(__pyx_parallel_exc_type); + __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb); + __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + } + goto __pyx_L4_error; + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } -/* "View.MemoryView":1172 - * dst_data += dst_stride + /* "newanalysis/helpers/unfold.pyx":53 + * cdef double DX,DY,DZ * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + * for i in prange(n, nogil=True): # <<<<<<<<<<<<<< + * DX = coor_curr[i,0] - coor_prev[i,0] + * DY = coor_curr[i,1] - coor_prev[i,1] */ - -static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - - /* "View.MemoryView":1175 - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: - * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< - * src.shape, dst.shape, ndim, itemsize) - * - */ - _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); - - /* "View.MemoryView":1172 - * dst_data += dst_stride - * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1179 - * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - */ - -static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_size; - Py_ssize_t __pyx_r; - Py_ssize_t __pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - - /* "View.MemoryView":1181 - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< - * - * for shape in src.shape[:ndim]: - */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_size = __pyx_t_1; - - /* "View.MemoryView":1183 - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - * - * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< - * size *= shape - * - */ - __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); - for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_shape = (__pyx_t_2[0]); - - /* "View.MemoryView":1184 - * - * for shape in src.shape[:ndim]: - * size *= shape # <<<<<<<<<<<<<< - * - * return size - */ - __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; + } } - /* "View.MemoryView":1186 - * size *= shape - * - * return size # <<<<<<<<<<<<<< - * - * @cname('__pyx_fill_contig_strides_array') - */ - __pyx_r = __pyx_v_size; - goto __pyx_L0; - - /* "View.MemoryView":1179 + /* "newanalysis/helpers/unfold.pyx":18 + * void GetRotation(double *R_ptr, int n, double *APoints_ptr, double *BPoints_ptr, int debug) * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldBox(np.ndarray[np.float64_t,ndim=2,mode='c'] coor_unfold, + * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_prev, */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_curr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_prev.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.unfold.unfoldBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_curr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_prev.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor_unfold.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1189 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: - */ - -static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { - int __pyx_v_idx; - Py_ssize_t __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1198 - * cdef int idx - * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride - */ - __pyx_t_1 = ((__pyx_v_order == 'F') != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1199 +/* "newanalysis/helpers/unfold.pyx":67 + * coor_unfold[i,2] += DZ * - * if order == 'F': - * for idx in range(ndim): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] - */ - __pyx_t_2 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_idx = __pyx_t_4; - - /* "View.MemoryView":1200 - * if order == 'F': - * for idx in range(ndim): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * else: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, + * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":1201 - * for idx in range(ndim): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * else: - * for idx in range(ndim - 1, -1, -1): - */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6unfold_3unfoldOcta(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_6unfold_2unfoldOcta, "\n unfoldBox(xyz_unfold,xyz_prev,xyz_curr,boxlength)\n \n You have to hand over 3 coordinate sets and the boxlength as arguments: \n - the in-place-unfolding coordinates (from the previous timestep)\n - the trajectory coordinates from the previous timestep\n - the trajectory coordinates from the current timestep\n - boxlength\n\n This functions returns the unfolded coordinates of the current timestep.\n\n Arguments:\n xyz_unfold .. numpy array (float64, ndim=2) in-place-unfolding coordinate set: [[x,y,z],[x,y,z],...,[x,y,z]]\n xyz_traj_prev .. numpy array (float64, ndim=2) trajectory coordinates, previous timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n xyz_traj_curr .. numpy array (float64, ndim=2) trajectory coordinates, current timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n boxlength .. the box length\n\n Usage:\n With this function one can unfold \n the coordinates of a trajectory on the fly, timestep per timestep.\n\n Example: \n unfoldOcta(xyz_unfold, xyz_traj_prev, xyz_traj_curr, boxlength)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_6unfold_3unfoldOcta = {"unfoldOcta", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6unfold_3unfoldOcta, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_2unfoldOcta}; +static PyObject *__pyx_pw_11newanalysis_6unfold_3unfoldOcta(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_xyz_unfold = 0; + PyArrayObject *__pyx_v_xyz_traj_prev = 0; + PyArrayObject *__pyx_v_xyz_traj_curr = 0; + PyObject *__pyx_v_boxlength = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unfoldOcta (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 67, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz_unfold,&__pyx_n_s_xyz_traj_prev,&__pyx_n_s_xyz_traj_curr,&__pyx_n_s_boxlength,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz_unfold)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz_traj_prev)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfoldOcta", 1, 4, 4, 1); __PYX_ERR(0, 67, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz_traj_curr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfoldOcta", 1, 4, 4, 2); __PYX_ERR(0, 67, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfoldOcta", 1, 4, 4, 3); __PYX_ERR(0, 67, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "unfoldOcta") < 0)) __PYX_ERR(0, 67, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); } - - /* "View.MemoryView":1198 - * cdef int idx - * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride - */ - goto __pyx_L3; + __pyx_v_xyz_unfold = ((PyArrayObject *)values[0]); + __pyx_v_xyz_traj_prev = ((PyArrayObject *)values[1]); + __pyx_v_xyz_traj_curr = ((PyArrayObject *)values[2]); + __pyx_v_boxlength = values[3]; } - - /* "View.MemoryView":1203 - * stride *= shape[idx] - * else: - * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] - */ - /*else*/ { - for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { - __pyx_v_idx = __pyx_t_2; - - /* "View.MemoryView":1204 - * else: - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * - */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - - /* "View.MemoryView":1205 - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * - * return stride - */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unfoldOcta", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 67, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __pyx_L3:; - - /* "View.MemoryView":1207 - * stride *= shape[idx] - * - * return stride # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_data_to_temp') - */ - __pyx_r = __pyx_v_stride; - goto __pyx_L0; - - /* "View.MemoryView":1189 - * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: - */ + __Pyx_AddTraceback("newanalysis.unfold.unfoldOcta", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_unfold), __pyx_ptype_5numpy_ndarray, 1, "xyz_unfold", 0))) __PYX_ERR(0, 68, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_traj_prev), __pyx_ptype_5numpy_ndarray, 1, "xyz_traj_prev", 0))) __PYX_ERR(0, 69, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_traj_curr), __pyx_ptype_5numpy_ndarray, 1, "xyz_traj_curr", 0))) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6unfold_2unfoldOcta(__pyx_self, __pyx_v_xyz_unfold, __pyx_v_xyz_traj_prev, __pyx_v_xyz_traj_curr, __pyx_v_boxlength); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1210 - * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, - */ - -static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { +static PyObject *__pyx_pf_11newanalysis_6unfold_2unfoldOcta(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz_unfold, PyArrayObject *__pyx_v_xyz_traj_prev, PyArrayObject *__pyx_v_xyz_traj_curr, PyObject *__pyx_v_boxlength) { + double __pyx_v_boxl; + double __pyx_v_boxl2; + double __pyx_v_boxl34; + int __pyx_v_n; int __pyx_v_i; - void *__pyx_v_result; - size_t __pyx_v_itemsize; - size_t __pyx_v_size; - void *__pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - struct __pyx_memoryview_obj *__pyx_t_4; - int __pyx_t_5; + double __pyx_v_DX; + double __pyx_v_DY; + double __pyx_v_DZ; + double __pyx_v_DD; + PyArrayObject *__pyx_v_c_xyz_traj_prev = 0; + PyArrayObject *__pyx_v_c_xyz_traj_curr = 0; + double *__pyx_v_unfold; + double *__pyx_v_prev; + double *__pyx_v_curr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_c_xyz_traj_curr; + __Pyx_Buffer __pyx_pybuffer_c_xyz_traj_curr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_c_xyz_traj_prev; + __Pyx_Buffer __pyx_pybuffer_c_xyz_traj_prev; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_traj_curr; + __Pyx_Buffer __pyx_pybuffer_xyz_traj_curr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_traj_prev; + __Pyx_Buffer __pyx_pybuffer_xyz_traj_prev; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_unfold; + __Pyx_Buffer __pyx_pybuffer_xyz_unfold; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_t_6; + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + long __pyx_t_14; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unfoldOcta", 0); + __pyx_pybuffer_c_xyz_traj_prev.pybuffer.buf = NULL; + __pyx_pybuffer_c_xyz_traj_prev.refcount = 0; + __pyx_pybuffernd_c_xyz_traj_prev.data = NULL; + __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer = &__pyx_pybuffer_c_xyz_traj_prev; + __pyx_pybuffer_c_xyz_traj_curr.pybuffer.buf = NULL; + __pyx_pybuffer_c_xyz_traj_curr.refcount = 0; + __pyx_pybuffernd_c_xyz_traj_curr.data = NULL; + __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer = &__pyx_pybuffer_c_xyz_traj_curr; + __pyx_pybuffer_xyz_unfold.pybuffer.buf = NULL; + __pyx_pybuffer_xyz_unfold.refcount = 0; + __pyx_pybuffernd_xyz_unfold.data = NULL; + __pyx_pybuffernd_xyz_unfold.rcbuffer = &__pyx_pybuffer_xyz_unfold; + __pyx_pybuffer_xyz_traj_prev.pybuffer.buf = NULL; + __pyx_pybuffer_xyz_traj_prev.refcount = 0; + __pyx_pybuffernd_xyz_traj_prev.data = NULL; + __pyx_pybuffernd_xyz_traj_prev.rcbuffer = &__pyx_pybuffer_xyz_traj_prev; + __pyx_pybuffer_xyz_traj_curr.pybuffer.buf = NULL; + __pyx_pybuffer_xyz_traj_curr.refcount = 0; + __pyx_pybuffernd_xyz_traj_curr.data = NULL; + __pyx_pybuffernd_xyz_traj_curr.rcbuffer = &__pyx_pybuffer_xyz_traj_curr; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_unfold, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) + } + __pyx_pybuffernd_xyz_unfold.diminfo[0].strides = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_unfold.diminfo[0].shape = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_unfold.diminfo[1].strides = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_unfold.diminfo[1].shape = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_traj_prev, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) + } + __pyx_pybuffernd_xyz_traj_prev.diminfo[0].strides = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_traj_prev.diminfo[0].shape = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_traj_prev.diminfo[1].strides = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_traj_prev.diminfo[1].shape = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_traj_curr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) + } + __pyx_pybuffernd_xyz_traj_curr.diminfo[0].strides = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_traj_curr.diminfo[0].shape = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_traj_curr.diminfo[1].strides = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_traj_curr.diminfo[1].shape = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.shape[1]; - /* "View.MemoryView":1221 - * cdef void *result - * - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef size_t size = slice_get_size(src, ndim) - * + /* "newanalysis/helpers/unfold.pyx":96 + * unfoldOcta(xyz_unfold, xyz_traj_prev, xyz_traj_curr, boxlength) + * """ + * cdef double boxl = boxlength # <<<<<<<<<<<<<< + * cdef double boxl2 = boxl/2 + * cdef double boxl34 = 3*boxl/4 */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_boxlength); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_v_boxl = __pyx_t_1; - /* "View.MemoryView":1222 - * - * cdef size_t itemsize = src.memview.view.itemsize - * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< - * - * result = malloc(size) + /* "newanalysis/helpers/unfold.pyx":97 + * """ + * cdef double boxl = boxlength + * cdef double boxl2 = boxl/2 # <<<<<<<<<<<<<< + * cdef double boxl34 = 3*boxl/4 + * cdef int n = 3*len(xyz_unfold) */ - __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); + __pyx_v_boxl2 = (__pyx_v_boxl / 2.0); - /* "View.MemoryView":1224 - * cdef size_t size = slice_get_size(src, ndim) - * - * result = malloc(size) # <<<<<<<<<<<<<< - * if not result: - * _err(MemoryError, NULL) + /* "newanalysis/helpers/unfold.pyx":98 + * cdef double boxl = boxlength + * cdef double boxl2 = boxl/2 + * cdef double boxl34 = 3*boxl/4 # <<<<<<<<<<<<<< + * cdef int n = 3*len(xyz_unfold) + * cdef int i */ - __pyx_v_result = malloc(__pyx_v_size); + __pyx_v_boxl34 = ((3.0 * __pyx_v_boxl) / 4.0); - /* "View.MemoryView":1225 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) - * + /* "newanalysis/helpers/unfold.pyx":99 + * cdef double boxl2 = boxl/2 + * cdef double boxl34 = 3*boxl/4 + * cdef int n = 3*len(xyz_unfold) # <<<<<<<<<<<<<< + * cdef int i + * cdef double DX,DY,DZ,DD */ - __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_xyz_unfold)); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_v_n = (3 * __pyx_t_2); - /* "View.MemoryView":1226 - * result = malloc(size) - * if not result: - * _err(MemoryError, NULL) # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/unfold.pyx":102 + * cdef int i + * cdef double DX,DY,DZ,DD + * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_prev = np.copy(xyz_traj_prev) # <<<<<<<<<<<<<< + * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_curr = np.copy(xyz_traj_curr) + * cdef double *unfold = xyz_unfold.data */ - __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1226, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_xyz_traj_prev)}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 102, __pyx_L1_error) + __pyx_t_7 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_c_xyz_traj_prev = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 102, __pyx_L1_error) + } else {__pyx_pybuffernd_c_xyz_traj_prev.diminfo[0].strides = __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c_xyz_traj_prev.diminfo[0].shape = __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_c_xyz_traj_prev.diminfo[1].strides = __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_c_xyz_traj_prev.diminfo[1].shape = __pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_7 = 0; + __pyx_v_c_xyz_traj_prev = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":1225 - * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) - * + /* "newanalysis/helpers/unfold.pyx":103 + * cdef double DX,DY,DZ,DD + * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_prev = np.copy(xyz_traj_prev) + * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_curr = np.copy(xyz_traj_curr) # <<<<<<<<<<<<<< + * cdef double *unfold = xyz_unfold.data + * cdef double *prev = c_xyz_traj_prev.data */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, ((PyObject *)__pyx_v_xyz_traj_curr)}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_8 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_c_xyz_traj_curr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 103, __pyx_L1_error) + } else {__pyx_pybuffernd_c_xyz_traj_curr.diminfo[0].strides = __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c_xyz_traj_curr.diminfo[0].shape = __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_c_xyz_traj_curr.diminfo[1].strides = __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_c_xyz_traj_curr.diminfo[1].shape = __pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_8 = 0; + __pyx_v_c_xyz_traj_curr = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":1229 - * - * - * tmpslice.data = result # <<<<<<<<<<<<<< - * tmpslice.memview = src.memview - * for i in range(ndim): + /* "newanalysis/helpers/unfold.pyx":104 + * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_prev = np.copy(xyz_traj_prev) + * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_curr = np.copy(xyz_traj_curr) + * cdef double *unfold = xyz_unfold.data # <<<<<<<<<<<<<< + * cdef double *prev = c_xyz_traj_prev.data + * cdef double *curr = c_xyz_traj_curr.data */ - __pyx_v_tmpslice->data = ((char *)__pyx_v_result); + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz_unfold)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_v_unfold = ((double *)__pyx_t_9); - /* "View.MemoryView":1230 - * - * tmpslice.data = result - * tmpslice.memview = src.memview # <<<<<<<<<<<<<< - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - */ - __pyx_t_4 = __pyx_v_src->memview; - __pyx_v_tmpslice->memview = __pyx_t_4; - - /* "View.MemoryView":1231 - * tmpslice.data = result - * tmpslice.memview = src.memview - * for i in range(ndim): # <<<<<<<<<<<<<< - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 - */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1232 - * tmpslice.memview = src.memview - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< - * tmpslice.suboffsets[i] = -1 + /* "newanalysis/helpers/unfold.pyx":105 + * cdef np.ndarray[np.float64_t,ndim=2] c_xyz_traj_curr = np.copy(xyz_traj_curr) + * cdef double *unfold = xyz_unfold.data + * cdef double *prev = c_xyz_traj_prev.data # <<<<<<<<<<<<<< + * cdef double *curr = c_xyz_traj_curr.data * */ - (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_c_xyz_traj_prev)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_v_prev = ((double *)__pyx_t_9); - /* "View.MemoryView":1233 - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/unfold.pyx":106 + * cdef double *unfold = xyz_unfold.data + * cdef double *prev = c_xyz_traj_prev.data + * cdef double *curr = c_xyz_traj_curr.data # <<<<<<<<<<<<<< * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, + * for i in range(0,n,3): */ - (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; - } + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_c_xyz_traj_curr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_v_curr = ((double *)__pyx_t_9); - /* "View.MemoryView":1235 - * tmpslice.suboffsets[i] = -1 - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< - * ndim, order) + /* "newanalysis/helpers/unfold.pyx":108 + * cdef double *curr = c_xyz_traj_curr.data * + * for i in range(0,n,3): # <<<<<<<<<<<<<< + * DX = curr[i] - prev[i] + * DY = curr[i+1] - prev[i+1] */ - (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + __pyx_t_6 = __pyx_v_n; + __pyx_t_10 = __pyx_t_6; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=3) { + __pyx_v_i = __pyx_t_11; - /* "View.MemoryView":1239 + /* "newanalysis/helpers/unfold.pyx":109 * - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 + * for i in range(0,n,3): + * DX = curr[i] - prev[i] # <<<<<<<<<<<<<< + * DY = curr[i+1] - prev[i+1] + * DZ = curr[i+2] - prev[i+2] */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_v_DX = ((__pyx_v_curr[__pyx_v_i]) - (__pyx_v_prev[__pyx_v_i])); - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * + /* "newanalysis/helpers/unfold.pyx":110 + * for i in range(0,n,3): + * DX = curr[i] - prev[i] + * DY = curr[i+1] - prev[i+1] # <<<<<<<<<<<<<< + * DZ = curr[i+2] - prev[i+2] + * DD = fabs(DX) + fabs(DY) + fabs(DZ) */ - __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { + __pyx_v_DY = ((__pyx_v_curr[(__pyx_v_i + 1)]) - (__pyx_v_prev[(__pyx_v_i + 1)])); - /* "View.MemoryView":1241 - * for i in range(ndim): - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< - * - * if slice_is_contig(src[0], order, ndim): + /* "newanalysis/helpers/unfold.pyx":111 + * DX = curr[i] - prev[i] + * DY = curr[i+1] - prev[i+1] + * DZ = curr[i+2] - prev[i+2] # <<<<<<<<<<<<<< + * DD = fabs(DX) + fabs(DY) + fabs(DZ) + * if DD > boxl34: */ - (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + __pyx_v_DZ = ((__pyx_v_curr[(__pyx_v_i + 2)]) - (__pyx_v_prev[(__pyx_v_i + 2)])); - /* "View.MemoryView":1240 - * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 - * + /* "newanalysis/helpers/unfold.pyx":112 + * DY = curr[i+1] - prev[i+1] + * DZ = curr[i+2] - prev[i+2] + * DD = fabs(DX) + fabs(DY) + fabs(DZ) # <<<<<<<<<<<<<< + * if DD > boxl34: + * DX -= sign(DX)*boxl2 */ - } - } + __pyx_v_DD = ((fabs(__pyx_v_DX) + fabs(__pyx_v_DY)) + fabs(__pyx_v_DZ)); - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: + /* "newanalysis/helpers/unfold.pyx":113 + * DZ = curr[i+2] - prev[i+2] + * DD = fabs(DX) + fabs(DY) + fabs(DZ) + * if DD > boxl34: # <<<<<<<<<<<<<< + * DX -= sign(DX)*boxl2 + * DY -= sign(DY)*boxl2 */ - __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_12 = (__pyx_v_DD > __pyx_v_boxl34); + if (__pyx_t_12) { - /* "View.MemoryView":1244 - * - * if slice_is_contig(src[0], order, ndim): - * memcpy(result, src.data, size) # <<<<<<<<<<<<<< - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + /* "newanalysis/helpers/unfold.pyx":114 + * DD = fabs(DX) + fabs(DY) + fabs(DZ) + * if DD > boxl34: + * DX -= sign(DX)*boxl2 # <<<<<<<<<<<<<< + * DY -= sign(DY)*boxl2 + * DZ -= sign(DZ)*boxl2 */ - (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_DX); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_v_DX = (__pyx_v_DX - (__pyx_t_13 * __pyx_v_boxl2)); - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: + /* "newanalysis/helpers/unfold.pyx":115 + * if DD > boxl34: + * DX -= sign(DX)*boxl2 + * DY -= sign(DY)*boxl2 # <<<<<<<<<<<<<< + * DZ -= sign(DZ)*boxl2 + * else: */ - goto __pyx_L9; - } + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_DY); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_v_DY = (__pyx_v_DY - (__pyx_t_13 * __pyx_v_boxl2)); - /* "View.MemoryView":1246 - * memcpy(result, src.data, size) - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< - * - * return result + /* "newanalysis/helpers/unfold.pyx":116 + * DX -= sign(DX)*boxl2 + * DY -= sign(DY)*boxl2 + * DZ -= sign(DZ)*boxl2 # <<<<<<<<<<<<<< + * else: + * if fabs(DX) > boxl2: */ - /*else*/ { - copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); - } - __pyx_L9:; + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_DZ); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_v_DZ = (__pyx_v_DZ - (__pyx_t_13 * __pyx_v_boxl2)); - /* "View.MemoryView":1248 - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) - * - * return result # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/unfold.pyx":113 + * DZ = curr[i+2] - prev[i+2] + * DD = fabs(DX) + fabs(DY) + fabs(DZ) + * if DD > boxl34: # <<<<<<<<<<<<<< + * DX -= sign(DX)*boxl2 + * DY -= sign(DY)*boxl2 */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; + goto __pyx_L5; + } - /* "View.MemoryView":1210 - * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + /* "newanalysis/helpers/unfold.pyx":118 + * DZ -= sign(DZ)*boxl2 + * else: + * if fabs(DX) > boxl2: # <<<<<<<<<<<<<< + * DX -= sign(DX)*boxl + * if fabs(DY) > boxl2: */ + /*else*/ { + __pyx_t_12 = (fabs(__pyx_v_DX) > __pyx_v_boxl2); + if (__pyx_t_12) { - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = NULL; - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1253 - * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + /* "newanalysis/helpers/unfold.pyx":119 + * else: + * if fabs(DX) > boxl2: + * DX -= sign(DX)*boxl # <<<<<<<<<<<<<< + * if fabs(DY) > boxl2: + * DY -= sign(DY)*boxl */ + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_DX); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_v_DX = (__pyx_v_DX - (__pyx_t_13 * __pyx_v_boxl)); -static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_extents", 0); - - /* "View.MemoryView":1256 - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % - * (i, extent1, extent2)) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err_dim') + /* "newanalysis/helpers/unfold.pyx":118 + * DZ -= sign(DZ)*boxl2 + * else: + * if fabs(DX) > boxl2: # <<<<<<<<<<<<<< + * DX -= sign(DX)*boxl + * if fabs(DY) > boxl2: */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; + } - /* "View.MemoryView":1255 - * cdef int _err_extents(int i, Py_ssize_t extent1, - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<< - * (i, extent1, extent2)) - * + /* "newanalysis/helpers/unfold.pyx":120 + * if fabs(DX) > boxl2: + * DX -= sign(DX)*boxl + * if fabs(DY) > boxl2: # <<<<<<<<<<<<<< + * DY -= sign(DY)*boxl + * if fabs(DZ) > boxl2: */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 1255, __pyx_L1_error) + __pyx_t_12 = (fabs(__pyx_v_DY) > __pyx_v_boxl2); + if (__pyx_t_12) { - /* "View.MemoryView":1253 - * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + /* "newanalysis/helpers/unfold.pyx":121 + * DX -= sign(DX)*boxl + * if fabs(DY) > boxl2: + * DY -= sign(DY)*boxl # <<<<<<<<<<<<<< + * if fabs(DZ) > boxl2: + * DZ -= sign(DZ)*boxl */ + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_DY); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_v_DY = (__pyx_v_DY - (__pyx_t_13 * __pyx_v_boxl)); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} + /* "newanalysis/helpers/unfold.pyx":120 + * if fabs(DX) > boxl2: + * DX -= sign(DX)*boxl + * if fabs(DY) > boxl2: # <<<<<<<<<<<<<< + * DY -= sign(DY)*boxl + * if fabs(DZ) > boxl2: + */ + } -/* "View.MemoryView":1259 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) - * + /* "newanalysis/helpers/unfold.pyx":122 + * if fabs(DY) > boxl2: + * DY -= sign(DY)*boxl + * if fabs(DZ) > boxl2: # <<<<<<<<<<<<<< + * DZ -= sign(DZ)*boxl + * unfold[i] += DX */ + __pyx_t_12 = (fabs(__pyx_v_DZ) > __pyx_v_boxl2); + if (__pyx_t_12) { -static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_dim", 0); - __Pyx_INCREF(__pyx_v_error); + /* "newanalysis/helpers/unfold.pyx":123 + * DY -= sign(DY)*boxl + * if fabs(DZ) > boxl2: + * DZ -= sign(DZ)*boxl # <<<<<<<<<<<<<< + * unfold[i] += DX + * unfold[i+1] += DY + */ + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_DZ); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_v_DZ = (__pyx_v_DZ - (__pyx_t_13 * __pyx_v_boxl)); - /* "View.MemoryView":1260 - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: - * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err') + /* "newanalysis/helpers/unfold.pyx":122 + * if fabs(DY) > boxl2: + * DY -= sign(DY)*boxl + * if fabs(DZ) > boxl2: # <<<<<<<<<<<<<< + * DZ -= sign(DZ)*boxl + * unfold[i] += DX */ - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_v_error); - __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + } } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 1260, __pyx_L1_error) + __pyx_L5:; + + /* "newanalysis/helpers/unfold.pyx":124 + * if fabs(DZ) > boxl2: + * DZ -= sign(DZ)*boxl + * unfold[i] += DX # <<<<<<<<<<<<<< + * unfold[i+1] += DY + * unfold[i+2] += DZ + */ + __pyx_t_13 = __pyx_v_i; + (__pyx_v_unfold[__pyx_t_13]) = ((__pyx_v_unfold[__pyx_t_13]) + __pyx_v_DX); - /* "View.MemoryView":1259 + /* "newanalysis/helpers/unfold.pyx":125 + * DZ -= sign(DZ)*boxl + * unfold[i] += DX + * unfold[i+1] += DY # <<<<<<<<<<<<<< + * unfold[i+2] += DZ * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) + */ + __pyx_t_14 = (__pyx_v_i + 1); + (__pyx_v_unfold[__pyx_t_14]) = ((__pyx_v_unfold[__pyx_t_14]) + __pyx_v_DY); + + /* "newanalysis/helpers/unfold.pyx":126 + * unfold[i] += DX + * unfold[i+1] += DY + * unfold[i+2] += DZ # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __pyx_t_14 = (__pyx_v_i + 2); + (__pyx_v_unfold[__pyx_t_14]) = ((__pyx_v_unfold[__pyx_t_14]) + __pyx_v_DZ); + } + + /* "newanalysis/helpers/unfold.pyx":67 + * coor_unfold[i,2] += DZ * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, + * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); + __Pyx_XDECREF(__pyx_t_5); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.unfold.unfoldOcta", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c_xyz_traj_curr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c_xyz_traj_prev.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_c_xyz_traj_prev); + __Pyx_XDECREF((PyObject *)__pyx_v_c_xyz_traj_curr); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif return __pyx_r; } -/* "View.MemoryView":1263 +/* "newanalysis/helpers/unfold.pyx":128 + * unfold[i+2] += DZ * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldCharmmOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, + * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, */ -static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6unfold_5unfoldCharmmOcta(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_6unfold_4unfoldCharmmOcta, "\n unfoldCharmmOcta(xyz_unfold,xyz_prev,xyz_curr,dimensions)\n \n You have to hand over 3 coordinate sets and the dimensions array as arguments: \n - the in-place-unfolding coordinates (from the previous timestep)\n - the trajectory coordinates from the previous timestep\n - the trajectory coordinates from the current timestep\n - dimensions = matrix with entries for basis vectors\n\n This functions returns the unfolded coordinates of the current timestep.\n\n Arguments:\n xyz_unfold .. numpy array (float64, ndim=2) in-place-unfolding coordinate set: [[x,y,z],[x,y,z],...,[x,y,z]]\n xyz_traj_prev .. numpy array (float64, ndim=2) trajectory coordinates, previous timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n xyz_traj_curr .. numpy array (float64, ndim=2) trajectory coordinates, current timestep: [[x,y,z],[x,y,z],...,[x,y,z]]\n dimensions .. numpy array (float32, ndim=1) output from u.coord.dimensions\n\n Usage:\n With this function one can unfold \n the coordinates of a trajectory on the fly, timestep per timestep.\n Compatible with every box-shape in CHARMM.\n\n Example: \n unfoldCharmmOcta(xyz_unfold, xyz_traj_prev, xyz_traj_curr, dimensions)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_6unfold_5unfoldCharmmOcta = {"unfoldCharmmOcta", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6unfold_5unfoldCharmmOcta, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_4unfoldCharmmOcta}; +static PyObject *__pyx_pw_11newanalysis_6unfold_5unfoldCharmmOcta(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_xyz_unfold = 0; + PyArrayObject *__pyx_v_xyz_traj_prev = 0; + PyArrayObject *__pyx_v_xyz_traj_curr = 0; + PyArrayObject *__pyx_v_dimensions = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unfoldCharmmOcta (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 128, __pyx_L3_error) #endif - __Pyx_RefNannySetupContext("_err", 0); - __Pyx_INCREF(__pyx_v_error); - - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: - */ - __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":1265 - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: - * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< - * else: - * raise error - */ - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_error); - __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz_unfold,&__pyx_n_s_xyz_traj_prev,&__pyx_n_s_xyz_traj_curr,&__pyx_n_s_dimensions,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz_unfold)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz_traj_prev)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfoldCharmmOcta", 1, 4, 4, 1); __PYX_ERR(0, 128, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz_traj_curr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfoldCharmmOcta", 1, 4, 4, 2); __PYX_ERR(0, 128, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dimensions)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("unfoldCharmmOcta", 1, 4, 4, 3); __PYX_ERR(0, 128, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "unfoldCharmmOcta") < 0)) __PYX_ERR(0, 128, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 1265, __pyx_L1_error) - - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: - */ + __pyx_v_xyz_unfold = ((PyArrayObject *)values[0]); + __pyx_v_xyz_traj_prev = ((PyArrayObject *)values[1]); + __pyx_v_xyz_traj_curr = ((PyArrayObject *)values[2]); + __pyx_v_dimensions = ((PyArrayObject *)values[3]); } - - /* "View.MemoryView":1267 - * raise error(msg.decode('ascii')) - * else: - * raise error # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_contents') - */ - /*else*/ { - __Pyx_Raise(__pyx_v_error, 0, 0, 0); - __PYX_ERR(2, 1267, __pyx_L1_error) + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unfoldCharmmOcta", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 128, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - - /* "View.MemoryView":1263 - * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) - */ + __Pyx_AddTraceback("newanalysis.unfold.unfoldCharmmOcta", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_unfold), __pyx_ptype_5numpy_ndarray, 1, "xyz_unfold", 0))) __PYX_ERR(0, 129, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_traj_prev), __pyx_ptype_5numpy_ndarray, 1, "xyz_traj_prev", 0))) __PYX_ERR(0, 130, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz_traj_curr), __pyx_ptype_5numpy_ndarray, 1, "xyz_traj_curr", 0))) __PYX_ERR(0, 131, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dimensions), __pyx_ptype_5numpy_ndarray, 1, "dimensions", 0))) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6unfold_4unfoldCharmmOcta(__pyx_self, __pyx_v_xyz_unfold, __pyx_v_xyz_traj_prev, __pyx_v_xyz_traj_curr, __pyx_v_dimensions); /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif return __pyx_r; } -/* "View.MemoryView":1270 - * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ - -static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { - void *__pyx_v_tmpdata; - size_t __pyx_v_itemsize; +static PyObject *__pyx_pf_11newanalysis_6unfold_4unfoldCharmmOcta(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz_unfold, PyArrayObject *__pyx_v_xyz_traj_prev, PyArrayObject *__pyx_v_xyz_traj_curr, PyArrayObject *__pyx_v_dimensions) { + double __pyx_v_diag; + double __pyx_v_offdiag; + double __pyx_v_norm; + double __pyx_v_norm2; + double __pyx_v_norm22; + double __pyx_v_norm32; + double __pyx_v_A; + double __pyx_v_B; + double __pyx_v_C; + double __pyx_v_DX; + double __pyx_v_DY; + double __pyx_v_DZ; + double __pyx_v_D; + double __pyx_v_T1; + double __pyx_v_T2; + double __pyx_v_T3; + int __pyx_v_n; int __pyx_v_i; - char __pyx_v_order; - int __pyx_v_broadcasting; - int __pyx_v_direct_copy; - __Pyx_memviewslice __pyx_v_tmp; - int __pyx_v_ndim; - int __pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; + double *__pyx_v_unfold; + double *__pyx_v_prev; + double *__pyx_v_curr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_dimensions; + __Pyx_Buffer __pyx_pybuffer_dimensions; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_traj_curr; + __Pyx_Buffer __pyx_pybuffer_xyz_traj_curr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_traj_prev; + __Pyx_Buffer __pyx_pybuffer_xyz_traj_prev; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz_unfold; + __Pyx_Buffer __pyx_pybuffer_xyz_unfold; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; int __pyx_t_6; - void *__pyx_t_7; - int __pyx_t_8; + double __pyx_t_7; + Py_ssize_t __pyx_t_8; + char *__pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + long __pyx_t_17; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unfoldCharmmOcta", 0); + __pyx_pybuffer_xyz_unfold.pybuffer.buf = NULL; + __pyx_pybuffer_xyz_unfold.refcount = 0; + __pyx_pybuffernd_xyz_unfold.data = NULL; + __pyx_pybuffernd_xyz_unfold.rcbuffer = &__pyx_pybuffer_xyz_unfold; + __pyx_pybuffer_xyz_traj_prev.pybuffer.buf = NULL; + __pyx_pybuffer_xyz_traj_prev.refcount = 0; + __pyx_pybuffernd_xyz_traj_prev.data = NULL; + __pyx_pybuffernd_xyz_traj_prev.rcbuffer = &__pyx_pybuffer_xyz_traj_prev; + __pyx_pybuffer_xyz_traj_curr.pybuffer.buf = NULL; + __pyx_pybuffer_xyz_traj_curr.refcount = 0; + __pyx_pybuffernd_xyz_traj_curr.data = NULL; + __pyx_pybuffernd_xyz_traj_curr.rcbuffer = &__pyx_pybuffer_xyz_traj_curr; + __pyx_pybuffer_dimensions.pybuffer.buf = NULL; + __pyx_pybuffer_dimensions.refcount = 0; + __pyx_pybuffernd_dimensions.data = NULL; + __pyx_pybuffernd_dimensions.rcbuffer = &__pyx_pybuffer_dimensions; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_unfold, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 128, __pyx_L1_error) + } + __pyx_pybuffernd_xyz_unfold.diminfo[0].strides = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_unfold.diminfo[0].shape = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_unfold.diminfo[1].strides = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_unfold.diminfo[1].shape = __pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_traj_prev, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 128, __pyx_L1_error) + } + __pyx_pybuffernd_xyz_traj_prev.diminfo[0].strides = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_traj_prev.diminfo[0].shape = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_traj_prev.diminfo[1].strides = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_traj_prev.diminfo[1].shape = __pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz_traj_curr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 128, __pyx_L1_error) + } + __pyx_pybuffernd_xyz_traj_curr.diminfo[0].strides = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz_traj_curr.diminfo[0].shape = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz_traj_curr.diminfo[1].strides = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz_traj_curr.diminfo[1].shape = __pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dimensions.rcbuffer->pybuffer, (PyObject*)__pyx_v_dimensions, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 128, __pyx_L1_error) + } + __pyx_pybuffernd_dimensions.diminfo[0].strides = __pyx_pybuffernd_dimensions.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dimensions.diminfo[0].shape = __pyx_pybuffernd_dimensions.rcbuffer->pybuffer.shape[0]; - /* "View.MemoryView":1278 - * Check for overlapping memory and verify the shapes. + /* "newanalysis/helpers/unfold.pyx":159 * """ - * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i + * + * cdef double diag = np.round(dimensions[0],4) # <<<<<<<<<<<<<< + * cdef double offdiag = np.round(dimensions[3],4) + * cdef double norm = sqrt(diag*diag+2*offdiag*offdiag) */ - __pyx_v_tmpdata = NULL; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_round); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = 0; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_pybuffernd_dimensions.diminfo[0].shape; + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dimensions.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_dimensions.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_2, __pyx_int_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_diag = ((double)__pyx_t_7); - /* "View.MemoryView":1279 - * """ - * cdef void *tmpdata = NULL - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) + /* "newanalysis/helpers/unfold.pyx":160 + * + * cdef double diag = np.round(dimensions[0],4) + * cdef double offdiag = np.round(dimensions[3],4) # <<<<<<<<<<<<<< + * cdef double norm = sqrt(diag*diag+2*offdiag*offdiag) + * cdef double norm2 = norm/2.0, norm22 = norm2*norm2, norm32 = 2*norm/3.0 */ - __pyx_t_1 = __pyx_v_src.memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_round); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = 3; + if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_pybuffernd_dimensions.diminfo[0].shape; + __pyx_t_3 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_dimensions.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_dimensions.diminfo[0].strides))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_3, __pyx_int_4}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_offdiag = ((double)__pyx_t_7); - /* "View.MemoryView":1281 - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< - * cdef bint broadcasting = False - * cdef bint direct_copy = False + /* "newanalysis/helpers/unfold.pyx":161 + * cdef double diag = np.round(dimensions[0],4) + * cdef double offdiag = np.round(dimensions[3],4) + * cdef double norm = sqrt(diag*diag+2*offdiag*offdiag) # <<<<<<<<<<<<<< + * cdef double norm2 = norm/2.0, norm22 = norm2*norm2, norm32 = 2*norm/3.0 + * cdef double A = diag/norm, B = offdiag/norm, C = 1/sqrt(3) */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + __pyx_v_norm = sqrt(((__pyx_v_diag * __pyx_v_diag) + ((2.0 * __pyx_v_offdiag) * __pyx_v_offdiag))); + + /* "newanalysis/helpers/unfold.pyx":162 + * cdef double offdiag = np.round(dimensions[3],4) + * cdef double norm = sqrt(diag*diag+2*offdiag*offdiag) + * cdef double norm2 = norm/2.0, norm22 = norm2*norm2, norm32 = 2*norm/3.0 # <<<<<<<<<<<<<< + * cdef double A = diag/norm, B = offdiag/norm, C = 1/sqrt(3) + * cdef double DX, DY, DZ, D, T1, T2, T3 + */ + __pyx_v_norm2 = (__pyx_v_norm / 2.0); + __pyx_v_norm22 = (__pyx_v_norm2 * __pyx_v_norm2); + __pyx_v_norm32 = ((2.0 * __pyx_v_norm) / 3.0); - /* "View.MemoryView":1282 + /* "newanalysis/helpers/unfold.pyx":163 + * cdef double norm = sqrt(diag*diag+2*offdiag*offdiag) + * cdef double norm2 = norm/2.0, norm22 = norm2*norm2, norm32 = 2*norm/3.0 + * cdef double A = diag/norm, B = offdiag/norm, C = 1/sqrt(3) # <<<<<<<<<<<<<< + * cdef double DX, DY, DZ, D, T1, T2, T3 + * cdef int n = 3*len(xyz_unfold) + */ + if (unlikely(__pyx_v_norm == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 163, __pyx_L1_error) + } + __pyx_v_A = (__pyx_v_diag / __pyx_v_norm); + if (unlikely(__pyx_v_norm == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 163, __pyx_L1_error) + } + __pyx_v_B = (__pyx_v_offdiag / __pyx_v_norm); + __pyx_t_7 = sqrt(3.0); + if (unlikely(__pyx_t_7 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 163, __pyx_L1_error) + } + __pyx_v_C = (1.0 / __pyx_t_7); + + /* "newanalysis/helpers/unfold.pyx":165 + * cdef double A = diag/norm, B = offdiag/norm, C = 1/sqrt(3) + * cdef double DX, DY, DZ, D, T1, T2, T3 + * cdef int n = 3*len(xyz_unfold) # <<<<<<<<<<<<<< * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False # <<<<<<<<<<<<<< - * cdef bint direct_copy = False - * cdef __Pyx_memviewslice tmp + * cdef double *unfold = xyz_unfold.data */ - __pyx_v_broadcasting = 0; + __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_xyz_unfold)); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_v_n = (3 * __pyx_t_8); - /* "View.MemoryView":1283 - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False - * cdef bint direct_copy = False # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice tmp - * + /* "newanalysis/helpers/unfold.pyx":167 + * cdef int n = 3*len(xyz_unfold) + * cdef int i + * cdef double *unfold = xyz_unfold.data # <<<<<<<<<<<<<< + * cdef double *prev = xyz_traj_prev.data + * cdef double *curr = xyz_traj_curr.data */ - __pyx_v_direct_copy = 0; + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz_unfold)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_v_unfold = ((double *)__pyx_t_9); - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp + /* "newanalysis/helpers/unfold.pyx":168 + * cdef int i + * cdef double *unfold = xyz_unfold.data + * cdef double *prev = xyz_traj_prev.data # <<<<<<<<<<<<<< + * cdef double *curr = xyz_traj_curr.data * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: */ - __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz_traj_prev)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_v_prev = ((double *)__pyx_t_9); - /* "View.MemoryView":1287 + /* "newanalysis/helpers/unfold.pyx":169 + * cdef double *unfold = xyz_unfold.data + * cdef double *prev = xyz_traj_prev.data + * cdef double *curr = xyz_traj_curr.data # <<<<<<<<<<<<<< * - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) + * for i in range(0,n,3): */ - __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + __pyx_t_9 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz_traj_curr)); if (unlikely(__pyx_t_9 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_v_curr = ((double *)__pyx_t_9); - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp - * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) + /* "newanalysis/helpers/unfold.pyx":171 + * cdef double *curr = xyz_traj_curr.data * + * for i in range(0,n,3): # <<<<<<<<<<<<<< + * DX = curr[i] - prev[i] + * DY = curr[i+1] - prev[i+1] */ - __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_6 = __pyx_v_n; + __pyx_t_10 = __pyx_t_6; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=3) { + __pyx_v_i = __pyx_t_11; - /* "View.MemoryView":1289 - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/unfold.pyx":172 * - * cdef int ndim = max(src_ndim, dst_ndim) + * for i in range(0,n,3): + * DX = curr[i] - prev[i] # <<<<<<<<<<<<<< + * DY = curr[i+1] - prev[i+1] + * DZ = curr[i+2] - prev[i+2] */ - __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); + __pyx_v_DX = ((__pyx_v_curr[__pyx_v_i]) - (__pyx_v_prev[__pyx_v_i])); - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * + /* "newanalysis/helpers/unfold.pyx":173 + * for i in range(0,n,3): + * DX = curr[i] - prev[i] + * DY = curr[i+1] - prev[i+1] # <<<<<<<<<<<<<< + * DZ = curr[i+2] - prev[i+2] + * D = DX*DX+DY*DY+DZ*DZ */ - } - __pyx_L3:; + __pyx_v_DY = ((__pyx_v_curr[(__pyx_v_i + 1)]) - (__pyx_v_prev[(__pyx_v_i + 1)])); - /* "View.MemoryView":1291 - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * - * for i in range(ndim): + /* "newanalysis/helpers/unfold.pyx":174 + * DX = curr[i] - prev[i] + * DY = curr[i+1] - prev[i+1] + * DZ = curr[i+2] - prev[i+2] # <<<<<<<<<<<<<< + * D = DX*DX+DY*DY+DZ*DZ + * if D > norm22: # if there was a jump */ - __pyx_t_3 = __pyx_v_dst_ndim; - __pyx_t_4 = __pyx_v_src_ndim; - if (((__pyx_t_3 > __pyx_t_4) != 0)) { - __pyx_t_5 = __pyx_t_3; - } else { - __pyx_t_5 = __pyx_t_4; - } - __pyx_v_ndim = __pyx_t_5; + __pyx_v_DZ = ((__pyx_v_curr[(__pyx_v_i + 2)]) - (__pyx_v_prev[(__pyx_v_i + 2)])); - /* "View.MemoryView":1293 - * cdef int ndim = max(src_ndim, dst_ndim) - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: + /* "newanalysis/helpers/unfold.pyx":175 + * DY = curr[i+1] - prev[i+1] + * DZ = curr[i+2] - prev[i+2] + * D = DX*DX+DY*DY+DZ*DZ # <<<<<<<<<<<<<< + * if D > norm22: # if there was a jump + * T1 = DX*A+DY*B+DZ*B */ - __pyx_t_5 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_5; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_v_D = (((__pyx_v_DX * __pyx_v_DX) + (__pyx_v_DY * __pyx_v_DY)) + (__pyx_v_DZ * __pyx_v_DZ)); - /* "View.MemoryView":1294 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + /* "newanalysis/helpers/unfold.pyx":176 + * DZ = curr[i+2] - prev[i+2] + * D = DX*DX+DY*DY+DZ*DZ + * if D > norm22: # if there was a jump # <<<<<<<<<<<<<< + * T1 = DX*A+DY*B+DZ*B + * T2 = DX*B+DY*A+DZ*B */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0); - if (__pyx_t_2) { + __pyx_t_12 = (__pyx_v_D > __pyx_v_norm22); + if (__pyx_t_12) { - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/helpers/unfold.pyx":177 + * D = DX*DX+DY*DY+DZ*DZ + * if D > norm22: # if there was a jump + * T1 = DX*A+DY*B+DZ*B # <<<<<<<<<<<<<< + * T2 = DX*B+DY*A+DZ*B + * T3 = DX*B+DY*B+DZ*A */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { + __pyx_v_T1 = (((__pyx_v_DX * __pyx_v_A) + (__pyx_v_DY * __pyx_v_B)) + (__pyx_v_DZ * __pyx_v_B)); - /* "View.MemoryView":1296 - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - * broadcasting = True # <<<<<<<<<<<<<< - * src.strides[i] = 0 - * else: + /* "newanalysis/helpers/unfold.pyx":178 + * if D > norm22: # if there was a jump + * T1 = DX*A+DY*B+DZ*B + * T2 = DX*B+DY*A+DZ*B # <<<<<<<<<<<<<< + * T3 = DX*B+DY*B+DZ*A + * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis */ - __pyx_v_broadcasting = 1; + __pyx_v_T2 = (((__pyx_v_DX * __pyx_v_B) + (__pyx_v_DY * __pyx_v_A)) + (__pyx_v_DZ * __pyx_v_B)); - /* "View.MemoryView":1297 - * if src.shape[i] == 1: - * broadcasting = True - * src.strides[i] = 0 # <<<<<<<<<<<<<< - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) + /* "newanalysis/helpers/unfold.pyx":179 + * T1 = DX*A+DY*B+DZ*B + * T2 = DX*B+DY*A+DZ*B + * T3 = DX*B+DY*B+DZ*A # <<<<<<<<<<<<<< + * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis + * DX -= sign(T1)*norm*C */ - (__pyx_v_src.strides[__pyx_v_i]) = 0; + __pyx_v_T3 = (((__pyx_v_DX * __pyx_v_B) + (__pyx_v_DY * __pyx_v_B)) + (__pyx_v_DZ * __pyx_v_A)); - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/helpers/unfold.pyx":180 + * T2 = DX*B+DY*A+DZ*B + * T3 = DX*B+DY*B+DZ*A + * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis # <<<<<<<<<<<<<< + * DX -= sign(T1)*norm*C + * DY -= sign(T1)*norm*C */ - goto __pyx_L7; + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_12 = (__pyx_t_13 == __pyx_t_14); + if (__pyx_t_12) { + __pyx_t_15 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3); if (unlikely(__pyx_t_15 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_12 = (__pyx_t_14 == __pyx_t_15); } + if (__pyx_t_12) { - /* "View.MemoryView":1299 - * src.strides[i] = 0 - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< - * - * if src.suboffsets[i] >= 0: + /* "newanalysis/helpers/unfold.pyx":181 + * T3 = DX*B+DY*B+DZ*A + * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis + * DX -= sign(T1)*norm*C # <<<<<<<<<<<<<< + * DY -= sign(T1)*norm*C + * DZ -= sign(T1)*norm*C */ - /*else*/ { - __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1299, __pyx_L1_error) - } - __pyx_L7:; + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_v_DX = (__pyx_v_DX - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_C)); - /* "View.MemoryView":1294 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + /* "newanalysis/helpers/unfold.pyx":182 + * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis + * DX -= sign(T1)*norm*C + * DY -= sign(T1)*norm*C # <<<<<<<<<<<<<< + * DZ -= sign(T1)*norm*C + * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 */ - } + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_v_DY = (__pyx_v_DY - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_C)); - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) - * + /* "newanalysis/helpers/unfold.pyx":183 + * DX -= sign(T1)*norm*C + * DY -= sign(T1)*norm*C + * DZ -= sign(T1)*norm*C # <<<<<<<<<<<<<< + * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 + * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 */ - __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0); - if (__pyx_t_2) { + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error) + __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_C)); - /* "View.MemoryView":1302 - * - * if src.suboffsets[i] >= 0: - * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< - * - * if slices_overlap(&src, &dst, ndim, itemsize): + /* "newanalysis/helpers/unfold.pyx":180 + * T2 = DX*B+DY*A+DZ*B + * T3 = DX*B+DY*B+DZ*A + * if sign(T1) == sign(T2) == sign(T3): # jump across hexagon, non-orthogonal to basis # <<<<<<<<<<<<<< + * DX -= sign(T1)*norm*C + * DY -= sign(T1)*norm*C */ - __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1302, __pyx_L1_error) + goto __pyx_L6; + } - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) - * + /* "newanalysis/helpers/unfold.pyx":184 + * DY -= sign(T1)*norm*C + * DZ -= sign(T1)*norm*C + * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 # <<<<<<<<<<<<<< + * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 + * DX -= sign(T1)*norm*A */ - } - } + __pyx_t_12 = (((fabs((fabs(__pyx_v_T1) - fabs(__pyx_v_T2))) + fabs((fabs(__pyx_v_T1) - fabs(__pyx_v_T3)))) + fabs((fabs(__pyx_v_T2) - fabs(__pyx_v_T3)))) < __pyx_v_norm32); + if (__pyx_t_12) { - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): + /* "newanalysis/helpers/unfold.pyx":185 + * DZ -= sign(T1)*norm*C + * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 + * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 # <<<<<<<<<<<<<< + * DX -= sign(T1)*norm*A + * DY -= sign(T1)*norm*B */ - __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0); - if (__pyx_t_2) { + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_16 = (__pyx_t_14 == __pyx_t_13); + if (!__pyx_t_16) { + } else { + __pyx_t_12 = __pyx_t_16; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_16 = (__pyx_t_13 == __pyx_t_14); + __pyx_t_12 = __pyx_t_16; + __pyx_L8_bool_binop_done:; + if (__pyx_t_12) { - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * + /* "newanalysis/helpers/unfold.pyx":186 + * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 + * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 + * DX -= sign(T1)*norm*A # <<<<<<<<<<<<<< + * DY -= sign(T1)*norm*B + * DZ -= sign(T1)*norm*B */ - __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_v_DX = (__pyx_v_DX - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_A)); - /* "View.MemoryView":1307 - * - * if not slice_is_contig(src, order, ndim): - * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + /* "newanalysis/helpers/unfold.pyx":187 + * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 + * DX -= sign(T1)*norm*A + * DY -= sign(T1)*norm*B # <<<<<<<<<<<<<< + * DZ -= sign(T1)*norm*B + * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L1_error) + __pyx_v_DY = (__pyx_v_DY - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * + /* "newanalysis/helpers/unfold.pyx":188 + * DX -= sign(T1)*norm*A + * DY -= sign(T1)*norm*B + * DZ -= sign(T1)*norm*B # <<<<<<<<<<<<<< + * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 + * DX -= sign(T2)*norm*B */ - } + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L1_error) + __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1309 - * order = get_best_order(&dst, ndim) - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< - * src = tmp - * + /* "newanalysis/helpers/unfold.pyx":185 + * DZ -= sign(T1)*norm*C + * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 + * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 # <<<<<<<<<<<<<< + * DX -= sign(T1)*norm*A + * DY -= sign(T1)*norm*B */ - __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1309, __pyx_L1_error) - __pyx_v_tmpdata = __pyx_t_7; + } - /* "View.MemoryView":1310 - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) - * src = tmp # <<<<<<<<<<<<<< - * - * if not broadcasting: + /* "newanalysis/helpers/unfold.pyx":189 + * DY -= sign(T1)*norm*B + * DZ -= sign(T1)*norm*B + * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 # <<<<<<<<<<<<<< + * DX -= sign(T2)*norm*B + * DY -= sign(T2)*norm*A */ - __pyx_v_src = __pyx_v_tmp; + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_16 = (__pyx_t_14 == __pyx_t_13); + if (!__pyx_t_16) { + } else { + __pyx_t_12 = __pyx_t_16; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_16 = (__pyx_t_13 == __pyx_t_14); + __pyx_t_12 = __pyx_t_16; + __pyx_L11_bool_binop_done:; + if (__pyx_t_12) { - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): + /* "newanalysis/helpers/unfold.pyx":190 + * DZ -= sign(T1)*norm*B + * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 + * DX -= sign(T2)*norm*B # <<<<<<<<<<<<<< + * DY -= sign(T2)*norm*A + * DZ -= sign(T2)*norm*B */ - } + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_v_DX = (__pyx_v_DX - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/unfold.pyx":191 + * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 + * DX -= sign(T2)*norm*B + * DY -= sign(T2)*norm*A # <<<<<<<<<<<<<< + * DZ -= sign(T2)*norm*B + * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 */ - __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error) + __pyx_v_DY = (__pyx_v_DY - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_A)); - /* "View.MemoryView":1315 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + /* "newanalysis/helpers/unfold.pyx":192 + * DX -= sign(T2)*norm*B + * DY -= sign(T2)*norm*A + * DZ -= sign(T2)*norm*B # <<<<<<<<<<<<<< + * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 + * DX -= sign(T3)*norm*B */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1316 - * - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/helpers/unfold.pyx":189 + * DY -= sign(T1)*norm*B + * DZ -= sign(T1)*norm*B + * if sign(T2) == sign(T1) or sign(T2)==sign(T3): # if T2 has an equal sign as T1 or T3 # <<<<<<<<<<<<<< + * DX -= sign(T2)*norm*B + * DY -= sign(T2)*norm*A */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + } - /* "View.MemoryView":1315 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + /* "newanalysis/helpers/unfold.pyx":193 + * DY -= sign(T2)*norm*A + * DZ -= sign(T2)*norm*B + * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 # <<<<<<<<<<<<<< + * DX -= sign(T3)*norm*B + * DY -= sign(T3)*norm*B */ - goto __pyx_L12; - } + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_16 = (__pyx_t_14 == __pyx_t_13); + if (!__pyx_t_16) { + } else { + __pyx_t_12 = __pyx_t_16; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_13 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3); if (unlikely(__pyx_t_13 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_t_16 = (__pyx_t_13 == __pyx_t_14); + __pyx_t_12 = __pyx_t_16; + __pyx_L14_bool_binop_done:; + if (__pyx_t_12) { - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) - * + /* "newanalysis/helpers/unfold.pyx":194 + * DZ -= sign(T2)*norm*B + * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 + * DX -= sign(T3)*norm*B # <<<<<<<<<<<<<< + * DY -= sign(T3)*norm*B + * DZ -= sign(T3)*norm*A */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_v_DX = (__pyx_v_DX - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1318 - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< - * - * if direct_copy: + /* "newanalysis/helpers/unfold.pyx":195 + * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 + * DX -= sign(T3)*norm*B + * DY -= sign(T3)*norm*B # <<<<<<<<<<<<<< + * DZ -= sign(T3)*norm*A + * else: # jump across one of three hexagons, orthogonal to a basis vector */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_v_DY = (__pyx_v_DY - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) - * + /* "newanalysis/helpers/unfold.pyx":196 + * DX -= sign(T3)*norm*B + * DY -= sign(T3)*norm*B + * DZ -= sign(T3)*norm*A # <<<<<<<<<<<<<< + * else: # jump across one of three hexagons, orthogonal to a basis vector + * if fabs(T1) > norm2: */ - } - __pyx_L12:; + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_A)); - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) + /* "newanalysis/helpers/unfold.pyx":193 + * DY -= sign(T2)*norm*A + * DZ -= sign(T2)*norm*B + * if sign(T3) == sign(T1) or sign(T3)==sign(T2): # if T3 has an equal sign as T1 or T2 # <<<<<<<<<<<<<< + * DX -= sign(T3)*norm*B + * DY -= sign(T3)*norm*B */ - __pyx_t_2 = (__pyx_v_direct_copy != 0); - if (__pyx_t_2) { + } - /* "View.MemoryView":1322 - * if direct_copy: - * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) + /* "newanalysis/helpers/unfold.pyx":184 + * DY -= sign(T1)*norm*C + * DZ -= sign(T1)*norm*C + * elif fabs(fabs(T1)-fabs(T2))+fabs(fabs(T1)-fabs(T3))+fabs(fabs(T2)-fabs(T3)) < norm32: # jump across squares, differences in absolute Ts should be ~ 0 # <<<<<<<<<<<<<< + * if sign(T1) == sign(T2) or sign(T1)==sign(T3): # if T1 has an equal sign as T2 or T3 + * DX -= sign(T1)*norm*A */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + goto __pyx_L6; + } - /* "View.MemoryView":1323 - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) + /* "newanalysis/helpers/unfold.pyx":198 + * DZ -= sign(T3)*norm*A + * else: # jump across one of three hexagons, orthogonal to a basis vector + * if fabs(T1) > norm2: # <<<<<<<<<<<<<< + * DX -= sign(T1)*norm*A + * DY -= sign(T1)*norm*B */ - (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + /*else*/ { + __pyx_t_12 = (fabs(__pyx_v_T1) > __pyx_v_norm2); + if (__pyx_t_12) { - /* "View.MemoryView":1324 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * free(tmpdata) - * return 0 + /* "newanalysis/helpers/unfold.pyx":199 + * else: # jump across one of three hexagons, orthogonal to a basis vector + * if fabs(T1) > norm2: + * DX -= sign(T1)*norm*A # <<<<<<<<<<<<<< + * DY -= sign(T1)*norm*B + * DZ -= sign(T1)*norm*B */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_v_DX = (__pyx_v_DX - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_A)); - /* "View.MemoryView":1325 - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 - * + /* "newanalysis/helpers/unfold.pyx":200 + * if fabs(T1) > norm2: + * DX -= sign(T1)*norm*A + * DY -= sign(T1)*norm*B # <<<<<<<<<<<<<< + * DZ -= sign(T1)*norm*B + * if fabs(T2) > norm2: */ - free(__pyx_v_tmpdata); + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_v_DY = (__pyx_v_DY - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1326 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< - * - * if order == 'F' == get_best_order(&dst, ndim): + /* "newanalysis/helpers/unfold.pyx":201 + * DX -= sign(T1)*norm*A + * DY -= sign(T1)*norm*B + * DZ -= sign(T1)*norm*B # <<<<<<<<<<<<<< + * if fabs(T2) > norm2: + * DX -= sign(T2)*norm*B */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T1); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) + /* "newanalysis/helpers/unfold.pyx":198 + * DZ -= sign(T3)*norm*A + * else: # jump across one of three hexagons, orthogonal to a basis vector + * if fabs(T1) > norm2: # <<<<<<<<<<<<<< + * DX -= sign(T1)*norm*A + * DY -= sign(T1)*norm*B */ - } + } - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/unfold.pyx":202 + * DY -= sign(T1)*norm*B + * DZ -= sign(T1)*norm*B + * if fabs(T2) > norm2: # <<<<<<<<<<<<<< + * DX -= sign(T2)*norm*B + * DY -= sign(T2)*norm*A */ - } + __pyx_t_12 = (fabs(__pyx_v_T2) > __pyx_v_norm2); + if (__pyx_t_12) { - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/unfold.pyx":203 + * DZ -= sign(T1)*norm*B + * if fabs(T2) > norm2: + * DX -= sign(T2)*norm*B # <<<<<<<<<<<<<< + * DY -= sign(T2)*norm*A + * DZ -= sign(T2)*norm*B */ - __pyx_t_2 = (__pyx_v_order == 'F'); - if (__pyx_t_2) { - __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); - } - __pyx_t_8 = (__pyx_t_2 != 0); - if (__pyx_t_8) { + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_v_DX = (__pyx_v_DX - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1331 - * - * - * transpose_memslice(&src) # <<<<<<<<<<<<<< - * transpose_memslice(&dst) - * + /* "newanalysis/helpers/unfold.pyx":204 + * if fabs(T2) > norm2: + * DX -= sign(T2)*norm*B + * DY -= sign(T2)*norm*A # <<<<<<<<<<<<<< + * DZ -= sign(T2)*norm*B + * if fabs(T3) > norm2: */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1331, __pyx_L1_error) + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_v_DY = (__pyx_v_DY - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_A)); - /* "View.MemoryView":1332 - * - * transpose_memslice(&src) - * transpose_memslice(&dst) # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) + /* "newanalysis/helpers/unfold.pyx":205 + * DX -= sign(T2)*norm*B + * DY -= sign(T2)*norm*A + * DZ -= sign(T2)*norm*B # <<<<<<<<<<<<<< + * if fabs(T3) > norm2: + * DX -= sign(T3)*norm*B */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1332, __pyx_L1_error) + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T2); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * + /* "newanalysis/helpers/unfold.pyx":202 + * DY -= sign(T1)*norm*B + * DZ -= sign(T1)*norm*B + * if fabs(T2) > norm2: # <<<<<<<<<<<<<< + * DX -= sign(T2)*norm*B + * DY -= sign(T2)*norm*A */ - } + } - /* "View.MemoryView":1334 - * transpose_memslice(&dst) - * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) + /* "newanalysis/helpers/unfold.pyx":206 + * DY -= sign(T2)*norm*A + * DZ -= sign(T2)*norm*B + * if fabs(T3) > norm2: # <<<<<<<<<<<<<< + * DX -= sign(T3)*norm*B + * DY -= sign(T3)*norm*B */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1335 - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) - * - */ - copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - - /* "View.MemoryView":1336 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * - * free(tmpdata) - */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - - /* "View.MemoryView":1338 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 - * - */ - free(__pyx_v_tmpdata); - - /* "View.MemoryView":1339 - * - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_broadcast_leading') - */ - __pyx_r = 0; - goto __pyx_L0; - - /* "View.MemoryView":1270 - * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ - - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = -1; - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1342 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: - */ - -static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { - int __pyx_v_i; - int __pyx_v_offset; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - - /* "View.MemoryView":1346 - * int ndim_other) nogil: - * cdef int i - * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): - */ - __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); + __pyx_t_12 = (fabs(__pyx_v_T3) > __pyx_v_norm2); + if (__pyx_t_12) { - /* "View.MemoryView":1348 - * cdef int offset = ndim_other - ndim - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] + /* "newanalysis/helpers/unfold.pyx":207 + * DZ -= sign(T2)*norm*B + * if fabs(T3) > norm2: + * DX -= sign(T3)*norm*B # <<<<<<<<<<<<<< + * DY -= sign(T3)*norm*B + * DZ -= sign(T3)*norm*A */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_v_DX = (__pyx_v_DX - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1349 - * - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] + /* "newanalysis/helpers/unfold.pyx":208 + * if fabs(T3) > norm2: + * DX -= sign(T3)*norm*B + * DY -= sign(T3)*norm*B # <<<<<<<<<<<<<< + * DZ -= sign(T3)*norm*A + * unfold[i] += DX */ - (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_v_DY = (__pyx_v_DY - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_B)); - /* "View.MemoryView":1350 - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - * + /* "newanalysis/helpers/unfold.pyx":209 + * DX -= sign(T3)*norm*B + * DY -= sign(T3)*norm*B + * DZ -= sign(T3)*norm*A # <<<<<<<<<<<<<< + * unfold[i] += DX + * unfold[i+1] += DY */ - (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + __pyx_t_14 = __pyx_f_11newanalysis_6unfold_sign(__pyx_v_T3); if (unlikely(__pyx_t_14 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_v_DZ = (__pyx_v_DZ - ((__pyx_t_14 * __pyx_v_norm) * __pyx_v_A)); - /* "View.MemoryView":1351 - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< - * - * for i in range(offset): + /* "newanalysis/helpers/unfold.pyx":206 + * DY -= sign(T2)*norm*A + * DZ -= sign(T2)*norm*B + * if fabs(T3) > norm2: # <<<<<<<<<<<<<< + * DX -= sign(T3)*norm*B + * DY -= sign(T3)*norm*B */ - (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); - } + } + } + __pyx_L6:; - /* "View.MemoryView":1353 - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - * - * for i in range(offset): # <<<<<<<<<<<<<< - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] + /* "newanalysis/helpers/unfold.pyx":176 + * DZ = curr[i+2] - prev[i+2] + * D = DX*DX+DY*DY+DZ*DZ + * if D > norm22: # if there was a jump # <<<<<<<<<<<<<< + * T1 = DX*A+DY*B+DZ*B + * T2 = DX*B+DY*A+DZ*B */ - __pyx_t_1 = __pyx_v_offset; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + } - /* "View.MemoryView":1354 - * - * for i in range(offset): - * mslice.shape[i] = 1 # <<<<<<<<<<<<<< - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 + /* "newanalysis/helpers/unfold.pyx":210 + * DY -= sign(T3)*norm*B + * DZ -= sign(T3)*norm*A + * unfold[i] += DX # <<<<<<<<<<<<<< + * unfold[i+1] += DY + * unfold[i+2] += DZ */ - (__pyx_v_mslice->shape[__pyx_v_i]) = 1; + __pyx_t_14 = __pyx_v_i; + (__pyx_v_unfold[__pyx_t_14]) = ((__pyx_v_unfold[__pyx_t_14]) + __pyx_v_DX); - /* "View.MemoryView":1355 - * for i in range(offset): - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< - * mslice.suboffsets[i] = -1 + /* "newanalysis/helpers/unfold.pyx":211 + * DZ -= sign(T3)*norm*A + * unfold[i] += DX + * unfold[i+1] += DY # <<<<<<<<<<<<<< + * unfold[i+2] += DZ * */ - (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); + __pyx_t_17 = (__pyx_v_i + 1); + (__pyx_v_unfold[__pyx_t_17]) = ((__pyx_v_unfold[__pyx_t_17]) + __pyx_v_DY); - /* "View.MemoryView":1356 - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + /* "newanalysis/helpers/unfold.pyx":212 + * unfold[i] += DX + * unfold[i+1] += DY + * unfold[i+2] += DZ # <<<<<<<<<<<<<< * * */ - (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + __pyx_t_17 = (__pyx_v_i + 2); + (__pyx_v_unfold[__pyx_t_17]) = ((__pyx_v_unfold[__pyx_t_17]) + __pyx_v_DZ); } - /* "View.MemoryView":1342 + /* "newanalysis/helpers/unfold.pyx":128 + * unfold[i+2] += DZ * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldCharmmOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, + * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dimensions.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.unfold.unfoldCharmmOcta", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dimensions.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_curr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_traj_prev.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz_unfold.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1364 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: - * - */ - -static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - int __pyx_t_1; - - /* "View.MemoryView":1368 - * - * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) - */ - __pyx_t_1 = (__pyx_v_dtype_is_object != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1369 - * - * if dtype_is_object: - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< - * dst.strides, ndim, inc) - * - */ - __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); - - /* "View.MemoryView":1368 - * - * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) - */ - } - - /* "View.MemoryView":1364 +/* "newanalysis/helpers/unfold.pyx":215 * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: - * - */ - - /* function exit code */ -} - -/* "View.MemoryView":1373 * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistBox(np.ndarray[np.float64_t,ndim=1,mode="c"] aufpunkt, + * np.ndarray[np.float64_t,ndim=2,mode="c"] com, */ -static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6unfold_7minDistBox(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_6unfold_6minDistBox, "\n translateBox(vec, com, xyz, boxlength, atoms_per_residue, residue_first_atom)\n\n Translate the box by a given vector\n\n Args:\n aufpunkt .. vector by which the coordinates are translated\n com .. centers of mass of all molecules in the box\n xyz .. coordinates of all atoms\n boxlength .. edge length of the cubic box\n atoms_per_residue .. array showing how many atoms each residue contains\n residue_first_atom .. index of the first atom of each residue\n "); +static PyMethodDef __pyx_mdef_11newanalysis_6unfold_7minDistBox = {"minDistBox", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6unfold_7minDistBox, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_6minDistBox}; +static PyObject *__pyx_pw_11newanalysis_6unfold_7minDistBox(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_aufpunkt = 0; + PyArrayObject *__pyx_v_com = 0; + PyArrayObject *__pyx_v_xyz = 0; + PyObject *__pyx_v_boxlength = 0; + PyArrayObject *__pyx_v_atoms_per_residue = 0; + PyArrayObject *__pyx_v_residue_first_atom = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + __Pyx_RefNannySetupContext("minDistBox (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 215, __pyx_L3_error) #endif - __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - - /* "View.MemoryView":1376 - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - - /* "View.MemoryView":1373 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - */ + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_com,&__pyx_n_s_xyz,&__pyx_n_s_boxlength,&__pyx_n_s_atoms_per_residue,&__pyx_n_s_residue_first_atom,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_com)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, 1); __PYX_ERR(0, 215, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, 2); __PYX_ERR(0, 215, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, 3); __PYX_ERR(0, 215, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_atoms_per_residue)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, 4); __PYX_ERR(0, 215, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_residue_first_atom)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, 5); __PYX_ERR(0, 215, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "minDistBox") < 0)) __PYX_ERR(0, 215, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 6)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + } + __pyx_v_aufpunkt = ((PyArrayObject *)values[0]); + __pyx_v_com = ((PyArrayObject *)values[1]); + __pyx_v_xyz = ((PyArrayObject *)values[2]); + __pyx_v_boxlength = values[3]; + __pyx_v_atoms_per_residue = ((PyArrayObject *)values[4]); + __pyx_v_residue_first_atom = ((PyArrayObject *)values[5]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("minDistBox", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 215, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.unfold.minDistBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_aufpunkt), __pyx_ptype_5numpy_ndarray, 1, "aufpunkt", 0))) __PYX_ERR(0, 216, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_com), __pyx_ptype_5numpy_ndarray, 1, "com", 0))) __PYX_ERR(0, 217, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 218, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_atoms_per_residue), __pyx_ptype_5numpy_ndarray, 1, "atoms_per_residue", 0))) __PYX_ERR(0, 220, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_residue_first_atom), __pyx_ptype_5numpy_ndarray, 1, "residue_first_atom", 0))) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6unfold_6minDistBox(__pyx_self, __pyx_v_aufpunkt, __pyx_v_com, __pyx_v_xyz, __pyx_v_boxlength, __pyx_v_atoms_per_residue, __pyx_v_residue_first_atom); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + return __pyx_r; } -/* "View.MemoryView":1379 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i - */ - -static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; +static PyObject *__pyx_pf_11newanalysis_6unfold_6minDistBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_aufpunkt, PyArrayObject *__pyx_v_com, PyArrayObject *__pyx_v_xyz, PyObject *__pyx_v_boxlength, PyArrayObject *__pyx_v_atoms_per_residue, PyArrayObject *__pyx_v_residue_first_atom) { + double __pyx_v_shift[3]; + double *__pyx_v_auf; + double __pyx_v_boxl; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_nmol; + double *__pyx_v_ccom; + double *__pyx_v_cxyz; + int *__pyx_v_apr; + int *__pyx_v_rfa; + CYTHON_UNUSED int __pyx_v_natom; + __Pyx_LocalBuf_ND __pyx_pybuffernd_atoms_per_residue; + __Pyx_Buffer __pyx_pybuffer_atoms_per_residue; + __Pyx_LocalBuf_ND __pyx_pybuffernd_aufpunkt; + __Pyx_Buffer __pyx_pybuffer_aufpunkt; + __Pyx_LocalBuf_ND __pyx_pybuffernd_com; + __Pyx_Buffer __pyx_pybuffer_com; + __Pyx_LocalBuf_ND __pyx_pybuffernd_residue_first_atom; + __Pyx_Buffer __pyx_pybuffer_residue_first_atom; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; + __Pyx_Buffer __pyx_pybuffer_xyz; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; + char *__pyx_t_1; + double __pyx_t_2; Py_ssize_t __pyx_t_3; int __pyx_t_4; - __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + long __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("minDistBox", 0); + __pyx_pybuffer_aufpunkt.pybuffer.buf = NULL; + __pyx_pybuffer_aufpunkt.refcount = 0; + __pyx_pybuffernd_aufpunkt.data = NULL; + __pyx_pybuffernd_aufpunkt.rcbuffer = &__pyx_pybuffer_aufpunkt; + __pyx_pybuffer_com.pybuffer.buf = NULL; + __pyx_pybuffer_com.refcount = 0; + __pyx_pybuffernd_com.data = NULL; + __pyx_pybuffernd_com.rcbuffer = &__pyx_pybuffer_com; + __pyx_pybuffer_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_xyz.refcount = 0; + __pyx_pybuffernd_xyz.data = NULL; + __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; + __pyx_pybuffer_atoms_per_residue.pybuffer.buf = NULL; + __pyx_pybuffer_atoms_per_residue.refcount = 0; + __pyx_pybuffernd_atoms_per_residue.data = NULL; + __pyx_pybuffernd_atoms_per_residue.rcbuffer = &__pyx_pybuffer_atoms_per_residue; + __pyx_pybuffer_residue_first_atom.pybuffer.buf = NULL; + __pyx_pybuffer_residue_first_atom.refcount = 0; + __pyx_pybuffernd_residue_first_atom.data = NULL; + __pyx_pybuffernd_residue_first_atom.rcbuffer = &__pyx_pybuffer_residue_first_atom; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer, (PyObject*)__pyx_v_aufpunkt, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 215, __pyx_L1_error) + } + __pyx_pybuffernd_aufpunkt.diminfo[0].strides = __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_aufpunkt.diminfo[0].shape = __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_com.rcbuffer->pybuffer, (PyObject*)__pyx_v_com, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 215, __pyx_L1_error) + } + __pyx_pybuffernd_com.diminfo[0].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_com.diminfo[0].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_com.diminfo[1].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_com.diminfo[1].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 215, __pyx_L1_error) + } + __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer, (PyObject*)__pyx_v_atoms_per_residue, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 215, __pyx_L1_error) + } + __pyx_pybuffernd_atoms_per_residue.diminfo[0].strides = __pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_atoms_per_residue.diminfo[0].shape = __pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer, (PyObject*)__pyx_v_residue_first_atom, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 215, __pyx_L1_error) + } + __pyx_pybuffernd_residue_first_atom.diminfo[0].strides = __pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_residue_first_atom.diminfo[0].shape = __pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer.shape[0]; - /* "View.MemoryView":1383 - * cdef Py_ssize_t i + /* "newanalysis/helpers/unfold.pyx":237 * - * for i in range(shape[0]): # <<<<<<<<<<<<<< - * if ndim == 1: - * if inc: + * cdef double[3] shift + * cdef double* auf = aufpunkt.data # <<<<<<<<<<<<<< + * cdef double boxl = boxlength + * cdef int i, j, k, nmol=len(com) */ - __pyx_t_1 = (__pyx_v_shape[0]); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_aufpunkt)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_v_auf = ((double *)__pyx_t_1); - /* "View.MemoryView":1384 - * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) + /* "newanalysis/helpers/unfold.pyx":238 + * cdef double[3] shift + * cdef double* auf = aufpunkt.data + * cdef double boxl = boxlength # <<<<<<<<<<<<<< + * cdef int i, j, k, nmol=len(com) + * cdef double *ccom = com.data */ - __pyx_t_4 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_4) { + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_boxlength); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_v_boxl = ((double)__pyx_t_2); - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: + /* "newanalysis/helpers/unfold.pyx":239 + * cdef double* auf = aufpunkt.data + * cdef double boxl = boxlength + * cdef int i, j, k, nmol=len(com) # <<<<<<<<<<<<<< + * cdef double *ccom = com.data + * cdef double *cxyz = xyz.data */ - __pyx_t_4 = (__pyx_v_inc != 0); - if (__pyx_t_4) { + __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_com)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_v_nmol = __pyx_t_3; - /* "View.MemoryView":1386 - * if ndim == 1: - * if inc: - * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * Py_DECREF(( data)[0]) + /* "newanalysis/helpers/unfold.pyx":240 + * cdef double boxl = boxlength + * cdef int i, j, k, nmol=len(com) + * cdef double *ccom = com.data # <<<<<<<<<<<<<< + * cdef double *cxyz = xyz.data + * cdef int* apr = atoms_per_residue.data */ - Py_INCREF((((PyObject **)__pyx_v_data)[0])); + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_com)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_v_ccom = ((double *)__pyx_t_1); - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: + /* "newanalysis/helpers/unfold.pyx":241 + * cdef int i, j, k, nmol=len(com) + * cdef double *ccom = com.data + * cdef double *cxyz = xyz.data # <<<<<<<<<<<<<< + * cdef int* apr = atoms_per_residue.data + * cdef int* rfa = residue_first_atom.data */ - goto __pyx_L6; - } + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_v_cxyz = ((double *)__pyx_t_1); - /* "View.MemoryView":1388 - * Py_INCREF(( data)[0]) - * else: - * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, + /* "newanalysis/helpers/unfold.pyx":242 + * cdef double *ccom = com.data + * cdef double *cxyz = xyz.data + * cdef int* apr = atoms_per_residue.data # <<<<<<<<<<<<<< + * cdef int* rfa = residue_first_atom.data + * cdef int natom = len(xyz) */ - /*else*/ { - Py_DECREF((((PyObject **)__pyx_v_data)[0])); - } - __pyx_L6:; + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_atoms_per_residue)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_v_apr = ((int *)__pyx_t_1); - /* "View.MemoryView":1384 - * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) - */ - goto __pyx_L5; - } - - /* "View.MemoryView":1390 - * Py_DECREF(( data)[0]) - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, inc) + /* "newanalysis/helpers/unfold.pyx":243 + * cdef double *cxyz = xyz.data + * cdef int* apr = atoms_per_residue.data + * cdef int* rfa = residue_first_atom.data # <<<<<<<<<<<<<< + * cdef int natom = len(xyz) * */ - /*else*/ { - - /* "View.MemoryView":1391 - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, - * ndim - 1, inc) # <<<<<<<<<<<<<< - * - * data += strides[0] - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); - } - __pyx_L5:; + __pyx_t_1 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_residue_first_atom)); if (unlikely(__pyx_t_1 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_v_rfa = ((int *)__pyx_t_1); - /* "View.MemoryView":1393 - * ndim - 1, inc) - * - * data += strides[0] # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/unfold.pyx":244 + * cdef int* apr = atoms_per_residue.data + * cdef int* rfa = residue_first_atom.data + * cdef int natom = len(xyz) # <<<<<<<<<<<<<< * + * for i in range(nmol): */ - __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0])); - } + __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 244, __pyx_L1_error) + __pyx_v_natom = ((int)__pyx_t_3); - /* "View.MemoryView":1379 + /* "newanalysis/helpers/unfold.pyx":246 + * cdef int natom = len(xyz) * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i + * for i in range(nmol): # <<<<<<<<<<<<<< + * for j in range(3): + * ccom[i*3+j]-=auf[j] */ + __pyx_t_4 = __pyx_v_nmol; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":1399 + /* "newanalysis/helpers/unfold.pyx":247 * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - */ - -static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - - /* "View.MemoryView":1402 - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) + * for i in range(nmol): + * for j in range(3): # <<<<<<<<<<<<<< + * ccom[i*3+j]-=auf[j] + * shift[j] = boxl*floor(ccom[i*3+j]/boxl + 0.5) */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) { + __pyx_v_j = __pyx_t_7; - /* "View.MemoryView":1403 - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) + /* "newanalysis/helpers/unfold.pyx":248 + * for i in range(nmol): + * for j in range(3): + * ccom[i*3+j]-=auf[j] # <<<<<<<<<<<<<< + * shift[j] = boxl*floor(ccom[i*3+j]/boxl + 0.5) + * ccom[i*3+j]-=shift[j] */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); + __pyx_t_8 = ((__pyx_v_i * 3) + __pyx_v_j); + (__pyx_v_ccom[__pyx_t_8]) = ((__pyx_v_ccom[__pyx_t_8]) - (__pyx_v_auf[__pyx_v_j])); - /* "View.MemoryView":1405 - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/unfold.pyx":249 + * for j in range(3): + * ccom[i*3+j]-=auf[j] + * shift[j] = boxl*floor(ccom[i*3+j]/boxl + 0.5) # <<<<<<<<<<<<<< + * ccom[i*3+j]-=shift[j] * */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + __pyx_t_2 = (__pyx_v_ccom[((__pyx_v_i * 3) + __pyx_v_j)]); + if (unlikely(__pyx_v_boxl == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 249, __pyx_L1_error) + } + (__pyx_v_shift[__pyx_v_j]) = (__pyx_v_boxl * floor(((__pyx_t_2 / __pyx_v_boxl) + 0.5))); - /* "View.MemoryView":1399 + /* "newanalysis/helpers/unfold.pyx":250 + * ccom[i*3+j]-=auf[j] + * shift[j] = boxl*floor(ccom[i*3+j]/boxl + 0.5) + * ccom[i*3+j]-=shift[j] # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: + * for k in range(rfa[i],rfa[i]+apr[i]): */ + __pyx_t_8 = ((__pyx_v_i * 3) + __pyx_v_j); + (__pyx_v_ccom[__pyx_t_8]) = ((__pyx_v_ccom[__pyx_t_8]) - (__pyx_v_shift[__pyx_v_j])); + } - /* function exit code */ -} - -/* "View.MemoryView":1409 + /* "newanalysis/helpers/unfold.pyx":252 + * ccom[i*3+j]-=shift[j] * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: + * for k in range(rfa[i],rfa[i]+apr[i]): # <<<<<<<<<<<<<< + * for j in range(3): + * cxyz[k*3+j]-= shift[j] */ + __pyx_t_7 = ((__pyx_v_rfa[__pyx_v_i]) + (__pyx_v_apr[__pyx_v_i])); + __pyx_t_9 = __pyx_t_7; + for (__pyx_t_10 = (__pyx_v_rfa[__pyx_v_i]); __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_k = __pyx_t_10; -static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_extent; - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - - /* "View.MemoryView":1413 - * size_t itemsize, void *item) nogil: - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t extent = shape[0] + /* "newanalysis/helpers/unfold.pyx":253 * - */ - __pyx_v_stride = (__pyx_v_strides[0]); - - /* "View.MemoryView":1414 - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] - * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< + * for k in range(rfa[i],rfa[i]+apr[i]): + * for j in range(3): # <<<<<<<<<<<<<< + * cxyz[k*3+j]-= shift[j] * - * if ndim == 1: */ - __pyx_v_extent = (__pyx_v_shape[0]); + for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) { + __pyx_v_j = __pyx_t_11; - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] + /* "newanalysis/helpers/unfold.pyx":254 + * for k in range(rfa[i],rfa[i]+apr[i]): + * for j in range(3): + * cxyz[k*3+j]-= shift[j] # <<<<<<<<<<<<<< * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) - */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1417 * - * if ndim == 1: - * for i in range(extent): # <<<<<<<<<<<<<< - * memcpy(data, item, itemsize) - * data += stride - */ - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1418 - * if ndim == 1: - * for i in range(extent): - * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< - * data += stride - * else: - */ - (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - - /* "View.MemoryView":1419 - * for i in range(extent): - * memcpy(data, item, itemsize) - * data += stride # <<<<<<<<<<<<<< - * else: - * for i in range(extent): */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + __pyx_t_8 = ((__pyx_v_k * 3) + __pyx_v_j); + (__pyx_v_cxyz[__pyx_t_8]) = ((__pyx_v_cxyz[__pyx_t_8]) - (__pyx_v_shift[__pyx_v_j])); + } } - - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) - */ - goto __pyx_L3; } - /* "View.MemoryView":1421 - * data += stride - * else: - * for i in range(extent): # <<<<<<<<<<<<<< - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - */ - /*else*/ { - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1422 - * else: - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, itemsize, item) - * data += stride - */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - - /* "View.MemoryView":1424 - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - * data += stride # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/unfold.pyx":215 * - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - } - __pyx_L3:; - - /* "View.MemoryView":1409 * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistBox(np.ndarray[np.float64_t,ndim=1,mode="c"] aufpunkt, + * np.ndarray[np.float64_t,ndim=2,mode="c"] com, */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.unfold.minDistBox", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_atoms_per_residue.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_residue_first_atom.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result +/* "newanalysis/helpers/unfold.pyx":257 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistCenterBox(np.ndarray[np.float64_t,ndim=1,mode='c'] aufpunkt, + * np.ndarray[np.float64_t,ndim=2,mode='c'] com, */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; +static PyObject *__pyx_pw_11newanalysis_6unfold_9minDistCenterBox(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_6unfold_8minDistCenterBox, "\n translateBox(vec, com, xyz, boxlength, atoms_per_residue, residue_first_atom)\n\n Translate the box by a given vector\n\n Args:\n aufpunkt .. vector by which the coordinates are translated\n com .. centers of mass of all molecules in the box\n xyz .. coordinates of all atoms\n boxlength .. edge length of the cubic box\n atoms_per_residue .. array showing how many atoms each residue contains\n residue_first_atom .. index of the first atom of each residue\n "); +static PyMethodDef __pyx_mdef_11newanalysis_6unfold_9minDistCenterBox = {"minDistCenterBox", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6unfold_9minDistCenterBox, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_8minDistCenterBox}; +static PyObject *__pyx_pw_11newanalysis_6unfold_9minDistCenterBox(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_aufpunkt = 0; + PyArrayObject *__pyx_v_com = 0; + PyArrayObject *__pyx_v_coor = 0; + __pyx_t_5numpy_float64_t __pyx_v_boxl; + PyArrayObject *__pyx_v_apr = 0; + PyArrayObject *__pyx_v_rfa = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + __Pyx_RefNannySetupContext("minDistCenterBox (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 257, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aufpunkt,&__pyx_n_s_com,&__pyx_n_s_coor,&__pyx_n_s_boxl,&__pyx_n_s_apr,&__pyx_n_s_rfa,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_aufpunkt)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_com)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, 1); __PYX_ERR(0, 257, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, 2); __PYX_ERR(0, 257, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, 3); __PYX_ERR(0, 257, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, 4); __PYX_ERR(0, 257, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rfa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, 5); __PYX_ERR(0, 257, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "minDistCenterBox") < 0)) __PYX_ERR(0, 257, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 6)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); } - __pyx_v___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error) - __pyx_v___pyx_state = values[2]; - } - goto __pyx_L4_argument_unpacking_done; + __pyx_v_aufpunkt = ((PyArrayObject *)values[0]); + __pyx_v_com = ((PyArrayObject *)values[1]); + __pyx_v_coor = ((PyArrayObject *)values[2]); + __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 261, __pyx_L3_error) + __pyx_v_apr = ((PyArrayObject *)values[4]); + __pyx_v_rfa = ((PyArrayObject *)values[5]); + } + goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("minDistCenterBox", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 257, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.unfold.minDistCenterBox", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_aufpunkt), __pyx_ptype_5numpy_ndarray, 1, "aufpunkt", 0))) __PYX_ERR(0, 258, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_com), __pyx_ptype_5numpy_ndarray, 1, "com", 0))) __PYX_ERR(0, 259, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coor), __pyx_ptype_5numpy_ndarray, 1, "coor", 0))) __PYX_ERR(0, 260, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_apr), __pyx_ptype_5numpy_ndarray, 1, "apr", 0))) __PYX_ERR(0, 262, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rfa), __pyx_ptype_5numpy_ndarray, 1, "rfa", 0))) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_6unfold_8minDistCenterBox(__pyx_self, __pyx_v_aufpunkt, __pyx_v_com, __pyx_v_coor, __pyx_v_boxl, __pyx_v_apr, __pyx_v_rfa); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; +static PyObject *__pyx_pf_11newanalysis_6unfold_8minDistCenterBox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_aufpunkt, PyArrayObject *__pyx_v_com, PyArrayObject *__pyx_v_coor, __pyx_t_5numpy_float64_t __pyx_v_boxl, PyArrayObject *__pyx_v_apr, PyArrayObject *__pyx_v_rfa) { + double __pyx_v_shift[3]; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_nmol; + CYTHON_UNUSED int __pyx_v_natom; + __Pyx_LocalBuf_ND __pyx_pybuffernd_apr; + __Pyx_Buffer __pyx_pybuffer_apr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_aufpunkt; + __Pyx_Buffer __pyx_pybuffer_aufpunkt; + __Pyx_LocalBuf_ND __pyx_pybuffernd_com; + __Pyx_Buffer __pyx_pybuffer_com; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coor; + __Pyx_Buffer __pyx_pybuffer_coor; + __Pyx_LocalBuf_ND __pyx_pybuffernd_rfa; + __Pyx_Buffer __pyx_pybuffer_rfa; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + npy_intp *__pyx_t_1; int __pyx_t_2; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; + int __pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + __pyx_t_5numpy_float64_t __pyx_t_9; + __pyx_t_5numpy_int32_t __pyx_t_10; + __pyx_t_5numpy_int32_t __pyx_t_11; + int __pyx_t_12; + Py_ssize_t __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + __Pyx_RefNannySetupContext("minDistCenterBox", 0); + __pyx_pybuffer_aufpunkt.pybuffer.buf = NULL; + __pyx_pybuffer_aufpunkt.refcount = 0; + __pyx_pybuffernd_aufpunkt.data = NULL; + __pyx_pybuffernd_aufpunkt.rcbuffer = &__pyx_pybuffer_aufpunkt; + __pyx_pybuffer_com.pybuffer.buf = NULL; + __pyx_pybuffer_com.refcount = 0; + __pyx_pybuffernd_com.data = NULL; + __pyx_pybuffernd_com.rcbuffer = &__pyx_pybuffer_com; + __pyx_pybuffer_coor.pybuffer.buf = NULL; + __pyx_pybuffer_coor.refcount = 0; + __pyx_pybuffernd_coor.data = NULL; + __pyx_pybuffernd_coor.rcbuffer = &__pyx_pybuffer_coor; + __pyx_pybuffer_apr.pybuffer.buf = NULL; + __pyx_pybuffer_apr.refcount = 0; + __pyx_pybuffernd_apr.data = NULL; + __pyx_pybuffernd_apr.rcbuffer = &__pyx_pybuffer_apr; + __pyx_pybuffer_rfa.pybuffer.buf = NULL; + __pyx_pybuffer_rfa.refcount = 0; + __pyx_pybuffernd_rfa.data = NULL; + __pyx_pybuffernd_rfa.rcbuffer = &__pyx_pybuffer_rfa; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer, (PyObject*)__pyx_v_aufpunkt, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 257, __pyx_L1_error) + } + __pyx_pybuffernd_aufpunkt.diminfo[0].strides = __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_aufpunkt.diminfo[0].shape = __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_com.rcbuffer->pybuffer, (PyObject*)__pyx_v_com, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 257, __pyx_L1_error) + } + __pyx_pybuffernd_com.diminfo[0].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_com.diminfo[0].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_com.diminfo[1].strides = __pyx_pybuffernd_com.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_com.diminfo[1].shape = __pyx_pybuffernd_com.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coor.rcbuffer->pybuffer, (PyObject*)__pyx_v_coor, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 257, __pyx_L1_error) + } + __pyx_pybuffernd_coor.diminfo[0].strides = __pyx_pybuffernd_coor.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coor.diminfo[0].shape = __pyx_pybuffernd_coor.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coor.diminfo[1].strides = __pyx_pybuffernd_coor.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coor.diminfo[1].shape = __pyx_pybuffernd_coor.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_apr.rcbuffer->pybuffer, (PyObject*)__pyx_v_apr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 257, __pyx_L1_error) + } + __pyx_pybuffernd_apr.diminfo[0].strides = __pyx_pybuffernd_apr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_apr.diminfo[0].shape = __pyx_pybuffernd_apr.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rfa.rcbuffer->pybuffer, (PyObject*)__pyx_v_rfa, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 257, __pyx_L1_error) + } + __pyx_pybuffernd_rfa.diminfo[0].strides = __pyx_pybuffernd_rfa.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rfa.diminfo[0].shape = __pyx_pybuffernd_rfa.rcbuffer->pybuffer.shape[0]; - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) + /* "newanalysis/helpers/unfold.pyx":279 + * + * cdef double[3] shift + * cdef int i, j, k, nmol = com.shape[0], natom = coor.shape[0] # <<<<<<<<<<<<<< + * + * for i in range(nmol): */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__22, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_com)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_v_nmol = (__pyx_t_1[0]); + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_coor)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_v_natom = (__pyx_t_1[0]); - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) + /* "newanalysis/helpers/unfold.pyx":281 + * cdef int i, j, k, nmol = com.shape[0], natom = coor.shape[0] + * + * for i in range(nmol): # <<<<<<<<<<<<<< + * for j in range(3): + * com[i,j] -= aufpunkt[j] */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); - __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __pyx_v_nmol; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "(tree fragment)":6 - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: + /* "newanalysis/helpers/unfold.pyx":282 + * + * for i in range(nmol): + * for j in range(3): # <<<<<<<<<<<<<< + * com[i,j] -= aufpunkt[j] + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_v___pyx_PickleError); - __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 6, __pyx_L1_error) + for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) { + __pyx_v_j = __pyx_t_5; - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) + /* "newanalysis/helpers/unfold.pyx":283 + * for i in range(nmol): + * for j in range(3): + * com[i,j] -= aufpunkt[j] # <<<<<<<<<<<<<< + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) + * com[i,j] -= shift[j] */ - } + __pyx_t_6 = __pyx_v_j; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_aufpunkt.diminfo[0].shape; + __pyx_t_7 = __pyx_v_i; + __pyx_t_8 = __pyx_v_j; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_com.diminfo[0].shape; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_com.diminfo[1].shape; + *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_com.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_com.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_com.diminfo[1].strides) -= (*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_aufpunkt.diminfo[0].strides)); - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + /* "newanalysis/helpers/unfold.pyx":284 + * for j in range(3): + * com[i,j] -= aufpunkt[j] + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) # <<<<<<<<<<<<<< + * com[i,j] -= shift[j] + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = __pyx_v_i; + __pyx_t_8 = __pyx_v_j; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_com.diminfo[0].shape; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_com.diminfo[1].shape; + __pyx_t_9 = (*__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_com.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_com.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_com.diminfo[1].strides)); + if (unlikely(__pyx_v_boxl == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 284, __pyx_L1_error) + } + (__pyx_v_shift[__pyx_v_j]) = (__pyx_v_boxl * floor(((__pyx_t_9 / __pyx_v_boxl) + 0.5))); + + /* "newanalysis/helpers/unfold.pyx":285 + * com[i,j] -= aufpunkt[j] + * shift[j] = boxl * floor(com[i,j] / boxl + 0.5) + * com[i,j] -= shift[j] # <<<<<<<<<<<<<< + * + * for k in range(rfa[i], rfa[i]+apr[i]): + */ + __pyx_t_8 = __pyx_v_i; + __pyx_t_6 = __pyx_v_j; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_com.diminfo[0].shape; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_com.diminfo[1].shape; + *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_com.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_com.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_com.diminfo[1].strides) -= (__pyx_v_shift[__pyx_v_j]); } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result = __pyx_t_4; - __pyx_t_4 = 0; - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "newanalysis/helpers/unfold.pyx":287 + * com[i,j] -= shift[j] + * + * for k in range(rfa[i], rfa[i]+apr[i]): # <<<<<<<<<<<<<< + * for j in range(3): + * coor[k,j] -= (aufpunkt[j] + shift[j]) */ - __pyx_t_3 = (__pyx_v___pyx_state != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { + __pyx_t_6 = __pyx_v_i; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_rfa.diminfo[0].shape; + __pyx_t_8 = __pyx_v_i; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_apr.diminfo[0].shape; + __pyx_t_10 = ((*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_rfa.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_rfa.diminfo[0].strides)) + (*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_apr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_apr.diminfo[0].strides))); + __pyx_t_8 = __pyx_v_i; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_rfa.diminfo[0].shape; + __pyx_t_11 = __pyx_t_10; + for (__pyx_t_5 = (*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_rfa.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_rfa.diminfo[0].strides)); __pyx_t_5 < __pyx_t_11; __pyx_t_5+=1) { + __pyx_v_k = __pyx_t_5; - /* "(tree fragment)":9 - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + /* "newanalysis/helpers/unfold.pyx":288 + * + * for k in range(rfa[i], rfa[i]+apr[i]): + * for j in range(3): # <<<<<<<<<<<<<< + * coor[k,j] -= (aufpunkt[j] + shift[j]) + * */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_t_4 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (__pyx_t_12 = 0; __pyx_t_12 < 3; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result + /* "newanalysis/helpers/unfold.pyx":289 + * for k in range(rfa[i], rfa[i]+apr[i]): + * for j in range(3): + * coor[k,j] -= (aufpunkt[j] + shift[j]) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ + __pyx_t_6 = __pyx_v_j; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_aufpunkt.diminfo[0].shape; + __pyx_t_7 = __pyx_v_k; + __pyx_t_13 = __pyx_v_j; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_coor.diminfo[0].shape; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_coor.diminfo[1].shape; + *__Pyx_BufPtrCContig2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_coor.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_coor.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_coor.diminfo[1].strides) -= ((*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_aufpunkt.diminfo[0].strides)) + (__pyx_v_shift[__pyx_v_j])); + } + } } - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; - goto __pyx_L0; - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "newanalysis/helpers/unfold.pyx":257 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistCenterBox(np.ndarray[np.float64_t,ndim=1,mode='c'] aufpunkt, + * np.ndarray[np.float64_t,ndim=2,mode='c'] com, */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_apr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rfa.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.unfold.minDistCenterBox", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_apr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_aufpunkt.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_com.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coor.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rfa.rcbuffer->pybuffer); + __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): +/* "newanalysis/helpers/unfold.pyx":291 + * coor[k,j] -= (aufpunkt[j] + shift[j]) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minVec(double [:] coor1, double [:] coor2, double boxl, double boxl2): + * """ */ -static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6unfold_11minVec(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_6unfold_10minVec, "\n minVec(xyz1, xyz2, boxl, boxl2)\n\n Gives the shortes vector pointing from xyz1 to xyz2 considering periodic boundary conditions.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_6unfold_11minVec = {"minVec", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6unfold_11minVec, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_10minVec}; +static PyObject *__pyx_pw_11newanalysis_6unfold_11minVec(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxl; + double __pyx_v_boxl2; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("minVec (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 291, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_boxl,&__pyx_n_s_boxl2,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minVec", 1, 4, 4, 1); __PYX_ERR(0, 291, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minVec", 1, 4, 4, 2); __PYX_ERR(0, 291, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minVec", 1, 4, 4, 3); __PYX_ERR(0, 291, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "minVec") < 0)) __PYX_ERR(0, 291, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 292, __pyx_L3_error) + __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 292, __pyx_L3_error) + __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error) + __pyx_v_boxl2 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("minVec", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 291, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + __Pyx_AddTraceback("newanalysis.unfold.minVec", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_6unfold_10minVec(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_boxl, __pyx_v_boxl2); + + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_6unfold_10minVec(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, double __pyx_v_boxl, double __pyx_v_boxl2) { + __Pyx_memviewslice __pyx_v_delta = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); + __Pyx_RefNannySetupContext("minVec", 0); - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) + /* "newanalysis/helpers/unfold.pyx":298 + * Gives the shortes vector pointing from xyz1 to xyz2 considering periodic boundary conditions. + * """ + * cdef double [:] delta = np.zeros(3) # <<<<<<<<<<<<<< + * cdef int i + * */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 12, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->name); - __Pyx_DECREF(__pyx_v___pyx_result->name); - __pyx_v___pyx_result->name = __pyx_t_1; - __pyx_t_1 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_int_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_delta = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) + /* "newanalysis/helpers/unfold.pyx":301 + * cdef int i + * + * for i in range(3): # <<<<<<<<<<<<<< + * delta[i] = coor2[i] - coor1[i] + * if fabs(delta[i]) > boxl2: */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 13, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_4 = ((__pyx_t_3 > 1) != 0); - if (__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { + for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "(tree fragment)":14 - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< + /* "newanalysis/helpers/unfold.pyx":302 + * + * for i in range(3): + * delta[i] = coor2[i] - coor1[i] # <<<<<<<<<<<<<< + * if fabs(delta[i]) > boxl2: + * delta[i] -= sign(delta[i]) * boxl */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 14, __pyx_L1_error) - } - __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __pyx_v_i; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor2.shape[0]; + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor1.shape[0]; + __pyx_t_8 = __pyx_v_i; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_delta.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_delta.data + __pyx_t_8 * __pyx_v_delta.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_coor2.data + __pyx_t_6 * __pyx_v_coor2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coor1.data + __pyx_t_7 * __pyx_v_coor1.strides[0]) )))); - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) + /* "newanalysis/helpers/unfold.pyx":303 + * for i in range(3): + * delta[i] = coor2[i] - coor1[i] + * if fabs(delta[i]) > boxl2: # <<<<<<<<<<<<<< + * delta[i] -= sign(delta[i]) * boxl + * */ - } + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_delta.shape[0]; + __pyx_t_9 = (fabs((*((double *) ( /* dim=0 */ (__pyx_v_delta.data + __pyx_t_7 * __pyx_v_delta.strides[0]) )))) > __pyx_v_boxl2); + if (__pyx_t_9) { - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + /* "newanalysis/helpers/unfold.pyx":304 + * delta[i] = coor2[i] - coor1[i] + * if fabs(delta[i]) > boxl2: + * delta[i] -= sign(delta[i]) * boxl # <<<<<<<<<<<<<< + * + * return np.asarray(delta) */ + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_delta.shape[0]; + __pyx_t_10 = __pyx_f_11newanalysis_6unfold_sign((*((double *) ( /* dim=0 */ (__pyx_v_delta.data + __pyx_t_7 * __pyx_v_delta.strides[0]) )))); if (unlikely(__pyx_t_10 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 304, __pyx_L1_error) + __pyx_t_7 = __pyx_v_i; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_delta.shape[0]; + *((double *) ( /* dim=0 */ (__pyx_v_delta.data + __pyx_t_7 * __pyx_v_delta.strides[0]) )) -= (__pyx_t_10 * __pyx_v_boxl); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "newanalysis/helpers/unfold.pyx":303 + * for i in range(3): + * delta[i] = coor2[i] - coor1[i] + * if fabs(delta[i]) > boxl2: # <<<<<<<<<<<<<< + * delta[i] -= sign(delta[i]) * boxl + * + */ + } + } + + /* "newanalysis/helpers/unfold.pyx":306 + * delta[i] -= sign(delta[i]) * boxl + * + * return np.asarray(delta) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_delta, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; + + /* "newanalysis/helpers/unfold.pyx":291 + * coor[k,j] -= (aufpunkt[j] + shift[j]) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minVec(double [:] coor1, double [:] coor2, double boxl, double boxl2): + * """ + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("newanalysis.unfold.minVec", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delta, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_vtabstruct_array __pyx_vtable_array; -static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_array_obj *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_array_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_array; - p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} +/* "newanalysis/helpers/unfold.pyx":308 + * return np.asarray(delta) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDist(double [:] coor1, double [:] coor2, double boxl, double boxl2): + * """ + */ -static void __pyx_tp_dealloc_array(PyObject *o) { - struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6unfold_13minDist(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_6unfold_12minDist, "\n minDist(xyz1, xyz2, boxl, boxl2)\n\n Gives the shortest distance between xyz1 and xyz2 considering periodic boundary conditions.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_6unfold_13minDist = {"minDist", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6unfold_13minDist, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_12minDist}; +static PyObject *__pyx_pw_11newanalysis_6unfold_13minDist(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor1 = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coor2 = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxl; + double __pyx_v_boxl2; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[4] = {0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("minDist (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 308, __pyx_L3_error) #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_array___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->mode); - Py_CLEAR(p->_format); - (*Py_TYPE(o)->tp_free)(o); -} -static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_array___setitem__(o, i, v); + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor1,&__pyx_n_s_coor2,&__pyx_n_s_boxl,&__pyx_n_s_boxl2,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor1)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minDist", 1, 4, 4, 1); __PYX_ERR(0, 308, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minDist", 1, 4, 4, 2); __PYX_ERR(0, 308, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl2)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("minDist", 1, 4, 4, 3); __PYX_ERR(0, 308, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "minDist") < 0)) __PYX_ERR(0, 308, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 4)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + } + __pyx_v_coor1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor1.memview)) __PYX_ERR(0, 309, __pyx_L3_error) + __pyx_v_coor2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor2.memview)) __PYX_ERR(0, 309, __pyx_L3_error) + __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error) + __pyx_v_boxl2 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_boxl2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error) } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); - return -1; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("minDist", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 308, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } -} + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + __Pyx_AddTraceback("newanalysis.unfold.minDist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_6unfold_12minDist(__pyx_self, __pyx_v_coor1, __pyx_v_coor2, __pyx_v_boxl, __pyx_v_boxl2); -static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { - PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n); - if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - v = __pyx_array___getattr__(o, n); + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor1, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor2, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - return v; -} - -static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyMethodDef __pyx_methods_array[] = { - {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; +static PyObject *__pyx_pf_11newanalysis_6unfold_12minDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor1, __Pyx_memviewslice __pyx_v_coor2, double __pyx_v_boxl, double __pyx_v_boxl2) { + double __pyx_v_delta[3]; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("minDist", 0); -static struct PyGetSetDef __pyx_getsets_array[] = { - {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; + /* "newanalysis/helpers/unfold.pyx":319 + * cdef int i + * + * for i in range(3): # <<<<<<<<<<<<<< + * delta[i] = coor2[i] - coor1[i] + * if fabs(delta[i]) > boxl2: + */ + for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; -static PySequenceMethods __pyx_tp_as_sequence_array = { - __pyx_array___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_array, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; + /* "newanalysis/helpers/unfold.pyx":320 + * + * for i in range(3): + * delta[i] = coor2[i] - coor1[i] # <<<<<<<<<<<<<< + * if fabs(delta[i]) > boxl2: + * delta[i] -= sign(delta[i]) * boxl + */ + __pyx_t_2 = __pyx_v_i; + if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coor2.shape[0]; + __pyx_t_3 = __pyx_v_i; + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coor1.shape[0]; + (__pyx_v_delta[__pyx_v_i]) = ((*((double *) ( /* dim=0 */ (__pyx_v_coor2.data + __pyx_t_2 * __pyx_v_coor2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coor1.data + __pyx_t_3 * __pyx_v_coor1.strides[0]) )))); -static PyMappingMethods __pyx_tp_as_mapping_array = { - __pyx_array___len__, /*mp_length*/ - __pyx_array___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ -}; + /* "newanalysis/helpers/unfold.pyx":321 + * for i in range(3): + * delta[i] = coor2[i] - coor1[i] + * if fabs(delta[i]) > boxl2: # <<<<<<<<<<<<<< + * delta[i] -= sign(delta[i]) * boxl + * + */ + __pyx_t_4 = (fabs((__pyx_v_delta[__pyx_v_i])) > __pyx_v_boxl2); + if (__pyx_t_4) { -static PyBufferProcs __pyx_tp_as_buffer_array = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_array_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; + /* "newanalysis/helpers/unfold.pyx":322 + * delta[i] = coor2[i] - coor1[i] + * if fabs(delta[i]) > boxl2: + * delta[i] -= sign(delta[i]) * boxl # <<<<<<<<<<<<<< + * + * return float(sqrt(delta[0]*delta[0] + delta[1]*delta[1] + delta[2]*delta[2])) + */ + __pyx_t_5 = __pyx_v_i; + __pyx_t_6 = __pyx_f_11newanalysis_6unfold_sign((__pyx_v_delta[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L1_error) + (__pyx_v_delta[__pyx_t_5]) = ((__pyx_v_delta[__pyx_t_5]) - (__pyx_t_6 * __pyx_v_boxl)); -static PyTypeObject __pyx_type___pyx_array = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.unfold.array", /*tp_name*/ - sizeof(struct __pyx_array_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_array, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - __pyx_tp_getattro_array, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_array, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_array, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_array, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ + /* "newanalysis/helpers/unfold.pyx":321 + * for i in range(3): + * delta[i] = coor2[i] - coor1[i] + * if fabs(delta[i]) > boxl2: # <<<<<<<<<<<<<< + * delta[i] -= sign(delta[i]) * boxl + * + */ + } + } + + /* "newanalysis/helpers/unfold.pyx":324 + * delta[i] -= sign(delta[i]) * boxl + * + * return float(sqrt(delta[0]*delta[0] + delta[1]*delta[1] + delta[2]*delta[2])) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = PyFloat_FromDouble(sqrt(((((__pyx_v_delta[0]) * (__pyx_v_delta[0])) + ((__pyx_v_delta[1]) * (__pyx_v_delta[1]))) + ((__pyx_v_delta[2]) * (__pyx_v_delta[2]))))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 324, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; + + /* "newanalysis/helpers/unfold.pyx":308 + * return np.asarray(delta) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDist(double [:] coor1, double [:] coor2, double boxl, double boxl2): + * """ + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("newanalysis.unfold.minDist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/helpers/unfold.pyx":326 + * return float(sqrt(delta[0]*delta[0] + delta[1]*delta[1] + delta[2]*delta[2])) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findMinDist(double [:,:] coor, double boxl): + * cdef int n = coor.shape[0], i, j + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6unfold_15findMinDist(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_6unfold_15findMinDist = {"findMinDist", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6unfold_15findMinDist, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_6unfold_15findMinDist(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_boxl; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("findMinDist (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 326, __pyx_L3_error) #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ #endif -}; - -static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_MemviewEnum_obj *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_boxl,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxl)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("findMinDist", 1, 2, 2, 1); __PYX_ERR(0, 326, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "findMinDist") < 0)) __PYX_ERR(0, 326, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 2)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 327, __pyx_L3_error) + __pyx_v_boxl = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_boxl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 327, __pyx_L3_error) } - if (unlikely(!o)) return 0; - p = ((struct __pyx_MemviewEnum_obj *)o); - p->name = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_Enum(PyObject *o) { - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("findMinDist", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 326, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->name); - (*Py_TYPE(o)->tp_free)(o); -} + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __Pyx_AddTraceback("newanalysis.unfold.findMinDist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_6unfold_14findMinDist(__pyx_self, __pyx_v_coor, __pyx_v_boxl); -static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - if (p->name) { - e = (*v)(p->name, a); if (e) return e; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - return 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static int __pyx_tp_clear_Enum(PyObject *o) { - PyObject* tmp; - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - tmp = ((PyObject*)p->name); - p->name = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} +static PyObject *__pyx_pf_11newanalysis_6unfold_14findMinDist(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, double __pyx_v_boxl) { + int __pyx_v_n; + int __pyx_v_i; + int __pyx_v_j; + double __pyx_v_minimum; + double __pyx_v_dist; + double __pyx_v_boxl2; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_t_16; + double __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("findMinDist", 0); -static PyMethodDef __pyx_methods_Enum[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; + /* "newanalysis/helpers/unfold.pyx":328 + * @cython.boundscheck(False) + * def findMinDist(double [:,:] coor, double boxl): + * cdef int n = coor.shape[0], i, j # <<<<<<<<<<<<<< + * cdef double minimum = 1000000.0, dist + * cdef double boxl2 = boxl/2.0 + */ + __pyx_v_n = (__pyx_v_coor.shape[0]); -static PyTypeObject __pyx_type___pyx_MemviewEnum = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.unfold.Enum", /*tp_name*/ - sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_Enum, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_MemviewEnum___repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_Enum, /*tp_traverse*/ - __pyx_tp_clear_Enum, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_Enum, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_MemviewEnum___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_Enum, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; -static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; - -static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryview_obj *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_memoryview_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_memoryview; - p->obj = Py_None; Py_INCREF(Py_None); - p->_size = Py_None; Py_INCREF(Py_None); - p->_array_interface = Py_None; Py_INCREF(Py_None); - p->view.obj = NULL; - if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} - -static void __pyx_tp_dealloc_memoryview(PyObject *o) { - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_memoryview___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->obj); - Py_CLEAR(p->_size); - Py_CLEAR(p->_array_interface); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - if (p->obj) { - e = (*v)(p->obj, a); if (e) return e; - } - if (p->_size) { - e = (*v)(p->_size, a); if (e) return e; - } - if (p->_array_interface) { - e = (*v)(p->_array_interface, a); if (e) return e; - } - if (p->view.obj) { - e = (*v)(p->view.obj, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_memoryview(PyObject *o) { - PyObject* tmp; - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - tmp = ((PyObject*)p->obj); - p->obj = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_size); - p->_size = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_array_interface); - p->_array_interface = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - Py_CLEAR(p->view.obj); - return 0; -} -static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_memoryview___setitem__(o, i, v); - } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); - return -1; - } -} + /* "newanalysis/helpers/unfold.pyx":329 + * def findMinDist(double [:,:] coor, double boxl): + * cdef int n = coor.shape[0], i, j + * cdef double minimum = 1000000.0, dist # <<<<<<<<<<<<<< + * cdef double boxl2 = boxl/2.0 + * + */ + __pyx_v_minimum = 1000000.0; -static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); -} + /* "newanalysis/helpers/unfold.pyx":330 + * cdef int n = coor.shape[0], i, j + * cdef double minimum = 1000000.0, dist + * cdef double boxl2 = boxl/2.0 # <<<<<<<<<<<<<< + * + * for i in range(n): + */ + __pyx_v_boxl2 = (__pyx_v_boxl / 2.0); -static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); -} + /* "newanalysis/helpers/unfold.pyx":332 + * cdef double boxl2 = boxl/2.0 + * + * for i in range(n): # <<<<<<<<<<<<<< + * for j in range(n): + * if i == j: continue + */ + __pyx_t_1 = __pyx_v_n; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; -static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); -} + /* "newanalysis/helpers/unfold.pyx":333 + * + * for i in range(n): + * for j in range(n): # <<<<<<<<<<<<<< + * if i == j: continue + * dist = minDist(coor[i], coor[j], boxl, boxl2) + */ + __pyx_t_4 = __pyx_v_n; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_j = __pyx_t_6; -static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); -} + /* "newanalysis/helpers/unfold.pyx":334 + * for i in range(n): + * for j in range(n): + * if i == j: continue # <<<<<<<<<<<<<< + * dist = minDist(coor[i], coor[j], boxl, boxl2) + * if dist < minimum: + */ + __pyx_t_7 = (__pyx_v_i == __pyx_v_j); + if (__pyx_t_7) { + goto __pyx_L5_continue; + } -static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); + /* "newanalysis/helpers/unfold.pyx":335 + * for j in range(n): + * if i == j: continue + * dist = minDist(coor[i], coor[j], boxl, boxl2) # <<<<<<<<<<<<<< + * if dist < minimum: + * minimum = dist + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_minDist); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10.data = __pyx_v_coor.data; + __pyx_t_10.memview = __pyx_v_coor.memview; + __PYX_INC_MEMVIEW(&__pyx_t_10, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_i; + Py_ssize_t __pyx_tmp_shape = __pyx_v_coor.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_coor.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride; } -static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); -} +__pyx_t_10.shape[0] = __pyx_v_coor.shape[1]; +__pyx_t_10.strides[0] = __pyx_v_coor.strides[1]; + __pyx_t_10.suboffsets[0] = -1; -static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); +__pyx_t_11 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1); + __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; + __pyx_t_10.data = __pyx_v_coor.data; + __pyx_t_10.memview = __pyx_v_coor.memview; + __PYX_INC_MEMVIEW(&__pyx_t_10, 1); + { + Py_ssize_t __pyx_tmp_idx = __pyx_v_j; + Py_ssize_t __pyx_tmp_shape = __pyx_v_coor.shape[0]; + Py_ssize_t __pyx_tmp_stride = __pyx_v_coor.strides[0]; + if (__pyx_tmp_idx < 0) + __pyx_tmp_idx += __pyx_tmp_shape; + __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride; } -static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); -} +__pyx_t_10.shape[0] = __pyx_v_coor.shape[1]; +__pyx_t_10.strides[0] = __pyx_v_coor.strides[1]; + __pyx_t_10.suboffsets[0] = -1; -static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); -} - -static PyMethodDef __pyx_methods_memoryview[] = { - {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0}, - {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0}, - {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0}, - {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; +__pyx_t_12 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1); + __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; + __pyx_t_13 = PyFloat_FromDouble(__pyx_v_boxl); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PyFloat_FromDouble(__pyx_v_boxl2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = NULL; + __pyx_t_16 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_15)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_16 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[5] = {__pyx_t_15, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_16, 4+__pyx_t_16); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 335, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_dist = __pyx_t_17; -static struct PyGetSetDef __pyx_getsets_memoryview[] = { - {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0}, - {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0}, - {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0}, - {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0}, - {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0}, - {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0}, - {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0}, - {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0}, - {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; + /* "newanalysis/helpers/unfold.pyx":336 + * if i == j: continue + * dist = minDist(coor[i], coor[j], boxl, boxl2) + * if dist < minimum: # <<<<<<<<<<<<<< + * minimum = dist + * + */ + __pyx_t_7 = (__pyx_v_dist < __pyx_v_minimum); + if (__pyx_t_7) { -static PySequenceMethods __pyx_tp_as_sequence_memoryview = { - __pyx_memoryview___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_memoryview, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; + /* "newanalysis/helpers/unfold.pyx":337 + * dist = minDist(coor[i], coor[j], boxl, boxl2) + * if dist < minimum: + * minimum = dist # <<<<<<<<<<<<<< + * + * return float(minimum) + */ + __pyx_v_minimum = __pyx_v_dist; -static PyMappingMethods __pyx_tp_as_mapping_memoryview = { - __pyx_memoryview___len__, /*mp_length*/ - __pyx_memoryview___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ -}; + /* "newanalysis/helpers/unfold.pyx":336 + * if i == j: continue + * dist = minDist(coor[i], coor[j], boxl, boxl2) + * if dist < minimum: # <<<<<<<<<<<<<< + * minimum = dist + * + */ + } + __pyx_L5_continue:; + } + } -static PyBufferProcs __pyx_tp_as_buffer_memoryview = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_memoryview_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; + /* "newanalysis/helpers/unfold.pyx":339 + * minimum = dist + * + * return float(minimum) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_minimum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L0; -static PyTypeObject __pyx_type___pyx_memoryview = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.unfold.memoryview", /*tp_name*/ - sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_memoryview___repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_memoryview___str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_memoryview, /*tp_traverse*/ - __pyx_tp_clear_memoryview, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_memoryview, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_memoryview, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_memoryview, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; -static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + /* "newanalysis/helpers/unfold.pyx":326 + * return float(sqrt(delta[0]*delta[0] + delta[1]*delta[1] + delta[2]*delta[2])) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findMinDist(double [:,:] coor, double boxl): + * cdef int n = coor.shape[0], i, j + */ -static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryviewslice_obj *p; - PyObject *o = __pyx_tp_new_memoryview(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_memoryviewslice_obj *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; - p->from_object = Py_None; Py_INCREF(Py_None); - p->from_slice.memview = NULL; - return o; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("newanalysis.unfold.findMinDist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } +/* "newanalysis/helpers/unfold.pyx":341 + * return float(minimum) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def bertholdHorn(double [:,:] coor, double [:,:] coorA, double [:,:] coorB): + * """ + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_6unfold_17bertholdHorn(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_6unfold_16bertholdHorn, "\n bertholdHorn(coor,coorA,coorB)\n\n Applies the Berthold-Horn-algorithm to a set of coordinates xyz, inplace.\n\n Args:\n coor .. coordinates of all atoms\n coorA .. template coordinates\n coorB .. corresponding coordinates of the current frame\n "); +static PyMethodDef __pyx_mdef_11newanalysis_6unfold_17bertholdHorn = {"bertholdHorn", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_6unfold_17bertholdHorn, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_6unfold_16bertholdHorn}; +static PyObject *__pyx_pw_11newanalysis_6unfold_17bertholdHorn(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_coor = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coorA = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_coorB = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif - PyObject_GC_UnTrack(o); + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("bertholdHorn (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 341, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_memoryviewslice___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->from_object); - PyObject_GC_Track(o); - __pyx_tp_dealloc_memoryview(o); -} - -static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; - if (p->from_object) { - e = (*v)(p->from_object, a); if (e) return e; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coor,&__pyx_n_s_coorA,&__pyx_n_s_coorB,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coor)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 341, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coorA)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 341, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("bertholdHorn", 1, 3, 3, 1); __PYX_ERR(0, 341, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coorB)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 341, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("bertholdHorn", 1, 3, 3, 2); __PYX_ERR(0, 341, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "bertholdHorn") < 0)) __PYX_ERR(0, 341, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v_coor = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coor.memview)) __PYX_ERR(0, 342, __pyx_L3_error) + __pyx_v_coorA = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorA.memview)) __PYX_ERR(0, 342, __pyx_L3_error) + __pyx_v_coorB = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coorB.memview)) __PYX_ERR(0, 342, __pyx_L3_error) } - return 0; -} - -static int __pyx_tp_clear__memoryviewslice(PyObject *o) { - PyObject* tmp; - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - __pyx_tp_clear_memoryview(o); - tmp = ((PyObject*)p->from_object); - p->from_object = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - __PYX_XDEC_MEMVIEW(&p->from_slice, 1); - return 0; -} - -static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o); -} - -static PyMethodDef __pyx_methods__memoryviewslice[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = { - {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type___pyx_memoryviewslice = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.unfold._memoryviewslice", /*tp_name*/ - sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - #if CYTHON_COMPILING_IN_PYPY - __pyx_memoryview___repr__, /*tp_repr*/ - #else - 0, /*tp_repr*/ - #endif - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_memoryview___str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Internal class for passing memoryview slices to Python", /*tp_doc*/ - __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ - __pyx_tp_clear__memoryviewslice, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods__memoryviewslice, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets__memoryviewslice, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new__memoryviewslice, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_unfold(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_unfold}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "unfold", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("bertholdHorn", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 341, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorA, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorB, 1); + __Pyx_AddTraceback("newanalysis.unfold.bertholdHorn", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_6unfold_16bertholdHorn(__pyx_self, __pyx_v_coor, __pyx_v_coorA, __pyx_v_coorB); -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1}, - {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, - {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1}, - {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, - {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1}, - {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0}, - {&__pyx_n_s_D, __pyx_k_D, sizeof(__pyx_k_D), 0, 0, 1, 1}, - {&__pyx_n_s_DD, __pyx_k_DD, sizeof(__pyx_k_DD), 0, 0, 1, 1}, - {&__pyx_n_s_DX, __pyx_k_DX, sizeof(__pyx_k_DX), 0, 0, 1, 1}, - {&__pyx_n_s_DY, __pyx_k_DY, sizeof(__pyx_k_DY), 0, 0, 1, 1}, - {&__pyx_n_s_DZ, __pyx_k_DZ, sizeof(__pyx_k_DZ), 0, 0, 1, 1}, - {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, - {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, - {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, - {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0}, - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, - {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, - {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, - {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, - {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, - {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 0, 1, 1}, - {&__pyx_n_s_T1, __pyx_k_T1, sizeof(__pyx_k_T1), 0, 0, 1, 1}, - {&__pyx_n_s_T2, __pyx_k_T2, sizeof(__pyx_k_T2), 0, 0, 1, 1}, - {&__pyx_n_s_T3, __pyx_k_T3, sizeof(__pyx_k_T3), 0, 0, 1, 1}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, - {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, - {&__pyx_n_s_apr, __pyx_k_apr, sizeof(__pyx_k_apr), 0, 0, 1, 1}, - {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, - {&__pyx_n_s_atoms_per_residue, __pyx_k_atoms_per_residue, sizeof(__pyx_k_atoms_per_residue), 0, 0, 1, 1}, - {&__pyx_n_s_auf, __pyx_k_auf, sizeof(__pyx_k_auf), 0, 0, 1, 1}, - {&__pyx_n_s_aufpunkt, __pyx_k_aufpunkt, sizeof(__pyx_k_aufpunkt), 0, 0, 1, 1}, - {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, - {&__pyx_n_s_bertholdHorn, __pyx_k_bertholdHorn, sizeof(__pyx_k_bertholdHorn), 0, 0, 1, 1}, - {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, - {&__pyx_n_s_boxl2, __pyx_k_boxl2, sizeof(__pyx_k_boxl2), 0, 0, 1, 1}, - {&__pyx_n_s_boxl34, __pyx_k_boxl34, sizeof(__pyx_k_boxl34), 0, 0, 1, 1}, - {&__pyx_n_s_boxlength, __pyx_k_boxlength, sizeof(__pyx_k_boxlength), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, - {&__pyx_n_s_c_xyz_traj_curr, __pyx_k_c_xyz_traj_curr, sizeof(__pyx_k_c_xyz_traj_curr), 0, 0, 1, 1}, - {&__pyx_n_s_c_xyz_traj_prev, __pyx_k_c_xyz_traj_prev, sizeof(__pyx_k_c_xyz_traj_prev), 0, 0, 1, 1}, - {&__pyx_n_s_ccom, __pyx_k_ccom, sizeof(__pyx_k_ccom), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_com, __pyx_k_com, sizeof(__pyx_k_com), 0, 0, 1, 1}, - {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, - {&__pyx_n_s_coor, __pyx_k_coor, sizeof(__pyx_k_coor), 0, 0, 1, 1}, - {&__pyx_n_s_coor1, __pyx_k_coor1, sizeof(__pyx_k_coor1), 0, 0, 1, 1}, - {&__pyx_n_s_coor2, __pyx_k_coor2, sizeof(__pyx_k_coor2), 0, 0, 1, 1}, - {&__pyx_n_s_coorA, __pyx_k_coorA, sizeof(__pyx_k_coorA), 0, 0, 1, 1}, - {&__pyx_n_s_coorB, __pyx_k_coorB, sizeof(__pyx_k_coorB), 0, 0, 1, 1}, - {&__pyx_n_s_coor_curr, __pyx_k_coor_curr, sizeof(__pyx_k_coor_curr), 0, 0, 1, 1}, - {&__pyx_n_s_coor_prev, __pyx_k_coor_prev, sizeof(__pyx_k_coor_prev), 0, 0, 1, 1}, - {&__pyx_n_s_coor_unfold, __pyx_k_coor_unfold, sizeof(__pyx_k_coor_unfold), 0, 0, 1, 1}, - {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, - {&__pyx_n_s_curr, __pyx_k_curr, sizeof(__pyx_k_curr), 0, 0, 1, 1}, - {&__pyx_n_s_cxyz, __pyx_k_cxyz, sizeof(__pyx_k_cxyz), 0, 0, 1, 1}, - {&__pyx_n_s_delta, __pyx_k_delta, sizeof(__pyx_k_delta), 0, 0, 1, 1}, - {&__pyx_n_s_diag, __pyx_k_diag, sizeof(__pyx_k_diag), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_n_s_dimensions, __pyx_k_dimensions, sizeof(__pyx_k_dimensions), 0, 0, 1, 1}, - {&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1}, - {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, - {&__pyx_n_s_findMinDist, __pyx_k_findMinDist, sizeof(__pyx_k_findMinDist), 0, 0, 1, 1}, - {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, - {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, - {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, - {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, - {&__pyx_n_s_minDist, __pyx_k_minDist, sizeof(__pyx_k_minDist), 0, 0, 1, 1}, - {&__pyx_n_s_minDistBox, __pyx_k_minDistBox, sizeof(__pyx_k_minDistBox), 0, 0, 1, 1}, - {&__pyx_n_s_minDistCenterBox, __pyx_k_minDistCenterBox, sizeof(__pyx_k_minDistCenterBox), 0, 0, 1, 1}, - {&__pyx_n_s_minVec, __pyx_k_minVec, sizeof(__pyx_k_minVec), 0, 0, 1, 1}, - {&__pyx_n_s_minimum, __pyx_k_minimum, sizeof(__pyx_k_minimum), 0, 0, 1, 1}, - {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, - {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_natom, __pyx_k_natom, sizeof(__pyx_k_natom), 0, 0, 1, 1}, - {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, - {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, - {&__pyx_n_s_newanalysis_unfold, __pyx_k_newanalysis_unfold, sizeof(__pyx_k_newanalysis_unfold), 0, 0, 1, 1}, - {&__pyx_n_s_nmol, __pyx_k_nmol, sizeof(__pyx_k_nmol), 0, 0, 1, 1}, - {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, - {&__pyx_n_s_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 0, 0, 1, 1}, - {&__pyx_n_s_norm2, __pyx_k_norm2, sizeof(__pyx_k_norm2), 0, 0, 1, 1}, - {&__pyx_n_s_norm22, __pyx_k_norm22, sizeof(__pyx_k_norm22), 0, 0, 1, 1}, - {&__pyx_n_s_norm32, __pyx_k_norm32, sizeof(__pyx_k_norm32), 0, 0, 1, 1}, - {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, - {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_offdiag, __pyx_k_offdiag, sizeof(__pyx_k_offdiag), 0, 0, 1, 1}, - {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_n_s_prev, __pyx_k_prev, sizeof(__pyx_k_prev), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_residue_first_atom, __pyx_k_residue_first_atom, sizeof(__pyx_k_residue_first_atom), 0, 0, 1, 1}, - {&__pyx_n_s_rfa, __pyx_k_rfa, sizeof(__pyx_k_rfa), 0, 0, 1, 1}, - {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, - {&__pyx_n_s_shift, __pyx_k_shift, sizeof(__pyx_k_shift), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_kp_s_src_helpers_unfold_pyx, __pyx_k_src_helpers_unfold_pyx, sizeof(__pyx_k_src_helpers_unfold_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_tmpx, __pyx_k_tmpx, sizeof(__pyx_k_tmpx), 0, 0, 1, 1}, - {&__pyx_n_s_tmpy, __pyx_k_tmpy, sizeof(__pyx_k_tmpy), 0, 0, 1, 1}, - {&__pyx_n_s_tmpz, __pyx_k_tmpz, sizeof(__pyx_k_tmpz), 0, 0, 1, 1}, - {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, - {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, - {&__pyx_n_s_unfold, __pyx_k_unfold, sizeof(__pyx_k_unfold), 0, 0, 1, 1}, - {&__pyx_n_s_unfoldBox, __pyx_k_unfoldBox, sizeof(__pyx_k_unfoldBox), 0, 0, 1, 1}, - {&__pyx_n_s_unfoldCharmmOcta, __pyx_k_unfoldCharmmOcta, sizeof(__pyx_k_unfoldCharmmOcta), 0, 0, 1, 1}, - {&__pyx_n_s_unfoldOcta, __pyx_k_unfoldOcta, sizeof(__pyx_k_unfoldOcta), 0, 0, 1, 1}, - {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {&__pyx_n_s_xyz, __pyx_k_xyz, sizeof(__pyx_k_xyz), 0, 0, 1, 1}, - {&__pyx_n_s_xyz_traj_curr, __pyx_k_xyz_traj_curr, sizeof(__pyx_k_xyz_traj_curr), 0, 0, 1, 1}, - {&__pyx_n_s_xyz_traj_prev, __pyx_k_xyz_traj_prev, sizeof(__pyx_k_xyz_traj_prev), 0, 0, 1, 1}, - {&__pyx_n_s_xyz_unfold, __pyx_k_xyz_unfold, sizeof(__pyx_k_xyz_unfold), 0, 0, 1, 1}, - {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 108, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 944, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 134, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 149, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 152, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error) - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 406, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 615, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 834, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coor, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorA, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_coorB, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { +static PyObject *__pyx_pf_11newanalysis_6unfold_16bertholdHorn(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coor, __Pyx_memviewslice __pyx_v_coorA, __Pyx_memviewslice __pyx_v_coorB) { + __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_v_tmpx; + double __pyx_v_tmpy; + double __pyx_v_tmpz; + int __pyx_v_i; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; + Py_ssize_t __pyx_t_19; + Py_ssize_t __pyx_t_20; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("bertholdHorn", 0); - /* "src/helpers/unfold.pyx":353 + /* "newanalysis/helpers/unfold.pyx":353 * coorB .. corresponding coordinates of the current frame * """ * cdef double [:,:] R = np.zeros((3,3)) # <<<<<<<<<<<<<< * cdef double tmpx, tmpy, tmpz * cdef int i */ - __pyx_tuple_ = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 353, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_tuple__11}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_R = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/unfold.pyx":357 + * cdef int i * - * cdef inline int import_umath() except -1: - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 944, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) # <<<<<<<<<<<<<< * - * cdef inline int import_ufunc() except -1: + * for i in prange(coor.shape[0], nogil=True): */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 950, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[1]; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coorA.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coorA.shape[1]; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coorB.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coorB.shape[1]; + GetRotation((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_6 * __pyx_v_R.strides[0]) ) + __pyx_t_7 * __pyx_v_R.strides[1]) )))), (__pyx_v_coorA.shape[0]), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorA.data + __pyx_t_8 * __pyx_v_coorA.strides[0]) ) + __pyx_t_9 * __pyx_v_coorA.strides[1]) )))), (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coorB.data + __pyx_t_10 * __pyx_v_coorB.strides[0]) ) + __pyx_t_11 * __pyx_v_coorB.strides[1]) )))), 0); - /* "View.MemoryView":134 - * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< - * - * if itemsize <= 0: - */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - - /* "View.MemoryView":137 - * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< - * - * if not isinstance(format, bytes): - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * + /* "newanalysis/helpers/unfold.pyx":359 + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) * + * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + if (unlikely(!__pyx_v_coor.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("coor"); __PYX_ERR(0, 359, __pyx_L4_error) } + __pyx_t_12 = (__pyx_v_coor.shape[0]); + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_14 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1; + if (__pyx_t_14 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_tmpx) lastprivate(__pyx_v_tmpy) lastprivate(__pyx_v_tmpz) + #endif /* _OPENMP */ + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){ + { + __pyx_v_i = (int)(0 + 1 * __pyx_t_13); + /* Initialize private variables to invalid values */ + __pyx_v_tmpx = ((double)__PYX_NAN()); + __pyx_v_tmpy = ((double)__PYX_NAN()); + __pyx_v_tmpz = ((double)__PYX_NAN()); - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/unfold.pyx":360 * - * if self.dtype_is_object: - */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len + * for i in prange(coor.shape[0], nogil=True): + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] # <<<<<<<<<<<<<< + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_t_11 = 0; + __pyx_t_10 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_R.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_R.shape[1]; + __pyx_t_9 = __pyx_v_i; + __pyx_t_8 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[1]; + __pyx_t_7 = 0; + __pyx_t_6 = 1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[1]; + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = 1; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + __pyx_t_17 = 0; + __pyx_t_18 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_R.shape[1]; + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_tmpx = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_11 * __pyx_v_R.strides[0]) ) + __pyx_t_10 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_8 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_7 * __pyx_v_R.strides[0]) ) + __pyx_t_6 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_17 * __pyx_v_R.strides[0]) ) + __pyx_t_18 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) ))))); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/helpers/unfold.pyx":361 + * for i in prange(coor.shape[0], nogil=True): + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] # <<<<<<<<<<<<<< + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_t_20 = 1; + __pyx_t_19 = 0; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_R.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_R.shape[1]; + __pyx_t_18 = __pyx_v_i; + __pyx_t_17 = 0; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coor.shape[0]; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_coor.shape[1]; + __pyx_t_16 = 1; + __pyx_t_15 = 1; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_R.shape[0]; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_R.shape[1]; + __pyx_t_6 = __pyx_v_i; + __pyx_t_7 = 1; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coor.shape[0]; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coor.shape[1]; + __pyx_t_8 = 1; + __pyx_t_9 = 2; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_R.shape[0]; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_R.shape[1]; + __pyx_t_10 = __pyx_v_i; + __pyx_t_11 = 2; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coor.shape[0]; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coor.shape[1]; + __pyx_v_tmpy = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_20 * __pyx_v_R.strides[0]) ) + __pyx_t_19 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_18 * __pyx_v_coor.strides[0]) ) + __pyx_t_17 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_16 * __pyx_v_R.strides[0]) ) + __pyx_t_15 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_6 * __pyx_v_coor.strides[0]) ) + __pyx_t_7 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_8 * __pyx_v_R.strides[0]) ) + __pyx_t_9 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_10 * __pyx_v_coor.strides[0]) ) + __pyx_t_11 * __pyx_v_coor.strides[1]) ))))); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/unfold.pyx":362 + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] # <<<<<<<<<<<<<< + * coor[i,0] = tmpx + * coor[i,1] = tmpy */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_t_11 = 2; + __pyx_t_10 = 0; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_R.shape[0]; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_R.shape[1]; + __pyx_t_9 = __pyx_v_i; + __pyx_t_8 = 0; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coor.shape[0]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coor.shape[1]; + __pyx_t_7 = 2; + __pyx_t_6 = 1; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_R.shape[0]; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_R.shape[1]; + __pyx_t_15 = __pyx_v_i; + __pyx_t_16 = 1; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_coor.shape[0]; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coor.shape[1]; + __pyx_t_17 = 2; + __pyx_t_18 = 2; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_R.shape[0]; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_R.shape[1]; + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = 2; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + __pyx_v_tmpz = ((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_11 * __pyx_v_R.strides[0]) ) + __pyx_t_10 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_9 * __pyx_v_coor.strides[0]) ) + __pyx_t_8 * __pyx_v_coor.strides[1]) )))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_7 * __pyx_v_R.strides[0]) ) + __pyx_t_6 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_15 * __pyx_v_coor.strides[0]) ) + __pyx_t_16 * __pyx_v_coor.strides[1]) ))))) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_R.data + __pyx_t_17 * __pyx_v_R.strides[0]) ) + __pyx_t_18 * __pyx_v_R.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) ))))); - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< - * - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "newanalysis/helpers/unfold.pyx":363 + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx # <<<<<<<<<<<<<< + * coor[i,1] = tmpy + * coor[i,2] = tmpz */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_t_20 = __pyx_v_i; + __pyx_t_19 = 0; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpx; - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: + /* "newanalysis/helpers/unfold.pyx":364 + * tmpz = R[2,0] * coor[i,0] + R[2,1] * coor[i,1] + R[2,2] * coor[i,2] + * coor[i,0] = tmpx + * coor[i,1] = tmpy # <<<<<<<<<<<<<< + * coor[i,2] = tmpz */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = 1; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[0]; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_19 * __pyx_v_coor.strides[0]) ) + __pyx_t_20 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpy; - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< - * - * if flags & PyBUF_ND: + /* "newanalysis/helpers/unfold.pyx":365 + * coor[i,0] = tmpx + * coor[i,1] = tmpy + * coor[i,2] = tmpz # <<<<<<<<<<<<<< */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_t_20 = __pyx_v_i; + __pyx_t_19 = 2; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_coor.shape[0]; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_coor.shape[1]; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_coor.data + __pyx_t_20 * __pyx_v_coor.strides[0]) ) + __pyx_t_19 * __pyx_v_coor.strides[1]) )) = __pyx_v_tmpz; + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "View.MemoryView":572 - * if self.view.strides == NULL: - * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< + /* "newanalysis/helpers/unfold.pyx":359 + * GetRotation(&R[0,0], coorA.shape[0], &coorA[0,0], &coorB[0,0], 0) * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + * for i in prange(coor.shape[0], nogil=True): # <<<<<<<<<<<<<< + * tmpx = R[0,0] * coor[i,0] + R[0,1] * coor[i,1] + R[0,2] * coor[i,2] + * tmpy = R[1,0] * coor[i,0] + R[1,1] * coor[i,1] + R[1,2] * coor[i,2] */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L4_error: { + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L1_error; + } + __pyx_L5:; + } + } - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + /* "newanalysis/helpers/unfold.pyx":341 + * return float(minimum) * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - */ - __pyx_tuple__15 = PyTuple_New(1); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_INCREF(__pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__15, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_tuple__15); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def bertholdHorn(double [:,:] coor, double [:,:] coorA, double [:,:] coorB): + * """ */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: - */ - __pyx_slice__18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__18)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__18); - __Pyx_GIVEREF(__pyx_slice__18); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1); + __Pyx_AddTraceback("newanalysis.unfold.bertholdHorn", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_R, 1); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_array __pyx_vtable_array; - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_tuple__22 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - - /* "src/helpers/unfold.pyx":19 - * - * @cython.boundscheck(False) - * def unfoldBox(np.ndarray[np.float64_t,ndim=2,mode='c'] coor_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_prev, - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_curr, - */ - __pyx_tuple__23 = PyTuple_Pack(10, __pyx_n_s_coor_unfold, __pyx_n_s_coor_prev, __pyx_n_s_coor_curr, __pyx_n_s_boxl, __pyx_n_s_boxl2, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_DX, __pyx_n_s_DY, __pyx_n_s_DZ); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_unfold_pyx, __pyx_n_s_unfoldBox, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 19, __pyx_L1_error) - - /* "src/helpers/unfold.pyx":68 - * - * @cython.boundscheck(False) - * def unfoldOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, - * np.ndarray[np.float64_t,ndim=2] xyz_traj_curr, - */ - __pyx_tuple__25 = PyTuple_Pack(18, __pyx_n_s_xyz_unfold, __pyx_n_s_xyz_traj_prev, __pyx_n_s_xyz_traj_curr, __pyx_n_s_boxlength, __pyx_n_s_boxl, __pyx_n_s_boxl2, __pyx_n_s_boxl34, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_DX, __pyx_n_s_DY, __pyx_n_s_DZ, __pyx_n_s_DD, __pyx_n_s_c_xyz_traj_prev, __pyx_n_s_c_xyz_traj_curr, __pyx_n_s_unfold, __pyx_n_s_prev, __pyx_n_s_curr); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(4, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_unfold_pyx, __pyx_n_s_unfoldOcta, 68, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 68, __pyx_L1_error) - - /* "src/helpers/unfold.pyx":129 - * - * @cython.boundscheck(False) - * def unfoldCharmmOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, - * np.ndarray[np.float64_t,ndim=2] xyz_traj_curr, - */ - __pyx_tuple__27 = PyTuple_Pack(25, __pyx_n_s_xyz_unfold, __pyx_n_s_xyz_traj_prev, __pyx_n_s_xyz_traj_curr, __pyx_n_s_dimensions, __pyx_n_s_diag, __pyx_n_s_offdiag, __pyx_n_s_norm, __pyx_n_s_norm2, __pyx_n_s_norm22, __pyx_n_s_norm32, __pyx_n_s_A, __pyx_n_s_B, __pyx_n_s_C, __pyx_n_s_DX, __pyx_n_s_DY, __pyx_n_s_DZ, __pyx_n_s_D, __pyx_n_s_T1, __pyx_n_s_T2, __pyx_n_s_T3, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_unfold, __pyx_n_s_prev, __pyx_n_s_curr); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(4, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_unfold_pyx, __pyx_n_s_unfoldCharmmOcta, 129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 129, __pyx_L1_error) - - /* "src/helpers/unfold.pyx":216 - * - * @cython.boundscheck(False) - * def minDistBox(np.ndarray[np.float64_t,ndim=1,mode="c"] aufpunkt, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] com, - * np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, - */ - __pyx_tuple__29 = PyTuple_Pack(18, __pyx_n_s_aufpunkt, __pyx_n_s_com, __pyx_n_s_xyz, __pyx_n_s_boxlength, __pyx_n_s_atoms_per_residue, __pyx_n_s_residue_first_atom, __pyx_n_s_shift, __pyx_n_s_auf, __pyx_n_s_boxl, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_nmol, __pyx_n_s_ccom, __pyx_n_s_cxyz, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_natom); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(6, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_unfold_pyx, __pyx_n_s_minDistBox, 216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 216, __pyx_L1_error) - - /* "src/helpers/unfold.pyx":258 - * - * @cython.boundscheck(False) - * def minDistCenterBox(np.ndarray[np.float64_t,ndim=1,mode='c'] aufpunkt, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] com, - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor, - */ - __pyx_tuple__31 = PyTuple_Pack(12, __pyx_n_s_aufpunkt, __pyx_n_s_com, __pyx_n_s_coor, __pyx_n_s_boxl, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_shift, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_nmol, __pyx_n_s_natom); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_unfold_pyx, __pyx_n_s_minDistCenterBox, 258, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 258, __pyx_L1_error) - - /* "src/helpers/unfold.pyx":292 - * - * @cython.boundscheck(False) - * def minVec(double [:] coor1, double [:] coor2, double boxl, double boxl2): # <<<<<<<<<<<<<< - * """ - * minVec(xyz1, xyz2, boxl, boxl2) - */ - __pyx_tuple__33 = PyTuple_Pack(6, __pyx_n_s_coor1, __pyx_n_s_coor2, __pyx_n_s_boxl, __pyx_n_s_boxl2, __pyx_n_s_delta, __pyx_n_s_i); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_unfold_pyx, __pyx_n_s_minVec, 292, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 292, __pyx_L1_error) - - /* "src/helpers/unfold.pyx":309 - * - * @cython.boundscheck(False) - * def minDist(double [:] coor1, double [:] coor2, double boxl, double boxl2): # <<<<<<<<<<<<<< - * """ - * minDist(xyz1, xyz2, boxl, boxl2) - */ - __pyx_tuple__35 = PyTuple_Pack(6, __pyx_n_s_coor1, __pyx_n_s_coor2, __pyx_n_s_boxl, __pyx_n_s_boxl2, __pyx_n_s_delta, __pyx_n_s_i); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_unfold_pyx, __pyx_n_s_minDist, 309, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 309, __pyx_L1_error) - - /* "src/helpers/unfold.pyx":327 - * - * @cython.boundscheck(False) - * def findMinDist(double [:,:] coor, double boxl): # <<<<<<<<<<<<<< - * cdef int n = coor.shape[0], i, j - * cdef double minimum = 1000000.0, dist - */ - __pyx_tuple__37 = PyTuple_Pack(8, __pyx_n_s_coor, __pyx_n_s_boxl, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_minimum, __pyx_n_s_dist, __pyx_n_s_boxl2); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_unfold_pyx, __pyx_n_s_findMinDist, 327, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 327, __pyx_L1_error) - - /* "src/helpers/unfold.pyx":342 - * - * @cython.boundscheck(False) - * def bertholdHorn(double [:,:] coor, double [:,:] coorA, double [:,:] coorB): # <<<<<<<<<<<<<< - * """ - * bertholdHorn(coor,coorA,coorB) - */ - __pyx_tuple__39 = PyTuple_Pack(8, __pyx_n_s_coor, __pyx_n_s_coorA, __pyx_n_s_coorB, __pyx_n_s_R, __pyx_n_s_tmpx, __pyx_n_s_tmpy, __pyx_n_s_tmpz, __pyx_n_s_i); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_helpers_unfold_pyx, __pyx_n_s_bertholdHorn, 342, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 342, __pyx_L1_error) - - /* "View.MemoryView":287 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") - */ - __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - - /* "View.MemoryView":288 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); - - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - - /* "View.MemoryView":292 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - - /* "View.MemoryView":293 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_tuple__46 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif } - -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - /* InitThreads.init */ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 -PyEval_InitThreads(); -#endif - -if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; +static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; } -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - generic = Py_None; Py_INCREF(Py_None); - strided = Py_None; Py_INCREF(Py_None); - indirect = Py_None; Py_INCREF(Py_None); - contiguous = Py_None; Py_INCREF(Py_None); - indirect_contiguous = Py_None; Py_INCREF(Py_None); - __Pyx_RefNannyFinishContext(); - return 0; +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } } -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; } -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); } -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __pyx_vtabptr_array = &__pyx_vtable_array; - __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; - if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_array.tp_print = 0; +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ #endif - if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - __pyx_array_type = &__pyx_type___pyx_array; - if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_MemviewEnum.tp_print = 0; + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) - __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; - __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; - __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; - __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; - __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; - __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; - __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; - __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; - __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; - if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryview.tp_print = 0; + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - __pyx_memoryview_type = &__pyx_type___pyx_memoryview; - __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; - __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; - __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; - __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; - __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; - if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryviewslice.tp_print = 0; + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", - #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyTypeObject), - #else - sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyHeapTypeObject), - #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT(PyArray_Descr), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 199, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 222, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayMultiIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 226, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error) - __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 770, __pyx_L1_error) - __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 772, __pyx_L1_error) - __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 774, __pyx_L1_error) - __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 776, __pyx_L1_error) - __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 778, __pyx_L1_error) - __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 780, __pyx_L1_error) - __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 782, __pyx_L1_error) - __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 784, __pyx_L1_error) - __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 786, __pyx_L1_error) - __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 788, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT(PyUFuncObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; #endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "newanalysis.unfold.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; #else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initunfold(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initunfold(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_unfold(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_unfold(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { - result = PyDict_SetItemString(moddict, to_name, value); - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; -static CYTHON_SMALL_CODE int __pyx_pymod_exec_unfold(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - PyObject *__pyx_t_1 = NULL; - static PyThread_type_lock __pyx_t_2[8]; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'unfold' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_unfold(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.unfold.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - PyEval_InitThreads(); + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("unfold", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + 0, /*tp_compare*/ #endif - if (__pyx_module_is_main_newanalysis__unfold) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "newanalysis.unfold")) { - if (unlikely(PyDict_SetItemString(modules, "newanalysis.unfold", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } + 0, /*tp_as_async*/ #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_array, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_array, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_array, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ #endif +}; +#endif - /* "src/helpers/unfold.pyx":4 - * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - * - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np - * - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); + return o; +} - /* "src/helpers/unfold.pyx":19 - * - * @cython.boundscheck(False) - * def unfoldBox(np.ndarray[np.float64_t,ndim=2,mode='c'] coor_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_prev, - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_curr, - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6unfold_1unfoldBox, NULL, __pyx_n_s_newanalysis_unfold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_unfoldBox, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} - /* "src/helpers/unfold.pyx":68 - * - * @cython.boundscheck(False) - * def unfoldOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, - * np.ndarray[np.float64_t,ndim=2] xyz_traj_curr, - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6unfold_3unfoldOcta, NULL, __pyx_n_s_newanalysis_unfold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_unfoldOcta, __pyx_t_1) < 0) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} - /* "src/helpers/unfold.pyx":129 - * - * @cython.boundscheck(False) - * def unfoldCharmmOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, - * np.ndarray[np.float64_t,ndim=2] xyz_traj_curr, - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6unfold_5unfoldCharmmOcta, NULL, __pyx_n_s_newanalysis_unfold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_unfoldCharmmOcta, __pyx_t_1) < 0) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} - /* "src/helpers/unfold.pyx":216 - * - * @cython.boundscheck(False) - * def minDistBox(np.ndarray[np.float64_t,ndim=1,mode="c"] aufpunkt, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode="c"] com, - * np.ndarray[np.float64_t,ndim=2,mode="c"] xyz, - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6unfold_7minDistBox, NULL, __pyx_n_s_newanalysis_unfold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_minDistBox, __pyx_t_1) < 0) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyObject *__pyx_specialmethod___pyx_MemviewEnum___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_MemviewEnum___repr__(self); +} - /* "src/helpers/unfold.pyx":258 - * - * @cython.boundscheck(False) - * def minDistCenterBox(np.ndarray[np.float64_t,ndim=1,mode='c'] aufpunkt, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=2,mode='c'] com, - * np.ndarray[np.float64_t,ndim=2,mode='c'] coor, - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6unfold_9minDistCenterBox, NULL, __pyx_n_s_newanalysis_unfold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_minDistCenterBox, __pyx_t_1) < 0) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyMethodDef __pyx_methods_Enum[] = { + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_MemviewEnum___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "newanalysis.unfold.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_MemviewEnum_slots, +}; +#else - /* "src/helpers/unfold.pyx":292 - * - * @cython.boundscheck(False) - * def minVec(double [:] coor1, double [:] coor2, double boxl, double boxl2): # <<<<<<<<<<<<<< - * """ - * minVec(xyz1, xyz2, boxl, boxl2) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6unfold_11minVec, NULL, __pyx_n_s_newanalysis_unfold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_minVec, __pyx_t_1) < 0) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyTypeObject __pyx_type___pyx_MemviewEnum = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.unfold.""Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_Enum, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_MemviewEnum___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_Enum, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; - /* "src/helpers/unfold.pyx":309 - * - * @cython.boundscheck(False) - * def minDist(double [:] coor1, double [:] coor2, double boxl, double boxl2): # <<<<<<<<<<<<<< - * """ - * minDist(xyz1, xyz2, boxl, boxl2) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6unfold_13minDist, NULL, __pyx_n_s_newanalysis_unfold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_minDist, __pyx_t_1) < 0) __PYX_ERR(0, 309, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->_array_interface = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} - /* "src/helpers/unfold.pyx":327 - * - * @cython.boundscheck(False) - * def findMinDist(double [:,:] coor, double boxl): # <<<<<<<<<<<<<< - * cdef int n = coor.shape[0], i, j - * cdef double minimum = 1000000.0, dist - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6unfold_15findMinDist, NULL, __pyx_n_s_newanalysis_unfold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_findMinDist, __pyx_t_1) < 0) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_memoryview___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + Py_CLEAR(p->_array_interface); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} - /* "src/helpers/unfold.pyx":342 - * - * @cython.boundscheck(False) - * def bertholdHorn(double [:,:] coor, double [:,:] coorA, double [:,:] coorB): # <<<<<<<<<<<<<< - * """ - * bertholdHorn(coor,coorA,coorB) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_6unfold_17bertholdHorn, NULL, __pyx_n_s_newanalysis_unfold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_bertholdHorn, __pyx_t_1) < 0) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->_array_interface) { + e = (*v)(p->_array_interface, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} - /* "src/helpers/unfold.pyx":1 - * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< - * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - * - */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_array_interface); + p->_array_interface = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} - /* "View.MemoryView":210 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * def __dealloc__(array self): - */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_array_type); +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} - /* "View.MemoryView":287 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(generic); - __Pyx_DECREF_SET(generic, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); +} - /* "View.MemoryView":288 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(strided); - __Pyx_DECREF_SET(strided, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); +} - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(indirect); - __Pyx_DECREF_SET(indirect, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); +} - /* "View.MemoryView":292 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(contiguous); - __Pyx_DECREF_SET(contiguous, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); +} - /* "View.MemoryView":293 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(indirect_contiguous); - __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); +} - /* "View.MemoryView":317 - * - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ - * PyThread_allocate_lock(), - */ - __pyx_memoryview_thread_locks_used = 0; +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); +} - /* "View.MemoryView":318 - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< - * PyThread_allocate_lock(), - * PyThread_allocate_lock(), - */ - __pyx_t_2[0] = PyThread_allocate_lock(); - __pyx_t_2[1] = PyThread_allocate_lock(); - __pyx_t_2[2] = PyThread_allocate_lock(); - __pyx_t_2[3] = PyThread_allocate_lock(); - __pyx_t_2[4] = PyThread_allocate_lock(); - __pyx_t_2[5] = PyThread_allocate_lock(); - __pyx_t_2[6] = PyThread_allocate_lock(); - __pyx_t_2[7] = PyThread_allocate_lock(); - memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); +} - /* "View.MemoryView":551 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_memoryview_type); +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); +} - /* "View.MemoryView":997 - * return self.from_object - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_memoryviewslice_type); +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); +} - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +static PyObject *__pyx_specialmethod___pyx_memoryview___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_memoryview___repr__(self); +} - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - */ +static PyMethodDef __pyx_methods_memoryview[] = { + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_memoryview___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"is_c_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; - /*--- Wrapped vars code ---*/ +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0}, + {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0}, + {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0}, + {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0}, + {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0}, + {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0}, + {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0}, + {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0}, + {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init newanalysis.unfold", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_CLEAR(__pyx_m); - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init newanalysis.unfold"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; #endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "newanalysis.unfold.memoryview", + sizeof(struct __pyx_memoryview_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_memoryview_slots, +}; +#else -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.unfold.""memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_memoryview, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_memoryview, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_memoryview, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; #endif - return PyObject_GetAttr(obj, attr_name); +static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + new((void*)&(p->from_slice)) __Pyx_memviewslice(); + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; + return o; } -#endif -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) { + if (PyObject_CallFinalizerFromDealloc(o)) return; } - return result; + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_memoryviewslice___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->from_slice); + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); } -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; + } + return 0; } -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); + return 0; } -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; +static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "newanalysis.unfold._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.unfold.""_memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods__memoryviewslice, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new__memoryviewslice, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1}, + {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, + {&__pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_k_All_dimensions_preceding_dimensi, sizeof(__pyx_k_All_dimensions_preceding_dimensi), 0, 0, 1, 0}, + {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, + {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1}, + {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, + {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1}, + {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, + {&__pyx_kp_u_Cannot_index_with_type, __pyx_k_Cannot_index_with_type, sizeof(__pyx_k_Cannot_index_with_type), 0, 1, 0, 0}, + {&__pyx_kp_s_Cannot_transpose_memoryview_with, __pyx_k_Cannot_transpose_memoryview_with, sizeof(__pyx_k_Cannot_transpose_memoryview_with), 0, 0, 1, 0}, + {&__pyx_n_s_D, __pyx_k_D, sizeof(__pyx_k_D), 0, 0, 1, 1}, + {&__pyx_n_s_DD, __pyx_k_DD, sizeof(__pyx_k_DD), 0, 0, 1, 1}, + {&__pyx_n_s_DX, __pyx_k_DX, sizeof(__pyx_k_DX), 0, 0, 1, 1}, + {&__pyx_n_s_DY, __pyx_k_DY, sizeof(__pyx_k_DY), 0, 0, 1, 1}, + {&__pyx_n_s_DZ, __pyx_k_DZ, sizeof(__pyx_k_DZ), 0, 0, 1, 1}, + {&__pyx_kp_s_Dimension_d_is_not_direct, __pyx_k_Dimension_d_is_not_direct, sizeof(__pyx_k_Dimension_d_is_not_direct), 0, 0, 1, 0}, + {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, + {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, + {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_k_Index_out_of_bounds_axis_d, sizeof(__pyx_k_Index_out_of_bounds_axis_d), 0, 0, 1, 0}, + {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, + {&__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 1, 0, 0}, + {&__pyx_kp_u_Invalid_shape_in_axis, __pyx_k_Invalid_shape_in_axis, sizeof(__pyx_k_Invalid_shape_in_axis), 0, 1, 0, 0}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, + {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, + {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, + {&__pyx_kp_u_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 1, 0, 0}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 0, 1, 1}, + {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1}, + {&__pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_k_Step_may_not_be_zero_axis_d, sizeof(__pyx_k_Step_may_not_be_zero_axis_d), 0, 0, 1, 0}, + {&__pyx_n_s_T1, __pyx_k_T1, sizeof(__pyx_k_T1), 0, 0, 1, 1}, + {&__pyx_n_s_T2, __pyx_k_T2, sizeof(__pyx_k_T2), 0, 0, 1, 1}, + {&__pyx_n_s_T3, __pyx_k_T3, sizeof(__pyx_k_T3), 0, 0, 1, 1}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, + {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, + {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, + {&__pyx_n_s__39, __pyx_k__39, sizeof(__pyx_k__39), 0, 0, 1, 1}, + {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, + {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, + {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, + {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, + {&__pyx_kp_u_and, __pyx_k_and, sizeof(__pyx_k_and), 0, 1, 0, 0}, + {&__pyx_n_s_apr, __pyx_k_apr, sizeof(__pyx_k_apr), 0, 0, 1, 1}, + {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_atoms_per_residue, __pyx_k_atoms_per_residue, sizeof(__pyx_k_atoms_per_residue), 0, 0, 1, 1}, + {&__pyx_n_s_auf, __pyx_k_auf, sizeof(__pyx_k_auf), 0, 0, 1, 1}, + {&__pyx_n_s_aufpunkt, __pyx_k_aufpunkt, sizeof(__pyx_k_aufpunkt), 0, 0, 1, 1}, + {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, + {&__pyx_n_s_bertholdHorn, __pyx_k_bertholdHorn, sizeof(__pyx_k_bertholdHorn), 0, 0, 1, 1}, + {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, + {&__pyx_n_s_boxl2, __pyx_k_boxl2, sizeof(__pyx_k_boxl2), 0, 0, 1, 1}, + {&__pyx_n_s_boxl34, __pyx_k_boxl34, sizeof(__pyx_k_boxl34), 0, 0, 1, 1}, + {&__pyx_n_s_boxlength, __pyx_k_boxlength, sizeof(__pyx_k_boxlength), 0, 0, 1, 1}, + {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, + {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, + {&__pyx_n_s_c_xyz_traj_curr, __pyx_k_c_xyz_traj_curr, sizeof(__pyx_k_c_xyz_traj_curr), 0, 0, 1, 1}, + {&__pyx_n_s_c_xyz_traj_prev, __pyx_k_c_xyz_traj_prev, sizeof(__pyx_k_c_xyz_traj_prev), 0, 0, 1, 1}, + {&__pyx_n_s_ccom, __pyx_k_ccom, sizeof(__pyx_k_ccom), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, + {&__pyx_kp_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 0}, + {&__pyx_n_s_com, __pyx_k_com, sizeof(__pyx_k_com), 0, 0, 1, 1}, + {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, + {&__pyx_n_s_coor, __pyx_k_coor, sizeof(__pyx_k_coor), 0, 0, 1, 1}, + {&__pyx_n_s_coor1, __pyx_k_coor1, sizeof(__pyx_k_coor1), 0, 0, 1, 1}, + {&__pyx_n_s_coor2, __pyx_k_coor2, sizeof(__pyx_k_coor2), 0, 0, 1, 1}, + {&__pyx_n_s_coorA, __pyx_k_coorA, sizeof(__pyx_k_coorA), 0, 0, 1, 1}, + {&__pyx_n_s_coorB, __pyx_k_coorB, sizeof(__pyx_k_coorB), 0, 0, 1, 1}, + {&__pyx_n_s_coor_curr, __pyx_k_coor_curr, sizeof(__pyx_k_coor_curr), 0, 0, 1, 1}, + {&__pyx_n_s_coor_prev, __pyx_k_coor_prev, sizeof(__pyx_k_coor_prev), 0, 0, 1, 1}, + {&__pyx_n_s_coor_unfold, __pyx_k_coor_unfold, sizeof(__pyx_k_coor_unfold), 0, 0, 1, 1}, + {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, + {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, + {&__pyx_n_s_curr, __pyx_k_curr, sizeof(__pyx_k_curr), 0, 0, 1, 1}, + {&__pyx_n_s_cxyz, __pyx_k_cxyz, sizeof(__pyx_k_cxyz), 0, 0, 1, 1}, + {&__pyx_n_s_delta, __pyx_k_delta, sizeof(__pyx_k_delta), 0, 0, 1, 1}, + {&__pyx_n_s_diag, __pyx_k_diag, sizeof(__pyx_k_diag), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_n_s_dimensions, __pyx_k_dimensions, sizeof(__pyx_k_dimensions), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1}, + {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, + {&__pyx_n_s_findMinDist, __pyx_k_findMinDist, sizeof(__pyx_k_findMinDist), 0, 0, 1, 1}, + {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, + {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0}, + {&__pyx_kp_u_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 1, 0, 0}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, + {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, + {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, + {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, + {&__pyx_n_s_minDist, __pyx_k_minDist, sizeof(__pyx_k_minDist), 0, 0, 1, 1}, + {&__pyx_n_s_minDistBox, __pyx_k_minDistBox, sizeof(__pyx_k_minDistBox), 0, 0, 1, 1}, + {&__pyx_n_s_minDistCenterBox, __pyx_k_minDistCenterBox, sizeof(__pyx_k_minDistCenterBox), 0, 0, 1, 1}, + {&__pyx_n_s_minVec, __pyx_k_minVec, sizeof(__pyx_k_minVec), 0, 0, 1, 1}, + {&__pyx_n_s_minimum, __pyx_k_minimum, sizeof(__pyx_k_minimum), 0, 0, 1, 1}, + {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_s_natom, __pyx_k_natom, sizeof(__pyx_k_natom), 0, 0, 1, 1}, + {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_kp_s_newanalysis_helpers_unfold_pyx, __pyx_k_newanalysis_helpers_unfold_pyx, sizeof(__pyx_k_newanalysis_helpers_unfold_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_newanalysis_unfold, __pyx_k_newanalysis_unfold, sizeof(__pyx_k_newanalysis_unfold), 0, 0, 1, 1}, + {&__pyx_n_s_nmol, __pyx_k_nmol, sizeof(__pyx_k_nmol), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, + {&__pyx_n_s_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 0, 0, 1, 1}, + {&__pyx_n_s_norm2, __pyx_k_norm2, sizeof(__pyx_k_norm2), 0, 0, 1, 1}, + {&__pyx_n_s_norm22, __pyx_k_norm22, sizeof(__pyx_k_norm22), 0, 0, 1, 1}, + {&__pyx_n_s_norm32, __pyx_k_norm32, sizeof(__pyx_k_norm32), 0, 0, 1, 1}, + {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, + {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, + {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, + {&__pyx_n_s_offdiag, __pyx_k_offdiag, sizeof(__pyx_k_offdiag), 0, 0, 1, 1}, + {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_prev, __pyx_k_prev, sizeof(__pyx_k_prev), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1}, + {&__pyx_n_s_residue_first_atom, __pyx_k_residue_first_atom, sizeof(__pyx_k_residue_first_atom), 0, 0, 1, 1}, + {&__pyx_n_s_rfa, __pyx_k_rfa, sizeof(__pyx_k_rfa), 0, 0, 1, 1}, + {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_shift, __pyx_k_shift, sizeof(__pyx_k_shift), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, + {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, + {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_tmpx, __pyx_k_tmpx, sizeof(__pyx_k_tmpx), 0, 0, 1, 1}, + {&__pyx_n_s_tmpy, __pyx_k_tmpy, sizeof(__pyx_k_tmpy), 0, 0, 1, 1}, + {&__pyx_n_s_tmpz, __pyx_k_tmpz, sizeof(__pyx_k_tmpz), 0, 0, 1, 1}, + {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, + {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, + {&__pyx_n_s_unfold, __pyx_k_unfold, sizeof(__pyx_k_unfold), 0, 0, 1, 1}, + {&__pyx_n_s_unfoldBox, __pyx_k_unfoldBox, sizeof(__pyx_k_unfoldBox), 0, 0, 1, 1}, + {&__pyx_n_s_unfoldCharmmOcta, __pyx_k_unfoldCharmmOcta, sizeof(__pyx_k_unfoldCharmmOcta), 0, 0, 1, 1}, + {&__pyx_n_s_unfoldOcta, __pyx_k_unfoldOcta, sizeof(__pyx_k_unfoldOcta), 0, 0, 1, 1}, + {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, + {&__pyx_n_s_xyz, __pyx_k_xyz, sizeof(__pyx_k_xyz), 0, 0, 1, 1}, + {&__pyx_n_s_xyz_traj_curr, __pyx_k_xyz_traj_curr, sizeof(__pyx_k_xyz_traj_curr), 0, 0, 1, 1}, + {&__pyx_n_s_xyz_traj_prev, __pyx_k_xyz_traj_prev, sizeof(__pyx_k_xyz_traj_prev), 0, 0, 1, 1}, + {&__pyx_n_s_xyz_unfold, __pyx_k_xyz_unfold, sizeof(__pyx_k_xyz_unfold), 0, 0, 1, 1}, + {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 100, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 141, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 156, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 159, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 373, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 408, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 618, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 914, __pyx_L1_error) + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 983, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cached_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + */ + __pyx_tuple__4 = PyTuple_New(1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_tuple__4, 0, __pyx_int_neg_1)) __PYX_ERR(1, 582, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_tuple__4); + + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False + */ + __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + */ + __pyx_tuple__8 = PyTuple_Pack(3, __pyx_int_136983863, __pyx_int_112105877, __pyx_int_184977713); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: + */ + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: + */ + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 989, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + + /* "newanalysis/helpers/unfold.pyx":353 + * coorB .. corresponding coordinates of the current frame + * """ + * cdef double [:,:] R = np.zeros((3,3)) # <<<<<<<<<<<<<< + * cdef double tmpx, tmpy, tmpz + * cdef int i + */ + __pyx_tuple__11 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 353, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_sys); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + */ + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_collections_abc); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * + */ + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_collections); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + + /* "View.MemoryView":309 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") + */ + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * + */ + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * + */ + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_tuple__20 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "newanalysis/helpers/unfold.pyx":18 + * void GetRotation(double *R_ptr, int n, double *APoints_ptr, double *BPoints_ptr, int debug) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldBox(np.ndarray[np.float64_t,ndim=2,mode='c'] coor_unfold, + * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_prev, + */ + __pyx_tuple__22 = PyTuple_Pack(10, __pyx_n_s_coor_unfold, __pyx_n_s_coor_prev, __pyx_n_s_coor_curr, __pyx_n_s_boxl, __pyx_n_s_boxl2, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_DX, __pyx_n_s_DY, __pyx_n_s_DZ); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_unfold_pyx, __pyx_n_s_unfoldBox, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 18, __pyx_L1_error) + + /* "newanalysis/helpers/unfold.pyx":67 + * coor_unfold[i,2] += DZ + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, + * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, + */ + __pyx_tuple__24 = PyTuple_Pack(18, __pyx_n_s_xyz_unfold, __pyx_n_s_xyz_traj_prev, __pyx_n_s_xyz_traj_curr, __pyx_n_s_boxlength, __pyx_n_s_boxl, __pyx_n_s_boxl2, __pyx_n_s_boxl34, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_DX, __pyx_n_s_DY, __pyx_n_s_DZ, __pyx_n_s_DD, __pyx_n_s_c_xyz_traj_prev, __pyx_n_s_c_xyz_traj_curr, __pyx_n_s_unfold, __pyx_n_s_prev, __pyx_n_s_curr); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_unfold_pyx, __pyx_n_s_unfoldOcta, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 67, __pyx_L1_error) + + /* "newanalysis/helpers/unfold.pyx":128 + * unfold[i+2] += DZ + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldCharmmOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, + * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, + */ + __pyx_tuple__26 = PyTuple_Pack(25, __pyx_n_s_xyz_unfold, __pyx_n_s_xyz_traj_prev, __pyx_n_s_xyz_traj_curr, __pyx_n_s_dimensions, __pyx_n_s_diag, __pyx_n_s_offdiag, __pyx_n_s_norm, __pyx_n_s_norm2, __pyx_n_s_norm22, __pyx_n_s_norm32, __pyx_n_s_A, __pyx_n_s_B, __pyx_n_s_C, __pyx_n_s_DX, __pyx_n_s_DY, __pyx_n_s_DZ, __pyx_n_s_D, __pyx_n_s_T1, __pyx_n_s_T2, __pyx_n_s_T3, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_unfold, __pyx_n_s_prev, __pyx_n_s_curr); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_unfold_pyx, __pyx_n_s_unfoldCharmmOcta, 128, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 128, __pyx_L1_error) + + /* "newanalysis/helpers/unfold.pyx":215 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistBox(np.ndarray[np.float64_t,ndim=1,mode="c"] aufpunkt, + * np.ndarray[np.float64_t,ndim=2,mode="c"] com, + */ + __pyx_tuple__28 = PyTuple_Pack(18, __pyx_n_s_aufpunkt, __pyx_n_s_com, __pyx_n_s_xyz, __pyx_n_s_boxlength, __pyx_n_s_atoms_per_residue, __pyx_n_s_residue_first_atom, __pyx_n_s_shift, __pyx_n_s_auf, __pyx_n_s_boxl, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_nmol, __pyx_n_s_ccom, __pyx_n_s_cxyz, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_natom); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_unfold_pyx, __pyx_n_s_minDistBox, 215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 215, __pyx_L1_error) + + /* "newanalysis/helpers/unfold.pyx":257 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistCenterBox(np.ndarray[np.float64_t,ndim=1,mode='c'] aufpunkt, + * np.ndarray[np.float64_t,ndim=2,mode='c'] com, + */ + __pyx_tuple__30 = PyTuple_Pack(12, __pyx_n_s_aufpunkt, __pyx_n_s_com, __pyx_n_s_coor, __pyx_n_s_boxl, __pyx_n_s_apr, __pyx_n_s_rfa, __pyx_n_s_shift, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_nmol, __pyx_n_s_natom); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_unfold_pyx, __pyx_n_s_minDistCenterBox, 257, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 257, __pyx_L1_error) + + /* "newanalysis/helpers/unfold.pyx":291 + * coor[k,j] -= (aufpunkt[j] + shift[j]) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minVec(double [:] coor1, double [:] coor2, double boxl, double boxl2): + * """ + */ + __pyx_tuple__32 = PyTuple_Pack(6, __pyx_n_s_coor1, __pyx_n_s_coor2, __pyx_n_s_boxl, __pyx_n_s_boxl2, __pyx_n_s_delta, __pyx_n_s_i); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_unfold_pyx, __pyx_n_s_minVec, 291, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 291, __pyx_L1_error) + + /* "newanalysis/helpers/unfold.pyx":308 + * return np.asarray(delta) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDist(double [:] coor1, double [:] coor2, double boxl, double boxl2): + * """ + */ + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_unfold_pyx, __pyx_n_s_minDist, 308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 308, __pyx_L1_error) + + /* "newanalysis/helpers/unfold.pyx":326 + * return float(sqrt(delta[0]*delta[0] + delta[1]*delta[1] + delta[2]*delta[2])) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findMinDist(double [:,:] coor, double boxl): + * cdef int n = coor.shape[0], i, j + */ + __pyx_tuple__35 = PyTuple_Pack(8, __pyx_n_s_coor, __pyx_n_s_boxl, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_minimum, __pyx_n_s_dist, __pyx_n_s_boxl2); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_unfold_pyx, __pyx_n_s_findMinDist, 326, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 326, __pyx_L1_error) + + /* "newanalysis/helpers/unfold.pyx":341 + * return float(minimum) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def bertholdHorn(double [:,:] coor, double [:,:] coorA, double [:,:] coorB): + * """ + */ + __pyx_tuple__37 = PyTuple_Pack(8, __pyx_n_s_coor, __pyx_n_s_coorA, __pyx_n_s_coorB, __pyx_n_s_R, __pyx_n_s_tmpx, __pyx_n_s_tmpy, __pyx_n_s_tmpz, __pyx_n_s_i); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_helpers_unfold_pyx, __pyx_n_s_bertholdHorn, 341, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 0)); else + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* NumpyImportArray.init */ + /* + * Cython has automatically inserted a call to _import_array since + * you didn't include one when you cimported numpy. To disable this + * add the line + * numpy._import_array + */ +#ifdef NPY_FEATURE_VERSION +#ifndef NO_IMPORT_ARRAY +if (unlikely(_import_array() == -1)) { + PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import " + "(auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; " + "use 'numpy._import_array' to disable if you are certain you don't need it)."); +} +#endif +#endif + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_module ### */ + +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_array_type)) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_array_type->tp_base->tp_as_buffer && __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #else + __pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_array_type->tp_print = 0; + #endif + if (__Pyx_SetVtable(__pyx_array_type, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_MemviewEnum_type)) __PYX_ERR(1, 302, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #else + __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_MemviewEnum_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_MemviewEnum_type->tp_dictoffset && __pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_MemviewEnum_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_memoryview_type)) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #else + __pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryview_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryview_type->tp_dictoffset && __pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryview_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_memoryview_type, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_memoryviewslice_type)) __PYX_ERR(1, 952, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #else + __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryviewslice_type->tp_base = __pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryviewslice_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryviewslice_type->tp_dictoffset && __pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryviewslice_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_2(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArray_Descr),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 202, __pyx_L1_error) + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 225, __pyx_L1_error) + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayMultiIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 229, __pyx_L1_error) + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 238, __pyx_L1_error) + __pyx_ptype_5numpy_generic = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 809, __pyx_L1_error) + __pyx_ptype_5numpy_number = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 811, __pyx_L1_error) + __pyx_ptype_5numpy_integer = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 813, __pyx_L1_error) + __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 815, __pyx_L1_error) + __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 817, __pyx_L1_error) + __pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 819, __pyx_L1_error) + __pyx_ptype_5numpy_floating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 821, __pyx_L1_error) + __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 823, __pyx_L1_error) + __pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_ptype_5numpy_character = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyUFuncObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 865, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_unfold(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_unfold}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "unfold", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void +#endif +#else +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initunfold(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initunfold(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_unfold(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_unfold(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else + result = PyDict_SetItemString(moddict, to_name, value); +#endif + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + if (__Pyx_check_single_interpreter()) + return NULL; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; +#endif + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_unfold(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + static PyThread_type_lock __pyx_t_8[8]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'unfold' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("unfold", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to unfold pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_unfold(void)", 0); + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + PyEval_InitThreads(); + #endif + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_newanalysis__unfold) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "newanalysis.unfold")) { + if (unlikely((PyDict_SetItemString(modules, "newanalysis.unfold", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_version_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__11, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + goto __pyx_L8; + } + + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":104 + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None + */ + /*except:*/ { + __Pyx_AddTraceback("View.MemoryView", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(1, 104, __pyx_L4_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_7); + + /* "View.MemoryView":106 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * + */ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L3_exception_handled; + } + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + __pyx_L4_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":242 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":243 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L16_try_end; + __pyx_L11_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":244 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L12_exception_handled; + } + __pyx_L12_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L16_try_end:; + } + + /* "View.MemoryView":309 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":323 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), + */ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":324 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), + */ + __pyx_t_8[0] = PyThread_allocate_lock(); + __pyx_t_8[1] = PyThread_allocate_lock(); + __pyx_t_8[2] = PyThread_allocate_lock(); + __pyx_t_8[3] = PyThread_allocate_lock(); + __pyx_t_8[4] = PyThread_allocate_lock(); + __pyx_t_8[5] = PyThread_allocate_lock(); + __pyx_t_8[6] = PyThread_allocate_lock(); + __pyx_t_8[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_8, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":983 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); + + /* "View.MemoryView":984 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); + + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L22_try_end; + __pyx_L17_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":985 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L18_exception_handled; + } + __pyx_L18_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L22_try_end:; + } + + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 989, __pyx_L23_error) + if (__pyx_t_6) { + + /* "View.MemoryView":993 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_memoryviewslice_type)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":994 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_array_type)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + } + + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L28_try_end; + __pyx_L23_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":995 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L24_exception_handled; + } + __pyx_L24_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L28_try_end:; + } + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/unfold.pyx":4 + * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * + */ + __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_7) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/unfold.pyx":18 + * void GetRotation(double *R_ptr, int n, double *APoints_ptr, double *BPoints_ptr, int debug) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldBox(np.ndarray[np.float64_t,ndim=2,mode='c'] coor_unfold, + * np.ndarray[np.float64_t,ndim=2,mode='c'] coor_prev, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6unfold_1unfoldBox, 0, __pyx_n_s_unfoldBox, NULL, __pyx_n_s_newanalysis_unfold, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_unfoldBox, __pyx_t_7) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/unfold.pyx":67 + * coor_unfold[i,2] += DZ + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, + * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6unfold_3unfoldOcta, 0, __pyx_n_s_unfoldOcta, NULL, __pyx_n_s_newanalysis_unfold, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_unfoldOcta, __pyx_t_7) < 0) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/unfold.pyx":128 + * unfold[i+2] += DZ + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def unfoldCharmmOcta(np.ndarray[np.float64_t,ndim=2] xyz_unfold, + * np.ndarray[np.float64_t,ndim=2] xyz_traj_prev, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6unfold_5unfoldCharmmOcta, 0, __pyx_n_s_unfoldCharmmOcta, NULL, __pyx_n_s_newanalysis_unfold, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_unfoldCharmmOcta, __pyx_t_7) < 0) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/unfold.pyx":215 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistBox(np.ndarray[np.float64_t,ndim=1,mode="c"] aufpunkt, + * np.ndarray[np.float64_t,ndim=2,mode="c"] com, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6unfold_7minDistBox, 0, __pyx_n_s_minDistBox, NULL, __pyx_n_s_newanalysis_unfold, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_minDistBox, __pyx_t_7) < 0) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/unfold.pyx":257 + * + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDistCenterBox(np.ndarray[np.float64_t,ndim=1,mode='c'] aufpunkt, + * np.ndarray[np.float64_t,ndim=2,mode='c'] com, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6unfold_9minDistCenterBox, 0, __pyx_n_s_minDistCenterBox, NULL, __pyx_n_s_newanalysis_unfold, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_minDistCenterBox, __pyx_t_7) < 0) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/unfold.pyx":291 + * coor[k,j] -= (aufpunkt[j] + shift[j]) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minVec(double [:] coor1, double [:] coor2, double boxl, double boxl2): + * """ + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6unfold_11minVec, 0, __pyx_n_s_minVec, NULL, __pyx_n_s_newanalysis_unfold, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_minVec, __pyx_t_7) < 0) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/unfold.pyx":308 + * return np.asarray(delta) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def minDist(double [:] coor1, double [:] coor2, double boxl, double boxl2): + * """ + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6unfold_13minDist, 0, __pyx_n_s_minDist, NULL, __pyx_n_s_newanalysis_unfold, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_minDist, __pyx_t_7) < 0) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/unfold.pyx":326 + * return float(sqrt(delta[0]*delta[0] + delta[1]*delta[1] + delta[2]*delta[2])) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def findMinDist(double [:,:] coor, double boxl): + * cdef int n = coor.shape[0], i, j + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6unfold_15findMinDist, 0, __pyx_n_s_findMinDist, NULL, __pyx_n_s_newanalysis_unfold, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_findMinDist, __pyx_t_7) < 0) __PYX_ERR(0, 326, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/unfold.pyx":341 + * return float(minimum) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def bertholdHorn(double [:,:] coor, double [:,:] coorA, double [:,:] coorB): + * """ + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_6unfold_17bertholdHorn, 0, __pyx_n_s_bertholdHorn, NULL, __pyx_n_s_newanalysis_unfold, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_bertholdHorn, __pyx_t_7) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/helpers/unfold.pyx":1 + * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< + * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + * + */ + __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + if (__pyx_m) { + if (__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init newanalysis.unfold", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init newanalysis.unfold"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) +} +#endif + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } + name = first_kw_arg; + while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); // transfer ownership of value to values + Py_DECREF(key); +#endif + key = NULL; + value = NULL; continue; } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_Check(key))) { @@ -23138,6 +27562,9 @@ static int __Pyx_ParseOptionalKeywords( if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif break; } name++; @@ -23154,2454 +27581,4365 @@ static int __Pyx_ParseOptionalKeywords( argname++; } } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = ( + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key) + ); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + Py_XDECREF(key); + Py_XDECREF(value); + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + Py_XDECREF(key); + Py_XDECREF(value); + return -1; +} + +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { + return NULL; + } + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) +#else + if (PyCFunction_Check(func)) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } + } + } + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } + } +#endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); } else { - goto invalid_keyword; + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); } } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + #if CYTHON_VECTORCALL + #if Py_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); + vectorcallfunc f = PyVectorcall_Function(func); #endif -bad: - return -1; + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); + } + #endif + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); } -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* CIntToDigits */ +static const char DIGIT_PAIRS_10[2*10*10+1] = { + "00010203040506070809" + "10111213141516171819" + "20212223242526272829" + "30313233343536373839" + "40414243444546474849" + "50515253545556575859" + "60616263646566676869" + "70717273747576777879" + "80818283848586878889" + "90919293949596979899" +}; +static const char DIGIT_PAIRS_8[2*8*8+1] = { + "0001020304050607" + "1011121314151617" + "2021222324252627" + "3031323334353637" + "4041424344454647" + "5051525354555657" + "6061626364656667" + "7071727374757677" +}; +static const char DIGITS_HEX[2*16+1] = { + "0123456789abcdef" + "0123456789ABCDEF" +}; + +/* BuildPyUnicode */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char) { + PyObject *uval; + Py_ssize_t uoffset = ulength - clength; +#if CYTHON_USE_UNICODE_INTERNALS + Py_ssize_t i; +#if CYTHON_PEP393_ENABLED + void *udata; + uval = PyUnicode_New(ulength, 127); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_DATA(uval); +#else + Py_UNICODE *udata; + uval = PyUnicode_FromUnicode(NULL, ulength); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_AS_UNICODE(uval); +#endif + if (uoffset > 0) { + i = 0; + if (prepend_sign) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); + i++; + } + for (; i < uoffset; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); + } } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif + for (i=0; i < clength; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; +#else + { + PyObject *sign = NULL, *padding = NULL; + uval = NULL; + if (uoffset > 0) { + prepend_sign = !!prepend_sign; + if (uoffset > prepend_sign) { + padding = PyUnicode_FromOrdinal(padding_char); + if (likely(padding) && uoffset > prepend_sign + 1) { + PyObject *tmp; + PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign); + if (unlikely(!repeat)) goto done_or_error; + tmp = PyNumber_Multiply(padding, repeat); + Py_DECREF(repeat); + Py_DECREF(padding); + padding = tmp; + } + if (unlikely(!padding)) goto done_or_error; + } + if (prepend_sign) { + sign = PyUnicode_FromOrdinal('-'); + if (unlikely(!sign)) goto done_or_error; + } + } + uval = PyUnicode_DecodeASCII(chars, clength, NULL); + if (likely(uval) && padding) { + PyObject *tmp = PyNumber_Add(padding, uval); + Py_DECREF(uval); + uval = tmp; + } + if (likely(uval) && sign) { + PyObject *tmp = PyNumber_Add(sign, uval); + Py_DECREF(uval); + uval = tmp; + } +done_or_error: + Py_XDECREF(padding); + Py_XDECREF(sign); } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; +#endif + return uval; } -/* IsLittleEndian */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) -{ - union { - uint32_t u32; - uint8_t u8[4]; - } S; - S.u32 = 0x01020304; - return S.u8[0] == 4; +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(int)*3+2]; + char *dpos, *end = digits + sizeof(int)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + int remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (int) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (int) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (int) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); } -/* BufferFormatCheck */ -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type) { - stack[0].field = &ctx->root; - stack[0].parent_offset = 0; - ctx->root.type = type; - ctx->root.name = "buffer dtype"; - ctx->root.offset = 0; - ctx->head = stack; - ctx->head->field = &ctx->root; - ctx->fmt_offset = 0; - ctx->head->parent_offset = 0; - ctx->new_packmode = '@'; - ctx->enc_packmode = '@'; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->is_complex = 0; - ctx->is_valid_array = 0; - ctx->struct_alignment = 0; - while (type->typegroup == 'S') { - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = 0; - type = type->fields->type; - } -} -static int __Pyx_BufFmt_ParseNumber(const char** ts) { - int count; - const char* t = *ts; - if (*t < '0' || *t > '9') { - return -1; - } else { - count = *t++ - '0'; - while (*t >= '0' && *t <= '9') { - count *= 10; - count += *t++ - '0'; +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (Py_ssize_t) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (Py_ssize_t) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (Py_ssize_t) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + CYTHON_MAYBE_UNUSED_VAR(max_char); +#if CYTHON_PEP393_ENABLED + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); +#else + result_uval = PyUnicode_FromUnicode(NULL, result_ulength); + if (unlikely(!result_uval)) return NULL; + result_ukind = sizeof(Py_UNICODE); + kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; + result_udata = PyUnicode_AS_UNICODE(result_uval); +#endif + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); + if (unlikely(__Pyx_PyUnicode_READY(uval))) + goto bad; + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030D0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif } + char_pos += ulength; } - *ts = t; - return count; + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; +#else + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + CYTHON_UNUSED_VAR(value_count); + return PyUnicode_Join(__pyx_empty_unicode, value_tuple); +#endif } -static int __Pyx_BufFmt_ExpectNumber(const char **ts) { - int number = __Pyx_BufFmt_ParseNumber(ts); - if (number == -1) - PyErr_Format(PyExc_ValueError,\ - "Does not understand character buffer dtype format string ('%c')", **ts); - return number; + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); } -static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - PyErr_Format(PyExc_ValueError, - "Unexpected format string character: '%c'", ch); + +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { - switch (ch) { - case '?': return "'bool'"; - case 'c': return "'char'"; - case 'b': return "'signed char'"; - case 'B': return "'unsigned char'"; - case 'h': return "'short'"; - case 'H': return "'unsigned short'"; - case 'i': return "'int'"; - case 'I': return "'unsigned int'"; - case 'l': return "'long'"; - case 'L': return "'unsigned long'"; - case 'q': return "'long long'"; - case 'Q': return "'unsigned long long'"; - case 'f': return (is_complex ? "'complex float'" : "'float'"); - case 'd': return (is_complex ? "'complex double'" : "'double'"); - case 'g': return (is_complex ? "'complex long double'" : "'long double'"); - case 'T': return "a struct"; - case 'O': return "Python object"; - case 'P': return "a pointer"; - case 's': case 'p': return "a string"; - case 0: return "end"; - default: return "unparseable format string"; - } + +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } -static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return 2; - case 'i': case 'I': case 'l': case 'L': return 4; - case 'q': case 'Q': return 8; - case 'f': return (is_complex ? 8 : 4); - case 'd': return (is_complex ? 16 : 8); - case 'g': { - PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); - return 0; + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); } - case 'O': case 'P': return sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); } + return NULL; } -static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(short); - case 'i': case 'I': return sizeof(int); - case 'l': case 'L': return sizeof(long); - #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(PY_LONG_LONG); - #endif - case 'f': return sizeof(float) * (is_complex ? 2 : 1); - case 'd': return sizeof(double) * (is_complex ? 2 : 1); - case 'g': return sizeof(long double) * (is_complex ? 2 : 1); - case 'O': case 'P': return sizeof(void*); - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (meth) { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } } - } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; } -typedef struct { char c; short x; } __Pyx_st_short; -typedef struct { char c; int x; } __Pyx_st_int; -typedef struct { char c; long x; } __Pyx_st_long; -typedef struct { char c; float x; } __Pyx_st_float; -typedef struct { char c; double x; } __Pyx_st_double; -typedef struct { char c; long double x; } __Pyx_st_longdouble; -typedef struct { char c; void *x; } __Pyx_st_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; -#endif -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); -#endif - case 'f': return sizeof(__Pyx_st_float) - sizeof(float); - case 'd': return sizeof(__Pyx_st_double) - sizeof(double); - case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); } -/* These are for computing the padding at the end of the struct to align - on the first member of the struct. This will probably the same as above, - but we don't have any guarantees. - */ -typedef struct { short x; char c; } __Pyx_pad_short; -typedef struct { int x; char c; } __Pyx_pad_int; -typedef struct { long x; char c; } __Pyx_pad_long; -typedef struct { float x; char c; } __Pyx_pad_float; -typedef struct { double x; char c; } __Pyx_pad_double; -typedef struct { long double x; char c; } __Pyx_pad_longdouble; -typedef struct { void *x; char c; } __Pyx_pad_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif -static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + Py_ssize_t kwsize; +#if CYTHON_ASSUME_SAFE_MACROS + kwsize = PyTuple_GET_SIZE(kw); +#else + kwsize = PyTuple_Size(kw); + if (kwsize < 0) return 0; #endif - case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); - case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); - case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + if (unlikely(kwsize == 0)) + return 1; + if (!kw_allowed) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, 0); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + goto invalid_keyword; + } +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < kwsize; pos++) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } +#endif + return 1; + } + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; } + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; } -static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { - switch (ch) { - case 'c': - return 'H'; - case 'b': case 'h': case 'i': - case 'l': case 'q': case 's': case 'p': - return 'I'; - case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': - return 'U'; - case 'f': case 'd': case 'g': - return (is_complex ? 'C' : 'R'); - case 'O': - return 'O'; - case 'P': - return 'P'; - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +/* GetAttr3 */ +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyString_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); + } + return r; } - } +#endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); } -static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { - if (ctx->head == NULL || ctx->head->field == &ctx->root) { - const char* expected; - const char* quote; - if (ctx->head == NULL) { - expected = "end"; - quote = ""; - } else { - expected = ctx->head->field->type->name; - quote = "'"; + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif } - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected %s%s%s but got %s", - quote, expected, quote, - __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); - } else { - __Pyx_StructField* field = ctx->head->field; - __Pyx_StructField* parent = (ctx->head - 1)->field; - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", - field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), - parent->type->name, field->name); - } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; } -static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { - char group; - size_t size, offset, arraysize = 1; - if (ctx->enc_type == 0) return 0; - if (ctx->head->field->type->arraysize[0]) { - int i, ndim = 0; - if (ctx->enc_type == 's' || ctx->enc_type == 'p') { - ctx->is_valid_array = ctx->head->field->type->ndim == 1; - ndim = 1; - if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { - PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %zu", - ctx->head->field->type->arraysize[0], ctx->enc_count); - return -1; - } +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; } - if (!ctx->is_valid_array) { - PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", - ctx->head->field->type->ndim, ndim); - return -1; +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; } - for (i = 0; i < ctx->head->field->type->ndim; i++) { - arraysize *= ctx->head->field->type->arraysize[i]; + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; } - ctx->is_valid_array = 0; - ctx->enc_count = 1; - } - group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); - do { - __Pyx_StructField* field = ctx->head->field; - __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { - size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); - } else { - size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); } - if (ctx->enc_packmode == '@') { - size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - size_t align_mod_offset; - if (align_at == 0) return -1; - align_mod_offset = ctx->fmt_offset % align_at; - if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; - if (ctx->struct_alignment == 0) - ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, - ctx->is_complex); +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); } - if (type->size != size || type->typegroup != group) { - if (type->typegroup == 'C' && type->fields != NULL) { - size_t parent_offset = ctx->head->parent_offset + field->offset; - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = parent_offset; - continue; - } - if ((type->typegroup == 'H' || group == 'H') && type->size == size) { - } else { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; } - offset = ctx->head->parent_offset + field->offset; - if (ctx->fmt_offset != offset) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", - (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); - return -1; + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* GetTopmostException */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; } - ctx->fmt_offset += size; - if (arraysize) - ctx->fmt_offset += (arraysize - 1) * size; - --ctx->enc_count; - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - break; - } - ctx->head->field = ++field; - if (field->type == NULL) { - --ctx->head; - field = ctx->head->field; - continue; - } else if (field->type->typegroup == 'S') { - size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; - field = field->type->fields; - ++ctx->head; - ctx->head->field = field; - ctx->head->parent_offset = parent_offset; - break; - } else { - break; - } + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); } - } while (ctx->enc_count); - ctx->enc_type = 0; - ctx->is_complex = 0; - return 0; + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif } -static PyObject * -__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif +} +#endif + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif { - const char *ts = *tsp; - int i = 0, number, ndim; - ++ts; - if (ctx->new_count != 1) { - PyErr_SetString(PyExc_ValueError, - "Cannot handle repeated arrays in format string"); - return NULL; + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ndim = ctx->head->field->type->ndim; - while (*ts && *ts != ')') { - switch (*ts) { - case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; - default: break; - } - number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) - return PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %d", - ctx->head->field->type->arraysize[i], number); - if (*ts != ',' && *ts != ')') - return PyErr_Format(PyExc_ValueError, - "Expected a comma in format string, got '%c'", *ts); - if (*ts == ',') ts++; - i++; + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif } - if (i != ndim) - return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", - ctx->head->field->type->ndim, i); - if (!*ts) { - PyErr_SetString(PyExc_ValueError, - "Unexpected end of format string, expected ')'"); - return NULL; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif } - ctx->is_valid_array = 1; - ctx->new_count = 1; - *tsp = ++ts; - return Py_None; + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; } -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { - int got_Z = 0; - while (1) { - switch(*ts) { - case 0: - if (ctx->enc_type != 0 && ctx->head == NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - if (ctx->head != NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - return ts; - case ' ': - case '\r': - case '\n': - ++ts; - break; - case '<': - if (!__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); - return NULL; - } - ctx->new_packmode = '='; - ++ts; - break; - case '=': - case '@': - case '^': - ctx->new_packmode = *ts++; - break; - case 'T': - { - const char* ts_after_sub; - size_t i, struct_count = ctx->new_count; - size_t struct_alignment = ctx->struct_alignment; - ctx->new_count = 1; - ++ts; - if (*ts != '{') { - PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - ctx->enc_count = 0; - ctx->struct_alignment = 0; - ++ts; - ts_after_sub = ts; - for (i = 0; i != struct_count; ++i) { - ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); - if (!ts_after_sub) return NULL; - } - ts = ts_after_sub; - if (struct_alignment) ctx->struct_alignment = struct_alignment; - } - break; - case '}': - { - size_t alignment = ctx->struct_alignment; - ++ts; - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - if (alignment && ctx->fmt_offset % alignment) { - ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); - } - } - return ts; - case 'x': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->fmt_offset += ctx->new_count; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->enc_packmode = ctx->new_packmode; - ++ts; - break; - case 'Z': - got_Z = 1; - ++ts; - if (*ts != 'f' && *ts != 'd' && *ts != 'g') { - __Pyx_BufFmt_RaiseUnexpectedChar('Z'); - return NULL; - } - CYTHON_FALLTHROUGH; - case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': - case 'l': case 'L': case 'q': case 'Q': - case 'f': case 'd': case 'g': - case 'O': case 'p': - if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && - (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { - ctx->enc_count += ctx->new_count; - ctx->new_count = 1; - got_Z = 0; - ++ts; - break; - } - CYTHON_FALLTHROUGH; - case 's': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_count = ctx->new_count; - ctx->enc_packmode = ctx->new_packmode; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; - ++ts; - ctx->new_count = 1; - got_Z = 0; - break; - case ':': - ++ts; - while(*ts != ':') ++ts; - ++ts; - break; - case '(': - if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; - break; - default: - { - int number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - ctx->new_count = (size_t)number; +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) + goto bad; + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) + goto bad; + from_list = empty_list; + } + #endif + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif } } - } +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + return module; } -/* BufferGetAndValidate */ - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (unlikely(info->buf == NULL)) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); -} -static void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; -} -static int __Pyx__GetBufferAndValidate( - Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, - int nd, int cast, __Pyx_BufFmt_StackElem* stack) -{ - buf->buf = NULL; - if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { - __Pyx_ZeroBuffer(buf); - return -1; - } - if (unlikely(buf->ndim != nd)) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - nd, buf->ndim); - goto fail; - } - if (!cast) { - __Pyx_BufFmt_Context ctx; - __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; - } - if (unlikely((size_t)buf->itemsize != dtype->size)) { - PyErr_Format(PyExc_ValueError, - "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", - buf->itemsize, (buf->itemsize > 1) ? "s" : "", - dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); - goto fail; - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_SafeReleaseBuffer(buf); - return -1; +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); + } + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; } - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); +#endif + return imported_module; } -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; + } + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; } #endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__3; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; + } + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); + } + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); + } +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); +} -/* PyDictVersioning */ - #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +/* ssize_strlen */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; } -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { + +/* FastTypeChecks */ #if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} #else - dictptr = _PyObject_GetDictPtr(obj); +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} #endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; itp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { + if (likely(err == exc_type)) return 1; + if (likely(PyExceptionClass_Check(err))) { + if (likely(PyExceptionClass_Check(exc_type))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); + } else if (likely(PyTuple_Check(exc_type))) { + return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); + } else { + } + } + return PyErr_GivenExceptionMatches(err, exc_type); +} +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { + assert(PyExceptionClass_Check(exc_type1)); + assert(PyExceptionClass_Check(exc_type2)); + if (likely(err == exc_type1 || err == exc_type2)) return 1; + if (likely(PyExceptionClass_Check(err))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); + } + return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); +} +#endif + +/* PySequenceMultiply */ +static PyObject* __Pyx_PySequence_Multiply_Generic(PyObject *seq, Py_ssize_t mul) { + PyObject *result, *pymul = PyInt_FromSsize_t(mul); + if (unlikely(!pymul)) + return NULL; + result = PyNumber_Multiply(seq, pymul); + Py_DECREF(pymul); + return result; } +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul) { +#if CYTHON_USE_TYPE_SLOTS + PyTypeObject *type = Py_TYPE(seq); + if (likely(type->tp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else #endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } +} -/* GetModuleGlobalName */ - #if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } } #else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) #else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + if (is_list || PySequence_Check(o)) +#endif + { + return PySequence_SetItem(o, i, v); } - PyErr_Clear(); #endif - return __Pyx_GetBuiltinName(name); + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); - } +/* RaiseUnboundLocalError */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } -#endif -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; + return value; } -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; + +/* HasAttr */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } + r = __Pyx_GetAttr(o, n); + if (!r) { + PyErr_Clear(); + return 0; + } else { + Py_DECREF(r); + return 1; } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; +} + +/* IsLittleEndian */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) +{ + union { + uint32_t u32; + uint8_t u8[4]; + } S; + S.u32 = 0x01020304; + return S.u8[0] == 4; +} + +/* BufferFormatCheck */ +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t <= '9') { + count *= 10; + count += *t++ - '0'; } - nk = i / 2; } - else { - kwtuple = NULL; - k = NULL; + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case '?': return "'bool'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparsable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - else { - d = NULL; - nd = 0; +} +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; + } } +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - return result; } +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif - -/* PyObjectCall2Args */ - static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; } - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - return result; + } } -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } } -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); + } + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } } - if (likely(__Pyx_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; } - -/* MemviewSliceInit */ - static int -__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference) +static int +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { - __Pyx_RefNannyDeclarations - int i, retval=-1; - Py_buffer *buf = &memview->view; - __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (unlikely(memviewslice->memview || memviewslice->data)) { + const char *ts = *tsp; + int i = 0, number, ndim; + ++ts; + if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, - "memviewslice is already initialized!"); - goto fail; + "Cannot handle repeated arrays in format string"); + return -1; } - if (buf->strides) { - for (i = 0; i < ndim; i++) { - memviewslice->strides[i] = buf->strides[i]; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return -1; + ndim = ctx->head->field->type->ndim; + while (*ts && *ts != ')') { + switch (*ts) { + case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; + default: break; } - } else { - Py_ssize_t stride = buf->itemsize; - for (i = ndim - 1; i >= 0; i--) { - memviewslice->strides[i] = stride; - stride *= buf->shape[i]; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return -1; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + return -1; + } + if (*ts != ',' && *ts != ')') { + PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + return -1; } + if (*ts == ',') ts++; + i++; } - for (i = 0; i < ndim; i++) { - memviewslice->shape[i] = buf->shape[i]; - if (buf->suboffsets) { - memviewslice->suboffsets[i] = buf->suboffsets[i]; - } else { - memviewslice->suboffsets[i] = -1; + if (i != ndim) { + PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + return -1; + } + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return -1; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return 0; +} +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case '\r': + case '\n': + ++ts; + break; + case '<': + if (!__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; + } + break; + case '}': + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } + CYTHON_FALLTHROUGH; + case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 'p': + if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && + (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { + ctx->enc_count += ctx->new_count; + ctx->new_count = 1; + got_Z = 0; + ++ts; + break; + } + CYTHON_FALLTHROUGH; + case 's': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (__pyx_buffmt_parse_array(ctx, &ts) < 0) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } } - memviewslice->memview = memview; - memviewslice->data = (char *)buf->buf; - if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { - Py_INCREF(memview); - } - retval = 0; - goto no_fail; -fail: - memviewslice->memview = 0; - memviewslice->data = 0; - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; -} -#ifndef Py_NO_RETURN -#define Py_NO_RETURN -#endif -static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { - va_list vargs; - char msg[200]; -#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) - va_start(vargs, fmt); -#else - va_start(vargs); -#endif - vsnprintf(msg, 200, fmt, vargs); - va_end(vargs); - Py_FatalError(msg); + } } -static CYTHON_INLINE int -__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)++; - PyThread_release_lock(lock); - return result; + +/* BufferGetAndValidate */ + static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (unlikely(info->buf == NULL)) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); } -static CYTHON_INLINE int -__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)--; - PyThread_release_lock(lock); - return result; +static void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; } -static CYTHON_INLINE void -__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +static int __Pyx__GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) { - int first_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) - return; - if (unlikely(__pyx_get_slice_count(memview) < 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - first_time = __pyx_add_acquisition_count(memview) == 0; - if (unlikely(first_time)) { - if (have_gil) { - Py_INCREF((PyObject *) memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_INCREF((PyObject *) memview); - PyGILState_Release(_gilstate); - } - } -} -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, - int have_gil, int lineno) { - int last_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) { - memslice->memview = NULL; - return; - } - if (unlikely(__pyx_get_slice_count(memview) <= 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - last_time = __pyx_sub_acquisition_count(memview) == 1; - memslice->data = NULL; - if (unlikely(last_time)) { - if (have_gil) { - Py_CLEAR(memslice->memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_CLEAR(memslice->memview); - PyGILState_Release(_gilstate); - } - } else { - memslice->memview = NULL; - } + buf->buf = NULL; + if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { + __Pyx_ZeroBuffer(buf); + return -1; + } + if (unlikely(buf->ndim != nd)) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if (unlikely((size_t)buf->itemsize != dtype->size)) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_SafeReleaseBuffer(buf); + return -1; } -/* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +/* ErrOccurredWithGIL */ + static CYTHON_INLINE int __Pyx_ErrOccurredWithGIL(void) { + int err; + #ifdef WITH_THREAD + PyGILState_STATE _save = PyGILState_Ensure(); + #endif + err = !!PyErr_Occurred(); + #ifdef WITH_THREAD + PyGILState_Release(_save); + #endif + return err; } -/* None */ +/* RaiseUnboundMemoryviewSliceNogil */ static void __Pyx_RaiseUnboundMemoryviewSliceNogil(const char *varname) { #ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); #endif __Pyx_RaiseUnboundLocalError(varname); #ifdef WITH_THREAD - PyGILState_Release(gilstate); - #endif -} - -/* GetTopmostException */ - #if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; - } - return exc_info; -} -#endif - -/* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -#endif - -/* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; icurexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); -} -#endif - -/* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) -#endif -{ - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) -#endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if CYTHON_USE_EXC_INFO_STACK - { - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; - } - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; + PyGILState_Release(gilstate); #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); +} + +/* PyObject_GenericGetAttrNoDict */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else - PyErr_SetExcInfo(local_type, local_value, local_tb); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; + __Pyx_DECREF_TypeName(type_name); + return NULL; } - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); + } + Py_INCREF(descr); + #if PY_MAJOR_VERSION < 3 + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) + #endif + { + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; } + } + return descr; +} #endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } + +/* PyObject_GenericGetAttr */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { + if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { + return PyObject_GenericGetAttr(obj, attr_name); } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; + return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); } +#endif + +/* FixUpExtensionType */ + #if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); #else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif } + memb++; } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); + if (changed) + PyType_Modified(type); } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); #endif - } -bad: - Py_XDECREF(owned_instance); - return; + return 0; } #endif -/* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); +/* PyObjectCallNoArg */ + static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod */ + static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif #else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif +#endif + { + meth_found = 1; } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); +#endif + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } #endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); + *method = attr; + return 0; +} + +/* PyObjectCallMethod0 */ + static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); return result; } -#endif + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; } -/* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); +/* ValidateBasesTuple */ + #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_MACROS + n = PyTuple_GET_SIZE(bases); #else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; + n = PyTuple_Size(bases); + if (n < 0) return -1; #endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); + for (i = 1; i < n; i++) + { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; +#endif + PyTypeObject *b; #if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); #endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; } -#if CYTHON_USE_UNICODE_INTERNALS +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; - #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; } +#if !CYTHON_USE_TYPE_SLOTS + if (dictoffset == 0) { + PyErr_Format(PyExc_TypeError, + "extension type '%s.200s': " + "unable to validate whether bases have a __dict__ " + "when CYTHON_USE_TYPE_SLOTS is off " + "(likely because you are building in the limited API). " + "Therefore, all extension types with multiple bases " + "must add 'cdef dict __dict__' in this compilation mode", + type_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); #endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; + return -1; } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); +#else + if (dictoffset == 0 && b->tp_dictoffset) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + } + return 0; +} +#endif + +/* PyType_Ready */ + static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); #endif - if (!py_result) + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); #endif - return (equals == Py_NE); + } +#endif + return r; #endif } -/* DivInt[Py_ssize_t] */ - static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { - Py_ssize_t q = a / b; - Py_ssize_t r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; +/* SetVTable */ + static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; } -/* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) +/* GetVTable */ + static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); #else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); #endif - return PyObject_GetAttr(o, n); + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; } -/* GetItemInt */ - static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); +/* MergeVTables */ + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i; + void** base_vtables; + __Pyx_TypeName tp_base_name; + __Pyx_TypeName base_name; + void* unknown = (void*)-1; + PyObject* bases = type->tp_bases; + int base_depth = 0; + { + PyTypeObject* base = type->tp_base; + while (base) { + base_depth += 1; + base = base->tp_base; + } } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; + base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; + for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { + void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); + if (base_vtable != NULL) { + int j; + PyTypeObject* base = type->tp_base; + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; + } + base = base->tp_base; + } + } } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); + PyErr_Clear(); + free(base_vtables); + return 0; +bad: + tp_base_name = __Pyx_PyType_GetName(type->tp_base); + base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); + free(base_vtables); + return -1; +} #endif + +/* SetupReduce */ + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyTuple_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); +#else + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#endif + if (getstate) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); #else - return PySequence_GetItem(o, i); + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } #endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; + if (object_getstate != getstate) { + goto __PYX_GOOD; } } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); + if (likely(reduce_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); + if (likely(setstate_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; } } - return m->sq_item(o, i); + PyType_Modified((PyTypeObject*)type_obj); } } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); } + ret = -1; +__PYX_GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); + Py_XDECREF(object_getstate); + Py_XDECREF(getstate); #endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* ObjectGetItem */ - #if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr = NULL; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); - } - return __Pyx_PyObject_GetIndex(obj, key); + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; } #endif -/* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; - } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - } - if (unlikely(stop <= start)) - return __Pyx_NewRef(__pyx_empty_unicode); - length = stop - start; - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); - } -} - -/* GetAttr3 */ - static PyObject *__Pyx_GetAttr3Default(PyObject *d) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(d); - return d; -} -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r = __Pyx_GetAttr(o, n); - return (likely(r)) ? r : __Pyx_GetAttr3Default(d); -} - -/* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -/* SwapException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = *type; - exc_info->exc_value = *value; - exc_info->exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} +/* TypeImport */ + #ifndef __PYX_HAVE_RT_ImportType_3_0_2 +#define __PYX_HAVE_RT_ImportType_3_0_2 +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size) +{ + PyObject *result = 0; + char warning[200]; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + PyObject *py_itemsize; #endif - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) +#if !CYTHON_COMPILING_IN_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_2 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_2 && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; } + return (PyTypeObject *)result; bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; + Py_XDECREF(result); + return NULL; } +#endif -/* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; +/* FetchSharedCythonModule */ + static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; +} + +/* FetchCommonType */ + static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; } - return b == &PyBaseObject_Type; + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; } -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { + goto bad; } - return 0; + goto done; } - return __Pyx_InBases(a, b); + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; } -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { + goto bad; } + goto done; } - __Pyx_ErrRestore(exception, value, tb); - return res; + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; +done: + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; } -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); +#endif + +/* PyVectorcallFastCallDict */ + #if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); return res; } +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} #endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); + +/* CythonFunctionShared */ + static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) +{ + CYTHON_UNUSED_VAR(closure); + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { #if PY_MAJOR_VERSION >= 3 - for (i=0; ifunc_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #endif - for (i=0; ifunc_doc == NULL)) + return NULL; } else { + Py_INCREF(Py_None); + return Py_None; } +#endif + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_doc, value); return 0; } -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { - if (likely(err == exc_type)) return 1; - if (likely(PyExceptionClass_Check(err))) { - if (likely(PyExceptionClass_Check(exc_type))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); - } else if (likely(PyTuple_Check(exc_type))) { - return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); - } else { - } +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#elif PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; } - return PyErr_GivenExceptionMatches(err, exc_type); + Py_INCREF(op->func_name); + return op->func_name; } -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { - assert(PyExceptionClass_Check(exc_type1)); - assert(PyExceptionClass_Check(exc_type2)); - if (likely(err == exc_type1 || err == exc_type2)) return 1; - if (likely(PyExceptionClass_Check(err))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; } - return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_name, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_qualname); + return op->func_qualname; } +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) #endif - -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_dict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; } #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); - } + result = Py_None; } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); + Py_INCREF(result); + return result; } -#endif - -/* DivInt[long] */ - static CYTHON_INLINE long __Pyx_div_long(long a, long b) { - long q = a / b; - long r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + return 0; } - -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } } - return value; + Py_INCREF(result); + return result; } - -/* HasAttr */ - static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { - PyObject *r; - if (unlikely(!__Pyx_PyBaseString_Check(n))) { +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, - "hasattr(): attribute name must be string"); + "__annotations__ must be set to a dict object"); return -1; } - r = __Pyx_GetAttr(o, n); - if (unlikely(!r)) { - PyErr_Clear(); - return 0; - } else { - Py_DECREF(r); - return 1; + Py_XINCREF(value); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; } + Py_INCREF(result); + return result; } - -/* PyObject_GenericGetAttrNoDict */ - #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } #endif - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { - PyObject *descr; - PyTypeObject *tp = Py_TYPE(obj); - if (unlikely(!PyString_Check(attr_name))) { - return PyObject_GenericGetAttr(obj, attr_name); - } - assert(!tp->tp_dictoffset); - descr = _PyType_Lookup(tp, attr_name); - if (unlikely(!descr)) { - return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); - } - Py_INCREF(descr); - #if PY_MAJOR_VERSION < 3 - if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) - #endif - { - descrgetfunc f = Py_TYPE(descr)->tp_descr_get; - if (unlikely(f)) { - PyObject *res = f(descr, obj, (PyObject *)tp); - Py_DECREF(descr); - return res; + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); } +ignore: + PyErr_Clear(); } - return descr; -} #endif - -/* PyObject_GenericGetAttr */ - #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { - if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { - return PyObject_GenericGetAttr(obj, attr_name); - } - return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); } +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, #endif - -/* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, #else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + CYTHON_UNUSED_VAR(args); +#if PY_MAJOR_VERSION >= 3 + Py_INCREF(m->func_qualname); + return m->func_qualname; +#else + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); #endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; } - -/* PyObjectGetAttrStrNoError */ - static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults_size = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); } #endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; } - return result; + return 0; } - -/* SetupReduce */ - static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { - int ret; - PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); - if (likely(name_attr)) { - ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); - } else { - ret = -1; - } - if (unlikely(ret < 0)) { - PyErr_Clear(); - ret = 0; - } - Py_XDECREF(name_attr); - return ret; +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); } -static int __Pyx_setup_reduce(PyObject* type_obj) { - int ret = 0; - PyObject *object_reduce = NULL; - PyObject *object_getstate = NULL; - PyObject *object_reduce_ex = NULL; - PyObject *reduce = NULL; - PyObject *reduce_ex = NULL; - PyObject *reduce_cython = NULL; - PyObject *setstate = NULL; - PyObject *setstate_cython = NULL; - PyObject *getstate = NULL; -#if CYTHON_USE_PYTYPE_LOOKUP - getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); #else - getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); - if (!getstate && PyErr_Occurred()) { - goto __PYX_BAD; + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); } -#endif - if (getstate) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); #else - object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); - if (!object_getstate && PyErr_Occurred()) { - goto __PYX_BAD; - } + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyObject *py_name = NULL; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); #endif - if (object_getstate != getstate) { - goto __PYX_GOOD; + return NULL; } - } -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); #else - object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; -#endif - reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; - if (reduce_ex == object_reduce_ex) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); #else - object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); #endif - reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; - if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { - reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); - if (likely(reduce_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (reduce == object_reduce || PyErr_Occurred()) { - goto __PYX_BAD; - } - setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); - if (!setstate) PyErr_Clear(); - if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { - setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); - if (likely(setstate_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (!setstate || PyErr_Occurred()) { - goto __PYX_BAD; - } - } - PyType_Modified((PyTypeObject*)type_obj); + return NULL; } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; } - goto __PYX_GOOD; -__PYX_BAD: - if (!PyErr_Occurred()) - PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); - ret = -1; -__PYX_GOOD: -#if !CYTHON_USE_PYTYPE_LOOKUP - Py_XDECREF(object_reduce); - Py_XDECREF(object_reduce_ex); - Py_XDECREF(object_getstate); - Py_XDECREF(getstate); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", + py_name); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); #endif - Py_XDECREF(reduce); - Py_XDECREF(reduce_ex); - Py_XDECREF(reduce_cython); - Py_XDECREF(setstate); - Py_XDECREF(setstate_cython); - return ret; + return NULL; } - -/* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size) -{ - PyObject *result = 0; - char warning[200]; - Py_ssize_t basicsize; - Py_ssize_t itemsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; - PyObject *py_itemsize; +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); #endif - result = PyObject_GetAttrString(module, class_name); - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; - itemsize = ((PyTypeObject *)result)->tp_itemsize; +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_MACROS + argc = PyTuple_GET_SIZE(args); #else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; - py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); - if (!py_itemsize) - goto bad; - itemsize = PyLong_AsSsize_t(py_itemsize); - Py_DECREF(py_itemsize); - py_itemsize = 0; - if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; + argc = PyTuple_Size(args); + if (unlikely(!argc) < 0) return NULL; #endif - if (itemsize) { - if (size % alignment) { - alignment = size % alignment; + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); +#else + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); +#endif + return NULL; } - if (itemsize < (Py_ssize_t)alignment) - itemsize = (Py_ssize_t)alignment; + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); } - if ((size_t)(basicsize + itemsize) < size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; + return result; +} +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; } - return (PyTypeObject *)result; -bad: - Py_XDECREF(result); - return NULL; + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); } +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL + 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_PyMethod_New, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, +#endif +}; +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); #endif + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + m->defaults_size = size; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ + static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -25615,7 +31953,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -25637,7 +31975,8 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -25715,17 +32054,99 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + PyErr_Clear(); + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #endif +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + py_funcname = PyUnicode_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -25760,6 +32181,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -25822,13 +32244,19 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + __Pyx_TypeName obj_type_name; if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags); - PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' does not have the buffer interface", + obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { @@ -25903,19 +32331,6 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, return (start1 < end2) && (start2 < end1); } -/* Capsule */ - static CYTHON_INLINE PyObject * -__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) -{ - PyObject *cobj; -#if PY_VERSION_HEX >= 0x02070000 - cobj = PyCapsule_New(p, sig, NULL); -#else - cobj = PyCObject_FromVoidPtr(p, NULL); -#endif - return cobj; -} - /* TypeInfoCompare */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) @@ -26012,8 +32427,9 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) return 0; } static int -__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec) +__pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec) { + CYTHON_UNUSED_VAR(ndim); if (spec & __Pyx_MEMVIEW_DIRECT) { if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { PyErr_Format(PyExc_ValueError, @@ -26212,14 +32628,14 @@ static int __Pyx_ValidateAndInit_memviewslice( } static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) { double value = __pyx_PyFloat_AsDouble(obj); - if ((value == (double)-1) && PyErr_Occurred()) + if (unlikely((value == (double)-1) && PyErr_Occurred())) return 0; *(double *) itemp = value; return 1; } /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); @@ -26239,7 +32655,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -26373,7 +32789,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); @@ -26393,7 +32809,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -26593,6 +33009,141 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return new_mvs; } +/* MemviewSliceInit */ + static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF(memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} +#ifndef Py_NO_RETURN +#define Py_NO_RETURN +#endif +static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -26626,8 +33177,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } @@ -26644,7 +33219,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -26658,40 +33233,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -26704,109 +33284,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -26860,8 +33512,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(npy_int32), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(npy_int32)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } @@ -26878,7 +33554,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -26892,40 +33568,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -26938,109 +33619,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -27094,8 +33847,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } @@ -27112,7 +33889,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(char) < sizeof(long)) { + if ((sizeof(char) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -27126,40 +33903,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { - return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { - return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { - return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -27172,109 +33954,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(char) <= sizeof(unsigned long)) { + if ((sizeof(char) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) - case -2: - if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(char) <= sizeof(long)) { + if ((sizeof(char) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (char) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (char) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (char) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (char) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (char) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (char) -1; } } else { @@ -27295,6 +34149,22 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (char) -1; } +/* FormatTypeName */ + #if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name_2); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__39); + } + return name; +} +#endif + /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[5]; @@ -27325,7 +34195,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, rtversion[i] = rt_from_call[i]; } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -27334,9 +34204,31 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + #if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -27344,23 +34236,11 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -27422,7 +34302,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -27451,22 +34331,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -27532,13 +34416,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -27606,4 +34488,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/newanalysis/voro/voro.cpp b/newanalysis/voro/voro.cpp index c2d2d63..b5812d0 100644 --- a/newanalysis/voro/voro.cpp +++ b/newanalysis/voro/voro.cpp @@ -1,22 +1,78 @@ -/* Generated by Cython 0.29.34 */ +/* Generated by Cython 3.0.2 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/arrayscalars.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include/numpy/ufuncobject.h", + "newanalysis/voro/mod_voro.h" + ], + "extra_compile_args": [ + "-fopenmp" + ], + "extra_link_args": [ + "-fopenmp" + ], + "extra_objects": [ + "newanalysis/voro/voro++-0.4.6/install/lib/libvoro++.a" + ], + "include_dirs": [ + "newanalysis/voro", + "newanalysis/voro/voro++-0.4.6/install/include", + "/scratch/data/andras/miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/core/include" + ], + "language": "c++", + "library_dirs": [ + "newanalysis/voro/voro++-0.4.6/install/lib" + ], + "name": "newanalysis.voro", + "sources": [ + "newanalysis/voro/voro.pyx", + "newanalysis/voro/mod_voro.cpp" + ] + }, + "module_name": "newanalysis.voro" +} +END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. +#else +#if CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" #else -#define CYTHON_ABI "0_29_34" -#define CYTHON_HEX_VERSION 0x001D22F0 -#define CYTHON_FUTURE_DIVISION 0 +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_2" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030002F0 +#define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -35,9 +91,7 @@ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -45,13 +99,19 @@ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -76,10 +136,19 @@ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS @@ -89,44 +158,121 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK @@ -136,8 +282,9 @@ #endif #elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 @@ -181,16 +328,17 @@ #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -199,11 +347,8 @@ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5) + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 @@ -226,29 +371,47 @@ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) + #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #endif - #if PY_VERSION_HEX >= 0x030B00A4 + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 @@ -257,6 +420,10 @@ #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -285,6 +452,17 @@ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -298,13 +476,16 @@ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -312,28 +493,59 @@ # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -343,13 +555,26 @@ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." @@ -373,91 +598,151 @@ class __Pyx_FakeReference { T *operator->() { return ptr; } T *operator&() { return ptr; } operator T&() { return *ptr; } - template bool operator ==(U other) { return *ptr == other; } - template bool operator !=(U other) { return *ptr != other; } + template bool operator ==(const U& other) const { return *ptr == other; } + template bool operator !=(const U& other) const { return *ptr != other; } + template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; } + template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; } private: T *ptr; }; -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + PyObject *version_info; // borrowed + PyObject *py_minor_version = NULL; + long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; - } - end: - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(call_result); - Py_XDECREF(empty); + #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 + minor_version = 11; // we don't yet need to distinguish between versions > 11 + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); + } + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); + Py_XDECREF(py_minor_version); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here + if (!empty_bytes) return NULL; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -471,6 +756,12 @@ class __Pyx_FakeReference { #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -485,30 +776,53 @@ class __Pyx_FakeReference { #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -517,6 +831,22 @@ class __Pyx_FakeReference { #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -547,6 +877,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -559,12 +911,69 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) +#else + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) @@ -575,10 +984,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else @@ -596,11 +1005,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -611,14 +1020,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -647,8 +1062,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -658,15 +1079,33 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif #if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -678,6 +1117,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -695,11 +1137,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -744,12 +1181,17 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else + #define __PYX_EXTERN_C extern "C++" #endif #define __PYX_HAVE__newanalysis__voro @@ -757,18 +1199,17 @@ static CYTHON_INLINE float __PYX_NAN() { /* Early includes */ #include #include + + /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */ + #include "numpy/arrayobject.h" #include "numpy/ndarrayobject.h" #include "numpy/ndarraytypes.h" #include "numpy/arrayscalars.h" #include "numpy/ufuncobject.h" - - /* NumPy API declarations from "numpy/__init__.pxd" */ - #include "mod_voro.h" #include "pythread.h" #include -#include "pystate.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -837,9 +1278,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -847,11 +1288,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -877,7 +1329,52 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -899,7 +1396,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -964,23 +1461,19 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; /* Header.proto */ #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 - #elif defined(_Complex_I) + #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__)) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 @@ -998,15 +1491,28 @@ static const char *__pyx_filename; #define _Complex_I 1.0fj #endif +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { - "src/voro/voro.pyx", - "__init__.pxd", - "stringsource", + "newanalysis/voro/voro.pyx", + "", + "__init__.cython-30.pxd", "type.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + /* BufferFormatStructs.proto */ -#define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { @@ -1041,17 +1547,6 @@ typedef struct { char is_valid_array; } __Pyx_BufFmt_Context; -/* MemviewSliceStruct.proto */ -struct __pyx_memoryview_obj; -typedef struct { - struct __pyx_memoryview_obj *memview; - char *data; - Py_ssize_t shape[8]; - Py_ssize_t strides[8]; - Py_ssize_t suboffsets[8]; -} __Pyx_memviewslice; -#define __Pyx_MemoryView_Len(m) (m.shape[0]) - /* Atomics.proto */ #include #ifndef CYTHON_ATOMICS @@ -1059,7 +1554,44 @@ typedef struct { #endif #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS #define __pyx_atomic_int_type int -#if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ +#define __pyx_nonatomic_int_type int +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__)) + #include +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ + (defined(_MSC_VER) && _MSC_VER >= 1700))) + #include +#endif +#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ + (__STDC_VERSION__ >= 201112L) &&\ + !defined(__STDC_NO_ATOMICS__) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type atomic_int + #define __pyx_atomic_incr_aligned(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C atomics" + #endif +#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ + (__cplusplus >= 201103L) ||\ +\ + (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ + ATOMIC_INT_LOCK_FREE == 2) + #undef __pyx_atomic_int_type + #define __pyx_atomic_int_type std::atomic_int + #define __pyx_atomic_incr_aligned(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) + #define __pyx_atomic_decr_aligned(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) + #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) + #pragma message ("Using standard C++ atomics") + #elif defined(__PYX_DEBUG_ATOMICS) + #warning "Using standard C++ atomics" + #endif +#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1) @@ -1067,10 +1599,11 @@ typedef struct { #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif -#elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL +#elif CYTHON_ATOMICS && defined(_MSC_VER) #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type long + #define __pyx_nonatomic_int_type long #pragma intrinsic (_InterlockedExchangeAdd) #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1) @@ -1084,7 +1617,6 @@ typedef struct { #warning "Not using atomics" #endif #endif -typedef volatile __pyx_atomic_int_type __pyx_atomic_int; #if CYTHON_ATOMICS #define __pyx_add_acquisition_count(memview)\ __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview)) @@ -1097,20 +1629,20 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) #endif -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif +/* MemviewSliceStruct.proto */ +struct __pyx_memoryview_obj; +typedef struct { + struct __pyx_memoryview_obj *memview; + char *data; + Py_ssize_t shape[8]; + Py_ssize_t strides[8]; + Py_ssize_t suboffsets[8]; +} __Pyx_memviewslice; +#define __Pyx_MemoryView_Len(m) (m.shape[0]) +/* #### Code section: numeric_typedefs ### */ -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":689 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":730 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -1119,7 +1651,7 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":690 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":731 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -1128,7 +1660,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":691 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":732 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -1137,7 +1669,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":692 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":733 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -1146,7 +1678,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":696 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":737 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -1155,7 +1687,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":697 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":738 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -1164,7 +1696,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":698 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":739 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -1173,7 +1705,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":699 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":740 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -1182,7 +1714,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":703 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":744 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -1191,7 +1723,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":704 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":745 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -1200,61 +1732,43 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":713 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":754 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t + * */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":714 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":755 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":715 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":717 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":757 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t + * */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":718 - * - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":758 * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":719 * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":721 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":760 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1263,7 +1777,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":722 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":761 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1272,7 +1786,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":724 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":763 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1281,7 +1795,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":725 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":764 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1290,7 +1804,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":726 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":765 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1298,8 +1812,9 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* #### Code section: complex_type_declarations ### */ /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else @@ -1311,7 +1826,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); /* Declarations.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else @@ -1322,6 +1837,7 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_array_obj; @@ -1329,7 +1845,7 @@ struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":728 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":767 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1338,7 +1854,7 @@ struct __pyx_memoryviewslice_obj; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":729 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":768 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1347,7 +1863,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":730 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":769 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1356,7 +1872,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":732 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":771 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1365,8 +1881,8 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1390,7 +1906,7 @@ struct __pyx_array_obj { }; -/* "View.MemoryView":280 +/* "View.MemoryView":302 * * @cname('__pyx_MemviewEnum') * cdef class Enum(object): # <<<<<<<<<<<<<< @@ -1403,10 +1919,10 @@ struct __pyx_MemviewEnum_obj { }; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1417,8 +1933,7 @@ struct __pyx_memoryview_obj { PyObject *_size; PyObject *_array_interface; PyThread_type_lock lock; - __pyx_atomic_int acquisition_count[2]; - __pyx_atomic_int *acquisition_count_aligned_p; + __pyx_atomic_int_type acquisition_count; Py_buffer view; int flags; int dtype_is_object; @@ -1426,8 +1941,8 @@ struct __pyx_memoryview_obj { }; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1443,8 +1958,8 @@ struct __pyx_memoryviewslice_obj { -/* "View.MemoryView":106 - * +/* "View.MemoryView":114 + * @cython.collection_type("sequence") * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< * @@ -1457,10 +1972,10 @@ struct __pyx_vtabstruct_array { static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; -/* "View.MemoryView":331 +/* "View.MemoryView":337 * * @cname('__pyx_memoryview') - * cdef class memoryview(object): # <<<<<<<<<<<<<< + * cdef class memoryview: # <<<<<<<<<<<<<< * * cdef object obj */ @@ -1473,12 +1988,13 @@ struct __pyx_vtabstruct_memoryview { PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *); PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *); PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *); + PyObject *(*_get_base)(struct __pyx_memoryview_obj *); }; static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; -/* "View.MemoryView":967 - * +/* "View.MemoryView":952 + * @cython.collection_type("sequence") * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< * "Internal class for passing memoryview slices to Python" @@ -1489,6 +2005,7 @@ struct __pyx_vtabstruct__memoryviewslice { struct __pyx_vtabstruct_memoryview __pyx_base; }; static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1497,11 +2014,11 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1511,28 +2028,40 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1543,6 +2072,10 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1554,71 +2087,30 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* decode_c_string_utf16.proto */ -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 0; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = -1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} -static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { - int byteorder = 1; - return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); -} - -/* decode_c_bytes.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( - const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); - -/* decode_bytes.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_bytes( - PyObject* string, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - return __Pyx_decode_c_bytes( - PyBytes_AS_STRING(string), PyBytes_GET_SIZE(string), - start, stop, encoding, errors, decode_func); -} - -/* PyObject_Unicode.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyObject_Unicode(obj)\ - (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) -#else -#define __Pyx_PyObject_Unicode(obj)\ - (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj)) -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() #endif /* PyErrFetchRestore.proto */ @@ -1630,7 +2122,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) @@ -1646,8 +2138,77 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#else + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) +#endif +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) + #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) +#else + #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op + #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs + #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS + #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) + #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, @@ -1657,216 +2218,92 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); -/* IsLittleEndian.proto */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); - -/* BufferFormatCheck.proto */ -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type); - -/* BufferGetAndValidate.proto */ -#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ - ((obj == Py_None || obj == NULL) ?\ - (__Pyx_ZeroBuffer(buf), 0) :\ - __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) -static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, - __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); -static void __Pyx_ZeroBuffer(Py_buffer* buf); -static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; -static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) do {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} while(0) -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -/* DictGetItem.proto */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); -#define __Pyx_PyObject_Dict_GetItem(obj, name)\ - (likely(PyDict_CheckExact(obj)) ?\ - __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) -#else -#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) -#endif - -/* BufferIndexError.proto */ -static void __Pyx_RaiseBufferIndexError(int axis); - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif -#if CYTHON_FAST_PYCALL - static size_t __pyx_pyframe_localsplus_offset = 0; +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL +#endif +#endif #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - -/* PyObjectCallMethO.proto */ +/* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* MemviewSliceInit.proto */ -#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d -#define __Pyx_MEMVIEW_DIRECT 1 -#define __Pyx_MEMVIEW_PTR 2 -#define __Pyx_MEMVIEW_FULL 4 -#define __Pyx_MEMVIEW_CONTIG 8 -#define __Pyx_MEMVIEW_STRIDED 16 -#define __Pyx_MEMVIEW_FOLLOW 32 -#define __Pyx_IS_C_CONTIG 1 -#define __Pyx_IS_F_CONTIG 2 -static int __Pyx_init_memviewslice( - struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference); -static CYTHON_INLINE int __pyx_add_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( - __pyx_atomic_int *acquisition_count, PyThread_type_lock lock); -#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p) -#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview)) -#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) -#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__) -static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); - -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC #endif -/* IncludeStringH.proto */ -#include +/* BuildPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char); -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); + +/* JoinPyUnicode.proto */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char); /* StrEquals.proto */ #if PY_MAJOR_VERSION >= 3 @@ -1875,14 +2312,29 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals #endif -/* DivInt[Py_ssize_t].proto */ -static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); - -/* UnaryNegOverflows.proto */ -#define UNARY_NEG_WOULD_OVERFLOW(x)\ - (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) +/* PyObjectFormatSimple.proto */ +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#elif PY_MAJOR_VERSION < 3 + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\ + PyObject_Format(s, f)) +#elif CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ + likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ + PyObject_Format(s, f)) +#else + #define __Pyx_PyObject_FormatSimple(s, f) (\ + likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ + PyObject_Format(s, f)) +#endif -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ /* GetAttr.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); @@ -1909,22 +2361,107 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + /* ObjectGetItem.proto */ #if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); #else #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif -/* decode_c_string.proto */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); + +/* DivInt[Py_ssize_t].proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); + +/* UnaryNegOverflows.proto */ +#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\ + (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) /* GetAttr3.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* GetModuleGlobalName.proto */ +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) do {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} while(0) +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); +#else +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); +#endif + +/* AssertionsEnabled.proto */ +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (1) +#elif CYTHON_COMPILING_IN_LIMITED_API || (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000) + static int __pyx_assertions_enabled_flag; + #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag) + static int __Pyx_init_assertions_enabled(void) { + PyObject *builtins, *debug, *debug_str; + int flag; + builtins = PyEval_GetBuiltins(); + if (!builtins) goto bad; + debug_str = PyUnicode_FromStringAndSize("__debug__", 9); + if (!debug_str) goto bad; + debug = PyObject_GetItem(builtins, debug_str); + Py_DECREF(debug_str); + if (!debug) goto bad; + flag = PyObject_IsTrue(debug); + Py_DECREF(debug); + if (flag == -1) goto bad; + __pyx_assertions_enabled_flag = flag; + return 0; + bad: + __pyx_assertions_enabled_flag = 1; + return -1; + } +#else + #define __Pyx_init_assertions_enabled() (0) + #define __pyx_assertions_enabled() (!Py_OptimizeFlag) +#endif + /* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); @@ -1934,6 +2471,33 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* RaiseNoneIterError.proto */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) @@ -1945,20 +2509,33 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* ssize_strlen.proto */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); + /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { @@ -1976,45 +2553,21 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif - -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} - -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif +/* PySequenceMultiply.proto */ +#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul) +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul); -/* None.proto */ +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck); + +/* RaiseUnboundLocalError.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); /* DivInt[long].proto */ @@ -2032,56 +2585,299 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* HasAttr.proto */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); -/* PyObject_GenericGetAttrNoDict.proto */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr -#endif - -/* PyObject_GenericGetAttr.proto */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr -#endif - -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); +/* decode_c_string_utf16.proto */ +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 0; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = -1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { + int byteorder = 1; + return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); +} -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); +/* decode_c_bytes.proto */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( + const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); -/* SetupReduce.proto */ -static int __Pyx_setup_reduce(PyObject* type_obj); +/* decode_bytes.proto */ +static CYTHON_INLINE PyObject* __Pyx_decode_bytes( + PyObject* string, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { + return __Pyx_decode_c_bytes( + PyBytes_AS_STRING(string), PyBytes_GET_SIZE(string), + start, stop, encoding, errors, decode_func); +} -/* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -#if __STDC_VERSION__ >= 201112L -#include -#endif -#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT(s) alignof(s) +/* PyObject_Unicode.proto */ +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyObject_Unicode(obj)\ + (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) #else -#define __PYX_GET_STRUCT_ALIGNMENT(s) sizeof(void*) -#endif -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 -}; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size); +#define __Pyx_PyObject_Unicode(obj)\ + (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj)) #endif -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) -#else -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); -#endif +/* IsLittleEndian.proto */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void); + +/* BufferFormatCheck.proto */ +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type); + +/* BufferGetAndValidate.proto */ +#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\ + ((obj == Py_None || obj == NULL) ?\ + (__Pyx_ZeroBuffer(buf), 0) :\ + __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)) +static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static void __Pyx_ZeroBuffer(Py_buffer* buf); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; +static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + +/* DictGetItem.proto */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); +#define __Pyx_PyObject_Dict_GetItem(obj, name)\ + (likely(PyDict_CheckExact(obj)) ?\ + __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) +#else +#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) +#endif + +/* BufferIndexError.proto */ +static void __Pyx_RaiseBufferIndexError(int axis); + +/* PyObject_GenericGetAttrNoDict.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr +#endif + +/* PyObject_GenericGetAttr.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr +#endif + +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); + +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); + +/* MergeVTables.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type); +#endif + +/* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce(PyObject* type_obj); +#endif + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_2 +#define __PYX_HAVE_RT_ImportType_proto_3_0_2 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_2(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_0_2 { + __Pyx_ImportType_CheckSize_Error_3_0_2 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_2 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_2 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size); +#endif + +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + typesModule = PyImport_ImportModule("types"); + if (!typesModule) return NULL; + methodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + if (!methodType) return NULL; + result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); + Py_DECREF(methodType); + return result; +} +#elif PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + void *defaults; + int defaults_pyobjects; + size_t defaults_size; // used by FusedFunction for copying defaults + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* CLineInTraceback.proto */ +#ifdef CYTHON_CLINE_IN_TRACEBACK +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#else +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -2095,6 +2891,7 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -2131,9 +2928,6 @@ static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, __Pyx_memviewslice *slice2, int ndim, size_t itemsize); -/* Capsule.proto */ -static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); - /* TypeInfoCompare.proto */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b); @@ -2154,11 +2948,6 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_d /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *, int writable_flag); -/* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *, int writable_flag); @@ -2171,13 +2960,6 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_c /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(PyObject *, int writable_flag); -/* Print.proto */ -static int __Pyx_Print(PyObject*, PyObject *, int); -#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 -static PyObject* __pyx_print = 0; -static PyObject* __pyx_print_kwargs = 0; -#endif - /* MemviewDtypeToObject.proto */ static CYTHON_INLINE PyObject *__pyx_memview_get_char(const char *itemp); static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj); @@ -2209,7 +2991,7 @@ static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_float(a, b) ((a)==(b)) #define __Pyx_c_sum_float(a, b) ((a)+(b)) #define __Pyx_c_diff_float(a, b) ((a)-(b)) @@ -2247,7 +3029,7 @@ static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) #endif /* Arithmetic.proto */ -#if CYTHON_CCOMPLEX +#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #define __Pyx_c_eq_double(a, b) ((a)==(b)) #define __Pyx_c_sum_double(a, b) ((a)+(b)) #define __Pyx_c_diff_double(a, b) ((a)-(b)) @@ -2291,6 +3073,31 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, size_t sizeof_dtype, int contig_flag, int dtype_is_object); +/* MemviewSliceInit.proto */ +#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d +#define __Pyx_MEMVIEW_DIRECT 1 +#define __Pyx_MEMVIEW_PTR 2 +#define __Pyx_MEMVIEW_FULL 4 +#define __Pyx_MEMVIEW_CONTIG 8 +#define __Pyx_MEMVIEW_STRIDED 16 +#define __Pyx_MEMVIEW_FOLLOW 32 +#define __Pyx_IS_C_CONTIG 1 +#define __Pyx_IS_F_CONTIG 2 +static int __Pyx_init_memviewslice( + struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference); +static CYTHON_INLINE int __pyx_add_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( + __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock); +#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count) +#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) +#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__) +static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int); + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); @@ -2309,8 +3116,21 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); -/* PrintOne.proto */ -static int __Pyx_PrintOne(PyObject* stream, PyObject *o); +/* None.proto */ +#include + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); @@ -2318,6 +3138,7 @@ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/ @@ -2326,58 +3147,46 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/ +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/ -/* Module declarations from 'cpython.buffer' */ +/* Module declarations from "libc.string" */ -/* Module declarations from 'libc.string' */ +/* Module declarations from "libc.stdio" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.type" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "cpython" */ -/* Module declarations from 'cpython' */ +/* Module declarations from "cpython.object" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.ref" */ -/* Module declarations from 'cpython.ref' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'cpython.mem' */ +/* Module declarations from "numpy" */ -/* Module declarations from 'numpy' */ +/* Module declarations from "cython.view" */ -/* Module declarations from 'numpy' */ -static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; -static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; -static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; -static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static PyTypeObject *__pyx_ptype_5numpy_generic = 0; -static PyTypeObject *__pyx_ptype_5numpy_number = 0; -static PyTypeObject *__pyx_ptype_5numpy_integer = 0; -static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0; -static PyTypeObject *__pyx_ptype_5numpy_inexact = 0; -static PyTypeObject *__pyx_ptype_5numpy_floating = 0; -static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0; -static PyTypeObject *__pyx_ptype_5numpy_flexible = 0; -static PyTypeObject *__pyx_ptype_5numpy_character = 0; -static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +/* Module declarations from "cython.dataclasses" */ -/* Module declarations from 'cython.view' */ +/* Module declarations from "cython" */ -/* Module declarations from 'cython' */ +/* Module declarations from "cpython.version" */ -/* Module declarations from 'cpython.version' */ - -/* Module declarations from 'newanalysis.voro' */ -static PyTypeObject *__pyx_array_type = 0; -static PyTypeObject *__pyx_MemviewEnum_type = 0; -static PyTypeObject *__pyx_memoryview_type = 0; -static PyTypeObject *__pyx_memoryviewslice_type = 0; +/* Module declarations from "newanalysis.voro" */ +static PyObject *__pyx_collections_abc_Sequence = 0; static PyObject *generic = 0; static PyObject *strided = 0; static PyObject *indirect = 0; @@ -2386,12 +3195,12 @@ static PyObject *indirect_contiguous = 0; static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; static PyObject *__pyx_f_11newanalysis_4voro__ustring(PyObject *); /*proto*/ +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ -static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/ static PyObject *_unellipsify(PyObject *, int); /*proto*/ -static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ +static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/ static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/ @@ -2409,8 +3218,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /* static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/ static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/ -static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/ -static int __pyx_memoryview_err(PyObject *, char *); /*proto*/ +static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/ +static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/ +static int __pyx_memoryview_err_no_memory(void); /*proto*/ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/ @@ -2419,28 +3229,36 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/ static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', __PYX_IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t = { "int8_t", NULL, sizeof(__pyx_t_5numpy_int8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int8_t), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t = { "int8_t", NULL, sizeof(__pyx_t_5numpy_int8_t), { 0 }, 0, __PYX_IS_UNSIGNED(__pyx_t_5numpy_int8_t) ? 'U' : 'I', __PYX_IS_UNSIGNED(__pyx_t_5numpy_int8_t), 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, __PYX_IS_UNSIGNED(int) ? 'U' : 'I', __PYX_IS_UNSIGNED(int), 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_char = { "char", NULL, sizeof(char), { 0 }, 0, 'H', IS_UNSIGNED(char), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_char = { "char", NULL, sizeof(char), { 0 }, 0, 'H', __PYX_IS_UNSIGNED(char), 0 }; +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "newanalysis.voro" extern int __pyx_module_is_main_newanalysis__voro; int __pyx_module_is_main_newanalysis__voro = 0; -/* Implementation of 'newanalysis.voro' */ +/* Implementation of "newanalysis.voro" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_ImportError; +static PyObject *__pyx_builtin___import__; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_AssertionError; static PyObject *__pyx_builtin_Ellipsis; static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_ImportError; +/* #### Code section: string_decls ### */ +static const char __pyx_k_[] = ": "; static const char __pyx_k_C[] = "C"; static const char __pyx_k_O[] = "O"; static const char __pyx_k_c[] = "c"; @@ -2448,28 +3266,37 @@ static const char __pyx_k_i[] = "i"; static const char __pyx_k_j[] = "j"; static const char __pyx_k_k[] = "k"; static const char __pyx_k_n[] = "n"; +static const char __pyx_k__2[] = "."; +static const char __pyx_k__3[] = "*"; +static const char __pyx_k__6[] = "'"; +static const char __pyx_k__7[] = ")"; static const char __pyx_k_c1[] = "c1"; static const char __pyx_k_c2[] = "c2"; static const char __pyx_k_ds[] = "ds"; static const char __pyx_k_fa[] = "fa"; static const char __pyx_k_fn[] = "fn"; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_n2[] = "n2"; static const char __pyx_k_np[] = "np"; static const char __pyx_k_s1[] = "s1"; static const char __pyx_k_s2[] = "s2"; static const char __pyx_k_ts[] = "ts"; +static const char __pyx_k__45[] = "?"; +static const char __pyx_k_abc[] = "abc"; +static const char __pyx_k_and[] = " and "; static const char __pyx_k_cds[] = "cds"; static const char __pyx_k_cfa[] = "cfa"; static const char __pyx_k_ctr[] = "ctr"; static const char __pyx_k_cts[] = "cts"; -static const char __pyx_k_end[] = "end"; static const char __pyx_k_f2c[] = "f2c"; +static const char __pyx_k_got[] = " (got "; static const char __pyx_k_nat[] = "nat"; static const char __pyx_k_new[] = "__new__"; static const char __pyx_k_obj[] = "obj"; static const char __pyx_k_sh1[] = "sh1"; static const char __pyx_k_sh2[] = "sh2"; +static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_xyz[] = "xyz"; static const char __pyx_k_base[] = "base"; static const char __pyx_k_boxl[] = "boxl"; @@ -2478,7 +3305,6 @@ static const char __pyx_k_cres[] = "cres"; static const char __pyx_k_cxyz[] = "cxyz"; static const char __pyx_k_dict[] = "__dict__"; static const char __pyx_k_dist[] = "dist"; -static const char __pyx_k_file[] = "file"; static const char __pyx_k_int8[] = "int8"; static const char __pyx_k_ires[] = "ires"; static const char __pyx_k_iubq[] = "iubq"; @@ -2492,6 +3318,7 @@ static const char __pyx_k_nmol[] = "nmol"; static const char __pyx_k_ntot[] = "ntot"; static const char __pyx_k_pack[] = "pack"; static const char __pyx_k_size[] = "size"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_step[] = "step"; static const char __pyx_k_stop[] = "stop"; static const char __pyx_k_test[] = "__test__"; @@ -2501,6 +3328,7 @@ static const char __pyx_k_box_x[] = "box_x"; static const char __pyx_k_box_y[] = "box_y"; static const char __pyx_k_box_z[] = "box_z"; static const char __pyx_k_class[] = "__class__"; +static const char __pyx_k_count[] = "count"; static const char __pyx_k_cvols[] = "cvols"; static const char __pyx_k_ds_ts[] = "ds_ts"; static const char __pyx_k_dtype[] = "dtype"; @@ -2508,6 +3336,7 @@ static const char __pyx_k_empty[] = "empty"; static const char __pyx_k_error[] = "error"; static const char __pyx_k_flags[] = "flags"; static const char __pyx_k_icore[] = "icore"; +static const char __pyx_k_index[] = "index"; static const char __pyx_k_isurr[] = "isurr"; static const char __pyx_k_maxsh[] = "maxsh"; static const char __pyx_k_ncore[] = "ncore"; @@ -2522,6 +3351,7 @@ static const char __pyx_k_boxl_x[] = "boxl_x"; static const char __pyx_k_boxl_y[] = "boxl_y"; static const char __pyx_k_boxl_z[] = "boxl_z"; static const char __pyx_k_calcCN[] = "calcCN"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_h5file[] = "h5file"; @@ -2538,12 +3368,14 @@ static const char __pyx_k_update[] = "update"; static const char __pyx_k_xyz_ts[] = "xyz_ts"; static const char __pyx_k_asarray[] = "asarray"; static const char __pyx_k_dataset[] = "dataset"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_fortran[] = "fortran"; static const char __pyx_k_len_xyz[] = "len_xyz"; static const char __pyx_k_memview[] = "memview"; static const char __pyx_k_mindist[] = "mindist"; static const char __pyx_k_xyz_ptr[] = "xyz_ptr"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; +static const char __pyx_k_Sequence[] = "Sequence"; static const char __pyx_k_color_id[] = "color_id"; static const char __pyx_k_core_end[] = "core_end"; static const char __pyx_k_corelist[] = "corelist"; @@ -2554,6 +3386,7 @@ static const char __pyx_k_itemsize[] = "itemsize"; static const char __pyx_k_maxshell[] = "maxshell"; static const char __pyx_k_minshell[] = "minshell"; static const char __pyx_k_pyx_type[] = "__pyx_type"; +static const char __pyx_k_register[] = "register"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_surr_end[] = "surr_end"; static const char __pyx_k_TypeError[] = "TypeError"; @@ -2562,6 +3395,7 @@ static const char __pyx_k_ccorelist[] = "ccorelist"; static const char __pyx_k_core_last[] = "core_last"; static const char __pyx_k_csurrlist[] = "csurrlist"; static const char __pyx_k_enumerate[] = "enumerate"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_shell_end[] = "shell_end"; @@ -2581,21 +3415,27 @@ static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_PickleError[] = "PickleError"; static const char __pyx_k_calcCN_int8[] = "calcCN_int8"; +static const char __pyx_k_collections[] = "collections"; static const char __pyx_k_delaunay_ts[] = "delaunay_ts"; static const char __pyx_k_lower_limit[] = "lower_limit"; static const char __pyx_k_shell_begin[] = "shell_begin"; static const char __pyx_k_upper_limit[] = "upper_limit"; static const char __pyx_k_delaunay_tmp[] = "delaunay_tmp"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; -static const char __pyx_k_stringsource[] = "stringsource"; +static const char __pyx_k_stringsource[] = ""; static const char __pyx_k_surroundlist[] = "surroundlist"; -static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; +static const char __pyx_k_version_info[] = "version_info"; +static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; +static const char __pyx_k_AssertionError[] = "AssertionError"; static const char __pyx_k_draw_triangles[] = "draw_triangles"; static const char __pyx_k_points_to_draw[] = "points_to_draw"; static const char __pyx_k_py_byte_string[] = "py_byte_string"; static const char __pyx_k_View_MemoryView[] = "View.MemoryView"; static const char __pyx_k_allocate_buffer[] = "allocate_buffer"; +static const char __pyx_k_collections_abc[] = "collections.abc"; static const char __pyx_k_cylinder_radius[] = "cylinder_radius"; static const char __pyx_k_dtype_is_object[] = "dtype_is_object"; static const char __pyx_k_nearestNeighbor[] = "nearestNeighbor"; @@ -2606,252 +3446,48 @@ static const char __pyx_k_drawTessellation[] = "drawTessellation"; static const char __pyx_k_newanalysis_voro[] = "newanalysis.voro"; static const char __pyx_k_buildNeighborList[] = "buildNeighborList"; static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum"; -static const char __pyx_k_src_voro_voro_pyx[] = "src/voro/voro.pyx"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_len_points_to_draw[] = "len_points_to_draw"; static const char __pyx_k_strided_and_direct[] = ""; static const char __pyx_k_Unknown_string_type[] = "Unknown string type!"; static const char __pyx_k_strided_and_indirect[] = ""; +static const char __pyx_k_Invalid_shape_in_axis[] = "Invalid shape in axis "; static const char __pyx_k_contiguous_and_direct[] = ""; +static const char __pyx_k_Cannot_index_with_type[] = "Cannot index with type '"; static const char __pyx_k_MemoryView_of_r_object[] = ""; static const char __pyx_k_MemoryView_of_r_at_0x_x[] = ""; static const char __pyx_k_contiguous_and_indirect[] = ""; -static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; static const char __pyx_k_calcTessellationParallel[] = "calcTessellationParallel"; -static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; +static const char __pyx_k_Dimension_d_is_not_direct[] = "Dimension %d is not direct"; static const char __pyx_k_Result_array_is_too_short[] = "Result array is too short!\n"; +static const char __pyx_k_newanalysis_voro_voro_pyx[] = "newanalysis/voro/voro.pyx"; +static const char __pyx_k_Index_out_of_bounds_axis_d[] = "Index out of bounds (axis %d)"; +static const char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero (axis %d)"; static const char __pyx_k_calcTessellationParallelAll[] = "calcTessellationParallelAll"; static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; static const char __pyx_k_calcTessellationVolSurfAtomic[] = "calcTessellationVolSurfAtomic"; static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; static const char __pyx_k_strided_and_direct_or_indirect[] = ""; static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; +static const char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced"; static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview"; static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview"; +static const char __pyx_k_Cannot_transpose_memoryview_with[] = "Cannot transpose memoryview with indirect dimensions"; static const char __pyx_k_ERROR_Either_pass_vols_AND_fa_or[] = "ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!"; static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; -static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))"; +static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))"; static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; -static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; -static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)"; +static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got "; +static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis "; static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; -static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)"; +static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension "; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides."; -static PyObject *__pyx_n_s_ASCII; -static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; -static PyObject *__pyx_n_s_C; -static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; -static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; -static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; -static PyObject *__pyx_kp_s_Cannot_index_with_type_s; -static PyObject *__pyx_kp_s_ERROR_Either_pass_vols_AND_fa_or; -static PyObject *__pyx_n_s_Ellipsis; -static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; -static PyObject *__pyx_n_s_ImportError; -static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; -static PyObject *__pyx_n_s_IndexError; -static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; -static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; -static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d; -static PyObject *__pyx_n_s_MemoryError; -static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; -static PyObject *__pyx_kp_s_MemoryView_of_r_object; -static PyObject *__pyx_n_b_O; -static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a; -static PyObject *__pyx_n_s_PickleError; -static PyObject *__pyx_kp_s_Result_array_is_too_short; -static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; -static PyObject *__pyx_kp_s_Unknown_string_type; -static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s_View_MemoryView; -static PyObject *__pyx_n_s_allocate_buffer; -static PyObject *__pyx_n_s_asarray; -static PyObject *__pyx_n_s_base; -static PyObject *__pyx_n_s_box_x; -static PyObject *__pyx_n_s_box_y; -static PyObject *__pyx_n_s_box_z; -static PyObject *__pyx_n_s_boxl; -static PyObject *__pyx_n_s_boxl_x; -static PyObject *__pyx_n_s_boxl_y; -static PyObject *__pyx_n_s_boxl_z; -static PyObject *__pyx_n_s_boxlength; -static PyObject *__pyx_n_s_buildNeighborList; -static PyObject *__pyx_n_s_c; -static PyObject *__pyx_n_u_c; -static PyObject *__pyx_n_s_c1; -static PyObject *__pyx_n_s_c2; -static PyObject *__pyx_n_s_calcCN; -static PyObject *__pyx_n_s_calcCN_int8; -static PyObject *__pyx_n_s_calcTessellation; -static PyObject *__pyx_n_s_calcTessellationParallel; -static PyObject *__pyx_n_s_calcTessellationParallelAll; -static PyObject *__pyx_n_s_calcTessellationVolSurfAtomic; -static PyObject *__pyx_n_s_ccorelist; -static PyObject *__pyx_n_s_cds; -static PyObject *__pyx_n_s_cf2c; -static PyObject *__pyx_n_s_cfa; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_color_id; -static PyObject *__pyx_kp_s_contiguous_and_direct; -static PyObject *__pyx_kp_s_contiguous_and_indirect; -static PyObject *__pyx_n_s_core_begin; -static PyObject *__pyx_n_s_core_end; -static PyObject *__pyx_n_s_core_first; -static PyObject *__pyx_n_s_core_last; -static PyObject *__pyx_n_s_corelist; -static PyObject *__pyx_n_s_cres; -static PyObject *__pyx_n_s_csurrlist; -static PyObject *__pyx_n_s_ctr; -static PyObject *__pyx_n_s_cts; -static PyObject *__pyx_n_s_cvols; -static PyObject *__pyx_n_s_cxyz; -static PyObject *__pyx_n_s_cylinder_radius; -static PyObject *__pyx_n_s_dataset; -static PyObject *__pyx_n_s_delaunay; -static PyObject *__pyx_n_s_delaunay_tmp; -static PyObject *__pyx_n_s_delaunay_ts; -static PyObject *__pyx_n_s_dict; -static PyObject *__pyx_n_s_dist; -static PyObject *__pyx_n_s_drawTessellation; -static PyObject *__pyx_n_s_draw_triangles; -static PyObject *__pyx_n_s_ds; -static PyObject *__pyx_n_s_ds_ts; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_dtype_is_object; -static PyObject *__pyx_n_s_empty; -static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_end; -static PyObject *__pyx_n_s_enumerate; -static PyObject *__pyx_n_s_error; -static PyObject *__pyx_n_s_f2c; -static PyObject *__pyx_n_s_fa; -static PyObject *__pyx_n_s_file; -static PyObject *__pyx_n_s_filename; -static PyObject *__pyx_n_s_flags; -static PyObject *__pyx_n_s_fn; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_fortran; -static PyObject *__pyx_n_u_fortran; -static PyObject *__pyx_n_s_getstate; -static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi; -static PyObject *__pyx_n_s_h5file; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_icore; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_int8; -static PyObject *__pyx_n_s_ires; -static PyObject *__pyx_n_s_isurr; -static PyObject *__pyx_n_s_itemsize; -static PyObject *__pyx_kp_s_itemsize_0_for_cython_array; -static PyObject *__pyx_n_s_iubq; -static PyObject *__pyx_n_s_j; -static PyObject *__pyx_n_s_k; -static PyObject *__pyx_n_s_len_points_to_draw; -static PyObject *__pyx_n_s_len_xyz; -static PyObject *__pyx_n_s_lower_limit; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_maxsh; -static PyObject *__pyx_n_s_maxshell; -static PyObject *__pyx_n_s_memview; -static PyObject *__pyx_n_s_mindist; -static PyObject *__pyx_n_s_minshell; -static PyObject *__pyx_n_s_mode; -static PyObject *__pyx_n_s_n; -static PyObject *__pyx_n_s_n2; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_name_2; -static PyObject *__pyx_n_s_nat; -static PyObject *__pyx_n_s_natoms; -static PyObject *__pyx_n_s_ncore; -static PyObject *__pyx_n_s_ncpu; -static PyObject *__pyx_n_s_ndim; -static PyObject *__pyx_n_s_nearestNeighbor; -static PyObject *__pyx_n_s_new; -static PyObject *__pyx_n_s_newanalysis_voro; -static PyObject *__pyx_n_s_nmax; -static PyObject *__pyx_n_s_nmol; -static PyObject *__pyx_n_s_nmolecules; -static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; -static PyObject *__pyx_n_s_np; -static PyObject *__pyx_n_s_nsurr; -static PyObject *__pyx_n_s_ntot; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; -static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; -static PyObject *__pyx_n_s_obj; -static PyObject *__pyx_n_s_order; -static PyObject *__pyx_n_s_pack; -static PyObject *__pyx_n_s_pickle; -static PyObject *__pyx_n_s_points_ptr; -static PyObject *__pyx_n_s_points_to_draw; -static PyObject *__pyx_n_s_print; -static PyObject *__pyx_n_s_py_byte_string; -static PyObject *__pyx_n_s_pyx_PickleError; -static PyObject *__pyx_n_s_pyx_checksum; -static PyObject *__pyx_n_s_pyx_getbuffer; -static PyObject *__pyx_n_s_pyx_result; -static PyObject *__pyx_n_s_pyx_state; -static PyObject *__pyx_n_s_pyx_type; -static PyObject *__pyx_n_s_pyx_unpickle_Enum; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_radius; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_reduce; -static PyObject *__pyx_n_s_reduce_cython; -static PyObject *__pyx_n_s_reduce_ex; -static PyObject *__pyx_n_s_result; -static PyObject *__pyx_n_s_s1; -static PyObject *__pyx_n_s_s2; -static PyObject *__pyx_n_s_setstate; -static PyObject *__pyx_n_s_setstate_cython; -static PyObject *__pyx_n_s_sh1; -static PyObject *__pyx_n_s_sh2; -static PyObject *__pyx_n_s_shape; -static PyObject *__pyx_n_s_shell_begin; -static PyObject *__pyx_n_s_shell_end; -static PyObject *__pyx_n_s_size; -static PyObject *__pyx_kp_s_src_voro_voro_pyx; -static PyObject *__pyx_n_s_start; -static PyObject *__pyx_n_s_step; -static PyObject *__pyx_n_s_stop; -static PyObject *__pyx_kp_s_strided_and_direct; -static PyObject *__pyx_kp_s_strided_and_direct_or_indirect; -static PyObject *__pyx_kp_s_strided_and_indirect; -static PyObject *__pyx_kp_s_stringsource; -static PyObject *__pyx_n_s_struct; -static PyObject *__pyx_n_s_surr_begin; -static PyObject *__pyx_n_s_surr_end; -static PyObject *__pyx_n_s_surr_first; -static PyObject *__pyx_n_s_surr_last; -static PyObject *__pyx_n_s_surroundlist; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_triangles; -static PyObject *__pyx_n_s_ts; -static PyObject *__pyx_kp_s_unable_to_allocate_array_data; -static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; -static PyObject *__pyx_n_s_unpack; -static PyObject *__pyx_n_s_update; -static PyObject *__pyx_n_s_upper_limit; -static PyObject *__pyx_n_s_vols; -static PyObject *__pyx_n_s_xyz; -static PyObject *__pyx_n_s_xyz_ptr; -static PyObject *__pyx_n_s_xyz_ts; -static PyObject *__pyx_pf_11newanalysis_4voro_calcTessellation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, float __pyx_v_boxlength, PyArrayObject *__pyx_v_f2c, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell, PyArrayObject *__pyx_v_corelist, PyArrayObject *__pyx_v_vols, PyArrayObject *__pyx_v_fa, PyArrayObject *__pyx_v_ds_ts, PyObject *__pyx_v_ts, PyObject *__pyx_v_ires, PyArrayObject *__pyx_v_surroundlist, PyObject *__pyx_v_h5file); /* proto */ -static PyObject *__pyx_pf_11newanalysis_4voro_2calcTessellationVolSurfAtomic(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz, float __pyx_v_boxlength, __Pyx_memviewslice __pyx_v_f2c, int __pyx_v_natoms, int __pyx_v_nmolecules, int __pyx_v_maxshell, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_vols, __Pyx_memviewslice __pyx_v_fa); /* proto */ -static PyObject *__pyx_pf_11newanalysis_4voro_4calcTessellationParallel(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz_ts, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_surroundlist, __Pyx_memviewslice __pyx_v_delaunay_ts, PyObject *__pyx_v_boxlength, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell); /* proto */ -static PyObject *__pyx_pf_11newanalysis_4voro_6calcTessellationParallelAll(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz_ts, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_delaunay_ts, PyObject *__pyx_v_boxlength, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell); /* proto */ -static PyObject *__pyx_pf_11newanalysis_4voro_8nearestNeighbor(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_surroundlist, __Pyx_memviewslice __pyx_v_delaunay_tmp, __Pyx_memviewslice __pyx_v_delaunay_ts, int __pyx_v_iubq, int __pyx_v_maxshell); /* proto */ -static PyObject *__pyx_pf_11newanalysis_4voro_10drawTessellation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_points_to_draw, PyObject *__pyx_v_cylinder_radius, PyObject *__pyx_v_triangles, int __pyx_v_nmol, int __pyx_v_color_id, PyObject *__pyx_v_filename, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z); /* proto */ -static PyObject *__pyx_pf_11newanalysis_4voro_12buildNeighborList(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_first, PyObject *__pyx_v_core_last, PyObject *__pyx_v_surr_first, PyObject *__pyx_v_surr_last, PyObject *__pyx_v_ctr, PyObject *__pyx_v_minshell, PyObject *__pyx_v_maxshell); /* proto */ -static PyObject *__pyx_pf_11newanalysis_4voro_14calcCN(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_begin, PyObject *__pyx_v_core_end, PyObject *__pyx_v_surr_begin, PyObject *__pyx_v_surr_end, PyObject *__pyx_v_shell_begin, PyObject *__pyx_v_shell_end, PyObject *__pyx_v_ntot); /* proto */ -static PyObject *__pyx_pf_11newanalysis_4voro_16calcCN_int8(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_begin, PyObject *__pyx_v_core_end, PyObject *__pyx_v_surr_begin, PyObject *__pyx_v_surr_end, PyObject *__pyx_v_shell_begin, PyObject *__pyx_v_shell_end, PyObject *__pyx_v_ntot); /* proto */ +/* #### Code section: decls ### */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ @@ -2890,1704 +3526,2714 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_11newanalysis_4voro_calcTessellation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, float __pyx_v_boxlength, PyArrayObject *__pyx_v_f2c, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell, PyArrayObject *__pyx_v_corelist, PyArrayObject *__pyx_v_vols, PyArrayObject *__pyx_v_fa, PyArrayObject *__pyx_v_ds_ts, PyObject *__pyx_v_ts, PyObject *__pyx_v_ires, PyArrayObject *__pyx_v_surroundlist, PyObject *__pyx_v_h5file); /* proto */ +static PyObject *__pyx_pf_11newanalysis_4voro_2calcTessellationVolSurfAtomic(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz, float __pyx_v_boxlength, __Pyx_memviewslice __pyx_v_f2c, int __pyx_v_natoms, int __pyx_v_nmolecules, int __pyx_v_maxshell, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_vols, __Pyx_memviewslice __pyx_v_fa); /* proto */ +static PyObject *__pyx_pf_11newanalysis_4voro_4calcTessellationParallel(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz_ts, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_surroundlist, __Pyx_memviewslice __pyx_v_delaunay_ts, PyObject *__pyx_v_boxlength, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell); /* proto */ +static PyObject *__pyx_pf_11newanalysis_4voro_6calcTessellationParallelAll(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz_ts, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_delaunay_ts, PyObject *__pyx_v_boxlength, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell); /* proto */ +static PyObject *__pyx_pf_11newanalysis_4voro_8nearestNeighbor(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_surroundlist, __Pyx_memviewslice __pyx_v_delaunay_tmp, __Pyx_memviewslice __pyx_v_delaunay_ts, int __pyx_v_iubq, int __pyx_v_maxshell); /* proto */ +static PyObject *__pyx_pf_11newanalysis_4voro_10drawTessellation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_points_to_draw, PyObject *__pyx_v_cylinder_radius, PyObject *__pyx_v_triangles, int __pyx_v_nmol, int __pyx_v_color_id, PyObject *__pyx_v_filename, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z); /* proto */ +static PyObject *__pyx_pf_11newanalysis_4voro_12buildNeighborList(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_first, PyObject *__pyx_v_core_last, PyObject *__pyx_v_surr_first, PyObject *__pyx_v_surr_last, PyObject *__pyx_v_ctr, PyObject *__pyx_v_minshell, PyObject *__pyx_v_maxshell); /* proto */ +static PyObject *__pyx_pf_11newanalysis_4voro_14calcCN(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_begin, PyObject *__pyx_v_core_end, PyObject *__pyx_v_surr_begin, PyObject *__pyx_v_surr_end, PyObject *__pyx_v_shell_begin, PyObject *__pyx_v_shell_end, PyObject *__pyx_v_ntot); /* proto */ +static PyObject *__pyx_pf_11newanalysis_4voro_16calcCN_int8(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_begin, PyObject *__pyx_v_core_end, PyObject *__pyx_v_surr_begin, PyObject *__pyx_v_surr_end, PyObject *__pyx_v_shell_begin, PyObject *__pyx_v_shell_end, PyObject *__pyx_v_ntot); /* proto */ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_112105877; -static PyObject *__pyx_int_136983863; -static PyObject *__pyx_int_184977713; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__18; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_tuple__29; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__33; -static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__37; -static PyObject *__pyx_tuple__39; -static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__42; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__44; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__46; -static PyObject *__pyx_codeobj__24; -static PyObject *__pyx_codeobj__26; -static PyObject *__pyx_codeobj__28; -static PyObject *__pyx_codeobj__30; -static PyObject *__pyx_codeobj__32; -static PyObject *__pyx_codeobj__34; -static PyObject *__pyx_codeobj__36; -static PyObject *__pyx_codeobj__38; -static PyObject *__pyx_codeobj__40; -static PyObject *__pyx_codeobj__47; -/* Late includes */ - -/* "src/voro/voro.pyx":21 - * void _calcTessellationVolSurfAtomic(double *xyz, float boxlength, int *f2c, int natoms, int nmolecules, int maxshell, char *ds_ptr, int *corelist, int ncore, float* vols, float* face_area_ptr) - * - * cdef unicode _ustring(s): # <<<<<<<<<<<<<< - * if type(s) is unicode: - * # fast path for most common case(s) - */ - -static PyObject *__pyx_f_11newanalysis_4voro__ustring(PyObject *__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_ustring", 0); +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4type_type; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_5numpy_dtype; + PyTypeObject *__pyx_ptype_5numpy_flatiter; + PyTypeObject *__pyx_ptype_5numpy_broadcast; + PyTypeObject *__pyx_ptype_5numpy_ndarray; + PyTypeObject *__pyx_ptype_5numpy_generic; + PyTypeObject *__pyx_ptype_5numpy_number; + PyTypeObject *__pyx_ptype_5numpy_integer; + PyTypeObject *__pyx_ptype_5numpy_signedinteger; + PyTypeObject *__pyx_ptype_5numpy_unsignedinteger; + PyTypeObject *__pyx_ptype_5numpy_inexact; + PyTypeObject *__pyx_ptype_5numpy_floating; + PyTypeObject *__pyx_ptype_5numpy_complexfloating; + PyTypeObject *__pyx_ptype_5numpy_flexible; + PyTypeObject *__pyx_ptype_5numpy_character; + PyTypeObject *__pyx_ptype_5numpy_ufunc; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type___pyx_array; + PyObject *__pyx_type___pyx_MemviewEnum; + PyObject *__pyx_type___pyx_memoryview; + PyObject *__pyx_type___pyx_memoryviewslice; + #endif + PyTypeObject *__pyx_array_type; + PyTypeObject *__pyx_MemviewEnum_type; + PyTypeObject *__pyx_memoryview_type; + PyTypeObject *__pyx_memoryviewslice_type; + PyObject *__pyx_kp_u_; + PyObject *__pyx_n_s_ASCII; + PyObject *__pyx_kp_s_All_dimensions_preceding_dimensi; + PyObject *__pyx_n_s_AssertionError; + PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; + PyObject *__pyx_n_s_C; + PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; + PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor; + PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi; + PyObject *__pyx_kp_u_Cannot_index_with_type; + PyObject *__pyx_kp_s_Cannot_transpose_memoryview_with; + PyObject *__pyx_kp_s_Dimension_d_is_not_direct; + PyObject *__pyx_kp_s_ERROR_Either_pass_vols_AND_fa_or; + PyObject *__pyx_n_s_Ellipsis; + PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; + PyObject *__pyx_n_s_ImportError; + PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0; + PyObject *__pyx_n_s_IndexError; + PyObject *__pyx_kp_s_Index_out_of_bounds_axis_d; + PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; + PyObject *__pyx_kp_u_Invalid_mode_expected_c_or_fortr; + PyObject *__pyx_kp_u_Invalid_shape_in_axis; + PyObject *__pyx_n_s_MemoryError; + PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; + PyObject *__pyx_kp_s_MemoryView_of_r_object; + PyObject *__pyx_n_b_O; + PyObject *__pyx_kp_u_Out_of_bounds_on_buffer_access_a; + PyObject *__pyx_n_s_PickleError; + PyObject *__pyx_kp_s_Result_array_is_too_short; + PyObject *__pyx_n_s_Sequence; + PyObject *__pyx_kp_s_Step_may_not_be_zero_axis_d; + PyObject *__pyx_n_s_TypeError; + PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; + PyObject *__pyx_kp_s_Unknown_string_type; + PyObject *__pyx_n_s_ValueError; + PyObject *__pyx_n_s_View_MemoryView; + PyObject *__pyx_kp_u__2; + PyObject *__pyx_n_s__3; + PyObject *__pyx_n_s__45; + PyObject *__pyx_kp_u__6; + PyObject *__pyx_kp_u__7; + PyObject *__pyx_n_s_abc; + PyObject *__pyx_n_s_allocate_buffer; + PyObject *__pyx_kp_u_and; + PyObject *__pyx_n_s_asarray; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_base; + PyObject *__pyx_n_s_box_x; + PyObject *__pyx_n_s_box_y; + PyObject *__pyx_n_s_box_z; + PyObject *__pyx_n_s_boxl; + PyObject *__pyx_n_s_boxl_x; + PyObject *__pyx_n_s_boxl_y; + PyObject *__pyx_n_s_boxl_z; + PyObject *__pyx_n_s_boxlength; + PyObject *__pyx_n_s_buildNeighborList; + PyObject *__pyx_n_s_c; + PyObject *__pyx_n_u_c; + PyObject *__pyx_n_s_c1; + PyObject *__pyx_n_s_c2; + PyObject *__pyx_n_s_calcCN; + PyObject *__pyx_n_s_calcCN_int8; + PyObject *__pyx_n_s_calcTessellation; + PyObject *__pyx_n_s_calcTessellationParallel; + PyObject *__pyx_n_s_calcTessellationParallelAll; + PyObject *__pyx_n_s_calcTessellationVolSurfAtomic; + PyObject *__pyx_n_s_ccorelist; + PyObject *__pyx_n_s_cds; + PyObject *__pyx_n_s_cf2c; + PyObject *__pyx_n_s_cfa; + PyObject *__pyx_n_s_class; + PyObject *__pyx_n_s_class_getitem; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_collections; + PyObject *__pyx_kp_s_collections_abc; + PyObject *__pyx_n_s_color_id; + PyObject *__pyx_kp_s_contiguous_and_direct; + PyObject *__pyx_kp_s_contiguous_and_indirect; + PyObject *__pyx_n_s_core_begin; + PyObject *__pyx_n_s_core_end; + PyObject *__pyx_n_s_core_first; + PyObject *__pyx_n_s_core_last; + PyObject *__pyx_n_s_corelist; + PyObject *__pyx_n_s_count; + PyObject *__pyx_n_s_cres; + PyObject *__pyx_n_s_csurrlist; + PyObject *__pyx_n_s_ctr; + PyObject *__pyx_n_s_cts; + PyObject *__pyx_n_s_cvols; + PyObject *__pyx_n_s_cxyz; + PyObject *__pyx_n_s_cylinder_radius; + PyObject *__pyx_n_s_dataset; + PyObject *__pyx_n_s_delaunay; + PyObject *__pyx_n_s_delaunay_tmp; + PyObject *__pyx_n_s_delaunay_ts; + PyObject *__pyx_n_s_dict; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_n_s_dist; + PyObject *__pyx_n_s_drawTessellation; + PyObject *__pyx_n_s_draw_triangles; + PyObject *__pyx_n_s_ds; + PyObject *__pyx_n_s_ds_ts; + PyObject *__pyx_n_s_dtype; + PyObject *__pyx_n_s_dtype_is_object; + PyObject *__pyx_n_s_empty; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_encode; + PyObject *__pyx_n_s_enumerate; + PyObject *__pyx_n_s_error; + PyObject *__pyx_n_s_f2c; + PyObject *__pyx_n_s_fa; + PyObject *__pyx_n_s_filename; + PyObject *__pyx_n_s_flags; + PyObject *__pyx_n_s_fn; + PyObject *__pyx_n_s_format; + PyObject *__pyx_n_s_fortran; + PyObject *__pyx_n_u_fortran; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_getstate; + PyObject *__pyx_kp_u_got; + PyObject *__pyx_kp_u_got_differing_extents_in_dimensi; + PyObject *__pyx_n_s_h5file; + PyObject *__pyx_n_s_i; + PyObject *__pyx_n_s_icore; + PyObject *__pyx_n_s_id; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_index; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_int8; + PyObject *__pyx_n_s_ires; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_isurr; + PyObject *__pyx_n_s_itemsize; + PyObject *__pyx_kp_s_itemsize_0_for_cython_array; + PyObject *__pyx_n_s_iubq; + PyObject *__pyx_n_s_j; + PyObject *__pyx_n_s_k; + PyObject *__pyx_n_s_len_points_to_draw; + PyObject *__pyx_n_s_len_xyz; + PyObject *__pyx_n_s_lower_limit; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_maxsh; + PyObject *__pyx_n_s_maxshell; + PyObject *__pyx_n_s_memview; + PyObject *__pyx_n_s_mindist; + PyObject *__pyx_n_s_minshell; + PyObject *__pyx_n_s_mode; + PyObject *__pyx_n_s_n; + PyObject *__pyx_n_s_n2; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_name_2; + PyObject *__pyx_n_s_nat; + PyObject *__pyx_n_s_natoms; + PyObject *__pyx_n_s_ncore; + PyObject *__pyx_n_s_ncpu; + PyObject *__pyx_n_s_ndim; + PyObject *__pyx_n_s_nearestNeighbor; + PyObject *__pyx_n_s_new; + PyObject *__pyx_n_s_newanalysis_voro; + PyObject *__pyx_kp_s_newanalysis_voro_voro_pyx; + PyObject *__pyx_n_s_nmax; + PyObject *__pyx_n_s_nmol; + PyObject *__pyx_n_s_nmolecules; + PyObject *__pyx_kp_s_no_default___reduce___due_to_non; + PyObject *__pyx_n_s_np; + PyObject *__pyx_n_s_nsurr; + PyObject *__pyx_n_s_ntot; + PyObject *__pyx_n_s_numpy; + PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; + PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; + PyObject *__pyx_n_s_obj; + PyObject *__pyx_n_s_order; + PyObject *__pyx_n_s_pack; + PyObject *__pyx_n_s_pickle; + PyObject *__pyx_n_s_points_ptr; + PyObject *__pyx_n_s_points_to_draw; + PyObject *__pyx_n_s_print; + PyObject *__pyx_n_s_py_byte_string; + PyObject *__pyx_n_s_pyx_PickleError; + PyObject *__pyx_n_s_pyx_checksum; + PyObject *__pyx_n_s_pyx_result; + PyObject *__pyx_n_s_pyx_state; + PyObject *__pyx_n_s_pyx_type; + PyObject *__pyx_n_s_pyx_unpickle_Enum; + PyObject *__pyx_n_s_pyx_vtable; + PyObject *__pyx_n_s_radius; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_reduce; + PyObject *__pyx_n_s_reduce_cython; + PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_register; + PyObject *__pyx_n_s_result; + PyObject *__pyx_n_s_s1; + PyObject *__pyx_n_s_s2; + PyObject *__pyx_n_s_setstate; + PyObject *__pyx_n_s_setstate_cython; + PyObject *__pyx_n_s_sh1; + PyObject *__pyx_n_s_sh2; + PyObject *__pyx_n_s_shape; + PyObject *__pyx_n_s_shell_begin; + PyObject *__pyx_n_s_shell_end; + PyObject *__pyx_n_s_size; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_start; + PyObject *__pyx_n_s_step; + PyObject *__pyx_n_s_stop; + PyObject *__pyx_kp_s_strided_and_direct; + PyObject *__pyx_kp_s_strided_and_direct_or_indirect; + PyObject *__pyx_kp_s_strided_and_indirect; + PyObject *__pyx_kp_s_stringsource; + PyObject *__pyx_n_s_struct; + PyObject *__pyx_n_s_surr_begin; + PyObject *__pyx_n_s_surr_end; + PyObject *__pyx_n_s_surr_first; + PyObject *__pyx_n_s_surr_last; + PyObject *__pyx_n_s_surroundlist; + PyObject *__pyx_n_s_sys; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_triangles; + PyObject *__pyx_n_s_ts; + PyObject *__pyx_kp_s_unable_to_allocate_array_data; + PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; + PyObject *__pyx_n_s_unpack; + PyObject *__pyx_n_s_update; + PyObject *__pyx_n_s_upper_limit; + PyObject *__pyx_n_s_version_info; + PyObject *__pyx_n_s_vols; + PyObject *__pyx_n_s_xyz; + PyObject *__pyx_n_s_xyz_ptr; + PyObject *__pyx_n_s_xyz_ts; + PyObject *__pyx_int_0; + PyObject *__pyx_int_1; + PyObject *__pyx_int_3; + PyObject *__pyx_int_112105877; + PyObject *__pyx_int_136983863; + PyObject *__pyx_int_184977713; + PyObject *__pyx_int_neg_1; + PyObject *__pyx_slice__5; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__8; + PyObject *__pyx_tuple__9; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__11; + PyObject *__pyx_tuple__12; + PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__14; + PyObject *__pyx_tuple__15; + PyObject *__pyx_tuple__16; + PyObject *__pyx_tuple__17; + PyObject *__pyx_tuple__18; + PyObject *__pyx_tuple__19; + PyObject *__pyx_tuple__20; + PyObject *__pyx_tuple__21; + PyObject *__pyx_tuple__22; + PyObject *__pyx_tuple__23; + PyObject *__pyx_tuple__25; + PyObject *__pyx_tuple__27; + PyObject *__pyx_tuple__28; + PyObject *__pyx_tuple__30; + PyObject *__pyx_tuple__32; + PyObject *__pyx_tuple__34; + PyObject *__pyx_tuple__36; + PyObject *__pyx_tuple__38; + PyObject *__pyx_tuple__39; + PyObject *__pyx_tuple__41; + PyObject *__pyx_tuple__42; + PyObject *__pyx_codeobj__24; + PyObject *__pyx_codeobj__26; + PyObject *__pyx_codeobj__29; + PyObject *__pyx_codeobj__31; + PyObject *__pyx_codeobj__33; + PyObject *__pyx_codeobj__35; + PyObject *__pyx_codeobj__37; + PyObject *__pyx_codeobj__40; + PyObject *__pyx_codeobj__43; + PyObject *__pyx_codeobj__44; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif - /* "src/voro/voro.pyx":22 - * - * cdef unicode _ustring(s): - * if type(s) is unicode: # <<<<<<<<<<<<<< - * # fast path for most common case(s) - * return s - */ - __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_s)) == ((PyObject *)(&PyUnicode_Type))); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) - /* "src/voro/voro.pyx":24 - * if type(s) is unicode: - * # fast path for most common case(s) - * return s # <<<<<<<<<<<<<< - * elif PY_MAJOR_VERSION < 3 and isinstance(s, bytes): - * # only accept byte strings in Python 2.x, not in Py3 - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject*)__pyx_v_s)); - __pyx_r = ((PyObject*)__pyx_v_s); - goto __pyx_L0; +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) - /* "src/voro/voro.pyx":22 +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); + Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_array_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_array); + Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum); + Py_CLEAR(clear_module_state->__pyx_memoryview_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview); + Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type); + Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice); + Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_n_s_ASCII); + Py_CLEAR(clear_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_CLEAR(clear_module_state->__pyx_n_s_C); + Py_CLEAR(clear_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_CLEAR(clear_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_ERROR_Either_pass_vols_AND_fa_or); + Py_CLEAR(clear_module_state->__pyx_n_s_Ellipsis); + Py_CLEAR(clear_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_CLEAR(clear_module_state->__pyx_n_s_ImportError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_CLEAR(clear_module_state->__pyx_n_s_IndexError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_CLEAR(clear_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_CLEAR(clear_module_state->__pyx_n_b_O); + Py_CLEAR(clear_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_CLEAR(clear_module_state->__pyx_n_s_PickleError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Result_array_is_too_short); + Py_CLEAR(clear_module_state->__pyx_n_s_Sequence); + Py_CLEAR(clear_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unknown_string_type); + Py_CLEAR(clear_module_state->__pyx_n_s_ValueError); + Py_CLEAR(clear_module_state->__pyx_n_s_View_MemoryView); + Py_CLEAR(clear_module_state->__pyx_kp_u__2); + Py_CLEAR(clear_module_state->__pyx_n_s__3); + Py_CLEAR(clear_module_state->__pyx_n_s__45); + Py_CLEAR(clear_module_state->__pyx_kp_u__6); + Py_CLEAR(clear_module_state->__pyx_kp_u__7); + Py_CLEAR(clear_module_state->__pyx_n_s_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_allocate_buffer); + Py_CLEAR(clear_module_state->__pyx_kp_u_and); + Py_CLEAR(clear_module_state->__pyx_n_s_asarray); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_base); + Py_CLEAR(clear_module_state->__pyx_n_s_box_x); + Py_CLEAR(clear_module_state->__pyx_n_s_box_y); + Py_CLEAR(clear_module_state->__pyx_n_s_box_z); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl_x); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl_y); + Py_CLEAR(clear_module_state->__pyx_n_s_boxl_z); + Py_CLEAR(clear_module_state->__pyx_n_s_boxlength); + Py_CLEAR(clear_module_state->__pyx_n_s_buildNeighborList); + Py_CLEAR(clear_module_state->__pyx_n_s_c); + Py_CLEAR(clear_module_state->__pyx_n_u_c); + Py_CLEAR(clear_module_state->__pyx_n_s_c1); + Py_CLEAR(clear_module_state->__pyx_n_s_c2); + Py_CLEAR(clear_module_state->__pyx_n_s_calcCN); + Py_CLEAR(clear_module_state->__pyx_n_s_calcCN_int8); + Py_CLEAR(clear_module_state->__pyx_n_s_calcTessellation); + Py_CLEAR(clear_module_state->__pyx_n_s_calcTessellationParallel); + Py_CLEAR(clear_module_state->__pyx_n_s_calcTessellationParallelAll); + Py_CLEAR(clear_module_state->__pyx_n_s_calcTessellationVolSurfAtomic); + Py_CLEAR(clear_module_state->__pyx_n_s_ccorelist); + Py_CLEAR(clear_module_state->__pyx_n_s_cds); + Py_CLEAR(clear_module_state->__pyx_n_s_cf2c); + Py_CLEAR(clear_module_state->__pyx_n_s_cfa); + Py_CLEAR(clear_module_state->__pyx_n_s_class); + Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_collections); + Py_CLEAR(clear_module_state->__pyx_kp_s_collections_abc); + Py_CLEAR(clear_module_state->__pyx_n_s_color_id); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_CLEAR(clear_module_state->__pyx_n_s_core_begin); + Py_CLEAR(clear_module_state->__pyx_n_s_core_end); + Py_CLEAR(clear_module_state->__pyx_n_s_core_first); + Py_CLEAR(clear_module_state->__pyx_n_s_core_last); + Py_CLEAR(clear_module_state->__pyx_n_s_corelist); + Py_CLEAR(clear_module_state->__pyx_n_s_count); + Py_CLEAR(clear_module_state->__pyx_n_s_cres); + Py_CLEAR(clear_module_state->__pyx_n_s_csurrlist); + Py_CLEAR(clear_module_state->__pyx_n_s_ctr); + Py_CLEAR(clear_module_state->__pyx_n_s_cts); + Py_CLEAR(clear_module_state->__pyx_n_s_cvols); + Py_CLEAR(clear_module_state->__pyx_n_s_cxyz); + Py_CLEAR(clear_module_state->__pyx_n_s_cylinder_radius); + Py_CLEAR(clear_module_state->__pyx_n_s_dataset); + Py_CLEAR(clear_module_state->__pyx_n_s_delaunay); + Py_CLEAR(clear_module_state->__pyx_n_s_delaunay_tmp); + Py_CLEAR(clear_module_state->__pyx_n_s_delaunay_ts); + Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_dist); + Py_CLEAR(clear_module_state->__pyx_n_s_drawTessellation); + Py_CLEAR(clear_module_state->__pyx_n_s_draw_triangles); + Py_CLEAR(clear_module_state->__pyx_n_s_ds); + Py_CLEAR(clear_module_state->__pyx_n_s_ds_ts); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype_is_object); + Py_CLEAR(clear_module_state->__pyx_n_s_empty); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); + Py_CLEAR(clear_module_state->__pyx_n_s_error); + Py_CLEAR(clear_module_state->__pyx_n_s_f2c); + Py_CLEAR(clear_module_state->__pyx_n_s_fa); + Py_CLEAR(clear_module_state->__pyx_n_s_filename); + Py_CLEAR(clear_module_state->__pyx_n_s_flags); + Py_CLEAR(clear_module_state->__pyx_n_s_fn); + Py_CLEAR(clear_module_state->__pyx_n_s_format); + Py_CLEAR(clear_module_state->__pyx_n_s_fortran); + Py_CLEAR(clear_module_state->__pyx_n_u_fortran); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_kp_u_got); + Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_CLEAR(clear_module_state->__pyx_n_s_h5file); + Py_CLEAR(clear_module_state->__pyx_n_s_i); + Py_CLEAR(clear_module_state->__pyx_n_s_icore); + Py_CLEAR(clear_module_state->__pyx_n_s_id); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_index); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_int8); + Py_CLEAR(clear_module_state->__pyx_n_s_ires); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_isurr); + Py_CLEAR(clear_module_state->__pyx_n_s_itemsize); + Py_CLEAR(clear_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_CLEAR(clear_module_state->__pyx_n_s_iubq); + Py_CLEAR(clear_module_state->__pyx_n_s_j); + Py_CLEAR(clear_module_state->__pyx_n_s_k); + Py_CLEAR(clear_module_state->__pyx_n_s_len_points_to_draw); + Py_CLEAR(clear_module_state->__pyx_n_s_len_xyz); + Py_CLEAR(clear_module_state->__pyx_n_s_lower_limit); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_maxsh); + Py_CLEAR(clear_module_state->__pyx_n_s_maxshell); + Py_CLEAR(clear_module_state->__pyx_n_s_memview); + Py_CLEAR(clear_module_state->__pyx_n_s_mindist); + Py_CLEAR(clear_module_state->__pyx_n_s_minshell); + Py_CLEAR(clear_module_state->__pyx_n_s_mode); + Py_CLEAR(clear_module_state->__pyx_n_s_n); + Py_CLEAR(clear_module_state->__pyx_n_s_n2); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_name_2); + Py_CLEAR(clear_module_state->__pyx_n_s_nat); + Py_CLEAR(clear_module_state->__pyx_n_s_natoms); + Py_CLEAR(clear_module_state->__pyx_n_s_ncore); + Py_CLEAR(clear_module_state->__pyx_n_s_ncpu); + Py_CLEAR(clear_module_state->__pyx_n_s_ndim); + Py_CLEAR(clear_module_state->__pyx_n_s_nearestNeighbor); + Py_CLEAR(clear_module_state->__pyx_n_s_new); + Py_CLEAR(clear_module_state->__pyx_n_s_newanalysis_voro); + Py_CLEAR(clear_module_state->__pyx_kp_s_newanalysis_voro_voro_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_nmax); + Py_CLEAR(clear_module_state->__pyx_n_s_nmol); + Py_CLEAR(clear_module_state->__pyx_n_s_nmolecules); + Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_CLEAR(clear_module_state->__pyx_n_s_np); + Py_CLEAR(clear_module_state->__pyx_n_s_nsurr); + Py_CLEAR(clear_module_state->__pyx_n_s_ntot); + Py_CLEAR(clear_module_state->__pyx_n_s_numpy); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_CLEAR(clear_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_CLEAR(clear_module_state->__pyx_n_s_obj); + Py_CLEAR(clear_module_state->__pyx_n_s_order); + Py_CLEAR(clear_module_state->__pyx_n_s_pack); + Py_CLEAR(clear_module_state->__pyx_n_s_pickle); + Py_CLEAR(clear_module_state->__pyx_n_s_points_ptr); + Py_CLEAR(clear_module_state->__pyx_n_s_points_to_draw); + Py_CLEAR(clear_module_state->__pyx_n_s_print); + Py_CLEAR(clear_module_state->__pyx_n_s_py_byte_string); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); + Py_CLEAR(clear_module_state->__pyx_n_s_radius); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_register); + Py_CLEAR(clear_module_state->__pyx_n_s_result); + Py_CLEAR(clear_module_state->__pyx_n_s_s1); + Py_CLEAR(clear_module_state->__pyx_n_s_s2); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_sh1); + Py_CLEAR(clear_module_state->__pyx_n_s_sh2); + Py_CLEAR(clear_module_state->__pyx_n_s_shape); + Py_CLEAR(clear_module_state->__pyx_n_s_shell_begin); + Py_CLEAR(clear_module_state->__pyx_n_s_shell_end); + Py_CLEAR(clear_module_state->__pyx_n_s_size); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_start); + Py_CLEAR(clear_module_state->__pyx_n_s_step); + Py_CLEAR(clear_module_state->__pyx_n_s_stop); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_indirect); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_struct); + Py_CLEAR(clear_module_state->__pyx_n_s_surr_begin); + Py_CLEAR(clear_module_state->__pyx_n_s_surr_end); + Py_CLEAR(clear_module_state->__pyx_n_s_surr_first); + Py_CLEAR(clear_module_state->__pyx_n_s_surr_last); + Py_CLEAR(clear_module_state->__pyx_n_s_surroundlist); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_triangles); + Py_CLEAR(clear_module_state->__pyx_n_s_ts); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_CLEAR(clear_module_state->__pyx_n_s_unpack); + Py_CLEAR(clear_module_state->__pyx_n_s_update); + Py_CLEAR(clear_module_state->__pyx_n_s_upper_limit); + Py_CLEAR(clear_module_state->__pyx_n_s_version_info); + Py_CLEAR(clear_module_state->__pyx_n_s_vols); + Py_CLEAR(clear_module_state->__pyx_n_s_xyz); + Py_CLEAR(clear_module_state->__pyx_n_s_xyz_ptr); + Py_CLEAR(clear_module_state->__pyx_n_s_xyz_ts); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_3); + Py_CLEAR(clear_module_state->__pyx_int_112105877); + Py_CLEAR(clear_module_state->__pyx_int_136983863); + Py_CLEAR(clear_module_state->__pyx_int_184977713); + Py_CLEAR(clear_module_state->__pyx_int_neg_1); + Py_CLEAR(clear_module_state->__pyx_slice__5); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_tuple__9); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__14); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__16); + Py_CLEAR(clear_module_state->__pyx_tuple__17); + Py_CLEAR(clear_module_state->__pyx_tuple__18); + Py_CLEAR(clear_module_state->__pyx_tuple__19); + Py_CLEAR(clear_module_state->__pyx_tuple__20); + Py_CLEAR(clear_module_state->__pyx_tuple__21); + Py_CLEAR(clear_module_state->__pyx_tuple__22); + Py_CLEAR(clear_module_state->__pyx_tuple__23); + Py_CLEAR(clear_module_state->__pyx_tuple__25); + Py_CLEAR(clear_module_state->__pyx_tuple__27); + Py_CLEAR(clear_module_state->__pyx_tuple__28); + Py_CLEAR(clear_module_state->__pyx_tuple__30); + Py_CLEAR(clear_module_state->__pyx_tuple__32); + Py_CLEAR(clear_module_state->__pyx_tuple__34); + Py_CLEAR(clear_module_state->__pyx_tuple__36); + Py_CLEAR(clear_module_state->__pyx_tuple__38); + Py_CLEAR(clear_module_state->__pyx_tuple__39); + Py_CLEAR(clear_module_state->__pyx_tuple__41); + Py_CLEAR(clear_module_state->__pyx_tuple__42); + Py_CLEAR(clear_module_state->__pyx_codeobj__24); + Py_CLEAR(clear_module_state->__pyx_codeobj__26); + Py_CLEAR(clear_module_state->__pyx_codeobj__29); + Py_CLEAR(clear_module_state->__pyx_codeobj__31); + Py_CLEAR(clear_module_state->__pyx_codeobj__33); + Py_CLEAR(clear_module_state->__pyx_codeobj__35); + Py_CLEAR(clear_module_state->__pyx_codeobj__37); + Py_CLEAR(clear_module_state->__pyx_codeobj__40); + Py_CLEAR(clear_module_state->__pyx_codeobj__43); + Py_CLEAR(clear_module_state->__pyx_codeobj__44); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); + Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_array_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_array); + Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum); + Py_VISIT(traverse_module_state->__pyx_memoryview_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview); + Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type); + Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice); + Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_n_s_ASCII); + Py_VISIT(traverse_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri); + Py_VISIT(traverse_module_state->__pyx_n_s_C); + Py_VISIT(traverse_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi); + Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_index_with_type); + Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with); + Py_VISIT(traverse_module_state->__pyx_kp_s_Dimension_d_is_not_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_ERROR_Either_pass_vols_AND_fa_or); + Py_VISIT(traverse_module_state->__pyx_n_s_Ellipsis); + Py_VISIT(traverse_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr); + Py_VISIT(traverse_module_state->__pyx_n_s_ImportError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0); + Py_VISIT(traverse_module_state->__pyx_n_s_IndexError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d); + Py_VISIT(traverse_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr); + Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_shape_in_axis); + Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x); + Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_object); + Py_VISIT(traverse_module_state->__pyx_n_b_O); + Py_VISIT(traverse_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + Py_VISIT(traverse_module_state->__pyx_n_s_PickleError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Result_array_is_too_short); + Py_VISIT(traverse_module_state->__pyx_n_s_Sequence); + Py_VISIT(traverse_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unable_to_convert_item_to_object); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unknown_string_type); + Py_VISIT(traverse_module_state->__pyx_n_s_ValueError); + Py_VISIT(traverse_module_state->__pyx_n_s_View_MemoryView); + Py_VISIT(traverse_module_state->__pyx_kp_u__2); + Py_VISIT(traverse_module_state->__pyx_n_s__3); + Py_VISIT(traverse_module_state->__pyx_n_s__45); + Py_VISIT(traverse_module_state->__pyx_kp_u__6); + Py_VISIT(traverse_module_state->__pyx_kp_u__7); + Py_VISIT(traverse_module_state->__pyx_n_s_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_allocate_buffer); + Py_VISIT(traverse_module_state->__pyx_kp_u_and); + Py_VISIT(traverse_module_state->__pyx_n_s_asarray); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_base); + Py_VISIT(traverse_module_state->__pyx_n_s_box_x); + Py_VISIT(traverse_module_state->__pyx_n_s_box_y); + Py_VISIT(traverse_module_state->__pyx_n_s_box_z); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl_x); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl_y); + Py_VISIT(traverse_module_state->__pyx_n_s_boxl_z); + Py_VISIT(traverse_module_state->__pyx_n_s_boxlength); + Py_VISIT(traverse_module_state->__pyx_n_s_buildNeighborList); + Py_VISIT(traverse_module_state->__pyx_n_s_c); + Py_VISIT(traverse_module_state->__pyx_n_u_c); + Py_VISIT(traverse_module_state->__pyx_n_s_c1); + Py_VISIT(traverse_module_state->__pyx_n_s_c2); + Py_VISIT(traverse_module_state->__pyx_n_s_calcCN); + Py_VISIT(traverse_module_state->__pyx_n_s_calcCN_int8); + Py_VISIT(traverse_module_state->__pyx_n_s_calcTessellation); + Py_VISIT(traverse_module_state->__pyx_n_s_calcTessellationParallel); + Py_VISIT(traverse_module_state->__pyx_n_s_calcTessellationParallelAll); + Py_VISIT(traverse_module_state->__pyx_n_s_calcTessellationVolSurfAtomic); + Py_VISIT(traverse_module_state->__pyx_n_s_ccorelist); + Py_VISIT(traverse_module_state->__pyx_n_s_cds); + Py_VISIT(traverse_module_state->__pyx_n_s_cf2c); + Py_VISIT(traverse_module_state->__pyx_n_s_cfa); + Py_VISIT(traverse_module_state->__pyx_n_s_class); + Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_collections); + Py_VISIT(traverse_module_state->__pyx_kp_s_collections_abc); + Py_VISIT(traverse_module_state->__pyx_n_s_color_id); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_indirect); + Py_VISIT(traverse_module_state->__pyx_n_s_core_begin); + Py_VISIT(traverse_module_state->__pyx_n_s_core_end); + Py_VISIT(traverse_module_state->__pyx_n_s_core_first); + Py_VISIT(traverse_module_state->__pyx_n_s_core_last); + Py_VISIT(traverse_module_state->__pyx_n_s_corelist); + Py_VISIT(traverse_module_state->__pyx_n_s_count); + Py_VISIT(traverse_module_state->__pyx_n_s_cres); + Py_VISIT(traverse_module_state->__pyx_n_s_csurrlist); + Py_VISIT(traverse_module_state->__pyx_n_s_ctr); + Py_VISIT(traverse_module_state->__pyx_n_s_cts); + Py_VISIT(traverse_module_state->__pyx_n_s_cvols); + Py_VISIT(traverse_module_state->__pyx_n_s_cxyz); + Py_VISIT(traverse_module_state->__pyx_n_s_cylinder_radius); + Py_VISIT(traverse_module_state->__pyx_n_s_dataset); + Py_VISIT(traverse_module_state->__pyx_n_s_delaunay); + Py_VISIT(traverse_module_state->__pyx_n_s_delaunay_tmp); + Py_VISIT(traverse_module_state->__pyx_n_s_delaunay_ts); + Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_dist); + Py_VISIT(traverse_module_state->__pyx_n_s_drawTessellation); + Py_VISIT(traverse_module_state->__pyx_n_s_draw_triangles); + Py_VISIT(traverse_module_state->__pyx_n_s_ds); + Py_VISIT(traverse_module_state->__pyx_n_s_ds_ts); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype_is_object); + Py_VISIT(traverse_module_state->__pyx_n_s_empty); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); + Py_VISIT(traverse_module_state->__pyx_n_s_error); + Py_VISIT(traverse_module_state->__pyx_n_s_f2c); + Py_VISIT(traverse_module_state->__pyx_n_s_fa); + Py_VISIT(traverse_module_state->__pyx_n_s_filename); + Py_VISIT(traverse_module_state->__pyx_n_s_flags); + Py_VISIT(traverse_module_state->__pyx_n_s_fn); + Py_VISIT(traverse_module_state->__pyx_n_s_format); + Py_VISIT(traverse_module_state->__pyx_n_s_fortran); + Py_VISIT(traverse_module_state->__pyx_n_u_fortran); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_kp_u_got); + Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi); + Py_VISIT(traverse_module_state->__pyx_n_s_h5file); + Py_VISIT(traverse_module_state->__pyx_n_s_i); + Py_VISIT(traverse_module_state->__pyx_n_s_icore); + Py_VISIT(traverse_module_state->__pyx_n_s_id); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_index); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_int8); + Py_VISIT(traverse_module_state->__pyx_n_s_ires); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_isurr); + Py_VISIT(traverse_module_state->__pyx_n_s_itemsize); + Py_VISIT(traverse_module_state->__pyx_kp_s_itemsize_0_for_cython_array); + Py_VISIT(traverse_module_state->__pyx_n_s_iubq); + Py_VISIT(traverse_module_state->__pyx_n_s_j); + Py_VISIT(traverse_module_state->__pyx_n_s_k); + Py_VISIT(traverse_module_state->__pyx_n_s_len_points_to_draw); + Py_VISIT(traverse_module_state->__pyx_n_s_len_xyz); + Py_VISIT(traverse_module_state->__pyx_n_s_lower_limit); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_maxsh); + Py_VISIT(traverse_module_state->__pyx_n_s_maxshell); + Py_VISIT(traverse_module_state->__pyx_n_s_memview); + Py_VISIT(traverse_module_state->__pyx_n_s_mindist); + Py_VISIT(traverse_module_state->__pyx_n_s_minshell); + Py_VISIT(traverse_module_state->__pyx_n_s_mode); + Py_VISIT(traverse_module_state->__pyx_n_s_n); + Py_VISIT(traverse_module_state->__pyx_n_s_n2); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_name_2); + Py_VISIT(traverse_module_state->__pyx_n_s_nat); + Py_VISIT(traverse_module_state->__pyx_n_s_natoms); + Py_VISIT(traverse_module_state->__pyx_n_s_ncore); + Py_VISIT(traverse_module_state->__pyx_n_s_ncpu); + Py_VISIT(traverse_module_state->__pyx_n_s_ndim); + Py_VISIT(traverse_module_state->__pyx_n_s_nearestNeighbor); + Py_VISIT(traverse_module_state->__pyx_n_s_new); + Py_VISIT(traverse_module_state->__pyx_n_s_newanalysis_voro); + Py_VISIT(traverse_module_state->__pyx_kp_s_newanalysis_voro_voro_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_nmax); + Py_VISIT(traverse_module_state->__pyx_n_s_nmol); + Py_VISIT(traverse_module_state->__pyx_n_s_nmolecules); + Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_VISIT(traverse_module_state->__pyx_n_s_np); + Py_VISIT(traverse_module_state->__pyx_n_s_nsurr); + Py_VISIT(traverse_module_state->__pyx_n_s_ntot); + Py_VISIT(traverse_module_state->__pyx_n_s_numpy); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_multiarray_failed_to); + Py_VISIT(traverse_module_state->__pyx_kp_s_numpy_core_umath_failed_to_impor); + Py_VISIT(traverse_module_state->__pyx_n_s_obj); + Py_VISIT(traverse_module_state->__pyx_n_s_order); + Py_VISIT(traverse_module_state->__pyx_n_s_pack); + Py_VISIT(traverse_module_state->__pyx_n_s_pickle); + Py_VISIT(traverse_module_state->__pyx_n_s_points_ptr); + Py_VISIT(traverse_module_state->__pyx_n_s_points_to_draw); + Py_VISIT(traverse_module_state->__pyx_n_s_print); + Py_VISIT(traverse_module_state->__pyx_n_s_py_byte_string); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Enum); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); + Py_VISIT(traverse_module_state->__pyx_n_s_radius); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_register); + Py_VISIT(traverse_module_state->__pyx_n_s_result); + Py_VISIT(traverse_module_state->__pyx_n_s_s1); + Py_VISIT(traverse_module_state->__pyx_n_s_s2); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_sh1); + Py_VISIT(traverse_module_state->__pyx_n_s_sh2); + Py_VISIT(traverse_module_state->__pyx_n_s_shape); + Py_VISIT(traverse_module_state->__pyx_n_s_shell_begin); + Py_VISIT(traverse_module_state->__pyx_n_s_shell_end); + Py_VISIT(traverse_module_state->__pyx_n_s_size); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_start); + Py_VISIT(traverse_module_state->__pyx_n_s_step); + Py_VISIT(traverse_module_state->__pyx_n_s_stop); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct_or_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_indirect); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_struct); + Py_VISIT(traverse_module_state->__pyx_n_s_surr_begin); + Py_VISIT(traverse_module_state->__pyx_n_s_surr_end); + Py_VISIT(traverse_module_state->__pyx_n_s_surr_first); + Py_VISIT(traverse_module_state->__pyx_n_s_surr_last); + Py_VISIT(traverse_module_state->__pyx_n_s_surroundlist); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_triangles); + Py_VISIT(traverse_module_state->__pyx_n_s_ts); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_array_data); + Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str); + Py_VISIT(traverse_module_state->__pyx_n_s_unpack); + Py_VISIT(traverse_module_state->__pyx_n_s_update); + Py_VISIT(traverse_module_state->__pyx_n_s_upper_limit); + Py_VISIT(traverse_module_state->__pyx_n_s_version_info); + Py_VISIT(traverse_module_state->__pyx_n_s_vols); + Py_VISIT(traverse_module_state->__pyx_n_s_xyz); + Py_VISIT(traverse_module_state->__pyx_n_s_xyz_ptr); + Py_VISIT(traverse_module_state->__pyx_n_s_xyz_ts); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_3); + Py_VISIT(traverse_module_state->__pyx_int_112105877); + Py_VISIT(traverse_module_state->__pyx_int_136983863); + Py_VISIT(traverse_module_state->__pyx_int_184977713); + Py_VISIT(traverse_module_state->__pyx_int_neg_1); + Py_VISIT(traverse_module_state->__pyx_slice__5); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_tuple__9); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__14); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__16); + Py_VISIT(traverse_module_state->__pyx_tuple__17); + Py_VISIT(traverse_module_state->__pyx_tuple__18); + Py_VISIT(traverse_module_state->__pyx_tuple__19); + Py_VISIT(traverse_module_state->__pyx_tuple__20); + Py_VISIT(traverse_module_state->__pyx_tuple__21); + Py_VISIT(traverse_module_state->__pyx_tuple__22); + Py_VISIT(traverse_module_state->__pyx_tuple__23); + Py_VISIT(traverse_module_state->__pyx_tuple__25); + Py_VISIT(traverse_module_state->__pyx_tuple__27); + Py_VISIT(traverse_module_state->__pyx_tuple__28); + Py_VISIT(traverse_module_state->__pyx_tuple__30); + Py_VISIT(traverse_module_state->__pyx_tuple__32); + Py_VISIT(traverse_module_state->__pyx_tuple__34); + Py_VISIT(traverse_module_state->__pyx_tuple__36); + Py_VISIT(traverse_module_state->__pyx_tuple__38); + Py_VISIT(traverse_module_state->__pyx_tuple__39); + Py_VISIT(traverse_module_state->__pyx_tuple__41); + Py_VISIT(traverse_module_state->__pyx_tuple__42); + Py_VISIT(traverse_module_state->__pyx_codeobj__24); + Py_VISIT(traverse_module_state->__pyx_codeobj__26); + Py_VISIT(traverse_module_state->__pyx_codeobj__29); + Py_VISIT(traverse_module_state->__pyx_codeobj__31); + Py_VISIT(traverse_module_state->__pyx_codeobj__33); + Py_VISIT(traverse_module_state->__pyx_codeobj__35); + Py_VISIT(traverse_module_state->__pyx_codeobj__37); + Py_VISIT(traverse_module_state->__pyx_codeobj__40); + Py_VISIT(traverse_module_state->__pyx_codeobj__43); + Py_VISIT(traverse_module_state->__pyx_codeobj__44); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_5numpy_dtype __pyx_mstate_global->__pyx_ptype_5numpy_dtype +#define __pyx_ptype_5numpy_flatiter __pyx_mstate_global->__pyx_ptype_5numpy_flatiter +#define __pyx_ptype_5numpy_broadcast __pyx_mstate_global->__pyx_ptype_5numpy_broadcast +#define __pyx_ptype_5numpy_ndarray __pyx_mstate_global->__pyx_ptype_5numpy_ndarray +#define __pyx_ptype_5numpy_generic __pyx_mstate_global->__pyx_ptype_5numpy_generic +#define __pyx_ptype_5numpy_number __pyx_mstate_global->__pyx_ptype_5numpy_number +#define __pyx_ptype_5numpy_integer __pyx_mstate_global->__pyx_ptype_5numpy_integer +#define __pyx_ptype_5numpy_signedinteger __pyx_mstate_global->__pyx_ptype_5numpy_signedinteger +#define __pyx_ptype_5numpy_unsignedinteger __pyx_mstate_global->__pyx_ptype_5numpy_unsignedinteger +#define __pyx_ptype_5numpy_inexact __pyx_mstate_global->__pyx_ptype_5numpy_inexact +#define __pyx_ptype_5numpy_floating __pyx_mstate_global->__pyx_ptype_5numpy_floating +#define __pyx_ptype_5numpy_complexfloating __pyx_mstate_global->__pyx_ptype_5numpy_complexfloating +#define __pyx_ptype_5numpy_flexible __pyx_mstate_global->__pyx_ptype_5numpy_flexible +#define __pyx_ptype_5numpy_character __pyx_mstate_global->__pyx_ptype_5numpy_character +#define __pyx_ptype_5numpy_ufunc __pyx_mstate_global->__pyx_ptype_5numpy_ufunc +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type___pyx_array __pyx_mstate_global->__pyx_type___pyx_array +#define __pyx_type___pyx_MemviewEnum __pyx_mstate_global->__pyx_type___pyx_MemviewEnum +#define __pyx_type___pyx_memoryview __pyx_mstate_global->__pyx_type___pyx_memoryview +#define __pyx_type___pyx_memoryviewslice __pyx_mstate_global->__pyx_type___pyx_memoryviewslice +#endif +#define __pyx_array_type __pyx_mstate_global->__pyx_array_type +#define __pyx_MemviewEnum_type __pyx_mstate_global->__pyx_MemviewEnum_type +#define __pyx_memoryview_type __pyx_mstate_global->__pyx_memoryview_type +#define __pyx_memoryviewslice_type __pyx_mstate_global->__pyx_memoryviewslice_type +#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_n_s_ASCII __pyx_mstate_global->__pyx_n_s_ASCII +#define __pyx_kp_s_All_dimensions_preceding_dimensi __pyx_mstate_global->__pyx_kp_s_All_dimensions_preceding_dimensi +#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError +#define __pyx_kp_s_Buffer_view_does_not_expose_stri __pyx_mstate_global->__pyx_kp_s_Buffer_view_does_not_expose_stri +#define __pyx_n_s_C __pyx_mstate_global->__pyx_n_s_C +#define __pyx_kp_s_Can_only_create_a_buffer_that_is __pyx_mstate_global->__pyx_kp_s_Can_only_create_a_buffer_that_is +#define __pyx_kp_s_Cannot_assign_to_read_only_memor __pyx_mstate_global->__pyx_kp_s_Cannot_assign_to_read_only_memor +#define __pyx_kp_s_Cannot_create_writable_memory_vi __pyx_mstate_global->__pyx_kp_s_Cannot_create_writable_memory_vi +#define __pyx_kp_u_Cannot_index_with_type __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type +#define __pyx_kp_s_Cannot_transpose_memoryview_with __pyx_mstate_global->__pyx_kp_s_Cannot_transpose_memoryview_with +#define __pyx_kp_s_Dimension_d_is_not_direct __pyx_mstate_global->__pyx_kp_s_Dimension_d_is_not_direct +#define __pyx_kp_s_ERROR_Either_pass_vols_AND_fa_or __pyx_mstate_global->__pyx_kp_s_ERROR_Either_pass_vols_AND_fa_or +#define __pyx_n_s_Ellipsis __pyx_mstate_global->__pyx_n_s_Ellipsis +#define __pyx_kp_s_Empty_shape_tuple_for_cython_arr __pyx_mstate_global->__pyx_kp_s_Empty_shape_tuple_for_cython_arr +#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError +#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0 +#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError +#define __pyx_kp_s_Index_out_of_bounds_axis_d __pyx_mstate_global->__pyx_kp_s_Index_out_of_bounds_axis_d +#define __pyx_kp_s_Indirect_dimensions_not_supporte __pyx_mstate_global->__pyx_kp_s_Indirect_dimensions_not_supporte +#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr +#define __pyx_kp_u_Invalid_shape_in_axis __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis +#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError +#define __pyx_kp_s_MemoryView_of_r_at_0x_x __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_at_0x_x +#define __pyx_kp_s_MemoryView_of_r_object __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_object +#define __pyx_n_b_O __pyx_mstate_global->__pyx_n_b_O +#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a +#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError +#define __pyx_kp_s_Result_array_is_too_short __pyx_mstate_global->__pyx_kp_s_Result_array_is_too_short +#define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence +#define __pyx_kp_s_Step_may_not_be_zero_axis_d __pyx_mstate_global->__pyx_kp_s_Step_may_not_be_zero_axis_d +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_kp_s_Unable_to_convert_item_to_object __pyx_mstate_global->__pyx_kp_s_Unable_to_convert_item_to_object +#define __pyx_kp_s_Unknown_string_type __pyx_mstate_global->__pyx_kp_s_Unknown_string_type +#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError +#define __pyx_n_s_View_MemoryView __pyx_mstate_global->__pyx_n_s_View_MemoryView +#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 +#define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3 +#define __pyx_n_s__45 __pyx_mstate_global->__pyx_n_s__45 +#define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6 +#define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7 +#define __pyx_n_s_abc __pyx_mstate_global->__pyx_n_s_abc +#define __pyx_n_s_allocate_buffer __pyx_mstate_global->__pyx_n_s_allocate_buffer +#define __pyx_kp_u_and __pyx_mstate_global->__pyx_kp_u_and +#define __pyx_n_s_asarray __pyx_mstate_global->__pyx_n_s_asarray +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base +#define __pyx_n_s_box_x __pyx_mstate_global->__pyx_n_s_box_x +#define __pyx_n_s_box_y __pyx_mstate_global->__pyx_n_s_box_y +#define __pyx_n_s_box_z __pyx_mstate_global->__pyx_n_s_box_z +#define __pyx_n_s_boxl __pyx_mstate_global->__pyx_n_s_boxl +#define __pyx_n_s_boxl_x __pyx_mstate_global->__pyx_n_s_boxl_x +#define __pyx_n_s_boxl_y __pyx_mstate_global->__pyx_n_s_boxl_y +#define __pyx_n_s_boxl_z __pyx_mstate_global->__pyx_n_s_boxl_z +#define __pyx_n_s_boxlength __pyx_mstate_global->__pyx_n_s_boxlength +#define __pyx_n_s_buildNeighborList __pyx_mstate_global->__pyx_n_s_buildNeighborList +#define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c +#define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c +#define __pyx_n_s_c1 __pyx_mstate_global->__pyx_n_s_c1 +#define __pyx_n_s_c2 __pyx_mstate_global->__pyx_n_s_c2 +#define __pyx_n_s_calcCN __pyx_mstate_global->__pyx_n_s_calcCN +#define __pyx_n_s_calcCN_int8 __pyx_mstate_global->__pyx_n_s_calcCN_int8 +#define __pyx_n_s_calcTessellation __pyx_mstate_global->__pyx_n_s_calcTessellation +#define __pyx_n_s_calcTessellationParallel __pyx_mstate_global->__pyx_n_s_calcTessellationParallel +#define __pyx_n_s_calcTessellationParallelAll __pyx_mstate_global->__pyx_n_s_calcTessellationParallelAll +#define __pyx_n_s_calcTessellationVolSurfAtomic __pyx_mstate_global->__pyx_n_s_calcTessellationVolSurfAtomic +#define __pyx_n_s_ccorelist __pyx_mstate_global->__pyx_n_s_ccorelist +#define __pyx_n_s_cds __pyx_mstate_global->__pyx_n_s_cds +#define __pyx_n_s_cf2c __pyx_mstate_global->__pyx_n_s_cf2c +#define __pyx_n_s_cfa __pyx_mstate_global->__pyx_n_s_cfa +#define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class +#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections +#define __pyx_kp_s_collections_abc __pyx_mstate_global->__pyx_kp_s_collections_abc +#define __pyx_n_s_color_id __pyx_mstate_global->__pyx_n_s_color_id +#define __pyx_kp_s_contiguous_and_direct __pyx_mstate_global->__pyx_kp_s_contiguous_and_direct +#define __pyx_kp_s_contiguous_and_indirect __pyx_mstate_global->__pyx_kp_s_contiguous_and_indirect +#define __pyx_n_s_core_begin __pyx_mstate_global->__pyx_n_s_core_begin +#define __pyx_n_s_core_end __pyx_mstate_global->__pyx_n_s_core_end +#define __pyx_n_s_core_first __pyx_mstate_global->__pyx_n_s_core_first +#define __pyx_n_s_core_last __pyx_mstate_global->__pyx_n_s_core_last +#define __pyx_n_s_corelist __pyx_mstate_global->__pyx_n_s_corelist +#define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count +#define __pyx_n_s_cres __pyx_mstate_global->__pyx_n_s_cres +#define __pyx_n_s_csurrlist __pyx_mstate_global->__pyx_n_s_csurrlist +#define __pyx_n_s_ctr __pyx_mstate_global->__pyx_n_s_ctr +#define __pyx_n_s_cts __pyx_mstate_global->__pyx_n_s_cts +#define __pyx_n_s_cvols __pyx_mstate_global->__pyx_n_s_cvols +#define __pyx_n_s_cxyz __pyx_mstate_global->__pyx_n_s_cxyz +#define __pyx_n_s_cylinder_radius __pyx_mstate_global->__pyx_n_s_cylinder_radius +#define __pyx_n_s_dataset __pyx_mstate_global->__pyx_n_s_dataset +#define __pyx_n_s_delaunay __pyx_mstate_global->__pyx_n_s_delaunay +#define __pyx_n_s_delaunay_tmp __pyx_mstate_global->__pyx_n_s_delaunay_tmp +#define __pyx_n_s_delaunay_ts __pyx_mstate_global->__pyx_n_s_delaunay_ts +#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_dist __pyx_mstate_global->__pyx_n_s_dist +#define __pyx_n_s_drawTessellation __pyx_mstate_global->__pyx_n_s_drawTessellation +#define __pyx_n_s_draw_triangles __pyx_mstate_global->__pyx_n_s_draw_triangles +#define __pyx_n_s_ds __pyx_mstate_global->__pyx_n_s_ds +#define __pyx_n_s_ds_ts __pyx_mstate_global->__pyx_n_s_ds_ts +#define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype +#define __pyx_n_s_dtype_is_object __pyx_mstate_global->__pyx_n_s_dtype_is_object +#define __pyx_n_s_empty __pyx_mstate_global->__pyx_n_s_empty +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate +#define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error +#define __pyx_n_s_f2c __pyx_mstate_global->__pyx_n_s_f2c +#define __pyx_n_s_fa __pyx_mstate_global->__pyx_n_s_fa +#define __pyx_n_s_filename __pyx_mstate_global->__pyx_n_s_filename +#define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags +#define __pyx_n_s_fn __pyx_mstate_global->__pyx_n_s_fn +#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format +#define __pyx_n_s_fortran __pyx_mstate_global->__pyx_n_s_fortran +#define __pyx_n_u_fortran __pyx_mstate_global->__pyx_n_u_fortran +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got +#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi +#define __pyx_n_s_h5file __pyx_mstate_global->__pyx_n_s_h5file +#define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i +#define __pyx_n_s_icore __pyx_mstate_global->__pyx_n_s_icore +#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_int8 __pyx_mstate_global->__pyx_n_s_int8 +#define __pyx_n_s_ires __pyx_mstate_global->__pyx_n_s_ires +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_isurr __pyx_mstate_global->__pyx_n_s_isurr +#define __pyx_n_s_itemsize __pyx_mstate_global->__pyx_n_s_itemsize +#define __pyx_kp_s_itemsize_0_for_cython_array __pyx_mstate_global->__pyx_kp_s_itemsize_0_for_cython_array +#define __pyx_n_s_iubq __pyx_mstate_global->__pyx_n_s_iubq +#define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j +#define __pyx_n_s_k __pyx_mstate_global->__pyx_n_s_k +#define __pyx_n_s_len_points_to_draw __pyx_mstate_global->__pyx_n_s_len_points_to_draw +#define __pyx_n_s_len_xyz __pyx_mstate_global->__pyx_n_s_len_xyz +#define __pyx_n_s_lower_limit __pyx_mstate_global->__pyx_n_s_lower_limit +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_maxsh __pyx_mstate_global->__pyx_n_s_maxsh +#define __pyx_n_s_maxshell __pyx_mstate_global->__pyx_n_s_maxshell +#define __pyx_n_s_memview __pyx_mstate_global->__pyx_n_s_memview +#define __pyx_n_s_mindist __pyx_mstate_global->__pyx_n_s_mindist +#define __pyx_n_s_minshell __pyx_mstate_global->__pyx_n_s_minshell +#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode +#define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n +#define __pyx_n_s_n2 __pyx_mstate_global->__pyx_n_s_n2 +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 +#define __pyx_n_s_nat __pyx_mstate_global->__pyx_n_s_nat +#define __pyx_n_s_natoms __pyx_mstate_global->__pyx_n_s_natoms +#define __pyx_n_s_ncore __pyx_mstate_global->__pyx_n_s_ncore +#define __pyx_n_s_ncpu __pyx_mstate_global->__pyx_n_s_ncpu +#define __pyx_n_s_ndim __pyx_mstate_global->__pyx_n_s_ndim +#define __pyx_n_s_nearestNeighbor __pyx_mstate_global->__pyx_n_s_nearestNeighbor +#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new +#define __pyx_n_s_newanalysis_voro __pyx_mstate_global->__pyx_n_s_newanalysis_voro +#define __pyx_kp_s_newanalysis_voro_voro_pyx __pyx_mstate_global->__pyx_kp_s_newanalysis_voro_voro_pyx +#define __pyx_n_s_nmax __pyx_mstate_global->__pyx_n_s_nmax +#define __pyx_n_s_nmol __pyx_mstate_global->__pyx_n_s_nmol +#define __pyx_n_s_nmolecules __pyx_mstate_global->__pyx_n_s_nmolecules +#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non +#define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np +#define __pyx_n_s_nsurr __pyx_mstate_global->__pyx_n_s_nsurr +#define __pyx_n_s_ntot __pyx_mstate_global->__pyx_n_s_ntot +#define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy +#define __pyx_kp_s_numpy_core_multiarray_failed_to __pyx_mstate_global->__pyx_kp_s_numpy_core_multiarray_failed_to +#define __pyx_kp_s_numpy_core_umath_failed_to_impor __pyx_mstate_global->__pyx_kp_s_numpy_core_umath_failed_to_impor +#define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj +#define __pyx_n_s_order __pyx_mstate_global->__pyx_n_s_order +#define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack +#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle +#define __pyx_n_s_points_ptr __pyx_mstate_global->__pyx_n_s_points_ptr +#define __pyx_n_s_points_to_draw __pyx_mstate_global->__pyx_n_s_points_to_draw +#define __pyx_n_s_print __pyx_mstate_global->__pyx_n_s_print +#define __pyx_n_s_py_byte_string __pyx_mstate_global->__pyx_n_s_py_byte_string +#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError +#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum +#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type +#define __pyx_n_s_pyx_unpickle_Enum __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Enum +#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable +#define __pyx_n_s_radius __pyx_mstate_global->__pyx_n_s_radius +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce +#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython +#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register +#define __pyx_n_s_result __pyx_mstate_global->__pyx_n_s_result +#define __pyx_n_s_s1 __pyx_mstate_global->__pyx_n_s_s1 +#define __pyx_n_s_s2 __pyx_mstate_global->__pyx_n_s_s2 +#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate +#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython +#define __pyx_n_s_sh1 __pyx_mstate_global->__pyx_n_s_sh1 +#define __pyx_n_s_sh2 __pyx_mstate_global->__pyx_n_s_sh2 +#define __pyx_n_s_shape __pyx_mstate_global->__pyx_n_s_shape +#define __pyx_n_s_shell_begin __pyx_mstate_global->__pyx_n_s_shell_begin +#define __pyx_n_s_shell_end __pyx_mstate_global->__pyx_n_s_shell_end +#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start +#define __pyx_n_s_step __pyx_mstate_global->__pyx_n_s_step +#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop +#define __pyx_kp_s_strided_and_direct __pyx_mstate_global->__pyx_kp_s_strided_and_direct +#define __pyx_kp_s_strided_and_direct_or_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_direct_or_indirect +#define __pyx_kp_s_strided_and_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_indirect +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct +#define __pyx_n_s_surr_begin __pyx_mstate_global->__pyx_n_s_surr_begin +#define __pyx_n_s_surr_end __pyx_mstate_global->__pyx_n_s_surr_end +#define __pyx_n_s_surr_first __pyx_mstate_global->__pyx_n_s_surr_first +#define __pyx_n_s_surr_last __pyx_mstate_global->__pyx_n_s_surr_last +#define __pyx_n_s_surroundlist __pyx_mstate_global->__pyx_n_s_surroundlist +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_triangles __pyx_mstate_global->__pyx_n_s_triangles +#define __pyx_n_s_ts __pyx_mstate_global->__pyx_n_s_ts +#define __pyx_kp_s_unable_to_allocate_array_data __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_array_data +#define __pyx_kp_s_unable_to_allocate_shape_and_str __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_shape_and_str +#define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack +#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update +#define __pyx_n_s_upper_limit __pyx_mstate_global->__pyx_n_s_upper_limit +#define __pyx_n_s_version_info __pyx_mstate_global->__pyx_n_s_version_info +#define __pyx_n_s_vols __pyx_mstate_global->__pyx_n_s_vols +#define __pyx_n_s_xyz __pyx_mstate_global->__pyx_n_s_xyz +#define __pyx_n_s_xyz_ptr __pyx_mstate_global->__pyx_n_s_xyz_ptr +#define __pyx_n_s_xyz_ts __pyx_mstate_global->__pyx_n_s_xyz_ts +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3 +#define __pyx_int_112105877 __pyx_mstate_global->__pyx_int_112105877 +#define __pyx_int_136983863 __pyx_mstate_global->__pyx_int_136983863 +#define __pyx_int_184977713 __pyx_mstate_global->__pyx_int_184977713 +#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 +#define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17 +#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 +#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19 +#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 +#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 +#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 +#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23 +#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25 +#define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27 +#define __pyx_tuple__28 __pyx_mstate_global->__pyx_tuple__28 +#define __pyx_tuple__30 __pyx_mstate_global->__pyx_tuple__30 +#define __pyx_tuple__32 __pyx_mstate_global->__pyx_tuple__32 +#define __pyx_tuple__34 __pyx_mstate_global->__pyx_tuple__34 +#define __pyx_tuple__36 __pyx_mstate_global->__pyx_tuple__36 +#define __pyx_tuple__38 __pyx_mstate_global->__pyx_tuple__38 +#define __pyx_tuple__39 __pyx_mstate_global->__pyx_tuple__39 +#define __pyx_tuple__41 __pyx_mstate_global->__pyx_tuple__41 +#define __pyx_tuple__42 __pyx_mstate_global->__pyx_tuple__42 +#define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24 +#define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26 +#define __pyx_codeobj__29 __pyx_mstate_global->__pyx_codeobj__29 +#define __pyx_codeobj__31 __pyx_mstate_global->__pyx_codeobj__31 +#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33 +#define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35 +#define __pyx_codeobj__37 __pyx_mstate_global->__pyx_codeobj__37 +#define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40 +#define __pyx_codeobj__43 __pyx_mstate_global->__pyx_codeobj__43 +#define __pyx_codeobj__44 __pyx_mstate_global->__pyx_codeobj__44 +/* #### Code section: module_code ### */ + +/* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): * - * cdef unicode _ustring(s): - * if type(s) is unicode: # <<<<<<<<<<<<<< - * # fast path for most common case(s) - * return s - */ - } - - /* "src/voro/voro.pyx":25 - * # fast path for most common case(s) - * return s - * elif PY_MAJOR_VERSION < 3 and isinstance(s, bytes): # <<<<<<<<<<<<<< - * # only accept byte strings in Python 2.x, not in Py3 - * return (s).decode('ascii') - */ - __pyx_t_1 = ((PY_MAJOR_VERSION < 3) != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_1 = PyBytes_Check(__pyx_v_s); - __pyx_t_3 = (__pyx_t_1 != 0); - __pyx_t_2 = __pyx_t_3; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { - - /* "src/voro/voro.pyx":27 - * elif PY_MAJOR_VERSION < 3 and isinstance(s, bytes): - * # only accept byte strings in Python 2.x, not in Py3 - * return (s).decode('ascii') # <<<<<<<<<<<<<< - * elif isinstance(s, unicode): - * # an evil cast to might work here in some(!) cases, - */ - __Pyx_XDECREF(__pyx_r); - if (unlikely(__pyx_v_s == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode"); - __PYX_ERR(0, 27, __pyx_L1_error) - } - __pyx_t_4 = __Pyx_decode_bytes(((PyObject*)__pyx_v_s), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "src/voro/voro.pyx":25 - * # fast path for most common case(s) - * return s - * elif PY_MAJOR_VERSION < 3 and isinstance(s, bytes): # <<<<<<<<<<<<<< - * # only accept byte strings in Python 2.x, not in Py3 - * return (s).decode('ascii') - */ - } - - /* "src/voro/voro.pyx":28 - * # only accept byte strings in Python 2.x, not in Py3 - * return (s).decode('ascii') - * elif isinstance(s, unicode): # <<<<<<<<<<<<<< - * # an evil cast to might work here in some(!) cases, - * # depending on what the further processing does. to be safe, - */ - __pyx_t_2 = PyUnicode_Check(__pyx_v_s); - __pyx_t_3 = (__pyx_t_2 != 0); - if (likely(__pyx_t_3)) { - - /* "src/voro/voro.pyx":32 - * # depending on what the further processing does. to be safe, - * # we can always create a copy instead - * return unicode(s) # <<<<<<<<<<<<<< - * else: - * raise TypeError("Unknown string type!") - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_Unicode(__pyx_v_s); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "src/voro/voro.pyx":28 - * # only accept byte strings in Python 2.x, not in Py3 - * return (s).decode('ascii') - * elif isinstance(s, unicode): # <<<<<<<<<<<<<< - * # an evil cast to might work here in some(!) cases, - * # depending on what the further processing does. to be safe, - */ - } - - /* "src/voro/voro.pyx":34 - * return unicode(s) - * else: - * raise TypeError("Unknown string type!") # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 34, __pyx_L1_error) - } - - /* "src/voro/voro.pyx":21 - * void _calcTessellationVolSurfAtomic(double *xyz, float boxlength, int *f2c, int natoms, int nmolecules, int maxshell, char *ds_ptr, int *corelist, int ncore, float* vols, float* face_area_ptr) - * - * cdef unicode _ustring(s): # <<<<<<<<<<<<<< - * if type(s) is unicode: - * # fast path for most common case(s) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("newanalysis.voro._ustring", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/voro/voro.pyx":37 - * - * @cython.boundscheck(False) - * def calcTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, float boxlength, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, - * np.ndarray[np.int32_t,ndim=1, mode="c"] corelist, */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_4voro_1calcTessellation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_4voro_calcTessellation[] = " \n calcTessellation(xyz, boxlength, f2c, natoms, nmolecules, maxshell, corelist, vols, fa)\n\n This function wraps a c++ function calling the voro++ library\n\n args: \txyz\t\t---\t2-dim numpy array of 64 bit floats in C format with coordinates\n \tboxlength\t---\tboxlength as a float\n \tf2c\t\t---\tfine2coarse array, 1-dim, C-format, 32 bit integers\n \tnatoms\t\t---\tnumber of atoms\n \tnmolecules\t---\tnumber of molecules\n \tmaxshell\t---\toutermost shell to be calculated\n \tcorelist\t---\tresidue numbers of the 'core' molecules\n \tvols\t\t---\tarray in which the calculated volumes are to be inserted, 1-dim, C-format, 64-bit floats [optional]\n \tfa\t\t---\tarray in which the calculated interface areas are to be inserted, 2-dim, C-format, 64-bit floats [optional]\n\n ###############################################################################\n NOTE: do not call this function directly! instead, use the AtomGroup interface!\n E.g. if you have a selection \"sel\", call\n\n shells = sel.calcTessellation(maxshell=3,core_sel=None,volumes=None,face_areas=None)\n\n Doc-String:\n Calculates the Voronoi tessellation of the whole box with the current AtomGroup as the core selection and returns the Delaunay distance matrix.\n\n Arguments:\n \tmaxshell:\tMaximum shell to calculate (default is 3)\n \tcore_sel:\tAtomGroup object of core selection (default is self)\n \tvolumes:\t1-dim numpy.float64 array for cell volume calculation (only together with face_areas!)\n \tface_areas:\t2-dim numpy.float64 array for surface area calculation (only together with volumes!)\n\n The returned shells array will have n x n size, with n being the total number of residues in the box,\n "" but only those lines corresponding to the residue numbers of the residues in sel will be filled\n (cf. the output of sel.f2c(), meaning fine2coarse -- atom number -> residue number).\n In this way, one can save time by not generating the neighborhood information for unneeding residues.\n"; -static PyMethodDef __pyx_mdef_11newanalysis_4voro_1calcTessellation = {"calcTessellation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_4voro_1calcTessellation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_calcTessellation}; -static PyObject *__pyx_pw_11newanalysis_4voro_1calcTessellation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_xyz = 0; - float __pyx_v_boxlength; - PyArrayObject *__pyx_v_f2c = 0; - PyObject *__pyx_v_natoms = 0; - PyObject *__pyx_v_nmolecules = 0; - PyObject *__pyx_v_maxshell = 0; - PyArrayObject *__pyx_v_corelist = 0; - PyArrayObject *__pyx_v_vols = 0; - PyArrayObject *__pyx_v_fa = 0; - PyArrayObject *__pyx_v_ds_ts = 0; - PyObject *__pyx_v_ts = 0; - PyObject *__pyx_v_ires = 0; - PyArrayObject *__pyx_v_surroundlist = 0; - PyObject *__pyx_v_h5file = 0; +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_shape = 0; + Py_ssize_t __pyx_v_itemsize; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_v_allocate_buffer; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcTessellation (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 131, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_boxlength,&__pyx_n_s_f2c,&__pyx_n_s_natoms,&__pyx_n_s_nmolecules,&__pyx_n_s_maxshell,&__pyx_n_s_corelist,&__pyx_n_s_vols,&__pyx_n_s_fa,&__pyx_n_s_ds_ts,&__pyx_n_s_ts,&__pyx_n_s_ires,&__pyx_n_s_surroundlist,&__pyx_n_s_h5file,0}; - PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - - /* "src/voro/voro.pyx":40 - * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, - * np.ndarray[np.int32_t,ndim=1, mode="c"] corelist, - * np.ndarray[np.float32_t,ndim=1,mode="c"] vols = None, # <<<<<<<<<<<<<< - * np.ndarray[np.float32_t,ndim=2,mode="c"] fa = None, - * np.ndarray[np.int8_t,ndim=1,mode="c"] ds_ts = None, ts=None, ires=None, - */ - values[7] = (PyObject *)((PyArrayObject *)Py_None); - - /* "src/voro/voro.pyx":41 - * np.ndarray[np.int32_t,ndim=1, mode="c"] corelist, - * np.ndarray[np.float32_t,ndim=1,mode="c"] vols = None, - * np.ndarray[np.float32_t,ndim=2,mode="c"] fa = None, # <<<<<<<<<<<<<< - * np.ndarray[np.int8_t,ndim=1,mode="c"] ds_ts = None, ts=None, ires=None, - * np.ndarray[np.int32_t,ndim=1] surroundlist = None, h5file=None): - */ - values[8] = (PyObject *)((PyArrayObject *)Py_None); - - /* "src/voro/voro.pyx":42 - * np.ndarray[np.float32_t,ndim=1,mode="c"] vols = None, - * np.ndarray[np.float32_t,ndim=2,mode="c"] fa = None, - * np.ndarray[np.int8_t,ndim=1,mode="c"] ds_ts = None, ts=None, ires=None, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=1] surroundlist = None, h5file=None): - * """ - */ - values[9] = (PyObject *)((PyArrayObject *)Py_None); - values[10] = ((PyObject *)Py_None); - values[11] = ((PyObject *)Py_None); - - /* "src/voro/voro.pyx":43 - * np.ndarray[np.float32_t,ndim=2,mode="c"] fa = None, - * np.ndarray[np.int8_t,ndim=1,mode="c"] ds_ts = None, ts=None, ires=None, - * np.ndarray[np.int32_t,ndim=1] surroundlist = None, h5file=None): # <<<<<<<<<<<<<< - * """ - * calcTessellation(xyz, boxlength, f2c, natoms, nmolecules, maxshell, corelist, vols, fa) - */ - values[12] = (PyObject *)((PyArrayObject *)Py_None); - values[13] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; + values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_n_s_c)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shape)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 1); __PYX_ERR(0, 37, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f2c)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 2); __PYX_ERR(0, 37, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_natoms)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 3); __PYX_ERR(0, 37, __pyx_L3_error) + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_itemsize)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmolecules)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 4); __PYX_ERR(0, 37, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 5); __PYX_ERR(0, 37, __pyx_L3_error) + case 2: + if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_format)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[2]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_corelist)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 6); __PYX_ERR(0, 37, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vols); - if (value) { values[7] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 8: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fa); - if (value) { values[8] = value; kw_args--; } + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 9: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds_ts); - if (value) { values[9] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 10: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ts); - if (value) { values[10] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 11: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ires); - if (value) { values[11] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 12: + case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surroundlist); - if (value) { values[12] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode); + if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 13: + case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h5file); - if (value) { values[13] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_allocate_buffer); + if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcTessellation") < 0)) __PYX_ERR(0, 37, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 131, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } - __pyx_v_xyz = ((PyArrayObject *)values[0]); - __pyx_v_boxlength = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_boxlength == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L3_error) - __pyx_v_f2c = ((PyArrayObject *)values[2]); - __pyx_v_natoms = values[3]; - __pyx_v_nmolecules = values[4]; - __pyx_v_maxshell = values[5]; - __pyx_v_corelist = ((PyArrayObject *)values[6]); - __pyx_v_vols = ((PyArrayObject *)values[7]); - __pyx_v_fa = ((PyArrayObject *)values[8]); - __pyx_v_ds_ts = ((PyArrayObject *)values[9]); - __pyx_v_ts = values[10]; - __pyx_v_ires = values[11]; - __pyx_v_surroundlist = ((PyArrayObject *)values[12]); - __pyx_v_h5file = values[13]; + __pyx_v_shape = ((PyObject*)values[0]); + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 131, __pyx_L3_error) + __pyx_v_format = values[2]; + __pyx_v_mode = values[3]; + if (values[4]) { + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 132, __pyx_L3_error) + } else { + + /* "View.MemoryView":132 + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, + * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + * + * cdef int idx + */ + __pyx_v_allocate_buffer = ((int)1); + } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 37, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(1, 131, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.voro.calcTessellation", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 37, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f2c), __pyx_ptype_5numpy_ndarray, 1, "f2c", 0))) __PYX_ERR(0, 38, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_corelist), __pyx_ptype_5numpy_ndarray, 1, "corelist", 0))) __PYX_ERR(0, 39, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vols), __pyx_ptype_5numpy_ndarray, 1, "vols", 0))) __PYX_ERR(0, 40, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fa), __pyx_ptype_5numpy_ndarray, 1, "fa", 0))) __PYX_ERR(0, 41, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ds_ts), __pyx_ptype_5numpy_ndarray, 1, "ds_ts", 0))) __PYX_ERR(0, 42, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_surroundlist), __pyx_ptype_5numpy_ndarray, 1, "surroundlist", 0))) __PYX_ERR(0, 43, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_4voro_calcTessellation(__pyx_self, __pyx_v_xyz, __pyx_v_boxlength, __pyx_v_f2c, __pyx_v_natoms, __pyx_v_nmolecules, __pyx_v_maxshell, __pyx_v_corelist, __pyx_v_vols, __pyx_v_fa, __pyx_v_ds_ts, __pyx_v_ts, __pyx_v_ires, __pyx_v_surroundlist, __pyx_v_h5file); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 131, __pyx_L1_error) + if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 131, __pyx_L1_error) + } + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); - /* "src/voro/voro.pyx":37 + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): * - * @cython.boundscheck(False) - * def calcTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, float boxlength, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, - * np.ndarray[np.int32_t,ndim=1, mode="c"] corelist, */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __pyx_r = NULL; + __pyx_r = -1; __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_4voro_calcTessellation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, float __pyx_v_boxlength, PyArrayObject *__pyx_v_f2c, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell, PyArrayObject *__pyx_v_corelist, PyArrayObject *__pyx_v_vols, PyArrayObject *__pyx_v_fa, PyArrayObject *__pyx_v_ds_ts, PyObject *__pyx_v_ts, PyObject *__pyx_v_ires, PyArrayObject *__pyx_v_surroundlist, PyObject *__pyx_v_h5file) { - PyArrayObject *__pyx_v_delaunay = 0; - char *__pyx_v_cds; - int *__pyx_v_cts; - double *__pyx_v_cxyz; - int *__pyx_v_cf2c; - int *__pyx_v_ccorelist; - int *__pyx_v_csurrlist; - float *__pyx_v_cvols; - float *__pyx_v_cfa; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_nsurr; - int __pyx_v_ncore; - int __pyx_v_mindist; - int __pyx_v_dist; - int __pyx_v_icore; - int __pyx_v_isurr; - PyObject *__pyx_v_dataset = NULL; - __Pyx_LocalBuf_ND __pyx_pybuffernd_corelist; - __Pyx_Buffer __pyx_pybuffer_corelist; - __Pyx_LocalBuf_ND __pyx_pybuffernd_delaunay; - __Pyx_Buffer __pyx_pybuffer_delaunay; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ds_ts; - __Pyx_Buffer __pyx_pybuffer_ds_ts; - __Pyx_LocalBuf_ND __pyx_pybuffernd_f2c; - __Pyx_Buffer __pyx_pybuffer_f2c; - __Pyx_LocalBuf_ND __pyx_pybuffernd_fa; - __Pyx_Buffer __pyx_pybuffer_fa; - __Pyx_LocalBuf_ND __pyx_pybuffernd_surroundlist; - __Pyx_Buffer __pyx_pybuffer_surroundlist; - __Pyx_LocalBuf_ND __pyx_pybuffernd_vols; - __Pyx_Buffer __pyx_pybuffer_vols; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; - __Pyx_Buffer __pyx_pybuffer_xyz; - PyObject *__pyx_r = NULL; +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { + int __pyx_v_idx; + Py_ssize_t __pyx_v_dim; + char __pyx_v_order; + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - long __pyx_t_14; - long __pyx_t_15; - Py_ssize_t __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - long __pyx_t_20; - long __pyx_t_21; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + char *__pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_UCS4 __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcTessellation", 0); - __pyx_pybuffer_delaunay.pybuffer.buf = NULL; - __pyx_pybuffer_delaunay.refcount = 0; - __pyx_pybuffernd_delaunay.data = NULL; - __pyx_pybuffernd_delaunay.rcbuffer = &__pyx_pybuffer_delaunay; - __pyx_pybuffer_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_xyz.refcount = 0; - __pyx_pybuffernd_xyz.data = NULL; - __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; - __pyx_pybuffer_f2c.pybuffer.buf = NULL; - __pyx_pybuffer_f2c.refcount = 0; - __pyx_pybuffernd_f2c.data = NULL; - __pyx_pybuffernd_f2c.rcbuffer = &__pyx_pybuffer_f2c; - __pyx_pybuffer_corelist.pybuffer.buf = NULL; - __pyx_pybuffer_corelist.refcount = 0; - __pyx_pybuffernd_corelist.data = NULL; - __pyx_pybuffernd_corelist.rcbuffer = &__pyx_pybuffer_corelist; - __pyx_pybuffer_vols.pybuffer.buf = NULL; - __pyx_pybuffer_vols.refcount = 0; - __pyx_pybuffernd_vols.data = NULL; - __pyx_pybuffernd_vols.rcbuffer = &__pyx_pybuffer_vols; - __pyx_pybuffer_fa.pybuffer.buf = NULL; - __pyx_pybuffer_fa.refcount = 0; - __pyx_pybuffernd_fa.data = NULL; - __pyx_pybuffernd_fa.rcbuffer = &__pyx_pybuffer_fa; - __pyx_pybuffer_ds_ts.pybuffer.buf = NULL; - __pyx_pybuffer_ds_ts.refcount = 0; - __pyx_pybuffernd_ds_ts.data = NULL; - __pyx_pybuffernd_ds_ts.rcbuffer = &__pyx_pybuffer_ds_ts; - __pyx_pybuffer_surroundlist.pybuffer.buf = NULL; - __pyx_pybuffer_surroundlist.refcount = 0; - __pyx_pybuffernd_surroundlist.data = NULL; - __pyx_pybuffernd_surroundlist.rcbuffer = &__pyx_pybuffer_surroundlist; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error) - } - __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f2c.rcbuffer->pybuffer, (PyObject*)__pyx_v_f2c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error) - } - __pyx_pybuffernd_f2c.diminfo[0].strides = __pyx_pybuffernd_f2c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f2c.diminfo[0].shape = __pyx_pybuffernd_f2c.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corelist.rcbuffer->pybuffer, (PyObject*)__pyx_v_corelist, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error) - } - __pyx_pybuffernd_corelist.diminfo[0].strides = __pyx_pybuffernd_corelist.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corelist.diminfo[0].shape = __pyx_pybuffernd_corelist.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vols.rcbuffer->pybuffer, (PyObject*)__pyx_v_vols, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error) - } - __pyx_pybuffernd_vols.diminfo[0].strides = __pyx_pybuffernd_vols.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vols.diminfo[0].shape = __pyx_pybuffernd_vols.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fa.rcbuffer->pybuffer, (PyObject*)__pyx_v_fa, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error) - } - __pyx_pybuffernd_fa.diminfo[0].strides = __pyx_pybuffernd_fa.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fa.diminfo[0].shape = __pyx_pybuffernd_fa.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fa.diminfo[1].strides = __pyx_pybuffernd_fa.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fa.diminfo[1].shape = __pyx_pybuffernd_fa.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ds_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_ds_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error) - } - __pyx_pybuffernd_ds_ts.diminfo[0].strides = __pyx_pybuffernd_ds_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ds_ts.diminfo[0].shape = __pyx_pybuffernd_ds_ts.rcbuffer->pybuffer.shape[0]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_surroundlist.rcbuffer->pybuffer, (PyObject*)__pyx_v_surroundlist, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error) - } - __pyx_pybuffernd_surroundlist.diminfo[0].strides = __pyx_pybuffernd_surroundlist.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_surroundlist.diminfo[0].shape = __pyx_pybuffernd_surroundlist.rcbuffer->pybuffer.shape[0]; + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_format); - /* "src/voro/voro.pyx":78 - * In this way, one can save time by not generating the neighborhood information for unneeding residues. - * """ - * cdef np.ndarray[np.int8_t,ndim=2,mode="c"] delaunay = np.empty((nmolecules,nmolecules),dtype=np.int8,order="C") # <<<<<<<<<<<<<< - * cdef char *cds = delaunay.data - * cdef int *cts + /* "View.MemoryView":137 + * cdef Py_ssize_t dim + * + * self.ndim = len(shape) # <<<<<<<<<<<<<< + * self.itemsize = itemsize + * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_nmolecules); - __Pyx_GIVEREF(__pyx_v_nmolecules); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nmolecules); - __Pyx_INCREF(__pyx_v_nmolecules); - __Pyx_GIVEREF(__pyx_v_nmolecules); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_nmolecules); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(0, 78, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 78, __pyx_L1_error) - __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_delaunay.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { - __pyx_v_delaunay = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_delaunay.rcbuffer->pybuffer.buf = NULL; - __PYX_ERR(0, 78, __pyx_L1_error) - } else {__pyx_pybuffernd_delaunay.diminfo[0].strides = __pyx_pybuffernd_delaunay.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_delaunay.diminfo[0].shape = __pyx_pybuffernd_delaunay.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_delaunay.diminfo[1].strides = __pyx_pybuffernd_delaunay.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_delaunay.diminfo[1].shape = __pyx_pybuffernd_delaunay.rcbuffer->pybuffer.shape[1]; - } + if (unlikely(__pyx_v_shape == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 137, __pyx_L1_error) } - __pyx_t_6 = 0; - __pyx_v_delaunay = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 137, __pyx_L1_error) + __pyx_v_self->ndim = ((int)__pyx_t_1); - /* "src/voro/voro.pyx":79 - * """ - * cdef np.ndarray[np.int8_t,ndim=2,mode="c"] delaunay = np.empty((nmolecules,nmolecules),dtype=np.int8,order="C") - * cdef char *cds = delaunay.data # <<<<<<<<<<<<<< - * cdef int *cts - * cdef double* cxyz = xyz.data + /* "View.MemoryView":138 + * + * self.ndim = len(shape) + * self.itemsize = itemsize # <<<<<<<<<<<<<< + * + * if not self.ndim: */ - __pyx_v_cds = ((char *)__pyx_v_delaunay->data); + __pyx_v_self->itemsize = __pyx_v_itemsize; - /* "src/voro/voro.pyx":81 - * cdef char *cds = delaunay.data - * cdef int *cts - * cdef double* cxyz = xyz.data # <<<<<<<<<<<<<< - * cdef int* cf2c = f2c.data - * cdef int* ccorelist = corelist.data + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * */ - __pyx_v_cxyz = ((double *)__pyx_v_xyz->data); + __pyx_t_2 = (!(__pyx_v_self->ndim != 0)); + if (unlikely(__pyx_t_2)) { - /* "src/voro/voro.pyx":82 - * cdef int *cts - * cdef double* cxyz = xyz.data - * cdef int* cf2c = f2c.data # <<<<<<<<<<<<<< - * cdef int* ccorelist = corelist.data - * cdef int *csurrlist + /* "View.MemoryView":141 + * + * if not self.ndim: + * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<< + * + * if itemsize <= 0: */ - __pyx_v_cf2c = ((int *)__pyx_v_f2c->data); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Empty_shape_tuple_for_cython_arr, 0, 0); + __PYX_ERR(1, 141, __pyx_L1_error) - /* "src/voro/voro.pyx":83 - * cdef double* cxyz = xyz.data - * cdef int* cf2c = f2c.data - * cdef int* ccorelist = corelist.data # <<<<<<<<<<<<<< - * cdef int *csurrlist - * cdef float* cvols + /* "View.MemoryView":140 + * self.itemsize = itemsize + * + * if not self.ndim: # <<<<<<<<<<<<<< + * raise ValueError, "Empty shape tuple for cython.array" + * */ - __pyx_v_ccorelist = ((int *)__pyx_v_corelist->data); + } - /* "src/voro/voro.pyx":87 - * cdef float* cvols - * cdef float* cfa - * cdef int i, j, nsurr, ncore = len(corelist), mindist, dist, icore, isurr # <<<<<<<<<<<<<< - * if (vols is not None and fa is None) or (vols is None and fa is not None): - * print "ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!" + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * */ - __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_corelist)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 87, __pyx_L1_error) - __pyx_v_ncore = ((int)__pyx_t_7); + __pyx_t_2 = (__pyx_v_itemsize <= 0); + if (unlikely(__pyx_t_2)) { - /* "src/voro/voro.pyx":88 - * cdef float* cfa - * cdef int i, j, nsurr, ncore = len(corelist), mindist, dist, icore, isurr - * if (vols is not None and fa is None) or (vols is None and fa is not None): # <<<<<<<<<<<<<< - * print "ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!" - * if vols is not None: + /* "View.MemoryView":144 + * + * if itemsize <= 0: + * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<< + * + * if not isinstance(format, bytes): + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_itemsize_0_for_cython_array, 0, 0); + __PYX_ERR(1, 144, __pyx_L1_error) + + /* "View.MemoryView":143 + * raise ValueError, "Empty shape tuple for cython.array" + * + * if itemsize <= 0: # <<<<<<<<<<<<<< + * raise ValueError, "itemsize <= 0 for cython.array" + * */ - __pyx_t_9 = (((PyObject *)__pyx_v_vols) != Py_None); - __pyx_t_10 = (__pyx_t_9 != 0); - if (!__pyx_t_10) { - goto __pyx_L5_next_or; - } else { - } - __pyx_t_10 = (((PyObject *)__pyx_v_fa) == Py_None); - __pyx_t_9 = (__pyx_t_10 != 0); - if (!__pyx_t_9) { - } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L4_bool_binop_done; } - __pyx_L5_next_or:; - __pyx_t_9 = (((PyObject *)__pyx_v_vols) == Py_None); - __pyx_t_10 = (__pyx_t_9 != 0); - if (__pyx_t_10) { - } else { - __pyx_t_8 = __pyx_t_10; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_10 = (((PyObject *)__pyx_v_fa) != Py_None); - __pyx_t_9 = (__pyx_t_10 != 0); - __pyx_t_8 = __pyx_t_9; - __pyx_L4_bool_binop_done:; - if (__pyx_t_8) { - /* "src/voro/voro.pyx":89 - * cdef int i, j, nsurr, ncore = len(corelist), mindist, dist, icore, isurr - * if (vols is not None and fa is None) or (vols is None and fa is not None): - * print "ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!" # <<<<<<<<<<<<<< - * if vols is not None: - * cvols = vols.data + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - if (__Pyx_PrintOne(0, __pyx_kp_s_ERROR_Either_pass_vols_AND_fa_or) < 0) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_2 = PyBytes_Check(__pyx_v_format); + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { - /* "src/voro/voro.pyx":88 - * cdef float* cfa - * cdef int i, j, nsurr, ncore = len(corelist), mindist, dist, icore, isurr - * if (vols is not None and fa is None) or (vols is None and fa is not None): # <<<<<<<<<<<<<< - * print "ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!" - * if vols is not None: + /* "View.MemoryView":147 + * + * if not isinstance(format, bytes): + * format = format.encode('ASCII') # <<<<<<<<<<<<<< + * self._format = format # keep a reference to the byte string + * self.format = self._format */ - } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_ASCII}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4); + __pyx_t_4 = 0; - /* "src/voro/voro.pyx":90 - * if (vols is not None and fa is None) or (vols is None and fa is not None): - * print "ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!" - * if vols is not None: # <<<<<<<<<<<<<< - * cvols = vols.data - * if fa is not None: + /* "View.MemoryView":146 + * raise ValueError, "itemsize <= 0 for cython.array" + * + * if not isinstance(format, bytes): # <<<<<<<<<<<<<< + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string */ - __pyx_t_8 = (((PyObject *)__pyx_v_vols) != Py_None); - __pyx_t_9 = (__pyx_t_8 != 0); - if (__pyx_t_9) { + } - /* "src/voro/voro.pyx":91 - * print "ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!" - * if vols is not None: - * cvols = vols.data # <<<<<<<<<<<<<< - * if fa is not None: - * cfa = fa.data + /* "View.MemoryView":148 + * if not isinstance(format, bytes): + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< + * self.format = self._format + * */ - __pyx_v_cvols = ((float *)__pyx_v_vols->data); + if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_format))) __PYX_ERR(1, 148, __pyx_L1_error) + __pyx_t_4 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "src/voro/voro.pyx":90 - * if (vols is not None and fa is None) or (vols is None and fa is not None): - * print "ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!" - * if vols is not None: # <<<<<<<<<<<<<< - * cvols = vols.data - * if fa is not None: + /* "View.MemoryView":149 + * format = format.encode('ASCII') + * self._format = format # keep a reference to the byte string + * self.format = self._format # <<<<<<<<<<<<<< + * + * */ + if (unlikely(__pyx_v_self->_format == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(1, 149, __pyx_L1_error) } + __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(1, 149, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_8; - /* "src/voro/voro.pyx":92 - * if vols is not None: - * cvols = vols.data - * if fa is not None: # <<<<<<<<<<<<<< - * cfa = fa.data - * if vols is not None and fa is not None: + /* "View.MemoryView":152 + * + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< + * self._strides = self._shape + self.ndim + * */ - __pyx_t_9 = (((PyObject *)__pyx_v_fa) != Py_None); - __pyx_t_8 = (__pyx_t_9 != 0); - if (__pyx_t_8) { + __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - /* "src/voro/voro.pyx":93 - * cvols = vols.data - * if fa is not None: - * cfa = fa.data # <<<<<<<<<<<<<< - * if vols is not None and fa is not None: - * _calcTessellationVolSurf(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist),cvols,cfa) + /* "View.MemoryView":153 + * + * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) + * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * + * if not self._shape: */ - __pyx_v_cfa = ((float *)__pyx_v_fa->data); + __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - /* "src/voro/voro.pyx":92 - * if vols is not None: - * cvols = vols.data - * if fa is not None: # <<<<<<<<<<<<<< - * cfa = fa.data - * if vols is not None and fa is not None: + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * */ - } + __pyx_t_3 = (!(__pyx_v_self->_shape != 0)); + if (unlikely(__pyx_t_3)) { - /* "src/voro/voro.pyx":94 - * if fa is not None: - * cfa = fa.data - * if vols is not None and fa is not None: # <<<<<<<<<<<<<< - * _calcTessellationVolSurf(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist),cvols,cfa) - * else: + /* "View.MemoryView":156 + * + * if not self._shape: + * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<< + * + * */ - __pyx_t_9 = (((PyObject *)__pyx_v_vols) != Py_None); - __pyx_t_10 = (__pyx_t_9 != 0); - if (__pyx_t_10) { - } else { - __pyx_t_8 = __pyx_t_10; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = (((PyObject *)__pyx_v_fa) != Py_None); - __pyx_t_9 = (__pyx_t_10 != 0); - __pyx_t_8 = __pyx_t_9; - __pyx_L11_bool_binop_done:; - if (__pyx_t_8) { + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_shape_and_str, 0, 0); + __PYX_ERR(1, 156, __pyx_L1_error) - /* "src/voro/voro.pyx":95 - * cfa = fa.data - * if vols is not None and fa is not None: - * _calcTessellationVolSurf(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist),cvols,cfa) # <<<<<<<<<<<<<< - * else: - * _calcTessellation(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist)) + /* "View.MemoryView":155 + * self._strides = self._shape + self.ndim + * + * if not self._shape: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate shape and strides." + * */ - __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_natoms); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L1_error) - __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L1_error) - __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L1_error) - __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_corelist)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 95, __pyx_L1_error) - _calcTessellationVolSurf(__pyx_v_cxyz, __pyx_v_boxlength, __pyx_v_cf2c, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_v_cds, __pyx_v_ccorelist, __pyx_t_7, __pyx_v_cvols, __pyx_v_cfa); + } - /* "src/voro/voro.pyx":94 - * if fa is not None: - * cfa = fa.data - * if vols is not None and fa is not None: # <<<<<<<<<<<<<< - * _calcTessellationVolSurf(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist),cvols,cfa) - * else: + /* "View.MemoryView":159 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." */ - goto __pyx_L10; - } + __pyx_t_7 = 0; + __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(1, 159, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_7; + __pyx_t_7 = (__pyx_t_7 + 1); - /* "src/voro/voro.pyx":97 - * _calcTessellationVolSurf(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist),cvols,cfa) - * else: - * _calcTessellation(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist)) # <<<<<<<<<<<<<< - * if h5file is not None: - * dataset = h5file['delaunay'] + /* "View.MemoryView":160 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim */ - /*else*/ { - __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_v_natoms); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L1_error) - __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L1_error) - __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L1_error) - __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_corelist)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 97, __pyx_L1_error) - _calcTessellation(__pyx_v_cxyz, __pyx_v_boxlength, __pyx_v_cf2c, __pyx_t_13, __pyx_t_12, __pyx_t_11, __pyx_v_cds, __pyx_v_ccorelist, __pyx_t_7); - } - __pyx_L10:; + __pyx_t_3 = (__pyx_v_dim <= 0); + if (unlikely(__pyx_t_3)) { - /* "src/voro/voro.pyx":98 - * else: - * _calcTessellation(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist)) - * if h5file is not None: # <<<<<<<<<<<<<< - * dataset = h5file['delaunay'] - * dataset[ts] = delaunay + /* "View.MemoryView":161 + * for idx, dim in enumerate(shape): + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<< + * self._shape[idx] = dim + * */ - __pyx_t_8 = (__pyx_v_h5file != Py_None); - __pyx_t_9 = (__pyx_t_8 != 0); - if (__pyx_t_9) { + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = 0; + __pyx_t_10 = 127; + __Pyx_INCREF(__pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_9 += 22; + __Pyx_GIVEREF(__pyx_kp_u_Invalid_shape_in_axis); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_shape_in_axis); + __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u_); + __pyx_t_9 += 2; + __Pyx_GIVEREF(__pyx_kp_u_); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_); + __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u__2); + __pyx_t_9 += 1; + __Pyx_GIVEREF(__pyx_kp_u__2); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2); + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 161, __pyx_L1_error) - /* "src/voro/voro.pyx":99 - * _calcTessellation(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist)) - * if h5file is not None: - * dataset = h5file['delaunay'] # <<<<<<<<<<<<<< - * dataset[ts] = delaunay - * elif ds_ts is None: + /* "View.MemoryView":160 + * + * for idx, dim in enumerate(shape): + * if dim <= 0: # <<<<<<<<<<<<<< + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_h5file, __pyx_n_s_delaunay); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_dataset = __pyx_t_5; - __pyx_t_5 = 0; + } - /* "src/voro/voro.pyx":100 - * if h5file is not None: - * dataset = h5file['delaunay'] - * dataset[ts] = delaunay # <<<<<<<<<<<<<< - * elif ds_ts is None: - * return delaunay + /* "View.MemoryView":162 + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." + * self._shape[idx] = dim # <<<<<<<<<<<<<< + * + * cdef char order */ - if (unlikely(PyObject_SetItem(__pyx_v_dataset, __pyx_v_ts, ((PyObject *)__pyx_v_delaunay)) < 0)) __PYX_ERR(0, 100, __pyx_L1_error) + (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - /* "src/voro/voro.pyx":98 - * else: - * _calcTessellation(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist)) - * if h5file is not None: # <<<<<<<<<<<<<< - * dataset = h5file['delaunay'] - * dataset[ts] = delaunay + /* "View.MemoryView":159 + * + * + * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< + * if dim <= 0: + * raise ValueError, f"Invalid shape in axis {idx}: {dim}." */ - goto __pyx_L13; } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/voro/voro.pyx":101 - * dataset = h5file['delaunay'] - * dataset[ts] = delaunay - * elif ds_ts is None: # <<<<<<<<<<<<<< - * return delaunay - * else: + /* "View.MemoryView":165 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' */ - __pyx_t_9 = (((PyObject *)__pyx_v_ds_ts) == Py_None); - __pyx_t_8 = (__pyx_t_9 != 0); - if (__pyx_t_8) { + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 165, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/voro/voro.pyx":102 - * dataset[ts] = delaunay - * elif ds_ts is None: - * return delaunay # <<<<<<<<<<<<<< - * else: - * cts = ds_ts.data - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_delaunay)); - __pyx_r = ((PyObject *)__pyx_v_delaunay); - goto __pyx_L0; - - /* "src/voro/voro.pyx":101 - * dataset = h5file['delaunay'] - * dataset[ts] = delaunay - * elif ds_ts is None: # <<<<<<<<<<<<<< - * return delaunay - * else: + /* "View.MemoryView":166 + * cdef char order + * if mode == 'c': + * order = b'C' # <<<<<<<<<<<<<< + * self.mode = u'c' + * elif mode == 'fortran': */ - } + __pyx_v_order = 'C'; - /* "src/voro/voro.pyx":104 - * return delaunay - * else: - * cts = ds_ts.data # <<<<<<<<<<<<<< - * if ires is not None: - * for i in range(nmolecules): + /* "View.MemoryView":167 + * if mode == 'c': + * order = b'C' + * self.mode = u'c' # <<<<<<<<<<<<<< + * elif mode == 'fortran': + * order = b'F' */ - /*else*/ { - __pyx_v_cts = ((int *)__pyx_v_ds_ts->data); + __Pyx_INCREF(__pyx_n_u_c); + __Pyx_GIVEREF(__pyx_n_u_c); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_c; - /* "src/voro/voro.pyx":105 - * else: - * cts = ds_ts.data - * if ires is not None: # <<<<<<<<<<<<<< - * for i in range(nmolecules): - * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] + /* "View.MemoryView":165 + * + * cdef char order + * if mode == 'c': # <<<<<<<<<<<<<< + * order = b'C' + * self.mode = u'c' */ - __pyx_t_8 = (__pyx_v_ires != Py_None); - __pyx_t_9 = (__pyx_t_8 != 0); - if (__pyx_t_9) { + goto __pyx_L11; + } - /* "src/voro/voro.pyx":106 - * cts = ds_ts.data - * if ires is not None: - * for i in range(nmolecules): # <<<<<<<<<<<<<< - * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] - * elif surroundlist is not None: + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' */ - __pyx_t_14 = __Pyx_PyInt_As_long(__pyx_v_nmolecules); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error) - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_15; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(1, 168, __pyx_L1_error) + if (likely(__pyx_t_3)) { - /* "src/voro/voro.pyx":107 - * if ires is not None: - * for i in range(nmolecules): - * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] # <<<<<<<<<<<<<< - * elif surroundlist is not None: - * nsurr = len(surroundlist) + /* "View.MemoryView":169 + * self.mode = u'c' + * elif mode == 'fortran': + * order = b'F' # <<<<<<<<<<<<<< + * self.mode = u'fortran' + * else: */ - __pyx_t_5 = PyNumber_Multiply(__pyx_v_ires, __pyx_v_nmolecules); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_v_ts, __pyx_v_nmolecules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_16 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_16 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - (__pyx_v_cts[__pyx_t_16]) = (__pyx_v_cds[__pyx_t_7]); - } + __pyx_v_order = 'F'; - /* "src/voro/voro.pyx":105 - * else: - * cts = ds_ts.data - * if ires is not None: # <<<<<<<<<<<<<< - * for i in range(nmolecules): - * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] + /* "View.MemoryView":170 + * elif mode == 'fortran': + * order = b'F' + * self.mode = u'fortran' # <<<<<<<<<<<<<< + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" */ - goto __pyx_L14; - } + __Pyx_INCREF(__pyx_n_u_fortran); + __Pyx_GIVEREF(__pyx_n_u_fortran); + __Pyx_GOTREF(__pyx_v_self->mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = __pyx_n_u_fortran; - /* "src/voro/voro.pyx":108 - * for i in range(nmolecules): - * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] - * elif surroundlist is not None: # <<<<<<<<<<<<<< - * nsurr = len(surroundlist) - * csurrlist = surroundlist.data + /* "View.MemoryView":168 + * order = b'C' + * self.mode = u'c' + * elif mode == 'fortran': # <<<<<<<<<<<<<< + * order = b'F' + * self.mode = u'fortran' */ - __pyx_t_9 = (((PyObject *)__pyx_v_surroundlist) != Py_None); - __pyx_t_8 = (__pyx_t_9 != 0); - if (__pyx_t_8) { + goto __pyx_L11; + } - /* "src/voro/voro.pyx":109 - * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] - * elif surroundlist is not None: - * nsurr = len(surroundlist) # <<<<<<<<<<<<<< - * csurrlist = surroundlist.data - * for i in range(nsurr): + /* "View.MemoryView":172 + * self.mode = u'fortran' + * else: + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<< + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) */ - __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_surroundlist)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 109, __pyx_L1_error) - __pyx_v_nsurr = ((int)__pyx_t_7); + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(1, 172, __pyx_L1_error) + } + __pyx_L11:; - /* "src/voro/voro.pyx":110 - * elif surroundlist is not None: - * nsurr = len(surroundlist) - * csurrlist = surroundlist.data # <<<<<<<<<<<<<< - * for i in range(nsurr): - * mindist = maxshell + /* "View.MemoryView":174 + * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" + * + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<< + * + * self.free_data = allocate_buffer */ - __pyx_v_csurrlist = ((int *)__pyx_v_surroundlist->data); + __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - /* "src/voro/voro.pyx":111 - * nsurr = len(surroundlist) - * csurrlist = surroundlist.data - * for i in range(nsurr): # <<<<<<<<<<<<<< - * mindist = maxshell - * isurr = csurrlist[i] + /* "View.MemoryView":176 + * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) + * + * self.free_data = allocate_buffer # <<<<<<<<<<<<<< + * self.dtype_is_object = format == b'O' + * */ - __pyx_t_11 = __pyx_v_nsurr; - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_i = __pyx_t_13; + __pyx_v_self->free_data = __pyx_v_allocate_buffer; - /* "src/voro/voro.pyx":112 - * csurrlist = surroundlist.data - * for i in range(nsurr): - * mindist = maxshell # <<<<<<<<<<<<<< - * isurr = csurrlist[i] - * for j in range(ncore): + /* "View.MemoryView":177 + * + * self.free_data = allocate_buffer + * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< + * + * if allocate_buffer: */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L1_error) - __pyx_v_mindist = __pyx_t_17; + __pyx_t_6 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 177, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_self->dtype_is_object = __pyx_t_3; - /* "src/voro/voro.pyx":113 - * for i in range(nsurr): - * mindist = maxshell - * isurr = csurrlist[i] # <<<<<<<<<<<<<< - * for j in range(ncore): - * icore = ccorelist[j] + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * */ - __pyx_v_isurr = (__pyx_v_csurrlist[__pyx_v_i]); + if (__pyx_v_allocate_buffer) { - /* "src/voro/voro.pyx":114 - * mindist = maxshell - * isurr = csurrlist[i] - * for j in range(ncore): # <<<<<<<<<<<<<< - * icore = ccorelist[j] - * dist = cds[icore * nmolecules + isurr] + /* "View.MemoryView":180 + * + * if allocate_buffer: + * _allocate_buffer(self) # <<<<<<<<<<<<<< + * + * @cname('getbuffer') */ - __pyx_t_17 = __pyx_v_ncore; - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_j = __pyx_t_19; + __pyx_t_7 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 180, __pyx_L1_error) - /* "src/voro/voro.pyx":115 - * isurr = csurrlist[i] - * for j in range(ncore): - * icore = ccorelist[j] # <<<<<<<<<<<<<< - * dist = cds[icore * nmolecules + isurr] - * if dist < mindist: + /* "View.MemoryView":179 + * self.dtype_is_object = format == b'O' + * + * if allocate_buffer: # <<<<<<<<<<<<<< + * _allocate_buffer(self) + * */ - __pyx_v_icore = (__pyx_v_ccorelist[__pyx_v_j]); + } - /* "src/voro/voro.pyx":116 - * for j in range(ncore): - * icore = ccorelist[j] - * dist = cds[icore * nmolecules + isurr] # <<<<<<<<<<<<<< - * if dist < mindist: - * mindist = dist + /* "View.MemoryView":131 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode="c", bint allocate_buffer=True): + * */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_icore); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_v_nmolecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_isurr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_dist = (__pyx_v_cds[__pyx_t_7]); - /* "src/voro/voro.pyx":117 - * icore = ccorelist[j] - * dist = cds[icore * nmolecules + isurr] - * if dist < mindist: # <<<<<<<<<<<<<< - * mindist = dist - * cts[ts*nsurr+isurr] = mindist - */ - __pyx_t_8 = ((__pyx_v_dist < __pyx_v_mindist) != 0); - if (__pyx_t_8) { + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_format); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/voro/voro.pyx":118 - * dist = cds[icore * nmolecules + isurr] - * if dist < mindist: - * mindist = dist # <<<<<<<<<<<<<< - * cts[ts*nsurr+isurr] = mindist - * else: +/* "View.MemoryView":182 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ - __pyx_v_mindist = __pyx_v_dist; - /* "src/voro/voro.pyx":117 - * icore = ccorelist[j] - * dist = cds[icore * nmolecules + isurr] - * if dist < mindist: # <<<<<<<<<<<<<< - * mindist = dist - * cts[ts*nsurr+isurr] = mindist +/* Python wrapper */ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_bufmode; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + Py_ssize_t *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + if (unlikely(__pyx_v_info == NULL)) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; + } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "View.MemoryView":184 + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 # <<<<<<<<<<<<<< + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": */ - } - } + __pyx_v_bufmode = -1; - /* "src/voro/voro.pyx":119 - * if dist < mindist: - * mindist = dist - * cts[ts*nsurr+isurr] = mindist # <<<<<<<<<<<<<< - * else: - * for i in range(nmolecules): + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nsurr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Multiply(__pyx_v_ts, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_isurr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - (__pyx_v_cts[__pyx_t_7]) = __pyx_v_mindist; - } + __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0); + if (__pyx_t_1) { - /* "src/voro/voro.pyx":108 - * for i in range(nmolecules): - * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] - * elif surroundlist is not None: # <<<<<<<<<<<<<< - * nsurr = len(surroundlist) - * csurrlist = surroundlist.data + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": */ - goto __pyx_L14; + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 186, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":187 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + */ + __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":186 + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): + * if self.mode == u"c": # <<<<<<<<<<<<<< + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + */ + goto __pyx_L4; } - /* "src/voro/voro.pyx":121 - * cts[ts*nsurr+isurr] = mindist + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + */ + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 188, __pyx_L1_error) + if (__pyx_t_1) { + + /* "View.MemoryView":189 + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + */ + __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + + /* "View.MemoryView":188 + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * elif self.mode == u"fortran": # <<<<<<<<<<<<<< + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + */ + } + __pyx_L4:; + + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + */ + __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0)); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":191 + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<< + * info.buf = self.data + * info.len = self.len + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Can_only_create_a_buffer_that_is, 0, 0); + __PYX_ERR(1, 191, __pyx_L1_error) + + /* "View.MemoryView":190 + * elif self.mode == u"fortran": + * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + * if not (flags & bufmode): # <<<<<<<<<<<<<< + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + */ + } + + /* "View.MemoryView":185 + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 + * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<< + * if self.mode == u"c": + * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + */ + } + + /* "View.MemoryView":192 + * if not (flags & bufmode): + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data # <<<<<<<<<<<<<< + * info.len = self.len + * + */ + __pyx_t_2 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_2; + + /* "View.MemoryView":193 + * raise ValueError, "Can only create a buffer that is contiguous in memory." + * info.buf = self.data + * info.len = self.len # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: + */ + __pyx_t_3 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_3; + + /* "View.MemoryView":195 + * info.len = self.len + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { + + /* "View.MemoryView":196 + * + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim # <<<<<<<<<<<<<< + * info.shape = self._shape + * info.strides = self._strides + */ + __pyx_t_4 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_4; + + /* "View.MemoryView":197 + * if flags & PyBUF_STRIDES: + * info.ndim = self.ndim + * info.shape = self._shape # <<<<<<<<<<<<<< + * info.strides = self._strides * else: - * for i in range(nmolecules): # <<<<<<<<<<<<<< - * for j in range(nmolecules): - * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] */ - /*else*/ { - __pyx_t_14 = __Pyx_PyInt_As_long(__pyx_v_nmolecules); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L1_error) - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_15; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + __pyx_t_5 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_5; - /* "src/voro/voro.pyx":122 + /* "View.MemoryView":198 + * info.ndim = self.ndim + * info.shape = self._shape + * info.strides = self._strides # <<<<<<<<<<<<<< * else: - * for i in range(nmolecules): - * for j in range(nmolecules): # <<<<<<<<<<<<<< - * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] + * info.ndim = 1 + */ + __pyx_t_5 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_5; + + /* "View.MemoryView":195 + * info.len = self.len * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.ndim = self.ndim + * info.shape = self._shape */ - __pyx_t_20 = __Pyx_PyInt_As_long(__pyx_v_nmolecules); if (unlikely((__pyx_t_20 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L1_error) - __pyx_t_21 = __pyx_t_20; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_21; __pyx_t_12+=1) { - __pyx_v_j = __pyx_t_12; + goto __pyx_L6; + } - /* "src/voro/voro.pyx":123 - * for i in range(nmolecules): - * for j in range(nmolecules): - * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] # <<<<<<<<<<<<<< + /* "View.MemoryView":200 + * info.strides = self._strides + * else: + * info.ndim = 1 # <<<<<<<<<<<<<< + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL + */ + /*else*/ { + __pyx_v_info->ndim = 1; + + /* "View.MemoryView":201 + * else: + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<< + * info.strides = NULL * - * def calcTessellationVolSurfAtomic(double [:,:] xyz, float boxlength, */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_nmolecules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Multiply(__pyx_v_ts, __pyx_v_nmolecules); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_v_nmolecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyNumber_Multiply(__pyx_v_nmolecules, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_16 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_16 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - (__pyx_v_cts[__pyx_t_16]) = (__pyx_v_cds[__pyx_t_7]); - } - } + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); + if (__pyx_t_1) { + __pyx_t_5 = (&__pyx_v_self->len); + } else { + __pyx_t_5 = NULL; } - __pyx_L14:; + __pyx_v_info->shape = __pyx_t_5; + + /* "View.MemoryView":202 + * info.ndim = 1 + * info.shape = &self.len if flags & PyBUF_ND else NULL + * info.strides = NULL # <<<<<<<<<<<<<< + * + * info.suboffsets = NULL + */ + __pyx_v_info->strides = NULL; } - __pyx_L13:; + __pyx_L6:; - /* "src/voro/voro.pyx":37 + /* "View.MemoryView":204 + * info.strides = NULL * - * @cython.boundscheck(False) - * def calcTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, float boxlength, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, - * np.ndarray[np.int32_t,ndim=1, mode="c"] corelist, + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = self.itemsize + * info.readonly = 0 + */ + __pyx_v_info->suboffsets = NULL; + + /* "View.MemoryView":205 + * + * info.suboffsets = NULL + * info.itemsize = self.itemsize # <<<<<<<<<<<<<< + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + */ + __pyx_t_3 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_3; + + /* "View.MemoryView":206 + * info.suboffsets = NULL + * info.itemsize = self.itemsize + * info.readonly = 0 # <<<<<<<<<<<<<< + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self + */ + __pyx_v_info->readonly = 0; + + /* "View.MemoryView":207 + * info.itemsize = self.itemsize + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<< + * info.obj = self + * + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_self->format; + } else { + __pyx_t_2 = NULL; + } + __pyx_v_info->format = __pyx_t_2; + + /* "View.MemoryView":208 + * info.readonly = 0 + * info.format = self.format if flags & PyBUF_FORMAT else NULL + * info.obj = self # <<<<<<<<<<<<<< + * + * def __dealloc__(array self): + */ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":182 + * _allocate_buffer(self) + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * cdef int bufmode = -1 */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corelist.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_delaunay.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f2c.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fa.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_surroundlist.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vols.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.voro.calcTessellation", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corelist.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_delaunay.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds_ts.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f2c.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fa.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_surroundlist.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vols.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; + } __pyx_L2:; - __Pyx_XDECREF((PyObject *)__pyx_v_delaunay); - __Pyx_XDECREF(__pyx_v_dataset); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/voro/voro.pyx":125 - * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] +/* "View.MemoryView":210 + * info.obj = self * - * def calcTessellationVolSurfAtomic(double [:,:] xyz, float boxlength, # <<<<<<<<<<<<<< - * int [:] f2c, int natoms, int nmolecules, int maxshell, - * int [:] corelist, float [:] vols, float [:] fa): + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_4voro_3calcTessellationVolSurfAtomic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_4voro_3calcTessellationVolSurfAtomic = {"calcTessellationVolSurfAtomic", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_4voro_3calcTessellationVolSurfAtomic, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_4voro_3calcTessellationVolSurfAtomic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_xyz = { 0, 0, { 0 }, { 0 }, { 0 } }; - float __pyx_v_boxlength; - __Pyx_memviewslice __pyx_v_f2c = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_natoms; - int __pyx_v_nmolecules; - int __pyx_v_maxshell; - __Pyx_memviewslice __pyx_v_corelist = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_vols = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_fa = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcTessellationVolSurfAtomic (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_boxlength,&__pyx_n_s_f2c,&__pyx_n_s_natoms,&__pyx_n_s_nmolecules,&__pyx_n_s_maxshell,&__pyx_n_s_corelist,&__pyx_n_s_vols,&__pyx_n_s_fa,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 1); __PYX_ERR(0, 125, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f2c)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 2); __PYX_ERR(0, 125, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_natoms)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 3); __PYX_ERR(0, 125, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmolecules)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 4); __PYX_ERR(0, 125, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 5); __PYX_ERR(0, 125, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_corelist)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 6); __PYX_ERR(0, 125, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vols)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 7); __PYX_ERR(0, 125, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 8); __PYX_ERR(0, 125, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcTessellationVolSurfAtomic") < 0)) __PYX_ERR(0, 125, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - } - __pyx_v_xyz = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xyz.memview)) __PYX_ERR(0, 125, __pyx_L3_error) - __pyx_v_boxlength = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_boxlength == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) - __pyx_v_f2c = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_f2c.memview)) __PYX_ERR(0, 126, __pyx_L3_error) - __pyx_v_natoms = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_natoms == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error) - __pyx_v_nmolecules = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nmolecules == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error) - __pyx_v_maxshell = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error) - __pyx_v_corelist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_corelist.memview)) __PYX_ERR(0, 127, __pyx_L3_error) - __pyx_v_vols = __Pyx_PyObject_to_MemoryviewSlice_ds_float(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vols.memview)) __PYX_ERR(0, 127, __pyx_L3_error) - __pyx_v_fa = __Pyx_PyObject_to_MemoryviewSlice_ds_float(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fa.memview)) __PYX_ERR(0, 127, __pyx_L3_error) - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 125, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.voro.calcTessellationVolSurfAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_4voro_2calcTessellationVolSurfAtomic(__pyx_self, __pyx_v_xyz, __pyx_v_boxlength, __pyx_v_f2c, __pyx_v_natoms, __pyx_v_nmolecules, __pyx_v_maxshell, __pyx_v_corelist, __pyx_v_vols, __pyx_v_fa); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_4voro_2calcTessellationVolSurfAtomic(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz, float __pyx_v_boxlength, __Pyx_memviewslice __pyx_v_f2c, int __pyx_v_natoms, int __pyx_v_nmolecules, int __pyx_v_maxshell, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_vols, __Pyx_memviewslice __pyx_v_fa) { - __Pyx_memviewslice __pyx_v_delaunay = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_r = NULL; +static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcTessellationVolSurfAtomic", 0); + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "src/voro/voro.pyx":129 - * int [:] corelist, float [:] vols, float [:] fa): + /* "View.MemoryView":211 * - * cdef char [:,:] delaunay = np.empty((nmolecules, nmolecules), dtype=np.int8) # <<<<<<<<<<<<<< - * - * _calcTessellationVolSurfAtomic(&xyz[0,0], boxlength, &f2c[0], natoms, nmolecules, maxshell, + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nmolecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nmolecules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_delaunay = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL); + if (__pyx_t_1) { - /* "src/voro/voro.pyx":131 - * cdef char [:,:] delaunay = np.empty((nmolecules, nmolecules), dtype=np.int8) - * - * _calcTessellationVolSurfAtomic(&xyz[0,0], boxlength, &f2c[0], natoms, nmolecules, maxshell, # <<<<<<<<<<<<<< - * &delaunay[0,0], &corelist[0], corelist.shape[0], &vols[0], &fa[0]) + /* "View.MemoryView":212 + * def __dealloc__(array self): + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) # <<<<<<<<<<<<<< + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + */ + __pyx_v_self->callback_free_data(__pyx_v_self->data); + + /* "View.MemoryView":211 * + * def __dealloc__(array self): + * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: */ - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_9 = -1; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_v_xyz.shape[0]; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_7 >= __pyx_v_xyz.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_xyz.shape[1]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_8 >= __pyx_v_xyz.shape[1])) __pyx_t_9 = 1; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 131, __pyx_L1_error) - } - __pyx_t_10 = 0; - __pyx_t_9 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_v_f2c.shape[0]; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_v_f2c.shape[0])) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 131, __pyx_L1_error) + goto __pyx_L3; } - /* "src/voro/voro.pyx":132 - * - * _calcTessellationVolSurfAtomic(&xyz[0,0], boxlength, &f2c[0], natoms, nmolecules, maxshell, - * &delaunay[0,0], &corelist[0], corelist.shape[0], &vols[0], &fa[0]) # <<<<<<<<<<<<<< - * - * return np.asarray(delaunay) + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) */ - __pyx_t_11 = 0; - __pyx_t_12 = 0; - __pyx_t_9 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_v_delaunay.shape[0]; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_v_delaunay.shape[0])) __pyx_t_9 = 0; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_v_delaunay.shape[1]; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_12 >= __pyx_v_delaunay.shape[1])) __pyx_t_9 = 1; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 132, __pyx_L1_error) - } - __pyx_t_13 = 0; - __pyx_t_9 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_v_corelist.shape[0]; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_v_corelist.shape[0])) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 132, __pyx_L1_error) - } - __pyx_t_14 = 0; - __pyx_t_9 = -1; - if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_v_vols.shape[0]; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_v_vols.shape[0])) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 132, __pyx_L1_error) + if (__pyx_v_self->free_data) { + } else { + __pyx_t_1 = __pyx_v_self->free_data; + goto __pyx_L4_bool_binop_done; } - __pyx_t_15 = 0; - __pyx_t_9 = -1; - if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_v_fa.shape[0]; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_v_fa.shape[0])) __pyx_t_9 = 0; - if (unlikely(__pyx_t_9 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_9); - __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_self->data != NULL); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + */ + if (__pyx_v_self->dtype_is_object) { + + /* "View.MemoryView":215 + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<< + * free(self.data) + * PyObject_Free(self._shape) + */ + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + + /* "View.MemoryView":214 + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + */ + } + + /* "View.MemoryView":216 + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) # <<<<<<<<<<<<<< + * PyObject_Free(self._shape) + * + */ + free(__pyx_v_self->data); + + /* "View.MemoryView":213 + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + */ } + __pyx_L3:; - /* "src/voro/voro.pyx":131 - * cdef char [:,:] delaunay = np.empty((nmolecules, nmolecules), dtype=np.int8) + /* "View.MemoryView":217 + * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) + * free(self.data) + * PyObject_Free(self._shape) # <<<<<<<<<<<<<< * - * _calcTessellationVolSurfAtomic(&xyz[0,0], boxlength, &f2c[0], natoms, nmolecules, maxshell, # <<<<<<<<<<<<<< - * &delaunay[0,0], &corelist[0], corelist.shape[0], &vols[0], &fa[0]) + * @property + */ + PyObject_Free(__pyx_v_self->_shape); + + /* "View.MemoryView":210 + * info.obj = self * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) */ - _calcTessellationVolSurfAtomic((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_xyz.data + __pyx_t_7 * __pyx_v_xyz.strides[0]) ) + __pyx_t_8 * __pyx_v_xyz.strides[1]) )))), __pyx_v_boxlength, (&(*((int *) ( /* dim=0 */ (__pyx_v_f2c.data + __pyx_t_10 * __pyx_v_f2c.strides[0]) )))), __pyx_v_natoms, __pyx_v_nmolecules, __pyx_v_maxshell, (&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delaunay.data + __pyx_t_11 * __pyx_v_delaunay.strides[0]) ) + __pyx_t_12 * __pyx_v_delaunay.strides[1]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_corelist.data + __pyx_t_13 * __pyx_v_corelist.strides[0]) )))), (__pyx_v_corelist.shape[0]), (&(*((float *) ( /* dim=0 */ (__pyx_v_vols.data + __pyx_t_14 * __pyx_v_vols.strides[0]) )))), (&(*((float *) ( /* dim=0 */ (__pyx_v_fa.data + __pyx_t_15 * __pyx_v_fa.strides[0]) ))))); - /* "src/voro/voro.pyx":134 - * &delaunay[0,0], &corelist[0], corelist.shape[0], &vols[0], &fa[0]) + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "View.MemoryView":219 + * PyObject_Free(self._shape) * - * return np.asarray(delaunay) # <<<<<<<<<<<<<< + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "View.MemoryView":221 + * @property + * def memview(self): + * return self.get_memview() # <<<<<<<<<<<<<< * - * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): + * @cname('get_memview') */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "View.MemoryView":219 + * PyObject_Free(self._shape) + * + * @property # <<<<<<<<<<<<<< + * def memview(self): + * return self.get_memview() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":224 + * + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) + */ + +static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_memview", 0); + + /* "View.MemoryView":225 + * @cname('get_memview') + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< + * return memoryview(self, flags, self.dtype_is_object) + * + */ + __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); + + /* "View.MemoryView":226 + * cdef get_memview(self): + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_delaunay, 2, (PyObject *(*)(char *)) __pyx_memview_get_char, (int (*)(char *, PyObject *)) __pyx_memview_set_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 226, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "src/voro/voro.pyx":125 - * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] + /* "View.MemoryView":224 * - * def calcTessellationVolSurfAtomic(double [:,:] xyz, float boxlength, # <<<<<<<<<<<<<< - * int [:] f2c, int natoms, int nmolecules, int maxshell, - * int [:] corelist, float [:] vols, float [:] fa): + * @cname('get_memview') + * cdef get_memview(self): # <<<<<<<<<<<<<< + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + * return memoryview(self, flags, self.dtype_is_object) */ /* function exit code */ @@ -4595,4453 +6241,3778 @@ static PyObject *__pyx_pf_11newanalysis_4voro_2calcTessellationVolSurfAtomic(CYT __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __Pyx_AddTraceback("newanalysis.voro.calcTessellationVolSurfAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_delaunay, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_xyz, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_f2c, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_corelist, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_vols, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_fa, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/voro/voro.pyx":136 - * return np.asarray(delaunay) +/* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * - * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< - * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_4voro_5calcTessellationParallel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_4voro_4calcTessellationParallel[] = "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)"; -static PyMethodDef __pyx_mdef_11newanalysis_4voro_5calcTessellationParallel = {"calcTessellationParallel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_4voro_5calcTessellationParallel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_4calcTessellationParallel}; -static PyObject *__pyx_pw_11newanalysis_4voro_5calcTessellationParallel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_xyz_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_f2c = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_corelist = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_surroundlist = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_delaunay_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_v_boxlength = 0; - PyObject *__pyx_v_natoms = 0; - PyObject *__pyx_v_nmolecules = 0; - PyObject *__pyx_v_maxshell = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcTessellationParallel (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz_ts,&__pyx_n_s_f2c,&__pyx_n_s_corelist,&__pyx_n_s_surroundlist,&__pyx_n_s_delaunay_ts,&__pyx_n_s_boxlength,&__pyx_n_s_natoms,&__pyx_n_s_nmolecules,&__pyx_n_s_maxshell,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz_ts)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f2c)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 1); __PYX_ERR(0, 136, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_corelist)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 2); __PYX_ERR(0, 136, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surroundlist)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 3); __PYX_ERR(0, 136, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delaunay_ts)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 4); __PYX_ERR(0, 136, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 5); __PYX_ERR(0, 136, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_natoms)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 6); __PYX_ERR(0, 136, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmolecules)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 7); __PYX_ERR(0, 136, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 8); __PYX_ERR(0, 136, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcTessellationParallel") < 0)) __PYX_ERR(0, 136, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - } - __pyx_v_xyz_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xyz_ts.memview)) __PYX_ERR(0, 136, __pyx_L3_error) - __pyx_v_f2c = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_f2c.memview)) __PYX_ERR(0, 136, __pyx_L3_error) - __pyx_v_corelist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_corelist.memview)) __PYX_ERR(0, 136, __pyx_L3_error) - __pyx_v_surroundlist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_surroundlist.memview)) __PYX_ERR(0, 136, __pyx_L3_error) - __pyx_v_delaunay_ts = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_delaunay_ts.memview)) __PYX_ERR(0, 136, __pyx_L3_error) - __pyx_v_boxlength = values[5]; - __pyx_v_natoms = values[6]; - __pyx_v_nmolecules = values[7]; - __pyx_v_maxshell = values[8]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 136, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.voro.calcTessellationParallel", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_4voro_4calcTessellationParallel(__pyx_self, __pyx_v_xyz_ts, __pyx_v_f2c, __pyx_v_corelist, __pyx_v_surroundlist, __pyx_v_delaunay_ts, __pyx_v_boxlength, __pyx_v_natoms, __pyx_v_nmolecules, __pyx_v_maxshell); + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_4voro_4calcTessellationParallel(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz_ts, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_surroundlist, __Pyx_memviewslice __pyx_v_delaunay_ts, PyObject *__pyx_v_boxlength, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell) { - int __pyx_v_nat; - int __pyx_v_nmol; - int __pyx_v_maxsh; - int __pyx_v_ncore; - int __pyx_v_nsurr; - int __pyx_v_ncpu; - float __pyx_v_boxl; - PyObject *__pyx_r = NULL; +static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - size_t __pyx_t_2; - float __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcTessellationParallel", 0); + __Pyx_RefNannySetupContext("__len__", 0); - /* "src/voro/voro.pyx":138 - * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): - * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) # <<<<<<<<<<<<<< - * cdef float boxl = boxlength + /* "View.MemoryView":229 * - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_natoms); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error) - __pyx_v_nat = ((int)__pyx_t_1); - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error) - __pyx_v_nmol = ((int)__pyx_t_1); - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error) - __pyx_v_maxsh = ((int)__pyx_t_1); - __pyx_t_2 = __Pyx_MemoryView_Len(__pyx_v_corelist); - __pyx_v_ncore = ((int)__pyx_t_2); - __pyx_t_2 = __Pyx_MemoryView_Len(__pyx_v_surroundlist); - __pyx_v_nsurr = ((int)__pyx_t_2); - __pyx_t_2 = __Pyx_MemoryView_Len(__pyx_v_delaunay_ts); - __pyx_v_ncpu = ((int)__pyx_t_2); - - /* "src/voro/voro.pyx":139 - * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) - * cdef float boxl = boxlength # <<<<<<<<<<<<<< + * def __len__(self): + * return self._shape[0] # <<<<<<<<<<<<<< * - * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) + * def __getattr__(self, attr): */ - __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_boxlength); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error) - __pyx_v_boxl = ((float)__pyx_t_3); + __pyx_r = (__pyx_v_self->_shape[0]); + goto __pyx_L0; - /* "src/voro/voro.pyx":141 - * cdef float boxl = boxlength - * - * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) # <<<<<<<<<<<<<< + /* "View.MemoryView":228 + * return memoryview(self, flags, self.dtype_is_object) * - * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): - */ - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_1 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_xyz_ts.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_xyz_ts.shape[0])) __pyx_t_1 = 0; - if (__pyx_t_5 < 0) { - __pyx_t_5 += __pyx_v_xyz_ts.shape[1]; - if (unlikely(__pyx_t_5 < 0)) __pyx_t_1 = 1; - } else if (unlikely(__pyx_t_5 >= __pyx_v_xyz_ts.shape[1])) __pyx_t_1 = 1; - if (__pyx_t_6 < 0) { - __pyx_t_6 += __pyx_v_xyz_ts.shape[2]; - if (unlikely(__pyx_t_6 < 0)) __pyx_t_1 = 2; - } else if (unlikely(__pyx_t_6 >= __pyx_v_xyz_ts.shape[2])) __pyx_t_1 = 2; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 141, __pyx_L1_error) - } - __pyx_t_7 = 0; - __pyx_t_1 = -1; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_v_f2c.shape[0]; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_7 >= __pyx_v_f2c.shape[0])) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 141, __pyx_L1_error) - } - __pyx_t_8 = 0; - __pyx_t_1 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_corelist.shape[0]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_v_corelist.shape[0])) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 141, __pyx_L1_error) - } - __pyx_t_9 = 0; - __pyx_t_1 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_v_surroundlist.shape[0]; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_v_surroundlist.shape[0])) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 141, __pyx_L1_error) - } - __pyx_t_10 = 0; - __pyx_t_11 = 0; - __pyx_t_1 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_v_delaunay_ts.shape[0]; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_v_delaunay_ts.shape[0])) __pyx_t_1 = 0; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_v_delaunay_ts.shape[1]; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_1 = 1; - } else if (unlikely(__pyx_t_11 >= __pyx_v_delaunay_ts.shape[1])) __pyx_t_1 = 1; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 141, __pyx_L1_error) - } - _calcTessellationParallel((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_xyz_ts.data + __pyx_t_4 * __pyx_v_xyz_ts.strides[0]) ) + __pyx_t_5 * __pyx_v_xyz_ts.strides[1]) ) + __pyx_t_6 * __pyx_v_xyz_ts.strides[2]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_f2c.data + __pyx_t_7 * __pyx_v_f2c.strides[0]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_corelist.data + __pyx_t_8 * __pyx_v_corelist.strides[0]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_surroundlist.data + __pyx_t_9 * __pyx_v_surroundlist.strides[0]) )))), (&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delaunay_ts.data + __pyx_t_10 * __pyx_v_delaunay_ts.strides[0]) ) + __pyx_t_11 * __pyx_v_delaunay_ts.strides[1]) )))), __pyx_v_boxl, __pyx_v_nat, __pyx_v_nmol, __pyx_v_maxsh, __pyx_v_ncore, __pyx_v_nsurr, __pyx_v_ncpu); - - /* "src/voro/voro.pyx":136 - * return np.asarray(delaunay) + * def __len__(self): # <<<<<<<<<<<<<< + * return self._shape[0] * - * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< - * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("newanalysis.voro.calcTessellationParallel", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_xyz_ts, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_f2c, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_corelist, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_surroundlist, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_delaunay_ts, 1); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/voro/voro.pyx":143 - * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) +/* "View.MemoryView":231 + * return self._shape[0] + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * - * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< - * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_4voro_7calcTessellationParallelAll(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_4voro_6calcTessellationParallelAll[] = "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)"; -static PyMethodDef __pyx_mdef_11newanalysis_4voro_7calcTessellationParallelAll = {"calcTessellationParallelAll", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_4voro_7calcTessellationParallelAll, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_6calcTessellationParallelAll}; -static PyObject *__pyx_pw_11newanalysis_4voro_7calcTessellationParallelAll(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_xyz_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_f2c = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_corelist = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_delaunay_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_v_boxlength = 0; - PyObject *__pyx_v_natoms = 0; - PyObject *__pyx_v_nmolecules = 0; - PyObject *__pyx_v_maxshell = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ +static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcTessellationParallelAll (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz_ts,&__pyx_n_s_f2c,&__pyx_n_s_corelist,&__pyx_n_s_delaunay_ts,&__pyx_n_s_boxlength,&__pyx_n_s_natoms,&__pyx_n_s_nmolecules,&__pyx_n_s_maxshell,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz_ts)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f2c)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 1); __PYX_ERR(0, 143, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_corelist)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 2); __PYX_ERR(0, 143, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delaunay_ts)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 3); __PYX_ERR(0, 143, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxlength)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 4); __PYX_ERR(0, 143, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_natoms)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 5); __PYX_ERR(0, 143, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmolecules)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 6); __PYX_ERR(0, 143, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 7); __PYX_ERR(0, 143, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcTessellationParallelAll") < 0)) __PYX_ERR(0, 143, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - } - __pyx_v_xyz_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xyz_ts.memview)) __PYX_ERR(0, 143, __pyx_L3_error) - __pyx_v_f2c = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_f2c.memview)) __PYX_ERR(0, 143, __pyx_L3_error) - __pyx_v_corelist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_corelist.memview)) __PYX_ERR(0, 143, __pyx_L3_error) - __pyx_v_delaunay_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_delaunay_ts.memview)) __PYX_ERR(0, 143, __pyx_L3_error) - __pyx_v_boxlength = values[4]; - __pyx_v_natoms = values[5]; - __pyx_v_nmolecules = values[6]; - __pyx_v_maxshell = values[7]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 143, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.voro.calcTessellationParallelAll", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_4voro_6calcTessellationParallelAll(__pyx_self, __pyx_v_xyz_ts, __pyx_v_f2c, __pyx_v_corelist, __pyx_v_delaunay_ts, __pyx_v_boxlength, __pyx_v_natoms, __pyx_v_nmolecules, __pyx_v_maxshell); + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_4voro_6calcTessellationParallelAll(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz_ts, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_delaunay_ts, PyObject *__pyx_v_boxlength, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell) { - int __pyx_v_nat; - int __pyx_v_nmol; - int __pyx_v_maxsh; - int __pyx_v_ncore; - int __pyx_v_ncpu; - float __pyx_v_boxl; +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - size_t __pyx_t_2; - float __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcTessellationParallelAll", 0); + __Pyx_RefNannySetupContext("__getattr__", 0); - /* "src/voro/voro.pyx":145 - * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): - * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) # <<<<<<<<<<<<<< - * cdef float boxl = boxlength + /* "View.MemoryView":232 * - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_natoms); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error) - __pyx_v_nat = ((int)__pyx_t_1); - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error) - __pyx_v_nmol = ((int)__pyx_t_1); - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error) - __pyx_v_maxsh = ((int)__pyx_t_1); - __pyx_t_2 = __Pyx_MemoryView_Len(__pyx_v_corelist); - __pyx_v_ncore = ((int)__pyx_t_2); - __pyx_t_2 = __Pyx_MemoryView_Len(__pyx_v_delaunay_ts); - __pyx_v_ncpu = ((int)__pyx_t_2); - - /* "src/voro/voro.pyx":146 - * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) - * cdef float boxl = boxlength # <<<<<<<<<<<<<< + * def __getattr__(self, attr): + * return getattr(self.memview, attr) # <<<<<<<<<<<<<< * - * _calcTessellationParallelAll(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &(delaunay_ts[0,0,0]), boxl, nat, nmol, maxsh, ncore, ncpu) + * def __getitem__(self, item): */ - __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_boxlength); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 146, __pyx_L1_error) - __pyx_v_boxl = ((float)__pyx_t_3); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/voro/voro.pyx":148 - * cdef float boxl = boxlength - * - * _calcTessellationParallelAll(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &(delaunay_ts[0,0,0]), boxl, nat, nmol, maxsh, ncore, ncpu) # <<<<<<<<<<<<<< + /* "View.MemoryView":231 + * return self._shape[0] * - * @cython.boundscheck(False) - */ - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_1 = -1; - if (__pyx_t_4 < 0) { - __pyx_t_4 += __pyx_v_xyz_ts.shape[0]; - if (unlikely(__pyx_t_4 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_4 >= __pyx_v_xyz_ts.shape[0])) __pyx_t_1 = 0; - if (__pyx_t_5 < 0) { - __pyx_t_5 += __pyx_v_xyz_ts.shape[1]; - if (unlikely(__pyx_t_5 < 0)) __pyx_t_1 = 1; - } else if (unlikely(__pyx_t_5 >= __pyx_v_xyz_ts.shape[1])) __pyx_t_1 = 1; - if (__pyx_t_6 < 0) { - __pyx_t_6 += __pyx_v_xyz_ts.shape[2]; - if (unlikely(__pyx_t_6 < 0)) __pyx_t_1 = 2; - } else if (unlikely(__pyx_t_6 >= __pyx_v_xyz_ts.shape[2])) __pyx_t_1 = 2; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 148, __pyx_L1_error) - } - __pyx_t_7 = 0; - __pyx_t_1 = -1; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_v_f2c.shape[0]; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_7 >= __pyx_v_f2c.shape[0])) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 148, __pyx_L1_error) - } - __pyx_t_8 = 0; - __pyx_t_1 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_v_corelist.shape[0]; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_v_corelist.shape[0])) __pyx_t_1 = 0; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 148, __pyx_L1_error) - } - __pyx_t_9 = 0; - __pyx_t_10 = 0; - __pyx_t_11 = 0; - __pyx_t_1 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_v_delaunay_ts.shape[0]; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_1 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_v_delaunay_ts.shape[0])) __pyx_t_1 = 0; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_v_delaunay_ts.shape[1]; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_1 = 1; - } else if (unlikely(__pyx_t_10 >= __pyx_v_delaunay_ts.shape[1])) __pyx_t_1 = 1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_v_delaunay_ts.shape[2]; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_1 = 2; - } else if (unlikely(__pyx_t_11 >= __pyx_v_delaunay_ts.shape[2])) __pyx_t_1 = 2; - if (unlikely(__pyx_t_1 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_1); - __PYX_ERR(0, 148, __pyx_L1_error) - } - _calcTessellationParallelAll((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_xyz_ts.data + __pyx_t_4 * __pyx_v_xyz_ts.strides[0]) ) + __pyx_t_5 * __pyx_v_xyz_ts.strides[1]) ) + __pyx_t_6 * __pyx_v_xyz_ts.strides[2]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_f2c.data + __pyx_t_7 * __pyx_v_f2c.strides[0]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_corelist.data + __pyx_t_8 * __pyx_v_corelist.strides[0]) )))), (&(*((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delaunay_ts.data + __pyx_t_9 * __pyx_v_delaunay_ts.strides[0]) ) + __pyx_t_10 * __pyx_v_delaunay_ts.strides[1]) ) + __pyx_t_11 * __pyx_v_delaunay_ts.strides[2]) )))), __pyx_v_boxl, __pyx_v_nat, __pyx_v_nmol, __pyx_v_maxsh, __pyx_v_ncore, __pyx_v_ncpu); - - /* "src/voro/voro.pyx":143 - * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) * - * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< - * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("newanalysis.voro.calcTessellationParallelAll", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_xyz_ts, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_f2c, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_corelist, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_delaunay_ts, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/voro/voro.pyx":151 +/* "View.MemoryView":234 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] * - * @cython.boundscheck(False) - * def nearestNeighbor(int [:] corelist, int [:] surroundlist, char [:,:,:] delaunay_tmp, char [:,:,:] delaunay_ts, int iubq, int maxshell): # <<<<<<<<<<<<<< - * cdef int icore, isurr, c, j, k, nsurr = len(surroundlist), ncore = len(corelist), ncpu = delaunay_tmp.shape[0] - * cdef char dist, mindist */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_4voro_9nearestNeighbor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_11newanalysis_4voro_9nearestNeighbor = {"nearestNeighbor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_4voro_9nearestNeighbor, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_11newanalysis_4voro_9nearestNeighbor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_corelist = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_surroundlist = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_delaunay_tmp = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_memviewslice __pyx_v_delaunay_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_v_iubq; - int __pyx_v_maxshell; +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("nearestNeighbor (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_corelist,&__pyx_n_s_surroundlist,&__pyx_n_s_delaunay_tmp,&__pyx_n_s_delaunay_ts,&__pyx_n_s_iubq,&__pyx_n_s_maxshell,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "View.MemoryView":235 + * + * def __getitem__(self, item): + * return self.memview[item] # <<<<<<<<<<<<<< + * + * def __setitem__(self, item, value): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":234 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":237 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * + */ + +/* Python wrapper */ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "View.MemoryView":238 + * + * def __setitem__(self, item, value): + * self.memview[item] = value # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(1, 238, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":237 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_corelist)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surroundlist)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, 1); __PYX_ERR(0, 151, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delaunay_tmp)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, 2); __PYX_ERR(0, 151, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delaunay_ts)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, 3); __PYX_ERR(0, 151, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_iubq)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, 4); __PYX_ERR(0, 151, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, 5); __PYX_ERR(0, 151, __pyx_L3_error) + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nearestNeighbor") < 0)) __PYX_ERR(0, 151, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - __pyx_v_corelist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_corelist.memview)) __PYX_ERR(0, 151, __pyx_L3_error) - __pyx_v_surroundlist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_surroundlist.memview)) __PYX_ERR(0, 151, __pyx_L3_error) - __pyx_v_delaunay_tmp = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_delaunay_tmp.memview)) __PYX_ERR(0, 151, __pyx_L3_error) - __pyx_v_delaunay_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_delaunay_ts.memview)) __PYX_ERR(0, 151, __pyx_L3_error) - __pyx_v_iubq = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_iubq == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L3_error) - __pyx_v_maxshell = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L3_error) + __pyx_v___pyx_state = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 151, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.voro.nearestNeighbor", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_11newanalysis_4voro_8nearestNeighbor(__pyx_self, __pyx_v_corelist, __pyx_v_surroundlist, __pyx_v_delaunay_tmp, __pyx_v_delaunay_ts, __pyx_v_iubq, __pyx_v_maxshell); + __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_4voro_8nearestNeighbor(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_surroundlist, __Pyx_memviewslice __pyx_v_delaunay_tmp, __Pyx_memviewslice __pyx_v_delaunay_ts, int __pyx_v_iubq, int __pyx_v_maxshell) { - int __pyx_v_icore; - int __pyx_v_isurr; - int __pyx_v_c; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_nsurr; - int __pyx_v_ncore; - int __pyx_v_ncpu; - char __pyx_v_dist; - char __pyx_v_mindist; +static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - __Pyx_RefNannySetupContext("nearestNeighbor", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/voro/voro.pyx":152 - * @cython.boundscheck(False) - * def nearestNeighbor(int [:] corelist, int [:] surroundlist, char [:,:,:] delaunay_tmp, char [:,:,:] delaunay_ts, int iubq, int maxshell): - * cdef int icore, isurr, c, j, k, nsurr = len(surroundlist), ncore = len(corelist), ncpu = delaunay_tmp.shape[0] # <<<<<<<<<<<<<< - * cdef char dist, mindist - * + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_surroundlist); - __pyx_v_nsurr = __pyx_t_1; - __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_corelist); - __pyx_v_ncore = __pyx_t_1; - __pyx_v_ncpu = (__pyx_v_delaunay_tmp.shape[0]); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/voro/voro.pyx":155 - * cdef char dist, mindist - * - * for c in range(ncpu): # <<<<<<<<<<<<<< - * for j in range(nsurr): - * mindist = maxshell + 1 + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_2 = __pyx_v_ncpu; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_c = __pyx_t_4; - /* "src/voro/voro.pyx":156 + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * * - * for c in range(ncpu): - * for j in range(nsurr): # <<<<<<<<<<<<<< - * mindist = maxshell + 1 - * isurr = surroundlist[j] */ - __pyx_t_5 = __pyx_v_nsurr; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_j = __pyx_t_7; - /* "src/voro/voro.pyx":157 - * for c in range(ncpu): - * for j in range(nsurr): - * mindist = maxshell + 1 # <<<<<<<<<<<<<< - * isurr = surroundlist[j] - * for k in range(ncore): +static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) { + Py_ssize_t __pyx_v_i; + PyObject **__pyx_v_p; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_allocate_buffer", 0); + + /* "View.MemoryView":254 + * cdef PyObject **p + * + * self.free_data = True # <<<<<<<<<<<<<< + * self.data = malloc(self.len) + * if not self.data: */ - __pyx_v_mindist = (__pyx_v_maxshell + 1); + __pyx_v_self->free_data = 1; - /* "src/voro/voro.pyx":158 - * for j in range(nsurr): - * mindist = maxshell + 1 - * isurr = surroundlist[j] # <<<<<<<<<<<<<< - * for k in range(ncore): - * icore = corelist[k] + /* "View.MemoryView":255 + * + * self.free_data = True + * self.data = malloc(self.len) # <<<<<<<<<<<<<< + * if not self.data: + * raise MemoryError, "unable to allocate array data." */ - __pyx_t_8 = __pyx_v_j; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_surroundlist.shape[0]; - __pyx_v_isurr = (*((int *) ( /* dim=0 */ (__pyx_v_surroundlist.data + __pyx_t_8 * __pyx_v_surroundlist.strides[0]) ))); + __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); - /* "src/voro/voro.pyx":159 - * mindist = maxshell + 1 - * isurr = surroundlist[j] - * for k in range(ncore): # <<<<<<<<<<<<<< - * icore = corelist[k] - * dist = delaunay_tmp[c,icore,isurr] + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * */ - __pyx_t_9 = __pyx_v_ncore; - __pyx_t_10 = __pyx_t_9; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_k = __pyx_t_11; + __pyx_t_1 = (!(__pyx_v_self->data != 0)); + if (unlikely(__pyx_t_1)) { - /* "src/voro/voro.pyx":160 - * isurr = surroundlist[j] - * for k in range(ncore): - * icore = corelist[k] # <<<<<<<<<<<<<< - * dist = delaunay_tmp[c,icore,isurr] - * if dist < mindist and dist != -1: + /* "View.MemoryView":257 + * self.data = malloc(self.len) + * if not self.data: + * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<< + * + * if self.dtype_is_object: */ - __pyx_t_8 = __pyx_v_k; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_corelist.shape[0]; - __pyx_v_icore = (*((int *) ( /* dim=0 */ (__pyx_v_corelist.data + __pyx_t_8 * __pyx_v_corelist.strides[0]) ))); + __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_array_data, 0, 0); + __PYX_ERR(1, 257, __pyx_L1_error) - /* "src/voro/voro.pyx":161 - * for k in range(ncore): - * icore = corelist[k] - * dist = delaunay_tmp[c,icore,isurr] # <<<<<<<<<<<<<< - * if dist < mindist and dist != -1: - * mindist = dist + /* "View.MemoryView":256 + * self.free_data = True + * self.data = malloc(self.len) + * if not self.data: # <<<<<<<<<<<<<< + * raise MemoryError, "unable to allocate array data." + * */ - __pyx_t_8 = __pyx_v_c; - __pyx_t_12 = __pyx_v_icore; - __pyx_t_13 = __pyx_v_isurr; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_delaunay_tmp.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_delaunay_tmp.shape[1]; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_delaunay_tmp.shape[2]; - __pyx_v_dist = (*((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delaunay_tmp.data + __pyx_t_8 * __pyx_v_delaunay_tmp.strides[0]) ) + __pyx_t_12 * __pyx_v_delaunay_tmp.strides[1]) ) + __pyx_t_13 * __pyx_v_delaunay_tmp.strides[2]) ))); + } - /* "src/voro/voro.pyx":162 - * icore = corelist[k] - * dist = delaunay_tmp[c,icore,isurr] - * if dist < mindist and dist != -1: # <<<<<<<<<<<<<< - * mindist = dist - * delaunay_ts[c,iubq,j] = mindist + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): */ - __pyx_t_15 = ((__pyx_v_dist < __pyx_v_mindist) != 0); - if (__pyx_t_15) { - } else { - __pyx_t_14 = __pyx_t_15; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_15 = ((__pyx_v_dist != -1L) != 0); - __pyx_t_14 = __pyx_t_15; - __pyx_L10_bool_binop_done:; - if (__pyx_t_14) { + if (__pyx_v_self->dtype_is_object) { - /* "src/voro/voro.pyx":163 - * dist = delaunay_tmp[c,icore,isurr] - * if dist < mindist and dist != -1: - * mindist = dist # <<<<<<<<<<<<<< - * delaunay_ts[c,iubq,j] = mindist + /* "View.MemoryView":260 * + * if self.dtype_is_object: + * p = self.data # <<<<<<<<<<<<<< + * for i in range(self.len // self.itemsize): + * p[i] = Py_None */ - __pyx_v_mindist = __pyx_v_dist; + __pyx_v_p = ((PyObject **)__pyx_v_self->data); - /* "src/voro/voro.pyx":162 - * icore = corelist[k] - * dist = delaunay_tmp[c,icore,isurr] - * if dist < mindist and dist != -1: # <<<<<<<<<<<<<< - * mindist = dist - * delaunay_ts[c,iubq,j] = mindist + /* "View.MemoryView":261 + * if self.dtype_is_object: + * p = self.data + * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<< + * p[i] = Py_None + * Py_INCREF(Py_None) */ - } - } + if (unlikely(__pyx_v_self->itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 261, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/voro/voro.pyx":164 - * if dist < mindist and dist != -1: - * mindist = dist - * delaunay_ts[c,iubq,j] = mindist # <<<<<<<<<<<<<< + /* "View.MemoryView":262 + * p = self.data + * for i in range(self.len // self.itemsize): + * p[i] = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) + * return 0 + */ + (__pyx_v_p[__pyx_v_i]) = Py_None; + + /* "View.MemoryView":263 + * for i in range(self.len // self.itemsize): + * p[i] = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * return 0 * - * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, */ - __pyx_t_13 = __pyx_v_c; - __pyx_t_12 = __pyx_v_iubq; - __pyx_t_8 = __pyx_v_j; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_delaunay_ts.shape[0]; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_delaunay_ts.shape[1]; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_delaunay_ts.shape[2]; - *((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delaunay_ts.data + __pyx_t_13 * __pyx_v_delaunay_ts.strides[0]) ) + __pyx_t_12 * __pyx_v_delaunay_ts.strides[1]) ) + __pyx_t_8 * __pyx_v_delaunay_ts.strides[2]) )) = __pyx_v_mindist; + Py_INCREF(Py_None); } + + /* "View.MemoryView":259 + * raise MemoryError, "unable to allocate array data." + * + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * p = self.data + * for i in range(self.len // self.itemsize): + */ } - /* "src/voro/voro.pyx":151 + /* "View.MemoryView":264 + * p[i] = Py_None + * Py_INCREF(Py_None) + * return 0 # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":248 + * + * @cname("__pyx_array_allocate_buffer") + * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<< + * * - * @cython.boundscheck(False) - * def nearestNeighbor(int [:] corelist, int [:] surroundlist, char [:,:,:] delaunay_tmp, char [:,:,:] delaunay_ts, int iubq, int maxshell): # <<<<<<<<<<<<<< - * cdef int icore, isurr, c, j, k, nsurr = len(surroundlist), ncore = len(corelist), ncpu = delaunay_tmp.shape[0] - * cdef char dist, mindist */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __PYX_XDEC_MEMVIEW(&__pyx_v_corelist, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_surroundlist, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_delaunay_tmp, 1); - __PYX_XDEC_MEMVIEW(&__pyx_v_delaunay_ts, 1); - __Pyx_XGIVEREF(__pyx_r); + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/voro/voro.pyx":166 - * delaunay_ts[c,iubq,j] = mindist +/* "View.MemoryView":268 * - * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, - * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ -/* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_4voro_11drawTessellation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_4voro_10drawTessellation[] = "\n drawTessellation(xyz, points_to_draw, cylinder_radius, triangles, nmol, color_id, filename, box_x, box_y=None, box_z=None)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_4voro_11drawTessellation = {"drawTessellation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_4voro_11drawTessellation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_10drawTessellation}; -static PyObject *__pyx_pw_11newanalysis_4voro_11drawTessellation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_xyz = 0; - PyArrayObject *__pyx_v_points_to_draw = 0; - PyObject *__pyx_v_cylinder_radius = 0; - PyObject *__pyx_v_triangles = 0; - int __pyx_v_nmol; - int __pyx_v_color_id; - PyObject *__pyx_v_filename = 0; - PyObject *__pyx_v_box_x = 0; - PyObject *__pyx_v_box_y = 0; - PyObject *__pyx_v_box_z = 0; +static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_c_mode, char *__pyx_v_buf) { + struct __pyx_array_obj *__pyx_v_result = 0; + PyObject *__pyx_v_mode = 0; + struct __pyx_array_obj *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("drawTessellation (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_points_to_draw,&__pyx_n_s_cylinder_radius,&__pyx_n_s_triangles,&__pyx_n_s_nmol,&__pyx_n_s_color_id,&__pyx_n_s_filename,&__pyx_n_s_box_x,&__pyx_n_s_box_y,&__pyx_n_s_box_z,0}; - PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; + __Pyx_RefNannySetupContext("array_cwrapper", 0); - /* "src/voro/voro.pyx":168 - * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, - * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, - * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): # <<<<<<<<<<<<<< - * """ - * drawTessellation(xyz, points_to_draw, cylinder_radius, triangles, nmol, color_id, filename, box_x, box_y=None, box_z=None) + /* "View.MemoryView":270 + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< + * + * if buf is NULL: */ - values[8] = ((PyObject *)Py_None); - values[9] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xyz)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_points_to_draw)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 1); __PYX_ERR(0, 166, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cylinder_radius)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 2); __PYX_ERR(0, 166, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_triangles)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 3); __PYX_ERR(0, 166, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmol)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 4); __PYX_ERR(0, 166, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color_id)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 5); __PYX_ERR(0, 166, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 6); __PYX_ERR(0, 166, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_x)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 7); __PYX_ERR(0, 166, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_y); - if (value) { values[8] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 9: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box_z); - if (value) { values[9] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "drawTessellation") < 0)) __PYX_ERR(0, 166, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_xyz = ((PyArrayObject *)values[0]); - __pyx_v_points_to_draw = ((PyArrayObject *)values[1]); - __pyx_v_cylinder_radius = values[2]; - __pyx_v_triangles = values[3]; - __pyx_v_nmol = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_v_color_id = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_color_id == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) - __pyx_v_filename = values[6]; - __pyx_v_box_x = values[7]; - __pyx_v_box_y = values[8]; - __pyx_v_box_z = values[9]; + __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f'); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_n_s_fortran); + __pyx_t_1 = __pyx_n_s_fortran; + } else { + __Pyx_INCREF(__pyx_n_s_c); + __pyx_t_1 = __pyx_n_s_c; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 166, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.voro.drawTessellation", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 166, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_points_to_draw), __pyx_ptype_5numpy_ndarray, 1, "points_to_draw", 0))) __PYX_ERR(0, 167, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_4voro_10drawTessellation(__pyx_self, __pyx_v_xyz, __pyx_v_points_to_draw, __pyx_v_cylinder_radius, __pyx_v_triangles, __pyx_v_nmol, __pyx_v_color_id, __pyx_v_filename, __pyx_v_box_x, __pyx_v_box_y, __pyx_v_box_z); + __pyx_v_mode = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/voro/voro.pyx":166 - * delaunay_ts[c,iubq,j] = mindist + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. * - * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, - * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ + __pyx_t_2 = (__pyx_v_buf == NULL); + if (__pyx_t_2) { - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_11newanalysis_4voro_10drawTessellation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_points_to_draw, PyObject *__pyx_v_cylinder_radius, PyObject *__pyx_v_triangles, int __pyx_v_nmol, int __pyx_v_color_id, PyObject *__pyx_v_filename, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z) { - int __pyx_v_len_xyz; - int __pyx_v_len_points_to_draw; - PyObject *__pyx_v_py_byte_string = NULL; - const char *__pyx_v_fn; - double *__pyx_v_xyz_ptr; - int *__pyx_v_points_ptr; - int __pyx_v_draw_triangles; - double __pyx_v_radius; - float __pyx_v_boxl_x; - float __pyx_v_boxl_y; - float __pyx_v_boxl_z; - __Pyx_LocalBuf_ND __pyx_pybuffernd_points_to_draw; - __Pyx_Buffer __pyx_pybuffer_points_to_draw; - __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; - __Pyx_Buffer __pyx_pybuffer_xyz; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - const char *__pyx_t_4; - int __pyx_t_5; - double __pyx_t_6; - float __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("drawTessellation", 0); - __pyx_pybuffer_xyz.pybuffer.buf = NULL; - __pyx_pybuffer_xyz.refcount = 0; - __pyx_pybuffernd_xyz.data = NULL; - __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; - __pyx_pybuffer_points_to_draw.pybuffer.buf = NULL; - __pyx_pybuffer_points_to_draw.refcount = 0; - __pyx_pybuffernd_points_to_draw.data = NULL; - __pyx_pybuffernd_points_to_draw.rcbuffer = &__pyx_pybuffer_points_to_draw; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 166, __pyx_L1_error) - } - __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_points_to_draw.rcbuffer->pybuffer, (PyObject*)__pyx_v_points_to_draw, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 166, __pyx_L1_error) - } - __pyx_pybuffernd_points_to_draw.diminfo[0].strides = __pyx_pybuffernd_points_to_draw.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_points_to_draw.diminfo[0].shape = __pyx_pybuffernd_points_to_draw.rcbuffer->pybuffer.shape[0]; - - /* "src/voro/voro.pyx":173 - * """ + /* "View.MemoryView":273 * - * cdef int len_xyz = len(xyz), len_points_to_draw = len(points_to_draw) # <<<<<<<<<<<<<< - * py_byte_string = _ustring(filename).encode('UTF-8') - * cdef const_char* fn = py_byte_string + * if buf is NULL: + * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<< + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 173, __pyx_L1_error) - __pyx_v_len_xyz = __pyx_t_1; - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_points_to_draw)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 173, __pyx_L1_error) - __pyx_v_len_points_to_draw = __pyx_t_1; + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode)) __PYX_ERR(1, 273, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 273, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/voro/voro.pyx":174 + /* "View.MemoryView":272 + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. * - * cdef int len_xyz = len(xyz), len_points_to_draw = len(points_to_draw) - * py_byte_string = _ustring(filename).encode('UTF-8') # <<<<<<<<<<<<<< - * cdef const_char* fn = py_byte_string - * cdef double *xyz_ptr = xyz.data + * if buf is NULL: # <<<<<<<<<<<<<< + * result = array.__new__(array, shape, itemsize, format, mode) + * else: */ - __pyx_t_2 = __pyx_f_11newanalysis_4voro__ustring(__pyx_v_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__pyx_t_2 == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); - __PYX_ERR(0, 174, __pyx_L1_error) + goto __pyx_L3; } - __pyx_t_3 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_py_byte_string = __pyx_t_3; - __pyx_t_3 = 0; - - /* "src/voro/voro.pyx":175 - * cdef int len_xyz = len(xyz), len_points_to_draw = len(points_to_draw) - * py_byte_string = _ustring(filename).encode('UTF-8') - * cdef const_char* fn = py_byte_string # <<<<<<<<<<<<<< - * cdef double *xyz_ptr = xyz.data - * cdef int *points_ptr = points_to_draw.data - */ - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_py_byte_string); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error) - __pyx_v_fn = __pyx_t_4; - - /* "src/voro/voro.pyx":176 - * py_byte_string = _ustring(filename).encode('UTF-8') - * cdef const_char* fn = py_byte_string - * cdef double *xyz_ptr = xyz.data # <<<<<<<<<<<<<< - * cdef int *points_ptr = points_to_draw.data - * cdef bint draw_triangles = triangles - */ - __pyx_v_xyz_ptr = ((double *)__pyx_v_xyz->data); - - /* "src/voro/voro.pyx":177 - * cdef const_char* fn = py_byte_string - * cdef double *xyz_ptr = xyz.data - * cdef int *points_ptr = points_to_draw.data # <<<<<<<<<<<<<< - * cdef bint draw_triangles = triangles - * cdef double radius = cylinder_radius - */ - __pyx_v_points_ptr = ((int *)__pyx_v_points_to_draw->data); - - /* "src/voro/voro.pyx":178 - * cdef double *xyz_ptr = xyz.data - * cdef int *points_ptr = points_to_draw.data - * cdef bint draw_triangles = triangles # <<<<<<<<<<<<<< - * cdef double radius = cylinder_radius - * cdef float boxl_x, boxl_y, boxl_z - */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_triangles); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error) - __pyx_v_draw_triangles = __pyx_t_5; - /* "src/voro/voro.pyx":179 - * cdef int *points_ptr = points_to_draw.data - * cdef bint draw_triangles = triangles - * cdef double radius = cylinder_radius # <<<<<<<<<<<<<< - * cdef float boxl_x, boxl_y, boxl_z + /* "View.MemoryView":275 + * result = array.__new__(array, shape, itemsize, format, mode) + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<< + * result.data = buf * */ - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_cylinder_radius); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L1_error) - __pyx_v_radius = ((double)__pyx_t_6); + /*else*/ { + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_mode); + __Pyx_GIVEREF(__pyx_v_mode); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode)) __PYX_ERR(1, 275, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 275, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 275, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "src/voro/voro.pyx":182 - * cdef float boxl_x, boxl_y, boxl_z + /* "View.MemoryView":276 + * else: + * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) + * result.data = buf # <<<<<<<<<<<<<< * - * boxl_x = box_x # <<<<<<<<<<<<<< - * if box_y: - * boxl_y = box_y + * return result */ - __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_v_box_x); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error) - __pyx_v_boxl_x = ((float)__pyx_t_7); + __pyx_v_result->data = __pyx_v_buf; + } + __pyx_L3:; - /* "src/voro/voro.pyx":183 + /* "View.MemoryView":278 + * result.data = buf + * + * return result # <<<<<<<<<<<<<< + * * - * boxl_x = box_x - * if box_y: # <<<<<<<<<<<<<< - * boxl_y = box_y - * else: - */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_box_y); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 183, __pyx_L1_error) - if (__pyx_t_5) { - - /* "src/voro/voro.pyx":184 - * boxl_x = box_x - * if box_y: - * boxl_y = box_y # <<<<<<<<<<<<<< - * else: - * boxl_y = boxl_x */ - __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_v_box_y); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L1_error) - __pyx_v_boxl_y = ((float)__pyx_t_7); + __Pyx_XDECREF((PyObject *)__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "src/voro/voro.pyx":183 + /* "View.MemoryView":268 * - * boxl_x = box_x - * if box_y: # <<<<<<<<<<<<<< - * boxl_y = box_y - * else: + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< + * cdef array result + * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */ - goto __pyx_L3; - } - /* "src/voro/voro.pyx":186 - * boxl_y = box_y - * else: - * boxl_y = boxl_x # <<<<<<<<<<<<<< - * if box_z: - * boxl_z = box_z - */ - /*else*/ { - __pyx_v_boxl_y = __pyx_v_boxl_x; - } - __pyx_L3:; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_mode); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/voro/voro.pyx":187 - * else: - * boxl_y = boxl_x - * if box_z: # <<<<<<<<<<<<<< - * boxl_z = box_z - * else: - */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_box_z); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 187, __pyx_L1_error) - if (__pyx_t_5) { - - /* "src/voro/voro.pyx":188 - * boxl_y = boxl_x - * if box_z: - * boxl_z = box_z # <<<<<<<<<<<<<< - * else: - * boxl_z = boxl_x - */ - __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_v_box_z); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L1_error) - __pyx_v_boxl_z = ((float)__pyx_t_7); - - /* "src/voro/voro.pyx":187 - * else: - * boxl_y = boxl_x - * if box_z: # <<<<<<<<<<<<<< - * boxl_z = box_z - * else: - */ - goto __pyx_L4; - } - - /* "src/voro/voro.pyx":190 - * boxl_z = box_z - * else: - * boxl_z = boxl_x # <<<<<<<<<<<<<< - * - * _drawTessellation(xyz_ptr, boxl_x, boxl_y, boxl_z, len_xyz, points_ptr, len_points_to_draw, radius, draw_triangles, nmol, color_id, fn) - */ - /*else*/ { - __pyx_v_boxl_z = __pyx_v_boxl_x; - } - __pyx_L4:; - - /* "src/voro/voro.pyx":192 - * boxl_z = boxl_x - * - * _drawTessellation(xyz_ptr, boxl_x, boxl_y, boxl_z, len_xyz, points_ptr, len_points_to_draw, radius, draw_triangles, nmol, color_id, fn) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - _drawTessellation(__pyx_v_xyz_ptr, __pyx_v_boxl_x, __pyx_v_boxl_y, __pyx_v_boxl_z, __pyx_v_len_xyz, __pyx_v_points_ptr, __pyx_v_len_points_to_draw, __pyx_v_radius, __pyx_v_draw_triangles, __pyx_v_nmol, __pyx_v_color_id, __pyx_v_fn); - - /* "src/voro/voro.pyx":166 - * delaunay_ts[c,iubq,j] = mindist - * - * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, - * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_points_to_draw.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.voro.drawTessellation", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_points_to_draw.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XDECREF(__pyx_v_py_byte_string); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/voro/voro.pyx":195 - * - * @cython.boundscheck(False) - * def buildNeighborList(np.ndarray[np.int32_t,ndim=2] ds, # <<<<<<<<<<<<<< - * np.ndarray[np.int8_t,ndim=3] result, - * core_first, core_last, surr_first, surr_last, +/* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_4voro_13buildNeighborList(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_4voro_12buildNeighborList[] = "\n buildNeighborList(ds, result, core_first, core_last, surr_first, surr_last, ctr, minshell=1, maxshell=1)\n\n Add the delaunay distance matrix information from the current frame to a residence timeseries for later correlation.\n "; -static PyMethodDef __pyx_mdef_11newanalysis_4voro_13buildNeighborList = {"buildNeighborList", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_4voro_13buildNeighborList, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_12buildNeighborList}; -static PyObject *__pyx_pw_11newanalysis_4voro_13buildNeighborList(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_ds = 0; - PyArrayObject *__pyx_v_result = 0; - PyObject *__pyx_v_core_first = 0; - PyObject *__pyx_v_core_last = 0; - PyObject *__pyx_v_surr_first = 0; - PyObject *__pyx_v_surr_last = 0; - PyObject *__pyx_v_ctr = 0; - PyObject *__pyx_v_minshell = 0; - PyObject *__pyx_v_maxshell = 0; +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("buildNeighborList (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 304, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_result,&__pyx_n_s_core_first,&__pyx_n_s_core_last,&__pyx_n_s_surr_first,&__pyx_n_s_surr_last,&__pyx_n_s_ctr,&__pyx_n_s_minshell,&__pyx_n_s_maxshell,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - values[7] = ((PyObject *)__pyx_int_1); - values[8] = ((PyObject *)__pyx_int_1); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 1); __PYX_ERR(0, 195, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_core_first)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 2); __PYX_ERR(0, 195, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_core_last)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 3); __PYX_ERR(0, 195, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surr_first)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 4); __PYX_ERR(0, 195, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surr_last)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 5); __PYX_ERR(0, 195, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ctr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 6); __PYX_ERR(0, 195, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_minshell); - if (value) { values[7] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 8: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxshell); - if (value) { values[8] = value; kw_args--; } + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 304, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "buildNeighborList") < 0)) __PYX_ERR(0, 195, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 304, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } - __pyx_v_ds = ((PyArrayObject *)values[0]); - __pyx_v_result = ((PyArrayObject *)values[1]); - __pyx_v_core_first = values[2]; - __pyx_v_core_last = values[3]; - __pyx_v_surr_first = values[4]; - __pyx_v_surr_last = values[5]; - __pyx_v_ctr = values[6]; - __pyx_v_minshell = values[7]; - __pyx_v_maxshell = values[8]; + __pyx_v_name = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 195, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 304, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.voro.buildNeighborList", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ds), __pyx_ptype_5numpy_ndarray, 1, "ds", 0))) __PYX_ERR(0, 195, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_5numpy_ndarray, 1, "result", 0))) __PYX_ERR(0, 196, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_4voro_12buildNeighborList(__pyx_self, __pyx_v_ds, __pyx_v_result, __pyx_v_core_first, __pyx_v_core_last, __pyx_v_surr_first, __pyx_v_surr_last, __pyx_v_ctr, __pyx_v_minshell, __pyx_v_maxshell); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_4voro_12buildNeighborList(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_first, PyObject *__pyx_v_core_last, PyObject *__pyx_v_surr_first, PyObject *__pyx_v_surr_last, PyObject *__pyx_v_ctr, PyObject *__pyx_v_minshell, PyObject *__pyx_v_maxshell) { - int __pyx_v_ncore; - int __pyx_v_nsurr; - int __pyx_v_n2; - int __pyx_v_ntot; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int *__pyx_v_cds; - __pyx_t_5numpy_int8_t *__pyx_v_cres; - CYTHON_UNUSED int __pyx_v_c1; - CYTHON_UNUSED int __pyx_v_c2; - int __pyx_v_s1; - int __pyx_v_s2; - int __pyx_v_lower_limit; - int __pyx_v_upper_limit; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ds; - __Pyx_Buffer __pyx_pybuffer_ds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_result; - __Pyx_Buffer __pyx_pybuffer_result; - PyObject *__pyx_r = NULL; +static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("buildNeighborList", 0); - __pyx_pybuffer_ds.pybuffer.buf = NULL; - __pyx_pybuffer_ds.refcount = 0; - __pyx_pybuffernd_ds.data = NULL; - __pyx_pybuffernd_ds.rcbuffer = &__pyx_pybuffer_ds; - __pyx_pybuffer_result.pybuffer.buf = NULL; - __pyx_pybuffer_result.refcount = 0; - __pyx_pybuffernd_result.data = NULL; - __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ds.rcbuffer->pybuffer, (PyObject*)__pyx_v_ds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error) - } - __pyx_pybuffernd_ds.diminfo[0].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ds.diminfo[0].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ds.diminfo[1].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ds.diminfo[1].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error) - } - __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_result.diminfo[1].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_result.diminfo[1].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_result.diminfo[2].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_result.diminfo[2].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[2]; + __Pyx_RefNannySetupContext("__init__", 0); - /* "src/voro/voro.pyx":205 - * """ - * - * cdef int ncore = result.shape[1] # <<<<<<<<<<<<<< - * cdef int nsurr = result.shape[2] - * cdef int n2 = ncore * nsurr + /* "View.MemoryView":305 + * cdef object name + * def __init__(self, name): + * self.name = name # <<<<<<<<<<<<<< + * def __repr__(self): + * return self.name */ - __pyx_v_ncore = (__pyx_v_result->dimensions[1]); + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->name); + __Pyx_DECREF(__pyx_v_self->name); + __pyx_v_self->name = __pyx_v_name; - /* "src/voro/voro.pyx":206 - * - * cdef int ncore = result.shape[1] - * cdef int nsurr = result.shape[2] # <<<<<<<<<<<<<< - * cdef int n2 = ncore * nsurr - * cdef int ntot = ds.shape[0] + /* "View.MemoryView":304 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): */ - __pyx_v_nsurr = (__pyx_v_result->dimensions[2]); - /* "src/voro/voro.pyx":207 - * cdef int ncore = result.shape[1] - * cdef int nsurr = result.shape[2] - * cdef int n2 = ncore * nsurr # <<<<<<<<<<<<<< - * cdef int ntot = ds.shape[0] - * cdef int i, j, k = ctr - */ - __pyx_v_n2 = (__pyx_v_ncore * __pyx_v_nsurr); + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/voro/voro.pyx":208 - * cdef int nsurr = result.shape[2] - * cdef int n2 = ncore * nsurr - * cdef int ntot = ds.shape[0] # <<<<<<<<<<<<<< - * cdef int i, j, k = ctr - * cdef int *cds = ds.data - */ - __pyx_v_ntot = (__pyx_v_ds->dimensions[0]); - - /* "src/voro/voro.pyx":209 - * cdef int n2 = ncore * nsurr - * cdef int ntot = ds.shape[0] - * cdef int i, j, k = ctr # <<<<<<<<<<<<<< - * cdef int *cds = ds.data - * cdef np.int8_t* cres = result.data - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_ctr); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error) - __pyx_v_k = __pyx_t_1; - - /* "src/voro/voro.pyx":210 - * cdef int ntot = ds.shape[0] - * cdef int i, j, k = ctr - * cdef int *cds = ds.data # <<<<<<<<<<<<<< - * cdef np.int8_t* cres = result.data - * cdef int c1 = core_first, c2 = core_last, s1=surr_first, s2=surr_last - */ - __pyx_v_cds = ((int *)__pyx_v_ds->data); - - /* "src/voro/voro.pyx":211 - * cdef int i, j, k = ctr - * cdef int *cds = ds.data - * cdef np.int8_t* cres = result.data # <<<<<<<<<<<<<< - * cdef int c1 = core_first, c2 = core_last, s1=surr_first, s2=surr_last - * cdef int lower_limit = minshell, upper_limit = maxshell - */ - __pyx_v_cres = ((__pyx_t_5numpy_int8_t *)__pyx_v_result->data); - - /* "src/voro/voro.pyx":212 - * cdef int *cds = ds.data - * cdef np.int8_t* cres = result.data - * cdef int c1 = core_first, c2 = core_last, s1=surr_first, s2=surr_last # <<<<<<<<<<<<<< - * cdef int lower_limit = minshell, upper_limit = maxshell - * - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_core_first); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) - __pyx_v_c1 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_core_last); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) - __pyx_v_c2 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_surr_first); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) - __pyx_v_s1 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_surr_last); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) - __pyx_v_s2 = __pyx_t_1; - - /* "src/voro/voro.pyx":213 - * cdef np.int8_t* cres = result.data - * cdef int c1 = core_first, c2 = core_last, s1=surr_first, s2=surr_last - * cdef int lower_limit = minshell, upper_limit = maxshell # <<<<<<<<<<<<<< - * - * for i in prange(c1,c2,nogil=True): - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_minshell); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L1_error) - __pyx_v_lower_limit = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L1_error) - __pyx_v_upper_limit = __pyx_t_1; - - /* "src/voro/voro.pyx":215 - * cdef int lower_limit = minshell, upper_limit = maxshell - * - * for i in prange(c1,c2,nogil=True): # <<<<<<<<<<<<<< - * for j in range(s1,s2): - * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - __pyx_t_1 = __pyx_v_c1; - __pyx_t_2 = __pyx_v_c2; - if ((1 == 0)) abort(); - { - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) (x) - #define unlikely(x) (x) - #endif - __pyx_t_4 = (__pyx_t_2 - __pyx_t_1 + 1 - 1/abs(1)) / 1; - if (__pyx_t_4 > 0) - { - #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) - #endif /* _OPENMP */ - { - #ifdef _OPENMP - #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) - #endif /* _OPENMP */ - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3++){ - { - __pyx_v_i = (int)(__pyx_t_1 + 1 * __pyx_t_3); - /* Initialize private variables to invalid values */ - __pyx_v_j = ((int)0xbad0bad0); - - /* "src/voro/voro.pyx":216 +/* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name * - * for i in prange(c1,c2,nogil=True): - * for j in range(s1,s2): # <<<<<<<<<<<<<< - * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: - * cres[k*n2+i*ncore+j] = 1 */ - __pyx_t_5 = __pyx_v_s2; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = __pyx_v_s1; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_j = __pyx_t_7; - /* "src/voro/voro.pyx":217 - * for i in prange(c1,c2,nogil=True): - * for j in range(s1,s2): - * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: # <<<<<<<<<<<<<< - * cres[k*n2+i*ncore+j] = 1 - * - */ - __pyx_t_9 = (((__pyx_v_cds[((__pyx_v_i * __pyx_v_ntot) + __pyx_v_j)]) >= __pyx_v_lower_limit) != 0); - if (__pyx_t_9) { - } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L13_bool_binop_done; - } - __pyx_t_9 = (((__pyx_v_cds[((__pyx_v_i * __pyx_v_ntot) + __pyx_v_j)]) <= __pyx_v_upper_limit) != 0); - __pyx_t_8 = __pyx_t_9; - __pyx_L13_bool_binop_done:; - if (__pyx_t_8) { +/* Python wrapper */ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); - /* "src/voro/voro.pyx":218 - * for j in range(s1,s2): - * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: - * cres[k*n2+i*ncore+j] = 1 # <<<<<<<<<<<<<< - * - * def calcCN(np.ndarray[np.int32_t,ndim=2] ds, - */ - (__pyx_v_cres[(((__pyx_v_k * __pyx_v_n2) + (__pyx_v_i * __pyx_v_ncore)) + __pyx_v_j)]) = ((__pyx_t_5numpy_int8_t)1); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/voro/voro.pyx":217 - * for i in prange(c1,c2,nogil=True): - * for j in range(s1,s2): - * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: # <<<<<<<<<<<<<< - * cres[k*n2+i*ncore+j] = 1 - * - */ - } - } - } - } - } - } - } - #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) - #undef likely - #undef unlikely - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) - #endif - } +static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/voro/voro.pyx":215 - * cdef int lower_limit = minshell, upper_limit = maxshell + /* "View.MemoryView":307 + * self.name = name + * def __repr__(self): + * return self.name # <<<<<<<<<<<<<< * - * for i in prange(c1,c2,nogil=True): # <<<<<<<<<<<<<< - * for j in range(s1,s2): - * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: + * cdef generic = Enum("") */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->name); + __pyx_r = __pyx_v_self->name; + goto __pyx_L0; - /* "src/voro/voro.pyx":195 + /* "View.MemoryView":306 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name * - * @cython.boundscheck(False) - * def buildNeighborList(np.ndarray[np.int32_t,ndim=2] ds, # <<<<<<<<<<<<<< - * np.ndarray[np.int8_t,ndim=3] result, - * core_first, core_last, surr_first, surr_last, */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.voro.buildNeighborList", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); - __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/voro/voro.pyx":220 - * cres[k*n2+i*ncore+j] = 1 - * - * def calcCN(np.ndarray[np.int32_t,ndim=2] ds, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] result, - * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_4voro_15calcCN(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_4voro_14calcCN[] = "\n calcCN(ds,result,core_begin,core_end,surr_begin,surr_end,shell_begin,shell_end,ntot)\n\n Calculates the coordination number between two selections and adds the found value to a histogram.\n \n Args:\n ds .. delaunay distance matrix of the whole system\n result .. result histogram\n core_begin .. first residue number of the core selection\n core_end .. last residue number of the core selection\n surr_begin .. first residue number of the surround selection\n surr_end .. last residue number of the surround selection\n shell_begin .. lowest delaunay distance to consider\n shell_end .. highest delaunay distance to consider\n ntot .. total number of residues in the system (the number of columns in the ds matrix)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_4voro_15calcCN = {"calcCN", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_4voro_15calcCN, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_14calcCN}; -static PyObject *__pyx_pw_11newanalysis_4voro_15calcCN(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_ds = 0; - PyArrayObject *__pyx_v_result = 0; - PyObject *__pyx_v_core_begin = 0; - PyObject *__pyx_v_core_end = 0; - PyObject *__pyx_v_surr_begin = 0; - PyObject *__pyx_v_surr_end = 0; - PyObject *__pyx_v_shell_begin = 0; - PyObject *__pyx_v_shell_end = 0; - PyObject *__pyx_v_ntot = 0; +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcCN (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_result,&__pyx_n_s_core_begin,&__pyx_n_s_core_end,&__pyx_n_s_surr_begin,&__pyx_n_s_surr_end,&__pyx_n_s_shell_begin,&__pyx_n_s_shell_end,&__pyx_n_s_ntot,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 1); __PYX_ERR(0, 220, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_core_begin)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 2); __PYX_ERR(0, 220, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_core_end)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 3); __PYX_ERR(0, 220, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surr_begin)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 4); __PYX_ERR(0, 220, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surr_end)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 5); __PYX_ERR(0, 220, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shell_begin)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 6); __PYX_ERR(0, 220, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shell_end)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 7); __PYX_ERR(0, 220, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ntot)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 8); __PYX_ERR(0, 220, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcCN") < 0)) __PYX_ERR(0, 220, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - } - __pyx_v_ds = ((PyArrayObject *)values[0]); - __pyx_v_result = ((PyArrayObject *)values[1]); - __pyx_v_core_begin = values[2]; - __pyx_v_core_end = values[3]; - __pyx_v_surr_begin = values[4]; - __pyx_v_surr_end = values[5]; - __pyx_v_shell_begin = values[6]; - __pyx_v_shell_end = values[7]; - __pyx_v_ntot = values[8]; - } + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 220, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.voro.calcCN", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ds), __pyx_ptype_5numpy_ndarray, 1, "ds", 0))) __PYX_ERR(0, 220, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_5numpy_ndarray, 1, "result", 0))) __PYX_ERR(0, 221, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_4voro_14calcCN(__pyx_self, __pyx_v_ds, __pyx_v_result, __pyx_v_core_begin, __pyx_v_core_end, __pyx_v_surr_begin, __pyx_v_surr_end, __pyx_v_shell_begin, __pyx_v_shell_end, __pyx_v_ntot); + __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_4voro_14calcCN(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_begin, PyObject *__pyx_v_core_end, PyObject *__pyx_v_surr_begin, PyObject *__pyx_v_surr_end, PyObject *__pyx_v_shell_begin, PyObject *__pyx_v_shell_end, PyObject *__pyx_v_ntot) { - int __pyx_v_c1; - int __pyx_v_c2; - int __pyx_v_s1; - int __pyx_v_s2; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_sh1; - int __pyx_v_sh2; - int __pyx_v_n; - int *__pyx_v_cds; - double *__pyx_v_cres; - int __pyx_v_ctr; - int __pyx_v_nmax; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ds; - __Pyx_Buffer __pyx_pybuffer_ds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_result; - __Pyx_Buffer __pyx_pybuffer_result; +static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - long __pyx_t_5; - long __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcCN", 0); - __pyx_pybuffer_ds.pybuffer.buf = NULL; - __pyx_pybuffer_ds.refcount = 0; - __pyx_pybuffernd_ds.data = NULL; - __pyx_pybuffernd_ds.rcbuffer = &__pyx_pybuffer_ds; - __pyx_pybuffer_result.pybuffer.buf = NULL; - __pyx_pybuffer_result.refcount = 0; - __pyx_pybuffernd_result.data = NULL; - __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ds.rcbuffer->pybuffer, (PyObject*)__pyx_v_ds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 220, __pyx_L1_error) - } - __pyx_pybuffernd_ds.diminfo[0].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ds.diminfo[0].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ds.diminfo[1].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ds.diminfo[1].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 220, __pyx_L1_error) - } - __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "src/voro/voro.pyx":241 - * """ - * - * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot # <<<<<<<<<<<<<< - * cdef int *cds = ds.data - * cdef double *cres = result.data + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = (self.name,) # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_core_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) - __pyx_v_c1 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_core_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) - __pyx_v_c2 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_surr_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) - __pyx_v_s1 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_surr_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) - __pyx_v_s2 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_shell_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) - __pyx_v_sh1 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_shell_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) - __pyx_v_sh2 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_ntot); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) - __pyx_v_n = __pyx_t_1; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->name); + __Pyx_GIVEREF(__pyx_v_self->name); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/voro/voro.pyx":242 - * - * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot - * cdef int *cds = ds.data # <<<<<<<<<<<<<< - * cdef double *cres = result.data - * cdef int ctr, nmax=len(result) + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) */ - __pyx_v_cds = ((int *)__pyx_v_ds->data); + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/voro/voro.pyx":243 - * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot - * cdef int *cds = ds.data - * cdef double *cres = result.data # <<<<<<<<<<<<<< - * cdef int ctr, nmax=len(result) - * + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - __pyx_v_cres = ((double *)__pyx_v_result->data); + __pyx_t_2 = (__pyx_v__dict != Py_None); + if (__pyx_t_2) { - /* "src/voro/voro.pyx":244 - * cdef int *cds = ds.data - * cdef double *cres = result.data - * cdef int ctr, nmax=len(result) # <<<<<<<<<<<<<< - * - * # e.g. c1=0, c2=499 + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: */ - __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 244, __pyx_L1_error) - __pyx_v_nmax = __pyx_t_2; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict)) __PYX_ERR(1, 8, __pyx_L1_error); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "src/voro/voro.pyx":247 - * - * # e.g. c1=0, c2=499 - * for i in range(c1,c2+1): # <<<<<<<<<<<<<< - * ctr=0 - * for j in range(s1,s2+1): + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = self.name is not None */ - __pyx_t_3 = (__pyx_v_c2 + 1); - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_1 = __pyx_v_c1; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; + __pyx_v_use_setstate = 1; - /* "src/voro/voro.pyx":248 - * # e.g. c1=0, c2=499 - * for i in range(c1,c2+1): - * ctr=0 # <<<<<<<<<<<<<< - * for j in range(s1,s2+1): - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: + /* "(tree fragment)":7 + * state = (self.name,) + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True */ - __pyx_v_ctr = 0; + goto __pyx_L3; + } - /* "src/voro/voro.pyx":249 - * for i in range(c1,c2+1): - * ctr=0 - * for j in range(s1,s2+1): # <<<<<<<<<<<<<< - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: - * ctr+=1 + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = self.name is not None # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state */ - __pyx_t_5 = (__pyx_v_s2 + 1); - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = __pyx_v_s1; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_j = __pyx_t_7; + /*else*/ { + __pyx_t_2 = (__pyx_v_self->name != Py_None); + __pyx_v_use_setstate = __pyx_t_2; + } + __pyx_L3:; - /* "src/voro/voro.pyx":250 - * ctr=0 - * for j in range(s1,s2+1): - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: # <<<<<<<<<<<<<< - * ctr+=1 - * if ctr >= nmax: + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: */ - __pyx_t_9 = (((__pyx_v_cds[((__pyx_v_i * __pyx_v_n) + __pyx_v_j)]) >= __pyx_v_sh1) != 0); - if (__pyx_t_9) { - } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_9 = (((__pyx_v_cds[((__pyx_v_i * __pyx_v_n) + __pyx_v_j)]) <= __pyx_v_sh2) != 0); - __pyx_t_8 = __pyx_t_9; - __pyx_L8_bool_binop_done:; - if (__pyx_t_8) { + if (__pyx_v_use_setstate) { - /* "src/voro/voro.pyx":251 - * for j in range(s1,s2+1): - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: - * ctr+=1 # <<<<<<<<<<<<<< - * if ctr >= nmax: - * print "Result array is too short!\n" + /* "(tree fragment)":13 + * use_setstate = self.name is not None + * if use_setstate: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) */ - __pyx_v_ctr = (__pyx_v_ctr + 1); + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state)) __PYX_ERR(1, 13, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "src/voro/voro.pyx":250 - * ctr=0 - * for j in range(s1,s2+1): - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: # <<<<<<<<<<<<<< - * ctr+=1 - * if ctr >= nmax: - */ - } - } + /* "(tree fragment)":12 + * else: + * use_setstate = self.name is not None + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + */ + } - /* "src/voro/voro.pyx":252 - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: - * ctr+=1 - * if ctr >= nmax: # <<<<<<<<<<<<<< - * print "Result array is too short!\n" - * else: + /* "(tree fragment)":15 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ - __pyx_t_8 = ((__pyx_v_ctr >= __pyx_v_nmax) != 0); - if (__pyx_t_8) { + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_136983863); + __Pyx_GIVEREF(__pyx_int_136983863); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } - /* "src/voro/voro.pyx":253 - * ctr+=1 - * if ctr >= nmax: - * print "Result array is too short!\n" # <<<<<<<<<<<<<< - * else: - * cres[ctr]+=1 + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Result_array_is_too_short) < 0) __PYX_ERR(0, 253, __pyx_L1_error) - /* "src/voro/voro.pyx":252 - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: - * ctr+=1 - * if ctr >= nmax: # <<<<<<<<<<<<<< - * print "Result array is too short!\n" - * else: + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ - goto __pyx_L10; + +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 16, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } + } + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state); - /* "src/voro/voro.pyx":255 - * print "Result array is too short!\n" - * else: - * cres[ctr]+=1 # <<<<<<<<<<<<<< - * - * def calcCN_int8(np.ndarray[np.int8_t,ndim=2] ds, - */ - /*else*/ { - __pyx_t_7 = __pyx_v_ctr; - (__pyx_v_cres[__pyx_t_7]) = ((__pyx_v_cres[__pyx_t_7]) + 1.0); + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } - __pyx_L10:; } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/voro/voro.pyx":220 - * cres[k*n2+i*ncore+j] = 1 - * - * def calcCN(np.ndarray[np.int32_t,ndim=2] ds, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] result, - * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): +static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state(self, __pyx_state) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.voro.calcCN", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); - __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/voro/voro.pyx":257 - * cres[ctr]+=1 +/* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo * - * def calcCN_int8(np.ndarray[np.int8_t,ndim=2] ds, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] result, - * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ /* Python wrapper */ -static PyObject *__pyx_pw_11newanalysis_4voro_17calcCN_int8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_11newanalysis_4voro_16calcCN_int8[] = "\n calcCN(ds,result,core_begin,core_end,surr_begin,surr_end,shell_begin,shell_end,ntot)\n\n Calculates the coordination number between two selections and adds the found value to a histogram.\n \n Args:\n ds .. delaunay distance matrix of the whole system\n result .. result histogram\n core_begin .. first residue number of the core selection\n core_end .. last residue number of the core selection\n surr_begin .. first residue number of the surround selection\n surr_end .. last residue number of the surround selection\n shell_begin .. lowest delaunay distance to consider\n shell_end .. highest delaunay distance to consider\n ntot .. total number of residues in the system (the number of columns in the ds matrix)\n "; -static PyMethodDef __pyx_mdef_11newanalysis_4voro_17calcCN_int8 = {"calcCN_int8", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11newanalysis_4voro_17calcCN_int8, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_16calcCN_int8}; -static PyObject *__pyx_pw_11newanalysis_4voro_17calcCN_int8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_ds = 0; - PyArrayObject *__pyx_v_result = 0; - PyObject *__pyx_v_core_begin = 0; - PyObject *__pyx_v_core_end = 0; - PyObject *__pyx_v_surr_begin = 0; - PyObject *__pyx_v_surr_end = 0; - PyObject *__pyx_v_shell_begin = 0; - PyObject *__pyx_v_shell_end = 0; - PyObject *__pyx_v_ntot = 0; +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + int __pyx_v_flags; + int __pyx_v_dtype_is_object; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calcCN_int8 (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 349, __pyx_L3_error) + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_result,&__pyx_n_s_core_begin,&__pyx_n_s_core_end,&__pyx_n_s_surr_begin,&__pyx_n_s_surr_end,&__pyx_n_s_shell_begin,&__pyx_n_s_shell_end,&__pyx_n_s_ntot,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ds)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_result)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 1); __PYX_ERR(0, 257, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_core_begin)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 2); __PYX_ERR(0, 257, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_core_end)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 3); __PYX_ERR(0, 257, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surr_begin)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 4); __PYX_ERR(0, 257, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 5: - if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surr_end)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 5); __PYX_ERR(0, 257, __pyx_L3_error) + if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[1]); + kw_args--; } - CYTHON_FALLTHROUGH; - case 6: - if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shell_begin)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 6); __PYX_ERR(0, 257, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 7: - if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shell_end)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 7); __PYX_ERR(0, 257, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 349, __pyx_L3_error) } CYTHON_FALLTHROUGH; - case 8: - if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ntot)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 8); __PYX_ERR(0, 257, __pyx_L3_error) + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype_is_object); + if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calcCN_int8") < 0)) __PYX_ERR(0, 257, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(1, 349, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_obj = values[0]; + __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + if (values[2]) { + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 349, __pyx_L3_error) + } else { + __pyx_v_dtype_is_object = ((int)0); } - __pyx_v_ds = ((PyArrayObject *)values[0]); - __pyx_v_result = ((PyArrayObject *)values[1]); - __pyx_v_core_begin = values[2]; - __pyx_v_core_end = values[3]; - __pyx_v_surr_begin = values[4]; - __pyx_v_surr_end = values[5]; - __pyx_v_shell_begin = values[6]; - __pyx_v_shell_end = values[7]; - __pyx_v_ntot = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 257, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(1, 349, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("newanalysis.voro.calcCN_int8", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ds), __pyx_ptype_5numpy_ndarray, 1, "ds", 0))) __PYX_ERR(0, 257, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_5numpy_ndarray, 1, "result", 0))) __PYX_ERR(0, 258, __pyx_L1_error) - __pyx_r = __pyx_pf_11newanalysis_4voro_16calcCN_int8(__pyx_self, __pyx_v_ds, __pyx_v_result, __pyx_v_core_begin, __pyx_v_core_end, __pyx_v_surr_begin, __pyx_v_surr_end, __pyx_v_shell_begin, __pyx_v_shell_end, __pyx_v_ntot); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_11newanalysis_4voro_16calcCN_int8(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_begin, PyObject *__pyx_v_core_end, PyObject *__pyx_v_surr_begin, PyObject *__pyx_v_surr_end, PyObject *__pyx_v_shell_begin, PyObject *__pyx_v_shell_end, PyObject *__pyx_v_ntot) { - int __pyx_v_c1; - int __pyx_v_c2; - int __pyx_v_s1; - int __pyx_v_s2; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_sh1; - int __pyx_v_sh2; - int __pyx_v_n; - char *__pyx_v_cds; - double *__pyx_v_cres; - int __pyx_v_ctr; - int __pyx_v_nmax; - __Pyx_LocalBuf_ND __pyx_pybuffernd_ds; - __Pyx_Buffer __pyx_pybuffer_ds; - __Pyx_LocalBuf_ND __pyx_pybuffernd_result; - __Pyx_Buffer __pyx_pybuffer_result; - PyObject *__pyx_r = NULL; +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - Py_ssize_t __pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - long __pyx_t_5; - long __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; + int __pyx_t_2; + int __pyx_t_3; + Py_intptr_t __pyx_t_4; + size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("calcCN_int8", 0); - __pyx_pybuffer_ds.pybuffer.buf = NULL; - __pyx_pybuffer_ds.refcount = 0; - __pyx_pybuffernd_ds.data = NULL; - __pyx_pybuffernd_ds.rcbuffer = &__pyx_pybuffer_ds; - __pyx_pybuffer_result.pybuffer.buf = NULL; - __pyx_pybuffer_result.refcount = 0; - __pyx_pybuffernd_result.data = NULL; - __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ds.rcbuffer->pybuffer, (PyObject*)__pyx_v_ds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 257, __pyx_L1_error) - } - __pyx_pybuffernd_ds.diminfo[0].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ds.diminfo[0].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ds.diminfo[1].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ds.diminfo[1].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[1]; - { - __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 257, __pyx_L1_error) - } - __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "src/voro/voro.pyx":278 - * """ + /* "View.MemoryView":350 * - * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot # <<<<<<<<<<<<<< - * cdef char *cds = ds.data - * cdef double *cres = result.data + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj # <<<<<<<<<<<<<< + * self.flags = flags + * if type(self) is memoryview or obj is not None: */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_core_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) - __pyx_v_c1 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_core_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) - __pyx_v_c2 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_surr_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) - __pyx_v_s1 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_surr_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) - __pyx_v_s2 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_shell_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) - __pyx_v_sh1 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_shell_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) - __pyx_v_sh2 = __pyx_t_1; - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_ntot); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) - __pyx_v_n = __pyx_t_1; + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + __Pyx_GOTREF(__pyx_v_self->obj); + __Pyx_DECREF(__pyx_v_self->obj); + __pyx_v_self->obj = __pyx_v_obj; - /* "src/voro/voro.pyx":279 - * - * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot - * cdef char *cds = ds.data # <<<<<<<<<<<<<< - * cdef double *cres = result.data - * cdef int ctr, nmax=len(result) + /* "View.MemoryView":351 + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): + * self.obj = obj + * self.flags = flags # <<<<<<<<<<<<<< + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) */ - __pyx_v_cds = ((char *)__pyx_v_ds->data); + __pyx_v_self->flags = __pyx_v_flags; - /* "src/voro/voro.pyx":280 - * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot - * cdef char *cds = ds.data - * cdef double *cres = result.data # <<<<<<<<<<<<<< - * cdef int ctr, nmax=len(result) - * + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ - __pyx_v_cres = ((double *)__pyx_v_result->data); + __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_obj != Py_None); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/voro/voro.pyx":281 - * cdef char *cds = ds.data - * cdef double *cres = result.data - * cdef int ctr, nmax=len(result) # <<<<<<<<<<<<<< - * - * # e.g. c1=0, c2=499 + /* "View.MemoryView":353 + * self.flags = flags + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + */ + __pyx_t_3 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 353, __pyx_L1_error) + + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) */ - __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 281, __pyx_L1_error) - __pyx_v_nmax = __pyx_t_2; + __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL); + if (__pyx_t_1) { - /* "src/voro/voro.pyx":284 + /* "View.MemoryView":355 + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) * - * # e.g. c1=0, c2=499 - * for i in range(c1,c2+1): # <<<<<<<<<<<<<< - * ctr=0 - * for j in range(s1,s2+1): */ - __pyx_t_3 = (__pyx_v_c2 + 1); - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_1 = __pyx_v_c1; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; + ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - /* "src/voro/voro.pyx":285 - * # e.g. c1=0, c2=499 - * for i in range(c1,c2+1): - * ctr=0 # <<<<<<<<<<<<<< - * for j in range(s1,s2+1): - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: + /* "View.MemoryView":356 + * if self.view.obj == NULL: + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): */ - __pyx_v_ctr = 0; + Py_INCREF(Py_None); - /* "src/voro/voro.pyx":286 - * for i in range(c1,c2+1): - * ctr=0 - * for j in range(s1,s2+1): # <<<<<<<<<<<<<< - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: - * ctr+=1 + /* "View.MemoryView":354 + * if type(self) is memoryview or obj is not None: + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = Py_None + * Py_INCREF(Py_None) */ - __pyx_t_5 = (__pyx_v_s2 + 1); - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = __pyx_v_s1; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_j = __pyx_t_7; + } - /* "src/voro/voro.pyx":287 - * ctr=0 - * for j in range(s1,s2+1): - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: # <<<<<<<<<<<<<< - * ctr+=1 - * if ctr >= nmax: + /* "View.MemoryView":352 + * self.obj = obj + * self.flags = flags + * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< + * __Pyx_GetBuffer(obj, &self.view, flags) + * if self.view.obj == NULL: */ - __pyx_t_9 = (((__pyx_v_cds[((__pyx_v_i * __pyx_v_n) + __pyx_v_j)]) >= __pyx_v_sh1) != 0); - if (__pyx_t_9) { - } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_9 = (((__pyx_v_cds[((__pyx_v_i * __pyx_v_n) + __pyx_v_j)]) <= __pyx_v_sh2) != 0); - __pyx_t_8 = __pyx_t_9; - __pyx_L8_bool_binop_done:; - if (__pyx_t_8) { + } - /* "src/voro/voro.pyx":288 - * for j in range(s1,s2+1): - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: - * ctr+=1 # <<<<<<<<<<<<<< - * if ctr >= nmax: - * print "Result array is too short!\n" + /* "View.MemoryView":358 + * Py_INCREF(Py_None) + * + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: */ - __pyx_v_ctr = (__pyx_v_ctr + 1); + __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED()); + if (__pyx_t_1) { - /* "src/voro/voro.pyx":287 - * ctr=0 - * for j in range(s1,s2+1): - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: # <<<<<<<<<<<<<< - * ctr+=1 - * if ctr >= nmax: + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 */ - } - } + __pyx_t_1 = (__pyx_memoryview_thread_locks_used < 8); + if (__pyx_t_1) { - /* "src/voro/voro.pyx":289 - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: - * ctr+=1 - * if ctr >= nmax: # <<<<<<<<<<<<<< - * print "Result array is too short!\n" - * else: + /* "View.MemoryView":361 + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: */ - __pyx_t_8 = ((__pyx_v_ctr >= __pyx_v_nmax) != 0); - if (__pyx_t_8) { + __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - /* "src/voro/voro.pyx":290 - * ctr+=1 - * if ctr >= nmax: - * print "Result array is too short!\n" # <<<<<<<<<<<<<< - * else: - * cres[ctr]+=1 + /* "View.MemoryView":362 + * if __pyx_memoryview_thread_locks_used < 8: + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Result_array_is_too_short) < 0) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); - /* "src/voro/voro.pyx":289 - * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: - * ctr+=1 - * if ctr >= nmax: # <<<<<<<<<<<<<< - * print "Result array is too short!\n" - * else: + /* "View.MemoryView":360 + * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<< + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 */ - goto __pyx_L10; } - /* "src/voro/voro.pyx":292 - * print "Result array is too short!\n" - * else: - * cres[ctr]+=1 # <<<<<<<<<<<<<< - * + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: */ - /*else*/ { - __pyx_t_7 = __pyx_v_ctr; - (__pyx_v_cres[__pyx_t_7]) = ((__pyx_v_cres[__pyx_t_7]) + 1.0); - } - __pyx_L10:; - } + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (__pyx_t_1) { - /* "src/voro/voro.pyx":257 - * cres[ctr]+=1 - * - * def calcCN_int8(np.ndarray[np.int8_t,ndim=2] ds, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] result, - * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): + /* "View.MemoryView":364 + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< + * if self.lock is NULL: + * raise MemoryError */ + __pyx_v_self->lock = PyThread_allocate_lock(); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); - __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("newanalysis.voro.calcCN_int8", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - goto __pyx_L2; - __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); - __pyx_L2:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * + */ + __pyx_t_1 = (__pyx_v_self->lock == NULL); + if (unlikely(__pyx_t_1)) { -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t + /* "View.MemoryView":366 + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + * raise MemoryError # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) + * if flags & PyBUF_FORMAT: + */ + PyErr_NoMemory(); __PYX_ERR(1, 366, __pyx_L1_error) + + /* "View.MemoryView":365 + * if self.lock is NULL: + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: # <<<<<<<<<<<<<< + * raise MemoryError * */ + } -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + /* "View.MemoryView":363 + * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] + * __pyx_memoryview_thread_locks_used += 1 + * if self.lock is NULL: # <<<<<<<<<<<<<< + * self.lock = PyThread_allocate_lock() + * if self.lock is NULL: + */ + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":735 + /* "View.MemoryView":358 + * Py_INCREF(Py_None) * - * cdef inline object PyArray_MultiIterNew1(a): - * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< + * global __pyx_memoryview_thread_locks_used + * if __pyx_memoryview_thread_locks_used < 8: + */ + } + + /* "View.MemoryView":368 + * raise MemoryError * - * cdef inline object PyArray_MultiIterNew2(a, b): + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":734 - * ctypedef npy_cdouble complex_t + /* "View.MemoryView":369 * - * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(1, a) + * if flags & PyBUF_FORMAT: + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< + * else: + * self.dtype_is_object = dtype_is_object + */ + __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O'); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L12_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00'); + __pyx_t_1 = __pyx_t_2; + __pyx_L12_bool_binop_done:; + __pyx_v_self->dtype_is_object = __pyx_t_1; + + /* "View.MemoryView":368 + * raise MemoryError * + * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: */ + goto __pyx_L11; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":371 + * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') + * else: + * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + * + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + */ + /*else*/ { + __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; + } + __pyx_L11:; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) + /* "View.MemoryView":373 + * self.dtype_is_object = dtype_is_object * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<< + * self.typeinfo = NULL * */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count))); + __pyx_t_5 = (sizeof(__pyx_atomic_int_type)); + if (unlikely(__pyx_t_5 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 373, __pyx_L1_error) + } + __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 373, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 373, __pyx_L1_error) + #endif -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":738 + /* "View.MemoryView":374 * - * cdef inline object PyArray_MultiIterNew2(a, b): - * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 + * self.typeinfo = NULL # <<<<<<<<<<<<<< * - * cdef inline object PyArray_MultiIterNew3(a, b, c): + * def __dealloc__(memoryview self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_self->typeinfo = NULL; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":737 - * return PyArray_MultiIterNew(1, a) - * - * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(2, a, b) + /* "View.MemoryView":349 + * cdef __Pyx_TypeInfo *typeinfo * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) +/* "View.MemoryView":376 + * self.typeinfo = NULL * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; +/* Python wrapper */ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":741 - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): - * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 741, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":740 - * return PyArray_MultiIterNew(2, a, b) - * - * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(3, a, b, c) - * - */ + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) +static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { + int __pyx_v_i; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyThread_type_lock __pyx_t_5; + PyThread_type_lock __pyx_t_6; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "View.MemoryView":377 * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + */ + __pyx_t_1 = (__pyx_v_self->obj != Py_None); + if (__pyx_t_1) { + + /* "View.MemoryView":378 + * def __dealloc__(memoryview self): + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: * */ + __Pyx_ReleaseBuffer((&__pyx_v_self->view)); -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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":744 - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): - * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + /* "View.MemoryView":377 * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * def __dealloc__(memoryview self): + * if self.obj is not None: # <<<<<<<<<<<<<< + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 744, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + goto __pyx_L3; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":743 - * return PyArray_MultiIterNew(3, a, b, c) - * - * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(4, a, b, c, d) + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * + * (<__pyx_buffer *> &self.view).obj = NULL */ + __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None); + if (__pyx_t_1) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) + /* "View.MemoryView":381 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) * */ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; -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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":747 + /* "View.MemoryView":382 * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): - * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< * - * cdef inline tuple PyDataType_SHAPE(dtype d): + * cdef int i */ - __Pyx_XDECREF(__pyx_r); - __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_ERR(1, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + Py_DECREF(Py_None); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":746 - * return PyArray_MultiIterNew(4, a, b, c, d) - * - * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< - * return PyArray_MultiIterNew(5, a, b, c, d, e) + /* "View.MemoryView":379 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * + * (<__pyx_buffer *> &self.view).obj = NULL */ + } + __pyx_L3:; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: */ + __pyx_t_1 = (__pyx_v_self->lock != NULL); + if (__pyx_t_1) { -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); + /* "View.MemoryView":387 + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + */ + __pyx_t_2 = __pyx_memoryview_thread_locks_used; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 - * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: */ - __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); - if (__pyx_t_1) { + __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":751 - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape # <<<<<<<<<<<<<< - * else: - * return () + /* "View.MemoryView":389 + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); - __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); - goto __pyx_L0; + __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":750 - * - * cdef inline tuple PyDataType_SHAPE(dtype d): - * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< - * return d.subarray.shape - * else: + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) */ - } + __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":753 - * return d.subarray.shape - * else: - * return () # <<<<<<<<<<<<<< - * - * + /* "View.MemoryView":392 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< + * break + * else: */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_empty_tuple); - __pyx_r = __pyx_empty_tuple; - goto __pyx_L0; - } + __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); + __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":749 - * return PyArray_MultiIterNew(5, a, b, c, d, e) - * - * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< - * if PyDataType_HASSUBARRAY(d): - * return d.subarray.shape + /* "View.MemoryView":391 + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break */ + (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5; + (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6; - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":390 + * if __pyx_memoryview_thread_locks[i] is self.lock: + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + */ + } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) + /* "View.MemoryView":393 + * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( + * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + * break # <<<<<<<<<<<<<< + * else: + * PyThread_free_lock(self.lock) */ + goto __pyx_L6_break; -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_array_base", 0); + /* "View.MemoryView":388 + * if self.lock != NULL: + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< + * __pyx_memoryview_thread_locks_used -= 1 + * if i != __pyx_memoryview_thread_locks_used: + */ + } + } + /*else*/ { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":929 - * - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< - * PyArray_SetBaseObject(arr, base) + /* "View.MemoryView":395 + * break + * else: + * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: */ - Py_INCREF(__pyx_v_base); + PyThread_free_lock(__pyx_v_self->lock); + } + __pyx_L6_break:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":930 - * cdef inline void set_array_base(ndarray arr, object base): - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): + /* "View.MemoryView":386 + * cdef int i + * global __pyx_memoryview_thread_locks_used + * if self.lock != NULL: # <<<<<<<<<<<<<< + * for i in range(__pyx_memoryview_thread_locks_used): + * if __pyx_memoryview_thread_locks[i] is self.lock: */ - (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":928 - * int _import_umath() except -1 + /* "View.MemoryView":376 + * self.typeinfo = NULL * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * Py_INCREF(base) # important to do this before stealing the reference below! - * PyArray_SetBaseObject(arr, base) + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) */ /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) +/* "View.MemoryView":397 + * PyThread_free_lock(self.lock) * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: - */ + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf + */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_v_base; - PyObject *__pyx_r = NULL; +static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + Py_ssize_t __pyx_v_dim; + char *__pyx_v_itemp; + PyObject *__pyx_v_idx = NULL; + char *__pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base", 0); + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_item_pointer", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":933 + /* "View.MemoryView":399 + * cdef char *get_item_pointer(memoryview self, object index) except NULL: + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< * - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< - * if base is NULL: - * return None + * for dim, idx in enumerate(index): */ - __pyx_v_base = PyArray_BASE(__pyx_v_arr); + __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * */ - __pyx_t_1 = ((__pyx_v_base == NULL) != 0); - if (__pyx_t_1) { + __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { + __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 401, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(1, 401, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 401, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_1; + __pyx_t_1 = (__pyx_t_1 + 1); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":935 - * base = PyArray_BASE(arr) - * if base is NULL: - * return None # <<<<<<<<<<<<<< - * return base + /* "View.MemoryView":402 * + * for dim, idx in enumerate(index): + * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< + * + * return itemp */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_7; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":934 - * cdef inline object get_array_base(ndarray arr): - * base = PyArray_BASE(arr) - * if base is NULL: # <<<<<<<<<<<<<< - * return None - * return base + /* "View.MemoryView":401 + * cdef char *itemp = self.view.buf + * + * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * */ } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":936 - * if base is NULL: - * return None - * return base # <<<<<<<<<<<<<< + /* "View.MemoryView":404 + * itemp = pybuffer_index(&self.view, itemp, idx, dim) + * + * return itemp # <<<<<<<<<<<<<< + * * - * # Versions of the import_* functions which are more suitable for */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_base)); - __pyx_r = ((PyObject *)__pyx_v_base); + __pyx_r = __pyx_v_itemp; goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":932 - * PyArray_SetBaseObject(arr, base) + /* "View.MemoryView":397 + * PyThread_free_lock(self.lock) * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * base = PyArray_BASE(arr) - * if base is NULL: + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_idx); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() +/* "View.MemoryView":407 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ -static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { - int __pyx_r; +/* Python wrapper */ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_indices = NULL; + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_array", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + __Pyx_RefNannySetupContext("__getitem__", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":942 - * cdef inline int import_array() except -1: - * try: - * __pyx_import_array() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":408 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self + * */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 942, __pyx_L3_error) + __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: + /* "View.MemoryView":409 + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: + * return self # <<<<<<<<<<<<<< + * + * have_slices, indices = _unellipsify(index, self.view.ndim) */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":943 - * try: - * __pyx_import_array() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":408 + * + * def __getitem__(memoryview self, object index): + * if index is Ellipsis: # <<<<<<<<<<<<<< + * return self * */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 943, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":411 + * return self * - * cdef inline int import_umath() except -1: + * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< + * + * cdef char *itemp */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 944, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 944, __pyx_L5_except_error) + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(__pyx_t_2 != Py_None)) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 411, __pyx_L1_error) } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":941 - * # Cython code. - * cdef inline int import_array() except -1: - * try: # <<<<<<<<<<<<<< - * __pyx_import_array() - * except Exception: - */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 411, __pyx_L1_error) } + __pyx_v_have_slices = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_indices = __pyx_t_4; + __pyx_t_4 = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":940 - * # Versions of the import_* functions which are more suitable for - * # Cython code. - * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< - * try: - * __pyx_import_array() - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") - * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() - */ - -static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_umath", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "View.MemoryView":414 * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":948 - * cdef inline int import_umath() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 948, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 414, __pyx_L1_error) + if (__pyx_t_1) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 - * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + /* "View.MemoryView":415 + * cdef char *itemp + * if have_slices: + * return memview_slice(self, indices) # <<<<<<<<<<<<<< + * else: + * itemp = self.get_item_pointer(indices) */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":949 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":414 * + * cdef char *itemp + * if have_slices: # <<<<<<<<<<<<<< + * return memview_slice(self, indices) + * else: */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 949, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + /* "View.MemoryView":417 + * return memview_slice(self, indices) + * else: + * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< + * return self.convert_item_to_object(itemp) * - * cdef inline int import_ufunc() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 950, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 950, __pyx_L5_except_error) - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + /*else*/ { + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((char *)NULL))) __PYX_ERR(1, 417, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_5; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":947 + /* "View.MemoryView":418 + * else: + * itemp = self.get_item_pointer(indices) + * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< * - * cdef inline int import_umath() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: + * def __setitem__(memoryview self, object index, object value): */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":946 - * raise ImportError("numpy.core.multiarray failed to import") + /* "View.MemoryView":407 * - * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") +/* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ -static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { +/* Python wrapper */ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + PyObject *__pyx_v_have_slices = NULL; + PyObject *__pyx_v_obj = NULL; int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("import_ufunc", 0); + __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_INCREF(__pyx_v_index); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + /* "View.MemoryView":421 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + if (unlikely(__pyx_v_self->view.readonly)) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":954 - * cdef inline int import_ufunc() except -1: - * try: - * _import_umath() # <<<<<<<<<<<<<< - * except Exception: - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":422 + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<< + * + * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 954, __pyx_L3_error) + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_Cannot_assign_to_read_only_memor, 0, 0); + __PYX_ERR(1, 422, __pyx_L1_error) - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 + /* "View.MemoryView":421 + * + * def __setitem__(memoryview self, object index, object value): + * if self.view.readonly: # <<<<<<<<<<<<<< + * raise TypeError, "Cannot assign to read-only memoryview" * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":955 - * try: - * _import_umath() - * except Exception: # <<<<<<<<<<<<<< - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":424 + * raise TypeError, "Cannot assign to read-only memoryview" * - */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_4) { - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 955, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":956 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * - * cdef extern from *: + * if have_slices: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 956, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 956, __pyx_L5_except_error) + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(__pyx_t_1 != Py_None)) { + PyObject* sequence = __pyx_t_1; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 424, __pyx_L1_error) } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":953 - * - * cdef inline int import_ufunc() except -1: - * try: # <<<<<<<<<<<<<< - * _import_umath() - * except Exception: - */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 424, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 424, __pyx_L1_error) } + __pyx_v_have_slices = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3); + __pyx_t_3 = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":952 - * raise ImportError("numpy.core.umath failed to import") + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) * - * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< - * try: - * _import_umath() + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 426, __pyx_L1_error) + if (__pyx_t_4) { - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 - * + /* "View.MemoryView":427 * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` + * if have_slices: + * obj = self.is_slice(value) # <<<<<<<<<<<<<< + * if obj: + * self.setitem_slice_assignment(self[index], obj) */ + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_obj = __pyx_t_1; + __pyx_t_1 = 0; -static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_timedelta64_object", 0); + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(1, 428, __pyx_L1_error) + if (__pyx_t_4) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":978 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< - * - * + /* "View.MemoryView":429 + * obj = self.is_slice(value) + * if obj: + * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< + * else: + * self.setitem_slice_assign_scalar(self[index], value) */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); - goto __pyx_L0; + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 429, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":966 - * - * - * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.timedelta64)` + /* "View.MemoryView":428 + * if have_slices: + * obj = self.is_slice(value) + * if obj: # <<<<<<<<<<<<<< + * self.setitem_slice_assignment(self[index], obj) + * else: */ + goto __pyx_L5; + } - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":431 + * self.setitem_slice_assignment(self[index], obj) + * else: + * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< + * else: + * self.setitem_indexed(index, value) + */ + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 431, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L5:; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * + /* "View.MemoryView":426 + * have_slices, index = _unellipsify(index, self.view.ndim) * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` + * if have_slices: # <<<<<<<<<<<<<< + * obj = self.is_slice(value) + * if obj: */ + goto __pyx_L4; + } -static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_datetime64_object", 0); - - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":993 - * bool - * """ - * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< - * + /* "View.MemoryView":433 + * self.setitem_slice_assign_scalar(self[index], value) + * else: + * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< * + * cdef is_slice(self, obj): */ - __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); - goto __pyx_L0; + /*else*/ { + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L4:; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":981 - * + /* "View.MemoryView":420 + * return self.convert_item_to_object(itemp) * - * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< - * """ - * Cython equivalent of `isinstance(obj, np.datetime64)` + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * if self.view.readonly: + * raise TypeError, "Cannot assign to read-only memoryview" */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_have_slices); + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XDECREF(__pyx_v_index); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 - * +/* "View.MemoryView":435 + * self.setitem_indexed(index, value) * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ -static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { - npy_datetime __pyx_r; +static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_slice", 0); + __Pyx_INCREF(__pyx_v_obj); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1003 - * also needed. That can be found using `get_datetime64_unit`. - * """ - * return (obj).obval # <<<<<<<<<<<<<< - * + /* "View.MemoryView":436 * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ - __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; - goto __pyx_L0; + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":996 - * - * - * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy datetime64 object + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { - /* function exit code */ - __pyx_L0:; - return __pyx_r; -} + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: + */ + __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + + /* "View.MemoryView":439 + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) # <<<<<<<<<<<<<< + * except TypeError: + * return None + */ + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 439, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + + /* "View.MemoryView":438 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: + */ + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_obj); + __Pyx_GIVEREF(__pyx_v_obj); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6)) __PYX_ERR(1, 438, __pyx_L4_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 438, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 + /* "View.MemoryView":440 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + * except TypeError: # <<<<<<<<<<<<<< + * return None * + */ + __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); + if (__pyx_t_9) { + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 440, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + + /* "View.MemoryView":441 + * self.dtype_is_object) + * except TypeError: + * return None # <<<<<<<<<<<<<< * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object + * return obj */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; -static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { - npy_timedelta __pyx_r; + /* "View.MemoryView":437 + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): + * try: # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + * self.dtype_is_object) + */ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L0; + __pyx_L9_try_end:; + } - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1010 - * returns the int64 value underlying scalar numpy timedelta64 object - * """ - * return (obj).obval # <<<<<<<<<<<<<< + /* "View.MemoryView":436 + * + * cdef is_slice(self, obj): + * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< + * try: + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + */ + } + + /* "View.MemoryView":443 + * return None * + * return obj # <<<<<<<<<<<<<< * + * cdef setitem_slice_assignment(self, dst, src): */ - __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_obj); + __pyx_r = __pyx_v_obj; goto __pyx_L0; - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1006 - * + /* "View.MemoryView":435 + * self.setitem_indexed(index, value) * - * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the int64 value underlying scalar numpy timedelta64 object + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 - * +/* "View.MemoryView":445 + * return obj * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ -static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { - NPY_DATETIMEUNIT __pyx_r; +static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { + __Pyx_memviewslice __pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_src_slice; + __Pyx_memviewslice __pyx_v_msrc; + __Pyx_memviewslice __pyx_v_mdst; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1017 - * returns the unit part of the dtype for a numpy datetime64 object. - * """ - * return (obj).obmeta.base # <<<<<<<<<<<<<< + /* "View.MemoryView":448 + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] + * */ - __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); - goto __pyx_L0; + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 448, __pyx_L1_error) + __pyx_v_msrc = (__pyx_t_1[0]); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":1013 + /* "View.MemoryView":449 + * cdef __Pyx_memviewslice src_slice + * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<< * + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) + */ + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 449, __pyx_L1_error) + __pyx_v_mdst = (__pyx_t_1[0]); + + /* "View.MemoryView":451 + * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] * - * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< - * """ - * returns the unit part of the dtype for a numpy datetime64 object. + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 451, __pyx_L1_error) + + /* "View.MemoryView":445 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): +/* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL */ -/* Python wrapper */ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_shape = 0; - Py_ssize_t __pyx_v_itemsize; - PyObject *__pyx_v_format = 0; - PyObject *__pyx_v_mode = 0; - int __pyx_v_allocate_buffer; +static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { + int __pyx_v_array[0x80]; + void *__pyx_v_tmp; + void *__pyx_v_item; + __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + char const *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; - PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_n_s_c); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 123, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 123, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode); - if (value) { values[3] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 123, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_shape = ((PyObject*)values[0]); - __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_v_format = values[2]; - __pyx_v_mode = values[3]; - if (values[4]) { - __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 124, __pyx_L3_error) - } else { + __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - /* "View.MemoryView":124 + /* "View.MemoryView":455 + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef int array[128] + * cdef void *tmp = NULL # <<<<<<<<<<<<<< + * cdef void *item * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, - * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< + */ + __pyx_v_tmp = NULL; + + /* "View.MemoryView":460 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice + * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< * - * cdef int idx + * if self.view.itemsize > sizeof(array): */ - __pyx_v_allocate_buffer = ((int)1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 123, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 123, __pyx_L1_error) - if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 123, __pyx_L1_error) - } - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 460, __pyx_L1_error) + __pyx_v_dst_slice = __pyx_t_1; - /* "View.MemoryView":123 - * cdef bint dtype_is_object + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + */ + __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))); + if (__pyx_t_2) { + + /* "View.MemoryView":463 * + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< + * if tmp == NULL: + * raise MemoryError */ + __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp + */ + __pyx_t_2 = (__pyx_v_tmp == NULL); + if (unlikely(__pyx_t_2)) { -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { - int __pyx_v_idx; - Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_dim; - PyObject **__pyx_v_p; - char __pyx_v_order; - int __pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - Py_ssize_t __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_format); + /* "View.MemoryView":465 + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: + * raise MemoryError # <<<<<<<<<<<<<< + * item = tmp + * else: + */ + PyErr_NoMemory(); __PYX_ERR(1, 465, __pyx_L1_error) - /* "View.MemoryView":130 - * cdef PyObject **p - * - * self.ndim = len(shape) # <<<<<<<<<<<<<< - * self.itemsize = itemsize + /* "View.MemoryView":464 + * if self.view.itemsize > sizeof(array): + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: # <<<<<<<<<<<<<< + * raise MemoryError + * item = tmp + */ + } + + /* "View.MemoryView":466 + * if tmp == NULL: + * raise MemoryError + * item = tmp # <<<<<<<<<<<<<< + * else: + * item = array + */ + __pyx_v_item = __pyx_v_tmp; + + /* "View.MemoryView":462 + * dst_slice = get_slice_from_memview(dst, &tmp_slice) * + * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< + * tmp = PyMem_Malloc(self.view.itemsize) + * if tmp == NULL: */ - if (unlikely(__pyx_v_shape == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 130, __pyx_L1_error) + goto __pyx_L3; } - __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 130, __pyx_L1_error) - __pyx_v_self->ndim = ((int)__pyx_t_1); - /* "View.MemoryView":131 - * - * self.ndim = len(shape) - * self.itemsize = itemsize # <<<<<<<<<<<<<< + /* "View.MemoryView":468 + * item = tmp + * else: + * item = array # <<<<<<<<<<<<<< * - * if not self.ndim: + * try: */ - __pyx_v_self->itemsize = __pyx_v_itemsize; + /*else*/ { + __pyx_v_item = ((void *)__pyx_v_array); + } + __pyx_L3:; - /* "View.MemoryView":133 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") + /* "View.MemoryView":470 + * item = array * + * try: # <<<<<<<<<<<<<< + * if self.dtype_is_object: + * ( item)[0] = value */ - __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0); - if (unlikely(__pyx_t_2)) { + /*try:*/ { - /* "View.MemoryView":134 - * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< + /* "View.MemoryView":471 * - * if itemsize <= 0: + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 134, __pyx_L1_error) + if (__pyx_v_self->dtype_is_object) { - /* "View.MemoryView":133 - * self.itemsize = itemsize - * - * if not self.ndim: # <<<<<<<<<<<<<< - * raise ValueError("Empty shape tuple for cython.array") - * + /* "View.MemoryView":472 + * try: + * if self.dtype_is_object: + * ( item)[0] = value # <<<<<<<<<<<<<< + * else: + * self.assign_item_from_object( item, value) */ - } + (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") - * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") + /* "View.MemoryView":471 * + * try: + * if self.dtype_is_object: # <<<<<<<<<<<<<< + * ( item)[0] = value + * else: */ - __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0); - if (unlikely(__pyx_t_2)) { + goto __pyx_L8; + } - /* "View.MemoryView":137 + /* "View.MemoryView":474 + * ( item)[0] = value + * else: + * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< * - * if not isinstance(format, bytes): */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 137, __pyx_L1_error) + /*else*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L8:; - /* "View.MemoryView":136 - * raise ValueError("Empty shape tuple for cython.array") + /* "View.MemoryView":478 * - * if itemsize <= 0: # <<<<<<<<<<<<<< - * raise ValueError("itemsize <= 0 for cython.array") * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - } + __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL); + if (__pyx_t_2) { - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") + /* "View.MemoryView":479 * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * item, self.dtype_is_object) */ - __pyx_t_2 = PyBytes_Check(__pyx_v_format); - __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_4) { + __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 479, __pyx_L6_error) - /* "View.MemoryView":140 + /* "View.MemoryView":478 * - * if not isinstance(format, bytes): - * format = format.encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format # keep a reference to the byte string - * self.format = self._format + * + * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); - __pyx_t_3 = 0; - /* "View.MemoryView":139 - * raise ValueError("itemsize <= 0 for cython.array") - * - * if not isinstance(format, bytes): # <<<<<<<<<<<<<< - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string + /* "View.MemoryView":480 + * if self.view.suboffsets != NULL: + * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) + * finally: */ + __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); } - /* "View.MemoryView":141 - * if not isinstance(format, bytes): - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< - * self.format = self._format + /* "View.MemoryView":483 + * item, self.dtype_is_object) + * finally: + * PyMem_Free(tmp) # <<<<<<<<<<<<<< * + * cdef setitem_indexed(self, index, value): */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 141, __pyx_L1_error) - __pyx_t_3 = __pyx_v_format; - __Pyx_INCREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->_format); - __Pyx_DECREF(__pyx_v_self->_format); - __pyx_v_self->_format = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + /*finally:*/ { + /*normal exit:*/{ + PyMem_Free(__pyx_v_tmp); + goto __pyx_L7; + } + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; + { + PyMem_Free(__pyx_v_tmp); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + } + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; + goto __pyx_L1_error; + } + __pyx_L7:; + } - /* "View.MemoryView":142 - * format = format.encode('ASCII') - * self._format = format # keep a reference to the byte string - * self.format = self._format # <<<<<<<<<<<<<< - * + /* "View.MemoryView":453 + * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL */ - if (unlikely(__pyx_v_self->_format == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(2, 142, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 142, __pyx_L1_error) - __pyx_v_self->format = __pyx_t_7; - /* "View.MemoryView":145 - * - * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< - * self._strides = self._shape + self.ndim + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":485 + * PyMem_Free(tmp) * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) */ - __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - /* "View.MemoryView":146 +static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + char *__pyx_v_itemp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("setitem_indexed", 0); + + /* "View.MemoryView":486 * - * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) - * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< + * self.assign_item_from_object(itemp, value) * - * if not self._shape: */ - __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 486, __pyx_L1_error) + __pyx_v_itemp = __pyx_t_1; - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") + /* "View.MemoryView":487 + * cdef setitem_indexed(self, index, value): + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< * + * cdef convert_item_to_object(self, char *itemp): */ - __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * + /* "View.MemoryView":485 + * PyMem_Free(tmp) * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 149, __pyx_L1_error) - /* "View.MemoryView":148 - * self._strides = self._shape + self.ndim - * - * if not self._shape: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate shape and strides.") + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - } - /* "View.MemoryView":152 - * +static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_v_struct = NULL; + PyObject *__pyx_v_bytesitem = 0; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":492 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef bytes bytesitem * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ - __pyx_t_8 = 0; - __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; - for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 152, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_9; - __pyx_v_idx = __pyx_t_8; - __pyx_t_8 = (__pyx_t_8 + 1); + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 492, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":153 + /* "View.MemoryView":495 + * cdef bytes bytesitem * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim + * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< + * try: + * result = struct.unpack(self.view.format, bytesitem) */ - __pyx_t_4 = ((__pyx_v_dim <= 0) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":154 - * for idx, dim in enumerate(shape): - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<< - * self._shape[idx] = dim + /* "View.MemoryView":496 * + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "View.MemoryView":497 + * bytesitem = itemp[:self.view.itemsize] + * try: + * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< + * except struct.error: + * raise ValueError, "Unable to convert item to object" */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 154, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 497, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 497, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 154, __pyx_L1_error) + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":153 + /* "View.MemoryView":496 * - * for idx, dim in enumerate(shape): - * if dim <= 0: # <<<<<<<<<<<<<< - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ } - /* "View.MemoryView":155 - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) - * self._shape[idx] = dim # <<<<<<<<<<<<<< - * - * cdef char order - */ - (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - - /* "View.MemoryView":152 - * - * - * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< - * if dim <= 0: - * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /*else:*/ { + __pyx_t_9 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 501, __pyx_L5_except_error) + __pyx_t_10 = (__pyx_t_9 == 1); + if (__pyx_t_10) { - /* "View.MemoryView":158 + /* "View.MemoryView":502 + * else: + * if len(self.view.format) == 1: + * return result[0] # <<<<<<<<<<<<<< + * return result * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 158, __pyx_L1_error) - if (__pyx_t_4) { - - /* "View.MemoryView":159 - * cdef char order - * if mode == 'fortran': - * order = b'F' # <<<<<<<<<<<<<< - * self.mode = u'fortran' - * elif mode == 'c': */ - __pyx_v_order = 'F'; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 502, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6_except_return; - /* "View.MemoryView":160 - * if mode == 'fortran': - * order = b'F' - * self.mode = u'fortran' # <<<<<<<<<<<<<< - * elif mode == 'c': - * order = b'C' + /* "View.MemoryView":501 + * raise ValueError, "Unable to convert item to object" + * else: + * if len(self.view.format) == 1: # <<<<<<<<<<<<<< + * return result[0] + * return result */ - __Pyx_INCREF(__pyx_n_u_fortran); - __Pyx_GIVEREF(__pyx_n_u_fortran); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_fortran; + } - /* "View.MemoryView":158 + /* "View.MemoryView":503 + * if len(self.view.format) == 1: + * return result[0] + * return result # <<<<<<<<<<<<<< * - * cdef char order - * if mode == 'fortran': # <<<<<<<<<<<<<< - * order = b'F' - * self.mode = u'fortran' - */ - goto __pyx_L10; - } - - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' + * cdef assign_item_from_object(self, char *itemp, object value): */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 161, __pyx_L1_error) - if (likely(__pyx_t_4)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L6_except_return; + } + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":162 - * self.mode = u'fortran' - * elif mode == 'c': - * order = b'C' # <<<<<<<<<<<<<< - * self.mode = u'c' + /* "View.MemoryView":498 + * try: + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: # <<<<<<<<<<<<<< + * raise ValueError, "Unable to convert item to object" * else: */ - __pyx_v_order = 'C'; + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_6); + __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; + if (__pyx_t_8) { + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 498, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_1); - /* "View.MemoryView":163 - * elif mode == 'c': - * order = b'C' - * self.mode = u'c' # <<<<<<<<<<<<<< + /* "View.MemoryView":499 + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: + * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<< * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) - */ - __Pyx_INCREF(__pyx_n_u_c); - __Pyx_GIVEREF(__pyx_n_u_c); - __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(__pyx_v_self->mode); - __pyx_v_self->mode = __pyx_n_u_c; - - /* "View.MemoryView":161 - * order = b'F' - * self.mode = u'fortran' - * elif mode == 'c': # <<<<<<<<<<<<<< - * order = b'C' - * self.mode = u'c' + * if len(self.view.format) == 1: */ - goto __pyx_L10; - } + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Unable_to_convert_item_to_object, 0, 0); + __PYX_ERR(1, 499, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "View.MemoryView":165 - * self.mode = u'c' - * else: - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< + /* "View.MemoryView":496 * - * self.len = fill_contig_strides_array(self._shape, self._strides, + * bytesitem = itemp[:self.view.itemsize] + * try: # <<<<<<<<<<<<<< + * result = struct.unpack(self.view.format, bytesitem) + * except struct.error: */ - /*else*/ { - __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 165, __pyx_L1_error) + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L6_except_return:; + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); + goto __pyx_L0; } - __pyx_L10:; - - /* "View.MemoryView":167 - * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) - * - * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<< - * itemsize, self.ndim, order) - * - */ - __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - /* "View.MemoryView":170 - * itemsize, self.ndim, order) + /* "View.MemoryView":489 + * self.assign_item_from_object(itemp, value) * - * self.free_data = allocate_buffer # <<<<<<<<<<<<<< - * self.dtype_is_object = format == b'O' - * if allocate_buffer: + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_v_self->free_data = __pyx_v_allocate_buffer; - /* "View.MemoryView":171 - * - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< - * if allocate_buffer: - * - */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 171, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 171, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_self->dtype_is_object = __pyx_t_4; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesitem); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< - * +/* "View.MemoryView":505 + * return result * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ - __pyx_t_4 = (__pyx_v_allocate_buffer != 0); - if (__pyx_t_4) { - /* "View.MemoryView":175 - * - * - * self.data = malloc(self.len) # <<<<<<<<<<<<<< - * if not self.data: - * raise MemoryError("unable to allocate array data.") - */ - __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); +static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_v_struct = NULL; + char __pyx_v_c; + PyObject *__pyx_v_bytesvalue = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + char *__pyx_t_10; + char *__pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "View.MemoryView":176 - * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") - * + /* "View.MemoryView":508 + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + * import struct # <<<<<<<<<<<<<< + * cdef char c + * cdef bytes bytesvalue */ - __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_struct = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< + /* "View.MemoryView":513 + * cdef Py_ssize_t i * - * if self.dtype_is_object: + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 177, __pyx_L1_error) + __pyx_t_2 = PyTuple_Check(__pyx_v_value); + if (__pyx_t_2) { - /* "View.MemoryView":176 - * - * self.data = malloc(self.len) - * if not self.data: # <<<<<<<<<<<<<< - * raise MemoryError("unable to allocate array data.") + /* "View.MemoryView":514 * + * if isinstance(value, tuple): + * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + * else: + * bytesvalue = struct.pack(self.view.format, value) */ - } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 514, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") + /* "View.MemoryView":513 + * cdef Py_ssize_t i * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): + * if isinstance(value, tuple): # <<<<<<<<<<<<<< + * bytesvalue = struct.pack(self.view.format, *value) + * else: */ - __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_4) { + goto __pyx_L3; + } - /* "View.MemoryView":180 + /* "View.MemoryView":516 + * bytesvalue = struct.pack(self.view.format, *value) + * else: + * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< * - * if self.dtype_is_object: - * p = self.data # <<<<<<<<<<<<<< - * for i in range(self.len / itemsize): - * p[i] = Py_None + * for i, c in enumerate(bytesvalue): */ - __pyx_v_p = ((PyObject **)__pyx_v_self->data); - - /* "View.MemoryView":181 - * if self.dtype_is_object: - * p = self.data - * for i in range(self.len / itemsize): # <<<<<<<<<<<<<< - * p[i] = Py_None - * Py_INCREF(Py_None) - */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 181, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 181, __pyx_L1_error) + /*else*/ { + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } - __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize); - __pyx_t_9 = __pyx_t_1; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_value}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(1, 516, __pyx_L1_error) + __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L3:; - /* "View.MemoryView":182 - * p = self.data - * for i in range(self.len / itemsize): - * p[i] = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c * */ - (__pyx_v_p[__pyx_v_i]) = Py_None; + __pyx_t_7 = 0; + if (unlikely(__pyx_v_bytesvalue == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); + __PYX_ERR(1, 518, __pyx_L1_error) + } + __Pyx_INCREF(__pyx_v_bytesvalue); + __pyx_t_8 = __pyx_v_bytesvalue; + __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8); + __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8)); + for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) { + __pyx_t_9 = __pyx_t_12; + __pyx_v_c = (__pyx_t_9[0]); - /* "View.MemoryView":183 - * for i in range(self.len / itemsize): - * p[i] = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "View.MemoryView":519 + * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< * * @cname('getbuffer') */ - Py_INCREF(Py_None); - } + __pyx_v_i = __pyx_t_7; - /* "View.MemoryView":179 - * raise MemoryError("unable to allocate array data.") + /* "View.MemoryView":518 + * bytesvalue = struct.pack(self.view.format, value) + * + * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< + * itemp[i] = c * - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * p = self.data - * for i in range(self.len / itemsize): */ - } + __pyx_t_7 = (__pyx_t_7 + 1); - /* "View.MemoryView":172 - * self.free_data = allocate_buffer - * self.dtype_is_object = format == b'O' - * if allocate_buffer: # <<<<<<<<<<<<<< + /* "View.MemoryView":519 * + * for i, c in enumerate(bytesvalue): + * itemp[i] = c # <<<<<<<<<<<<<< * + * @cname('getbuffer') */ + (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "View.MemoryView":123 - * cdef bint dtype_is_object - * - * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< - * mode="c", bint allocate_buffer=True): + /* "View.MemoryView":505 + * return result * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_format); + __Pyx_XDECREF(__pyx_v_struct); + __Pyx_XDECREF(__pyx_v_bytesvalue); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":186 +/* "View.MemoryView":521 + * itemp[i] = c * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ /* Python wrapper */ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_bufmode; +static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + Py_ssize_t *__pyx_t_3; char *__pyx_t_4; - Py_ssize_t __pyx_t_5; + void *__pyx_t_5; int __pyx_t_6; - Py_ssize_t *__pyx_t_7; + Py_ssize_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { + if (unlikely(__pyx_v_info == NULL)) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; } @@ -9049,254 +10020,286 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); - /* "View.MemoryView":187 + /* "View.MemoryView":523 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 # <<<<<<<<<<<<<< - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - */ - __pyx_v_bufmode = -1; - - /* "View.MemoryView":188 - * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 188, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); + __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":189 - * cdef int bufmode = -1 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS + /* "View.MemoryView":524 + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: + * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<< + * + * if flags & PyBUF_ND: */ - __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Cannot_create_writable_memory_vi, 0, 0); + __PYX_ERR(1, 524, __pyx_L1_error) - /* "View.MemoryView":188 + /* "View.MemoryView":523 + * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): - * cdef int bufmode = -1 - * if self.mode == u"c": # <<<<<<<<<<<<<< - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": + * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * */ - goto __pyx_L3; } - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 190, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); if (__pyx_t_1) { - /* "View.MemoryView":191 - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") + /* "View.MemoryView":527 + * + * if flags & PyBUF_ND: + * info.shape = self.view.shape # <<<<<<<<<<<<<< + * else: + * info.shape = NULL */ - __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); + __pyx_t_3 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_3; - /* "View.MemoryView":190 - * if self.mode == u"c": - * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * elif self.mode == u"fortran": # <<<<<<<<<<<<<< - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): + /* "View.MemoryView":526 + * raise ValueError, "Cannot create writable memory view from read-only memoryview" + * + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< + * info.shape = self.view.shape + * else: */ + goto __pyx_L6; } - __pyx_L3:; - - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - */ - __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0); - if (unlikely(__pyx_t_1)) { - - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 193, __pyx_L1_error) - /* "View.MemoryView":192 - * elif self.mode == u"fortran": - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): # <<<<<<<<<<<<<< - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data + /* "View.MemoryView":529 + * info.shape = self.view.shape + * else: + * info.shape = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_STRIDES: */ + /*else*/ { + __pyx_v_info->shape = NULL; } + __pyx_L6:; - /* "View.MemoryView":194 - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data # <<<<<<<<<<<<<< - * info.len = self.len - * info.ndim = self.ndim + /* "View.MemoryView":531 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - __pyx_t_4 = __pyx_v_self->data; - __pyx_v_info->buf = __pyx_t_4; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + if (__pyx_t_1) { - /* "View.MemoryView":195 - * raise ValueError("Can only create a buffer that is contiguous in memory.") - * info.buf = self.data - * info.len = self.len # <<<<<<<<<<<<<< - * info.ndim = self.ndim - * info.shape = self._shape + /* "View.MemoryView":532 + * + * if flags & PyBUF_STRIDES: + * info.strides = self.view.strides # <<<<<<<<<<<<<< + * else: + * info.strides = NULL */ - __pyx_t_5 = __pyx_v_self->len; - __pyx_v_info->len = __pyx_t_5; + __pyx_t_3 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_3; - /* "View.MemoryView":196 - * info.buf = self.data - * info.len = self.len - * info.ndim = self.ndim # <<<<<<<<<<<<<< - * info.shape = self._shape - * info.strides = self._strides + /* "View.MemoryView":531 + * info.shape = NULL + * + * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * info.strides = self.view.strides + * else: */ - __pyx_t_6 = __pyx_v_self->ndim; - __pyx_v_info->ndim = __pyx_t_6; + goto __pyx_L7; + } - /* "View.MemoryView":197 - * info.len = self.len - * info.ndim = self.ndim - * info.shape = self._shape # <<<<<<<<<<<<<< - * info.strides = self._strides - * info.suboffsets = NULL + /* "View.MemoryView":534 + * info.strides = self.view.strides + * else: + * info.strides = NULL # <<<<<<<<<<<<<< + * + * if flags & PyBUF_INDIRECT: */ - __pyx_t_7 = __pyx_v_self->_shape; - __pyx_v_info->shape = __pyx_t_7; + /*else*/ { + __pyx_v_info->strides = NULL; + } + __pyx_L7:; - /* "View.MemoryView":198 - * info.ndim = self.ndim - * info.shape = self._shape - * info.strides = self._strides # <<<<<<<<<<<<<< - * info.suboffsets = NULL - * info.itemsize = self.itemsize + /* "View.MemoryView":536 + * info.strides = NULL + * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: */ - __pyx_t_7 = __pyx_v_self->_strides; - __pyx_v_info->strides = __pyx_t_7; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); + if (__pyx_t_1) { - /* "View.MemoryView":199 - * info.shape = self._shape - * info.strides = self._strides - * info.suboffsets = NULL # <<<<<<<<<<<<<< - * info.itemsize = self.itemsize - * info.readonly = 0 + /* "View.MemoryView":537 + * + * if flags & PyBUF_INDIRECT: + * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< + * else: + * info.suboffsets = NULL */ - __pyx_v_info->suboffsets = NULL; + __pyx_t_3 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_3; - /* "View.MemoryView":200 - * info.strides = self._strides - * info.suboffsets = NULL - * info.itemsize = self.itemsize # <<<<<<<<<<<<<< - * info.readonly = 0 + /* "View.MemoryView":536 + * info.strides = NULL * + * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< + * info.suboffsets = self.view.suboffsets + * else: */ - __pyx_t_5 = __pyx_v_self->itemsize; - __pyx_v_info->itemsize = __pyx_t_5; + goto __pyx_L8; + } - /* "View.MemoryView":201 - * info.suboffsets = NULL - * info.itemsize = self.itemsize - * info.readonly = 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":539 + * info.suboffsets = self.view.suboffsets + * else: + * info.suboffsets = NULL # <<<<<<<<<<<<<< * * if flags & PyBUF_FORMAT: */ - __pyx_v_info->readonly = 0; + /*else*/ { + __pyx_v_info->suboffsets = NULL; + } + __pyx_L8:; - /* "View.MemoryView":203 - * info.readonly = 0 + /* "View.MemoryView":541 + * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format + * info.format = self.view.format * else: */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":204 + /* "View.MemoryView":542 * * if flags & PyBUF_FORMAT: - * info.format = self.format # <<<<<<<<<<<<<< + * info.format = self.view.format # <<<<<<<<<<<<<< * else: * info.format = NULL */ - __pyx_t_4 = __pyx_v_self->format; + __pyx_t_4 = __pyx_v_self->view.format; __pyx_v_info->format = __pyx_t_4; - /* "View.MemoryView":203 - * info.readonly = 0 + /* "View.MemoryView":541 + * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.format + * info.format = self.view.format * else: */ - goto __pyx_L5; + goto __pyx_L9; } - /* "View.MemoryView":206 - * info.format = self.format + /* "View.MemoryView":544 + * info.format = self.view.format * else: * info.format = NULL # <<<<<<<<<<<<<< * - * info.obj = self + * info.buf = self.view.buf */ /*else*/ { __pyx_v_info->format = NULL; } - __pyx_L5:; + __pyx_L9:; - /* "View.MemoryView":208 + /* "View.MemoryView":546 * info.format = NULL * - * info.obj = self # <<<<<<<<<<<<<< - * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + * info.buf = self.view.buf # <<<<<<<<<<<<<< + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + __pyx_t_5 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_5; - /* "View.MemoryView":186 + /* "View.MemoryView":547 * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == u"c": + * info.buf = self.view.buf + * info.ndim = self.view.ndim # <<<<<<<<<<<<<< + * info.itemsize = self.view.itemsize + * info.len = self.view.len + */ + __pyx_t_6 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_6; + + /* "View.MemoryView":548 + * info.buf = self.view.buf + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< + * info.len = self.view.len + * info.readonly = self.view.readonly + */ + __pyx_t_7 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_7; + + /* "View.MemoryView":549 + * info.ndim = self.view.ndim + * info.itemsize = self.view.itemsize + * info.len = self.view.len # <<<<<<<<<<<<<< + * info.readonly = self.view.readonly + * info.obj = self + */ + __pyx_t_7 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_7; + + /* "View.MemoryView":550 + * info.itemsize = self.view.itemsize + * info.len = self.view.len + * info.readonly = self.view.readonly # <<<<<<<<<<<<<< + * info.obj = self + * + */ + __pyx_t_1 = __pyx_v_self->view.readonly; + __pyx_v_info->readonly = __pyx_t_1; + + /* "View.MemoryView":551 + * info.len = self.view.len + * info.readonly = self.view.readonly + * info.obj = self # <<<<<<<<<<<<<< + * + * + */ + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + + /* "View.MemoryView":521 + * itemp[i] = c + * + * @cname('getbuffer') # <<<<<<<<<<<<<< + * def __getbuffer__(self, Py_buffer *info, int flags): + * if flags & PyBUF_WRITABLE and self.view.readonly: */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); @@ -9313,159 +10316,118 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru return __pyx_r; } -/* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") +/* "View.MemoryView":554 * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ /* Python wrapper */ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":213 - * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: - */ - __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":214 - * def __dealloc__(array self): - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) # <<<<<<<<<<<<<< - * elif self.free_data: - * if self.dtype_is_object: - */ - __pyx_v_self->callback_free_data(__pyx_v_self->data); - - /* "View.MemoryView":213 - * - * def __dealloc__(array self): - * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< - * self.callback_free_data(self.data) - * elif self.free_data: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, - */ - __pyx_t_1 = (__pyx_v_self->free_data != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) - */ - __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":217 - * elif self.free_data: - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< - * self._strides, self.ndim, False) - * free(self.data) - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":216 - * self.callback_free_data(self.data) - * elif self.free_data: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) + /* "View.MemoryView":556 + * @property + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< + * transpose_memslice(&result.from_slice) + * return result */ - } + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 556, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 556, __pyx_L1_error) + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":219 - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) - * free(self.data) # <<<<<<<<<<<<<< - * PyObject_Free(self._shape) + /* "View.MemoryView":557 + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< + * return result * */ - free(__pyx_v_self->data); - - /* "View.MemoryView":215 - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - * elif self.free_data: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, - */ - } - __pyx_L3:; + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 557, __pyx_L1_error) - /* "View.MemoryView":220 - * self._strides, self.ndim, False) - * free(self.data) - * PyObject_Free(self._shape) # <<<<<<<<<<<<<< + /* "View.MemoryView":558 + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + * return result # <<<<<<<<<<<<<< * * @property */ - PyObject_Free(__pyx_v_self->_shape); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; - /* "View.MemoryView":212 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + /* "View.MemoryView":554 * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) + * + * @property # <<<<<<<<<<<<<< + * def T(self): + * cdef _memoryviewslice result = memoryview_copy(self) */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":223 - * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() +/* "View.MemoryView":560 + * return result * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9474,32 +10436,32 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":224 + /* "View.MemoryView":562 * @property - * def memview(self): - * return self.get_memview() # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() # <<<<<<<<<<<<<< * - * @cname('get_memview') + * cdef _get_base(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 224, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":223 - * - * @property - * def memview(self): # <<<<<<<<<<<<<< - * return self.get_memview() + /* "View.MemoryView":560 + * return result * + * @property # <<<<<<<<<<<<<< + * def base(self): + * return self._get_base() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9507,197 +10469,239 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ return __pyx_r; } -/* "View.MemoryView":227 +/* "View.MemoryView":564 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) */ -static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { - int __pyx_v_flags; +static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_memview", 0); + __Pyx_RefNannySetupContext("_get_base", 0); - /* "View.MemoryView":228 - * @cname('get_memview') - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< - * return memoryview(self, flags, self.dtype_is_object) + /* "View.MemoryView":565 * - */ - __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); - - /* "View.MemoryView":229 - * cdef get_memview(self): - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< + * cdef _get_base(self): + * return self.obj # <<<<<<<<<<<<<< * - * def __len__(self): + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_v_self->obj); + __pyx_r = __pyx_v_self->obj; goto __pyx_L0; - /* "View.MemoryView":227 + /* "View.MemoryView":564 + * return self._get_base() + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.obj * - * @cname('get_memview') - * cdef get_memview(self): # <<<<<<<<<<<<<< - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - * return memoryview(self, flags, self.dtype_is_object) */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] +/* "View.MemoryView":567 + * return self.obj * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ /* Python wrapper */ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_7genexpr__pyx_v_length; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); + PyObject *__pyx_t_1 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":232 - * - * def __len__(self): - * return self._shape[0] # <<<<<<<<<<<<<< + /* "View.MemoryView":569 + * @property + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< * - * def __getattr__(self, attr): + * @property */ - __pyx_r = (__pyx_v_self->_shape[0]); + __Pyx_XDECREF(__pyx_r); + { /* enter inner scope */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]); + __pyx_t_5 = PyInt_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } /* exit inner scope */ + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; - /* "View.MemoryView":231 - * return memoryview(self, flags, self.dtype_is_object) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self._shape[0] + /* "View.MemoryView":567 + * return self.obj * + * @property # <<<<<<<<<<<<<< + * def shape(self): + * return tuple([length for length in self.view.shape[:self.view.ndim]]) */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":234 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) +/* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ /* Python wrapper */ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ -static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr1__pyx_v_stride; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getattr__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":235 + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< * - * def __getattr__(self, attr): - * return getattr(self.memview, attr) # <<<<<<<<<<<<<< + * raise ValueError, "Buffer view does not expose strides" + */ + __pyx_t_1 = (__pyx_v_self->view.strides == NULL); + if (unlikely(__pyx_t_1)) { + + /* "View.MemoryView":575 + * if self.view.strides == NULL: * - * def __getitem__(self, item): + * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<< + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) + */ + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Buffer_view_does_not_expose_stri, 0, 0); + __PYX_ERR(1, 575, __pyx_L1_error) + + /* "View.MemoryView":573 + * @property + * def strides(self): + * if self.view.strides == NULL: # <<<<<<<<<<<<<< + * + * raise ValueError, "Buffer view does not expose strides" + */ + } + + /* "View.MemoryView":577 + * raise ValueError, "Buffer view does not expose strides" + * + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; goto __pyx_L0; - /* "View.MemoryView":234 - * return self._shape[0] - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) + /* "View.MemoryView":571 + * return tuple([length for length in self.view.shape[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def strides(self): + * if self.view.strides == NULL: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9705,67 +10709,118 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__( return __pyx_r; } -/* "View.MemoryView":237 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] +/* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ /* Python wrapper */ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ -static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + Py_ssize_t *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":238 + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim * - * def __getitem__(self, item): - * return self.memview[item] # <<<<<<<<<<<<<< + */ + __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL); + if (__pyx_t_1) { + + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * - * def __setitem__(self, item, value): + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":581 + * @property + * def suboffsets(self): + * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< + * return (-1,) * self.view.ndim + * + */ + } + + /* "View.MemoryView":584 + * return (-1,) * self.view.ndim + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * + * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); + for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { + __pyx_t_3 = __pyx_t_5; + __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } /* exit inner scope */ + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; goto __pyx_L0; - /* "View.MemoryView":237 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] + /* "View.MemoryView":579 + * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def suboffsets(self): + * if self.view.suboffsets == NULL: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9773,8649 +10828,8110 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__ return __pyx_r; } -/* "View.MemoryView":240 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value +/* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ /* Python wrapper */ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { - int __pyx_r; +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":241 - * - * def __setitem__(self, item, value): - * self.memview[item] = value # <<<<<<<<<<<<<< - * + /* "View.MemoryView":588 + * @property + * def ndim(self): + * return self.view.ndim # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 241, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 241, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":240 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value + /* "View.MemoryView":586 + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) * + * @property # <<<<<<<<<<<<<< + * def ndim(self): + * return self.view.ndim */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): +/* "View.MemoryView":590 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":592 + * @property + * def itemsize(self): + * return self.view.itemsize # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 592, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "View.MemoryView":590 + * return self.view.ndim + * + * @property # <<<<<<<<<<<<<< + * def itemsize(self): + * return self.view.itemsize */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") +/* "View.MemoryView":594 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "View.MemoryView":596 + * @property + * def nbytes(self): + * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":594 + * return self.view.itemsize + * + * @property # <<<<<<<<<<<<<< + * def nbytes(self): + * return self.size * self.view.itemsize */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":245 +/* "View.MemoryView":598 + * return self.size * self.view.itemsize * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ -static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) { - struct __pyx_array_obj *__pyx_v_result = 0; - struct __pyx_array_obj *__pyx_r = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("array_cwrapper", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":249 - * cdef array result + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: */ - __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_size == Py_None); if (__pyx_t_1) { - /* "View.MemoryView":250 + /* "View.MemoryView":601 + * def size(self): + * if self._size is None: + * result = 1 # <<<<<<<<<<<<<< * - * if buf == NULL: - * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<< - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), + * for length in self.view.shape[:self.view.ndim]: */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); - __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_int_1); + __pyx_v_result = __pyx_int_1; - /* "View.MemoryView":249 - * cdef array result + /* "View.MemoryView":603 + * result = 1 + * + * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< + * result *= length * - * if buf == NULL: # <<<<<<<<<<<<<< - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf */ - /*else*/ { - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_shape); - __Pyx_GIVEREF(__pyx_v_shape); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_3 = 0; + __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); + for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_t_5 = PyInt_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 603, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5); + __pyx_t_5 = 0; - /* "View.MemoryView":253 - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) # <<<<<<<<<<<<<< - * result.data = buf + /* "View.MemoryView":604 * + * for length in self.view.shape[:self.view.ndim]: + * result *= length # <<<<<<<<<<<<<< + * + * self._size = result */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 253, __pyx_L1_error) + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); + __pyx_t_5 = 0; + } - /* "View.MemoryView":252 - * result = array(shape, itemsize, format, mode.decode('ASCII')) - * else: - * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< - * allocate_buffer=False) - * result.data = buf + /* "View.MemoryView":606 + * result *= length + * + * self._size = result # <<<<<<<<<<<<<< + * + * return self._size */ - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5); - __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_v_result); + __Pyx_GIVEREF(__pyx_v_result); + __Pyx_GOTREF(__pyx_v_self->_size); + __Pyx_DECREF(__pyx_v_self->_size); + __pyx_v_self->_size = __pyx_v_result; - /* "View.MemoryView":254 - * result = array(shape, itemsize, format, mode.decode('ASCII'), - * allocate_buffer=False) - * result.data = buf # <<<<<<<<<<<<<< + /* "View.MemoryView":600 + * @property + * def size(self): + * if self._size is None: # <<<<<<<<<<<<<< + * result = 1 * - * return result */ - __pyx_v_result->data = __pyx_v_buf; } - __pyx_L3:; - /* "View.MemoryView":256 - * result.data = buf - * - * return result # <<<<<<<<<<<<<< + /* "View.MemoryView":608 + * self._size = result * + * return self._size # <<<<<<<<<<<<<< * + * def __len__(self): */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = __pyx_v_result; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_size); + __pyx_r = __pyx_v_self->_size; goto __pyx_L0; - /* "View.MemoryView":245 + /* "View.MemoryView":598 + * return self.size * self.view.itemsize * - * @cname("__pyx_array_new") - * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< - * char *mode, char *buf): - * cdef array result + * @property # <<<<<<<<<<<<<< + * def size(self): + * if self._size is None: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): +/* "View.MemoryView":610 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ /* Python wrapper */ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 282, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_name = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 282, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { - int __pyx_r; +static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { + Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); + int __pyx_t_1; + __Pyx_RefNannySetupContext("__len__", 0); - /* "View.MemoryView":283 - * cdef object name - * def __init__(self, name): - * self.name = name # <<<<<<<<<<<<<< - * def __repr__(self): - * return self.name + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * */ - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __Pyx_GOTREF(__pyx_v_self->name); - __Pyx_DECREF(__pyx_v_self->name); - __pyx_v_self->name = __pyx_v_name; + __pyx_t_1 = (__pyx_v_self->view.ndim >= 1); + if (__pyx_t_1) { - /* "View.MemoryView":282 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name + /* "View.MemoryView":612 + * def __len__(self): + * if self.view.ndim >= 1: + * return self.view.shape[0] # <<<<<<<<<<<<<< + * + * return 0 + */ + __pyx_r = (__pyx_v_self->view.shape[0]); + goto __pyx_L0; + + /* "View.MemoryView":611 + * + * def __len__(self): + * if self.view.ndim >= 1: # <<<<<<<<<<<<<< + * return self.view.shape[0] + * + */ + } + + /* "View.MemoryView":614 + * return self.view.shape[0] + * + * return 0 # <<<<<<<<<<<<<< + * * def __repr__(self): + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "View.MemoryView":610 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] */ /* function exit code */ - __pyx_r = 0; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name +/* "View.MemoryView":616 + * return 0 * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ /* Python wrapper */ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); - /* "View.MemoryView":285 - * self.name = name + /* "View.MemoryView":617 + * * def __repr__(self): - * return self.name # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) * - * cdef generic = Enum("") */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->name); - __pyx_r = __pyx_v_self->name; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":618 + * def __repr__(self): + * return "" % (self.base.__class__.__name__, + * id(self)) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":617 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 617, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":284 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name + /* "View.MemoryView":616 + * return 0 * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict +/* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { - PyObject *__pyx_v_state = 0; - PyObject *__pyx_v__dict = 0; - int __pyx_v_use_setstate; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("__str__", 0); - /* "(tree fragment)":5 - * cdef object _dict - * cdef bint use_setstate - * state = (self.name,) # <<<<<<<<<<<<<< - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: + /* "View.MemoryView":621 + * + * def __str__(self): + * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< + * + * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_self->name); - __Pyx_GIVEREF(__pyx_v_self->name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name); - __pyx_v_state = ((PyObject*)__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error); __pyx_t_1 = 0; - - /* "(tree fragment)":6 - * cdef bint use_setstate - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< - * if _dict is not None: - * state += (_dict,) - */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v__dict = __pyx_t_1; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; + goto __pyx_L0; - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - __pyx_t_2 = (__pyx_v__dict != Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "(tree fragment)":8 - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: - * state += (_dict,) # <<<<<<<<<<<<<< - * use_setstate = True - * else: - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v__dict); - __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); - __pyx_t_4 = 0; - - /* "(tree fragment)":9 - * if _dict is not None: - * state += (_dict,) - * use_setstate = True # <<<<<<<<<<<<<< - * else: - * use_setstate = self.name is not None - */ - __pyx_v_use_setstate = 1; - - /* "(tree fragment)":7 - * state = (self.name,) - * _dict = getattr(self, '__dict__', None) - * if _dict is not None: # <<<<<<<<<<<<<< - * state += (_dict,) - * use_setstate = True - */ - goto __pyx_L3; - } - - /* "(tree fragment)":11 - * use_setstate = True - * else: - * use_setstate = self.name is not None # <<<<<<<<<<<<<< - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - */ - /*else*/ { - __pyx_t_3 = (__pyx_v_self->name != Py_None); - __pyx_v_use_setstate = __pyx_t_3; - } - __pyx_L3:; - - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: - */ - __pyx_t_3 = (__pyx_v_use_setstate != 0); - if (__pyx_t_3) { - - /* "(tree fragment)":13 - * use_setstate = self.name is not None - * if use_setstate: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<< - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); - __pyx_t_4 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "(tree fragment)":12 - * else: - * use_setstate = self.name is not None - * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: - */ - } - - /* "(tree fragment)":15 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_184977713); - __Pyx_GIVEREF(__pyx_int_184977713); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713); - __Pyx_INCREF(__pyx_v_state); - __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __pyx_t_5 = 0; - __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef tuple state - * cdef object _dict + /* "View.MemoryView":620 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v__dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) +/* "View.MemoryView":624 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* Python wrapper */ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 624, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_c_contig", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":17 - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): - * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< - */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":16 - * else: - * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state(self, __pyx_state) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":299 - * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory - */ - -static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) { - Py_intptr_t __pyx_v_aligned_p; - size_t __pyx_v_offset; - void *__pyx_r; - int __pyx_t_1; - - /* "View.MemoryView":301 - * cdef void *align_pointer(void *memory, size_t alignment) nogil: - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<< - * cdef size_t offset - * - */ - __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory); - - /* "View.MemoryView":305 - * - * with cython.cdivision(True): - * offset = aligned_p % alignment # <<<<<<<<<<<<<< - * - * if offset > 0: - */ - __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment); - - /* "View.MemoryView":307 - * offset = aligned_p % alignment - * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset - * - */ - __pyx_t_1 = ((__pyx_v_offset > 0) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":308 - * - * if offset > 0: - * aligned_p += alignment - offset # <<<<<<<<<<<<<< - * - * return aligned_p - */ - __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset)); + __Pyx_RefNannySetupContext("is_c_contig", 0); - /* "View.MemoryView":307 - * offset = aligned_p % alignment - * - * if offset > 0: # <<<<<<<<<<<<<< - * aligned_p += alignment - offset + /* "View.MemoryView":627 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * */ - } + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 627, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "View.MemoryView":310 - * aligned_p += alignment - offset - * - * return aligned_p # <<<<<<<<<<<<<< - * + /* "View.MemoryView":628 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< * + * def is_f_contig(self): */ - __pyx_r = ((void *)__pyx_v_aligned_p); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":299 + /* "View.MemoryView":624 * - * @cname('__pyx_align_pointer') - * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< - * "Align pointer memory on a given boundary" - * cdef Py_intptr_t aligned_p = memory + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo +/* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ /* Python wrapper */ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_obj = 0; - int __pyx_v_flags; - int __pyx_v_dtype_is_object; +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - int __pyx_r; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 346, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 346, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) - if (values[2]) { - __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error) - } else { - __pyx_v_dtype_is_object = ((int)0); - } - } + __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 630, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_f_contig", 0))) return NULL; goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 346, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return -1; + return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) { - int __pyx_r; +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice *__pyx_v_mslice; + __Pyx_memviewslice __pyx_v_tmp; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; + __Pyx_memviewslice *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_RefNannySetupContext("is_f_contig", 0); - /* "View.MemoryView":347 + /* "View.MemoryView":633 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj # <<<<<<<<<<<<<< - * self.flags = flags - * if type(self) is memoryview or obj is not None: - */ - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - __Pyx_GOTREF(__pyx_v_self->obj); - __Pyx_DECREF(__pyx_v_self->obj); - __pyx_v_self->obj = __pyx_v_obj; - - /* "View.MemoryView":348 - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): - * self.obj = obj - * self.flags = flags # <<<<<<<<<<<<<< - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) */ - __pyx_v_self->flags = __pyx_v_flags; + __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 633, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: + /* "View.MemoryView":634 + * cdef __Pyx_memviewslice tmp + * mslice = get_slice_from_memview(self, &tmp) + * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * + * def copy(self): */ - __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_3 = (__pyx_v_obj != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "View.MemoryView":350 - * self.flags = flags - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None + /* "View.MemoryView":630 + * return slice_is_contig(mslice[0], 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp */ - __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 350, __pyx_L1_error) - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) - */ - __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":352 - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) +/* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - /* "View.MemoryView":353 - * if self.view.obj == NULL: - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 636, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_mslice; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy", 0); + + /* "View.MemoryView":638 + * def copy(self): + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): + * slice_copy(self, &mslice) */ - Py_INCREF(Py_None); + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - /* "View.MemoryView":351 - * if type(self) is memoryview or obj is not None: - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &self.view).obj = Py_None - * Py_INCREF(Py_None) + /* "View.MemoryView":640 + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * + * slice_copy(self, &mslice) # <<<<<<<<<<<<<< + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, + * self.view.itemsize, */ - } + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - /* "View.MemoryView":349 - * self.obj = obj - * self.flags = flags - * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< - * __Pyx_GetBuffer(obj, &self.view, flags) - * if self.view.obj == NULL: + /* "View.MemoryView":641 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_C_CONTIGUOUS, */ - } + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 641, __pyx_L1_error) + __pyx_v_mslice = __pyx_t_1; - /* "View.MemoryView":355 - * Py_INCREF(Py_None) + /* "View.MemoryView":646 + * self.dtype_is_object) * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: + * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * + * def copy_fortran(self): */ - __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0); - if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 + /* "View.MemoryView":636 + * return slice_is_contig(mslice[0], 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ - __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":358 - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - */ - __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - - /* "View.MemoryView":359 - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); - - /* "View.MemoryView":357 - * if not __PYX_CYTHON_ATOMICS_ENABLED(): - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - */ - } - - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":361 - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< - * if self.lock is NULL: - * raise MemoryError - */ - __pyx_v_self->lock = PyThread_allocate_lock(); - - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); - if (unlikely(__pyx_t_1)) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":363 - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - * raise MemoryError # <<<<<<<<<<<<<< +/* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) * - * if flags & PyBUF_FORMAT: + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ - PyErr_NoMemory(); __PYX_ERR(2, 363, __pyx_L1_error) - /* "View.MemoryView":362 - * if self.lock is NULL: - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * - */ - } +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 648, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy_fortran", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - /* "View.MemoryView":360 - * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] - * __pyx_memoryview_thread_locks_used += 1 - * if self.lock is NULL: # <<<<<<<<<<<<<< - * self.lock = PyThread_allocate_lock() - * if self.lock is NULL: - */ - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":355 - * Py_INCREF(Py_None) - * - * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<< - * global __pyx_memoryview_thread_locks_used - * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: - */ - } +static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + int __pyx_v_flags; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_memviewslice __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_fortran", 0); - /* "View.MemoryView":365 - * raise MemoryError + /* "View.MemoryView":650 + * def copy_fortran(self): + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: + * slice_copy(self, &src) */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - /* "View.MemoryView":366 + /* "View.MemoryView":652 + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS * - * if flags & PyBUF_FORMAT: - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< - * else: - * self.dtype_is_object = dtype_is_object + * slice_copy(self, &src) # <<<<<<<<<<<<<< + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, + * self.view.itemsize, */ - __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L12_bool_binop_done; - } - __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L12_bool_binop_done:; - __pyx_v_self->dtype_is_object = __pyx_t_1; + __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); - /* "View.MemoryView":365 - * raise MemoryError + /* "View.MemoryView":653 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< + * self.view.itemsize, + * flags|PyBUF_F_CONTIGUOUS, */ - goto __pyx_L11; - } + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 653, __pyx_L1_error) + __pyx_v_dst = __pyx_t_1; - /* "View.MemoryView":368 - * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') - * else: - * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< + /* "View.MemoryView":658 + * self.dtype_is_object) * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( - */ - /*else*/ { - __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object; - } - __pyx_L11:; - - /* "View.MemoryView":370 - * self.dtype_is_object = dtype_is_object + * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< * - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<< - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL - */ - __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int)))); - - /* "View.MemoryView":372 - * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( - * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) - * self.typeinfo = NULL # <<<<<<<<<<<<<< * - * def __dealloc__(memoryview self): */ - __pyx_v_self->typeinfo = NULL; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "View.MemoryView":346 - * cdef __Pyx_TypeInfo *typeinfo + /* "View.MemoryView":648 + * return memoryview_copy_from_slice(self, &mslice) * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":374 - * self.typeinfo = NULL - * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { - int __pyx_v_i; +static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyThread_type_lock __pyx_t_6; - PyThread_type_lock __pyx_t_7; - __Pyx_RefNannySetupContext("__dealloc__", 0); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "View.MemoryView":375 - * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_1 = (__pyx_v_self->obj != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":376 - * def __dealloc__(memoryview self): - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - * - */ - __Pyx_ReleaseBuffer((&__pyx_v_self->view)); - - /* "View.MemoryView":375 - * - * def __dealloc__(memoryview self): - * if self.obj is not None: # <<<<<<<<<<<<<< - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - */ - goto __pyx_L3; - } - - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< - * - * (<__pyx_buffer *> &self.view).obj = NULL - */ - __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":379 - * elif (<__pyx_buffer *> &self.view).obj == Py_None: - * - * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< - * Py_DECREF(Py_None) - * - */ - ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; - - /* "View.MemoryView":380 - * - * (<__pyx_buffer *> &self.view).obj = NULL - * Py_DECREF(Py_None) # <<<<<<<<<<<<<< - * - * cdef int i - */ - Py_DECREF(Py_None); - - /* "View.MemoryView":377 - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< - * - * (<__pyx_buffer *> &self.view).obj = NULL - */ - } - __pyx_L3:; - - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - */ - __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":385 - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - */ - __pyx_t_3 = __pyx_memoryview_thread_locks_used; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; - - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - */ - __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0); - if (__pyx_t_2) { + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "View.MemoryView":387 - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - */ - __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); - - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":390 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< - * break - * else: - */ - __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]); + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":389 - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6; - (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7; - /* "View.MemoryView":388 - * if __pyx_memoryview_thread_locks[i] is self.lock: - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - */ +/* Python wrapper */ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; } - - /* "View.MemoryView":391 - * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( - * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) - * break # <<<<<<<<<<<<<< - * else: - * PyThread_free_lock(self.lock) - */ - goto __pyx_L6_break; - - /* "View.MemoryView":386 - * if self.lock != NULL: - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< - * __pyx_memoryview_thread_locks_used -= 1 - * if i != __pyx_memoryview_thread_locks_used: - */ + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } - /*else*/ { + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state); - /* "View.MemoryView":393 - * break - * else: - * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< - * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - */ - PyThread_free_lock(__pyx_v_self->lock); + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } - __pyx_L6_break:; + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":384 - * cdef int i - * global __pyx_memoryview_thread_locks_used - * if self.lock != NULL: # <<<<<<<<<<<<<< - * for i in range(__pyx_memoryview_thread_locks_used): - * if __pyx_memoryview_thread_locks[i] is self.lock: +static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - } + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "View.MemoryView":374 - * self.typeinfo = NULL - * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":395 - * PyThread_free_lock(self.lock) +/* "View.MemoryView":662 * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ -static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - Py_ssize_t __pyx_v_dim; - char *__pyx_v_itemp; - PyObject *__pyx_v_idx = NULL; - char *__pyx_r; +static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { + struct __pyx_memoryview_obj *__pyx_v_result = 0; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - char *__pyx_t_7; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_item_pointer", 0); + __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - /* "View.MemoryView":397 - * cdef char *get_item_pointer(memoryview self, object index) except NULL: - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< - * - * for dim, idx in enumerate(index): - */ - __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * + /* "View.MemoryView":663 + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< + * result.typeinfo = typeinfo + * return result */ + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) { - __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 399, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 399, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_v_dim = __pyx_t_1; - __pyx_t_1 = (__pyx_t_1 + 1); - - /* "View.MemoryView":400 - * - * for dim, idx in enumerate(index): - * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< - * - * return itemp - */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 400, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_7; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":399 - * cdef char *itemp = self.view.buf - * - * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< - * itemp = pybuffer_index(&self.view, itemp, idx, dim) + /* "View.MemoryView":664 + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo # <<<<<<<<<<<<<< + * return result * */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_result->typeinfo = __pyx_v_typeinfo; - /* "View.MemoryView":402 - * itemp = pybuffer_index(&self.view, itemp, idx, dim) - * - * return itemp # <<<<<<<<<<<<<< - * + /* "View.MemoryView":665 + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + * return result # <<<<<<<<<<<<<< * + * @cname('__pyx_memoryview_check') */ - __pyx_r = __pyx_v_itemp; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "View.MemoryView":395 - * PyThread_free_lock(self.lock) + /* "View.MemoryView":662 * - * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< - * cdef Py_ssize_t dim - * cdef char *itemp = self.view.buf + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_idx); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":405 +/* "View.MemoryView":668 * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self */ -/* Python wrapper */ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; +static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + int __pyx_t_1; + __Pyx_RefNannySetupContext("memoryview_check", 0); + + /* "View.MemoryView":669 + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: + * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + * + * cdef tuple _unellipsify(object index, int ndim): + */ + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "View.MemoryView":668 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) + * + */ /* function exit code */ + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_indices = NULL; - char *__pyx_v_itemp; +/* "View.MemoryView":671 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with + */ + +static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_tup = NULL; + PyObject *__pyx_v_result = NULL; + int __pyx_v_have_slices; + int __pyx_v_seen_ellipsis; + PyObject *__pyx_v_item = NULL; + Py_ssize_t __pyx_v_nslices; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - char *__pyx_t_6; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_UCS4 __pyx_t_6; + PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); + __Pyx_RefNannySetupContext("_unellipsify", 0); - /* "View.MemoryView":406 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self + /* "View.MemoryView":677 + * """ + * cdef Py_ssize_t idx + * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<< * + * result = [slice(None)] * ndim */ - __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis); - __pyx_t_2 = (__pyx_t_1 != 0); + __pyx_t_2 = PyTuple_Check(__pyx_v_index); if (__pyx_t_2) { + __Pyx_INCREF(((PyObject*)__pyx_v_index)); + __pyx_t_1 = __pyx_v_index; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index)) __PYX_ERR(1, 677, __pyx_L1_error); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_v_tup = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":407 - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: - * return self # <<<<<<<<<<<<<< + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) * - * have_slices, indices = _unellipsify(index, self.view.ndim) + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; + __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) { + __Pyx_INCREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error); + } + } + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "View.MemoryView":406 - * - * def __getitem__(memoryview self, object index): - * if index is Ellipsis: # <<<<<<<<<<<<<< - * return self + /* "View.MemoryView":680 * + * result = [slice(None)] * ndim + * have_slices = False # <<<<<<<<<<<<<< + * seen_ellipsis = False + * idx = 0 */ - } + __pyx_v_have_slices = 0; - /* "View.MemoryView":409 - * return self - * - * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< - * - * cdef char *itemp + /* "View.MemoryView":681 + * result = [slice(None)] * ndim + * have_slices = False + * seen_ellipsis = False # <<<<<<<<<<<<<< + * idx = 0 + * for item in tup: */ - __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(__pyx_t_3 != Py_None)) { - PyObject* sequence = __pyx_t_3; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 409, __pyx_L1_error) - } + __pyx_v_seen_ellipsis = 0; + + /* "View.MemoryView":682 + * have_slices = False + * seen_ellipsis = False + * idx = 0 # <<<<<<<<<<<<<< + * for item in tup: + * if item is Ellipsis: + */ + __pyx_v_idx = 0; + + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: + */ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 683, __pyx_L1_error) + } + __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; + for (;;) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(1, 683, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 409, __pyx_L1_error) - } - __pyx_v_have_slices = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_v_indices = __pyx_t_5; - __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":412 - * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) - * else: + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 412, __pyx_L1_error) - if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); + if (__pyx_t_2) { - /* "View.MemoryView":413 - * cdef char *itemp - * if have_slices: - * return memview_slice(self, indices) # <<<<<<<<<<<<<< + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True + */ + __pyx_t_2 = (!__pyx_v_seen_ellipsis); + if (__pyx_t_2) { + + /* "View.MemoryView":686 + * if item is Ellipsis: + * if not seen_ellipsis: + * idx += ndim - len(tup) # <<<<<<<<<<<<<< + * seen_ellipsis = True + * have_slices = True + */ + if (unlikely(__pyx_v_tup == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 686, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 686, __pyx_L1_error) + __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5)); + + /* "View.MemoryView":687 + * if not seen_ellipsis: + * idx += ndim - len(tup) + * seen_ellipsis = True # <<<<<<<<<<<<<< + * have_slices = True * else: - * itemp = self.get_item_pointer(indices) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_v_seen_ellipsis = 1; - /* "View.MemoryView":412 - * - * cdef char *itemp - * if have_slices: # <<<<<<<<<<<<<< - * return memview_slice(self, indices) + /* "View.MemoryView":685 + * for item in tup: + * if item is Ellipsis: + * if not seen_ellipsis: # <<<<<<<<<<<<<< + * idx += ndim - len(tup) + * seen_ellipsis = True + */ + } + + /* "View.MemoryView":688 + * idx += ndim - len(tup) + * seen_ellipsis = True + * have_slices = True # <<<<<<<<<<<<<< * else: + * if isinstance(item, slice): */ - } + __pyx_v_have_slices = 1; - /* "View.MemoryView":415 - * return memview_slice(self, indices) + /* "View.MemoryView":684 + * idx = 0 + * for item in tup: + * if item is Ellipsis: # <<<<<<<<<<<<<< + * if not seen_ellipsis: + * idx += ndim - len(tup) + */ + goto __pyx_L5; + } + + /* "View.MemoryView":690 + * have_slices = True * else: - * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< - * return self.convert_item_to_object(itemp) - * + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): */ - /*else*/ { - __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 415, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_6; + /*else*/ { + __pyx_t_2 = PySlice_Check(__pyx_v_item); + if (__pyx_t_2) { - /* "View.MemoryView":416 + /* "View.MemoryView":691 * else: - * itemp = self.get_item_pointer(indices) - * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< + * if isinstance(item, slice): + * have_slices = True # <<<<<<<<<<<<<< + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + */ + __pyx_v_have_slices = 1; + + /* "View.MemoryView":690 + * have_slices = True + * else: + * if isinstance(item, slice): # <<<<<<<<<<<<<< + * have_slices = True + * elif not PyIndex_Check(item): + */ + goto __pyx_L7; + } + + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + */ + __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0)); + if (unlikely(__pyx_t_2)) { + + /* "View.MemoryView":693 + * have_slices = True + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<< + * result[idx] = item + * idx += 1 + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_6 = 127; + __Pyx_INCREF(__pyx_kp_u_Cannot_index_with_type); + __pyx_t_5 += 24; + __Pyx_GIVEREF(__pyx_kp_u_Cannot_index_with_type); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Cannot_index_with_type); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_5 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__6); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(1, 693, __pyx_L1_error) + + /* "View.MemoryView":692 + * if isinstance(item, slice): + * have_slices = True + * elif not PyIndex_Check(item): # <<<<<<<<<<<<<< + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + */ + } + __pyx_L7:; + + /* "View.MemoryView":694 + * elif not PyIndex_Check(item): + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item # <<<<<<<<<<<<<< + * idx += 1 * - * def __setitem__(memoryview self, object index, object value): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0))) __PYX_ERR(1, 694, __pyx_L1_error) + } + __pyx_L5:; + + /* "View.MemoryView":695 + * raise TypeError, f"Cannot index with type '{type(item)}'" + * result[idx] = item + * idx += 1 # <<<<<<<<<<<<<< + * + * nslices = ndim - idx + */ + __pyx_v_idx = (__pyx_v_idx + 1); + + /* "View.MemoryView":683 + * seen_ellipsis = False + * idx = 0 + * for item in tup: # <<<<<<<<<<<<<< + * if item is Ellipsis: + * if not seen_ellipsis: + */ } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":405 + /* "View.MemoryView":697 + * idx += 1 * + * nslices = ndim - idx # <<<<<<<<<<<<<< + * return have_slices or nslices, tuple(result) * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self + */ + __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx); + + /* "View.MemoryView":698 + * + * nslices = ndim - idx + * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + */ + __Pyx_XDECREF(__pyx_r); + if (!__pyx_v_have_slices) { + } else { + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + __pyx_L9_bool_binop_done:; + __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(1, 698, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_7); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7)) __PYX_ERR(1, 698, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "View.MemoryView":671 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_indices); + __Pyx_XDECREF(__pyx_v_tup); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_item); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) +/* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: */ -/* Python wrapper */ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - PyObject *__pyx_v_have_slices = NULL; - PyObject *__pyx_v_obj = NULL; +static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_suboffset; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + Py_ssize_t *__pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - __Pyx_INCREF(__pyx_v_index); + __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - /* "View.MemoryView":419 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") + /* "View.MemoryView":701 * + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" */ - __pyx_t_1 = (__pyx_v_self->view.readonly != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); + for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { + __pyx_t_1 = __pyx_t_3; + __pyx_v_suboffset = (__pyx_t_1[0]); - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< - * - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 420, __pyx_L1_error) + __pyx_t_4 = (__pyx_v_suboffset >= 0); + if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":419 - * - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: # <<<<<<<<<<<<<< - * raise TypeError("Cannot assign to read-only memoryview") + /* "View.MemoryView":703 + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<< + * return 0 # return type just used as an error flag * */ - } + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Indirect_dimensions_not_supporte, 0, 0); + __PYX_ERR(1, 703, __pyx_L1_error) - /* "View.MemoryView":422 - * raise TypeError("Cannot assign to read-only memoryview") - * - * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< - * - * if have_slices: + /* "View.MemoryView":702 + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag */ - __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(__pyx_t_2 != Py_None)) { - PyObject* sequence = __pyx_t_2; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 422, __pyx_L1_error) } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 422, __pyx_L1_error) } - __pyx_v_have_slices = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); - __pyx_t_4 = 0; - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "View.MemoryView":704 + * if suboffset >= 0: + * raise ValueError, "Indirect dimensions not supported" + * return 0 # return type just used as an error flag # <<<<<<<<<<<<<< + * * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":425 + /* "View.MemoryView":700 + * return have_slices or nslices, tuple(result) * - * if have_slices: - * obj = self.is_slice(value) # <<<<<<<<<<<<<< - * if obj: - * self.setitem_slice_assignment(self[index], obj) - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_obj = __pyx_t_2; - __pyx_t_2 = 0; - - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 426, __pyx_L1_error) - if (__pyx_t_1) { - - /* "View.MemoryView":427 - * obj = self.is_slice(value) - * if obj: - * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< - * else: - * self.setitem_slice_assign_scalar(self[index], value) - */ - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "View.MemoryView":426 - * if have_slices: - * obj = self.is_slice(value) - * if obj: # <<<<<<<<<<<<<< - * self.setitem_slice_assignment(self[index], obj) - * else: - */ - goto __pyx_L5; - } - - /* "View.MemoryView":429 - * self.setitem_slice_assignment(self[index], obj) - * else: - * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< - * else: - * self.setitem_indexed(index, value) - */ - /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 429, __pyx_L1_error) - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L5:; - - /* "View.MemoryView":424 - * have_slices, index = _unellipsify(index, self.view.ndim) - * - * if have_slices: # <<<<<<<<<<<<<< - * obj = self.is_slice(value) - * if obj: - */ - goto __pyx_L4; - } - - /* "View.MemoryView":431 - * self.setitem_slice_assign_scalar(self[index], value) - * else: - * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< - * - * cdef is_slice(self, obj): - */ - /*else*/ { - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L4:; - - /* "View.MemoryView":418 - * return self.convert_item_to_object(itemp) - * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") + * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<< + * for suboffset in suboffsets[:ndim]: + * if suboffset >= 0: */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_have_slices); - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XDECREF(__pyx_v_index); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":433 - * self.setitem_indexed(index, value) +/* "View.MemoryView":711 * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step */ -static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) { - PyObject *__pyx_r = NULL; +static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { + int __pyx_v_new_ndim; + int __pyx_v_suboffset_dim; + int __pyx_v_dim; + __Pyx_memviewslice __pyx_v_src; + __Pyx_memviewslice __pyx_v_dst; + __Pyx_memviewslice *__pyx_v_p_src; + struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; + __Pyx_memviewslice *__pyx_v_p_dst; + int *__pyx_v_p_suboffset_dim; + Py_ssize_t __pyx_v_start; + Py_ssize_t __pyx_v_stop; + Py_ssize_t __pyx_v_step; + Py_ssize_t __pyx_v_cindex; + int __pyx_v_have_start; + int __pyx_v_have_stop; + int __pyx_v_have_step; + PyObject *__pyx_v_index = NULL; + struct __pyx_memoryview_obj *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_2 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_slice", 0); - __Pyx_INCREF(__pyx_v_obj); + __Pyx_RefNannySetupContext("memview_slice", 0); - /* "View.MemoryView":434 - * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, + /* "View.MemoryView":712 + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): + * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< + * cdef bint negative_step + * cdef __Pyx_memviewslice src, dst */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_v_new_ndim = 0; + __pyx_v_suboffset_dim = -1; - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) + /* "View.MemoryView":719 + * + * + * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * + * cdef _memoryviewslice memviewsliceobj */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_5); - /*try:*/ { + (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: + /* "View.MemoryView":723 + * cdef _memoryviewslice memviewsliceobj + * + * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * + * if isinstance(memview, _memoryviewslice): */ - __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(__pyx_assertions_enabled())) { + __pyx_t_1 = (__pyx_v_memview->view.ndim > 0); + if (unlikely(!__pyx_t_1)) { + __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); + __PYX_ERR(1, 723, __pyx_L1_error) + } + } + #else + if ((1)); else __PYX_ERR(1, 723, __pyx_L1_error) + #endif - /* "View.MemoryView":437 - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * except TypeError: - * return None + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 437, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "View.MemoryView":436 - * if not isinstance(obj, memoryview): - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< - * self.dtype_is_object) - * except TypeError: + /* "View.MemoryView":726 + * + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview # <<<<<<<<<<<<<< + * p_src = &memviewsliceobj.from_slice + * else: */ - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 436, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); - __pyx_t_7 = 0; + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 726, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) + /* "View.MemoryView":727 + * if isinstance(memview, _memoryviewslice): + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, &src) */ - } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); - /* "View.MemoryView":438 - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - * except TypeError: # <<<<<<<<<<<<<< - * return None + /* "View.MemoryView":725 + * assert memview.view.ndim > 0 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * memviewsliceobj = memview + * p_src = &memviewsliceobj.from_slice */ - __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); - if (__pyx_t_9) { - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 438, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_6); + goto __pyx_L3; + } - /* "View.MemoryView":439 - * self.dtype_is_object) - * except TypeError: - * return None # <<<<<<<<<<<<<< + /* "View.MemoryView":729 + * p_src = &memviewsliceobj.from_slice + * else: + * slice_copy(memview, &src) # <<<<<<<<<<<<<< + * p_src = &src * - * return obj */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_except_return; - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; - - /* "View.MemoryView":435 - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): - * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, - * self.dtype_is_object) - */ - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L1_error; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); - goto __pyx_L0; - __pyx_L9_try_end:; - } + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - /* "View.MemoryView":434 + /* "View.MemoryView":730 + * else: + * slice_copy(memview, &src) + * p_src = &src # <<<<<<<<<<<<<< + * * - * cdef is_slice(self, obj): - * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< - * try: - * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ + __pyx_v_p_src = (&__pyx_v_src); } + __pyx_L3:; - /* "View.MemoryView":441 - * return None + /* "View.MemoryView":736 * - * return obj # <<<<<<<<<<<<<< * - * cdef setitem_slice_assignment(self, dst, src): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_obj); - __pyx_r = __pyx_v_obj; - goto __pyx_L0; - - /* "View.MemoryView":433 - * self.setitem_indexed(index, value) + * dst.memview = p_src.memview # <<<<<<<<<<<<<< + * dst.data = p_src.data * - * cdef is_slice(self, obj): # <<<<<<<<<<<<<< - * if not isinstance(obj, memoryview): - * try: */ + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_obj); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":443 - * return obj + /* "View.MemoryView":737 + * + * dst.memview = p_src.memview + * dst.data = p_src.data # <<<<<<<<<<<<<< * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice - */ - -static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) { - __Pyx_memviewslice __pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_src_slice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - __Pyx_memviewslice *__pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) */ - if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 447, __pyx_L1_error) - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 447, __pyx_L1_error) + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; - /* "View.MemoryView":448 + /* "View.MemoryView":742 * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<< - * src.ndim, dst.ndim, self.dtype_is_object) * + * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< + * cdef int *p_suboffset_dim = &suboffset_dim + * cdef Py_ssize_t start, stop, step, cindex */ - if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 448, __pyx_L1_error) - __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 448, __pyx_L1_error) + __pyx_v_p_dst = (&__pyx_v_dst); - /* "View.MemoryView":449 - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< + /* "View.MemoryView":743 * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): + * cdef __Pyx_memviewslice *p_dst = &dst + * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< + * cdef Py_ssize_t start, stop, step, cindex + * cdef bint have_start, have_stop, have_step */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - /* "View.MemoryView":447 - * cdef __Pyx_memviewslice src_slice + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step * - * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< - * get_slice_from_memview(dst, &dst_slice)[0], - * src.ndim, dst.ndim, self.dtype_is_object) + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index */ - __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 447, __pyx_L1_error) + __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { + __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 747, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(1, 747, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 747, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); - /* "View.MemoryView":443 - * return obj + /* "View.MemoryView":748 * - * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice dst_slice - * cdef __Pyx_memviewslice src_slice + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ + __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0); + if (__pyx_t_1) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) - * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + /* "View.MemoryView":749 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * cindex = index # <<<<<<<<<<<<<< + * slice_memviewslice( + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], */ + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 749, __pyx_L1_error) + __pyx_v_cindex = __pyx_t_9; -static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) { - int __pyx_v_array[0x80]; - void *__pyx_v_tmp; - void *__pyx_v_item; - __Pyx_memviewslice *__pyx_v_dst_slice; - __Pyx_memviewslice __pyx_v_tmp_slice; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - char const *__pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - - /* "View.MemoryView":453 - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): - * cdef int array[128] - * cdef void *tmp = NULL # <<<<<<<<<<<<<< - * cdef void *item - * + /* "View.MemoryView":750 + * if PyIndex_Check(index): + * cindex = index + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - __pyx_v_tmp = NULL; + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 750, __pyx_L1_error) - /* "View.MemoryView":458 - * cdef __Pyx_memviewslice *dst_slice - * cdef __Pyx_memviewslice tmp_slice - * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< + /* "View.MemoryView":748 * - * if self.view.itemsize > sizeof(array): + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): # <<<<<<<<<<<<<< + * cindex = index + * slice_memviewslice( */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 458, __pyx_L1_error) - __pyx_v_dst_slice = __pyx_t_1; + goto __pyx_L6; + } - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) - * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 */ - __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); - if (__pyx_t_2) { + __pyx_t_1 = (__pyx_v_index == Py_None); + if (__pyx_t_1) { - /* "View.MemoryView":461 - * - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< - * if tmp == NULL: - * raise MemoryError + /* "View.MemoryView":757 + * False) + * elif index is None: + * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 */ - __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); + (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp + /* "View.MemoryView":758 + * elif index is None: + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 */ - __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0); - if (unlikely(__pyx_t_2)) { + (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - /* "View.MemoryView":463 - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: - * raise MemoryError # <<<<<<<<<<<<<< - * item = tmp + /* "View.MemoryView":759 + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< + * new_ndim += 1 * else: */ - PyErr_NoMemory(); __PYX_ERR(2, 463, __pyx_L1_error) + (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; - /* "View.MemoryView":462 - * if self.view.itemsize > sizeof(array): - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: # <<<<<<<<<<<<<< - * raise MemoryError - * item = tmp + /* "View.MemoryView":760 + * p_dst.strides[new_ndim] = 0 + * p_dst.suboffsets[new_ndim] = -1 + * new_ndim += 1 # <<<<<<<<<<<<<< + * else: + * start = index.start or 0 + */ + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + + /* "View.MemoryView":756 + * 0, 0, 0, # have_{start,stop,step} + * False) + * elif index is None: # <<<<<<<<<<<<<< + * p_dst.shape[new_ndim] = 1 + * p_dst.strides[new_ndim] = 0 */ + goto __pyx_L6; } - /* "View.MemoryView":464 - * if tmp == NULL: - * raise MemoryError - * item = tmp # <<<<<<<<<<<<<< + /* "View.MemoryView":762 + * new_ndim += 1 * else: - * item = array + * start = index.start or 0 # <<<<<<<<<<<<<< + * stop = index.stop or 0 + * step = index.step or 0 */ - __pyx_v_item = __pyx_v_tmp; + /*else*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 762, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 762, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L7_bool_binop_done:; + __pyx_v_start = __pyx_t_9; - /* "View.MemoryView":460 - * dst_slice = get_slice_from_memview(dst, &tmp_slice) + /* "View.MemoryView":763 + * else: + * start = index.start or 0 + * stop = index.stop or 0 # <<<<<<<<<<<<<< + * step = index.step or 0 * - * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< - * tmp = PyMem_Malloc(self.view.itemsize) - * if tmp == NULL: */ - goto __pyx_L3; - } + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 763, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 763, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L9_bool_binop_done:; + __pyx_v_stop = __pyx_t_9; - /* "View.MemoryView":466 - * item = tmp - * else: - * item = array # <<<<<<<<<<<<<< + /* "View.MemoryView":764 + * start = index.start or 0 + * stop = index.stop or 0 + * step = index.step or 0 # <<<<<<<<<<<<<< * - * try: + * have_start = index.start is not None */ - /*else*/ { - __pyx_v_item = ((void *)__pyx_v_array); - } - __pyx_L3:; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 764, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(1, 764, __pyx_L1_error) + if (!__pyx_t_1) { + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error) + __pyx_t_9 = __pyx_t_11; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_9 = 0; + __pyx_L11_bool_binop_done:; + __pyx_v_step = __pyx_t_9; - /* "View.MemoryView":468 - * item = array + /* "View.MemoryView":766 + * step = index.step or 0 * - * try: # <<<<<<<<<<<<<< - * if self.dtype_is_object: - * ( item)[0] = value + * have_start = index.start is not None # <<<<<<<<<<<<<< + * have_stop = index.stop is not None + * have_step = index.step is not None */ - /*try:*/ { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 766, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_start = __pyx_t_1; - /* "View.MemoryView":469 + /* "View.MemoryView":767 + * + * have_start = index.start is not None + * have_stop = index.stop is not None # <<<<<<<<<<<<<< + * have_step = index.step is not None * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: */ - __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0); - if (__pyx_t_2) { + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_stop = __pyx_t_1; - /* "View.MemoryView":470 - * try: - * if self.dtype_is_object: - * ( item)[0] = value # <<<<<<<<<<<<<< - * else: - * self.assign_item_from_object( item, value) + /* "View.MemoryView":768 + * have_start = index.start is not None + * have_stop = index.stop is not None + * have_step = index.step is not None # <<<<<<<<<<<<<< + * + * slice_memviewslice( */ - (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 768, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = (__pyx_t_8 != Py_None); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_have_step = __pyx_t_1; - /* "View.MemoryView":469 + /* "View.MemoryView":770 + * have_step = index.step is not None * - * try: - * if self.dtype_is_object: # <<<<<<<<<<<<<< - * ( item)[0] = value - * else: + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - goto __pyx_L8; - } + __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 770, __pyx_L1_error) - /* "View.MemoryView":472 - * ( item)[0] = value - * else: - * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< - * + /* "View.MemoryView":776 + * have_start, have_stop, have_step, + * True) + * new_ndim += 1 # <<<<<<<<<<<<<< * + * if isinstance(memview, _memoryviewslice): */ - /*else*/ { - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 472, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); } - __pyx_L8:; + __pyx_L6:; - /* "View.MemoryView":476 - * + /* "View.MemoryView":747 + * cdef bint have_start, have_stop, have_step * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< + * if PyIndex_Check(index): + * cindex = index */ - __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0); - if (__pyx_t_2) { + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":477 + /* "View.MemoryView":778 + * new_ndim += 1 * - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, */ - __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 477, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "View.MemoryView":476 + /* "View.MemoryView":779 * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, + */ + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":780 + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< + * memviewsliceobj.to_dtype_func, + * memview.dtype_is_object) + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 780, __pyx_L1_error) } + + /* "View.MemoryView":781 + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * else: + */ + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) } + + /* "View.MemoryView":779 * - * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< + * memviewsliceobj.to_object_func, + * memviewsliceobj.to_dtype_func, */ - } + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 779, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; - /* "View.MemoryView":478 - * if self.view.suboffsets != NULL: - * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< - * item, self.dtype_is_object) - * finally: + /* "View.MemoryView":778 + * new_ndim += 1 + * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * return memoryview_fromslice(dst, new_ndim, + * memviewsliceobj.to_object_func, */ - __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); } - /* "View.MemoryView":481 - * item, self.dtype_is_object) - * finally: - * PyMem_Free(tmp) # <<<<<<<<<<<<<< + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) * - * cdef setitem_indexed(self, index, value): */ - /*finally:*/ { - /*normal exit:*/{ - PyMem_Free(__pyx_v_tmp); - goto __pyx_L7; - } - __pyx_L6_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename; - { - PyMem_Free(__pyx_v_tmp); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6; - goto __pyx_L1_error; - } - __pyx_L7:; + /*else*/ { + __Pyx_XDECREF((PyObject *)__pyx_r); + + /* "View.MemoryView":785 + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, + * memview.dtype_is_object) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "View.MemoryView":784 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * + */ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(1, 784, __pyx_L1_error) + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; } - /* "View.MemoryView":451 - * src.ndim, dst.ndim, self.dtype_is_object) + /* "View.MemoryView":711 * - * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< - * cdef int array[128] - * cdef void *tmp = NULL + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":483 - * PyMem_Free(tmp) +/* "View.MemoryView":793 * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ -static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { - char *__pyx_v_itemp; - PyObject *__pyx_r = NULL; +static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { + Py_ssize_t __pyx_v_new_shape; + int __pyx_v_negative_step; + int __pyx_r; __Pyx_RefNannyDeclarations - char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setitem_indexed", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("slice_memviewslice", 1); - /* "View.MemoryView":484 + /* "View.MemoryView":813 + * cdef bint negative_step * - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< - * self.assign_item_from_object(itemp, value) + * if not is_slice: # <<<<<<<<<<<<<< * + * if start < 0: */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 484, __pyx_L1_error) - __pyx_v_itemp = __pyx_t_1; + __pyx_t_1 = (!__pyx_v_is_slice); + if (__pyx_t_1) { - /* "View.MemoryView":485 - * cdef setitem_indexed(self, index, value): - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< + /* "View.MemoryView":815 + * if not is_slice: * - * cdef convert_item_to_object(self, char *itemp): + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 485, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = (__pyx_v_start < 0); + if (__pyx_t_1) { - /* "View.MemoryView":483 - * PyMem_Free(tmp) + /* "View.MemoryView":816 * - * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< - * cdef char *itemp = self.get_item_pointer(index) - * self.assign_item_from_object(itemp, value) + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) */ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) + /* "View.MemoryView":815 + * if not is_slice: * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if not 0 <= start < shape: */ + } -static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_v_struct = NULL; - PyObject *__pyx_v_bytesitem = 0; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - size_t __pyx_t_10; - int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: + */ + __pyx_t_1 = (0 <= __pyx_v_start); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + } + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { - /* "View.MemoryView":490 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef bytes bytesitem + /* "View.MemoryView":818 + * start += shape + * if not 0 <= start < shape: + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< + * else: * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 818, __pyx_L1_error) - /* "View.MemoryView":493 - * cdef bytes bytesitem - * - * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< - * try: - * result = struct.unpack(self.view.format, bytesitem) + /* "View.MemoryView":817 + * if start < 0: + * start += shape + * if not 0 <= start < shape: # <<<<<<<<<<<<<< + * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) + * else: */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + } - /* "View.MemoryView":494 + /* "View.MemoryView":813 + * cdef bint negative_step * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + * if not is_slice: # <<<<<<<<<<<<<< + * + * if start < 0: */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { + goto __pyx_L3; + } - /* "View.MemoryView":495 - * bytesitem = itemp[:self.view.itemsize] - * try: - * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< - * except struct.error: - * raise ValueError("Unable to convert item to object") + /* "View.MemoryView":821 + * else: + * + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); - __Pyx_INCREF(__pyx_v_bytesitem); - __Pyx_GIVEREF(__pyx_v_bytesitem); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; + /*else*/ { + __pyx_t_2 = (__pyx_v_have_step != 0); + if (__pyx_t_2) { - /* "View.MemoryView":494 + /* "View.MemoryView":822 * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + * if have_step: + * negative_step = step < 0 # <<<<<<<<<<<<<< + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) */ - } + __pyx_v_negative_step = (__pyx_v_step < 0); - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result */ - /*else:*/ { - __pyx_t_10 = strlen(__pyx_v_self->view.format); - __pyx_t_11 = ((__pyx_t_10 == 1) != 0); - if (__pyx_t_11) { + __pyx_t_2 = (__pyx_v_step == 0); + if (__pyx_t_2) { - /* "View.MemoryView":500 + /* "View.MemoryView":824 + * negative_step = step < 0 + * if step == 0: + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< * else: - * if len(self.view.format) == 1: - * return result[0] # <<<<<<<<<<<<<< - * return result - * + * negative_step = False */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L6_except_return; + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 824, __pyx_L1_error) - /* "View.MemoryView":499 - * raise ValueError("Unable to convert item to object") + /* "View.MemoryView":823 + * if have_step: + * negative_step = step < 0 + * if step == 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) * else: - * if len(self.view.format) == 1: # <<<<<<<<<<<<<< - * return result[0] - * return result */ } - /* "View.MemoryView":501 - * if len(self.view.format) == 1: - * return result[0] - * return result # <<<<<<<<<<<<<< + /* "View.MemoryView":821 + * else: * - * cdef assign_item_from_object(self, char *itemp, object value): + * if have_step: # <<<<<<<<<<<<<< + * negative_step = step < 0 + * if step == 0: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L6_except_return; + goto __pyx_L6; } - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "View.MemoryView":496 - * try: - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: # <<<<<<<<<<<<<< - * raise ValueError("Unable to convert item to object") + /* "View.MemoryView":826 + * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) * else: + * negative_step = False # <<<<<<<<<<<<<< + * step = 1 + * */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9); - __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0; - if (__pyx_t_8) { - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 496, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); + /*else*/ { + __pyx_v_negative_step = 0; - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< + /* "View.MemoryView":827 * else: - * if len(self.view.format) == 1: + * negative_step = False + * step = 1 # <<<<<<<<<<<<<< + * + * */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 497, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(2, 497, __pyx_L5_except_error) + __pyx_v_step = 1; } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + __pyx_L6:; - /* "View.MemoryView":494 + /* "View.MemoryView":830 * - * bytesitem = itemp[:self.view.itemsize] - * try: # <<<<<<<<<<<<<< - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape */ - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L6_except_return:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L0; - } + __pyx_t_2 = (__pyx_v_have_start != 0); + if (__pyx_t_2) { - /* "View.MemoryView":487 - * self.assign_item_from_object(itemp, value) + /* "View.MemoryView":831 * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesitem); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":832 + * if have_start: + * if start < 0: + * start += shape # <<<<<<<<<<<<<< + * if start < 0: + * start = 0 + */ + __pyx_v_start = (__pyx_v_start + __pyx_v_shape); -/* "View.MemoryView":503 - * return result - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: */ + __pyx_t_2 = (__pyx_v_start < 0); + if (__pyx_t_2) { -static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_v_struct = NULL; - char __pyx_v_c; - PyObject *__pyx_v_bytesvalue = 0; - Py_ssize_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - char *__pyx_t_11; - char *__pyx_t_12; - char *__pyx_t_13; - char *__pyx_t_14; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); + /* "View.MemoryView":834 + * start += shape + * if start < 0: + * start = 0 # <<<<<<<<<<<<<< + * elif start >= shape: + * if negative_step: + */ + __pyx_v_start = 0; - /* "View.MemoryView":506 - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" - * import struct # <<<<<<<<<<<<<< - * cdef char c - * cdef bytes bytesvalue + /* "View.MemoryView":833 + * if start < 0: + * start += shape + * if start < 0: # <<<<<<<<<<<<<< + * start = 0 + * elif start >= shape: */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_struct = __pyx_t_1; - __pyx_t_1 = 0; + } - /* "View.MemoryView":511 - * cdef Py_ssize_t i + /* "View.MemoryView":831 * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) - * else: + * if have_start: + * if start < 0: # <<<<<<<<<<<<<< + * start += shape + * if start < 0: */ - __pyx_t_2 = PyTuple_Check(__pyx_v_value); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + goto __pyx_L9; + } - /* "View.MemoryView":512 - * - * if isinstance(value, tuple): - * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 + */ + __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape); + if (__pyx_t_2) { + + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: + */ + if (__pyx_v_negative_step) { + + /* "View.MemoryView":837 + * elif start >= shape: + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = shape + */ + __pyx_v_start = (__pyx_v_shape - 1); + + /* "View.MemoryView":836 + * start = 0 + * elif start >= shape: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: + */ + goto __pyx_L11; + } + + /* "View.MemoryView":839 + * start = shape - 1 + * else: + * start = shape # <<<<<<<<<<<<<< * else: - * bytesvalue = struct.pack(self.view.format, value) + * if negative_step: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; + /*else*/ { + __pyx_v_start = __pyx_v_shape; + } + __pyx_L11:; - /* "View.MemoryView":511 - * cdef Py_ssize_t i + /* "View.MemoryView":835 + * if start < 0: + * start = 0 + * elif start >= shape: # <<<<<<<<<<<<<< + * if negative_step: + * start = shape - 1 + */ + } + __pyx_L9:; + + /* "View.MemoryView":830 * - * if isinstance(value, tuple): # <<<<<<<<<<<<<< - * bytesvalue = struct.pack(self.view.format, *value) + * + * if have_start: # <<<<<<<<<<<<<< + * if start < 0: + * start += shape + */ + goto __pyx_L8; + } + + /* "View.MemoryView":841 + * start = shape * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - goto __pyx_L3; - } + /*else*/ { + if (__pyx_v_negative_step) { - /* "View.MemoryView":514 - * bytesvalue = struct.pack(self.view.format, *value) + /* "View.MemoryView":842 * else: - * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< - * - * for i, c in enumerate(bytesvalue): + * if negative_step: + * start = shape - 1 # <<<<<<<<<<<<<< + * else: + * start = 0 */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 514, __pyx_L1_error) - __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - } - __pyx_L3:; + __pyx_v_start = (__pyx_v_shape - 1); - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c - * + /* "View.MemoryView":841 + * start = shape + * else: + * if negative_step: # <<<<<<<<<<<<<< + * start = shape - 1 + * else: */ - __pyx_t_9 = 0; - if (unlikely(__pyx_v_bytesvalue == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(2, 516, __pyx_L1_error) - } - __Pyx_INCREF(__pyx_v_bytesvalue); - __pyx_t_10 = __pyx_v_bytesvalue; - __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10); - __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10)); - for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) { - __pyx_t_11 = __pyx_t_14; - __pyx_v_c = (__pyx_t_11[0]); + goto __pyx_L12; + } - /* "View.MemoryView":517 - * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< + /* "View.MemoryView":844 + * start = shape - 1 + * else: + * start = 0 # <<<<<<<<<<<<<< * - * @cname('getbuffer') + * if have_stop: */ - __pyx_v_i = __pyx_t_9; + /*else*/ { + __pyx_v_start = 0; + } + __pyx_L12:; + } + __pyx_L8:; - /* "View.MemoryView":516 - * bytesvalue = struct.pack(self.view.format, value) - * - * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< - * itemp[i] = c + /* "View.MemoryView":846 + * start = 0 * + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ - __pyx_t_9 = (__pyx_t_9 + 1); + __pyx_t_2 = (__pyx_v_have_stop != 0); + if (__pyx_t_2) { - /* "View.MemoryView":517 + /* "View.MemoryView":847 * - * for i, c in enumerate(bytesvalue): - * itemp[i] = c # <<<<<<<<<<<<<< - * - * @cname('getbuffer') + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: */ - (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { - /* "View.MemoryView":503 - * return result - * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * """Only used if instantiated manually by the user, or if Cython doesn't - * know how to convert the type""" + /* "View.MemoryView":848 + * if have_stop: + * if stop < 0: + * stop += shape # <<<<<<<<<<<<<< + * if stop < 0: + * stop = 0 */ + __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_struct); - __Pyx_XDECREF(__pyx_v_bytesvalue); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":520 - * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ + __pyx_t_2 = (__pyx_v_stop < 0); + if (__pyx_t_2) { -/* Python wrapper */ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - char *__pyx_t_5; - void *__pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - if (__pyx_v_info == NULL) { - PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); - return -1; - } - __Pyx_RefNannySetupContext("__getbuffer__", 0); - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * + /* "View.MemoryView":850 + * stop += shape + * if stop < 0: + * stop = 0 # <<<<<<<<<<<<<< + * elif stop > shape: + * stop = shape */ - __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = (__pyx_v_self->view.readonly != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_v_stop = 0; - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< - * - * if flags & PyBUF_ND: + /* "View.MemoryView":849 + * if stop < 0: + * stop += shape + * if stop < 0: # <<<<<<<<<<<<<< + * stop = 0 + * elif stop > shape: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 522, __pyx_L1_error) + } - /* "View.MemoryView":521 - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< - * raise ValueError("Cannot create writable memory view from read-only memoryview") + /* "View.MemoryView":847 * + * if have_stop: + * if stop < 0: # <<<<<<<<<<<<<< + * stop += shape + * if stop < 0: */ - } + goto __pyx_L14; + } - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape); + if (__pyx_t_2) { - /* "View.MemoryView":525 - * - * if flags & PyBUF_ND: - * info.shape = self.view.shape # <<<<<<<<<<<<<< + /* "View.MemoryView":852 + * stop = 0 + * elif stop > shape: + * stop = shape # <<<<<<<<<<<<<< * else: - * info.shape = NULL + * if negative_step: */ - __pyx_t_4 = __pyx_v_self->view.shape; - __pyx_v_info->shape = __pyx_t_4; + __pyx_v_stop = __pyx_v_shape; - /* "View.MemoryView":524 - * raise ValueError("Cannot create writable memory view from read-only memoryview") - * - * if flags & PyBUF_ND: # <<<<<<<<<<<<<< - * info.shape = self.view.shape + /* "View.MemoryView":851 + * if stop < 0: + * stop = 0 + * elif stop > shape: # <<<<<<<<<<<<<< + * stop = shape * else: */ - goto __pyx_L6; - } + } + __pyx_L14:; - /* "View.MemoryView":527 - * info.shape = self.view.shape - * else: - * info.shape = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":846 + * start = 0 * - * if flags & PyBUF_STRIDES: + * if have_stop: # <<<<<<<<<<<<<< + * if stop < 0: + * stop += shape */ - /*else*/ { - __pyx_v_info->shape = NULL; - } - __pyx_L6:; + goto __pyx_L13; + } - /* "View.MemoryView":529 - * info.shape = NULL - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides + /* "View.MemoryView":854 + * stop = shape * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); - if (__pyx_t_1) { + /*else*/ { + if (__pyx_v_negative_step) { - /* "View.MemoryView":530 - * - * if flags & PyBUF_STRIDES: - * info.strides = self.view.strides # <<<<<<<<<<<<<< + /* "View.MemoryView":855 * else: - * info.strides = NULL + * if negative_step: + * stop = -1 # <<<<<<<<<<<<<< + * else: + * stop = shape */ - __pyx_t_4 = __pyx_v_self->view.strides; - __pyx_v_info->strides = __pyx_t_4; + __pyx_v_stop = -1L; - /* "View.MemoryView":529 - * info.shape = NULL - * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< - * info.strides = self.view.strides + /* "View.MemoryView":854 + * stop = shape * else: + * if negative_step: # <<<<<<<<<<<<<< + * stop = -1 + * else: */ - goto __pyx_L7; - } + goto __pyx_L16; + } - /* "View.MemoryView":532 - * info.strides = self.view.strides - * else: - * info.strides = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":857 + * stop = -1 + * else: + * stop = shape # <<<<<<<<<<<<<< + * * - * if flags & PyBUF_INDIRECT: */ - /*else*/ { - __pyx_v_info->strides = NULL; - } - __pyx_L7:; + /*else*/ { + __pyx_v_stop = __pyx_v_shape; + } + __pyx_L16:; + } + __pyx_L13:; - /* "View.MemoryView":534 - * info.strides = NULL + /* "View.MemoryView":861 * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: + * with cython.cdivision(True): + * new_shape = (stop - start) // step # <<<<<<<<<<<<<< + * + * if (stop - start) - step * new_shape: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); - if (__pyx_t_1) { + __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - /* "View.MemoryView":535 + /* "View.MemoryView":863 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 * - * if flags & PyBUF_INDIRECT: - * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< - * else: - * info.suboffsets = NULL */ - __pyx_t_4 = __pyx_v_self->view.suboffsets; - __pyx_v_info->suboffsets = __pyx_t_4; + __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); + if (__pyx_t_2) { - /* "View.MemoryView":534 - * info.strides = NULL + /* "View.MemoryView":864 * - * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< - * info.suboffsets = self.view.suboffsets - * else: + * if (stop - start) - step * new_shape: + * new_shape += 1 # <<<<<<<<<<<<<< + * + * if new_shape < 0: */ - goto __pyx_L8; - } + __pyx_v_new_shape = (__pyx_v_new_shape + 1); - /* "View.MemoryView":537 - * info.suboffsets = self.view.suboffsets - * else: - * info.suboffsets = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":863 + * new_shape = (stop - start) // step + * + * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< + * new_shape += 1 * - * if flags & PyBUF_FORMAT: */ - /*else*/ { - __pyx_v_info->suboffsets = NULL; - } - __pyx_L8:; + } - /* "View.MemoryView":539 - * info.suboffsets = NULL + /* "View.MemoryView":866 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_new_shape < 0); + if (__pyx_t_2) { - /* "View.MemoryView":540 + /* "View.MemoryView":867 + * + * if new_shape < 0: + * new_shape = 0 # <<<<<<<<<<<<<< + * * - * if flags & PyBUF_FORMAT: - * info.format = self.view.format # <<<<<<<<<<<<<< - * else: - * info.format = NULL */ - __pyx_t_5 = __pyx_v_self->view.format; - __pyx_v_info->format = __pyx_t_5; + __pyx_v_new_shape = 0; - /* "View.MemoryView":539 - * info.suboffsets = NULL + /* "View.MemoryView":866 + * new_shape += 1 + * + * if new_shape < 0: # <<<<<<<<<<<<<< + * new_shape = 0 * - * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< - * info.format = self.view.format - * else: */ - goto __pyx_L9; - } + } - /* "View.MemoryView":542 - * info.format = self.view.format - * else: - * info.format = NULL # <<<<<<<<<<<<<< + /* "View.MemoryView":870 * - * info.buf = self.view.buf + * + * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset */ - /*else*/ { - __pyx_v_info->format = NULL; - } - __pyx_L9:; + (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - /* "View.MemoryView":544 - * info.format = NULL + /* "View.MemoryView":871 + * + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< + * dst.suboffsets[new_ndim] = suboffset * - * info.buf = self.view.buf # <<<<<<<<<<<<<< - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize */ - __pyx_t_6 = __pyx_v_self->view.buf; - __pyx_v_info->buf = __pyx_t_6; + (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - /* "View.MemoryView":545 + /* "View.MemoryView":872 + * dst.strides[new_ndim] = stride * step + * dst.shape[new_ndim] = new_shape + * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + * * - * info.buf = self.view.buf - * info.ndim = self.view.ndim # <<<<<<<<<<<<<< - * info.itemsize = self.view.itemsize - * info.len = self.view.len */ - __pyx_t_7 = __pyx_v_self->view.ndim; - __pyx_v_info->ndim = __pyx_t_7; + (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; + } + __pyx_L3:; - /* "View.MemoryView":546 - * info.buf = self.view.buf - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< - * info.len = self.view.len - * info.readonly = self.view.readonly + /* "View.MemoryView":875 + * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ - __pyx_t_8 = __pyx_v_self->view.itemsize; - __pyx_v_info->itemsize = __pyx_t_8; + __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0); + if (__pyx_t_2) { - /* "View.MemoryView":547 - * info.ndim = self.view.ndim - * info.itemsize = self.view.itemsize - * info.len = self.view.len # <<<<<<<<<<<<<< - * info.readonly = self.view.readonly - * info.obj = self + /* "View.MemoryView":876 + * + * if suboffset_dim[0] < 0: + * dst.data += start * stride # <<<<<<<<<<<<<< + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride */ - __pyx_t_8 = __pyx_v_self->view.len; - __pyx_v_info->len = __pyx_t_8; + __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); - /* "View.MemoryView":548 - * info.itemsize = self.view.itemsize - * info.len = self.view.len - * info.readonly = self.view.readonly # <<<<<<<<<<<<<< - * info.obj = self + /* "View.MemoryView":875 * + * + * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< + * dst.data += start * stride + * else: */ - __pyx_t_1 = __pyx_v_self->view.readonly; - __pyx_v_info->readonly = __pyx_t_1; + goto __pyx_L19; + } - /* "View.MemoryView":549 - * info.len = self.view.len - * info.readonly = self.view.readonly - * info.obj = self # <<<<<<<<<<<<<< + /* "View.MemoryView":878 + * dst.data += start * stride + * else: + * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") + * if suboffset >= 0: */ - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + /*else*/ { + __pyx_t_3 = (__pyx_v_suboffset_dim[0]); + (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); + } + __pyx_L19:; - /* "View.MemoryView":520 + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: */ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - if (__pyx_v_info->obj != NULL) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - goto __pyx_L2; - __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; - } - __pyx_L2:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":555 + /* "View.MemoryView":881 * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ + __pyx_t_2 = (!__pyx_v_is_slice); + if (__pyx_t_2) { -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: + */ + __pyx_t_2 = (__pyx_v_new_ndim == 0); + if (__pyx_t_2) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":883 + * if not is_slice: + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + */ + __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":882 + * if suboffset >= 0: + * if not is_slice: + * if new_ndim == 0: # <<<<<<<<<<<<<< + * dst.data = ( dst.data)[0] + suboffset + * else: + */ + goto __pyx_L22; + } - /* "View.MemoryView":556 - * @property - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< - * transpose_memslice(&result.from_slice) - * return result + /* "View.MemoryView":885 + * dst.data = ( dst.data)[0] + suboffset + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) + * else: */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 556, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 556, __pyx_L1_error) - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); - __pyx_t_1 = 0; + /*else*/ { - /* "View.MemoryView":557 - * def T(self): - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< - * return result - * + /* "View.MemoryView":886 + * else: + * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " + * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * else: + * suboffset_dim[0] = new_ndim */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 557, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 885, __pyx_L1_error) + } + __pyx_L22:; - /* "View.MemoryView":558 - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - * return result # <<<<<<<<<<<<<< + /* "View.MemoryView":881 * - * @property + * if suboffset >= 0: + * if not is_slice: # <<<<<<<<<<<<<< + * if new_ndim == 0: + * dst.data = ( dst.data)[0] + suboffset */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + goto __pyx_L21; + } - /* "View.MemoryView":555 + /* "View.MemoryView":888 + * "must be indexed and not sliced", dim) + * else: + * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< * - * @property - * def T(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) + * return 0 */ + /*else*/ { + (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; + } + __pyx_L21:; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj + /* "View.MemoryView":880 + * dst.suboffsets[suboffset_dim[0]] += start * stride * + * if suboffset >= 0: # <<<<<<<<<<<<<< + * if not is_slice: + * if new_ndim == 0: */ + } -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":562 - * @property - * def base(self): - * return self.obj # <<<<<<<<<<<<<< + /* "View.MemoryView":890 + * suboffset_dim[0] = new_ndim + * + * return 0 # <<<<<<<<<<<<<< + * * - * @property */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->obj); - __pyx_r = __pyx_v_self->obj; + __pyx_r = 0; goto __pyx_L0; - /* "View.MemoryView":561 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.obj + /* "View.MemoryView":793 * + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, */ /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "View.MemoryView":565 - * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) +/* "View.MemoryView":896 * + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_length; - PyObject *__pyx_r = NULL; +static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_suboffset; + Py_ssize_t __pyx_v_itemsize; + char *__pyx_v_resultp; + char *__pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_UCS4 __pyx_t_4; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("pybuffer_index", 0); - /* "View.MemoryView":566 - * @property - * def shape(self): - * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< - * - * @property + /* "View.MemoryView":898 + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< + * cdef Py_ssize_t itemsize = view.itemsize + * cdef char *resultp */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_length = (__pyx_t_2[0]); - __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __pyx_v_suboffset = -1L; - /* "View.MemoryView":565 - * - * @property - * def shape(self): # <<<<<<<<<<<<<< - * return tuple([length for length in self.view.shape[:self.view.ndim]]) + /* "View.MemoryView":899 + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< + * cdef char *resultp * */ + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":569 + /* "View.MemoryView":902 + * cdef char *resultp * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize + */ + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { + + /* "View.MemoryView":903 * + * if view.ndim == 0: + * shape = view.len // itemsize # <<<<<<<<<<<<<< + * stride = itemsize + * else: */ + if (unlikely(__pyx_v_itemsize == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(1, 903, __pyx_L1_error) + } + else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); + __PYX_ERR(1, 903, __pyx_L1_error) + } + __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "View.MemoryView":904 + * if view.ndim == 0: + * shape = view.len // itemsize + * stride = itemsize # <<<<<<<<<<<<<< + * else: + * shape = view.shape[dim] + */ + __pyx_v_stride = __pyx_v_itemsize; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":902 + * cdef char *resultp + * + * if view.ndim == 0: # <<<<<<<<<<<<<< + * shape = view.len // itemsize + * stride = itemsize + */ + goto __pyx_L3; + } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_stride; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":906 + * stride = itemsize + * else: + * shape = view.shape[dim] # <<<<<<<<<<<<<< + * stride = view.strides[dim] + * if view.suboffsets != NULL: + */ + /*else*/ { + __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< - * - * raise ValueError("Buffer view does not expose strides") + /* "View.MemoryView":907 + * else: + * shape = view.shape[dim] + * stride = view.strides[dim] # <<<<<<<<<<<<<< + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] */ - __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - /* "View.MemoryView":572 - * if self.view.strides == NULL: - * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { - /* "View.MemoryView":570 - * @property - * def strides(self): - * if self.view.strides == NULL: # <<<<<<<<<<<<<< + /* "View.MemoryView":909 + * stride = view.strides[dim] + * if view.suboffsets != NULL: + * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< * - * raise ValueError("Buffer view does not expose strides") + * if index < 0: */ - } + __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); - /* "View.MemoryView":574 - * raise ValueError("Buffer view does not expose strides") - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< + /* "View.MemoryView":908 + * shape = view.shape[dim] + * stride = view.strides[dim] + * if view.suboffsets != NULL: # <<<<<<<<<<<<<< + * suboffset = view.suboffsets[dim] * - * @property */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_v_stride = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } } - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; + __pyx_L3:; - /* "View.MemoryView":569 - * - * @property - * def strides(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":577 + /* "View.MemoryView":912 * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + * if index < 0: + * index += view.shape[dim] # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" */ + __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + */ + __pyx_t_2 = (__pyx_v_index < 0); + if (unlikely(__pyx_t_2)) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":914 + * index += view.shape[dim] + * if index < 0: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * if index >= shape: + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__7); + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 914, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(1, 914, __pyx_L1_error) -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - Py_ssize_t *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":913 + * if index < 0: + * index += view.shape[dim] + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + */ + } - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim + /* "View.MemoryView":911 + * suboffset = view.suboffsets[dim] * + * if index < 0: # <<<<<<<<<<<<<< + * index += view.shape[dim] + * if index < 0: */ - __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); - if (__pyx_t_1) { + } - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" + * + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__15, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":578 - * @property - * def suboffsets(self): - * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< - * return (-1,) * self.view.ndim + /* "View.MemoryView":917 * + * if index >= shape: + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<< + * + * resultp = bufp + index * stride */ - } + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_4 = 127; + __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_1 += 37; + __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a); + __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_1 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__7); + __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 917, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 917, __pyx_L1_error) - /* "View.MemoryView":581 - * return (-1,) * self.view.ndim + /* "View.MemoryView":916 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< + * if index >= shape: # <<<<<<<<<<<<<< + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * @property */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); - for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) { - __pyx_t_4 = __pyx_t_6; - __pyx_v_suboffset = (__pyx_t_4[0]); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - /* "View.MemoryView":577 + /* "View.MemoryView":919 + * raise IndexError, f"Out of bounds on buffer access (axis {dim})" * - * @property - * def suboffsets(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim + * resultp = bufp + index * stride # <<<<<<<<<<<<<< + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset */ + __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":584 + /* "View.MemoryView":920 * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset * */ + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":921 + * resultp = bufp + index * stride + * if suboffset >= 0: + * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + * + * return resultp + */ + __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":920 + * + * resultp = bufp + index * stride + * if suboffset >= 0: # <<<<<<<<<<<<<< + * resultp = ( resultp)[0] + suboffset + * + */ + } - /* "View.MemoryView":585 - * @property - * def ndim(self): - * return self.view.ndim # <<<<<<<<<<<<<< + /* "View.MemoryView":923 + * resultp = ( resultp)[0] + suboffset + * + * return resultp # <<<<<<<<<<<<<< + * * - * @property */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 585, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = __pyx_v_resultp; goto __pyx_L0; - /* "View.MemoryView":584 - * - * @property - * def ndim(self): # <<<<<<<<<<<<<< - * return self.view.ndim + /* "View.MemoryView":896 * + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":588 +/* "View.MemoryView":929 * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim * */ -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { + int __pyx_v_ndim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; + long __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("transpose_memslice", 1); - /* "View.MemoryView":589 - * @property - * def itemsize(self): - * return self.view.itemsize # <<<<<<<<<<<<<< + /* "View.MemoryView":930 + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: + * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< * - * @property + * cdef Py_ssize_t *shape = memslice.shape */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; - /* "View.MemoryView":588 + /* "View.MemoryView":932 + * cdef int ndim = memslice.memview.view.ndim * - * @property - * def itemsize(self): # <<<<<<<<<<<<<< - * return self.view.itemsize + * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< + * cdef Py_ssize_t *strides = memslice.strides * */ + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":933 + * + * cdef Py_ssize_t *shape = memslice.shape + * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; -/* "View.MemoryView":592 + /* "View.MemoryView":937 * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize + * cdef int i, j + * for i in range(ndim // 2): # <<<<<<<<<<<<<< + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + */ + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "View.MemoryView":938 + * cdef int i, j + * for i in range(ndim // 2): + * j = ndim - 1 - i # <<<<<<<<<<<<<< + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] + */ + __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + + /* "View.MemoryView":939 + * for i in range(ndim // 2): + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< + * shape[i], shape[j] = shape[j], shape[i] * */ + __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "View.MemoryView":940 + * j = ndim - 1 - i + * strides[i], strides[j] = strides[j], strides[i] + * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + */ + __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + */ + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_8) { + } else { + __pyx_t_7 = __pyx_t_8; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_7 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_7) { -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "View.MemoryView":943 + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< + * + * return 0 + */ + __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_kp_s_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L1_error) - /* "View.MemoryView":593 - * @property - * def nbytes(self): - * return self.size * self.view.itemsize # <<<<<<<<<<<<<< + /* "View.MemoryView":942 + * shape[i], shape[j] = shape[j], shape[i] + * + * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") * - * @property */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 593, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + } + } + + /* "View.MemoryView":945 + * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") + * + * return 0 # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 0; goto __pyx_L0; - /* "View.MemoryView":592 + /* "View.MemoryView":929 * - * @property - * def nbytes(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim * */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "View.MemoryView":596 +/* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); - return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; +static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - Py_ssize_t *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 + /* "View.MemoryView":964 * - */ - __pyx_t_1 = (__pyx_v_self->_size == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":598 - * def size(self): - * if self._size is None: - * result = 1 # <<<<<<<<<<<<<< + * def __dealloc__(self): + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< * - * for length in self.view.shape[:self.view.ndim]: + * cdef convert_item_to_object(self, char *itemp): */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_result = __pyx_int_1; + __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1); - /* "View.MemoryView":600 - * result = 1 + /* "View.MemoryView":963 + * cdef int (*to_dtype_func)(char *, object) except 0 * - * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< - * result *= length + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * */ - __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); - for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { - __pyx_t_3 = __pyx_t_5; - __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6); - __pyx_t_6 = 0; - /* "View.MemoryView":601 - * - * for length in self.view.shape[:self.view.ndim]: - * result *= length # <<<<<<<<<<<<<< + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * self._size = result + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) */ - __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 601, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6); - __pyx_t_6 = 0; - } - /* "View.MemoryView":603 - * result *= length - * - * self._size = result # <<<<<<<<<<<<<< +static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("convert_item_to_object", 0); + + /* "View.MemoryView":967 * - * return self._size + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: */ - __Pyx_INCREF(__pyx_v_result); - __Pyx_GIVEREF(__pyx_v_result); - __Pyx_GOTREF(__pyx_v_self->_size); - __Pyx_DECREF(__pyx_v_self->_size); - __pyx_v_self->_size = __pyx_v_result; + __pyx_t_1 = (__pyx_v_self->to_object_func != NULL); + if (__pyx_t_1) { - /* "View.MemoryView":597 - * @property - * def size(self): - * if self._size is None: # <<<<<<<<<<<<<< - * result = 1 + /* "View.MemoryView":968 + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) # <<<<<<<<<<<<<< + * else: + * return memoryview.convert_item_to_object(self, itemp) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 968, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "View.MemoryView":967 * + * cdef convert_item_to_object(self, char *itemp): + * if self.to_object_func != NULL: # <<<<<<<<<<<<<< + * return self.to_object_func(itemp) + * else: */ } - /* "View.MemoryView":605 - * self._size = result - * - * return self._size # <<<<<<<<<<<<<< + /* "View.MemoryView":970 + * return self.to_object_func(itemp) + * else: + * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< * - * def __len__(self): + * cdef assign_item_from_object(self, char *itemp, object value): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_size); - __pyx_r = __pyx_v_self->_size; - goto __pyx_L0; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 970, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } - /* "View.MemoryView":596 + /* "View.MemoryView":966 + * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) * - * @property - * def size(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":607 - * return self._size +/* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ -/* Python wrapper */ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { - Py_ssize_t __pyx_r; +static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__len__", 0); + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] + /* "View.MemoryView":973 * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: */ - __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); + __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL); if (__pyx_t_1) { - /* "View.MemoryView":609 - * def __len__(self): - * if self.view.ndim >= 1: - * return self.view.shape[0] # <<<<<<<<<<<<<< - * - * return 0 + /* "View.MemoryView":974 + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< + * else: + * memoryview.assign_item_from_object(self, itemp, value) */ - __pyx_r = (__pyx_v_self->view.shape[0]); - goto __pyx_L0; + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 974, __pyx_L1_error) - /* "View.MemoryView":608 - * - * def __len__(self): - * if self.view.ndim >= 1: # <<<<<<<<<<<<<< - * return self.view.shape[0] + /* "View.MemoryView":973 * + * cdef assign_item_from_object(self, char *itemp, object value): + * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< + * self.to_dtype_func(itemp, value) + * else: */ + goto __pyx_L3; } - /* "View.MemoryView":611 - * return self.view.shape[0] - * - * return 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":976 + * self.to_dtype_func(itemp, value) + * else: + * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< * - * def __repr__(self): + * cdef _get_base(self): */ - __pyx_r = 0; - goto __pyx_L0; + /*else*/ { + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L3:; - /* "View.MemoryView":607 - * return self._size + /* "View.MemoryView":972 + * return memoryview.convert_item_to_object(self, itemp) * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":613 - * return 0 +/* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) */ -/* Python wrapper */ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "View.MemoryView":614 - * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_RefNannySetupContext("_get_base", 0); - /* "View.MemoryView":615 - * def __repr__(self): - * return "" % (self.base.__class__.__name__, - * id(self)) # <<<<<<<<<<<<<< + /* "View.MemoryView":979 * - * def __str__(self): - */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "View.MemoryView":614 + * cdef _get_base(self): + * return self.from_object # <<<<<<<<<<<<<< * - * def __repr__(self): - * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< - * id(self)) * */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->from_object); + __pyx_r = __pyx_v_self->from_object; goto __pyx_L0; - /* "View.MemoryView":613 - * return 0 + /* "View.MemoryView":978 + * memoryview.assign_item_from_object(self, itemp, value) + * + * cdef _get_base(self): # <<<<<<<<<<<<<< + * return self.from_object * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":617 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) - * +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + goto __pyx_L4_argument_unpacking_done; + goto __pyx_L3_error; + __pyx_L3_error:; + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { +static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "View.MemoryView":618 - * - * def __str__(self): - * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< - * - * + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "View.MemoryView":617 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) - * + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":621 - * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 3, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; +static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_c_contig", 0); - - /* "View.MemoryView":624 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'C', self.view.ndim) - * - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 624, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "View.MemoryView":625 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< - * - * def is_f_contig(self): + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "View.MemoryView":621 - * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) +/* "View.MemoryView":999 * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ -/* Python wrapper */ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; +static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { + struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; + Py_ssize_t __pyx_v_suboffset; + PyObject *__pyx_v_length = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice *__pyx_v_mslice; - __Pyx_memviewslice __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice *__pyx_t_1; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TypeInfo *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t *__pyx_t_6; + Py_ssize_t *__pyx_t_7; + Py_ssize_t *__pyx_t_8; + Py_ssize_t __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_f_contig", 0); + __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - /* "View.MemoryView":630 - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "View.MemoryView":1007 + * cdef _memoryviewslice result * - */ - __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 630, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; - - /* "View.MemoryView":631 - * cdef __Pyx_memviewslice tmp - * mslice = get_slice_from_memview(self, &tmp) - * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None * - * def copy(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 631, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None); + if (__pyx_t_1) { - /* "View.MemoryView":627 - * return slice_is_contig(mslice[0], 'C', self.view.ndim) + /* "View.MemoryView":1008 + * + * if memviewslice.memview == Py_None: + * return None # <<<<<<<<<<<<<< + * * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice - * cdef __Pyx_memviewslice tmp */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "View.MemoryView":1007 + * cdef _memoryviewslice result + * + * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< + * return None * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS */ + } -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_mslice; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy", 0); - - /* "View.MemoryView":635 - * def copy(self): - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< + /* "View.MemoryView":1013 * - * slice_copy(self, &mslice) + * + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<< + * + * result.from_slice = memviewslice */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0)) __PYX_ERR(1, 1013, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF((PyObject *)__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; - /* "View.MemoryView":637 - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + /* "View.MemoryView":1015 + * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) + * + * result.from_slice = memviewslice # <<<<<<<<<<<<<< + * __PYX_INC_MEMVIEW(&memviewslice, 1) * - * slice_copy(self, &mslice) # <<<<<<<<<<<<<< - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, - * self.view.itemsize, */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); + __pyx_v_result->from_slice = __pyx_v_memviewslice; - /* "View.MemoryView":638 + /* "View.MemoryView":1016 * - * slice_copy(self, &mslice) - * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_C_CONTIGUOUS, + * result.from_slice = memviewslice + * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< + * + * result.from_object = ( memviewslice.memview)._get_base() */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 638, __pyx_L1_error) - __pyx_v_mslice = __pyx_t_1; + __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - /* "View.MemoryView":643 - * self.dtype_is_object) + /* "View.MemoryView":1018 + * __PYX_INC_MEMVIEW(&memviewslice, 1) * - * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< + * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<< + * result.typeinfo = memviewslice.memview.typeinfo * - * def copy_fortran(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 643, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_result->from_object); + __Pyx_DECREF(__pyx_v_result->from_object); + __pyx_v_result->from_object = __pyx_t_2; __pyx_t_2 = 0; - goto __pyx_L0; - /* "View.MemoryView":633 - * return slice_is_contig(mslice[0], 'F', self.view.ndim) + /* "View.MemoryView":1019 * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + * result.from_object = ( memviewslice.memview)._get_base() + * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * + * result.view = memviewslice.memview.view */ + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) + /* "View.MemoryView":1021 + * result.typeinfo = memviewslice.memview.typeinfo * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< + * result.view.buf = memviewslice.data + * result.view.ndim = ndim */ + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); - __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1022 + * + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + */ + __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); -static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - int __pyx_v_flags; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_memviewslice __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("copy_fortran", 0); + /* "View.MemoryView":1023 + * result.view = memviewslice.memview.view + * result.view.buf = memviewslice.data + * result.view.ndim = ndim # <<<<<<<<<<<<<< + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) + */ + __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - /* "View.MemoryView":647 - * def copy_fortran(self): - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< + /* "View.MemoryView":1024 + * result.view.buf = memviewslice.data + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< + * Py_INCREF(Py_None) * - * slice_copy(self, &src) */ - __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); + ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; - /* "View.MemoryView":649 - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + /* "View.MemoryView":1025 + * result.view.ndim = ndim + * (<__pyx_buffer *> &result.view).obj = Py_None + * Py_INCREF(Py_None) # <<<<<<<<<<<<<< * - * slice_copy(self, &src) # <<<<<<<<<<<<<< - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, - * self.view.itemsize, + * if (memviewslice.memview).flags & PyBUF_WRITABLE: */ - __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); + Py_INCREF(Py_None); - /* "View.MemoryView":650 + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) * - * slice_copy(self, &src) - * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< - * self.view.itemsize, - * flags|PyBUF_F_CONTIGUOUS, + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 650, __pyx_L1_error) - __pyx_v_dst = __pyx_t_1; + __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + if (__pyx_t_1) { - /* "View.MemoryView":655 - * self.dtype_is_object) - * - * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1028 * + * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< + * else: + * result.flags = PyBUF_RECORDS_RO */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - /* "View.MemoryView":645 - * return memoryview_copy_from_slice(self, &mslice) + /* "View.MemoryView":1027 + * Py_INCREF(Py_None) * - * def copy_fortran(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice src, dst - * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< + * result.flags = PyBUF_RECORDS + * else: */ + goto __pyx_L4; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1030 + * result.flags = PyBUF_RECORDS + * else: + * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * + * result.view.shape = result.from_slice.shape + */ + /*else*/ { + __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + } + __pyx_L4:; -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "View.MemoryView":1032 + * result.flags = PyBUF_RECORDS_RO + * + * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< + * result.view.strides = result.from_slice.strides + * */ + __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + /* "View.MemoryView":1033 + * + * result.view.shape = result.from_slice.shape + * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1036 + * + * + * result.view.suboffsets = NULL # <<<<<<<<<<<<<< + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + */ + __pyx_v_result->__pyx_base.view.suboffsets = NULL; -static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + /* "View.MemoryView":1037 + * + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + */ + __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_v_suboffset = (__pyx_t_6[0]); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_1 = (__pyx_v_suboffset >= 0); + if (__pyx_t_1) { - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "View.MemoryView":1039 + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< + * break + * */ + __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1040 + * if suboffset >= 0: + * result.view.suboffsets = result.from_slice.suboffsets + * break # <<<<<<<<<<<<<< + * + * result.view.len = result.view.itemsize + */ + goto __pyx_L6_break; -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":1038 + * result.view.suboffsets = NULL + * for suboffset in result.from_slice.suboffsets[:ndim]: + * if suboffset >= 0: # <<<<<<<<<<<<<< + * result.view.suboffsets = result.from_slice.suboffsets + * break */ + } + } + __pyx_L6_break:; -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + /* "View.MemoryView":1042 + * break + * + * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< + * for length in result.view.shape[:ndim]: + * result.view.len *= length + */ + __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1043 + * + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< + * result.view.len *= length + * + */ + __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); + for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_6 = __pyx_t_8; + __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); + __pyx_t_2 = 0; -static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + /* "View.MemoryView":1044 + * result.view.len = result.view.itemsize + * for length in result.view.shape[:ndim]: + * result.view.len *= length # <<<<<<<<<<<<<< + * + * result.to_object_func = to_object_func + */ + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + } - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "View.MemoryView":1046 + * result.view.len *= length + * + * result.to_object_func = to_object_func # <<<<<<<<<<<<<< + * result.to_dtype_func = to_dtype_func + * */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_v_result->to_object_func = __pyx_v_to_object_func; - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":1047 + * + * result.to_object_func = to_object_func + * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< + * + * return result + */ + __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + + /* "View.MemoryView":1049 + * result.to_dtype_func = to_dtype_func + * + * return result # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_result); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + /* "View.MemoryView":999 + * + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_length); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":659 +/* "View.MemoryView":1052 * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ -static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) { - struct __pyx_memoryview_obj *__pyx_v_result = 0; - PyObject *__pyx_r = NULL; +static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { + struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; + __Pyx_memviewslice *__pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); + __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - /* "View.MemoryView":660 - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< - * result.typeinfo = typeinfo - * return result + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_o); - __Pyx_GIVEREF(__pyx_v_o); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "View.MemoryView":661 - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo # <<<<<<<<<<<<<< - * return result + /* "View.MemoryView":1056 + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): + * obj = memview # <<<<<<<<<<<<<< + * return &obj.from_slice + * else: + */ + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error) + __pyx_t_2 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "View.MemoryView":1057 + * if isinstance(memview, _memoryviewslice): + * obj = memview + * return &obj.from_slice # <<<<<<<<<<<<<< + * else: + * slice_copy(memview, mslice) + */ + __pyx_r = (&__pyx_v_obj->from_slice); + goto __pyx_L0; + + /* "View.MemoryView":1055 + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * obj = memview + * return &obj.from_slice + */ + } + + /* "View.MemoryView":1059 + * return &obj.from_slice + * else: + * slice_copy(memview, mslice) # <<<<<<<<<<<<<< + * return mslice * */ - __pyx_v_result->typeinfo = __pyx_v_typeinfo; + /*else*/ { + __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - /* "View.MemoryView":662 - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo - * return result # <<<<<<<<<<<<<< + /* "View.MemoryView":1060 + * else: + * slice_copy(memview, mslice) + * return mslice # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_check') + * @cname('__pyx_memoryview_slice_copy') */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; + __pyx_r = __pyx_v_mslice; + goto __pyx_L0; + } - /* "View.MemoryView":659 + /* "View.MemoryView":1052 * - * @cname('__pyx_memoryview_new') - * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< - * cdef memoryview result = memoryview(o, flags, dtype_is_object) - * result.typeinfo = typeinfo + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice) except NULL: + * cdef _memoryviewslice obj */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_obj); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":665 - * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) +/* "View.MemoryView":1063 * + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets */ -static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { - int __pyx_r; +static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { + int __pyx_v_dim; + Py_ssize_t *__pyx_v_shape; + Py_ssize_t *__pyx_v_strides; + Py_ssize_t *__pyx_v_suboffsets; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("memoryview_check", 0); + Py_ssize_t *__pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("slice_copy", 0); - /* "View.MemoryView":666 - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): - * return isinstance(o, memoryview) # <<<<<<<<<<<<<< + /* "View.MemoryView":1067 + * cdef (Py_ssize_t*) shape, strides, suboffsets * - * cdef tuple _unellipsify(object index, int ndim): + * shape = memview.view.shape # <<<<<<<<<<<<<< + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); - __pyx_r = __pyx_t_1; - goto __pyx_L0; + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; - /* "View.MemoryView":665 + /* "View.MemoryView":1068 * - * @cname('__pyx_memoryview_check') - * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< - * return isinstance(o, memoryview) + * shape = memview.view.shape + * strides = memview.view.strides # <<<<<<<<<<<<<< + * suboffsets = memview.view.suboffsets * */ + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1069 + * shape = memview.view.shape + * strides = memview.view.strides + * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + * + * dst.memview = <__pyx_memoryview *> memview + */ + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; -/* "View.MemoryView":668 - * return isinstance(o, memoryview) + /* "View.MemoryView":1071 + * suboffsets = memview.view.suboffsets + * + * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< + * dst.data = memview.view.buf * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with */ + __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); -static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { - PyObject *__pyx_v_tup = NULL; - PyObject *__pyx_v_result = NULL; - int __pyx_v_have_slices; - int __pyx_v_seen_ellipsis; - CYTHON_UNUSED PyObject *__pyx_v_idx = NULL; - PyObject *__pyx_v_item = NULL; - Py_ssize_t __pyx_v_nslices; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_unellipsify", 0); + /* "View.MemoryView":1072 + * + * dst.memview = <__pyx_memoryview *> memview + * dst.data = memview.view.buf # <<<<<<<<<<<<<< + * + * for dim in range(memview.view.ndim): + */ + __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: + /* "View.MemoryView":1074 + * dst.data = memview.view.buf + * + * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] */ - __pyx_t_1 = PyTuple_Check(__pyx_v_index); - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_2 = __pyx_v_memview->view.ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_dim = __pyx_t_4; - /* "View.MemoryView":674 - * """ - * if not isinstance(index, tuple): - * tup = (index,) # <<<<<<<<<<<<<< - * else: - * tup = index + /* "View.MemoryView":1075 + * + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 674, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_index); - __Pyx_GIVEREF(__pyx_v_index); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); - __pyx_v_tup = __pyx_t_3; - __pyx_t_3 = 0; + (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); - /* "View.MemoryView":673 - * full slices. - * """ - * if not isinstance(index, tuple): # <<<<<<<<<<<<<< - * tup = (index,) - * else: + /* "View.MemoryView":1076 + * for dim in range(memview.view.ndim): + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * */ - goto __pyx_L3; - } + (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); - /* "View.MemoryView":676 - * tup = (index,) - * else: - * tup = index # <<<<<<<<<<<<<< + /* "View.MemoryView":1077 + * dst.shape[dim] = shape[dim] + * dst.strides[dim] = strides[dim] + * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< * - * result = [] + * @cname('__pyx_memoryview_copy_object') */ - /*else*/ { - __Pyx_INCREF(__pyx_v_index); - __pyx_v_tup = __pyx_v_index; + __pyx_t_6 = (__pyx_v_suboffsets != 0); + if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); + } else { + __pyx_t_5 = -1L; + } + (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; } - __pyx_L3:; - /* "View.MemoryView":678 - * tup = index + /* "View.MemoryView":1063 * - * result = [] # <<<<<<<<<<<<<< - * have_slices = False - * seen_ellipsis = False + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 678, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_result = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - /* "View.MemoryView":679 + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "View.MemoryView":1080 * - * result = [] - * have_slices = False # <<<<<<<<<<<<<< - * seen_ellipsis = False - * for idx, item in enumerate(tup): + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice */ - __pyx_v_have_slices = 0; - /* "View.MemoryView":680 - * result = [] - * have_slices = False - * seen_ellipsis = False # <<<<<<<<<<<<<< - * for idx, item in enumerate(tup): - * if item is Ellipsis: - */ - __pyx_v_seen_ellipsis = 0; - - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_3 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) { - __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 681, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } - } else { - __pyx_t_7 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_7)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 681, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_7; - __pyx_t_7 = 0; - - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - */ - __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True - */ - __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0); - if (__pyx_t_1) { +static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { + __Pyx_memviewslice __pyx_v_memviewslice; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy", 0); - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: + /* "View.MemoryView":1083 + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< + * return memoryview_copy_from_slice(memview, &memviewslice) + * */ - __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__18); - __Pyx_GIVEREF(__pyx_slice__18); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__18); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); - /* "View.MemoryView":685 - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True # <<<<<<<<<<<<<< - * else: - * result.append(slice(None)) + /* "View.MemoryView":1084 + * cdef __Pyx_memviewslice memviewslice + * slice_copy(memview, &memviewslice) + * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_copy_object_from_slice') */ - __pyx_v_seen_ellipsis = 1; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":683 - * for idx, item in enumerate(tup): - * if item is Ellipsis: - * if not seen_ellipsis: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - * seen_ellipsis = True + /* "View.MemoryView":1080 + * + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice */ - goto __pyx_L7; - } - /* "View.MemoryView":687 - * seen_ellipsis = True - * else: - * result.append(slice(None)) # <<<<<<<<<<<<<< - * have_slices = True - * else: - */ - /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__18); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 687, __pyx_L1_error) - } - __pyx_L7:; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":688 - * else: - * result.append(slice(None)) - * have_slices = True # <<<<<<<<<<<<<< - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): +/* "View.MemoryView":1087 + * + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ - __pyx_v_have_slices = 1; - /* "View.MemoryView":682 - * seen_ellipsis = False - * for idx, item in enumerate(tup): - * if item is Ellipsis: # <<<<<<<<<<<<<< - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) - */ - goto __pyx_L6; - } +static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { + PyObject *(*__pyx_v_to_object_func)(char *); + int (*__pyx_v_to_dtype_func)(char *, PyObject *); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *(*__pyx_t_2)(char *); + int (*__pyx_t_3)(char *, PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - /*else*/ { - __pyx_t_2 = PySlice_Check(__pyx_v_item); - __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0); - if (__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0); - __pyx_t_1 = __pyx_t_10; - __pyx_L9_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); + if (__pyx_t_1) { - /* "View.MemoryView":691 - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): - * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<< + /* "View.MemoryView":1095 * - * have_slices = have_slices or isinstance(item, slice) + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: */ - __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(2, 691, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_2; - /* "View.MemoryView":690 - * have_slices = True - * else: - * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< - * raise TypeError("Cannot index with type '%s'" % type(item)) - * + /* "View.MemoryView":1096 + * if isinstance(memview, _memoryviewslice): + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< + * else: + * to_object_func = NULL */ - } + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_3; - /* "View.MemoryView":693 - * raise TypeError("Cannot index with type '%s'" % type(item)) - * - * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< - * result.append(item) + /* "View.MemoryView":1094 + * cdef int (*to_dtype_func)(char *, object) except 0 * + * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< + * to_object_func = (<_memoryviewslice> memview).to_object_func + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func */ - __pyx_t_10 = (__pyx_v_have_slices != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_1 = __pyx_t_10; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = PySlice_Check(__pyx_v_item); - __pyx_t_2 = (__pyx_t_10 != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L11_bool_binop_done:; - __pyx_v_have_slices = __pyx_t_1; + goto __pyx_L3; + } - /* "View.MemoryView":694 - * - * have_slices = have_slices or isinstance(item, slice) - * result.append(item) # <<<<<<<<<<<<<< + /* "View.MemoryView":1098 + * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func + * else: + * to_object_func = NULL # <<<<<<<<<<<<<< + * to_dtype_func = NULL * - * nslices = ndim - len(result) */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 694, __pyx_L1_error) - } - __pyx_L6:; + /*else*/ { + __pyx_v_to_object_func = NULL; - /* "View.MemoryView":681 - * have_slices = False - * seen_ellipsis = False - * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< - * if item is Ellipsis: - * if not seen_ellipsis: + /* "View.MemoryView":1099 + * else: + * to_object_func = NULL + * to_dtype_func = NULL # <<<<<<<<<<<<<< + * + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, */ + __pyx_v_to_dtype_func = NULL; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_L3:; - /* "View.MemoryView":696 - * result.append(item) + /* "View.MemoryView":1101 + * to_dtype_func = NULL * - * nslices = ndim - len(result) # <<<<<<<<<<<<<< - * if nslices: - * result.extend([slice(None)] * nslices) + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< + * to_object_func, to_dtype_func, + * memview.dtype_is_object) */ - __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 696, __pyx_L1_error) - __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); + __Pyx_XDECREF(__pyx_r); - /* "View.MemoryView":697 + /* "View.MemoryView":1103 + * return memoryview_fromslice(memviewslice[0], memview.view.ndim, + * to_object_func, to_dtype_func, + * memview.dtype_is_object) # <<<<<<<<<<<<<< * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) * */ - __pyx_t_1 = (__pyx_v_nslices != 0); - if (__pyx_t_1) { + __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "View.MemoryView":698 - * nslices = ndim - len(result) - * if nslices: - * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< + /* "View.MemoryView":1087 * - * return have_slices or nslices, tuple(result) + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__18); - __Pyx_GIVEREF(__pyx_slice__18); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__18); - } - } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":697 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "View.MemoryView":1109 + * * - * nslices = ndim - len(result) - * if nslices: # <<<<<<<<<<<<<< - * result.extend([slice(None)] * nslices) + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg * */ - } - /* "View.MemoryView":700 - * result.extend([slice(None)] * nslices) +static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + + /* "View.MemoryView":1110 * - * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: + * return -arg if arg < 0 else arg # <<<<<<<<<<<<<< * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): + * @cname('__pyx_get_best_slice_order') */ - __Pyx_XDECREF(__pyx_r); - if (!__pyx_v_have_slices) { + __pyx_t_2 = (__pyx_v_arg < 0); + if (__pyx_t_2) { + __pyx_t_1 = (-__pyx_v_arg); } else { - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L14_bool_binop_done; + __pyx_t_1 = __pyx_v_arg; } - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_L14_bool_binop_done:; - __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4); - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_r = ((PyObject*)__pyx_t_11); - __pyx_t_11 = 0; + __pyx_r = __pyx_t_1; goto __pyx_L0; - /* "View.MemoryView":668 - * return isinstance(o, memoryview) + /* "View.MemoryView":1109 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<< + * return -arg if arg < 0 else arg * - * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< - * """ - * Replace all ellipses with full slices and fill incomplete indices with */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tup); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_XDECREF(__pyx_v_item); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) +/* "View.MemoryView":1113 * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. */ -static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; +static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { + int __pyx_v_i; + Py_ssize_t __pyx_v_c_stride; + Py_ssize_t __pyx_v_f_stride; + char __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - /* "View.MemoryView":703 + /* "View.MemoryView":1118 + * """ + * cdef int i + * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< + * cdef Py_ssize_t f_stride = 0 * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") */ - __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim); - for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) { - __pyx_t_1 = __pyx_t_3; - __pyx_v_suboffset = (__pyx_t_1[0]); + __pyx_v_c_stride = 0; - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") + /* "View.MemoryView":1119 + * cdef int i + * cdef Py_ssize_t c_stride = 0 + * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< * + * for i in range(ndim - 1, -1, -1): */ - __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_v_f_stride = 0; - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1121 + * cdef Py_ssize_t f_stride = 0 * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(2, 705, __pyx_L1_error) + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":704 - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * raise ValueError("Indirect dimensions not supported") + /* "View.MemoryView":1122 * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break */ - } - } + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { - /* "View.MemoryView":702 - * return have_slices or nslices, tuple(result) + /* "View.MemoryView":1123 + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break * - * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: */ + __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":712 + /* "View.MemoryView":1124 + * if mslice.shape[i] > 1: + * c_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step + * for i in range(ndim): */ + goto __pyx_L4_break; -static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) { - int __pyx_v_new_ndim; - int __pyx_v_suboffset_dim; - int __pyx_v_dim; - __Pyx_memviewslice __pyx_v_src; - __Pyx_memviewslice __pyx_v_dst; - __Pyx_memviewslice *__pyx_v_p_src; - struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0; - __Pyx_memviewslice *__pyx_v_p_dst; - int *__pyx_v_p_suboffset_dim; - Py_ssize_t __pyx_v_start; - Py_ssize_t __pyx_v_stop; - Py_ssize_t __pyx_v_step; - int __pyx_v_have_start; - int __pyx_v_have_stop; - int __pyx_v_have_step; - PyObject *__pyx_v_index = NULL; - struct __pyx_memoryview_obj *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - struct __pyx_memoryview_obj *__pyx_t_4; - char *__pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memview_slice", 0); - - /* "View.MemoryView":713 - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): - * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< - * cdef bint negative_step - * cdef __Pyx_memviewslice src, dst + /* "View.MemoryView":1122 + * + * for i in range(ndim - 1, -1, -1): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * c_stride = mslice.strides[i] + * break */ - __pyx_v_new_ndim = 0; - __pyx_v_suboffset_dim = -1; + } + } + __pyx_L4_break:; - /* "View.MemoryView":720 + /* "View.MemoryView":1126 + * break * + * for i in range(ndim): # <<<<<<<<<<<<<< + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + */ + __pyx_t_1 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_1; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "View.MemoryView":1127 * - * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break + */ + __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1); + if (__pyx_t_2) { + + /* "View.MemoryView":1128 + * for i in range(ndim): + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< + * break * - * cdef _memoryviewslice memviewsliceobj */ - (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); + __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":724 - * cdef _memoryviewslice memviewsliceobj + /* "View.MemoryView":1129 + * if mslice.shape[i] > 1: + * f_stride = mslice.strides[i] + * break # <<<<<<<<<<<<<< * - * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + */ + goto __pyx_L7_break; + + /* "View.MemoryView":1127 * - * if isinstance(memview, _memoryviewslice): + * for i in range(ndim): + * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< + * f_stride = mslice.strides[i] + * break */ - #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!Py_OptimizeFlag)) { - if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { - PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(2, 724, __pyx_L1_error) } } - #endif + __pyx_L7_break:; - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 + /* "View.MemoryView":1131 + * break * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); + __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)); if (__pyx_t_2) { - /* "View.MemoryView":727 + /* "View.MemoryView":1132 * - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview # <<<<<<<<<<<<<< - * p_src = &memviewsliceobj.from_slice + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * return 'C' # <<<<<<<<<<<<<< * else: + * return 'F' */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 727, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_r = 'C'; + goto __pyx_L0; - /* "View.MemoryView":728 - * if isinstance(memview, _memoryviewslice): - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, &src) - */ - __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); - - /* "View.MemoryView":726 - * assert memview.view.ndim > 0 + /* "View.MemoryView":1131 + * break * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * memviewsliceobj = memview - * p_src = &memviewsliceobj.from_slice + * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< + * return 'C' + * else: */ - goto __pyx_L3; } - /* "View.MemoryView":730 - * p_src = &memviewsliceobj.from_slice + /* "View.MemoryView":1134 + * return 'C' * else: - * slice_copy(memview, &src) # <<<<<<<<<<<<<< - * p_src = &src + * return 'F' # <<<<<<<<<<<<<< * + * @cython.cdivision(True) */ /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - - /* "View.MemoryView":731 - * else: - * slice_copy(memview, &src) - * p_src = &src # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_p_src = (&__pyx_v_src); + __pyx_r = 'F'; + goto __pyx_L0; } - __pyx_L3:; - /* "View.MemoryView":737 - * - * - * dst.memview = p_src.memview # <<<<<<<<<<<<<< - * dst.data = p_src.data + /* "View.MemoryView":1113 * + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. */ - __pyx_t_4 = __pyx_v_p_src->memview; - __pyx_v_dst.memview = __pyx_t_4; - /* "View.MemoryView":738 - * - * dst.memview = p_src.memview - * dst.data = p_src.data # <<<<<<<<<<<<<< - * + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1137 * + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ - __pyx_t_5 = __pyx_v_p_src->data; - __pyx_v_dst.data = __pyx_t_5; - /* "View.MemoryView":743 - * +static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; + Py_ssize_t __pyx_v_dst_extent; + Py_ssize_t __pyx_v_src_stride; + Py_ssize_t __pyx_v_dst_stride; + int __pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + + /* "View.MemoryView":1144 * - * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< - * cdef int *p_suboffset_dim = &suboffset_dim - * cdef Py_ssize_t start, stop, step + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] */ - __pyx_v_p_dst = (&__pyx_v_dst); + __pyx_v_src_extent = (__pyx_v_src_shape[0]); - /* "View.MemoryView":744 - * - * cdef __Pyx_memviewslice *p_dst = &dst - * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< - * cdef Py_ssize_t start, stop, step - * cdef bint have_start, have_stop, have_step + /* "View.MemoryView":1145 + * cdef Py_ssize_t i + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] */ - __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); + __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step + /* "View.MemoryView":1146 + * cdef Py_ssize_t src_extent = src_shape[0] + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t dst_stride = dst_strides[0] * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( */ - __pyx_t_6 = 0; - if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 748, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error) - #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - } - } else { - __pyx_t_9 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_9)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 748, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_9); - } - __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_v_dim = __pyx_t_6; - __pyx_t_6 = (__pyx_t_6 + 1); + __pyx_v_src_stride = (__pyx_v_src_strides[0]); - /* "View.MemoryView":749 + /* "View.MemoryView":1147 + * cdef Py_ssize_t dst_extent = dst_shape[0] + * cdef Py_ssize_t src_stride = src_strides[0] + * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * if ndim == 1: */ - __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0); - if (__pyx_t_2) { + __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); - /* "View.MemoryView":753 - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, - * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<< - * 0, 0, 0, # have_{start,stop,step} - * False) + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] + * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): */ - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 753, __pyx_L1_error) + __pyx_t_1 = (__pyx_v_ndim == 1); + if (__pyx_t_1) { - /* "View.MemoryView":750 - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + /* "View.MemoryView":1150 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 750, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_src_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_2 = (__pyx_v_dst_stride > 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L5_bool_binop_done; + } - /* "View.MemoryView":749 - * - * for dim, index in enumerate(indices): - * if PyIndex_Check(index): # <<<<<<<<<<<<<< - * slice_memviewslice( - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + /* "View.MemoryView":1151 + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize * dst_extent) + * else: */ - goto __pyx_L6; + __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); } + __pyx_t_1 = __pyx_t_2; + __pyx_L5_bool_binop_done:; - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 + /* "View.MemoryView":1150 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - __pyx_t_2 = (__pyx_v_index == Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "View.MemoryView":757 - * False) - * elif index is None: - * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 + /* "View.MemoryView":1152 + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): */ - (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); - /* "View.MemoryView":758 - * elif index is None: - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 + /* "View.MemoryView":1150 + * + * if ndim == 1: + * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< + * src_stride == itemsize == dst_stride): + * memcpy(dst_data, src_data, itemsize * dst_extent) */ - (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; + goto __pyx_L4; + } - /* "View.MemoryView":759 - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< - * new_ndim += 1 + /* "View.MemoryView":1154 + * memcpy(dst_data, src_data, itemsize * dst_extent) * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride */ - (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":760 - * p_dst.strides[new_ndim] = 0 - * p_dst.suboffsets[new_ndim] = -1 - * new_ndim += 1 # <<<<<<<<<<<<<< + /* "View.MemoryView":1155 * else: - * start = index.start or 0 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< + * src_data += src_stride + * dst_data += dst_stride */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); + (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); - /* "View.MemoryView":756 - * 0, 0, 0, # have_{start,stop,step} - * False) - * elif index is None: # <<<<<<<<<<<<<< - * p_dst.shape[new_ndim] = 1 - * p_dst.strides[new_ndim] = 0 + /* "View.MemoryView":1156 + * for i in range(dst_extent): + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride + * else: */ - goto __pyx_L6; - } + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "View.MemoryView":762 - * new_ndim += 1 - * else: - * start = index.start or 0 # <<<<<<<<<<<<<< - * stop = index.stop or 0 - * step = index.step or 0 + /* "View.MemoryView":1157 + * memcpy(dst_data, src_data, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< + * else: + * for i in range(dst_extent): */ - /*else*/ { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L7_bool_binop_done; + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); } - __pyx_t_10 = 0; - __pyx_L7_bool_binop_done:; - __pyx_v_start = __pyx_t_10; + } + __pyx_L4:; - /* "View.MemoryView":763 - * else: - * start = index.start or 0 - * stop = index.stop or 0 # <<<<<<<<<<<<<< - * step = index.step or 0 + /* "View.MemoryView":1149 + * cdef Py_ssize_t dst_stride = dst_strides[0] * + * if ndim == 1: # <<<<<<<<<<<<<< + * if (src_stride > 0 and dst_stride > 0 and + * src_stride == itemsize == dst_stride): */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 763, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 763, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 763, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L9_bool_binop_done:; - __pyx_v_stop = __pyx_t_10; + goto __pyx_L3; + } - /* "View.MemoryView":764 - * start = index.start or 0 - * stop = index.stop or 0 - * step = index.step or 0 # <<<<<<<<<<<<<< - * - * have_start = index.start is not None + /* "View.MemoryView":1159 + * dst_data += dst_stride + * else: + * for i in range(dst_extent): # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src_data, src_strides + 1, + * dst_data, dst_strides + 1, */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 764, __pyx_L1_error) - if (!__pyx_t_1) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 764, __pyx_L1_error) - __pyx_t_10 = __pyx_t_12; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_10 = 0; - __pyx_L11_bool_binop_done:; - __pyx_v_step = __pyx_t_10; + /*else*/ { + __pyx_t_3 = __pyx_v_dst_extent; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":766 - * step = index.step or 0 - * - * have_start = index.start is not None # <<<<<<<<<<<<<< - * have_stop = index.stop is not None - * have_step = index.step is not None + /* "View.MemoryView":1160 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< + * dst_data, dst_strides + 1, + * src_shape + 1, dst_shape + 1, */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_start = __pyx_t_1; + _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - /* "View.MemoryView":767 - * - * have_start = index.start is not None - * have_stop = index.stop is not None # <<<<<<<<<<<<<< - * have_step = index.step is not None + /* "View.MemoryView":1164 + * src_shape + 1, dst_shape + 1, + * ndim - 1, itemsize) + * src_data += src_stride # <<<<<<<<<<<<<< + * dst_data += dst_stride * */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 767, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_stop = __pyx_t_1; + __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "View.MemoryView":768 - * have_start = index.start is not None - * have_stop = index.stop is not None - * have_step = index.step is not None # <<<<<<<<<<<<<< + /* "View.MemoryView":1165 + * ndim - 1, itemsize) + * src_data += src_stride + * dst_data += dst_stride # <<<<<<<<<<<<<< * - * slice_memviewslice( + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 768, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_have_step = __pyx_t_1; + __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + } + } + __pyx_L3:; - /* "View.MemoryView":770 - * have_step = index.step is not None + /* "View.MemoryView":1137 * - * slice_memviewslice( # <<<<<<<<<<<<<< - * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], - * dim, new_ndim, p_suboffset_dim, + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 770, __pyx_L1_error) - /* "View.MemoryView":776 - * have_start, have_stop, have_step, - * True) - * new_ndim += 1 # <<<<<<<<<<<<<< - * - * if isinstance(memview, _memoryviewslice): - */ - __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - } - __pyx_L6:; + /* function exit code */ +} - /* "View.MemoryView":748 - * cdef bint have_start, have_stop, have_step +/* "View.MemoryView":1167 + * dst_data += dst_stride * - * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< - * if PyIndex_Check(index): - * slice_memviewslice( + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":778 - * new_ndim += 1 - * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { +static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - /* "View.MemoryView":779 + /* "View.MemoryView":1170 + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); + _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); - /* "View.MemoryView":780 - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< - * memviewsliceobj.to_dtype_func, - * memview.dtype_is_object) + /* "View.MemoryView":1167 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) noexcept nogil: */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 780, __pyx_L1_error) } - /* "View.MemoryView":781 - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< - * memview.dtype_is_object) - * else: - */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 781, __pyx_L1_error) } + /* function exit code */ +} - /* "View.MemoryView":779 +/* "View.MemoryView":1174 * - * if isinstance(memview, _memoryviewslice): - * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< - * memviewsliceobj.to_object_func, - * memviewsliceobj.to_dtype_func, + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 779, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 779, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - /* "View.MemoryView":778 - * new_ndim += 1 +static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { + Py_ssize_t __pyx_v_shape; + Py_ssize_t __pyx_v_size; + Py_ssize_t __pyx_r; + Py_ssize_t __pyx_t_1; + Py_ssize_t *__pyx_t_2; + Py_ssize_t *__pyx_t_3; + Py_ssize_t *__pyx_t_4; + + /* "View.MemoryView":1176 + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * return memoryview_fromslice(dst, new_ndim, - * memviewsliceobj.to_object_func, + * for shape in src.shape[:ndim]: */ - } + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) + /* "View.MemoryView":1178 + * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * + * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< + * size *= shape * */ - /*else*/ { - __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); + for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_2 = __pyx_t_4; + __pyx_v_shape = (__pyx_t_2[0]); - /* "View.MemoryView":785 - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, - * memview.dtype_is_object) # <<<<<<<<<<<<<< + /* "View.MemoryView":1179 * + * for shape in src.shape[:ndim]: + * size *= shape # <<<<<<<<<<<<<< * + * return size */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_v_size = (__pyx_v_size * __pyx_v_shape); + } - /* "View.MemoryView":784 - * memview.dtype_is_object) - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< - * memview.dtype_is_object) + /* "View.MemoryView":1181 + * size *= shape + * + * return size # <<<<<<<<<<<<<< * + * @cname('__pyx_fill_contig_strides_array') */ - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 784, __pyx_L1_error) - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - } + __pyx_r = __pyx_v_size; + goto __pyx_L0; - /* "View.MemoryView":712 + /* "View.MemoryView":1174 * - * @cname('__pyx_memview_slice') - * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< - * cdef int new_ndim = 0, suboffset_dim = -1, dim - * cdef bint negative_step + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef Py_ssize_t shape, size = src.memview.view.itemsize */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":809 +/* "View.MemoryView":1184 * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: */ -static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) { - Py_ssize_t __pyx_v_new_shape; - int __pyx_v_negative_step; - int __pyx_r; +static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { + int __pyx_v_idx; + Py_ssize_t __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; + int __pyx_t_4; - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< + /* "View.MemoryView":1193 + * cdef int idx * - * if start < 0: + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ - __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0); + __pyx_t_1 = (__pyx_v_order == 'F'); if (__pyx_t_1) { - /* "View.MemoryView":831 - * if not is_slice: + /* "View.MemoryView":1194 * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: + * if order == 'F': + * for idx in range(ndim): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] */ - __pyx_t_1 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_idx = __pyx_t_4; - /* "View.MemoryView":832 - * - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) - */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - - /* "View.MemoryView":831 - * if not is_slice: - * - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if not 0 <= start < shape: + /* "View.MemoryView":1195 + * if order == 'F': + * for idx in range(ndim): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] + * else: */ - } + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) + /* "View.MemoryView":1196 + * for idx in range(ndim): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< * else: + * for idx in range(ndim - 1, -1, -1): */ - __pyx_t_1 = (0 <= __pyx_v_start); - if (__pyx_t_1) { - __pyx_t_1 = (__pyx_v_start < __pyx_v_shape); + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":834 - * start += shape - * if not 0 <= start < shape: - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< - * else: + /* "View.MemoryView":1193 + * cdef int idx * + * if order == 'F': # <<<<<<<<<<<<<< + * for idx in range(ndim): + * strides[idx] = stride */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 834, __pyx_L1_error) + goto __pyx_L3; + } - /* "View.MemoryView":833 - * if start < 0: - * start += shape - * if not 0 <= start < shape: # <<<<<<<<<<<<<< - * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) + /* "View.MemoryView":1198 + * stride *= shape[idx] * else: + * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * strides[idx] = stride + * stride *= shape[idx] */ - } + /*else*/ { + for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { + __pyx_v_idx = __pyx_t_2; - /* "View.MemoryView":829 - * cdef bint negative_step - * - * if not is_slice: # <<<<<<<<<<<<<< + /* "View.MemoryView":1199 + * else: + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride # <<<<<<<<<<<<<< + * stride *= shape[idx] * - * if start < 0: */ - goto __pyx_L3; - } + (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":837 - * else: - * - * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":1200 + * for idx in range(ndim - 1, -1, -1): + * strides[idx] = stride + * stride *= shape[idx] # <<<<<<<<<<<<<< * - * if have_step and step == 0: + * return stride */ - /*else*/ { - __pyx_t_1 = ((__pyx_v_have_step != 0) != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L6_bool_binop_done; + __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } - __pyx_t_1 = ((__pyx_v_step < 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L6_bool_binop_done:; - __pyx_v_negative_step = __pyx_t_2; + } + __pyx_L3:; - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 + /* "View.MemoryView":1202 + * stride *= shape[idx] * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + * return stride # <<<<<<<<<<<<<< * + * @cname('__pyx_memoryview_copy_data_to_temp') */ - __pyx_t_1 = (__pyx_v_have_step != 0); - if (__pyx_t_1) { - } else { - __pyx_t_2 = __pyx_t_1; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_1 = ((__pyx_v_step == 0) != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L9_bool_binop_done:; - if (__pyx_t_2) { + __pyx_r = __pyx_v_stride; + goto __pyx_L0; - /* "View.MemoryView":840 - * - * if have_step and step == 0: - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< + /* "View.MemoryView":1184 * + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) noexcept nogil: + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1205 * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 840, __pyx_L1_error) - /* "View.MemoryView":839 - * negative_step = have_step != 0 and step < 0 +static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { + int __pyx_v_i; + void *__pyx_v_result; + size_t __pyx_v_itemsize; + size_t __pyx_v_size; + void *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("copy_data_to_temp", 1); + + /* "View.MemoryView":1216 + * cdef void *result * - * if have_step and step == 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef size_t size = slice_get_size(src, ndim) * */ - } + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":843 + /* "View.MemoryView":1217 * + * cdef size_t itemsize = src.memview.view.itemsize + * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape + * result = malloc(size) */ - __pyx_t_2 = (__pyx_v_have_start != 0); - if (__pyx_t_2) { + __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - /* "View.MemoryView":844 + /* "View.MemoryView":1219 + * cdef size_t size = slice_get_size(src, ndim) * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: + * result = malloc(size) # <<<<<<<<<<<<<< + * if not result: + * _err_no_memory() */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { + __pyx_v_result = malloc(__pyx_v_size); - /* "View.MemoryView":845 - * if have_start: - * if start < 0: - * start += shape # <<<<<<<<<<<<<< - * if start < 0: - * start = 0 + /* "View.MemoryView":1220 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * */ - __pyx_v_start = (__pyx_v_start + __pyx_v_shape); + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "View.MemoryView":1221 + * result = malloc(size) + * if not result: + * _err_no_memory() # <<<<<<<<<<<<<< + * + * */ - __pyx_t_2 = ((__pyx_v_start < 0) != 0); - if (__pyx_t_2) { + __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error) - /* "View.MemoryView":847 - * start += shape - * if start < 0: - * start = 0 # <<<<<<<<<<<<<< - * elif start >= shape: - * if negative_step: + /* "View.MemoryView":1220 + * + * result = malloc(size) + * if not result: # <<<<<<<<<<<<<< + * _err_no_memory() + * */ - __pyx_v_start = 0; + } - /* "View.MemoryView":846 - * if start < 0: - * start += shape - * if start < 0: # <<<<<<<<<<<<<< - * start = 0 - * elif start >= shape: + /* "View.MemoryView":1224 + * + * + * tmpslice.data = result # <<<<<<<<<<<<<< + * tmpslice.memview = src.memview + * for i in range(ndim): */ - } + __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - /* "View.MemoryView":844 + /* "View.MemoryView":1225 * - * if have_start: - * if start < 0: # <<<<<<<<<<<<<< - * start += shape - * if start < 0: + * tmpslice.data = result + * tmpslice.memview = src.memview # <<<<<<<<<<<<<< + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] */ - goto __pyx_L12; - } + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 + /* "View.MemoryView":1226 + * tmpslice.data = result + * tmpslice.memview = src.memview + * for i in range(ndim): # <<<<<<<<<<<<<< + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 */ - __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0); - if (__pyx_t_2) { + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "View.MemoryView":1227 + * tmpslice.memview = src.memview + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< + * tmpslice.suboffsets[i] = -1 + * */ - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { + (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - /* "View.MemoryView":850 - * elif start >= shape: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = shape + /* "View.MemoryView":1228 + * for i in range(ndim): + * tmpslice.shape[i] = src.shape[i] + * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) */ - __pyx_v_start = (__pyx_v_shape - 1); + (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; + } - /* "View.MemoryView":849 - * start = 0 - * elif start >= shape: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + /* "View.MemoryView":1230 + * tmpslice.suboffsets[i] = -1 + * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<< + * + * */ - goto __pyx_L14; - } + (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - /* "View.MemoryView":852 - * start = shape - 1 - * else: - * start = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: - */ - /*else*/ { - __pyx_v_start = __pyx_v_shape; - } - __pyx_L14:; - - /* "View.MemoryView":848 - * if start < 0: - * start = 0 - * elif start >= shape: # <<<<<<<<<<<<<< - * if negative_step: - * start = shape - 1 - */ - } - __pyx_L12:; - - /* "View.MemoryView":843 + /* "View.MemoryView":1233 * * - * if have_start: # <<<<<<<<<<<<<< - * if start < 0: - * start += shape - */ - goto __pyx_L11; - } - - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":855 - * else: - * if negative_step: - * start = shape - 1 # <<<<<<<<<<<<<< - * else: - * start = 0 - */ - __pyx_v_start = (__pyx_v_shape - 1); - - /* "View.MemoryView":854 - * start = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * start = shape - 1 - * else: + * for i in range(ndim): # <<<<<<<<<<<<<< + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 */ - goto __pyx_L15; - } + __pyx_t_3 = __pyx_v_ndim; + __pyx_t_5 = __pyx_t_3; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":857 - * start = shape - 1 - * else: - * start = 0 # <<<<<<<<<<<<<< + /* "View.MemoryView":1234 * - * if have_stop: - */ - /*else*/ { - __pyx_v_start = 0; - } - __pyx_L15:; - } - __pyx_L11:; - - /* "View.MemoryView":859 - * start = 0 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape */ - __pyx_t_2 = (__pyx_v_have_stop != 0); + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); if (__pyx_t_2) { - /* "View.MemoryView":860 + /* "View.MemoryView":1235 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: + * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: - */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":861 - * if have_stop: - * if stop < 0: - * stop += shape # <<<<<<<<<<<<<< - * if stop < 0: - * stop = 0 - */ - __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: - */ - __pyx_t_2 = ((__pyx_v_stop < 0) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":863 - * stop += shape - * if stop < 0: - * stop = 0 # <<<<<<<<<<<<<< - * elif stop > shape: - * stop = shape - */ - __pyx_v_stop = 0; - - /* "View.MemoryView":862 - * if stop < 0: - * stop += shape - * if stop < 0: # <<<<<<<<<<<<<< - * stop = 0 - * elif stop > shape: + * if slice_is_contig(src[0], order, ndim): */ - } + (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - /* "View.MemoryView":860 + /* "View.MemoryView":1234 * - * if have_stop: - * if stop < 0: # <<<<<<<<<<<<<< - * stop += shape - * if stop < 0: - */ - goto __pyx_L17; - } - - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: - */ - __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":865 - * stop = 0 - * elif stop > shape: - * stop = shape # <<<<<<<<<<<<<< - * else: - * if negative_step: - */ - __pyx_v_stop = __pyx_v_shape; - - /* "View.MemoryView":864 - * if stop < 0: - * stop = 0 - * elif stop > shape: # <<<<<<<<<<<<<< - * stop = shape - * else: - */ - } - __pyx_L17:; - - /* "View.MemoryView":859 - * start = 0 + * for i in range(ndim): + * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< + * tmpslice.strides[i] = 0 * - * if have_stop: # <<<<<<<<<<<<<< - * if stop < 0: - * stop += shape */ - goto __pyx_L16; } + } - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: - */ - /*else*/ { - __pyx_t_2 = (__pyx_v_negative_step != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":868 - * else: - * if negative_step: - * stop = -1 # <<<<<<<<<<<<<< - * else: - * stop = shape + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 + * + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - __pyx_v_stop = -1L; + __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":867 - * stop = shape - * else: - * if negative_step: # <<<<<<<<<<<<<< - * stop = -1 - * else: + /* "View.MemoryView":1238 + * + * if slice_is_contig(src[0], order, ndim): + * memcpy(result, src.data, size) # <<<<<<<<<<<<<< + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) */ - goto __pyx_L19; - } + (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - /* "View.MemoryView":870 - * stop = -1 - * else: - * stop = shape # <<<<<<<<<<<<<< + /* "View.MemoryView":1237 + * tmpslice.strides[i] = 0 * - * if not have_step: + * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< + * memcpy(result, src.data, size) + * else: */ - /*else*/ { - __pyx_v_stop = __pyx_v_shape; - } - __pyx_L19:; - } - __pyx_L16:; + goto __pyx_L9; + } - /* "View.MemoryView":872 - * stop = shape - * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 + /* "View.MemoryView":1240 + * memcpy(result, src.data, size) + * else: + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< * + * return result */ - __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0); - if (__pyx_t_2) { + /*else*/ { + copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); + } + __pyx_L9:; - /* "View.MemoryView":873 + /* "View.MemoryView":1242 + * copy_strided_to_strided(src, tmpslice, ndim, itemsize) * - * if not have_step: - * step = 1 # <<<<<<<<<<<<<< + * return result # <<<<<<<<<<<<<< * * */ - __pyx_v_step = 1; + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "View.MemoryView":872 - * stop = shape - * - * if not have_step: # <<<<<<<<<<<<<< - * step = 1 + /* "View.MemoryView":1205 * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, */ - } - /* "View.MemoryView":877 - * - * with cython.cdivision(True): - * new_shape = (stop - start) // step # <<<<<<<<<<<<<< - * - * if (stop - start) - step * new_shape: - */ - __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); + /* function exit code */ + __pyx_L1_error:; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + __pyx_L0:; + __Pyx_RefNannyFinishContextNogil() + return __pyx_r; +} - /* "View.MemoryView":879 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 +/* "View.MemoryView":1247 * + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ - __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":880 - * - * if (stop - start) - step * new_shape: - * new_shape += 1 # <<<<<<<<<<<<<< +static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_UCS4 __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_extents", 0); + + /* "View.MemoryView":1249 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<< * - * if new_shape < 0: + * @cname('__pyx_memoryview_err_dim') */ - __pyx_v_new_shape = (__pyx_v_new_shape + 1); + __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 127; + __Pyx_INCREF(__pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_2 += 35; + __Pyx_GIVEREF(__pyx_kp_u_got_differing_extents_in_dimensi); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_got_differing_extents_in_dimensi); + __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_got); + __pyx_t_2 += 6; + __Pyx_GIVEREF(__pyx_kp_u_got); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_got); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u_and); + __pyx_t_2 += 5; + __Pyx_GIVEREF(__pyx_kp_u_and); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_and); + __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_kp_u__7); + __pyx_t_2 += 1; + __Pyx_GIVEREF(__pyx_kp_u__7); + PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__7); + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 1249, __pyx_L1_error) - /* "View.MemoryView":879 - * new_shape = (stop - start) // step - * - * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< - * new_shape += 1 + /* "View.MemoryView":1247 * + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" */ - } - /* "View.MemoryView":882 - * new_shape += 1 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1252 * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * */ - __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":883 - * - * if new_shape < 0: - * new_shape = 0 # <<<<<<<<<<<<<< - * +static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, PyObject *__pyx_v_msg, int __pyx_v_dim) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_dim", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1253 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: + * raise error, msg % dim # <<<<<<<<<<<<<< * + * @cname('__pyx_memoryview_err') */ - __pyx_v_new_shape = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_v_msg, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1253, __pyx_L1_error) - /* "View.MemoryView":882 - * new_shape += 1 + /* "View.MemoryView":1252 * - * if new_shape < 0: # <<<<<<<<<<<<<< - * new_shape = 0 + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg % dim * */ - } - /* "View.MemoryView":886 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1256 * + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg * - * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset */ - (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - /* "View.MemoryView":887 - * - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< - * dst.suboffsets[new_ndim] = suboffset +static int __pyx_memoryview_err(PyObject *__pyx_v_error, PyObject *__pyx_v_msg) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err", 0); + __Pyx_INCREF(__pyx_v_msg); + + /* "View.MemoryView":1257 + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: + * raise error, msg # <<<<<<<<<<<<<< * + * @cname('__pyx_memoryview_err_no_memory') */ - (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; + __Pyx_Raise(((PyObject *)__pyx_v_error), __pyx_v_msg, 0, 0); + __PYX_ERR(1, 1257, __pyx_L1_error) - /* "View.MemoryView":888 - * dst.strides[new_ndim] = stride * step - * dst.shape[new_ndim] = new_shape - * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< + /* "View.MemoryView":1256 * + * @cname('__pyx_memoryview_err') + * cdef int _err(PyObject *error, str msg) except -1 with gil: # <<<<<<<<<<<<<< + * raise error, msg * */ - (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset; - } - __pyx_L3:; - /* "View.MemoryView":891 + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1260 * + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: */ - __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":892 - * - * if suboffset_dim[0] < 0: - * dst.data += start * stride # <<<<<<<<<<<<<< - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride - */ - __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); +static int __pyx_memoryview_err_no_memory(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("_err_no_memory", 0); - /* "View.MemoryView":891 + /* "View.MemoryView":1261 + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: + * raise MemoryError # <<<<<<<<<<<<<< * * - * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< - * dst.data += start * stride - * else: */ - goto __pyx_L23; - } + PyErr_NoMemory(); __PYX_ERR(1, 1261, __pyx_L1_error) - /* "View.MemoryView":894 - * dst.data += start * stride - * else: - * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< + /* "View.MemoryView":1260 * - * if suboffset >= 0: - */ - /*else*/ { - __pyx_t_3 = (__pyx_v_suboffset_dim[0]); - (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride)); - } - __pyx_L23:; - - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride + * @cname('__pyx_memoryview_err_no_memory') + * cdef int _err_no_memory() except -1 with gil: # <<<<<<<<<<<<<< + * raise MemoryError * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":897 + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("View.MemoryView._err_no_memory", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} + +/* "View.MemoryView":1265 * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ - __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: +static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { + void *__pyx_v_tmpdata; + size_t __pyx_v_itemsize; + int __pyx_v_i; + char __pyx_v_order; + int __pyx_v_broadcasting; + int __pyx_v_direct_copy; + __Pyx_memviewslice __pyx_v_tmp; + int __pyx_v_ndim; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + void *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save; + #endif + __Pyx_RefNannySetupContext("memoryview_copy_contents", 1); + + /* "View.MemoryView":1273 + * Check for overlapping memory and verify the shapes. + * """ + * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i */ - __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0); - if (__pyx_t_2) { + __pyx_v_tmpdata = NULL; - /* "View.MemoryView":899 - * if not is_slice: - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " + /* "View.MemoryView":1274 + * """ + * cdef void *tmpdata = NULL + * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) */ - __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":898 - * if suboffset >= 0: - * if not is_slice: - * if new_ndim == 0: # <<<<<<<<<<<<<< - * dst.data = ( dst.data)[0] + suboffset - * else: + /* "View.MemoryView":1276 + * cdef size_t itemsize = src.memview.view.itemsize + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< + * cdef bint broadcasting = False + * cdef bint direct_copy = False */ - goto __pyx_L26; - } + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); - /* "View.MemoryView":901 - * dst.data = ( dst.data)[0] + suboffset - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< - * "must be indexed and not sliced", dim) - * else: + /* "View.MemoryView":1277 + * cdef int i + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False # <<<<<<<<<<<<<< + * cdef bint direct_copy = False + * cdef __Pyx_memviewslice tmp */ - /*else*/ { + __pyx_v_broadcasting = 0; - /* "View.MemoryView":902 - * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< - * else: - * suboffset_dim[0] = new_ndim + /* "View.MemoryView":1278 + * cdef char order = get_best_order(&src, src_ndim) + * cdef bint broadcasting = False + * cdef bint direct_copy = False # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice tmp + * */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 901, __pyx_L1_error) - } - __pyx_L26:; + __pyx_v_direct_copy = 0; - /* "View.MemoryView":897 + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp * - * if suboffset >= 0: - * if not is_slice: # <<<<<<<<<<<<<< - * if new_ndim == 0: - * dst.data = ( dst.data)[0] + suboffset + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ - goto __pyx_L25; - } + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":904 - * "must be indexed and not sliced", dim) - * else: - * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< + /* "View.MemoryView":1282 * - * return 0 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) */ - /*else*/ { - (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim; - } - __pyx_L25:; + __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); - /* "View.MemoryView":896 - * dst.suboffsets[suboffset_dim[0]] += start * stride + /* "View.MemoryView":1281 + * cdef __Pyx_memviewslice tmp * - * if suboffset >= 0: # <<<<<<<<<<<<<< - * if not is_slice: - * if new_ndim == 0: + * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: */ + goto __pyx_L3; } - /* "View.MemoryView":906 - * suboffset_dim[0] = new_ndim - * - * return 0 # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) * */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":809 + /* "View.MemoryView":1284 + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: + * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_slice_memviewslice') - * cdef int slice_memviewslice( # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + * cdef int ndim = max(src_ndim, dst_ndim) */ + __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = -1; - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":912 + /* "View.MemoryView":1283 + * if src_ndim < dst_ndim: + * broadcast_leading(&src, src_ndim, dst_ndim) + * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< + * broadcast_leading(&dst, dst_ndim, src_ndim) * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - */ - -static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_suboffset; - Py_ssize_t __pyx_v_itemsize; - char *__pyx_v_resultp; - char *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pybuffer_index", 0); - - /* "View.MemoryView":914 - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< - * cdef Py_ssize_t itemsize = view.itemsize - * cdef char *resultp */ - __pyx_v_suboffset = -1L; + } + __pyx_L3:; - /* "View.MemoryView":915 - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 - * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< - * cdef char *resultp + /* "View.MemoryView":1286 + * broadcast_leading(&dst, dst_ndim, src_ndim) + * + * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< * + * for i in range(ndim): */ - __pyx_t_1 = __pyx_v_view->itemsize; - __pyx_v_itemsize = __pyx_t_1; + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + __pyx_t_2 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_2) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_ndim = __pyx_t_5; - /* "View.MemoryView":918 - * cdef char *resultp + /* "View.MemoryView":1288 + * cdef int ndim = max(src_ndim, dst_ndim) * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + * for i in range(ndim): # <<<<<<<<<<<<<< + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: */ - __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0); - if (__pyx_t_2) { + __pyx_t_5 = __pyx_v_ndim; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":919 + /* "View.MemoryView":1289 * - * if view.ndim == 0: - * shape = view.len / itemsize # <<<<<<<<<<<<<< - * stride = itemsize - * else: + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ - if (unlikely(__pyx_v_itemsize == 0)) { - PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { - PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 919, __pyx_L1_error) - } - __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize); + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { - /* "View.MemoryView":920 - * if view.ndim == 0: - * shape = view.len / itemsize - * stride = itemsize # <<<<<<<<<<<<<< - * else: - * shape = view.shape[dim] + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 */ - __pyx_v_stride = __pyx_v_itemsize; + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { - /* "View.MemoryView":918 - * cdef char *resultp - * - * if view.ndim == 0: # <<<<<<<<<<<<<< - * shape = view.len / itemsize - * stride = itemsize + /* "View.MemoryView":1291 + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: + * broadcasting = True # <<<<<<<<<<<<<< + * src.strides[i] = 0 + * else: */ - goto __pyx_L3; - } + __pyx_v_broadcasting = 1; - /* "View.MemoryView":922 - * stride = itemsize - * else: - * shape = view.shape[dim] # <<<<<<<<<<<<<< - * stride = view.strides[dim] - * if view.suboffsets != NULL: + /* "View.MemoryView":1292 + * if src.shape[i] == 1: + * broadcasting = True + * src.strides[i] = 0 # <<<<<<<<<<<<<< + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) */ - /*else*/ { - __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); + (__pyx_v_src.strides[__pyx_v_i]) = 0; - /* "View.MemoryView":923 - * else: - * shape = view.shape[dim] - * stride = view.strides[dim] # <<<<<<<<<<<<<< - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] + /* "View.MemoryView":1290 + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: + * if src.shape[i] == 1: # <<<<<<<<<<<<<< + * broadcasting = True + * src.strides[i] = 0 */ - __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); + goto __pyx_L7; + } - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] + /* "View.MemoryView":1294 + * src.strides[i] = 0 + * else: + * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< * + * if src.suboffsets[i] >= 0: */ - __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0); - if (__pyx_t_2) { + /*else*/ { + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1294, __pyx_L1_error) + } + __pyx_L7:; - /* "View.MemoryView":925 - * stride = view.strides[dim] - * if view.suboffsets != NULL: - * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< + /* "View.MemoryView":1289 * - * if index < 0: + * for i in range(ndim): + * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< + * if src.shape[i] == 1: + * broadcasting = True */ - __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); + } - /* "View.MemoryView":924 - * shape = view.shape[dim] - * stride = view.strides[dim] - * if view.suboffsets != NULL: # <<<<<<<<<<<<<< - * suboffset = view.suboffsets[dim] + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) * - */ - } - } - __pyx_L3:; - - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (__pyx_t_2) { + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { - /* "View.MemoryView":928 + /* "View.MemoryView":1297 * - * if index < 0: - * index += view.shape[dim] # <<<<<<<<<<<<<< - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) - */ - __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); - - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + * if src.suboffsets[i] >= 0: + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< * + * if slices_overlap(&src, &dst, ndim, itemsize): */ - __pyx_t_2 = ((__pyx_v_index < 0) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_6 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error) - /* "View.MemoryView":930 - * index += view.shape[dim] - * if index < 0: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< + /* "View.MemoryView":1296 + * _err_extents(i, dst.shape[i], src.shape[i]) * - * if index >= shape: - */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 930, __pyx_L1_error) - - /* "View.MemoryView":929 - * if index < 0: - * index += view.shape[dim] - * if index < 0: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * */ } - - /* "View.MemoryView":927 - * suboffset = view.suboffsets[dim] - * - * if index < 0: # <<<<<<<<<<<<<< - * index += view.shape[dim] - * if index < 0: - */ } - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< * + * if not slice_is_contig(src, order, ndim): */ - __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { - /* "View.MemoryView":933 + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): * - * if index >= shape: - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) * - * resultp = bufp + index * stride */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 933, __pyx_L1_error) + __pyx_t_2 = (!__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { - /* "View.MemoryView":932 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "View.MemoryView":1302 * - * if index >= shape: # <<<<<<<<<<<<<< - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + * if not slice_is_contig(src, order, ndim): + * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< * + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) */ - } + __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); - /* "View.MemoryView":935 - * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) + /* "View.MemoryView":1301 + * if slices_overlap(&src, &dst, ndim, itemsize): + * + * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< + * order = get_best_order(&dst, ndim) * - * resultp = bufp + index * stride # <<<<<<<<<<<<<< - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset */ - __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); + } - /* "View.MemoryView":936 + /* "View.MemoryView":1304 + * order = get_best_order(&dst, ndim) * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< + * src = tmp * */ - __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_2) { + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1304, __pyx_L1_error) + __pyx_v_tmpdata = __pyx_t_7; - /* "View.MemoryView":937 - * resultp = bufp + index * stride - * if suboffset >= 0: - * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< + /* "View.MemoryView":1305 * - * return resultp + * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + * src = tmp # <<<<<<<<<<<<<< + * + * if not broadcasting: */ - __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); + __pyx_v_src = __pyx_v_tmp; - /* "View.MemoryView":936 + /* "View.MemoryView":1299 + * _err_dim(PyExc_ValueError, "Dimension %d is not direct", i) * - * resultp = bufp + index * stride - * if suboffset >= 0: # <<<<<<<<<<<<<< - * resultp = ( resultp)[0] + suboffset + * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< * + * if not slice_is_contig(src, order, ndim): */ } - /* "View.MemoryView":939 - * resultp = ( resultp)[0] + suboffset + /* "View.MemoryView":1307 + * src = tmp * - * return resultp # <<<<<<<<<<<<<< + * if not broadcasting: # <<<<<<<<<<<<<< * * */ - __pyx_r = __pyx_v_resultp; - goto __pyx_L0; + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { - /* "View.MemoryView":912 + /* "View.MemoryView":1310 * - * @cname('__pyx_pybuffer_index') - * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< - * Py_ssize_t dim) except NULL: - * cdef Py_ssize_t shape, stride, suboffset = -1 + * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim); + if (__pyx_t_2) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1311 + * + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) + */ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); -/* "View.MemoryView":945 + /* "View.MemoryView":1310 * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim * + * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): */ + goto __pyx_L12; + } -static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { - int __pyx_v_ndim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_r; - int __pyx_t_1; - Py_ssize_t *__pyx_t_2; - long __pyx_t_3; - long __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - - /* "View.MemoryView":946 - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: - * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * cdef Py_ssize_t *shape = memslice.shape */ - __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; - __pyx_v_ndim = __pyx_t_1; + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim); + if (__pyx_t_2) { - /* "View.MemoryView":948 - * cdef int ndim = memslice.memview.view.ndim + /* "View.MemoryView":1313 + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): + * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< * - * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< - * cdef Py_ssize_t *strides = memslice.strides + * if direct_copy: + */ + __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + + /* "View.MemoryView":1312 + * if slice_is_contig(src, 'C', ndim): + * direct_copy = slice_is_contig(dst, 'C', ndim) + * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< + * direct_copy = slice_is_contig(dst, 'F', ndim) * */ - __pyx_t_2 = __pyx_v_memslice->shape; - __pyx_v_shape = __pyx_t_2; + } + __pyx_L12:; - /* "View.MemoryView":949 + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * cdef Py_ssize_t *shape = memslice.shape - * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< + * if direct_copy: # <<<<<<<<<<<<<< * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + */ + if (__pyx_v_direct_copy) { + + /* "View.MemoryView":1317 + * if direct_copy: * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) */ - __pyx_t_2 = __pyx_v_memslice->strides; - __pyx_v_strides = __pyx_t_2; + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":953 + /* "View.MemoryView":1318 * - * cdef int i, j - * for i in range(ndim / 2): # <<<<<<<<<<<<<< - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) */ - __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; + (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - /* "View.MemoryView":954 - * cdef int i, j - * for i in range(ndim / 2): - * j = ndim - 1 - i # <<<<<<<<<<<<<< - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] + /* "View.MemoryView":1319 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * free(tmpdata) + * return 0 */ - __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":955 - * for i in range(ndim / 2): - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< - * shape[i], shape[j] = shape[j], shape[i] + /* "View.MemoryView":1320 + * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 * */ - __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]); - __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]); - (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; - (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; + free(__pyx_v_tmpdata); - /* "View.MemoryView":956 - * j = ndim - 1 - i - * strides[i], strides[j] = strides[j], strides[i] - * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< + /* "View.MemoryView":1321 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: + * if order == 'F' == get_best_order(&dst, ndim): */ - __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]); - __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]); - (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; - (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] + /* "View.MemoryView":1315 + * direct_copy = slice_is_contig(dst, 'F', ndim) * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") + * if direct_copy: # <<<<<<<<<<<<<< * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_7 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; } - __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0); - __pyx_t_7 = __pyx_t_8; - __pyx_L6_bool_binop_done:; - if (__pyx_t_7) { - /* "View.MemoryView":959 + /* "View.MemoryView":1307 + * src = tmp + * + * if not broadcasting: # <<<<<<<<<<<<<< * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< * - * return 1 */ - __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 959, __pyx_L1_error) + } - /* "View.MemoryView":958 - * shape[i], shape[j] = shape[j], shape[i] + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< * - * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") * */ - } + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); } + if (__pyx_t_2) { - /* "View.MemoryView":961 - * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") + /* "View.MemoryView":1326 * - * return 1 # <<<<<<<<<<<<<< * + * transpose_memslice(&src) # <<<<<<<<<<<<<< + * transpose_memslice(&dst) * */ - __pyx_r = 1; - goto __pyx_L0; + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1326, __pyx_L1_error) - /* "View.MemoryView":945 + /* "View.MemoryView":1327 * - * @cname('__pyx_memslice_transpose') - * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< - * cdef int ndim = memslice.memview.view.ndim + * transpose_memslice(&src) + * transpose_memslice(&dst) # <<<<<<<<<<<<<< * + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) */ + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(1, 1327, __pyx_L1_error) - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = 0; - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 + /* "View.MemoryView":1323 + * return 0 + * + * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * */ + } -/* Python wrapper */ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "View.MemoryView":979 - * - * def __dealloc__(self): - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< + /* "View.MemoryView":1329 + * transpose_memslice(&dst) * - * cdef convert_item_to_object(self, char *itemp): + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) */ - __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":978 - * cdef int (*to_dtype_func)(char *, object) except 0 + /* "View.MemoryView":1330 * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * */ + copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + /* "View.MemoryView":1331 + * refcount_copying(&dst, dtype_is_object, ndim, inc=False) + * copy_strided_to_strided(&src, &dst, ndim, itemsize) + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) + * free(tmpdata) */ + __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); -static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_item_to_object", 0); - - /* "View.MemoryView":982 + /* "View.MemoryView":1333 + * refcount_copying(&dst, dtype_is_object, ndim, inc=True) * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: - */ - __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":983 - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) # <<<<<<<<<<<<<< - * else: - * return memoryview.convert_item_to_object(self, itemp) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "View.MemoryView":982 + * free(tmpdata) # <<<<<<<<<<<<<< + * return 0 * - * cdef convert_item_to_object(self, char *itemp): - * if self.to_object_func != NULL: # <<<<<<<<<<<<<< - * return self.to_object_func(itemp) - * else: */ - } + free(__pyx_v_tmpdata); - /* "View.MemoryView":985 - * return self.to_object_func(itemp) - * else: - * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< + /* "View.MemoryView":1334 * - * cdef assign_item_from_object(self, char *itemp, object value): + * free(tmpdata) + * return 0 # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_broadcast_leading') */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 985, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } + __pyx_r = 0; + goto __pyx_L0; - /* "View.MemoryView":981 - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + /* "View.MemoryView":1265 * - * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< - * if self.to_object_func != NULL: - * return self.to_object_func(itemp) + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + #ifdef WITH_THREAD + __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_RefNannyFinishContextNogil() return __pyx_r; } -/* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) +/* "View.MemoryView":1337 * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ -static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations +static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { + int __pyx_v_i; + int __pyx_v_offset; int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("assign_item_from_object", 0); + int __pyx_t_3; - /* "View.MemoryView":988 + /* "View.MemoryView":1341 + * int ndim_other) noexcept nogil: + * cdef int i + * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: + * for i in range(ndim - 1, -1, -1): */ - __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0); - if (__pyx_t_1) { + __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - /* "View.MemoryView":989 - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< - * else: - * memoryview.assign_item_from_object(self, itemp, value) + /* "View.MemoryView":1343 + * cdef int offset = ndim_other - ndim + * + * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 989, __pyx_L1_error) + for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { + __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":988 + /* "View.MemoryView":1344 * - * cdef assign_item_from_object(self, char *itemp, object value): - * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< - * self.to_dtype_func(itemp, value) - * else: + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] */ - goto __pyx_L3; - } + (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - /* "View.MemoryView":991 - * self.to_dtype_func(itemp, value) - * else: - * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< + /* "View.MemoryView":1345 + * for i in range(ndim - 1, -1, -1): + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] * - * @property */ - /*else*/ { - __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 991, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); + + /* "View.MemoryView":1346 + * mslice.shape[i + offset] = mslice.shape[i] + * mslice.strides[i + offset] = mslice.strides[i] + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< + * + * for i in range(offset): + */ + (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); } - __pyx_L3:; - /* "View.MemoryView":987 - * return memoryview.convert_item_to_object(self, itemp) + /* "View.MemoryView":1348 + * mslice.suboffsets[i + offset] = mslice.suboffsets[i] * - * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< - * if self.to_dtype_func != NULL: - * self.to_dtype_func(itemp, value) + * for i in range(offset): # <<<<<<<<<<<<<< + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] */ + __pyx_t_1 = __pyx_v_offset; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":994 - * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object + /* "View.MemoryView":1349 * + * for i in range(offset): + * mslice.shape[i] = 1 # <<<<<<<<<<<<<< + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 */ + (__pyx_v_mslice->shape[__pyx_v_i]) = 1; -/* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - - /* "View.MemoryView":995 - * @property - * def base(self): - * return self.from_object # <<<<<<<<<<<<<< + /* "View.MemoryView":1350 + * for i in range(offset): + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< + * mslice.suboffsets[i] = -1 * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->from_object); - __pyx_r = __pyx_v_self->from_object; - goto __pyx_L0; + (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); - /* "View.MemoryView":994 + /* "View.MemoryView":1351 + * mslice.shape[i] = 1 + * mslice.strides[i] = mslice.strides[0] + * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< * - * @property - * def base(self): # <<<<<<<<<<<<<< - * return self.from_object * + */ + (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; + } + + /* "View.MemoryView":1337 + * + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) noexcept nogil: */ /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): +/* "View.MemoryView":1359 + * + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< + * + * if dtype_is_object: */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); +static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * + */ + if (__pyx_v_dtype_is_object) { -static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + /* "View.MemoryView":1362 + * + * if dtype_is_object: + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + */ + __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":1361 + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: + * + * if dtype_is_object: # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, dst.strides, ndim, inc) + * */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 2, __pyx_L1_error) + } - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "View.MemoryView":1359 + * + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, int ndim, bint inc) noexcept nogil: # <<<<<<<<<<<<<< + * + * if dtype_is_object: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") +/* "View.MemoryView":1365 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: */ -/* Python wrapper */ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; +static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "View.MemoryView":1368 + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: + * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "View.MemoryView":1365 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) noexcept with gil: */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return __pyx_r; + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif } -/* "View.MemoryView":1001 +/* "View.MemoryView":1371 * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ -static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) { - struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; - Py_ssize_t __pyx_v_suboffset; - PyObject *__pyx_v_length = NULL; - PyObject *__pyx_r = NULL; +static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_TypeInfo *__pyx_t_4; - Py_buffer __pyx_t_5; - Py_ssize_t *__pyx_t_6; - Py_ssize_t *__pyx_t_7; - Py_ssize_t *__pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_fromslice", 0); + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - /* "View.MemoryView":1009 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None + /* "View.MemoryView":1374 + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< * + * for i in range(shape[0]): */ - __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0); - if (__pyx_t_1) { + __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":1010 - * - * if memviewslice.memview == Py_None: - * return None # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1376 + * cdef Py_ssize_t stride = strides[0] * + * for i in range(shape[0]): # <<<<<<<<<<<<<< + * if ndim == 1: + * if inc: */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_t_1 = (__pyx_v_shape[0]); + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1009 - * cdef _memoryviewslice result - * - * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< - * return None + /* "View.MemoryView":1377 * + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) */ - } + __pyx_t_4 = (__pyx_v_ndim == 1); + if (__pyx_t_4) { - /* "View.MemoryView":1015 - * - * - * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<< - * - * result.from_slice = memviewslice + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); - __pyx_t_2 = 0; + if (__pyx_v_inc) { + + /* "View.MemoryView":1379 + * if ndim == 1: + * if inc: + * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * Py_DECREF(( data)[0]) + */ + Py_INCREF((((PyObject **)__pyx_v_data)[0])); + + /* "View.MemoryView":1378 + * for i in range(shape[0]): + * if ndim == 1: + * if inc: # <<<<<<<<<<<<<< + * Py_INCREF(( data)[0]) + * else: + */ + goto __pyx_L6; + } + + /* "View.MemoryView":1381 + * Py_INCREF(( data)[0]) + * else: + * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + */ + /*else*/ { + Py_DECREF((((PyObject **)__pyx_v_data)[0])); + } + __pyx_L6:; - /* "View.MemoryView":1017 - * result = _memoryviewslice(None, 0, dtype_is_object) + /* "View.MemoryView":1377 * - * result.from_slice = memviewslice # <<<<<<<<<<<<<< - * __PYX_INC_MEMVIEW(&memviewslice, 1) + * for i in range(shape[0]): + * if ndim == 1: # <<<<<<<<<<<<<< + * if inc: + * Py_INCREF(( data)[0]) + */ + goto __pyx_L5; + } + + /* "View.MemoryView":1383 + * Py_DECREF(( data)[0]) + * else: + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) # <<<<<<<<<<<<<< * + * data += stride */ - __pyx_v_result->from_slice = __pyx_v_memviewslice; + /*else*/ { + __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + } + __pyx_L5:; - /* "View.MemoryView":1018 + /* "View.MemoryView":1385 + * refcount_objects_in_slice(data, shape + 1, strides + 1, ndim - 1, inc) + * + * data += stride # <<<<<<<<<<<<<< * - * result.from_slice = memviewslice - * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< * - * result.from_object = ( memviewslice.memview).base */ - __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } - /* "View.MemoryView":1020 - * __PYX_INC_MEMVIEW(&memviewslice, 1) - * - * result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<< - * result.typeinfo = memviewslice.memview.typeinfo + /* "View.MemoryView":1371 * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc) noexcept: + * cdef Py_ssize_t i */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1020, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_result->from_object); - __Pyx_DECREF(__pyx_v_result->from_object); - __pyx_v_result->from_object = __pyx_t_2; - __pyx_t_2 = 0; - /* "View.MemoryView":1021 + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "View.MemoryView":1391 * - * result.from_object = ( memviewslice.memview).base - * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + */ + +static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { + + /* "View.MemoryView":1394 + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) + */ + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + + /* "View.MemoryView":1395 + * bint dtype_is_object) noexcept nogil: + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) # <<<<<<<<<<<<<< + * refcount_copying(dst, dtype_is_object, ndim, inc=True) * - * result.view = memviewslice.memview.view */ - __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; - __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; + __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":1023 - * result.typeinfo = memviewslice.memview.typeinfo + /* "View.MemoryView":1396 + * refcount_copying(dst, dtype_is_object, ndim, inc=False) + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, itemsize, item) + * refcount_copying(dst, dtype_is_object, ndim, inc=True) # <<<<<<<<<<<<<< + * * - * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< - * result.view.buf = memviewslice.data - * result.view.ndim = ndim */ - __pyx_t_5 = __pyx_v_memviewslice.memview->view; - __pyx_v_result->__pyx_base.view = __pyx_t_5; + __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":1024 + /* "View.MemoryView":1391 * - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) noexcept nogil: */ - __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - /* "View.MemoryView":1025 - * result.view = memviewslice.memview.view - * result.view.buf = memviewslice.data - * result.view.ndim = ndim # <<<<<<<<<<<<<< - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) + /* function exit code */ +} + +/* "View.MemoryView":1400 + * + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ - __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - /* "View.MemoryView":1026 - * result.view.buf = memviewslice.data - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< - * Py_INCREF(Py_None) +static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { + CYTHON_UNUSED Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_stride; + Py_ssize_t __pyx_v_extent; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + + /* "View.MemoryView":1404 + * size_t itemsize, void *item) noexcept nogil: + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< + * cdef Py_ssize_t extent = shape[0] * */ - ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; + __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":1027 - * result.view.ndim = ndim - * (<__pyx_buffer *> &result.view).obj = Py_None - * Py_INCREF(Py_None) # <<<<<<<<<<<<<< + /* "View.MemoryView":1405 + * cdef Py_ssize_t i + * cdef Py_ssize_t stride = strides[0] + * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: + * if ndim == 1: */ - Py_INCREF(Py_None); + __pyx_v_extent = (__pyx_v_shape[0]); - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS - * else: + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) */ - __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); + __pyx_t_1 = (__pyx_v_ndim == 1); if (__pyx_t_1) { - /* "View.MemoryView":1030 + /* "View.MemoryView":1408 * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: - * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< - * else: - * result.flags = PyBUF_RECORDS_RO + * if ndim == 1: + * for i in range(extent): # <<<<<<<<<<<<<< + * memcpy(data, item, itemsize) + * data += stride */ - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1029 - * Py_INCREF(Py_None) - * - * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< - * result.flags = PyBUF_RECORDS + /* "View.MemoryView":1409 + * if ndim == 1: + * for i in range(extent): + * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< + * data += stride * else: */ - goto __pyx_L4; - } + (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - /* "View.MemoryView":1032 - * result.flags = PyBUF_RECORDS + /* "View.MemoryView":1410 + * for i in range(extent): + * memcpy(data, item, itemsize) + * data += stride # <<<<<<<<<<<<<< * else: - * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< + * for i in range(extent): + */ + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + + /* "View.MemoryView":1407 + * cdef Py_ssize_t extent = shape[0] * - * result.view.shape = result.from_slice.shape + * if ndim == 1: # <<<<<<<<<<<<<< + * for i in range(extent): + * memcpy(data, item, itemsize) */ - /*else*/ { - __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO; + goto __pyx_L3; } - __pyx_L4:; - /* "View.MemoryView":1034 - * result.flags = PyBUF_RECORDS_RO - * - * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< - * result.view.strides = result.from_slice.strides - * + /* "View.MemoryView":1412 + * data += stride + * else: + * for i in range(extent): # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride */ - __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); + /*else*/ { + __pyx_t_2 = __pyx_v_extent; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1035 - * - * result.view.shape = result.from_slice.shape - * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< - * + /* "View.MemoryView":1413 + * else: + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * data += stride * */ - __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); + __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":1038 + /* "View.MemoryView":1414 + * for i in range(extent): + * _slice_assign_scalar(data, shape + 1, strides + 1, ndim - 1, itemsize, item) + * data += stride # <<<<<<<<<<<<<< * * - * result.view.suboffsets = NULL # <<<<<<<<<<<<<< - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: */ - __pyx_v_result->__pyx_base.view.suboffsets = NULL; + __pyx_v_data = (__pyx_v_data + __pyx_v_stride); + } + } + __pyx_L3:; - /* "View.MemoryView":1039 + /* "View.MemoryView":1400 * - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) noexcept nogil: */ - __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_v_suboffset = (__pyx_t_6[0]); - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break - */ - __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0); - if (__pyx_t_1) { + /* function exit code */ +} - /* "View.MemoryView":1041 - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< - * break - * +/* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ - __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - /* "View.MemoryView":1042 - * if suboffset >= 0: - * result.view.suboffsets = result.from_slice.suboffsets - * break # <<<<<<<<<<<<<< - * - * result.view.len = result.view.itemsize - */ - goto __pyx_L6_break; +/* Python wrapper */ +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[3] = {0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(1, 1, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_type)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_checksum)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 3)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, __pyx_nargs); __PYX_ERR(1, 1, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); - /* "View.MemoryView":1040 - * result.view.suboffsets = NULL - * for suboffset in result.from_slice.suboffsets[:ndim]: - * if suboffset >= 0: # <<<<<<<<<<<<<< - * result.view.suboffsets = result.from_slice.suboffsets - * break - */ + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } - __pyx_L6_break:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1044 - * break - * - * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< - * for length in result.view.shape[:ndim]: - * result.view.len *= length +static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum */ - __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__8, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "View.MemoryView":1045 - * - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< - * result.view.len *= length - * + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) */ - __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); - for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { - __pyx_t_6 = __pyx_t_8; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1045, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError)) __PYX_ERR(1, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __pyx_v___pyx_PickleError = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":1046 - * result.view.len = result.view.itemsize - * for length in result.view.shape[:ndim]: - * result.view.len *= length # <<<<<<<<<<<<<< - * - * result.to_object_func = to_object_func + /* "(tree fragment)":6 + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum # <<<<<<<<<<<<<< + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1046, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1046, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1046, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_result->__pyx_base.view.len = __pyx_t_9; + __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + */ } - /* "View.MemoryView":1048 - * result.view.len *= length - * - * result.to_object_func = to_object_func # <<<<<<<<<<<<<< - * result.to_dtype_func = to_dtype_func - * + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) */ - __pyx_v_result->to_object_func = __pyx_v_to_object_func; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v___pyx_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v___pyx_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":1049 - * - * result.to_object_func = to_object_func - * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< - * - * return result + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result */ - __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; + __pyx_t_2 = (__pyx_v___pyx_state != Py_None); + if (__pyx_t_2) { - /* "View.MemoryView":1051 - * result.to_dtype_func = to_dtype_func - * - * return result # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') + /* "(tree fragment)":9 + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + * __pyx_result = Enum.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + */ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; goto __pyx_L0; - /* "View.MemoryView":1001 - * - * @cname('__pyx_memoryview_fromslice') - * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< - * int ndim, - * object (*to_object_func)(char *), + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_length); + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1054 - * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj +/* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): */ -static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) { - struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0; - __Pyx_memviewslice *__pyx_r; +static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_slice_from_memview", 0); + __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v___pyx_result->name); + __Pyx_DECREF(__pyx_v___pyx_result->name); + __pyx_v___pyx_result->name = __pyx_t_1; + __pyx_t_1 = 0; - /* "View.MemoryView":1058 - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): - * obj = memview # <<<<<<<<<<<<<< - * return &obj.from_slice - * else: + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1058, __pyx_L1_error) - __pyx_t_3 = ((PyObject *)__pyx_v_memview); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); - __pyx_t_3 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 > 1); + if (__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_2) { - /* "View.MemoryView":1059 - * if isinstance(memview, _memoryviewslice): - * obj = memview - * return &obj.from_slice # <<<<<<<<<<<<<< - * else: - * slice_copy(memview, mslice) + /* "(tree fragment)":14 + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< */ - __pyx_r = (&__pyx_v_obj->from_slice); - goto __pyx_L0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 14, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":1057 - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * obj = memview - * return &obj.from_slice + /* "(tree fragment)":13 + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[1]) */ } - /* "View.MemoryView":1061 - * return &obj.from_slice - * else: - * slice_copy(memview, mslice) # <<<<<<<<<<<<<< - * return mslice + /* "(tree fragment)":11 + * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * __pyx_result.name = __pyx_state[0] + * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ - /*else*/ { - __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - /* "View.MemoryView":1062 - * else: - * slice_copy(memview, mslice) - * return mslice # <<<<<<<<<<<<<< +static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { + PyObject *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":248 + * """Returns a borrowed reference to the object owning the data/memory. + * """ + * return PyArray_BASE(self) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_slice_copy') + * @property */ - __pyx_r = __pyx_v_mslice; - goto __pyx_L0; - } + __pyx_r = PyArray_BASE(__pyx_v_self); + goto __pyx_L0; - /* "View.MemoryView":1054 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":245 * - * @cname('__pyx_memoryview_get_slice_from_memoryview') - * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *mslice) except NULL: - * cdef _memoryviewslice obj + * @property + * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< + * """Returns a borrowed reference to the object owning the data/memory. + * """ */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_obj); - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1065 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ */ -static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { - int __pyx_v_dim; - Py_ssize_t *__pyx_v_shape; - Py_ssize_t *__pyx_v_strides; - Py_ssize_t *__pyx_v_suboffsets; +static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self) { + PyArray_Descr *__pyx_r = NULL; __Pyx_RefNannyDeclarations - Py_ssize_t *__pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - __Pyx_RefNannySetupContext("slice_copy", 0); + PyArray_Descr *__pyx_t_1; + __Pyx_RefNannySetupContext("descr", 0); - /* "View.MemoryView":1069 - * cdef (Py_ssize_t*) shape, strides, suboffsets + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":254 + * """Returns an owned reference to the dtype of the array. + * """ + * return PyArray_DESCR(self) # <<<<<<<<<<<<<< * - * shape = memview.view.shape # <<<<<<<<<<<<<< - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets + * @property */ - __pyx_t_1 = __pyx_v_memview->view.shape; - __pyx_v_shape = __pyx_t_1; + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyArray_DESCR(__pyx_v_self); + __Pyx_INCREF((PyObject *)((PyArray_Descr *)__pyx_t_1)); + __pyx_r = ((PyArray_Descr *)__pyx_t_1); + goto __pyx_L0; - /* "View.MemoryView":1070 - * - * shape = memview.view.shape - * strides = memview.view.strides # <<<<<<<<<<<<<< - * suboffsets = memview.view.suboffsets + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":251 * + * @property + * cdef inline dtype descr(self): # <<<<<<<<<<<<<< + * """Returns an owned reference to the dtype of the array. + * """ */ - __pyx_t_1 = __pyx_v_memview->view.strides; - __pyx_v_strides = __pyx_t_1; - /* "View.MemoryView":1071 - * shape = memview.view.shape - * strides = memview.view.strides - * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 * - * dst.memview = <__pyx_memoryview *> memview + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ */ - __pyx_t_1 = __pyx_v_memview->view.suboffsets; - __pyx_v_suboffsets = __pyx_t_1; - /* "View.MemoryView":1073 - * suboffsets = memview.view.suboffsets - * - * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< - * dst.data = memview.view.buf +static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { + int __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":260 + * """Returns the number of dimensions in the array. + * """ + * return PyArray_NDIM(self) # <<<<<<<<<<<<<< * + * @property */ - __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); + __pyx_r = PyArray_NDIM(__pyx_v_self); + goto __pyx_L0; - /* "View.MemoryView":1074 - * - * dst.memview = <__pyx_memoryview *> memview - * dst.data = memview.view.buf # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":257 * - * for dim in range(memview.view.ndim): + * @property + * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< + * """Returns the number of dimensions in the array. + * """ */ - __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - /* "View.MemoryView":1076 - * dst.data = memview.view.buf + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 * - * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - __pyx_t_2 = __pyx_v_memview->view.ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_dim = __pyx_t_4; - /* "View.MemoryView":1077 +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":268 + * Can return NULL for 0-dimensional arrays. + * """ + * return PyArray_DIMS(self) # <<<<<<<<<<<<<< * - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + * @property */ - (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); + __pyx_r = PyArray_DIMS(__pyx_v_self); + goto __pyx_L0; - /* "View.MemoryView":1078 - * for dim in range(memview.view.ndim): - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":263 * + * @property + * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the dimensions/shape of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); - /* "View.MemoryView":1079 - * dst.shape[dim] = shape[dim] - * dst.strides[dim] = strides[dim] - * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 * - * @cname('__pyx_memoryview_copy_object') + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ - if ((__pyx_v_suboffsets != 0)) { - __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]); - } else { - __pyx_t_5 = -1L; - } - (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; - } - /* "View.MemoryView":1065 +static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { + npy_intp *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":275 + * The number of elements matches the number of dimensions of the array (ndim). + * """ + * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_slice_copy') - * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< - * cdef int dim - * cdef (Py_ssize_t*) shape, strides, suboffsets + * @property + */ + __pyx_r = PyArray_STRIDES(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":271 + * + * @property + * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< + * """Returns a pointer to the strides of the array. + * The number of elements matches the number of dimensions of the array (ndim). */ /* function exit code */ - __Pyx_RefNannyFinishContext(); + __pyx_L0:; + return __pyx_r; } -/* "View.MemoryView":1082 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ */ -static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) { - __Pyx_memviewslice __pyx_v_memviewslice; +static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { + npy_intp __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":281 + * """Returns the total size (in number of elements) of the array. + * """ + * return PyArray_SIZE(self) # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_r = PyArray_SIZE(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":278 + * + * @property + * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< + * """Returns the total size (in number of elements) of the array. + * """ + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 + * + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { + char *__pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":290 + * of `PyArray_DATA()` instead, which returns a 'void*'. + * """ + * return PyArray_BYTES(self) # <<<<<<<<<<<<<< + * + * ctypedef unsigned char npy_bool + */ + __pyx_r = PyArray_BYTES(__pyx_v_self); + goto __pyx_L0; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":284 + * + * @property + * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< + * """The pointer to the data buffer as a char*. + * This is provided for legacy reasons to avoid direct struct field access. + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "View.MemoryView":1085 - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< - * return memoryview_copy_from_slice(memview, &memviewslice) + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":774 * - */ - __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); - - /* "View.MemoryView":1086 - * cdef __Pyx_memviewslice memviewslice - * slice_copy(memview, &memviewslice) - * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1086, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":1082 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":773 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) * - * @cname('__pyx_memoryview_copy_object') - * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< - * "Create a new memoryview object" - * cdef __Pyx_memviewslice memviewslice */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18423,125 +18939,99 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx return __pyx_r; } -/* "View.MemoryView":1089 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. */ -static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) { - PyObject *(*__pyx_v_to_object_func)(char *); - int (*__pyx_v_to_dtype_func)(char *, PyObject *); +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *(*__pyx_t_3)(char *); - int (*__pyx_t_4)(char *, PyObject *); - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":777 * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - */ - __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1097 + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - */ - __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; - __pyx_v_to_object_func = __pyx_t_3; - - /* "View.MemoryView":1098 - * if isinstance(memview, _memoryviewslice): - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< - * else: - * to_object_func = NULL + * cdef inline object PyArray_MultiIterNew3(a, b, c): */ - __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; - __pyx_v_to_dtype_func = __pyx_t_4; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":1096 - * cdef int (*to_dtype_func)(char *, object) except 0 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":776 + * return PyArray_MultiIterNew(1, a) * - * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< - * to_object_func = (<_memoryviewslice> memview).to_object_func - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1100 - * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func - * else: - * to_object_func = NULL # <<<<<<<<<<<<<< - * to_dtype_func = NULL + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) * */ - /*else*/ { - __pyx_v_to_object_func = NULL; - /* "View.MemoryView":1101 - * else: - * to_object_func = NULL - * to_dtype_func = NULL # <<<<<<<<<<<<<< - * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - */ - __pyx_v_to_dtype_func = NULL; - } - __pyx_L3:; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1103 - * to_dtype_func = NULL +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< - * to_object_func, to_dtype_func, - * memview.dtype_is_object) */ - __Pyx_XDECREF(__pyx_r); - /* "View.MemoryView":1105 - * return memoryview_fromslice(memviewslice[0], memview.view.ndim, - * to_object_func, to_dtype_func, - * memview.dtype_is_object) # <<<<<<<<<<<<<< +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":780 * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":1089 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":779 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) * - * @cname('__pyx_memoryview_copy_object_from_slice') - * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< - * """ - * Create a new memoryview object from a given memoryview object and slice. */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -18549,4949 +19039,9547 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview return __pyx_r; } -/* "View.MemoryView":1111 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg */ -static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { - Py_ssize_t __pyx_r; - int __pyx_t_1; +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "View.MemoryView":1112 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":783 * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: - */ - __pyx_t_1 = ((__pyx_v_arg < 0) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1113 - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: - * return -arg # <<<<<<<<<<<<<< - * else: - * return arg - */ - __pyx_r = (-__pyx_v_arg); - goto __pyx_L0; - - /* "View.MemoryView":1112 + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: - * if arg < 0: # <<<<<<<<<<<<<< - * return -arg - * else: + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - } + __Pyx_XDECREF(__pyx_r); + __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_ERR(2, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":1115 - * return -arg - * else: - * return arg # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":782 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) * - * @cname('__pyx_get_best_slice_order') - */ - /*else*/ { - __pyx_r = __pyx_v_arg; - goto __pyx_L0; - } - - /* "View.MemoryView":1111 - * - * - * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< - * if arg < 0: - * return -arg */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1118 - * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. - */ - -static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) { - int __pyx_v_i; - Py_ssize_t __pyx_v_c_stride; - Py_ssize_t __pyx_v_f_stride; - char __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - - /* "View.MemoryView":1123 - * """ - * cdef int i - * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< - * cdef Py_ssize_t f_stride = 0 - * - */ - __pyx_v_c_stride = 0; - - /* "View.MemoryView":1124 - * cdef int i - * cdef Py_ssize_t c_stride = 0 - * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): - */ - __pyx_v_f_stride = 0; - - /* "View.MemoryView":1126 - * cdef Py_ssize_t f_stride = 0 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; - - /* "View.MemoryView":1127 + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1128 - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "View.MemoryView":1129 - * if mslice.shape[i] > 1: - * c_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":786 * - * for i in range(ndim): - */ - goto __pyx_L4_break; - - /* "View.MemoryView":1127 + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * - * for i in range(ndim - 1, -1, -1): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * c_stride = mslice.strides[i] - * break + * cdef inline tuple PyDataType_SHAPE(dtype d): */ - } - } - __pyx_L4_break:; + __Pyx_XDECREF(__pyx_r); + __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_ERR(2, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "View.MemoryView":1131 - * break + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":785 + * return PyArray_MultiIterNew(4, a, b, c, d) * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - */ - __pyx_t_1 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_1; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1132 + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break */ - __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1133 - * for i in range(ndim): - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1134 - * if mslice.shape[i] > 1: - * f_stride = mslice.strides[i] - * break # <<<<<<<<<<<<<< +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape */ - goto __pyx_L7_break; - /* "View.MemoryView":1132 - * - * for i in range(ndim): - * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< - * f_stride = mslice.strides[i] - * break - */ - } - } - __pyx_L7_break:; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - /* "View.MemoryView":1136 - * break + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape * else: */ - __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0); - if (__pyx_t_2) { + __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); + if (__pyx_t_1) { - /* "View.MemoryView":1137 - * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): - * return 'C' # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":790 + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape # <<<<<<<<<<<<<< * else: - * return 'F' + * return () */ - __pyx_r = 'C'; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); + __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); goto __pyx_L0; - /* "View.MemoryView":1136 - * break + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":789 * - * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< - * return 'C' + * cdef inline tuple PyDataType_SHAPE(dtype d): + * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< + * return d.subarray.shape * else: */ } - /* "View.MemoryView":1139 - * return 'C' + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":792 + * return d.subarray.shape * else: - * return 'F' # <<<<<<<<<<<<<< + * return () # <<<<<<<<<<<<<< + * * - * @cython.cdivision(True) */ /*else*/ { - __pyx_r = 'F'; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_empty_tuple); + __pyx_r = __pyx_empty_tuple; goto __pyx_L0; } - /* "View.MemoryView":1118 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":788 + * return PyArray_MultiIterNew(5, a, b, c, d, e) * - * @cname('__pyx_get_best_slice_order') - * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< - * """ - * Figure out the best memory access order for a given slice. + * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< + * if PyDataType_HASSUBARRAY(d): + * return d.subarray.shape */ /* function exit code */ __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1142 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ -static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent; - Py_ssize_t __pyx_v_dst_extent; - Py_ssize_t __pyx_v_src_stride; - Py_ssize_t __pyx_v_dst_stride; +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "View.MemoryView":1149 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":968 + * + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) * - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] */ - __pyx_v_src_extent = (__pyx_v_src_shape[0]); + Py_INCREF(__pyx_v_base); - /* "View.MemoryView":1150 - * cdef Py_ssize_t i - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":969 + * cdef inline void set_array_base(ndarray arr, object base): + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): */ - __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 969, __pyx_L1_error) - /* "View.MemoryView":1151 - * cdef Py_ssize_t src_extent = src_shape[0] - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t dst_stride = dst_strides[0] + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":967 + * int _import_umath() except -1 * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ - __pyx_v_src_stride = (__pyx_v_src_strides[0]); - /* "View.MemoryView":1152 - * cdef Py_ssize_t dst_extent = dst_shape[0] - * cdef Py_ssize_t src_stride = src_strides[0] - * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: - */ - __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { - /* "View.MemoryView":1155 +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":972 * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: + * return None */ - __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L5_bool_binop_done; - } + __pyx_v_base = PyArray_BASE(__pyx_v_arr); - /* "View.MemoryView":1156 - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base */ - __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize); - if (__pyx_t_2) { - __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride)); - } - __pyx_t_3 = (__pyx_t_2 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L5_bool_binop_done:; + __pyx_t_1 = (__pyx_v_base == NULL); + if (__pyx_t_1) { - /* "View.MemoryView":1155 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":974 + * base = PyArray_BASE(arr) + * if base is NULL: + * return None # <<<<<<<<<<<<<< + * return base * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) */ - if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "View.MemoryView":1157 - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); + } - /* "View.MemoryView":1155 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":975 + * if base is NULL: + * return None + * return base # <<<<<<<<<<<<<< * - * if ndim == 1: - * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< - * src_stride == itemsize == dst_stride): - * memcpy(dst_data, src_data, itemsize * dst_extent) + * # Versions of the import_* functions which are more suitable for */ - goto __pyx_L4; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; - /* "View.MemoryView":1159 - * memcpy(dst_data, src_data, itemsize * dst_extent) - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - - /* "View.MemoryView":1160 - * else: - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< - * src_data += src_stride - * dst_data += dst_stride + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":971 + * PyArray_SetBaseObject(arr, base) + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: */ - (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); - /* "View.MemoryView":1161 - * for i in range(dst_extent): - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride - * else: - */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1162 - * memcpy(dst_data, src_data, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< - * else: - * for i in range(dst_extent): +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); - } - } - __pyx_L4:; - /* "View.MemoryView":1154 - * cdef Py_ssize_t dst_stride = dst_strides[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * if (src_stride > 0 and dst_stride > 0 and - * src_stride == itemsize == dst_stride): +static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_array", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - goto __pyx_L3; - } + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "View.MemoryView":1164 - * dst_data += dst_stride - * else: - * for i in range(dst_extent): # <<<<<<<<<<<<<< - * _copy_strided_to_strided(src_data, src_strides + 1, - * dst_data, dst_strides + 1, + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":981 + * cdef inline int import_array() except -1: + * try: + * __pyx_import_array() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") */ - /*else*/ { - __pyx_t_4 = __pyx_v_dst_extent; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 981, __pyx_L3_error) - /* "View.MemoryView":1165 - * else: - * for i in range(dst_extent): - * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< - * dst_data, dst_strides + 1, - * src_shape + 1, dst_shape + 1, + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: */ - _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":1169 - * src_shape + 1, dst_shape + 1, - * ndim - 1, itemsize) - * src_data += src_stride # <<<<<<<<<<<<<< - * dst_data += dst_stride + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":982 + * try: + * __pyx_import_array() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.multiarray failed to import") * */ - __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 982, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":1170 - * ndim - 1, itemsize) - * src_data += src_stride - * dst_data += dst_stride # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, + * cdef inline int import_umath() except -1: */ - __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 983, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 983, __pyx_L5_except_error) } + goto __pyx_L5_except_error; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":980 + * # Cython code. + * cdef inline int import_array() except -1: + * try: # <<<<<<<<<<<<<< + * __pyx_import_array() + * except Exception: + */ + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; } - __pyx_L3:; - /* "View.MemoryView":1142 - * - * @cython.cdivision(True) - * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< - * char *dst_data, Py_ssize_t *dst_strides, - * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":979 + * # Versions of the import_* functions which are more suitable for + * # Cython code. + * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< + * try: + * __pyx_import_array() */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1172 - * dst_data += dst_stride +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ -static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - - /* "View.MemoryView":1175 - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: - * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< - * src.shape, dst.shape, ndim, itemsize) - * - */ - _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); +static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_umath", 0); - /* "View.MemoryView":1172 - * dst_data += dst_stride + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *dst, - * int ndim, size_t itemsize) nogil: + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* function exit code */ -} - -/* "View.MemoryView":1179 - * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":987 + * cdef inline int import_umath() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") */ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 987, __pyx_L3_error) -static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) { - Py_ssize_t __pyx_v_shape; - Py_ssize_t __pyx_v_size; - Py_ssize_t __pyx_r; - Py_ssize_t __pyx_t_1; - Py_ssize_t *__pyx_t_2; - Py_ssize_t *__pyx_t_3; - Py_ssize_t *__pyx_t_4; - - /* "View.MemoryView":1181 - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * for shape in src.shape[:ndim]: + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_size = __pyx_t_1; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":1183 - * cdef Py_ssize_t shape, size = src.memview.view.itemsize - * - * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<< - * size *= shape + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":988 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") * */ - __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim); - for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_2 = __pyx_t_4; - __pyx_v_shape = (__pyx_t_2[0]); + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 988, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":1184 - * - * for shape in src.shape[:ndim]: - * size *= shape # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * - * return size + * cdef inline int import_ufunc() except -1: */ - __pyx_v_size = (__pyx_v_size * __pyx_v_shape); - } + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 989, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 989, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; - /* "View.MemoryView":1186 - * size *= shape - * - * return size # <<<<<<<<<<<<<< + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":986 * - * @cname('__pyx_fill_contig_strides_array') + * cdef inline int import_umath() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_r = __pyx_v_size; - goto __pyx_L0; + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } - /* "View.MemoryView":1179 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":985 + * raise ImportError("numpy.core.multiarray failed to import") * - * @cname('__pyx_memoryview_slice_get_size') - * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< - * "Return the size of the memory occupied by the slice in number of bytes" - * cdef Py_ssize_t shape, size = src.memview.view.itemsize + * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1189 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ -static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) { - int __pyx_v_idx; - Py_ssize_t __pyx_r; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; +static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("import_ufunc", 0); - /* "View.MemoryView":1198 - * cdef int idx + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_1 = ((__pyx_v_order == 'F') != 0); - if (__pyx_t_1) { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":993 + * cdef inline int import_ufunc() except -1: + * try: + * _import_umath() # <<<<<<<<<<<<<< + * except Exception: + * raise ImportError("numpy.core.umath failed to import") + */ + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 993, __pyx_L3_error) - /* "View.MemoryView":1199 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * - * if order == 'F': - * for idx in range(ndim): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - __pyx_t_2 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_idx = __pyx_t_4; + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; - /* "View.MemoryView":1200 - * if order == 'F': - * for idx in range(ndim): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] - * else: + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":994 + * try: + * _import_umath() + * except Exception: # <<<<<<<<<<<<<< + * raise ImportError("numpy.core.umath failed to import") + * */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; + __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_4) { + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 994, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); - /* "View.MemoryView":1201 - * for idx in range(ndim): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< - * else: - * for idx in range(ndim - 1, -1, -1): + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":995 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * + * */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 995, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(2, 995, __pyx_L5_except_error) } + goto __pyx_L5_except_error; - /* "View.MemoryView":1198 - * cdef int idx + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":992 * - * if order == 'F': # <<<<<<<<<<<<<< - * for idx in range(ndim): - * strides[idx] = stride + * cdef inline int import_ufunc() except -1: + * try: # <<<<<<<<<<<<<< + * _import_umath() + * except Exception: */ - goto __pyx_L3; + __pyx_L5_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; } - /* "View.MemoryView":1203 - * stride *= shape[idx] - * else: - * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * strides[idx] = stride - * stride *= shape[idx] - */ - /*else*/ { - for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { - __pyx_v_idx = __pyx_t_2; - - /* "View.MemoryView":1204 - * else: - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride # <<<<<<<<<<<<<< - * stride *= shape[idx] + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":991 + * raise ImportError("numpy.core.umath failed to import") * + * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< + * try: + * _import_umath() */ - (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":1205 - * for idx in range(ndim - 1, -1, -1): - * strides[idx] = stride - * stride *= shape[idx] # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - * return stride + * + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ - __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); - } - } - __pyx_L3:; - /* "View.MemoryView":1207 - * stride *= shape[idx] +static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_timedelta64_object", 0); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1010 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< * - * return stride # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_copy_data_to_temp') */ - __pyx_r = __pyx_v_stride; + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); goto __pyx_L0; - /* "View.MemoryView":1189 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":998 * - * @cname('__pyx_fill_contig_strides_array') - * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< - * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, - * int ndim, char order) nogil: + * + * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.timedelta64)` */ /* function exit code */ __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1210 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + * + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` */ -static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) { - int __pyx_v_i; - void *__pyx_v_result; - size_t __pyx_v_itemsize; - size_t __pyx_v_size; - void *__pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - struct __pyx_memoryview_obj *__pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_datetime64_object", 0); - /* "View.MemoryView":1221 - * cdef void *result + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1025 + * bool + * """ + * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< * - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef size_t size = slice_get_size(src, ndim) * */ - __pyx_t_1 = __pyx_v_src->memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; + __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); + goto __pyx_L0; - /* "View.MemoryView":1222 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1013 * - * cdef size_t itemsize = src.memview.view.itemsize - * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< * - * result = malloc(size) + * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< + * """ + * Cython equivalent of `isinstance(obj, np.datetime64)` */ - __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - /* "View.MemoryView":1224 - * cdef size_t size = slice_get_size(src, ndim) - * - * result = malloc(size) # <<<<<<<<<<<<<< - * if not result: - * _err(MemoryError, NULL) - */ - __pyx_v_result = malloc(__pyx_v_size); + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":1225 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) * + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object */ - __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1226 - * result = malloc(size) - * if not result: - * _err(MemoryError, NULL) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1226, __pyx_L1_error) +static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { + npy_datetime __pyx_r; - /* "View.MemoryView":1225 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1035 + * also needed. That can be found using `get_datetime64_unit`. + * """ + * return (obj).obval # <<<<<<<<<<<<<< * - * result = malloc(size) - * if not result: # <<<<<<<<<<<<<< - * _err(MemoryError, NULL) * */ - } + __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; - /* "View.MemoryView":1229 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1028 * * - * tmpslice.data = result # <<<<<<<<<<<<<< - * tmpslice.memview = src.memview - * for i in range(ndim): - */ - __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - - /* "View.MemoryView":1230 - * - * tmpslice.data = result - * tmpslice.memview = src.memview # <<<<<<<<<<<<<< - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] + * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy datetime64 object */ - __pyx_t_4 = __pyx_v_src->memview; - __pyx_v_tmpslice->memview = __pyx_t_4; - /* "View.MemoryView":1231 - * tmpslice.data = result - * tmpslice.memview = src.memview - * for i in range(ndim): # <<<<<<<<<<<<<< - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 - */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "View.MemoryView":1232 - * tmpslice.memview = src.memview - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< - * tmpslice.suboffsets[i] = -1 +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 * - */ - (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - - /* "View.MemoryView":1233 - * for i in range(ndim): - * tmpslice.shape[i] = src.shape[i] - * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object */ - (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; - } - /* "View.MemoryView":1235 - * tmpslice.suboffsets[i] = -1 +static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { + npy_timedelta __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1042 + * returns the int64 value underlying scalar numpy timedelta64 object + * """ + * return (obj).obval # <<<<<<<<<<<<<< * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< - * ndim, order) * */ - (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); + __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; + goto __pyx_L0; - /* "View.MemoryView":1239 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1038 * * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 + * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the int64 value underlying scalar numpy timedelta64 object */ - __pyx_t_3 = __pyx_v_ndim; - __pyx_t_5 = __pyx_t_3; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1240 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. */ - __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { - /* "View.MemoryView":1241 - * for i in range(ndim): - * if tmpslice.shape[i] == 1: - * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< - * - * if slice_is_contig(src[0], order, ndim): +static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { + NPY_DATETIMEUNIT __pyx_r; + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1049 + * returns the unit part of the dtype for a numpy datetime64 object. + * """ + * return (obj).obmeta.base # <<<<<<<<<<<<<< */ - (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; + __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); + goto __pyx_L0; - /* "View.MemoryView":1240 + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":1045 * - * for i in range(ndim): - * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< - * tmpslice.strides[i] = 0 * + * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< + * """ + * returns the unit part of the dtype for a numpy datetime64 object. */ - } - } - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 - * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: - */ - __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0); - if (__pyx_t_2) { + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} - /* "View.MemoryView":1244 +/* "newanalysis/voro/voro.pyx":21 + * void _calcTessellationVolSurfAtomic(double *xyz, float boxlength, int *f2c, int natoms, int nmolecules, int maxshell, char *ds_ptr, int *corelist, int ncore, float* vols, float* face_area_ptr) * - * if slice_is_contig(src[0], order, ndim): - * memcpy(result, src.data, size) # <<<<<<<<<<<<<< - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) + * cdef unicode _ustring(s): # <<<<<<<<<<<<<< + * if type(s) is unicode: + * # fast path for most common case(s) */ - (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - /* "View.MemoryView":1243 - * tmpslice.strides[i] = 0 +static PyObject *__pyx_f_11newanalysis_4voro__ustring(PyObject *__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_ustring", 0); + + /* "newanalysis/voro/voro.pyx":22 * - * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< - * memcpy(result, src.data, size) - * else: + * cdef unicode _ustring(s): + * if type(s) is unicode: # <<<<<<<<<<<<<< + * # fast path for most common case(s) + * return s */ - goto __pyx_L9; - } + __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_s)) == ((PyObject *)(&PyUnicode_Type))); + if (__pyx_t_1) { - /* "View.MemoryView":1246 - * memcpy(result, src.data, size) - * else: - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< + /* "newanalysis/voro/voro.pyx":24 + * if type(s) is unicode: + * # fast path for most common case(s) + * return s # <<<<<<<<<<<<<< + * elif PY_MAJOR_VERSION < 3 and isinstance(s, bytes): + * # only accept byte strings in Python 2.x, not in Py3 + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject*)__pyx_v_s)); + __pyx_r = ((PyObject*)__pyx_v_s); + goto __pyx_L0; + + /* "newanalysis/voro/voro.pyx":22 * - * return result + * cdef unicode _ustring(s): + * if type(s) is unicode: # <<<<<<<<<<<<<< + * # fast path for most common case(s) + * return s */ - /*else*/ { - copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize); } - __pyx_L9:; - /* "View.MemoryView":1248 - * copy_strided_to_strided(src, tmpslice, ndim, itemsize) - * - * return result # <<<<<<<<<<<<<< - * - * + /* "newanalysis/voro/voro.pyx":25 + * # fast path for most common case(s) + * return s + * elif PY_MAJOR_VERSION < 3 and isinstance(s, bytes): # <<<<<<<<<<<<<< + * # only accept byte strings in Python 2.x, not in Py3 + * return (s).decode('ascii') */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; + __pyx_t_2 = (PY_MAJOR_VERSION < 3); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = PyBytes_Check(__pyx_v_s); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "View.MemoryView":1210 - * - * @cname('__pyx_memoryview_copy_data_to_temp') - * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice *tmpslice, - * char order, + /* "newanalysis/voro/voro.pyx":27 + * elif PY_MAJOR_VERSION < 3 and isinstance(s, bytes): + * # only accept byte strings in Python 2.x, not in Py3 + * return (s).decode('ascii') # <<<<<<<<<<<<<< + * elif isinstance(s, unicode): + * # an evil cast to might work here in some(!) cases, */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(__pyx_v_s == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode"); + __PYX_ERR(0, 27, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_decode_bytes(((PyObject*)__pyx_v_s), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; - /* function exit code */ - __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif + /* "newanalysis/voro/voro.pyx":25 + * # fast path for most common case(s) + * return s + * elif PY_MAJOR_VERSION < 3 and isinstance(s, bytes): # <<<<<<<<<<<<<< + * # only accept byte strings in Python 2.x, not in Py3 + * return (s).decode('ascii') + */ } - __pyx_r = NULL; - __pyx_L0:; - return __pyx_r; -} -/* "View.MemoryView":1253 - * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + /* "newanalysis/voro/voro.pyx":28 + * # only accept byte strings in Python 2.x, not in Py3 + * return (s).decode('ascii') + * elif isinstance(s, unicode): # <<<<<<<<<<<<<< + * # an evil cast to might work here in some(!) cases, + * # depending on what the further processing does. to be safe, */ + __pyx_t_1 = PyUnicode_Check(__pyx_v_s); + if (likely(__pyx_t_1)) { -static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err_extents", 0); + /* "newanalysis/voro/voro.pyx":32 + * # depending on what the further processing does. to be safe, + * # we can always create a copy instead + * return unicode(s) # <<<<<<<<<<<<<< + * else: + * raise TypeError("Unknown string type!") + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; - /* "View.MemoryView":1256 - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % - * (i, extent1, extent2)) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err_dim') + /* "newanalysis/voro/voro.pyx":28 + * # only accept byte strings in Python 2.x, not in Py3 + * return (s).decode('ascii') + * elif isinstance(s, unicode): # <<<<<<<<<<<<<< + * # an evil cast to might work here in some(!) cases, + * # depending on what the further processing does. to be safe, */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_3 = 0; + } - /* "View.MemoryView":1255 - * cdef int _err_extents(int i, Py_ssize_t extent1, - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<< - * (i, extent1, extent2)) + /* "newanalysis/voro/voro.pyx":34 + * return unicode(s) + * else: + * raise TypeError("Unknown string type!") # <<<<<<<<<<<<<< * + * @cython.boundscheck(False) */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 1255, __pyx_L1_error) + /*else*/ { + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 34, __pyx_L1_error) + } - /* "View.MemoryView":1253 + /* "newanalysis/voro/voro.pyx":21 + * void _calcTessellationVolSurfAtomic(double *xyz, float boxlength, int *f2c, int natoms, int nmolecules, int maxshell, char *ds_ptr, int *corelist, int ncore, float* vols, float* face_area_ptr) * - * @cname('__pyx_memoryview_err_extents') - * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< - * Py_ssize_t extent2) except -1 with gil: - * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + * cdef unicode _ustring(s): # <<<<<<<<<<<<<< + * if type(s) is unicode: + * # fast path for most common case(s) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("newanalysis.voro._ustring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif return __pyx_r; } -/* "View.MemoryView":1259 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) +/* "newanalysis/voro/voro.pyx":36 + * raise TypeError("Unknown string type!") * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, float boxlength, + * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, */ -static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_4voro_1calcTessellation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_4voro_calcTessellation, " \n calcTessellation(xyz, boxlength, f2c, natoms, nmolecules, maxshell, corelist, vols, fa)\n\n This function wraps a c++ function calling the voro++ library\n\n args: \txyz\t\t---\t2-dim numpy array of 64 bit floats in C format with coordinates\n \tboxlength\t---\tboxlength as a float\n \tf2c\t\t---\tfine2coarse array, 1-dim, C-format, 32 bit integers\n \tnatoms\t\t---\tnumber of atoms\n \tnmolecules\t---\tnumber of molecules\n \tmaxshell\t---\toutermost shell to be calculated\n \tcorelist\t---\tresidue numbers of the 'core' molecules\n \tvols\t\t---\tarray in which the calculated volumes are to be inserted, 1-dim, C-format, 64-bit floats [optional]\n \tfa\t\t---\tarray in which the calculated interface areas are to be inserted, 2-dim, C-format, 64-bit floats [optional]\n\n ###############################################################################\n NOTE: do not call this function directly! instead, use the AtomGroup interface!\n E.g. if you have a selection \"sel\", call\n\n shells = sel.calcTessellation(maxshell=3,core_sel=None,volumes=None,face_areas=None)\n\n Doc-String:\n Calculates the Voronoi tessellation of the whole box with the current AtomGroup as the core selection and returns the Delaunay distance matrix.\n\n Arguments:\n \tmaxshell:\tMaximum shell to calculate (default is 3)\n \tcore_sel:\tAtomGroup object of core selection (default is self)\n \tvolumes:\t1-dim numpy.float64 array for cell volume calculation (only together with face_areas!)\n \tface_areas:\t2-dim numpy.float64 array for surface area calculation (only together with volumes!)\n\n The returned shells array will have n x n size, with n being the total number of residues in the box,\n "" but only those lines corresponding to the residue numbers of the residues in sel will be filled\n (cf. the output of sel.f2c(), meaning fine2coarse -- atom number -> residue number).\n In this way, one can save time by not generating the neighborhood information for unneeding residues.\n"); +static PyMethodDef __pyx_mdef_11newanalysis_4voro_1calcTessellation = {"calcTessellation", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_4voro_1calcTessellation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_calcTessellation}; +static PyObject *__pyx_pw_11newanalysis_4voro_1calcTessellation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_xyz = 0; + float __pyx_v_boxlength; + PyArrayObject *__pyx_v_f2c = 0; + PyObject *__pyx_v_natoms = 0; + PyObject *__pyx_v_nmolecules = 0; + PyObject *__pyx_v_maxshell = 0; + PyArrayObject *__pyx_v_corelist = 0; + PyArrayObject *__pyx_v_vols = 0; + PyArrayObject *__pyx_v_fa = 0; + PyArrayObject *__pyx_v_ds_ts = 0; + PyObject *__pyx_v_ts = 0; + PyObject *__pyx_v_ires = 0; + PyArrayObject *__pyx_v_surroundlist = 0; + PyObject *__pyx_v_h5file = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcTessellation (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 36, __pyx_L3_error) #endif - __Pyx_RefNannySetupContext("_err_dim", 0); - __Pyx_INCREF(__pyx_v_error); + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_boxlength,&__pyx_n_s_f2c,&__pyx_n_s_natoms,&__pyx_n_s_nmolecules,&__pyx_n_s_maxshell,&__pyx_n_s_corelist,&__pyx_n_s_vols,&__pyx_n_s_fa,&__pyx_n_s_ds_ts,&__pyx_n_s_ts,&__pyx_n_s_ires,&__pyx_n_s_surroundlist,&__pyx_n_s_h5file,0}; - /* "View.MemoryView":1260 - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: - * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_err') + /* "newanalysis/voro/voro.pyx":40 + * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, + * np.ndarray[np.int32_t,ndim=1, mode="c"] corelist, + * np.ndarray[np.float32_t,ndim=1,mode="c"] vols = None, # <<<<<<<<<<<<<< + * np.ndarray[np.float32_t,ndim=2,mode="c"] fa = None, + * np.ndarray[np.int8_t,ndim=1,mode="c"] ds_ts = None, ts=None, ires=None, */ - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_v_error); - __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 1260, __pyx_L1_error) - - /* "View.MemoryView":1259 - * - * @cname('__pyx_memoryview_err_dim') - * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii') % dim) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} + values[7] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((PyArrayObject *)Py_None)); -/* "View.MemoryView":1263 - * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) + /* "newanalysis/voro/voro.pyx":41 + * np.ndarray[np.int32_t,ndim=1, mode="c"] corelist, + * np.ndarray[np.float32_t,ndim=1,mode="c"] vols = None, + * np.ndarray[np.float32_t,ndim=2,mode="c"] fa = None, # <<<<<<<<<<<<<< + * np.ndarray[np.int8_t,ndim=1,mode="c"] ds_ts = None, ts=None, ires=None, + * np.ndarray[np.int32_t,ndim=1] surroundlist = None, h5file=None): */ + values[8] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((PyArrayObject *)Py_None)); -static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("_err", 0); - __Pyx_INCREF(__pyx_v_error); - - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: + /* "newanalysis/voro/voro.pyx":42 + * np.ndarray[np.float32_t,ndim=1,mode="c"] vols = None, + * np.ndarray[np.float32_t,ndim=2,mode="c"] fa = None, + * np.ndarray[np.int8_t,ndim=1,mode="c"] ds_ts = None, ts=None, ires=None, # <<<<<<<<<<<<<< + * np.ndarray[np.int32_t,ndim=1] surroundlist = None, h5file=None): + * """ */ - __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); - if (unlikely(__pyx_t_1)) { + values[9] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((PyArrayObject *)Py_None)); + values[10] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[11] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); - /* "View.MemoryView":1265 - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: - * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< - * else: - * raise error + /* "newanalysis/voro/voro.pyx":43 + * np.ndarray[np.float32_t,ndim=2,mode="c"] fa = None, + * np.ndarray[np.int8_t,ndim=1,mode="c"] ds_ts = None, ts=None, ires=None, + * np.ndarray[np.int32_t,ndim=1] surroundlist = None, h5file=None): # <<<<<<<<<<<<<< + * """ + * calcTessellation(xyz, boxlength, f2c, natoms, nmolecules, maxshell, corelist, vols, fa) */ - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_error); - __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + values[12] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((PyArrayObject *)Py_None)); + values[13] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); + CYTHON_FALLTHROUGH; + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); + CYTHON_FALLTHROUGH; + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + CYTHON_FALLTHROUGH; + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 1); __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_f2c)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 2); __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_natoms)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 3); __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmolecules)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 4); __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 5); __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_corelist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, 6); __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_vols); + if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fa); + if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds_ts); + if (value) { values[9] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 10: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ts); + if (value) { values[10] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 11: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ires); + if (value) { values[11] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 12: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_surroundlist); + if (value) { values[12] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 13: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_h5file); + if (value) { values[13] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcTessellation") < 0)) __PYX_ERR(0, 36, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); + CYTHON_FALLTHROUGH; + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); + CYTHON_FALLTHROUGH; + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); + CYTHON_FALLTHROUGH; + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); + CYTHON_FALLTHROUGH; + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1265, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 1265, __pyx_L1_error) - - /* "View.MemoryView":1264 - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: - * if msg != NULL: # <<<<<<<<<<<<<< - * raise error(msg.decode('ascii')) - * else: - */ + __pyx_v_xyz = ((PyArrayObject *)values[0]); + __pyx_v_boxlength = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_boxlength == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L3_error) + __pyx_v_f2c = ((PyArrayObject *)values[2]); + __pyx_v_natoms = values[3]; + __pyx_v_nmolecules = values[4]; + __pyx_v_maxshell = values[5]; + __pyx_v_corelist = ((PyArrayObject *)values[6]); + __pyx_v_vols = ((PyArrayObject *)values[7]); + __pyx_v_fa = ((PyArrayObject *)values[8]); + __pyx_v_ds_ts = ((PyArrayObject *)values[9]); + __pyx_v_ts = values[10]; + __pyx_v_ires = values[11]; + __pyx_v_surroundlist = ((PyArrayObject *)values[12]); + __pyx_v_h5file = values[13]; } - - /* "View.MemoryView":1267 - * raise error(msg.decode('ascii')) - * else: - * raise error # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_copy_contents') - */ - /*else*/ { - __Pyx_Raise(__pyx_v_error, 0, 0, 0); - __PYX_ERR(2, 1267, __pyx_L1_error) + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcTessellation", 0, 7, 14, __pyx_nargs); __PYX_ERR(0, 36, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } + __Pyx_AddTraceback("newanalysis.voro.calcTessellation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 37, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f2c), __pyx_ptype_5numpy_ndarray, 1, "f2c", 0))) __PYX_ERR(0, 38, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_corelist), __pyx_ptype_5numpy_ndarray, 1, "corelist", 0))) __PYX_ERR(0, 39, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vols), __pyx_ptype_5numpy_ndarray, 1, "vols", 0))) __PYX_ERR(0, 40, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fa), __pyx_ptype_5numpy_ndarray, 1, "fa", 0))) __PYX_ERR(0, 41, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ds_ts), __pyx_ptype_5numpy_ndarray, 1, "ds_ts", 0))) __PYX_ERR(0, 42, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_surroundlist), __pyx_ptype_5numpy_ndarray, 1, "surroundlist", 0))) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_4voro_calcTessellation(__pyx_self, __pyx_v_xyz, __pyx_v_boxlength, __pyx_v_f2c, __pyx_v_natoms, __pyx_v_nmolecules, __pyx_v_maxshell, __pyx_v_corelist, __pyx_v_vols, __pyx_v_fa, __pyx_v_ds_ts, __pyx_v_ts, __pyx_v_ires, __pyx_v_surroundlist, __pyx_v_h5file); - /* "View.MemoryView":1263 + /* "newanalysis/voro/voro.pyx":36 + * raise TypeError("Unknown string type!") * - * @cname('__pyx_memoryview_err') - * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< - * if msg != NULL: - * raise error(msg.decode('ascii')) + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, float boxlength, + * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __Pyx_XDECREF(__pyx_v_error); + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif return __pyx_r; } -/* "View.MemoryView":1270 - * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, - */ - -static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) { - void *__pyx_v_tmpdata; - size_t __pyx_v_itemsize; +static PyObject *__pyx_pf_11newanalysis_4voro_calcTessellation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, float __pyx_v_boxlength, PyArrayObject *__pyx_v_f2c, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell, PyArrayObject *__pyx_v_corelist, PyArrayObject *__pyx_v_vols, PyArrayObject *__pyx_v_fa, PyArrayObject *__pyx_v_ds_ts, PyObject *__pyx_v_ts, PyObject *__pyx_v_ires, PyArrayObject *__pyx_v_surroundlist, PyObject *__pyx_v_h5file) { + PyArrayObject *__pyx_v_delaunay = 0; + char *__pyx_v_cds; + int *__pyx_v_cts; + double *__pyx_v_cxyz; + int *__pyx_v_cf2c; + int *__pyx_v_ccorelist; + int *__pyx_v_csurrlist; + float *__pyx_v_cvols; + float *__pyx_v_cfa; int __pyx_v_i; - char __pyx_v_order; - int __pyx_v_broadcasting; - int __pyx_v_direct_copy; - __Pyx_memviewslice __pyx_v_tmp; - int __pyx_v_ndim; - int __pyx_r; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - void *__pyx_t_7; - int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - - /* "View.MemoryView":1278 - * Check for overlapping memory and verify the shapes. - * """ - * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - */ - __pyx_v_tmpdata = NULL; + int __pyx_v_j; + int __pyx_v_nsurr; + int __pyx_v_ncore; + int __pyx_v_mindist; + int __pyx_v_dist; + int __pyx_v_icore; + int __pyx_v_isurr; + PyObject *__pyx_v_dataset = NULL; + __Pyx_LocalBuf_ND __pyx_pybuffernd_corelist; + __Pyx_Buffer __pyx_pybuffer_corelist; + __Pyx_LocalBuf_ND __pyx_pybuffernd_delaunay; + __Pyx_Buffer __pyx_pybuffer_delaunay; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ds_ts; + __Pyx_Buffer __pyx_pybuffer_ds_ts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_f2c; + __Pyx_Buffer __pyx_pybuffer_f2c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_fa; + __Pyx_Buffer __pyx_pybuffer_fa; + __Pyx_LocalBuf_ND __pyx_pybuffernd_surroundlist; + __Pyx_Buffer __pyx_pybuffer_surroundlist; + __Pyx_LocalBuf_ND __pyx_pybuffernd_vols; + __Pyx_Buffer __pyx_pybuffer_vols; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; + __Pyx_Buffer __pyx_pybuffer_xyz; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + char *__pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + Py_ssize_t __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + long __pyx_t_20; + long __pyx_t_21; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcTessellation", 0); + __pyx_pybuffer_delaunay.pybuffer.buf = NULL; + __pyx_pybuffer_delaunay.refcount = 0; + __pyx_pybuffernd_delaunay.data = NULL; + __pyx_pybuffernd_delaunay.rcbuffer = &__pyx_pybuffer_delaunay; + __pyx_pybuffer_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_xyz.refcount = 0; + __pyx_pybuffernd_xyz.data = NULL; + __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; + __pyx_pybuffer_f2c.pybuffer.buf = NULL; + __pyx_pybuffer_f2c.refcount = 0; + __pyx_pybuffernd_f2c.data = NULL; + __pyx_pybuffernd_f2c.rcbuffer = &__pyx_pybuffer_f2c; + __pyx_pybuffer_corelist.pybuffer.buf = NULL; + __pyx_pybuffer_corelist.refcount = 0; + __pyx_pybuffernd_corelist.data = NULL; + __pyx_pybuffernd_corelist.rcbuffer = &__pyx_pybuffer_corelist; + __pyx_pybuffer_vols.pybuffer.buf = NULL; + __pyx_pybuffer_vols.refcount = 0; + __pyx_pybuffernd_vols.data = NULL; + __pyx_pybuffernd_vols.rcbuffer = &__pyx_pybuffer_vols; + __pyx_pybuffer_fa.pybuffer.buf = NULL; + __pyx_pybuffer_fa.refcount = 0; + __pyx_pybuffernd_fa.data = NULL; + __pyx_pybuffernd_fa.rcbuffer = &__pyx_pybuffer_fa; + __pyx_pybuffer_ds_ts.pybuffer.buf = NULL; + __pyx_pybuffer_ds_ts.refcount = 0; + __pyx_pybuffernd_ds_ts.data = NULL; + __pyx_pybuffernd_ds_ts.rcbuffer = &__pyx_pybuffer_ds_ts; + __pyx_pybuffer_surroundlist.pybuffer.buf = NULL; + __pyx_pybuffer_surroundlist.refcount = 0; + __pyx_pybuffernd_surroundlist.data = NULL; + __pyx_pybuffernd_surroundlist.rcbuffer = &__pyx_pybuffer_surroundlist; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 36, __pyx_L1_error) + } + __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f2c.rcbuffer->pybuffer, (PyObject*)__pyx_v_f2c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 36, __pyx_L1_error) + } + __pyx_pybuffernd_f2c.diminfo[0].strides = __pyx_pybuffernd_f2c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f2c.diminfo[0].shape = __pyx_pybuffernd_f2c.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_corelist.rcbuffer->pybuffer, (PyObject*)__pyx_v_corelist, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 36, __pyx_L1_error) + } + __pyx_pybuffernd_corelist.diminfo[0].strides = __pyx_pybuffernd_corelist.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_corelist.diminfo[0].shape = __pyx_pybuffernd_corelist.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vols.rcbuffer->pybuffer, (PyObject*)__pyx_v_vols, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 36, __pyx_L1_error) + } + __pyx_pybuffernd_vols.diminfo[0].strides = __pyx_pybuffernd_vols.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vols.diminfo[0].shape = __pyx_pybuffernd_vols.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fa.rcbuffer->pybuffer, (PyObject*)__pyx_v_fa, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 36, __pyx_L1_error) + } + __pyx_pybuffernd_fa.diminfo[0].strides = __pyx_pybuffernd_fa.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fa.diminfo[0].shape = __pyx_pybuffernd_fa.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fa.diminfo[1].strides = __pyx_pybuffernd_fa.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fa.diminfo[1].shape = __pyx_pybuffernd_fa.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ds_ts.rcbuffer->pybuffer, (PyObject*)__pyx_v_ds_ts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 36, __pyx_L1_error) + } + __pyx_pybuffernd_ds_ts.diminfo[0].strides = __pyx_pybuffernd_ds_ts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ds_ts.diminfo[0].shape = __pyx_pybuffernd_ds_ts.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_surroundlist.rcbuffer->pybuffer, (PyObject*)__pyx_v_surroundlist, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 36, __pyx_L1_error) + } + __pyx_pybuffernd_surroundlist.diminfo[0].strides = __pyx_pybuffernd_surroundlist.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_surroundlist.diminfo[0].shape = __pyx_pybuffernd_surroundlist.rcbuffer->pybuffer.shape[0]; - /* "View.MemoryView":1279 - * """ - * cdef void *tmpdata = NULL - * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) + /* "newanalysis/voro/voro.pyx":78 + * In this way, one can save time by not generating the neighborhood information for unneeding residues. + * """ + * cdef np.ndarray[np.int8_t,ndim=2,mode="c"] delaunay = np.empty((nmolecules,nmolecules),dtype=np.int8,order="C") # <<<<<<<<<<<<<< + * cdef char *cds = delaunay.data + * cdef int *cts */ - __pyx_t_1 = __pyx_v_src.memview->view.itemsize; - __pyx_v_itemsize = __pyx_t_1; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_nmolecules); + __Pyx_GIVEREF(__pyx_v_nmolecules); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nmolecules)) __PYX_ERR(0, 78, __pyx_L1_error); + __Pyx_INCREF(__pyx_v_nmolecules); + __Pyx_GIVEREF(__pyx_v_nmolecules); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_nmolecules)) __PYX_ERR(0, 78, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_delaunay.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { + __pyx_v_delaunay = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_delaunay.rcbuffer->pybuffer.buf = NULL; + __PYX_ERR(0, 78, __pyx_L1_error) + } else {__pyx_pybuffernd_delaunay.diminfo[0].strides = __pyx_pybuffernd_delaunay.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_delaunay.diminfo[0].shape = __pyx_pybuffernd_delaunay.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_delaunay.diminfo[1].strides = __pyx_pybuffernd_delaunay.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_delaunay.diminfo[1].shape = __pyx_pybuffernd_delaunay.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_6 = 0; + __pyx_v_delaunay = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; - /* "View.MemoryView":1281 - * cdef size_t itemsize = src.memview.view.itemsize - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< - * cdef bint broadcasting = False - * cdef bint direct_copy = False + /* "newanalysis/voro/voro.pyx":79 + * """ + * cdef np.ndarray[np.int8_t,ndim=2,mode="c"] delaunay = np.empty((nmolecules,nmolecules),dtype=np.int8,order="C") + * cdef char *cds = delaunay.data # <<<<<<<<<<<<<< + * cdef int *cts + * cdef double* cxyz = xyz.data */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); + __pyx_t_7 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_delaunay)); if (unlikely(__pyx_t_7 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_v_cds = ((char *)__pyx_t_7); - /* "View.MemoryView":1282 - * cdef int i - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False # <<<<<<<<<<<<<< - * cdef bint direct_copy = False - * cdef __Pyx_memviewslice tmp + /* "newanalysis/voro/voro.pyx":81 + * cdef char *cds = delaunay.data + * cdef int *cts + * cdef double* cxyz = xyz.data # <<<<<<<<<<<<<< + * cdef int* cf2c = f2c.data + * cdef int* ccorelist = corelist.data */ - __pyx_v_broadcasting = 0; + __pyx_t_7 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_7 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_v_cxyz = ((double *)__pyx_t_7); - /* "View.MemoryView":1283 - * cdef char order = get_best_order(&src, src_ndim) - * cdef bint broadcasting = False - * cdef bint direct_copy = False # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice tmp - * + /* "newanalysis/voro/voro.pyx":82 + * cdef int *cts + * cdef double* cxyz = xyz.data + * cdef int* cf2c = f2c.data # <<<<<<<<<<<<<< + * cdef int* ccorelist = corelist.data + * cdef int *csurrlist */ - __pyx_v_direct_copy = 0; + __pyx_t_7 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_f2c)); if (unlikely(__pyx_t_7 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_v_cf2c = ((int *)__pyx_t_7); - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp - * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: + /* "newanalysis/voro/voro.pyx":83 + * cdef double* cxyz = xyz.data + * cdef int* cf2c = f2c.data + * cdef int* ccorelist = corelist.data # <<<<<<<<<<<<<< + * cdef int *csurrlist + * cdef float* cvols */ - __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_7 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_corelist)); if (unlikely(__pyx_t_7 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_v_ccorelist = ((int *)__pyx_t_7); - /* "View.MemoryView":1287 - * - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) + /* "newanalysis/voro/voro.pyx":87 + * cdef float* cvols + * cdef float* cfa + * cdef int i, j, nsurr, ncore = len(corelist), mindist, dist, icore, isurr # <<<<<<<<<<<<<< + * if (vols is not None and fa is None) or (vols is None and fa is not None): + * print("ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!") */ - __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); + __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_corelist)); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_v_ncore = ((int)__pyx_t_8); - /* "View.MemoryView":1286 - * cdef __Pyx_memviewslice tmp - * - * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: + /* "newanalysis/voro/voro.pyx":88 + * cdef float* cfa + * cdef int i, j, nsurr, ncore = len(corelist), mindist, dist, icore, isurr + * if (vols is not None and fa is None) or (vols is None and fa is not None): # <<<<<<<<<<<<<< + * print("ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!") + * if vols is not None: */ - goto __pyx_L3; + __pyx_t_10 = (((PyObject *)__pyx_v_vols) != Py_None); + if (!__pyx_t_10) { + goto __pyx_L5_next_or; + } else { } - - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - */ - __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0); - if (__pyx_t_2) { - - /* "View.MemoryView":1289 - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: - * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< - * - * cdef int ndim = max(src_ndim, dst_ndim) - */ - __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - - /* "View.MemoryView":1288 - * if src_ndim < dst_ndim: - * broadcast_leading(&src, src_ndim, dst_ndim) - * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - */ + __pyx_t_10 = (((PyObject *)__pyx_v_fa) == Py_None); + if (!__pyx_t_10) { + } else { + __pyx_t_9 = __pyx_t_10; + goto __pyx_L4_bool_binop_done; } - __pyx_L3:; - - /* "View.MemoryView":1291 - * broadcast_leading(&dst, dst_ndim, src_ndim) - * - * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< - * - * for i in range(ndim): - */ - __pyx_t_3 = __pyx_v_dst_ndim; - __pyx_t_4 = __pyx_v_src_ndim; - if (((__pyx_t_3 > __pyx_t_4) != 0)) { - __pyx_t_5 = __pyx_t_3; + __pyx_L5_next_or:; + __pyx_t_10 = (((PyObject *)__pyx_v_vols) == Py_None); + if (__pyx_t_10) { } else { - __pyx_t_5 = __pyx_t_4; + __pyx_t_9 = __pyx_t_10; + goto __pyx_L4_bool_binop_done; } - __pyx_v_ndim = __pyx_t_5; + __pyx_t_10 = (((PyObject *)__pyx_v_fa) != Py_None); + __pyx_t_9 = __pyx_t_10; + __pyx_L4_bool_binop_done:; + if (__pyx_t_9) { - /* "View.MemoryView":1293 - * cdef int ndim = max(src_ndim, dst_ndim) - * - * for i in range(ndim): # <<<<<<<<<<<<<< - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: + /* "newanalysis/voro/voro.pyx":89 + * cdef int i, j, nsurr, ncore = len(corelist), mindist, dist, icore, isurr + * if (vols is not None and fa is None) or (vols is None and fa is not None): + * print("ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!") # <<<<<<<<<<<<<< + * if vols is not None: + * cvols = vols.data */ - __pyx_t_5 = __pyx_v_ndim; - __pyx_t_3 = __pyx_t_5; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":1294 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + /* "newanalysis/voro/voro.pyx":88 + * cdef float* cfa + * cdef int i, j, nsurr, ncore = len(corelist), mindist, dist, icore, isurr + * if (vols is not None and fa is None) or (vols is None and fa is not None): # <<<<<<<<<<<<<< + * print("ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!") + * if vols is not None: */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0); - if (__pyx_t_2) { + } - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/voro/voro.pyx":90 + * if (vols is not None and fa is None) or (vols is None and fa is not None): + * print("ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!") + * if vols is not None: # <<<<<<<<<<<<<< + * cvols = vols.data + * if fa is not None: */ - __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0); - if (__pyx_t_2) { + __pyx_t_9 = (((PyObject *)__pyx_v_vols) != Py_None); + if (__pyx_t_9) { - /* "View.MemoryView":1296 - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: - * broadcasting = True # <<<<<<<<<<<<<< - * src.strides[i] = 0 - * else: + /* "newanalysis/voro/voro.pyx":91 + * print("ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!") + * if vols is not None: + * cvols = vols.data # <<<<<<<<<<<<<< + * if fa is not None: + * cfa = fa.data */ - __pyx_v_broadcasting = 1; + __pyx_t_7 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_vols)); if (unlikely(__pyx_t_7 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_v_cvols = ((float *)__pyx_t_7); - /* "View.MemoryView":1297 - * if src.shape[i] == 1: - * broadcasting = True - * src.strides[i] = 0 # <<<<<<<<<<<<<< - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) + /* "newanalysis/voro/voro.pyx":90 + * if (vols is not None and fa is None) or (vols is None and fa is not None): + * print("ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!") + * if vols is not None: # <<<<<<<<<<<<<< + * cvols = vols.data + * if fa is not None: */ - (__pyx_v_src.strides[__pyx_v_i]) = 0; + } - /* "View.MemoryView":1295 - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: - * if src.shape[i] == 1: # <<<<<<<<<<<<<< - * broadcasting = True - * src.strides[i] = 0 + /* "newanalysis/voro/voro.pyx":92 + * if vols is not None: + * cvols = vols.data + * if fa is not None: # <<<<<<<<<<<<<< + * cfa = fa.data + * if vols is not None and fa is not None: */ - goto __pyx_L7; - } + __pyx_t_9 = (((PyObject *)__pyx_v_fa) != Py_None); + if (__pyx_t_9) { - /* "View.MemoryView":1299 - * src.strides[i] = 0 - * else: - * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< - * - * if src.suboffsets[i] >= 0: + /* "newanalysis/voro/voro.pyx":93 + * cvols = vols.data + * if fa is not None: + * cfa = fa.data # <<<<<<<<<<<<<< + * if vols is not None and fa is not None: + * _calcTessellationVolSurf(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist),cvols,cfa) */ - /*else*/ { - __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1299, __pyx_L1_error) - } - __pyx_L7:; + __pyx_t_7 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_fa)); if (unlikely(__pyx_t_7 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_v_cfa = ((float *)__pyx_t_7); - /* "View.MemoryView":1294 - * - * for i in range(ndim): - * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< - * if src.shape[i] == 1: - * broadcasting = True + /* "newanalysis/voro/voro.pyx":92 + * if vols is not None: + * cvols = vols.data + * if fa is not None: # <<<<<<<<<<<<<< + * cfa = fa.data + * if vols is not None and fa is not None: */ - } + } - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) - * + /* "newanalysis/voro/voro.pyx":94 + * if fa is not None: + * cfa = fa.data + * if vols is not None and fa is not None: # <<<<<<<<<<<<<< + * _calcTessellationVolSurf(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist),cvols,cfa) + * else: */ - __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0); - if (__pyx_t_2) { + __pyx_t_10 = (((PyObject *)__pyx_v_vols) != Py_None); + if (__pyx_t_10) { + } else { + __pyx_t_9 = __pyx_t_10; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_10 = (((PyObject *)__pyx_v_fa) != Py_None); + __pyx_t_9 = __pyx_t_10; + __pyx_L11_bool_binop_done:; + if (__pyx_t_9) { - /* "View.MemoryView":1302 - * - * if src.suboffsets[i] >= 0: - * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< - * - * if slices_overlap(&src, &dst, ndim, itemsize): + /* "newanalysis/voro/voro.pyx":95 + * cfa = fa.data + * if vols is not None and fa is not None: + * _calcTessellationVolSurf(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist),cvols,cfa) # <<<<<<<<<<<<<< + * else: + * _calcTessellation(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist)) */ - __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1302, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_natoms); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_corelist)); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 95, __pyx_L1_error) + _calcTessellationVolSurf(__pyx_v_cxyz, __pyx_v_boxlength, __pyx_v_cf2c, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_v_cds, __pyx_v_ccorelist, __pyx_t_8, __pyx_v_cvols, __pyx_v_cfa); - /* "View.MemoryView":1301 - * _err_extents(i, dst.shape[i], src.shape[i]) - * - * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< - * _err_dim(ValueError, "Dimension %d is not direct", i) - * + /* "newanalysis/voro/voro.pyx":94 + * if fa is not None: + * cfa = fa.data + * if vols is not None and fa is not None: # <<<<<<<<<<<<<< + * _calcTessellationVolSurf(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist),cvols,cfa) + * else: */ - } + goto __pyx_L10; } - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): + /* "newanalysis/voro/voro.pyx":97 + * _calcTessellationVolSurf(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist),cvols,cfa) + * else: + * _calcTessellation(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist)) # <<<<<<<<<<<<<< + * if h5file is not None: + * dataset = h5file['delaunay'] */ - __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0); - if (__pyx_t_2) { + /*else*/ { + __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_v_natoms); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_corelist)); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 97, __pyx_L1_error) + _calcTessellation(__pyx_v_cxyz, __pyx_v_boxlength, __pyx_v_cf2c, __pyx_t_13, __pyx_t_12, __pyx_t_11, __pyx_v_cds, __pyx_v_ccorelist, __pyx_t_8); + } + __pyx_L10:; - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * + /* "newanalysis/voro/voro.pyx":98 + * else: + * _calcTessellation(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist)) + * if h5file is not None: # <<<<<<<<<<<<<< + * dataset = h5file['delaunay'] + * dataset[ts] = delaunay */ - __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_9 = (__pyx_v_h5file != Py_None); + if (__pyx_t_9) { - /* "View.MemoryView":1307 - * - * if not slice_is_contig(src, order, ndim): - * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) + /* "newanalysis/voro/voro.pyx":99 + * _calcTessellation(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist)) + * if h5file is not None: + * dataset = h5file['delaunay'] # <<<<<<<<<<<<<< + * dataset[ts] = delaunay + * elif ds_ts is None: */ - __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_h5file, __pyx_n_s_delaunay); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_dataset = __pyx_t_5; + __pyx_t_5 = 0; - /* "View.MemoryView":1306 - * if slices_overlap(&src, &dst, ndim, itemsize): - * - * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< - * order = get_best_order(&dst, ndim) - * + /* "newanalysis/voro/voro.pyx":100 + * if h5file is not None: + * dataset = h5file['delaunay'] + * dataset[ts] = delaunay # <<<<<<<<<<<<<< + * elif ds_ts is None: + * return delaunay */ - } + if (unlikely((PyObject_SetItem(__pyx_v_dataset, __pyx_v_ts, ((PyObject *)__pyx_v_delaunay)) < 0))) __PYX_ERR(0, 100, __pyx_L1_error) - /* "View.MemoryView":1309 - * order = get_best_order(&dst, ndim) - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< - * src = tmp - * + /* "newanalysis/voro/voro.pyx":98 + * else: + * _calcTessellation(cxyz, boxlength, cf2c, natoms, nmolecules, maxshell, cds, ccorelist,len(corelist)) + * if h5file is not None: # <<<<<<<<<<<<<< + * dataset = h5file['delaunay'] + * dataset[ts] = delaunay */ - __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1309, __pyx_L1_error) - __pyx_v_tmpdata = __pyx_t_7; + goto __pyx_L13; + } - /* "View.MemoryView":1310 - * - * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) - * src = tmp # <<<<<<<<<<<<<< - * - * if not broadcasting: + /* "newanalysis/voro/voro.pyx":101 + * dataset = h5file['delaunay'] + * dataset[ts] = delaunay + * elif ds_ts is None: # <<<<<<<<<<<<<< + * return delaunay + * else: */ - __pyx_v_src = __pyx_v_tmp; - - /* "View.MemoryView":1304 - * _err_dim(ValueError, "Dimension %d is not direct", i) - * - * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< - * - * if not slice_is_contig(src, order, ndim): - */ - } + __pyx_t_9 = (((PyObject *)__pyx_v_ds_ts) == Py_None); + if (__pyx_t_9) { - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * - * + /* "newanalysis/voro/voro.pyx":102 + * dataset[ts] = delaunay + * elif ds_ts is None: + * return delaunay # <<<<<<<<<<<<<< + * else: + * cts = ds_ts.data */ - __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0); - if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF((PyObject *)__pyx_v_delaunay); + __pyx_r = ((PyObject *)__pyx_v_delaunay); + goto __pyx_L0; - /* "View.MemoryView":1315 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + /* "newanalysis/voro/voro.pyx":101 + * dataset = h5file['delaunay'] + * dataset[ts] = delaunay + * elif ds_ts is None: # <<<<<<<<<<<<<< + * return delaunay + * else: */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + } - /* "View.MemoryView":1316 - * - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) + /* "newanalysis/voro/voro.pyx":104 + * return delaunay + * else: + * cts = ds_ts.data # <<<<<<<<<<<<<< + * if ires is not None: + * for i in range(nmolecules): */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); + /*else*/ { + __pyx_t_7 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ds_ts)); if (unlikely(__pyx_t_7 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_v_cts = ((int *)__pyx_t_7); - /* "View.MemoryView":1315 - * - * - * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): + /* "newanalysis/voro/voro.pyx":105 + * else: + * cts = ds_ts.data + * if ires is not None: # <<<<<<<<<<<<<< + * for i in range(nmolecules): + * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] */ - goto __pyx_L12; - } + __pyx_t_9 = (__pyx_v_ires != Py_None); + if (__pyx_t_9) { - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) - * + /* "newanalysis/voro/voro.pyx":106 + * cts = ds_ts.data + * if ires is not None: + * for i in range(nmolecules): # <<<<<<<<<<<<<< + * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] + * elif surroundlist is not None: */ - __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0); - if (__pyx_t_2) { + __pyx_t_14 = __Pyx_PyInt_As_long(__pyx_v_nmolecules); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_15; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; - /* "View.MemoryView":1318 - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): - * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< - * - * if direct_copy: + /* "newanalysis/voro/voro.pyx":107 + * if ires is not None: + * for i in range(nmolecules): + * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] # <<<<<<<<<<<<<< + * elif surroundlist is not None: + * nsurr = len(surroundlist) */ - __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); + __pyx_t_5 = PyNumber_Multiply(__pyx_v_ires, __pyx_v_nmolecules); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_v_ts, __pyx_v_nmolecules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_16 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_16 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + (__pyx_v_cts[__pyx_t_16]) = (__pyx_v_cds[__pyx_t_8]); + } - /* "View.MemoryView":1317 - * if slice_is_contig(src, 'C', ndim): - * direct_copy = slice_is_contig(dst, 'C', ndim) - * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< - * direct_copy = slice_is_contig(dst, 'F', ndim) - * + /* "newanalysis/voro/voro.pyx":105 + * else: + * cts = ds_ts.data + * if ires is not None: # <<<<<<<<<<<<<< + * for i in range(nmolecules): + * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] */ + goto __pyx_L14; } - __pyx_L12:; - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) + /* "newanalysis/voro/voro.pyx":108 + * for i in range(nmolecules): + * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] + * elif surroundlist is not None: # <<<<<<<<<<<<<< + * nsurr = len(surroundlist) + * csurrlist = surroundlist.data */ - __pyx_t_2 = (__pyx_v_direct_copy != 0); - if (__pyx_t_2) { + __pyx_t_9 = (((PyObject *)__pyx_v_surroundlist) != Py_None); + if (__pyx_t_9) { - /* "View.MemoryView":1322 - * if direct_copy: - * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) + /* "newanalysis/voro/voro.pyx":109 + * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] + * elif surroundlist is not None: + * nsurr = len(surroundlist) # <<<<<<<<<<<<<< + * csurrlist = surroundlist.data + * for i in range(nsurr): */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_surroundlist)); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_v_nsurr = ((int)__pyx_t_8); - /* "View.MemoryView":1323 - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) + /* "newanalysis/voro/voro.pyx":110 + * elif surroundlist is not None: + * nsurr = len(surroundlist) + * csurrlist = surroundlist.data # <<<<<<<<<<<<<< + * for i in range(nsurr): + * mindist = maxshell */ - (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); + __pyx_t_7 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_surroundlist)); if (unlikely(__pyx_t_7 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_v_csurrlist = ((int *)__pyx_t_7); - /* "View.MemoryView":1324 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * free(tmpdata) - * return 0 + /* "newanalysis/voro/voro.pyx":111 + * nsurr = len(surroundlist) + * csurrlist = surroundlist.data + * for i in range(nsurr): # <<<<<<<<<<<<<< + * mindist = maxshell + * isurr = csurrlist[i] */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + __pyx_t_11 = __pyx_v_nsurr; + __pyx_t_12 = __pyx_t_11; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_i = __pyx_t_13; - /* "View.MemoryView":1325 - * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 - * + /* "newanalysis/voro/voro.pyx":112 + * csurrlist = surroundlist.data + * for i in range(nsurr): + * mindist = maxshell # <<<<<<<<<<<<<< + * isurr = csurrlist[i] + * for j in range(ncore): */ - free(__pyx_v_tmpdata); + __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_v_mindist = __pyx_t_17; - /* "View.MemoryView":1326 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< - * - * if order == 'F' == get_best_order(&dst, ndim): + /* "newanalysis/voro/voro.pyx":113 + * for i in range(nsurr): + * mindist = maxshell + * isurr = csurrlist[i] # <<<<<<<<<<<<<< + * for j in range(ncore): + * icore = ccorelist[j] */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_v_isurr = (__pyx_v_csurrlist[__pyx_v_i]); - /* "View.MemoryView":1320 - * direct_copy = slice_is_contig(dst, 'F', ndim) - * - * if direct_copy: # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) + /* "newanalysis/voro/voro.pyx":114 + * mindist = maxshell + * isurr = csurrlist[i] + * for j in range(ncore): # <<<<<<<<<<<<<< + * icore = ccorelist[j] + * dist = cds[icore * nmolecules + isurr] */ - } + __pyx_t_17 = __pyx_v_ncore; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_j = __pyx_t_19; - /* "View.MemoryView":1312 - * src = tmp - * - * if not broadcasting: # <<<<<<<<<<<<<< - * - * + /* "newanalysis/voro/voro.pyx":115 + * isurr = csurrlist[i] + * for j in range(ncore): + * icore = ccorelist[j] # <<<<<<<<<<<<<< + * dist = cds[icore * nmolecules + isurr] + * if dist < mindist: */ - } + __pyx_v_icore = (__pyx_v_ccorelist[__pyx_v_j]); - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * + /* "newanalysis/voro/voro.pyx":116 + * for j in range(ncore): + * icore = ccorelist[j] + * dist = cds[icore * nmolecules + isurr] # <<<<<<<<<<<<<< + * if dist < mindist: + * mindist = dist */ - __pyx_t_2 = (__pyx_v_order == 'F'); - if (__pyx_t_2) { - __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); - } - __pyx_t_8 = (__pyx_t_2 != 0); - if (__pyx_t_8) { + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_icore); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_v_nmolecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_isurr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_dist = (__pyx_v_cds[__pyx_t_8]); - /* "View.MemoryView":1331 - * - * - * transpose_memslice(&src) # <<<<<<<<<<<<<< - * transpose_memslice(&dst) - * + /* "newanalysis/voro/voro.pyx":117 + * icore = ccorelist[j] + * dist = cds[icore * nmolecules + isurr] + * if dist < mindist: # <<<<<<<<<<<<<< + * mindist = dist + * cts[ts*nsurr+isurr] = mindist */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1331, __pyx_L1_error) + __pyx_t_9 = (__pyx_v_dist < __pyx_v_mindist); + if (__pyx_t_9) { - /* "View.MemoryView":1332 - * - * transpose_memslice(&src) - * transpose_memslice(&dst) # <<<<<<<<<<<<<< - * - * refcount_copying(&dst, dtype_is_object, ndim, False) + /* "newanalysis/voro/voro.pyx":118 + * dist = cds[icore * nmolecules + isurr] + * if dist < mindist: + * mindist = dist # <<<<<<<<<<<<<< + * cts[ts*nsurr+isurr] = mindist + * else: */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1332, __pyx_L1_error) + __pyx_v_mindist = __pyx_v_dist; - /* "View.MemoryView":1328 - * return 0 - * - * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< - * - * + /* "newanalysis/voro/voro.pyx":117 + * icore = ccorelist[j] + * dist = cds[icore * nmolecules + isurr] + * if dist < mindist: # <<<<<<<<<<<<<< + * mindist = dist + * cts[ts*nsurr+isurr] = mindist */ - } + } + } - /* "View.MemoryView":1334 - * transpose_memslice(&dst) - * - * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) + /* "newanalysis/voro/voro.pyx":119 + * if dist < mindist: + * mindist = dist + * cts[ts*nsurr+isurr] = mindist # <<<<<<<<<<<<<< + * else: + * for i in range(nmolecules): */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nsurr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Multiply(__pyx_v_ts, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_isurr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + (__pyx_v_cts[__pyx_t_8]) = __pyx_v_mindist; + } - /* "View.MemoryView":1335 - * - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< - * refcount_copying(&dst, dtype_is_object, ndim, True) - * + /* "newanalysis/voro/voro.pyx":108 + * for i in range(nmolecules): + * cts[ts * nmolecules + i] = cds[ires * nmolecules + i] + * elif surroundlist is not None: # <<<<<<<<<<<<<< + * nsurr = len(surroundlist) + * csurrlist = surroundlist.data */ - copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + goto __pyx_L14; + } - /* "View.MemoryView":1336 - * refcount_copying(&dst, dtype_is_object, ndim, False) - * copy_strided_to_strided(&src, &dst, ndim, itemsize) - * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * - * free(tmpdata) + /* "newanalysis/voro/voro.pyx":121 + * cts[ts*nsurr+isurr] = mindist + * else: + * for i in range(nmolecules): # <<<<<<<<<<<<<< + * for j in range(nmolecules): + * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] */ - __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + /*else*/ { + __pyx_t_14 = __Pyx_PyInt_As_long(__pyx_v_nmolecules); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_15; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; - /* "View.MemoryView":1338 - * refcount_copying(&dst, dtype_is_object, ndim, True) - * - * free(tmpdata) # <<<<<<<<<<<<<< - * return 0 + /* "newanalysis/voro/voro.pyx":122 + * else: + * for i in range(nmolecules): + * for j in range(nmolecules): # <<<<<<<<<<<<<< + * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] * */ - free(__pyx_v_tmpdata); + __pyx_t_20 = __Pyx_PyInt_As_long(__pyx_v_nmolecules); if (unlikely((__pyx_t_20 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_21; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; - /* "View.MemoryView":1339 - * - * free(tmpdata) - * return 0 # <<<<<<<<<<<<<< + /* "newanalysis/voro/voro.pyx":123 + * for i in range(nmolecules): + * for j in range(nmolecules): + * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] # <<<<<<<<<<<<<< * - * @cname('__pyx_memoryview_broadcast_leading') + * def calcTessellationVolSurfAtomic(double [:,:] xyz, float boxlength, */ - __pyx_r = 0; - goto __pyx_L0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_nmolecules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Multiply(__pyx_v_ts, __pyx_v_nmolecules); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_v_nmolecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyNumber_Multiply(__pyx_v_nmolecules, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_16 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_16 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + (__pyx_v_cts[__pyx_t_16]) = (__pyx_v_cds[__pyx_t_8]); + } + } + } + __pyx_L14:; + } + __pyx_L13:; - /* "View.MemoryView":1270 + /* "newanalysis/voro/voro.pyx":36 + * raise TypeError("Unknown string type!") * - * @cname('__pyx_memoryview_copy_contents') - * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< - * __Pyx_memviewslice dst, - * int src_ndim, int dst_ndim, + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, float boxlength, + * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - } - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corelist.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_delaunay.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f2c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fa.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_surroundlist.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vols.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.voro.calcTessellation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_corelist.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_delaunay.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds_ts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f2c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fa.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_surroundlist.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vols.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_delaunay); + __Pyx_XDECREF(__pyx_v_dataset); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":1342 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: - */ - -static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) { - int __pyx_v_i; - int __pyx_v_offset; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - - /* "View.MemoryView":1346 - * int ndim_other) nogil: - * cdef int i - * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< - * - * for i in range(ndim - 1, -1, -1): - */ - __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - - /* "View.MemoryView":1348 - * cdef int offset = ndim_other - ndim - * - * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - */ - for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { - __pyx_v_i = __pyx_t_1; - - /* "View.MemoryView":1349 - * - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - */ - (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - - /* "View.MemoryView":1350 - * for i in range(ndim - 1, -1, -1): - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] - * - */ - (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); - - /* "View.MemoryView":1351 - * mslice.shape[i + offset] = mslice.shape[i] - * mslice.strides[i + offset] = mslice.strides[i] - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< - * - * for i in range(offset): - */ - (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); - } - - /* "View.MemoryView":1353 - * mslice.suboffsets[i + offset] = mslice.suboffsets[i] +/* "newanalysis/voro/voro.pyx":125 + * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] * - * for i in range(offset): # <<<<<<<<<<<<<< - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] + * def calcTessellationVolSurfAtomic(double [:,:] xyz, float boxlength, # <<<<<<<<<<<<<< + * int [:] f2c, int natoms, int nmolecules, int maxshell, + * int [:] corelist, float [:] vols, float [:] fa): */ - __pyx_t_1 = __pyx_v_offset; - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1354 - * - * for i in range(offset): - * mslice.shape[i] = 1 # <<<<<<<<<<<<<< - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 - */ - (__pyx_v_mslice->shape[__pyx_v_i]) = 1; - - /* "View.MemoryView":1355 - * for i in range(offset): - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< - * mslice.suboffsets[i] = -1 - * - */ - (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); - - /* "View.MemoryView":1356 - * mslice.shape[i] = 1 - * mslice.strides[i] = mslice.strides[0] - * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< - * - * - */ - (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_4voro_3calcTessellationVolSurfAtomic(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_4voro_3calcTessellationVolSurfAtomic = {"calcTessellationVolSurfAtomic", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_4voro_3calcTessellationVolSurfAtomic, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_4voro_3calcTessellationVolSurfAtomic(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_xyz = { 0, 0, { 0 }, { 0 }, { 0 } }; + float __pyx_v_boxlength; + __Pyx_memviewslice __pyx_v_f2c = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_natoms; + int __pyx_v_nmolecules; + int __pyx_v_maxshell; + __Pyx_memviewslice __pyx_v_corelist = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_vols = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_fa = { 0, 0, { 0 }, { 0 }, { 0 } }; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcTessellationVolSurfAtomic (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 125, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_boxlength,&__pyx_n_s_f2c,&__pyx_n_s_natoms,&__pyx_n_s_nmolecules,&__pyx_n_s_maxshell,&__pyx_n_s_corelist,&__pyx_n_s_vols,&__pyx_n_s_fa,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 1); __PYX_ERR(0, 125, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_f2c)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 2); __PYX_ERR(0, 125, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_natoms)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 3); __PYX_ERR(0, 125, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmolecules)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 4); __PYX_ERR(0, 125, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 5); __PYX_ERR(0, 125, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_corelist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 6); __PYX_ERR(0, 125, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_vols)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 7); __PYX_ERR(0, 125, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fa)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, 8); __PYX_ERR(0, 125, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcTessellationVolSurfAtomic") < 0)) __PYX_ERR(0, 125, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 9)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + } + __pyx_v_xyz = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xyz.memview)) __PYX_ERR(0, 125, __pyx_L3_error) + __pyx_v_boxlength = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_boxlength == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error) + __pyx_v_f2c = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_f2c.memview)) __PYX_ERR(0, 126, __pyx_L3_error) + __pyx_v_natoms = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_natoms == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error) + __pyx_v_nmolecules = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nmolecules == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error) + __pyx_v_maxshell = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error) + __pyx_v_corelist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_corelist.memview)) __PYX_ERR(0, 127, __pyx_L3_error) + __pyx_v_vols = __Pyx_PyObject_to_MemoryviewSlice_ds_float(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vols.memview)) __PYX_ERR(0, 127, __pyx_L3_error) + __pyx_v_fa = __Pyx_PyObject_to_MemoryviewSlice_ds_float(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fa.memview)) __PYX_ERR(0, 127, __pyx_L3_error) } - - /* "View.MemoryView":1342 - * - * @cname('__pyx_memoryview_broadcast_leading') - * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< - * int ndim, - * int ndim_other) nogil: - */ + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcTessellationVolSurfAtomic", 1, 9, 9, __pyx_nargs); __PYX_ERR(0, 125, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_xyz, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_f2c, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corelist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vols, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_fa, 1); + __Pyx_AddTraceback("newanalysis.voro.calcTessellationVolSurfAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_4voro_2calcTessellationVolSurfAtomic(__pyx_self, __pyx_v_xyz, __pyx_v_boxlength, __pyx_v_f2c, __pyx_v_natoms, __pyx_v_nmolecules, __pyx_v_maxshell, __pyx_v_corelist, __pyx_v_vols, __pyx_v_fa); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_xyz, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_f2c, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corelist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_vols, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_fa, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1364 - * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: - * - */ - -static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { - int __pyx_t_1; - - /* "View.MemoryView":1368 - * - * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) - */ - __pyx_t_1 = (__pyx_v_dtype_is_object != 0); - if (__pyx_t_1) { +static PyObject *__pyx_pf_11newanalysis_4voro_2calcTessellationVolSurfAtomic(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz, float __pyx_v_boxlength, __Pyx_memviewslice __pyx_v_f2c, int __pyx_v_natoms, int __pyx_v_nmolecules, int __pyx_v_maxshell, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_vols, __Pyx_memviewslice __pyx_v_fa) { + __Pyx_memviewslice __pyx_v_delaunay = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_15; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcTessellationVolSurfAtomic", 0); - /* "View.MemoryView":1369 + /* "newanalysis/voro/voro.pyx":129 + * int [:] corelist, float [:] vols, float [:] fa): * - * if dtype_is_object: - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< - * dst.strides, ndim, inc) + * cdef char [:,:] delaunay = np.empty((nmolecules, nmolecules), dtype=np.int8) # <<<<<<<<<<<<<< * + * _calcTessellationVolSurfAtomic(&xyz[0,0], boxlength, &f2c[0], natoms, nmolecules, maxshell, */ - __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nmolecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nmolecules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_3); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_delaunay = __pyx_t_6; + __pyx_t_6.memview = NULL; + __pyx_t_6.data = NULL; - /* "View.MemoryView":1368 + /* "newanalysis/voro/voro.pyx":131 + * cdef char [:,:] delaunay = np.empty((nmolecules, nmolecules), dtype=np.int8) * + * _calcTessellationVolSurfAtomic(&xyz[0,0], boxlength, &f2c[0], natoms, nmolecules, maxshell, # <<<<<<<<<<<<<< + * &delaunay[0,0], &corelist[0], corelist.shape[0], &vols[0], &fa[0]) * - * if dtype_is_object: # <<<<<<<<<<<<<< - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) */ + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = -1; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_v_xyz.shape[0]; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_7 >= __pyx_v_xyz.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_xyz.shape[1]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_8 >= __pyx_v_xyz.shape[1])) __pyx_t_9 = 1; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 131, __pyx_L1_error) + } + __pyx_t_10 = 0; + __pyx_t_9 = -1; + if (__pyx_t_10 < 0) { + __pyx_t_10 += __pyx_v_f2c.shape[0]; + if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_10 >= __pyx_v_f2c.shape[0])) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 131, __pyx_L1_error) } - /* "View.MemoryView":1364 + /* "newanalysis/voro/voro.pyx":132 * - * @cname('__pyx_memoryview_refcount_copying') - * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< - * int ndim, bint inc) nogil: + * _calcTessellationVolSurfAtomic(&xyz[0,0], boxlength, &f2c[0], natoms, nmolecules, maxshell, + * &delaunay[0,0], &corelist[0], corelist.shape[0], &vols[0], &fa[0]) # <<<<<<<<<<<<<< * + * return np.asarray(delaunay) */ + __pyx_t_11 = 0; + __pyx_t_12 = 0; + __pyx_t_9 = -1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_v_delaunay.shape[0]; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_11 >= __pyx_v_delaunay.shape[0])) __pyx_t_9 = 0; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_v_delaunay.shape[1]; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_12 >= __pyx_v_delaunay.shape[1])) __pyx_t_9 = 1; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 132, __pyx_L1_error) + } + __pyx_t_13 = 0; + __pyx_t_9 = -1; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_v_corelist.shape[0]; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_13 >= __pyx_v_corelist.shape[0])) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 132, __pyx_L1_error) + } + __pyx_t_14 = 0; + __pyx_t_9 = -1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_v_vols.shape[0]; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_14 >= __pyx_v_vols.shape[0])) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 132, __pyx_L1_error) + } + __pyx_t_15 = 0; + __pyx_t_9 = -1; + if (__pyx_t_15 < 0) { + __pyx_t_15 += __pyx_v_fa.shape[0]; + if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_15 >= __pyx_v_fa.shape[0])) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + __PYX_ERR(0, 132, __pyx_L1_error) + } - /* function exit code */ -} - -/* "View.MemoryView":1373 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - */ - -static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - __Pyx_RefNannyDeclarations - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - - /* "View.MemoryView":1376 - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - - /* "View.MemoryView":1373 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') - * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * bint inc) with gil: - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif -} - -/* "View.MemoryView":1379 - * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i - */ - -static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - - /* "View.MemoryView":1383 - * cdef Py_ssize_t i - * - * for i in range(shape[0]): # <<<<<<<<<<<<<< - * if ndim == 1: - * if inc: - */ - __pyx_t_1 = (__pyx_v_shape[0]); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "View.MemoryView":1384 + /* "newanalysis/voro/voro.pyx":131 + * cdef char [:,:] delaunay = np.empty((nmolecules, nmolecules), dtype=np.int8) * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) - */ - __pyx_t_4 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: - */ - __pyx_t_4 = (__pyx_v_inc != 0); - if (__pyx_t_4) { - - /* "View.MemoryView":1386 - * if ndim == 1: - * if inc: - * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * Py_DECREF(( data)[0]) - */ - Py_INCREF((((PyObject **)__pyx_v_data)[0])); - - /* "View.MemoryView":1385 - * for i in range(shape[0]): - * if ndim == 1: - * if inc: # <<<<<<<<<<<<<< - * Py_INCREF(( data)[0]) - * else: - */ - goto __pyx_L6; - } - - /* "View.MemoryView":1388 - * Py_INCREF(( data)[0]) - * else: - * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, - */ - /*else*/ { - Py_DECREF((((PyObject **)__pyx_v_data)[0])); - } - __pyx_L6:; - - /* "View.MemoryView":1384 + * _calcTessellationVolSurfAtomic(&xyz[0,0], boxlength, &f2c[0], natoms, nmolecules, maxshell, # <<<<<<<<<<<<<< + * &delaunay[0,0], &corelist[0], corelist.shape[0], &vols[0], &fa[0]) * - * for i in range(shape[0]): - * if ndim == 1: # <<<<<<<<<<<<<< - * if inc: - * Py_INCREF(( data)[0]) */ - goto __pyx_L5; - } + _calcTessellationVolSurfAtomic((&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_xyz.data + __pyx_t_7 * __pyx_v_xyz.strides[0]) ) + __pyx_t_8 * __pyx_v_xyz.strides[1]) )))), __pyx_v_boxlength, (&(*((int *) ( /* dim=0 */ (__pyx_v_f2c.data + __pyx_t_10 * __pyx_v_f2c.strides[0]) )))), __pyx_v_natoms, __pyx_v_nmolecules, __pyx_v_maxshell, (&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delaunay.data + __pyx_t_11 * __pyx_v_delaunay.strides[0]) ) + __pyx_t_12 * __pyx_v_delaunay.strides[1]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_corelist.data + __pyx_t_13 * __pyx_v_corelist.strides[0]) )))), (__pyx_v_corelist.shape[0]), (&(*((float *) ( /* dim=0 */ (__pyx_v_vols.data + __pyx_t_14 * __pyx_v_vols.strides[0]) )))), (&(*((float *) ( /* dim=0 */ (__pyx_v_fa.data + __pyx_t_15 * __pyx_v_fa.strides[0]) ))))); - /* "View.MemoryView":1390 - * Py_DECREF(( data)[0]) - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, inc) + /* "newanalysis/voro/voro.pyx":134 + * &delaunay[0,0], &corelist[0], corelist.shape[0], &vols[0], &fa[0]) * - */ - /*else*/ { - - /* "View.MemoryView":1391 - * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, - * ndim - 1, inc) # <<<<<<<<<<<<<< + * return np.asarray(delaunay) # <<<<<<<<<<<<<< * - * data += strides[0] + * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): */ - __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_delaunay, 2, (PyObject *(*)(char *)) __pyx_memview_get_char, (int (*)(char *, PyObject *)) __pyx_memview_set_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = NULL; + __pyx_t_9 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_9 = 1; } - __pyx_L5:; - - /* "View.MemoryView":1393 - * ndim - 1, inc) - * - * data += strides[0] # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0])); } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "View.MemoryView":1379 + /* "newanalysis/voro/voro.pyx":125 + * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] * - * @cname('__pyx_memoryview_refcount_objects_in_slice') - * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, bint inc): - * cdef Py_ssize_t i + * def calcTessellationVolSurfAtomic(double [:,:] xyz, float boxlength, # <<<<<<<<<<<<<< + * int [:] f2c, int natoms, int nmolecules, int maxshell, + * int [:] corelist, float [:] vols, float [:] fa): */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); + __Pyx_AddTraceback("newanalysis.voro.calcTessellationVolSurfAtomic", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delaunay, 1); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "View.MemoryView":1399 - * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - */ - -static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - - /* "View.MemoryView":1402 - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - - /* "View.MemoryView":1403 - * bint dtype_is_object) nogil: - * refcount_copying(dst, dtype_is_object, ndim, False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) - */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - - /* "View.MemoryView":1405 - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) - * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< - * - * - */ - __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - - /* "View.MemoryView":1399 - * - * @cname('__pyx_memoryview_slice_assign_scalar') - * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< - * size_t itemsize, void *item, - * bint dtype_is_object) nogil: - */ - - /* function exit code */ -} - -/* "View.MemoryView":1409 +/* "newanalysis/voro/voro.pyx":136 + * return np.asarray(delaunay) * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: - */ - -static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) { - CYTHON_UNUSED Py_ssize_t __pyx_v_i; - Py_ssize_t __pyx_v_stride; - Py_ssize_t __pyx_v_extent; - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - Py_ssize_t __pyx_t_4; - - /* "View.MemoryView":1413 - * size_t itemsize, void *item) nogil: - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< - * cdef Py_ssize_t extent = shape[0] - * - */ - __pyx_v_stride = (__pyx_v_strides[0]); - - /* "View.MemoryView":1414 - * cdef Py_ssize_t i - * cdef Py_ssize_t stride = strides[0] - * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< - * - * if ndim == 1: - */ - __pyx_v_extent = (__pyx_v_shape[0]); - - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) - */ - __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); - if (__pyx_t_1) { - - /* "View.MemoryView":1417 - * - * if ndim == 1: - * for i in range(extent): # <<<<<<<<<<<<<< - * memcpy(data, item, itemsize) - * data += stride - */ - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1418 - * if ndim == 1: - * for i in range(extent): - * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< - * data += stride - * else: - */ - (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - - /* "View.MemoryView":1419 - * for i in range(extent): - * memcpy(data, item, itemsize) - * data += stride # <<<<<<<<<<<<<< - * else: - * for i in range(extent): - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - - /* "View.MemoryView":1416 - * cdef Py_ssize_t extent = shape[0] - * - * if ndim == 1: # <<<<<<<<<<<<<< - * for i in range(extent): - * memcpy(data, item, itemsize) - */ - goto __pyx_L3; - } - - /* "View.MemoryView":1421 - * data += stride - * else: - * for i in range(extent): # <<<<<<<<<<<<<< - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - */ - /*else*/ { - __pyx_t_2 = __pyx_v_extent; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - - /* "View.MemoryView":1422 - * else: - * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< - * ndim - 1, itemsize, item) - * data += stride - */ - __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - - /* "View.MemoryView":1424 - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) - * data += stride # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_data = (__pyx_v_data + __pyx_v_stride); - } - } - __pyx_L3:; - - /* "View.MemoryView":1409 - * - * @cname('__pyx_memoryview__slice_assign_scalar') - * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< - * Py_ssize_t *strides, int ndim, - * size_t itemsize, void *item) nogil: - */ - - /* function exit code */ -} - -/* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< + * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) */ /* Python wrapper */ -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v___pyx_type = 0; - long __pyx_v___pyx_checksum; - PyObject *__pyx_v___pyx_state = 0; +static PyObject *__pyx_pw_11newanalysis_4voro_5calcTessellationParallel(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_4voro_4calcTessellationParallel, "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)"); +static PyMethodDef __pyx_mdef_11newanalysis_4voro_5calcTessellationParallel = {"calcTessellationParallel", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_4voro_5calcTessellationParallel, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_4calcTessellationParallel}; +static PyObject *__pyx_pw_11newanalysis_4voro_5calcTessellationParallel(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_xyz_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_f2c = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_corelist = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_surroundlist = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_delaunay_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_boxlength = 0; + PyObject *__pyx_v_natoms = 0; + PyObject *__pyx_v_nmolecules = 0; + PyObject *__pyx_v_maxshell = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); + __Pyx_RefNannySetupContext("calcTessellationParallel (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 136, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz_ts,&__pyx_n_s_f2c,&__pyx_n_s_corelist,&__pyx_n_s_surroundlist,&__pyx_n_s_delaunay_ts,&__pyx_n_s_boxlength,&__pyx_n_s_natoms,&__pyx_n_s_nmolecules,&__pyx_n_s_maxshell,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_f2c)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 1); __PYX_ERR(0, 136, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_corelist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 2); __PYX_ERR(0, 136, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_surroundlist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 3); __PYX_ERR(0, 136, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_delaunay_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 4); __PYX_ERR(0, 136, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 5); __PYX_ERR(0, 136, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_natoms)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 6); __PYX_ERR(0, 136, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmolecules)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 7); __PYX_ERR(0, 136, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, 8); __PYX_ERR(0, 136, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcTessellationParallel") < 0)) __PYX_ERR(0, 136, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 9)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); } - __pyx_v___pyx_type = values[0]; - __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error) - __pyx_v___pyx_state = values[2]; + __pyx_v_xyz_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xyz_ts.memview)) __PYX_ERR(0, 136, __pyx_L3_error) + __pyx_v_f2c = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_f2c.memview)) __PYX_ERR(0, 136, __pyx_L3_error) + __pyx_v_corelist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_corelist.memview)) __PYX_ERR(0, 136, __pyx_L3_error) + __pyx_v_surroundlist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_surroundlist.memview)) __PYX_ERR(0, 136, __pyx_L3_error) + __pyx_v_delaunay_ts = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_delaunay_ts.memview)) __PYX_ERR(0, 136, __pyx_L3_error) + __pyx_v_boxlength = values[5]; + __pyx_v_natoms = values[6]; + __pyx_v_nmolecules = values[7]; + __pyx_v_maxshell = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calcTessellationParallel", 1, 9, 9, __pyx_nargs); __PYX_ERR(0, 136, __pyx_L3_error) + goto __pyx_L3_error; __pyx_L3_error:; - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_xyz_ts, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_f2c, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corelist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_surroundlist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delaunay_ts, 1); + __Pyx_AddTraceback("newanalysis.voro.calcTessellationParallel", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + __pyx_r = __pyx_pf_11newanalysis_4voro_4calcTessellationParallel(__pyx_self, __pyx_v_xyz_ts, __pyx_v_f2c, __pyx_v_corelist, __pyx_v_surroundlist, __pyx_v_delaunay_ts, __pyx_v_boxlength, __pyx_v_natoms, __pyx_v_nmolecules, __pyx_v_maxshell); /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_xyz_ts, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_f2c, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corelist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_surroundlist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delaunay_ts, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = 0; - PyObject *__pyx_v___pyx_result = 0; +static PyObject *__pyx_pf_11newanalysis_4voro_4calcTessellationParallel(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz_ts, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_surroundlist, __Pyx_memviewslice __pyx_v_delaunay_ts, PyObject *__pyx_v_boxlength, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell) { + int __pyx_v_nat; + int __pyx_v_nmol; + int __pyx_v_maxsh; + int __pyx_v_ncore; + int __pyx_v_nsurr; + int __pyx_v_ncpu; + float __pyx_v_boxl; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + float __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); + __Pyx_RefNannySetupContext("calcTessellationParallel", 0); - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) + /* "newanalysis/voro/voro.pyx":138 + * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): + * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) # <<<<<<<<<<<<<< + * cdef float boxl = boxlength + * */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__22, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_natoms); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_v_nat = ((int)__pyx_t_1); + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_v_nmol = ((int)__pyx_t_1); + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_v_maxsh = ((int)__pyx_t_1); + __pyx_t_2 = __Pyx_MemoryView_Len(__pyx_v_corelist); + __pyx_v_ncore = ((int)__pyx_t_2); + __pyx_t_2 = __Pyx_MemoryView_Len(__pyx_v_surroundlist); + __pyx_v_nsurr = ((int)__pyx_t_2); + __pyx_t_2 = __Pyx_MemoryView_Len(__pyx_v_delaunay_ts); + __pyx_v_ncpu = ((int)__pyx_t_2); - /* "(tree fragment)":5 - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_PickleError); - __Pyx_GIVEREF(__pyx_n_s_PickleError); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError); - __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_1); - __pyx_v___pyx_PickleError = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "(tree fragment)":6 - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: + /* "newanalysis/voro/voro.pyx":139 + * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) + * cdef float boxl = boxlength # <<<<<<<<<<<<<< + * + * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) */ - __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_v___pyx_PickleError); - __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_boxlength); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_v_boxl = ((float)__pyx_t_3); - /* "(tree fragment)":4 - * cdef object __pyx_PickleError - * cdef object __pyx_result - * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<< - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) + /* "newanalysis/voro/voro.pyx":141 + * cdef float boxl = boxlength + * + * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) # <<<<<<<<<<<<<< + * + * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): */ + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_1 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_xyz_ts.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_xyz_ts.shape[0])) __pyx_t_1 = 0; + if (__pyx_t_5 < 0) { + __pyx_t_5 += __pyx_v_xyz_ts.shape[1]; + if (unlikely(__pyx_t_5 < 0)) __pyx_t_1 = 1; + } else if (unlikely(__pyx_t_5 >= __pyx_v_xyz_ts.shape[1])) __pyx_t_1 = 1; + if (__pyx_t_6 < 0) { + __pyx_t_6 += __pyx_v_xyz_ts.shape[2]; + if (unlikely(__pyx_t_6 < 0)) __pyx_t_1 = 2; + } else if (unlikely(__pyx_t_6 >= __pyx_v_xyz_ts.shape[2])) __pyx_t_1 = 2; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 141, __pyx_L1_error) } - - /* "(tree fragment)":7 - * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } + __pyx_t_7 = 0; + __pyx_t_1 = -1; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_v_f2c.shape[0]; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_7 >= __pyx_v_f2c.shape[0])) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 141, __pyx_L1_error) } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v___pyx_result = __pyx_t_4; - __pyx_t_4 = 0; - - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ - __pyx_t_3 = (__pyx_v___pyx_state != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "(tree fragment)":9 - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_t_4 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) - * __pyx_result = Enum.__new__(__pyx_type) - * if __pyx_state is not None: # <<<<<<<<<<<<<< - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - */ + __pyx_t_8 = 0; + __pyx_t_1 = -1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_corelist.shape[0]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_v_corelist.shape[0])) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 141, __pyx_L1_error) } + __pyx_t_9 = 0; + __pyx_t_1 = -1; + if (__pyx_t_9 < 0) { + __pyx_t_9 += __pyx_v_surroundlist.shape[0]; + if (unlikely(__pyx_t_9 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_9 >= __pyx_v_surroundlist.shape[0])) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 141, __pyx_L1_error) + } + __pyx_t_10 = 0; + __pyx_t_11 = 0; + __pyx_t_1 = -1; + if (__pyx_t_10 < 0) { + __pyx_t_10 += __pyx_v_delaunay_ts.shape[0]; + if (unlikely(__pyx_t_10 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_10 >= __pyx_v_delaunay_ts.shape[0])) __pyx_t_1 = 0; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_v_delaunay_ts.shape[1]; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_1 = 1; + } else if (unlikely(__pyx_t_11 >= __pyx_v_delaunay_ts.shape[1])) __pyx_t_1 = 1; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 141, __pyx_L1_error) + } + _calcTessellationParallel((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_xyz_ts.data + __pyx_t_4 * __pyx_v_xyz_ts.strides[0]) ) + __pyx_t_5 * __pyx_v_xyz_ts.strides[1]) ) + __pyx_t_6 * __pyx_v_xyz_ts.strides[2]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_f2c.data + __pyx_t_7 * __pyx_v_f2c.strides[0]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_corelist.data + __pyx_t_8 * __pyx_v_corelist.strides[0]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_surroundlist.data + __pyx_t_9 * __pyx_v_surroundlist.strides[0]) )))), (&(*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delaunay_ts.data + __pyx_t_10 * __pyx_v_delaunay_ts.strides[0]) ) + __pyx_t_11 * __pyx_v_delaunay_ts.strides[1]) )))), __pyx_v_boxl, __pyx_v_nat, __pyx_v_nmol, __pyx_v_maxsh, __pyx_v_ncore, __pyx_v_nsurr, __pyx_v_ncpu); - /* "(tree fragment)":10 - * if __pyx_state is not None: - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result # <<<<<<<<<<<<<< - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v___pyx_result); - __pyx_r = __pyx_v___pyx_result; - goto __pyx_L0; - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result + /* "newanalysis/voro/voro.pyx":136 + * return np.asarray(delaunay) + * + * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< + * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("newanalysis.voro.calcTessellationParallel", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v___pyx_PickleError); - __Pyx_XDECREF(__pyx_v___pyx_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): +/* "newanalysis/voro/voro.pyx":143 + * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) + * + * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< + * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) */ -static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_4voro_7calcTessellationParallelAll(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_4voro_6calcTessellationParallelAll, "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)"); +static PyMethodDef __pyx_mdef_11newanalysis_4voro_7calcTessellationParallelAll = {"calcTessellationParallelAll", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_4voro_7calcTessellationParallelAll, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_6calcTessellationParallelAll}; +static PyObject *__pyx_pw_11newanalysis_4voro_7calcTessellationParallelAll(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_xyz_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_f2c = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_corelist = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_delaunay_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_boxlength = 0; + PyObject *__pyx_v_natoms = 0; + PyObject *__pyx_v_nmolecules = 0; + PyObject *__pyx_v_maxshell = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - - /* "(tree fragment)":12 - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 12, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v___pyx_result->name); - __Pyx_DECREF(__pyx_v___pyx_result->name); - __pyx_v___pyx_result->name = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) - */ - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 13, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_4 = ((__pyx_t_3 > 1) != 0); - if (__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - if (__pyx_t_2) { - - /* "(tree fragment)":14 - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(__pyx_v___pyx_state == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 14, __pyx_L1_error) - } - __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcTessellationParallelAll (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 143, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz_ts,&__pyx_n_s_f2c,&__pyx_n_s_corelist,&__pyx_n_s_delaunay_ts,&__pyx_n_s_boxlength,&__pyx_n_s_natoms,&__pyx_n_s_nmolecules,&__pyx_n_s_maxshell,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_f2c)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 1); __PYX_ERR(0, 143, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_corelist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 2); __PYX_ERR(0, 143, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_delaunay_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 3); __PYX_ERR(0, 143, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxlength)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 4); __PYX_ERR(0, 143, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_natoms)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 5); __PYX_ERR(0, 143, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmolecules)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 6); __PYX_ERR(0, 143, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, 7); __PYX_ERR(0, 143, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcTessellationParallelAll") < 0)) __PYX_ERR(0, 143, __pyx_L3_error) } + } else if (unlikely(__pyx_nargs != 8)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_xyz_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_xyz_ts.memview)) __PYX_ERR(0, 143, __pyx_L3_error) + __pyx_v_f2c = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_f2c.memview)) __PYX_ERR(0, 143, __pyx_L3_error) + __pyx_v_corelist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_corelist.memview)) __PYX_ERR(0, 143, __pyx_L3_error) + __pyx_v_delaunay_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_delaunay_ts.memview)) __PYX_ERR(0, 143, __pyx_L3_error) + __pyx_v_boxlength = values[4]; + __pyx_v_natoms = values[5]; + __pyx_v_nmolecules = values[6]; + __pyx_v_maxshell = values[7]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcTessellationParallelAll", 1, 8, 8, __pyx_nargs); __PYX_ERR(0, 143, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __PYX_XCLEAR_MEMVIEW(&__pyx_v_xyz_ts, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_f2c, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corelist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delaunay_ts, 1); + __Pyx_AddTraceback("newanalysis.voro.calcTessellationParallelAll", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_4voro_6calcTessellationParallelAll(__pyx_self, __pyx_v_xyz_ts, __pyx_v_f2c, __pyx_v_corelist, __pyx_v_delaunay_ts, __pyx_v_boxlength, __pyx_v_natoms, __pyx_v_nmolecules, __pyx_v_maxshell); - /* "(tree fragment)":13 - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[1]) + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_xyz_ts, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_f2c, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corelist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delaunay_ts, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_4voro_6calcTessellationParallelAll(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_xyz_ts, __Pyx_memviewslice __pyx_v_f2c, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_delaunay_ts, PyObject *__pyx_v_boxlength, PyObject *__pyx_v_natoms, PyObject *__pyx_v_nmolecules, PyObject *__pyx_v_maxshell) { + int __pyx_v_nat; + int __pyx_v_nmol; + int __pyx_v_maxsh; + int __pyx_v_ncore; + int __pyx_v_ncpu; + float __pyx_v_boxl; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + float __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcTessellationParallelAll", 0); + + /* "newanalysis/voro/voro.pyx":145 + * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): + * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) # <<<<<<<<<<<<<< + * cdef float boxl = boxlength + * + */ + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_natoms); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_v_nat = ((int)__pyx_t_1); + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_nmolecules); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_v_nmol = ((int)__pyx_t_1); + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_v_maxsh = ((int)__pyx_t_1); + __pyx_t_2 = __Pyx_MemoryView_Len(__pyx_v_corelist); + __pyx_v_ncore = ((int)__pyx_t_2); + __pyx_t_2 = __Pyx_MemoryView_Len(__pyx_v_delaunay_ts); + __pyx_v_ncpu = ((int)__pyx_t_2); + + /* "newanalysis/voro/voro.pyx":146 + * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) + * cdef float boxl = boxlength # <<<<<<<<<<<<<< + * + * _calcTessellationParallelAll(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &(delaunay_ts[0,0,0]), boxl, nat, nmol, maxsh, ncore, ncpu) + */ + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_boxlength); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_v_boxl = ((float)__pyx_t_3); + + /* "newanalysis/voro/voro.pyx":148 + * cdef float boxl = boxlength + * + * _calcTessellationParallelAll(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &(delaunay_ts[0,0,0]), boxl, nat, nmol, maxsh, ncore, ncpu) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) */ + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_1 = -1; + if (__pyx_t_4 < 0) { + __pyx_t_4 += __pyx_v_xyz_ts.shape[0]; + if (unlikely(__pyx_t_4 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_4 >= __pyx_v_xyz_ts.shape[0])) __pyx_t_1 = 0; + if (__pyx_t_5 < 0) { + __pyx_t_5 += __pyx_v_xyz_ts.shape[1]; + if (unlikely(__pyx_t_5 < 0)) __pyx_t_1 = 1; + } else if (unlikely(__pyx_t_5 >= __pyx_v_xyz_ts.shape[1])) __pyx_t_1 = 1; + if (__pyx_t_6 < 0) { + __pyx_t_6 += __pyx_v_xyz_ts.shape[2]; + if (unlikely(__pyx_t_6 < 0)) __pyx_t_1 = 2; + } else if (unlikely(__pyx_t_6 >= __pyx_v_xyz_ts.shape[2])) __pyx_t_1 = 2; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 148, __pyx_L1_error) + } + __pyx_t_7 = 0; + __pyx_t_1 = -1; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_v_f2c.shape[0]; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_7 >= __pyx_v_f2c.shape[0])) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 148, __pyx_L1_error) + } + __pyx_t_8 = 0; + __pyx_t_1 = -1; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_v_corelist.shape[0]; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_v_corelist.shape[0])) __pyx_t_1 = 0; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 148, __pyx_L1_error) + } + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + __pyx_t_1 = -1; + if (__pyx_t_9 < 0) { + __pyx_t_9 += __pyx_v_delaunay_ts.shape[0]; + if (unlikely(__pyx_t_9 < 0)) __pyx_t_1 = 0; + } else if (unlikely(__pyx_t_9 >= __pyx_v_delaunay_ts.shape[0])) __pyx_t_1 = 0; + if (__pyx_t_10 < 0) { + __pyx_t_10 += __pyx_v_delaunay_ts.shape[1]; + if (unlikely(__pyx_t_10 < 0)) __pyx_t_1 = 1; + } else if (unlikely(__pyx_t_10 >= __pyx_v_delaunay_ts.shape[1])) __pyx_t_1 = 1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_v_delaunay_ts.shape[2]; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_1 = 2; + } else if (unlikely(__pyx_t_11 >= __pyx_v_delaunay_ts.shape[2])) __pyx_t_1 = 2; + if (unlikely(__pyx_t_1 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_1); + __PYX_ERR(0, 148, __pyx_L1_error) } + _calcTessellationParallelAll((&(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_xyz_ts.data + __pyx_t_4 * __pyx_v_xyz_ts.strides[0]) ) + __pyx_t_5 * __pyx_v_xyz_ts.strides[1]) ) + __pyx_t_6 * __pyx_v_xyz_ts.strides[2]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_f2c.data + __pyx_t_7 * __pyx_v_f2c.strides[0]) )))), (&(*((int *) ( /* dim=0 */ (__pyx_v_corelist.data + __pyx_t_8 * __pyx_v_corelist.strides[0]) )))), (&(*((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delaunay_ts.data + __pyx_t_9 * __pyx_v_delaunay_ts.strides[0]) ) + __pyx_t_10 * __pyx_v_delaunay_ts.strides[1]) ) + __pyx_t_11 * __pyx_v_delaunay_ts.strides[2]) )))), __pyx_v_boxl, __pyx_v_nat, __pyx_v_nmol, __pyx_v_maxsh, __pyx_v_ncore, __pyx_v_ncpu); - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): + /* "newanalysis/voro/voro.pyx":143 + * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) + * + * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< + * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("newanalysis.voro.calcTessellationParallelAll", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_vtabstruct_array __pyx_vtable_array; -static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_array_obj *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_array_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_array; - p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} +/* "newanalysis/voro/voro.pyx":150 + * _calcTessellationParallelAll(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &(delaunay_ts[0,0,0]), boxl, nat, nmol, maxsh, ncore, ncpu) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def nearestNeighbor(int [:] corelist, int [:] surroundlist, char [:,:,:] delaunay_tmp, char [:,:,:] delaunay_ts, int iubq, int maxshell): + * cdef int icore, isurr, c, j, k, nsurr = len(surroundlist), ncore = len(corelist), ncpu = delaunay_tmp.shape[0] + */ -static void __pyx_tp_dealloc_array(PyObject *o) { - struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_4voro_9nearestNeighbor(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_11newanalysis_4voro_9nearestNeighbor = {"nearestNeighbor", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_4voro_9nearestNeighbor, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_11newanalysis_4voro_9nearestNeighbor(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + __Pyx_memviewslice __pyx_v_corelist = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_surroundlist = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_delaunay_tmp = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_memviewslice __pyx_v_delaunay_ts = { 0, 0, { 0 }, { 0 }, { 0 } }; + int __pyx_v_iubq; + int __pyx_v_maxshell; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[6] = {0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("nearestNeighbor (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 150, __pyx_L3_error) #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_array___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->mode); - Py_CLEAR(p->_format); - (*Py_TYPE(o)->tp_free)(o); -} -static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_array___setitem__(o, i, v); + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_corelist,&__pyx_n_s_surroundlist,&__pyx_n_s_delaunay_tmp,&__pyx_n_s_delaunay_ts,&__pyx_n_s_iubq,&__pyx_n_s_maxshell,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_corelist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_surroundlist)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, 1); __PYX_ERR(0, 150, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_delaunay_tmp)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, 2); __PYX_ERR(0, 150, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_delaunay_ts)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, 3); __PYX_ERR(0, 150, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_iubq)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, 4); __PYX_ERR(0, 150, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, 5); __PYX_ERR(0, 150, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "nearestNeighbor") < 0)) __PYX_ERR(0, 150, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 6)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + } + __pyx_v_corelist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_corelist.memview)) __PYX_ERR(0, 151, __pyx_L3_error) + __pyx_v_surroundlist = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_surroundlist.memview)) __PYX_ERR(0, 151, __pyx_L3_error) + __pyx_v_delaunay_tmp = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_delaunay_tmp.memview)) __PYX_ERR(0, 151, __pyx_L3_error) + __pyx_v_delaunay_ts = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_delaunay_ts.memview)) __PYX_ERR(0, 151, __pyx_L3_error) + __pyx_v_iubq = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_iubq == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L3_error) + __pyx_v_maxshell = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_maxshell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L3_error) } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); - return -1; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("nearestNeighbor", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 150, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } -} + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corelist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_surroundlist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delaunay_tmp, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delaunay_ts, 1); + __Pyx_AddTraceback("newanalysis.voro.nearestNeighbor", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_11newanalysis_4voro_8nearestNeighbor(__pyx_self, __pyx_v_corelist, __pyx_v_surroundlist, __pyx_v_delaunay_tmp, __pyx_v_delaunay_ts, __pyx_v_iubq, __pyx_v_maxshell); -static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { - PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n); - if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - v = __pyx_array___getattr__(o, n); + /* function exit code */ + __PYX_XCLEAR_MEMVIEW(&__pyx_v_corelist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_surroundlist, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delaunay_tmp, 1); + __PYX_XCLEAR_MEMVIEW(&__pyx_v_delaunay_ts, 1); + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - return v; + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); -} +static PyObject *__pyx_pf_11newanalysis_4voro_8nearestNeighbor(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_corelist, __Pyx_memviewslice __pyx_v_surroundlist, __Pyx_memviewslice __pyx_v_delaunay_tmp, __Pyx_memviewslice __pyx_v_delaunay_ts, int __pyx_v_iubq, int __pyx_v_maxshell) { + int __pyx_v_icore; + int __pyx_v_isurr; + int __pyx_v_c; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_nsurr; + int __pyx_v_ncore; + int __pyx_v_ncpu; + char __pyx_v_dist; + char __pyx_v_mindist; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + Py_ssize_t __pyx_t_12; + Py_ssize_t __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + __Pyx_RefNannySetupContext("nearestNeighbor", 0); -static PyMethodDef __pyx_methods_array[] = { - {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; + /* "newanalysis/voro/voro.pyx":152 + * @cython.boundscheck(False) + * def nearestNeighbor(int [:] corelist, int [:] surroundlist, char [:,:,:] delaunay_tmp, char [:,:,:] delaunay_ts, int iubq, int maxshell): + * cdef int icore, isurr, c, j, k, nsurr = len(surroundlist), ncore = len(corelist), ncpu = delaunay_tmp.shape[0] # <<<<<<<<<<<<<< + * cdef char dist, mindist + * + */ + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_surroundlist); + __pyx_v_nsurr = __pyx_t_1; + __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_corelist); + __pyx_v_ncore = __pyx_t_1; + __pyx_v_ncpu = (__pyx_v_delaunay_tmp.shape[0]); -static struct PyGetSetDef __pyx_getsets_array[] = { - {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; + /* "newanalysis/voro/voro.pyx":155 + * cdef char dist, mindist + * + * for c in range(ncpu): # <<<<<<<<<<<<<< + * for j in range(nsurr): + * mindist = maxshell + 1 + */ + __pyx_t_2 = __pyx_v_ncpu; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_c = __pyx_t_4; -static PySequenceMethods __pyx_tp_as_sequence_array = { - __pyx_array___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_array, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; + /* "newanalysis/voro/voro.pyx":156 + * + * for c in range(ncpu): + * for j in range(nsurr): # <<<<<<<<<<<<<< + * mindist = maxshell + 1 + * isurr = surroundlist[j] + */ + __pyx_t_5 = __pyx_v_nsurr; + __pyx_t_6 = __pyx_t_5; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_j = __pyx_t_7; -static PyMappingMethods __pyx_tp_as_mapping_array = { - __pyx_array___len__, /*mp_length*/ - __pyx_array___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ -}; + /* "newanalysis/voro/voro.pyx":157 + * for c in range(ncpu): + * for j in range(nsurr): + * mindist = maxshell + 1 # <<<<<<<<<<<<<< + * isurr = surroundlist[j] + * for k in range(ncore): + */ + __pyx_v_mindist = (__pyx_v_maxshell + 1); -static PyBufferProcs __pyx_tp_as_buffer_array = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_array_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; + /* "newanalysis/voro/voro.pyx":158 + * for j in range(nsurr): + * mindist = maxshell + 1 + * isurr = surroundlist[j] # <<<<<<<<<<<<<< + * for k in range(ncore): + * icore = corelist[k] + */ + __pyx_t_8 = __pyx_v_j; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_surroundlist.shape[0]; + __pyx_v_isurr = (*((int *) ( /* dim=0 */ (__pyx_v_surroundlist.data + __pyx_t_8 * __pyx_v_surroundlist.strides[0]) ))); -static PyTypeObject __pyx_type___pyx_array = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.voro.array", /*tp_name*/ - sizeof(struct __pyx_array_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_array, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - __pyx_tp_getattro_array, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_array, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_array, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_array, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; + /* "newanalysis/voro/voro.pyx":159 + * mindist = maxshell + 1 + * isurr = surroundlist[j] + * for k in range(ncore): # <<<<<<<<<<<<<< + * icore = corelist[k] + * dist = delaunay_tmp[c,icore,isurr] + */ + __pyx_t_9 = __pyx_v_ncore; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_k = __pyx_t_11; -static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_MemviewEnum_obj *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_MemviewEnum_obj *)o); - p->name = Py_None; Py_INCREF(Py_None); - return o; -} + /* "newanalysis/voro/voro.pyx":160 + * isurr = surroundlist[j] + * for k in range(ncore): + * icore = corelist[k] # <<<<<<<<<<<<<< + * dist = delaunay_tmp[c,icore,isurr] + * if dist < mindist and dist != -1: + */ + __pyx_t_8 = __pyx_v_k; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_corelist.shape[0]; + __pyx_v_icore = (*((int *) ( /* dim=0 */ (__pyx_v_corelist.data + __pyx_t_8 * __pyx_v_corelist.strides[0]) ))); -static void __pyx_tp_dealloc_Enum(PyObject *o) { - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->name); - (*Py_TYPE(o)->tp_free)(o); -} + /* "newanalysis/voro/voro.pyx":161 + * for k in range(ncore): + * icore = corelist[k] + * dist = delaunay_tmp[c,icore,isurr] # <<<<<<<<<<<<<< + * if dist < mindist and dist != -1: + * mindist = dist + */ + __pyx_t_8 = __pyx_v_c; + __pyx_t_12 = __pyx_v_icore; + __pyx_t_13 = __pyx_v_isurr; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_delaunay_tmp.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_delaunay_tmp.shape[1]; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_delaunay_tmp.shape[2]; + __pyx_v_dist = (*((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delaunay_tmp.data + __pyx_t_8 * __pyx_v_delaunay_tmp.strides[0]) ) + __pyx_t_12 * __pyx_v_delaunay_tmp.strides[1]) ) + __pyx_t_13 * __pyx_v_delaunay_tmp.strides[2]) ))); -static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - if (p->name) { - e = (*v)(p->name, a); if (e) return e; + /* "newanalysis/voro/voro.pyx":162 + * icore = corelist[k] + * dist = delaunay_tmp[c,icore,isurr] + * if dist < mindist and dist != -1: # <<<<<<<<<<<<<< + * mindist = dist + * delaunay_ts[c,iubq,j] = mindist + */ + __pyx_t_15 = (__pyx_v_dist < __pyx_v_mindist); + if (__pyx_t_15) { + } else { + __pyx_t_14 = __pyx_t_15; + goto __pyx_L10_bool_binop_done; + } + __pyx_t_15 = (__pyx_v_dist != -1L); + __pyx_t_14 = __pyx_t_15; + __pyx_L10_bool_binop_done:; + if (__pyx_t_14) { + + /* "newanalysis/voro/voro.pyx":163 + * dist = delaunay_tmp[c,icore,isurr] + * if dist < mindist and dist != -1: + * mindist = dist # <<<<<<<<<<<<<< + * delaunay_ts[c,iubq,j] = mindist + * + */ + __pyx_v_mindist = __pyx_v_dist; + + /* "newanalysis/voro/voro.pyx":162 + * icore = corelist[k] + * dist = delaunay_tmp[c,icore,isurr] + * if dist < mindist and dist != -1: # <<<<<<<<<<<<<< + * mindist = dist + * delaunay_ts[c,iubq,j] = mindist + */ + } + } + + /* "newanalysis/voro/voro.pyx":164 + * if dist < mindist and dist != -1: + * mindist = dist + * delaunay_ts[c,iubq,j] = mindist # <<<<<<<<<<<<<< + * + * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, + */ + __pyx_t_13 = __pyx_v_c; + __pyx_t_12 = __pyx_v_iubq; + __pyx_t_8 = __pyx_v_j; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_delaunay_ts.shape[0]; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_delaunay_ts.shape[1]; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_delaunay_ts.shape[2]; + *((char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_delaunay_ts.data + __pyx_t_13 * __pyx_v_delaunay_ts.strides[0]) ) + __pyx_t_12 * __pyx_v_delaunay_ts.strides[1]) ) + __pyx_t_8 * __pyx_v_delaunay_ts.strides[2]) )) = __pyx_v_mindist; + } } - return 0; -} -static int __pyx_tp_clear_Enum(PyObject *o) { - PyObject* tmp; - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; - tmp = ((PyObject*)p->name); - p->name = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; + /* "newanalysis/voro/voro.pyx":150 + * _calcTessellationParallelAll(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &(delaunay_ts[0,0,0]), boxl, nat, nmol, maxsh, ncore, ncpu) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def nearestNeighbor(int [:] corelist, int [:] surroundlist, char [:,:,:] delaunay_tmp, char [:,:,:] delaunay_ts, int iubq, int maxshell): + * cdef int icore, isurr, c, j, k, nsurr = len(surroundlist), ncore = len(corelist), ncpu = delaunay_tmp.shape[0] + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static PyMethodDef __pyx_methods_Enum[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; +/* "newanalysis/voro/voro.pyx":166 + * delaunay_ts[c,iubq,j] = mindist + * + * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, # <<<<<<<<<<<<<< + * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, + * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): + */ -static PyTypeObject __pyx_type___pyx_MemviewEnum = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.voro.Enum", /*tp_name*/ - sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_Enum, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_4voro_11drawTessellation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_4voro_10drawTessellation, "\n drawTessellation(xyz, points_to_draw, cylinder_radius, triangles, nmol, color_id, filename, box_x, box_y=None, box_z=None)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_4voro_11drawTessellation = {"drawTessellation", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_4voro_11drawTessellation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_10drawTessellation}; +static PyObject *__pyx_pw_11newanalysis_4voro_11drawTessellation(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_xyz = 0; + PyArrayObject *__pyx_v_points_to_draw = 0; + PyObject *__pyx_v_cylinder_radius = 0; + PyObject *__pyx_v_triangles = 0; + int __pyx_v_nmol; + int __pyx_v_color_id; + PyObject *__pyx_v_filename = 0; + PyObject *__pyx_v_box_x = 0; + PyObject *__pyx_v_box_y = 0; + PyObject *__pyx_v_box_z = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("drawTessellation (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 166, __pyx_L3_error) #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ #endif - __pyx_MemviewEnum___repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_Enum, /*tp_traverse*/ - __pyx_tp_clear_Enum, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_Enum, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_MemviewEnum___init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_Enum, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; -static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xyz,&__pyx_n_s_points_to_draw,&__pyx_n_s_cylinder_radius,&__pyx_n_s_triangles,&__pyx_n_s_nmol,&__pyx_n_s_color_id,&__pyx_n_s_filename,&__pyx_n_s_box_x,&__pyx_n_s_box_y,&__pyx_n_s_box_z,0}; -static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryview_obj *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + /* "newanalysis/voro/voro.pyx":168 + * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, + * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, + * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): # <<<<<<<<<<<<<< + * """ + * drawTessellation(xyz, points_to_draw, cylinder_radius, triangles, nmol, color_id, filename, box_x, box_y=None, box_z=None) + */ + values[8] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + values[9] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xyz)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_points_to_draw)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 1); __PYX_ERR(0, 166, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cylinder_radius)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 2); __PYX_ERR(0, 166, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_triangles)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 3); __PYX_ERR(0, 166, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_nmol)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 4); __PYX_ERR(0, 166, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_color_id)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 5); __PYX_ERR(0, 166, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 6); __PYX_ERR(0, 166, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_x)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, 7); __PYX_ERR(0, 166, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_y); + if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_box_z); + if (value) { values[9] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "drawTessellation") < 0)) __PYX_ERR(0, 166, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_xyz = ((PyArrayObject *)values[0]); + __pyx_v_points_to_draw = ((PyArrayObject *)values[1]); + __pyx_v_cylinder_radius = values[2]; + __pyx_v_triangles = values[3]; + __pyx_v_nmol = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nmol == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_color_id = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_color_id == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L3_error) + __pyx_v_filename = values[6]; + __pyx_v_box_x = values[7]; + __pyx_v_box_y = values[8]; + __pyx_v_box_z = values[9]; } - if (unlikely(!o)) return 0; - p = ((struct __pyx_memoryview_obj *)o); - p->__pyx_vtab = __pyx_vtabptr_memoryview; - p->obj = Py_None; Py_INCREF(Py_None); - p->_size = Py_None; Py_INCREF(Py_None); - p->_array_interface = Py_None; Py_INCREF(Py_None); - p->view.obj = NULL; - if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("drawTessellation", 0, 8, 10, __pyx_nargs); __PYX_ERR(0, 166, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.voro.drawTessellation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; -} + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) __PYX_ERR(0, 166, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_points_to_draw), __pyx_ptype_5numpy_ndarray, 1, "points_to_draw", 0))) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_4voro_10drawTessellation(__pyx_self, __pyx_v_xyz, __pyx_v_points_to_draw, __pyx_v_cylinder_radius, __pyx_v_triangles, __pyx_v_nmol, __pyx_v_color_id, __pyx_v_filename, __pyx_v_box_x, __pyx_v_box_y, __pyx_v_box_z); -static void __pyx_tp_dealloc_memoryview(PyObject *o) { - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); + /* "newanalysis/voro/voro.pyx":166 + * delaunay_ts[c,iubq,j] = mindist + * + * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, # <<<<<<<<<<<<<< + * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, + * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_memoryview___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - Py_CLEAR(p->obj); - Py_CLEAR(p->_size); - Py_CLEAR(p->_array_interface); - (*Py_TYPE(o)->tp_free)(o); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - if (p->obj) { - e = (*v)(p->obj, a); if (e) return e; - } - if (p->_size) { - e = (*v)(p->_size, a); if (e) return e; - } - if (p->_array_interface) { - e = (*v)(p->_array_interface, a); if (e) return e; +static PyObject *__pyx_pf_11newanalysis_4voro_10drawTessellation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_points_to_draw, PyObject *__pyx_v_cylinder_radius, PyObject *__pyx_v_triangles, int __pyx_v_nmol, int __pyx_v_color_id, PyObject *__pyx_v_filename, PyObject *__pyx_v_box_x, PyObject *__pyx_v_box_y, PyObject *__pyx_v_box_z) { + int __pyx_v_len_xyz; + int __pyx_v_len_points_to_draw; + PyObject *__pyx_v_py_byte_string = NULL; + const char *__pyx_v_fn; + double *__pyx_v_xyz_ptr; + int *__pyx_v_points_ptr; + int __pyx_v_draw_triangles; + double __pyx_v_radius; + float __pyx_v_boxl_x; + float __pyx_v_boxl_y; + float __pyx_v_boxl_z; + __Pyx_LocalBuf_ND __pyx_pybuffernd_points_to_draw; + __Pyx_Buffer __pyx_pybuffer_points_to_draw; + __Pyx_LocalBuf_ND __pyx_pybuffernd_xyz; + __Pyx_Buffer __pyx_pybuffer_xyz; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + const char *__pyx_t_4; + char *__pyx_t_5; + int __pyx_t_6; + double __pyx_t_7; + float __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("drawTessellation", 0); + __pyx_pybuffer_xyz.pybuffer.buf = NULL; + __pyx_pybuffer_xyz.refcount = 0; + __pyx_pybuffernd_xyz.data = NULL; + __pyx_pybuffernd_xyz.rcbuffer = &__pyx_pybuffer_xyz; + __pyx_pybuffer_points_to_draw.pybuffer.buf = NULL; + __pyx_pybuffer_points_to_draw.refcount = 0; + __pyx_pybuffernd_points_to_draw.data = NULL; + __pyx_pybuffernd_points_to_draw.rcbuffer = &__pyx_pybuffer_points_to_draw; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer, (PyObject*)__pyx_v_xyz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 166, __pyx_L1_error) } - if (p->view.obj) { - e = (*v)(p->view.obj, a); if (e) return e; + __pyx_pybuffernd_xyz.diminfo[0].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xyz.diminfo[0].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xyz.diminfo[1].strides = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xyz.diminfo[1].shape = __pyx_pybuffernd_xyz.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_points_to_draw.rcbuffer->pybuffer, (PyObject*)__pyx_v_points_to_draw, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 166, __pyx_L1_error) } - return 0; -} + __pyx_pybuffernd_points_to_draw.diminfo[0].strides = __pyx_pybuffernd_points_to_draw.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_points_to_draw.diminfo[0].shape = __pyx_pybuffernd_points_to_draw.rcbuffer->pybuffer.shape[0]; -static int __pyx_tp_clear_memoryview(PyObject *o) { - PyObject* tmp; - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; - tmp = ((PyObject*)p->obj); - p->obj = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_size); - p->_size = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_array_interface); - p->_array_interface = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - Py_CLEAR(p->view.obj); - return 0; -} -static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} + /* "newanalysis/voro/voro.pyx":173 + * """ + * + * cdef int len_xyz = len(xyz), len_points_to_draw = len(points_to_draw) # <<<<<<<<<<<<<< + * py_byte_string = _ustring(filename).encode('UTF-8') + * cdef const_char* fn = py_byte_string + */ + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_v_len_xyz = __pyx_t_1; + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_points_to_draw)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_v_len_points_to_draw = __pyx_t_1; -static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_memoryview___setitem__(o, i, v); - } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); - return -1; + /* "newanalysis/voro/voro.pyx":174 + * + * cdef int len_xyz = len(xyz), len_points_to_draw = len(points_to_draw) + * py_byte_string = _ustring(filename).encode('UTF-8') # <<<<<<<<<<<<<< + * cdef const_char* fn = py_byte_string + * cdef double *xyz_ptr = xyz.data + */ + __pyx_t_2 = __pyx_f_11newanalysis_4voro__ustring(__pyx_v_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(__pyx_t_2 == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); + __PYX_ERR(0, 174, __pyx_L1_error) } -} + __pyx_t_3 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_py_byte_string = __pyx_t_3; + __pyx_t_3 = 0; -static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); -} + /* "newanalysis/voro/voro.pyx":175 + * cdef int len_xyz = len(xyz), len_points_to_draw = len(points_to_draw) + * py_byte_string = _ustring(filename).encode('UTF-8') + * cdef const_char* fn = py_byte_string # <<<<<<<<<<<<<< + * cdef double *xyz_ptr = xyz.data + * cdef int *points_ptr = points_to_draw.data + */ + __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_py_byte_string); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_v_fn = __pyx_t_4; -static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); -} + /* "newanalysis/voro/voro.pyx":176 + * py_byte_string = _ustring(filename).encode('UTF-8') + * cdef const_char* fn = py_byte_string + * cdef double *xyz_ptr = xyz.data # <<<<<<<<<<<<<< + * cdef int *points_ptr = points_to_draw.data + * cdef bint draw_triangles = triangles + */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_xyz)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_v_xyz_ptr = ((double *)__pyx_t_5); -static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); -} + /* "newanalysis/voro/voro.pyx":177 + * cdef const_char* fn = py_byte_string + * cdef double *xyz_ptr = xyz.data + * cdef int *points_ptr = points_to_draw.data # <<<<<<<<<<<<<< + * cdef bint draw_triangles = triangles + * cdef double radius = cylinder_radius + */ + __pyx_t_5 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_points_to_draw)); if (unlikely(__pyx_t_5 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_v_points_ptr = ((int *)__pyx_t_5); -static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); -} + /* "newanalysis/voro/voro.pyx":178 + * cdef double *xyz_ptr = xyz.data + * cdef int *points_ptr = points_to_draw.data + * cdef bint draw_triangles = triangles # <<<<<<<<<<<<<< + * cdef double radius = cylinder_radius + * cdef float boxl_x, boxl_y, boxl_z + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_triangles); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_v_draw_triangles = __pyx_t_6; -static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); -} + /* "newanalysis/voro/voro.pyx":179 + * cdef int *points_ptr = points_to_draw.data + * cdef bint draw_triangles = triangles + * cdef double radius = cylinder_radius # <<<<<<<<<<<<<< + * cdef float boxl_x, boxl_y, boxl_z + * + */ + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_cylinder_radius); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_v_radius = ((double)__pyx_t_7); -static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); -} + /* "newanalysis/voro/voro.pyx":182 + * cdef float boxl_x, boxl_y, boxl_z + * + * boxl_x = box_x # <<<<<<<<<<<<<< + * if box_y: + * boxl_y = box_y + */ + __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_v_box_x); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error) + __pyx_v_boxl_x = ((float)__pyx_t_8); -static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); -} + /* "newanalysis/voro/voro.pyx":183 + * + * boxl_x = box_x + * if box_y: # <<<<<<<<<<<<<< + * boxl_y = box_y + * else: + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_box_y); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 183, __pyx_L1_error) + if (__pyx_t_6) { -static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); -} + /* "newanalysis/voro/voro.pyx":184 + * boxl_x = box_x + * if box_y: + * boxl_y = box_y # <<<<<<<<<<<<<< + * else: + * boxl_y = boxl_x + */ + __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_v_box_y); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_v_boxl_y = ((float)__pyx_t_8); -static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); -} + /* "newanalysis/voro/voro.pyx":183 + * + * boxl_x = box_x + * if box_y: # <<<<<<<<<<<<<< + * boxl_y = box_y + * else: + */ + goto __pyx_L3; + } -static PyMethodDef __pyx_methods_memoryview[] = { - {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0}, - {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0}, - {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0}, - {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; + /* "newanalysis/voro/voro.pyx":186 + * boxl_y = box_y + * else: + * boxl_y = boxl_x # <<<<<<<<<<<<<< + * if box_z: + * boxl_z = box_z + */ + /*else*/ { + __pyx_v_boxl_y = __pyx_v_boxl_x; + } + __pyx_L3:; -static struct PyGetSetDef __pyx_getsets_memoryview[] = { - {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0}, - {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0}, - {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0}, - {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0}, - {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0}, - {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0}, - {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0}, - {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0}, - {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; + /* "newanalysis/voro/voro.pyx":187 + * else: + * boxl_y = boxl_x + * if box_z: # <<<<<<<<<<<<<< + * boxl_z = box_z + * else: + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_box_z); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 187, __pyx_L1_error) + if (__pyx_t_6) { -static PySequenceMethods __pyx_tp_as_sequence_memoryview = { - __pyx_memoryview___len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_memoryview, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; + /* "newanalysis/voro/voro.pyx":188 + * boxl_y = boxl_x + * if box_z: + * boxl_z = box_z # <<<<<<<<<<<<<< + * else: + * boxl_z = boxl_x + */ + __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_v_box_z); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L1_error) + __pyx_v_boxl_z = ((float)__pyx_t_8); -static PyMappingMethods __pyx_tp_as_mapping_memoryview = { - __pyx_memoryview___len__, /*mp_length*/ - __pyx_memoryview___getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ -}; + /* "newanalysis/voro/voro.pyx":187 + * else: + * boxl_y = boxl_x + * if box_z: # <<<<<<<<<<<<<< + * boxl_z = box_z + * else: + */ + goto __pyx_L4; + } -static PyBufferProcs __pyx_tp_as_buffer_memoryview = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - __pyx_memoryview_getbuffer, /*bf_getbuffer*/ - 0, /*bf_releasebuffer*/ -}; + /* "newanalysis/voro/voro.pyx":190 + * boxl_z = box_z + * else: + * boxl_z = boxl_x # <<<<<<<<<<<<<< + * + * _drawTessellation(xyz_ptr, boxl_x, boxl_y, boxl_z, len_xyz, points_ptr, len_points_to_draw, radius, draw_triangles, nmol, color_id, fn) + */ + /*else*/ { + __pyx_v_boxl_z = __pyx_v_boxl_x; + } + __pyx_L4:; -static PyTypeObject __pyx_type___pyx_memoryview = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.voro.memoryview", /*tp_name*/ - sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_memoryview___repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_memoryview___str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_memoryview, /*tp_traverse*/ - __pyx_tp_clear_memoryview, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_memoryview, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_memoryview, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_memoryview, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; -static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; - -static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_memoryviewslice_obj *p; - PyObject *o = __pyx_tp_new_memoryview(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_memoryviewslice_obj *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; - p->from_object = Py_None; Py_INCREF(Py_None); - p->from_slice.memview = NULL; - return o; -} - -static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); - __pyx_memoryviewslice___dealloc__(o); - __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->from_object); - PyObject_GC_Track(o); - __pyx_tp_dealloc_memoryview(o); -} - -static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; - if (p->from_object) { - e = (*v)(p->from_object, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear__memoryviewslice(PyObject *o) { - PyObject* tmp; - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; - __pyx_tp_clear_memoryview(o); - tmp = ((PyObject*)p->from_object); - p->from_object = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - __PYX_XDEC_MEMVIEW(&p->from_slice, 1); - return 0; -} - -static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o); -} - -static PyMethodDef __pyx_methods__memoryviewslice[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = { - {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type___pyx_memoryviewslice = { - PyVarObject_HEAD_INIT(0, 0) - "newanalysis.voro._memoryviewslice", /*tp_name*/ - sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - #if CYTHON_COMPILING_IN_PYPY - __pyx_memoryview___repr__, /*tp_repr*/ - #else - 0, /*tp_repr*/ - #endif - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_memoryview___str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Internal class for passing memoryview slices to Python", /*tp_doc*/ - __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ - __pyx_tp_clear__memoryviewslice, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods__memoryviewslice, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets__memoryviewslice, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new__memoryviewslice, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_voro(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_voro}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "voro", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, - {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, - {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1}, - {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, - {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0}, - {&__pyx_kp_s_ERROR_Either_pass_vols_AND_fa_or, __pyx_k_ERROR_Either_pass_vols_AND_fa_or, sizeof(__pyx_k_ERROR_Either_pass_vols_AND_fa_or), 0, 0, 1, 0}, - {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, - {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, - {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, - {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, - {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, - {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0}, - {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, - {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, - {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, - {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, - {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, - {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, - {&__pyx_kp_s_Result_array_is_too_short, __pyx_k_Result_array_is_too_short, sizeof(__pyx_k_Result_array_is_too_short), 0, 0, 1, 0}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, - {&__pyx_kp_s_Unknown_string_type, __pyx_k_Unknown_string_type, sizeof(__pyx_k_Unknown_string_type), 0, 0, 1, 0}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, - {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, - {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, - {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, - {&__pyx_n_s_box_x, __pyx_k_box_x, sizeof(__pyx_k_box_x), 0, 0, 1, 1}, - {&__pyx_n_s_box_y, __pyx_k_box_y, sizeof(__pyx_k_box_y), 0, 0, 1, 1}, - {&__pyx_n_s_box_z, __pyx_k_box_z, sizeof(__pyx_k_box_z), 0, 0, 1, 1}, - {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, - {&__pyx_n_s_boxl_x, __pyx_k_boxl_x, sizeof(__pyx_k_boxl_x), 0, 0, 1, 1}, - {&__pyx_n_s_boxl_y, __pyx_k_boxl_y, sizeof(__pyx_k_boxl_y), 0, 0, 1, 1}, - {&__pyx_n_s_boxl_z, __pyx_k_boxl_z, sizeof(__pyx_k_boxl_z), 0, 0, 1, 1}, - {&__pyx_n_s_boxlength, __pyx_k_boxlength, sizeof(__pyx_k_boxlength), 0, 0, 1, 1}, - {&__pyx_n_s_buildNeighborList, __pyx_k_buildNeighborList, sizeof(__pyx_k_buildNeighborList), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, - {&__pyx_n_s_c1, __pyx_k_c1, sizeof(__pyx_k_c1), 0, 0, 1, 1}, - {&__pyx_n_s_c2, __pyx_k_c2, sizeof(__pyx_k_c2), 0, 0, 1, 1}, - {&__pyx_n_s_calcCN, __pyx_k_calcCN, sizeof(__pyx_k_calcCN), 0, 0, 1, 1}, - {&__pyx_n_s_calcCN_int8, __pyx_k_calcCN_int8, sizeof(__pyx_k_calcCN_int8), 0, 0, 1, 1}, - {&__pyx_n_s_calcTessellation, __pyx_k_calcTessellation, sizeof(__pyx_k_calcTessellation), 0, 0, 1, 1}, - {&__pyx_n_s_calcTessellationParallel, __pyx_k_calcTessellationParallel, sizeof(__pyx_k_calcTessellationParallel), 0, 0, 1, 1}, - {&__pyx_n_s_calcTessellationParallelAll, __pyx_k_calcTessellationParallelAll, sizeof(__pyx_k_calcTessellationParallelAll), 0, 0, 1, 1}, - {&__pyx_n_s_calcTessellationVolSurfAtomic, __pyx_k_calcTessellationVolSurfAtomic, sizeof(__pyx_k_calcTessellationVolSurfAtomic), 0, 0, 1, 1}, - {&__pyx_n_s_ccorelist, __pyx_k_ccorelist, sizeof(__pyx_k_ccorelist), 0, 0, 1, 1}, - {&__pyx_n_s_cds, __pyx_k_cds, sizeof(__pyx_k_cds), 0, 0, 1, 1}, - {&__pyx_n_s_cf2c, __pyx_k_cf2c, sizeof(__pyx_k_cf2c), 0, 0, 1, 1}, - {&__pyx_n_s_cfa, __pyx_k_cfa, sizeof(__pyx_k_cfa), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_color_id, __pyx_k_color_id, sizeof(__pyx_k_color_id), 0, 0, 1, 1}, - {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, - {&__pyx_n_s_core_begin, __pyx_k_core_begin, sizeof(__pyx_k_core_begin), 0, 0, 1, 1}, - {&__pyx_n_s_core_end, __pyx_k_core_end, sizeof(__pyx_k_core_end), 0, 0, 1, 1}, - {&__pyx_n_s_core_first, __pyx_k_core_first, sizeof(__pyx_k_core_first), 0, 0, 1, 1}, - {&__pyx_n_s_core_last, __pyx_k_core_last, sizeof(__pyx_k_core_last), 0, 0, 1, 1}, - {&__pyx_n_s_corelist, __pyx_k_corelist, sizeof(__pyx_k_corelist), 0, 0, 1, 1}, - {&__pyx_n_s_cres, __pyx_k_cres, sizeof(__pyx_k_cres), 0, 0, 1, 1}, - {&__pyx_n_s_csurrlist, __pyx_k_csurrlist, sizeof(__pyx_k_csurrlist), 0, 0, 1, 1}, - {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, - {&__pyx_n_s_cts, __pyx_k_cts, sizeof(__pyx_k_cts), 0, 0, 1, 1}, - {&__pyx_n_s_cvols, __pyx_k_cvols, sizeof(__pyx_k_cvols), 0, 0, 1, 1}, - {&__pyx_n_s_cxyz, __pyx_k_cxyz, sizeof(__pyx_k_cxyz), 0, 0, 1, 1}, - {&__pyx_n_s_cylinder_radius, __pyx_k_cylinder_radius, sizeof(__pyx_k_cylinder_radius), 0, 0, 1, 1}, - {&__pyx_n_s_dataset, __pyx_k_dataset, sizeof(__pyx_k_dataset), 0, 0, 1, 1}, - {&__pyx_n_s_delaunay, __pyx_k_delaunay, sizeof(__pyx_k_delaunay), 0, 0, 1, 1}, - {&__pyx_n_s_delaunay_tmp, __pyx_k_delaunay_tmp, sizeof(__pyx_k_delaunay_tmp), 0, 0, 1, 1}, - {&__pyx_n_s_delaunay_ts, __pyx_k_delaunay_ts, sizeof(__pyx_k_delaunay_ts), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1}, - {&__pyx_n_s_drawTessellation, __pyx_k_drawTessellation, sizeof(__pyx_k_drawTessellation), 0, 0, 1, 1}, - {&__pyx_n_s_draw_triangles, __pyx_k_draw_triangles, sizeof(__pyx_k_draw_triangles), 0, 0, 1, 1}, - {&__pyx_n_s_ds, __pyx_k_ds, sizeof(__pyx_k_ds), 0, 0, 1, 1}, - {&__pyx_n_s_ds_ts, __pyx_k_ds_ts, sizeof(__pyx_k_ds_ts), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, - {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, - {&__pyx_n_s_f2c, __pyx_k_f2c, sizeof(__pyx_k_f2c), 0, 0, 1, 1}, - {&__pyx_n_s_fa, __pyx_k_fa, sizeof(__pyx_k_fa), 0, 0, 1, 1}, - {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1}, - {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1}, - {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, - {&__pyx_n_s_fn, __pyx_k_fn, sizeof(__pyx_k_fn), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, - {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0}, - {&__pyx_n_s_h5file, __pyx_k_h5file, sizeof(__pyx_k_h5file), 0, 0, 1, 1}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_icore, __pyx_k_icore, sizeof(__pyx_k_icore), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1}, - {&__pyx_n_s_ires, __pyx_k_ires, sizeof(__pyx_k_ires), 0, 0, 1, 1}, - {&__pyx_n_s_isurr, __pyx_k_isurr, sizeof(__pyx_k_isurr), 0, 0, 1, 1}, - {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, - {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, - {&__pyx_n_s_iubq, __pyx_k_iubq, sizeof(__pyx_k_iubq), 0, 0, 1, 1}, - {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, - {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, - {&__pyx_n_s_len_points_to_draw, __pyx_k_len_points_to_draw, sizeof(__pyx_k_len_points_to_draw), 0, 0, 1, 1}, - {&__pyx_n_s_len_xyz, __pyx_k_len_xyz, sizeof(__pyx_k_len_xyz), 0, 0, 1, 1}, - {&__pyx_n_s_lower_limit, __pyx_k_lower_limit, sizeof(__pyx_k_lower_limit), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_maxsh, __pyx_k_maxsh, sizeof(__pyx_k_maxsh), 0, 0, 1, 1}, - {&__pyx_n_s_maxshell, __pyx_k_maxshell, sizeof(__pyx_k_maxshell), 0, 0, 1, 1}, - {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, - {&__pyx_n_s_mindist, __pyx_k_mindist, sizeof(__pyx_k_mindist), 0, 0, 1, 1}, - {&__pyx_n_s_minshell, __pyx_k_minshell, sizeof(__pyx_k_minshell), 0, 0, 1, 1}, - {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, - {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, - {&__pyx_n_s_n2, __pyx_k_n2, sizeof(__pyx_k_n2), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_nat, __pyx_k_nat, sizeof(__pyx_k_nat), 0, 0, 1, 1}, - {&__pyx_n_s_natoms, __pyx_k_natoms, sizeof(__pyx_k_natoms), 0, 0, 1, 1}, - {&__pyx_n_s_ncore, __pyx_k_ncore, sizeof(__pyx_k_ncore), 0, 0, 1, 1}, - {&__pyx_n_s_ncpu, __pyx_k_ncpu, sizeof(__pyx_k_ncpu), 0, 0, 1, 1}, - {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, - {&__pyx_n_s_nearestNeighbor, __pyx_k_nearestNeighbor, sizeof(__pyx_k_nearestNeighbor), 0, 0, 1, 1}, - {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, - {&__pyx_n_s_newanalysis_voro, __pyx_k_newanalysis_voro, sizeof(__pyx_k_newanalysis_voro), 0, 0, 1, 1}, - {&__pyx_n_s_nmax, __pyx_k_nmax, sizeof(__pyx_k_nmax), 0, 0, 1, 1}, - {&__pyx_n_s_nmol, __pyx_k_nmol, sizeof(__pyx_k_nmol), 0, 0, 1, 1}, - {&__pyx_n_s_nmolecules, __pyx_k_nmolecules, sizeof(__pyx_k_nmolecules), 0, 0, 1, 1}, - {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, - {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, - {&__pyx_n_s_nsurr, __pyx_k_nsurr, sizeof(__pyx_k_nsurr), 0, 0, 1, 1}, - {&__pyx_n_s_ntot, __pyx_k_ntot, sizeof(__pyx_k_ntot), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, - {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1}, - {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_n_s_points_ptr, __pyx_k_points_ptr, sizeof(__pyx_k_points_ptr), 0, 0, 1, 1}, - {&__pyx_n_s_points_to_draw, __pyx_k_points_to_draw, sizeof(__pyx_k_points_to_draw), 0, 0, 1, 1}, - {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, - {&__pyx_n_s_py_byte_string, __pyx_k_py_byte_string, sizeof(__pyx_k_py_byte_string), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_radius, __pyx_k_radius, sizeof(__pyx_k_radius), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, - {&__pyx_n_s_s1, __pyx_k_s1, sizeof(__pyx_k_s1), 0, 0, 1, 1}, - {&__pyx_n_s_s2, __pyx_k_s2, sizeof(__pyx_k_s2), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_sh1, __pyx_k_sh1, sizeof(__pyx_k_sh1), 0, 0, 1, 1}, - {&__pyx_n_s_sh2, __pyx_k_sh2, sizeof(__pyx_k_sh2), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, - {&__pyx_n_s_shell_begin, __pyx_k_shell_begin, sizeof(__pyx_k_shell_begin), 0, 0, 1, 1}, - {&__pyx_n_s_shell_end, __pyx_k_shell_end, sizeof(__pyx_k_shell_end), 0, 0, 1, 1}, - {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_kp_s_src_voro_voro_pyx, __pyx_k_src_voro_voro_pyx, sizeof(__pyx_k_src_voro_voro_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, - {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, - {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_n_s_surr_begin, __pyx_k_surr_begin, sizeof(__pyx_k_surr_begin), 0, 0, 1, 1}, - {&__pyx_n_s_surr_end, __pyx_k_surr_end, sizeof(__pyx_k_surr_end), 0, 0, 1, 1}, - {&__pyx_n_s_surr_first, __pyx_k_surr_first, sizeof(__pyx_k_surr_first), 0, 0, 1, 1}, - {&__pyx_n_s_surr_last, __pyx_k_surr_last, sizeof(__pyx_k_surr_last), 0, 0, 1, 1}, - {&__pyx_n_s_surroundlist, __pyx_k_surroundlist, sizeof(__pyx_k_surroundlist), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_triangles, __pyx_k_triangles, sizeof(__pyx_k_triangles), 0, 0, 1, 1}, - {&__pyx_n_s_ts, __pyx_k_ts, sizeof(__pyx_k_ts), 0, 0, 1, 1}, - {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, - {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, - {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {&__pyx_n_s_upper_limit, __pyx_k_upper_limit, sizeof(__pyx_k_upper_limit), 0, 0, 1, 1}, - {&__pyx_n_s_vols, __pyx_k_vols, sizeof(__pyx_k_vols), 0, 0, 1, 1}, - {&__pyx_n_s_xyz, __pyx_k_xyz, sizeof(__pyx_k_xyz), 0, 0, 1, 1}, - {&__pyx_n_s_xyz_ptr, __pyx_k_xyz_ptr, sizeof(__pyx_k_xyz_ptr), 0, 0, 1, 1}, - {&__pyx_n_s_xyz_ts, __pyx_k_xyz_ts, sizeof(__pyx_k_xyz_ts), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 34, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 106, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 944, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 134, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 149, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 152, __pyx_L1_error) - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 406, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 615, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 834, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "src/voro/voro.pyx":34 - * return unicode(s) - * else: - * raise TypeError("Unknown string type!") # <<<<<<<<<<<<<< + /* "newanalysis/voro/voro.pyx":192 + * boxl_z = boxl_x + * + * _drawTessellation(xyz_ptr, boxl_x, boxl_y, boxl_z, len_xyz, points_ptr, len_points_to_draw, radius, draw_triangles, nmol, color_id, fn) # <<<<<<<<<<<<<< * * @cython.boundscheck(False) */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Unknown_string_type); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); + _drawTessellation(__pyx_v_xyz_ptr, __pyx_v_boxl_x, __pyx_v_boxl_y, __pyx_v_boxl_z, __pyx_v_len_xyz, __pyx_v_points_ptr, __pyx_v_len_points_to_draw, __pyx_v_radius, __pyx_v_draw_triangles, __pyx_v_nmol, __pyx_v_color_id, __pyx_v_fn); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":944 - * __pyx_import_array() - * except Exception: - * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + /* "newanalysis/voro/voro.pyx":166 + * delaunay_ts[c,iubq,j] = mindist * - * cdef inline int import_umath() except -1: + * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, # <<<<<<<<<<<<<< + * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, + * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 944, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - /* "../../../../../scratch/data/florian/anaconda3/envs/mda_philipp/lib/python3.9/site-packages/numpy/__init__.pxd":950 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_points_to_draw.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.voro.drawTessellation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_points_to_draw.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xyz.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF(__pyx_v_py_byte_string); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/voro/voro.pyx":194 + * _drawTessellation(xyz_ptr, boxl_x, boxl_y, boxl_z, len_xyz, points_ptr, len_points_to_draw, radius, draw_triangles, nmol, color_id, fn) * - * cdef inline int import_ufunc() except -1: + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def buildNeighborList(np.ndarray[np.int32_t,ndim=2] ds, + * np.ndarray[np.int8_t,ndim=3] result, */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 950, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); - /* "View.MemoryView":134 - * - * if not self.ndim: - * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< - * - * if itemsize <= 0: - */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_4voro_13buildNeighborList(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_4voro_12buildNeighborList, "\n buildNeighborList(ds, result, core_first, core_last, surr_first, surr_last, ctr, minshell=1, maxshell=1)\n\n Add the delaunay distance matrix information from the current frame to a residence timeseries for later correlation.\n "); +static PyMethodDef __pyx_mdef_11newanalysis_4voro_13buildNeighborList = {"buildNeighborList", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_4voro_13buildNeighborList, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_12buildNeighborList}; +static PyObject *__pyx_pw_11newanalysis_4voro_13buildNeighborList(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_ds = 0; + PyArrayObject *__pyx_v_result = 0; + PyObject *__pyx_v_core_first = 0; + PyObject *__pyx_v_core_last = 0; + PyObject *__pyx_v_surr_first = 0; + PyObject *__pyx_v_surr_last = 0; + PyObject *__pyx_v_ctr = 0; + PyObject *__pyx_v_minshell = 0; + PyObject *__pyx_v_maxshell = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("buildNeighborList (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 194, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_result,&__pyx_n_s_core_first,&__pyx_n_s_core_last,&__pyx_n_s_surr_first,&__pyx_n_s_surr_last,&__pyx_n_s_ctr,&__pyx_n_s_minshell,&__pyx_n_s_maxshell,0}; + values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_1))); + values[8] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_1))); + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 1); __PYX_ERR(0, 194, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_core_first)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 2); __PYX_ERR(0, 194, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_core_last)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 3); __PYX_ERR(0, 194, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_surr_first)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 4); __PYX_ERR(0, 194, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_surr_last)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 5); __PYX_ERR(0, 194, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ctr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, 6); __PYX_ERR(0, 194, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_minshell); + if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxshell); + if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "buildNeighborList") < 0)) __PYX_ERR(0, 194, __pyx_L3_error) + } + } else { + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ds = ((PyArrayObject *)values[0]); + __pyx_v_result = ((PyArrayObject *)values[1]); + __pyx_v_core_first = values[2]; + __pyx_v_core_last = values[3]; + __pyx_v_surr_first = values[4]; + __pyx_v_surr_last = values[5]; + __pyx_v_ctr = values[6]; + __pyx_v_minshell = values[7]; + __pyx_v_maxshell = values[8]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("buildNeighborList", 0, 7, 9, __pyx_nargs); __PYX_ERR(0, 194, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.voro.buildNeighborList", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ds), __pyx_ptype_5numpy_ndarray, 1, "ds", 0))) __PYX_ERR(0, 195, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_5numpy_ndarray, 1, "result", 0))) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_4voro_12buildNeighborList(__pyx_self, __pyx_v_ds, __pyx_v_result, __pyx_v_core_first, __pyx_v_core_last, __pyx_v_surr_first, __pyx_v_surr_last, __pyx_v_ctr, __pyx_v_minshell, __pyx_v_maxshell); - /* "View.MemoryView":137 - * - * if itemsize <= 0: - * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_4voro_12buildNeighborList(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_first, PyObject *__pyx_v_core_last, PyObject *__pyx_v_surr_first, PyObject *__pyx_v_surr_last, PyObject *__pyx_v_ctr, PyObject *__pyx_v_minshell, PyObject *__pyx_v_maxshell) { + int __pyx_v_ncore; + int __pyx_v_nsurr; + int __pyx_v_n2; + int __pyx_v_ntot; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int *__pyx_v_cds; + __pyx_t_5numpy_int8_t *__pyx_v_cres; + CYTHON_UNUSED int __pyx_v_c1; + CYTHON_UNUSED int __pyx_v_c2; + int __pyx_v_s1; + int __pyx_v_s2; + int __pyx_v_lower_limit; + int __pyx_v_upper_limit; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ds; + __Pyx_Buffer __pyx_pybuffer_ds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_result; + __Pyx_Buffer __pyx_pybuffer_result; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + npy_intp *__pyx_t_1; + int __pyx_t_2; + char *__pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("buildNeighborList", 0); + __pyx_pybuffer_ds.pybuffer.buf = NULL; + __pyx_pybuffer_ds.refcount = 0; + __pyx_pybuffernd_ds.data = NULL; + __pyx_pybuffernd_ds.rcbuffer = &__pyx_pybuffer_ds; + __pyx_pybuffer_result.pybuffer.buf = NULL; + __pyx_pybuffer_result.refcount = 0; + __pyx_pybuffernd_result.data = NULL; + __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ds.rcbuffer->pybuffer, (PyObject*)__pyx_v_ds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 194, __pyx_L1_error) + } + __pyx_pybuffernd_ds.diminfo[0].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ds.diminfo[0].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ds.diminfo[1].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ds.diminfo[1].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 194, __pyx_L1_error) + } + __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_result.diminfo[1].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_result.diminfo[1].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_result.diminfo[2].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_result.diminfo[2].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[2]; + + /* "newanalysis/voro/voro.pyx":205 + * """ * - * if not isinstance(format, bytes): + * cdef int ncore = result.shape[1] # <<<<<<<<<<<<<< + * cdef int nsurr = result.shape[2] + * cdef int n2 = ncore * nsurr */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_result)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_v_ncore = (__pyx_t_1[1]); - /* "View.MemoryView":149 - * - * if not self._shape: - * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< - * + /* "newanalysis/voro/voro.pyx":206 * + * cdef int ncore = result.shape[1] + * cdef int nsurr = result.shape[2] # <<<<<<<<<<<<<< + * cdef int n2 = ncore * nsurr + * cdef int ntot = ds.shape[0] */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_result)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_v_nsurr = (__pyx_t_1[2]); - /* "View.MemoryView":177 - * self.data = malloc(self.len) - * if not self.data: - * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< - * - * if self.dtype_is_object: + /* "newanalysis/voro/voro.pyx":207 + * cdef int ncore = result.shape[1] + * cdef int nsurr = result.shape[2] + * cdef int n2 = ncore * nsurr # <<<<<<<<<<<<<< + * cdef int ntot = ds.shape[0] + * cdef int i, j, k = ctr */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_v_n2 = (__pyx_v_ncore * __pyx_v_nsurr); - /* "View.MemoryView":193 - * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS - * if not (flags & bufmode): - * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< - * info.buf = self.data - * info.len = self.len + /* "newanalysis/voro/voro.pyx":208 + * cdef int nsurr = result.shape[2] + * cdef int n2 = ncore * nsurr + * cdef int ntot = ds.shape[0] # <<<<<<<<<<<<<< + * cdef int i, j, k = ctr + * cdef int *cds = ds.data */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_ds)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_v_ntot = (__pyx_t_1[0]); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "newanalysis/voro/voro.pyx":209 + * cdef int n2 = ncore * nsurr + * cdef int ntot = ds.shape[0] + * cdef int i, j, k = ctr # <<<<<<<<<<<<<< + * cdef int *cds = ds.data + * cdef np.int8_t* cres = result.data */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_ctr); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_v_k = __pyx_t_2; - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "newanalysis/voro/voro.pyx":210 + * cdef int ntot = ds.shape[0] + * cdef int i, j, k = ctr + * cdef int *cds = ds.data # <<<<<<<<<<<<<< + * cdef np.int8_t* cres = result.data + * cdef int c1 = core_first, c2 = core_last, s1=surr_first, s2=surr_last */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_t_3 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ds)); if (unlikely(__pyx_t_3 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_v_cds = ((int *)__pyx_t_3); - /* "View.MemoryView":420 - * def __setitem__(memoryview self, object index, object value): - * if self.view.readonly: - * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< - * - * have_slices, index = _unellipsify(index, self.view.ndim) + /* "newanalysis/voro/voro.pyx":211 + * cdef int i, j, k = ctr + * cdef int *cds = ds.data + * cdef np.int8_t* cres = result.data # <<<<<<<<<<<<<< + * cdef int c1 = core_first, c2 = core_last, s1=surr_first, s2=surr_last + * cdef int lower_limit = minshell, upper_limit = maxshell */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_t_3 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_result)); if (unlikely(__pyx_t_3 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_v_cres = ((__pyx_t_5numpy_int8_t *)__pyx_t_3); - /* "View.MemoryView":497 - * result = struct.unpack(self.view.format, bytesitem) - * except struct.error: - * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< - * else: - * if len(self.view.format) == 1: + /* "newanalysis/voro/voro.pyx":212 + * cdef int *cds = ds.data + * cdef np.int8_t* cres = result.data + * cdef int c1 = core_first, c2 = core_last, s1=surr_first, s2=surr_last # <<<<<<<<<<<<<< + * cdef int lower_limit = minshell, upper_limit = maxshell + * */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_core_first); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_v_c1 = __pyx_t_2; + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_core_last); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_v_c2 = __pyx_t_2; + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_surr_first); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_v_s1 = __pyx_t_2; + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_surr_last); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_v_s2 = __pyx_t_2; - /* "View.MemoryView":522 - * def __getbuffer__(self, Py_buffer *info, int flags): - * if flags & PyBUF_WRITABLE and self.view.readonly: - * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< - * - * if flags & PyBUF_ND: - */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - - /* "View.MemoryView":572 - * if self.view.strides == NULL: - * - * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< - * - * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) - */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - - /* "View.MemoryView":579 - * def suboffsets(self): - * if self.view.suboffsets == NULL: - * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< - * - * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) - */ - __pyx_tuple__15 = PyTuple_New(1); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 579, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_INCREF(__pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__15, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_tuple__15); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - - /* "View.MemoryView":684 - * if item is Ellipsis: - * if not seen_ellipsis: - * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< - * seen_ellipsis = True - * else: - */ - __pyx_slice__18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__18)) __PYX_ERR(2, 684, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__18); - __Pyx_GIVEREF(__pyx_slice__18); - - /* "View.MemoryView":705 - * for suboffset in suboffsets[:ndim]: - * if suboffset >= 0: - * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< - * + /* "newanalysis/voro/voro.pyx":213 + * cdef np.int8_t* cres = result.data + * cdef int c1 = core_first, c2 = core_last, s1=surr_first, s2=surr_last + * cdef int lower_limit = minshell, upper_limit = maxshell # <<<<<<<<<<<<<< * + * for i in prange(c1,c2,nogil=True): */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 705, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_tuple__22 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_minshell); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_v_lower_limit = __pyx_t_2; + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_maxshell); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_v_upper_limit = __pyx_t_2; - /* "src/voro/voro.pyx":37 + /* "newanalysis/voro/voro.pyx":215 + * cdef int lower_limit = minshell, upper_limit = maxshell * - * @cython.boundscheck(False) - * def calcTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, float boxlength, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, - * np.ndarray[np.int32_t,ndim=1, mode="c"] corelist, + * for i in prange(c1,c2,nogil=True): # <<<<<<<<<<<<<< + * for j in range(s1,s2): + * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: */ - __pyx_tuple__23 = PyTuple_Pack(32, __pyx_n_s_xyz, __pyx_n_s_boxlength, __pyx_n_s_f2c, __pyx_n_s_natoms, __pyx_n_s_nmolecules, __pyx_n_s_maxshell, __pyx_n_s_corelist, __pyx_n_s_vols, __pyx_n_s_fa, __pyx_n_s_ds_ts, __pyx_n_s_ts, __pyx_n_s_ires, __pyx_n_s_surroundlist, __pyx_n_s_h5file, __pyx_n_s_delaunay, __pyx_n_s_cds, __pyx_n_s_cts, __pyx_n_s_cxyz, __pyx_n_s_cf2c, __pyx_n_s_ccorelist, __pyx_n_s_csurrlist, __pyx_n_s_cvols, __pyx_n_s_cfa, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_nsurr, __pyx_n_s_ncore, __pyx_n_s_mindist, __pyx_n_s_dist, __pyx_n_s_icore, __pyx_n_s_isurr, __pyx_n_s_dataset); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(14, 0, 32, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_voro_voro_pyx, __pyx_n_s_calcTessellation, 37, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 37, __pyx_L1_error) + { + #ifdef WITH_THREAD + PyThreadState *_save; + _save = NULL; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + __pyx_t_2 = __pyx_v_c1; + __pyx_t_4 = __pyx_v_c2; + { + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) (x) + #define unlikely(x) (x) + #endif + __pyx_t_6 = (__pyx_t_4 - __pyx_t_2 + 1 - 1/abs(1)) / 1; + if (__pyx_t_6 > 0) + { + #ifdef _OPENMP + #pragma omp parallel private(__pyx_t_10, __pyx_t_11, __pyx_t_7, __pyx_t_8, __pyx_t_9) + #endif /* _OPENMP */ + { + #ifdef _OPENMP + #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) + #endif /* _OPENMP */ + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){ + { + __pyx_v_i = (int)(__pyx_t_2 + 1 * __pyx_t_5); + /* Initialize private variables to invalid values */ + __pyx_v_j = ((int)0xbad0bad0); - /* "src/voro/voro.pyx":125 - * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] + /* "newanalysis/voro/voro.pyx":216 * - * def calcTessellationVolSurfAtomic(double [:,:] xyz, float boxlength, # <<<<<<<<<<<<<< - * int [:] f2c, int natoms, int nmolecules, int maxshell, - * int [:] corelist, float [:] vols, float [:] fa): + * for i in prange(c1,c2,nogil=True): + * for j in range(s1,s2): # <<<<<<<<<<<<<< + * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: + * cres[k*n2+i*ncore+j] = 1 */ - __pyx_tuple__25 = PyTuple_Pack(10, __pyx_n_s_xyz, __pyx_n_s_boxlength, __pyx_n_s_f2c, __pyx_n_s_natoms, __pyx_n_s_nmolecules, __pyx_n_s_maxshell, __pyx_n_s_corelist, __pyx_n_s_vols, __pyx_n_s_fa, __pyx_n_s_delaunay); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(9, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_voro_voro_pyx, __pyx_n_s_calcTessellationVolSurfAtomic, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_7 = __pyx_v_s2; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = __pyx_v_s1; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_j = __pyx_t_9; - /* "src/voro/voro.pyx":136 - * return np.asarray(delaunay) + /* "newanalysis/voro/voro.pyx":217 + * for i in prange(c1,c2,nogil=True): + * for j in range(s1,s2): + * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: # <<<<<<<<<<<<<< + * cres[k*n2+i*ncore+j] = 1 * - * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< - * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) */ - __pyx_tuple__27 = PyTuple_Pack(16, __pyx_n_s_xyz_ts, __pyx_n_s_f2c, __pyx_n_s_corelist, __pyx_n_s_surroundlist, __pyx_n_s_delaunay_ts, __pyx_n_s_boxlength, __pyx_n_s_natoms, __pyx_n_s_nmolecules, __pyx_n_s_maxshell, __pyx_n_s_nat, __pyx_n_s_nmol, __pyx_n_s_maxsh, __pyx_n_s_ncore, __pyx_n_s_nsurr, __pyx_n_s_ncpu, __pyx_n_s_boxl); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(9, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_voro_voro_pyx, __pyx_n_s_calcTessellationParallel, 136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_11 = ((__pyx_v_cds[((__pyx_v_i * __pyx_v_ntot) + __pyx_v_j)]) >= __pyx_v_lower_limit); + if (__pyx_t_11) { + } else { + __pyx_t_10 = __pyx_t_11; + goto __pyx_L13_bool_binop_done; + } + __pyx_t_11 = ((__pyx_v_cds[((__pyx_v_i * __pyx_v_ntot) + __pyx_v_j)]) <= __pyx_v_upper_limit); + __pyx_t_10 = __pyx_t_11; + __pyx_L13_bool_binop_done:; + if (__pyx_t_10) { - /* "src/voro/voro.pyx":143 - * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) + /* "newanalysis/voro/voro.pyx":218 + * for j in range(s1,s2): + * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: + * cres[k*n2+i*ncore+j] = 1 # <<<<<<<<<<<<<< * - * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< - * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) + * def calcCN(np.ndarray[np.int32_t,ndim=2] ds, */ - __pyx_tuple__29 = PyTuple_Pack(14, __pyx_n_s_xyz_ts, __pyx_n_s_f2c, __pyx_n_s_corelist, __pyx_n_s_delaunay_ts, __pyx_n_s_boxlength, __pyx_n_s_natoms, __pyx_n_s_nmolecules, __pyx_n_s_maxshell, __pyx_n_s_nat, __pyx_n_s_nmol, __pyx_n_s_maxsh, __pyx_n_s_ncore, __pyx_n_s_ncpu, __pyx_n_s_boxl); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(8, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_voro_voro_pyx, __pyx_n_s_calcTessellationParallelAll, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 143, __pyx_L1_error) + (__pyx_v_cres[(((__pyx_v_k * __pyx_v_n2) + (__pyx_v_i * __pyx_v_ncore)) + __pyx_v_j)]) = ((__pyx_t_5numpy_int8_t)1); - /* "src/voro/voro.pyx":151 + /* "newanalysis/voro/voro.pyx":217 + * for i in prange(c1,c2,nogil=True): + * for j in range(s1,s2): + * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: # <<<<<<<<<<<<<< + * cres[k*n2+i*ncore+j] = 1 * - * @cython.boundscheck(False) - * def nearestNeighbor(int [:] corelist, int [:] surroundlist, char [:,:,:] delaunay_tmp, char [:,:,:] delaunay_ts, int iubq, int maxshell): # <<<<<<<<<<<<<< - * cdef int icore, isurr, c, j, k, nsurr = len(surroundlist), ncore = len(corelist), ncpu = delaunay_tmp.shape[0] - * cdef char dist, mindist */ - __pyx_tuple__31 = PyTuple_Pack(16, __pyx_n_s_corelist, __pyx_n_s_surroundlist, __pyx_n_s_delaunay_tmp, __pyx_n_s_delaunay_ts, __pyx_n_s_iubq, __pyx_n_s_maxshell, __pyx_n_s_icore, __pyx_n_s_isurr, __pyx_n_s_c, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_nsurr, __pyx_n_s_ncore, __pyx_n_s_ncpu, __pyx_n_s_dist, __pyx_n_s_mindist); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(6, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_voro_voro_pyx, __pyx_n_s_nearestNeighbor, 151, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 151, __pyx_L1_error) + } + } + } + } + } + } + } + #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))))) + #undef likely + #undef unlikely + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #endif + } - /* "src/voro/voro.pyx":166 - * delaunay_ts[c,iubq,j] = mindist + /* "newanalysis/voro/voro.pyx":215 + * cdef int lower_limit = minshell, upper_limit = maxshell * - * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, - * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): + * for i in prange(c1,c2,nogil=True): # <<<<<<<<<<<<<< + * for j in range(s1,s2): + * if cds[i*ntot+j]>=lower_limit and cds[i*ntot+j]<=upper_limit: */ - __pyx_tuple__33 = PyTuple_Pack(21, __pyx_n_s_xyz, __pyx_n_s_points_to_draw, __pyx_n_s_cylinder_radius, __pyx_n_s_triangles, __pyx_n_s_nmol, __pyx_n_s_color_id, __pyx_n_s_filename, __pyx_n_s_box_x, __pyx_n_s_box_y, __pyx_n_s_box_z, __pyx_n_s_len_xyz, __pyx_n_s_len_points_to_draw, __pyx_n_s_py_byte_string, __pyx_n_s_fn, __pyx_n_s_xyz_ptr, __pyx_n_s_points_ptr, __pyx_n_s_draw_triangles, __pyx_n_s_radius, __pyx_n_s_boxl_x, __pyx_n_s_boxl_y, __pyx_n_s_boxl_z); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 166, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(10, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_voro_voro_pyx, __pyx_n_s_drawTessellation, 166, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 166, __pyx_L1_error) + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } - /* "src/voro/voro.pyx":195 + /* "newanalysis/voro/voro.pyx":194 + * _drawTessellation(xyz_ptr, boxl_x, boxl_y, boxl_z, len_xyz, points_ptr, len_points_to_draw, radius, draw_triangles, nmol, color_id, fn) * - * @cython.boundscheck(False) - * def buildNeighborList(np.ndarray[np.int32_t,ndim=2] ds, # <<<<<<<<<<<<<< + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def buildNeighborList(np.ndarray[np.int32_t,ndim=2] ds, * np.ndarray[np.int8_t,ndim=3] result, - * core_first, core_last, surr_first, surr_last, */ - __pyx_tuple__35 = PyTuple_Pack(24, __pyx_n_s_ds, __pyx_n_s_result, __pyx_n_s_core_first, __pyx_n_s_core_last, __pyx_n_s_surr_first, __pyx_n_s_surr_last, __pyx_n_s_ctr, __pyx_n_s_minshell, __pyx_n_s_maxshell, __pyx_n_s_ncore, __pyx_n_s_nsurr, __pyx_n_s_n2, __pyx_n_s_ntot, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_cds, __pyx_n_s_cres, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_lower_limit, __pyx_n_s_upper_limit); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(9, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_voro_voro_pyx, __pyx_n_s_buildNeighborList, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 195, __pyx_L1_error) - /* "src/voro/voro.pyx":220 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.voro.buildNeighborList", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "newanalysis/voro/voro.pyx":220 * cres[k*n2+i*ncore+j] = 1 * * def calcCN(np.ndarray[np.int32_t,ndim=2] ds, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t,ndim=1] result, * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): */ - __pyx_tuple__37 = PyTuple_Pack(22, __pyx_n_s_ds, __pyx_n_s_result, __pyx_n_s_core_begin, __pyx_n_s_core_end, __pyx_n_s_surr_begin, __pyx_n_s_surr_end, __pyx_n_s_shell_begin, __pyx_n_s_shell_end, __pyx_n_s_ntot, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_sh1, __pyx_n_s_sh2, __pyx_n_s_n, __pyx_n_s_cds, __pyx_n_s_cres, __pyx_n_s_ctr, __pyx_n_s_nmax); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(9, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_voro_voro_pyx, __pyx_n_s_calcCN, 220, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 220, __pyx_L1_error) - - /* "src/voro/voro.pyx":257 - * cres[ctr]+=1 - * - * def calcCN_int8(np.ndarray[np.int8_t,ndim=2] ds, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] result, - * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): - */ - __pyx_tuple__39 = PyTuple_Pack(22, __pyx_n_s_ds, __pyx_n_s_result, __pyx_n_s_core_begin, __pyx_n_s_core_end, __pyx_n_s_surr_begin, __pyx_n_s_surr_end, __pyx_n_s_shell_begin, __pyx_n_s_shell_end, __pyx_n_s_ntot, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_sh1, __pyx_n_s_sh2, __pyx_n_s_n, __pyx_n_s_cds, __pyx_n_s_cres, __pyx_n_s_ctr, __pyx_n_s_nmax); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 257, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(9, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_voro_voro_pyx, __pyx_n_s_calcCN_int8, 257, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 257, __pyx_L1_error) - - /* "View.MemoryView":287 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") - */ - __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - - /* "View.MemoryView":288 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * - */ - __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); - - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - - /* "View.MemoryView":292 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * - */ - __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - - /* "View.MemoryView":293 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * - * - */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_tuple__46 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - /* InitThreads.init */ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 -PyEval_InitThreads(); +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_4voro_15calcCN(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_4voro_14calcCN, "\n calcCN(ds,result,core_begin,core_end,surr_begin,surr_end,shell_begin,shell_end,ntot)\n\n Calculates the coordination number between two selections and adds the found value to a histogram.\n \n Args:\n ds .. delaunay distance matrix of the whole system\n result .. result histogram\n core_begin .. first residue number of the core selection\n core_end .. last residue number of the core selection\n surr_begin .. first residue number of the surround selection\n surr_end .. last residue number of the surround selection\n shell_begin .. lowest delaunay distance to consider\n shell_end .. highest delaunay distance to consider\n ntot .. total number of residues in the system (the number of columns in the ds matrix)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_4voro_15calcCN = {"calcCN", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_4voro_15calcCN, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_14calcCN}; +static PyObject *__pyx_pw_11newanalysis_4voro_15calcCN(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds #endif - -if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) - - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - generic = Py_None; Py_INCREF(Py_None); - strided = Py_None; Py_INCREF(Py_None); - indirect = Py_None; Py_INCREF(Py_None); - contiguous = Py_None; Py_INCREF(Py_None); - indirect_contiguous = Py_None; Py_INCREF(Py_None); - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations +) { + PyArrayObject *__pyx_v_ds = 0; + PyArrayObject *__pyx_v_result = 0; + PyObject *__pyx_v_core_begin = 0; + PyObject *__pyx_v_core_end = 0; + PyObject *__pyx_v_surr_begin = 0; + PyObject *__pyx_v_surr_end = 0; + PyObject *__pyx_v_shell_begin = 0; + PyObject *__pyx_v_shell_end = 0; + PyObject *__pyx_v_ntot = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __pyx_vtabptr_array = &__pyx_vtable_array; - __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; - if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_array.tp_print = 0; - #endif - if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error) - __pyx_array_type = &__pyx_type___pyx_array; - if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_MemviewEnum.tp_print = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcCN (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 220, __pyx_L3_error) #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error) - __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; - __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; - __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; - __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; - __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; - __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; - __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; - __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; - __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; - if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryview.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr; + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_result,&__pyx_n_s_core_begin,&__pyx_n_s_core_end,&__pyx_n_s_surr_begin,&__pyx_n_s_surr_end,&__pyx_n_s_shell_begin,&__pyx_n_s_shell_end,&__pyx_n_s_ntot,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 1); __PYX_ERR(0, 220, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_core_begin)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 2); __PYX_ERR(0, 220, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_core_end)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 3); __PYX_ERR(0, 220, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_surr_begin)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 4); __PYX_ERR(0, 220, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_surr_end)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 5); __PYX_ERR(0, 220, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shell_begin)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 6); __PYX_ERR(0, 220, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shell_end)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 7); __PYX_ERR(0, 220, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ntot)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, 8); __PYX_ERR(0, 220, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcCN") < 0)) __PYX_ERR(0, 220, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 9)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + } + __pyx_v_ds = ((PyArrayObject *)values[0]); + __pyx_v_result = ((PyArrayObject *)values[1]); + __pyx_v_core_begin = values[2]; + __pyx_v_core_end = values[3]; + __pyx_v_surr_begin = values[4]; + __pyx_v_surr_end = values[5]; + __pyx_v_shell_begin = values[6]; + __pyx_v_shell_end = values[7]; + __pyx_v_ntot = values[8]; } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error) - __pyx_memoryview_type = &__pyx_type___pyx_memoryview; - __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; - __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; - __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; - __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; - __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; - if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type___pyx_memoryviewslice.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcCN", 1, 9, 9, __pyx_nargs); __PYX_ERR(0, 220, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error) - __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + __Pyx_AddTraceback("newanalysis.voro.calcCN", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return 0; + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ds), __pyx_ptype_5numpy_ndarray, 1, "ds", 0))) __PYX_ERR(0, 220, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_5numpy_ndarray, 1, "result", 0))) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_4voro_14calcCN(__pyx_self, __pyx_v_ds, __pyx_v_result, __pyx_v_core_begin, __pyx_v_core_end, __pyx_v_surr_begin, __pyx_v_surr_end, __pyx_v_shell_begin, __pyx_v_shell_end, __pyx_v_ntot); + + /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); - return -1; + return __pyx_r; } -static int __Pyx_modinit_type_import_code(void) { +static PyObject *__pyx_pf_11newanalysis_4voro_14calcCN(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_begin, PyObject *__pyx_v_core_end, PyObject *__pyx_v_surr_begin, PyObject *__pyx_v_surr_end, PyObject *__pyx_v_shell_begin, PyObject *__pyx_v_shell_end, PyObject *__pyx_v_ntot) { + int __pyx_v_c1; + int __pyx_v_c2; + int __pyx_v_s1; + int __pyx_v_s2; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_sh1; + int __pyx_v_sh2; + int __pyx_v_n; + int *__pyx_v_cds; + double *__pyx_v_cres; + int __pyx_v_ctr; + int __pyx_v_nmax; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ds; + __Pyx_Buffer __pyx_pybuffer_ds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_result; + __Pyx_Buffer __pyx_pybuffer_result; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + long __pyx_t_6; + long __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", - #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyTypeObject), - #else - sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyHeapTypeObject), - #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT(PyArray_Descr), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 199, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 222, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayMultiIterObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 226, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT(PyArrayObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error) - __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 770, __pyx_L1_error) - __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 772, __pyx_L1_error) - __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 774, __pyx_L1_error) - __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 776, __pyx_L1_error) - __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 778, __pyx_L1_error) - __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 780, __pyx_L1_error) - __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 782, __pyx_L1_error) - __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 784, __pyx_L1_error) - __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 786, __pyx_L1_error) - __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT(PyObject), - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 788, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT(PyUFuncObject), - __Pyx_ImportType_CheckSize_Ignore); - if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 826, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif -#else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initvoro(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initvoro(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_voro(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_voro(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { - result = PyDict_SetItemString(moddict, to_name, value); - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - - -static CYTHON_SMALL_CODE int __pyx_pymod_exec_voro(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - PyObject *__pyx_t_1 = NULL; - static PyThread_type_lock __pyx_t_2[8]; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'voro' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_voro(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - PyEval_InitThreads(); - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("voro", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_newanalysis__voro) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_RefNannySetupContext("calcCN", 0); + __pyx_pybuffer_ds.pybuffer.buf = NULL; + __pyx_pybuffer_ds.refcount = 0; + __pyx_pybuffernd_ds.data = NULL; + __pyx_pybuffernd_ds.rcbuffer = &__pyx_pybuffer_ds; + __pyx_pybuffer_result.pybuffer.buf = NULL; + __pyx_pybuffer_result.refcount = 0; + __pyx_pybuffernd_result.data = NULL; + __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ds.rcbuffer->pybuffer, (PyObject*)__pyx_v_ds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 220, __pyx_L1_error) } - #if PY_MAJOR_VERSION >= 3 + __pyx_pybuffernd_ds.diminfo[0].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ds.diminfo[0].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ds.diminfo[1].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ds.diminfo[1].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[1]; { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "newanalysis.voro")) { - if (unlikely(PyDict_SetItemString(modules, "newanalysis.voro", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 220, __pyx_L1_error) } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif + __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; - /* "src/voro/voro.pyx":4 - * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - * - * import numpy as np # <<<<<<<<<<<<<< - * cimport numpy as np + /* "newanalysis/voro/voro.pyx":241 + * """ * + * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot # <<<<<<<<<<<<<< + * cdef int *cds = ds.data + * cdef double *cres = result.data */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_core_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_v_c1 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_core_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_v_c2 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_surr_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_v_s1 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_surr_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_v_s2 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_shell_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_v_sh1 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_shell_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_v_sh2 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_ntot); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_v_n = __pyx_t_1; - /* "src/voro/voro.pyx":37 + /* "newanalysis/voro/voro.pyx":242 * - * @cython.boundscheck(False) - * def calcTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, float boxlength, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, - * np.ndarray[np.int32_t,ndim=1, mode="c"] corelist, + * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot + * cdef int *cds = ds.data # <<<<<<<<<<<<<< + * cdef double *cres = result.data + * cdef int ctr, nmax=len(result) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_4voro_1calcTessellation, NULL, __pyx_n_s_newanalysis_voro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcTessellation, __pyx_t_1) < 0) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ds)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L1_error) + __pyx_v_cds = ((int *)__pyx_t_2); - /* "src/voro/voro.pyx":125 - * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] + /* "newanalysis/voro/voro.pyx":243 + * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot + * cdef int *cds = ds.data + * cdef double *cres = result.data # <<<<<<<<<<<<<< + * cdef int ctr, nmax=len(result) * - * def calcTessellationVolSurfAtomic(double [:,:] xyz, float boxlength, # <<<<<<<<<<<<<< - * int [:] f2c, int natoms, int nmolecules, int maxshell, - * int [:] corelist, float [:] vols, float [:] fa): */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_4voro_3calcTessellationVolSurfAtomic, NULL, __pyx_n_s_newanalysis_voro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcTessellationVolSurfAtomic, __pyx_t_1) < 0) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_result)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_v_cres = ((double *)__pyx_t_2); - /* "src/voro/voro.pyx":136 - * return np.asarray(delaunay) - * - * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< - * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_4voro_5calcTessellationParallel, NULL, __pyx_n_s_newanalysis_voro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcTessellationParallel, __pyx_t_1) < 0) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/voro/voro.pyx":143 - * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) - * - * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< - * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" - * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_4voro_7calcTessellationParallelAll, NULL, __pyx_n_s_newanalysis_voro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcTessellationParallelAll, __pyx_t_1) < 0) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/voro/voro.pyx":151 - * - * @cython.boundscheck(False) - * def nearestNeighbor(int [:] corelist, int [:] surroundlist, char [:,:,:] delaunay_tmp, char [:,:,:] delaunay_ts, int iubq, int maxshell): # <<<<<<<<<<<<<< - * cdef int icore, isurr, c, j, k, nsurr = len(surroundlist), ncore = len(corelist), ncpu = delaunay_tmp.shape[0] - * cdef char dist, mindist - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_4voro_9nearestNeighbor, NULL, __pyx_n_s_newanalysis_voro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_nearestNeighbor, __pyx_t_1) < 0) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/voro/voro.pyx":166 - * delaunay_ts[c,iubq,j] = mindist + /* "newanalysis/voro/voro.pyx":244 + * cdef int *cds = ds.data + * cdef double *cres = result.data + * cdef int ctr, nmax=len(result) # <<<<<<<<<<<<<< * - * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, # <<<<<<<<<<<<<< - * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, - * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): + * # e.g. c1=0, c2=499 */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_4voro_11drawTessellation, NULL, __pyx_n_s_newanalysis_voro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_drawTessellation, __pyx_t_1) < 0) __PYX_ERR(0, 166, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 244, __pyx_L1_error) + __pyx_v_nmax = __pyx_t_3; - /* "src/voro/voro.pyx":195 + /* "newanalysis/voro/voro.pyx":247 * - * @cython.boundscheck(False) - * def buildNeighborList(np.ndarray[np.int32_t,ndim=2] ds, # <<<<<<<<<<<<<< - * np.ndarray[np.int8_t,ndim=3] result, - * core_first, core_last, surr_first, surr_last, + * # e.g. c1=0, c2=499 + * for i in range(c1,c2+1): # <<<<<<<<<<<<<< + * ctr=0 + * for j in range(s1,s2+1): */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_4voro_13buildNeighborList, NULL, __pyx_n_s_newanalysis_voro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_buildNeighborList, __pyx_t_1) < 0) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = (__pyx_v_c2 + 1); + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_1 = __pyx_v_c1; __pyx_t_1 < __pyx_t_5; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; - /* "src/voro/voro.pyx":220 - * cres[k*n2+i*ncore+j] = 1 - * - * def calcCN(np.ndarray[np.int32_t,ndim=2] ds, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] result, - * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): + /* "newanalysis/voro/voro.pyx":248 + * # e.g. c1=0, c2=499 + * for i in range(c1,c2+1): + * ctr=0 # <<<<<<<<<<<<<< + * for j in range(s1,s2+1): + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_4voro_15calcCN, NULL, __pyx_n_s_newanalysis_voro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcCN, __pyx_t_1) < 0) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_ctr = 0; - /* "src/voro/voro.pyx":257 - * cres[ctr]+=1 - * - * def calcCN_int8(np.ndarray[np.int8_t,ndim=2] ds, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t,ndim=1] result, - * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): + /* "newanalysis/voro/voro.pyx":249 + * for i in range(c1,c2+1): + * ctr=0 + * for j in range(s1,s2+1): # <<<<<<<<<<<<<< + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: + * ctr+=1 */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11newanalysis_4voro_17calcCN_int8, NULL, __pyx_n_s_newanalysis_voro); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcCN_int8, __pyx_t_1) < 0) __PYX_ERR(0, 257, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = (__pyx_v_s2 + 1); + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = __pyx_v_s1; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_j = __pyx_t_8; - /* "src/voro/voro.pyx":1 - * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< - * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - * + /* "newanalysis/voro/voro.pyx":250 + * ctr=0 + * for j in range(s1,s2+1): + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: # <<<<<<<<<<<<<< + * ctr+=1 + * if ctr >= nmax: */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = ((__pyx_v_cds[((__pyx_v_i * __pyx_v_n) + __pyx_v_j)]) >= __pyx_v_sh1); + if (__pyx_t_10) { + } else { + __pyx_t_9 = __pyx_t_10; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_10 = ((__pyx_v_cds[((__pyx_v_i * __pyx_v_n) + __pyx_v_j)]) <= __pyx_v_sh2); + __pyx_t_9 = __pyx_t_10; + __pyx_L8_bool_binop_done:; + if (__pyx_t_9) { - /* "View.MemoryView":210 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * def __dealloc__(array self): + /* "newanalysis/voro/voro.pyx":251 + * for j in range(s1,s2+1): + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: + * ctr+=1 # <<<<<<<<<<<<<< + * if ctr >= nmax: + * print("Result array is too short!\n") */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_array_type); + __pyx_v_ctr = (__pyx_v_ctr + 1); - /* "View.MemoryView":287 - * return self.name - * - * cdef generic = Enum("") # <<<<<<<<<<<<<< - * cdef strided = Enum("") # default - * cdef indirect = Enum("") + /* "newanalysis/voro/voro.pyx":250 + * ctr=0 + * for j in range(s1,s2+1): + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: # <<<<<<<<<<<<<< + * ctr+=1 + * if ctr >= nmax: */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(generic); - __Pyx_DECREF_SET(generic, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + } + } - /* "View.MemoryView":288 - * - * cdef generic = Enum("") - * cdef strided = Enum("") # default # <<<<<<<<<<<<<< - * cdef indirect = Enum("") - * + /* "newanalysis/voro/voro.pyx":252 + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: + * ctr+=1 + * if ctr >= nmax: # <<<<<<<<<<<<<< + * print("Result array is too short!\n") + * else: */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(strided); - __Pyx_DECREF_SET(strided, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_9 = (__pyx_v_ctr >= __pyx_v_nmax); + if (__pyx_t_9) { - /* "View.MemoryView":289 - * cdef generic = Enum("") - * cdef strided = Enum("") # default - * cdef indirect = Enum("") # <<<<<<<<<<<<<< - * - * + /* "newanalysis/voro/voro.pyx":253 + * ctr+=1 + * if ctr >= nmax: + * print("Result array is too short!\n") # <<<<<<<<<<<<<< + * else: + * cres[ctr]+=1 */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(indirect); - __Pyx_DECREF_SET(indirect, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "View.MemoryView":292 - * - * - * cdef contiguous = Enum("") # <<<<<<<<<<<<<< - * cdef indirect_contiguous = Enum("") - * + /* "newanalysis/voro/voro.pyx":252 + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: + * ctr+=1 + * if ctr >= nmax: # <<<<<<<<<<<<<< + * print("Result array is too short!\n") + * else: */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(contiguous); - __Pyx_DECREF_SET(contiguous, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + goto __pyx_L10; + } - /* "View.MemoryView":293 - * - * cdef contiguous = Enum("") - * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< - * + /* "newanalysis/voro/voro.pyx":255 + * print("Result array is too short!\n") + * else: + * cres[ctr]+=1 # <<<<<<<<<<<<<< * + * def calcCN_int8(np.ndarray[np.int8_t,ndim=2] ds, */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(indirect_contiguous); - __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + /*else*/ { + __pyx_t_8 = __pyx_v_ctr; + (__pyx_v_cres[__pyx_t_8]) = ((__pyx_v_cres[__pyx_t_8]) + 1.0); + } + __pyx_L10:; + } - /* "View.MemoryView":317 + /* "newanalysis/voro/voro.pyx":220 + * cres[k*n2+i*ncore+j] = 1 * - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ - * PyThread_allocate_lock(), - */ - __pyx_memoryview_thread_locks_used = 0; - - /* "View.MemoryView":318 - * DEF THREAD_LOCKS_PREALLOCATED = 8 - * cdef int __pyx_memoryview_thread_locks_used = 0 - * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< - * PyThread_allocate_lock(), - * PyThread_allocate_lock(), + * def calcCN(np.ndarray[np.int32_t,ndim=2] ds, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=1] result, + * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): */ - __pyx_t_2[0] = PyThread_allocate_lock(); - __pyx_t_2[1] = PyThread_allocate_lock(); - __pyx_t_2[2] = PyThread_allocate_lock(); - __pyx_t_2[3] = PyThread_allocate_lock(); - __pyx_t_2[4] = PyThread_allocate_lock(); - __pyx_t_2[5] = PyThread_allocate_lock(); - __pyx_t_2[6] = PyThread_allocate_lock(); - __pyx_t_2[7] = PyThread_allocate_lock(); - memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); - /* "View.MemoryView":551 - * info.obj = self - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 551, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_memoryview_type); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_11); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.voro.calcCN", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "View.MemoryView":997 - * return self.from_object - * - * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< - * +/* "newanalysis/voro/voro.pyx":257 + * cres[ctr]+=1 * + * def calcCN_int8(np.ndarray[np.int8_t,ndim=2] ds, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=1] result, + * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 997, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyType_Modified(__pyx_memoryviewslice_type); - - /* "(tree fragment)":1 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * cdef object __pyx_PickleError - * cdef object __pyx_result - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "(tree fragment)":11 - * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) - * return __pyx_result - * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.name = __pyx_state[0] - * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): - */ - - /*--- Wrapped vars code ---*/ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init newanalysis.voro", __pyx_clineno, __pyx_lineno, __pyx_filename); +/* Python wrapper */ +static PyObject *__pyx_pw_11newanalysis_4voro_17calcCN_int8(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_11newanalysis_4voro_16calcCN_int8, "\n calcCN(ds,result,core_begin,core_end,surr_begin,surr_end,shell_begin,shell_end,ntot)\n\n Calculates the coordination number between two selections and adds the found value to a histogram.\n \n Args:\n ds .. delaunay distance matrix of the whole system\n result .. result histogram\n core_begin .. first residue number of the core selection\n core_end .. last residue number of the core selection\n surr_begin .. first residue number of the surround selection\n surr_end .. last residue number of the surround selection\n shell_begin .. lowest delaunay distance to consider\n shell_end .. highest delaunay distance to consider\n ntot .. total number of residues in the system (the number of columns in the ds matrix)\n "); +static PyMethodDef __pyx_mdef_11newanalysis_4voro_17calcCN_int8 = {"calcCN_int8", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_11newanalysis_4voro_17calcCN_int8, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_11newanalysis_4voro_16calcCN_int8}; +static PyObject *__pyx_pw_11newanalysis_4voro_17calcCN_int8(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyArrayObject *__pyx_v_ds = 0; + PyArrayObject *__pyx_v_result = 0; + PyObject *__pyx_v_core_begin = 0; + PyObject *__pyx_v_core_end = 0; + PyObject *__pyx_v_surr_begin = 0; + PyObject *__pyx_v_surr_end = 0; + PyObject *__pyx_v_shell_begin = 0; + PyObject *__pyx_v_shell_end = 0; + PyObject *__pyx_v_ntot = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("calcCN_int8 (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __pyx_nargs = PyTuple_Size(__pyx_args); + if (unlikely((__pyx_nargs < 0))) __PYX_ERR(0, 257, __pyx_L3_error) + #endif + #endif + __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ds,&__pyx_n_s_result,&__pyx_n_s_core_begin,&__pyx_n_s_core_end,&__pyx_n_s_surr_begin,&__pyx_n_s_surr_end,&__pyx_n_s_shell_begin,&__pyx_n_s_shell_end,&__pyx_n_s_ntot,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + CYTHON_FALLTHROUGH; + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + CYTHON_FALLTHROUGH; + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ds)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_result)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 1); __PYX_ERR(0, 257, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_core_begin)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 2); __PYX_ERR(0, 257, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_core_end)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 3); __PYX_ERR(0, 257, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_surr_begin)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 4); __PYX_ERR(0, 257, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_surr_end)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[5]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 5); __PYX_ERR(0, 257, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shell_begin)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[6]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 6); __PYX_ERR(0, 257, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shell_end)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[7]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 7); __PYX_ERR(0, 257, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ntot)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[8]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, 8); __PYX_ERR(0, 257, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "calcCN_int8") < 0)) __PYX_ERR(0, 257, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 9)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); + values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); + values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); + values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); + } + __pyx_v_ds = ((PyArrayObject *)values[0]); + __pyx_v_result = ((PyArrayObject *)values[1]); + __pyx_v_core_begin = values[2]; + __pyx_v_core_end = values[3]; + __pyx_v_surr_begin = values[4]; + __pyx_v_surr_end = values[5]; + __pyx_v_shell_begin = values[6]; + __pyx_v_shell_end = values[7]; + __pyx_v_ntot = values[8]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("calcCN_int8", 1, 9, 9, __pyx_nargs); __PYX_ERR(0, 257, __pyx_L3_error) + goto __pyx_L3_error; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("newanalysis.voro.calcCN_int8", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ds), __pyx_ptype_5numpy_ndarray, 1, "ds", 0))) __PYX_ERR(0, 257, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_5numpy_ndarray, 1, "result", 0))) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_r = __pyx_pf_11newanalysis_4voro_16calcCN_int8(__pyx_self, __pyx_v_ds, __pyx_v_result, __pyx_v_core_begin, __pyx_v_core_end, __pyx_v_surr_begin, __pyx_v_surr_end, __pyx_v_shell_begin, __pyx_v_shell_end, __pyx_v_ntot); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_11newanalysis_4voro_16calcCN_int8(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ds, PyArrayObject *__pyx_v_result, PyObject *__pyx_v_core_begin, PyObject *__pyx_v_core_end, PyObject *__pyx_v_surr_begin, PyObject *__pyx_v_surr_end, PyObject *__pyx_v_shell_begin, PyObject *__pyx_v_shell_end, PyObject *__pyx_v_ntot) { + int __pyx_v_c1; + int __pyx_v_c2; + int __pyx_v_s1; + int __pyx_v_s2; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_sh1; + int __pyx_v_sh2; + int __pyx_v_n; + char *__pyx_v_cds; + double *__pyx_v_cres; + int __pyx_v_ctr; + int __pyx_v_nmax; + __Pyx_LocalBuf_ND __pyx_pybuffernd_ds; + __Pyx_Buffer __pyx_pybuffer_ds; + __Pyx_LocalBuf_ND __pyx_pybuffernd_result; + __Pyx_Buffer __pyx_pybuffer_result; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + char *__pyx_t_2; + Py_ssize_t __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + long __pyx_t_6; + long __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("calcCN_int8", 0); + __pyx_pybuffer_ds.pybuffer.buf = NULL; + __pyx_pybuffer_ds.refcount = 0; + __pyx_pybuffernd_ds.data = NULL; + __pyx_pybuffernd_ds.rcbuffer = &__pyx_pybuffer_ds; + __pyx_pybuffer_result.pybuffer.buf = NULL; + __pyx_pybuffer_result.refcount = 0; + __pyx_pybuffernd_result.data = NULL; + __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ds.rcbuffer->pybuffer, (PyObject*)__pyx_v_ds, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 257, __pyx_L1_error) + } + __pyx_pybuffernd_ds.diminfo[0].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ds.diminfo[0].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ds.diminfo[1].strides = __pyx_pybuffernd_ds.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ds.diminfo[1].shape = __pyx_pybuffernd_ds.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 257, __pyx_L1_error) + } + __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; + + /* "newanalysis/voro/voro.pyx":278 + * """ + * + * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot # <<<<<<<<<<<<<< + * cdef char *cds = ds.data + * cdef double *cres = result.data + */ + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_core_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_v_c1 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_core_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_v_c2 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_surr_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_v_s1 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_surr_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_v_s2 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_shell_begin); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_v_sh1 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_shell_end); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_v_sh2 = __pyx_t_1; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_ntot); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_v_n = __pyx_t_1; + + /* "newanalysis/voro/voro.pyx":279 + * + * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot + * cdef char *cds = ds.data # <<<<<<<<<<<<<< + * cdef double *cres = result.data + * cdef int ctr, nmax=len(result) + */ + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_ds)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_v_cds = ((char *)__pyx_t_2); + + /* "newanalysis/voro/voro.pyx":280 + * cdef int c1=core_begin, c2=core_end, s1=surr_begin, s2=surr_end, i, j, sh1=shell_begin, sh2=shell_end, n=ntot + * cdef char *cds = ds.data + * cdef double *cres = result.data # <<<<<<<<<<<<<< + * cdef int ctr, nmax=len(result) + * + */ + __pyx_t_2 = __pyx_f_5numpy_7ndarray_4data_data(((PyArrayObject *)__pyx_v_result)); if (unlikely(__pyx_t_2 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 280, __pyx_L1_error) + __pyx_v_cres = ((double *)__pyx_t_2); + + /* "newanalysis/voro/voro.pyx":281 + * cdef char *cds = ds.data + * cdef double *cres = result.data + * cdef int ctr, nmax=len(result) # <<<<<<<<<<<<<< + * + * # e.g. c1=0, c2=499 + */ + __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_v_nmax = __pyx_t_3; + + /* "newanalysis/voro/voro.pyx":284 + * + * # e.g. c1=0, c2=499 + * for i in range(c1,c2+1): # <<<<<<<<<<<<<< + * ctr=0 + * for j in range(s1,s2+1): + */ + __pyx_t_4 = (__pyx_v_c2 + 1); + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_1 = __pyx_v_c1; __pyx_t_1 < __pyx_t_5; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; + + /* "newanalysis/voro/voro.pyx":285 + * # e.g. c1=0, c2=499 + * for i in range(c1,c2+1): + * ctr=0 # <<<<<<<<<<<<<< + * for j in range(s1,s2+1): + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: + */ + __pyx_v_ctr = 0; + + /* "newanalysis/voro/voro.pyx":286 + * for i in range(c1,c2+1): + * ctr=0 + * for j in range(s1,s2+1): # <<<<<<<<<<<<<< + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: + * ctr+=1 + */ + __pyx_t_6 = (__pyx_v_s2 + 1); + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = __pyx_v_s1; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_j = __pyx_t_8; + + /* "newanalysis/voro/voro.pyx":287 + * ctr=0 + * for j in range(s1,s2+1): + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: # <<<<<<<<<<<<<< + * ctr+=1 + * if ctr >= nmax: + */ + __pyx_t_10 = ((__pyx_v_cds[((__pyx_v_i * __pyx_v_n) + __pyx_v_j)]) >= __pyx_v_sh1); + if (__pyx_t_10) { + } else { + __pyx_t_9 = __pyx_t_10; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_10 = ((__pyx_v_cds[((__pyx_v_i * __pyx_v_n) + __pyx_v_j)]) <= __pyx_v_sh2); + __pyx_t_9 = __pyx_t_10; + __pyx_L8_bool_binop_done:; + if (__pyx_t_9) { + + /* "newanalysis/voro/voro.pyx":288 + * for j in range(s1,s2+1): + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: + * ctr+=1 # <<<<<<<<<<<<<< + * if ctr >= nmax: + * print("Result array is too short!\n") + */ + __pyx_v_ctr = (__pyx_v_ctr + 1); + + /* "newanalysis/voro/voro.pyx":287 + * ctr=0 + * for j in range(s1,s2+1): + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: # <<<<<<<<<<<<<< + * ctr+=1 + * if ctr >= nmax: + */ + } + } + + /* "newanalysis/voro/voro.pyx":289 + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: + * ctr+=1 + * if ctr >= nmax: # <<<<<<<<<<<<<< + * print("Result array is too short!\n") + * else: + */ + __pyx_t_9 = (__pyx_v_ctr >= __pyx_v_nmax); + if (__pyx_t_9) { + + /* "newanalysis/voro/voro.pyx":290 + * ctr+=1 + * if ctr >= nmax: + * print("Result array is too short!\n") # <<<<<<<<<<<<<< + * else: + * cres[ctr]+=1 + */ + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "newanalysis/voro/voro.pyx":289 + * if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: + * ctr+=1 + * if ctr >= nmax: # <<<<<<<<<<<<<< + * print("Result array is too short!\n") + * else: + */ + goto __pyx_L10; + } + + /* "newanalysis/voro/voro.pyx":292 + * print("Result array is too short!\n") + * else: + * cres[ctr]+=1 # <<<<<<<<<<<<<< + * + */ + /*else*/ { + __pyx_t_8 = __pyx_v_ctr; + (__pyx_v_cres[__pyx_t_8]) = ((__pyx_v_cres[__pyx_t_8]) + 1.0); + } + __pyx_L10:; + } + + /* "newanalysis/voro/voro.pyx":257 + * cres[ctr]+=1 + * + * def calcCN_int8(np.ndarray[np.int8_t,ndim=2] ds, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=1] result, + * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_11); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("newanalysis.voro.calcCN_int8", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ds.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_array __pyx_vtable_array; + +static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_array_obj *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_array_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_array; + p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_array(PyObject *o) { + struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_array) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_array___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->mode); + Py_CLEAR(p->_format); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} +static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_array___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) { + PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_array___getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o); +} + +static PyMethodDef __pyx_methods_array[] = { + {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_array_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_array[] = { + {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_array_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_array}, + {Py_sq_length, (void *)__pyx_array___len__}, + {Py_sq_item, (void *)__pyx_sq_item_array}, + {Py_mp_length, (void *)__pyx_array___len__}, + {Py_mp_subscript, (void *)__pyx_array___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_array}, + {Py_tp_getattro, (void *)__pyx_tp_getattro_array}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_array_getbuffer}, + #endif + {Py_tp_methods, (void *)__pyx_methods_array}, + {Py_tp_getset, (void *)__pyx_getsets_array}, + {Py_tp_new, (void *)__pyx_tp_new_array}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_array_spec = { + "newanalysis.voro.array", + sizeof(struct __pyx_array_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_array_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_array = { + __pyx_array___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_array, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_array = { + __pyx_array___len__, /*mp_length*/ + __pyx_array___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_array = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_array_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_array = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.voro.""array", /*tp_name*/ + sizeof(struct __pyx_array_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_array, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_array, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_array, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_array, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_array, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_array, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_array, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_MemviewEnum_obj *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_MemviewEnum_obj *)o); + p->name = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_Enum(PyObject *o) { + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_Enum) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->name); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} + +static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + if (p->name) { + e = (*v)(p->name, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_Enum(PyObject *o) { + PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + tmp = ((PyObject*)p->name); + p->name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_specialmethod___pyx_MemviewEnum___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_MemviewEnum___repr__(self); +} + +static PyMethodDef __pyx_methods_Enum[] = { + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_MemviewEnum___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_MemviewEnum_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_Enum}, + {Py_tp_repr, (void *)__pyx_MemviewEnum___repr__}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_Enum}, + {Py_tp_clear, (void *)__pyx_tp_clear_Enum}, + {Py_tp_methods, (void *)__pyx_methods_Enum}, + {Py_tp_init, (void *)__pyx_MemviewEnum___init__}, + {Py_tp_new, (void *)__pyx_tp_new_Enum}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_MemviewEnum_spec = { + "newanalysis.voro.Enum", + sizeof(struct __pyx_MemviewEnum_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_MemviewEnum_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_MemviewEnum = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.voro.""Enum", /*tp_name*/ + sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_Enum, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_MemviewEnum___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_Enum, /*tp_traverse*/ + __pyx_tp_clear_Enum, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_Enum, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + __pyx_MemviewEnum___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_Enum, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; + +static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryview_obj *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_memoryview_obj *)o); + p->__pyx_vtab = __pyx_vtabptr_memoryview; + p->obj = Py_None; Py_INCREF(Py_None); + p->_size = Py_None; Py_INCREF(Py_None); + p->_array_interface = Py_None; Py_INCREF(Py_None); + p->view.obj = NULL; + if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_memoryview(PyObject *o) { + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_memoryview) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_memoryview___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->obj); + Py_CLEAR(p->_size); + Py_CLEAR(p->_array_interface); + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} + +static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + if (p->obj) { + e = (*v)(p->obj, a); if (e) return e; + } + if (p->_size) { + e = (*v)(p->_size, a); if (e) return e; + } + if (p->_array_interface) { + e = (*v)(p->_array_interface, a); if (e) return e; + } + if (p->view.obj) { + e = (*v)(p->view.obj, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_memoryview(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + tmp = ((PyObject*)p->obj); + p->obj = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_size); + p->_size = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_array_interface); + p->_array_interface = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + Py_CLEAR(p->view.obj); + return 0; +} +static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_memoryview___setitem__(o, i, v); + } + else { + __Pyx_TypeName o_type_name; + o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by " __Pyx_FMT_TYPENAME, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + return -1; + } +} + +static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o); +} + +static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o); +} + +static PyObject *__pyx_specialmethod___pyx_memoryview___repr__(PyObject *self, CYTHON_UNUSED PyObject *arg) { + return __pyx_memoryview___repr__(self); +} + +static PyMethodDef __pyx_methods_memoryview[] = { + {"__repr__", (PyCFunction)__pyx_specialmethod___pyx_memoryview___repr__, METH_NOARGS|METH_COEXIST, 0}, + {"is_c_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_c_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"is_f_contig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_is_f_contig, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"copy_fortran", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_memoryview_copy_fortran, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryview_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_memoryview[] = { + {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0}, + {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0}, + {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0}, + {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0}, + {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0}, + {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0}, + {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0}, + {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0}, + {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +#if !CYTHON_COMPILING_IN_LIMITED_API + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; +#endif +static PyType_Slot __pyx_type___pyx_memoryview_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_memoryview}, + {Py_tp_repr, (void *)__pyx_memoryview___repr__}, + {Py_sq_length, (void *)__pyx_memoryview___len__}, + {Py_sq_item, (void *)__pyx_sq_item_memoryview}, + {Py_mp_length, (void *)__pyx_memoryview___len__}, + {Py_mp_subscript, (void *)__pyx_memoryview___getitem__}, + {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_memoryview}, + {Py_tp_str, (void *)__pyx_memoryview___str__}, + #if defined(Py_bf_getbuffer) + {Py_bf_getbuffer, (void *)__pyx_memoryview_getbuffer}, + #endif + {Py_tp_traverse, (void *)__pyx_tp_traverse_memoryview}, + {Py_tp_clear, (void *)__pyx_tp_clear_memoryview}, + {Py_tp_methods, (void *)__pyx_methods_memoryview}, + {Py_tp_getset, (void *)__pyx_getsets_memoryview}, + {Py_tp_new, (void *)__pyx_tp_new_memoryview}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryview_spec = { + "newanalysis.voro.memoryview", + sizeof(struct __pyx_memoryview_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type___pyx_memoryview_slots, +}; +#else + +static PySequenceMethods __pyx_tp_as_sequence_memoryview = { + __pyx_memoryview___len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_memoryview, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_memoryview = { + __pyx_memoryview___len__, /*mp_length*/ + __pyx_memoryview___getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_memoryview = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + __pyx_memoryview_getbuffer, /*bf_getbuffer*/ + 0, /*bf_releasebuffer*/ +}; + +static PyTypeObject __pyx_type___pyx_memoryview = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.voro.""memoryview", /*tp_name*/ + sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_memoryview, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_memoryview___repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_memoryview___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_memoryview, /*tp_traverse*/ + __pyx_tp_clear_memoryview, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_memoryview, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_memoryview, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_memoryview, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif +static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; + +static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_memoryviewslice_obj *p; + PyObject *o = __pyx_tp_new_memoryview(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_memoryviewslice_obj *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice; + new((void*)&(p->from_slice)) __Pyx_memviewslice(); + p->from_object = Py_None; Py_INCREF(Py_None); + p->from_slice.memview = NULL; + return o; +} + +static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc__memoryviewslice) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); + __pyx_memoryviewslice___dealloc__(o); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); + PyErr_Restore(etype, eval, etb); + } + __Pyx_call_destructor(p->from_slice); + Py_CLEAR(p->from_object); + PyObject_GC_Track(o); + __pyx_tp_dealloc_memoryview(o); +} + +static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e; + if (p->from_object) { + e = (*v)(p->from_object, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear__memoryviewslice(PyObject *o) { + PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + __pyx_tp_clear_memoryview(o); + tmp = ((PyObject*)p->from_object); + p->from_object = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + __PYX_XCLEAR_MEMVIEW(&p->from_slice, 1); + return 0; +} + +static PyMethodDef __pyx_methods__memoryviewslice[] = { + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type___pyx_memoryviewslice_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc__memoryviewslice}, + {Py_tp_doc, (void *)PyDoc_STR("Internal class for passing memoryview slices to Python")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse__memoryviewslice}, + {Py_tp_clear, (void *)__pyx_tp_clear__memoryviewslice}, + {Py_tp_methods, (void *)__pyx_methods__memoryviewslice}, + {Py_tp_new, (void *)__pyx_tp_new__memoryviewslice}, + {0, 0}, +}; +static PyType_Spec __pyx_type___pyx_memoryviewslice_spec = { + "newanalysis.voro._memoryviewslice", + sizeof(struct __pyx_memoryviewslice_obj), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, + __pyx_type___pyx_memoryviewslice_slots, +}; +#else + +static PyTypeObject __pyx_type___pyx_memoryviewslice = { + PyVarObject_HEAD_INIT(0, 0) + "newanalysis.voro.""_memoryviewslice", /*tp_name*/ + sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY || 0 + __pyx_memoryview___str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_SEQUENCE, /*tp_flags*/ + PyDoc_STR("Internal class for passing memoryview slices to Python"), /*tp_doc*/ + __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/ + __pyx_tp_clear__memoryviewslice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods__memoryviewslice, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS + 0, /*tp_dictoffset*/ + #endif + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new__memoryviewslice, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, /*tp_vectorcall*/ + #endif + #if __PYX_NEED_TP_PRINT_SLOT == 1 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif +}; +#endif + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, + {&__pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_k_All_dimensions_preceding_dimensi, sizeof(__pyx_k_All_dimensions_preceding_dimensi), 0, 0, 1, 0}, + {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1}, + {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, + {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1}, + {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0}, + {&__pyx_kp_u_Cannot_index_with_type, __pyx_k_Cannot_index_with_type, sizeof(__pyx_k_Cannot_index_with_type), 0, 1, 0, 0}, + {&__pyx_kp_s_Cannot_transpose_memoryview_with, __pyx_k_Cannot_transpose_memoryview_with, sizeof(__pyx_k_Cannot_transpose_memoryview_with), 0, 0, 1, 0}, + {&__pyx_kp_s_Dimension_d_is_not_direct, __pyx_k_Dimension_d_is_not_direct, sizeof(__pyx_k_Dimension_d_is_not_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_ERROR_Either_pass_vols_AND_fa_or, __pyx_k_ERROR_Either_pass_vols_AND_fa_or, sizeof(__pyx_k_ERROR_Either_pass_vols_AND_fa_or), 0, 0, 1, 0}, + {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, + {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, + {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_k_Index_out_of_bounds_axis_d, sizeof(__pyx_k_Index_out_of_bounds_axis_d), 0, 0, 1, 0}, + {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, + {&__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 1, 0, 0}, + {&__pyx_kp_u_Invalid_shape_in_axis, __pyx_k_Invalid_shape_in_axis, sizeof(__pyx_k_Invalid_shape_in_axis), 0, 1, 0, 0}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, + {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, + {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, + {&__pyx_kp_u_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 1, 0, 0}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, + {&__pyx_kp_s_Result_array_is_too_short, __pyx_k_Result_array_is_too_short, sizeof(__pyx_k_Result_array_is_too_short), 0, 0, 1, 0}, + {&__pyx_n_s_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 0, 1, 1}, + {&__pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_k_Step_may_not_be_zero_axis_d, sizeof(__pyx_k_Step_may_not_be_zero_axis_d), 0, 0, 1, 0}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, + {&__pyx_kp_s_Unknown_string_type, __pyx_k_Unknown_string_type, sizeof(__pyx_k_Unknown_string_type), 0, 0, 1, 0}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1}, + {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, + {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1}, + {&__pyx_n_s__45, __pyx_k__45, sizeof(__pyx_k__45), 0, 0, 1, 1}, + {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, + {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, + {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, + {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, + {&__pyx_kp_u_and, __pyx_k_and, sizeof(__pyx_k_and), 0, 1, 0, 0}, + {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, + {&__pyx_n_s_box_x, __pyx_k_box_x, sizeof(__pyx_k_box_x), 0, 0, 1, 1}, + {&__pyx_n_s_box_y, __pyx_k_box_y, sizeof(__pyx_k_box_y), 0, 0, 1, 1}, + {&__pyx_n_s_box_z, __pyx_k_box_z, sizeof(__pyx_k_box_z), 0, 0, 1, 1}, + {&__pyx_n_s_boxl, __pyx_k_boxl, sizeof(__pyx_k_boxl), 0, 0, 1, 1}, + {&__pyx_n_s_boxl_x, __pyx_k_boxl_x, sizeof(__pyx_k_boxl_x), 0, 0, 1, 1}, + {&__pyx_n_s_boxl_y, __pyx_k_boxl_y, sizeof(__pyx_k_boxl_y), 0, 0, 1, 1}, + {&__pyx_n_s_boxl_z, __pyx_k_boxl_z, sizeof(__pyx_k_boxl_z), 0, 0, 1, 1}, + {&__pyx_n_s_boxlength, __pyx_k_boxlength, sizeof(__pyx_k_boxlength), 0, 0, 1, 1}, + {&__pyx_n_s_buildNeighborList, __pyx_k_buildNeighborList, sizeof(__pyx_k_buildNeighborList), 0, 0, 1, 1}, + {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, + {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, + {&__pyx_n_s_c1, __pyx_k_c1, sizeof(__pyx_k_c1), 0, 0, 1, 1}, + {&__pyx_n_s_c2, __pyx_k_c2, sizeof(__pyx_k_c2), 0, 0, 1, 1}, + {&__pyx_n_s_calcCN, __pyx_k_calcCN, sizeof(__pyx_k_calcCN), 0, 0, 1, 1}, + {&__pyx_n_s_calcCN_int8, __pyx_k_calcCN_int8, sizeof(__pyx_k_calcCN_int8), 0, 0, 1, 1}, + {&__pyx_n_s_calcTessellation, __pyx_k_calcTessellation, sizeof(__pyx_k_calcTessellation), 0, 0, 1, 1}, + {&__pyx_n_s_calcTessellationParallel, __pyx_k_calcTessellationParallel, sizeof(__pyx_k_calcTessellationParallel), 0, 0, 1, 1}, + {&__pyx_n_s_calcTessellationParallelAll, __pyx_k_calcTessellationParallelAll, sizeof(__pyx_k_calcTessellationParallelAll), 0, 0, 1, 1}, + {&__pyx_n_s_calcTessellationVolSurfAtomic, __pyx_k_calcTessellationVolSurfAtomic, sizeof(__pyx_k_calcTessellationVolSurfAtomic), 0, 0, 1, 1}, + {&__pyx_n_s_ccorelist, __pyx_k_ccorelist, sizeof(__pyx_k_ccorelist), 0, 0, 1, 1}, + {&__pyx_n_s_cds, __pyx_k_cds, sizeof(__pyx_k_cds), 0, 0, 1, 1}, + {&__pyx_n_s_cf2c, __pyx_k_cf2c, sizeof(__pyx_k_cf2c), 0, 0, 1, 1}, + {&__pyx_n_s_cfa, __pyx_k_cfa, sizeof(__pyx_k_cfa), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, + {&__pyx_kp_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 0}, + {&__pyx_n_s_color_id, __pyx_k_color_id, sizeof(__pyx_k_color_id), 0, 0, 1, 1}, + {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, + {&__pyx_n_s_core_begin, __pyx_k_core_begin, sizeof(__pyx_k_core_begin), 0, 0, 1, 1}, + {&__pyx_n_s_core_end, __pyx_k_core_end, sizeof(__pyx_k_core_end), 0, 0, 1, 1}, + {&__pyx_n_s_core_first, __pyx_k_core_first, sizeof(__pyx_k_core_first), 0, 0, 1, 1}, + {&__pyx_n_s_core_last, __pyx_k_core_last, sizeof(__pyx_k_core_last), 0, 0, 1, 1}, + {&__pyx_n_s_corelist, __pyx_k_corelist, sizeof(__pyx_k_corelist), 0, 0, 1, 1}, + {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, + {&__pyx_n_s_cres, __pyx_k_cres, sizeof(__pyx_k_cres), 0, 0, 1, 1}, + {&__pyx_n_s_csurrlist, __pyx_k_csurrlist, sizeof(__pyx_k_csurrlist), 0, 0, 1, 1}, + {&__pyx_n_s_ctr, __pyx_k_ctr, sizeof(__pyx_k_ctr), 0, 0, 1, 1}, + {&__pyx_n_s_cts, __pyx_k_cts, sizeof(__pyx_k_cts), 0, 0, 1, 1}, + {&__pyx_n_s_cvols, __pyx_k_cvols, sizeof(__pyx_k_cvols), 0, 0, 1, 1}, + {&__pyx_n_s_cxyz, __pyx_k_cxyz, sizeof(__pyx_k_cxyz), 0, 0, 1, 1}, + {&__pyx_n_s_cylinder_radius, __pyx_k_cylinder_radius, sizeof(__pyx_k_cylinder_radius), 0, 0, 1, 1}, + {&__pyx_n_s_dataset, __pyx_k_dataset, sizeof(__pyx_k_dataset), 0, 0, 1, 1}, + {&__pyx_n_s_delaunay, __pyx_k_delaunay, sizeof(__pyx_k_delaunay), 0, 0, 1, 1}, + {&__pyx_n_s_delaunay_tmp, __pyx_k_delaunay_tmp, sizeof(__pyx_k_delaunay_tmp), 0, 0, 1, 1}, + {&__pyx_n_s_delaunay_ts, __pyx_k_delaunay_ts, sizeof(__pyx_k_delaunay_ts), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1}, + {&__pyx_n_s_drawTessellation, __pyx_k_drawTessellation, sizeof(__pyx_k_drawTessellation), 0, 0, 1, 1}, + {&__pyx_n_s_draw_triangles, __pyx_k_draw_triangles, sizeof(__pyx_k_draw_triangles), 0, 0, 1, 1}, + {&__pyx_n_s_ds, __pyx_k_ds, sizeof(__pyx_k_ds), 0, 0, 1, 1}, + {&__pyx_n_s_ds_ts, __pyx_k_ds_ts, sizeof(__pyx_k_ds_ts), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, + {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, + {&__pyx_n_s_f2c, __pyx_k_f2c, sizeof(__pyx_k_f2c), 0, 0, 1, 1}, + {&__pyx_n_s_fa, __pyx_k_fa, sizeof(__pyx_k_fa), 0, 0, 1, 1}, + {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1}, + {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, + {&__pyx_n_s_fn, __pyx_k_fn, sizeof(__pyx_k_fn), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, + {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_kp_u_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 1, 0, 0}, + {&__pyx_kp_u_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 1, 0, 0}, + {&__pyx_n_s_h5file, __pyx_k_h5file, sizeof(__pyx_k_h5file), 0, 0, 1, 1}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_icore, __pyx_k_icore, sizeof(__pyx_k_icore), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1}, + {&__pyx_n_s_ires, __pyx_k_ires, sizeof(__pyx_k_ires), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_isurr, __pyx_k_isurr, sizeof(__pyx_k_isurr), 0, 0, 1, 1}, + {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, + {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, + {&__pyx_n_s_iubq, __pyx_k_iubq, sizeof(__pyx_k_iubq), 0, 0, 1, 1}, + {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, + {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, + {&__pyx_n_s_len_points_to_draw, __pyx_k_len_points_to_draw, sizeof(__pyx_k_len_points_to_draw), 0, 0, 1, 1}, + {&__pyx_n_s_len_xyz, __pyx_k_len_xyz, sizeof(__pyx_k_len_xyz), 0, 0, 1, 1}, + {&__pyx_n_s_lower_limit, __pyx_k_lower_limit, sizeof(__pyx_k_lower_limit), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_maxsh, __pyx_k_maxsh, sizeof(__pyx_k_maxsh), 0, 0, 1, 1}, + {&__pyx_n_s_maxshell, __pyx_k_maxshell, sizeof(__pyx_k_maxshell), 0, 0, 1, 1}, + {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, + {&__pyx_n_s_mindist, __pyx_k_mindist, sizeof(__pyx_k_mindist), 0, 0, 1, 1}, + {&__pyx_n_s_minshell, __pyx_k_minshell, sizeof(__pyx_k_minshell), 0, 0, 1, 1}, + {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, + {&__pyx_n_s_n2, __pyx_k_n2, sizeof(__pyx_k_n2), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_s_nat, __pyx_k_nat, sizeof(__pyx_k_nat), 0, 0, 1, 1}, + {&__pyx_n_s_natoms, __pyx_k_natoms, sizeof(__pyx_k_natoms), 0, 0, 1, 1}, + {&__pyx_n_s_ncore, __pyx_k_ncore, sizeof(__pyx_k_ncore), 0, 0, 1, 1}, + {&__pyx_n_s_ncpu, __pyx_k_ncpu, sizeof(__pyx_k_ncpu), 0, 0, 1, 1}, + {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_s_nearestNeighbor, __pyx_k_nearestNeighbor, sizeof(__pyx_k_nearestNeighbor), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_n_s_newanalysis_voro, __pyx_k_newanalysis_voro, sizeof(__pyx_k_newanalysis_voro), 0, 0, 1, 1}, + {&__pyx_kp_s_newanalysis_voro_voro_pyx, __pyx_k_newanalysis_voro_voro_pyx, sizeof(__pyx_k_newanalysis_voro_voro_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_nmax, __pyx_k_nmax, sizeof(__pyx_k_nmax), 0, 0, 1, 1}, + {&__pyx_n_s_nmol, __pyx_k_nmol, sizeof(__pyx_k_nmol), 0, 0, 1, 1}, + {&__pyx_n_s_nmolecules, __pyx_k_nmolecules, sizeof(__pyx_k_nmolecules), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, + {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_nsurr, __pyx_k_nsurr, sizeof(__pyx_k_nsurr), 0, 0, 1, 1}, + {&__pyx_n_s_ntot, __pyx_k_ntot, sizeof(__pyx_k_ntot), 0, 0, 1, 1}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, + {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, + {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, + {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1}, + {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_points_ptr, __pyx_k_points_ptr, sizeof(__pyx_k_points_ptr), 0, 0, 1, 1}, + {&__pyx_n_s_points_to_draw, __pyx_k_points_to_draw, sizeof(__pyx_k_points_to_draw), 0, 0, 1, 1}, + {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, + {&__pyx_n_s_py_byte_string, __pyx_k_py_byte_string, sizeof(__pyx_k_py_byte_string), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_radius, __pyx_k_radius, sizeof(__pyx_k_radius), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_register, __pyx_k_register, sizeof(__pyx_k_register), 0, 0, 1, 1}, + {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, + {&__pyx_n_s_s1, __pyx_k_s1, sizeof(__pyx_k_s1), 0, 0, 1, 1}, + {&__pyx_n_s_s2, __pyx_k_s2, sizeof(__pyx_k_s2), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_sh1, __pyx_k_sh1, sizeof(__pyx_k_sh1), 0, 0, 1, 1}, + {&__pyx_n_s_sh2, __pyx_k_sh2, sizeof(__pyx_k_sh2), 0, 0, 1, 1}, + {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_shell_begin, __pyx_k_shell_begin, sizeof(__pyx_k_shell_begin), 0, 0, 1, 1}, + {&__pyx_n_s_shell_end, __pyx_k_shell_end, sizeof(__pyx_k_shell_end), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, + {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, + {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_n_s_surr_begin, __pyx_k_surr_begin, sizeof(__pyx_k_surr_begin), 0, 0, 1, 1}, + {&__pyx_n_s_surr_end, __pyx_k_surr_end, sizeof(__pyx_k_surr_end), 0, 0, 1, 1}, + {&__pyx_n_s_surr_first, __pyx_k_surr_first, sizeof(__pyx_k_surr_first), 0, 0, 1, 1}, + {&__pyx_n_s_surr_last, __pyx_k_surr_last, sizeof(__pyx_k_surr_last), 0, 0, 1, 1}, + {&__pyx_n_s_surroundlist, __pyx_k_surroundlist, sizeof(__pyx_k_surroundlist), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_triangles, __pyx_k_triangles, sizeof(__pyx_k_triangles), 0, 0, 1, 1}, + {&__pyx_n_s_ts, __pyx_k_ts, sizeof(__pyx_k_ts), 0, 0, 1, 1}, + {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, + {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, + {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_upper_limit, __pyx_k_upper_limit, sizeof(__pyx_k_upper_limit), 0, 0, 1, 1}, + {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, + {&__pyx_n_s_vols, __pyx_k_vols, sizeof(__pyx_k_vols), 0, 0, 1, 1}, + {&__pyx_n_s_xyz, __pyx_k_xyz, sizeof(__pyx_k_xyz), 0, 0, 1, 1}, + {&__pyx_n_s_xyz_ptr, __pyx_k_xyz_ptr, sizeof(__pyx_k_xyz_ptr), 0, 0, 1, 1}, + {&__pyx_n_s_xyz_ts, __pyx_k_xyz_ts, sizeof(__pyx_k_xyz_ts), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 34, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 100, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 141, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 156, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 159, __pyx_L1_error) + __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(1, 373, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 408, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 618, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 914, __pyx_L1_error) + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 983, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cached_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "View.MemoryView":582 + * def suboffsets(self): + * if self.view.suboffsets == NULL: + * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< + * + * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) + */ + __pyx_tuple__4 = PyTuple_New(1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_tuple__4, 0, __pyx_int_neg_1)) __PYX_ERR(1, 582, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_tuple__4); + + /* "View.MemoryView":679 + * tup = index if isinstance(index, tuple) else (index,) + * + * result = [slice(None)] * ndim # <<<<<<<<<<<<<< + * have_slices = False + * seen_ellipsis = False + */ + __pyx_slice__5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__5)) __PYX_ERR(1, 679, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__5); + __Pyx_GIVEREF(__pyx_slice__5); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum not in (0x82a3537, 0x6ae9995, 0xb068931): # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))" % __pyx_checksum + */ + __pyx_tuple__8 = PyTuple_Pack(3, __pyx_int_136983863, __pyx_int_112105877, __pyx_int_184977713); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":983 + * __pyx_import_array() + * except Exception: + * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_umath() except -1: + */ + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + + /* "../miniconda3/envs/cy30/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":989 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + * + * cdef inline int import_ufunc() except -1: + */ + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 989, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + + /* "newanalysis/voro/voro.pyx":34 + * return unicode(s) + * else: + * raise TypeError("Unknown string type!") # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Unknown_string_type); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + + /* "newanalysis/voro/voro.pyx":89 + * cdef int i, j, nsurr, ncore = len(corelist), mindist, dist, icore, isurr + * if (vols is not None and fa is None) or (vols is None and fa is not None): + * print("ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!") # <<<<<<<<<<<<<< + * if vols is not None: + * cvols = vols.data + */ + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_ERROR_Either_pass_vols_AND_fa_or); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + + /* "newanalysis/voro/voro.pyx":253 + * ctr+=1 + * if ctr >= nmax: + * print("Result array is too short!\n") # <<<<<<<<<<<<<< + * else: + * cres[ctr]+=1 + */ + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Result_array_is_too_short); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 253, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_sys); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_tuple__15 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + */ + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_collections_abc); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * + */ + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_collections); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + + /* "View.MemoryView":309 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") + */ + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * + */ + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * + */ + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_tuple__23 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "newanalysis/voro/voro.pyx":36 + * raise TypeError("Unknown string type!") + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, float boxlength, + * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, + */ + __pyx_tuple__25 = PyTuple_Pack(32, __pyx_n_s_xyz, __pyx_n_s_boxlength, __pyx_n_s_f2c, __pyx_n_s_natoms, __pyx_n_s_nmolecules, __pyx_n_s_maxshell, __pyx_n_s_corelist, __pyx_n_s_vols, __pyx_n_s_fa, __pyx_n_s_ds_ts, __pyx_n_s_ts, __pyx_n_s_ires, __pyx_n_s_surroundlist, __pyx_n_s_h5file, __pyx_n_s_delaunay, __pyx_n_s_cds, __pyx_n_s_cts, __pyx_n_s_cxyz, __pyx_n_s_cf2c, __pyx_n_s_ccorelist, __pyx_n_s_csurrlist, __pyx_n_s_cvols, __pyx_n_s_cfa, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_nsurr, __pyx_n_s_ncore, __pyx_n_s_mindist, __pyx_n_s_dist, __pyx_n_s_icore, __pyx_n_s_isurr, __pyx_n_s_dataset); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(14, 0, 0, 32, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_voro_voro_pyx, __pyx_n_s_calcTessellation, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_tuple__27 = PyTuple_Pack(7, Py_None, Py_None, Py_None, Py_None, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + + /* "newanalysis/voro/voro.pyx":125 + * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] + * + * def calcTessellationVolSurfAtomic(double [:,:] xyz, float boxlength, # <<<<<<<<<<<<<< + * int [:] f2c, int natoms, int nmolecules, int maxshell, + * int [:] corelist, float [:] vols, float [:] fa): + */ + __pyx_tuple__28 = PyTuple_Pack(10, __pyx_n_s_xyz, __pyx_n_s_boxlength, __pyx_n_s_f2c, __pyx_n_s_natoms, __pyx_n_s_nmolecules, __pyx_n_s_maxshell, __pyx_n_s_corelist, __pyx_n_s_vols, __pyx_n_s_fa, __pyx_n_s_delaunay); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_voro_voro_pyx, __pyx_n_s_calcTessellationVolSurfAtomic, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 125, __pyx_L1_error) + + /* "newanalysis/voro/voro.pyx":136 + * return np.asarray(delaunay) + * + * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< + * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) + */ + __pyx_tuple__30 = PyTuple_Pack(16, __pyx_n_s_xyz_ts, __pyx_n_s_f2c, __pyx_n_s_corelist, __pyx_n_s_surroundlist, __pyx_n_s_delaunay_ts, __pyx_n_s_boxlength, __pyx_n_s_natoms, __pyx_n_s_nmolecules, __pyx_n_s_maxshell, __pyx_n_s_nat, __pyx_n_s_nmol, __pyx_n_s_maxsh, __pyx_n_s_ncore, __pyx_n_s_nsurr, __pyx_n_s_ncpu, __pyx_n_s_boxl); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_voro_voro_pyx, __pyx_n_s_calcTessellationParallel, 136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 136, __pyx_L1_error) + + /* "newanalysis/voro/voro.pyx":143 + * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) + * + * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< + * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) + */ + __pyx_tuple__32 = PyTuple_Pack(14, __pyx_n_s_xyz_ts, __pyx_n_s_f2c, __pyx_n_s_corelist, __pyx_n_s_delaunay_ts, __pyx_n_s_boxlength, __pyx_n_s_natoms, __pyx_n_s_nmolecules, __pyx_n_s_maxshell, __pyx_n_s_nat, __pyx_n_s_nmol, __pyx_n_s_maxsh, __pyx_n_s_ncore, __pyx_n_s_ncpu, __pyx_n_s_boxl); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_voro_voro_pyx, __pyx_n_s_calcTessellationParallelAll, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 143, __pyx_L1_error) + + /* "newanalysis/voro/voro.pyx":150 + * _calcTessellationParallelAll(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &(delaunay_ts[0,0,0]), boxl, nat, nmol, maxsh, ncore, ncpu) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def nearestNeighbor(int [:] corelist, int [:] surroundlist, char [:,:,:] delaunay_tmp, char [:,:,:] delaunay_ts, int iubq, int maxshell): + * cdef int icore, isurr, c, j, k, nsurr = len(surroundlist), ncore = len(corelist), ncpu = delaunay_tmp.shape[0] + */ + __pyx_tuple__34 = PyTuple_Pack(16, __pyx_n_s_corelist, __pyx_n_s_surroundlist, __pyx_n_s_delaunay_tmp, __pyx_n_s_delaunay_ts, __pyx_n_s_iubq, __pyx_n_s_maxshell, __pyx_n_s_icore, __pyx_n_s_isurr, __pyx_n_s_c, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_nsurr, __pyx_n_s_ncore, __pyx_n_s_ncpu, __pyx_n_s_dist, __pyx_n_s_mindist); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_voro_voro_pyx, __pyx_n_s_nearestNeighbor, 150, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 150, __pyx_L1_error) + + /* "newanalysis/voro/voro.pyx":166 + * delaunay_ts[c,iubq,j] = mindist + * + * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, # <<<<<<<<<<<<<< + * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, + * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): + */ + __pyx_tuple__36 = PyTuple_Pack(21, __pyx_n_s_xyz, __pyx_n_s_points_to_draw, __pyx_n_s_cylinder_radius, __pyx_n_s_triangles, __pyx_n_s_nmol, __pyx_n_s_color_id, __pyx_n_s_filename, __pyx_n_s_box_x, __pyx_n_s_box_y, __pyx_n_s_box_z, __pyx_n_s_len_xyz, __pyx_n_s_len_points_to_draw, __pyx_n_s_py_byte_string, __pyx_n_s_fn, __pyx_n_s_xyz_ptr, __pyx_n_s_points_ptr, __pyx_n_s_draw_triangles, __pyx_n_s_radius, __pyx_n_s_boxl_x, __pyx_n_s_boxl_y, __pyx_n_s_boxl_z); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(10, 0, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_voro_voro_pyx, __pyx_n_s_drawTessellation, 166, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_tuple__38 = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + + /* "newanalysis/voro/voro.pyx":194 + * _drawTessellation(xyz_ptr, boxl_x, boxl_y, boxl_z, len_xyz, points_ptr, len_points_to_draw, radius, draw_triangles, nmol, color_id, fn) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def buildNeighborList(np.ndarray[np.int32_t,ndim=2] ds, + * np.ndarray[np.int8_t,ndim=3] result, + */ + __pyx_tuple__39 = PyTuple_Pack(24, __pyx_n_s_ds, __pyx_n_s_result, __pyx_n_s_core_first, __pyx_n_s_core_last, __pyx_n_s_surr_first, __pyx_n_s_surr_last, __pyx_n_s_ctr, __pyx_n_s_minshell, __pyx_n_s_maxshell, __pyx_n_s_ncore, __pyx_n_s_nsurr, __pyx_n_s_n2, __pyx_n_s_ntot, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_cds, __pyx_n_s_cres, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_lower_limit, __pyx_n_s_upper_limit); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_voro_voro_pyx, __pyx_n_s_buildNeighborList, 194, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(2, ((PyObject *)__pyx_int_1), ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + + /* "newanalysis/voro/voro.pyx":220 + * cres[k*n2+i*ncore+j] = 1 + * + * def calcCN(np.ndarray[np.int32_t,ndim=2] ds, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=1] result, + * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): + */ + __pyx_tuple__42 = PyTuple_Pack(22, __pyx_n_s_ds, __pyx_n_s_result, __pyx_n_s_core_begin, __pyx_n_s_core_end, __pyx_n_s_surr_begin, __pyx_n_s_surr_end, __pyx_n_s_shell_begin, __pyx_n_s_shell_end, __pyx_n_s_ntot, __pyx_n_s_c1, __pyx_n_s_c2, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_sh1, __pyx_n_s_sh2, __pyx_n_s_n, __pyx_n_s_cds, __pyx_n_s_cres, __pyx_n_s_ctr, __pyx_n_s_nmax); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_voro_voro_pyx, __pyx_n_s_calcCN, 220, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 220, __pyx_L1_error) + + /* "newanalysis/voro/voro.pyx":257 + * cres[ctr]+=1 + * + * def calcCN_int8(np.ndarray[np.int8_t,ndim=2] ds, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=1] result, + * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): + */ + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_newanalysis_voro_voro_pyx, __pyx_n_s_calcCN_int8, 257, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + /* AssertionsEnabled.init */ + if (likely(__Pyx_init_assertions_enabled() == 0)); else + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + /* NumpyImportArray.init */ + /* + * Cython has automatically inserted a call to _import_array since + * you didn't include one when you cimported numpy. To disable this + * add the line + * numpy._import_array + */ +#ifdef NPY_FEATURE_VERSION +#ifndef NO_IMPORT_ARRAY +if (unlikely(_import_array() == -1)) { + PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import " + "(auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; " + "use 'numpy._import_array' to disable if you are certain you don't need it)."); +} +#endif +#endif + +if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) + + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_module ### */ + +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __pyx_collections_abc_Sequence = Py_None; Py_INCREF(Py_None); + generic = Py_None; Py_INCREF(Py_None); + strided = Py_None; Py_INCREF(Py_None); + indirect = Py_None; Py_INCREF(Py_None); + contiguous = Py_None; Py_INCREF(Py_None); + indirect_contiguous = Py_None; Py_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_array = &__pyx_vtable_array; + __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; + #if CYTHON_USE_TYPE_SPECS + __pyx_array_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_array_spec, NULL); if (unlikely(!__pyx_array_type)) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_array_type->tp_as_buffer = &__pyx_tp_as_buffer_array; + if (!__pyx_array_type->tp_as_buffer->bf_releasebuffer && __pyx_array_type->tp_base->tp_as_buffer && __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_array_type->tp_as_buffer->bf_releasebuffer = __pyx_array_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_array_spec, __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #else + __pyx_array_type = &__pyx_type___pyx_array; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_array_type->tp_print = 0; + #endif + if (__Pyx_SetVtable(__pyx_array_type, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_array_type) < 0) __PYX_ERR(1, 114, __pyx_L1_error) + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_MemviewEnum_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_MemviewEnum_spec, NULL); if (unlikely(!__pyx_MemviewEnum_type)) __PYX_ERR(1, 302, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_MemviewEnum_spec, __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #else + __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_MemviewEnum_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_MemviewEnum_type->tp_dictoffset && __pyx_MemviewEnum_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_MemviewEnum_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_MemviewEnum_type) < 0) __PYX_ERR(1, 302, __pyx_L1_error) + #endif + __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; + __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; + __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice; + __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment; + __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar; + __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; + __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; + __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; + __pyx_vtable_memoryview._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryview__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_memoryview_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryview_spec, NULL); if (unlikely(!__pyx_memoryview_type)) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryview_type->tp_as_buffer = &__pyx_tp_as_buffer_memoryview; + if (!__pyx_memoryview_type->tp_as_buffer->bf_releasebuffer && __pyx_memoryview_type->tp_base->tp_as_buffer && __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer) { + __pyx_memoryview_type->tp_as_buffer->bf_releasebuffer = __pyx_memoryview_type->tp_base->tp_as_buffer->bf_releasebuffer; + } + #elif defined(Py_bf_getbuffer) && defined(Py_bf_releasebuffer) + /* PY_VERSION_HEX >= 0x03090000 || Py_LIMITED_API >= 0x030B0000 */ + #elif defined(_MSC_VER) + #pragma message ("The buffer protocol is not supported in the Limited C-API < 3.11.") + #else + #warning "The buffer protocol is not supported in the Limited C-API < 3.11." + #endif + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryview_spec, __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #else + __pyx_memoryview_type = &__pyx_type___pyx_memoryview; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryview_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryview_type->tp_dictoffset && __pyx_memoryview_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryview_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_memoryview_type, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryview_type) < 0) __PYX_ERR(1, 337, __pyx_L1_error) + #endif + __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; + __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; + __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; + __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; + __pyx_vtable__memoryviewslice.__pyx_base._get_base = (PyObject *(*)(struct __pyx_memoryview_obj *))__pyx_memoryviewslice__get_base; + #if CYTHON_USE_TYPE_SPECS + __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_memoryview_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 952, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_memoryviewslice_type = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type___pyx_memoryviewslice_spec, __pyx_t_1); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_memoryviewslice_type)) __PYX_ERR(1, 952, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type___pyx_memoryviewslice_spec, __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #else + __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + __pyx_memoryviewslice_type->tp_base = __pyx_memoryview_type; + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_memoryviewslice_type->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_memoryviewslice_type->tp_dictoffset && __pyx_memoryviewslice_type->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_memoryviewslice_type->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_memoryviewslice_type, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_memoryviewslice_type) < 0) __PYX_ERR(1, 952, __pyx_L1_error) + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_2(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyTypeObject), + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_5numpy_dtype = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArray_Descr),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 202, __pyx_L1_error) + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 225, __pyx_L1_error) + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayMultiIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 229, __pyx_L1_error) + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyArrayObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 238, __pyx_L1_error) + __pyx_ptype_5numpy_generic = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 809, __pyx_L1_error) + __pyx_ptype_5numpy_number = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 811, __pyx_L1_error) + __pyx_ptype_5numpy_integer = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 813, __pyx_L1_error) + __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 815, __pyx_L1_error) + __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 817, __pyx_L1_error) + __pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 819, __pyx_L1_error) + __pyx_ptype_5numpy_floating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 821, __pyx_L1_error) + __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 823, __pyx_L1_error) + __pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 825, __pyx_L1_error) + __pyx_ptype_5numpy_character = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_2); if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_0_2(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_2(PyUFuncObject),__Pyx_ImportType_CheckSize_Ignore_3_0_2); if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 865, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_voro(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_voro}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "voro", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void +#endif +#else +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initvoro(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initvoro(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_voro(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_voro(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else + result = PyDict_SetItemString(moddict, to_name, value); +#endif + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + if (__Pyx_check_single_interpreter()) + return NULL; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; +#endif + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_voro(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + static PyThread_type_lock __pyx_t_8[8]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'voro' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("voro", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to voro pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_voro(void)", 0); + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + PyEval_InitThreads(); + #endif + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_newanalysis__voro) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "newanalysis.voro")) { + if (unlikely((PyDict_SetItemString(modules, "newanalysis.voro", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_version_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_tuple__15, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 100, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + + /* "View.MemoryView":101 + * try: + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence # <<<<<<<<<<<<<< + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abc); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 101, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + + /* "View.MemoryView":100 + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: + * if __import__("sys").version_info >= (3, 3): # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + */ + goto __pyx_L8; + } + + /* "View.MemoryView":103 + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence # <<<<<<<<<<<<<< + * except: + * + */ + /*else*/ { + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 103, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L8:; + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "View.MemoryView":104 + * else: + * __pyx_collections_abc_Sequence = __import__("collections").Sequence + * except: # <<<<<<<<<<<<<< + * + * __pyx_collections_abc_Sequence = None + */ + /*except:*/ { + __Pyx_AddTraceback("View.MemoryView", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(1, 104, __pyx_L4_except_error) + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_7); + + /* "View.MemoryView":106 + * except: + * + * __pyx_collections_abc_Sequence = None # <<<<<<<<<<<<<< + * + * + */ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_collections_abc_Sequence); + __Pyx_DECREF_SET(__pyx_collections_abc_Sequence, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L3_exception_handled; + } + + /* "View.MemoryView":99 + * + * cdef object __pyx_collections_abc_Sequence "__pyx_collections_abc_Sequence" + * try: # <<<<<<<<<<<<<< + * if __import__("sys").version_info >= (3, 3): + * __pyx_collections_abc_Sequence = __import__("collections.abc").abc.Sequence + */ + __pyx_L4_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L7_try_end:; + } + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":242 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 242, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":243 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_array_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 243, __pyx_L11_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_array_type); + + /* "View.MemoryView":241 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L16_try_end; + __pyx_L11_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":244 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L12_exception_handled; + } + __pyx_L12_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L16_try_end:; + } + + /* "View.MemoryView":309 + * return self.name + * + * cdef generic = Enum("") # <<<<<<<<<<<<<< + * cdef strided = Enum("") # default + * cdef indirect = Enum("") + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(generic); + __Pyx_DECREF_SET(generic, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":310 + * + * cdef generic = Enum("") + * cdef strided = Enum("") # default # <<<<<<<<<<<<<< + * cdef indirect = Enum("") + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(strided); + __Pyx_DECREF_SET(strided, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":311 + * cdef generic = Enum("") + * cdef strided = Enum("") # default + * cdef indirect = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect); + __Pyx_DECREF_SET(indirect, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":314 + * + * + * cdef contiguous = Enum("") # <<<<<<<<<<<<<< + * cdef indirect_contiguous = Enum("") + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(contiguous); + __Pyx_DECREF_SET(contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":315 + * + * cdef contiguous = Enum("") + * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XGOTREF(indirect_contiguous); + __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "View.MemoryView":323 + * + * + * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ + * PyThread_allocate_lock(), + */ + __pyx_memoryview_thread_locks_used = 0; + + /* "View.MemoryView":324 + * + * cdef int __pyx_memoryview_thread_locks_used = 0 + * cdef PyThread_type_lock[8] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< + * PyThread_allocate_lock(), + * PyThread_allocate_lock(), + */ + __pyx_t_8[0] = PyThread_allocate_lock(); + __pyx_t_8[1] = PyThread_allocate_lock(); + __pyx_t_8[2] = PyThread_allocate_lock(); + __pyx_t_8[3] = PyThread_allocate_lock(); + __pyx_t_8[4] = PyThread_allocate_lock(); + __pyx_t_8[5] = PyThread_allocate_lock(); + __pyx_t_8[6] = PyThread_allocate_lock(); + __pyx_t_8[7] = PyThread_allocate_lock(); + memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_8, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); + + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "View.MemoryView":983 + * + * try: + * count = __pyx_collections_abc_Sequence.count # <<<<<<<<<<<<<< + * index = __pyx_collections_abc_Sequence.index + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_count); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_count, __pyx_t_7) < 0) __PYX_ERR(1, 983, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); + + /* "View.MemoryView":984 + * try: + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index # <<<<<<<<<<<<<< + * except: + * pass + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_SetItemOnTypeDict(__pyx_memoryviewslice_type, __pyx_n_s_index, __pyx_t_7) < 0) __PYX_ERR(1, 984, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + PyType_Modified(__pyx_memoryviewslice_type); + + /* "View.MemoryView":982 + * + * + * try: # <<<<<<<<<<<<<< + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L22_try_end; + __pyx_L17_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":985 + * count = __pyx_collections_abc_Sequence.count + * index = __pyx_collections_abc_Sequence.index + * except: # <<<<<<<<<<<<<< + * pass + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L18_exception_handled; + } + __pyx_L18_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_L22_try_end:; + } + + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + /*try:*/ { + + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_collections_abc_Sequence); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(1, 989, __pyx_L23_error) + if (__pyx_t_6) { + + /* "View.MemoryView":993 + * + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) # <<<<<<<<<<<<<< + * __pyx_collections_abc_Sequence.register(array) + * except: + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_memoryviewslice_type)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 993, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "View.MemoryView":994 + * + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) # <<<<<<<<<<<<<< + * except: + * pass # ignore failure, it's a minor issue + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_collections_abc_Sequence, __pyx_n_s_register); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_array_type)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 994, __pyx_L23_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":989 + * + * try: + * if __pyx_collections_abc_Sequence: # <<<<<<<<<<<<<< + * + * + */ + } + + /* "View.MemoryView":988 + * pass + * + * try: # <<<<<<<<<<<<<< + * if __pyx_collections_abc_Sequence: + * + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L28_try_end; + __pyx_L23_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "View.MemoryView":995 + * __pyx_collections_abc_Sequence.register(_memoryviewslice) + * __pyx_collections_abc_Sequence.register(array) + * except: # <<<<<<<<<<<<<< + * pass # ignore failure, it's a minor issue + * + */ + /*except:*/ { + __Pyx_ErrRestore(0,0,0); + goto __pyx_L24_exception_handled; + } + __pyx_L24_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_L28_try_end:; + } + + /* "(tree fragment)":1 + * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/voro/voro.pyx":4 + * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * + */ + __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_7) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/voro/voro.pyx":36 + * raise TypeError("Unknown string type!") + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def calcTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, float boxlength, + * np.ndarray[np.int32_t,ndim=1, mode="c"] f2c, natoms, nmolecules, maxshell, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_4voro_1calcTessellation, 0, __pyx_n_s_calcTessellation, NULL, __pyx_n_s_newanalysis_voro, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__27); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcTessellation, __pyx_t_7) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/voro/voro.pyx":125 + * cts[ts * nmolecules * nmolecules + nmolecules * j + i] = cds[j * nmolecules + i] + * + * def calcTessellationVolSurfAtomic(double [:,:] xyz, float boxlength, # <<<<<<<<<<<<<< + * int [:] f2c, int natoms, int nmolecules, int maxshell, + * int [:] corelist, float [:] vols, float [:] fa): + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_4voro_3calcTessellationVolSurfAtomic, 0, __pyx_n_s_calcTessellationVolSurfAtomic, NULL, __pyx_n_s_newanalysis_voro, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcTessellationVolSurfAtomic, __pyx_t_7) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/voro/voro.pyx":136 + * return np.asarray(delaunay) + * + * def calcTessellationParallel(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, int [:] surroundlist, char [:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< + * "calcTessellationParallel(xyz_ts,f2c,corelist,surroundlist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), nsurr = len(surroundlist), ncpu = len(delaunay_ts) + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_4voro_5calcTessellationParallel, 0, __pyx_n_s_calcTessellationParallel, NULL, __pyx_n_s_newanalysis_voro, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcTessellationParallel, __pyx_t_7) < 0) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/voro/voro.pyx":143 + * _calcTessellationParallel(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &surroundlist[0], &(delaunay_ts[0,0]), boxl, nat, nmol, maxsh, ncore, nsurr, ncpu) + * + * def calcTessellationParallelAll(double [:,:,:] xyz_ts, int [:] f2c, int [:] corelist, char [:,:,:] delaunay_ts, boxlength, natoms, nmolecules, maxshell): # <<<<<<<<<<<<<< + * "calcTessellationParallelAll(xyz_ts,f2c,corelist,delaunay_ts,boxl,nat,nmol,maxshell)" + * cdef int nat = natoms, nmol = nmolecules, maxsh = maxshell, ncore = len(corelist), ncpu = len(delaunay_ts) + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_4voro_7calcTessellationParallelAll, 0, __pyx_n_s_calcTessellationParallelAll, NULL, __pyx_n_s_newanalysis_voro, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcTessellationParallelAll, __pyx_t_7) < 0) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/voro/voro.pyx":150 + * _calcTessellationParallelAll(&(xyz_ts[0,0,0]), &f2c[0], &corelist[0], &(delaunay_ts[0,0,0]), boxl, nat, nmol, maxsh, ncore, ncpu) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def nearestNeighbor(int [:] corelist, int [:] surroundlist, char [:,:,:] delaunay_tmp, char [:,:,:] delaunay_ts, int iubq, int maxshell): + * cdef int icore, isurr, c, j, k, nsurr = len(surroundlist), ncore = len(corelist), ncpu = delaunay_tmp.shape[0] + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_4voro_9nearestNeighbor, 0, __pyx_n_s_nearestNeighbor, NULL, __pyx_n_s_newanalysis_voro, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_nearestNeighbor, __pyx_t_7) < 0) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/voro/voro.pyx":166 + * delaunay_ts[c,iubq,j] = mindist + * + * def drawTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, # <<<<<<<<<<<<<< + * np.ndarray[np.int32_t,ndim=1, mode="c"] points_to_draw, cylinder_radius, + * triangles, int nmol, int color_id, filename, box_x, box_y=None, box_z=None): + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_4voro_11drawTessellation, 0, __pyx_n_s_drawTessellation, NULL, __pyx_n_s_newanalysis_voro, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__38); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_drawTessellation, __pyx_t_7) < 0) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/voro/voro.pyx":194 + * _drawTessellation(xyz_ptr, boxl_x, boxl_y, boxl_z, len_xyz, points_ptr, len_points_to_draw, radius, draw_triangles, nmol, color_id, fn) + * + * @cython.boundscheck(False) # <<<<<<<<<<<<<< + * def buildNeighborList(np.ndarray[np.int32_t,ndim=2] ds, + * np.ndarray[np.int8_t,ndim=3] result, + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_4voro_13buildNeighborList, 0, __pyx_n_s_buildNeighborList, NULL, __pyx_n_s_newanalysis_voro, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__41); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_buildNeighborList, __pyx_t_7) < 0) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/voro/voro.pyx":220 + * cres[k*n2+i*ncore+j] = 1 + * + * def calcCN(np.ndarray[np.int32_t,ndim=2] ds, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=1] result, + * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_4voro_15calcCN, 0, __pyx_n_s_calcCN, NULL, __pyx_n_s_newanalysis_voro, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcCN, __pyx_t_7) < 0) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/voro/voro.pyx":257 + * cres[ctr]+=1 + * + * def calcCN_int8(np.ndarray[np.int8_t,ndim=2] ds, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t,ndim=1] result, + * core_begin, core_end, surr_begin, surr_end, shell_begin, shell_end, ntot): + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_11newanalysis_4voro_17calcCN_int8, 0, __pyx_n_s_calcCN_int8, NULL, __pyx_n_s_newanalysis_voro, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calcCN_int8, __pyx_t_7) < 0) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "newanalysis/voro/voro.pyx":1 + * # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; encoding: utf-8 -*- # <<<<<<<<<<<<<< + * # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + * + */ + __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + if (__pyx_m) { + if (__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init newanalysis.voro", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init newanalysis.voro"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) +} +#endif + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); // transfer ownership of value to values + Py_DECREF(key); +#endif + key = NULL; + value = NULL; + continue; + } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = ( + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key) + ); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + Py_XDECREF(key); + Py_XDECREF(value); + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + Py_XDECREF(key); + Py_XDECREF(value); + return -1; +} + +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } } - Py_CLEAR(__pyx_m); - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init newanalysis.voro"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; } - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; } #endif -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; } +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; #endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { + return NULL; + } + if ( #if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); + co->co_kwonlyargcount == 0 && #endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } } - return result; -} - -/* decode_c_bytes */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( - const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - if (unlikely((start < 0) | (stop < 0))) { - if (start < 0) { - start += length; - if (start < 0) - start = 0; + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; } - if (stop < 0) - stop += length; + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); } - if (stop > length) - stop = length; - if (unlikely(stop <= start)) - return __Pyx_NewRef(__pyx_empty_unicode); - length = stop - start; - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); + else { + d = NULL; + nd = 0; } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; } +#endif /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON @@ -23513,2536 +28601,4005 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg } #endif -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; } #endif -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) +#else + if (PyCFunction_Check(func)) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } } } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } } + } #endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); } } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + #if CYTHON_VECTORCALL + #if Py_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); + } + #endif + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); } + +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* CIntToDigits */ +static const char DIGIT_PAIRS_10[2*10*10+1] = { + "00010203040506070809" + "10111213141516171819" + "20212223242526272829" + "30313233343536373839" + "40414243444546474849" + "50515253545556575859" + "60616263646566676869" + "70717273747576777879" + "80818283848586878889" + "90919293949596979899" +}; +static const char DIGIT_PAIRS_8[2*8*8+1] = { + "0001020304050607" + "1011121314151617" + "2021222324252627" + "3031323334353637" + "4041424344454647" + "5051525354555657" + "6061626364656667" + "7071727374757677" +}; +static const char DIGITS_HEX[2*16+1] = { + "0123456789abcdef" + "0123456789ABCDEF" +}; + +/* BuildPyUnicode */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char) { + PyObject *uval; + Py_ssize_t uoffset = ulength - clength; +#if CYTHON_USE_UNICODE_INTERNALS + Py_ssize_t i; +#if CYTHON_PEP393_ENABLED + void *udata; + uval = PyUnicode_New(ulength, 127); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_DATA(uval); #else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; + Py_UNICODE *udata; + uval = PyUnicode_FromUnicode(NULL, ulength); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_AS_UNICODE(uval); +#endif + if (uoffset > 0) { + i = 0; + if (prepend_sign) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); + i++; } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; + for (; i < uoffset; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); + } + } + for (i=0; i < clength; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); + } +#else + { + PyObject *sign = NULL, *padding = NULL; + uval = NULL; + if (uoffset > 0) { + prepend_sign = !!prepend_sign; + if (uoffset > prepend_sign) { + padding = PyUnicode_FromOrdinal(padding_char); + if (likely(padding) && uoffset > prepend_sign + 1) { + PyObject *tmp; + PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign); + if (unlikely(!repeat)) goto done_or_error; + tmp = PyNumber_Multiply(padding, repeat); + Py_DECREF(repeat); + Py_DECREF(padding); + padding = tmp; } + if (unlikely(!padding)) goto done_or_error; } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; + if (prepend_sign) { + sign = PyUnicode_FromOrdinal('-'); + if (unlikely(!sign)) goto done_or_error; } } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; + uval = PyUnicode_DecodeASCII(chars, clength, NULL); + if (likely(uval) && padding) { + PyObject *tmp = PyNumber_Add(padding, uval); + Py_DECREF(uval); + uval = tmp; + } + if (likely(uval) && sign) { + PyObject *tmp = PyNumber_Add(sign, uval); + Py_DECREF(uval); + uval = tmp; + } +done_or_error: + Py_XDECREF(padding); + Py_XDECREF(sign); } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); +#endif + return uval; +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(int)*3+2]; + char *dpos, *end = digits + sizeof(int)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + int remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (int) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (int) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (int) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (Py_ssize_t) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (Py_ssize_t) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (Py_ssize_t) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + assert(!last_one_off || *dpos == '0'); + dpos += last_one_off; + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} + +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + CYTHON_MAYBE_UNUSED_VAR(max_char); +#if CYTHON_PEP393_ENABLED + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); +#else + result_uval = PyUnicode_FromUnicode(NULL, result_ulength); + if (unlikely(!result_uval)) return NULL; + result_ukind = sizeof(Py_UNICODE); + kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; + result_udata = PyUnicode_AS_UNICODE(result_uval); +#endif + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); + if (unlikely(__Pyx_PyUnicode_READY(uval))) goto bad; + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030D0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif } - PyException_SetCause(value, fixed_cause); + char_pos += ulength; } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; #else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + CYTHON_UNUSED_VAR(value_count); + return PyUnicode_Join(__pyx_empty_unicode, value_tuple); #endif - } -bad: - Py_XDECREF(owned_instance); - return; } + +/* GetAttr */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); #endif + return PyObject_GetAttr(o, n); +} -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (unlikely(!j)) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } else { - num_expected = num_max; - more_or_less = "at most"; + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return sm->sq_item(o, i); + } } - if (exact) { - more_or_less = "exactly"; +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; + Py_ssize_t key_value; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (meth) { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { + } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + Py_ssize_t kwsize; +#if CYTHON_ASSUME_SAFE_MACROS + kwsize = PyTuple_GET_SIZE(kw); +#else + kwsize = PyTuple_Size(kw); + if (kwsize < 0) return 0; +#endif + if (unlikely(kwsize == 0)) + return 1; + if (!kw_allowed) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, 0); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif goto invalid_keyword; } +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < kwsize; pos++) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } +#endif + return 1; } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); - goto bad; + return 0; +#endif invalid_keyword: - PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else + PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); #endif -bad: - return -1; -} - -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } -/* IsLittleEndian */ -static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) -{ - union { - uint32_t u32; - uint8_t u8[4]; - } S; - S.u32 = 0x01020304; - return S.u8[0] == 4; +/* DivInt[Py_ssize_t] */ +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; } -/* BufferFormatCheck */ -static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, - __Pyx_BufFmt_StackElem* stack, - __Pyx_TypeInfo* type) { - stack[0].field = &ctx->root; - stack[0].parent_offset = 0; - ctx->root.type = type; - ctx->root.name = "buffer dtype"; - ctx->root.offset = 0; - ctx->head = stack; - ctx->head->field = &ctx->root; - ctx->fmt_offset = 0; - ctx->head->parent_offset = 0; - ctx->new_packmode = '@'; - ctx->enc_packmode = '@'; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->is_complex = 0; - ctx->is_valid_array = 0; - ctx->struct_alignment = 0; - while (type->typegroup == 'S') { - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = 0; - type = type->fields->type; - } +/* GetAttr3 */ +static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; } -static int __Pyx_BufFmt_ParseNumber(const char** ts) { - int count; - const char* t = *ts; - if (*t < '0' || *t > '9') { - return -1; - } else { - count = *t++ - '0'; - while (*t >= '0' && *t <= '9') { - count *= 10; - count += *t++ - '0'; +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r; +#if CYTHON_USE_TYPE_SLOTS + if (likely(PyString_Check(n))) { + r = __Pyx_PyObject_GetAttrStrNoError(o, n); + if (unlikely(!r) && likely(!PyErr_Occurred())) { + r = __Pyx_NewRef(d); } + return r; } - *ts = t; - return count; +#endif + r = PyObject_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); } -static int __Pyx_BufFmt_ExpectNumber(const char **ts) { - int number = __Pyx_BufFmt_ParseNumber(ts); - if (number == -1) - PyErr_Format(PyExc_ValueError,\ - "Does not understand character buffer dtype format string ('%c')", **ts); - return number; + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; } -static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - PyErr_Format(PyExc_ValueError, - "Unexpected format string character: '%c'", ch); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; } -static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { - switch (ch) { - case '?': return "'bool'"; - case 'c': return "'char'"; - case 'b': return "'signed char'"; - case 'B': return "'unsigned char'"; - case 'h': return "'short'"; - case 'H': return "'unsigned short'"; - case 'i': return "'int'"; - case 'I': return "'unsigned int'"; - case 'l': return "'long'"; - case 'L': return "'unsigned long'"; - case 'q': return "'long long'"; - case 'Q': return "'unsigned long long'"; - case 'f': return (is_complex ? "'complex float'" : "'float'"); - case 'd': return (is_complex ? "'complex double'" : "'double'"); - case 'g': return (is_complex ? "'complex long double'" : "'long double'"); - case 'T': return "a struct"; - case 'O': return "Python object"; - case 'P': return "a pointer"; - case 's': case 'p': return "a string"; - case 0: return "end"; - default: return "unparseable format string"; - } +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); } -static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return 2; - case 'i': case 'I': case 'l': case 'L': return 4; - case 'q': case 'Q': return 8; - case 'f': return (is_complex ? 8 : 4); - case 'd': return (is_complex ? 16 : 8); - case 'g': { - PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); - return 0; +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* RaiseTooManyValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseNoneIterError */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} + +/* GetTopmostException */ +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; } - case 'O': case 'P': return sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + return exc_info; +} +#endif + +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #endif } -static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(short); - case 'i': case 'I': return sizeof(int); - case 'l': case 'L': return sizeof(long); - #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(PY_LONG_LONG); +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; #endif - case 'f': return sizeof(float) * (is_complex ? 2 : 1); - case 'd': return sizeof(double) * (is_complex ? 2 : 1); - case 'g': return sizeof(long double) * (is_complex ? 2 : 1); - case 'O': case 'P': return sizeof(void*); - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; - } - } + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif } -typedef struct { char c; short x; } __Pyx_st_short; -typedef struct { char c; int x; } __Pyx_st_int; -typedef struct { char c; long x; } __Pyx_st_long; -typedef struct { char c; float x; } __Pyx_st_float; -typedef struct { char c; double x; } __Pyx_st_double; -typedef struct { char c; long double x; } __Pyx_st_longdouble; -typedef struct { char c; void *x; } __Pyx_st_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif - case 'f': return sizeof(__Pyx_st_float) - sizeof(float); - case 'd': return sizeof(__Pyx_st_double) - sizeof(double); - case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); } -} -/* These are for computing the padding at the end of the struct to align - on the first member of the struct. This will probably the same as above, - but we don't have any guarantees. - */ -typedef struct { short x; char c; } __Pyx_pad_short; -typedef struct { int x; char c; } __Pyx_pad_int; -typedef struct { long x; char c; } __Pyx_pad_long; -typedef struct { float x; char c; } __Pyx_pad_float; -typedef struct { double x; char c; } __Pyx_pad_double; -typedef struct { long double x; char c; } __Pyx_pad_longdouble; -typedef struct { void *x; char c; } __Pyx_pad_void_p; -#ifdef HAVE_LONG_LONG -typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); #endif -static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { - switch (ch) { - case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; - case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); - case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); - case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); -#ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) #endif - case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); - case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); - case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); - case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); - default: - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; } -static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { - switch (ch) { - case 'c': - return 'H'; - case 'b': case 'h': case 'i': - case 'l': case 'q': case 's': case 'p': - return 'I'; - case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': - return 'U'; - case 'f': case 'd': case 'g': - return (is_complex ? 'C' : 'R'); - case 'O': - return 'O'; - case 'P': - return 'P'; - default: { - __Pyx_BufFmt_RaiseUnexpectedChar(ch); - return 0; + +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif } - } + #elif CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; } -static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { - if (ctx->head == NULL || ctx->head->field == &ctx->root) { - const char* expected; - const char* quote; - if (ctx->head == NULL) { - expected = "end"; - quote = ""; - } else { - expected = ctx->head->field->type->name; - quote = "'"; - } - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected %s%s%s but got %s", - quote, expected, quote, - __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); - } else { - __Pyx_StructField* field = ctx->head->field; - __Pyx_StructField* parent = (ctx->head - 1)->field; - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", - field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), - parent->type->name, field->name); - } +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; } -static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { - char group; - size_t size, offset, arraysize = 1; - if (ctx->enc_type == 0) return 0; - if (ctx->head->field->type->arraysize[0]) { - int i, ndim = 0; - if (ctx->enc_type == 's' || ctx->enc_type == 'p') { - ctx->is_valid_array = ctx->head->field->type->ndim == 1; - ndim = 1; - if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { - PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %zu", - ctx->head->field->type->arraysize[0], ctx->enc_count); - return -1; - } +#endif + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) + goto bad; + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) + goto bad; + from_list = empty_list; } - if (!ctx->is_valid_array) { - PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", - ctx->head->field->type->ndim, ndim); - return -1; + #endif + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif + } } - for (i = 0; i < ctx->head->field->type->ndim; i++) { - arraysize *= ctx->head->field->type->arraysize[i]; +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + return module; +} + +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); } - ctx->is_valid_array = 0; - ctx->enc_count = 1; - } - group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); - do { - __Pyx_StructField* field = ctx->head->field; - __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { - size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; } else { - size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); - } - if (ctx->enc_packmode == '@') { - size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - size_t align_mod_offset; - if (align_at == 0) return -1; - align_mod_offset = ctx->fmt_offset % align_at; - if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; - if (ctx->struct_alignment == 0) - ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, - ctx->is_complex); - } - if (type->size != size || type->typegroup != group) { - if (type->typegroup == 'C' && type->fields != NULL) { - size_t parent_offset = ctx->head->parent_offset + field->offset; - ++ctx->head; - ctx->head->field = type->fields; - ctx->head->parent_offset = parent_offset; - continue; - } - if ((type->typegroup == 'H' || group == 'H') && type->size == size) { - } else { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - } - offset = ctx->head->parent_offset + field->offset; - if (ctx->fmt_offset != offset) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", - (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); - return -1; - } - ctx->fmt_offset += size; - if (arraysize) - ctx->fmt_offset += (arraysize - 1) * size; - --ctx->enc_count; - while (1) { - if (field == &ctx->root) { - ctx->head = NULL; - if (ctx->enc_count != 0) { - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; - } - break; - } - ctx->head->field = ++field; - if (field->type == NULL) { - --ctx->head; - field = ctx->head->field; - continue; - } else if (field->type->typegroup == 'S') { - size_t parent_offset = ctx->head->parent_offset + field->offset; - if (field->type->fields->type == NULL) continue; - field = field->type->fields; - ++ctx->head; - ctx->head->field = field; - ctx->head->parent_offset = parent_offset; - break; - } else { - break; - } + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); } - } while (ctx->enc_count); - ctx->enc_type = 0; - ctx->is_complex = 0; - return 0; + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; } -static PyObject * -__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) -{ - const char *ts = *tsp; - int i = 0, number, ndim; - ++ts; - if (ctx->new_count != 1) { - PyErr_SetString(PyExc_ValueError, - "Cannot handle repeated arrays in format string"); +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); +#endif + return imported_module; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ndim = ctx->head->field->type->ndim; - while (*ts && *ts != ')') { - switch (*ts) { - case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; - default: break; - } - number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) - return PyErr_Format(PyExc_ValueError, - "Expected a dimension of size %zu, got %d", - ctx->head->field->type->arraysize[i], number); - if (*ts != ',' && *ts != ')') - return PyErr_Format(PyExc_ValueError, - "Expected a comma in format string, got '%c'", *ts); - if (*ts == ',') ts++; - i++; + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); } - if (i != ndim) - return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", - ctx->head->field->type->ndim, i); - if (!*ts) { - PyErr_SetString(PyExc_ValueError, - "Unexpected end of format string, expected ')'"); + return module; +} +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__3; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; } - ctx->is_valid_array = 1; - ctx->new_count = 1; - *tsp = ++ts; - return Py_None; -} -static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { - int got_Z = 0; - while (1) { - switch(*ts) { - case 0: - if (ctx->enc_type != 0 && ctx->head == NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - if (ctx->head != NULL) { - __Pyx_BufFmt_RaiseExpected(ctx); - return NULL; - } - return ts; - case ' ': - case '\r': - case '\n': - ++ts; - break; - case '<': - if (!__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); - return NULL; + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); } - ctx->new_packmode = '='; - ++ts; - break; - case '>': - case '!': - if (__Pyx_Is_Little_Endian()) { - PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); - return NULL; + if (likely(!spec)) { + PyErr_Clear(); + return module; } - ctx->new_packmode = '='; - ++ts; - break; - case '=': - case '@': - case '^': - ctx->new_packmode = *ts++; - break; - case 'T': - { - const char* ts_after_sub; - size_t i, struct_count = ctx->new_count; - size_t struct_alignment = ctx->struct_alignment; - ctx->new_count = 1; - ++ts; - if (*ts != '{') { - PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); - return NULL; - } - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - ctx->enc_count = 0; - ctx->struct_alignment = 0; - ++ts; - ts_after_sub = ts; - for (i = 0; i != struct_count; ++i) { - ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); - if (!ts_after_sub) return NULL; - } - ts = ts_after_sub; - if (struct_alignment) ctx->struct_alignment = struct_alignment; + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); + } +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); +} + +/* ssize_strlen */ +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} + +/* FastTypeChecks */ +#if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; } - break; - case '}': - { - size_t alignment = ctx->struct_alignment; - ++ts; - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->enc_type = 0; - if (alignment && ctx->fmt_offset % alignment) { - ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); - } + return 0; + } + return __Pyx_InBases(a, b); +} +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; } - return ts; - case 'x': - if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; - ctx->fmt_offset += ctx->new_count; - ctx->new_count = 1; - ctx->enc_count = 0; - ctx->enc_type = 0; - ctx->enc_packmode = ctx->new_packmode; - ++ts; - break; - case 'Z': - got_Z = 1; - ++ts; - if (*ts != 'f' && *ts != 'd' && *ts != 'g') { - __Pyx_BufFmt_RaiseUnexpectedChar('Z'); - return NULL; + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; } - CYTHON_FALLTHROUGH; - case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': - case 'l': case 'L': case 'q': case 'Q': - case 'f': case 'd': case 'g': - case 'O': case 'p': - if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && - (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { - ctx->enc_count += ctx->new_count; - ctx->new_count = 1; - got_Z = 0; - ++ts; - break; + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; ienc_count = ctx->new_count; - ctx->enc_packmode = ctx->new_packmode; - ctx->enc_type = *ts; - ctx->is_complex = got_Z; - ++ts; - ctx->new_count = 1; - got_Z = 0; - break; - case ':': - ++ts; - while(*ts != ':') ++ts; - ++ts; - break; - case '(': - if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; - break; - default: - { - int number = __Pyx_BufFmt_ExpectNumber(&ts); - if (number == -1) return NULL; - ctx->new_count = (size_t)number; + } + return 0; +} +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { + if (likely(err == exc_type)) return 1; + if (likely(PyExceptionClass_Check(err))) { + if (likely(PyExceptionClass_Check(exc_type))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); + } else if (likely(PyTuple_Check(exc_type))) { + return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); + } else { } } - } + return PyErr_GivenExceptionMatches(err, exc_type); } - -/* BufferGetAndValidate */ - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (unlikely(info->buf == NULL)) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { + assert(PyExceptionClass_Check(exc_type1)); + assert(PyExceptionClass_Check(exc_type2)); + if (likely(err == exc_type1 || err == exc_type2)) return 1; + if (likely(PyExceptionClass_Check(err))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); + } + return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); } -static void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; +#endif + +/* PySequenceMultiply */ +static PyObject* __Pyx_PySequence_Multiply_Generic(PyObject *seq, Py_ssize_t mul) { + PyObject *result, *pymul = PyInt_FromSsize_t(mul); + if (unlikely(!pymul)) + return NULL; + result = PyNumber_Multiply(seq, pymul); + Py_DECREF(pymul); + return result; } -static int __Pyx__GetBufferAndValidate( - Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, - int nd, int cast, __Pyx_BufFmt_StackElem* stack) -{ - buf->buf = NULL; - if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { - __Pyx_ZeroBuffer(buf); - return -1; - } - if (unlikely(buf->ndim != nd)) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - nd, buf->ndim); - goto fail; - } - if (!cast) { - __Pyx_BufFmt_Context ctx; - __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; - } - if (unlikely((size_t)buf->itemsize != dtype->size)) { - PyErr_Format(PyExc_ValueError, - "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", - buf->itemsize, (buf->itemsize > 1) ? "s" : "", - dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); - goto fail; - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_SafeReleaseBuffer(buf); - return -1; +static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul) { +#if CYTHON_USE_TYPE_SLOTS + PyTypeObject *type = Py_TYPE(seq); + if (likely(type->tp_as_sequence && type->tp_as_sequence->sq_repeat)) { + return type->tp_as_sequence->sq_repeat(seq, mul); + } else +#endif + { + return __Pyx_PySequence_Multiply_Generic(seq, mul); + } } -/* PyDictVersioning */ - #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (unlikely(!j)) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; } -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return sm->sq_ass_item(o, i, v); + } + } #else - dictptr = _PyObject_GetDictPtr(obj); +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) +#else + if (is_list || PySequence_Check(o)) #endif + { + return PySequence_SetItem(o, i, v); } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); + +/* RaiseUnboundLocalError */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } -#endif -/* GetModuleGlobalName */ - #if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); +/* DivInt[long] */ +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__2); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + if (unlikely(!value)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); + return value; } -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; +/* HasAttr */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; } - if (likely(__Pyx_TypeCheck(obj, type))) + r = __Pyx_GetAttr(o, n); + if (!r) { + PyErr_Clear(); + return 0; + } else { + Py_DECREF(r); return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; + } } -/* DictGetItem */ - #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - if (unlikely(PyTuple_Check(key))) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) { - PyErr_SetObject(PyExc_KeyError, args); - Py_DECREF(args); - } - } else { - PyErr_SetObject(PyExc_KeyError, key); - } +/* decode_c_bytes */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( + const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { + if (unlikely((start < 0) | (stop < 0))) { + if (start < 0) { + start += length; + if (start < 0) + start = 0; } - return NULL; + if (stop < 0) + stop += length; + } + if (stop > length) + stop = length; + if (unlikely(stop <= start)) + return __Pyx_NewRef(__pyx_empty_unicode); + length = stop - start; + cstring += start; + if (decode_func) { + return decode_func(cstring, length, errors); + } else { + return PyUnicode_Decode(cstring, length, encoding, errors); + } +} + +/* IsLittleEndian */ +static CYTHON_INLINE int __Pyx_Is_Little_Endian(void) +{ + union { + uint32_t u32; + uint8_t u8[4]; + } S; + S.u32 = 0x01020304; + return S.u8[0] == 4; +} + +/* BufferFormatCheck */ +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t <= '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case '?': return "'bool'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparsable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - Py_INCREF(value); - return value; -} -#endif - -/* BufferIndexError */ - static void __Pyx_RaiseBufferIndexError(int axis) { - PyErr_Format(PyExc_IndexError, - "Out of bounds on buffer access (axis %d)", axis); } - -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } + } } +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; } -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { + CYTHON_UNUSED_VAR(is_complex); + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); #endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); +} +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case '?': case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - else { - d = NULL; - nd = 0; + } +} +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } } -#endif -#endif - -/* PyObjectCall2Args */ - static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); + } + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + } + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; + } + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; } + break; + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; } -#endif - -/* MemviewSliceInit */ - static int -__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference) +static int +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { - __Pyx_RefNannyDeclarations - int i, retval=-1; - Py_buffer *buf = &memview->view; - __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (unlikely(memviewslice->memview || memviewslice->data)) { + const char *ts = *tsp; + int i = 0, number, ndim; + ++ts; + if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, - "memviewslice is already initialized!"); - goto fail; + "Cannot handle repeated arrays in format string"); + return -1; } - if (buf->strides) { - for (i = 0; i < ndim; i++) { - memviewslice->strides[i] = buf->strides[i]; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return -1; + ndim = ctx->head->field->type->ndim; + while (*ts && *ts != ')') { + switch (*ts) { + case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; + default: break; } - } else { - Py_ssize_t stride = buf->itemsize; - for (i = ndim - 1; i >= 0; i--) { - memviewslice->strides[i] = stride; - stride *= buf->shape[i]; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return -1; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + return -1; } + if (*ts != ',' && *ts != ')') { + PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + return -1; + } + if (*ts == ',') ts++; + i++; } - for (i = 0; i < ndim; i++) { - memviewslice->shape[i] = buf->shape[i]; - if (buf->suboffsets) { - memviewslice->suboffsets[i] = buf->suboffsets[i]; - } else { - memviewslice->suboffsets[i] = -1; + if (i != ndim) { + PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + return -1; + } + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return -1; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return 0; +} +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case '\r': + case '\n': + ++ts; + break; + case '<': + if (!__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_Is_Little_Endian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; + } + break; + case '}': + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } } - } - memviewslice->memview = memview; - memviewslice->data = (char *)buf->buf; - if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { - Py_INCREF(memview); - } - retval = 0; - goto no_fail; -fail: - memviewslice->memview = 0; - memviewslice->data = 0; - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; -} -#ifndef Py_NO_RETURN -#define Py_NO_RETURN -#endif -static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { - va_list vargs; - char msg[200]; -#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) - va_start(vargs, fmt); -#else - va_start(vargs); -#endif - vsnprintf(msg, 200, fmt, vargs); - va_end(vargs); - Py_FatalError(msg); -} -static CYTHON_INLINE int -__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)++; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE int -__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)--; - PyThread_release_lock(lock); - return result; -} -static CYTHON_INLINE void -__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) -{ - int first_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) - return; - if (unlikely(__pyx_get_slice_count(memview) < 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - first_time = __pyx_add_acquisition_count(memview) == 0; - if (unlikely(first_time)) { - if (have_gil) { - Py_INCREF((PyObject *) memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_INCREF((PyObject *) memview); - PyGILState_Release(_gilstate); + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; } - } -} -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, - int have_gil, int lineno) { - int last_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (unlikely(!memview || (PyObject *) memview == Py_None)) { - memslice->memview = NULL; - return; - } - if (unlikely(__pyx_get_slice_count(memview) <= 0)) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - last_time = __pyx_sub_acquisition_count(memview) == 1; - memslice->data = NULL; - if (unlikely(last_time)) { - if (have_gil) { - Py_CLEAR(memslice->memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_CLEAR(memslice->memview); - PyGILState_Release(_gilstate); + CYTHON_FALLTHROUGH; + case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 'p': + if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && + (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { + ctx->enc_count += ctx->new_count; + ctx->new_count = 1; + got_Z = 0; + ++ts; + break; + } + CYTHON_FALLTHROUGH; + case 's': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (__pyx_buffmt_parse_array(ctx, &ts) < 0) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } - } else { - memslice->memview = NULL; } + } } -/* GetTopmostException */ - #if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; - } - return exc_info; +/* BufferGetAndValidate */ + static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (unlikely(info->buf == NULL)) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); } -#endif - -/* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); +static void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; } -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); +static int __Pyx__GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + buf->buf = NULL; + if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) { + __Pyx_ZeroBuffer(buf); + return -1; + } + if (unlikely(buf->ndim != nd)) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if (unlikely((size_t)buf->itemsize != dtype->size)) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_SafeReleaseBuffer(buf); + return -1; } -#endif -/* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } + } + return NULL; } - return 0; -} -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { - PyObject *exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + Py_INCREF(value); + return value; } #endif -/* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) -#endif -{ - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) +/* BufferIndexError */ + static void __Pyx_RaiseBufferIndexError(int axis) { + PyErr_Format(PyExc_IndexError, + "Out of bounds on buffer access (axis %d)", axis); +} + +/* PyObject_GenericGetAttrNoDict */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else - if (unlikely(PyErr_Occurred())) + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; + __Pyx_DECREF_TypeName(type_name); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); + } + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); } + Py_INCREF(descr); + #if PY_MAJOR_VERSION < 3 + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if CYTHON_USE_EXC_INFO_STACK { - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; + } } - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); + return descr; +} #endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; + +/* PyObject_GenericGetAttr */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { + if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { + return PyObject_GenericGetAttr(obj, attr_name); + } + return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); } +#endif -/* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); +/* FixUpExtensionType */ + #if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); #else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; #endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; + if (changed) + PyType_Modified(type); } #endif + return 0; } - -/* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; #endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); + +/* PyObjectCallNoArg */ + static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod */ + static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } -#if CYTHON_USE_UNICODE_INTERNALS - { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } - } #endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; + { + meth_found = 1; } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); +#endif + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); #endif + *method = attr; + return 0; } -/* DivInt[Py_ssize_t] */ - static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { - Py_ssize_t q = a / b; - Py_ssize_t r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; +/* PyObjectCallMethod0 */ + static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; } -/* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_USE_TYPE_SLOTS -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) +/* ValidateBasesTuple */ + #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_MACROS + n = PyTuple_GET_SIZE(bases); #else - if (likely(PyString_Check(n))) + n = PyTuple_Size(bases); + if (n < 0) return -1; #endif - return __Pyx_PyObject_GetAttrStr(o, n); + for (i = 1; i < n; i++) + { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); +#else + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; #endif - return PyObject_GetAttr(o, n); + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#if !CYTHON_USE_TYPE_SLOTS + if (dictoffset == 0) { + PyErr_Format(PyExc_TypeError, + "extension type '%s.200s': " + "unable to validate whether bases have a __dict__ " + "when CYTHON_USE_TYPE_SLOTS is off " + "(likely because you are building in the limited API). " + "Therefore, all extension types with multiple bases " + "must add 'cdef dict __dict__' in this compilation mode", + type_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#else + if (dictoffset == 0 && b->tp_dictoffset) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + } + return 0; } +#endif -/* GetItemInt */ - static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); +/* PyType_Ready */ + static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif return r; +#endif } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + +/* SetVTable */ + static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) #else - return PySequence_GetItem(o, i); + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) #endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyTuple_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + +/* GetVTable */ + static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); #else - return PySequence_GetItem(o, i); + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); #endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; } -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; + +/* MergeVTables */ + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i; + void** base_vtables; + __Pyx_TypeName tp_base_name; + __Pyx_TypeName base_name; + void* unknown = (void*)-1; + PyObject* bases = type->tp_bases; + int base_depth = 0; + { + PyTypeObject* base = type->tp_base; + while (base) { + base_depth += 1; + base = base->tp_base; } } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); + base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; + for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { + void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); + if (base_vtable != NULL) { + int j; + PyTypeObject* base = type->tp_base; + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; + } + if (base_vtables[j] == base_vtable) { + break; + } else if (base_vtables[j] == NULL) { + goto bad; } + base = base->tp_base; } - return m->sq_item(o, i); } } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + PyErr_Clear(); + free(base_vtables); + return 0; +bad: + tp_base_name = __Pyx_PyType_GetName(type->tp_base); + base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); + free(base_vtables); + return -1; } +#endif -/* ObjectGetItem */ - #if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr = NULL; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); - } - return NULL; +/* SetupReduce */ + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; } -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); +#else + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; } - return __Pyx_PyObject_GetIndex(obj, key); -} #endif - -/* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; + if (getstate) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); +#else + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; +#endif + if (object_getstate != getstate) { + goto __PYX_GOOD; + } + } +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); + if (likely(reduce_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); + if (likely(setstate_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } + } + PyType_Modified((PyTypeObject*)type_obj); } - if (stop < 0) - stop += length; } - if (unlikely(stop <= start)) - return __Pyx_NewRef(__pyx_empty_unicode); - length = stop - start; - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); } -} - -/* GetAttr3 */ - static PyObject *__Pyx_GetAttr3Default(PyObject *d) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - __Pyx_PyErr_Clear(); - Py_INCREF(d); - return d; -} -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r = __Pyx_GetAttr(o, n); - return (likely(r)) ? r : __Pyx_GetAttr3Default(d); -} - -/* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -/* SwapException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = *type; - exc_info->exc_value = *value; - exc_info->exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; + ret = -1; +__PYX_GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); + Py_XDECREF(object_getstate); + Py_XDECREF(getstate); +#endif + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; } #endif -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) +/* TypeImport */ + #ifndef __PYX_HAVE_RT_ImportType_3_0_2 +#define __PYX_HAVE_RT_ImportType_3_0_2 +static PyTypeObject *__Pyx_ImportType_3_0_2(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_2 check_size) +{ + PyObject *result = 0; + char warning[200]; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + PyObject *py_itemsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) +#if !CYTHON_COMPILING_IN_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_2 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_2 && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; } + return (PyTypeObject *)result; bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; + Py_XDECREF(result); + return NULL; } +#endif -/* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON -static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { - while (a) { - a = a->tp_base; - if (a == b) - return 1; - } - return b == &PyBaseObject_Type; +/* FetchSharedCythonModule */ + static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; } -static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { - PyObject *mro; - if (a == b) return 1; - mro = a->tp_mro; - if (likely(mro)) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; + +/* FetchCommonType */ + static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; } - return __Pyx_InBases(a, b); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; + return 0; +} +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { + goto bad; } + goto done; } - __Pyx_ErrRestore(exception, value, tb); - return res; + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; } #else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { + goto bad; + } + goto done; } - return res; + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; +done: + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; } #endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; itp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; } - return PyErr_GivenExceptionMatches(err, exc_type); + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; } -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { - assert(PyExceptionClass_Check(exc_type1)); - assert(PyExceptionClass_Check(exc_type2)); - if (likely(err == exc_type1 || err == exc_type2)) return 1; - if (likely(PyExceptionClass_Check(err))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); } - return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); } #endif -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; +/* CythonFunctionShared */ + static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); #endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; +} +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) +{ + CYTHON_UNUSED_VAR(closure); + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); - } + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); #endif - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + return 0; } +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#elif PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif - -/* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -/* DivInt[long] */ - static CYTHON_INLINE long __Pyx_div_long(long a, long b) { - long q = a / b; - long r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif + if (unlikely(op->func_name == NULL)) + return NULL; } - return value; + Py_INCREF(op->func_name); + return op->func_name; } - -/* HasAttr */ - static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { - PyObject *r; - if (unlikely(!__Pyx_PyBaseString_Check(n))) { +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { PyErr_SetString(PyExc_TypeError, - "hasattr(): attribute name must be string"); + "__name__ must be set to a string object"); return -1; } - r = __Pyx_GetAttr(o, n); - if (unlikely(!r)) { - PyErr_Clear(); - return 0; - } else { - Py_DECREF(r); - return 1; - } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_name, value); + return 0; } - -/* PyObject_GenericGetAttrNoDict */ - #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { - PyErr_Format(PyExc_AttributeError, +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); + if (unlikely(value == NULL || !PyUnicode_Check(value))) #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); + if (unlikely(value == NULL || !PyString_Check(value))) #endif - return NULL; + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + return 0; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { - PyObject *descr; - PyTypeObject *tp = Py_TYPE(obj); - if (unlikely(!PyString_Check(attr_name))) { - return PyObject_GenericGetAttr(obj, attr_name); +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; } - assert(!tp->tp_dictoffset); - descr = _PyType_Lookup(tp, attr_name); - if (unlikely(!descr)) { - return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_dict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; } - Py_INCREF(descr); - #if PY_MAJOR_VERSION < 3 - if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) #endif - { - descrgetfunc f = Py_TYPE(descr)->tp_descr_get; - if (unlikely(f)) { - PyObject *res = f(descr, obj, (PyObject *)tp); - Py_DECREF(descr); - return res; + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; } } - return descr; + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; } +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); +#else + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; + } #endif - -/* PyObject_GenericGetAttr */ - #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { - if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { - return PyObject_GenericGetAttr(obj, attr_name); + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); } - return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); } +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, #endif - -/* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, #else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) +{ + CYTHON_UNUSED_VAR(args); +#if PY_MAJOR_VERSION >= 3 + Py_INCREF(m->func_qualname); + return m->func_qualname; +#else + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); #endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; } - -/* PyObjectGetAttrStrNoError */ - static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults_size = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif + return (PyObject *) op; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); } #endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; } - return result; + return 0; } - -/* SetupReduce */ - static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { - int ret; - PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); - if (likely(name_attr)) { - ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); - } else { - ret = -1; - } - if (unlikely(ret < 0)) { - PyErr_Clear(); - ret = 0; - } - Py_XDECREF(name_attr); - return ret; +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); } -static int __Pyx_setup_reduce(PyObject* type_obj) { - int ret = 0; - PyObject *object_reduce = NULL; - PyObject *object_getstate = NULL; - PyObject *object_reduce_ex = NULL; - PyObject *reduce = NULL; - PyObject *reduce_ex = NULL; - PyObject *reduce_cython = NULL; - PyObject *setstate = NULL; - PyObject *setstate_cython = NULL; - PyObject *getstate = NULL; -#if CYTHON_USE_PYTYPE_LOOKUP - getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); #else - getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); - if (!getstate && PyErr_Occurred()) { - goto __PYX_BAD; + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); } -#endif - if (getstate) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); #else - object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); - if (!object_getstate && PyErr_Occurred()) { - goto __PYX_BAD; + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyObject *py_name = NULL; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); +#endif + return NULL; } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); #endif - if (object_getstate != getstate) { - goto __PYX_GOOD; + return NULL; } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; } -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", + py_name); + Py_DECREF(py_name); #else - object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); #endif - reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; - if (reduce_ex == object_reduce_ex) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; #else - object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); #endif - reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; - if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { - reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); - if (likely(reduce_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (reduce == object_reduce || PyErr_Occurred()) { - goto __PYX_BAD; - } - setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); - if (!setstate) PyErr_Clear(); - if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { - setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); - if (likely(setstate_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (!setstate || PyErr_Occurred()) { - goto __PYX_BAD; - } - } - PyType_Modified((PyTypeObject*)type_obj); - } } - goto __PYX_GOOD; -__PYX_BAD: - if (!PyErr_Occurred()) - PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); - ret = -1; -__PYX_GOOD: -#if !CYTHON_USE_PYTYPE_LOOKUP - Py_XDECREF(object_reduce); - Py_XDECREF(object_reduce_ex); - Py_XDECREF(object_getstate); - Py_XDECREF(getstate); #endif - Py_XDECREF(reduce); - Py_XDECREF(reduce_ex); - Py_XDECREF(reduce_cython); - Py_XDECREF(setstate); - Py_XDECREF(setstate_cython); + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_MACROS + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(!argc) < 0) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); +#else + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); +#endif + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } return ret; } - -/* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size) +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { - PyObject *result = 0; - char warning[200]; - Py_ssize_t basicsize; - Py_ssize_t itemsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; - PyObject *py_itemsize; -#endif - result = PyObject_GetAttrString(module, class_name); - if (!result) - goto bad; - if (!PyType_Check(result)) { + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; - itemsize = ((PyTypeObject *)result)->tp_itemsize; + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; #else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; - py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); - if (!py_itemsize) - goto bad; - itemsize = PyLong_AsSsize_t(py_itemsize); - Py_DECREF(py_itemsize); - py_itemsize = 0; - if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (itemsize) { - if (size % alignment) { - alignment = size % alignment; - } - if (itemsize < (Py_ssize_t)alignment) - itemsize = (Py_ssize_t)alignment; + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; } - if ((size_t)(basicsize + itemsize) < size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL + 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_PyMethod_New, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, +#endif +}; +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + m->defaults_size = size; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ + static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); } - return (PyTypeObject *)result; -bad: - Py_XDECREF(result); - return NULL; + return op; } -#endif /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -26056,7 +32613,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -26078,7 +32635,8 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + #if !CYTHON_COMPILING_IN_LIMITED_API +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -26156,17 +32714,99 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + PyErr_Clear(); + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #endif +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + py_funcname = PyUnicode_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -26201,6 +32841,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -26263,13 +32904,19 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + __Pyx_TypeName obj_type_name; if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags); if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags); - PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' does not have the buffer interface", + obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { @@ -26344,19 +32991,6 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, return (start1 < end2) && (start2 < end1); } -/* Capsule */ - static CYTHON_INLINE PyObject * -__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) -{ - PyObject *cobj; -#if PY_VERSION_HEX >= 0x02070000 - cobj = PyCapsule_New(p, sig, NULL); -#else - cobj = PyCObject_FromVoidPtr(p, NULL); -#endif - return cobj; -} - /* TypeInfoCompare */ static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) @@ -26453,8 +33087,9 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) return 0; } static int -__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec) +__pyx_check_suboffsets(Py_buffer *buf, int dim, int ndim, int spec) { + CYTHON_UNUSED_VAR(ndim); if (spec & __Pyx_MEMVIEW_DIRECT) { if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { PyErr_Format(PyExc_ValueError, @@ -26739,119 +33374,13 @@ static int __Pyx_ValidateAndInit_memviewslice( return result; } -/* Print */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static PyObject *__Pyx_GetStdout(void) { - PyObject *f = PySys_GetObject((char *)"stdout"); - if (!f) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); - } - return f; -} -static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - int i; - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { - PyObject* v; - if (PyFile_SoftSpace(f, 1)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - v = PyTuple_GET_ITEM(arg_tuple, i); - if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - goto error; - if (PyString_Check(v)) { - char *s = PyString_AsString(v); - Py_ssize_t len = PyString_Size(v); - if (len > 0) { - switch (s[len-1]) { - case ' ': break; - case '\f': case '\r': case '\n': case '\t': case '\v': - PyFile_SoftSpace(f, 0); - break; - default: break; - } - } - } - } - if (newline) { - if (PyFile_WriteString("\n", f) < 0) - goto error; - PyFile_SoftSpace(f, 0); - } - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; -} -#else -static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { - PyObject* kwargs = 0; - PyObject* result = 0; - PyObject* end_string; - if (unlikely(!__pyx_print)) { - __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print); - if (!__pyx_print) - return -1; - } - if (stream) { - kwargs = PyDict_New(); - if (unlikely(!kwargs)) - return -1; - if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0)) - goto bad; - if (!newline) { - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - goto bad; - if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - goto bad; - } - Py_DECREF(end_string); - } - } else if (!newline) { - if (unlikely(!__pyx_print_kwargs)) { - __pyx_print_kwargs = PyDict_New(); - if (unlikely(!__pyx_print_kwargs)) - return -1; - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - return -1; - if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - return -1; - } - Py_DECREF(end_string); - } - kwargs = __pyx_print_kwargs; - } - result = PyObject_Call(__pyx_print, arg_tuple, kwargs); - if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) - Py_DECREF(kwargs); - if (!result) - return -1; - Py_DECREF(result); - return 0; -bad: - if (kwargs != __pyx_print_kwargs) - Py_XDECREF(kwargs); - return -1; -} -#endif - /* MemviewDtypeToObject */ static CYTHON_INLINE PyObject *__pyx_memview_get_char(const char *itemp) { return (PyObject *) __Pyx_PyInt_From_char(*(char *) itemp); } static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj) { char value = __Pyx_PyInt_As_char(obj); - if ((value == (char)-1) && PyErr_Occurred()) + if (unlikely((value == (char)-1) && PyErr_Occurred())) return 0; *(char *) itemp = value; return 1; @@ -26863,14 +33392,14 @@ static CYTHON_INLINE int __pyx_memview_set_char(const char *itemp, PyObject *obj } static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) { int value = __Pyx_PyInt_As_int(obj); - if ((value == (int)-1) && PyErr_Occurred()) + if (unlikely((value == (int)-1) && PyErr_Occurred())) return 0; *(int *) itemp = value; return 1; } /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); @@ -26890,7 +33419,7 @@ static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -27024,7 +33553,7 @@ static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) #endif /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); @@ -27044,7 +33573,7 @@ static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus) #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -27244,6 +33773,141 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return new_mvs; } +/* MemviewSliceInit */ + static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (unlikely(memviewslice->memview || memviewslice->data)) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF(memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} +#ifndef Py_NO_RETURN +#define Py_NO_RETURN +#endif +static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { + va_list vargs; + char msg[200]; +#if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES) + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int_type *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + return; + } + old_acquisition_count = __pyx_add_acquisition_count(memview); + if (unlikely(old_acquisition_count <= 0)) { + if (likely(old_acquisition_count == 0)) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count+1, lineno); + } + } +} +static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + __pyx_nonatomic_int_type old_acquisition_count; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (unlikely(!memview || (PyObject *) memview == Py_None)) { + memslice->memview = NULL; + return; + } + old_acquisition_count = __pyx_sub_acquisition_count(memview); + memslice->data = NULL; + if (likely(old_acquisition_count > 1)) { + memslice->memview = NULL; + } else if (likely(old_acquisition_count == 1)) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); + } + } else { + __pyx_fatalerror("Acquisition count is %d (line %d)", + old_acquisition_count-1, lineno); + } +} + /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -27257,7 +33921,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -27271,40 +33935,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -27317,109 +33986,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -27473,8 +34214,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } @@ -27511,8 +34276,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(char), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(char)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } @@ -27529,7 +34318,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(char) < sizeof(long)) { + if ((sizeof(char) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -27543,40 +34332,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0]) - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) { - return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) { + return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) { - return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) { + return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) { - return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) { + return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -27589,109 +34383,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(char) <= sizeof(unsigned long)) { + if ((sizeof(char) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (char) 0; - case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0]) - case -2: - if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(char) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 2: + if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -3: + if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(char) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 3: + if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case -4: + if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(char) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) { - return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + break; + case 4: + if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) { + return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(char) <= sizeof(long)) { + if ((sizeof(char) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (char) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (char) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (char) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (char) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (char) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((char) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (char) -1; } } else { @@ -27745,8 +34611,32 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; + from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); + if (!from_bytes) return NULL; + py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); + if (!py_bytes) goto limited_bad; + order_str = PyUnicode_FromString(little ? "little" : "big"); + if (!order_str) goto limited_bad; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(from_bytes); + Py_XDECREF(py_bytes); + Py_XDECREF(order_str); + Py_XDECREF(arg_tuple); + Py_XDECREF(kwds); + return result; +#endif } } @@ -27763,7 +34653,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -27777,40 +34667,45 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -27823,109 +34718,181 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -27946,40 +34913,19 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (long) -1; } -/* PrintOne */ - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static int __Pyx_PrintOne(PyObject* f, PyObject *o) { - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - if (PyFile_SoftSpace(f, 0)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; +/* FormatTypeName */ + #if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name_2); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__45); } - if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) - goto error; - if (PyFile_WriteString("\n", f) < 0) - goto error; - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; - /* the line below is just to avoid C compiler - * warnings about unused functions */ - return __Pyx_Print(f, NULL, 0); -} -#else -static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { - int res; - PyObject* arg_tuple = PyTuple_Pack(1, o); - if (unlikely(!arg_tuple)) - return -1; - res = __Pyx_Print(stream, arg_tuple, 1); - Py_DECREF(arg_tuple); - return res; + return name; } #endif @@ -28013,7 +34959,7 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { rtversion[i] = rt_from_call[i]; } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -28022,9 +34968,31 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { } /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + #if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -28032,23 +35000,11 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -28110,7 +35066,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -28139,22 +35095,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -28220,13 +35180,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -28294,4 +35252,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/newanalysis/voro/voro.pyx b/newanalysis/voro/voro.pyx index 7b91642..829130d 100644 --- a/newanalysis/voro/voro.pyx +++ b/newanalysis/voro/voro.pyx @@ -86,7 +86,7 @@ def calcTessellation(np.ndarray[np.float64_t,ndim=2, mode="c"] xyz, float boxlen cdef float* cfa cdef int i, j, nsurr, ncore = len(corelist), mindist, dist, icore, isurr if (vols is not None and fa is None) or (vols is None and fa is not None): - print "ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!" + print("ERROR: Either pass vols AND fa or neither of them! Neither volumes nor face areas were calculated!") if vols is not None: cvols = vols.data if fa is not None: @@ -250,7 +250,7 @@ def calcCN(np.ndarray[np.int32_t,ndim=2] ds, if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: ctr+=1 if ctr >= nmax: - print "Result array is too short!\n" + print("Result array is too short!\n") else: cres[ctr]+=1 @@ -287,7 +287,7 @@ def calcCN_int8(np.ndarray[np.int8_t,ndim=2] ds, if cds[i*n+j]>=sh1 and cds[i*n+j]<=sh2: ctr+=1 if ctr >= nmax: - print "Result array is too short!\n" + print("Result array is too short!\n") else: cres[ctr]+=1